genode/repos/ports/run/noux_gdb_dynamic.run

166 lines
4.2 KiB
Plaintext
Raw Normal View History

cli_monitor: add a 'gdb' command This patch adds a 'gdb' command to 'cli_monitor', which makes it possible to debug an application with GDB. The command works similarly to the 'start' command, but instead of starting the subsystem binary directly, an 'init' subsystem gets started, which then starts 'terminal_crosslink', 'noux', GDB and 'gdb_monitor' (which starts the application binary as its target). So, for the 'gdb' command to work, these additional components need to be available, too. 'terminal_crosslink', 'noux', 'gdb_monitor' and the file 'gdb_command_config' are expected to be ROM modules. The Noux GDB client needs to get mounted at '/bin' in Noux and the target binaries need to be available as ROM modules (loaded by 'gdb_monitor') and also mounted at '/gdb' in Noux (loaded by the GDB client). Additionally, the source code of the target application can be provided at '/gdb/src/ in Noux. How the Noux mountings get established can be configured in the 'gdb_command_config' file. The default configuration in 'os/src/server/cli_monitor/gdb_command_config' mounts GDB from a tar archive named 'gdb.tar', the GDB target binaries from a tar archive named 'gdb_target.tar' and the target source code from a tar archive named 'gdb_target-src.tar'. The patch includes an 'expect' include file (ports/run/noux_gdb.inc) which provides functions that help to create those tar files: - 'create_gdb_tar' creates a tar archive for the 'gdb' client - 'create_binary_tar' creates a tar archive for the target application - 'create_source_tar' creates a tar archive for the source code of the target application - 'create_binary_and_source_tars' is a convenience wrapper for the previous two functions The patch also includes an example run script (ports/run/noux_gdb_dynamic.run). The 'gdb' command supports the following command line options: - --ram: the initial RAM quota provided to the whole subsystem (including the GDB-related components) - --ram-limit: limit for expanding RAM quota - --gdb-ram-preserve: the RAM quota that 'gdb_monitor' ahould preserve for itself Fixes #928.
2013-10-25 20:28:55 +00:00
if {![have_spec foc] || ![have_spec 32bit]} {
puts "\nThe Noux GDB scenario is supported on 32-bit Fiasco.OC only\n"
exit 0
}
source ${genode_dir}/repos/ports/run/noux_gdb.inc
cli_monitor: add a 'gdb' command This patch adds a 'gdb' command to 'cli_monitor', which makes it possible to debug an application with GDB. The command works similarly to the 'start' command, but instead of starting the subsystem binary directly, an 'init' subsystem gets started, which then starts 'terminal_crosslink', 'noux', GDB and 'gdb_monitor' (which starts the application binary as its target). So, for the 'gdb' command to work, these additional components need to be available, too. 'terminal_crosslink', 'noux', 'gdb_monitor' and the file 'gdb_command_config' are expected to be ROM modules. The Noux GDB client needs to get mounted at '/bin' in Noux and the target binaries need to be available as ROM modules (loaded by 'gdb_monitor') and also mounted at '/gdb' in Noux (loaded by the GDB client). Additionally, the source code of the target application can be provided at '/gdb/src/ in Noux. How the Noux mountings get established can be configured in the 'gdb_command_config' file. The default configuration in 'os/src/server/cli_monitor/gdb_command_config' mounts GDB from a tar archive named 'gdb.tar', the GDB target binaries from a tar archive named 'gdb_target.tar' and the target source code from a tar archive named 'gdb_target-src.tar'. The patch includes an 'expect' include file (ports/run/noux_gdb.inc) which provides functions that help to create those tar files: - 'create_gdb_tar' creates a tar archive for the 'gdb' client - 'create_binary_tar' creates a tar archive for the target application - 'create_source_tar' creates a tar archive for the source code of the target application - 'create_binary_and_source_tars' is a convenience wrapper for the previous two functions The patch also includes an example run script (ports/run/noux_gdb_dynamic.run). The 'gdb' command supports the following command line options: - --ram: the initial RAM quota provided to the whole subsystem (including the GDB-related components) - --ram-limit: limit for expanding RAM quota - --gdb-ram-preserve: the RAM quota that 'gdb_monitor' ahould preserve for itself Fixes #928.
2013-10-25 20:28:55 +00:00
#
# Uncomment the following line when working on the GDB source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/[noux_gdb_pkg_name]/ bin/[noux_gdb_pkg_name]/
set build_components {
core init drivers/timer noux lib/libc_noux
drivers/uart
server/terminal_mux server/terminal_crosslink
server/terminal_log
app/cli_monitor
app/gdb_monitor
}
lappend build_components noux-pkg/[noux_gdb_pkg_name]
lappend build_components test/gdb_monitor
set gdb_target_binary_name test-gdb_monitor
build $build_components
# names of the binaries needed for the GDB monitor test
set gdb_target_binaries {
ld.lib.so
libc.lib.so
libc_log.lib.so
}
lappend gdb_target_binaries ${gdb_target_binary_name}
create_gdb_tar
create_binary_and_source_tars "gdb_target" ${gdb_target_binaries}
create_boot_directory
append config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="CAP"/>
<service name="RAM"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
cli_monitor: add a 'gdb' command This patch adds a 'gdb' command to 'cli_monitor', which makes it possible to debug an application with GDB. The command works similarly to the 'start' command, but instead of starting the subsystem binary directly, an 'init' subsystem gets started, which then starts 'terminal_crosslink', 'noux', GDB and 'gdb_monitor' (which starts the application binary as its target). So, for the 'gdb' command to work, these additional components need to be available, too. 'terminal_crosslink', 'noux', 'gdb_monitor' and the file 'gdb_command_config' are expected to be ROM modules. The Noux GDB client needs to get mounted at '/bin' in Noux and the target binaries need to be available as ROM modules (loaded by 'gdb_monitor') and also mounted at '/gdb' in Noux (loaded by the GDB client). Additionally, the source code of the target application can be provided at '/gdb/src/ in Noux. How the Noux mountings get established can be configured in the 'gdb_command_config' file. The default configuration in 'os/src/server/cli_monitor/gdb_command_config' mounts GDB from a tar archive named 'gdb.tar', the GDB target binaries from a tar archive named 'gdb_target.tar' and the target source code from a tar archive named 'gdb_target-src.tar'. The patch includes an 'expect' include file (ports/run/noux_gdb.inc) which provides functions that help to create those tar files: - 'create_gdb_tar' creates a tar archive for the 'gdb' client - 'create_binary_tar' creates a tar archive for the target application - 'create_source_tar' creates a tar archive for the source code of the target application - 'create_binary_and_source_tars' is a convenience wrapper for the previous two functions The patch also includes an example run script (ports/run/noux_gdb_dynamic.run). The 'gdb' command supports the following command line options: - --ram: the initial RAM quota provided to the whole subsystem (including the GDB-related components) - --ram-limit: limit for expanding RAM quota - --gdb-ram-preserve: the RAM quota that 'gdb_monitor' ahould preserve for itself Fixes #928.
2013-10-25 20:28:55 +00:00
</default-route>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="uart_drv">}
# use kernel debugger as UART on Fiasco.OC
append_if [have_spec foc] config {
<binary name="kdb_uart_drv"/>}
append config {
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Uart"/>
<service name="Terminal"/>
</provides>
<config> }
# on Fiasco.OC the kdb_uart_drv is always UART 0
append_if [have_spec foc] config {
<policy label="terminal_mux" uart="0" detect_size="yes"/> }
# on all other kernels, direct terminal_mux to UART 1 (Qemu stdio, see below)
append_if [expr ![have_spec foc]] config {
<policy label="terminal_mux" uart="1" detect_size="yes"/> }
append config {
</config>
<route> <any-service> <parent/> <any-child/> </any-service> </route>
</start>
<start name="terminal_mux">
<resource name="RAM" quantum="3M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="Terminal"><child name="uart_drv"/></service>
<any-service> <parent/> <any-child/> </any-service>
</route>
<config>
<keyboard layout="de"/>
</config>
</start>
<start name="terminal_log">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="LOG"/>
</provides>
<route>
<any-service><child name="terminal_mux"/> <any-child/> <parent/> </any-service>
</route>
</start>
<start name="cli_monitor">
<resource name="RAM" quantum="3G"/>
<config>
<subsystem name="gdb_test" help="GDB test application"> }
append config "
<binary name=\"${gdb_target_binary_name}\"/> "
append config {
<resource name="RAM" quantum="50M"/>
</subsystem>
</config>
<route>
<service name="LOG"><child name="terminal_log"/></service>
<service name="Terminal"><child name="terminal_mux"/></service>
<any-service><parent/><any-child/></any-service>
</route>
</start>
</config>
}
install_config $config
#
# Boot modules
#
exec cp ${genode_dir}/repos/os/src/app/cli_monitor/gdb_command_config bin
cli_monitor: add a 'gdb' command This patch adds a 'gdb' command to 'cli_monitor', which makes it possible to debug an application with GDB. The command works similarly to the 'start' command, but instead of starting the subsystem binary directly, an 'init' subsystem gets started, which then starts 'terminal_crosslink', 'noux', GDB and 'gdb_monitor' (which starts the application binary as its target). So, for the 'gdb' command to work, these additional components need to be available, too. 'terminal_crosslink', 'noux', 'gdb_monitor' and the file 'gdb_command_config' are expected to be ROM modules. The Noux GDB client needs to get mounted at '/bin' in Noux and the target binaries need to be available as ROM modules (loaded by 'gdb_monitor') and also mounted at '/gdb' in Noux (loaded by the GDB client). Additionally, the source code of the target application can be provided at '/gdb/src/ in Noux. How the Noux mountings get established can be configured in the 'gdb_command_config' file. The default configuration in 'os/src/server/cli_monitor/gdb_command_config' mounts GDB from a tar archive named 'gdb.tar', the GDB target binaries from a tar archive named 'gdb_target.tar' and the target source code from a tar archive named 'gdb_target-src.tar'. The patch includes an 'expect' include file (ports/run/noux_gdb.inc) which provides functions that help to create those tar files: - 'create_gdb_tar' creates a tar archive for the 'gdb' client - 'create_binary_tar' creates a tar archive for the target application - 'create_source_tar' creates a tar archive for the source code of the target application - 'create_binary_and_source_tars' is a convenience wrapper for the previous two functions The patch also includes an example run script (ports/run/noux_gdb_dynamic.run). The 'gdb' command supports the following command line options: - --ram: the initial RAM quota provided to the whole subsystem (including the GDB-related components) - --ram-limit: limit for expanding RAM quota - --gdb-ram-preserve: the RAM quota that 'gdb_monitor' ahould preserve for itself Fixes #928.
2013-10-25 20:28:55 +00:00
# generic modules
set boot_modules {
core init timer ld.lib.so noux terminal_mux terminal_crosslink
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so expat.lib.so
libc_lock_pipe.lib.so libc_log.lib.so libc_terminal.lib.so
cli_monitor gdb_monitor terminal_log gdb.tar
gdb_command_config
gdb_target.tar
gdb_target-src.tar
}
lappend boot_modules ${gdb_target_binary_name}
# platform-specific modules
lappend_if [expr ![have_spec foc]] boot_modules uart_drv
lappend_if [have_spec foc] boot_modules kdb_uart_drv
set fiasco_serial_esc_arg ""
build_boot_image $boot_modules
append qemu_args " -nographic "
run_genode_until forever
exec rm bin/gdb.tar