This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] Add --core-pattern option to eu-stack
- From: Mark Wielaard <mark at klomp dot org>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 30 Oct 2014 22:55:41 +0100
- Subject: Re: [PATCH] Add --core-pattern option to eu-stack
On Thu, 2014-10-09 at 23:25 +0200, Jan Kratochvil wrote:
> To backtrace crashed thread from Linux core_pattern handler a special operation
> similar to PTRACE_ATTACH needs to be done. This is implemented as a demo in
> eu-stack's core_pattern function invoked by eu-stack's --core-pattern option.
Cute! And I saw the %i support made it into the mainline kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b03023ecbdb76c1dec86b41ed80b123c22783220
I did have to lookup how to use this though. And I couldn't make it work
without adding an -o option to eu-stack to explicitly redirect output
since it seems you cannot use normal shell redirections
in /proc/sys/kernel/core_pattern. So I had to use something like
--output=/proc/%p/cwd/%i.stack. Where does the stdout of the
core_pattern end up otherwise?
It would probably be good to have a full example usage in the --help
message (and tell people to look at man 5 core).
> The code of core_pattern function has been suggested by Oleg Nesterov.
I was wondering if we could make this a little more generically usable
and call it --wait-exit or something like that. So people could also use
it outside the core_pattern if they just want to get a backtrace for a
known thread when it exits.
> + if (opt_core_pattern == true && show_one_tid == false)
> + argp_error (state,
> + N_("--core-pattern requires -1"));
Why this restriction?
Thanks,
Mark