diff options
author | Stu Grossman <grossman@cygnus> | 1998-10-05 19:42:04 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1998-10-05 19:42:04 +0000 |
commit | 242c0d81808102504721ac1289dccec5dce660f9 (patch) | |
tree | a0d74af308640017ea9e48e4a98be116f50bac55 /gdb/printcmd.c | |
parent | ecd41d25b901d3fdee37e8215c288892b4c8c3d5 (diff) | |
download | gdb-242c0d81808102504721ac1289dccec5dce660f9.zip gdb-242c0d81808102504721ac1289dccec5dce660f9.tar.gz gdb-242c0d81808102504721ac1289dccec5dce660f9.tar.bz2 |
* c-lang.c (emit_char c_printchar c_printstr), c-lang.h (c_printstr)
ch-lang.c (chill_printstr chill_printchar) c-valprint.c (c_val_print)
ch-valprint.c (chill_val_print) expprint.c (print_subexp) f-lang.c
(f_printstr f_printchar emit_char) f-valprint.c (f_val_print) jv-lang.c
(java_printchar java_emit_char) jv-valprint.c (java_value_print
java_val_print) language.c (unk_lang_printchar unk_lang_printstr
unk_lang_emit_char) language.h (struct language_defn LA_PRINT_STRING
LA_EMIT_CHAR) m2-lang.c (m2_printstr m2_printchar emit_char) printcmd.c
(print_formatted) scm-lang.c (scm_printstr) valprint.c
(val_print_string) value.h (val_print_string): Add emit_char routines
to language_desc struct to allow finer control over language specific
character output issues. Add character width arg to printstr routines
to allow handling of wchar_t/Unicode strings. Fix c_printstr to handle
wide characters. Supply width argument to LA_PRINT_STRING and
val_print_string.
* jv-lang.c (java_object_type dynamics_objfile java_link_class_type
get_dynamics_objfile get_java_object_type) jv-lang.h
(get_java_object_type): Make lots of things static.
* expprint.c (dump_prefix_expression dump_subexp): Move opcode name
printing to common routine (op_name).
* (dump_subexp): Add support for OP_SCOPE.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index ad1ad37..7d0f3a5 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -293,8 +293,9 @@ print_formatted (val, format, size) switch (format) { case 's': + /* FIXME: Need to handle wchar_t's here... */ next_address = VALUE_ADDRESS (val) - + val_print_string (VALUE_ADDRESS (val), 0, gdb_stdout); + + val_print_string (VALUE_ADDRESS (val), -1, 1, gdb_stdout); next_section = VALUE_BFD_SECTION (val); break; @@ -688,6 +689,8 @@ print_address_demangle (addr, stream, do_demangle) /* These are the types that $__ will get after an examine command of one of these sizes. */ +static struct type *examine_i_type; + static struct type *examine_b_type; static struct type *examine_h_type; static struct type *examine_w_type; @@ -720,7 +723,9 @@ do_examine (fmt, addr, sect) if (format == 's' || format == 'i') size = 'b'; - if (size == 'b') + if (format == 'i') + val_type = examine_i_type; + else if (size == 'b') val_type = examine_b_type; else if (size == 'h') val_type = examine_h_type; @@ -753,7 +758,16 @@ do_examine (fmt, addr, sect) /* Note that print_formatted sets next_address for the next object. */ last_examine_address = next_address; - last_examine_value = value_at (val_type, next_address, sect); + /* The value to be displayed is not fetched greedily. + Instead, to avoid the posibility of a fetched value not + being used, its retreval is delayed until the print code + uses it. When examining an instruction stream, the + disassembler will perform its own memory fetch using just + the address stored in LAST_EXAMINE_VALUE. FIXME: Should + the disassembler be modified so that LAST_EXAMINE_VALUE + is left with the byte sequence from the last complete + instruction fetched from memory? */ + last_examine_value = value_at_lazy (val_type, next_address, sect); print_formatted (last_examine_value, format, size); } printf_filtered ("\n"); @@ -1261,7 +1275,13 @@ x_command (exp, from_tty) (LONGEST) last_examine_address)); /* Make contents of last address examined available to the user as $__.*/ - set_internalvar (lookup_internalvar ("__"), last_examine_value); + /* If the last value has not been fetched from memory then don't + fetch it now - instead mark it by voiding the $__ variable. */ + if (VALUE_LAZY (last_examine_value)) + set_internalvar (lookup_internalvar ("__"), + allocate_value (builtin_type_void)); + else + set_internalvar (lookup_internalvar ("__"), last_examine_value); } } @@ -2190,7 +2210,6 @@ disassemble_command (arg, from_tty) if (find_pc_partial_function (pc, &name, &low, &high) == 0) error ("No function contains program counter for selected frame.\n"); low += FUNCTION_START_OFFSET; - high -= 1; } else if (!(space_index = (char *) strchr (arg, ' '))) { @@ -2199,20 +2218,6 @@ disassemble_command (arg, from_tty) if (find_pc_partial_function (pc, &name, &low, &high) == 0) error ("No function contains specified address.\n"); low += FUNCTION_START_OFFSET; - high -= 1; - if (overlay_debugging) - { - section = find_pc_overlay (pc); - if (pc_in_unmapped_range (pc, section)) - { - /* find_pc_partial_function will have returned low and high - relative to the symbolic (mapped) address range. Need to - translate them back to the unmapped range where PC is. */ - - low = overlay_unmapped_address (low, section); - high = overlay_unmapped_address (high, section); - } - } } else { @@ -2220,7 +2225,6 @@ disassemble_command (arg, from_tty) *space_index = '\0'; low = parse_and_eval_address (arg); high = parse_and_eval_address (space_index + 1); - high -= 1; } printf_filtered ("Dump of assembler code "); @@ -2246,7 +2250,7 @@ disassemble_command (arg, from_tty) pc_masked = pc; #endif - while (pc_masked <= high) + while (pc_masked < high) { QUIT; print_address (pc_masked, gdb_stdout); @@ -2442,6 +2446,11 @@ environment, the value is printed in its own window."); &setprintlist), &showprintlist); + /* For examine/instruction a single byte quantity is specified as + the data. This avoids problems with value_at_lazy() requiring a + valid data type (and rejecting VOID). */ + examine_i_type = init_type (TYPE_CODE_INT, 1, 0, "examine_i_type", NULL); + examine_b_type = init_type (TYPE_CODE_INT, 1, 0, "examine_b_type", NULL); examine_h_type = init_type (TYPE_CODE_INT, 2, 0, "examine_h_type", NULL); examine_w_type = init_type (TYPE_CODE_INT, 4, 0, "examine_w_type", NULL); |