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]

[patch] Add asserts to {decrement,increment}_reading_symtab


Hi.
While implementing a fix for something I came across this and thought
these asserts useful enough.

I will check this in in a few days if there are no objections.
Regression tested on amd64-linux.

2013-05-07  Doug Evans  <dje@google.com>

	* symfile.c (decrement_reading_symtab): Add assert.
	(increment_reading_symtab): Ditto.

Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.375
diff -u -p -r1.375 symfile.c
--- symfile.c	7 May 2013 00:02:12 -0000	1.375
+++ symfile.c	8 May 2013 00:39:56 -0000
@@ -160,6 +160,7 @@ static void
 decrement_reading_symtab (void *dummy)
 {
   currently_reading_symtab--;
+  gdb_assert (currently_reading_symtab >= 0);
 }
 
 /* Increment currently_reading_symtab and return a cleanup that can be
@@ -169,6 +170,7 @@ struct cleanup *
 increment_reading_symtab (void)
 {
   ++currently_reading_symtab;
+  gdb_assert (currently_reading_symtab > 0);
   return make_cleanup (decrement_reading_symtab, NULL);
 }
 


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