public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA, doc RFA] Add verbose level to "set debug dwarf2-read".
@ 2013-09-23 21:57 Doug Evans
  2013-09-24  5:15 ` Eli Zaretskii
  2013-09-30 18:55 ` Doug Evans
  0 siblings, 2 replies; 4+ messages in thread
From: Doug Evans @ 2013-09-23 21:57 UTC (permalink / raw)
  To: gdb-patches, eliz

Hi.

The output produced by "set debug dwarf2-read on" has too low an S/N ratio
when debugging programs compiled with -fdebug-types-section.
There can be 100s of type units in the file and one line of output
for each of these TUs can make the other 10 lines of output disappear
into the noise.

This patch changes "set debug dwarf2-read on|off" to
"set debug dwarf2-read 0|1|2".
TUs are now only printed if "set debug dwarf2-read 2".

Ok to check in?

2013-09-23  Doug Evans  <dje@google.com>

	* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
	(create_debug_types_hash_table): Only print debugging messages for
	each TU if dwarf2-read >= 2.
	(process_queue): Ditto.
	(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
	Update doc string.

	doc/
	* gdb.texinfo (Debugging Output): Update text for
	"set debug dwarf2-read".

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.833
diff -u -p -r1.833 dwarf2read.c
--- dwarf2read.c	17 Sep 2013 22:12:55 -0000	1.833
+++ dwarf2read.c	23 Sep 2013 21:42:16 -0000
@@ -78,9 +78,10 @@
 typedef struct symbol *symbolp;
 DEF_VEC_P (symbolp);
 
-/* When non-zero, print basic high level tracing messages.
+/* When == 1, print basic high level tracing messages.
+   When > 1, be more verbose.
    This is in contrast to the low level DIE reading of dwarf2_die_debug.  */
-static int dwarf2_read_debug = 0;
+static unsigned int dwarf2_read_debug = 0;
 
 /* When non-zero, dump DIEs after they are read in.  */
 static unsigned int dwarf2_die_debug = 0;
@@ -4354,7 +4355,7 @@ create_debug_types_hash_table (struct dw
 	    }
 	  *slot = dwo_file ? (void *) dwo_tu : (void *) sig_type;
 
-	  if (dwarf2_read_debug)
+	  if (dwarf2_read_debug > 1)
 	    fprintf_unfiltered (gdb_stdlog, "  offset 0x%x, signature %s\n",
 				offset.sect_off,
 				hex_string (signature));
@@ -7023,6 +7024,7 @@ process_queue (void)
 	  : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
 	{
 	  struct dwarf2_per_cu_data *per_cu = item->per_cu;
+	  unsigned int debug_print_threshold;
 	  char buf[100];
 
 	  if (per_cu->is_debug_types)
@@ -7031,12 +7033,19 @@ process_queue (void)
 		(struct signatured_type *) per_cu;
 
 	      sprintf (buf, "TU %s at offset 0x%x",
-		       hex_string (sig_type->signature), per_cu->offset.sect_off);
+		       hex_string (sig_type->signature),
+		       per_cu->offset.sect_off);
+	      /* There can be 100s of TUs.
+		 Only print them in verbose mode.  */
+	      debug_print_threshold = 2;
 	    }
 	  else
-	    sprintf (buf, "CU at offset 0x%x", per_cu->offset.sect_off);
+	    {
+	      sprintf (buf, "CU at offset 0x%x", per_cu->offset.sect_off);
+	      debug_print_threshold = 1;
+	    }
 
-	  if (dwarf2_read_debug)
+	  if (dwarf2_read_debug >= debug_print_threshold)
 	    fprintf_unfiltered (gdb_stdlog, "Expanding symtab of %s\n", buf);
 
 	  if (per_cu->is_debug_types)
@@ -7044,7 +7053,7 @@ process_queue (void)
 	  else
 	    process_full_comp_unit (per_cu, item->pretend_language);
 
-	  if (dwarf2_read_debug)
+	  if (dwarf2_read_debug >= debug_print_threshold)
 	    fprintf_unfiltered (gdb_stdlog, "Done expanding %s\n", buf);
 	}
 
@@ -21616,11 +21625,12 @@ conversational style, when possible."),
 			   &set_dwarf2_cmdlist,
 			   &show_dwarf2_cmdlist);
 
-  add_setshow_boolean_cmd ("dwarf2-read", no_class, &dwarf2_read_debug, _("\
+  add_setshow_zuinteger_cmd ("dwarf2-read", no_class, &dwarf2_read_debug, _("\
 Set debugging of the dwarf2 reader."), _("\
 Show debugging of the dwarf2 reader."), _("\
-When enabled, debugging messages are printed during dwarf2 reading\n\
-and symtab expansion."),
+When enabled (non-zero), debugging messages are printed during dwarf2\n\
+reading and symtab expansion.  A value of 1 (one) provides basic\n\
+information.  A value greater than 1 provides more verbose information."),
 			    NULL,
 			    NULL,
 			    &setdebuglist, &showdebuglist);
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.1112
diff -u -p -r1.1112 gdb.texinfo
--- doc/gdb.texinfo	16 Sep 2013 18:00:34 -0000	1.1112
+++ doc/gdb.texinfo	23 Sep 2013 21:42:16 -0000
@@ -22460,7 +22460,9 @@ Show the current state of DWARF2 DIE deb
 @item set debug dwarf2-read
 @cindex DWARF2 Reading
 Turns on or off display of debugging messages related to reading
-DWARF debug info.  The default is off.
+DWARF debug info.  The default is 0 (off).
+A value of 1 provides basic information.
+A value greater than 1 provides more verbose information.
 @item show debug dwarf2-read
 Show the current state of DWARF2 reader debugging.
 @item set debug displaced

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

end of thread, other threads:[~2013-10-01 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-23 21:57 [RFA, doc RFA] Add verbose level to "set debug dwarf2-read" Doug Evans
2013-09-24  5:15 ` Eli Zaretskii
2013-09-30 18:55 ` Doug Evans
2013-10-01 15:04   ` Tom Tromey

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).