2012-01-13 19:01:00 +00:00
|
|
|
#
|
|
|
|
# \brief Test for using the GDB monitor
|
|
|
|
# \author Christian Prochaska
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2011-05-24
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
|
|
|
|
2017-02-25 22:58:37 +00:00
|
|
|
set build_components {
|
2019-01-03 17:01:49 +00:00
|
|
|
core init timer
|
|
|
|
drivers/uart
|
2012-01-13 19:01:00 +00:00
|
|
|
app/gdb_monitor
|
|
|
|
test/gdb_monitor
|
|
|
|
}
|
|
|
|
|
2017-02-25 22:58:37 +00:00
|
|
|
lappend build_components "lib/gdbserver_platform-$::env(KERNEL)"
|
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
2012-01-13 19:01:00 +00:00
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate config
|
|
|
|
#
|
|
|
|
|
|
|
|
set config {
|
|
|
|
<config verbose="yes">
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
2017-05-29 14:50:12 +00:00
|
|
|
<default caps="100"/>
|
2012-01-13 19:01:00 +00:00
|
|
|
<start name="timer">
|
2016-05-17 14:13:23 +00:00
|
|
|
<resource name="RAM" quantum="2M"/>
|
2012-01-13 19:01:00 +00:00
|
|
|
<provides> <service name="Timer"/> </provides>
|
|
|
|
</start>
|
|
|
|
<start name="uart_drv">
|
2016-05-17 14:13:23 +00:00
|
|
|
<resource name="RAM" quantum="2M"/>
|
2012-01-13 19:01:00 +00:00
|
|
|
<provides> <service name="Terminal"/> </provides>
|
|
|
|
<config>
|
2016-11-24 14:28:32 +00:00
|
|
|
<policy label_prefix="gdb_monitor" uart="1"/>
|
2012-01-13 19:01:00 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
2017-05-29 14:50:12 +00:00
|
|
|
<start name="gdb_monitor" caps="200">
|
2017-11-27 12:20:11 +00:00
|
|
|
<resource name="RAM" quantum="8M"/>
|
2012-04-23 12:44:28 +00:00
|
|
|
<config>
|
2014-04-14 09:57:22 +00:00
|
|
|
<target name="test-gdb_monitor">
|
|
|
|
<config>
|
2017-05-29 14:50:12 +00:00
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
2014-04-14 09:57:22 +00:00
|
|
|
</config>
|
|
|
|
</target>
|
2017-11-27 12:20:11 +00:00
|
|
|
<preserve name="RAM" quantum="4M"/>
|
2017-05-29 14:50:12 +00:00
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
2012-04-23 12:44:28 +00:00
|
|
|
</config>
|
2012-01-13 19:01:00 +00:00
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
2017-02-25 22:58:37 +00:00
|
|
|
# evaluated by the run tool
|
|
|
|
proc binary_name_gdbserver_platform_lib_so { } {
|
|
|
|
return "gdbserver_platform-$::env(KERNEL).lib.so"
|
|
|
|
}
|
|
|
|
|
2012-01-13 19:01:00 +00:00
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
|
|
|
core init timer
|
2018-04-23 08:49:21 +00:00
|
|
|
ld.lib.so libc.lib.so vfs.lib.so libm.lib.so posix.lib.so
|
2017-05-14 19:55:57 +00:00
|
|
|
libc_pipe.lib.so libc_terminal.lib.so
|
2012-01-13 19:01:00 +00:00
|
|
|
uart_drv
|
2017-02-25 22:58:37 +00:00
|
|
|
gdb_monitor gdbserver_platform.lib.so test-gdb_monitor
|
2012-01-13 19:01:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
#
|
|
|
|
# Execute test case
|
|
|
|
#
|
|
|
|
#
|
|
|
|
set local_port 5555
|
|
|
|
|
|
|
|
# qemu config
|
2017-05-23 13:05:55 +00:00
|
|
|
append qemu_args " -nographic "
|
2012-01-13 19:01:00 +00:00
|
|
|
|
|
|
|
# connect comport 0 to stdio
|
|
|
|
append qemu_args " -serial mon:stdio "
|
|
|
|
|
|
|
|
# connect comport 1 with TCP port $local_port
|
|
|
|
append qemu_args " -serial chardev:uart "
|
2016-05-17 14:13:23 +00:00
|
|
|
append qemu_args " -chardev socket,id=uart,port=$local_port,host=localhost,server,nowait,ipv4 "
|
2012-01-13 19:01:00 +00:00
|
|
|
|
|
|
|
run_genode_until {.*Remote debugging using /dev/terminal.*} 30
|
|
|
|
|
|
|
|
puts "GDB monitor is up, starting GDB in a new terminal"
|
|
|
|
|
2014-05-07 09:48:19 +00:00
|
|
|
source ${genode_dir}/repos/ports/run/gdb_monitor.inc
|
2013-09-04 10:25:28 +00:00
|
|
|
|
2017-05-29 14:50:12 +00:00
|
|
|
# GDB loads symbols from 'debug/ld.lib.so'
|
2017-01-04 10:38:39 +00:00
|
|
|
if { [have_spec nova] } {
|
2017-05-29 14:50:12 +00:00
|
|
|
exec ln -sf ld-nova.lib.so debug/ld.lib.so
|
2017-01-04 10:38:39 +00:00
|
|
|
}
|
|
|
|
if { [have_spec foc] } {
|
2017-05-29 14:50:12 +00:00
|
|
|
exec ln -sf ld-foc.lib.so debug/ld.lib.so
|
2017-01-04 10:38:39 +00:00
|
|
|
}
|
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
set gdb_target_binary "test-gdb_monitor"
|
|
|
|
|
2012-01-13 19:01:00 +00:00
|
|
|
# sequence of GDB commands to execute at startup
|
|
|
|
set gdb_cmds ""
|
|
|
|
append gdb_cmds "-ex \"target remote localhost:$local_port\" "
|
|
|
|
|
2017-01-04 10:38:39 +00:00
|
|
|
append gdb_cmds [gdb_initial_breakpoint_cmds $gdb_target_binary]
|
2012-01-13 19:01:00 +00:00
|
|
|
|
|
|
|
# ask the user for confirmations again
|
|
|
|
append gdb_cmds {-ex "set interactive-mode auto" }
|
|
|
|
|
2017-05-29 14:50:12 +00:00
|
|
|
puts "command: [gdb] debug/ld.lib.so $gdb_cmds"
|
2012-01-13 19:01:00 +00:00
|
|
|
|
2017-05-29 14:50:12 +00:00
|
|
|
exec [terminal] -e "[gdb] debug/ld.lib.so $gdb_cmds" &
|
2012-01-13 19:01:00 +00:00
|
|
|
|
2015-02-06 12:24:28 +00:00
|
|
|
interact -i [output_spawn_id]
|
2012-01-13 19:01:00 +00:00
|
|
|
|
|
|
|
# vi: set ft=tcl :
|