debugging VFS plugins with monitor
Christian Prochaska
christian.prochaska at genode-labs.com
Tue Sep 26 15:51:37 CEST 2023
Hi Pirmin,
I think the following part of 'monitor_gdb.run' is probably relevant for your setup too:
----------
# don't ask for y/n when loading a new symbol file
append gdb_cmds {-ex "set interactive-mode off" }
# set search path for shared libraries
append gdb_cmds {-ex "set solib-search-path debug" }
# set a breakpoint in the 'binary_ready_hook_for_gdb' function
append gdb_cmds {-ex "b binary_ready_hook_for_gdb" }
# continue execution until the breakpoint triggers
append gdb_cmds {-ex "c" }
# delete the 'binary_ready_hook_for_gdb' breakpoint
append gdb_cmds {-ex "delete 1" }
# switch to the 'ep' thread
append gdb_cmds {-ex "thread 2" }
# load the symbols of the test application
append gdb_cmds "-ex \"file debug/test-monitor_gdb\" "
----------
These commands set a breakpoint in ld.lib.so which triggers when the 'test-monitor_gdb' binary
has been loaded into memory and then GDB switches to that file and breakpoint addresses
in the binary or shared libraries should be found without having to manually add more symbol files
with load addresses, I think.
Christian
On 26.09.23 15:09, Duss Pirmin wrote:
> Hello Genodians
>
> I really like the new monitor component, it is really easy to use.
>
> For a first real world application, I'm trying to debug why run/vfs_tresor_init fails after the update of openssl. For this I
> changed the run script so that I can run it on QEMU.
>
> I can connect to the monitor as described in run/monitor_gdb.
>
> What doesn't work with run/vfs_tresor_init is stopping the program execution at break-points. As this works in run/monitor_gdb I
> assume, that I have overlooked something in my configuration.
>
> To automate startup of gdb I created the following /data/genode/build/x86_64/debug/.gdbinit:
>
> ! set non-stop on
> ! set style enabled on
> !
> ! set solib-search-path /data/genode/build/x86_64/debug/
> ! set debug-file-directory /data/genode/build/x86_64/debug/
> !
> ! # connect to monitor running inside QEMU
> ! target extended-remote localhost:5555
> !
> ! # add libraries/binary as needed (for symbols)
> ! add-symbol-file ld.lib.so 0x30000
> ! add-symbol-file libc.lib.so 0x10d43000
> ! add-symbol-file libcrypto.lib.so 0x1038000
> ! add-symbol-file vfs.lib.so 0x10f5c000
> ! add-symbol-file vfs_jitterentropy.lib.so 0x10f51000
> ! add-symbol-file vfs_tresor_trust_anchor.lib.so 0x10f26000
> !
> ! add-symbol-file vfs
> !
> ! #set breakpoints
> ! b /data/genode/repos/os/src/server/vfs/main.cc:1000
> ! b /data/genode/repos/gems/src/lib/vfs/tresor_trust_anchor/vfs.cc:2022
> !
> ! # select the first component that is monitored
> ! inferior 1
>
> The addresses for the libraries I took from the ld_verbose output of a previous run.
>
> I execute gdb as follows:
> ! cd /data/genode/build/x86_64/debug
> ! /usr/local/genode/tool/23.05/bin/genode-x86-gdb ld.lib.so
>
> When I run info breakpoints I get the following output:
> ! 1 breakpoint keep y <PENDING> /data/.../vfs/main.cc:1000
> ! 2 breakpoint keep y <PENDING> /data/.../vfs.cc:2022
>
> With run/monitor_gdb, it reports an address instead of <PENDING>.
>
> Does anybody have an idea what I'm doing wrong? Or is there a limitation I'm not aware of?
>
> Regards Pirmin
>
> _______________________________________________
> Genode users mailing list
> users at lists.genode.org
> https://lists.genode.org/listinfo/users
More information about the users
mailing list