This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] switch from zinteger_cmd to zuinteger_cmd
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 3 Aug 2012 19:05:21 +0800
- Subject: [PATCH] switch from zinteger_cmd to zuinteger_cmd
Hi,
this is the part 2 to switch from zinteger_cmd to zuinteger_cmd
in GDB. After this patch, there are still some zinteger_cmd,
and I need more thought on them, so I push the 'obvious' bits
out first.
Regression tested on x86_64-linux. Note that some commands can
be changed to boolean or enum commands, for example 'stop_on_solib_events'
can be changed to boolean, while "annotation" can be changed to enum
command. However, I keep them as integer command to avoid breaking
the compatibility.
gdb:
2012-08-03 Yao Qi <yao@codesourcery.com>
* complaints.c (stop_whining): Add 'unsigned'.
(_initialize_complaints): Call add_setshow_zuinteger_cmd instead
for command "complaints".
* ser-go32.c (struct dos_ttystate): Change fields 'base' and
'irq' from int to unsigned int.
(_initialize_ser_dos): Call add_setshow_zuinteger_cmd instead.
* stack.c (annotation_level): Add 'unsigned'.
* defs.h: Update declaration.
* top.c (init_main): Call add_setshow_zuinteger_cmd instead
for command "annotation".
* dwarf2read.c (dwarf2_max_cache_age): Add 'unsigned'.
(_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd
for command "max-cache-age".
* inferior.h: Update the declaration of 'stop_on_solib_events'.
* infrun.c (stop_on_solib_events): Add 'unsigned'.
(_initialize_infrun): Call add_setshow_zuinteger_cmd for
command "stop-on-solib-events".
* remote-mips.c (monitor_warnings): Add 'unsigned'.
(_initialize_remote_mips): Call add_setshow_zuinteger_cmd for
command "monitor-warnings".
---
gdb/complaints.c | 10 ++++----
gdb/defs.h | 2 +-
gdb/dwarf2read.c | 14 ++++++------
gdb/inferior.h | 2 +-
gdb/infrun.c | 10 ++++----
gdb/remote-mips.c | 12 +++++-----
gdb/ser-go32.c | 62 ++++++++++++++++++++++++++--------------------------
gdb/stack.c | 2 +-
gdb/top.c | 8 +++---
9 files changed, 61 insertions(+), 61 deletions(-)
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 4df36ad..3f0f227 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -159,7 +159,7 @@ find_complaint (struct complaints *complaints, const char *file,
before we stop whining about it? Default is no whining at all,
since so many systems have ill-constructed symbol files. */
-static int stop_whining = 0;
+static unsigned int stop_whining = 0;
/* Print a complaint, and link the complaint block into a chain for
later handling. */
@@ -325,10 +325,10 @@ complaints_show_value (struct ui_file *file, int from_tty,
void
_initialize_complaints (void)
{
- add_setshow_zinteger_cmd ("complaints", class_support,
- &stop_whining, _("\
+ add_setshow_zuinteger_cmd ("complaints", class_support,
+ &stop_whining, _("\
Set max number of complaints about incorrect symbols."), _("\
Show max number of complaints about incorrect symbols."), NULL,
- NULL, complaints_show_value,
- &setlist, &showlist);
+ NULL, complaints_show_value,
+ &setlist, &showlist);
}
diff --git a/gdb/defs.h b/gdb/defs.h
index 7be99a2..1b231ca 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -272,7 +272,7 @@ extern char *relocate_gdb_directory (const char *initial, int flag);
/* Annotation stuff. */
-extern int annotation_level; /* in stack.c */
+extern unsigned int annotation_level; /* in stack.c */
/* From regex.c or libc. BSD 4.4 declares this with the argument type as
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 04c6ed0..0e35f8a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1085,7 +1085,7 @@ static struct dwarf2_queue_item *dwarf2_queue, *dwarf2_queue_tail;
compilation units. Set this to zero to disable caching. Cache
sizes of up to at least twenty will improve startup time for
typical inter-CU-reference binaries, at an obvious memory cost. */
-static int dwarf2_max_cache_age = 5;
+static unsigned int dwarf2_max_cache_age = 5;
static void
show_dwarf2_max_cache_age (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -19607,17 +19607,17 @@ Show DWARF 2 variables such as the cache size"),
&show_dwarf2_cmdlist, "maintenance show dwarf2 ",
0/*allow-unknown*/, &maintenance_show_cmdlist);
- add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
- &dwarf2_max_cache_age, _("\
+ add_setshow_zuinteger_cmd ("max-cache-age", class_obscure,
+ &dwarf2_max_cache_age, _("\
Set the upper bound on the age of cached dwarf2 compilation units."), _("\
Show the upper bound on the age of cached dwarf2 compilation units."), _("\
A higher limit means that cached compilation units will be stored\n\
in memory longer, and more total memory will be used. Zero disables\n\
caching, which can slow down startup."),
- NULL,
- show_dwarf2_max_cache_age,
- &set_dwarf2_cmdlist,
- &show_dwarf2_cmdlist);
+ NULL,
+ show_dwarf2_max_cache_age,
+ &set_dwarf2_cmdlist,
+ &show_dwarf2_cmdlist);
add_setshow_boolean_cmd ("always-disassemble", class_obscure,
&dwarf2_always_disassemble, _("\
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 86402f1..1db2d29 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -203,7 +203,7 @@ extern char *construct_inferior_arguments (int, char **);
extern unsigned int debug_infrun;
-extern int stop_on_solib_events;
+extern unsigned int stop_on_solib_events;
extern void start_remote (int from_tty);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index cf6c062..8eb8521 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -360,7 +360,7 @@ static struct symbol *step_start_function;
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
-int stop_on_solib_events;
+unsigned int stop_on_solib_events;
static void
show_stop_on_solib_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -7201,16 +7201,16 @@ leave it stopped or free to run as needed."),
/* Update cached state. */
signal_cache_update (-1);
- add_setshow_zinteger_cmd ("stop-on-solib-events", class_support,
+ add_setshow_zuinteger_cmd ("stop-on-solib-events", class_support,
&stop_on_solib_events, _("\
Set stopping for shared library events."), _("\
Show stopping for shared library events."), _("\
If nonzero, gdb will give control to the user when the dynamic linker\n\
notifies gdb of shared library events. The most common event of interest\n\
to the user would be loading/unloading of a new library."),
- NULL,
- show_stop_on_solib_events,
- &setlist, &showlist);
+ NULL,
+ show_stop_on_solib_events,
+ &setlist, &showlist);
add_setshow_enum_cmd ("follow-fork-mode", class_run,
follow_fork_mode_kind_names,
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index db4381b..0b70dd0 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -454,7 +454,7 @@ struct lsi_error lsi_error_table[] =
/* Set to 1 with the 'set monitor-warnings' command to enable printing
of warnings returned by PMON when hardware breakpoints are used. */
-static int monitor_warnings;
+static unsigned int monitor_warnings;
/* This is the ptid we use while we're connected to the remote. Its
value is arbitrary, as the remote-mips target doesn't have a notion of
@@ -3719,14 +3719,14 @@ Show the prompt that GDB expects from the monitor."), NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("monitor-warnings", class_obscure,
- &monitor_warnings, _("\
+ add_setshow_zuinteger_cmd ("monitor-warnings", class_obscure,
+ &monitor_warnings, _("\
Set printing of monitor warnings."), _("\
Show printing of monitor warnings."), _("\
When enabled, monitor warnings about hardware breakpoints will be displayed."),
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
add_com ("pmon", class_obscure, pmon_command,
_("Send a packet to PMON (must be in debug mode)."));
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 73f69c5..0c13d20 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -192,8 +192,8 @@ intrupts[NINTR];
static struct dos_ttystate
{
- int base;
- int irq;
+ unsigned int base;
+ unsigned int irq;
int refcnt;
struct intrupt *intrupt;
int fifo;
@@ -925,61 +925,61 @@ _initialize_ser_dos (void)
intrupts[1].inuse = /* keyboard */
intrupts[2].inuse = 1; /* slave icu */
- add_setshow_zinteger_cmd ("com1base", class_obscure, &ports[0].base, _("\
+ add_setshow_zuinteger_cmd ("com1base", class_obscure, &ports[0].base, _("\
Set COM1 base i/o port address."), _("\
Show COM1 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com1irq", class_obscure, &ports[0].irq, _("\
+ add_setshow_zuinteger_cmd ("com1irq", class_obscure, &ports[0].irq, _("\
Set COM1 interrupt request."), _("\
Show COM1 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com2base", class_obscure, &ports[1].base, _("\
+ add_setshow_zuinteger_cmd ("com2base", class_obscure, &ports[1].base, _("\
Set COM2 base i/o port address."), _("\
Show COM2 base i/o port address."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com2irq", class_obscure, &ports[1].irq, _("\
+ add_setshow_zuinteger_cmd ("com2irq", class_obscure, &ports[1].irq, _("\
Set COM2 interrupt request."), _("\
Show COM2 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com3base", class_obscure, &ports[2].base, _("\
+ add_setshow_zuinteger_cmd ("com3base", class_obscure, &ports[2].base, _("\
Set COM3 base i/o port address."), _("\
Show COM3 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com3irq", class_obscure, &ports[2].irq, _("\
+ add_setshow_zuinteger_cmd ("com3irq", class_obscure, &ports[2].irq, _("\
Set COM3 interrupt request."), _("\
Show COM3 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com4base", class_obscure, &ports[3].base, _("\
+ add_setshow_zuinteger_cmd ("com4base", class_obscure, &ports[3].base, _("\
Set COM4 base i/o port address."), _("\
Show COM4 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
- add_setshow_zinteger_cmd ("com4irq", class_obscure, &ports[3].irq, _("\
+ add_setshow_zuinteger_cmd ("com4irq", class_obscure, &ports[3].irq, _("\
Set COM4 interrupt request."), _("\
Show COM4 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
- &setlist, &showlist);
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setlist, &showlist);
add_info ("serial", dos_info,
_("Print DOS serial port status."));
diff --git a/gdb/stack.c b/gdb/stack.c
index 51747ea..4ccf73e 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -107,7 +107,7 @@ static void set_last_displayed_sal (int valid,
parse. Two means print similar annotations, but in many more
cases and in a slightly different syntax. */
-int annotation_level = 0;
+unsigned int annotation_level = 0;
/* These variables hold the last symtab and line we displayed to the user.
* This is where we insert a breakpoint or a skiplist entry by default. */
diff --git a/gdb/top.c b/gdb/top.c
index 213c68c..cb30c8b 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1653,14 +1653,14 @@ Show whether to confirm potentially dangerous operations."), NULL,
show_confirm,
&setlist, &showlist);
- add_setshow_zinteger_cmd ("annotate", class_obscure, &annotation_level, _("\
+ add_setshow_zuinteger_cmd ("annotate", class_obscure, &annotation_level, _("\
Set annotation_level."), _("\
Show annotation_level."), _("\
0 == normal; 1 == fullname (for use when running under emacs)\n\
2 == output annotated suitably for use by programs that control GDB."),
- NULL,
- show_annotation_level,
- &setlist, &showlist);
+ NULL,
+ show_annotation_level,
+ &setlist, &showlist);
add_setshow_boolean_cmd ("exec-done-display", class_support,
&exec_done_display_p, _("\
--
1.7.7.6