Switch to DWARF-2 on sparc-sun-solaris2.7+

Eric Botcazou ebotcazou@libertysurf.fr
Sun Apr 4 15:30:00 GMT 2004


> Unfortunately, I don't remember the details at this point; I ran into
> these problems several years ago when I was finishing up the gcc dwarf2
> implementation.

The most relevant document returned by Google about the problem is a message 
from DJ:  http://gcc.gnu.org/ml/gcc-bugs/2001-12/msg00749.html

There was a problem with unaligned dynamic relocations for DWARF-2 EH, which 
were causing the dynamic linker to abort.  I presume DJ was working with GNU 
binutils so he probably didn't see any problem at compile-time.

The native SPARC/Solaris port has been using DWARF-2 EH for a while now and 
I've never seen any similar problem reported in the GCC bug database.  I'm 
under the impression that this has been definitively fixed by these lines in 
dwarf2out.c:output_call_frame_info

    /* Ug.  Some platforms can't do unaligned dynamic relocations at all.  */
      if (eh_personality_libfunc && per_encoding == DW_EH_PE_aligned)
	{
	  int offset = (  4		/* Length */
			+ 4		/* CIE Id */
			+ 1		/* CIE version */
			+ strlen (augmentation) + 1	/* Augmentation */
			+ size_of_uleb128 (1)		/* Code alignment */
			+ size_of_sleb128 (DWARF_CIE_DATA_ALIGNMENT)
			+ 1		/* RA column */
			+ 1		/* Augmentation size */
			+ 1		/* Personality encoding */ );
	  int pad = -offset & (PTR_SIZE - 1);

	  augmentation_size += pad;

	  /* Augmentations should be small, so there's scarce need to
	     iterate for a solution.  Die if we exceed one uleb128 byte.  */
	  if (size_of_uleb128 (augmentation_size) != 1)
	    abort ();
	}

which are guarded by

  if (for_eh)

We have also these lines:

      if (augmentation[0])
	{
	  if (any_lsda_needed)
	    {
	      int size = size_of_encoded_value (lsda_encoding);

	      if (lsda_encoding == DW_EH_PE_aligned)
		{
		  int offset = (  4		/* Length */
				+ 4		/* CIE offset */
				+ 2 * size_of_encoded_value (fde_encoding)
				+ 1		/* Augmentation size */ );
		  int pad = -offset & (PTR_SIZE - 1);

		  size += pad;
		  if (size_of_uleb128 (size) != 1)
		    abort ();
		}

	      dw2_asm_output_data_uleb128 (size, "Augmentation size");

	      if (fde->uses_eh_lsda)
		{
		  ASM_GENERATE_INTERNAL_LABEL (l1, "LLSDA",
					       fde->funcdef_number);
		  dw2_asm_output_encoded_addr_rtx (
			lsda_encoding, gen_rtx_SYMBOL_REF (Pmode, l1),
			"Language Specific Data Area");
		}
	      else
		{
		  if (lsda_encoding == DW_EH_PE_aligned)
		    ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
		  dw2_asm_output_data
		    (size_of_encoded_value (lsda_encoding), 0,
		     "Language Specific Data Area (none)");
		}

which are not guarded by if (for_eh).

Is that not sufficient to avoid the problem for debug info?

> Perhaps the sparc64 Solaris binutils don't have this problem--perhaps the
> sparc32 Solaris binutils don't have it anymore, either.  If the GDB
> testsuite gets reasonable results when you use the system binutils, I
> would go ahead with this change--but please do test with them, not just
> with the GNU ones.

All my testing was done with Sun binutils.  Using DWARF-2 causes the number 
of failures in the GDB 6.1pre testsuite to drop from 100 to 66:

--- mail-report-0.log   Sun Apr  4 11:23:26 2004
+++ mail-report-1.log   Sun Apr  4 11:23:37 2004
@@ -42,13 +42,8 @@
 FAIL: gdb.asm/asm-source.exp: x/i &staticvar (timeout)
 FAIL: gdb.asm/asm-source.exp: disassem &staticvar &staticvar+1 (timeout)
 FAIL: gdb.asm/asm-source.exp: look at static function
-FAIL: gdb.base/bigcore.exp: check next heap (address 0x2b8210b8)
-FAIL: gdb.base/bigcore.exp: check prev heap (address 0x2bcfb008)
-FAIL: gdb.base/callfuncs.exp: p t_float_values(3.14159,-2.3765)
-FAIL: gdb.base/callfuncs.exp: p t_float_values(float_val1,float_val2)
-FAIL: gdb.base/callfuncs.exp: p t_float_values(3.14159,float_val2)
-FAIL: gdb.base/callfuncs.exp: p t_float_values(float_val1,-2.3765)
-XPASS: gdb.base/constvars.exp: ptype qux1
+FAIL: gdb.base/bigcore.exp: check next heap (address 0x2aa610c0)
+FAIL: gdb.base/bigcore.exp: check prev heap (address 0x2aa6cff8)
 FAIL: gdb.base/fileio.exp: System with invalid command returns 127
 FAIL: gdb.base/float.exp: info float
 FAIL: gdb.base/interrupt.exp: call function after waking it (the program 
exited)
@@ -56,56 +51,25 @@
 FAIL: gdb.base/interrupt.exp: continue
 FAIL: gdb.base/interrupt.exp: echo data (timeout)
 FAIL: gdb.base/interrupt.exp: send end of file
+FAIL: gdb.base/nodebug.exp: p top
+FAIL: gdb.base/nodebug.exp: whatis top
+FAIL: gdb.base/nodebug.exp: p middle
+FAIL: gdb.base/nodebug.exp: whatis middle
+FAIL: gdb.base/nodebug.exp: whatis datalocal
+FAIL: gdb.base/nodebug.exp: ptype datalocal
+FAIL: gdb.base/nodebug.exp: whatis bsslocal
+FAIL: gdb.base/nodebug.exp: ptype bsslocal
 FAIL: gdb.base/readline.exp: Simple operate-and-get-next - C-o for p 1
 FAIL: gdb.base/readline.exp: operate-and-get-next with secondary prompt - 
send end
 FAIL: gdb.base/readline.exp: Simple operate-and-get-next - C-o for p 7
-FAIL: gdb.base/relocate.exp: static variables have different addresses
 FAIL: gdb.base/shreloc.exp: (msymbol) relocated static vars have different 
addresses
 FAIL: gdb.base/shreloc.exp: (msymbol) relocated extern vars have different 
addresses
 FAIL: gdb.base/shreloc.exp: (msymbol) relocated functions have different 
addresses
 XPASS: gdb.base/signals.exp: continue to handler
-XPASS: gdb.base/volatile.exp: ptype qux2
-FAIL: gdb.cp/classes.exp: ptype obj_with_enum
-FAIL: gdb.cp/inherit.exp: print g_vE
-FAIL: gdb.cp/namespace.exp: print 'AAA::c'
-FAIL: gdb.cp/namespace.exp: print AAA::c
-FAIL: gdb.cp/namespace.exp: print AAA::xyzq('x')
-FAIL: gdb.cp/namespace.exp: print BBB::CCC::xyzq('x')
-FAIL: gdb.cp/namespace.exp: print BBB::Class::xyzq
-FAIL: gdb.cp/namespace.exp: print c
-FAIL: gdb.cp/namespace.exp: print cc
-FAIL: gdb.cp/namespace.exp: print 'C::cc'
-FAIL: gdb.cp/namespace.exp: print C::cc
-FAIL: gdb.cp/namespace.exp: print cd
-FAIL: gdb.cp/namespace.exp: print C::D::cd
-FAIL: gdb.cp/namespace.exp: print 'E::cde'
-FAIL: gdb.cp/namespace.exp: print E::cde
-FAIL: gdb.cp/namespace.exp: print shadow
-FAIL: gdb.cp/namespace.exp: print E::ce
-FAIL: gdb.cp/namespace.exp: ptype C
-FAIL: gdb.cp/namespace.exp: ptype E
-FAIL: gdb.cp/namespace.exp: ptype CClass
-FAIL: gdb.cp/namespace.exp: ptype CClass::NestedClass
-FAIL: gdb.cp/namespace.exp: ptype C::CClass
-FAIL: gdb.cp/namespace.exp: ptype C::CClass::NestedClass
-FAIL: gdb.cp/namespace.exp: ptype C::NestedClass
-FAIL: gdb.cp/namespace.exp: print cOtherFile
-FAIL: gdb.cp/namespace.exp: ptype OtherFileClass
-FAIL: gdb.cp/namespace.exp: ptype C::OtherFileClass
-FAIL: gdb.cp/namespace.exp: print cX
-FAIL: gdb.cp/namespace.exp: print 'F::cXf'
-FAIL: gdb.cp/namespace.exp: print F::cXf
-FAIL: gdb.cp/namespace.exp: print F::cXfX
-FAIL: gdb.cp/namespace.exp: print X
-FAIL: gdb.cp/namespace.exp: print 'G::Xg'
-FAIL: gdb.cp/namespace.exp: print G::Xg
-FAIL: gdb.cp/namespace.exp: print G::XgX
-FAIL: gdb.cp/namespace.exp: print cXOtherFile
-FAIL: gdb.cp/namespace.exp: print XOtherFile
-FAIL: gdb.cp/pr-1553.exp: ptype c_var
-FAIL: gdb.cp/pr-1553.exp: ptype E::F
-FAIL: gdb.cp/rtti.exp: print *obj
-FAIL: gdb.cp/rtti.exp: print *obj3
+FAIL: gdb.base/structs2.exp: structs2 continue1 (PRMS 13536)
+FAIL: gdb.base/structs2.exp: structs2 continue2 (PRMS 13536)
+FAIL: gdb.cp/annota3.exp: annotate-quit (pattern 1)
+FAIL: gdb.cp/templates.exp: ptype Baz
 FAIL: gdb.mi/mi-basics.exp: environment-directory arg operation
 FAIL: gdb.mi/mi-basics.exp: environment-directory empty-string operation
 FAIL: gdb.mi/mi-basics.exp: environment-path dir1 dir2 operation
@@ -120,12 +84,12 @@

                === gdb Summary ===

-# of expected passes           9663
-# of unexpected failures       100
-# of unexpected successes      3
-# of expected failures         57
+# of expected passes           9696
+# of unexpected failures       66
+# of unexpected successes      1
+# of expected failures         47
 # of unknown successes         12
-# of known failures            21
+# of known failures            34
 # of unresolved testcases      1
 # of untested testcases                3
 # of unsupported tests         5

-- 
Eric Botcazou



More information about the Gcc-patches mailing list