diff options
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index 1667882..d3094ca 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -104,8 +104,6 @@ static void val_print_type_code_flags (struct type *type, const gdb_byte *valaddr, struct ui_file *stream); -void _initialize_valprint (void); - #define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */ struct value_print_options user_print_options = @@ -1490,9 +1488,6 @@ void print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order, bool zero_pad) { - -#define BITS_IN_BYTES 8 - const gdb_byte *p; unsigned int i; int b; @@ -1512,7 +1507,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, /* Every byte has 8 binary characters; peel off and print from the MSB end. */ - for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++) + for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++) { if (*p & (mask >> i)) b = '1'; @@ -1532,7 +1527,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, p >= valaddr; p--) { - for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++) + for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++) { if (*p & (mask >> i)) b = '1'; @@ -1593,20 +1588,26 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr, */ #define BITS_IN_OCTAL 3 #define HIGH_ZERO 0340 -#define LOW_ZERO 0016 +#define LOW_ZERO 0034 #define CARRY_ZERO 0003 + static_assert (HIGH_ZERO + LOW_ZERO + CARRY_ZERO == 0xff, + "cycle zero constants are wrong"); #define HIGH_ONE 0200 #define MID_ONE 0160 #define LOW_ONE 0016 #define CARRY_ONE 0001 + static_assert (HIGH_ONE + MID_ONE + LOW_ONE + CARRY_ONE == 0xff, + "cycle one constants are wrong"); #define HIGH_TWO 0300 #define MID_TWO 0070 #define LOW_TWO 0007 + static_assert (HIGH_TWO + MID_TWO + LOW_TWO == 0xff, + "cycle two constants are wrong"); /* For 32 we start in cycle 2, with two bits and one bit carry; for 64 in cycle in cycle 1, with one bit and a two bit carry. */ - cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL; + cycle = (len * HOST_CHAR_BIT) % BITS_IN_OCTAL; carry = 0; fputs_filtered ("0", stream); @@ -2985,13 +2986,10 @@ val_print_string (struct type *elttype, const char *encoding, if (err != 0) { - char *str; - - str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr); - make_cleanup (xfree, str); + std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr); fprintf_filtered (stream, "<error: "); - fputs_filtered (str, stream); + fputs_filtered (str.c_str (), stream); fprintf_filtered (stream, ">"); } |