This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoints/1407: Gdb with gcc on Solaris crashes with segmentationfault when using "call"


The following reply was made to PR breakpoints/1407; it has been noted by GNATS.

From: Mark Kettenis <kettenis@chello.nl>
To: ac131313@redhat.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: breakpoints/1407: Gdb with gcc on Solaris crashes with segmentation
 fault when using "call"
Date: Sun, 12 Oct 2003 23:14:55 +0200 (CEST)

    Date: 11 Oct 2003 16:18:00 -0000
    From: Andrew Cagney <ac131313@redhat.com>
 
     Looking at the branch, it appears to be using ON_STACK, push_dummy_call, 
     and push_dummy_code?  That would mean that the hard bits are done.
 
 Yup it does.  But I thought there were still some hard bits to be
 done.
 
     Looking at the output from the testcase, GDB even appears to know
     that it's at the dummy frame breakpoint (the <function called from
     gdb> message).
 
 That's not really surprising.  The PC is pointing at the call dummy
 breakpoint on the stack.
 
     All that's missing is mods to "infrun.c" that let GDB interpret SEGV as 
     a breakpoint trap (not unreasonable if GDB's to get breakpoints using 
     memory mapping working).  Hmm, looking at the code:
 
 	   /* NOTE: cagney/2003-03-29: These two checks for a random signal
 	      at one stage in the past included checks for an inferior
 	      function call's call dummy's return breakpoint.  The original
 	      comment, that went with the test, read:
 
 	      ``End of a stack dummy.  Some systems (e.g. Sony news) give
 	      another signal besides SIGTRAP, so check here as well as
 	      above.''
 
 	      If someone ever tries to get get call dummys on a
 	      non-executable stack to work (where the target would stop
 	      with something like a SIGSEG), then those tests might need to
 	      be re-instated.  Given, however, that the tests were only
 	      enabled when momentary breakpoints were not being used, I
 	      suspect that it won't be the case.  */
 
 
 	   if (stop_signal == TARGET_SIGNAL_TRAP)
 	   ...
 
     Try changing it to:
 
 	   if (stop_signal == .._TRAP || _SEGV)
 
 Well, that doesn't work.  The attached patch however, does work.  I'll
 add some comments and check it in on the SPARC branch.
 
 Mark
 
 Index: infrun.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/infrun.c,v
 retrieving revision 1.113
 diff -u -p -r1.113 infrun.c
 --- infrun.c 14 Sep 2003 16:32:13 -0000 1.113
 +++ infrun.c 12 Oct 2003 21:06:00 -0000
 @@ -1854,6 +1854,7 @@ handle_inferior_event (struct execution_
    if (stop_signal == TARGET_SIGNAL_TRAP
        || (breakpoints_inserted &&
  	  (stop_signal == TARGET_SIGNAL_ILL
 +	   || stop_signal == TARGET_SIGNAL_SEGV
  	   || stop_signal == TARGET_SIGNAL_EMT))
        || stop_soon == STOP_QUIETLY
        || stop_soon == STOP_QUIETLY_NO_SIGSTOP)
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]