monitor: separate 'monitor_gdb' run scripts

Fixes #4944
This commit is contained in:
Christian Prochaska 2023-06-28 16:56:31 +02:00 committed by Norman Feske
parent 5a2d4c3437
commit 2dd1365af3
4 changed files with 129 additions and 110 deletions

View File

@ -0,0 +1,105 @@
proc platform_supported { } {
if {[have_spec x86_64] && [have_board pc]} {
if {![have_spec linux] && ![have_spec foc] && ![have_spec sel4]} {
return 1 } }
return 0
}
if {![platform_supported]} {
puts "Run script is not supported on this platform"
exit 0
}
build { core lib/ld init timer monitor drivers/uart test/log }
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="LOG"/>
<service name="PD"/>
<service name="CPU"/>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="RM"/>
</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="pc_uart_drv">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Terminal"/>
<service name="Uart"/>
</provides>
<config>
<policy label_prefix="monitor" uart="1"/>
</config>
</start>
<start name="monitor" caps="1000">
<resource name="RAM" quantum="100M"/>
<config>
<parent-provides>
<service name="LOG"/>
<service name="PD"/>
<service name="CPU"/>
<service name="ROM"/>
</parent-provides>
<default caps="100"/>
<monitor>
<policy label="first-test-log"/>
</monitor>
<start name="first-test-log">
<resource name="RAM" quantum="2M"/>
<binary name="test-log"/>
<route>
<service name="PD"> <local/> </service>
<service name="CPU"> <local/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="second-test-log">
<resource name="RAM" quantum="2M"/>
<binary name="test-log"/>
<route>
<service name="PD"> <local/> </service>
<service name="CPU"> <local/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
</config>
</start>
</config>
}
build_boot_image [build_artifacts]
set local_port 5555
# qemu config
append qemu_args " -display none "
# connect comport 0 to stdio
append qemu_args " -serial 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 -> monitor -> first-test-log\].*} 30
set genode_id [output_spawn_id]

View File

@ -1,120 +1,23 @@
proc platform_supported { } {
if {[have_spec x86_64] && [have_board pc]} {
if {![have_spec linux] && ![have_spec foc] && ![have_spec sel4]} {
return 1 } }
return 0
}
if {![platform_supported]} {
puts "Run script is not supported on this platform"
exit 0
}
build { core lib/ld init timer monitor drivers/uart test/log }
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="LOG"/>
<service name="PD"/>
<service name="CPU"/>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="RM"/>
</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="pc_uart_drv">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Terminal"/>
<service name="Uart"/>
</provides>
<config>
<policy label_prefix="monitor" uart="1"/>
</config>
</start>
<start name="monitor" caps="1000">
<resource name="RAM" quantum="100M"/>
<config>
<parent-provides>
<service name="LOG"/>
<service name="PD"/>
<service name="CPU"/>
<service name="ROM"/>
</parent-provides>
<default caps="100"/>
<monitor>
<policy label="first-test-log" stop="no"/>
</monitor>
<start name="first-test-log">
<resource name="RAM" quantum="2M"/>
<binary name="test-log"/>
<route>
<service name="PD"> <local/> </service>
<service name="CPU"> <local/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="second-test-log">
<resource name="RAM" quantum="2M"/>
<binary name="test-log"/>
<route>
<service name="PD"> <local/> </service>
<service name="CPU"> <local/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
</config>
</start>
</config>
}
build_boot_image [build_artifacts]
set local_port 5555
# qemu config
append qemu_args " -display none "
# connect comport 0 to stdio
append qemu_args " -serial 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 -> monitor -> first-test-log\].*} 30
set genode_id [output_spawn_id]
source ${genode_dir}/repos/os/run/monitor_gdb.inc
# sequence of GDB commands to execute at startup
set gdb_cmds ""
append gdb_cmds {-ex "target remote localhost:$local_port" }
append gdb_cmds {-ex "set style enabled off" }
# test for dumping memory
append gdb_cmds {-ex "x/x 0x1003e8b" }
# run GDB
eval spawn [gdb] debug/ld.lib.so -n $gdb_cmds
set gdb_id [list $spawn_id $genode_id]
# show output of both GDB and Genode, supply user input to GDB
interact -i $gdb_id $genode_id
puts ""
puts "----- test: dump memory -----"
puts ""
run_genode_until {\(gdb\)} 60 $gdb_id
send "x/x 0x1003e8b\n"
run_genode_until {\(gdb\)} 20 $gdb_id
if {![regexp {0x1003e8b:\t0x6f636e6f} $output]} {
puts stderr "*** Error: Dumped memory is not as expected"
}

View File

@ -0,0 +1,10 @@
source ${genode_dir}/repos/os/run/monitor_gdb.inc
# sequence of GDB commands to execute at startup
set gdb_cmds ""
append gdb_cmds "-ex \"target remote localhost:$local_port\" "
# run GDB
exec [terminal] -e "bash -lc \'[gdb] debug/ld.lib.so $gdb_cmds\'" &
interact -i $genode_id

View File

@ -34,6 +34,7 @@ lx_hybrid_pthread_ipc
microcode
migrate
monitor
monitor_gdb
netperf_lwip
netperf_lwip_bridge
netperf_lwip_usb