From: Tom Tromey <tom@tromey.com>
To: Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC PATCH 1/1] gdb/riscv: Cache per-BFD disassembler
Date: Fri, 14 Oct 2022 12:39:37 -0600 [thread overview]
Message-ID: <871qrameqe.fsf@tromey.com> (raw)
In-Reply-To: <760e2c443b1244b2a0a64f7f865e905b9ef90a72.1665287884.git.research_trasio@irq.a4lg.com> (Tsukasa OI via Gdb-patches's message of "Sun, 9 Oct 2022 03:59:03 +0000")
>>>>> Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> writes:
> +static int
> +riscv_print_insn (bfd_vma memaddr, disassemble_info *info)
> +{
> + static disassembler_ftype disassemble_fn = NULL;
> + static bfd *abfd = NULL;
This seems mildly dangerous, in that a BFD could be destroyed, then a
new one created with the same address.
It's better to cache things using the registry system.
See gdb/registry.h. You can look for "registry<bfd>" for examples.
Tom
next prev parent reply other threads:[~2022-10-14 18:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 3:59 [RFC PATCH 0/1] " Tsukasa OI
2022-10-09 3:59 ` [RFC PATCH 1/1] " Tsukasa OI
2022-10-14 18:39 ` Tom Tromey [this message]
2022-10-16 15:31 ` Tsukasa OI
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=871qrameqe.fsf@tromey.com \
--to=tom@tromey.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).