Re: RFC: MI output during program execution

Nick Roberts
2005-09-19T10:30:22Z

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 2705 bytes --]

> I've started a merge on current CVS (for some reason gdb-413 seemed to
> include everything except the GDB source). Getting MI output during
> program execution seems to be closely related to making GDB asynchronous.
> I couldn't attempt such a task on my own but, using the Apple code as a
> prototype, it doesn't look too difficult. When I have something working
> perhaps I could put it on a branch.

I now have something that works for GNU/Linux (probably under limited
conditions). With MI it now picks up mi_exec_async_cli_cmd_continuation to
print the *stopped record, even with CLI commands like "run":

(gdb)
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080484c5",func="main",file="myprog.c",line="55",times="0"}
(gdb)
-interpreter-exec console run
Switching to interpreter "console".
(gdb) Starting program: /home/nickrob/myprog
^running
(gdb)
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080484c5",func="main",args=[{name="argc",value="1"},{name="argv",value="0xfee72c74"}],file="myprog.c",fullname="/home/nickrob/myprog.c",line="55"}
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x080484d7",func="main",args=[{name="argc",value="1"},{name="argv",value="0xfee72c74"}],file="myprog.c",fullname="/home/nickrob/myprog.c",line="56"}

Such asynchronous behaviour should also help with event notification which
Apple's code also has, but which I have not tried to merge for the moment.

I've changed the files:

cli-interp.c infcmd.c mi-interp.c
defs.h inf-loop.c mi-main.c
event-loop.c inf-ptrace.c mi-main.h
event-loop.h infrun.c target.c
event-top.c interps.c target.h
event-top.h interps.h top.c
exec.c linux-nat.c tui-hooks.c
i386-linux-nat.c linux-thread-db.c wrapper.h
inf-child.c Makefile.in

and added four new ones:

async-nat-inferior.c
async-nat-inferior.h
async-nat-sigthread.c
async-nat-sigthread.h

derived from their macosx-*-*.* counterparts.

Some files had to be changed e.g event-loop.c, event-top.c, inf-loop.c.
Others should probably have been changed elsewhere with different target
methods e.g i386-linux-nat.c linux-thread-db.c. This is just a starting
point.

I attach the new files and a set of diffs against HEAD from about 20:00 NZST
(+12 GMT) Sept 19 2005, for anyone who might like to test the functionality.
If I am given approval to commit these changes to a branch then I will create
ChangeLog entries (attributed to Apple).

I presume there is more freedom to committing on a non-release branch. What
are the rules?

Nick

[-- Attachment #2: asynchronous GDB --]
[-- Type: application/octet-stream, Size: 24705 bytes --]