All of lore.kernel.org
 help / color / mirror / Atom feed
* Getting backtrace of a process
@ 2021-06-14 15:10 hemanth nandish
  2021-06-15  6:01 ` Valdis Klētnieks
  0 siblings, 1 reply; 2+ messages in thread
From: hemanth nandish @ 2021-06-14 15:10 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 626 bytes --]

I am trying to get create a custom error log of a process when it causes a
segmentation fault.
We can modify the* /proc/sys/kernel/core_pattern* file to pipe the core
information to a handler binary.

I am trying to use the *libunwind *library within this handler to also get
the backtrace information but it is failing.

As per my understanding, the *do_coredump* kills the faulty process inside
*coredump_wait*  function before invoking the userspace handler,
This might be the reason the libunwind fails to gather the backtrace as it
uses PTRACE calls.

Is there any way to overcome this without modifying the kernel code?

[-- Attachment #1.2: Type: text/html, Size: 804 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting backtrace of a process
  2021-06-14 15:10 Getting backtrace of a process hemanth nandish
@ 2021-06-15  6:01 ` Valdis Klētnieks
  0 siblings, 0 replies; 2+ messages in thread
From: Valdis Klētnieks @ 2021-06-15  6:01 UTC (permalink / raw)
  To: hemanth nandish; +Cc: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 502 bytes --]

On Mon, 14 Jun 2021 20:40:57 +0530, hemanth nandish said:

> As per my understanding, the *do_coredump* kills the faulty process inside
> *coredump_wait*  function before invoking the userspace handler,
> This might be the reason the libunwind fails to gather the backtrace as it
> uses PTRACE calls.
>
> Is there any way to overcome this without modifying the kernel code?

You might want to look at how gdb implements stuff like 'thread apply all bt',
which works just fine on a coredump.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-15  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 15:10 Getting backtrace of a process hemanth nandish
2021-06-15  6:01 ` Valdis Klētnieks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.