This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA, doc RFA] Change "set debug symtab-create" to accept verbosity levels
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org, eliz at gnu dot org
- Date: Fri, 27 Sep 2013 16:37:46 -0700
- Subject: [RFA, doc RFA] Change "set debug symtab-create" to accept verbosity levels
- Authentication-results: sourceware.org; auth=none
Hi.
The output of "set debug symtab-create 1" is too verbose for my tastes.
Including every header in the output reduces the S/N ratio too much.
This patch changes "set debug symtab-create" to accept a verbosity level.
Regression tested on amd64-linux.
Ok to check in?
2013-09-27 Doug Evans <dje@google.com>
* NEWS: Mention that "set debug symtab-create" now accepts a
verbosity level.
* buildsym.c (end_symtab_from_static_block): Call set_symtab_primary
to set the symtab's primary flag.
* jit.c (finalize_symtab): Ditto.
* mdebugread.c (psymtab_to_symtab_1): Ditto.
* symfile.c (allocate_symtab): Only print debugging messages for
symtab_create_debug levels 2 and higher.
* symtab.c (symtab_create_debug): Change type to unsigned int.
(set_symtab_primary): New function.
(_initialize_symtab): Change "set debug symtab-create" to a
zuinteger option.
* symtab.h (set_symtab_primary): Declare.
(symtab_create_debug): Update decl.
doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug symtab-create".
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.616
diff -u -p -r1.616 NEWS
--- NEWS 25 Sep 2013 23:17:11 -0000 1.616
+++ NEWS 27 Sep 2013 23:23:52 -0000
@@ -87,6 +87,10 @@ show range-stepping
trace-buffer-size -1" and "set height unlimited" is now an alias for
"set height 0".
+* The "set debug symtab-create" debugging option of GDB has been changed to
+ accept a verbosity level. 0 means "off", 1 provides basic debugging
+ output, and values of 2 or greater provides more verbose output.
+
* New command-line options
--configuration
Display the details of GDB configure-time options.
Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.110
diff -u -p -r1.110 buildsym.c
--- buildsym.c 25 Sep 2013 22:24:05 -0000 1.110
+++ buildsym.c 27 Sep 2013 23:23:52 -0000
@@ -1231,8 +1231,7 @@ end_symtab_from_static_block (struct blo
/* All symtabs for the main file and the subfiles share a
blockvector, so we need to clear primary for everything
but the main file. */
-
- symtab->primary = 0;
+ set_symtab_primary (symtab, 0);
}
else
{
@@ -1280,7 +1279,7 @@ end_symtab_from_static_block (struct blo
/* Set this for the main source file. */
if (symtab)
{
- symtab->primary = 1;
+ set_symtab_primary (symtab, 1);
if (symtab->blockvector)
{
Index: jit.c
===================================================================
RCS file: /cvs/src/src/gdb/jit.c,v
retrieving revision 1.56
diff -u -p -r1.56 jit.c
--- jit.c 24 Sep 2013 14:00:06 -0000 1.56
+++ jit.c 27 Sep 2013 23:23:52 -0000
@@ -665,7 +665,7 @@ finalize_symtab (struct gdb_symtab *stab
/* (begin, end) will contain the PC range this entire blockvector
spans. */
- symtab->primary = 1;
+ set_symtab_primary (symtab, 1);
BLOCKVECTOR_MAP (symtab->blockvector) = NULL;
begin = stab->blocks->begin;
end = stab->blocks->end;
Index: mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.143
diff -u -p -r1.143 mdebugread.c
--- mdebugread.c 8 Apr 2013 20:13:21 -0000 1.143
+++ mdebugread.c 27 Sep 2013 23:23:52 -0000
@@ -4334,7 +4334,7 @@ psymtab_to_symtab_1 (struct objfile *obj
}
pop_parse_stack ();
- st->primary = 1;
+ set_symtab_primary (st, 1);
sort_blocks (st);
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.395
diff -u -p -r1.395 symfile.c
--- symfile.c 25 Sep 2013 23:17:12 -0000 1.395
+++ symfile.c 27 Sep 2013 23:23:52 -0000
@@ -2816,7 +2816,9 @@ allocate_symtab (const char *filename, s
symtab->next = objfile->symtabs;
objfile->symtabs = symtab;
- if (symtab_create_debug)
+ /* This can be very verbose with lots of headers.
+ Only print at higher debug levels. */
+ if (symtab_create_debug >= 2)
{
/* Be a bit clever with debugging messages, and don't print objfile
every time, only when it changes. */
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.368
diff -u -p -r1.368 symtab.c
--- symtab.c 25 Sep 2013 21:51:27 -0000 1.368
+++ symtab.c 27 Sep 2013 23:23:52 -0000
@@ -106,7 +106,7 @@ void _initialize_symtab (void);
/* */
/* When non-zero, print debugging messages related to symtab creation. */
-int symtab_create_debug = 0;
+unsigned int symtab_create_debug = 0;
/* Non-zero if a file may be known by two different basenames.
This is the uncommon case, and significantly slows down gdb.
@@ -174,6 +174,22 @@ search_domain_name (enum search_domain e
}
}
+/* Set the primary field in SYMTAB. */
+
+void
+set_symtab_primary (struct symtab *symtab, int primary)
+{
+ symtab->primary = primary;
+
+ if (symtab_create_debug && primary)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "Created primary symtab %s for %s.\n",
+ host_address_to_string (symtab),
+ symtab_to_filename_for_display (symtab));
+ }
+}
+
/* See whether FILENAME matches SEARCH_NAME using the rule that we
advertise to the user. (The manual's description of linespecs
describes what we advertise). Returns true if they match, false
@@ -5285,13 +5301,15 @@ one base name, and gdb will do file name
NULL, NULL,
&setlist, &showlist);
- add_setshow_boolean_cmd ("symtab-create", no_class, &symtab_create_debug,
- _("Set debugging of symbol table creation."),
- _("Show debugging of symbol table creation."), _("\
-When enabled, debugging messages are printed when building symbol tables."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("symtab-create", no_class, &symtab_create_debug,
+ _("Set debugging of symbol table creation."),
+ _("Show debugging of symbol table creation."), _("\
+When enabled (non-zero), debugging messages are printed when building\n\
+symbol tables. A value of 1 (one) normally provides enough information.\n\
+A value greater than 1 provides more verbose information."),
+ NULL,
+ NULL,
+ &setdebuglist, &showdebuglist);
observer_attach_executable_changed (symtab_observer_executable_changed);
}
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.240
diff -u -p -r1.240 symtab.h
--- symtab.h 25 Sep 2013 21:51:27 -0000 1.240
+++ symtab.h 27 Sep 2013 23:23:52 -0000
@@ -941,6 +941,9 @@ struct symtab
#define LINETABLE(symtab) (symtab)->linetable
#define SYMTAB_PSPACE(symtab) (symtab)->objfile->pspace
+/* Call this to set the "primary" field in struct symtab. */
+extern void set_symtab_primary (struct symtab *, int primary);
+
typedef struct symtab *symtab_ptr;
DEF_VEC_P (symtab_ptr);
@@ -1335,7 +1338,7 @@ void fixup_section (struct general_symbo
struct objfile *lookup_objfile_from_block (const struct block *block);
-extern int symtab_create_debug;
+extern unsigned int symtab_create_debug;
extern int basenames_may_differ;
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.1113
diff -u -p -r1.1113 gdb.texinfo
--- doc/gdb.texinfo 25 Sep 2013 23:17:12 -0000 1.1113
+++ doc/gdb.texinfo 27 Sep 2013 23:23:52 -0000
@@ -22582,7 +22582,9 @@ Show the current state of symbol file de
@item set debug symtab-create
@cindex symbol table creation
Turns on or off display of debugging messages related to symbol table creation.
-The default is off.
+The default is 0 (off).
+A value of 1 provides basic information.
+A value greater than 1 provides more verbose information.
@item show debug symtab-create
Show the current state of symbol table creation debugging.
@item set debug target