Debugging Genode applications on Ubuntu 14.04 64bit
christian.prochaska at ...1...
Fri Dec 11 13:24:30 CET 2015
on the 'linux_x86' Genode platform, we usually use the GDB of the host
Linux system for debugging. There are some limitations on the GDB
features that can be used, for example, breakpoints in shared libraries
might not work. But features like showing a backtrace usually work.
For example, if a segmentation fault occurs reproducibly in a Genode
program, I would do the following:
1) let the program pause at a time before the crash occurs
On the 'linux_x86' platform, a function 'wait_for_continue()' exists,
which waits until the user presses the Return key on the log console.
This function could be called, for example, at the beginning of
'main()'. The function must be declared in the file where it is being
extern "C" void wait_for_continue();
2) execute the run script of the test scenario
The thread to be debugged should now be waiting in 'wait_for_continue()'.
3) find out the thread ID of the waiting thread
$ ps -eLf | grep Genode
shows a list of running Genode threads. The thread ID is the last of the
three IDs shown in each row.
4) start GDB and attach it to the thread
In the 'build/linux_x86/bin' directory, run
$ gdb <name of program ELF image> -p <thread id>
5) let the program continue until the crash occurs
- in GDB, enter 'cont'
- on the Genode log console, press Return
Now, if the segmentation fault occurs, GDB stops and the backtrace can
Hope this helps,
More information about the users