Hi Christian,
Thank you for your reply. Yes, this certainly makes life much easier!
Menno
On 11-12-15 13:24, Christian Prochaska wrote:
Hi Menno,
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:
- 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 used as:
extern "C" void wait_for_continue();
- execute the run script of the test scenario
The thread to be debugged should now be waiting in 'wait_for_continue()'.
- find out the thread ID of the waiting thread
The command
$ 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.
- 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>
- 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 be shown.
Hope this helps, Christian
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main