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

Created on 2018-01-11 05:24 by callmekohei, last changed 2018-01-11 05:24 by callmekohei.

Repositories containing patches
https://github.com/mono/sdb/issues/45
Messages (1)
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
History
Date User Action Args
2018-01-11 05:24:06callmekoheicreate