Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro_alves@portugalmail.pt>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [win32] wrong solib from/to addresses
Date: Tue, 12 Jun 2007 23:33:00 -0000	[thread overview]
Message-ID: <466F2D27.9000107@portugalmail.pt> (raw)
In-Reply-To: <20070612204900.GA4435@adacore.com>

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


  reply	other threads:[~2007-06-12 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 20:47 Joel Brobecker
2007-06-12 23:33 ` Pedro Alves [this message]
2007-06-13  2:21   ` Christopher Faylor
2007-06-13  3:09     ` Daniel Jacobowitz
2007-06-13  3:14       ` Christopher Faylor
2007-06-13  9:39       ` Joel Brobecker
2007-06-13 11:17         ` Daniel Jacobowitz
2007-06-13  9:31     ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=466F2D27.9000107@portugalmail.pt \
    --to=pedro_alves@portugalmail.pt \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox