gdb_monitor: improve the backtrace test

With this patch, functions which execute blocking syscalls on Fiasco.OC
are built with frame pointers to get a correct backtrace shown in GDB.

Also, the backtrace test for a thread currently executing a syscall now
traces the  'Genode::Thread_base::join()' function instead of
'Genode::sleep_forever()', because base-nova has a custom implementation
of 'Genode::sleep_forever()' with a different backtrace than on Fiasco.OC.

Fixes #1061.
This commit is contained in:
Christian Prochaska 2014-03-03 19:45:53 +01:00 committed by Christian Helmuth
parent 2ed22595ff
commit e142d0d2e8
8 changed files with 30 additions and 9 deletions

View File

@ -72,6 +72,9 @@ namespace Genode {
** Signal source interface **
*****************************/
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
Signal wait_for_signal()
{
using namespace Fiasco;

View File

@ -224,6 +224,9 @@ Ipc_ostream::Ipc_ostream(Native_capability dst, Msgbuf_base *snd_msg)
** Ipc_istream **
*****************/
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
void Ipc_istream::_wait()
{
l4_umword_t label = 0;

View File

@ -60,6 +60,9 @@ void Ipc_pager::_parse_msg_type()
}
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
void Ipc_pager::wait_for_fault()
{
l4_umword_t label;

View File

@ -79,7 +79,12 @@ static inline void thread_switch_to(Genode::Thread_base *thread_base)
/**
* Unconditionally block the calling thread
*/
static inline void thread_stop_myself()
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
__attribute__((used))
static void thread_stop_myself()
{
using namespace Fiasco;

View File

@ -224,6 +224,9 @@ Irq_session_component::~Irq_session_component() {
** Interrupt handler implemtentation **
***************************************/
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
void Interrupt_handler::entry()
{
using namespace Fiasco;

View File

@ -64,6 +64,10 @@ static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS];
/**
* Core pager "service loop"
*/
/* Build with frame pointer to make GDB backtraces work. See issue #1061. */
__attribute__((optimize("-fno-omit-frame-pointer")))
__attribute__((noinline))
static void _core_pager_loop()
{
using namespace Fiasco;

View File

@ -228,14 +228,14 @@ if {![regexp {Program received signal SIGSEGV, Segmentation fault.} $gdb_output]
exit -1
}
if {![regexp {Genode::Ipc_istream::_wait} $gdb_output] ||
![regexp {Genode::Ipc_server::_wait} $gdb_output] ||
![regexp {Genode::sleep_forever ()} $gdb_output]} {
if {![regexp {thread_stop_myself \(\)} $gdb_output] ||
![regexp {Genode::Cancelable_lock::lock \(this=} $gdb_output] ||
![regexp {Genode::Thread_base::join \(this=} $gdb_output] ||
![regexp {in main \(\)} $gdb_output]} {
puts stderr "Error: Stack trace when in syscall is not as expected"
exit -1
if {![have_spec nova]} {
puts stderr "Error: Stack trace when in syscall is not as expected"
exit -1
}
}
puts "Test succeeded"

View File

@ -89,7 +89,7 @@ int main(void)
test_thread.start();
Genode::sleep_forever();
test_thread.join();
return 0;
}