[RFC] Remote packet split out in different UI for 'new-ui' command
Muhammad Bilal
muhammad_bilal@mentor.com
Mon Feb 15 18:25:53 GMT 2021
Hi experts,
If I give gdb command from new-ui console then some gdb remote packets
go to main ui console.
i.e simple hello world remote debug
Create tty for new-ui
$ cat gdb-client
#!/bin/bash
reset
tty
tail -f /dev/null
$ ./gdb-client
/dev/pts/3
Launch gdbserver
$ gdbserver :10000 /tmp/hello
Launch gdb
$ gdb /tmp/hello -q -ex "new-ui mi /dev/pts/3" -ex "set debug remote 1"
-ex "tar rem :10000"
(gdb) tbreak main
(gdb) c
(gdb) b hello_world.c:3
Resume from new-ui mi console
(gdb)
-exec-continue
^running
*running,thread-id="all"
(gdb)
&"Sending packet: $Z0,555555555151,1#87..."
&"Packet received: OK\n"
&"Sending packet: $Z0,7ffff7fd37a5,1#e3..."
&"Packet received: OK\n"
&"Sending packet: $Z0,7ffff7fe508e,1#e6..."
&"Packet received: OK\n"
&"Sending packet: $Z0,7ffff7fe63e4,1#e6..."
&"Packet received: OK\n"
&"Sending packet: $vCont;c:p2bc5d1.-1#9f..."
=breakpoint-modified,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000555555555151",func="main",file="/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c",fullname="/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c",line="3",thread-groups=["i1"],times="1",original-location="hello_world.c:3"}
~"\n"
~"Breakpoint 5, main () at
/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c:3\n"
~"3\t\tputs(\"!!!Hello World!!!\"); /* prints !!!Hello World!!! */\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="5",frame={addr="0x0000555555555151",func="main",args=[],file="/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c",fullname="/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c",line="3",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="10"
(gdb)
Now you can see some packets also arrives in main gdb console
Sending packet: $m555555555140,40#6f...Packet received:
f30f1efae977fffffff30f1efa554889e5488d3dac0e0000e8f3feffffb8000000005dc3662e0f1f8400000000006690f30f1efa41574c8d3d3b2c0000415649
Sending packet: $m555555555151,1#3e...Packet received: 48
Breakpoint 5 at 0x555555555151: file
/var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c, line 3.
(gdb) Packet received:
T05swbreak:;06:60d7ffffff7f0000;07:60d7ffffff7f0000;10:5151555555550000;thread:p2bc5d1.2bc5d1;core:a;
Sending packet: $qXfer:threads:read::0,1000#92...Packet received:
l<threads>\n<thread id="p2bc5d1.2bc5d1" core="10"
name="hello"/>\n</threads>\n
Sending packet: $z0,555555555151,1#a7...Packet received: OK
Sending packet: $z0,7ffff7fd37a5,1#03...Packet received: OK
Sending packet: $z0,7ffff7fe508e,1#06...Packet received: OK
Sending packet: $z0,7ffff7fe63e4,1#06...Packet received: OK
Breakpoint 2, main ()
at /var/mbilal/workspace/cdt-2020-12/hello_world/src/hello_world.c:3
3 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
(gdb)
So, why GDB divide out remote packets to different console for singe
command?
This makes difficult to examine the debug packets flows in front-end gdb
(for example eclipse) where packets divide out in different console and
user need to parse both new-ui and main ui if some error come.
I see this is intentional in GDB .
/* Events are always processed with the main UI as current UI. This
way, warnings, debug output, etc. are always consistently sent to
the main console. */
scoped_restore save_ui = make_scoped_restore (¤t_ui, main_ui);
IMO, all remote packets should be on same console, from where command
executed...
Can we comment out above code or may be add some command to on|off this
behavior or do you see any regression to comment out the code ???
Thanks,
-Bilal
More information about the Gdb-patches
mailing list