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]

Patch: lib/libgloss.exp prunes MULTILIB_EXTRA_OPTS as a character set, but is a string


Testing the CRIS gcc port, I found that DejaGnu didn't like some
of my multilibs.  Or more precisely, it mutilizes what comes
from the gcc target makefile fragment variable
MULTILIB_EXTRA_OPTS.  Looking at libgloss.exp, where multilibs
are processed, it appears to be processed as a character set
rather than a string; "string trimright" works on a character
set, (cf.
<URL:http://dev.scriptics.com/man/tcl8.4/TclCmd/string.htm#M48>),
but MULTILIB_EXTRA_OPTS is a string.  On the other hand, I don't
understand why there was '"'-trimming, so I might be missing
something.  Though it looks like a spurious but harmless '"'.  I
kept it, though.

For example, for the failure I saw, there was one multilib line
from gcc -print-multi-lib (here quoted):
"aout;@maout@mbest-lib-options", and the bug caused the final
"t" to disappear, because it's in the set "-beilmnopst".  Also,
the ";" wasn't stripped off when carving out MULTILIB_EXTRA_OPTS
from the default multilib.  I added ';' to the trimleft
character set, not worrying about pruning ".;" only as a string.

Now, it appears you'll only see this bug if you specify board
multilibs/variants in this format:
 set target_list "cris-xsim{elinux,linux,aout,arch=v10,}"
rather than:
 set target_list "cris-xsim{-melinux,-mlinux,-maout,-march=v10,}"
and even then, you'll find that "aout" (among others) is not
translated into "-maout", but through magic means into... bah,
read libgloss.exp yourself for the spells.  The manual doesn't
say much about testing multilib/variants AFAICT.  The point is
that the former format is the one used in examples in the manual
(cf. <URL:http://dejagnu.sourceforge.net/manual/global.html>:
'set target_list "mips-lsi-sim{,soft-float,el}"').

Please consider the following patch.  It's against the
sources.redhat.com repository.  AFAIK, sourceforge hosts the
official repository, but "cvs -d
:pserver:anonymous@cvs.dejagnu.sourceforge.net:/cvsroot/dejagnu
co dejagnu" doesn't work.  It seems the sourceforge dejagnu CVS
setup it at fault: the cvsweb interface at
<URL:http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dejagnu/>
lists only CVSROOT.

dejagnu:
2001-09-05  Hans-Peter Nilsson  <hp@axis.com>

	* lib/libgloss.exp (get_multilibs): Don't assume options from
	MULTILIB_EXTRA_OPTS is a set of characters when pruning from
	multilib options.  Trim all ".;" left of default options.

Index: libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.2
diff -c -p -r1.2 libgloss.exp
*** libgloss.exp	2000/06/09 13:14:35	1.2
--- libgloss.exp	2001/09/05 19:13:47
***************
*** 1,4 ****
! # Copyright (C) 92, 93, 94, 95, 96, 97, 98, 1999 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
--- 1,4 ----
! # Copyright (C) 92, 93, 94, 95, 96, 97, 98, 1999, 2001 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
*************** proc get_multilibs { args } {
*** 421,432 ****
      # set output [exec $objdump_name --file-headers objfmtst.o ]
      set default_multilib [exec $compiler --print-multi-lib]
      set default_multilib [lindex $default_multilib 0];
!     set extra [string trimleft $default_multilib "."]
  
      # extract the options and their directory names as know by gcc
      foreach i "[exec $compiler --print-multi-lib]" {
      	if {$extra != ""} {
! 	  set i [string trimright $i $extra"]
  	}
  	set opts ""
  	set dir ""
--- 421,434 ----
      # set output [exec $objdump_name --file-headers objfmtst.o ]
      set default_multilib [exec $compiler --print-multi-lib]
      set default_multilib [lindex $default_multilib 0];
!     set extra [string trimleft $default_multilib ".;"]
  
      # extract the options and their directory names as know by gcc
      foreach i "[exec $compiler --print-multi-lib]" {
      	if {$extra != ""} {
! 	    set i [string range $i 0 \
! 		    [expr [string length $i] - [string length $extra] - 1]]
! 	    set i [string trimright $i {"}]
  	}
  	set opts ""
  	set dir ""

brgds, H-P


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