Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] Dwarf2 testsuite
@ 2004-10-08 18:35 Daniel Jacobowitz
  2004-10-08 19:45 ` Michael Chastain
  2004-10-08 20:38 ` Michael Snyder
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2004-10-08 18:35 UTC (permalink / raw)
  To: gdb-patches

This patch adds a sample test for DWARF-2 unit testing.  It requires:
  - gas, for the .uleb128/.sleb128 directives among other things
  - ELF; it could probably be made to work on non-ELF dwarf2 systems
    but I don't know what changes would be necessary.  Perhaps those
    should be tested separately.

I haven't tried, but I wrote it with the intent that it would not care about
the host beyond that; it should run on 64-bit ELF targets OK.

It just includes a trivial test containing hand-written DIEs for a single
CU.  This one file I annotated exhaustively, and let me tell you, it was
exhausting; for future tests I will allow them to be self-documenting (the
comments don't say anything that compiling the file and running readelf
won't tell you).

The test itself just demonstrates that the dwarf2 reader isn't completely
busted.  But more interesting tests could be easily added.

Look OK?  Suggestions?

-- 
Daniel Jacobowitz

2004-10-08  Daniel Jacobowitz  <dan@debian.org>

	* configure.in: Add gdb.dwarf2.
	* configure: Regenerated.
	* Makefile.in: Add gdb.dwarf2.
	* gdb.dwarf2/Makefile.in, gdb.dwarf2/dw2-basic.S,
	gdb.dwarf2/dw2-basic.exp, gdb.dwarf2/main.c, gdb.dwarf2/file1.txt,
	gdb.dwarf2/file2.txt: New files.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/Makefile.in,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.in
--- Makefile.in	20 Aug 2004 14:52:36 -0000	1.10
+++ Makefile.in	8 Oct 2004 18:27:33 -0000
@@ -36,6 +36,7 @@ EXEEXT = @EXEEXT@
 SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
 ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
+	gdb.dwarf2 \
 	gdb.fortran gdb.java gdb.mi gdb.objc gdb.threads gdb.trace \
 	$(SUBDIRS)
 
Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/configure,v
retrieving revision 1.15
diff -u -p -r1.15 configure
--- configure	17 Aug 2004 16:33:25 -0000	1.15
+++ configure	8 Oct 2004 18:27:33 -0000
@@ -1052,8 +1052,8 @@ ac_given_srcdir=$srcdir
 trap 'rm -fr `echo "Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
-  gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
+  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
@@ -1149,8 +1149,8 @@ cat >> $CONFIG_STATUS <<EOF
 CONFIG_FILES=\${CONFIG_FILES-"Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
-  gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
+  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/configure.in,v
retrieving revision 1.16
diff -u -p -r1.16 configure.in
--- configure.in	17 Aug 2004 16:33:26 -0000	1.16
+++ configure.in	8 Oct 2004 18:27:33 -0000
@@ -121,6 +121,6 @@ AC_CONFIG_SUBDIRS($configdirs)
 AC_OUTPUT([Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
-  gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
+  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile])
diff -urN empty/Makefile.in gdb.dwarf2/Makefile.in
--- empty/Makefile.in	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/Makefile.in	2004-10-08 13:02:16.000000000 -0400
@@ -0,0 +1,18 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+EXECUTABLES = *.x
+
+all info install-info dvi install uninstall installcheck check:
+	@echo "Nothing to be done for $@..."
+
+clean mostlyclean:
+	-rm -f *~ *.o a.out *.x *.ci *.tmp
+	-rm -f core core.coremaker coremaker.core corefile
+	-rm -f $(EXECUTABLES)
+
+distclean maintainer-clean realclean: clean
+	-rm -f *~ core
+	-rm -f Makefile config.status config.log
+	-rm -f *-init.exp
+	-rm -fr *.log summary detail *.plog *.sum *.psum site.*
diff -urN empty/dw2-basic.S gdb.dwarf2/dw2-basic.S
--- empty/dw2-basic.S	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/dw2-basic.S	2004-10-08 14:23:40.000000000 -0400
@@ -0,0 +1,201 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2004 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+ 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.  */
+
+/* Test a minimal file containing DWARF-2 information.  This test also
+   serves as a skeleton for other DWARF-2 tests.  Most other tests will
+   not be this extensively itemized and commented...  */
+
+/* Dummy function to provide debug information for.  */
+
+	.text
+.Lbegin_text1:
+	.globl func_cu1
+	.type func_cu1, %function
+func_cu1:
+.Lbegin_func_cu1:
+	.int 0
+.Lend_func_cu1:
+	.size func_cu1, .-func_cu1
+.Lend_text1:
+
+/* Debug information */
+
+	.section .debug_info
+.Lcu1_begin:
+	/* CU header */
+	.int	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
+.Lcu1_start:
+	.short	2				/* DWARF Version */
+	.int	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	/* CU die */
+	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
+	.int	.Lline1_begin			/* DW_AT_stmt_list */
+	.int	.Lend_text1			/* DW_AT_high_pc */
+	.int	.Lbegin_text1			/* DW_AT_low_pc */
+	.ascii	"file1.txt\0"			/* DW_AT_name */
+	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
+	.byte	1				/* DW_AT_language (C) */
+
+	/* func_cu1 */
+	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
+	.byte		1			/* DW_AT_external */
+	.byte		1			/* DW_AT_decl_file */
+	.byte		2			/* DW_AT_decl_line */
+	.ascii		"func_cu1\0"		/* DW_AT_name */
+	.int		.Ltype_int-.Lcu1_begin	/* DW_AT_type */
+	.int		.Lbegin_func_cu1	/* DW_AT_low_pc */
+	.int		.Lend_func_cu1		/* DW_AT_high_pc */
+	.byte		1			/* DW_AT_frame_base: length */
+	.byte		0x55			/* DW_AT_frame_base: DW_OP_reg5 */
+
+.Ltype_int:
+	.uleb128	3			/* Abbrev: DW_TAG_base_type */
+	.ascii		"int\0"			/* DW_AT_name */
+	.byte		4			/* DW_AT_byte_size */
+	.byte		5			/* DW_AT_encoding */
+
+	.byte		0			/* End of children of CU */
+
+.Lcu1_end:
+
+/* Abbrev table */
+	.section .debug_abbrev
+.Labbrev1_begin:
+	.uleb128	1			/* Abbrev code */
+	.uleb128	0x11			/* DW_TAG_compile_unit */
+	.byte		1			/* has_children */
+	.uleb128	0x10			/* DW_AT_stmt_list */
+	.uleb128	0x6			/* DW_FORM_data4 */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x25			/* DW_AT_producer */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x13			/* DW_AT_language */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	2			/* Abbrev code */
+	.uleb128	0x2e			/* DW_TAG_subprogram */
+	.byte		0			/* has_children */
+	.uleb128	0x3f			/* DW_AT_external */
+	.uleb128	0xc			/* DW_FORM_flag */
+	.uleb128	0x3a			/* DW_AT_decl_file */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x3b			/* DW_AT_decl_line */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x49			/* DW_AT_type */
+	.uleb128	0x13			/* DW_FORM_ref4 */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x40			/* DW_AT_frame_base */
+	.uleb128	0xa			/* DW_FORM_block1 */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	3			/* Abbrev code */
+	.uleb128	0x24			/* DW_TAG_base_type */
+	.byte		0			/* has_children */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0xb			/* DW_AT_byte_size */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x3e			/* DW_AT_encoding */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+/* Line table */
+	.section .debug_line
+.Lline1_begin:
+	.int		.Lline1_end - .Lline1_start	/* Initial length */
+.Lline1_start:
+	.short		2			/* Version */
+	.int		.Lline1_lines - .Lline1_hdr	/* header_length */
+.Lline1_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+ 	.byte		1			/* line_range */
+	.byte		0x10			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+	.byte		1
+	.byte		1
+	.byte		0
+	.byte		0
+	.byte		0
+	.byte		1
+	.byte		0
+	.byte		0
+	.byte		1
+	.byte		0
+	.byte		0
+	.byte		0
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii		"file1.txt\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline1_lines:
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.int		.Lbegin_func_cu1
+
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	3	/* ... to 4 */
+
+	.byte		1	/* DW_LNS_copy */
+
+	.byte		1	/* DW_LNS_copy (second time as an end-of-prologue marker) */
+
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.int		.Lend_func_cu1
+
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+
+.Lline1_end:
diff -urN empty/dw2-basic.exp gdb.dwarf2/dw2-basic.exp
--- empty/dw2-basic.exp	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/dw2-basic.exp	2004-10-08 14:29:41.000000000 -0400
@@ -0,0 +1,52 @@
+#   Copyright 2004
+#   Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+    && ![istarget *-*-elf*]
+    && ![istarget arm-*-eabi*]
+    && ![istarget powerpc-*-eabi*]} {
+    return 0  
+}
+
+set testfile "dw2-basic"
+set srcfile ${testfile}.S
+set binfile ${objdir}/${subdir}/${testfile}.x
+
+if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+    return -1
+}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
+    return -1
+}
+
+if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+gdb_test "list func_cu1" "4\tFile 1 Line 4"
+gdb_test "ptype func_cu1" "type = int \\(\\)"
diff -urN empty/file1.txt gdb.dwarf2/file1.txt
--- empty/file1.txt	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/file1.txt	2004-10-08 13:04:55.000000000 -0400
@@ -0,0 +1,8 @@
+File 1 Line 1
+File 1 Line 2
+File 1 Line 3
+File 1 Line 4
+File 1 Line 5
+File 1 Line 6
+File 1 Line 7
+File 1 Line 8
diff -urN empty/file2.txt gdb.dwarf2/file2.txt
--- empty/file2.txt	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/file2.txt	2004-10-08 13:05:12.000000000 -0400
@@ -0,0 +1,8 @@
+File 2 Line 1
+File 2 Line 2
+File 2 Line 3
+File 2 Line 4
+File 2 Line 5
+File 2 Line 6
+File 2 Line 7
+File 2 Line 8
diff -urN empty/main.c gdb.dwarf2/main.c
--- empty/main.c	1969-12-31 19:00:00.000000000 -0500
+++ gdb.dwarf2/main.c	2004-10-08 14:18:34.000000000 -0400
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2004 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+ 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.  */
+
+/* Dummy main function.  */
+
+int
+main()
+{
+  return 0;
+}


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 18:35 [rfa] Dwarf2 testsuite Daniel Jacobowitz
@ 2004-10-08 19:45 ` Michael Chastain
  2004-10-08 20:25   ` Daniel Jacobowitz
  2004-10-08 20:38 ` Michael Snyder
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Chastain @ 2004-10-08 19:45 UTC (permalink / raw)
  To: gdb-patches, drow

Okay, I threw this in my in-queue and I'll reply on Sunday (estimated).
Some random comments:

. It's okay to have tests that execute on some systems and not others,
  as long as gnu/hurd and gnu/linux are included.  This is actually
  covered in section 6, "platforms to support", in
    http://www.fsf.org/prep/maintain/maintain.html

. Makefile.in needs a copyright notice.  Actually all those little
  subdirectories shouldn't even need configure/makefile stuff,
  but I don't wanna get into that right now.

. The self-documenting bit is cool, just leave a comment
  "compile the file and run readelf -w to see what is going on".
  In fact you might want to strip the comments from this file,
  because when I go to debug something with a file like this,
  I don't trust the comments in the file anyways.

. We definitely need some infrastructure to return what the
  debug format is, but you can just ignore that and do whatever
  for now, as long as it doesn't totally blow up when I explicitly
  test with "runtest /gdb:debug_flags=-gstabs+ -g2".

More on Sunday.

Michael

2004-10-08  Daniel Jacobowitz  <dan@debian.org>

	* configure.in: Add gdb.dwarf2.
	* configure: Regenerated.
	* Makefile.in: Add gdb.dwarf2.
	* gdb.dwarf2/Makefile.in, gdb.dwarf2/dw2-basic.S,
	gdb.dwarf2/dw2-basic.exp, gdb.dwarf2/main.c, gdb.dwarf2/file1.txt,
	gdb.dwarf2/file2.txt: New files.


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 19:45 ` Michael Chastain
@ 2004-10-08 20:25   ` Daniel Jacobowitz
  2004-10-11  3:50     ` Michael Chastain
  2004-10-12 14:44     ` Daniel Jacobowitz
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2004-10-08 20:25 UTC (permalink / raw)
  To: Michael Chastain; +Cc: gdb-patches

On Fri, Oct 08, 2004 at 03:45:28PM -0400, Michael Chastain wrote:
> Okay, I threw this in my in-queue and I'll reply on Sunday (estimated).

Cool.  Thank you.

> Some random comments:
> 
> . It's okay to have tests that execute on some systems and not others,
>   as long as gnu/hurd and gnu/linux are included.  This is actually
>   covered in section 6, "platforms to support", in
>     http://www.fsf.org/prep/maintain/maintain.html

Hmm, Hurd is ELF also, so that should be fine.

> . Makefile.in needs a copyright notice.  Actually all those little
>   subdirectories shouldn't even need configure/makefile stuff,
>   but I don't wanna get into that right now.

OK.

> . The self-documenting bit is cool, just leave a comment
>   "compile the file and run readelf -w to see what is going on".
>   In fact you might want to strip the comments from this file,
>   because when I go to debug something with a file like this,
>   I don't trust the comments in the file anyways.

I'd prefer to leave the comments now that I've written them, for two
reasons:
 (A) !#(*& it, I spent a lot of effort on those comments!
 (B) they make it easier to make a copy with only an incremental change

> . We definitely need some infrastructure to return what the
>   debug format is, but you can just ignore that and do whatever
>   for now, as long as it doesn't totally blow up when I explicitly
>   test with "runtest /gdb:debug_flags=-gstabs+ -g2".

It won't blow up.  In fact, if GDB is working correctly, it will pass -
if it doesn't, that's a bug.  Mixed stabs and dwarf2 ought to work.

-- 
Daniel Jacobowitz


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 18:35 [rfa] Dwarf2 testsuite Daniel Jacobowitz
  2004-10-08 19:45 ` Michael Chastain
@ 2004-10-08 20:38 ` Michael Snyder
  2004-10-08 22:16   ` Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Snyder @ 2004-10-08 20:38 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> This patch adds a sample test for DWARF-2 unit testing.  It requires:
>   - gas, for the .uleb128/.sleb128 directives among other things
>   - ELF; it could probably be made to work on non-ELF dwarf2 systems
>     but I don't know what changes would be necessary.  Perhaps those
>     should be tested separately.
> 
> I haven't tried, but I wrote it with the intent that it would not care about
> the host beyond that; it should run on 64-bit ELF targets OK.
> 
> It just includes a trivial test containing hand-written DIEs for a single
> CU.  This one file I annotated exhaustively, and let me tell you, it was
> exhausting; for future tests I will allow them to be self-documenting (the
> comments don't say anything that compiling the file and running readelf
> won't tell you).
> 
> The test itself just demonstrates that the dwarf2 reader isn't completely
> busted.  But more interesting tests could be easily added.
> 
> Look OK?  Suggestions?
> 

Looks exhausting.  I'm glad you're doing this.

Dan, what would you think about (somebody) writing a tool
that could read some sort of description (eg. what's in
your comments), and generate the dwarf2 recs?  Sort of a
simple compiler that accepts, in effect, the dwarf2 spec
as input?  Would that be, perhaps, less of an effort than
writing a sufficiently large subset of tests by hand?



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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 20:38 ` Michael Snyder
@ 2004-10-08 22:16   ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2004-10-08 22:16 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Fri, Oct 08, 2004 at 01:38:48PM -0700, Michael Snyder wrote:
> Daniel Jacobowitz wrote:
> >This patch adds a sample test for DWARF-2 unit testing.  It requires:
> >  - gas, for the .uleb128/.sleb128 directives among other things
> >  - ELF; it could probably be made to work on non-ELF dwarf2 systems
> >    but I don't know what changes would be necessary.  Perhaps those
> >    should be tested separately.
> >
> >I haven't tried, but I wrote it with the intent that it would not care 
> >about
> >the host beyond that; it should run on 64-bit ELF targets OK.
> >
> >It just includes a trivial test containing hand-written DIEs for a single
> >CU.  This one file I annotated exhaustively, and let me tell you, it was
> >exhausting; for future tests I will allow them to be self-documenting (the
> >comments don't say anything that compiling the file and running readelf
> >won't tell you).
> >
> >The test itself just demonstrates that the dwarf2 reader isn't completely
> >busted.  But more interesting tests could be easily added.
> >
> >Look OK?  Suggestions?
> >
> 
> Looks exhausting.  I'm glad you're doing this.
> 
> Dan, what would you think about (somebody) writing a tool
> that could read some sort of description (eg. what's in
> your comments), and generate the dwarf2 recs?  Sort of a
> simple compiler that accepts, in effect, the dwarf2 spec
> as input?  Would that be, perhaps, less of an effort than
> writing a sufficiently large subset of tests by hand?

<chanting> Do it!  Do it!  Do it! </chanting>

Does that answer your question?  Yes, it would absolutely be less
effort.  It would be a little tricky.  Done properly could
encapsulate most of the time-consuming bits - in particular, it could
handle testing both 32-bit and 64-bit mode, and it could automate (for
the common cases at least) the nasty bits of .debug_abbrev and
.debug_line.

I'm not sure what it would output.  Maybe a text file full of .byte
directives, so that we could #include it from an asm file with the
labels referenced in it.

-- 
Daniel Jacobowitz


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 20:25   ` Daniel Jacobowitz
@ 2004-10-11  3:50     ` Michael Chastain
  2004-10-12 14:42       ` Daniel Jacobowitz
  2004-10-12 14:44     ` Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Chastain @ 2004-10-11  3:50 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches

Okay, it works fine in my test bed with:

  gdb 6.2.1 and gdb HEAD
  gcc 2, gcc 3, gcc 4pre
  dwarf-2 and stabs+ (not that it makes any difference)
  -feliminate-dwarf2-dups or not (ditto)

drow> I'd prefer to leave the comments now that I've written them, for two
drow> reasons:
drow>  (A) !#(*& it, I spent a lot of effort on those comments!
drow>  (B) they make it easier to make a copy with only an incremental change

Okay with me.

Two nits:

  The copyright notice to Makefile.in.  Grab from gdb.fortran/Makefile.in
  if you like.  (And yeah, the copyright notice in main.c makes me laugh
  at my own stubbornness).

  Is file2.txt used at all?  I could not find a reference to it.

With those things fixed ... approved.

Michael

2004-10-08  Daniel Jacobowitz  <dan@debian.org>

	* configure.in: Add gdb.dwarf2.
	* configure: Regenerated.
	* Makefile.in: Add gdb.dwarf2.
	* gdb.dwarf2/Makefile.in, gdb.dwarf2/dw2-basic.S,
	gdb.dwarf2/dw2-basic.exp, gdb.dwarf2/main.c, gdb.dwarf2/file1.txt,
	gdb.dwarf2/file2.txt: New files.


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-11  3:50     ` Michael Chastain
@ 2004-10-12 14:42       ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2004-10-12 14:42 UTC (permalink / raw)
  To: Michael Chastain; +Cc: gdb-patches

On Sun, Oct 10, 2004 at 11:50:33PM -0400, Michael Chastain wrote:
> Okay, it works fine in my test bed with:
> 
>   gdb 6.2.1 and gdb HEAD
>   gcc 2, gcc 3, gcc 4pre
>   dwarf-2 and stabs+ (not that it makes any difference)
>   -feliminate-dwarf2-dups or not (ditto)
> 
> drow> I'd prefer to leave the comments now that I've written them, for two
> drow> reasons:
> drow>  (A) !#(*& it, I spent a lot of effort on those comments!
> drow>  (B) they make it easier to make a copy with only an incremental change
> 
> Okay with me.
> 
> Two nits:
> 
>   The copyright notice to Makefile.in.  Grab from gdb.fortran/Makefile.in
>   if you like.  (And yeah, the copyright notice in main.c makes me laugh
>   at my own stubbornness).
> 
>   Is file2.txt used at all?  I could not find a reference to it.
> 
> With those things fixed ... approved.

Committed with those changes.  Thanks!  Next, I'll try to write a test
for inter-cu...

-- 
Daniel Jacobowitz


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-08 20:25   ` Daniel Jacobowitz
  2004-10-11  3:50     ` Michael Chastain
@ 2004-10-12 14:44     ` Daniel Jacobowitz
  2004-10-12 15:54       ` Michael Chastain
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2004-10-12 14:44 UTC (permalink / raw)
  To: Michael Chastain, gdb-patches

On Fri, Oct 08, 2004 at 04:25:50PM -0400, Daniel Jacobowitz wrote:
> On Fri, Oct 08, 2004 at 03:45:28PM -0400, Michael Chastain wrote:
> > Okay, I threw this in my in-queue and I'll reply on Sunday (estimated).
> 
> Cool.  Thank you.
> 
> > Some random comments:
> > 
> > . It's okay to have tests that execute on some systems and not others,
> >   as long as gnu/hurd and gnu/linux are included.  This is actually
> >   covered in section 6, "platforms to support", in
> >     http://www.fsf.org/prep/maintain/maintain.html
> 
> Hmm, Hurd is ELF also, so that should be fine.

Oops, I missed this.  OK to commit?  Not tested...

-- 
Daniel Jacobowitz

2004-10-12  Daniel Jacobowitz  <dan@debian.org>

	* gdb.dwarf2/dw2-basic.exp: Run on Hurd also.

Index: dw2-basic.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-basic.exp,v
retrieving revision 1.1
diff -u -p -r1.1 dw2-basic.exp
--- dw2-basic.exp	12 Oct 2004 14:41:42 -0000	1.1
+++ dw2-basic.exp	12 Oct 2004 14:43:44 -0000
@@ -20,6 +20,7 @@
 # This test can only be run on targets which support DWARF-2 and use gas.
 # For now pick a sampling of likely targets.
 if {![istarget *-*-linux*]
+    && ![istarget *-*-gnu*]
     && ![istarget *-*-elf*]
     && ![istarget arm-*-eabi*]
     && ![istarget powerpc-*-eabi*]} {


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

* Re: [rfa] Dwarf2 testsuite
  2004-10-12 14:44     ` Daniel Jacobowitz
@ 2004-10-12 15:54       ` Michael Chastain
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Chastain @ 2004-10-12 15:54 UTC (permalink / raw)
  To: gdb-patches, drow

> Oops, I missed this.  OK to commit?  Not tested...

Approved.

> 2004-10-12  Daniel Jacobowitz  <dan@debian.org>
>
> 	* gdb.dwarf2/dw2-basic.exp: Run on Hurd also.


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

end of thread, other threads:[~2004-10-12 15:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-08 18:35 [rfa] Dwarf2 testsuite Daniel Jacobowitz
2004-10-08 19:45 ` Michael Chastain
2004-10-08 20:25   ` Daniel Jacobowitz
2004-10-11  3:50     ` Michael Chastain
2004-10-12 14:42       ` Daniel Jacobowitz
2004-10-12 14:44     ` Daniel Jacobowitz
2004-10-12 15:54       ` Michael Chastain
2004-10-08 20:38 ` Michael Snyder
2004-10-08 22:16   ` Daniel Jacobowitz

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