This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Add asserts to {decrement,increment}_reading_symtab
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 07 May 2013 18:06:25 -0700
- Subject: [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);
}