Re: Core dump question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 15, 2005 at 07:18:48AM -0800, Steve Iribarne wrote:
> 1.  Does anyone know of a good library that I can build my app with that
> I can do a quick stack trace and dump those results somewhere.
 
Glibc include the backtrace*() family of functions, see "info libc".
Here's an excerpt:

- Function: int backtrace (void **BUFFER, int SIZE)
     The `backtrace' function obtains a backtrace for the current
     thread, as a list of pointers, and places the information into
     BUFFER.  The argument SIZE should be the number of `void *'
     elements that will fit into BUFFER.  The return value is the
     actual number of entries of BUFFER that are obtained, and is at
     most SIZE.

 - Function: char ** backtrace_symbols (void *const *BUFFER, int SIZE)
     The `backtrace_symbols' function translates the information
     obtained from the `backtrace' function into an array of strings.
     The argument BUFFER should be a pointer to an array of addresses
     obtained via the `backtrace' function, and SIZE is the number of
     entries in that array (the return value of `backtrace').

 - Function: void backtrace_symbols_fd (void *const *BUFFER, int SIZE,
          int FD)
     The `backtrace_symbols_fd' function performs the same translation
     as the function `backtrace_symbols' function.  Instead of returning
     the strings to the caller, it writes the strings to the file
     descriptor FD, one per line.  It does not use the `malloc'
     function, and can therefore be used in situations where that
     function might fail.


pstack(1) will print a stack backtrace of a running process.

Coretrace is a small backtrace program for core dumps,
http://www.arbetsmyra.dyndns.org/coretrace/

> 2.  Can someone tell me how to make the coredump happen in a "known"
> good location.

My /etc/sysctl.conf looks like:

# Controls where core dumps are stored and how they are named.
# See linux/Documentation/sysctl/kernel.txt for details.
kernel.core_pattern = /extra_disk/core/%e:%t:%s:%h:%u:%g:%p
kernel.suid_dumpable = 2

The suid_dumpable sysctl is from a patch posted by Alan Cox to the lkml,
http://marc.theaimsgroup.com/?l=linux-kernel&m=109647550421014&w=2

	-Bill

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux