public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug
@ 2015-05-27 19:59 Doug Evans
  0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2015-05-27 19:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Eli Zaretskii writes:
  > > Date: Tue, 12 May 2015 13:39:27 -0700
  > > From: Doug Evans <dje@google.com>
  > > Cc: gdb-patches <gdb-patches@sourceware.org>, Cary Coutant  
<ccoutant@google.com>
  > >
  > > >>  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-line
  > > >> +@cindex DWARF2 Line Tables
  > > >> +Turns on or off display of debugging messages related to reading
  > > >> +DWARF line tables.  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-line
  > > >> +Show the current state of DWARF2 line table debugging.
  > > >
  > > > This is also OK, but how about using "DWARF2" for consistency at  
least
  > > > in this fragment?
  > >
  > > Actually, I'd rather use "DWARF".
  >
  > I don't mind, as long as it's consistent.
  >
  > > Agreed. Where the version doesn't matter I propose using "DWARF".
  > > (as in the above)
  >
  > The above used both DWARF and DWARF2.

Here's what I pushed.

2015-05-27  Doug Evans  <dje@google.com>

	* NEWS: Mention "set debug dwarf-line".
	* dwarf2read.c (dwarf_line_debug): New static global.
	(add_include_dir): Add debug dwarf-line support.
	(add_file_name, dwarf_record_line, dwarf_finish_line): Ditto.
	(_initialize_dwarf2_read): New parameter "debug dwarf-line".

	doc/
	* gdb.texinfo (Debugging Output): Mention set/show debug dwarf-line.

diff --git a/gdb/NEWS b/gdb/NEWS
index 4c4e28c..bbfb55d 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -112,6 +112,10 @@ maint set dwarf max-cache-age
  maint show dwarf max-cache-age
    Renamed from "maint show dwarf2 max-cache-age".

+set debug dwarf-line
+show debug dwarf-line
+  Control display of debugging info regarding DWARF line processing.
+
  set max-completions
  show max-completions
    Set the maximum number of candidates to be considered during
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6cc6c7e..9ea846a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23417,6 +23417,14 @@ The value is the number of nesting levels to print.
  A value of zero turns off the display.
  @item show debug dwarf-die
  Show the current state of DWARF DIE debugging.
+@item set debug dwarf-line
+@cindex DWARF Line Tables
+Turns on or off display of debugging messages related to reading
+DWARF line tables.  The default is 0 (off).
+A value of 1 provides basic information.
+A value greater than 1 provides more verbose information.
+@item show debug dwarf-line
+Show the current state of DWARF line table debugging.
  @item set debug dwarf-read
  @cindex DWARF Reading
  Turns on or off display of debugging messages related to reading
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8e30ff3..e6d6b30 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -84,6 +84,9 @@ static unsigned int dwarf_read_debug = 0;
  /* When non-zero, dump DIEs after they are read in.  */
  static unsigned int dwarf_die_debug = 0;

+/* When non-zero, dump line number entries as they are read in.  */
+static unsigned int dwarf_line_debug = 0;
+
  /* When non-zero, cross-check physname against demangler.  */
  static int check_physname = 0;

@@ -17152,6 +17155,10 @@ free_line_header_voidp (void *arg)
  static void
  add_include_dir (struct line_header *lh, const char *include_dir)
  {
+  if (dwarf_line_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "Adding dir %u: %s\n",
+			lh->num_include_dirs + 1, include_dir);
+
    /* Grow the array if necessary.  */
    if (lh->include_dirs_size == 0)
      {
@@ -17181,6 +17188,10 @@ add_file_name (struct line_header *lh,
  {
    struct file_entry *fe;

+  if (dwarf_line_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "Adding file %u: %s\n",
+			lh->num_file_names + 1, name);
+
    /* Grow the array if necessary.  */
    if (lh->file_names_size == 0)
      {
@@ -17529,6 +17540,14 @@ dwarf_record_line (struct gdbarch *gdbarch, struct  
subfile *subfile,
  {
    CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address);

+  if (dwarf_line_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Recording line %u, file %s, address %s\n",
+			  line, lbasename (subfile->name),
+			  paddress (gdbarch, address));
+    }
+
    (*p_record_line) (subfile, line, addr);
  }

@@ -17541,8 +17560,18 @@ static void
  dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
  		   CORE_ADDR address, record_line_ftype p_record_line)
  {
-  if (subfile != NULL)
-    dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
+  if (subfile == NULL)
+    return;
+
+  if (dwarf_line_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Finishing current line, file %s, address %s\n",
+			  lbasename (subfile->name),
+			  paddress (gdbarch, address));
+    }
+
+  dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
  }

  /* Subroutine of dwarf_decode_lines to simplify it.
@@ -23321,6 +23350,16 @@ The value is the maximum depth to print."),
  			     NULL,
  			     &setdebuglist, &showdebuglist);

+  add_setshow_zuinteger_cmd ("dwarf-line", no_class, &dwarf_line_debug,  
_("\
+Set debugging of the dwarf line reader."), _("\
+Show debugging of the dwarf line reader."), _("\
+When enabled (non-zero), line number entries are dumped as they are read  
in.\n\
+A value of 1 (one) provides basic information.\n\
+A value greater than 1 provides more verbose information."),
+			     NULL,
+			     NULL,
+			     &setdebuglist, &showdebuglist);
+
    add_setshow_boolean_cmd ("check-physname", no_class, &check_physname,  
_("\
  Set cross-checking of \"physname\" code against demangler."), _("\
  Show cross-checking of \"physname\" code against demangler."), _("\

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

* Re: [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug
  2015-05-12 20:39   ` Doug Evans
@ 2015-05-13  2:44     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-05-13  2:44 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches, ccoutant

> Date: Tue, 12 May 2015 13:39:27 -0700
> From: Doug Evans <dje@google.com>
> Cc: gdb-patches <gdb-patches@sourceware.org>, Cary Coutant <ccoutant@google.com>
> 
> >>  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-line
> >> +@cindex DWARF2 Line Tables
> >> +Turns on or off display of debugging messages related to reading
> >> +DWARF line tables.  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-line
> >> +Show the current state of DWARF2 line table debugging.
> >
> > This is also OK, but how about using "DWARF2" for consistency at least
> > in this fragment?
> 
> Actually, I'd rather use "DWARF".

I don't mind, as long as it's consistent.

> Agreed. Where the version doesn't matter I propose using "DWARF".
> (as in the above)

The above used both DWARF and DWARF2.

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

* Re: [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug
  2015-03-12 20:37 ` Eli Zaretskii
@ 2015-05-12 20:39   ` Doug Evans
  2015-05-13  2:44     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2015-05-12 20:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, Cary Coutant

On Thu, Mar 12, 2015 at 1:37 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Doug Evans <dje@google.com>
>> cc: ccoutant@google.com
>> Date: Thu, 12 Mar 2015 13:01:49 -0700
>>
>> --- a/gdb/NEWS
>> +++ b/gdb/NEWS
>> @@ -30,6 +30,10 @@ record bts
>>
>>  * New options
>>
>> +set debug dwarf2-line
>> +show debug dwarf2-line
>> +  Control display of debugging info regarding DWARF line processing.
>
> This is OK.
>
>> --- a/gdb/doc/gdb.texinfo
>> +++ b/gdb/doc/gdb.texinfo
>> @@ -23245,6 +23245,14 @@ 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-line
>> +@cindex DWARF2 Line Tables
>> +Turns on or off display of debugging messages related to reading
>> +DWARF line tables.  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-line
>> +Show the current state of DWARF2 line table debugging.
>
> This is also OK, but how about using "DWARF2" for consistency at least
> in this fragment?

Actually, I'd rather use "DWARF".

There's a lot of history/inertia here that we should really overcome
and put behind us.
We call things DWARF2 to disambiguate from DWARF1 (which no longer
exists in any useful form).  dwarf2read.c should *really* be
dwarfread.c IMO (and so on for every other instance of
dwarf2/DWARF2/dw2/etc. in file names, code, docs, etc.)

> (Btw, I find this "DWARF2", "DWARF 4", "DWARF 5" thing utterly
> confusing for the reader; the truth is "DWARF version 5" etc.  I wish
> we started using that throughout.)

Agreed. Where the version doesn't matter I propose using "DWARF".
(as in the above)

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

* Re: [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug
  2015-03-12 20:01 Doug Evans
@ 2015-03-12 20:37 ` Eli Zaretskii
  2015-05-12 20:39   ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2015-03-12 20:37 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches, ccoutant

> From: Doug Evans <dje@google.com>
> cc: ccoutant@google.com
> Date: Thu, 12 Mar 2015 13:01:49 -0700
> 
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -30,6 +30,10 @@ record bts
>  
>  * New options
>  
> +set debug dwarf2-line
> +show debug dwarf2-line
> +  Control display of debugging info regarding DWARF line processing.

This is OK.

> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -23245,6 +23245,14 @@ 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-line
> +@cindex DWARF2 Line Tables
> +Turns on or off display of debugging messages related to reading
> +DWARF line tables.  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-line
> +Show the current state of DWARF2 line table debugging.

This is also OK, but how about using "DWARF2" for consistency at least
in this fragment?

(Btw, I find this "DWARF2", "DWARF 4", "DWARF 5" thing utterly
confusing for the reader; the truth is "DWARF version 5" etc.  I wish
we started using that throughout.)

Thanks.

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

* [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug
@ 2015-03-12 20:01 Doug Evans
  2015-03-12 20:37 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2015-03-12 20:01 UTC (permalink / raw)
  To: gdb-patches, eliz; +Cc: ccoutant

Hi.

This patch adds "set debug dwarf2-line".

2015-03-12  Doug Evans  <dje@google.com>

	* NEWS: Mention "set debug dwarf2-line".
	* dwarf2read.c (dwarf2_line_debug): New static global.
	(add_include_dir): Add debug dwarf2-line support.
	(add_file_name, dwarf_record_line, dwarf_finish_line): Ditto.
	(_initialize_dwarf2_read): New parameter "debug dwarf2-line".

	doc/
	* gdb.texinfo (Debugging Output): Mention set/show debug dwarf2-line.

diff --git a/gdb/NEWS b/gdb/NEWS
index 49dc0e6..9674ec2 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -30,6 +30,10 @@ record bts
 
 * New options
 
+set debug dwarf2-line
+show debug dwarf2-line
+  Control display of debugging info regarding DWARF line processing.
+
 set max-completions
 show max-completions
   Set the maximum number of candidates to be considered during
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 4b76ce9..4451a43 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23245,6 +23245,14 @@ 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-line
+@cindex DWARF2 Line Tables
+Turns on or off display of debugging messages related to reading
+DWARF line tables.  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-line
+Show the current state of DWARF2 line table debugging.
 @item set debug dwarf2-read
 @cindex DWARF2 Reading
 Turns on or off display of debugging messages related to reading
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index c6f539d..d980b1a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -84,6 +84,9 @@ static unsigned int dwarf2_read_debug = 0;
 /* When non-zero, dump DIEs after they are read in.  */
 static unsigned int dwarf2_die_debug = 0;
 
+/* When non-zero, dump line number entries as they are read in.  */
+static unsigned int dwarf2_line_debug = 0;
+
 /* When non-zero, cross-check physname against demangler.  */
 static int check_physname = 0;
 
@@ -17106,6 +17109,10 @@ free_line_header_voidp (void *arg)
 static void
 add_include_dir (struct line_header *lh, const char *include_dir)
 {
+  if (dwarf2_line_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "Adding dir %u: %s\n",
+			lh->num_include_dirs + 1, include_dir);
+
   /* Grow the array if necessary.  */
   if (lh->include_dirs_size == 0)
     {
@@ -17135,6 +17142,10 @@ add_file_name (struct line_header *lh,
 {
   struct file_entry *fe;
 
+  if (dwarf2_line_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "Adding file %u: %s\n",
+			lh->num_file_names + 1, name);
+
   /* Grow the array if necessary.  */
   if (lh->file_names_size == 0)
     {
@@ -17483,6 +17494,14 @@ dwarf_record_line (struct gdbarch *gdbarch, struct subfile *subfile,
 {
   CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address);
 
+  if (dwarf2_line_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Recording line %u, file %s, address %s\n",
+			  line, lbasename (subfile->name),
+			  paddress (gdbarch, address));
+    }
+
   (*p_record_line) (subfile, line, addr);
 }
 
@@ -17495,8 +17514,18 @@ static void
 dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
 		   CORE_ADDR address, record_line_ftype p_record_line)
 {
-  if (subfile != NULL)
-    dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
+  if (subfile == NULL)
+    return;
+
+  if (dwarf2_line_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "Finishing current line, file %s, address %s\n",
+			  lbasename (subfile->name),
+			  paddress (gdbarch, address));
+    }
+
+  dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
 }
 
 /* Subroutine of dwarf_decode_lines to simplify it.
@@ -23278,6 +23307,16 @@ The value is the maximum depth to print."),
 			     NULL,
 			     &setdebuglist, &showdebuglist);
 
+  add_setshow_zuinteger_cmd ("dwarf2-line", no_class, &dwarf2_line_debug, _("\
+Set debugging of the dwarf2 line reader."), _("\
+Show debugging of the dwarf2 line reader."), _("\
+When enabled (non-zero), line number entries are dumped as they are read in.\n\
+A value of 1 (one) provides basic information.\n\
+A value greater than 1 provides more verbose information."),
+			     NULL,
+			     NULL,
+			     &setdebuglist, &showdebuglist);
+
   add_setshow_boolean_cmd ("check-physname", no_class, &check_physname, _("\
 Set cross-checking of \"physname\" code against demangler."), _("\
 Show cross-checking of \"physname\" code against demangler."), _("\

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

end of thread, other threads:[~2015-05-27 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 19:59 [PATCH 2/6] DWARF Two Level Line Tables: dwarf2_line_debug Doug Evans
  -- strict thread matches above, loose matches on Subject: below --
2015-03-12 20:01 Doug Evans
2015-03-12 20:37 ` Eli Zaretskii
2015-05-12 20:39   ` Doug Evans
2015-05-13  2:44     ` Eli Zaretskii

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