This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [0/4] RFC: add DWARF index support
- From: Ken Werner <ken at linux dot vnet dot ibm dot com>
- To: Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Mon, 26 Jul 2010 20:40:17 +0200
- Subject: Re: [0/4] RFC: add DWARF index support
- References: <m3aaqcqhgn.fsf@fleche.redhat.com> <m3bp9z5jbz.fsf@fleche.redhat.com> <m363053l1o.fsf@fleche.redhat.com>
On Saturday, July 24, 2010 12:12:03 am Tom Tromey wrote:
> >>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
> Tom> Here is what I am testing.
>
> Here is the variant I am checking it. It seems to work with all
> combinations of .debug_types, .gdb_index, and -readnow.
>
> Let me know if you hit any more problems.
Hi Tom,
It seems old GCCs do not recognize that the types_list_elements and types_list
variables of dwarf2read.c:dwarf2_initialize_objfile are accessed under the
same condition as they are initialized. GCC 4.1.2 (RHEL5) issues the following
warning:
<snip>
src/gdb/dwarf2read.c: In function âdwarf2_initialize_objfileâ:
src/gdb/dwarf2read.c:1839: warning: âtypes_list_elementsâ may be used
uninitialized in this function
src/gdb/dwarf2read.c:1838: warning: âtypes_listâ may be used uninitialized in
this function
</snip>
The attached patch initializes the two variables to prevent the warnings.
OK to apply?
Regards
-ken
Changelog:
2010-07-06 Ken Werner <ken.werner@de.ibm.com>
* valops.c (dwarf2_read_index): Initialize the types_list and
types_list_elements variables.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.425
diff -p -u -r1.425 dwarf2read.c
--- dwarf2read.c 23 Jul 2010 22:15:13 -0000 1.425
+++ dwarf2read.c 26 Jul 2010 18:06:02 -0000
@@ -1835,8 +1835,10 @@ dwarf2_read_index (struct objfile *objfi
char *addr;
struct mapped_index *map;
offset_type *metadata;
- const gdb_byte *cu_list, *types_list;
- offset_type version, cu_list_elements, types_list_elements;
+ const gdb_byte *cu_list;
+ const gdb_byte *types_list = NULL;
+ offset_type version, cu_list_elements;
+ offset_type types_list_elements = 0;
int i;
if (dwarf2_per_objfile->gdb_index.asection == NULL