Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Set a breakpoint's type before adjusting its address
@ 2007-04-27 22:25 Kevin Buettner
  2007-04-28 21:54 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Buettner @ 2007-04-27 22:25 UTC (permalink / raw)
  To: gdb-patches

At the moment, running GDB on an FR-V target will generate lots of
"reading through apparently deleted breakpoint" warnings.  This is due
to the fact that (due to architectural constraints) FR-V needs to
adjust breakpoint addresses.  When it does so, it reads through
read_memory_nobpt(), triggering the warning due to the fact that the
breakpoint's type hasn't been set yet.  The patch below moves the type
assignment prior to the adjustment thus avoiding this situation.

Comments?

	* breakpoint.c (set_raw_breakpoint): Set breakpoint type before
	attempting to adjust its address.

Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.244
diff -u -p -r1.244 breakpoint.c
--- gdb/breakpoint.c	10 Apr 2007 14:53:46 -0000	1.244
+++ gdb/breakpoint.c	27 Apr 2007 22:06:44 -0000
@@ -4213,6 +4213,14 @@ set_raw_breakpoint (struct symtab_and_li
 
   b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
   memset (b, 0, sizeof (*b));
+
+  /* Set type before performing breakpoint adjustment.  If the breakpoint
+     needs to be adjusted, it's possible that this raw breakpoint will be
+     read by read_memory_nobpt().  If the type is unset (zero), the
+     "reading through apparently deleted breakpoint" warning will be
+     triggered.  */
+  b->type = bptype;
+
   b->loc = allocate_bp_location (b, bptype);
   b->loc->requested_address = sal.pc;
   b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
@@ -4223,7 +4231,6 @@ set_raw_breakpoint (struct symtab_and_li
     b->source_file = savestring (sal.symtab->filename,
 				 strlen (sal.symtab->filename));
   b->loc->section = sal.section;
-  b->type = bptype;
   b->language = current_language->la_language;
   b->input_radix = input_radix;
   b->thread = -1;


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

end of thread, other threads:[~2007-05-03 17:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-27 22:25 [rfc] Set a breakpoint's type before adjusting its address Kevin Buettner
2007-04-28 21:54 ` Daniel Jacobowitz
2007-05-03  0:15   ` Kevin Buettner
2007-05-03  2:38     ` Daniel Jacobowitz
2007-05-03 17:44       ` Kevin Buettner

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