lldb-mi icon indicating copy to clipboard operation
lldb-mi copied to clipboard

`breakpoint-hit` event doesn't respect `target.source-map` for remote target

Open brownts opened this issue 1 year ago • 0 comments

The "fullname" field in the breakpoint-hit stopped event doesn't contain the mapped path. I've captured both the lldb-mi and gdb commands and traces for comparison. Based on the mapping the /usr/src/hello_world.c source path should be mapped to /home/troy/git/hello_world_c/hello_world.c, but is instead being reported without the mapping (i.e., /usr/src/hello_world.c).

Additionally, bkptno doesn't match the actual breakpoint number either.

lldb-mi

commands
lldb-server gdbserver 0:2345 hello_world &
lldb-mi
settings append target.source-map /usr/src /home/troy/git/hello_world_c
settings show target.source-map
-target-select remote 0:2345
-break-insert -t -f main
-exec-continue
lldb-mi trace
> lldb-server gdbserver 0:2345 hello_world &
[1] 224602
Launched 'hello_world' as process 224603...
lldb-server-local_build
> lldb-mi
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb.embedded_interpreter'
(gdb)
settings append target.source-map /usr/src /home/troy/git/hello_world_c
^done
(gdb)
settings show target.source-map
~"target.source-map (path-map) =\n[0] \"/usr/src\" -> \"/home/troy/git/hello_world_c\"\n\n"
^done
(gdb)
-target-select remote 0:2345
Connection established.
^connected
=thread-group-started,id="i1",pid="224603"
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
*stopped,reason="signal-received",signal-name="SIGSTOP",signal-meaning="Stop",frame={level="0",addr="0x00007ffff7fe32b0",func="_start",file="??",fullname="??",line="-1"},thread-id="1",stopped-threads="all"
(gdb)
-break-insert -t -f main
^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",pending=["main"],times="0",addr="0x000055555555514f",func="main",file="hello_world.c",fullname="/usr/src/hello_world.c",line="8",original-location="main"}
(gdb)
-exec-continue
^running
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="0",frame={level="0",addr="0x000055555555514f",func="main",args=[],file="hello_world.c",fullname="/usr/src/hello_world.c",line="8"},thread-id="1",stopped-threads="all"
(gdb)

gdb

commands
gdbserver 0:2345 hello_world &
gdb -q --interpreter=mi2
-gdb-set substitute-path /usr/src /home/troy/git/hello_world_c
-target-select remote 0:2345
-break-insert -t -f main
-exec-continue
gdb trace
> gdbserver 0:2345 hello_world
Process /home/troy/git/hello_world_exe/hello_world created; pid = 232163
Listening on port 2345
Remote debugging from host 127.0.0.1, port 52854
> gdb -q --interpreter=mi2
=thread-group-added,id="i1"
(gdb) 
-gdb-set substitute-path /usr/src /home/troy/git/hello_world_c
^done
(gdb) 
-target-select remote 0:2345
=tsv-created,name="trace_timestamp",initial="0"
=thread-group-started,id="i1",pid="232163"
~"Reading /home/troy/git/hello_world_exe/hello_world from remote target...\n"
&"warning: File transfers from remote targets can be slow. Use \"set sysroot\" to access files locally instead.\n"
~"Reading /home/troy/git/hello_world_exe/hello_world from remote target...\n"
~"Reading symbols from target:/home/troy/git/hello_world_exe/hello_world...\n"
=thread-created,id="1",group-id="i1"
~"Reading /lib64/ld-linux-x86-64.so.2 from remote target...\n"
~"Reading /lib64/ld-linux-x86-64.so.2 from remote target...\n"
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="target:/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7fc5090",to="0x00007ffff7fee335"}]
~"Reading /usr/lib/debug/.build-id/21/a2739157f98ff49d8920f47723a6a3ddb1f4d1.debug from remote target...\n"
~"0x00007ffff7fe32b0 in _start () from target:/lib64/ld-linux-x86-64.so.2\n"
*stopped,frame={addr="0x00007ffff7fe32b0",func="_start",args=[],from="target:/lib64/ld-linux-x86-64.so.2",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1"
^connected
(gdb) 
-break-insert -t -f main
^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000055555555514f",func="main",file="hello_world.c",fullname="/home/troy/git/hello_world_c/hello_world.c",line="8",thread-groups=["i1"],times="0",original-location="main"}
(gdb) 
-exec-continue
^running
*running,thread-id="all"
(gdb) 
~"Reading /lib/x86_64-linux-gnu/libc.so.6 from remote target...\n"
=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="target:/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7da1700",to="0x00007ffff7f33abd"}]
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000055555555514f",func="main",file="hello_world.c",fullname="/home/troy/git/hello_world_c/hello_world.c",line="8",thread-groups=["i1"],times="1",original-location="main"}
~"\n"
~"Temporary breakpoint 1, main () at hello_world.c:8\n"
~"8\t  int i = 77;\n"
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000055555555514f",func="main",args=[],file="hello_world.c",fullname="/home/troy/git/hello_world_c/hello_world.c",line="8",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="2"
=breakpoint-deleted,id="1"
(gdb) 

brownts avatar Jan 04 '23 05:01 brownts