summaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 5068cc96c48..7ad2dd0e648 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -537,8 +537,8 @@ set_next_address (addr)
/* Make address available to the user as $_. */
set_internalvar (lookup_internalvar ("_"),
- value_from_longest (lookup_pointer_type (builtin_type_void),
- (LONGEST) addr));
+ value_from_pointer (lookup_pointer_type (builtin_type_void),
+ addr));
}
/* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,
@@ -562,12 +562,15 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
int offset = 0;
int line = 0;
- struct cleanup *cleanup_chain = make_cleanup (free, name);
- if (print_symbol_filename)
- make_cleanup (free, filename);
+ /* throw away both name and filename */
+ struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &name);
+ make_cleanup (free_current_contents, &filename);
if (build_address_symbolic (addr, do_demangle, &name, &offset, &filename, &line, &unmapped))
- return;
+ {
+ do_cleanups (cleanup_chain);
+ return;
+ }
fputs_filtered (leadin, stream);
if (unmapped)
@@ -932,8 +935,7 @@ print_command_1 (exp, inspect, voidprint)
{
struct type *type;
expr = parse_expression (exp);
- old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
- &expr);
+ old_chain = make_cleanup (free_current_contents, &expr);
cleanup = 1;
val = evaluate_expression (expr);
@@ -1046,7 +1048,7 @@ output_command (exp, from_tty)
}
expr = parse_expression (exp);
- old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+ old_chain = make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
@@ -1069,8 +1071,8 @@ set_command (exp, from_tty)
int from_tty;
{
struct expression *expr = parse_expression (exp);
- register struct cleanup *old_chain
- = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+ register struct cleanup *old_chain =
+ make_cleanup (free_current_contents, &expr);
evaluate_expression (expr);
do_cleanups (old_chain);
}
@@ -1367,8 +1369,7 @@ x_command (exp, from_tty)
But don't clobber a user-defined command's definition. */
if (from_tty)
*exp = 0;
- old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
- &expr);
+ old_chain = make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
val = value_ind (val);
@@ -1396,10 +1397,11 @@ x_command (exp, from_tty)
{
/* Make last address examined available to the user as $_. Use
the correct pointer type. */
+ struct type *pointer_type
+ = lookup_pointer_type (VALUE_TYPE (last_examine_value));
set_internalvar (lookup_internalvar ("_"),
- value_from_longest (
- lookup_pointer_type (VALUE_TYPE (last_examine_value)),
- (LONGEST) last_examine_address));
+ value_from_pointer (pointer_type,
+ last_examine_address));
/* Make contents of last address examined available to the user as $__. */
/* If the last value has not been fetched from memory then don't
@@ -1850,7 +1852,7 @@ print_frame_args (func, fi, num, stream)
struct ui_stream *stb;
stb = ui_out_stream_new (uiout);
- old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+ old_chain = make_cleanup_ui_out_stream_delete (stb);
#endif /* UI_OUT */
if (func)
@@ -1877,8 +1879,8 @@ print_frame_args (func, fi, num, stream)
/* Compute address of next argument by adding the size of
this argument and rounding to an int boundary. */
- current_offset
- = ((current_offset + arg_size + sizeof (int) - 1)
+ current_offset =
+ ((current_offset + arg_size + sizeof (int) - 1)
& ~(sizeof (int) - 1));
/* If this is the highest offset seen yet, set highest_offset. */
@@ -2106,8 +2108,7 @@ printf_command (arg, from_tty)
struct cleanup *old_cleanups;
val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
- old_cleanups = make_cleanup ((make_cleanup_func) free_current_contents,
- &val_args);
+ old_cleanups = make_cleanup (free_current_contents, &val_args);
if (s == 0)
error_no_arg ("format-control string and values to print");
@@ -2318,15 +2319,14 @@ printf_command (arg, from_tty)
{
char c;
QUIT;
- read_memory_section (tem + j, &c, 1,
- VALUE_BFD_SECTION (val_args[i]));
+ read_memory (tem + j, &c, 1);
if (c == 0)
break;
}
/* Copy the string contents into a string inside GDB. */
str = (char *) alloca (j + 1);
- read_memory_section (tem, str, j, VALUE_BFD_SECTION (val_args[i]));
+ read_memory (tem, str, j);
str[j] = 0;
printf_filtered (current_substring, str);