X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmemattr.c;h=e38bc5c33ab6720e450fe34b6ba6dac42fc86b23;hb=348fe36b1d64f12c60e08f6313520b3191663063;hp=02b93e838b897b669cbdc17fb5a4830c67a3b135;hpb=1d12d88f186fe1ae66deccf877b5509c506c4d39;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/memattr.c b/gdb/memattr.c index 02b93e838b..e38bc5c33a 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -1,6 +1,6 @@ /* Memory attributes support, for GDB. - Copyright (C) 2001-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -25,10 +25,10 @@ #include "target-dcache.h" #include "value.h" #include "language.h" -#include "vec.h" #include "breakpoint.h" #include "cli/cli-utils.h" #include +#include "gdbarch.h" static std::vector user_mem_region_list, target_mem_region_list; static std::vector *mem_region_list = &target_mem_region_list; @@ -52,7 +52,7 @@ static bool target_mem_regions_valid; /* If this flag is set, gdb will assume that memory ranges not specified by the memory map have type MEM_NONE, and will emit errors on all accesses to that memory. */ -static int inaccessible_by_default = 1; +static bool inaccessible_by_default = true; static void show_inaccessible_by_default (struct ui_file *file, int from_tty, @@ -74,9 +74,6 @@ show_inaccessible_by_default (struct ui_file *file, int from_tty, static void require_user_regions (int from_tty) { - struct mem_region *m; - int ix, length; - /* If we're already using a user-provided list, nothing to do. */ if (!mem_use_target ()) return; @@ -136,7 +133,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi, int ix = std::distance (user_mem_region_list.begin (), it); /* Check for an overlapping memory region. We only need to check - in the vicinity - at most one before and one after the + in the vincinity - at most one before and one after the insertion point. */ for (int i = ix - 1; i < ix + 1; i++) { @@ -166,10 +163,8 @@ struct mem_region * lookup_mem_region (CORE_ADDR addr) { static struct mem_region region (0, 0); - struct mem_region *m; CORE_ADDR lo; CORE_ADDR hi; - int ix; require_target_regions (); @@ -464,8 +459,6 @@ info_mem_command (const char *args, int from_tty) #endif printf_filtered ("\n"); - - gdb_flush (gdb_stdout); } } @@ -531,9 +524,6 @@ disable_mem_command (const char *args, int from_tty) if (args == NULL || *args == '\0') { - struct mem_region *m; - int ix; - for (mem_region &m : *mem_region_list) m.enabled_p = false; } @@ -553,9 +543,6 @@ disable_mem_command (const char *args, int from_tty) static void mem_delete (int num) { - struct mem_region *m; - int ix; - if (!mem_region_list) { printf_unfiltered (_("No memory region number %d.\n"), num); @@ -599,55 +586,51 @@ delete_mem_command (const char *args, int from_tty) dont_repeat (); } -static void -dummy_cmd (const char *args, int from_tty) -{ -} - static struct cmd_list_element *mem_set_cmdlist; static struct cmd_list_element *mem_show_cmdlist; +void _initialize_mem (); void -_initialize_mem (void) +_initialize_mem () { add_com ("mem", class_vars, mem_command, _("\ -Define attributes for memory region or reset memory region handling to\n\ -target-based.\n\ +Define attributes for memory region or reset memory region handling to " +"target-based.\n\ Usage: mem auto\n\ - mem [ ],\n\ -where may be rw (read/write), ro (read-only) or wo (write-only),\n\ - may be 8, 16, 32, or 64, and\n\ - may be cache or nocache")); + mem LOW HIGH [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, enable_mem_command, _("\ Enable memory region.\n\ -Arguments are the code numbers of the memory regions to enable.\n\ -Usage: enable mem ...\n\ -Do \"info mem\" to see current list of code numbers."), &enablelist); +Arguments are the IDs of the memory regions to enable.\n\ +Usage: enable mem [ID]...\n\ +Do \"info mem\" to see current list of IDs."), &enablelist); add_cmd ("mem", class_vars, disable_mem_command, _("\ Disable memory region.\n\ -Arguments are the code numbers of the memory regions to disable.\n\ -Usage: disable mem ...\n\ -Do \"info mem\" to see current list of code numbers."), &disablelist); +Arguments are the IDs of the memory regions to disable.\n\ +Usage: disable mem [ID]...\n\ +Do \"info mem\" to see current list of IDs."), &disablelist); add_cmd ("mem", class_vars, delete_mem_command, _("\ Delete memory region.\n\ -Arguments are the code numbers of the memory regions to delete.\n\ -Usage: delete mem ...\n\ -Do \"info mem\" to see current list of code numbers."), &deletelist); +Arguments are the IDs of the memory regions to delete.\n\ +Usage: delete mem [ID]...\n\ +Do \"info mem\" to see current list of IDs."), &deletelist); add_info ("mem", info_mem_command, - _("Memory region attributes")); - - add_prefix_cmd ("mem", class_vars, dummy_cmd, _("\ -Memory regions settings"), - &mem_set_cmdlist, "set mem ", - 0/* allow-unknown */, &setlist); - add_prefix_cmd ("mem", class_vars, dummy_cmd, _("\ -Memory regions settings"), - &mem_show_cmdlist, "show mem ", - 0/* allow-unknown */, &showlist); + _("Memory region attributes.")); + + add_basic_prefix_cmd ("mem", class_vars, _("\ +Memory regions settings."), + &mem_set_cmdlist, "set mem ", + 0/* allow-unknown */, &setlist); + add_show_prefix_cmd ("mem", class_vars, _("\ +Memory regions settings."), + &mem_show_cmdlist, "show mem ", + 0/* allow-unknown */, &showlist); add_setshow_boolean_cmd ("inaccessible-by-default", no_class, &inaccessible_by_default, _("\