From: Tom de Vries <tdevries@suse.de>
To: Aaron Merey <amerey@redhat.com>, luis.machado@arm.com
Cc: aburgess@redhat.com, thiago.bauermann@linaro.org,
gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4 v8] gdb: Buffer output streams during events that might download debuginfo
Date: Fri, 19 Jan 2024 20:34:27 +0100 [thread overview]
Message-ID: <6fb49b9c-691a-4a65-9af5-844b31a534af@suse.de> (raw)
In-Reply-To: <20240119171352.827651-1-amerey@redhat.com>
On 1/19/24 18:13, Aaron Merey wrote:
> Hi Luis,
>
> On Fri, Jan 19, 2024 at 9:35 AM Luis Machado <luis.machado@arm.com> wrote:
>>
>> I bisected a number of failures in gdb.dwarf2/dw2-dir-file-name.exp to commit 519d634396592c5698add4a327468e6e6920576e.
>>
>> In particular, my testing was done on aarch64-linux (Ubuntu 20.04).
>
> Thanks for finding this. These regressions are due to a last-minute
> decision to replace throw_exception with throw in one of the functions
> added in commit 519d634.
>
> I'm going to merge the patch below that restores throw_exception.
> Regression tested on Fedora 39 x86_64.
>
> Aaron
>
> ---
> gdb/ui-out.h: Fix exception handling in do_with_buffered_output
>
> Replace throw with throw_exeception in do_with_buffered_output.
>
> This patch fixes regressions in gdb.dwarf2/dw2-dir-file-name.exp
> caused by commit 519d63439.
>
> do_with_buffered_output needs to use throw_exception instead of
> throw to ensure that exceptions of the correct type are thrown.
> If using throw, gdb_exception_error may be wrongly converted into
> gdb_exception during print_frame_info. This prevents the exception
> from being caught in print_stack_frame.
Hi Aaron,
what you're describing here sounds like exception slicing.
The easiest way to fix this is by rethrowing using "throw" without argument.
See this ( https://en.cppreference.com/w/cpp/language/throw ):
...
When rethrowing exceptions, the second form must be used to avoid object
slicing in the (typical) case where exception objects use inheritance: ...
Thanks,
- Tom
> ---
> gdb/ui-out.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ui-out.h b/gdb/ui-out.h
> index 71add908a84..5b6ddd55063 100644
> --- a/gdb/ui-out.h
> +++ b/gdb/ui-out.h
> @@ -543,7 +543,7 @@ do_with_buffered_output (F func, ui_out *uiout, Arg... args)
> {
> func (uiout, std::forward<Arg> (args)...);
> }
> - catch (const gdb_exception &ex)
> + catch (gdb_exception &ex)
> {
> /* Ideally flush would be called in the destructor of buffer_group,
> however flushing might cause an exception to be thrown. Catch it
> @@ -556,7 +556,7 @@ do_with_buffered_output (F func, ui_out *uiout, Arg... args)
> {
> }
>
> - throw (std::move (ex));
> + throw_exception (std::move (ex));
> }
>
> /* Try was successful. Let any further exceptions propagate. */
next prev parent reply other threads:[~2024-01-19 19:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 15:48 [PATCH 0/4] On-demand debuginfo downloading Aaron Merey
2024-01-17 15:48 ` [PATCH 1/4 v8] gdb: Buffer output streams during events that might download debuginfo Aaron Merey
2024-01-18 11:22 ` Andrew Burgess
2024-01-19 5:28 ` Aaron Merey
2024-01-19 14:35 ` Luis Machado
2024-01-19 17:13 ` Aaron Merey
2024-01-19 19:34 ` Tom de Vries [this message]
2024-01-19 19:52 ` Aaron Merey
2024-01-17 15:48 ` [PATCH 2/4 v3] gdb/progspace: Add reverse safe iterator Aaron Merey
2024-01-18 12:02 ` Andrew Burgess
2024-01-19 5:09 ` Aaron Merey
2024-02-07 21:24 ` [PING][PATCH " Aaron Merey
2024-02-22 22:22 ` [PING*2][PATCH " Aaron Merey
2024-03-01 0:09 ` [PING*3][PATCH " Aaron Merey
2024-03-12 22:14 ` Aaron Merey
2024-01-17 15:48 ` [PATCH 3/4 v5] gdb/debuginfod: Support on-demand debuginfo downloading Aaron Merey
2024-01-18 15:34 ` Andrew Burgess
2024-01-19 5:12 ` Aaron Merey
2024-02-07 21:25 ` [PING][PATCH " Aaron Merey
2024-02-22 22:23 ` [PING*2][PATCH " Aaron Merey
2024-03-01 0:09 ` [PING*3][PATCH " Aaron Merey
2024-03-12 22:15 ` Aaron Merey
2024-03-27 10:58 ` [PATCH " Andrew Burgess
2024-03-27 23:56 ` Aaron Merey
2024-01-17 15:48 ` [PATCH 4/4 v6] gdb/debuginfod: Add .debug_line downloading Aaron Merey
2024-02-07 21:25 ` [PING][PATCH " Aaron Merey
2024-02-22 22:23 ` [PING*2][PATCH " Aaron Merey
2024-03-01 0:10 ` [PING*3][PATCH " Aaron Merey
2024-03-12 22:15 ` Aaron Merey
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=6fb49b9c-691a-4a65-9af5-844b31a534af@suse.de \
--to=tdevries@suse.de \
--cc=aburgess@redhat.com \
--cc=amerey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@arm.com \
--cc=thiago.bauermann@linaro.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