]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Only set call site if not empty
authorTom Tromey <tom@tromey.com>
Sat, 18 Oct 2025 20:33:06 +0000 (14:33 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 20 Oct 2025 23:27:58 +0000 (17:27 -0600)
In an earlier discussion, I noted that most compunit_symtabs do not
have a call-site hash table, so inlining the object into
compunit_symtab did not make sense.

It turns out that this is not entirely true -- while most
compunit_symtabs do not have any data in this object, the object
itself is always created.  This in turn is a regression introduced by
commit de2b4ab5 ("Convert dwarf2_cu::call_site_htab to new hash
table").

This patch fixes the issue by arranging to only store a call-site hash
table when it is non-empty.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/symtab.c

index 13cd331064c7d73cdf32223825316f3dde3578c4..4e96503586ecc7369bf2232e90dae5d1f488bf61 100644 (file)
@@ -428,8 +428,9 @@ void
 compunit_symtab::set_call_site_htab (call_site_htab_t &&call_site_htab)
 {
   gdb_assert (m_call_site_htab == nullptr);
-  m_call_site_htab
-    = std::make_unique<call_site_htab_t> (std::move (call_site_htab));
+  if (!call_site_htab.empty ())
+    m_call_site_htab
+      = std::make_unique<call_site_htab_t> (std::move (call_site_htab));
 }
 
 /* See symtab.h.  */