From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/disasm: mark functions passed to the disassembler noexcept
Date: Mon, 24 Oct 2022 14:24:42 -0400 [thread overview]
Message-ID: <36cfc9eb-a939-7d76-4295-3c507a187961@simark.ca> (raw)
In-Reply-To: <87mt9l6rp8.fsf@redhat.com>
On 10/24/22 13:45, Andrew Burgess via Gdb-patches wrote:
>
> I realise I made a bit of a mess, including the updated patch in the
> previous email. I should have just posted both of these as a new V2
> series.
>
> Oh well! The patch below applies on top of the first patch (in the
> parent email), and adds the noexcept keyword in a few places.
>
> Thanks,
> Andrew
>
> ---
>
> commit b1e3243296084566baf443d9c5280918a9d784f3
> Author: Andrew Burgess <aburgess@redhat.com>
> Date: Mon Oct 24 18:35:41 2022 +0100
>
> gdb/disasm: mark functions passed to the disassembler noexcept
>
> While working on another patch, Simon pointed out that GDB could be
> improved by marking the functions passed to the disassembler as
> noexcept.
>
> https://sourceware.org/pipermail/gdb-patches/2022-October/193084.html
>
> The reason this is important is the on some hosts, libopcodes, being C
> code, will not be compiled with support for handling exceptions. As
> such, an attempt to throw an exception over libopcodes code will cause
> GDB to terminate.
>
> See bug gdb/29712 for an example of when this happened.
>
> In this commit all the functions that are passed to the disassembler,
> and which might be used as callbacks by libopcodes are marked
> noexcept.
>
> Ideally, I would have liked to change these typedefs:
>
> using read_memory_ftype = decltype (disassemble_info::read_memory_func);
> using memory_error_ftype = decltype (disassemble_info::memory_error_func);
> using print_address_ftype = decltype (disassemble_info::print_address_func);
> using fprintf_ftype = decltype (disassemble_info::fprintf_func);
> using fprintf_styled_ftype = decltype (disassemble_info::fprintf_styled_func);
>
> which are declared in disasm.h, as including the noexcept keyword.
> However, when I tried this, I ran into this warning/error:
>
> In file included from ../../src/gdb/disasm.c:25:
> ../../src/gdb/disasm.h: In constructor ‘gdb_printing_disassembler::gdb_printing_disassembler(gdbarch*, ui_file*, gdb_disassemble_info::read_memory_ftype, gdb_disassemble_info::memory_error_ftype, gdb_disassemble_info::print_address_ftype)’:
> ../../src/gdb/disasm.h:116:3: error: mangled name for ‘gdb_printing_disassembler::gdb_printing_disassembler(gdbarch*, ui_file*, gdb_disassemble_info::read_memory_ftype, gdb_disassemble_info::memory_error_ftype, gdb_disassemble_info::print_address_ftype)’ will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
> 116 | gdb_printing_disassembler (struct gdbarch *gdbarch,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
>
> So I've left that change out. This does mean that if somebody adds a
> new use of the disassembler classes in the future, and forgets to mark
> the callbacks as noexcept, this will compile fine. We'll just have to
> manually check for that during review.
Like I said in my other email, I think this warning could safely be
ignored (silenced). We are not writing a library with a stable ABI, we
don't care if the mangling is different in two different builds.
Simon
next prev parent reply other threads:[~2022-10-24 18:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 12:50 [PATCH] gdb/python: avoid throwing an exception over libopcodes code Andrew Burgess
2022-10-24 15:50 ` Simon Marchi
2022-10-24 17:22 ` Andrew Burgess
2022-10-24 17:45 ` [PATCH] gdb/disasm: mark functions passed to the disassembler noexcept Andrew Burgess
2022-10-24 18:24 ` Simon Marchi [this message]
2022-10-24 18:20 ` [PATCH] gdb/python: avoid throwing an exception over libopcodes code Simon Marchi
2022-10-27 10:38 ` Andrew Burgess
2022-10-27 15:38 ` [PATCHv2 0/3] " Andrew Burgess
2022-10-27 15:38 ` [PATCHv2 1/3] " Andrew Burgess
2022-11-28 14:39 ` Simon Marchi
2022-11-28 19:26 ` Andrew Burgess
2022-10-27 15:38 ` [PATCHv2 2/3] gdb/disasm: mark functions passed to the disassembler noexcept Andrew Burgess
2022-10-27 15:38 ` [PATCHv2 3/3] gdb: mark disassembler function callback types as noexcept Andrew Burgess
2022-11-18 16:57 ` [PATCHv3 0/3] gdb/python: avoid throwing an exception over libopcodes code Andrew Burgess
2022-11-18 16:57 ` [PATCHv3 1/3] " Andrew Burgess
2022-11-18 16:57 ` [PATCHv3 2/3] gdb/disasm: mark functions passed to the disassembler noexcept Andrew Burgess
2022-11-18 16:57 ` [PATCHv3 3/3] gdb: mark disassembler function callback types as noexcept Andrew Burgess
2022-11-28 8:35 ` [PATCHv3 0/3] gdb/python: avoid throwing an exception over libopcodes code Tom de Vries
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=36cfc9eb-a939-7d76-4295-3c507a187961@simark.ca \
--to=simark@simark.ca \
--cc=aburgess@redhat.com \
--cc=gdb-patches@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).