From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8628 invoked by alias); 12 Jun 2007 23:33:11 -0000 Received: (qmail 8618 invoked by uid 22791); 12 Jun 2007 23:33:10 -0000 X-Spam-Check-By: sourceware.org Received: from mu-out-0910.google.com (HELO mu-out-0910.google.com) (209.85.134.184) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Jun 2007 23:33:07 +0000 Received: by mu-out-0910.google.com with SMTP id g7so20266muf for ; Tue, 12 Jun 2007 16:33:04 -0700 (PDT) Received: by 10.82.174.20 with SMTP id w20mr71468bue.1181691184701; Tue, 12 Jun 2007 16:33:04 -0700 (PDT) Received: from ?88.210.69.54? ( [88.210.69.54]) by mx.google.com with ESMTP id h7sm330373nfh.2007.06.12.16.33.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 12 Jun 2007 16:33:03 -0700 (PDT) Message-ID: <466F2D27.9000107@portugalmail.pt> Date: Tue, 12 Jun 2007 23:33:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: Re: [win32] wrong solib from/to addresses References: <20070612204900.GA4435@adacore.com> In-Reply-To: <20070612204900.GA4435@adacore.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2007-06/txt/msg00211.txt.bz2 Hi Joel, Joel Brobecker wrote: > We are working on porting our product to Vista, and we have noticed > an issue that this version of the MS OS makes more apparent: The from/to > addresses printed in the "info shared" listing are correct only when > the DLL was loaded at the prefered load address (which is in the > ImageBase field of the COFF/PE header). > > I collegue of mine told me that, for security reasons, system DLLs > on Vista are now always rebased, and thus, the information printed > by info based is off by a certain offset. > > The core of the attached patch is to implement the target_so_ops > method relocate_section_addresses. For that, I needed to compute > the offset between the load address and the image_base, and store > it for later use (during the call of our routine above). There > were two challenges: > > 1. Compute this image base. Rather than dig into the COFF/PE > data, I took a simpler route that I think has already been > taken: Use the start address of the .text section. I think > this is already used to do the symbol relocation. > > 2. Make that information available: I found that the lm_info > field was not allocated, so I had to add its initialization. > > With all these changes, the address are correct again. > I had a similar patch here, that I dumped in favor of a rewrite of win32 solibs on top of Daniel's pending solib-target.c. If I remember correctly, if you are moving the relocation to relocate_section_addresses, you should remove get_relocated_section_addrs as it is doing the same work, albeit bypassing gdb's solib mechanism. In my version I didn't cache the image_base on lm_info, but computed it inside relocate_section_addresses. > Tested on x86-windows, no regression. Dejagnu on Vista is not working > at all for me, so I ran the testsuite on XP instead. Did you test this with a recent binutils/ld? With the binutils version distributed with Cygwin the dll tests fail, because of the use of the .so/.sl extension instead of .dll. Current ld from cvs recognizes dlls without looking at the file extension. Eg, does gdb.base/shreloc.exp pass for you? Cheers, Pedro Alves