From da85a41850f2b78e9230cb6b7d755f14d90bdee3 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 15 Jan 2015 15:38:01 -0500 Subject: [PATCH] Force thread order in GDBProcessesTest.getThreadData A change in gdb showed that we shouldn't rely on the order of threads when they are all created at the same time. The solution is to break after each thread is created, so that gdb takes note of the new thread before we spawn another one. This way, they'll always be in the same order. Change-Id: Ia62dc0476163ad44bba52d51df95cf747d27da84 Signed-off-by: Simon Marchi Reviewed-on: https://git.eclipse.org/r/39712 Reviewed-by: Marc Khouzam Tested-by: Marc Khouzam --- .../cdt/tests/dsf/gdb/tests/GDBProcessesTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java index 70638b0df3a..b0dd786d5f4 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java @@ -150,8 +150,15 @@ public class GDBProcessesTest extends BaseTestCase { */ @Test public void getThreadData() throws Throwable { - // Start all threads, stop when they are all started - SyncUtil.runToLine(SOURCE_NAME, getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); + // Start the threads one by one to make sure they are discovered by gdb in the right + // order. + for (int i = 0; i < 5; i++) { + SyncUtil.runToLocation(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_AFTER_THREAD_START")); + + } + + // We need to get there to make sure that all the threads have their name set. + SyncUtil.runToLocation(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); IThreadDMData mainThreadData = SyncUtil.getThreadData(1);