diff options
| author | Peter Jones <pjones@redhat.com> | 2021-07-14 16:36:44 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-07-20 09:44:25 -0400 |
| commit | cedfa69e6afe381a074d22bdf1e6f2d9e6731038 (patch) | |
| tree | 7a6aaaa03f9edfed395b7061b027ed23b7b45481 /include | |
| parent | fea0a3fd026f1f4ec82a513269764b8349ffd4a5 (diff) | |
| download | efi-boot-shim-cedfa69e6afe381a074d22bdf1e6f2d9e6731038.tar.gz efi-boot-shim-cedfa69e6afe381a074d22bdf1e6f2d9e6731038.zip | |
test: Add a basic traceback printer
Some tests have some complex flows, and it's useful to be able to see
the call path when there's a failure.
This patch adds a very simple traceback printer, along with changing the
test build arguments to include more debug information.
The result you get from this traceback printer just gives you a function
name and the index into its .txt content, so to use it for more than
"which function calls which", you'll need to use eu-addr2line with the
output.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/test.h | 2 | ||||
| -rw-r--r-- | include/test.mk | 21 |
2 files changed, 18 insertions, 5 deletions
diff --git a/include/test.h b/include/test.h index 49a27a94..fedeb782 100644 --- a/include/test.h +++ b/include/test.h @@ -69,6 +69,8 @@ extern int debug; #define dprint(fmt, ...) {( if (debug) printf("%s:%d:" fmt, __func__, __LINE__, ##__VA_ARGS__); }) #endif +void print_traceback(int skip); + #define eassert(cond, fmt, ...) \ ({ \ if (!(cond)) { \ diff --git a/include/test.mk b/include/test.mk index c66b46de..23bf805c 100644 --- a/include/test.mk +++ b/include/test.mk @@ -14,14 +14,25 @@ CFLAGS = -O2 -ggdb -std=gnu11 \ -isystem $(TOPDIR)/include/system \ $(EFI_INCLUDES) \ -Iinclude -iquote . \ - -fshort-wchar -flto -fno-builtin \ - -Wall \ - -Wextra \ + -isystem /usr/include \ + -isystem $(shell $(CC) $(ARCH_CFLAGS) -print-file-name=include) \ + $(ARCH_CFLAGS) \ + -fshort-wchar \ + -flto \ + -fno-builtin \ + -rdynamic \ + -fno-inline \ + -fno-eliminate-unused-debug-types \ + -fno-eliminate-unused-debug-symbols \ + -gpubnames \ + -grecord-gcc-switches \ + $(DEFAULT_WARNFLAGS) \ -Wsign-compare \ -Wno-deprecated-declarations \ + -Wno-unused-but-set-variable \ + -Wno-unused-variable \ -Wno-pointer-sign \ - -Wno-unused \ - -Werror \ + $(DEFAULT_WERRFLAGS) \ -Werror=nonnull \ $(shell $(CC) -Werror=nonnull-compare -E -x c /dev/null >/dev/null 2>&1 && echo -Werror=nonnull-compare) \ $(ARCH_DEFINES) \ |
