Yao Qi | 30 Jul 2012 15:58
Gravatar

[RFC] Register commands using add_setshow_zuinteger_cmd

Hi,
I am examing the usage of zuinteger_cmd and zinteger_cmd today, and I find
that a lot of zinteger_cmd commands should be registered as zuinteger_cmd.
For example, all the debug commands, such as 'set debug infrun 1' should
be registered as 'zuinteger_cmd', because we never do 'set debug FOO -2'.

This patch is not indented to commit anything to CVS, but describe what I
try to do.  If it is the right way to go, I'll convert other zinteger_cmd
to zuinteger_cmd if appropriate.  What do you think?

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* serial.c (global_serial_debug_p): Add 'unsigned'.
	(_initialize_serial): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* target.c (targetdebug): Add 'unsigned'.
	(initialize_targets): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
---
 gdb/serial.c |   12 ++++++------
 gdb/target.c |   10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gdb/serial.c b/gdb/serial.c
index df18b2f..62d7fa9 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
 <at>  <at>  -27,7 +27,7  <at>  <at>  extern void _initialize_serial (void);
(Continue reading)

Tom Tromey | 30 Jul 2012 19:25
Picon
Favicon

Re: [RFC] Register commands using add_setshow_zuinteger_cmd

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> I am examing the usage of zuinteger_cmd and zinteger_cmd today, and I find
Yao> that a lot of zinteger_cmd commands should be registered as zuinteger_cmd.
Yao> For example, all the debug commands, such as 'set debug infrun 1' should
Yao> be registered as 'zuinteger_cmd', because we never do 'set debug FOO -2'.

Yao> This patch is not indented to commit anything to CVS, but describe what I
Yao> try to do.  If it is the right way to go, I'll convert other zinteger_cmd
Yao> to zuinteger_cmd if appropriate.  What do you think?

For 'maint' and 'set debug' settings, I think it is fine.

For other settings, I guess it would depend on the actual benefits of
the change.  It seems unlikely that anybody relies on some of these
things.  But it also doesn't seem to cause much harm.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 0/10] Register debug commands using add_setshow_zuinteger_cmd

On Monday, July 30, 2012 11:25:59 AM Tom Tromey wrote:
> Yao> This patch is not indented to commit anything to CVS, but describe what I
> Yao> try to do.  If it is the right way to go, I'll convert other zinteger_cmd
> Yao> to zuinteger_cmd if appropriate.  What do you think?
> 
> For 'maint' and 'set debug' settings, I think it is fine.

This patch set converts debug/maint commands registration from add_setshow_zinteger_cmd
to add_setshow_zuinteger_cmd, and change debug flag from 'int' to 'unsigned int'.
Note that 'add_setshow_zinteger_cmd' is overused (or abused), and this patch series fix
it to some extent.  After this patch, there are still some places use
add_setshow_zinteger_cmd improperly, such as ser-go32.c:_initialize_ser_dos.

Rebuild on x86-linux with --enable-targets=all.  Regression tested on x86_64-linux.

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 02/10] gdbarch_debug

It is similar to other patches except that this patch also removes the
declaration of 'gdbarch_debug', because it is declared in gdbarch.h.

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* arch-utils.h: Remove the declaration of 'gdbarch_debug'.
	* gdbarch.sh (gdbarch_debug): Add 'unsigned'.
	(extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* gdbarch.c, gdbarch.h: Re-generated.

gdbarch

gdb:

2012-07-31  Yao Qi  <yao <at> codesourcery.com>
---
 gdb/arch-utils.h |    3 ---
 gdb/gdbarch.c    |    4 ++--
 gdb/gdbarch.h    |    2 +-
 gdb/gdbarch.sh   |    6 +++---
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index ef4cb26..bed207f 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
 <at>  <at>  -27,9 +27,6  <at>  <at>  struct minimal_symbol;
(Continue reading)

Tom Tromey | 31 Jul 2012 21:36
Picon
Favicon

Re: [PATCH 02/10] gdbarch_debug

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* arch-utils.h: Remove the declaration of 'gdbarch_debug'.
Yao> 	* gdbarch.sh (gdbarch_debug): Add 'unsigned'.
Yao> 	(extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd
Yao> 	instead of add_setshow_zinteger_cmd.
Yao> 	* gdbarch.c, gdbarch.h: Re-generated.

Ok.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 03/10] maint watchdog.

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* defs.h: Update declaration of 'watchdog'.
	* maint.c (watchdog): Add 'unsigned'.
	(_initialize_maint_cmds): Call add_setshow_zuinteger_cmd instead
	of add_setshow_zinteger_cmd.
---
 gdb/defs.h  |    2 +-
 gdb/maint.c |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/defs.h b/gdb/defs.h
index 7be99a2..552fcb5 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
 <at>  <at>  -690,7 +690,7  <at>  <at>  extern void store_typed_address (gdb_byte *buf, struct type *type,
 
 /* From valops.c */

-extern int watchdog;
+extern unsigned int watchdog;

 /* Hooks for alternate command interfaces.  */

diff --git a/gdb/maint.c b/gdb/maint.c
index 6a106fd..06ca2f8 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
(Continue reading)

Tom Tromey | 31 Jul 2012 21:34
Picon
Favicon

Re: [PATCH 03/10] maint watchdog.

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 	* defs.h: Update declaration of 'watchdog'.
Yao> 	* maint.c (watchdog): Add 'unsigned'.
Yao> 	(_initialize_maint_cmds): Call add_setshow_zuinteger_cmd instead
Yao> 	of add_setshow_zinteger_cmd.

I'm not so sure about this one.
It is class_maintenance, but it is not in the "maint" command list.

Yao> +extern unsigned int watchdog;

There is this code in remote.c:

  int timeout;
...
  if (forever)
    timeout = watchdog > 0 ? watchdog : -1;

What if the user-supplied value won't fit into an int?

Tom

Yao Qi | 1 Aug 2012 10:19
Gravatar

Re: [PATCH 03/10] maint watchdog.

On Tuesday, July 31, 2012 01:34:57 PM Tom Tromey wrote:
> I'm not so sure about this one.
> It is class_maintenance, but it is not in the "maint" command list.
> 
> Yao> +extern unsigned int watchdog;
>  
> There is this code in remote.c:
> 
>   int timeout;
> ...
>   if (forever)
>     timeout = watchdog > 0 ? watchdog : -1;
> 
> What if the user-supplied value won't fit into an int?

'timeout' is a signed integer, and -1 means 'wait forever'.  I have to think 
about it again.  Please ignore this patch.

--

-- 
Yao (齐尧)

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 01/10] target independent

gdb:

2012-07-31  Yao Qi  <yao <at> codesourcery.com>

	* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
	(_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* dwarf2loc.h: Update the declaration of 'entry_values_debug'.
	* dwarf2read.c (dwarf2_die_debug): Add 'unsigned'.
	(_initialize_dwarf2_read):
	* frame.c (frame_debug): Add 'unsigned'.
	(_intialize_frame): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* frame.h: Update the declaration of 'frame_debug'.
	* gdbtypes.c (overload_debug): Add 'unsigned'.
	(_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* inferior.h: Update declaration of 'debug_infrun'.
	* infrun.c (debug_infrun): Add 'unsigned'.
	(_initialize_infrun): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* jit.c (jit_debug): Add 'unsigned'.
	(_initialize_jit): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* linux-nat.c (debug_linux_nat): Add 'unsigned'.
	(_initialize_linux_nat): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* linux-thread-db.c (libthread_db_debug): Add 'unsigned'.
	(_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
(Continue reading)

Tom Tromey | 31 Jul 2012 21:49
Picon
Favicon

Re: [PATCH 01/10] target independent

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-31  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
Yao> 	(_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of
[...]

This one is ok.

thanks,
Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 04/10] darwin and machoread

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'.
	(_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* machoread.c (mach_o_debug_level): Add 'unsigned'.
	(_initialize_machoread): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
---
 gdb/darwin-nat.c |   10 +++++-----
 gdb/machoread.c  |   14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 26ee23a..252fe3e 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
 <at>  <at>  -145,7 +145,7  <at>  <at>  static struct inferior *darwin_inf_fake_stop;
 #define PAGE_ROUND(x) PAGE_TRUNC((x) + mach_page_size - 1)

 /* This controls output of inferior debugging.  */
-static int darwin_debug_flag = 0;
+static unsigned int darwin_debug_flag = 0;

 /* Create a __TEXT __info_plist section in the executable so that gdb could
    be signed.  This is required to get an authorization for task_for_pid.
 <at>  <at>  -2057,12 +2057,12  <at>  <at>  _initialize_darwin_inferior (void)
   inferior_debug (2, _("GDB task: 0x%lx, pid: %d\n"), mach_task_self (),
(Continue reading)

Tom Tromey | 31 Jul 2012 21:38
Picon
Favicon

Re: [PATCH 04/10] darwin and machoread

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'.

It seems that inferior_debug should then take an unsigned int as its
first argument.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 05/10] solib-dsbt

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'.
	(_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
---
 gdb/solib-dsbt.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index fcc01a8..3005326 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
 <at>  <at>  -35,7 +35,7  <at>  <at> 
 #define GOT_MODULE_OFFSET 4

 /* Flag which indicates whether internal debug messages should be printed.  */
-static int solib_dsbt_debug = 0;
+static unsigned int solib_dsbt_debug = 0;

 /* TIC6X pointers are four bytes wide.  */
 enum { TIC6X_PTR_SIZE = 4 };
 <at>  <at>  -1184,12 +1184,12  <at>  <at>  _initialize_dsbt_solib (void)
   dsbt_so_ops.bfd_open = solib_bfd_open;

   /* Debug this file's internals.  */
-  add_setshow_zinteger_cmd ("solib-dsbt", class_maintenance,
-			    &solib_dsbt_debug, _("\
(Continue reading)

Tom Tromey | 31 Jul 2012 21:39
Picon
Favicon

Re: [PATCH 05/10] solib-dsbt

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'.
Yao> 	(_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of
Yao> 	add_setshow_zinteger_cmd.

Ok.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 06/10] solib-frv

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* solib-frv.c (solib_frv_debug): Add 'unsigned'.
	(_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
---
 gdb/solib-frv.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 0f59535..57a14a8 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
 <at>  <at>  -34,7 +34,7  <at>  <at> 
 #include "gdb_bfd.h"

 /* Flag which indicates whether internal debug messages should be printed.  */
-static int solib_frv_debug;
+static unsigned int solib_frv_debug;

 /* FR-V pointers are four bytes wide.  */
 enum { FRV_PTR_SIZE = 4 };
 <at>  <at>  -1184,12 +1184,12  <at>  <at>  _initialize_frv_solib (void)
   frv_so_ops.bfd_open = solib_bfd_open;

   /* Debug this file's internals.  */
-  add_setshow_zinteger_cmd ("solib-frv", class_maintenance,
-			    &solib_frv_debug, _("\
(Continue reading)

Tom Tromey | 31 Jul 2012 21:40
Picon
Favicon

Re: [PATCH 06/10] solib-frv

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* solib-frv.c (solib_frv_debug): Add 'unsigned'.
Yao> 	(_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of
Yao> 	add_setshow_zinteger_cmd.

Ok.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 07/10] nto

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* nto-tdep.c (_initialize_nto_tdep;): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* nto-tdep.h (struct nto_target_ops): Add 'unsigned' to field
	'internal_debugging'.
---
 gdb/nto-tdep.c |   12 ++++++------
 gdb/nto-tdep.h |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 5e0c910..951acd3 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
 <at>  <at>  -400,15 +400,15  <at>  <at>  extern initialize_file_ftype _initialize_nto_tdep;
 void
 _initialize_nto_tdep (void)
 {
-  add_setshow_zinteger_cmd ("nto-debug", class_maintenance,
-			    &nto_internal_debugging, _("\
+  add_setshow_zuinteger_cmd ("nto-debug", class_maintenance,
+			     &nto_internal_debugging, _("\
 Set QNX NTO internal debugging."), _("\
 Show QNX NTO internal debugging."), _("\
 When non-zero, nto specific debug info is\n\
 displayed. Different information is displayed\n\
 for different positive values."),
(Continue reading)

Tom Tromey | 31 Jul 2012 21:41
Picon
Favicon

Re: [PATCH 07/10] nto

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* nto-tdep.c (_initialize_nto_tdep;): Call add_setshow_zuinteger_cmd
Yao> 	instead of add_setshow_zinteger_cmd.
Yao> 	* nto-tdep.h (struct nto_target_ops): Add 'unsigned' to field
Yao> 	'internal_debugging'.

Is this setting even used anywhere?
What if we just remove it instead?

Tom

Yao Qi | 1 Aug 2012 09:26
Gravatar

Re: [PATCH 07/10] nto

On Tuesday, July 31, 2012 01:41:53 PM Tom Tromey wrote:
> >>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:
> Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
> Yao>    * nto-tdep.c (_initialize_nto_tdep;): Call add_setshow_zuinteger_cmd
> Yao>    instead of add_setshow_zinteger_cmd.
> Yao>    * nto-tdep.h (struct nto_target_ops): Add 'unsigned' to field
> Yao>    'internal_debugging'.
> 
> Is this setting even used anywhere?

No.

> What if we just remove it instead?

This new version removes 'nto_internal_debugging' and field
'internal_debugging'.  It also removes command 'nto-debug' registration along
with its document.  After this, _initialize_nto_tdep becomes empty, so remove
it.  We don't register any commands in nto-tdep.c, so don't have to include
cli/cli-decode.h and cli/cli-cmds.h anymore.

Rebuild GDB with --enable-targets=all.  This patch is obvious, and I'll commit
it.

--

-- 
Yao (齐尧)

gdb/doc:

2012-08-01  Yao Qi  <yao <at> codesourcery.com>

(Continue reading)

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 08/10] microblaze

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'.
	(_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd
	intead of add_setshow_zinteger_cmd.
---
 gdb/microblaze-tdep.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index ca59213..9658400 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
 <at>  <at>  -79,7 +79,7  <at>  <at>  static const char *microblaze_register_names[] =

 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
 
-static int microblaze_debug_flag = 0;
+static unsigned int microblaze_debug_flag = 0;

 static void
 microblaze_debug (const char *fmt, ...)
 <at>  <at>  -739,13 +739,13  <at>  <at>  _initialize_microblaze_tdep (void)
   register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);

   /* Debug this files internals.  */
-  add_setshow_zinteger_cmd ("microblaze", class_maintenance,
-			    &microblaze_debug_flag, _("\
(Continue reading)

Michael Eager | 31 Jul 2012 16:44

Re: [PATCH 08/10] microblaze

On 07/31/2012 03:50 AM, Yao Qi wrote:
> gdb:
>
> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
>
> 	* microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'.
> 	(_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd
> 	intead of add_setshow_zinteger_cmd.
> ---
>   gdb/microblaze-tdep.c |   12 ++++++------
>   1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
> index ca59213..9658400 100644
> --- a/gdb/microblaze-tdep.c
> +++ b/gdb/microblaze-tdep.c
>  <at>  <at>  -79,7 +79,7  <at>  <at>  static const char *microblaze_register_names[] =
>
>   #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
>   
> -static int microblaze_debug_flag = 0;
> +static unsigned int microblaze_debug_flag = 0;
>
>   static void
>   microblaze_debug (const char *fmt, ...)
>  <at>  <at>  -739,13 +739,13  <at>  <at>  _initialize_microblaze_tdep (void)
>     register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
>
>     /* Debug this files internals.  */
> -  add_setshow_zinteger_cmd ("microblaze", class_maintenance,
(Continue reading)

Tom Tromey | 31 Jul 2012 21:42
Picon
Favicon

Re: [PATCH 08/10] microblaze

Michael> Please remove extraneous whitespace changes at the end of the patch.

The code there has to be reindented due to the main part of the patch.
Otherwise the function arguments don't line up according to the coding
standards.

Tom

Yao Qi | 1 Aug 2012 08:42
Gravatar

Re: [PATCH 08/10] microblaze

On Tuesday, July 31, 2012 07:44:37 AM Michael Eager wrote:
> >     /* Debug this files internals.  */
> >
> > -  add_setshow_zinteger_cmd ("microblaze", class_maintenance,
> > -                         &microblaze_debug_flag, _("\
> > +  add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
> > +                          &microblaze_debug_flag, _("\
> >
> >   Set microblaze debugging."), _("\
> >   Show microblaze debugging."), _("\
> >   When non-zero, microblaze specific debugging is enabled."),
> >
> > -                         NULL,
> > -                         NULL,
> > -                         &setdebuglist, &showdebuglist);
> > +                          NULL,
> > +                          NULL,
> > +                          &setdebuglist, &showdebuglist);
> >
> >   }
> 
> Why is this needed?

Because debug flag should be 'unsigned' and 'add_setshow_zinteger_cmd' has 
been a little bit abused in GDB.  This patch tries to fix it.

--

-- 
Yao (齐尧)

(Continue reading)

Michael Eager | 6 Aug 2012 17:01

Re: [PATCH 08/10] microblaze

On 07/31/2012 11:42 PM, Yao Qi wrote:
> On Tuesday, July 31, 2012 07:44:37 AM Michael Eager wrote:
>>>      /* Debug this files internals.  */
>>>
>>> -  add_setshow_zinteger_cmd ("microblaze", class_maintenance,
>>> -                         &microblaze_debug_flag, _("\
>>> +  add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
>>> +                          &microblaze_debug_flag, _("\
>>>
>>>    Set microblaze debugging."), _("\
>>>    Show microblaze debugging."), _("\
>>>    When non-zero, microblaze specific debugging is enabled."),
>>>
>>> -                         NULL,
>>> -                         NULL,
>>> -                         &setdebuglist, &showdebuglist);
>>> +                          NULL,
>>> +                          NULL,
>>> +                          &setdebuglist, &showdebuglist);
>>>
>>>    }
>>
>> Why is this needed?
>
> Because debug flag should be 'unsigned' and 'add_setshow_zinteger_cmd' has
> been a little bit abused in GDB.  This patch tries to fix it.

This doesn't appear to me to be a necessary change.   The debugging command
works exactly as described.

(Continue reading)

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 09/10] mips

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* mips-tdep.c (mips_debug): Add 'unsigned'.
	(_initialize_mips_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
---
 gdb/mips-tdep.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 0439989..a001424 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
 <at>  <at>  -177,7 +177,7  <at>  <at>  const struct register_alias mips_numeric_register_aliases[] = {
 static int mips_fpu_type_auto = 1;
 static enum mips_fpu_type mips_fpu_type = MIPS_DEFAULT_FPU_TYPE;

-static int mips_debug = 0;
+static unsigned int mips_debug = 0;

 /* Properties (for struct target_desc) describing the g/G packet
    layout.  */
 <at>  <at>  -8879,13 +8879,13  <at>  <at>  that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\
 			   &setlist, &showlist);

   /* Debug this files internals.  */
-  add_setshow_zinteger_cmd ("mips", class_maintenance,
-			    &mips_debug, _("\
(Continue reading)

Tom Tromey | 31 Jul 2012 21:43
Picon
Favicon

Re: [PATCH 09/10] mips

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* mips-tdep.c (mips_debug): Add 'unsigned'.
Yao> 	(_initialize_mips_tdep): Call add_setshow_zuinteger_cmd
Yao> 	instead of add_setshow_zinteger_cmd.

Ok.

Tom

Yao Qi | 31 Jul 2012 12:50
Gravatar

[PATCH 10/10] xtensa

gdb:

2012-07-30  Yao Qi  <yao <at> codesourcery.com>

	* xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'.
	(_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
---
 gdb/xtensa-tdep.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index b2a0617..119dc6f 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
 <at>  <at>  -55,7 +55,7  <at>  <at> 
 #include "xtensa-config.h"

 
-static int xtensa_debug_level = 0;
+static unsigned int xtensa_debug_level = 0;

 #define DEBUGWARN(args...) \
   if (xtensa_debug_level > 0) \
 <at>  <at>  -3308,14 +3308,14  <at>  <at>  _initialize_xtensa_tdep (void)
   gdbarch_register (bfd_arch_xtensa, xtensa_gdbarch_init, xtensa_dump_tdep);
   xtensa_init_reggroups ();

-  add_setshow_zinteger_cmd ("xtensa",
-			    class_maintenance,
(Continue reading)

Tom Tromey | 31 Jul 2012 21:43
Picon
Favicon

Re: [PATCH 10/10] xtensa

>>>>> "Yao" == Yao Qi <yao <at> codesourcery.com> writes:

Yao> 2012-07-30  Yao Qi  <yao <at> codesourcery.com>
Yao> 	* xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'.
Yao> 	(_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd
Yao> 	instead of add_setshow_zinteger_cmd.

Okk.

Tom


Gmane