From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6486 invoked by alias); 25 Apr 2008 02:36:53 -0000 Received: (qmail 6478 invoked by uid 22791); 25 Apr 2008 02:36:53 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 25 Apr 2008 02:36:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A31752A9DA6 for ; Thu, 24 Apr 2008 22:36:26 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AMc-jFBRsKFE for ; Thu, 24 Apr 2008 22:36:26 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3288E2A9D17 for ; Thu, 24 Apr 2008 22:36:26 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id ACE35E7ACD; Thu, 24 Apr 2008 19:36:23 -0700 (PDT) Date: Fri, 25 Apr 2008 14:26:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFC/ia64-linux] pb with shared libraries when attaching to process Message-ID: <20080425023623.GB16580@adacore.com> References: <20080425012331.GP1431@adacore.com> <20080425014746.GA10244@caradoc.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080425014746.GA10244@caradoc.them.org> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00570.txt.bz2 > > (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 : 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