From: Tom Tromey Date: Sat, 18 Oct 2025 20:33:06 +0000 (-0600) Subject: Only set call site if not empty X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a83612ba7526757568305b2f452167919ce3579d;p=thirdparty%2Fbinutils-gdb.git Only set call site if not empty 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 --- diff --git a/gdb/symtab.c b/gdb/symtab.c index 13cd331064c..4e96503586e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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 (std::move (call_site_htab)); + if (!call_site_htab.empty ()) + m_call_site_htab + = std::make_unique (std::move (call_site_htab)); } /* See symtab.h. */