g++ and signal handlers that use sigcontext

David L idht4n@hotmail.com
Wed Feb 18 21:52:00 GMT 2004


>>foo.cc: In function `int main()':
>>foo.cc:56: invalid conversion from `void*' to `void (*)(int)'
> >
> >What is the proper way to set up a signal handler with a 2nd argument 
> >(sigcontext )?

>See `man sigaction'. You want to assign to sa_sigaction instead of
>sa_handler as shown in listing 3 of the article you just referenced above.
>But leave out the stupid old style cast and just make sure bt_sighandler
>has the expected signature.

The man page for sigaction says:

      Before  the introduction of SA_SIGINFO it was also possible to get 
some
       additional information, namely by using a sa_handler with second  
argu-
       ment  of  type  struct sigcontext.  See the relevant kernel sources 
for
       details.  This use is obsolete now.

It doesn't say how to get the information that sigcontext used to provide.  
It's
very useful to know the line number that caused the crash rather than the 
line
number that called the function that caused the crash... this info used to 
be
provided by sigcontext.  Is there another way to get that info now?

Thanks
David

_________________________________________________________________
Click, drag and drop. My MSN is the simple way to design your homepage. 
http://click.atdmt.com/AVE/go/onm00200364ave/direct/01/



More information about the Gcc-help mailing list