/* Print values for GNU debugger GDB.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
supported at this level. */
void
-print_scalar_formatted (const void *valaddr, struct type *type,
+print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
const struct value_print_options *options,
int size, struct ui_file *stream)
{
/* String printing should go through val_print_scalar_formatted. */
gdb_assert (options->format != 's');
- if (len > sizeof(LONGEST) &&
- (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM))
+ if (len > sizeof(LONGEST)
+ && (TYPE_CODE (type) == TYPE_CODE_INT
+ || TYPE_CODE (type) == TYPE_CODE_ENUM))
{
switch (options->format)
{
error (_("Argument required."));
sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
- &is_a_field_of_this);
+ &is_a_field_of_this).symbol;
if (sym == NULL)
{
if (is_a_field_of_this.type != NULL)
else
{
section = MSYMBOL_OBJ_SECTION (msym.objfile, msym.minsym);
- load_addr = BMSYMBOL_VALUE_ADDRESS (msym);
if (section
&& (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
- printf_filtered (_("a thread-local variable at offset %s "
- "in the thread-local storage for `%s'"),
- paddress (gdbarch, load_addr),
- objfile_name (section->objfile));
+ {
+ load_addr = MSYMBOL_VALUE_RAW_ADDRESS (msym.minsym);
+ printf_filtered (_("a thread-local variable at offset %s "
+ "in the thread-local storage for `%s'"),
+ paddress (gdbarch, load_addr),
+ objfile_name (section->objfile));
+ }
else
{
+ load_addr = BMSYMBOL_VALUE_ADDRESS (msym);
printf_filtered (_("static storage at address "));
fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
if (section_is_overlay (section))
struct format_data fmt;
struct expression *expr;
struct display *newobj;
- int display_it = 1;
const char *exp = arg;
-#if defined(TUI)
- /* NOTE: cagney/2003-02-13 The `tui_active' was previously
- `tui_version'. */
- if (tui_active && exp != NULL && *exp == '$')
- display_it = (tui_set_layout_for_display_command (exp) == TUI_FAILURE);
-#endif
-
- if (display_it)
+ if (exp == 0)
{
- if (exp == 0)
- {
- do_displays ();
- return;
- }
+ do_displays ();
+ return;
+ }
- if (*exp == '/')
- {
- exp++;
- fmt = decode_format (&exp, 0, 0);
- if (fmt.size && fmt.format == 0)
- fmt.format = 'x';
- if (fmt.format == 'i' || fmt.format == 's')
- fmt.size = 'b';
- }
- else
- {
- fmt.format = 0;
- fmt.size = 0;
- fmt.count = 0;
- fmt.raw = 0;
- }
+ if (*exp == '/')
+ {
+ exp++;
+ fmt = decode_format (&exp, 0, 0);
+ if (fmt.size && fmt.format == 0)
+ fmt.format = 'x';
+ if (fmt.format == 'i' || fmt.format == 's')
+ fmt.size = 'b';
+ }
+ else
+ {
+ fmt.format = 0;
+ fmt.size = 0;
+ fmt.count = 0;
+ fmt.raw = 0;
+ }
- innermost_block = NULL;
- expr = parse_expression (exp);
+ innermost_block = NULL;
+ expr = parse_expression (exp);
- newobj = (struct display *) xmalloc (sizeof (struct display));
+ newobj = XNEW (struct display);
- newobj->exp_string = xstrdup (exp);
- newobj->exp = expr;
- newobj->block = innermost_block;
- newobj->pspace = current_program_space;
- newobj->next = display_chain;
- newobj->number = ++display_number;
- newobj->format = fmt;
- newobj->enabled_p = 1;
- display_chain = newobj;
+ newobj->exp_string = xstrdup (exp);
+ newobj->exp = expr;
+ newobj->block = innermost_block;
+ newobj->pspace = current_program_space;
+ newobj->number = ++display_number;
+ newobj->format = fmt;
+ newobj->enabled_p = 1;
+ newobj->next = NULL;
- if (from_tty)
- do_one_display (newobj);
+ if (display_chain == NULL)
+ display_chain = newobj;
+ else
+ {
+ struct display *last;
- dont_repeat ();
+ for (last = display_chain; last->next != NULL; last = last->next)
+ ;
+ last->next = newobj;
}
+
+ if (from_tty)
+ do_one_display (newobj);
+
+ dont_repeat ();
}
static void
struct value *val;
struct value_print_options opts;
- val = read_var_value (var, frame);
+ /* READ_VAR_VALUE needs a block in order to deal with non-local
+ references (i.e. to handle nested functions). In this context, we
+ print variables that are local to this frame, so we can avoid passing
+ a block to it. */
+ val = read_var_value (var, NULL, frame);
get_user_print_options (&opts);
opts.deref_ref = 1;
common_val_print (val, stream, indent, &opts, current_language);
struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype);
- gdb_byte *buf = alloca (wcwidth);
+ gdb_byte *buf = (gdb_byte *) alloca (wcwidth);
struct obstack output;
struct cleanup *inner_cleanup;
long val = value_as_long (value);
#endif
- fmt = alloca (strlen (format) + 5);
+ fmt = (char *) alloca (strlen (format) + 5);
/* Copy up to the leading %. */
p = format;
int allocated_args = 20;
struct cleanup *old_cleanups;
- val_args = xmalloc (allocated_args * sizeof (struct value *));
+ val_args = XNEWVEC (struct value *, allocated_args);
old_cleanups = make_cleanup (free_current_contents, &val_args);
if (s == 0)