]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
GDB: remote: Update tdesc parameters and packet size ...
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Sun, 27 Apr 2025 05:01:44 +0000 (02:01 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Mon, 28 Apr 2025 04:52:53 +0000 (01:52 -0300)
... before using the g packet.

gdb/regcache.c
gdb/regcache.h
gdb/remote.c

index eff4267fda8b63a124e59dbd3e1bb41b0e49ff2f..120de8fd790b61e8460315c6a455e9ff90da2c80 100644 (file)
@@ -1408,6 +1408,15 @@ readable_regcache::update_tdesc_parameter (unsigned int param_id)
 
 /* See regcache.h.  */
 
+void
+readable_regcache::update_tdesc_parameters ()
+{
+  for (unsigned int i = 0; i < m_tdesc_parameter_status.size (); i++)
+    update_tdesc_parameter (i);
+}
+
+/* See regcache.h.  */
+
 register_status
 readable_regcache::tdesc_parameter_value (unsigned int param_id,
                                          gdb::array_view<gdb_byte> dst)
index 7fa40e06e3c906966d53735b7e3c4cb00ee86069..8fc82d1913bc64d71b88f1e003875a5d69669ba8 100644 (file)
@@ -405,6 +405,9 @@ public:
   /* FIXME: Document.  */
   void update_tdesc_parameter (unsigned int param_id);
 
+  /* FIXME: Document.  */
+  void update_tdesc_parameters ();
+
   /* FIXME: Document.  */
   register_status tdesc_parameter_value (unsigned int param_id,
                                         gdb::array_view<gdb_byte> dst);
index f51f9cf6985597bd6b353628eb01b1a47ad9defa..8c6e8085941efd966e9ebda91d6afda630cfb192 100644 (file)
@@ -8608,8 +8608,14 @@ remote_target::supply_expedited_registers (regcache *regcache,
     }
 
   if (regcache->has_variable_size_registers ())
-    rs->get_remote_arch_state (regcache->arch ())
-      ->update_packet_size (regcache, rs);
+    {
+      /* Presumably, the expedited registers allow recalculating the target
+        description parameters.  */
+      regcache->update_tdesc_parameters ();
+
+      rs->get_remote_arch_state (regcache->arch ())
+       ->update_packet_size (regcache, rs);
+    }
 }
 
 /* Called when it is decided that STOP_REPLY holds the info of the
@@ -9161,6 +9167,15 @@ remote_target::process_g_packet (struct regcache *regcache)
 void
 remote_target::fetch_registers_using_g (struct regcache *regcache)
 {
+  if (regcache->has_variable_size_registers ())
+    {
+      regcache->update_tdesc_parameters ();
+
+      remote_state *rs = get_remote_state ();
+      remote_arch_state *rsa = rs->get_remote_arch_state (regcache->arch ());
+      rsa->update_packet_size (regcache, rs);
+    }
+
   send_g_packet ();
   process_g_packet (regcache);
 }