public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Juraj Oršulić" <juraj.orsulic@fer.hr>
To: Florian Weimer <fweimer@redhat.com>, gcc-help@gcc.gnu.org
Subject: Re: Incorrect unwind when throwing exceptions - possible cause?
Date: Thu, 3 Feb 2022 16:38:57 +0100	[thread overview]
Message-ID: <CAEPqvox8mCqyK-pbXXX3scw2iZx_=iRynaD9aUDMbN-FF7W4rA@mail.gmail.com> (raw)
In-Reply-To: <CAEPqvowJ4uwCHg9pPn-ieUj62c4L6UgNCf9ThdCAsebKbF5kiA@mail.gmail.com>

Just to confirm, the problem was solved by adjusting the 3rdparty library
guilty for pulling in libunwind (in our case, Google glog, which has it as
an optional dependency) and evicting libunwind from the link list
(and using gcc's builtin unwinder instead).

It looks like that an up-to-date libunwind on Arch as of today doesn't have
this bug, but it's certainly present on Ubuntu 20.04.

Thanks again Florian!

On Thu, Feb 3, 2022 at 2:40 PM Juraj Oršulić <juraj.orsulic@fer.hr> wrote:
>
> Sorry for replying privately by mistake.
>
> Thank you so much Florian, I was not aware that libunwind is not the default
> unwinder. That could be the key to this and looks like we're linking it probably
> due to a 3rd party dependency.
>
> Looks like I made a mistake by reducing our project to an exception
> hello-world crashing minimum example instead of building one externally.
>
> In fact, I did, but I saw that _Unwind_RaiseException is called directly in
> __cxa_throw in libstdc++, so I assumed that is how it normally goes.
> Now I see that gcc provides a built-in for this function.
>
>
> On Thu, Feb 3, 2022 at 1:26 PM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * Juraj Oršulić:
> >
> > > I haven’t specified anything, so it’s using libunwind.so by default.
> > > I have stepped through libunwind and observed the moment of curruption when it
> > > prematurely commits the new rbp value.
> >
> > The default for GCC is its built-in unwinder.  If you are using
> > libunwind, you need to talk to the libunwind developers.
> >
> > Please keep posting to the list.
> >
> > Thanks,
> > Florian
> >

  reply	other threads:[~2022-02-03 15:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03  0:43 Juraj Oršulić
2022-02-03  1:06 ` Sam Varshavchik
2022-02-03  1:36 ` Juraj Oršulić
2022-02-03  2:15   ` Juraj Oršulić
2022-02-03 11:39 ` Florian Weimer
     [not found]   ` <CAEPqvowbo+iH4dazsfub3Vjc1D_zFGgKv2tg92Kv32vGVTq-2w@mail.gmail.com>
     [not found]     ` <87wnict9uz.fsf@oldenburg.str.redhat.com>
2022-02-03 13:40       ` Juraj Oršulić
2022-02-03 15:38         ` Juraj Oršulić [this message]
2022-02-04 10:37           ` Andrew Haley

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='CAEPqvox8mCqyK-pbXXX3scw2iZx_=iRynaD9aUDMbN-FF7W4rA@mail.gmail.com' \
    --to=juraj.orsulic@fer.hr \
    --cc=fweimer@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).