public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix for 'too much spew with "set verbose on"'
@ 2010-07-30 16:25 Paul Pluzhnikov
  2010-07-30 18:24 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Pluzhnikov @ 2010-07-30 16:25 UTC (permalink / raw)
  To: gdb; +Cc: Roland McGrath, Paul Pluzhnikov

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

In http://www.cygwin.com/ml/archer/2010-q2/msg00054.html, Roland complained:

  "I do like to know what gdb is doing.  But this has gotten out of hand.
  Does it really need to be saying all this, and the same things so many times?"

Here is a proposed fix (moving spewage under "maint set
show-libthread-db-processing" subcommand).

Thanks,
-- 
Paul Pluzhnikov


2010-07-30  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* linux-thread-db.c (maint_show_libthreaddb_processing): New variable.
	(thread_db_find_new_threads_silently): Control verbosity with it.
	(try_thread_db_load_1, try_thread_db_load): Likewise.
	(find_new_threads_once): Likewise.
	(_initialize_thread_db): Set/show it.

doc/ChangeLog:

	* gdb.texinfo (Threads): Document show-libthread-db-processing.

[-- Attachment #2: gdb-libthreaddb-20100730.txt --]
[-- Type: text/plain, Size: 3973 bytes --]

Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.75
diff -u -p -u -r1.75 linux-thread-db.c
--- linux-thread-db.c	11 Jun 2010 12:10:12 -0000	1.75
+++ linux-thread-db.c	30 Jul 2010 16:02:59 -0000
@@ -75,6 +75,10 @@
 
 static char *libthread_db_search_path;
 
+/* If non-zero, print details of libthread_db processing.  */
+
+static int maint_show_libthreaddb_processing;
+
 /* If we're running on GNU/Linux, we must explicitly attach to any new
    threads.  */
 
@@ -601,7 +605,7 @@ thread_db_find_new_threads_silently (pti
       thread_db_find_new_threads_2 (ptid, 1);
     }
 
-  if (except.reason < 0 && info_verbose)
+  if (except.reason < 0 && maint_show_libthreaddb_processing)
     {
       exception_fprintf (gdb_stderr, except,
 			 "Warning: thread_db_find_new_threads_silently: ");
@@ -658,7 +662,7 @@ try_thread_db_load_1 (struct thread_db_i
   err = info->td_ta_new_p (&info->proc_handle, &info->thread_agent);
   if (err != TD_OK)
     {
-      if (info_verbose)
+      if (maint_show_libthreaddb_processing)
 	printf_unfiltered (_("td_ta_new failed: %s\n"),
 			   thread_db_err_str (err));
       else
@@ -708,7 +712,7 @@ try_thread_db_load_1 (struct thread_db_i
 
   printf_unfiltered (_("[Thread debugging using libthread_db enabled]\n"));
 
-  if (info_verbose || *libthread_db_search_path)
+  if (maint_show_libthreaddb_processing || *libthread_db_search_path)
     {
       const char *library;
 
@@ -745,18 +749,18 @@ try_thread_db_load (const char *library)
   void *handle;
   struct thread_db_info *info;
 
-  if (info_verbose)
+  if (maint_show_libthreaddb_processing)
     printf_unfiltered (_("Trying host libthread_db library: %s.\n"),
                        library);
   handle = dlopen (library, RTLD_NOW);
   if (handle == NULL)
     {
-      if (info_verbose)
+      if (maint_show_libthreaddb_processing)
 	printf_unfiltered (_("dlopen failed: %s.\n"), dlerror ());
       return 0;
     }
 
-  if (info_verbose && strchr (library, '/') == NULL)
+  if (maint_show_libthreaddb_processing && strchr (library, '/') == NULL)
     {
       void *td_init;
 
@@ -1381,7 +1385,7 @@ find_new_threads_once (struct thread_db_
 				    TD_THR_ANY_USER_FLAGS);
     }
 
-  if (info_verbose)
+  if (maint_show_libthreaddb_processing)
     {
       if (except.reason < 0)
 	exception_fprintf (gdb_stderr, except,
@@ -1685,6 +1689,17 @@ gdb itself."),
 			    NULL,
 			    NULL,
 			    &setlist, &showlist);
+
+  add_setshow_boolean_cmd ("show-libthreaddb-processing", class_maintenance,
+			   &maint_show_libthreaddb_processing, _("\
+Set whether to show processing of libthread_db."), _("\
+Show whether to show processing of libthread_db."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, GDB will print details of libthread_db processing."),
+			   NULL,
+			   NULL,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
   /* Add ourselves to objfile event chain.  */
   observer_attach_new_objfile (thread_db_new_objfile);
 }
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.745
diff -u -p -u -r1.745 gdb.texinfo
--- doc/gdb.texinfo	30 Jul 2010 14:32:02 -0000	1.745
+++ doc/gdb.texinfo	30 Jul 2010 16:03:00 -0000
@@ -2864,6 +2864,14 @@ only on some platforms.
 @kindex show libthread-db-search-path 
 @item show libthread-db-search-path 
 Display current libthread_db search path.
+
+@kindex maint set show-libthread-db-processing
+@kindex maint show show-libthread-db-processing
+@cindex processing @code{libthread_db}
+@item maint set show-libthread-db-processing
+@itemx maint show show-libthread-db-processing
+Control whether to show various internal events while searching for and
+using @code{libthread_db}.  Use @code{ON} to enable, @code{OFF} to disable.
 @end table
 
 @node Forks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Fix for 'too much spew with "set verbose on"'
  2010-07-30 16:25 [patch] Fix for 'too much spew with "set verbose on"' Paul Pluzhnikov
@ 2010-07-30 18:24 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2010-07-30 18:24 UTC (permalink / raw)
  To: gdb; +Cc: Paul Pluzhnikov, Roland McGrath

On Friday 30 July 2010 17:24:38, Paul Pluzhnikov wrote:
> +  add_setshow_boolean_cmd ("show-libthreaddb-processing", class_maintenance,
> +                          &maint_show_libthreaddb_processing, _("\
> +Set whether to show processing of libthread_db."), _("\
> +Show whether to show processing of libthread_db."), _("\
> +Use \"on\" to enable, \"off\" to disable.\n\
> +If enabled, GDB will print details of libthread_db processing."),
> +                          NULL,
> +                          NULL,

Please implement this callback (it's the `show_func').  That is
a requirement for proper i18n.  At some point (when all commands
have been fixed to implement the callback), there'll be a 
runtime assertion forbiding this field being NULL.  Thanks.

> +                          &maintenance_set_cmdlist,
> +                          &maintenance_show_cmdlist);
>    /* Add ourselves to objfile event chain.  */

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-30 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30 16:25 [patch] Fix for 'too much spew with "set verbose on"' Paul Pluzhnikov
2010-07-30 18:24 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).