Introduce metadata style
[deliverable/binutils-gdb.git] / gdb / value.c
index 1b22cf916e3c921bb33e7afcba016626621de1af..67fe2f17c051a95a0cab640446a011fabba6c540 100644 (file)
@@ -41,8 +41,9 @@
 #include "user-regs.h"
 #include <algorithm>
 #include "completer.h"
-#include "common/selftest.h"
-#include "common/array-view.h"
+#include "gdbsupport/selftest.h"
+#include "gdbsupport/array-view.h"
+#include "cli/cli-style.h"
 
 /* Definition of a user function.  */
 struct internal_function
@@ -2539,7 +2540,8 @@ show_convenience (const char *ignore, int from_tty)
        }
       catch (const gdb_exception_error &ex)
        {
-         fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.what ());
+         fprintf_styled (gdb_stdout, metadata_style.style (),
+                         _("<error: %s>"), ex.what ());
        }
 
       printf_filtered (("\n"));
@@ -2751,10 +2753,16 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
     case TYPE_CODE_CHAR:
     case TYPE_CODE_RANGE:
     case TYPE_CODE_MEMBERPTR:
-      if (nosign)
-       return extract_unsigned_integer (valaddr, len, byte_order);
-      else
-       return extract_signed_integer (valaddr, len, byte_order);
+      {
+       LONGEST result;
+       if (nosign)
+         result = extract_unsigned_integer (valaddr, len, byte_order);
+       else
+         result = extract_signed_integer (valaddr, len, byte_order);
+       if (code == TYPE_CODE_RANGE)
+         result += TYPE_RANGE_DATA (type)->bias;
+       return result;
+      }
 
     case TYPE_CODE_FLT:
     case TYPE_CODE_DECFLOAT:
@@ -3315,12 +3323,14 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
 
   switch (TYPE_CODE (type))
     {
+    case TYPE_CODE_RANGE:
+      num -= TYPE_RANGE_DATA (type)->bias;
+      /* Fall through.  */
     case TYPE_CODE_INT:
     case TYPE_CODE_CHAR:
     case TYPE_CODE_ENUM:
     case TYPE_CODE_FLAGS:
     case TYPE_CODE_BOOL:
-    case TYPE_CODE_RANGE:
     case TYPE_CODE_MEMBERPTR:
       store_signed_integer (buf, len, byte_order, num);
       break;
This page took 0.024416 seconds and 4 git commands to generate.