This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Do not crash on missing template parameter names
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 8 Sep 2010 19:19:40 -0400
- Subject: [commit] Do not crash on missing template parameter names
The DWARF-3 spec I have handy is inconsistent about whether DW_AT_name
is required. Sometimes it's listed as must, other times as may. In
practice, it seems that RealView omits it. This patch just avoids
pushing NULLs onto the in-scope list, which leads to crashes in
temargs.exp down the road.
Tested on arm-eabi, checked in.
--
Daniel Jacobowitz
CodeSourcery
2010-09-08 Daniel Jacobowitz <dan@codesourcery.com>
* dwarf2read.c (read_func_scope, read_structure_type)
(read_common_block): Check for a NULL return from new_symbol.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.452
diff -u -p -r1.452 dwarf2read.c
--- dwarf2read.c 8 Sep 2010 19:09:42 -0000 1.452
+++ dwarf2read.c 8 Sep 2010 23:13:20 -0000
@@ -5479,7 +5479,8 @@ read_func_scope (struct die_info *die, s
{
struct symbol *arg = new_symbol (child_die, NULL, cu);
- VEC_safe_push (symbolp, template_args, arg);
+ if (arg != NULL)
+ VEC_safe_push (symbolp, template_args, arg);
}
else
process_die (child_die, cu);
@@ -6818,7 +6819,8 @@ process_structure_scope (struct die_info
{
struct symbol *arg = new_symbol (child_die, NULL, cu);
- VEC_safe_push (symbolp, template_args, arg);
+ if (arg != NULL)
+ VEC_safe_push (symbolp, template_args, arg);
}
child_die = sibling_die (child_die);
@@ -7299,7 +7301,7 @@ read_common_block (struct die_info *die,
{
sym = new_symbol (child_die, NULL, cu);
attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
- if (attr)
+ if (sym != NULL && attr != NULL)
{
CORE_ADDR byte_offset = 0;