aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMaxim Grigoriev <maxim2405@gmail.com>2009-10-21 18:51:42 +0000
committerMaxim Grigoriev <maxim2405@gmail.com>2009-10-21 18:51:42 +0000
commitd470961845fa6721714d8b9cf9027fb3a3a97e29 (patch)
tree6df68ffee3bfdd4ff242e2fbd112fae8074ac189 /gdb
parent56ee5e00a8dd7d6821958b9e0c8e84e405e362ff (diff)
downloadgdb-d470961845fa6721714d8b9cf9027fb3a3a97e29.zip
gdb-d470961845fa6721714d8b9cf9027fb3a3a97e29.tar.gz
gdb-d470961845fa6721714d8b9cf9027fb3a3a97e29.tar.bz2
2009-10-21 Maxim Grigoriev <maxim2405@gmail.com>
* xtensa-tdep.c (XTENSA_ISA_BADPC): New. (xtensa_scan_prologue): Replace read_memory with target_read_memory. (call0_analyze_prologue): Use XTENSA_ISA_BADPC instead of "0". (call0_frame_cache): Check error conditions on call0_analyze_prologue.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/xtensa-tdep.c14
2 files changed, 18 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b722779..12741a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-21 Maxim Grigoriev <maxim2405@gmail.com>
+
+ * xtensa-tdep.c (XTENSA_ISA_BADPC): New.
+ (xtensa_scan_prologue): Replace read_memory with target_read_memory.
+ (call0_analyze_prologue): Use XTENSA_ISA_BADPC instead of "0".
+ (call0_frame_cache): Check error conditions on call0_analyze_prologue.
+
2009-10-21 Paul Pluzhnikov <ppluzhnikov@google.com>
* defs.h (pc_prefix): New prototype.
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index ed85361..709f696 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1046,7 +1046,8 @@ xtensa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
/* Returns the best guess about which register is a frame pointer
for the function containing CURRENT_PC. */
-#define XTENSA_ISA_BSZ 32 /* Instruction buffer size. */
+#define XTENSA_ISA_BSZ 32 /* Instruction buffer size. */
+#define XTENSA_ISA_BADPC ((CORE_ADDR)0) /* Bad PC value. */
static unsigned int
xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
@@ -1083,7 +1084,8 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < current_pc
? ba + XTENSA_ISA_BSZ : current_pc;
- read_memory (ba, ibuf, bt - ba);
+ if (target_read_memory (ba, ibuf, bt - ba) != 0)
+ RETURN_FP;
}
xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
@@ -2171,6 +2173,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < body_pc ? ba + XTENSA_ISA_BSZ : body_pc;
read_memory (ba, ibuf, bt - ba);
+ /* If there is a memory reading error read_memory () will report it
+ and then throw an exception, stopping command execution. */
}
/* Decode format information. */
@@ -2290,7 +2294,7 @@ done:
(unsigned)ia, fail ? "failed" : "succeeded");
xtensa_insnbuf_free(isa, slot);
xtensa_insnbuf_free(isa, ins);
- return fail ? 0 : ia;
+ return fail ? XTENSA_ISA_BADPC : ia;
}
/* Initialize frame cache for the current frame in CALL0 ABI. */
@@ -2315,6 +2319,10 @@ call0_frame_cache (struct frame_info *this_frame,
C0_NREGS,
&cache->c0.c0_rt[0],
&cache->call0);
+
+ if (body_pc == XTENSA_ISA_BADPC)
+ error (_("Xtensa-specific internal error: CALL0 prologue \
+analysis failed in this frame. GDB command execution stopped."));
}
sp = get_frame_register_unsigned