This is the mail archive of the gdb-patches@sourceware.org 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: [patch] Fix crash on conditional watchpoints (PR 11371)


On Tuesday 17 August 2010 22:14:09, Pedro Alves wrote:
> > > +static void
> > > +decref_bp_location (struct bp_location **blp)
> > > +{
> > 
> > I miss here some:
> >   gdb_assert ((*blp)->refc > 0);
> 
> Whoops, only after committing have I noticed that I forgot to
> add this, so I added it with the obvious followup patch.

For completeness, here it is.  I tested it on x86_64-linux.

-- 
Pedro Alves

gdb/
2010-08-17  Pedro Alves  <pedro@codesourcery.com>

	PR breakpoints/11371

	* breakpoint.c (decref_bp_location): Assert the reference count is
	sane.

---
 gdb/breakpoint.c |    2 ++
 1 file changed, 2 insertions(+)

Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c	2010-08-17 21:55:29.000000000 +0100
+++ src/gdb/breakpoint.c	2010-08-17 22:03:06.000000000 +0100
@@ -5423,6 +5423,8 @@ incref_bp_location (struct bp_location *
 static void
 decref_bp_location (struct bp_location **blp)
 {
+  gdb_assert ((*blp)->refc > 0);
+
   if (--(*blp)->refc == 0)
     free_bp_location (*blp);
   *blp = NULL;


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