Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix for PR 1971 .
@ 2006-01-03 18:41 Ramana Radhakrishnan
  2006-01-03 23:34 ` Jim Blandy
  0 siblings, 1 reply; 9+ messages in thread
From: Ramana Radhakrishnan @ 2006-01-03 18:41 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

Hi , 

Attached is a fix for PR 1971. This inserts a breakpoint at the return
address for a function that does not have a previous frame which is what
you have in the case of main. This would however not stop after the
return from main because the semantics of the next command would not
stop the execution in any place where there is no debug information. 

Tested on native x86 with today's head as well as 6.4 branch with no
extra regressions .

Ok to commit with an additional testcase ?
 
cheers
Ramana

2006-01-03  Ramana Radhakrishnan  <ramana.radhakrishnan@codito.com>

	PR 1971
	* infrun.c (handle_inferior_event): Handle case where previous
	frame can be NULL. Use insert_step_resume_breakpoint_at_sal instead.


-- 
Ramana Radhakrishnan
GNU Tools
codito ergo sum (www.codito.com)

[-- Attachment #2: patch-pr1971 --]
[-- Type: text/x-patch, Size: 1187 bytes --]

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.208
diff -u -a -u -r1.208 infrun.c
--- infrun.c	17 Dec 2005 22:34:01 -0000	1.208
+++ infrun.c	3 Jan 2006 17:48:16 -0000
@@ -2390,8 +2390,22 @@
 	  /* We're doing a "next", set a breakpoint at callee's return
 	     address (the address at which the caller will
 	     resume).  */
-	  insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
-	  keep_going (ecs);
+ /* We're doing a "next", set a breakpoint at callee's return
+	     address (the address at which the caller will
+	     resume).  */
+	  if (get_prev_frame ( get_current_frame ()))
+	    {
+	      insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+	    }
+	  else
+	    {
+	        struct symtab_and_line sr_sal;
+		init_sal (&sr_sal);		/* initialize to zeros */
+		sr_sal.pc = ADDR_BITS_REMOVE (gdbarch_unwind_pc (current_gdbarch,get_current_frame()));
+		sr_sal.section = find_pc_overlay (sr_sal.pc);
+		insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	    }   
+	      keep_going (ecs);
 	  return;
 	}
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-01-04 13:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-03 18:41 Fix for PR 1971 Ramana Radhakrishnan
2006-01-03 23:34 ` Jim Blandy
2006-01-03 23:43   ` Jim Blandy
2006-01-04  5:07     ` Ramana Radhakrishnan
2006-01-04  5:55       ` Jim Blandy
2006-01-04  6:52         ` Ramana Radhakrishnan
2006-01-04  7:57           ` Jim Blandy
2006-01-04  8:27             ` Ramana Radhakrishnan
2006-01-04 13:56       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox