Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: restore nullptr check in compunit_symtab::find_call_site
@ 2024-12-03 15:52 Simon Marchi
  2024-12-03 16:17 ` Tom de Vries
  2024-12-03 17:49 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Marchi @ 2024-12-03 15:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Commit de2b4ab50de ("Convert dwarf2_cu::call_site_htab to new hash
table") removed this nullptr check for no good reason.  This causes a
crash if `m_call_site_htab` is not set, as shown in PR 32410.  My guess
is that when doing this change, I tried to make `m_call_site_htab` not a
pointer, removed this check, then realized it wasn't so obvious, and
forgot to re-add the check.

Change-Id: I455e00cdc0519dfb412dc7826d17a839b77aae69
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32410
---
 gdb/symtab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index edc19ff5c155..30c22dcea38c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -396,6 +396,9 @@ linetable_entry::pc (const struct objfile *objfile) const
 call_site *
 compunit_symtab::find_call_site (CORE_ADDR pc) const
 {
+  if (m_call_site_htab == nullptr)
+    return nullptr;
+
   CORE_ADDR delta = this->objfile ()->text_section_offset ();
 
   if (auto it = m_call_site_htab->find (static_cast<unrelocated_addr> (pc - delta));

base-commit: d556cf2ec79ed5afbbdd523484954c6a520b5b73
-- 
2.47.1


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

end of thread, other threads:[~2024-12-03 20:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 15:52 [PATCH] gdb: restore nullptr check in compunit_symtab::find_call_site Simon Marchi
2024-12-03 16:17 ` Tom de Vries
2024-12-03 19:19   ` Simon Marchi
2024-12-03 17:49 ` Tom Tromey
2024-12-03 19:11   ` Simon Marchi
2024-12-03 19:43     ` Tom Tromey
2024-12-03 20:05       ` Simon Marchi
2024-12-03 20:15         ` Tom Tromey

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