Symbol can't be found unless type 'tab'

Yao Qi yao@codesourcery.com
Mon Sep 10 12:52:00 GMT 2012


Hi,
I am trying to create a piece of fake dwarf information that a 8-byte 
variable 'i' occupies two registers, as below, and it seems right to me.

Contents of the .debug_info section:

   Compilation Unit @ offset 0x0:
    Length:        0x34 (32-bit)
    Version:       2
    Abbrev Offset: 0
    Pointer Size:  4
  <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     <c>   DW_AT_name        : set-reg.c
     <16>   DW_AT_producer    : GNU C 3.3.3
     <22>   DW_AT_language    : 2        (non-ANSI C)
  <1><23>: Abbrev Number: 2 (DW_TAG_base_type)
     <24>   DW_AT_name        : 8byte
     <2a>   DW_AT_byte_size   : 8
     <2b>   DW_AT_encoding    : 7        (unsigned)
  <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)

Contents of the .debug_loc section:

     Offset   Begin    End      Expression
     00000000 080483d5 080483e6 (DW_OP_reg2 (edx); DW_OP_piece: 4; 
DW_OP_reg3 (ebx); DW_OP_piece: 4)
     00000000 <End of list>

However, the symbol 'i' can't be found unless I type 'tab' after command 
'p'.
(gdb) p i
No symbol "i" in current context.
(gdb) p // type 'tab'
Display all 7422 possibilities? (y or n) // type 'n'
(gdb) p/x i
$2 = 0x45396ff4bfffeff4

Turning 'debug symtab-create' on tells me that 'tab' triggers creating 
symtab, and I think that is the reason 'i' can be found after typing 
'tab'.  What should I complete/add in my faked dwarf information so that 
symbol 'i' can be found directly when the executable is loaded?  without 
typing 'tab' to resolve symbol 'i'.

-- 
Yao



More information about the Gdb mailing list