mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
GDB monitor target configuration test
This commit is contained in:
parent
674e898af3
commit
b81bea845d
113
ports/run/gdb_monitor_target_config.run
Normal file
113
ports/run/gdb_monitor_target_config.run
Normal file
@ -0,0 +1,113 @@
|
||||
#
|
||||
# \brief Test for providing a config file to the target
|
||||
# \author Christian Prochaska
|
||||
# \date 2012-04-16
|
||||
#
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
build {
|
||||
core init
|
||||
drivers/timer drivers/uart
|
||||
app/gdb_monitor
|
||||
test/gdb_monitor_target_config
|
||||
}
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Generate config
|
||||
#
|
||||
|
||||
set config {
|
||||
<config verbose="yes">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="CAP"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="SIGNAL"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="512K"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
</start>
|
||||
<start name="uart_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Terminal"/> </provides>
|
||||
<config>
|
||||
<policy label="gdb_monitor" uart="1"/>
|
||||
</config>
|
||||
</start>
|
||||
<start name="gdb_monitor">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config>
|
||||
<target name="test-gdb_monitor_target_config">
|
||||
<config>
|
||||
<test_config_subnode/>
|
||||
</config>
|
||||
</target>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_lock_pipe.lib.so libc_terminal.lib.so
|
||||
uart_drv
|
||||
gdb_monitor test-gdb_monitor_target_config
|
||||
}
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
#
|
||||
# Execute test case
|
||||
#
|
||||
#
|
||||
set local_port 5555
|
||||
|
||||
# qemu config
|
||||
append qemu_args " -m 128 -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 "
|
||||
|
||||
run_genode_until {.*Remote debugging using /dev/terminal.*} 30
|
||||
|
||||
puts "GDB monitor is up, starting GDB in a new terminal"
|
||||
|
||||
# sequence of GDB commands to execute at startup
|
||||
set gdb_cmds ""
|
||||
append gdb_cmds "-ex \"target remote localhost:$local_port\" "
|
||||
|
||||
# continue execution
|
||||
append gdb_cmds {-ex "c" }
|
||||
|
||||
exec [terminal] -e "[gdb] bin/test-gdb_monitor_target_config $gdb_cmds" &
|
||||
|
||||
interact
|
||||
|
||||
# vi: set ft=tcl :
|
34
ports/src/test/gdb_monitor_target_config/main.cc
Normal file
34
ports/src/test/gdb_monitor_target_config/main.cc
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* \brief GDB Monitor target config test
|
||||
* \author Christian Prochaska
|
||||
* \date 2012-04-16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/config.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
try {
|
||||
config()->xml_node().sub_node("test_config_subnode");
|
||||
} catch(Config::Invalid) {
|
||||
PERR("Error: Missing '<config>' node.");
|
||||
return -1;
|
||||
} catch (Xml_node::Nonexistent_sub_node) {
|
||||
PERR("Error: Missing '<test_config_subnode>' sub node.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Test succeeded\n");
|
||||
|
||||
return 0;
|
||||
}
|
3
ports/src/test/gdb_monitor_target_config/target.mk
Normal file
3
ports/src/test/gdb_monitor_target_config/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = test-gdb_monitor_target_config
|
||||
SRC_CC = main.cc
|
||||
LIBS = env
|
Loading…
x
Reference in New Issue
Block a user