Patchwork [testsuite] Adapt dg-function-on-line for IRIX

login
register
mail settings
Submitter Rainer Orth
Date Jan. 24, 2011, 12:13 p.m.
Message ID <yddy66a33fg.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/80146/
State New
Headers show

Comments

Rainer Orth - Jan. 24, 2011, 12:13 p.m.
Two g++.dg/debug/dwarf2 tests are currently failing on IRIX 6.5:

FAIL: g++.dg/debug/dwarf2/lineno-simple1.C scan-assembler main:[^\\\\t]*(\\\\t.(fnstart|frame|mask|file)[^\\\\t]*)*\\\\t[^:]+:12\\\\n
FAIL: g++.dg/debug/dwarf2/pr46527.C scan-assembler _ZN6StructIdE13defined_laterEv:[^\\\\t]*(\\\\t.(fnstart|frame|mask|file)[^\\\\t]*)*\\\\t[^:]+:12\\\\n

It turns out that the current implementation of dg-function-on-line is
the culprit: for the first failure, the code around the definition of
main looks like this:

         # /vol/gcc/src/hg/trunk/irix/gcc/testsuite/g++.dg/debug/dwarf2/lineno-s
imple1.C:12
        .loc 1 12 0
        .set    nomips16
        .ent    main
        .type   main, @function
main:
        .frame  $fp,16,$31              # vars= 0, regs= 1/0, args= 0, gp= 0
        .mask   0x40000000,-8
        .fmask  0x00000000,0
        .set    noreorder
        .set    nomacro
         # basic block 2
        addiu   $sp,$sp,-16
.LCFI6 = .
        sd      $fp,8($sp)
.LCFI7 = .
        move    $fp,$sp
.LCFI8 = .
        move    $2,$0
.LCFI8 = .
        move    $2,$0
         # /vol/gcc/src/hg/trunk/irix/gcc/testsuite/g++.dg/debug/dwarf2/lineno-s
imple1.C:13

The pattern used by dg-function-on-line for all but hppa*-*-* is

    [format {%s:[^\t]*(\t.(fnstart|frame|mask|file)[^\t]*)*\t[^:]+:%d\n} \
                     $symbol $line]

Since Tcl regexp does multiline matches by default, if the line number
on the next # <filename>:<lineno> comment happens to the one we're
looking for, the match extends there.  This is why several of the
dg-function-on-line tests still succeed.  If it is not, the test fails.

What we really want to do is match the function declaration, which looks
like this:

        .loc 1 12 0
        .set    nomips16
        .ent    main
        .type   main, @function
main:

.loc gets the fileno (which we don't care for), the lineno (what we're
interested in, 0 and perhaps further info we also don't care for (like
is_stmt 0 discriminator 1), either .set nomips16 or .set mips16, and the
function declaration itself.

The following IRIX-specific patch implements this.  Tested with the
appropriate runtest invocations for the 3 testcases using
dg-function-on-line, committed to mainline.

	Rainer


2011-01-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* lib/scanasm.exp (dg-function-on-line): Handle mips-sgi-irix*.

Patch

diff -r 3a08436b46b4 gcc/testsuite/lib/scanasm.exp
--- a/gcc/testsuite/lib/scanasm.exp	Mon Jan 24 08:02:01 2011 +0000
+++ b/gcc/testsuite/lib/scanasm.exp	Mon Jan 24 13:09:54 2011 +0100
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2000, 2002, 2003, 2007, 2008, 2010
+# Copyright (C) 2000, 2002, 2003, 2007, 2008, 2010, 2011
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -342,6 +342,9 @@ 
     if { [istarget "hppa*-*-*"] } {
 	set pattern [format {\t;[^:]+:%d\n(\t[^\t]+\n)+%s:\n\t.PROC} \
                      $line $symbol]
+    } elseif { [istarget "mips-sgi-irix*"] } {
+	set pattern [format {\t\.loc [0-9]+ %d 0( [^\n]*)?\n\t\.set\t(no)?mips16\n\t\.ent\t%s\n\t\.type\t%s, @function\n%s:\n} \
+		     $line $symbol $symbol $symbol]
     } else {
 	set pattern [format {%s:[^\t]*(\t.(fnstart|frame|mask|file)[^\t]*)*\t[^:]+:%d\n} \
                      $symbol $line]