The simple way to get a core that "starts" at the fault is not to block signals. Obviously this has some very bad downsides.
Otherwise with what you have done you have to traverse stack frames back to the problem, in gdb this is the
command. Signal receipt when blocked causes an immediate interrupt to the executing code, pushing the state of the process and kernel onto the interrupt stack. Working backwards can be fun.
Some example code for gaddr2line():
Note that you should consider libelf instead of the python library.
I am using dbx for debugging core and the corresponding command for backtrace is where in dbx. But as I said earlier I am getting the stack of signal handler routine through backtrace and not the location of faulty code.
Hi,
Is there anything you can do to a *nix (SuSE Linux actually) which allows it to *try* to do a reboot if something crashes the system?
I know they have something at work (but I don't work with the servers myself) which makes the server reboot if it crashes/locks (works about 80% of the... (0 Replies)
Hi there,
I found a link to a file /dev/core of 17 GB
Is it ok??? I couldn't find many information about it.
Any suggestion would be appreciated!!!
Thanks in advance,
Giordano Bruno
PS: I'm working with FEDORA 6 (2 Replies)
Hi All,
I have scenario where my callback function data_update() can be called anytime. I have written the function data_update() such that it will create detached thread for processing the data sent to this function.
data_update()
{
pthread_attr_t attr_thread;
... (1 Reply)
I´m writing this program in QNX , I`m kinda new to UNIX and programing in general, and when I try to run it it gives me the Memory Fault error. Can anyone help?
#include <stdio.h>
#include <fcntl.h>
void main(void)
{int a,ter;
char buf;
printf("a=");
scanf("%d",a);
ter=open... (6 Replies)
in a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario:
client:Knock Knock
server:who's there
client: Eric
Server:Eric,Welcome.
client:exit
all process terminated
... (1 Reply)
Greetings,
I am writing a small program in C on UNIX, in which I am using (POSIX reliable) signals.
1. Suppose I have a signal : SIGX, and the corresponding signal handler : sigx_handler.
It is possible to receive SIGX in my process, and, while executing sigx_handler, to receive
again... (0 Replies)
I am in process of writing a library which can make any application of my product capable of creating core in the application's log folder with a product friendly core file name programatically. In my library I am registering for certain signals e.g. SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGABRT... (1 Reply)
What will happen if signal comes while a system call is being executed?
How it will be handled? (1 Reply)
Discussion started by: rupeshkp728
1 Replies
LEARN ABOUT MOJAVE
backtrace_symbols_fd
backtrace(3) BSD Library Functions Manual backtrace(3)NAME
backtrace, backtrace_symbols, backtrace_symbols_fd -- call stack backtrace and display functions
SYNOPSIS
#include <execinfo.h>
int
backtrace(void** array, int size);
char**
backtrace_symbols(void* const* array, int size);
void
backtrace_symbols_fd(void* const* array, int size, int fd);
DESCRIPTION
These routines provide a mechanism to examine the current thread's call stack.
backtrace() writes the function return addresses of the current call stack to the array of pointers referenced by array. At most, size
pointers are written. The number of pointers actually written to array is returned.
backtrace_symbols() attempts to transform a call stack obtained by backtrace() into an array of human-readable strings using dladdr(). The
array of strings returned has size elements. It is allocated using malloc() and should be released using free(). There is no need to free
the individual strings in the array.
backtrace_symbols_fd() performs the same operation as backtrace_symbols(), but the resulting strings are immediately written to the file
descriptor fd, and are not returned.
EXAMPLE
#include <execinfo.h>
#include <stdio.h>
...
void* callstack[128];
int i, frames = backtrace(callstack, 128);
char** strs = backtrace_symbols(callstack, frames);
for (i = 0; i < frames; ++i) {
printf("%s
", strs[i]);
}
free(strs);
...
HISTORY
These functions first appeared in Mac OS X 10.5.
SEE ALSO dladdr(3), malloc(3)Mac OS X February 15, 2007 Mac OS X