mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 14:13:09 +00:00
7309bcf4b5
Fixes #3558
146 lines
3.1 KiB
Tcl
146 lines
3.1 KiB
Tcl
#
|
|
# \brief Test for using the GDB monitor
|
|
# \author Christian Prochaska
|
|
# \author Norman Feske
|
|
# \date 2011-05-24
|
|
#
|
|
|
|
if {![have_include "power_on/qemu"] ||
|
|
!([have_spec nova])} {
|
|
puts "Run script is only supported for NOVA in Qemu"; exit 0
|
|
}
|
|
|
|
#
|
|
# Build
|
|
#
|
|
|
|
set build_components {
|
|
core init timer
|
|
drivers/uart
|
|
app/gdb_monitor
|
|
test/gdb_monitor
|
|
}
|
|
|
|
lappend build_components "lib/gdbserver_platform-$::env(KERNEL)"
|
|
|
|
build $build_components
|
|
|
|
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>
|
|
<default caps="100"/>
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides> <service name="Timer"/> </provides>
|
|
</start>
|
|
<start name="pc_uart_drv">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides> <service name="Terminal"/> </provides>
|
|
<config>
|
|
<policy label_prefix="gdb_monitor" uart="1"/>
|
|
</config>
|
|
</start>
|
|
<start name="gdb_monitor" caps="200">
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config>
|
|
<target name="test-gdb_monitor">
|
|
<config>
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
|
</config>
|
|
</target>
|
|
<preserve name="RAM" quantum="4M"/>
|
|
<vfs> <dir name="dev"> <log/> <terminal/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
|
</config>
|
|
</start>
|
|
</config>
|
|
}
|
|
|
|
install_config $config
|
|
|
|
#
|
|
# Boot modules
|
|
#
|
|
|
|
# evaluated by the run tool
|
|
proc binary_name_gdbserver_platform_lib_so { } {
|
|
return "gdbserver_platform-$::env(KERNEL).lib.so"
|
|
}
|
|
|
|
# generic modules
|
|
set boot_modules {
|
|
libc_pipe.lib.so
|
|
pc_uart_drv
|
|
gdb_monitor gdbserver_platform.lib.so test-gdb_monitor
|
|
}
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
#
|
|
# Execute test case
|
|
#
|
|
#
|
|
set local_port 5555
|
|
|
|
# qemu config
|
|
append qemu_args " -nographic "
|
|
|
|
# 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 "
|
|
append qemu_args " -chardev socket,id=uart,port=$local_port,host=localhost,server,nowait,ipv4 "
|
|
|
|
run_genode_until {.*Remote debugging using /dev/terminal.*} 30
|
|
|
|
puts "GDB monitor is up, starting GDB in a new terminal"
|
|
|
|
source ${genode_dir}/repos/ports/run/gdb_monitor.inc
|
|
|
|
# GDB loads symbols from 'debug/ld.lib.so'
|
|
if { [have_spec nova] } {
|
|
exec ln -sf ld-nova.lib.so debug/ld.lib.so
|
|
}
|
|
if { [have_spec foc] } {
|
|
exec ln -sf ld-foc.lib.so debug/ld.lib.so
|
|
}
|
|
|
|
set gdb_target_binary "test-gdb_monitor"
|
|
|
|
# sequence of GDB commands to execute at startup
|
|
set gdb_cmds ""
|
|
append gdb_cmds "-ex \"target remote localhost:$local_port\" "
|
|
|
|
append gdb_cmds [gdb_initial_breakpoint_cmds $gdb_target_binary]
|
|
|
|
# ask the user for confirmations again
|
|
append gdb_cmds {-ex "set interactive-mode auto" }
|
|
|
|
puts "command: [gdb] debug/ld.lib.so $gdb_cmds"
|
|
|
|
exec [terminal] -e "[gdb] debug/ld.lib.so $gdb_cmds" &
|
|
|
|
interact -i [output_spawn_id]
|
|
|
|
# vi: set ft=tcl :
|