Constify add_prefix_cmd
[deliverable/binutils-gdb.git] / gdb / memattr.c
CommitLineData
80629b1b 1/* Memory attributes support, for GDB.
14a5e767 2
61baf725 3 Copyright (C) 2001-2017 Free Software Foundation, Inc.
80629b1b
EZ
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
80629b1b
EZ
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
80629b1b 19
29e57380
C
20#include "defs.h"
21#include "command.h"
22#include "gdbcmd.h"
23#include "memattr.h"
24#include "target.h"
68c765e2 25#include "target-dcache.h"
29e57380
C
26#include "value.h"
27#include "language.h"
c96fc75e 28#include "vec.h"
fbcb778d 29#include "breakpoint.h"
197f0a60 30#include "cli/cli-utils.h"
29e57380 31
29e57380
C
32const struct mem_attrib default_mem_attrib =
33{
34 MEM_RW, /* mode */
35 MEM_WIDTH_UNSPECIFIED,
81a9a963
AC
36 0, /* hwbreak */
37 0, /* cache */
fd79ecee
DJ
38 0, /* verify */
39 -1 /* Flash blocksize not specified. */
29e57380
C
40};
41
4b5752d0
VP
42const struct mem_attrib unknown_mem_attrib =
43{
44 MEM_NONE, /* mode */
45 MEM_WIDTH_UNSPECIFIED,
46 0, /* hwbreak */
47 0, /* cache */
48 0, /* verify */
49 -1 /* Flash blocksize not specified. */
50};
51
52
fd79ecee 53VEC(mem_region_s) *mem_region_list, *target_mem_region_list;
f4d650ec 54static int mem_number = 0;
29e57380 55
fd79ecee
DJ
56/* If this flag is set, the memory region list should be automatically
57 updated from the target. If it is clear, the list is user-controlled
58 and should be left alone. */
59static int mem_use_target = 1;
60
61/* If this flag is set, we have tried to fetch the target memory regions
62 since the last time it was invalidated. If that list is still
63 empty, then the target can't supply memory regions. */
64static int target_mem_regions_valid;
65
4b5752d0
VP
66/* If this flag is set, gdb will assume that memory ranges not
67 specified by the memory map have type MEM_NONE, and will
68 emit errors on all accesses to that memory. */
56cf5405 69static int inaccessible_by_default = 1;
4b5752d0
VP
70
71static void
72show_inaccessible_by_default (struct ui_file *file, int from_tty,
73 struct cmd_list_element *c,
74 const char *value)
75{
76 if (inaccessible_by_default)
3e43a32a
MS
77 fprintf_filtered (file, _("Unknown memory addresses will "
78 "be treated as inaccessible.\n"));
4b5752d0 79 else
3e43a32a
MS
80 fprintf_filtered (file, _("Unknown memory addresses "
81 "will be treated as RAM.\n"));
4b5752d0
VP
82}
83
84
c96fc75e
DJ
85/* Predicate function which returns true if LHS should sort before RHS
86 in a list of memory regions, useful for VEC_lower_bound. */
87
88static int
89mem_region_lessthan (const struct mem_region *lhs,
90 const struct mem_region *rhs)
91{
92 return lhs->lo < rhs->lo;
93}
94
fd79ecee
DJ
95/* A helper function suitable for qsort, used to sort a
96 VEC(mem_region_s) by starting address. */
97
98int
99mem_region_cmp (const void *untyped_lhs, const void *untyped_rhs)
100{
19ba03f4
SM
101 const struct mem_region *lhs = (const struct mem_region *) untyped_lhs;
102 const struct mem_region *rhs = (const struct mem_region *) untyped_rhs;
fd79ecee
DJ
103
104 if (lhs->lo < rhs->lo)
105 return -1;
106 else if (lhs->lo == rhs->lo)
107 return 0;
108 else
109 return 1;
110}
111
112/* Allocate a new memory region, with default settings. */
113
114void
fe978cb0 115mem_region_init (struct mem_region *newobj)
fd79ecee 116{
fe978cb0
PA
117 memset (newobj, 0, sizeof (struct mem_region));
118 newobj->enabled_p = 1;
119 newobj->attrib = default_mem_attrib;
fd79ecee
DJ
120}
121
122/* This function should be called before any command which would
123 modify the memory region list. It will handle switching from
124 a target-provided list to a local list, if necessary. */
125
126static void
127require_user_regions (int from_tty)
128{
129 struct mem_region *m;
130 int ix, length;
131
132 /* If we're already using a user-provided list, nothing to do. */
133 if (!mem_use_target)
134 return;
135
136 /* Switch to a user-provided list (possibly a copy of the current
137 one). */
138 mem_use_target = 0;
139
140 /* If we don't have a target-provided region list yet, then
141 no need to warn. */
142 if (mem_region_list == NULL)
143 return;
144
145 /* Otherwise, let the user know how to get back. */
146 if (from_tty)
147 warning (_("Switching to manual control of memory regions; use "
148 "\"mem auto\" to fetch regions from the target again."));
149
150 /* And create a new list for the user to modify. */
151 length = VEC_length (mem_region_s, target_mem_region_list);
152 mem_region_list = VEC_alloc (mem_region_s, length);
153 for (ix = 0; VEC_iterate (mem_region_s, target_mem_region_list, ix, m); ix++)
154 VEC_quick_push (mem_region_s, mem_region_list, m);
155}
156
157/* This function should be called before any command which would
158 read the memory region list, other than those which call
159 require_user_regions. It will handle fetching the
160 target-provided list, if necessary. */
161
162static void
163require_target_regions (void)
164{
165 if (mem_use_target && !target_mem_regions_valid)
166 {
167 target_mem_regions_valid = 1;
168 target_mem_region_list = target_memory_map ();
169 mem_region_list = target_mem_region_list;
170 }
171}
172
c96fc75e 173static void
29e57380
C
174create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
175 const struct mem_attrib *attrib)
176{
fe978cb0 177 struct mem_region newobj;
c96fc75e 178 int i, ix;
29e57380 179
025bb325 180 /* lo == hi is a useless empty region. */
2b236d82 181 if (lo >= hi && hi != 0)
29e57380 182 {
a3f17187 183 printf_unfiltered (_("invalid memory region: low >= high\n"));
c96fc75e 184 return;
29e57380
C
185 }
186
fe978cb0
PA
187 mem_region_init (&newobj);
188 newobj.lo = lo;
189 newobj.hi = hi;
c96fc75e 190
fe978cb0 191 ix = VEC_lower_bound (mem_region_s, mem_region_list, &newobj,
c96fc75e
DJ
192 mem_region_lessthan);
193
194 /* Check for an overlapping memory region. We only need to check
195 in the vicinity - at most one before and one after the
196 insertion point. */
197 for (i = ix - 1; i < ix + 1; i++)
29e57380 198 {
c96fc75e
DJ
199 struct mem_region *n;
200
201 if (i < 0)
202 continue;
203 if (i >= VEC_length (mem_region_s, mem_region_list))
204 continue;
205
206 n = VEC_index (mem_region_s, mem_region_list, i);
207
2b236d82
DH
208 if ((lo >= n->lo && (lo < n->hi || n->hi == 0))
209 || (hi > n->lo && (hi <= n->hi || n->hi == 0))
1591a1e8 210 || (lo <= n->lo && ((hi >= n->hi && n->hi != 0) || hi == 0)))
29e57380 211 {
a3f17187 212 printf_unfiltered (_("overlapping memory region\n"));
c96fc75e 213 return;
29e57380
C
214 }
215 }
216
fe978cb0
PA
217 newobj.number = ++mem_number;
218 newobj.attrib = *attrib;
219 VEC_safe_insert (mem_region_s, mem_region_list, ix, &newobj);
29e57380
C
220}
221
222/*
223 * Look up the memory region cooresponding to ADDR.
224 */
225struct mem_region *
226lookup_mem_region (CORE_ADDR addr)
227{
228 static struct mem_region region;
229 struct mem_region *m;
230 CORE_ADDR lo;
231 CORE_ADDR hi;
c96fc75e 232 int ix;
29e57380 233
fd79ecee
DJ
234 require_target_regions ();
235
29e57380
C
236 /* First we initialize LO and HI so that they describe the entire
237 memory space. As we process the memory region chain, they are
238 redefined to describe the minimal region containing ADDR. LO
239 and HI are used in the case where no memory region is defined
240 that contains ADDR. If a memory region is disabled, it is
a76d924d
DJ
241 treated as if it does not exist. The initial values for LO
242 and HI represent the bottom and top of memory. */
29e57380 243
a76d924d
DJ
244 lo = 0;
245 hi = 0;
29e57380 246
4b5752d0
VP
247 /* Either find memory range containing ADDRESS, or set LO and HI
248 to the nearest boundaries of an existing memory range.
249
250 If we ever want to support a huge list of memory regions, this
c96fc75e
DJ
251 check should be replaced with a binary search (probably using
252 VEC_lower_bound). */
253 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
29e57380 254 {
b5de0fa7 255 if (m->enabled_p == 1)
29e57380 256 {
3e43a32a
MS
257 /* If the address is in the memory region, return that
258 memory range. */
2b236d82 259 if (addr >= m->lo && (addr < m->hi || m->hi == 0))
29e57380
C
260 return m;
261
a76d924d
DJ
262 /* This (correctly) won't match if m->hi == 0, representing
263 the top of the address space, because CORE_ADDR is unsigned;
264 no value of LO is less than zero. */
29e57380
C
265 if (addr >= m->hi && lo < m->hi)
266 lo = m->hi;
267
a76d924d
DJ
268 /* This will never set HI to zero; if we're here and ADDR
269 is at or below M, and the region starts at zero, then ADDR
270 would have been in the region. */
271 if (addr <= m->lo && (hi == 0 || hi > m->lo))
29e57380
C
272 hi = m->lo;
273 }
274 }
275
276 /* Because no region was found, we must cons up one based on what
277 was learned above. */
278 region.lo = lo;
279 region.hi = hi;
4b5752d0
VP
280
281 /* When no memory map is defined at all, we always return
282 'default_mem_attrib', so that we do not make all memory
283 inaccessible for targets that don't provide a memory map. */
284 if (inaccessible_by_default && !VEC_empty (mem_region_s, mem_region_list))
285 region.attrib = unknown_mem_attrib;
286 else
287 region.attrib = default_mem_attrib;
288
29e57380
C
289 return &region;
290}
fd79ecee
DJ
291
292/* Invalidate any memory regions fetched from the target. */
293
294void
295invalidate_target_mem_regions (void)
296{
fd79ecee
DJ
297 if (!target_mem_regions_valid)
298 return;
299
300 target_mem_regions_valid = 0;
301 VEC_free (mem_region_s, target_mem_region_list);
302 if (mem_use_target)
303 mem_region_list = NULL;
304}
305
025bb325 306/* Clear memory region list. */
fd79ecee
DJ
307
308static void
309mem_clear (void)
310{
311 VEC_free (mem_region_s, mem_region_list);
312}
29e57380
C
313\f
314
315static void
316mem_command (char *args, int from_tty)
317{
318 CORE_ADDR lo, hi;
319 char *tok;
320 struct mem_attrib attrib;
321
322 if (!args)
e2e0b3e5 323 error_no_arg (_("No mem"));
29e57380 324
fd79ecee
DJ
325 /* For "mem auto", switch back to using a target provided list. */
326 if (strcmp (args, "auto") == 0)
327 {
328 if (mem_use_target)
329 return;
330
331 if (mem_region_list != target_mem_region_list)
332 {
333 mem_clear ();
334 mem_region_list = target_mem_region_list;
335 }
336
337 mem_use_target = 1;
338 return;
339 }
340
341 require_user_regions (from_tty);
342
29e57380
C
343 tok = strtok (args, " \t");
344 if (!tok)
8a3fe4f8 345 error (_("no lo address"));
29e57380
C
346 lo = parse_and_eval_address (tok);
347
348 tok = strtok (NULL, " \t");
349 if (!tok)
8a3fe4f8 350 error (_("no hi address"));
29e57380
C
351 hi = parse_and_eval_address (tok);
352
353 attrib = default_mem_attrib;
354 while ((tok = strtok (NULL, " \t")) != NULL)
355 {
356 if (strcmp (tok, "rw") == 0)
357 attrib.mode = MEM_RW;
358 else if (strcmp (tok, "ro") == 0)
359 attrib.mode = MEM_RO;
360 else if (strcmp (tok, "wo") == 0)
361 attrib.mode = MEM_WO;
362
363 else if (strcmp (tok, "8") == 0)
364 attrib.width = MEM_WIDTH_8;
365 else if (strcmp (tok, "16") == 0)
366 {
367 if ((lo % 2 != 0) || (hi % 2 != 0))
8a3fe4f8 368 error (_("region bounds not 16 bit aligned"));
29e57380
C
369 attrib.width = MEM_WIDTH_16;
370 }
371 else if (strcmp (tok, "32") == 0)
372 {
373 if ((lo % 4 != 0) || (hi % 4 != 0))
8a3fe4f8 374 error (_("region bounds not 32 bit aligned"));
29e57380
C
375 attrib.width = MEM_WIDTH_32;
376 }
377 else if (strcmp (tok, "64") == 0)
378 {
379 if ((lo % 8 != 0) || (hi % 8 != 0))
8a3fe4f8 380 error (_("region bounds not 64 bit aligned"));
29e57380
C
381 attrib.width = MEM_WIDTH_64;
382 }
383
384#if 0
385 else if (strcmp (tok, "hwbreak") == 0)
81a9a963 386 attrib.hwbreak = 1;
29e57380 387 else if (strcmp (tok, "swbreak") == 0)
81a9a963 388 attrib.hwbreak = 0;
29e57380
C
389#endif
390
391 else if (strcmp (tok, "cache") == 0)
81a9a963 392 attrib.cache = 1;
29e57380 393 else if (strcmp (tok, "nocache") == 0)
81a9a963 394 attrib.cache = 0;
29e57380
C
395
396#if 0
397 else if (strcmp (tok, "verify") == 0)
81a9a963 398 attrib.verify = 1;
29e57380 399 else if (strcmp (tok, "noverify") == 0)
81a9a963 400 attrib.verify = 0;
29e57380
C
401#endif
402
403 else
8a3fe4f8 404 error (_("unknown attribute: %s"), tok);
29e57380
C
405 }
406
407 create_mem_region (lo, hi, &attrib);
408}
409\f
410
411static void
ae3b3f34 412info_mem_command (char *args, int from_tty)
29e57380
C
413{
414 struct mem_region *m;
415 struct mem_attrib *attrib;
c96fc75e 416 int ix;
29e57380 417
fd79ecee
DJ
418 if (mem_use_target)
419 printf_filtered (_("Using memory regions provided by the target.\n"));
420 else
421 printf_filtered (_("Using user-defined memory regions.\n"));
422
423 require_target_regions ();
424
c96fc75e 425 if (!mem_region_list)
29e57380 426 {
a3f17187 427 printf_unfiltered (_("There are no memory regions defined.\n"));
29e57380
C
428 return;
429 }
430
ab35b611
EZ
431 printf_filtered ("Num ");
432 printf_filtered ("Enb ");
433 printf_filtered ("Low Addr ");
f5656ead 434 if (gdbarch_addr_bit (target_gdbarch ()) > 32)
ab35b611
EZ
435 printf_filtered (" ");
436 printf_filtered ("High Addr ");
f5656ead 437 if (gdbarch_addr_bit (target_gdbarch ()) > 32)
ab35b611
EZ
438 printf_filtered (" ");
439 printf_filtered ("Attrs ");
440 printf_filtered ("\n");
441
c96fc75e 442 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
29e57380 443 {
a121b7c1 444 const char *tmp;
b8d56208 445
ab35b611 446 printf_filtered ("%-3d %-3c\t",
29e57380 447 m->number,
b5de0fa7 448 m->enabled_p ? 'y' : 'n');
f5656ead 449 if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
aacd3e8c 450 tmp = hex_string_custom (m->lo, 8);
ab35b611 451 else
aacd3e8c 452 tmp = hex_string_custom (m->lo, 16);
ab35b611
EZ
453
454 printf_filtered ("%s ", tmp);
2b236d82 455
f5656ead 456 if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
2163ab9d 457 {
b8d56208
MS
458 if (m->hi == 0)
459 tmp = "0x100000000";
460 else
aacd3e8c 461 tmp = hex_string_custom (m->hi, 8);
2163ab9d 462 }
ab35b611 463 else
2163ab9d 464 {
b8d56208
MS
465 if (m->hi == 0)
466 tmp = "0x10000000000000000";
467 else
aacd3e8c 468 tmp = hex_string_custom (m->hi, 16);
2163ab9d
DH
469 }
470
ab35b611 471 printf_filtered ("%s ", tmp);
29e57380
C
472
473 /* Print a token for each attribute.
474
475 * FIXME: Should we output a comma after each token? It may
476 * make it easier for users to read, but we'd lose the ability
477 * to cut-and-paste the list of attributes when defining a new
478 * region. Perhaps that is not important.
479 *
480 * FIXME: If more attributes are added to GDB, the output may
481 * become cluttered and difficult for users to read. At that
482 * time, we may want to consider printing tokens only if they
483 * are different from the default attribute. */
484
485 attrib = &m->attrib;
486 switch (attrib->mode)
487 {
488 case MEM_RW:
489 printf_filtered ("rw ");
490 break;
491 case MEM_RO:
492 printf_filtered ("ro ");
493 break;
494 case MEM_WO:
495 printf_filtered ("wo ");
496 break;
fd79ecee
DJ
497 case MEM_FLASH:
498 printf_filtered ("flash blocksize 0x%x ", attrib->blocksize);
499 break;
29e57380
C
500 }
501
502 switch (attrib->width)
503 {
504 case MEM_WIDTH_8:
505 printf_filtered ("8 ");
506 break;
507 case MEM_WIDTH_16:
508 printf_filtered ("16 ");
509 break;
510 case MEM_WIDTH_32:
511 printf_filtered ("32 ");
512 break;
513 case MEM_WIDTH_64:
514 printf_filtered ("64 ");
515 break;
516 case MEM_WIDTH_UNSPECIFIED:
517 break;
518 }
519
520#if 0
521 if (attrib->hwbreak)
522 printf_filtered ("hwbreak");
523 else
524 printf_filtered ("swbreak");
525#endif
526
527 if (attrib->cache)
528 printf_filtered ("cache ");
529 else
530 printf_filtered ("nocache ");
531
532#if 0
533 if (attrib->verify)
534 printf_filtered ("verify ");
535 else
536 printf_filtered ("noverify ");
537#endif
538
539 printf_filtered ("\n");
540
541 gdb_flush (gdb_stdout);
542 }
543}
544\f
545
025bb325 546/* Enable the memory region number NUM. */
29e57380
C
547
548static void
549mem_enable (int num)
550{
551 struct mem_region *m;
c96fc75e 552 int ix;
29e57380 553
c96fc75e 554 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
29e57380
C
555 if (m->number == num)
556 {
b5de0fa7 557 m->enabled_p = 1;
29e57380
C
558 return;
559 }
a3f17187 560 printf_unfiltered (_("No memory region number %d.\n"), num);
29e57380
C
561}
562
563static void
4465d9db 564enable_mem_command (const char *args, int from_tty)
29e57380 565{
29e57380
C
566 int num;
567 struct mem_region *m;
c96fc75e 568 int ix;
29e57380 569
fd79ecee
DJ
570 require_user_regions (from_tty);
571
4e5d721f 572 target_dcache_invalidate ();
29e57380 573
fbcb778d
MS
574 if (args == NULL || *args == '\0')
575 { /* Enable all mem regions. */
c96fc75e 576 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
b5de0fa7 577 m->enabled_p = 1;
29e57380
C
578 }
579 else
197f0a60 580 {
bfd28288
PA
581 number_or_range_parser parser (args);
582 while (!parser.finished ())
197f0a60 583 {
bfd28288 584 num = parser.get_number ();
197f0a60
TT
585 mem_enable (num);
586 }
587 }
29e57380
C
588}
589\f
590
025bb325 591/* Disable the memory region number NUM. */
29e57380
C
592
593static void
594mem_disable (int num)
595{
596 struct mem_region *m;
c96fc75e 597 int ix;
29e57380 598
c96fc75e 599 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
29e57380
C
600 if (m->number == num)
601 {
b5de0fa7 602 m->enabled_p = 0;
29e57380
C
603 return;
604 }
a3f17187 605 printf_unfiltered (_("No memory region number %d.\n"), num);
29e57380
C
606}
607
608static void
4465d9db 609disable_mem_command (const char *args, int from_tty)
29e57380 610{
fd79ecee
DJ
611 require_user_regions (from_tty);
612
4e5d721f 613 target_dcache_invalidate ();
29e57380 614
fbcb778d 615 if (args == NULL || *args == '\0')
29e57380 616 {
bfd28288
PA
617 struct mem_region *m;
618 int ix;
619
c96fc75e 620 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
b5de0fa7 621 m->enabled_p = 0;
29e57380
C
622 }
623 else
197f0a60 624 {
bfd28288
PA
625 number_or_range_parser parser (args);
626 while (!parser.finished ())
197f0a60 627 {
bfd28288 628 int num = parser.get_number ();
197f0a60
TT
629 mem_disable (num);
630 }
631 }
29e57380
C
632}
633
025bb325 634/* Delete the memory region number NUM. */
29e57380
C
635
636static void
637mem_delete (int num)
638{
6b4398f7 639 struct mem_region *m;
c96fc75e 640 int ix;
29e57380 641
c96fc75e 642 if (!mem_region_list)
29e57380 643 {
a3f17187 644 printf_unfiltered (_("No memory region number %d.\n"), num);
29e57380
C
645 return;
646 }
647
c96fc75e
DJ
648 for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
649 if (m->number == num)
650 break;
651
652 if (m == NULL)
29e57380 653 {
c96fc75e
DJ
654 printf_unfiltered (_("No memory region number %d.\n"), num);
655 return;
29e57380 656 }
c96fc75e
DJ
657
658 VEC_ordered_remove (mem_region_s, mem_region_list, ix);
29e57380
C
659}
660
661static void
4465d9db 662delete_mem_command (const char *args, int from_tty)
29e57380 663{
fd79ecee
DJ
664 require_user_regions (from_tty);
665
4e5d721f 666 target_dcache_invalidate ();
29e57380 667
fbcb778d 668 if (args == NULL || *args == '\0')
29e57380 669 {
9e2f0ad4 670 if (query (_("Delete all memory regions? ")))
29e57380
C
671 mem_clear ();
672 dont_repeat ();
673 return;
674 }
675
bfd28288
PA
676 number_or_range_parser parser (args);
677 while (!parser.finished ())
29e57380 678 {
bfd28288 679 int num = parser.get_number ();
29e57380 680 mem_delete (num);
29e57380
C
681 }
682
683 dont_repeat ();
684}
4b5752d0
VP
685
686static void
981a3fb3 687dummy_cmd (const char *args, int from_tty)
4b5752d0
VP
688{
689}
b9362cc7 690
4b5752d0
VP
691static struct cmd_list_element *mem_set_cmdlist;
692static struct cmd_list_element *mem_show_cmdlist;
693
29e57380 694void
5ae5f592 695_initialize_mem (void)
29e57380 696{
1bedd215 697 add_com ("mem", class_vars, mem_command, _("\
fd79ecee
DJ
698Define attributes for memory region or reset memory region handling to\n\
699target-based.\n\
700Usage: mem auto\n\
cce7e648
PA
701 mem <lo addr> <hi addr> [<mode> <width> <cache>],\n\
702where <mode> may be rw (read/write), ro (read-only) or wo (write-only),\n\
703 <width> may be 8, 16, 32, or 64, and\n\
1bedd215 704 <cache> may be cache or nocache"));
29e57380 705
ae3b3f34 706 add_cmd ("mem", class_vars, enable_mem_command, _("\
1a966eab 707Enable memory region.\n\
29e57380 708Arguments are the code numbers of the memory regions to enable.\n\
fbcb778d 709Usage: enable mem <code number>...\n\
1a966eab 710Do \"info mem\" to see current list of code numbers."), &enablelist);
29e57380 711
ae3b3f34 712 add_cmd ("mem", class_vars, disable_mem_command, _("\
1a966eab 713Disable memory region.\n\
29e57380 714Arguments are the code numbers of the memory regions to disable.\n\
fbcb778d 715Usage: disable mem <code number>...\n\
1a966eab 716Do \"info mem\" to see current list of code numbers."), &disablelist);
29e57380 717
ae3b3f34 718 add_cmd ("mem", class_vars, delete_mem_command, _("\
1a966eab 719Delete memory region.\n\
29e57380 720Arguments are the code numbers of the memory regions to delete.\n\
fbcb778d 721Usage: delete mem <code number>...\n\
1a966eab 722Do \"info mem\" to see current list of code numbers."), &deletelist);
29e57380 723
ae3b3f34 724 add_info ("mem", info_mem_command,
1bedd215 725 _("Memory region attributes"));
4b5752d0
VP
726
727 add_prefix_cmd ("mem", class_vars, dummy_cmd, _("\
728Memory regions settings"),
729 &mem_set_cmdlist, "set mem ",
730 0/* allow-unknown */, &setlist);
731 add_prefix_cmd ("mem", class_vars, dummy_cmd, _("\
732Memory regions settings"),
733 &mem_show_cmdlist, "show mem ",
734 0/* allow-unknown */, &showlist);
735
736 add_setshow_boolean_cmd ("inaccessible-by-default", no_class,
737 &inaccessible_by_default, _("\
738Set handling of unknown memory regions."), _("\
739Show handling of unknown memory regions."), _("\
740If on, and some memory map is defined, debugger will emit errors on\n\
741accesses to memory not defined in the memory map. If off, accesses to all\n\
742memory addresses will be allowed."),
743 NULL,
744 show_inaccessible_by_default,
745 &mem_set_cmdlist,
746 &mem_show_cmdlist);
29e57380 747}
This page took 1.524973 seconds and 4 git commands to generate.