This is the mail archive of the gdb-patches@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: [RFC/ia64-linux] pb with shared libraries when attaching to process


> > (the slot number is encoded in the last 4 bits of the address and
> > should be either 0, 1, or 2).
> 
> So what's actually at that address?  Dump a couple of words... my
> first guess is that it ends up being a function descriptor for
> _dl_debug_state, but GDB is somehow failing to convert it back into
> the breakpoint address.

Indeed!

   (gdb) x /2x 0x200000000003b768
   0x200000000003b768 <local+168>: 0x0001b720      0x20000000
   (gdb) x /i 0x200000000001b720
   0x200000000001b720 <_dl_debug_state>:   [MIB]       nop.m 0x0

Looking deeper into this, the problem is that GDB determins that
this symbol is in the .data section. The code that recognizes
function descriptors for ia64 checks first that the associated
section name is ".opd", or else checks the name of the symbol
with is_vtable_name() (see ia64-tdep.c:ia64_convert_from_func_ptr_addr).

I double checked /lib/ld-linux-ia64.so.2, and unless I'm mistaken,
the debugger is correct. Our address is inside the .data section
of the loader. There is no .opd section in sight.

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .hash         00000280  0000000000000120  0000000000000120  00000120  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynsym       00000888  00000000000003a0  00000000000003a0  000003a0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynstr       00000401  0000000000000c28  0000000000000c28  00000c28  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.version  000000b6  000000000000102a  000000000000102a  0000102a  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .gnu.version_d 00000080  00000000000010e0  00000000000010e0  000010e0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .rela.dyn     00001bc0  0000000000001160  0000000000001160  00001160  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rela.IA_64.pltoff 00000078  0000000000002d20  0000000000002d20  00002d20  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .plt          00000120  0000000000002da0  0000000000002da0  00002da0  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  8 .text         00024450  0000000000002ec0  0000000000002ec0  00002ec0  2**6
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  9 .rodata       00002722  0000000000027310  0000000000027310  00027310  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .IA_64.unwind_info 00001008  0000000000029a38  0000000000029a38  00029a38  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 .IA_64.unwind 00000b28  000000000002aa40  000000000002aa40  0002aa40  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 .data         00004180  000000000003b568  000000000003b568  0002b568  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 13 .dynamic      00000170  000000000003f6e8  000000000003f6e8  0002f6e8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 14 .got          000000e8  000000000003f858  000000000003f858  0002f858  2**3
                  CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA
 15 .IA_64.pltoff 00000050  000000000003f940  000000000003f940  0002f940  2**4
                  CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA
 16 .sdata        00000868  000000000003f990  000000000003f990  0002f990  2**3
                  CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA
 17 .sbss         0000010c  00000000000401f8  00000000000401f8  000301f8  2**3
                  ALLOC, SMALL_DATA
 18 .bss          00000748  0000000000040308  0000000000040308  000301fc  2**3
                  ALLOC
 19 .comment      00000535  0000000000000000  0000000000000000  000301fc  2**0
                  CONTENTS, READONLY

-- 
Joel


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