This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Tweak sparc_fetch_instruction


This now deals gracefully with the case where we can't read from
memory.  Needed for some upcoming changes.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* sparc-tdep.c (sparc_fetch_instruction): Return zero if we can't
	read the instruction at PC.

Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.142
diff -u -p -r1.142 sparc-tdep.c
--- sparc-tdep.c 17 Jan 2004 22:45:44 -0000 1.142
+++ sparc-tdep.c 24 Jan 2004 21:33:17 -0000
@@ -96,7 +96,9 @@ sparc_fetch_instruction (CORE_ADDR pc)
   unsigned long insn;
   int i;
 
-  read_memory (pc, buf, sizeof (buf));
+  /* If we can't read the instruction at PC, return zero.  */
+  if (target_read_memory (pc, buf, sizeof (buf)))
+    return 0;
 
   insn = 0;
   for (i = 0; i < sizeof (buf); i++)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]