[RFA] Add LDD_FOR_TARGET, fix prelink regexp

Doug Evans dje@google.com
Thu Aug 1 22:19:00 GMT 2013


Hi.

Awhile ago I submitted this patch, but it caused other failures.

http://sourceware.org/ml/gdb-patches/2010-11/msg00213.html

I've had some time and help digging deeper.
It turns out that fixing the first bug caused more tests to be
run and it's those additional tests that were failing
(because the wrong ldd was being used).

This patch makes the following tests pass for me which were previously
failing (assuming I specify the appropriate value for LDD_FOR_TARGET here).

attach-pie-misread.exp
break-interp.exp
prelink.exp
dlopen-libpthread.exp

Regression tested on an ubuntu-like amd64-linux system.

Ok to check in?

2013-08-01  Doug Evans  <dje@google.com>

	* lib/future.exp (gdb_find_ldd): New proc.
	* lib/prelink-support.exp (build_executable_own_libs): Call it.
	Make "/usr/sbin/" in prelink path optional.

Index: testsuite/lib/future.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/future.exp,v
retrieving revision 1.7
diff -u -p -r1.7 future.exp
--- testsuite/lib/future.exp	18 Jul 2013 05:13:27 -0000	1.7
+++ testsuite/lib/future.exp	1 Aug 2013 21:48:59 -0000
@@ -84,6 +84,16 @@ proc gdb_find_go_linker {} {
     return [find_go]
 }
 
+proc gdb_find_ldd {} {
+    global LDD_FOR_TARGET
+    if [info exists LDD_FOR_TARGET] {
+	set ldd $LDD_FOR_TARGET
+    } else {
+	set ldd "ldd"
+    }
+    return $ldd
+}
+
 proc gdb_default_target_compile {source destfile type options} {
     global target_triplet
     global tool_root_dir
Index: testsuite/lib/prelink-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/prelink-support.exp,v
retrieving revision 1.7
diff -u -p -r1.7 prelink-support.exp
--- testsuite/lib/prelink-support.exp	4 Jun 2013 13:23:32 -0000	1.7
+++ testsuite/lib/prelink-support.exp	1 Aug 2013 21:48:59 -0000
@@ -124,7 +124,8 @@ proc build_executable_own_libs {testname
     }
     set binfile ${objdir}/${subdir}/${executable}
 
-    set command "ldd $binfile"
+    set ldd [gdb_find_ldd]
+    set command "$ldd $binfile"
     set test "ldd $executable"
     set result [catch "exec $command" output]
     verbose -log "result of $command is $result"
@@ -235,7 +236,7 @@ proc prelink_no {arg {name {}}} {
     }
     # Last line does miss the trailing \n.  There can be multiple such messages
     # as ARG may list multiple files.
-    if {$result == 1 && [regexp {^(/usr/sbin/prelink[^\r\n]*: [^ ]* does not have .gnu.prelink_undo section\n?)*$} $output]} {
+    if {$result == 1 && [regexp {^([^\r\n]*prelink[^\r\n]*: [^ ]* does not have .gnu.prelink_undo section\n?)*$} $output]} {
 	pass $test
 	return 1
     } else {



More information about the Gdb-patches mailing list