[PATCH v2] stack: show binary and source file names where a function is defined

Mark Wielaard mjw at redhat.com
Tue Dec 17 13:41:33 UTC 2013


On Tue, 2013-12-17 at 12:03 +0900, Masatake YAMATO wrote:
> This patch adds the module and source file information to the
> each stack trace line.  `-m' is for module file information
> and `-s' is for source file information. `-v' is for both and more.
> 
> This is based on private discussion with Jan Kratochvil
> <jan.kratochvil at redhat.com>.
> 
> In v2 patch, `-s' and `-m' options are introduced instead
> of using `-v' repeatedly as suggested by Mark Wielaard <mjw at redhat.com>.
> 
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>

> +2013-12-16  Masatake YAMATO  <yamato at redhat.com>
> +
> +	* stack.c (show_module, show_source): New variables.
> +	(parse_opt): set show_module if -m option is given.
> +	set show_source if -s option is given.
> +	(main): Added `-m', `-s', and `-v' to the help message.
> +	(frame_callback): Print module and source file information.

I like it, but do want to tweak the formatting a little. In particular
don't print any information we don't have, like missing columns or
lines. I think it would be good to treat the activation info like the
rest of the extra/verbose information. And since source lines are
usually fairly large I think they should be on their own line.

What do you think of the attached. It produces the following with -v:

TID 7172:
#0  0x00000033c82ac8be     __waitpid - /lib64/libc-2.12.so
    ../sysdeps/unix/sysv/linux/waitpid.c:32
#1  0x000000000043eb72 - 1 waitchld - /bin/bash
    /usr/src/debug/bash-4.1/jobs.c:3064
#2  0x000000000043fe0f - 1 wait_for - /bin/bash
    /usr/src/debug/bash-4.1/jobs.c:2422
#3  0x00000000004309f9 - 1 execute_command_internal - /bin/bash
    /usr/src/debug/bash-4.1/execute_cmd.c:780
#4  0x0000000000430bee - 1 execute_command - /bin/bash
    /usr/src/debug/bash-4.1/execute_cmd.c:379
#5  0x000000000041d536 - 1 reader_loop - /bin/bash
    /usr/src/debug/bash-4.1/eval.c:153
#6  0x000000000041ccf9 - 1 main - /bin/bash
    /usr/src/debug/bash-4.1/shell.c:759
#7  0x00000033c821ed1d - 1 __libc_start_main - /lib64/libc-2.12.so
    /usr/src/debug/glibc-2.12-2-gc4ccff1/csu/libc-start.c:226
#8  0x000000000041af19 - 1 _start - /bin/bash

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-stack-show-binary-and-source-file-names-where-a-func.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20131217/3d7dc55d/attachment.bin>


More information about the elfutils-devel mailing list