27 Commits

Author SHA1 Message Date
lizhenlin efba194008 update version to 0.193
Signed-off-by: lizhenlin <lizhenlin2@h-partners.com>
2025-11-12 14:48:40 +08:00
Dmitry V. Levin adbf4bafc2 src: fix spelling typos in argp help text and error diagnostics
Since all these help text strings are marked for translation, apply the fixes
to translation strings as well, this helps to avoid translations becoming fuzzy.

lenght -> length
occured -> occurred
endianess -> endianness
reversable -> reversible

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-12 14:59:17 +01:00
Mark Wielaard 49c200b7c7 libdwfl, src: Replace some asserts with proper check or error messages.
library code really shouldn't assert and for utilities a proper
error message is better than crashing with an assert.

https://sourceware.org/bugzilla/show_bug.cgi?id=26176

Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-07-19 14:17:19 +02:00
Mark Wielaard ac9e5349dd stack: Fix error message when dwfl_core_file_attach fails.
Reported-by: Mao Han <han_mao@c-sky.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
2019-06-25 00:21:42 +02:00
Ross Burton e893aab0d1 Consolidate error.h inclusion in system.h
error.h isn't standard and so isn't part of the musl C library.
To easy future porting, consolidate the inclusion of error.h into system.h.

https://sourceware.org/bugzilla/show_bug.cgi?id=21008

Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-07-05 21:06:40 +02:00
Mark Wielaard 2a9dc514e5 Internationalized messages should not contain the '\v' escape sequence.
Replace horizontal tab '\v' with double line feed '\n\n' in doc strings.
Regenerate .po files.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-09-15 13:12:23 +02:00
Ulf Hermann 760925bc7b Cast pid_t to long long when printing
We don't know sizeof(pid_t) as it's not specified in any standard. In
order to still print it, we cast to long long, the largest integer type
we can easily print.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-08-18 23:51:58 +02:00
Ulf Hermann e22cc80923 Move print_version into printversion.{h|c}
Rename version.c so that the implementation is called after the header
and the header doesn't clash with the toplevel version.h. print_version
depends on argp and is only used in the tools.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-17 10:55:28 +01:00
Mark Wielaard 1700fd25e6 http://elfutils.org/ is now hosted at http://sourceware.org/elfutils/
fedorahosted used to be our home, but we are now hosted at sourceware.

Change the elfutils project home to http://elfutils.org/
Point hosted services (email, release, git, bug tracker and web pages)
to https://sourceware.org/elfutils/

Move design notes from README to NOTES.
Add URLs for home, releases, bugs, git and mailinglist to README.

Make the --version output of all tools the same by using a common
print_version function and update the publicly shown copyright holder
to the elfutils developers.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2016-12-24 22:51:32 +01:00
Mark Wielaard 13968d9aa9 stack: Add -i, --inlines. Show inlined call frames using DWARF debuginfo.
Using dwarf_getscopes_die we can get all scopes that make up the current
subprogram representing an address. Using the call_file/line/column
attributes we can also show the source locations of these "inlined" calls.
Includes a test that shows that when DWARF debuginfo is available all
inlined function call frames and their source location can be shown.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-27 16:07:54 +01:00
Mark Wielaard 8520f70163 stack: Initialize -n maxframes to 256 by default.
Make -n default just 256 frames, 2048 was too big. Also Document magic
number used in frames.allocated initialization.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-27 16:05:54 +01:00
Mark Wielaard 531a30acbe stack: Add -d, --debugname. Lookup DWARF debuginfo name for frame address.
Includes test that shows -d matches the function name that corresponds to
the actual source line we report with -s for a frame address.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-27 15:53:40 +01:00
Jan Kratochvil 7c6e785e6e Fix corruption of non-C++ symbols by the demangler.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
2014-01-15 21:16:57 +01:00
Mark Wielaard da91c5bb69 stack: Show and handle -r,--raw even without USE_DEMANGLE.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-03 00:06:50 +01:00
Mark Wielaard 36490c9e86 stack.c (print_frames): Print 0x before build-id hex-offset.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-02 23:59:41 +01:00
Mark Wielaard 6034e2f436 stack: Allow -n 0 for unlimited frames. Make default 2048 frames.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2014-01-02 23:49:40 +01:00
Mark Wielaard 1910801919 libdwfl: Add dwfl_core_file_attach and dwfl_linux_proc_attach.
Rewrite __libdwfl_attach_state_for_pid and __libdwfl_attach_state_for_core
as public functions and don't call them from dwfl_linux_proc_report and
dwfl_core_file_report anymore. This lets the user attach state explicitly
independ from how the dwfl modules have been reported. Since attaching
state is an explicit action now the error can be returned directly and we
don't need to keep track of process_attach_error. dwfl_linux_proc_attach
lets the user can tell libdwfl whether caller takes care of ptrace
attaching and stopping the threads under inspection, or whether the
callback needs to take care of that and detaching again.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 13:59:51 +01:00
Mark Wielaard a6141d2769 stack: Add -l, --list-modules. Show module memory map, build-id and files.
Use to list modules detected for process or core file by stack program
and to see build-ids and which main elf and debug files were recognized
by libdwfl callbacks.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard 1f7763e5ad stack: Improve error checking and exit code handling.
Check up front whether we attached correctly, if not error out. Make sure
callbacks report -1 only on real errors and DWARF_CB_ABORT if exiting early
(but not in error). Handle all errors from frame callback in print_frames
after printing of good frames. Print as much information as possible like
tid, address and module name if known with error messages. Only exit with
exit code zero if everything went fine. Exit with error code one if there
were any non-fatal errors. Exit with error code two if no frames could be
printed or a fatal error occurred.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard fdb64e6785 stack: Add --quiet to not resolve addresses, add --raw to not demangle.
Resolving addresses to function symbol names can be expensive. Use -q
to only print addresses (use together with --build-id to process later).
Demangle names by default, but add the -r option to not demangle and
show the raw names.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard fe9b95db01 stack: Simplify argument parsing. Don't use dwfl_standard_argp.
We were using dwfl_standard_argp but trying to add our own and substract
some options from it. dwfl_standard_argp also handles kernel, modules,
executables without state and process maps that stack doesn't support.
That made argp parsing somewhat ugly and meant our --help and --usage
didn't really match. Just handle the dwfl_standard_argp options we do
want directly ('-p', '--core', '-e' and '--debuginfo-path'). That way
we can also do sanity checking on the options given.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard 99fc3f7d94 stack: -b, --build-id shows module build-id, load address and pc offset.
A convenient format for offline processing of the backtrace.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard 9fec14aadf stack: Add new '-n MAXFRAMES' option. Resolve addresses after unwind.
Limit the number of frames printed per thread (defaults to 64) and resolve
addresses to names, modules and source after unwinding so the thread is
only stopped for the minimum time needed to do the actual unwinding. The
thread doesn't need to wait for the lookups and printing of information.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-31 11:58:42 +01:00
Mark Wielaard e962ec3bcb libdwfl: Add dwfl_getthread_frames.
dwfl_getthread_frames is a convenience function for when the user is only
interested in one specific thread id of a process. It can be implemented by
a simple wrapper function that removes an extra callback layer just to
filter on thread id. But it also provides an optimized path to getting
access to just one particular Dwfl_Thread of the Dwfl process by providing
and (optional) new callback for the state provider. The pid_thread_callbacks
now provide an (optional) pid_getthread that doesn't need to travers all
threads anymore. Which is implemented for the linux-pid-attach provider.

stack now uses this to implement a new '-1' option that shows just one
specific thread of a process.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-23 22:57:22 +01:00
Masatake YAMATO c8c610bcfb stack: show binary and source file names where a function is defined
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@redhat.com>.

In v2 patch, `-s' and `-m' options are introduced instead
of using `-v' repeatedly as suggested by Mark Wielaard <mjw@redhat.com>.

In v3 patch `-a' is added as extra option and source lines are
printed on their own line.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-12-18 11:53:56 +01:00
Mark Wielaard 875cad8234 stack: Add basic argp version and bug definitions.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
2013-11-11 15:41:33 +01:00
Jan Kratochvil 0b86746007 Unwinder for x86*.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Mark Wielaard  <mjw@redhat.com>
2013-11-07 21:39:00 +01:00