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.
{
LONGEST val_long = 0;
unsigned int len = TYPE_LENGTH (type);
+ enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch);
/* If we get here with a string format, try again without it. Go
all the way back to the language printers, which may call us
switch (format)
{
case 'o':
- print_octal_chars (stream, valaddr, len);
+ print_octal_chars (stream, valaddr, len, byte_order);
return;
case 'u':
case 'd':
- print_decimal_chars (stream, valaddr, len);
+ print_decimal_chars (stream, valaddr, len, byte_order);
return;
case 't':
- print_binary_chars (stream, valaddr, len);
+ print_binary_chars (stream, valaddr, len, byte_order);
return;
case 'x':
- print_hex_chars (stream, valaddr, len);
+ print_hex_chars (stream, valaddr, len, byte_order);
return;
case 'c':
- print_char_chars (stream, valaddr, len);
+ print_char_chars (stream, valaddr, len, byte_order);
return;
default:
break;
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)
return 0;
}
-/* Print address ADDR on STREAM. USE_LOCAL means the same thing as for
- print_longest. */
-void
-deprecated_print_address_numeric (CORE_ADDR addr, int use_local,
- struct ui_file *stream)
-{
- if (use_local)
- fputs_filtered (paddress (addr), stream);
- else
- {
- int addr_bit = gdbarch_addr_bit (current_gdbarch);
-
- if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
- addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
- print_longest (stream, 'x', 0, (ULONGEST) addr);
- }
-}
/* Print address ADDR symbolically on STREAM.
First print it as a number. Then perhaps print
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;
- long basereg;
- 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);
- basereg = SYMBOL_BASEREG (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);
- }
- break;
-
- case LOC_INDIRECT:
- printf_filtered (_("external global (indirect addressing), at address *("));
- fputs_filtered (paddress (load_addr = SYMBOL_VALUE_ADDRESS (sym)),
- gdb_stdout);
- printf_filtered (")");
- 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);
}
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));
printf_filtered (_("an argument at offset %ld"), val);
break;
- case LOC_LOCAL_ARG:
- printf_filtered (_("an argument at frame offset %ld"), val);
- break;
-
case LOC_LOCAL:
printf_filtered (_("a local variable at frame offset %ld"), val);
break;
printf_filtered (_("a reference argument at offset %ld"), val);
break;
- case LOC_BASEREG:
- printf_filtered (_("a variable at offset %ld from register %s"),
- val, gdbarch_register_name (current_gdbarch, basereg));
- break;
-
- case LOC_BASEREG_ARG:
- printf_filtered (_("an argument at offset %ld from register %s"),
- val, gdbarch_register_name (current_gdbarch, basereg));
- break;
-
case LOC_TYPEDEF:
printf_filtered (_("a typedef"));
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;
{
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);
}
}
}
break;
- case LOC_HP_THREAD_LOCAL_STATIC:
- printf_filtered (_("\
-a thread-local variable at offset %ld from the thread base register %s"),
- val, gdbarch_register_name (current_gdbarch, basereg));
- break;
-
case LOC_OPTIMIZED_OUT:
printf_filtered (_("optimized out"));
break;
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, _("\