From 59fd18d5155ffe8924ed24283def8ef434067909 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 35/38] Fix debug message when register is unavailable

Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>

Conflicts:
	gdb/frame.c
---
 gdb/frame.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/frame.c b/gdb/frame.c
index 3f2d2700541..d557a093f63 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1261,12 +1261,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 (&debug_file, " bytes=");
 	      fprintf_unfiltered (&debug_file, "[");
+	      if (buf != NULL) {
 	      for (i = 0; i < register_size (gdbarch, regnum); i++)
 		fprintf_unfiltered (&debug_file, "%02x", buf[i]);
+	      } else {
+	        fprintf_unfiltered (&debug_file, "unavailable");
+	      }
 	      fprintf_unfiltered (&debug_file, "]");
 	    }
 	}
-- 
2.17.1

