This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 02/15] Don't call gdbarch_pseudo_register_read_value in jit.c
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 1 Dec 2017 10:47:53 +0000
- Subject: [PATCH 02/15] Don't call gdbarch_pseudo_register_read_value in jit.c
- Authentication-results: sourceware.org; auth=none
- References: <1512125286-29788-1-git-send-email-yao.qi@linaro.org>
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:
2017-11-01 Yao Qi <yao.qi@linaro.org>
* jit.c (jit_frame_prev_register): Call regcache::cooked_read
instead of gdbarch_pseudo_register_read_value.
---
gdb/jit.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/gdb/jit.c b/gdb/jit.c
index 98afdf2..36aaefc 100644
--- 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
--
1.9.1