This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH]Add symbol whose field 'has_type' has been set to partial symbol table
- From: hex <heixia108 at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 24 Oct 2013 14:59:46 +0800
- Subject: [PATCH]Add symbol whose field 'has_type' has been set to partial symbol table
- Authentication-results: sourceware.org; auth=none
This patch intends to add symbol whose field 'has_type' has been set
to partial symbol table.
e.g.
// test.c
const int var = 3;
// Then compile it with `gcc -g -c test.c`(For the lastest GCC, we
need use 'gcc -g -O1 -c test.' to get the following DIE)
We could see the DIE of 'var' is as following:
<1><25>: Abbrev Number: 2 (DW_TAG_variable)
<26> DW_AT_name : var
<2a> DW_AT_decl_file : 1
<2b> DW_AT_decl_line : 1
<2c> DW_AT_type : <0x31>
<30> DW_AT_const_value : 3
Latest GDB will not add it to partial symbol table because its symbol
satisfies 'pdi->d.locdesc == NULL'. I think we need add it to partial
symbol table.
2013-10-24 Jun Gong <heixia108@gmail.com>
* dwarf2read.c(add_partial_symbol): Add symbol whose field
'has_type' has been set to partial symbol table.
--- gdb-7.6.50.20131021.orig/gdb/dwarf2read.c 2013-10-16
10:55:27.000000000 +0800
+++ gdb-7.6.50.20131021/gdb/dwarf2read.c 2013-10-24 14:29:18.737067814 +0800
@@ -6733,8 +6733,9 @@ add_partial_symbol (struct partial_die_i
}
else
{
- /* Static Variable. Skip symbols without location descriptors. */
- if (pdi->d.locdesc == NULL)
+ /* Static Variable. Skip symbols without location descriptors or
+ has_type not set. */
+ if (pdi->d.locdesc == NULL && pdi->has_type == 0)
{
xfree (built_actual_name);
return;