CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions
stacktrace-test.c File Reference

Just a small run-time test. More...

Functions

static void do_test (void)
 
int main (void)
 

Detailed Description

This small tool is intended to check, if the compiler flags about debugging (and not debugging) are working as expected.

The following compiler flags should have an impact to the tool's output.

Note
Goal is to have the same output on all architectures.

Configured with the following settings:

--disable-asan --enable-abort --enable-debug

it must report on an x86-64 host:

./stacktrace-test
------------------------------------------------
[…]/libcapsbase-build/.libs/stacktrace-test(+0x11fa)[0x55a12cab21fa]
[…]/libcapsbase-build/.libs/stacktrace-test(main+0x23)[0x55a12cab2247]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f618b708083]
[…]/libcapsbase-build/.libs/stacktrace-test(_start+0x2e)[0x55a12cab210e]
------------------------------------------------
libcapsbase:main:33: Forced crash for testing purposes
libcapsbase:caps_developers_failure_report_and_terminate:108: Fix your code!
---------------------------------------------------
[…]/libcapsbase-build/.libs/libcapsbase-1.so(caps_terminate+0x4d)[0x7f618b8f663e]
[…]/libcapsbase-build/.libs/libcapsbase-1.so(caps_memory_failure_report_and_terminate+0x0)[0x7f618b8f6a92]
[…]/libcapsbase-build/.libs/stacktrace-test(+0x127c)[0x55a12cab227c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f618b708083]
[…]/libcapsbase-build/.libs/stacktrace-test(_start+0x2e)[0x55a12cab210e]
---------------------------------------------------
Aborted

Important here is the additional stack trace after the line with the 'Fix your code'.

Configured with the following settings:

--disable-asan --enable-abort --disable-debug

it must report on an x86-64 host:

./stacktrace-test
------------------------------------------------
[…]/libcapsbase-build/.libs/stacktrace-test(+0x1218)[0x55a5a3799218]
[…]/libcapsbase-build/.libs/stacktrace-test(+0x10db)[0x55a5a37990db]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7ffba63be083]
[…]/libcapsbase-build/.libs/stacktrace-test(+0x113e)[0x55a5a379913e]
------------------------------------------------
libcapsbase:main:33: Forced crash for testing purposes
libcapsbase:caps_developers_failure_report_and_terminate:108: Fix your code!
Aborted

Important difference to the text shown above are the missing symbol names and only the first stack trace.

Function Documentation

◆ do_test()

static void do_test ( void  )
static

Check the base libc backtrace feature

For the debug case it schould output some symbol names instead of offsets only

◆ main()

int main ( void  )