From: Thomas De Schampheleire Date: Thu, 6 Nov 2014 12:59:04 +0000 (+0100) Subject: stack trace support: fix check on symbol name presence X-Git-Tag: v4.10~363 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22deda33c6464e403aaf3d979eb2ca28af937417;p=strace stack trace support: fix check on symbol name presence The output format of the stack trace is supposed to be different depending on whether symbol names are available in the build. However, the check only verified the validity of the pointer, not of the string pointed to (which could be empty). This commit fixes the check so that the original output: mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38] > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574] > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c] > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac] > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c] > /bin/busybox(+0x0) [0x62c60] > /bin/busybox(+0x0) [0x4940] > /bin/busybox(+0x0) [0x499c] > /bin/busybox(+0x0) [0x4e08] > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c] > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8] becomes: mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38] > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574] > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c] > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac] > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c] > /bin/busybox() [0x62c60] > /bin/busybox() [0x4940] > /bin/busybox() [0x499c] > /bin/busybox() [0x4e08] > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c] > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8] Signed-off-by: Thomas De Schampheleire Acked-by: Masatake YAMATO --- diff --git a/unwind.c b/unwind.c index 5b060083..6f422a1c 100644 --- a/unwind.c +++ b/unwind.c @@ -427,7 +427,7 @@ print_call_cb(void *dummy, unw_word_t function_offset, unsigned long true_offset) { - if (symbol_name) + if (symbol_name && (symbol_name[0] != '\0')) tprintf(STACK_ENTRY_SYMBOL_FMT); else if (binary_filename) tprintf(STACK_ENTRY_NOSYMBOL_FMT);