From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10836 invoked by alias); 17 Apr 2008 15:12:08 -0000 Received: (qmail 10824 invoked by uid 22791); 17 Apr 2008 15:12:07 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Apr 2008 15:11:43 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id m3HFBddo111322 for ; Thu, 17 Apr 2008 15:11:39 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m3HFBd7c3190916 for ; Thu, 17 Apr 2008 17:11:39 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m3HFBchH021459 for ; Thu, 17 Apr 2008 17:11:39 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id m3HFBc5N021455; Thu, 17 Apr 2008 17:11:38 +0200 Message-Id: <200804171511.m3HFBc5N021455@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 17 Apr 2008 17:11:38 +0200 Subject: Re: [RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address To: brobecker@adacore.com (Joel Brobecker) Date: Thu, 17 Apr 2008 15:29:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20070912211805.GF10540@adacore.com> from "Joel Brobecker" at Sep 12, 2007 02:18:05 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/msg00335.txt.bz2 Joel Brobecker wrote: > 2007-09-12 Joel Brobecker > > * solib-svr4.c: Add include of "auxv.h". > (enable_break): Use the AT_BASE auxiliary entry if available. > * Makefile.in (solib-svr4.o): Update dependencies. > > Tested on x86-linux, no regression. Currently testing on sparc-solaris, > but it's taking a loooong time because sigstep is keeps timing out to > death. It fixes the issue above, and I'm confident the results will be OK. It looks like this breaks remote debugging in the presence of prelinking. The problem is that AT_BASE is set by the kernel to the load bias (i.e. the difference between the actual load address and the load address as recorded in the ELF file) of the dynamic interpreter. GDB goes on to add back the load address from the ELF file, so that looks fine. However, when doing remote debugging, the ELF file GDB sees may be different from the ELF file that was used on the remote target. This happens in particular if a background prelinking job runs from time to time on the remote system. GDB used to work correctly in the presence of prelinking anyway, because for regular shared libraries it detected that mismatch by comparing the load addresses from the BFD it reads with those recorded in the dynamic loader's data structures (LM_ADDR_CHECK), and adjusting its expectations if it detects prelinking. However, this does not work for enable_break because this function must work *before* the dynamic loader gets a chance to set up those data structures. Any suggestions how this could be fixed? Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com