On Fri, May 9, 2025 at 1:32 PM Jonathan Wakely <jwak...@redhat.com> wrote:

> I added some gdb.execute('skip -rfu ...') commands to the Python hook
> loaded with libstdc++.so but this makes GDB print output like:
>
> Function(s) ^std::(move|forward|as_const|(__)?addressof) will be skipped
> when stepping.
>
> This probably aren't interesting to users, so this change suppresses
> that output by capturing the output into the gdb.execute return value
> (which is then ignored). An exception is thrown if the gdb.execute
> command fails, so this doesn't suppress any errors which might be
> meaningful to users or libstdc++ developers.
>
> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/118260
>         * python/hook.in: Suppress output from gdb.execute calls to
>         register skips.
> ---
>
> Tested manually with GDB.
>
Looks good, and I think skipping move/forward/as_const/addressof is OK.
I am less sold on preexisting skips for functions like begin, empty, front,
but that is not relevant to this change.

>
>  libstdc++-v3/python/hook.in | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libstdc++-v3/python/hook.in b/libstdc++-v3/python/hook.in
> index d63909d2af4c..74a097cd0a00 100644
> --- a/libstdc++-v3/python/hook.in
> +++ b/libstdc++-v3/python/hook.in
> @@ -55,10 +55,14 @@ if gdb.current_objfile () is not None:
>      if not dir_ in sys.path:
>          sys.path.insert(0, dir_)
>
> -    gdb.execute('skip -rfu ^std::(move|forward|as_const|(__)?addressof)')
> -    gdb.execute('skip -rfu ^std::(shared|unique)_ptr<.*>::(get|operator)')
> -    gdb.execute('skip -rfu
> ^std::(basic_string|vector|array|deque|(forward_)?list|(unordered_|flat_)?(multi)?(map|set)|span)<.*>::(c?r?(begin|end)|front|back|data|size|empty)')
> -    gdb.execute('skip -rfu
> ^std::(basic_string|vector|array|deque|span)<.*>::operator.]')
> +    gdb.execute('skip -rfu ^std::(move|forward|as_const|(__)?addressof)',
> +                to_string=True)
> +    gdb.execute('skip -rfu ^std::(shared|unique)_ptr<.*>::(get|operator)',
> +                to_string=True)
> +    gdb.execute('skip -rfu
> ^std::(basic_string|vector|array|deque|(forward_)?list|(unordered_|flat_)?(multi)?(map|set)|span)<.*>::(c?r?(begin|end)|front|back|data|size|empty)',
> +                to_string=True)
> +    gdb.execute('skip -rfu
> ^std::(basic_string|vector|array|deque|span)<.*>::operator.]',
> +                to_string=True)
>
>  # Call a function as a plain import would not execute body of the
> included file
>  # on repeated reloads of this object file.
> --
> 2.49.0
>
>

Reply via email to