Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/2] gdb: make is_linked_with_cygwin_dll handle import table not at beginning of .idata section
Date: Thu, 16 Apr 2020 20:21:49 +0100	[thread overview]
Message-ID: <d0f88ff6-3cef-1d21-b06f-37d0025a467f@redhat.com> (raw)
In-Reply-To: <20200416184739.205859-1-simon.marchi@polymtl.ca>

On 4/16/20 7:47 PM, Simon Marchi via Gdb-patches wrote:
> When loading the file C:\Windows\SysWOW64\msvcrt.dll, taken from a
> Windows 10 system, into GDB, we get the following warning:
> 
>     warning: Failed to parse .idata section: name's virtual address (0x0) is outside .idata section's range [0xb82b8, 0xb97f0[.
> 
> This uncovers an issue with how we parse the import table, part of the
> .idata section.  Right now, we assume that the import table is located
> at the beginning of the section.  That was the case in everything I had
> tried so far, but this file is an example where that's not true.
> 
> We need to compute the offset of the import table within the .idata
> section, and start there, instead of at the beginning of the .idata
> section.  Using the file mentioned above, this is the values we have to
> work with:
> 
>   A) bfd_section_vma (idata_section)    101b8000
>   B) Import table's virtual address        b82b8
>   C) Image base                         10100000
> 
> The virtual address that BFD returns us for the section has the image
> base applied, so we need to subtract it first.  The offset of the table
> in the section is therefore:
> 
>     B - (A - C)
> 
> This patch implements that.
> 
> gdb/ChangeLog:
> 
> 	windows-tdep.c (is_linked_with_cygwin_dll): Consider case where
> 	import table is not at beginning of .idata section.

Note the missing leading '*'.

This version looks good to me.  Both patches.

Thanks,
Pedro Alves



  parent reply	other threads:[~2020-04-16 19:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 15:45 [PATCH] " Simon Marchi
2020-04-16 16:27 ` Pedro Alves
2020-04-16 16:52   ` Simon Marchi
2020-04-16 18:47 ` [PATCH v2 1/2] " Simon Marchi
2020-04-16 18:47   ` [PATCH v2 2/2] gdb: is_linked_with_cygwin_dll: mention filename in warning messages Simon Marchi
2020-04-16 19:21   ` Pedro Alves [this message]
2020-04-16 19:47     ` [PATCH v2 1/2] gdb: make is_linked_with_cygwin_dll handle import table not at beginning of .idata section Simon Marchi

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=d0f88ff6-3cef-1d21-b06f-37d0025a467f@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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