Patchwork asan testsuite (take 3)

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 16, 2012, 10:06 a.m.
Message ID <20121116100620.GH1886@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/199528/
State New
Headers show

Comments

Jakub Jelinek - Nov. 16, 2012, 10:06 a.m.
On Thu, Nov 15, 2012 at 05:01:49PM -0800, Andrew Pinski wrote:
> All of these tests failure for me because my addr2line is too old and
> does not support dwarf4.  Can we move over to using libbacktrace in
> libsanitzer instead of depending on addr2line here?

The problem is that addr2line doesn't fail in that case, merely prints
some extra message to stderr and continues working.  And dejagnu combines
both stderr and stdout together.

Does the following fix the problem?  The second hunk is desirable
even if the first hunk doesn't help.

As for libbacktrace, as I said earlier, IMHO we should use it both to
symbolize all the printed backtraces (both gathered by the fast
unwind and libbacktrace gathered backtraces), and to gather backtraces
in places that aren't performance sensitive in the library (like, all
__asan_report_error callers).

Haven't studied libbacktrace too much, can it provide right now
just function name or function name and file:line info too?

2012-11-16  Jakub Jelinek  <jakub@redhat.com>

	* lib/asan-dg.exp (asan_symbolize): Prune BFD: prefixed error messages
	from addr2line_output.  Increment idx if asking for more than one address
	in one object.



	Jakub
Ian Taylor - Nov. 16, 2012, 2:43 p.m.
On Fri, Nov 16, 2012 at 2:06 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>
> Haven't studied libbacktrace too much, can it provide right now
> just function name or function name and file:line info too?

Yes.  backtrace_syminfo reads the symbol table to map a PC value to a
symbol name.  backtrace_pcinfo reads the debug info to map a PC value
to file:line and function.  The latter can return multiple instances
of file:line/function information for the case of an inlined function.

Also libbacktrace can separate the gathering of the backtrace from the
symbolization of the backtrace.  But it is true that libbacktrace,
which uses the unwind info, will always be slower than walking up a
linked list of frame pointers.

Ian

Patch

--- gcc/testsuite/lib/asan-dg.exp.jj	2012-11-14 23:57:07.000000000 +0100
+++ gcc/testsuite/lib/asan-dg.exp	2012-11-16 10:50:20.697041456 +0100
@@ -127,7 +127,9 @@  proc asan_symbolize { output } {
 	    set args "-f -e $key $arr($key)"
 	    set status [remote_exec host "$addr2line_name" $args]
 	    if { [lindex $status 0] > 0 } continue
-	    set addr2line_output [regexp -inline -all -line "^\[^\n\r]*" [lindex $status 1]]
+	    regsub -all "\r\n" [lindex $status 1] "\n" addr2line_output
+	    regsub -all "(^|\n|\r)BFD: \[^\n\r\]*" $addr2line_output "" addr2line_output
+	    set addr2line_output [regexp -inline -all -line "^\[^\n\r]*" $addr2line_output]
 	    set idx 0
 	    foreach val $arr($key) {
 		if { [expr $idx + 1] < [llength $addr2line_output] } {
@@ -137,6 +139,7 @@  proc asan_symbolize { output } {
 			set newkey "$key+$val"
 			set repl($newkey) "$fnname $fileline"
 		    }
+		    set idx [expr $idx + 2]
 		}
 	    }
 	}