summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/gdb/files/0005-Fix-debug-message-when-register-is-unavailable.patch
blob: 67520f4c7aab2cfca33c8b54318d4f1626cfe082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Nathan Rossi <nathan.rossi@petalogix.com>
Date: Tue, 8 May 2012 18:11:17 +1000
Subject: Fix debug message when register is unavailable

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

diff --git a/gdb/frame.c b/gdb/frame.c
index 4b8ab60..7ad7cb3 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -979,12 +979,19 @@ frame_unwind_register_value (struct frame_info *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, "]");
 	    }
 	}
-- 
1.7.9.5