[RFA] linux-dp tweaks for android
Doug Evans
dje@google.com
Tue Mar 2 19:55:00 GMT 2010
Hi.
Android doesn't have rand_r, so I'm proposing replacing it with rand.
I _think_ this part of the change is ok, but I wouldn't mind
another pair of eyes ...
The backtrace pattern for "first thread-specific breakpoint hit"
doesn't match on android so I added another pattern that will.
An alternative is to replace "from .*libpthread" with
"in pthread_create" (instead of simply adding "in pthread_create"),
the comments suggest that's ok.
Ok to check in?
2010-03-02 Doug Evans <dje@google.com>
testsuite/
* gdb.threads/linux-dp.c (shared_random): Call rand instead of rand_r.
* gdb.threads/linux-dp.exp: Compile with gdb_compile_pthreads instead
of gdb_compile. Add another pattern to match android backtrace.
Index: linux-dp.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.c,v
retrieving revision 1.2
diff -u -p -r1.2 linux-dp.c
--- linux-dp.c 24 Feb 2002 00:42:39 -0000 1.2
+++ linux-dp.c 2 Mar 2010 18:55:11 -0000
@@ -71,11 +71,10 @@ shared_printf (char *format, ...)
int
shared_random ()
{
- static unsigned int seed;
int result;
pthread_mutex_lock (&random_mutex);
- result = rand_r (&seed);
+ result = rand ();
pthread_mutex_unlock (&random_mutex);
return result;
}
Index: linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.22
diff -u -p -r1.22 linux-dp.exp
--- linux-dp.exp 1 Jan 2010 07:32:06 -0000 1.22
+++ linux-dp.exp 2 Mar 2010 18:55:11 -0000
@@ -49,7 +49,7 @@ if ![istarget *-*-linux-gnu*] then {
set testfile "linux-dp"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug libs=-lpthread}] != ""} {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} {
return -1
}
@@ -247,11 +247,11 @@ gdb_breakpoint "print_philosopher thread
gdb_continue_to_breakpoint "thread 5's print"
# When there is no debugging info available for the thread library,
# the backtrace entry for philosopher's caller looks like:
-# #1 0x4001c548 in pthread_create () from /lib/libpthread.so.0
+# #2 0x4001c548 in pthread_create () from /lib/libpthread.so.0
# If you do have debug info, the output obviously depends more on the
# exact library in use; under NPTL, you get:
# #2 0x0012b7fc in start_thread (arg=0x21) at pthread_create.c:264
-gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\).*" \
+gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create\).*" \
"first thread-specific breakpoint hit"
# Make sure it's catching the right thread. Try hitting the
More information about the Gdb-patches
mailing list