/* Support for GDB maintenance commands.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
- 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
#include "defs.h"
+#include "arch-utils.h"
#include <ctype.h>
#include <signal.h>
#include "command.h"
static void
maintenance_time_display (char *args, int from_tty)
{
- extern int display_time;
-
if (args == NULL || *args == '\0')
printf_unfiltered (_("\"maintenance time\" takes a numeric argument.\n"));
else
- display_time = strtol (args, NULL, 10);
+ set_display_time (strtol (args, NULL, 10));
}
static void
maintenance_space_display (char *args, int from_tty)
{
- extern int display_space;
-
if (args == NULL || *args == '\0')
printf_unfiltered ("\"maintenance space\" takes a numeric argument.\n");
else
- display_space = strtol (args, NULL, 10);
+ set_display_space (strtol (args, NULL, 10));
}
/* The "maintenance info" command is defined as a prefix, with
static void
maint_print_section_info (const char *name, flagword flags,
CORE_ADDR addr, CORE_ADDR endaddr,
- unsigned long filepos)
+ unsigned long filepos, int addr_size)
{
- /* FIXME-32x64: Need paddress with field width. */
- printf_filtered (" 0x%s", paddr (addr));
- printf_filtered ("->0x%s", paddr (endaddr));
+ printf_filtered (" %s", hex_string_custom (addr, addr_size));
+ printf_filtered ("->%s", hex_string_custom (endaddr, addr_size));
printf_filtered (" at %s",
hex_string_custom ((unsigned long) filepos, 8));
printf_filtered (": %s", name);
|| match_substring ((char *) arg, name)
|| match_bfd_flags ((char *) arg, flags))
{
+ struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
+ int addr_size = gdbarch_addr_bit (gdbarch) / 8;
CORE_ADDR addr, endaddr;
addr = bfd_section_vma (abfd, asect);
endaddr = addr + bfd_section_size (abfd, asect);
- maint_print_section_info (name, flags, addr, endaddr, asect->filepos);
+ maint_print_section_info (name, flags, addr, endaddr,
+ asect->filepos, addr_size);
}
}
|| match_substring (string, name)
|| match_bfd_flags (string, flags))
{
+ struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
+ int addr_size = gdbarch_addr_bit (gdbarch) / 8;
+
maint_print_section_info (name, flags,
obj_section_addr (asect),
obj_section_endaddr (asect),
- asect->the_bfd_section->filepos);
+ asect->the_bfd_section->filepos,
+ addr_size);
}
}
static void
maintenance_print_architecture (char *args, int from_tty)
{
+ struct gdbarch *gdbarch = get_current_arch ();
+
if (args == NULL)
- gdbarch_dump (current_gdbarch, gdb_stdout);
+ gdbarch_dump (gdbarch, gdb_stdout);
else
{
struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w");
+
if (file == NULL)
perror_with_name (_("maintenance print architecture"));
cleanups = make_cleanup_ui_file_delete (file);
- gdbarch_dump (current_gdbarch, file);
+ gdbarch_dump (gdbarch, file);
do_cleanups (cleanups);
}
}
printf_filtered (_("%s + %s\n"), symbol_name, symbol_offset);
}
else if (sect)
- printf_filtered (_("no symbol at %s:0x%s\n"),
- sect->the_bfd_section->name, paddr (address));
+ printf_filtered (_("no symbol at %s:%s\n"),
+ sect->the_bfd_section->name, hex_string (address));
else
- printf_filtered (_("no symbol at 0x%s\n"), paddr (address));
+ printf_filtered (_("no symbol at %s\n"), hex_string (address));
return;
}
static void
maintenance_do_deprecate (char *text, int deprecate)
{
-
struct cmd_list_element *alias = NULL;
struct cmd_list_element *prefix_cmd = NULL;
struct cmd_list_element *cmd = NULL;
memory. */
if (alias)
{
-
if (alias->flags & MALLOCED_REPLACEMENT)
xfree (alias->replacement);
else
{
extern void _mcleanup (void);
+
_mcleanup ();
}
}
void
_initialize_maint_cmds (void)
{
- struct cmd_list_element *tmpcmd;
-
add_prefix_cmd ("maintenance", class_maintenance, maintenance_command, _("\
Commands for use by GDB maintainers.\n\
Includes commands to dump specific internal GDB structures in\n\