*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / xtensa-tdep.c
index 966a739ea4d7112342df7feb68a2082e6194cd1f..709f696f785c3f332372001557a46fbebecce27e 100644 (file)
@@ -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);
@@ -2125,7 +2127,7 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
      Assume we may be in the prologue until we hit a flow control instr.  */
 
   rtmp = NULL;
-  body_pc = INT_MAX;
+  body_pc = UINT_MAX;
   end_pc = 0;
 
   /* Find out, if we have an information about the prologue from DWARF.  */
@@ -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
@@ -2498,7 +2506,7 @@ xtensa_verify_config (struct gdbarch *gdbarch)
   struct ui_file *log;
   struct cleanup *cleanups;
   struct gdbarch_tdep *tdep;
-  long dummy;
+  long length;
   char *buf;
 
   tdep = gdbarch_tdep (gdbarch);
@@ -2531,9 +2539,9 @@ xtensa_verify_config (struct gdbarch *gdbarch)
   if (tdep->a0_base == -1)
     fprintf_unfiltered (log, _("\n\ta0_base: No Ax registers"));
 
-  buf = ui_file_xstrdup (log, &dummy);
+  buf = ui_file_xstrdup (log, &length);
   make_cleanup (xfree, buf);
-  if (strlen (buf) > 0)
+  if (length > 0)
     internal_error (__FILE__, __LINE__,
                    _("the following are invalid: %s"), buf);
   do_cleanups (cleanups);
This page took 0.024801 seconds and 4 git commands to generate.