Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: dominikmascherbauer <dominik.mascherbauer@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] Add new commands for controlling type signature fallback.
Date: Tue, 11 Mar 2025 19:33:40 +0200	[thread overview]
Message-ID: <865xkfbhfv.fsf@gnu.org> (raw)
In-Reply-To: <9c04ac7d791b96d90c624fba5333f2e9009393a3.1741701275.git.dominik.mascherbauer@oracle.com> (message from dominikmascherbauer on Tue, 11 Mar 2025 15:57:18 +0100)

> From: dominikmascherbauer <dominik.mascherbauer@gmail.com>
> Cc: dominikmascherbauer <dominik.mascherbauer@oracle.com>
> Date: Tue, 11 Mar 2025 15:57:18 +0100
> 
> 'set dwarf-type-signature-fallback (off|main|full)':
> Enable type signature fallback.
> If a type signature is not found in the current objfile, either looks up the 'main' objfile or all objfiles in a progspace to find the type signature.
> Usually a type signature is unique, ther should only be one type unit for each type signature.
> Therefore, it should be okay to check other objfile for a type signature.
> However, whether this is really the case depends on the debug info producer.
> This is why its disabled by default.
> 
> 'set dwarf-type-signature-fallback-jit':
> Whether the type signature fallback is enabled for only JIT objfiles.
> JIT objfiles are self-contained, but usually share most debug info with some already loaded objfile.
> This is why JIT objfiles are a major use case for the type signature fallback.
> This option is added to restrict the type signature fallback to match this exact use-case and provides a more granular use of the type signature fallback.
> ---
>  gdb/NEWS            | 14 +++++++++
>  gdb/doc/gdb.texinfo | 26 +++++++++++++++++
>  gdb/dwarf2/read.c   | 70 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 110 insertions(+)

Thanks.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 2c504a9b603..53368d7463c 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -261,6 +261,20 @@ disable missing-objfile-handler LOCUS HANDLER
>    or can be a regular expression which is matched against the filename
>    of the primary executable in each program space.
>  
> +set dwarf-type-signature-fallback (off|main|full)
> +  New command which enables a type signature lookup fallback, if a
> +  dwarf objfile from a JIT compilation does not provide its own type
> +  units, but relies on type units from other objfiles.  The 'main'
> +  setting allows to limit the scope of the lookup to just the main
> +  symfile objfile, 'full' uses all objfiles in a progspace.
> +  The default value is 'off'.
> +
> +set dwarf-type-signature-fallback-jit on|off
> +  New command that is used in combination with type-signature-fallback
> +  and is on by default.  If type signature fallback is enabled,
> +  this restricts the fallback to objfiles that were loaded with the
> +  JIT debug interface.
> +
>  * Changed commands
>  
>  remove-symbol-file
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 04719bf65e6..901152dd15e 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -42325,6 +42325,32 @@ Symbol "argc" is a complex DWARF expression:
>  For more information on these expressions, see
>  @uref{http://www.dwarfstd.org/, the DWARF standard}.
>  
> +@kindex set dwarf-type-signature-fallback
> +@kindex show dwarf-type-signature-fallback
> +@item set dwarf-type-signature-fallback @samp{full|main|off}
> +@itemx show dwarf-type-signature-fallback
> +Control the behavior of the type signature lookup for type units if a
> +type signature is undefined within an objfile.
> +
> +The default is @code{off}, which means @value{GDBN} will not use other
> +objfiles in the progspace to lookup missing type signatures. When
> +@code{main}, @value{GDBN} will check the current main objfile for a
> +missing signatured type. When @code{full}, all objfiles in the current
> +progspace will be searched for the missing signatured type.
> +
> +@kindex set dwarf-type-signature-fallback-jit
> +@kindex show dwarf-type-signature-fallback-jit
> +@item set dwarf-type-signature-fallback-jit
> +@itemx show dwarf-type-signature-fallback-jit
> +
> +Control whether @code{dwarf type-signature-fallback} is limited to
> +objfiles originated from the JIT interface (@pxref{JIT Interface})
> +or all objfiles with a missing signatured type.
> +
> +The default is @code{on}, which limits the type signature fallback to
> +only objfiles from the JIT interface. When @code{off}, the type signature
> +fallback will look for missing signatured types for all objfiles.

Please leave two spaces between sentences, otherwise the printed
version will be typeset sub-optimally.

More generally, I think both NEWS and the text for the manual doesn't
tell what this means in practical terms and when it would be useful to
fiddle with these options.  I find myself wondering why and when would
I need to help GDB look up type signature, and even what is a "type
signature" (it is used in the manual only once, without any
explanations).  I think at least the manual should answer these
questions.

> +  add_setshow_enum_cmd ("dwarf-type-signature-fallback", class_support,
> +			type_signature_fallback_enums, &type_signature_fallback,
> +			_ ("\
> +Set resolution of type signatures with other objfiles as fallback."), _ ("\
> +Show resolution of type signatures with other objfiles as fallback."), _ ("\
> +This option will only take effect if set before loading symbols.\n\
> +off  == turn type signature fallback off\n\
> +main == use the main symbolfile as fallback objfile\n\
> +	for type signature resolution\n\
> +full == use all objfiles with type units in the current progspace\n\
> +	as fallback objfiles for type signature resolution."),

The list of possible values should probably start with "main" or
"full", as otherwise the reference to "fallback" in "off" will not be
understood.

Also note that you use "resolution" in the above doc strings, but
"look up" in the manual and NEWS.  I think it's better to use the same
terminology; "look up" sounds more accurate to me.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

  reply	other threads:[~2025-03-11 17:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 14:57 [PATCH 0/3] DWARF type signature lookup fallback dominikmascherbauer
2025-03-11 14:57 ` [PATCH 1/3] Add new commands for controlling type signature fallback dominikmascherbauer
2025-03-11 17:33   ` Eli Zaretskii [this message]
2025-03-12  9:12     ` Dominik Mascherbauer
2025-03-12 14:38       ` Eli Zaretskii
2025-03-12 14:44         ` Dominik Mascherbauer
2025-03-11 14:57 ` [PATCH 2/3] Add type signature fallback and JIT objfile restriction dominikmascherbauer
2025-03-11 14:57 ` [PATCH 3/3] Add testing for type signature fallback dominikmascherbauer
2025-03-12 15:37 ` [PATCH v2 0/3] DWARF type signature lookup fallback dominikmascherbauer
2025-03-12 15:37   ` [PATCH v2 1/3] Add new commands for controlling type signature fallback dominikmascherbauer
2025-03-12 15:43     ` Eli Zaretskii
2025-03-12 15:37   ` [PATCH v2 2/3] Add type signature fallback and JIT objfile restriction dominikmascherbauer
2025-03-12 15:37   ` [PATCH v2 3/3] Add testing for type signature fallback dominikmascherbauer
2025-03-12 16:32 ` [PATCH 0/3] DWARF type signature lookup fallback Tom Tromey
2025-03-13 10:42   ` Dominik Mascherbauer
2025-03-13 15:37     ` Tom Tromey

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=865xkfbhfv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dominik.mascherbauer@gmail.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