Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils: Introduce ASSERT and DASSERT debugging features
ASSERT is same as assert, but dumps stacktrace before stopped. However, DASSERT is only compiled when DEBUG=1 is on in debug mode build. Otherwise, it's simply ignored and doesn't make any overhead. It would be better if we add more assertion like statements with ASSERT and DASSERT. When one of the assertion is failed, it prints the stack trace and raises SIGTRAP signal so that it can be handled by a debugger, otherwise it will just stop execution anyway. Here is the example output. /data_sdb/honggyu/work/uftrace/git/uftrace/utils/fstack.c:2025: fstack_update_stack_count: ASSERT `!task' failed. Stack trace: #1 0x0000004559f2 fstack_update_stack_count + 0x66 #2 0x000000456187 __fstack_consume + 0x48f #3 0x000000456c68 __read_rstack + 0x74e #4 0x000000456cc1 read_rstack + 0x28 #5 0x000000417386 command_replay + 0x28e #6 0x000000407bf9 main + 0x4c3 #7 0x7fd2a7bee840 __libc_start_main + 0xf0 #8 0x0000004054e9 _start + 0x29 #9 0x000000000000 + 0x29 Please report this bug to https://github.com/namhyung/uftrace/issues. Trace/breakpoint trap Signed-off-by: Honggyu Kim <[email protected]>
- Loading branch information