gcc-toolset-9-elfutils/elfutils-0.176-gcc-pr88835.patch
2023-02-27 13:12:05 -05:00

29 lines
1.0 KiB
Diff

Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88835
diff --git a/src/readelf.c b/src/readelf.c
index 33706bd..b55844c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -10143,7 +10143,7 @@ print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
++digits;
tmp >>= 4;
}
- digits = MAX (4, digits);
+ digits = MIN (16, MAX (4, digits));
printf (gettext ("\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"
" %*s String\n"),
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 05e8ef8..d621fbf 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -185,7 +185,7 @@ frame_callback (Dwfl_Frame *state, void *frame_arg)
symname = dwfl_module_addrname (mod, pc_adjusted);
printf ("#%2d %#" PRIx64 "%4s\t%s\n", *framenop, (uint64_t) pc,
- ! isactivation ? "- 1" : "", symname);
+ ! isactivation ? "- 1" : "", symname ?: "<null>");
pid_t tid = dwfl_thread_tid (thread);
callback_verify (tid, *framenop, pc, symname, dwfl);
(*framenop)++;