public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 3/6] DWARF Two Level Line Tables: check_line_address
@ 2015-03-12 20:03 Doug Evans
  2015-05-27 20:28 ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2015-03-12 20:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: ccoutant

Hi.

This patch just factors out the checking of a line address
to improve the S/N ratio of the calling function.

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

	* dwarf2read.c (record_line_ftype): New typedef.
	(check_line_address): New function.
	(dwarf_decode_lines_1): Call it.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index d980b1a..fff5474 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17429,6 +17429,11 @@ psymtab_include_file_name (const struct line_header *lh, int file_index,
   return include_name;
 }
 
+/* Function to record a line number.  */
+
+typedef void (record_line_ftype) (struct subfile *subfile, int line,
+				  CORE_ADDR pc);
+
 /* Ignore this record_line request.  */
 
 static void
@@ -17528,6 +17533,36 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
   dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
 }
 
+/* Check address and if invalid nop-out the rest of the lines in this
+   sequence.  */
+
+static void
+check_line_address (struct dwarf2_cu *cu, record_line_ftype **p_record_line,
+		    const gdb_byte *line_ptr,
+		    CORE_ADDR lowpc, CORE_ADDR address)
+{
+  /* If address < lowpc then it's not a usable value, it's outside the
+     pc range of the CU.  However, we restrict the test to only address
+     values of zero to preserve GDB's previous behaviour which is to
+     handle the specific case of a function being GC'd by the linker.  */
+
+  if (address == 0 && address < lowpc)
+    {
+      /* This line table is for a function which has been
+	 GCd by the linker.  Ignore it.  PR gdb/12528 */
+
+      struct objfile *objfile = cu->objfile;
+      long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
+
+      complaint (&symfile_complaints,
+		 _(".debug_line address at offset 0x%lx is 0 [in module %s]"),
+		 line_offset, objfile_name (objfile));
+      *p_record_line = noop_record_line;
+      /* Note: *p_record_line is left as noop_record_line
+	 until we see DW_LNE_end_sequence.  */
+    }
+}
+
 /* Subroutine of dwarf_decode_lines to simplify it.
    Process the line number information in LH.  */
 
@@ -17661,31 +17696,10 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 		  break;
 		case DW_LNE_set_address:
 		  address = read_address (abfd, line_ptr, cu, &bytes_read);
-
-		  /* If address < lowpc then it's not a usable value, it's
-		     outside the pc range of the CU.  However, we restrict
-		     the test to only address values of zero to preserve
-		     GDB's previous behaviour which is to handle the specific
-		     case of a function being GC'd by the linker.  */
-		  if (address == 0 && address < lowpc)
-		    {
-		      /* This line table is for a function which has been
-			 GCd by the linker.  Ignore it.  PR gdb/12528 */
-
-		      long line_offset
-			= line_ptr - get_debug_line_section (cu)->buffer;
-
-		      complaint (&symfile_complaints,
-				 _(".debug_line address at offset 0x%lx is 0 "
-				   "[in module %s]"),
-				 line_offset, objfile_name (objfile));
-		      p_record_line = noop_record_line;
-		      /* Note: p_record_line is left as noop_record_line
-			 until we see DW_LNE_end_sequence.  */
-		    }
-
-		  op_index = 0;
 		  line_ptr += bytes_read;
+		  check_line_address (cu, &p_record_line, line_ptr,
+				      lowpc, address);
+		  op_index = 0;
 		  address += baseaddr;
 		  address = gdbarch_adjust_dwarf2_line (gdbarch, address, 0);
 		  break;

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

* Re: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address
  2015-03-12 20:03 [PATCH 3/6] DWARF Two Level Line Tables: check_line_address Doug Evans
@ 2015-05-27 20:28 ` Doug Evans
  2015-05-28  9:27   ` [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address) Jan-Benedict Glaw
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2015-05-27 20:28 UTC (permalink / raw)
  To: gdb-patches

On Thu, Mar 12, 2015 at 1:03 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> This patch just factors out the checking of a line address
> to improve the S/N ratio of the calling function.
>
> 2015-03-12  Doug Evans  <dje@google.com>
>
>         * dwarf2read.c (record_line_ftype): New typedef.
>         (check_line_address): New function.
>         (dwarf_decode_lines_1): Call it.

Committed.

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

* [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address)
  2015-05-27 20:28 ` Doug Evans
@ 2015-05-28  9:27   ` Jan-Benedict Glaw
  2015-05-28 13:58     ` Maciej W. Rozycki
  0 siblings, 1 reply; 6+ messages in thread
From: Jan-Benedict Glaw @ 2015-05-28  9:27 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]

Hi!

On Wed, 2015-05-27 13:28:33 -0700, Doug Evans <dje@google.com> wrote:
> On Thu, Mar 12, 2015 at 1:03 PM, Doug Evans <dje@google.com> wrote:
> > Hi.
> >
> > This patch just factors out the checking of a line address
> > to improve the S/N ratio of the calling function.
> >
> > 2015-03-12  Doug Evans  <dje@google.com>
> >
> >         * dwarf2read.c (record_line_ftype): New typedef.
> >         (check_line_address): New function.
> >         (dwarf_decode_lines_1): Call it.
> 
> Committed.

Seems it's breaking, see eg. this xtensa-linux build
(http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=442962),
or hppa-linux
(http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=443000):

[...]
 gcc -g -O2   -I. -I/home/jbglaw/repos/binutils_gdb/gdb -I/home/jbglaw/repos/binutils_gdb/gdb/common -I/home/jbglaw/repos/binutils_gdb/gdb/config -DLOCALEDIR="\"/home/jbglaw/build/hppa-linux/_install_/share/locale\"" -DHAVE_CONFIG_H -I/home/jbglaw/repos/binutils_gdb/gdb/../include/opcode -I/home/jbglaw/repos/binutils_gdb/gdb/../opcodes/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../readline/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../zlib -I../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../include -I../libdecnumber -I/home/jbglaw/repos/binutils_gdb/gdb/../libdecnumber  -I/home/jbglaw/repos/binutils_gdb/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.6 -I/usr/include/python2.6 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o dwarf2read.o -MT dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo /home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c
/home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c:17480: error: redefinition of typedef ‘record_line_ftype’
/home/jbglaw/repos/binutils_gdb/gdb/buildsym.h:177: note: previous declaration of ‘record_line_ftype’ was here
make[1]: *** [dwarf2read.o] Error 1
make[1]: Leaving directory `/home/jbglaw/build/hppa-linux/build-gdb/gdb'
make: *** [all-gdb] Error 2

  Probably just missed a small part of the patch which removed the
second definition?

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:                 Gib Dein Bestes. Dann übertriff Dich selbst!
the second  :

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address)
  2015-05-28  9:27   ` [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address) Jan-Benedict Glaw
@ 2015-05-28 13:58     ` Maciej W. Rozycki
  2015-05-28 16:52       ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Maciej W. Rozycki @ 2015-05-28 13:58 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: Doug Evans, gdb-patches

On Thu, 28 May 2015, Jan-Benedict Glaw wrote:

> > > This patch just factors out the checking of a line address
> > > to improve the S/N ratio of the calling function.
> > >
> > > 2015-03-12  Doug Evans  <dje@google.com>
> > >
> > >         * dwarf2read.c (record_line_ftype): New typedef.
> > >         (check_line_address): New function.
> > >         (dwarf_decode_lines_1): Call it.
> > 
> > Committed.
> 
> Seems it's breaking, see eg. this xtensa-linux build
> (http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=442962),
> or hppa-linux
> (http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=443000):
> 
> [...]
>  gcc -g -O2   -I. -I/home/jbglaw/repos/binutils_gdb/gdb -I/home/jbglaw/repos/binutils_gdb/gdb/common -I/home/jbglaw/repos/binutils_gdb/gdb/config -DLOCALEDIR="\"/home/jbglaw/build/hppa-linux/_install_/share/locale\"" -DHAVE_CONFIG_H -I/home/jbglaw/repos/binutils_gdb/gdb/../include/opcode -I/home/jbglaw/repos/binutils_gdb/gdb/../opcodes/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../readline/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../zlib -I../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../include -I../libdecnumber -I/home/jbglaw/repos/binutils_gdb/gdb/../libdecnumber  -I/home/jbglaw/repos/binutils_gdb/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.6 -I/usr/include/python2.6 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o dwarf2read.o -MT dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo /home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c
> /home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c:17480: error: redefinition of typedef Β‘record_line_ftypeΒ’
> /home/jbglaw/repos/binutils_gdb/gdb/buildsym.h:177: note: previous declaration of Β‘record_line_ftypeΒ’ was here
> make[1]: *** [dwarf2read.o] Error 1
> make[1]: Leaving directory `/home/jbglaw/build/hppa-linux/build-gdb/gdb'
> make: *** [all-gdb] Error 2
> 
>   Probably just missed a small part of the patch which removed the
> second definition?

 Also mips-linux; any build probably.

 The typedef in buildsym.h has to stay, it's already used elsewhere.  
It's the newly-added one in dwarf2read.c that has to go.  Both are 
identical anyway.

  Maciej

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

* Re: [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address)
  2015-05-28 13:58     ` Maciej W. Rozycki
@ 2015-05-28 16:52       ` Doug Evans
  2015-05-28 17:27         ` Maciej W. Rozycki
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2015-05-28 16:52 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Jan-Benedict Glaw, gdb-patches

On Thu, May 28, 2015 at 6:58 AM, Maciej W. Rozycki <macro@linux-mips.org> wrote:
> On Thu, 28 May 2015, Jan-Benedict Glaw wrote:
>
>> > > This patch just factors out the checking of a line address
>> > > to improve the S/N ratio of the calling function.
>> > >
>> > > 2015-03-12  Doug Evans  <dje@google.com>
>> > >
>> > >         * dwarf2read.c (record_line_ftype): New typedef.
>> > >         (check_line_address): New function.
>> > >         (dwarf_decode_lines_1): Call it.
>> >
>> > Committed.
>>
>> Seems it's breaking, see eg. this xtensa-linux build
>> (http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=442962),
>> or hppa-linux
>> (http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=443000):
>>
>> [...]
>>  gcc -g -O2   -I. -I/home/jbglaw/repos/binutils_gdb/gdb -I/home/jbglaw/repos/binutils_gdb/gdb/common -I/home/jbglaw/repos/binutils_gdb/gdb/config -DLOCALEDIR="\"/home/jbglaw/build/hppa-linux/_install_/share/locale\"" -DHAVE_CONFIG_H -I/home/jbglaw/repos/binutils_gdb/gdb/../include/opcode -I/home/jbglaw/repos/binutils_gdb/gdb/../opcodes/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../readline/.. -I/home/jbglaw/repos/binutils_gdb/gdb/../zlib -I../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../bfd -I/home/jbglaw/repos/binutils_gdb/gdb/../include -I../libdecnumber -I/home/jbglaw/repos/binutils_gdb/gdb/../libdecnumber  -I/home/jbglaw/repos/binutils_gdb/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.6 -I/usr/include/python2.6 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o dwarf2read.o -MT dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo /home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c
>> /home/jbglaw/repos/binutils_gdb/gdb/dwarf2read.c:17480: error: redefinition of typedef ‘record_line_ftype’
>> /home/jbglaw/repos/binutils_gdb/gdb/buildsym.h:177: note: previous declaration of ‘record_line_ftype’ was here
>> make[1]: *** [dwarf2read.o] Error 1
>> make[1]: Leaving directory `/home/jbglaw/build/hppa-linux/build-gdb/gdb'
>> make: *** [all-gdb] Error 2
>>
>>   Probably just missed a small part of the patch which removed the
>> second definition?
>
>  Also mips-linux; any build probably.
>
>  The typedef in buildsym.h has to stay, it's already used elsewhere.
> It's the newly-added one in dwarf2read.c that has to go.  Both are
> identical anyway.

Fixed.

The build didn't fail for me so I didn't see this.
I then tried several pure gcc versions (can't trust distro gcc defaults).
I got a failure with 4.3.3 but not with 4.[6-9].x.

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

        * dwarf2read.c (record_line_ftype): Remove, duplicate.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1ce616a..1e290c3 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17475,11 +17475,6 @@ psymtab_include_file_name (const struct
line_header *lh, int file_index,
   return include_name;
 }

-/* Function to record a line number.  */
-
-typedef void (record_line_ftype) (struct subfile *subfile, int line,
-                                 CORE_ADDR pc);
-
 /* State machine to track the state of the line number program.  */

 typedef struct

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

* Re: [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address)
  2015-05-28 16:52       ` Doug Evans
@ 2015-05-28 17:27         ` Maciej W. Rozycki
  0 siblings, 0 replies; 6+ messages in thread
From: Maciej W. Rozycki @ 2015-05-28 17:27 UTC (permalink / raw)
  To: Doug Evans; +Cc: Jan-Benedict Glaw, gdb-patches

On Thu, 28 May 2015, Doug Evans wrote:

> >  The typedef in buildsym.h has to stay, it's already used elsewhere.
> > It's the newly-added one in dwarf2read.c that has to go.  Both are
> > identical anyway.
> 
> Fixed.

 Thanks!

> The build didn't fail for me so I didn't see this.
> I then tried several pure gcc versions (can't trust distro gcc defaults).
> I got a failure with 4.3.3 but not with 4.[6-9].x.

 The version I've been using is 6.0 head, so I guess in the quest for 
perfection GCC has become strictier since 4.9 here as well.  It might be 
worth trying 5.0, being a proper release rather than WIP.

 Offhand I can't tell if the complaint was legitimate or not.  I suspect 
it was, even though the redefinition merely repeated the original, but in 
any case the extra typedef was redundant.

  Maciej

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 20:03 [PATCH 3/6] DWARF Two Level Line Tables: check_line_address Doug Evans
2015-05-27 20:28 ` Doug Evans
2015-05-28  9:27   ` [BUILDROBOT] error: redefinition of typedef ‘record_line_ftype’ (was: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address) Jan-Benedict Glaw
2015-05-28 13:58     ` Maciej W. Rozycki
2015-05-28 16:52       ` Doug Evans
2015-05-28 17:27         ` Maciej W. Rozycki

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