public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>, 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 15:47:47 -0400	[thread overview]
Message-ID: <42607e57-4c55-3a23-6712-b61e5fc75992@polymtl.ca> (raw)
In-Reply-To: <d0f88ff6-3cef-1d21-b06f-37d0025a467f@redhat.com>

On 2020-04-16 3:21 p.m., Pedro Alves wrote:
> 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 '*'.

Oops, fixed.

> This version looks good to me.  Both patches.

Both patches pushed, thanks.

Simon

      reply	other threads:[~2020-04-16 19:47 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   ` [PATCH v2 1/2] gdb: make is_linked_with_cygwin_dll handle import table not at beginning of .idata section Pedro Alves
2020-04-16 19:47     ` Simon Marchi [this message]

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=42607e57-4c55-3a23-6712-b61e5fc75992@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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).