public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/29793] New: [gdb/tdep, powerpc] FAIL: gdb.cp/gdb2495.exp: call a function that raises an exception without a handler.
Date: Wed, 16 Nov 2022 17:18:36 +0000	[thread overview]
Message-ID: <bug-29793-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29793

            Bug ID: 29793
           Summary: [gdb/tdep, powerpc] FAIL: gdb.cp/gdb2495.exp: call a
                    function that raises an exception without a handler.
           Product: gdb
           Version: 12.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With powerpc64le I ran into this failure:
...
(gdb) p exceptions.throw_function()^M
terminate called after throwing an instance of 'int'^M
^M
Program received signal SIGABRT, Aborted.^M
0x00007ffff7979838 in raise () from /lib64/libc.so.6^M
The program being debugged was signaled while in a function called from GDB.^M
GDB remains in the frame where the signal was received.^M
To change this behavior use "set unwindonsignal on".^M
Evaluation of the expression containing the function^M
(SimpleException::throw_function()) will be abandoned.^M
When the function is done executing, GDB will silently stop.^M
(gdb) FAIL: gdb.cp/gdb2495.exp: call a function that raises an exception
without a handler.
...

For contrast, with x86_64 instead I have:
...
(gdb) PASS: gdb.cp/gdb2495.exp: p exceptions.throw_function_with_handler()
p exceptions.throw_function()^M
The program being debugged entered a std::terminate call, most likely^M
caused by an unhandled C++ exception.  GDB blocked this call in order^M
to prevent the program from being terminated, and has restored the^M
context to its original state before the call.^M
To change this behaviour use "set unwind-on-terminating-exception off".^M
Evaluation of the expression containing the function
(SimpleException::throw_function())^M
will be abandoned.^M
(gdb) PASS: gdb.cp/gdb2495.exp: call a function that raises an exception
without a handler.
...

So, the problem seems to be that doing an inferior call sets a breakpoint on
std::terminate that is not triggered, and instead we run into the actual
std::terminate.

Using maint info break, we can see the internal breakpoints, where we have:
...
-10     std::terminate master keep n   0x00007ffff7d79e60 <std::terminate()>
inf 1
-10.1                              y-  0x00007ffff7d79e60 <std::terminate()>
inf 1
...

In contrast, if we set a user breakpoint on std::terminate, we have instead:
...
(gdb) b std::terminate
Breakpoint 2 at 0x7ffff7d79e74 (2 locations)
(gdb) info breakpoint
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>         
2.1                         y   0x00007ffff7d79e74 <std::terminate()+20>
2.2                         y   0x00007ffff7ecdeec <std::terminate()@plt>
...

So, AFAIU, the following happens:
- we start an inferior call
- an internal std::terminate breakpoint is set on the global entry point
- the inferior call uses the local entry point
- the breakpoint is not triggered
- we run into std::terminate

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-11-16 17:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 17:18 vries at gcc dot gnu.org [this message]
2022-11-16 17:19 ` [Bug tdep/29793] " vries at gcc dot gnu.org
2022-11-16 17:22 ` vries at gcc dot gnu.org
2022-11-16 17:39 ` cel at us dot ibm.com
2022-11-16 18:35 ` vries at gcc dot gnu.org
2022-11-16 18:53 ` vries at gcc dot gnu.org
2022-11-16 23:01 ` cel at us dot ibm.com
2022-11-17  9:24 ` vries at gcc dot gnu.org
2022-11-17  9:42 ` vries at gcc dot gnu.org
2022-11-17 13:11 ` uweigand at gcc dot gnu.org
2022-11-17 18:03 ` cel at us dot ibm.com
2022-11-18  9:57 ` vries at gcc dot gnu.org
2022-11-18 11:18 ` vries at gcc dot gnu.org
2022-11-18 13:20 ` vries at gcc dot gnu.org
2022-11-18 14:17 ` vries at gcc dot gnu.org
2022-11-18 16:44 ` vries at gcc dot gnu.org
2022-11-18 19:25 ` cel at us dot ibm.com
2022-11-19  7:11 ` vries at gcc dot gnu.org
2022-11-19 11:18 ` vries at gcc dot gnu.org
2022-11-21 16:34 ` cel at us dot ibm.com
2022-11-23  5:52 ` cvs-commit at gcc dot gnu.org
2022-11-23  5:54 ` vries at gcc dot gnu.org

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=bug-29793-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).