Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
@ 2012-06-19 22:27 Doug Evans
  2012-06-22 14:06 ` Tom Tromey
  2012-06-26 15:45 ` Doug Evans
  0 siblings, 2 replies; 6+ messages in thread
From: Doug Evans @ 2012-06-19 22:27 UTC (permalink / raw)
  To: gdb-patches, eliz

Hi.

I'm committing this after a doc RFA.
[But feel free to suggest changes or enhancements.]

This adds two options for debugging dwarf2 debug info reading and symbol table
creation, and adds the beginnings of some useful messages for such.

2012-06-19  Doug Evans  <dje@google.com>

	* NEWS: Mention new options "set debug dwarf2-read" and
	"set debug symtab-create".
	* dwarf2read.c (dwarf2_read_debug): New static global.
	(dwarf2_build_psymtabs_hard): Add debugging printfs.
	(process_queue): Ditto.
	(process_full_comp_unit): Ditto.
	(_initialize_dwarf2_read): Add new option "set debug dwarf2-read".
	* elfread.c (elf_symfile_read): Add debugging printf.
	* minsyms.c (install_minimal_symbols): Ditto.
	* psymtab.c (allocate_psymtab): Ditto.
	* symfile.c (allocate_symtab): Ditto.
	* symtab.c (symtab_create_debug): New global.
	(_initialize_symtab): Add new option "set debug symtab-create".
	* symtab.h (symtab_create_debug): Declare.

	doc/
	* gdb.texinfo (Debugging Output): Document debug options dwarf2-read
	and symtab-create.

diff --git a/gdb/NEWS b/gdb/NEWS
index 5450939..e357599 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -462,6 +462,16 @@ tstop [NOTES]
 
 * New options
 
+set debug dwarf2-read
+show debug dwarf2-read
+  Turns on or off display of GDB info related to reading DWARF debugging
+  information.  The default is off.
+
+set debug symtab-create
+show debug symtab-create
+  Turns on or off display of GDB debugging info related to symbol table
+  creation.  The default is off.
+
 set extended-prompt
 show extended-prompt
   Set the GDB prompt, and allow escape sequences to be inserted to
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a14e322..29f7257 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21741,6 +21741,12 @@ The value is the number of nesting levels to print.
 A value of zero turns off the display.
 @item show debug dwarf2-die
 Show the current state of DWARF2 DIE debugging.
+@item set debug dwarf2-read
+@cindex DWARF2 Reading
+Turns on or off display of @value{GDBN} info related to reading
+DWARF debugging information.  The default is off.
+@item show debug dwarf2-read
+Show the current state of DWARF2 reader debugging.
 @item set debug displaced
 @cindex displaced stepping debugging info
 Turns on or off display of @value{GDBN} debugging info for the
@@ -21838,6 +21844,12 @@ Turns on or off debugging messages for FR-V shared-library code.
 @item show debug solib-frv
 Display the current state of FR-V shared-library code debugging
 messages.
+@item set debug symtab-create
+@cindex Symbol Table Creation
+Turns on or off display of @value{GDBN} debugging info related to
+symbol table creation.  The default is off.
+@item show debug symtab-create
+Show the current state of symbol table creation debugging.
 @item set debug target
 @cindex target debugging info
 Turns on or off display of @value{GDBN} target debugging info. This info
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 097ee7f..d128f77 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -81,6 +81,10 @@
 typedef struct symbol *symbolp;
 DEF_VEC_P (symbolp);
 
+/* When non-zero, print basic high level tracing messages.
+   This is in contrast to the low level DIE reading of dwarf2_die_debug.  */
+static int dwarf2_read_debug = 0;
+
 /* When non-zero, dump DIEs after they are read in.  */
 static int dwarf2_die_debug = 0;
 
@@ -4349,6 +4353,12 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
   struct obstack temp_obstack;
   int i;
 
+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog, "Building psymtabs of objfile %s ...\n",
+			  objfile->name);
+    }
+
   dwarf2_per_objfile->reading_partial_symbols = 1;
 
   dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
@@ -4382,6 +4392,10 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
   discard_cleanups (addrmap_cleanup);
 
   do_cleanups (back_to);
+
+  if (dwarf2_read_debug)
+    fprintf_unfiltered (gdb_stdlog, "Done building psymtabs of %s\n",
+			objfile->name);
 }
 
 /* die_reader_func for load_partial_comp_unit.  */
@@ -5286,6 +5300,13 @@ process_queue (void)
 {
   struct dwarf2_queue_item *item, *next_item;
 
+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Expanding one or more symtabs of objfile %s ...\n",
+			  dwarf2_per_objfile->objfile->name);
+    }
+
   /* The queue starts out with one item, but following a DIE reference
      may load a new CU, adding it to the end of the queue.  */
   for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
@@ -5301,6 +5322,12 @@ process_queue (void)
     }
 
   dwarf2_queue_tail = NULL;
+
+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog, "Done expanding symtabs of %s.\n",
+			  dwarf2_per_objfile->objfile->name);
+    }
 }
 
 /* Free all allocated queue entries.  This function only releases anything if
@@ -5690,6 +5717,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
   struct cleanup *back_to, *delayed_list_cleanup;
   CORE_ADDR baseaddr;
 
+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Expanding symtab of %s at offset 0x%x\n",
+			  per_cu->is_debug_types ? "TU" : "CU",
+			  per_cu->offset.sect_off);
+    }
+
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
   buildsym_init ();
@@ -5765,6 +5800,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
   VEC_safe_push (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus, per_cu);
 
   do_cleanups (back_to);
+
+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Done expanding symtab of %s at offset 0x%x\n",
+			  per_cu->is_debug_types ? "TU" : "CU",
+			  per_cu->offset.sect_off);
+    }
 }
 
 /* Process an imported unit DIE.  */
@@ -18077,6 +18120,15 @@ conversational style, when possible."),
 			   &set_dwarf2_cmdlist,
 			   &show_dwarf2_cmdlist);
 
+  add_setshow_boolean_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."),
+			    NULL,
+			    NULL,
+			    &setdebuglist, &showdebuglist);
+
   add_setshow_zinteger_cmd ("dwarf2-die", no_class, &dwarf2_die_debug, _("\
 Set debugging of the dwarf2 DIE reader."), _("\
 Show debugging of the dwarf2 DIE reader."), _("\
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 679d081..1edfb27 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1251,6 +1251,13 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
   asymbol **symbol_table = NULL, **dyn_symbol_table = NULL;
   asymbol *synthsyms;
 
+  if (symtab_create_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Reading minimal symbols of objfile %s ...\n",
+			  objfile->name);
+    }
+
   init_minimal_symbol_collection ();
   back_to = make_cleanup_discard_minimal_symbols ();
 
@@ -1443,6 +1450,9 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
 	  xfree (debugfile);
 	}
     }
+
+  if (symtab_create_debug)
+    fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
 }
 
 /* Callback to lazily read psymtabs.  */
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index d762b2d..1070fff 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1167,6 +1167,13 @@ install_minimal_symbols (struct objfile *objfile)
 
   if (msym_count > 0)
     {
+      if (symtab_create_debug)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "Installing %d minimal symbols of objfile %s.\n",
+			      msym_count, objfile->name);
+	}
+
       /* Allocate enough space in the obstack, into which we will gather the
          bunches of new and existing minimal symbols, sort them, and then
          compact out the duplicate entries.  Once we have a final table,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 647368c..c92cab8 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1731,6 +1731,26 @@ allocate_psymtab (const char *filename, struct objfile *objfile)
   psymtab->next = objfile->psymtabs;
   objfile->psymtabs = psymtab;
 
+  if (symtab_create_debug)
+    {
+      /* Be a bit clever with debugging messages, and don't print objfile
+	 every time, only when it changes.  */
+      static char *last_objfile_name = NULL;
+
+      if (last_objfile_name == NULL
+	  || strcmp (last_objfile_name, objfile->name) != 0)
+	{
+	  xfree (last_objfile_name);
+	  last_objfile_name = xstrdup (objfile->name);
+	  fprintf_unfiltered (gdb_stdlog,
+			      "Creating one or more psymtabs for objfile %s ...\n",
+			      last_objfile_name);
+	}
+      fprintf_unfiltered (gdb_stdlog,
+			  "Created psymtab 0x%lx for module %s.\n",
+			  (long) psymtab, filename);
+    }
+
   return (psymtab);
 }
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 37d98d9..01252e2 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2873,6 +2873,26 @@ allocate_symtab (const char *filename, struct objfile *objfile)
   symtab->next = objfile->symtabs;
   objfile->symtabs = symtab;
 
+  if (symtab_create_debug)
+    {
+      /* Be a bit clever with debugging messages, and don't print objfile
+	 every time, only when it changes.  */
+      static char *last_objfile_name = NULL;
+
+      if (last_objfile_name == NULL
+	  || strcmp (last_objfile_name, objfile->name) != 0)
+	{
+	  xfree (last_objfile_name);
+	  last_objfile_name = xstrdup (objfile->name);
+	  fprintf_unfiltered (gdb_stdlog,
+			      "Creating one or more symtabs for objfile %s ...\n",
+			      last_objfile_name);
+	}
+      fprintf_unfiltered (gdb_stdlog,
+			  "Created symtab 0x%lx for module %s.\n",
+			  (long) symtab, filename);
+    }
+
   return (symtab);
 }
 \f
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 215c53d..ee37f30 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -109,6 +109,9 @@ void _initialize_symtab (void);
 
 /* */
 
+/* When non-zero, print debugging messages related to symtab creation.  */
+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.
    Default set to "off" to not slow down the common case.  */
@@ -5014,5 +5017,13 @@ one base name, and gdb will do file name comparisons more efficiently."),
 			   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);
+
   observer_attach_executable_changed (symtab_observer_executable_changed);
 }
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 8ee187e..57f618d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1250,6 +1250,8 @@ void fixup_section (struct general_symbol_info *ginfo,
 
 struct objfile *lookup_objfile_from_block (const struct block *block);
 
+extern int symtab_create_debug;
+
 extern int basenames_may_differ;
 
 int compare_filenames_for_search (const char *filename,


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

* Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
  2012-06-19 22:27 [doc RFA] "set debug dwarf2-read" and "set debug symtab-create" Doug Evans
@ 2012-06-22 14:06 ` Tom Tromey
  2012-06-23 22:58   ` Doug Evans
  2012-06-26 15:45 ` Doug Evans
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2012-06-22 14:06 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches, eliz

>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> I'm committing this after a doc RFA.
Doug> [But feel free to suggest changes or enhancements.]

Seems nice; I've wanted something like this before.  I have one
suggestion:

Doug> @@ -5286,6 +5300,13 @@ process_queue (void)

Doug> +      fprintf_unfiltered (gdb_stdlog,
Doug> +			  "Expanding one or more symtabs of objfile %s ...\n",
Doug> +			  dwarf2_per_objfile->objfile->name);

This seems a little vague; it would be nice to, say, print the CU offset
here.

Tom


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

* Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
  2012-06-22 14:06 ` Tom Tromey
@ 2012-06-23 22:58   ` Doug Evans
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Evans @ 2012-06-23 22:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, eliz

On Fri, Jun 22, 2012 at 7:06 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> I'm committing this after a doc RFA.
> Doug> [But feel free to suggest changes or enhancements.]
>
> Seems nice; I've wanted something like this before.  I have one
> suggestion:
>
> Doug> @@ -5286,6 +5300,13 @@ process_queue (void)
>
> Doug> +      fprintf_unfiltered (gdb_stdlog,
> Doug> +                   "Expanding one or more symtabs of objfile %s ...\n",
> Doug> +                   dwarf2_per_objfile->objfile->name);
>
> This seems a little vague; it would be nice to, say, print the CU offset
> here.
>
> Tom

This message is part A of a two part set.
The other part is:

@@ -5690,6 +5717,14 @@ process_full_comp_unit (struct
dwarf2_per_cu_data *per_cu,
   struct cleanup *back_to, *delayed_list_cleanup;
   CORE_ADDR baseaddr;

+  if (dwarf2_read_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+                         "Expanding symtab of %s at offset 0x%x\n",
+                         per_cu->is_debug_types ? "TU" : "CU",
+                         per_cu->offset.sect_off);
+    }
+
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));

   buildsym_init ();

I want to keep the S/N ratio high and thus I don't want to print the
objfile name for each expanded symtab (expanding one symtab can
involve expanding others as well).
So part A (so to speak) prints the objfile name and part B (possibly
replicated multiple times) prints all the CUs that get expanded.

I can add a comment noting this fact if you like.


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

* Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
  2012-06-19 22:27 [doc RFA] "set debug dwarf2-read" and "set debug symtab-create" Doug Evans
  2012-06-22 14:06 ` Tom Tromey
@ 2012-06-26 15:45 ` Doug Evans
  2012-06-26 16:26   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Doug Evans @ 2012-06-26 15:45 UTC (permalink / raw)
  To: eliz; +Cc: gdb-patches

Hi.  "Ping." :-)

On Tue, Jun 19, 2012 at 3:26 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> I'm committing this after a doc RFA.
> [But feel free to suggest changes or enhancements.]
>
> This adds two options for debugging dwarf2 debug info reading and symbol table
> creation, and adds the beginnings of some useful messages for such.
>
> 2012-06-19  Doug Evans  <dje@google.com>
>
>        * NEWS: Mention new options "set debug dwarf2-read" and
>        "set debug symtab-create".
>        * dwarf2read.c (dwarf2_read_debug): New static global.
>        (dwarf2_build_psymtabs_hard): Add debugging printfs.
>        (process_queue): Ditto.
>        (process_full_comp_unit): Ditto.
>        (_initialize_dwarf2_read): Add new option "set debug dwarf2-read".
>        * elfread.c (elf_symfile_read): Add debugging printf.
>        * minsyms.c (install_minimal_symbols): Ditto.
>        * psymtab.c (allocate_psymtab): Ditto.
>        * symfile.c (allocate_symtab): Ditto.
>        * symtab.c (symtab_create_debug): New global.
>        (_initialize_symtab): Add new option "set debug symtab-create".
>        * symtab.h (symtab_create_debug): Declare.
>
>        doc/
>        * gdb.texinfo (Debugging Output): Document debug options dwarf2-read
>        and symtab-create.
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 5450939..e357599 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -462,6 +462,16 @@ tstop [NOTES]
>
>  * New options
>
> +set debug dwarf2-read
> +show debug dwarf2-read
> +  Turns on or off display of GDB info related to reading DWARF debugging
> +  information.  The default is off.
> +
> +set debug symtab-create
> +show debug symtab-create
> +  Turns on or off display of GDB debugging info related to symbol table
> +  creation.  The default is off.
> +
>  set extended-prompt
>  show extended-prompt
>   Set the GDB prompt, and allow escape sequences to be inserted to
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index a14e322..29f7257 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -21741,6 +21741,12 @@ The value is the number of nesting levels to print.
>  A value of zero turns off the display.
>  @item show debug dwarf2-die
>  Show the current state of DWARF2 DIE debugging.
> +@item set debug dwarf2-read
> +@cindex DWARF2 Reading
> +Turns on or off display of @value{GDBN} info related to reading
> +DWARF debugging information.  The default is off.
> +@item show debug dwarf2-read
> +Show the current state of DWARF2 reader debugging.
>  @item set debug displaced
>  @cindex displaced stepping debugging info
>  Turns on or off display of @value{GDBN} debugging info for the
> @@ -21838,6 +21844,12 @@ Turns on or off debugging messages for FR-V shared-library code.
>  @item show debug solib-frv
>  Display the current state of FR-V shared-library code debugging
>  messages.
> +@item set debug symtab-create
> +@cindex Symbol Table Creation
> +Turns on or off display of @value{GDBN} debugging info related to
> +symbol table creation.  The default is off.
> +@item show debug symtab-create
> +Show the current state of symbol table creation debugging.
>  @item set debug target
>  @cindex target debugging info
>  Turns on or off display of @value{GDBN} target debugging info. This info
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 097ee7f..d128f77 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -81,6 +81,10 @@
>  typedef struct symbol *symbolp;
>  DEF_VEC_P (symbolp);
>
> +/* When non-zero, print basic high level tracing messages.
> +   This is in contrast to the low level DIE reading of dwarf2_die_debug.  */
> +static int dwarf2_read_debug = 0;
> +
>  /* When non-zero, dump DIEs after they are read in.  */
>  static int dwarf2_die_debug = 0;
>
> @@ -4349,6 +4353,12 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
>   struct obstack temp_obstack;
>   int i;
>
> +  if (dwarf2_read_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog, "Building psymtabs of objfile %s ...\n",
> +                         objfile->name);
> +    }
> +
>   dwarf2_per_objfile->reading_partial_symbols = 1;
>
>   dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
> @@ -4382,6 +4392,10 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
>   discard_cleanups (addrmap_cleanup);
>
>   do_cleanups (back_to);
> +
> +  if (dwarf2_read_debug)
> +    fprintf_unfiltered (gdb_stdlog, "Done building psymtabs of %s\n",
> +                       objfile->name);
>  }
>
>  /* die_reader_func for load_partial_comp_unit.  */
> @@ -5286,6 +5300,13 @@ process_queue (void)
>  {
>   struct dwarf2_queue_item *item, *next_item;
>
> +  if (dwarf2_read_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Expanding one or more symtabs of objfile %s ...\n",
> +                         dwarf2_per_objfile->objfile->name);
> +    }
> +
>   /* The queue starts out with one item, but following a DIE reference
>      may load a new CU, adding it to the end of the queue.  */
>   for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
> @@ -5301,6 +5322,12 @@ process_queue (void)
>     }
>
>   dwarf2_queue_tail = NULL;
> +
> +  if (dwarf2_read_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog, "Done expanding symtabs of %s.\n",
> +                         dwarf2_per_objfile->objfile->name);
> +    }
>  }
>
>  /* Free all allocated queue entries.  This function only releases anything if
> @@ -5690,6 +5717,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
>   struct cleanup *back_to, *delayed_list_cleanup;
>   CORE_ADDR baseaddr;
>
> +  if (dwarf2_read_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Expanding symtab of %s at offset 0x%x\n",
> +                         per_cu->is_debug_types ? "TU" : "CU",
> +                         per_cu->offset.sect_off);
> +    }
> +
>   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
>
>   buildsym_init ();
> @@ -5765,6 +5800,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
>   VEC_safe_push (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus, per_cu);
>
>   do_cleanups (back_to);
> +
> +  if (dwarf2_read_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Done expanding symtab of %s at offset 0x%x\n",
> +                         per_cu->is_debug_types ? "TU" : "CU",
> +                         per_cu->offset.sect_off);
> +    }
>  }
>
>  /* Process an imported unit DIE.  */
> @@ -18077,6 +18120,15 @@ conversational style, when possible."),
>                           &set_dwarf2_cmdlist,
>                           &show_dwarf2_cmdlist);
>
> +  add_setshow_boolean_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."),
> +                           NULL,
> +                           NULL,
> +                           &setdebuglist, &showdebuglist);
> +
>   add_setshow_zinteger_cmd ("dwarf2-die", no_class, &dwarf2_die_debug, _("\
>  Set debugging of the dwarf2 DIE reader."), _("\
>  Show debugging of the dwarf2 DIE reader."), _("\
> diff --git a/gdb/elfread.c b/gdb/elfread.c
> index 679d081..1edfb27 100644
> --- a/gdb/elfread.c
> +++ b/gdb/elfread.c
> @@ -1251,6 +1251,13 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
>   asymbol **symbol_table = NULL, **dyn_symbol_table = NULL;
>   asymbol *synthsyms;
>
> +  if (symtab_create_debug)
> +    {
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Reading minimal symbols of objfile %s ...\n",
> +                         objfile->name);
> +    }
> +
>   init_minimal_symbol_collection ();
>   back_to = make_cleanup_discard_minimal_symbols ();
>
> @@ -1443,6 +1450,9 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
>          xfree (debugfile);
>        }
>     }
> +
> +  if (symtab_create_debug)
> +    fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
>  }
>
>  /* Callback to lazily read psymtabs.  */
> diff --git a/gdb/minsyms.c b/gdb/minsyms.c
> index d762b2d..1070fff 100644
> --- a/gdb/minsyms.c
> +++ b/gdb/minsyms.c
> @@ -1167,6 +1167,13 @@ install_minimal_symbols (struct objfile *objfile)
>
>   if (msym_count > 0)
>     {
> +      if (symtab_create_debug)
> +       {
> +         fprintf_unfiltered (gdb_stdlog,
> +                             "Installing %d minimal symbols of objfile %s.\n",
> +                             msym_count, objfile->name);
> +       }
> +
>       /* Allocate enough space in the obstack, into which we will gather the
>          bunches of new and existing minimal symbols, sort them, and then
>          compact out the duplicate entries.  Once we have a final table,
> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index 647368c..c92cab8 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -1731,6 +1731,26 @@ allocate_psymtab (const char *filename, struct objfile *objfile)
>   psymtab->next = objfile->psymtabs;
>   objfile->psymtabs = psymtab;
>
> +  if (symtab_create_debug)
> +    {
> +      /* Be a bit clever with debugging messages, and don't print objfile
> +        every time, only when it changes.  */
> +      static char *last_objfile_name = NULL;
> +
> +      if (last_objfile_name == NULL
> +         || strcmp (last_objfile_name, objfile->name) != 0)
> +       {
> +         xfree (last_objfile_name);
> +         last_objfile_name = xstrdup (objfile->name);
> +         fprintf_unfiltered (gdb_stdlog,
> +                             "Creating one or more psymtabs for objfile %s ...\n",
> +                             last_objfile_name);
> +       }
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Created psymtab 0x%lx for module %s.\n",
> +                         (long) psymtab, filename);
> +    }
> +
>   return (psymtab);
>  }
>
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 37d98d9..01252e2 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -2873,6 +2873,26 @@ allocate_symtab (const char *filename, struct objfile *objfile)
>   symtab->next = objfile->symtabs;
>   objfile->symtabs = symtab;
>
> +  if (symtab_create_debug)
> +    {
> +      /* Be a bit clever with debugging messages, and don't print objfile
> +        every time, only when it changes.  */
> +      static char *last_objfile_name = NULL;
> +
> +      if (last_objfile_name == NULL
> +         || strcmp (last_objfile_name, objfile->name) != 0)
> +       {
> +         xfree (last_objfile_name);
> +         last_objfile_name = xstrdup (objfile->name);
> +         fprintf_unfiltered (gdb_stdlog,
> +                             "Creating one or more symtabs for objfile %s ...\n",
> +                             last_objfile_name);
> +       }
> +      fprintf_unfiltered (gdb_stdlog,
> +                         "Created symtab 0x%lx for module %s.\n",
> +                         (long) symtab, filename);
> +    }
> +
>   return (symtab);
>  }
>
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 215c53d..ee37f30 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -109,6 +109,9 @@ void _initialize_symtab (void);
>
>  /* */
>
> +/* When non-zero, print debugging messages related to symtab creation.  */
> +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.
>    Default set to "off" to not slow down the common case.  */
> @@ -5014,5 +5017,13 @@ one base name, and gdb will do file name comparisons more efficiently."),
>                           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);
> +
>   observer_attach_executable_changed (symtab_observer_executable_changed);
>  }
> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index 8ee187e..57f618d 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h
> @@ -1250,6 +1250,8 @@ void fixup_section (struct general_symbol_info *ginfo,
>
>  struct objfile *lookup_objfile_from_block (const struct block *block);
>
> +extern int symtab_create_debug;
> +
>  extern int basenames_may_differ;
>
>  int compare_filenames_for_search (const char *filename,


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

* Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
  2012-06-26 15:45 ` Doug Evans
@ 2012-06-26 16:26   ` Eli Zaretskii
  2012-06-26 20:16     ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2012-06-26 16:26 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

> Date: Tue, 26 Jun 2012 08:45:04 -0700
> From: Doug Evans <dje@google.com>
> Cc: gdb-patches <gdb-patches@sourceware.org>
> 
> Hi.  "Ping." :-)

Sorry, but your wording was ambiguous:

> > I'm committing this after a doc RFA.

I interpreted that as meaning "doc review was already done, I'm
committing this".

> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -462,6 +462,16 @@ tstop [NOTES]
>
>  * New options
>
> +set debug dwarf2-read
> +show debug dwarf2-read
> +  Turns on or off display of GDB info related to reading DWARF debugging
> +  information.  The default is off.

I'd prefer to say "display of debugging messages related to reading
DWARF debug info".

> +@item set debug dwarf2-read
> +@cindex DWARF2 Reading
> +Turns on or off display of @value{GDBN} info related to reading
> +DWARF debugging information.  The default is off.
> +@item show debug dwarf2-read
> +Show the current state of DWARF2 reader debugging.

Same here.

> +@item set debug symtab-create
> +@cindex Symbol Table Creation

Index entries should start with a lower-case letter.  I would simply
lower-case all the words in this entry.

OK with those changes.

Thanks, and sorry for the delay.


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

* Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create"
  2012-06-26 16:26   ` Eli Zaretskii
@ 2012-06-26 20:16     ` Doug Evans
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Evans @ 2012-06-26 20:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Tue, Jun 26, 2012 at 9:26 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Tue, 26 Jun 2012 08:45:04 -0700
> > From: Doug Evans <dje@google.com>
> > Cc: gdb-patches <gdb-patches@sourceware.org>
> >
> > Hi.  "Ping." :-)
>
> Sorry, but your wording was ambiguous:
>
> > > I'm committing this after a doc RFA.
>
> I interpreted that as meaning "doc review was already done, I'm
> committing this".
>
> > --- a/gdb/NEWS
> > +++ b/gdb/NEWS
> > @@ -462,6 +462,16 @@ tstop [NOTES]
> >
> >  * New options
> >
> > +set debug dwarf2-read
> > +show debug dwarf2-read
> > +  Turns on or off display of GDB info related to reading DWARF debugging
> > +  information.  The default is off.
>
> I'd prefer to say "display of debugging messages related to reading
> DWARF debug info".
>
> > +@item set debug dwarf2-read
> > +@cindex DWARF2 Reading
> > +Turns on or off display of @value{GDBN} info related to reading
> > +DWARF debugging information.  The default is off.
> > +@item show debug dwarf2-read
> > +Show the current state of DWARF2 reader debugging.
>
> Same here.
>
> > +@item set debug symtab-create
> > +@cindex Symbol Table Creation
>
> Index entries should start with a lower-case letter.  I would simply
> lower-case all the words in this entry.
>
> OK with those changes.
>
>
> Thanks, and sorry for the delay.


Committed with the suggested changes.
Thanks, and no worries.


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

end of thread, other threads:[~2012-06-26 20:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 22:27 [doc RFA] "set debug dwarf2-read" and "set debug symtab-create" Doug Evans
2012-06-22 14:06 ` Tom Tromey
2012-06-23 22:58   ` Doug Evans
2012-06-26 15:45 ` Doug Evans
2012-06-26 16:26   ` Eli Zaretskii
2012-06-26 20:16     ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox