From: Doug Evans Date: Fri, 8 Nov 2013 19:47:08 +0000 (-0800) Subject: Change "set debug dwarf2-read" to take a verbosity level. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73be47f57c32f50d4695a4b672af9263b5313cbb;p=binutils-gdb.git Change "set debug dwarf2-read" to take a verbosity level. * 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". --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 22de9aaf5d8..79abe3ddc58 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-11-08 Doug Evans + + * 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. + 2013-11-08 Tom Tromey * configure: Rebuild. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8b1fee456d3..2de1dc9496c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2013-11-08 Doug Evans + + * gdb.texinfo (Debugging Output): Update text for + "set debug dwarf2-read". + 2013-11-08 Doug Evans * gdb.texinfo (Debugging Output): Update text for diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5059243a330..16671cbf2d8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22609,7 +22609,9 @@ Show the current state of DWARF2 DIE debugging. @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 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index bc8e8ca6966..7e87ed9adde 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -79,9 +79,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; @@ -4606,7 +4607,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, } *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)); @@ -7285,6 +7286,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) @@ -7293,12 +7295,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) @@ -7306,7 +7315,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); } @@ -22382,11 +22391,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);