This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: gdb.execute can not put string value.
Type: behavior Stage: resolved
Components: macOS Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, callmekohei, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2018-01-11 05:24 by callmekohei, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg309791 - (view) Author: callmekohei (callmekohei) Date: 2018-01-11 05:24
Hello! I'm callmekohei! (^_^)/


------------------------
   Problems summary
------------------------

gdb.execute can not put string value.


------------------------
   Steps to Reproduce
------------------------

// create 
$ gcc -g foo.c

// launch sdb
$ sdb a.out

// set breakpoint
$ b foo.c:5

// run
$ run

// next
$ n


------------------------
   Current Behavior
------------------------

(gdb)  n
6	    n = 2;
False
True


------------------------
   Expected Behavior
------------------------

(gdb)  n
False
False


------------------------
   Code 
------------------------

// .gdbinit

set startup-with-shell off

python

class Foo(gdb.Command):

    def __init__(self):
        gdb.Command.__init__(self                     \
                , name            = 'n'               \
                , command_class   = gdb.COMMAND_USER  \
                , completer_class = gdb.COMPLETE_NONE \
                , prefix          = True)

    def invoke(self, arg, from_tty):
        output = gdb.execute(command='next',from_tty=False, to_string=True)
        print(output is None)
        print(output == '')

Foo()

end


// foo.c

#include <stdio.h>

int main(int argc, char *args[])
{
    int n = 1;
    n = 2;
    n = 3;
    n = 4;
    n = 5;
    n = 6;
    n = 7;
    n = 8;
    n = 9;
    printf("n = %d\n",n);
    return 0;
}


------------------------
   Others 
------------------------

see also:

https://github.com/mono/sdb/issues/45
msg339263 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2019-03-31 15:59
gdb.execute() is part of GDB's Python API and maintained by GDB maintainers. This tracker is for issues with Python interpreter and its standard library.
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76712
2019-03-31 15:59:50berker.peksagsethgrepos: - hgrepo377
2019-03-31 15:59:45berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg339263

resolution: not a bug
stage: resolved
2018-01-11 05:24:06callmekoheicreate