Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/tui: return std::string from tui_get_function_from_frame
Date: Thu, 22 Jan 2026 12:13:24 -0700	[thread overview]
Message-ID: <875x8t31gr.fsf@tromey.com> (raw)
In-Reply-To: <f0a672a9faf9f2d53566679ac533fa6c56a63131.1769092143.git.aburgess@redhat.com> (Andrew Burgess's message of "Thu, 22 Jan 2026 14:30:07 +0000")

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> I don't think there was anything particularly wrong with the old code,
Andrew> but I'm not a huge fan of returning data in static buffers unless
Andrew> there's a really good reason, and it doesn't feel like there's a
Andrew> really good reason in this case.

Definitely agree.  I feel like most such spots are artifacts of the C
days, where the lack of RAII often meant trying to find a shortcut.

Andrew>  /* Get a printable name for the function at the address.  The symbol
Andrew>     name is demangled if demangling is turned on.  Returns a pointer to
Andrew>     a static area holding the result.  */
Andrew> -static char*
Andrew> +static std::string
Andrew>  tui_get_function_from_frame (const frame_info_ptr &fi)

I think the comment needs a minor update.

Andrew> +  size_t pos = name.find('(');
Andrew> +  if (pos == std::string::npos)
Andrew> +    pos = name.find('>');
...
Andrew> +  if (pos != std::string::npos)
Andrew> +    name.erase (pos);
Andrew> +
Andrew> +  pos = name.find('+');

Some missing space-before-paren.

Otherwise looks good.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

  reply	other threads:[~2026-01-22 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 14:28 Andrew Burgess
2026-01-22 14:30 ` Andrew Burgess
2026-01-22 19:13   ` Tom Tromey [this message]
2026-01-23 10:47     ` 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=875x8t31gr.fsf@tromey.com \
    --to=tom@tromey.com \
    --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