mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 07:46:42 +00:00
bf62d6b896
Since the timer and timeout handling is part of the base library (the dynamic linker), it belongs to the base repository. Besides moving the timer and its related infrastructure (alarm, timeout libs, tests) to the base repository, this patch also moves the timer from the 'drivers' subdirectory directly to 'src' and disamibuates the timer's build locations for the various kernels. Otherwise the different timer implementations could interfere with each other when using one build directory with multiple kernels. Note that this patch changes the include paths for the former os/timer, os/alarm.h, os/duration.h, and os/timed_semaphore.h to base/. Issue #3101
187 lines
4.5 KiB
Tcl
187 lines
4.5 KiB
Tcl
#
|
|
# \brief Example for debugging a service
|
|
# \author Norman Feske
|
|
# \date 2011-09-13
|
|
#
|
|
# This example shows how GDB monitor can be used to debug a Genode service.
|
|
# GDB monitor sits in between the service and the service's parent. Any
|
|
# service announcements are transparently propagated through the GDB
|
|
# monitor to the parent. This way, the internal state of a service can
|
|
# be observed at any time via a remote GDB connection. In the example,
|
|
# the remote GDB connection is realized via an UART device. Alternatively,
|
|
# 'tcp_terminal' could be used (to attach GDB via a network connection).
|
|
#
|
|
|
|
#
|
|
# Build
|
|
#
|
|
|
|
set build_components {
|
|
core init timer
|
|
drivers/uart
|
|
app/gdb_monitor
|
|
test/gdb_monitor
|
|
server/nitpicker app/pointer app/scout
|
|
drivers/framebuffer drivers/input
|
|
}
|
|
|
|
lappend build_components "lib/gdbserver_platform-$::env(KERNEL)"
|
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
append_platform_drv_build_components
|
|
|
|
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="1M"/>
|
|
<provides> <service name="Timer"/> </provides>
|
|
</start>
|
|
<start name="uart_drv">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<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="10M"/>
|
|
<provides><service name="Nitpicker"/></provides>
|
|
<config>
|
|
<target name="nitpicker">
|
|
<config>
|
|
<domain name="pointer" layer="1" xray="no" origin="pointer"
|
|
content="client" label="no"/>
|
|
<domain name="default" layer="3" content="client"
|
|
label="no" hover="always" focus="click"/>
|
|
<policy label_prefix="pointer" domain="pointer"/>
|
|
<default-policy domain="default"/>
|
|
</config>
|
|
</target>
|
|
<preserve name="RAM" quantum="2M"/>
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
|
</config>
|
|
</start>
|
|
<start name="pointer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
</start>
|
|
<start name="scout">
|
|
<resource name="RAM" quantum="32M"/>
|
|
</start>}
|
|
|
|
append_platform_drv_config
|
|
|
|
append_if [have_spec framebuffer] config {
|
|
<start name="fb_drv">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<provides><service name="Framebuffer"/></provides>
|
|
</start>}
|
|
|
|
append_if [have_spec ps2] config {
|
|
<start name="ps2_drv">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Input"/></provides>
|
|
</start> }
|
|
|
|
append config {
|
|
</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 {
|
|
core init timer
|
|
ld.lib.so libc.lib.so vfs.lib.so libc_pipe.lib.so libc_terminal.lib.so
|
|
uart_drv
|
|
gdb_monitor gdbserver_platform.lib.so
|
|
nitpicker pointer scout
|
|
}
|
|
|
|
# platform-specific modules
|
|
lappend_if [have_spec framebuffer] boot_modules fb_drv
|
|
lappend_if [have_spec ps2] boot_modules ps2_drv
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
#
|
|
# Execute test case
|
|
#
|
|
#
|
|
set local_port 5555
|
|
|
|
# qemu config
|
|
|
|
# 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 {.*\[init -> gdb_monitor\].*} 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 "nitpicker"
|
|
|
|
# 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 :
|