This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/11688] wrap MI commands in python


http://sourceware.org/bugzilla/show_bug.cgi?id=11688

--- Comment #3 from matt rice <ratmice at gmail dot com> 2011-08-28 10:33:56 UTC ---
So I guess i changed my mind about working on this, with my main motivation
being that it might make an ok alternative wire format to mi for an interface,
e.g. using python on the client side with eval, dodging an mi parser
all-together... 

something like this, with print repr on the gdb side, and eval on the client
side... seems worth experimenting with anyways.

(gdb) py print eval(repr(gdb.mi_execute('break-insert', 'main')))
{'bkpt': {'disp': 'keep', 'file': 'test.c', 'number': 3, 'func': 'main',
'line': 34, 'original-location': 'main', 'addr': '0x0000000000400509',
'enabled': 'y', 'times': 0, 'fullname': '/home/ratmice/tests/test.c', 'type':
'breakpoint'}}

i've pretty much redone the python mi_execute command, to be less of a hack
and managed to coax it into outputting dictionaries, or lists instead of lists
of lists or tuples, i think its nicer...

(gdb) py stuff.append(gdb.mi_execute("break-insert", "main"))
(gdb) py x = stuff[-1]['bkpt']['number']
(gdb) py gdb.mi_execute("break-after", (x, 76))
(gdb) py print x
3
(gdb) info b 3
Num     Type           Disp Enb Address            What
3       breakpoint     keep y   0x0000000000400509 in main at test.c:34
    ignore next 76 hits

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]