/* Memory attributes support, for GDB.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
This file is part of GDB.
const char *value)
{
if (inaccessible_by_default)
- fprintf_filtered (file, _("\
-Unknown memory addresses will be treated as inaccessible.\n"));
+ fprintf_filtered (file, _("Unknown memory addresses will "
+ "be treated as inaccessible.\n"));
else
- fprintf_filtered (file, _("\
-Unknown memory addresses will be treated as RAM.\n"));
+ fprintf_filtered (file, _("Unknown memory addresses "
+ "will be treated as RAM.\n"));
}
struct mem_region new;
int i, ix;
- /* lo == hi is a useless empty region */
+ /* lo == hi is a useless empty region. */
if (lo >= hi && hi != 0)
{
printf_unfiltered (_("invalid memory region: low >= high\n"));
{
if (m->enabled_p == 1)
{
- /* If the address is in the memory region, return that memory range. */
+ /* If the address is in the memory region, return that
+ memory range. */
if (addr >= m->lo && (addr < m->hi || m->hi == 0))
return m;
void
invalidate_target_mem_regions (void)
{
- struct mem_region *m;
- int ix;
-
if (!target_mem_regions_valid)
return;
mem_region_list = NULL;
}
-/* Clear memory region list */
+/* Clear memory region list. */
static void
mem_clear (void)
printf_filtered ("Num ");
printf_filtered ("Enb ");
printf_filtered ("Low Addr ");
- if (gdbarch_addr_bit (current_gdbarch) > 32)
+ if (gdbarch_addr_bit (target_gdbarch) > 32)
printf_filtered (" ");
printf_filtered ("High Addr ");
- if (gdbarch_addr_bit (current_gdbarch) > 32)
+ if (gdbarch_addr_bit (target_gdbarch) > 32)
printf_filtered (" ");
printf_filtered ("Attrs ");
printf_filtered ("\n");
for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
{
char *tmp;
+
printf_filtered ("%-3d %-3c\t",
m->number,
m->enabled_p ? 'y' : 'n');
- if (gdbarch_addr_bit (current_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch) <= 32)
tmp = hex_string_custom ((unsigned long) m->lo, 8);
else
tmp = hex_string_custom ((unsigned long) m->lo, 16);
printf_filtered ("%s ", tmp);
- if (gdbarch_addr_bit (current_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch) <= 32)
{
- if (m->hi == 0)
- tmp = "0x100000000";
- else
- tmp = hex_string_custom ((unsigned long) m->hi, 8);
+ if (m->hi == 0)
+ tmp = "0x100000000";
+ else
+ tmp = hex_string_custom ((unsigned long) m->hi, 8);
}
else
{
- if (m->hi == 0)
- tmp = "0x10000000000000000";
- else
- tmp = hex_string_custom ((unsigned long) m->hi, 16);
+ if (m->hi == 0)
+ tmp = "0x10000000000000000";
+ else
+ tmp = hex_string_custom ((unsigned long) m->hi, 16);
}
printf_filtered ("%s ", tmp);
}
\f
-/* Enable the memory region number NUM. */
+/* Enable the memory region number NUM. */
static void
mem_enable (int num)
require_user_regions (from_tty);
- dcache_invalidate (target_dcache);
+ target_dcache_invalidate ();
if (p == 0)
{
}
\f
-/* Disable the memory region number NUM. */
+/* Disable the memory region number NUM. */
static void
mem_disable (int num)
require_user_regions (from_tty);
- dcache_invalidate (target_dcache);
+ target_dcache_invalidate ();
if (p == 0)
{
}
}
-/* Delete the memory region number NUM. */
+/* Delete the memory region number NUM. */
static void
mem_delete (int num)
{
- struct mem_region *m1, *m;
+ struct mem_region *m;
int ix;
if (!mem_region_list)
require_user_regions (from_tty);
- dcache_invalidate (target_dcache);
+ target_dcache_invalidate ();
if (p == 0)
{
- if (query ("Delete all memory regions? "))
+ if (query (_("Delete all memory regions? ")))
mem_clear ();
dont_repeat ();
return;
Define attributes for memory region or reset memory region handling to\n\
target-based.\n\
Usage: mem auto\n\
- mem <lo addr> <hi addr> [<mode> <width> <cache>], \n\
-where <mode> may be rw (read/write), ro (read-only) or wo (write-only), \n\
- <width> may be 8, 16, 32, or 64, and \n\
+ mem <lo addr> <hi addr> [<mode> <width> <cache>],\n\
+where <mode> may be rw (read/write), ro (read-only) or wo (write-only),\n\
+ <width> may be 8, 16, 32, or 64, and\n\
<cache> may be cache or nocache"));
add_cmd ("mem", class_vars, mem_enable_command, _("\