* [PATCH] Refrain from asking debug stubs to read invalid memory
@ 2024-03-18 16:19 Kévin Le Gouguec
0 siblings, 0 replies; only message in thread
From: Kévin Le Gouguec @ 2024-03-18 16:19 UTC (permalink / raw)
To: gdb-patches; +Cc: Kévin Le Gouguec
Some stubs take exception to this.
For example we observe RTEMS's libdebugger freezing when asked to examine
address zero on aarch64/xilinx_zynqmp_lp64_qemu. As of 2024-02-02 "gdb,
types: Resolve pointer types dynamically" (f18fc7e56fb) this happens as
early as 'target remote'. Ordinarily we would be greeted with…
_User_extensions_Thread_switch (executing=0x0, heir=<optimized out>)
at […]/cpukit/include/rtems/score/userextimpl.h:382
… but now, as language_defn::read_var_value calls resolve_dynamic_type with
a "dummy" address and value, resolve_dynamic_type_internal receives a
similarly "dummy" addr_stack, and attempts to read memory address zero:
guard against that.
---
gdb/gdbtypes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 599a696839e..917c997ad8c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2805,7 +2805,7 @@ resolve_dynamic_type_internal (struct type *type,
if (addr_stack->valaddr.data () != NULL)
pinfo.addr = extract_typed_address (addr_stack->valaddr.data (),
type);
- else
+ else if (addr_stack->addr != 0)
pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
pinfo.next = addr_stack;
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-18 16:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 16:19 [PATCH] Refrain from asking debug stubs to read invalid memory Kévin Le Gouguec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox