From: Tristan Gingold <gingold@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: "<gdb-patches@sourceware.org> ml" <gdb-patches@sourceware.org>
Subject: Re: [Patch] Fix windows 64 unwinding issues
Date: Wed, 18 Mar 2015 14:56:00 -0000 [thread overview]
Message-ID: <F4DAEB27-FAAD-4D5B-9F94-767DDBAEC2B2@adacore.com> (raw)
In-Reply-To: <550943A3.70709@redhat.com>
> On 18 Mar 2015, at 10:21, Pedro Alves <palves@redhat.com> wrote:
>
> Hi Tristan,
>
> Looks good to me. Thanks for the investigations and adding
> comments.
>
> Please fix the nits below and push.
Thanks for the review. Just pushed with the nits fixed.
Tristan.
>
> On 03/05/2015 01:42 PM, Tristan Gingold wrote:
>
>>
>> commit da3b5213dc072fca195451a04f35a2eb6342bb62
>> Author: Tristan Gingold <gingold@adacore.com>
>> Date: Thu Mar 5 14:36:32 2015 +0100
>>
>> Fix amd64 windows unwinding issues within MS dlls.
>>
>> Unwind info in system dlls uses almost all possible codes, contrary to unwind
>> info generated by gcc. A few issues have been discovered: incorrect handling
>> of SAVE_NONVOL opcodes and incorrect in prologue range checks. Furthermore I
>> added comments not to forget what has been investigated.
>>
>> gdb/ChangeLog:
>> * amd64-windows-tdep.c (amd64_windows_find_unwind_info): Move
>> redirection code to ...
>> (amd64_windows_frame_decode_insns): ... Here. Fix in prologue
>> checks. Fix SAVE_NONVOL operations. Add debug code and comments.
>>
>> diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
>> index 2aa10a1..9278a26 100644
>> --- a/gdb/amd64-windows-tdep.c
>> +++ b/gdb/amd64-windows-tdep.c
>> @@ -621,9 +621,47 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
>> CORE_ADDR cur_sp = cache->sp;
>> struct gdbarch *gdbarch = get_frame_arch (this_frame);
>> enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>> - int j;
>> + int first = 1;
>> +
>> + /* There are at least 3 possibilities to share an unwind info entry:
>> + 1. Two different runtime_function entries (in .pdata) can point to the
>> + same unwind info entry. There is no such indication while unwinding,
>> + so we don't really care about that case. We suppose this scheme is
>> + used to save memory when the unwind entries are exactly the same.
>
> tabs/spaces here don't look right.
>
>> + 2. Chained unwind_info entries, with no unwind codes (no prologue).
>> + There is a major difference with the previous case: the pc range for
>> + the function is different (in case 1, the pc range comes from the
>> + runtime_function entry; in case 2, the pc range for the chained entry
>> + comes from the first unwind entry). Case 1 cannot be used instead as
>
> Likewise.
>
>> + the pc is not in the prologue. This case is officially documented.
>> + (There might be unwind code in the first unwind entry to handle
>> + additionnal unwinding). GCC (at least until gcc 5.0) doesn't chain
>
> Typo "additionnal".
>
>> + entries.
>> + 3. Undocumented unwind info redirection. Hard to know the exact purpose,
>> + so it is considered as a memory optimization of case 2.
>> + */
>>
>> - for (j = 0; ; j++)
>> + if (unwind_info & 1)
>> + {
>> + /* Unofficially documented unwind info redirection, when UNWIND_INFO
>> + address is odd (http://www.codemachine.com/article_x64deepdive.html).
>> + */
>> + struct external_pex64_runtime_function d;
>> + CORE_ADDR sa, ea;
>> +
>> + if (target_read_memory (cache->image_base + (unwind_info & ~1),
>> + (gdb_byte *) &d, sizeof (d)) != 0)
>> + return;
>> +
>> + cache->start_rva =
>> + extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order);
>
> "=" goes on the next line.
>
>> + cache->end_rva =
>> + extract_unsigned_integer (d.rva_EndAddress, 4, byte_order);
>> + unwind_info =
>> + extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
>> + }
>
> Thanks,
> Pedro Alves
>
prev parent reply other threads:[~2015-03-18 14:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 13:42 Tristan Gingold
2015-03-18 9:02 ` Ping: " Tristan Gingold
2015-03-18 9:21 ` Pedro Alves
2015-03-18 14:56 ` Tristan Gingold [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=F4DAEB27-FAAD-4D5B-9F94-767DDBAEC2B2@adacore.com \
--to=gingold@adacore.com \
--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).