public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Evgeny Eltsin <eaeltsin@google.com>
To: gdb <gdb@sourceware.org>
Subject: [mingw] gdb does not handle rebased executables?
Date: Tue, 07 Feb 2012 13:51:00 -0000	[thread overview]
Message-ID: <CAJ_Jj1r7XvucR8S0bqDeTLu_pKnjUJYsyZd=RY5Ewb5gAAHJGQ@mail.gmail.com> (raw)

Hi,

It seems like gdb does not take into account that executable can be
rebased, so that process image base differs from what is given in the
PE file. When attaching to such a process, all its symbols in gdb have
wrong addresses.

We've made a dumb fix for that, by saving the image base at
CREATE_PROCESS_DEBUG_EVENT processing, and using it later right inside
attach_command_post_wait to relocate the executable.

However, injecting Windows-specific code in attach_command_post_wait
is ugly. Can you give me a hint which hook I can use to relocate the
executable after attach_command_post_wait figures it out? Probably
some observer event?

wbr,
Evgeny

P.S. For SVR4, something similar is done in
svr4_solib_create_inferior_hook -> svr4_relocate_main_executable. What
about Windows?

                 reply	other threads:[~2012-02-07 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAJ_Jj1r7XvucR8S0bqDeTLu_pKnjUJYsyZd=RY5Ewb5gAAHJGQ@mail.gmail.com' \
    --to=eaeltsin@google.com \
    --cc=gdb@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).