Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: z80: Guard against missing symtab in skip_prologue
@ 2026-06-03 12:11 Ronald Hecht
  2026-06-03 15:32 ` [PP?] " Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Ronald Hecht @ 2026-06-03 12:11 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 352 bytes --]

|Hi, this is the patch from PR tdep/34198. It fixes an internal 
segmentation fault in z80_skip_prologue when setting "break main" on 
some Z80 binaries. "break *main" works, which points at the prologue/SAL 
path. Regression-tested manually with the reproducer from the PR. 
Thanks, Ronald https://sourceware.org/bugzilla/show_bug.cgi?id=34198 |

[-- Attachment #1.2: Type: text/html, Size: 838 bytes --]

[-- Attachment #2: 0001-gdb-z80-Guard-against-missing-symtab-in-skip_prologu.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From 14a45c8bd64db9c6c41c75bd9a7de2c95935e9f2 Mon Sep 17 00:00:00 2001
From: Ronald Hecht <r.hecht@astech.de>
Date: Wed, 3 Jun 2026 14:05:07 +0200
Subject: [PATCH] gdb: z80: Guard against missing symtab in skip_prologue

Signed-off-by: Ronald Hecht <r.hecht@astech.de>
---
 gdb/z80-tdep.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index f7e207d0..f2e9b09e 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -495,12 +495,17 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   if (prologue_end != 0)
     {
       struct symtab_and_line prologue_sal = find_sal_for_pc (func_addr, 0);
-      struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
-      const char *debug_format = compunit->debugformat ();
-
-      if (debug_format != NULL &&
-	  !strncasecmp ("dwarf", debug_format, strlen("dwarf")))
-	return std::max (pc, prologue_end);
+      if (prologue_sal.symtab != nullptr)
+	{
+	  struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
+	  if (compunit != nullptr)
+	    {
+	      const char *debug_format = compunit->debugformat ();
+	      if (debug_format != nullptr
+		  && !strncasecmp ("dwarf", debug_format, strlen ("dwarf")))
+		return std::max (pc, prologue_end);
+	    }
+	}
     }
 
   return pc;
-- 
2.43.0


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

end of thread, other threads:[~2026-06-04 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 12:11 [PATCH] gdb: z80: Guard against missing symtab in skip_prologue Ronald Hecht
2026-06-03 15:32 ` [PP?] " Simon Marchi
2026-06-04  6:58   ` Ronald Hecht
2026-06-04 19:49     ` Simon Marchi

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