[PATCH 1/2] stack trace support: fix check on symbol name presence
Masatake YAMATO
yamato at redhat.com
Thu Nov 6 16:32:18 UTC 2014
Acked-by: Masatake YAMATO <yamato at redhat.com>
On Thu, 6 Nov 2014 13:59:04 +0100, Thomas De Schampheleire <patrickdepinguin at gmail.com> wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
>
> 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 <thomas.de.schampheleire at gmail.com>
> ---
> unwind.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/unwind.c b/unwind.c
> index 5b06008..6f422a1 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);
> --
> 1.7.1
>
More information about the Strace-devel
mailing list