Index: gdb/testsuite/gdb.trace/trace-mt.c |
diff --git a/gdb/testsuite/gdb.trace/ftrace.c b/gdb/testsuite/gdb.trace/trace-mt.c |
similarity index 63% |
copy from gdb/testsuite/gdb.trace/ftrace.c |
copy to gdb/testsuite/gdb.trace/trace-mt.c |
index bab992d06a89500d9dbde4123d19394b975e9fa6..90a5b54c77b1040d644b25beb419f9eb8bcc53ec 100644 |
--- a/gdb/testsuite/gdb.trace/ftrace.c |
+++ b/gdb/testsuite/gdb.trace/trace-mt.c |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 2011-2012 Free Software Foundation, Inc. |
+ Copyright 2012 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 |
@@ -15,46 +15,30 @@ |
You should have received a copy of the GNU General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
+#include <pthread.h> |
+ |
#ifdef SYMBOL_PREFIX |
#define SYMBOL(str) SYMBOL_PREFIX #str |
#else |
#define SYMBOL(str) #str |
#endif |
- |
-int globvar; |
- |
-static void |
-begin (void) |
-{} |
- |
/* Called from asm. */ |
static void __attribute__((used)) |
func (void) |
{} |
-static void |
-marker (int anarg) |
+static void * |
+thread_function(void *arg) |
{ |
- /* `set_point' is the label at which to set a fast tracepoint. The |
+ /* `set_point1' is the label at which to set a fast tracepoint. The |
insn at the label must be large enough to fit a fast tracepoint |
jump. */ |
- asm (" .global " SYMBOL(set_point) "\n" |
- SYMBOL(set_point) ":\n" |
+ asm (" .global " SYMBOL(set_point1) "\n" |
+ SYMBOL(set_point1) ":\n" |
#if (defined __x86_64__ || defined __i386__) |
" call " SYMBOL(func) "\n" |
#endif |
); |
- |
- ++anarg; |
- |
- /* Set up a known 4-byte instruction so we can try to set a shorter |
- fast tracepoint at it. */ |
- asm (" .global " SYMBOL(four_byter) "\n" |
- SYMBOL(four_byter) ":\n" |
-#if (defined __i386__) |
- " cmpl $0x1,0x8(%ebp) \n" |
-#endif |
- ); |
} |
static void |
@@ -62,15 +46,18 @@ end (void) |
{} |
int |
-main () |
+main (int argc, char *argv[], char *envp[]) |
{ |
- begin (); |
+ pthread_t threads[2]; |
+ int i; |
+ |
+ for (i = 0; i < 2; i++) |
+ pthread_create (&threads[i], NULL, thread_function, NULL); |
- for (globvar = 1; globvar < 11; ++globvar) |
- { |
- marker (globvar * 100); |
- } |
+ for (i = 0; i < 2; i++) |
+ pthread_join (threads[i], NULL); |
end (); |
+ |
return 0; |
} |