Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] DWARF type signature lookup fallback.
@ 2025-03-11 14:57 dominikmascherbauer
  2025-03-11 14:57 ` [PATCH 1/3] Add new commands for controlling type signature fallback dominikmascherbauer
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-11 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

I am working on a patch that adds parameters to allow type signature fallback for DWARF type units to fallback to other objfiles.
This allows to only create type units once and reuse them by their type signature, reducing duplication of type units.
It builds on the uniqueness of type signatures, so a type signature always references the same type unit.

This is my first time using a mailing list, so please remind me of any formatting errors or other mistakes.

Thanks,
Dominik

dominikmascherbauer (3):
  Add new commands for controlling type signature fallback.
  Add type signature fallback and JIT objfile restriction.
  Add testing for type signature fallback.

 gdb/NEWS                                      |  14 +
 gdb/doc/gdb.texinfo                           |  26 ++
 gdb/dwarf2/read.c                             | 254 ++++++++++++++++--
 gdb/jit.c                                     |   6 +-
 gdb/objfile-flags.h                           |   3 +
 .../gdb.dwarf2/sig-type-fallback-jit.c        |  62 +++++
 .../gdb.dwarf2/sig-type-fallback-jit.exp      |  75 ++++++
 7 files changed, 409 insertions(+), 31 deletions(-)
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp


base-commit: 512316811d47d689d75d25aa9d5b98bdafd64df6
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] Add new commands for controlling type signature fallback.
  2025-03-11 14:57 [PATCH 0/3] DWARF type signature lookup fallback dominikmascherbauer
@ 2025-03-11 14:57 ` dominikmascherbauer
  2025-03-11 17:33   ` Eli Zaretskii
  2025-03-11 14:57 ` [PATCH 2/3] Add type signature fallback and JIT objfile restriction dominikmascherbauer
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-11 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

'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(+)

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.
+
 @kindex maint set dwarf max-cache-age
 @kindex maint show dwarf max-cache-age
 @item maint set dwarf max-cache-age
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index c5375b68567..dc8cc7652d9 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -737,6 +737,49 @@ show_dwarf_max_cache_age (struct ui_file *file, int from_tty,
 	      value);
 }
 
+/* If the type for a type signature is not found in the CUs objfile
+   fallback to other objfiles for type signature resolution */
+const char type_signature_fallback_off[] = "off";
+const char type_signature_fallback_main[] = "main";
+const char type_signature_fallback_full[] = "full";
+static const char *type_signature_fallback_enums[] =
+	{
+		type_signature_fallback_off,
+		type_signature_fallback_main,
+		type_signature_fallback_full,
+		nullptr
+	};
+static const char *type_signature_fallback = type_signature_fallback_off;
+
+static void
+show_type_signature_fallback (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  gdb_printf (file, _ ("Resolution of type signatures with "
+		       "fallback objfiles is %s.\n"),
+	      value);
+}
+
+/* Type signature fallback is by default restricted to only jit objfiles.  */
+static bool type_signature_fallback_jit = true;
+
+static void
+show_type_signature_fallback_jit (struct ui_file *file, int from_tty,
+				  struct cmd_list_element *c, const char *value)
+{
+  gdb_printf (file, _ ("Whether type signature resolution with "
+		       "fallback objfiles is restricted to jit objfiles is %s.\n"),
+	      value);
+}
+
+/* Check if type signature fallback applies to OBJFILE. */
+static bool
+use_type_signature_fallback (struct objfile *objfile)
+{
+  return type_signature_fallback != type_signature_fallback_off &&
+	 (!type_signature_fallback_jit || objfile->flags & OBJF_JIT);
+}
+
 /* When true, wait for DWARF reading to be complete.  */
 static bool dwarf_synchronous = false;
 
@@ -20103,6 +20146,33 @@ caching, which can slow down startup."),
 			    &set_dwarf_cmdlist,
 			    &show_dwarf_cmdlist);
 
+  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."),
+			NULL, show_type_signature_fallback, &setlist,
+			&showlist);
+
+  add_setshow_boolean_cmd ("dwarf-type-signature-fallback-jit", class_support,
+			&type_signature_fallback_jit,
+			_ ("\
+Set wether resolution of type signatures with other objfiles as fallback\n\
+is restricted to jit objfiles."), _ ("\
+Show resolution of type signatures with other objfiles as fallback\n\
+is restricted to jit objfiles."), _ ("\
+By default, type signature resolution with fallback objfiles is restricted\n\
+to jit objfiles.\n\
+This option will only take effect if type-signature-fallback is enabled."),
+			NULL, show_type_signature_fallback_jit, &setlist,
+			&showlist);
+
   add_setshow_boolean_cmd ("synchronous", class_obscure,
 			    &dwarf_synchronous, _("\
 Set whether DWARF is read synchronously."), _("\
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/3] Add type signature fallback and JIT objfile restriction.
  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 14:57 ` dominikmascherbauer
  2025-03-11 14:57 ` [PATCH 3/3] Add testing for type signature fallback dominikmascherbauer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-11 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

To support type signature fallback, the lookup_signatured_type method is extended.
If no type signature was found in the current objfile or in a dwo file, the dwraf-type-signature-fallback option is checked:
'off': return nullptr
'main': only check the current main objfile for the type signature.
This reduces the additional load for a fallback as only one additional objfile is checked.
The main objfile often contains major parts of the debug info, thus it is also likely that the requested type signature is found there.
If the main objfile is linked to dwo/dwp files, those are also checked for the type signature.
This should be the same behavior as if the type signature is lookup up without fallback.
'full': check all objfiles in the current prospace.
Requires potentially more time than just checking the main objfile, but it will also find a type signature in a loaded shared library.

If a type signature was found in a fallback objfile, the per_objfile after lookup_signatured_type is the fallback per_objfile.
This ensures that if the type unit still needs to be read, it is read from the correct objfile.

Additionally, a flag is added to objfiles that marks an objfile as a JIT objfile.
With this information the type signature fallback can be restricted to only work for JIT objfiles.
This is a separate option because JIT objfile are self-contained but usually share debug info (especially type information) with some other already loaded objfile.
So this leaves loading other objfiles as is to avoid unexpected behavior if needed.
---
 gdb/dwarf2/read.c   | 184 +++++++++++++++++++++++++++++++++++++-------
 gdb/jit.c           |   6 +-
 gdb/objfile-flags.h |   3 +
 3 files changed, 162 insertions(+), 31 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index dc8cc7652d9..2c02f17e85a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2668,12 +2668,12 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile,
    to read all the DWOs to build the type unit groups.  */
 
 static struct signatured_type *
-lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_dwo_signatured_type (struct dwo_unit *dwo_unit, ULONGEST sig,
+			    struct dwarf2_per_objfile *per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
   dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
 
-  gdb_assert (cu->dwo_unit);
+  gdb_assert (dwo_unit);
 
   /* We only ever need to read in one copy of a signatured type.
      Use the global signatured_types array to do our own comdat-folding
@@ -2696,14 +2696,14 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
       && (*sig_type_it)->tu_read)
     return *sig_type_it;
 
-  /* Note: cu->dwo_unit is the dwo_unit that references this TU, not the
+  /* Note: dwo_unit is the dwo_unit that references this TU, not the
      dwo_unit of the TU itself.  */
-  dwo_file *dwo_file = cu->dwo_unit->dwo_file;
+  dwo_file *dwo_file = dwo_unit->dwo_file;
   auto it = dwo_file->tus.find (sig);
   if (it == dwo_file->tus.end ())
     return nullptr;
 
-  dwo_unit *dwo_entry = *it;
+  struct dwo_unit *dwo_entry = *it;
 
   /* If the global table doesn't have an entry for this TU, add one.  */
   if (sig_type_it == per_bfd->signatured_types.end ())
@@ -2723,13 +2723,12 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
    it won't be in .gdb_index.  */
 
 static struct signatured_type *
-lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_dwp_signatured_type (ULONGEST sig,
+			    struct dwarf2_per_objfile *per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
   dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
   struct dwp_file *dwp_file = get_dwp_file (per_objfile);
 
-  gdb_assert (cu->dwo_unit);
   gdb_assert (dwp_file != NULL);
 
   auto sig_type_it = per_bfd->signatured_types.find (sig);
@@ -2755,34 +2754,133 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
   return *sig_type_it;
 }
 
+/* Subroutine of lookup_signatured_type.
+   Look up the type for signature SIG, from a fallback objfile.
+   If we don't have a DWO/DWP file or can't find the signature there, check the
+   fallback object file.
+   If a signatured type was found, PER_OBJFILE will contain its per_objfile.  */
+
+static struct signatured_type *
+lookup_fallback_signatured_type (struct objfile *fallback_objfile, ULONGEST sig,
+				 struct dwarf2_per_objfile **per_objfile)
+{
+  struct signatured_type *sig_type = nullptr;
+
+  /* If we have a separate debug objfile, use it for the fallback.  */
+  if (fallback_objfile->separate_debug_objfile != nullptr)
+    fallback_objfile = fallback_objfile->separate_debug_objfile;
+
+  struct dwarf2_per_objfile *fallback_per_objfile = get_dwarf2_per_objfile
+	  (fallback_objfile);
+
+  /* The fallback objfile must be different to the current objfile. Otherwise,
+     this is no fallback so all necessary checks were already performed in
+     lookup_signatured_type.  */
+  if (fallback_per_objfile == *per_objfile)
+    return nullptr;
+
+  /* Do we have a dwp file?  */
+  if (get_dwp_file (fallback_per_objfile) != nullptr)
+    {
+      sig_type = lookup_dwp_signatured_type (sig, fallback_per_objfile);
+    }
+    /* Do we have dwo files?  */
+  else
+    {
+      /* Look for dwo_entry that contains the signatured type.  */
+      for (const dwo_file_up &file : fallback_per_objfile->per_bfd->dwo_files)
+        {
+	  auto it = file->tus.find (sig);
+	  if (it != file->tus.end ())
+	    {
+	      /* We found the dwo entry. Check for the signatured type.  */
+	      sig_type = lookup_dwo_signatured_type (*it, sig,
+						   fallback_per_objfile);
+	      break;
+	    }
+        }
+    }
+
+  /* Do we still need to check the fallback per_objfile or was the signatured
+     type found in a DWO/DWP file?  */
+  if (sig_type == nullptr)
+    {
+      auto sig_type_it
+        = fallback_per_objfile->per_bfd->signatured_types.find (sig);
+
+      if (sig_type_it != fallback_per_objfile->per_bfd->signatured_types.end ())
+	sig_type = *sig_type_it;
+    }
+
+  if (sig_type != nullptr)
+    /* Ensure we will know where the signature type came from.  */
+    *per_objfile = fallback_per_objfile;
+  return sig_type;
+}
+
 /* Lookup a signature based type for DW_FORM_ref_sig8.
    Returns NULL if signature SIG is not present in the table.
-   It is up to the caller to complain about this.  */
+   It is up to the caller to complain about this.
+   If type_signature_fallback is enabled and the signatured type is found,
+   per_objfile is the objfile where the signatured type was found in. */
 
 static struct signatured_type *
-lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig,
+			struct dwarf2_per_objfile **per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
-  dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+  struct signatured_type *sig_type = nullptr;
+  dwarf2_per_bfd *per_bfd = (*per_objfile)->per_bfd;
 
   if (cu->dwo_unit)
     {
       /* We're in a DWO/DWP file, and we're using .gdb_index.
-	 These cases require special processing.  */
-      if (get_dwp_file (per_objfile) == NULL)
-	return lookup_dwo_signatured_type (cu, sig);
+     These cases require special processing.  */
+      if (get_dwp_file (*per_objfile) == nullptr)
+	sig_type = lookup_dwo_signatured_type (cu->dwo_unit, sig, *per_objfile);
       else
-	return lookup_dwp_signatured_type (cu, sig);
+	sig_type = lookup_dwp_signatured_type (sig, *per_objfile);
+
+      /* If we already found the signatured type, return it.  */
+      if (sig_type != nullptr)
+	return sig_type;
     }
   else
     {
+      /* Lookup type signature in the current objfile.  */
       auto sig_type_it = per_bfd->signatured_types.find (sig);
 
+      /* If we already found the signatured type, return it.  */
       if (sig_type_it != per_bfd->signatured_types.end ())
 	return *sig_type_it;
+    }
 
-      return nullptr;
+  /* Handle fallback if type signature lookup fallback is enabled for this
+     objfile.  */
+  if (use_type_signature_fallback ((*per_objfile)->objfile))
+    {
+      /* Do a full fallback through all objfiles in the progspace.  */
+      if (type_signature_fallback == type_signature_fallback_full)
+	{
+	  for (objfile *objfile: (*per_objfile)->objfile->pspace ()->objfiles ())
+	    {
+	      sig_type = lookup_fallback_signatured_type (objfile, sig,
+							  per_objfile);
+	      /* If we already found the signatured type, return it.  */
+	      if (sig_type != nullptr)
+		return sig_type;
+	    }
+	}
+      else
+	{
+	  /* fallback to main symfile objfile.  */
+	  struct objfile *objfile
+	    = (*per_objfile)->objfile->pspace ()->symfile_object_file;
+	  return lookup_fallback_signatured_type (objfile, sig, per_objfile);
+	}
     }
+
+  /* We could not find the signatured type.  */
+  return nullptr;
 }
 
 /* Low level DIE reading support.  */
@@ -4332,8 +4430,19 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, dwarf2_per_cu *per_cu,
   bool queued = false;
   if (!per_objfile->symtab_set_p (per_cu))
     {
-      /* Add it to the queue.  */
-      queue_comp_unit (per_cu, per_objfile, pretend_language);
+      if (dependent_cu != nullptr && !per_objfile->queue.has_value () &&
+	  type_signature_fallback != type_signature_fallback_off)
+	{
+	  /* If the signatured type in the fallback objfile references another
+	     signatured type we might end up here with no queue in the fallback
+	     objfile.  */
+	  dw2_instantiate_symtab (per_cu, per_objfile, false);
+	}
+      else
+	{
+	  /* Add it to the queue.  */
+	  queue_comp_unit (per_cu, per_objfile, pretend_language);
+	}
       queued = true;
 
       dwarf_read_debug_printf ("Queuing CU for expansion: "
@@ -8382,7 +8491,7 @@ static int
 queue_and_load_dwo_tu (dwo_unit *dwo_unit, dwarf2_cu *cu)
 {
   ULONGEST signature = dwo_unit->signature;
-  signatured_type *sig_type = lookup_dwo_signatured_type (cu, signature);
+  signatured_type *sig_type = lookup_dwo_signatured_type (cu->dwo_unit, signature, cu->per_objfile);
 
   if (sig_type != NULL)
     {
@@ -18984,6 +19093,7 @@ dwarf2_get_die_type (cu_offset die_offset, dwarf2_per_cu *per_cu,
 
 static struct die_info *
 follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
+		  struct dwarf2_per_objfile *sig_type_per_objfile,
 		  struct dwarf2_cu **ref_cu)
 {
   struct dwarf2_cu *sig_cu;
@@ -18999,12 +19109,14 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
      Even if maybe_queue_comp_unit doesn't require us to load the CU's DIEs,
      it doesn't mean they are currently loaded.  Since we require them
      to be loaded, we must check for ourselves.  */
-  if (maybe_queue_comp_unit (*ref_cu, sig_type, per_objfile,
+  if (maybe_queue_comp_unit (*ref_cu, sig_type, sig_type_per_objfile,
 			     language_minimal)
-      || per_objfile->get_cu (sig_type) == nullptr)
-    read_signatured_type (sig_type, per_objfile);
+      || sig_type_per_objfile->get_cu (sig_type) == nullptr)
+    {
+      read_signatured_type (sig_type, sig_type_per_objfile);
+    }
 
-  sig_cu = per_objfile->get_cu (sig_type);
+  sig_cu = sig_type_per_objfile->get_cu (sig_type);
   gdb_assert (sig_cu != NULL);
   gdb_assert (to_underlying (sig_type->type_offset_in_section) != 0);
 
@@ -19040,7 +19152,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
 
   gdb_assert (attr->form == DW_FORM_ref_sig8);
 
-  sig_type = lookup_signatured_type (*ref_cu, signature);
+  dwarf2_per_objfile *sig_type_per_objfile = (*ref_cu)->per_objfile;
+  sig_type = lookup_signatured_type (*ref_cu, signature, &sig_type_per_objfile);
   /* sig_type will be NULL if the signatured type is missing from
      the debug info.  */
   if (sig_type == NULL)
@@ -19052,7 +19165,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
 	     objfile_name ((*ref_cu)->per_objfile->objfile));
     }
 
-  die = follow_die_sig_1 (src_die, sig_type, ref_cu);
+  die = follow_die_sig_1 (src_die, sig_type, sig_type_per_objfile, ref_cu);
   if (die == NULL)
     {
       src_die->error_dump ();
@@ -19079,7 +19192,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
   struct die_info *type_die;
   struct type *type;
 
-  sig_type = lookup_signatured_type (cu, signature);
+  dwarf2_per_objfile *sig_type_per_objfile = per_objfile;
+  sig_type = lookup_signatured_type (cu, signature, &sig_type_per_objfile);
   /* sig_type will be NULL if the signatured type is missing from
      the debug info.  */
   if (sig_type == NULL)
@@ -19098,7 +19212,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
     return type;
 
   type_cu = cu;
-  type_die = follow_die_sig_1 (die, sig_type, &type_cu);
+  type_die = follow_die_sig_1 (die, sig_type, sig_type_per_objfile, &type_cu);
   if (type_die != NULL)
     {
       /* N.B. We need to call get_die_type to ensure only one type for this DIE
@@ -19125,6 +19239,18 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
       type = build_error_marker_type (cu, die);
     }
 
+  if (type_signature_fallback != type_signature_fallback_off)
+    {
+      /* We might already have read the required signatured type
+         after looking for it in a fallback objfile  */
+      struct type *existing_type = per_objfile->get_type_for_signatured_type
+	      (sig_type);
+      if (existing_type != nullptr)
+	{
+	  gdb_assert (type == existing_type);
+	  return type;
+	}
+    }
   per_objfile->set_type_for_signatured_type (sig_type, type);
 
   return type;
diff --git a/gdb/jit.c b/gdb/jit.c
index d55e371b02a..ce19591c378 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -664,7 +664,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
 			       priv_data->entry.symfile_addr));
 
   objfile *objfile = objfile::make (nullptr, current_program_space,
-				    objfile_name.c_str (), OBJF_NOT_FILENAME);
+				    objfile_name.c_str (),
+				    OBJF_NOT_FILENAME | OBJF_JIT);
   objfile->section_offsets.push_back (0);
   objfile->sect_index_text = 0;
   objfile->per_bfd->gdbarch = priv_data->gdbarch;
@@ -801,7 +802,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
   objfile = symbol_file_add_from_bfd (nbfd,
 				      bfd_get_filename (nbfd.get ()), 0,
 				      &sai,
-				      OBJF_SHARED | OBJF_NOT_FILENAME, NULL);
+				      OBJF_SHARED | OBJF_NOT_FILENAME |
+				      OBJF_JIT, NULL);
 
   add_objfile_entry (objfile, entry_addr, code_entry->symfile_addr,
 		     code_entry->symfile_size);
diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h
index e0a84bcdc2e..0ad6e4037dd 100644
--- a/gdb/objfile-flags.h
+++ b/gdb/objfile-flags.h
@@ -56,6 +56,9 @@ enum objfile_flag : unsigned
     /* User requested that we do not read this objfile's symbolic
        information.  */
     OBJF_READNEVER = 1 << 6,
+
+    /* Set if this objfile originates from a JIT compilation  */
+    OBJF_JIT = 1 << 7,
   };
 
 DEF_ENUM_FLAGS_TYPE (enum objfile_flag, objfile_flags);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/3] Add testing for type signature fallback.
  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 14:57 ` [PATCH 2/3] Add type signature fallback and JIT objfile restriction dominikmascherbauer
@ 2025-03-11 14:57 ` dominikmascherbauer
  2025-03-12 15:37 ` [PATCH v2 0/3] DWARF type signature lookup fallback dominikmascherbauer
  2025-03-12 16:32 ` [PATCH 0/3] DWARF type signature lookup fallback Tom Tromey
  4 siblings, 0 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-11 14:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

Create an executable with a type unit that loads a JIT objfile with a reference its type unit.
Then in the context of the JIT objfile the type is checked.
This causes a type signature lookup with a fallback to the main objfile.
---
 .../gdb.dwarf2/sig-type-fallback-jit.c        | 62 +++++++++++++++
 .../gdb.dwarf2/sig-type-fallback-jit.exp      | 75 +++++++++++++++++++
 2 files changed, 137 insertions(+)
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp

diff --git a/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
new file mode 100644
index 00000000000..da83e27ad64
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
@@ -0,0 +1,62 @@
+/* This test program is part of GDB, the GNU debugger.
+
+   Copyright 2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Simulate loading of JIT code.  */
+
+#include "../gdb.base/jit-elf-util.h"
+#include "../gdb.base/jit-protocol.h"
+
+/* Must be defined by .exp file when compiling to know
+   what address to map the ELF binary to.  */
+#ifndef LIB_ADDRESS
+#error "Must define LOAD_ADDRESS"
+#endif
+#ifndef LIB_NAME_STRING
+#error "Must define LIB_NAME_STRING"
+#endif
+
+int
+main ()
+{
+  size_t obj_size;
+  void *load_addr = (void *) (size_t) (LIB_ADDRESS);
+  void *addr = load_elf (LIB_NAME_STRING, &obj_size, load_addr);
+
+  /* Link entry at the end of the list.  */
+  struct jit_code_entry *const entry = calloc (1, sizeof (*entry));
+  entry->symfile_addr = (const char *) addr;
+  entry->symfile_size = obj_size;
+  __jit_debug_descriptor.relevant_entry = entry;
+  __jit_debug_descriptor.first_entry = entry;
+
+  /* Notify GDB.  */
+  __jit_debug_descriptor.action_flag = JIT_REGISTER;
+  __jit_debug_register_code ();
+
+  // breakpoint 1
+
+  /* Now unregister entry.  */
+  /* Notify GDB.  */
+  __jit_debug_descriptor.action_flag = JIT_UNREGISTER;
+  __jit_debug_register_code ();
+
+  __jit_debug_descriptor.first_entry = NULL;
+  __jit_debug_descriptor.relevant_entry = NULL;
+  free (entry);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp
new file mode 100644
index 00000000000..91465118c5f
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp
@@ -0,0 +1,75 @@
+# Copyright 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+load_lib dwarf.exp
+
+require dwarf2_support allow_shlib_tests
+
+set lib_address 0x7000000
+set lib_name libfoo.so
+
+standard_testfile .c .S -lib.S
+
+# Create fake DWARF TU for the main objfile.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble ${asm_file} {
+    tu {version 5} 0x1122334455667788 the_type {
+ 	type_unit {} {
+   	    the_type: base_type {
+   		{name myType}
+   		{encoding @DW_ATE_signed}
+   		{byte_size 4 sdata}
+   	    }
+   	}
+   	}
+}
+
+# Create fake DWARF CU with type reference for the jit object file.
+set asm_file_lib [standard_output_file $srcfile3]
+Dwarf::assemble ${asm_file_lib} {
+    cu {} {
+  	compile_unit {} {
+   	    declare_labels typedef_label
+
+   	    typedef_label: typedef {
+   		{name bar}
+   		{type 0x1122334455667788 ref_sig8 }
+   	    }
+   	}
+    }
+}
+
+
+set libobj [standard_output_file $lib_name]
+if {[build_executable "build shared library" $libobj $asm_file_lib \
+	 [list debug text_segment=$lib_address shlib]] != 0} {
+    return -1
+}
+
+if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $asm_file] \
+	 [list debug additional_flags=-DLIB_ADDRESS=$lib_address \
+	 additional_flags=-DLIB_NAME_STRING=\"$libobj\" ]]} {
+    return -1
+}
+
+if {![runto_main]} {
+    return -1
+}
+
+gdb_test_no_output "set dwarf-type-signature-fallback main"
+gdb_breakpoint [gdb_get_line_number "breakpoint 1"]
+gdb_continue_to_breakpoint "first breakpoint"
+gdb_test "ptype bar" "type = myType"
\ No newline at end of file
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Add new commands for controlling type signature fallback.
  2025-03-11 14:57 ` [PATCH 1/3] Add new commands for controlling type signature fallback dominikmascherbauer
@ 2025-03-11 17:33   ` Eli Zaretskii
  2025-03-12  9:12     ` Dominik Mascherbauer
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2025-03-11 17:33 UTC (permalink / raw)
  To: dominikmascherbauer; +Cc: gdb-patches

> 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>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Add new commands for controlling type signature fallback.
  2025-03-11 17:33   ` Eli Zaretskii
@ 2025-03-12  9:12     ` Dominik Mascherbauer
  2025-03-12 14:38       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Dominik Mascherbauer @ 2025-03-12  9:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Thanks for the review.


>> 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.
> 

Would this be enough, or does it need to be more detailed:

diff --git a/gdb/NEWS b/gdb/NEWS
index 53368d7463c..5274c84f168 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -262,18 +262,25 @@ disable missing-objfile-handler LOCUS HANDLER
   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.
+  New command which enables a type signature look up fallback for DWARF objfiles.
+  If type signatures in DWARF objfile are unique, enabling this option to look
+  up type signatures from fallback DWARF objfiles.  Reusing type units from
+  fallback objfiles can be used to avoid duplicating those type units.
+
+  The 'main' setting allows to limit the scope of the lookup to just the main
+  symfile objfile to reduce the overhead of type signature lookup.  The 'full'
+  setting uses all objfiles in a progspace to find as many type signatures as
+  possible.
   The default value is 'off'.
 
 set dwarf-type-signature-fallback-jit on|off
-  New command that is used in combination with type-signature-fallback
+  New command that is used in combination with dwarf-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.
+  JIT objfiles are produced at run-time and often rely on already available
+  type information.  This allows the debug info producer to skip generating type
+  units that are known to be present in other objfiles.
 
 * Changed commands
 
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 901152dd15e..9581ea915e4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -42329,27 +42329,35 @@ For more information on these expressions, see
 @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.
+Control the behavior of the type signature look up in DWARF objfiles.  Type
+Signatures in DWARF uniquely identify a type unit.  A type unit contains debug
+info for a type and can b referenced by its type signature.  Type signature
+look up allows @value{GDBN} to look up type signatures not only in objfile
+containing the refererence to a type signature, but also other type signatures
+in the progspace.  This allows to avoid duplicating type units, by looking them
+up from other DWARF objfiles.
 
 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
+objfiles in the progspace to look up missing type signatures.  When
+@code{main}, @value{GDBN} will check the current main symfile objfile for a
+missing signatured type.  If the main symfile objfile contains most of the
+debug info required for debugging, this setting reduces the impact of type
+signature look up.  When @code{full}, all DWARF 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
+Control whether @code{dwarf-type-signature-fallback} is limited to DWARF
 objfiles originated from the JIT interface (@pxref{JIT Interface})
-or all objfiles with a missing signatured type.
+or all DWARF objfiles with a missing signatured type.  If only objfiles loaded
+through the JIT interface rely on existing types and type units this
+setting allows to limit type signature look up to avoid undesired behavior.
 
 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.
+only DWARF objfiles from the JIT interface.  When @code{off}, type signature
+look up is performed for missing signatured types in all DWARF objfiles.
 
 @kindex maint set dwarf max-cache-age
 @kindex maint show dwarf max-cache-age


>> +  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.
> 

Ok, I will change that.

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Add new commands for controlling type signature fallback.
  2025-03-12  9:12     ` Dominik Mascherbauer
@ 2025-03-12 14:38       ` Eli Zaretskii
  2025-03-12 14:44         ` Dominik Mascherbauer
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2025-03-12 14:38 UTC (permalink / raw)
  To: Dominik Mascherbauer; +Cc: gdb-patches

> Date: Wed, 12 Mar 2025 10:12:23 +0100
> Cc: gdb-patches@sourceware.org
> From: Dominik Mascherbauer <dominik.mascherbauer@gmail.com>
> 
> Would this be enough, or does it need to be more detailed:

I think it should be enough, but there are typos to fix:

> +  If type signatures in DWARF objfile are unique, enabling this option to look
> +  up type signatures from fallback DWARF objfiles.

This sentence is incomplete, or maybe some words need to be modified.

> +Control the behavior of the type signature look up in DWARF objfiles.  Type
> +Signatures in DWARF uniquely identify a type unit.  A type unit contains debug
> +info for a type and can b referenced by its type signature.  Type signature
                           ^
"be"

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Add new commands for controlling type signature fallback.
  2025-03-12 14:38       ` Eli Zaretskii
@ 2025-03-12 14:44         ` Dominik Mascherbauer
  0 siblings, 0 replies; 16+ messages in thread
From: Dominik Mascherbauer @ 2025-03-12 14:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

>> Date: Wed, 12 Mar 2025 10:12:23 +0100
>> Cc: gdb-patches@sourceware.org
>> From: Dominik Mascherbauer <dominik.mascherbauer@gmail.com>
>>
>> Would this be enough, or does it need to be more detailed:
> 
> I think it should be enough, but there are typos to fix:
> 
>> +  If type signatures in DWARF objfile are unique, enabling this option to look
>> +  up type signatures from fallback DWARF objfiles.
> 
> This sentence is incomplete, or maybe some words need to be modified.
> 
>> +Control the behavior of the type signature look up in DWARF objfiles.  Type
>> +Signatures in DWARF uniquely identify a type unit.  A type unit contains debug
>> +info for a type and can b referenced by its type signature.  Type signature
>                            ^
> "be"
> 
> Thanks.

I'll fix that.
Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 0/3] DWARF type signature lookup fallback.
  2025-03-11 14:57 [PATCH 0/3] DWARF type signature lookup fallback dominikmascherbauer
                   ` (2 preceding siblings ...)
  2025-03-11 14:57 ` [PATCH 3/3] Add testing for type signature fallback dominikmascherbauer
@ 2025-03-12 15:37 ` dominikmascherbauer
  2025-03-12 15:37   ` [PATCH v2 1/3] Add new commands for controlling type signature fallback dominikmascherbauer
                     ` (2 more replies)
  2025-03-12 16:32 ` [PATCH 0/3] DWARF type signature lookup fallback Tom Tromey
  4 siblings, 3 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-12 15:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

In v2:

  - Update NEWS and manual entry
  - Update command doc in read.c

--

I am working on a patch that adds parameters to allow type signature fallback for DWARF type units to fallback to other objfiles.
This allows to only create type units once and reuse them by their type signature, reducing duplication of type units.
It builds on the uniqueness of type signatures, so a type signature always references the same type unit.

This is my first time using a mailing list, so please remind me of any formatting errors or other mistakes.

Thanks,
Dominik

dominikmascherbauer (3):
  Add new commands for controlling type signature fallback.
  Add type signature fallback and JIT objfile restriction.
  Add testing for type signature fallback.

 gdb/NEWS                                      |  21 ++
 gdb/doc/gdb.texinfo                           |  34 +++
 gdb/dwarf2/read.c                             | 255 ++++++++++++++++--
 gdb/jit.c                                     |   6 +-
 gdb/objfile-flags.h                           |   3 +
 .../gdb.dwarf2/sig-type-fallback-jit.c        |  62 +++++
 .../gdb.dwarf2/sig-type-fallback-jit.exp      |  75 ++++++
 7 files changed, 425 insertions(+), 31 deletions(-)
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp


base-commit: 512316811d47d689d75d25aa9d5b98bdafd64df6
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/3] Add new commands for controlling type signature fallback.
  2025-03-12 15:37 ` [PATCH v2 0/3] DWARF type signature lookup fallback dominikmascherbauer
@ 2025-03-12 15:37   ` 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
  2 siblings, 1 reply; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-12 15:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

'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            | 21 ++++++++++++++
 gdb/doc/gdb.texinfo | 34 ++++++++++++++++++++++
 gdb/dwarf2/read.c   | 71 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 126 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 2c504a9b603..58b2f6400b5 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -261,6 +261,27 @@ 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 look up fallback for DWARF objfiles.
+  If type signatures in DWARF objfile are unique, enabling this option allows
+  to look up type signatures from fallback DWARF objfiles.  Reusing type units
+  from fallback objfiles can be used to avoid duplicating those type units.
+
+  The 'main' setting allows limiting the scope of the lookup to just the main
+  symfile objfile to reduce the overhead of type signature lookup.  The 'full'
+  setting uses all objfiles in a progspace to find as many type signatures as
+  possible.
+  The default value is 'off'.
+
+set dwarf-type-signature-fallback-jit on|off
+  New command that is used in combination with dwarf-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.
+  JIT objfiles are produced at run-time and often rely on already available
+  type information.  This allows the debug info producer to skip generating type
+  units that are known to be present in other objfiles.
+
 * Changed commands
 
 remove-symbol-file
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 04719bf65e6..df343f9fdd8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -42325,6 +42325,40 @@ 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 look up in DWARF objfiles.  Type
+Signatures in DWARF uniquely identify a type unit.  A type unit contains debug
+info for a type and can be referenced by its type signature.  Type signature
+look up allows @value{GDBN} to look up type signatures not only in objfile
+containing the reference to a type signature, but also other type signatures
+in the progspace.  This allows to avoid duplicating type units, by looking them
+up from other DWARF objfiles.
+
+The default is @code{off}, which means @value{GDBN} will not use other
+objfiles in the progspace to look up missing type signatures.  When
+@code{main}, @value{GDBN} will check the current main symfile objfile for a
+missing signatured type.  If the main symfile objfile contains most of the
+debug info required for debugging, this setting reduces the impact of type
+signature look up.  When @code{full}, all DWARF 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 DWARF
+objfiles originated from the JIT interface (@pxref{JIT Interface})
+or all DWARF objfiles with a missing signatured type.  If only objfiles loaded
+through the JIT interface rely on existing types and type units this
+setting allows limiting type signature look up to avoid undesired behavior.
+
+The default is @code{on}, which limits the type signature fallback to
+only DWARF objfiles from the JIT interface.  When @code{off}, type signature
+look up is performed for missing signatured types in all DWARF objfiles.
+
 @kindex maint set dwarf max-cache-age
 @kindex maint show dwarf max-cache-age
 @item maint set dwarf max-cache-age
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index c5375b68567..3fdaf003fb7 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -737,6 +737,50 @@ show_dwarf_max_cache_age (struct ui_file *file, int from_tty,
 	      value);
 }
 
+/* If the type for a type signature is not found in the CUs objfile
+   fallback to other objfiles for type signature look up */
+const char type_signature_fallback_off[] = "off";
+const char type_signature_fallback_main[] = "main";
+const char type_signature_fallback_full[] = "full";
+static const char *type_signature_fallback_enums[] =
+	{
+		type_signature_fallback_off,
+		type_signature_fallback_main,
+		type_signature_fallback_full,
+		nullptr
+	};
+static const char *type_signature_fallback = type_signature_fallback_off;
+
+static void
+show_type_signature_fallback (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  gdb_printf (file, _ ("Look up of type signatures with "
+		       "other DWARF objfiles as fallback is %s.\n"),
+	      value);
+}
+
+/* Type signature fallback is by default restricted to only jit objfiles.  */
+static bool type_signature_fallback_jit = true;
+
+static void
+show_type_signature_fallback_jit (struct ui_file *file, int from_tty,
+				  struct cmd_list_element *c, const char *value)
+{
+  gdb_printf (file, _ ("Whether type signature look up with other"
+		       "DWARF objfiles as fallback is restricted to"
+		       "objfiles loaded through the JIT interface is %s.\n"),
+	      value);
+}
+
+/* Check if type signature fallback applies to OBJFILE.  */
+static bool
+use_type_signature_fallback (struct objfile *objfile)
+{
+  return type_signature_fallback != type_signature_fallback_off &&
+	 (!type_signature_fallback_jit || objfile->flags & OBJF_JIT);
+}
+
 /* When true, wait for DWARF reading to be complete.  */
 static bool dwarf_synchronous = false;
 
@@ -20103,6 +20147,33 @@ caching, which can slow down startup."),
 			    &set_dwarf_cmdlist,
 			    &show_dwarf_cmdlist);
 
+  add_setshow_enum_cmd ("dwarf-type-signature-fallback", class_support,
+			type_signature_fallback_enums, &type_signature_fallback,
+			_ ("\
+Set look up of type signatures with other DWARF objfiles as fallback."), _ ("\
+Show look up of type signatures with other DWARF objfiles as fallback."), _ ("\
+This option will only take effect if set before loading symbols.\n\
+main == use the main symbolfile as fallback objfile\n\
+	for type signature look up.\n\
+full == use all DWARF objfiles with type units in the current progspace\n\
+	as fallback objfiles for type signature look up.\n\
+off  == turn type signature fallback off."),
+			NULL, show_type_signature_fallback, &setlist,
+			&showlist);
+
+  add_setshow_boolean_cmd ("dwarf-type-signature-fallback-jit", class_support,
+			&type_signature_fallback_jit,
+			_ ("\
+Set whether look up of type signatures with other DWARF objfiles as fallback\n\
+is restricted to objfiles loaded through the JIT interface."), _ ("\
+Show whether look up of type signatures with other DWARF objfiles as fallback\n\
+is restricted to objfiles loaded through the JIT interface."), _ ("\
+By default, type signature look up with other DWARF objfiles as fallback is\n\
+restricted to objfiles loaded through the JIT interface.\n\
+This option will only take effect if type-signature-fallback is enabled."),
+			NULL, show_type_signature_fallback_jit, &setlist,
+			&showlist);
+
   add_setshow_boolean_cmd ("synchronous", class_obscure,
 			    &dwarf_synchronous, _("\
 Set whether DWARF is read synchronously."), _("\
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 2/3] Add type signature fallback and JIT objfile restriction.
  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:37   ` dominikmascherbauer
  2025-03-12 15:37   ` [PATCH v2 3/3] Add testing for type signature fallback dominikmascherbauer
  2 siblings, 0 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-12 15:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

To support type signature fallback, the lookup_signatured_type method is extended.
If no type signature was found in the current objfile or in a dwo file, the dwraf-type-signature-fallback option is checked:
'off': return nullptr
'main': only check the current main objfile for the type signature.
This reduces the additional load for a fallback as only one additional objfile is checked.
The main objfile often contains major parts of the debug info, thus it is also likely that the requested type signature is found there.
If the main objfile is linked to dwo/dwp files, those are also checked for the type signature.
This should be the same behavior as if the type signature is lookup up without fallback.
'full': check all objfiles in the current prospace.
Requires potentially more time than just checking the main objfile, but it will also find a type signature in a loaded shared library.

If a type signature was found in a fallback objfile, the per_objfile after lookup_signatured_type is the fallback per_objfile.
This ensures that if the type unit still needs to be read, it is read from the correct objfile.

Additionally, a flag is added to objfiles that marks an objfile as a JIT objfile.
With this information the type signature fallback can be restricted to only work for JIT objfiles.
This is a separate option because JIT objfile are self-contained but usually share debug info (especially type information) with some other already loaded objfile.
So this leaves loading other objfiles as is to avoid unexpected behavior if needed.
---
 gdb/dwarf2/read.c   | 184 +++++++++++++++++++++++++++++++++++++-------
 gdb/jit.c           |   6 +-
 gdb/objfile-flags.h |   3 +
 3 files changed, 162 insertions(+), 31 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3fdaf003fb7..4b86acec772 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2669,12 +2669,12 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile,
    to read all the DWOs to build the type unit groups.  */
 
 static struct signatured_type *
-lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_dwo_signatured_type (struct dwo_unit *dwo_unit, ULONGEST sig,
+			    struct dwarf2_per_objfile *per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
   dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
 
-  gdb_assert (cu->dwo_unit);
+  gdb_assert (dwo_unit);
 
   /* We only ever need to read in one copy of a signatured type.
      Use the global signatured_types array to do our own comdat-folding
@@ -2697,14 +2697,14 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
       && (*sig_type_it)->tu_read)
     return *sig_type_it;
 
-  /* Note: cu->dwo_unit is the dwo_unit that references this TU, not the
+  /* Note: dwo_unit is the dwo_unit that references this TU, not the
      dwo_unit of the TU itself.  */
-  dwo_file *dwo_file = cu->dwo_unit->dwo_file;
+  dwo_file *dwo_file = dwo_unit->dwo_file;
   auto it = dwo_file->tus.find (sig);
   if (it == dwo_file->tus.end ())
     return nullptr;
 
-  dwo_unit *dwo_entry = *it;
+  struct dwo_unit *dwo_entry = *it;
 
   /* If the global table doesn't have an entry for this TU, add one.  */
   if (sig_type_it == per_bfd->signatured_types.end ())
@@ -2724,13 +2724,12 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
    it won't be in .gdb_index.  */
 
 static struct signatured_type *
-lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_dwp_signatured_type (ULONGEST sig,
+			    struct dwarf2_per_objfile *per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
   dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
   struct dwp_file *dwp_file = get_dwp_file (per_objfile);
 
-  gdb_assert (cu->dwo_unit);
   gdb_assert (dwp_file != NULL);
 
   auto sig_type_it = per_bfd->signatured_types.find (sig);
@@ -2756,34 +2755,133 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
   return *sig_type_it;
 }
 
+/* Subroutine of lookup_signatured_type.
+   Look up the type for signature SIG, from a fallback objfile.
+   If we don't have a DWO/DWP file or can't find the signature there, check the
+   fallback object file.
+   If a signatured type was found, PER_OBJFILE will contain its per_objfile.  */
+
+static struct signatured_type *
+lookup_fallback_signatured_type (struct objfile *fallback_objfile, ULONGEST sig,
+				 struct dwarf2_per_objfile **per_objfile)
+{
+  struct signatured_type *sig_type = nullptr;
+
+  /* If we have a separate debug objfile, use it for the fallback.  */
+  if (fallback_objfile->separate_debug_objfile != nullptr)
+    fallback_objfile = fallback_objfile->separate_debug_objfile;
+
+  struct dwarf2_per_objfile *fallback_per_objfile = get_dwarf2_per_objfile
+	  (fallback_objfile);
+
+  /* The fallback objfile must be different to the current objfile.  Otherwise,
+     this is no fallback so all necessary checks were already performed in
+     lookup_signatured_type.  */
+  if (fallback_per_objfile == *per_objfile)
+    return nullptr;
+
+  /* Do we have a dwp file?  */
+  if (get_dwp_file (fallback_per_objfile) != nullptr)
+    {
+      sig_type = lookup_dwp_signatured_type (sig, fallback_per_objfile);
+    }
+    /* Do we have dwo files?  */
+  else
+    {
+      /* Look for dwo_entry that contains the signatured type.  */
+      for (const dwo_file_up &file : fallback_per_objfile->per_bfd->dwo_files)
+        {
+	  auto it = file->tus.find (sig);
+	  if (it != file->tus.end ())
+	    {
+	      /* We found the dwo entry.  Check for the signatured type.  */
+	      sig_type = lookup_dwo_signatured_type (*it, sig,
+						   fallback_per_objfile);
+	      break;
+	    }
+        }
+    }
+
+  /* Do we still need to check the fallback per_objfile or was the signatured
+     type found in a DWO/DWP file?  */
+  if (sig_type == nullptr)
+    {
+      auto sig_type_it
+        = fallback_per_objfile->per_bfd->signatured_types.find (sig);
+
+      if (sig_type_it != fallback_per_objfile->per_bfd->signatured_types.end ())
+	sig_type = *sig_type_it;
+    }
+
+  if (sig_type != nullptr)
+    /* Ensure we will know where the signature type came from.  */
+    *per_objfile = fallback_per_objfile;
+  return sig_type;
+}
+
 /* Lookup a signature based type for DW_FORM_ref_sig8.
    Returns NULL if signature SIG is not present in the table.
-   It is up to the caller to complain about this.  */
+   It is up to the caller to complain about this.
+   If type_signature_fallback is enabled and the signatured type is found,
+   per_objfile is the objfile where the signatured type was found in.  */
 
 static struct signatured_type *
-lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
+lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig,
+			struct dwarf2_per_objfile **per_objfile)
 {
-  dwarf2_per_objfile *per_objfile = cu->per_objfile;
-  dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+  struct signatured_type *sig_type = nullptr;
+  dwarf2_per_bfd *per_bfd = (*per_objfile)->per_bfd;
 
   if (cu->dwo_unit)
     {
       /* We're in a DWO/DWP file, and we're using .gdb_index.
-	 These cases require special processing.  */
-      if (get_dwp_file (per_objfile) == NULL)
-	return lookup_dwo_signatured_type (cu, sig);
+     These cases require special processing.  */
+      if (get_dwp_file (*per_objfile) == nullptr)
+	sig_type = lookup_dwo_signatured_type (cu->dwo_unit, sig, *per_objfile);
       else
-	return lookup_dwp_signatured_type (cu, sig);
+	sig_type = lookup_dwp_signatured_type (sig, *per_objfile);
+
+      /* If we already found the signatured type, return it.  */
+      if (sig_type != nullptr)
+	return sig_type;
     }
   else
     {
+      /* Lookup type signature in the current objfile.  */
       auto sig_type_it = per_bfd->signatured_types.find (sig);
 
+      /* If we already found the signatured type, return it.  */
       if (sig_type_it != per_bfd->signatured_types.end ())
 	return *sig_type_it;
+    }
 
-      return nullptr;
+  /* Handle fallback if type signature lookup fallback is enabled for this
+     objfile.  */
+  if (use_type_signature_fallback ((*per_objfile)->objfile))
+    {
+      /* Do a full fallback through all objfiles in the progspace.  */
+      if (type_signature_fallback == type_signature_fallback_full)
+	{
+	  for (objfile *objfile: (*per_objfile)->objfile->pspace ()->objfiles ())
+	    {
+	      sig_type = lookup_fallback_signatured_type (objfile, sig,
+							  per_objfile);
+	      /* If we already found the signatured type, return it.  */
+	      if (sig_type != nullptr)
+		return sig_type;
+	    }
+	}
+      else
+	{
+	  /* fallback to main symfile objfile.  */
+	  struct objfile *objfile
+	    = (*per_objfile)->objfile->pspace ()->symfile_object_file;
+	  return lookup_fallback_signatured_type (objfile, sig, per_objfile);
+	}
     }
+
+  /* We could not find the signatured type.  */
+  return nullptr;
 }
 
 /* Low level DIE reading support.  */
@@ -4333,8 +4431,19 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, dwarf2_per_cu *per_cu,
   bool queued = false;
   if (!per_objfile->symtab_set_p (per_cu))
     {
-      /* Add it to the queue.  */
-      queue_comp_unit (per_cu, per_objfile, pretend_language);
+      if (dependent_cu != nullptr && !per_objfile->queue.has_value () &&
+	  type_signature_fallback != type_signature_fallback_off)
+	{
+	  /* If the signatured type in the fallback objfile references another
+	     signatured type we might end up here with no queue in the fallback
+	     objfile.  */
+	  dw2_instantiate_symtab (per_cu, per_objfile, false);
+	}
+      else
+	{
+	  /* Add it to the queue.  */
+	  queue_comp_unit (per_cu, per_objfile, pretend_language);
+	}
       queued = true;
 
       dwarf_read_debug_printf ("Queuing CU for expansion: "
@@ -8383,7 +8492,7 @@ static int
 queue_and_load_dwo_tu (dwo_unit *dwo_unit, dwarf2_cu *cu)
 {
   ULONGEST signature = dwo_unit->signature;
-  signatured_type *sig_type = lookup_dwo_signatured_type (cu, signature);
+  signatured_type *sig_type = lookup_dwo_signatured_type (cu->dwo_unit, signature, cu->per_objfile);
 
   if (sig_type != NULL)
     {
@@ -18985,6 +19094,7 @@ dwarf2_get_die_type (cu_offset die_offset, dwarf2_per_cu *per_cu,
 
 static struct die_info *
 follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
+		  struct dwarf2_per_objfile *sig_type_per_objfile,
 		  struct dwarf2_cu **ref_cu)
 {
   struct dwarf2_cu *sig_cu;
@@ -19000,12 +19110,14 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
      Even if maybe_queue_comp_unit doesn't require us to load the CU's DIEs,
      it doesn't mean they are currently loaded.  Since we require them
      to be loaded, we must check for ourselves.  */
-  if (maybe_queue_comp_unit (*ref_cu, sig_type, per_objfile,
+  if (maybe_queue_comp_unit (*ref_cu, sig_type, sig_type_per_objfile,
 			     language_minimal)
-      || per_objfile->get_cu (sig_type) == nullptr)
-    read_signatured_type (sig_type, per_objfile);
+      || sig_type_per_objfile->get_cu (sig_type) == nullptr)
+    {
+      read_signatured_type (sig_type, sig_type_per_objfile);
+    }
 
-  sig_cu = per_objfile->get_cu (sig_type);
+  sig_cu = sig_type_per_objfile->get_cu (sig_type);
   gdb_assert (sig_cu != NULL);
   gdb_assert (to_underlying (sig_type->type_offset_in_section) != 0);
 
@@ -19041,7 +19153,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
 
   gdb_assert (attr->form == DW_FORM_ref_sig8);
 
-  sig_type = lookup_signatured_type (*ref_cu, signature);
+  dwarf2_per_objfile *sig_type_per_objfile = (*ref_cu)->per_objfile;
+  sig_type = lookup_signatured_type (*ref_cu, signature, &sig_type_per_objfile);
   /* sig_type will be NULL if the signatured type is missing from
      the debug info.  */
   if (sig_type == NULL)
@@ -19053,7 +19166,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
 	     objfile_name ((*ref_cu)->per_objfile->objfile));
     }
 
-  die = follow_die_sig_1 (src_die, sig_type, ref_cu);
+  die = follow_die_sig_1 (src_die, sig_type, sig_type_per_objfile, ref_cu);
   if (die == NULL)
     {
       src_die->error_dump ();
@@ -19080,7 +19193,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
   struct die_info *type_die;
   struct type *type;
 
-  sig_type = lookup_signatured_type (cu, signature);
+  dwarf2_per_objfile *sig_type_per_objfile = per_objfile;
+  sig_type = lookup_signatured_type (cu, signature, &sig_type_per_objfile);
   /* sig_type will be NULL if the signatured type is missing from
      the debug info.  */
   if (sig_type == NULL)
@@ -19099,7 +19213,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
     return type;
 
   type_cu = cu;
-  type_die = follow_die_sig_1 (die, sig_type, &type_cu);
+  type_die = follow_die_sig_1 (die, sig_type, sig_type_per_objfile, &type_cu);
   if (type_die != NULL)
     {
       /* N.B. We need to call get_die_type to ensure only one type for this DIE
@@ -19126,6 +19240,18 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
       type = build_error_marker_type (cu, die);
     }
 
+  if (type_signature_fallback != type_signature_fallback_off)
+    {
+      /* We might already have read the required signatured type
+         after looking for it in a fallback objfile  */
+      struct type *existing_type = per_objfile->get_type_for_signatured_type
+	      (sig_type);
+      if (existing_type != nullptr)
+	{
+	  gdb_assert (type == existing_type);
+	  return type;
+	}
+    }
   per_objfile->set_type_for_signatured_type (sig_type, type);
 
   return type;
diff --git a/gdb/jit.c b/gdb/jit.c
index d55e371b02a..ce19591c378 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -664,7 +664,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
 			       priv_data->entry.symfile_addr));
 
   objfile *objfile = objfile::make (nullptr, current_program_space,
-				    objfile_name.c_str (), OBJF_NOT_FILENAME);
+				    objfile_name.c_str (),
+				    OBJF_NOT_FILENAME | OBJF_JIT);
   objfile->section_offsets.push_back (0);
   objfile->sect_index_text = 0;
   objfile->per_bfd->gdbarch = priv_data->gdbarch;
@@ -801,7 +802,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
   objfile = symbol_file_add_from_bfd (nbfd,
 				      bfd_get_filename (nbfd.get ()), 0,
 				      &sai,
-				      OBJF_SHARED | OBJF_NOT_FILENAME, NULL);
+				      OBJF_SHARED | OBJF_NOT_FILENAME |
+				      OBJF_JIT, NULL);
 
   add_objfile_entry (objfile, entry_addr, code_entry->symfile_addr,
 		     code_entry->symfile_size);
diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h
index e0a84bcdc2e..0ad6e4037dd 100644
--- a/gdb/objfile-flags.h
+++ b/gdb/objfile-flags.h
@@ -56,6 +56,9 @@ enum objfile_flag : unsigned
     /* User requested that we do not read this objfile's symbolic
        information.  */
     OBJF_READNEVER = 1 << 6,
+
+    /* Set if this objfile originates from a JIT compilation  */
+    OBJF_JIT = 1 << 7,
   };
 
 DEF_ENUM_FLAGS_TYPE (enum objfile_flag, objfile_flags);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 3/3] Add testing for type signature fallback.
  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:37   ` [PATCH v2 2/3] Add type signature fallback and JIT objfile restriction dominikmascherbauer
@ 2025-03-12 15:37   ` dominikmascherbauer
  2 siblings, 0 replies; 16+ messages in thread
From: dominikmascherbauer @ 2025-03-12 15:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: dominikmascherbauer

Create an executable with a type unit that loads a JIT objfile with a reference its type unit.
Then in the context of the JIT objfile the type is checked.
This causes a type signature lookup with a fallback to the main objfile.
---
 .../gdb.dwarf2/sig-type-fallback-jit.c        | 62 +++++++++++++++
 .../gdb.dwarf2/sig-type-fallback-jit.exp      | 75 +++++++++++++++++++
 2 files changed, 137 insertions(+)
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp

diff --git a/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
new file mode 100644
index 00000000000..da83e27ad64
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.c
@@ -0,0 +1,62 @@
+/* This test program is part of GDB, the GNU debugger.
+
+   Copyright 2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Simulate loading of JIT code.  */
+
+#include "../gdb.base/jit-elf-util.h"
+#include "../gdb.base/jit-protocol.h"
+
+/* Must be defined by .exp file when compiling to know
+   what address to map the ELF binary to.  */
+#ifndef LIB_ADDRESS
+#error "Must define LOAD_ADDRESS"
+#endif
+#ifndef LIB_NAME_STRING
+#error "Must define LIB_NAME_STRING"
+#endif
+
+int
+main ()
+{
+  size_t obj_size;
+  void *load_addr = (void *) (size_t) (LIB_ADDRESS);
+  void *addr = load_elf (LIB_NAME_STRING, &obj_size, load_addr);
+
+  /* Link entry at the end of the list.  */
+  struct jit_code_entry *const entry = calloc (1, sizeof (*entry));
+  entry->symfile_addr = (const char *) addr;
+  entry->symfile_size = obj_size;
+  __jit_debug_descriptor.relevant_entry = entry;
+  __jit_debug_descriptor.first_entry = entry;
+
+  /* Notify GDB.  */
+  __jit_debug_descriptor.action_flag = JIT_REGISTER;
+  __jit_debug_register_code ();
+
+  // breakpoint 1
+
+  /* Now unregister entry.  */
+  /* Notify GDB.  */
+  __jit_debug_descriptor.action_flag = JIT_UNREGISTER;
+  __jit_debug_register_code ();
+
+  __jit_debug_descriptor.first_entry = NULL;
+  __jit_debug_descriptor.relevant_entry = NULL;
+  free (entry);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp
new file mode 100644
index 00000000000..91465118c5f
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/sig-type-fallback-jit.exp
@@ -0,0 +1,75 @@
+# Copyright 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+load_lib dwarf.exp
+
+require dwarf2_support allow_shlib_tests
+
+set lib_address 0x7000000
+set lib_name libfoo.so
+
+standard_testfile .c .S -lib.S
+
+# Create fake DWARF TU for the main objfile.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble ${asm_file} {
+    tu {version 5} 0x1122334455667788 the_type {
+ 	type_unit {} {
+   	    the_type: base_type {
+   		{name myType}
+   		{encoding @DW_ATE_signed}
+   		{byte_size 4 sdata}
+   	    }
+   	}
+   	}
+}
+
+# Create fake DWARF CU with type reference for the jit object file.
+set asm_file_lib [standard_output_file $srcfile3]
+Dwarf::assemble ${asm_file_lib} {
+    cu {} {
+  	compile_unit {} {
+   	    declare_labels typedef_label
+
+   	    typedef_label: typedef {
+   		{name bar}
+   		{type 0x1122334455667788 ref_sig8 }
+   	    }
+   	}
+    }
+}
+
+
+set libobj [standard_output_file $lib_name]
+if {[build_executable "build shared library" $libobj $asm_file_lib \
+	 [list debug text_segment=$lib_address shlib]] != 0} {
+    return -1
+}
+
+if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $asm_file] \
+	 [list debug additional_flags=-DLIB_ADDRESS=$lib_address \
+	 additional_flags=-DLIB_NAME_STRING=\"$libobj\" ]]} {
+    return -1
+}
+
+if {![runto_main]} {
+    return -1
+}
+
+gdb_test_no_output "set dwarf-type-signature-fallback main"
+gdb_breakpoint [gdb_get_line_number "breakpoint 1"]
+gdb_continue_to_breakpoint "first breakpoint"
+gdb_test "ptype bar" "type = myType"
\ No newline at end of file
-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/3] Add new commands for controlling type signature fallback.
  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
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2025-03-12 15:43 UTC (permalink / raw)
  To: dominikmascherbauer; +Cc: gdb-patches

> From: dominikmascherbauer <dominik.mascherbauer@gmail.com>
> Cc: dominikmascherbauer <dominik.mascherbauer@oracle.com>
> Date: Wed, 12 Mar 2025 16:37:06 +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            | 21 ++++++++++++++
>  gdb/doc/gdb.texinfo | 34 ++++++++++++++++++++++
>  gdb/dwarf2/read.c   | 71 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 126 insertions(+)

Thanks, the documentation parts are okay.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] DWARF type signature lookup fallback.
  2025-03-11 14:57 [PATCH 0/3] DWARF type signature lookup fallback dominikmascherbauer
                   ` (3 preceding siblings ...)
  2025-03-12 15:37 ` [PATCH v2 0/3] DWARF type signature lookup fallback dominikmascherbauer
@ 2025-03-12 16:32 ` Tom Tromey
  2025-03-13 10:42   ` Dominik Mascherbauer
  4 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2025-03-12 16:32 UTC (permalink / raw)
  To: dominikmascherbauer; +Cc: gdb-patches, dominikmascherbauer

>>>>> dominikmascherbauer  <dominik.mascherbauer@gmail.com> writes:

> I am working on a patch that adds parameters to allow type signature
> fallback for DWARF type units to fallback to other objfiles.  This
> allows to only create type units once and reuse them by their type
> signature, reducing duplication of type units.  It builds on the
> uniqueness of type signatures, so a type signature always references
> the same type unit.

I am not sure this can really work due to lifetime constraints.

GDB has some rules about type ownership:

1. Arch-owned types must only refer to other arch-owned types

2. Objfile-owned types must only refer to other types coming from the
   same objfile, or to arch-owned types

These rules exist so that if an objfile is removed, there will not be
any dangling pointers.

I think this series violates rule 2.

There's a follow-on rule to this that isn't as frequently discussed, but
a symbol in an objfile has to follow rule 2 as well: it can't refer to
types from another objfile.  And I think this series also violates this.

I think you can see this in action for opaque types, where the lookup is
done over and over, because caching the result would violate the rules.
(This brings up the question of why you want this feature at all as
opposed to just using opaque type resolution.)


Anyway, this can't be easily remedied.  One idea we have discussed in
the past is to have a "type GC".  What this would mean is removing type
ownership -- just allocate all types globally.  Then, have a garbage
collector that removes type objects when things change, for instance
after an objfile is destroyed.

This is difficult to implement though.  For one thing types can refer
back to symbols.  Though perhaps this particular special case could be
handled by the GC.

Maybe other approaches are possible too, I don't know.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] DWARF type signature lookup fallback.
  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
  0 siblings, 1 reply; 16+ messages in thread
From: Dominik Mascherbauer @ 2025-03-13 10:42 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, dominikmascherbauer

>>>>>> dominikmascherbauer  <dominik.mascherbauer@gmail.com> writes:
> 
>> I am working on a patch that adds parameters to allow type signature
>> fallback for DWARF type units to fallback to other objfiles.  This
>> allows to only create type units once and reuse them by their type
>> signature, reducing duplication of type units.  It builds on the
>> uniqueness of type signatures, so a type signature always references
>> the same type unit.
> 
> I am not sure this can really work due to lifetime constraints.
> 
> GDB has some rules about type ownership:
> 
> 1. Arch-owned types must only refer to other arch-owned types
> 
> 2. Objfile-owned types must only refer to other types coming from the
>    same objfile, or to arch-owned types
> 
> These rules exist so that if an objfile is removed, there will not be
> any dangling pointers.
> 
> I think this series violates rule 2.
> 
> There's a follow-on rule to this that isn't as frequently discussed, but
> a symbol in an objfile has to follow rule 2 as well: it can't refer to
> types from another objfile.  And I think this series also violates this.
> 
> I think you can see this in action for opaque types, where the lookup is
> done over and over, because caching the result would violate the rules.
> (This brings up the question of why you want this feature at all as
> opposed to just using opaque type resolution.)
> 
> 
> Anyway, this can't be easily remedied.  One idea we have discussed in
> the past is to have a "type GC".  What this would mean is removing type
> ownership -- just allocate all types globally.  Then, have a garbage
> collector that removes type objects when things change, for instance
> after an objfile is destroyed.
> 
> This is difficult to implement though.  For one thing types can refer
> back to symbols.  Though perhaps this particular special case could be
> handled by the GC.
> 
> Maybe other approaches are possible too, I don't know.
> 
> Tom

Thanks for the response.  I agree that this series violates rule 2 as you 
mentioned.  I was not aware of those rules at the time of implementing
this patch.

Thank you very much for pointing out opaque types.  I did not come across
those when trying to figure out how to reference existing types from other
objfiles.  For checking available options I mainly used the DWARF specification
which does not mention them.

My initial idea was to use type signatures as they should be unique even
across multiple objfiles.  Based on that I thought it would be possible
to use type signatures for finding type units in other not linked 
objfiles such as objfiles coming from the JIT compilation interface.

I tested opaque types for my use-case, and it did work out.  So, I guess the
best option for me is to adapt the generated debug info for opaque types.

Thanks again,
Dominik

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] DWARF type signature lookup fallback.
  2025-03-13 10:42   ` Dominik Mascherbauer
@ 2025-03-13 15:37     ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2025-03-13 15:37 UTC (permalink / raw)
  To: Dominik Mascherbauer; +Cc: Tom Tromey, gdb-patches, dominikmascherbauer

>>>>> "Dominik" == Dominik Mascherbauer <dominik.mascherbauer@gmail.com> writes:

Dominik> Thanks for the response.  I agree that this series violates rule 2 as you 
Dominik> mentioned.  I was not aware of those rules at the time of implementing
Dominik> this patch.

Totally understandable, since if they are written down anywhere, it's in
some comment "somewhere".

Dominik> My initial idea was to use type signatures as they should be unique even
Dominik> across multiple objfiles.  Based on that I thought it would be possible
Dominik> to use type signatures for finding type units in other not linked 
Dominik> objfiles such as objfiles coming from the JIT compilation interface.

FWIW I think your insight here is correct.

Dominik> I tested opaque types for my use-case, and it did work out.  So, I guess the
Dominik> best option for me is to adapt the generated debug info for opaque types.

I wonder if integrating type signatures into 'struct type' would be
possible.  That is, an opaque type could store its signature.  Then
there'd be a new "quick" API method to look up a full type (which gdb
confusingly calls "transparent") by signature.

This might solve your problem without violating the lifetime rules and
without requiring type GC.

thanks,
Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-03-13 15:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox