From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/tui: return std::string from tui_get_function_from_frame
Date: Fri, 23 Jan 2026 10:47:17 +0000 [thread overview]
Message-ID: <87jyx8hah6.fsf@redhat.com> (raw)
In-Reply-To: <875x8t31gr.fsf@tromey.com>
Tom Tromey <tom@tromey.com> writes:
>>>>>> "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>
Fixed all the issues, and pushed.
Thanks,
Andrew
prev parent reply other threads:[~2026-01-23 10:47 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
2026-01-23 10:47 ` Andrew Burgess [this message]
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=87jyx8hah6.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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