aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-03-26 19:16:05 +0000
committerPedro Alves <palves@redhat.com>2013-03-26 19:16:05 +0000
commitdfd1f9bbf2dbc10d0b432e060af0141ab24aafd4 (patch)
tree1f64af9ef316da7761e0fa1e2a8b35b906df70dd
parentaddb4faf786052d9528df6304705c4fe5d6fc6e7 (diff)
downloadgdb-dfd1f9bbf2dbc10d0b432e060af0141ab24aafd4.zip
gdb-dfd1f9bbf2dbc10d0b432e060af0141ab24aafd4.tar.gz
gdb-dfd1f9bbf2dbc10d0b432e060af0141ab24aafd4.tar.bz2
Make "set/show dcache line-size" and "set/show dcache size" zinteger commands instead of uinteger.
It doesn't make sense to request an "unlimited" dcache. You want to configure the cache with specific lines and length of lines. It doesn't actually work anyway: (gdb) set dcache line-size 0 Invalid dcache line size: 4294967295 (must be power of 2). (gdb) set dcache size 0 (gdb) show dcache size Number of dcache lines is unlimited. (gdb) info dcache Dcache 4294967295 lines of 64 bytes each. No data cache available. The code already has guards in place to forbid 0s: static void set_dcache_size (char *args, int from_tty, struct cmd_list_element *c) { if (dcache_size == 0) { dcache_size = DCACHE_DEFAULT_SIZE; error (_("Dcache size must be greater than 0.")); } if (last_cache) dcache_invalidate (last_cache); } static void set_dcache_line_size (char *args, int from_tty, struct cmd_list_element *c) { if (dcache_line_size < 2 || (dcache_line_size & (dcache_line_size - 1)) != 0) { unsigned d = dcache_line_size; dcache_line_size = DCACHE_DEFAULT_LINE_SIZE; error (_("Invalid dcache line size: %u (must be power of 2)."), d); } if (last_cache) dcache_invalidate (last_cache); } So we now get: (gdb) set dcache line-size 0 Invalid dcache line size: 0 (must be power of 2). (gdb) set dcache size 0 Dcache size must be greater than 0. gdb/ 2013-03-26 Pedro Alves <palves@redhat.com> * dcache.c (_initialize_dcache): Make the "set dcache line-size" and "set dcache size" commands zuinteger instead of uinteger.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dcache.c24
2 files changed, 17 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ec48b97..91ee521 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-03-26 Pedro Alves <palves@redhat.com>
+ * dcache.c (_initialize_dcache): Make the "set dcache line-size"
+ and "set dcache size" commands zuinteger instead of uinteger.
+
+2013-03-26 Pedro Alves <palves@redhat.com>
+
* cris-tdep.c (_initialize_cris_tdep): Make the "set cris-version"
command zuinteger instead of uinteger.
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 6e2c7a2..acb9de4 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -727,20 +727,20 @@ Use this command to set number of lines in dcache and line-size."),
Show dcachesettings."),
&dcache_show_list, "show dcache ", /*allow_unknown*/0, &showlist);
- add_setshow_uinteger_cmd ("line-size", class_obscure,
- &dcache_line_size, _("\
+ add_setshow_zuinteger_cmd ("line-size", class_obscure,
+ &dcache_line_size, _("\
Set dcache line size in bytes (must be power of 2)."), _("\
Show dcache line size."),
- NULL,
- set_dcache_line_size,
- NULL,
- &dcache_set_list, &dcache_show_list);
- add_setshow_uinteger_cmd ("size", class_obscure,
- &dcache_size, _("\
+ NULL,
+ set_dcache_line_size,
+ NULL,
+ &dcache_set_list, &dcache_show_list);
+ add_setshow_zuinteger_cmd ("size", class_obscure,
+ &dcache_size, _("\
Set number of dcache lines."), _("\
Show number of dcache lines."),
- NULL,
- set_dcache_size,
- NULL,
- &dcache_set_list, &dcache_show_list);
+ NULL,
+ set_dcache_size,
+ NULL,
+ &dcache_set_list, &dcache_show_list);
}