Skip to content

Commit

Permalink
Add backtrace test
Browse files Browse the repository at this point in the history
  • Loading branch information
cproc authored and tor-m6 committed Jan 30, 2023
1 parent a1f0384 commit 3993c6c
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
66 changes: 66 additions & 0 deletions run/backtrace.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
build "core init timer test/backtrace"

create_boot_directory

install_config {
<config>
<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="200"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="test-backtrace">
<resource name="RAM" quantum="16M"/>
<config>
<vfs>
<dir name="dev">
<log/>
<inline name="rtc">2019-08-20 15:01</inline>
</dir>
<dir name="proc">
<dir name="self">
<rom name="exe"/>
</dir>
</dir>
<rom name="binary"/>
<rom name="ld.lib.so"/>
<rom name="libc.lib.so"/>
<rom name="libm.lib.so"/>
<rom name="posix.lib.so"/>
<rom name="vfs.lib.so"/>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
</config>
<route>
<service name="ROM" label="exe"><parent label="test-backtrace.debug"/></service>
<service name="ROM" label="binary"><parent label="test-backtrace.debug"/></service>
<any-service><parent/><any-child/></any-service>
</route>
</start>
</config>
}

exec ln -sf ../debug/test-backtrace bin/test-backtrace.debug

build_boot_image {
core init timer test-backtrace
ld.lib.so libc.lib.so vfs.lib.so libm.lib.so posix.lib.so
test-backtrace.debug
}

append qemu_args " -nographic "

run_genode_until "child .* exited with exit value 0.*\n" 30
24 changes: 24 additions & 0 deletions src/test/backtrace/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* \brief libbacktrace test
* \author Christian Prochaska
* \date 2023-01-28
*/

/*
* Copyright (C) 2023 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#include <backtrace.h>

int main(int argc, char **argv)
{
struct backtrace_state *state =
backtrace_create_state(NULL, 0, NULL, NULL);

backtrace_print(state, 0, stdout);

return 0;
}
5 changes: 5 additions & 0 deletions src/test/backtrace/target.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TARGET = test-backtrace
SRC_CC = main.cc
LIBS = posix backtrace

CC_CXX_WARN_STRICT =

0 comments on commit 3993c6c

Please sign in to comment.