format, size, stream);
}
+/* Return builtin floating point type of same length as TYPE.
+ If no such type is found, return TYPE itself. */
+static struct type *
+float_type_from_length (struct gdbarch *gdbarch, struct type *type)
+{
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ unsigned int len = TYPE_LENGTH (type);
+
+ if (len == TYPE_LENGTH (builtin->builtin_float))
+ type = builtin->builtin_float;
+ else if (len == TYPE_LENGTH (builtin->builtin_double))
+ type = builtin->builtin_double;
+ else if (len == TYPE_LENGTH (builtin->builtin_long_double))
+ type = builtin->builtin_long_double;
+
+ return type;
+}
+
/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
according to letters FORMAT and SIZE on STREAM.
FORMAT may not be zero. Formats s and i are not supported at this level.
case 'c':
if (TYPE_UNSIGNED (type))
- {
- struct type *utype;
-
- utype = builtin_type (current_gdbarch)->builtin_true_unsigned_char;
- value_print (value_from_longest (utype, val_long),
- stream, 0, Val_pretty_default);
- }
+ value_print (value_from_longest (builtin_type_true_unsigned_char,
+ val_long),
+ stream, 0, Val_pretty_default);
else
value_print (value_from_longest (builtin_type_true_char, val_long),
stream, 0, Val_pretty_default);
break;
case 'f':
- if (len == TYPE_LENGTH (builtin_type_float))
- type = builtin_type_float;
- else if (len == TYPE_LENGTH (builtin_type_double))
- type = builtin_type_double;
- else if (len == TYPE_LENGTH (builtin_type_long_double))
- type = builtin_type_long_double;
+ type = float_type_from_length (current_gdbarch, type);
print_floating (valaddr, type, stream);
break;
The `info lines' command uses this. */
void
-set_next_address (CORE_ADDR addr)
+set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
{
+ struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
+
next_address = addr;
/* Make address available to the user as $_. */
set_internalvar (lookup_internalvar ("_"),
- value_from_pointer (lookup_pointer_type (builtin_type_void),
- addr));
+ value_from_pointer (ptr_type, addr));
}
/* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,
struct minimal_symbol *msymbol;
struct symbol *symbol;
CORE_ADDR name_location = 0;
- asection *section = 0;
+ struct obj_section *section = NULL;
char *name_temp = "";
/* Let's say it is unmapped. */
if (do_demangle || asm_demangle)
name_temp = SYMBOL_PRINT_NAME (symbol);
else
- name_temp = DEPRECATED_SYMBOL_NAME (symbol);
+ name_temp = SYMBOL_LINKAGE_NAME (symbol);
}
if (msymbol != NULL)
if (do_demangle || asm_demangle)
name_temp = SYMBOL_PRINT_NAME (msymbol);
else
- name_temp = DEPRECATED_SYMBOL_NAME (msymbol);
+ name_temp = SYMBOL_LINKAGE_NAME (msymbol);
}
}
if (symbol == NULL && msymbol == NULL)
struct minimal_symbol *msymbol;
struct objfile *objfile;
struct obj_section *osect;
- asection *sect;
CORE_ADDR addr, sect_addr;
int matches = 0;
unsigned int offset;
if (objfile->separate_debug_objfile_backlink)
continue;
- sect = osect->the_bfd_section;
- sect_addr = overlay_mapped_address (addr, sect);
+ sect_addr = overlay_mapped_address (addr, osect);
- if (osect->addr <= sect_addr && sect_addr < osect->endaddr &&
- (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
+ if (obj_section_addr (osect) <= sect_addr
+ && sect_addr < obj_section_endaddr (osect)
+ && (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, osect)))
{
matches = 1;
offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
else
printf_filtered ("%s in ",
SYMBOL_PRINT_NAME (msymbol));
- if (pc_in_unmapped_range (addr, sect))
+ if (pc_in_unmapped_range (addr, osect))
printf_filtered (_("load address range of "));
- if (section_is_overlay (sect))
+ if (section_is_overlay (osect))
printf_filtered (_("%s overlay "),
- section_is_mapped (sect) ? "mapped" : "unmapped");
- printf_filtered (_("section %s"), sect->name);
+ section_is_mapped (osect) ? "mapped" : "unmapped");
+ printf_filtered (_("section %s"), osect->the_bfd_section->name);
printf_filtered ("\n");
}
}
struct symbol *sym;
struct minimal_symbol *msymbol;
long val;
- asection *section;
+ struct obj_section *section;
CORE_ADDR load_addr;
int is_a_field_of_this; /* C++: lookup_symbol sets this to nonzero
if exp is a field of `this'. */
printf_filtered ("\" is at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (" in a file compiled without debugging");
- section = SYMBOL_BFD_SECTION (msymbol);
+ section = SYMBOL_OBJ_SECTION (msymbol);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
- printf_filtered (" in overlay section %s", section->name);
+ printf_filtered (" in overlay section %s",
+ section->the_bfd_section->name);
}
printf_filtered (".\n");
}
}
printf_filtered ("Symbol \"");
- fprintf_symbol_filtered (gdb_stdout, DEPRECATED_SYMBOL_NAME (sym),
+ fprintf_symbol_filtered (gdb_stdout, SYMBOL_PRINT_NAME (sym),
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is ");
val = SYMBOL_VALUE (sym);
- section = SYMBOL_BFD_SECTION (sym);
+ section = SYMBOL_OBJ_SECTION (sym);
switch (SYMBOL_CLASS (sym))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
- printf_filtered (" in overlay section %s", section->name);
+ printf_filtered (" in overlay section %s",
+ section->the_bfd_section->name);
}
break;
case LOC_COMPUTED:
- case LOC_COMPUTED_ARG:
/* FIXME: cagney/2004-01-26: It should be possible to
unconditionally call the SYMBOL_OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
break;
case LOC_REGISTER:
- printf_filtered (_("a variable in register %s"),
+ if (SYMBOL_IS_ARGUMENT (sym))
+ printf_filtered (_("an argument in register %s"),
+ gdbarch_register_name (current_gdbarch, val));
+ else
+ printf_filtered (_("a variable in register %s"),
gdbarch_register_name (current_gdbarch, val));
break;
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
- printf_filtered (_(" in overlay section %s"), section->name);
+ printf_filtered (_(" in overlay section %s"),
+ section->the_bfd_section->name);
}
break;
- case LOC_REGPARM:
- printf_filtered (_("an argument in register %s"),
- gdbarch_register_name (current_gdbarch, val));
- break;
-
case LOC_REGPARM_ADDR:
printf_filtered (_("address of an argument in register %s"),
gdbarch_register_name (current_gdbarch, val));
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
- printf_filtered (_(" in overlay section %s"), section->name);
+ printf_filtered (_(" in overlay section %s"),
+ section->the_bfd_section->name);
}
break;
{
struct minimal_symbol *msym;
- msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, NULL);
+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL);
if (msym == NULL)
printf_filtered ("unresolved");
else
{
- section = SYMBOL_BFD_SECTION (msym);
+ section = SYMBOL_OBJ_SECTION (msym);
printf_filtered (_("static storage at address "));
load_addr = SYMBOL_VALUE_ADDRESS (msym);
fputs_filtered (paddress (load_addr), gdb_stdout);
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
- printf_filtered (_(" in overlay section %s"), section->name);
+ printf_filtered (_(" in overlay section %s"),
+ section->the_bfd_section->name);
}
}
}
s1 = s;
val_args[nargs] = parse_to_comma_and_eval (&s1);
- /* If format string wants a float, unchecked-convert the value to
- floating point of the same size */
-
- if (argclass[nargs] == double_arg)
- {
- struct type *type = value_type (val_args[nargs]);
- if (TYPE_LENGTH (type) == sizeof (float))
- deprecated_set_value_type (val_args[nargs], builtin_type_float);
- if (TYPE_LENGTH (type) == sizeof (double))
- deprecated_set_value_type (val_args[nargs], builtin_type_double);
- }
nargs++;
s = s1;
if (*s == ',')
break;
case double_arg:
{
- double val = value_as_double (val_args[i]);
- printf_filtered (current_substring, val);
+ struct type *type = value_type (val_args[i]);
+ DOUBLEST val;
+ int inv;
+
+ /* If format string wants a float, unchecked-convert the value
+ to floating point of the same size. */
+ type = float_type_from_length (current_gdbarch, type);
+ val = unpack_double (type, value_contents (val_args[i]), &inv);
+ if (inv)
+ error (_("Invalid floating value found in program."));
+
+ printf_filtered (current_substring, (double) val);
break;
}
case long_double_arg:
#ifdef HAVE_LONG_DOUBLE
{
- long double val = value_as_double (val_args[i]);
- printf_filtered (current_substring, val);
+ struct type *type = value_type (val_args[i]);
+ DOUBLEST val;
+ int inv;
+
+ /* If format string wants a float, unchecked-convert the value
+ to floating point of the same size. */
+ type = float_type_from_length (current_gdbarch, type);
+ val = unpack_double (type, value_contents (val_args[i]), &inv);
+ if (inv)
+ error (_("Invalid floating value found in program."));
+
+ printf_filtered (current_substring, (long double) val);
break;
}
#else
The argument is the function name and arguments, in the notation of the\n\
current working language. The result is printed and saved in the value\n\
history, if it is not void."));
- set_cmd_completer (c, location_completer);
+ set_cmd_completer (c, expression_completer);
add_cmd ("variable", class_vars, set_command, _("\
Evaluate expression EXP and assign result to variable VAR, using assignment\n\
\n\
EXP may be preceded with /FMT, where FMT is a format letter\n\
but no count or size letter (see \"x\" command)."));
- set_cmd_completer (c, location_completer);
+ set_cmd_completer (c, expression_completer);
add_com_alias ("p", "print", class_vars, 1);
c = add_com ("inspect", class_vars, inspect_command, _("\
Same as \"print\" command, except that if you are running in the epoch\n\
environment, the value is printed in its own window."));
- set_cmd_completer (c, location_completer);
+ set_cmd_completer (c, expression_completer);
add_setshow_uinteger_cmd ("max-symbolic-offset", no_class,
&max_symbolic_offset, _("\