[New-bugs-announce] [issue32531] gdb.execute can not put string value.

callmekohei report at bugs.python.org
Thu Jan 11 00:24:06 EST 2018


New submission from callmekohei <callmekohei at gmail.com>:

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

----------
components: macOS
hgrepos: 377
messages: 309791
nosy: callmekohei, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: gdb.execute can not put string value.
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32531>
_______________________________________


More information about the New-bugs-announce mailing list