This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA/RFC: Change Sparc64 gdb.asm tests to use -gdwarf2 instead of -gstabs


Not approved.

You stepped into one of the test suite cow pies ... sorry about that.

Instead of hard-wiring the debug format, the test should use the
value of debug_flags.  Copy this bit of code from lib/ada.exp
(which was copied from default_target_compile):

  set dest [target_info name]
  if [board_info $dest exists debug_flags] {
    append add_flags " [board_info $dest debug_flags]";
  } else {
    append add_flags " -g"
  }

For asm-source.exp it would be more like:

  switch --glob -- [istarget] {
    "alpha*-*-*" {
      set asm-arch alpha
      set asm-flags "-no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}"
      set debug-flags "-gdwarf-2"
    }
    ...
  }

  # Override the flags for this target board.
  set dest [target_info name]
  if { [board_info $dest exists debug_flags] } then {
    set debug_flags "board_info $dest debug_flags"
  }
  if { $debug_flags == "stabs+" } then {
    # GNU assembler does not support stabs+
    set debug_flags "stabs"
  }
  ...
  set asm-flags "$debug_flags $asm-flags"

Or something like that.  The point is to honor debug_flags.  This is the
same mechanism that C, C++, and Ada use to select which debug format to
test.

I run my test bed with both dwarf-2 and stabs+, just by supplying
the right flags to runtest (see below).

It would be nice if the assembler supported "-g" with a good default
value.  But it doesn't.  So we have to keep all the existing
per-architecture code to choose between -gdwarf-2 and -gstabs, with the
override at the end.

Also ... how did this ever work on sparc64 with stabs?  I thought that
stabs and stabs+ have never worked on 64-bit machines!  Am I missing a
clue?

nick> So this patch works around a known failure in GAS, which means that
nick> possibly the problem might be forgotten.

It's okay to pick whatever makes the most sense for the default.
gcc picks dwarf-2 so dwarf-2 is fine.  It's the tester's job
to test with all the supported debug formats.  That person would
file a bug report against gas -gstabs, and then the gas maintainers
would fix it, laugh at it, or whatever.

If there is a bug report filed for the bug, then the test can
return XFAIL or KFAIL with the PR number (XFAIL for a PR against
the assembler, KFAIL for a PR against gdb).

Lastly, you have to test the patch, and say how you tested it
(obviously by running asm-source.exp on a sparc64).
Please test with all three of:

  runtest
  runtest --target_board unix/gdb:debug_flags=dwarf-2
  runtest --target_board unix/gdb:debug_flags=stabs+

Whew.  If you want me to do the boring mechanical $debug_flags part
first, and then you just flip the switch on the default and run
the sparc64 tests, I'm up for that.  Or you can do the boring
mechanical part if you want.

Michael C

===

2004-07-26  Nick Clifton  <nickc@redhat.com>

	* gdb.asm/asm-source.exp: Use -gdwarf2 in preference to
	-gstabs for Sparc64.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]