This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Symbol can't be found unless type 'tab'


On Wed, 12 Sep 2012 09:44:44 +0200, Yao Qi wrote:
> On 09/10/2012 09:18 PM, Jan Kratochvil wrote:
> >On Mon, 10 Sep 2012 14:51:29 +0200, Yao Qi wrote:
> >>>  <1><2c>: Abbrev Number: 3 (DW_TAG_variable)
> >>>     <2d>   DW_AT_name        : i
> >>>     <2f>   DW_AT_type        : <0x23>
> >>>     <33>   DW_AT_location    : 0x0      (location list)
> >I guess because GDB does not like such complicated location expression for
> >glboal variables.
> 
> Jan, thanks for the pointer.
> 
> The "symptom" is symbol is not found in psymtab, but in symtab when
> I press 'tab' which triggers converting psymtab to symtab.  I wonder
> why symbol 'i' is *not* included in psymtab.

Because it has the complex location I suggested above.


> Examine the source of
> dwarf2read.c:add_partial_symbol, especially the case block for
> 'DW_TAG_variable', gives me some clue, and I add attribute
> DW_AT_external to symbol 'i' like this,
> 
>  <1><33>: Abbrev Number: 3 (DW_TAG_variable)
>     <34>   DW_AT_name        : i
>     <36>   DW_AT_type        : <0x2a>
>     <3a>   DW_AT_external    : 1  <--- here
>     <3b>   DW_AT_location    : 0x0      (location list)
> 
> and then symbol 'i' can be found by GDB without typing extra 'tab'.

It is difficult to talk about the problem when you have not provided the
testcase, I have provided mine now.

But DW_AT_external is not significant to GDB as GDB can display even static
variables, even when they are not in current CU.

It is good to verify 'maintenance info symtabs' is empty during these
experiments, when one tries to print the variable.

I am very sure that this complex DW_AT_location is not properly supported by
psymtabs in GDB, this is one of the reasons I was doing the fix and its later
undo as I referenced in the previous mail.

Why didn't use just normal DWARF block, instead of the location list?
This part does not matter for your testcase and it will work with GDB.


Jan

Attachment: i.c
Description: Text document

Attachment: i.s
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]