Segmentation fault

Derek Martin dmartin at ne.arris-i.com
Sun Feb 6 16:54:28 EST 2000


On Sun, 6 Feb 2000, Brad Noyes wrote:

> Hello,
> 
> I'm writing a c++ program that before i changed distributions from RH6.0, to
> Mandrake worked. But now i try to run it i get a Segmentation fault when i
> execute it with no core dump. 

This doesn't make sense to me, but then I don't use C++ so it may be that
C++ is doing some sort of exception handling that is preventing the core
dump, but I'm just speculating.  In C, in order to prevent the core
dump you'd have to do something like

int main( arg stuff here..){

...
 
   signal( SIGSEGV, mysighandler );

...

}

int mysighandler( void ){

  fprintf(stderr, "Seg Fault\n" );
  exit(1);
}


I assume C++ has some sort of similar signal handling, but I'd expect that
you'd have had to do something to make it work...


> Is there anyway that i can figure out why it is seg faulting with gdb,
> or something? 

Yes, compile the program with debug info ( -g option ) and trace it with
gdb.


-- 
"Quis custodiet ipsos custodes?"    "Who watches the watchmen?" 
-Juvenal, Satires, VI, 347 

Derek D. Martin      |  Senior UNIX Systems/Network Administrator
Arris Interactive    |  A Nortel Company
derekm at mediaone.net  |  dmartin at ne.arris-i.com
-------------------------------------------------

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list