Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Tristan Gingold <gingold@adacore.com>,
	       Joel Brobecker <brobecker@adacore.com>,
	gdb-patches@sourceware.org
Subject: Re: [RFA/commit+doco 2/2] Windows x64 SEH unwinder.
Date: Wed, 09 Jan 2013 19:11:00 -0000	[thread overview]
Message-ID: <50EDC0DB.3090707@redhat.com> (raw)
In-Reply-To: <871uduz319.fsf@fleche.redhat.com>

On 01/09/2013 05:20 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> I don't think you need to have a way of more finely ordering
> Pedro> the unwinders for that.  AFAICS, we can make the sniffer
> Pedro> return false in that case.  I had understood him
> Pedro> as meaning something about making the whole prepend/append
> Pedro> mechanisms more finer grained somehow.
> 
> FWIW I think Joel explained it in the original post.

Thanks.  I hadn't caught the desire to put bits in before the
dwarf unwinder, and other bits after.  I re-read the
original post, and now I read it as always wanting this
unwinder after the DWARF unwinder.  (note: "behind" is
ambiguous to me).  That looks doable with the current
architecture, without splitting the new unwinder, by
appending the non-checking unwinder in amd64_windows_init_abi
before calling amd64_init_abi, and have its sniffer always
claim the frame (which it would anyway), so the fallback
heuristic's sniffer never gets a chance to run.  But I'd
guess before or after dwarf doesn't really matter.

> My understanding based on that is that the absence of SEH is normal, but
> they'd still like to use this unwinder for such frames, because
> amd64-tdep.c provides a catch-all unwinder (I guess amd64_frame_unwind)
> that is not always good enough.

Right.  The catch-all unwinders are heuristic, and naturally can't
always work 100% correctly, worse on non-x64 targets,
where we don't have as stiff prologue format requirements.

I got confused with the minimal leaf function handling in the
patch, but this, coupled with __fastcall makes it clearer:

<http://www.sciencezero.org/index.php?title=How_to_write_x64_assembly_functions_in_Visual_C%2B%2B#Leaf_or_frame_function>

"
 leaf functions have limitations:

    Can not call out to other functions
    Can not change any non-volatile registers
    Can not change the stack pointer
"

(It goes without saying, but FAOD, I'd prefer that
explanations to my doubts ended up as comments in the code.)

> I don't know the mechanics of arranging the ordering with the DWARF
> unwinders.  I couldn't actually figure out how these are installed for
> x86-64.

Yeah, it's not obvious.  Put a break on dwarf2_append_unwinders.
The x86-64 gdbarch initialization starts in i386-tdep.c:i386_gdbarch_init,
shared with 32-bit.  There's no amd64_gdbarch_init.  That is what
appends the dwarf unwinders, with the dwarf2_append_unwinders call.
At the bottom, this/a gdbarch init function initializes the osabi (e.g.,
amd64_linux_init_abi), and this is what calls the generic
x86-64 amd64_init_abi early on, and installs the prologue-based
fallback unwinders.

-- 
Pedro Alves


  reply	other threads:[~2013-01-09 19:11 UTC|newest]

Thread overview: 31+ 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+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 [this message]
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
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 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 11:05 ` Add Windows x64 SEH unwinder (take 2) Pedro Alves
2013-01-09 11:11   ` Joel Brobecker

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=50EDC0DB.3090707@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gingold@adacore.com \
    --cc=tromey@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