From 63603295544821124aa5bed9f0e153d0c809f01a Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Sun, 27 Apr 2025 23:57:56 -0300 Subject: [PATCH] GDB: linux-nat: Make tdesc parameters available early Otherwise reg_buffer::initialize_variable_size_registers () won't be able to resolve the types of variable-size registers. --- gdb/linux-nat.c | 11 +++++++++++ gdb/linux-nat.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 2f98060506b..72d1448da62 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4637,6 +4637,17 @@ linux_nat_target::supports_set_thread_options (gdb_thread_options options) return ((options & supported_options) == options); } +/* See gdb/process-stratum-target.h. */ + +void +linux_nat_target::supply_early_registers (regcache *regcache) +{ + if (regcache->has_variable_size_registers ()) + /* We need the values of target description parameter early, so make + sure they're available. */ + regcache->update_tdesc_parameters (); +} + linux_nat_target::linux_nat_target () { /* We don't change the stratum; this target will sit at diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 6e539918ced..62f4296279f 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -192,6 +192,8 @@ public: recognizes SIGTRAP only. */ virtual bool low_status_is_event (int status); + void supply_early_registers (regcache *regcache) override; + protected: void post_startup_inferior (ptid_t) override; -- 2.47.2