Remote GDB debugging - can't acces source file but no errors printed -


i'm trying remotely debug application using gdb command line. path in gdb run on pc build path of application. contains amixer executable , amixer.c.

the code compiled -g -o2 parameters.

the debug symbols seem present:

$ readelf -ws amixer there 38 section headers, starting @ offset 0x1d24c: ...   [27] .debug_aranges    progbits        00000000 00a758 000140 00      0   0  8   [28] .debug_info       progbits        00000000 00a898 008c59 00      0   0  1   [29] .debug_abbrev     progbits        00000000 0134f1 00085a 00      0   0  1   [30] .debug_line       progbits        00000000 013d4b 001a8c 00      0   0  1   [31] .debug_frame      progbits        00000000 0157d8 000494 00      0   0  4   [32] .debug_str        progbits        00000000 015c6c 001f75 01  ms  0   0  1   [33] .debug_loc        progbits        00000000 017be1 004dff 00      0   0  1   [34] .debug_ranges     progbits        00000000 01c9e0 000700 00      0   0  1 

steps on remote device (stripped binary):

gdbserver 192.16.6.21:12345 amixer 

steps on pc (binary here not stripped):

$ gdb amixer (gdb) set sysroot /correct/path/to/remote/device/sysroot (gdb) target remote 192.16.6.12:12345 (gdb) break main  breakpoint 1 @ 0x11f58 (gdb) list main    (gdb) show directories  source directories searched: $cdir:$cwd (gdb) continues ...program executes on remote device...  

assumptions i've made:

  • break main doesn't throw error executable debug symbols available. expect see source file mentioned here already. in example: breakpoint 1 @ 0x62f4: file builtin.c, line 879.
  • there .debug* in output of readelf -ws amixer debug symbols present
  • list main doesn't list source of main function. isn't right

  • show directories list $cdir , $cwd i'm guessing @ least on of them directory i've started gdb amixer , build directory both executables , sources

i'm doing wrong looking review of assumptions , debugging tips.

break main doesn't throw error executable debug symbols available.

you mistaken: fact break main not show errors not imply debug symbols available. , rest of output consistent debug symbols not being available.

so first step should confirm debug symbols in fact present. if readelf -ws amixer not show .debug_* or .zdebug_* sections, proof no debug info present. if so, re-check build command lines presence of -g flag on compile lines, , absence of -wl,-s or similar flag on link line.


Comments