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

Re: Signal handler for SIGSEGV



Nguyen Thai wrote:
> 
> Hi all,
> I just want to ask some small questions :):
> 
> Does anyone work with replacing SIGSEGV handler on developer board lx? Could
> you give me an example?
> 

To register another signal handler you simply call

   sighandler_t signal(int signum, sighandler_t action);

where signum is SIGSEGV in your case, and action is your new signal
handler, or one of SIG_IGN (to ignore the signal) and SIG_DFL (for
default behaviour).  The signal handler is declared as:

   typedef void (*sighandler_t)(int);

which means it should take an integer argument and return void.  There
are some restrictions on what you can do inside a signal handler; refer
to a UNIX programming book for that.  There are a couple of examples in
busybox/syslogd.c.

> Regarding with gdbserver: can we open source file while debuging with
> gdbserver, if yes, how?

I don't think I understand your problem.  Do you want to be able to see
the source code of the debugged program in gdb?  In that case you need
the -g flag when compiling to get debug info, and the -s flag should be
omitted when linking (more info at
http://developer.axis.com/software/tools/gdb-cris/ under So You Want To
Debug).

/Orjan

-- 
Orjan Friberg              E-mail: orjan.friberg@xxxxxxx.com
Axis Communications AB     Phone:  +46 46 272 17 68