# # \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 drivers/timer drivers/uart app/gdb_monitor test/gdb_monitor server/nitpicker app/pointer app/scout drivers/framebuffer drivers/input } source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components create_boot_directory # # Generate config # set config { } append_platform_drv_config append_if [have_spec framebuffer] config { } append_if [have_spec ps2] config { } append config { } install_config $config # # Boot modules # # generic modules set boot_modules { core init timer ld.lib.so libc.lib.so libc_pipe.lib.so libc_terminal.lib.so uart_drv gdb_monitor 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 append qemu_args " -m 128 " # 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" exec [terminal] -e "[gdb] bin/nitpicker -ex \"target remote localhost:$local_port\"" & interact -i [output_spawn_id] # vi: set ft=tcl :