Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>,
	Joel Brobecker <brobecker@adacore.com>,
	Roland Schwingel <roland.schwingel@onevision.de>
Subject: Re: [PATCH v3] Windows x64 SEH unwinder
Date: Fri, 23 Aug 2013 06:54:00 -0000	[thread overview]
Message-ID: <9FD66EEA-C685-4F32-8F91-F9E0FF6AAAEE@adacore.com> (raw)
In-Reply-To: <52163929.1090008@redhat.com>


On Aug 22, 2013, at 6:15 PM, Pedro Alves <palves@redhat.com> wrote:

> On 08/22/2013 04:41 PM, Tristan Gingold wrote:
>> 
>> On Aug 22, 2013, at 5:26 PM, Pedro Alves <palves@redhat.com> wrote:
>> 
>>> On 08/22/2013 10:33 AM, Tristan Gingold wrote:
>>>> 
>>>> after discussion with Roland Schwingel, I have found that the patch
>>>> doesn't handle well dwarf3 DW_OP_call_frame_cfa, because the SEH
>>>> unwinder is before the dwarf2 one.
>>> 
>>> Can you clarify this a little better for the archives?
>> 
>> Sure.
>> 
>>> So that mean that for binaries built before that gcc fix,
>>> the SEH unwinder won't kick in at all, right?
>> 
>> No.
>> If dwarf2 info are presents, they will be used to unwind the
>> frames.  If they aren't, unwinding will probably fail.
> 
> Okay, I ISTR now that the SEH unwinder needs to always kicks
> in, as leaf frames are identified by absence of SEH...  So on
> old binaries without SEH and without dwarf, the SEH unwinder
> will kick in, but the SEH unwinder will probably think all
> functions are leaf, and that naturally most probably fails.

Correct.  But it should be roughly as good as without the SEH
unwinder.

> Good, now we have somewhere archived to point people at
> once someone complains.  :-)
> 
>> 
>>> Then,
>>> how come this fixes Roland's age old issue, and improves
>>> unwinding for him?
>> 
>> For the part compiled with gcc, the patch shouldn't change
>> anything.  But for function compiled by MS compilers (those
>> in dll), gdb will now unwind their frame by using the SEH
>> unwinder,
> 
> Got it.
> 
>> 
>>> In the previous versions, there was talk about needing
>>> finer ordering of the unwinders in order to support both
>>> old and new binaries.  What changed?  Why is this okay
>>> now?
>> 
>> Unwinding was possible when compiled with -g.  It is still
>> possible.
>> Version 1 and 2 of the patch failed, because the dwarf
>> unwinder was never used (always masked by the SEH unwinder).
> 
> I understand that, but what I'm asking is about this discussion
> in v2:
> 
> http://sourceware.org/ml/gdb-patches/2013-01/msg00185.html
> 
> On Jan 9, 2013, at 6:10 PM, Pedro Alves wrote:
>> On 01/09/2013 04:28 PM, Tristan Gingold wrote:
>> 
>>>>> I don't really see a real way of supporting both old and new versions
>>>>> of GCC, unless we have a way of more finely ordering the unwinders.
>>>> 
>>>> What specific finer order where you considering would be needed to
>>>> fix this?
>>> 
>>> Joel once proposed to activate this unwinder if the CU is compiled
>>> by gcc 4.6 or older.
>> 
>> I don't think you need to have a way of more finely ordering
>> the unwinders for that.  AFAICS, we can make the sniffer
>> return false in that case.  I had understood him
>> as meaning something about making the whole prepend/append
>> mechanisms more finer grained somehow.
> 
> So coming from that angle, and seeing that v3 just uses the
> usual prepend/append mechanisms, I naturally get curious on
> whether we're missing something now.
> 
> So IIUC, this new ordering means that even for objects
> compiled with newer gcc's that emit SEH, as long as there's
> dwarf debug info, then GDB won't use the SEH to unwind.

Correct.

> I'm guessing that using SEH if available would
> be better over dwarf2 (though I don't know for sure).

Why ?  I think that both unwinders should be correct. One might
be faster than the other, but I don't know which.

> And, this version is then a compromise.  Right?

The only compromise is when there are no unwind infos.  Previously
a default unwinder based on heuristic was used (doesn't work well,
particularly for MS dll).  With the patch, they are considered as
leaf functions by the SEH unwinder.

> Just trying to understand, and record all this info
> somewhere, not pushing to have it fixed.

Sure. No problem with that.

>> It is still possible that gdb with support for SEH unwinder
>> fails where gdb without for binaries produced by old gcc for
>> the cases where the prologue analyzer using heuristic was
>> correct.  But debugging with this unwinder isn't reliable.
> 
>> 
>> Hopes it clarifies :-)
> 
> Thanks, it does, somewhat.  :-)

Tristan.


  reply	other threads:[~2013-08-23  6:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 10:53 Add Windows x64 SEH unwinder (take 2) Joel Brobecker
2013-01-09 10:53 ` [RFA/commit+NEWS 1/2] Add command set/show debug unwind Joel Brobecker
2013-01-09 12:41   ` Jan Kratochvil
2013-01-09 18:40     ` Joel Brobecker
2013-01-09 15:14   ` Tom Tromey
2013-01-09 16:01   ` Eli Zaretskii
2013-01-09 10:53 ` [RFA/commit+doco 2/2] Windows x64 SEH unwinder Joel Brobecker
2013-01-09 15:52   ` Pedro Alves
2013-01-09 16:28     ` Tristan Gingold
2013-01-09 17:10       ` Pedro Alves
2013-01-09 17:53         ` Tom Tromey
2013-01-09 19:11           ` Pedro Alves
2013-01-09 20:07         ` Tristan Gingold
2013-01-10 16:24           ` Pedro Alves
2013-01-11  8:04             ` Tristan Gingold
2013-07-08 10:55             ` [RFA] Windows x64 SEH unwinder (v2) Tristan Gingold
2013-07-26 15:22               ` Pedro Alves
2013-08-19 13:59                 ` Tristan Gingold
2013-08-19 14:13                   ` Pedro Alves
2013-08-22  9:33                 ` [PATCH v3] Windows x64 SEH unwinder Tristan Gingold
2013-08-22 15:10                   ` Eli Zaretskii
2013-08-22 15:26                   ` Pedro Alves
2013-08-22 15:41                     ` Tristan Gingold
2013-08-22 16:15                       ` Pedro Alves
2013-08-23  6:54                         ` Tristan Gingold [this message]
2013-08-27 17:45                           ` Pedro Alves
2013-09-02  9:28                             ` Tristan Gingold
2013-01-09 16:06   ` [RFA/commit+doco 2/2] " Eli Zaretskii
2013-01-09 16:29     ` Tristan Gingold
2013-01-09 11:05 ` Add Windows x64 SEH unwinder (take 2) Pedro Alves
2013-01-09 11:11   ` Joel Brobecker
2013-08-22 12:07 [PATCH v3] Windows x64 SEH unwinder Roland Schwingel

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=9FD66EEA-C685-4F32-8F91-F9E0FF6AAAEE@adacore.com \
    --to=gingold@adacore.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=roland.schwingel@onevision.de \
    /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