Hi all,
I'm debugging an application on base-nova and trying to get remote gdb set up for that. Using gdb on base-linux is not an option right now, as the application exposes a different issue there.
To verify that gdb works, I adapted the simple run/log example (see the attached delta). I'm using current master (f4ea50c6). When starting the run file, I see:
[snip] Genode 18.05-203-gf4ea50c6f <local changes> 469 MiB RAM and 63253 caps assigned to init [init -> uart_drv] --- UART driver started --- [init -> gdb_monitor] using the pipe libc plugin [init -> gdb_monitor] Warning: sigaction: sigaction not implemented [init -> gdb_monitor] Process target created; pid = 1 [init -> gdb_monitor] Warning: unsupported ioctl (request=0x40047477) [init -> gdb_monitor] Warning: unsupported ioctl (request=0x80047476) [init -> uart_drv] open IRQ 3 [init -> uart_drv] [init -> gdb_monitor] Remote debugging using /dev/terminal [init -> gdb_monitor] Warning: fcntl(): command 4 args 66 not supported - terminal [init -> gdb_monitor] Warning: fcntl(): command 6 args 4294967295 not supported - terminal
Then, I start gdb on the host from within the debug directory of the build:
$ ln -s ld-nova.lib.so ld.lib.so $ genode-x86-gdb test-log GNU gdb (GDB) 7.3.1 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-pc-elf". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/build/x86_64/debug/test-log...done. (gdb) target remote localhost:5555 Remote debugging using localhost:5555 Reading symbols from ld.lib.so...done. Loaded symbols for ld.lib.so warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. _start () at /home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43 43 leaq _GLOBAL_OFFSET_TABLE_(%rip), %r15 (gdb)
The Genode log says:
[init -> gdb_monitor] Warning: ptrace(PTRACE_GETREGSET (0x4204)) called - not implemented! [init -> gdb_monitor] Warning: read: no memory at address 0x1005d08 [init -> gdb_monitor] Warning: read: no memory at address 0x1005d08 [init -> gdb_monitor] Warning: read: no memory at address 0x1005d08
GDB does not seem to work correctly:
(gdb) bt #0 _start () at /home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43 Cannot access memory at address 0x0
[init -> gdb_monitor] Warning: read: no memory at address 0x0
Any ideas what's wrong here?
Cheers, Alex
Hi Alex,
On 09.08.2018 16:08, Alexander Senier wrote:
GDB does not seem to work correctly:
(gdb) bt #0 _start () at /home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43 Cannot access memory at address 0x0
[init -> gdb_monitor] Warning: read: no memory at address 0x0
Any ideas what's wrong here?
The problem could be that the binary ('test-log') has not been loaded into memory by 'ld.lib.so' yet. I would suggest to use 'ports/run/gdb_monitor_interactive.run' or 'ports/run/debug_nitpicker.run' as template for your use case. These run scripts execute some GDB commands for initialization, like breaking at 'binary_ready_hook_for_gdb()' first and then loading the symbols of the appplication and its shared libraries.
Regards, Christian
Hi Christian,
thanks for the pointer! Indeed, proper initialization was missing. When executing the following commands in gdb, the debug session works as expected:
target remote localhost:5555
set interactive-mode off break binary_ready_hook_for_gdb continue delete 1 file debug/test-log set solib-search-path debug sharedlibrary
Cheers, Alex
On 09.08.2018 16:49, Christian Prochaska wrote:
Hi Alex,
On 09.08.2018 16:08, Alexander Senier wrote:
GDB does not seem to work correctly:
(gdb) bt #0 _start () at /home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43 Cannot access memory at address 0x0
[init -> gdb_monitor] Warning: read: no memory at address 0x0
Any ideas what's wrong here?
The problem could be that the binary ('test-log') has not been loaded into memory by 'ld.lib.so' yet. I would suggest to use 'ports/run/gdb_monitor_interactive.run' or 'ports/run/debug_nitpicker.run' as template for your use case. These run scripts execute some GDB commands for initialization, like breaking at 'binary_ready_hook_for_gdb()' first and then loading the symbols of the appplication and its shared libraries.
Regards, Christian
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users