From 80c56ef8463c23f51759f5c64ce0165e259a4071 Mon Sep 17 00:00:00 2001
From: Nathan Rossi <nathan.rossi@petalogix.com>
Date: Tue, 8 May 2012 18:11:17 +1000
Subject: [PATCH 03/10] Fix debug message when register is unavailable

Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
---
 gdb/frame.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdb/frame.c b/gdb/frame.c
index c1eba5848af..fe4a0dc0dd0 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1305,12 +1305,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
 	  else
 	    {
 	      int i;
-	      const gdb_byte *buf = value_contents (value);
+	      const gdb_byte *buf = NULL;
+	      if (value_entirely_available(value)) {
+	        buf = value_contents (value);
+	      }
 
 	      fprintf_unfiltered (gdb_stdlog, " bytes=");
 	      fprintf_unfiltered (gdb_stdlog, "[");
-	      for (i = 0; i < register_size (gdbarch, regnum); i++)
-		fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
+	      if (buf != NULL) {
+	        for (i = 0; i < register_size (gdbarch, regnum); i++)
+		  fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
+	      } else {
+	        fprintf_unfiltered (gdb_stdlog, "unavailable");
+	      }
 	      fprintf_unfiltered (gdb_stdlog, "]");
 	    }
 	}
-- 
2.17.1

