From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, Pedro Alves <pedro@palves.net>,
gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] [gdb] Fix rethrow exception slicing in insert_bp_location
Date: Mon, 24 Oct 2022 12:48:59 -0400 [thread overview]
Message-ID: <a9d2a0f4-b4f7-137a-35eb-ff62ee38492d@simark.ca> (raw)
In-Reply-To: <02ad6f69-2a1b-b938-0ab4-ba6288f10fde@suse.de>
On 10/24/22 12:43, Tom de Vries via Gdb-patches wrote:
> On 10/24/22 18:36, Pedro Alves wrote:
>> On 2022-10-24 9:49 a.m., Tom de Vries via Gdb-patches wrote:
>>
>>> +#define RETHROW_ON_TARGET_CLOSE_ERROR(E) \
>>> + do \
>>> + { \
>>> + if ((E).reason != 0) \
>>> + { \
>>> + /* Can't set the breakpoint. */ \
>>> + \
>>> + if ((E).error == TARGET_CLOSE_ERROR) \
>>> + /* If the target has closed then it will have deleted any \
>>> + breakpoints inserted within the target inferior, as a \
>>> + result any further attempts to interact with the \
>>> + breakpoint objects is not possible. Just rethrow the \
>>> + error. Don't use E to rethrow, to prevent object \
>>> + slicing of the exception. */ \
>>> + throw; \
>>> + } \
>>> + } while (0)
>>
>> Is there a reason this is a macro instead of a function?
>
> yes, the throw without expression.
>
> Do you know of a way to do this using a function?
Maybe by passing the exception object as a parameter and using:
https://en.cppreference.com/w/cpp/error/rethrow_exception
?
Simon
next prev parent reply other threads:[~2022-10-24 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 8:49 [PATCH 0/2] [gdb] Fix rethrow exception slicing Tom de Vries
2022-10-24 8:49 ` [PATCH 1/2] [gdb] Fix rethrow exception slicing in pretty_print_insn Tom de Vries
2022-10-24 8:49 ` [PATCH 2/2] [gdb] Fix rethrow exception slicing in insert_bp_location Tom de Vries
2022-10-24 16:36 ` Pedro Alves
2022-10-24 16:43 ` Tom de Vries
2022-10-24 16:48 ` Simon Marchi [this message]
2022-10-25 7:08 ` Tom de Vries
2022-10-24 16:51 ` Pedro Alves
2022-10-25 7:14 ` Tom de Vries
2022-10-25 9:26 ` Pedro Alves
2022-10-24 11:20 ` [PATCH 0/2] [gdb] Fix rethrow exception slicing Andrew Burgess
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=a9d2a0f4-b4f7-137a-35eb-ff62ee38492d@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=tdevries@suse.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).