Discard nested LBRAC symbols without crashing
Michael Elizabeth Chastain
chastain@cygnus.com
Tue Dec 21 17:36:00 GMT 1999
Hello gdb-patches people,
Here is my first gdb patch ever. Any feedback is welcome.
The problem:
In dbxread.c, the function "process_one_symbol" checks for
nested definitions of 'F' symbols, complains about them, and
ignores them. Unfortunately it messes up the symbol table
by calling 'finish_block' before issuing the complaint.
The fix:
Change process_one_symbol to check for nested definitions
before calling 'finish_block' rather than after.
This patch applies cleanly to gdb-19991213 snapshot and ought to
apply to any version in the past several years.
Michael Elizabeth Chastain
< mailto:chastain@cygnus.com >
"love without fear"
---
Index: gdb/dbxread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/dbxread.c,v
retrieving revision 1.243
diff -u -r1.243 dbxread.c
--- dbxread.c 1999/11/25 05:56:21 1.243
+++ dbxread.c 1999/12/22 01:17:52
@@ -2379,6 +2379,18 @@
function_start_offset = valu;
within_function = 1;
+
+ /*
+ * 15 Dec 1999, chastain@cygnus.com
+ * This fixes CR-102753 by catching unmatched lbrac before
+ * trying to finish the symbol.
+ */
+ if (context_stack_depth > 1)
+ {
+ complain (&lbrac_unmatched_complaint, symnum);
+ break;
+ }
+
if (context_stack_depth > 0)
{
new = pop_context ();
@@ -2386,9 +2398,6 @@
finish_block (new->name, &local_symbols, new->old_blocks,
new->start_addr, valu, objfile);
}
- /* Stack must be empty now. */
- if (context_stack_depth != 0)
- complain (&lbrac_unmatched_complaint, symnum);
new = push_context (0, valu);
new->name = define_symbol (valu, name, desc, type, objfile);
More information about the Gdb-patches
mailing list