From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18945 invoked by alias); 25 Mar 2014 20:43:28 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 18935 invoked by uid 89); 25 Mar 2014 20:43:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: smtp.smtpout.orange.fr Received: from smtp02.smtpout.orange.fr (HELO smtp.smtpout.orange.fr) (80.12.242.124) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Mar 2014 20:43:26 +0000 Received: from beldin ([82.125.28.20]) by mwinf5d56 with ME id hwjN1n00U0S25PW03wjPkj; Tue, 25 Mar 2014 21:43:23 +0100 From: Robert Jarzmik To: gdb@sourceware.org Cc: robert.jarzmik@intel.com Subject: Gdb, PIE and scan_dyntag(DT_DEBUG) X-URL: http://belgarath.falguerolles.org/ Date: Tue, 25 Mar 2014 20:43:00 -0000 Message-ID: <87bnwuuhzp.fsf@free.fr> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-03/txt/msg00066.txt.bz2 Hello, I'm pretty sure this was already covered somewhere, so a pointer would be great. I have a problem with gdb not finding the shared library list when analyzing a core dump of an ELF-X86-64 binary on Linux. After putting traces here and there, it boils down to : - the executable is placed at a random address (ASLR in linux) - the displacement is correctly input in AUXV - the linker base is not correctly computed The trouble lies in the scan_dyntag(DT_DEBUG) called by elf_locate_base() for me : - it tries first target_ops=core_ops, and looks at non-displaced address of .dynamic => failure => that's great - it then tries target_ops=exec_ops, and looks at non-displaced address of .dynamic => it succeeds, returning 0 => that's my problem As the call succeeded, elf_locate_base() won't call scan_dyntag_auxv() I manually "forced" elf_locate_base() to call scan_dyntag_aux() and then all my shared libraries appear. Could somebody tell me what's wrong in my core/executable/whatever, and why GDB is looking at the executable file .dynamic section before attempting AUXV AT_BASE reading and memory read accordingly ? Cheers. -- Robert PS: I'm using GDB 7.6. If it was fixed later I'll happily cherry-pick the patch.