From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6438 invoked by alias); 25 Jul 2009 02:11:30 -0000 Received: (qmail 6429 invoked by uid 22791); 25 Jul 2009 02:11:30 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_WEB,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-qy0-f198.google.com (HELO mail-qy0-f198.google.com) (209.85.221.198) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 25 Jul 2009 02:11:22 +0000 Received: by qyk36 with SMTP id 36so2720406qyk.12 for ; Fri, 24 Jul 2009 19:11:20 -0700 (PDT) Received: by 10.224.89.8 with SMTP id c8mr4035375qam.133.1248487880626; Fri, 24 Jul 2009 19:11:20 -0700 (PDT) Received: from hotblack.localnet ([201.82.211.45]) by mx.google.com with ESMTPS id 5sm5993268qwh.1.2009.07.24.19.11.18 (version=SSLv3 cipher=RC4-MD5); Fri, 24 Jul 2009 19:11:19 -0700 (PDT) From: Thiago Jung Bauermann To: Paul Pluzhnikov Subject: Re: [7.0] PR/9723: gdb breakpoints silently fail on PIE binaries Date: Sat, 25 Jul 2009 02:11:00 -0000 User-Agent: KMail/1.11.4 (Linux/2.6.30-1-amd64; KDE/4.2.4; x86_64; ; ) Cc: gdb@sourceware.org, Joel Brobecker References: <200907192257.08197.thiago.bauermann@gmail.com> <8ac60eac0907192113s54f996a7m2fac203e07687272@mail.gmail.com> In-Reply-To: <8ac60eac0907192113s54f996a7m2fac203e07687272@mail.gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200907242312.42358.thiago.bauermann@gmail.com> X-IsSubscribed: yes 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 X-SW-Source: 2009-07/txt/msg00194.txt.bz2 Em Segunda-feira 20 Julho 2009 01:13:00 Paul Pluzhnikov escreveu: > On Sun, Jul 19, 2009 at 6:57 PM, Thiago Jung > > Bauermann wrote: > > All this to say: can somebody save me some research time and tell in high > > level how can I recognize from looking at an ELF file that I'm dealing > > with a PIE binary (NOT a PIC library, of course)? Something like "see if > > the frob bit in the bozo section is set") is enough, I can go from there. > > Elf*_Ehdr.e_type == ET_DYN for the main executable? > > Elf*_Phdr.p_vaddr == 0 for the first PT_LOAD segment? > [This one is only true for non-prelinked -pie executable.] Great, thanks for the tip. Since nobody jumped into discussion, I assume any of those ways will work and have no known side-effect or false positive/negative. We'll see. :-) Now I have this issue, I'd like to ask people's opinion about it: by design (or defect?) the BFD library is a PITA to access the program header. I feel very tempted to use elf32.h and elf64.h directly in order to check that field. My only worry is that a cross-debugging session with a win32 gdb and a linux remote target would not be possible, unless windows includes such sysv elf headers too (perhaps it does?). Do you have an opinion? -- []'s Thiago Jung Bauermann