From 57c4678aa1ecb2bbed7b9d6abc2d1b511e0ad8b8 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 6 Feb 2015 13:24:28 +0100 Subject: [PATCH] gdb: adapt gdb_monitor run scripts Adjustment are required due to changes of the new run tool and the new shared library implementation. Issue #1192 --- repos/ports/run/gdb_monitor.inc | 7 +++++-- repos/ports/run/gdb_monitor.run | 5 ++++- repos/ports/run/gdb_monitor_interactive.run | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/repos/ports/run/gdb_monitor.inc b/repos/ports/run/gdb_monitor.inc index 62d429b7e..026916aef 100644 --- a/repos/ports/run/gdb_monitor.inc +++ b/repos/ports/run/gdb_monitor.inc @@ -22,8 +22,8 @@ proc gdb_main_breakpoint_cmds { target_binary_name } { # load the symbols of ld.lib.so append gdb_cmds {-ex "symbol-file bin/ld.lib.so" } - # set a breakpoint in the 'call_program_main()' function - append gdb_cmds {-ex "b call_program_main" } + # set a breakpoint in the 'Linker::Binary::call_entry_point' function + append gdb_cmds {-ex "b Linker::Binary::call_entry_point" } # continue execution until the breakpoint triggers append gdb_cmds {-ex "c" } @@ -37,6 +37,9 @@ proc gdb_main_breakpoint_cmds { target_binary_name } { # set a breakpoint in the application's 'main()' function append gdb_cmds {-ex "b main()" } + # set search path for "sharedlibrary" to bin + append gdb_cmds {-ex "set solib-search-path bin" } + # load the symbols of loaded shared libraries append gdb_cmds {-ex "sharedlibrary" } diff --git a/repos/ports/run/gdb_monitor.run b/repos/ports/run/gdb_monitor.run index 33ead46e9..dbb0ae33c 100644 --- a/repos/ports/run/gdb_monitor.run +++ b/repos/ports/run/gdb_monitor.run @@ -114,6 +114,7 @@ append qemu_args " -serial chardev:uart " append qemu_args " -chardev socket,id=uart,port=$local_port,host=localhost,server,nowait " run_genode_until {.*Remote debugging using /dev/terminal.*} 30 +set genode_id [output_spawn_id] puts "GDB monitor is up, starting GDB" @@ -168,9 +169,11 @@ append gdb_cmds {-ex "q" } # run GDB and redirect stderr to stdio to get the relevant output into the expect buffer eval spawn [gdb] bin/$gdb_target_binary -n -batch $gdb_cmds 2&>1 +set gdb_id $spawn_id set timeout 120 expect { + -i [list $genode_id $gdb_id] timeout { puts stderr "Error: Test execution timed out"; exit -2 } } @@ -185,7 +188,7 @@ if {![regexp {Breakpoint 2, main ()} $gdb_output]} { exit -1 } -if {![regexp {Breakpoint 3, puts ()} $gdb_output]} { +if {![regexp {Breakpoint 3, puts (.*)} $gdb_output]} { puts "Error: Breakpoint in shared library did not trigger" exit -1 } diff --git a/repos/ports/run/gdb_monitor_interactive.run b/repos/ports/run/gdb_monitor_interactive.run index 1e6842f01..d9b36bd5a 100644 --- a/repos/ports/run/gdb_monitor_interactive.run +++ b/repos/ports/run/gdb_monitor_interactive.run @@ -123,6 +123,6 @@ puts "command: [gdb] bin/$gdb_target_binary $gdb_cmds" exec [terminal] -e "[gdb] bin/test-gdb_monitor $gdb_cmds" & -interact +interact -i [output_spawn_id] # vi: set ft=tcl :