/* Print values for GNU debugger GDB.
- Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GDB.
static CORE_ADDR next_address;
+/* Number of delay instructions following current disassembled insn. */
+
+static int branch_delay_insns;
+
/* Last address examined. */
static CORE_ADDR last_examine_address;
case 'a':
case 's':
/* Pick the appropriate size for an address. */
- if (TARGET_PTR_BIT == 64)
+ if (gdbarch_ptr_bit (current_gdbarch) == 64)
val.size = osize ? 'g' : osize;
- else if (TARGET_PTR_BIT == 32)
+ else if (gdbarch_ptr_bit (current_gdbarch) == 32)
val.size = osize ? 'w' : osize;
- else if (TARGET_PTR_BIT == 16)
+ else if (gdbarch_ptr_bit (current_gdbarch) == 16)
val.size = osize ? 'h' : osize;
else
- /* Bad value for TARGET_PTR_BIT. */
+ /* Bad value for gdbarch_ptr_bit. */
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
break;
/* We often wrap here if there are long symbolic names. */
wrap_here (" ");
- next_address = VALUE_ADDRESS (val)
- + gdb_print_insn (VALUE_ADDRESS (val), stream);
+ next_address = (VALUE_ADDRESS (val)
+ + gdb_print_insn (VALUE_ADDRESS (val), stream,
+ &branch_delay_insns));
break;
default:
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
- TARGET_ADDR_BIT/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
+ gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
if (TYPE_CODE (type) == TYPE_CODE_PTR)
- len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
+ len = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
/* If we are printing it as unsigned, truncate it in case it is actually
a negative signed value (e.g. "print/u (short)-1" should print 65535
fputs_filtered (paddress (addr), stream);
else
{
- int addr_bit = TARGET_ADDR_BIT;
+ int addr_bit = gdbarch_addr_bit (current_gdbarch);
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
value_free (last_examine_value);
/* 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
+ Instead, to avoid the possibility of a fetched value not
+ being used, its retrieval 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
release_value (last_examine_value);
print_formatted (last_examine_value, format, size, gdb_stdout);
+
+ /* Display any branch delay slots following the final insn. */
+ if (format == 'i' && count == 1)
+ count += branch_delay_insns;
}
printf_filtered ("\n");
gdb_flush (gdb_stdout);
addr = parse_and_eval_address (arg);
ALL_OBJSECTIONS (objfile, osect)
{
+ /* Only process each object file once, even if there's a separate
+ debug file. */
+ if (objfile->separate_debug_objfile_backlink)
+ continue;
+
sect = osect->the_bfd_section;
sect_addr = overlay_mapped_address (addr, sect);
break;
case LOC_REGISTER:
- printf_filtered (_("a variable in register %s"), REGISTER_NAME (val));
+ printf_filtered (_("a variable in register %s"),
+ gdbarch_register_name (current_gdbarch, val));
break;
case LOC_STATIC:
break;
case LOC_REGPARM:
- printf_filtered (_("an argument in register %s"), REGISTER_NAME (val));
+ 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"),
- REGISTER_NAME (val));
+ gdbarch_register_name (current_gdbarch, val));
break;
case LOC_ARG:
case LOC_BASEREG:
printf_filtered (_("a variable at offset %ld from register %s"),
- val, REGISTER_NAME (basereg));
+ val, gdbarch_register_name (current_gdbarch, basereg));
break;
case LOC_BASEREG_ARG:
printf_filtered (_("an argument at offset %ld from register %s"),
- val, REGISTER_NAME (basereg));
+ val, gdbarch_register_name (current_gdbarch, basereg));
break;
case LOC_TYPEDEF:
case LOC_HP_THREAD_LOCAL_STATIC:
printf_filtered (_("\
a thread-local variable at offset %ld from the thread base register %s"),
- val, REGISTER_NAME (basereg));
+ val, gdbarch_register_name (current_gdbarch, basereg));
break;
case LOC_OPTIMIZED_OUT:
print_expression (d->exp, gdb_stdout);
annotate_display_expression_end ();
- if (d->format.count != 1)
+ if (d->format.count != 1 || d->format.format == 'i')
printf_filtered ("\n");
else
printf_filtered (" ");
val = evaluate_expression (d->exp);
addr = value_as_address (val);
if (d->format.format == 'i')
- addr = ADDR_BITS_REMOVE (addr);
+ addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
annotate_display_value ();