Don't call gdbarch_pseudo_register_read_value in jit.c
authorYao Qi <yao.qi@linaro.org>
Mon, 22 Jan 2018 11:02:48 +0000 (11:02 +0000)
committerYao Qi <yao.qi@linaro.org>
Mon, 22 Jan 2018 11:02:48 +0000 (11:02 +0000)
gdbarch_pseudo_register_read_value is not implemented in every gdbarch, so
the predicate gdbarch_pseudo_register_read_value_p is needed before
calling it.  However, there is no such guard in jit_frame_prev_register, I
am wondering how does jit work on the arch without having gdbarch method
pseudo_register_read_value.

The proper way to get register value is to call cooked_read, and then
create the value object from the buffer.

gdb:

2018-01-22  Yao Qi  <yao.qi@linaro.org>

* jit.c (jit_frame_prev_register): Call regcache::cooked_read
instead of gdbarch_pseudo_register_read_value.

gdb/ChangeLog
gdb/jit.c

index 6a5572faef8890bb58cacc40d2b6c629fc556658..61c65997bf1f30829a1c4e7b6a7df46cabac9d5e 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-22  Yao Qi  <yao.qi@linaro.org>
+
+       * jit.c (jit_frame_prev_register): Call regcache::cooked_read
+       instead of gdbarch_pseudo_register_read_value.
+
 2018-01-22  Joel Brobecker  <brobecker@adacore.com>
 
        * dwarf2read.c (need_gnat_info): Return nonzero if the cu's
index a972ed61d5af75ed5f3d64bdb62afbfca40d6a57..01ead4577f43942b468586e18cd3f7496ff953d7 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1271,19 +1271,13 @@ jit_frame_prev_register (struct frame_info *this_frame, void **cache, int reg)
     return frame_unwind_got_optimized (this_frame, reg);
 
   gdbarch = priv->regcache->arch ();
-  if (reg < gdbarch_num_regs (gdbarch))
-    {
-      gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, reg));
-      enum register_status status;
+  gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, reg));
+  enum register_status status = priv->regcache->cooked_read (reg, buf);
 
-      status = regcache_raw_read (priv->regcache, reg, buf);
-      if (status == REG_VALID)
-       return frame_unwind_got_bytes (this_frame, reg, buf);
-      else
-       return frame_unwind_got_optimized (this_frame, reg);
-    }
+  if (status == REG_VALID)
+    return frame_unwind_got_bytes (this_frame, reg, buf);
   else
-    return gdbarch_pseudo_register_read_value (gdbarch, priv->regcache, reg);
+    return frame_unwind_got_optimized (this_frame, reg);
 }
 
 /* Relay everything back to the unwinder registered by the JIT debug
This page took 0.027324 seconds and 4 git commands to generate.