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 58772e108fe..22eca349e66 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson and others. + * Copyright (c) 2009, 2014 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Ericsson AB - Initial implementation of Test cases + * Simon Marchi (Ericsson) - Check for thread name support. *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.tests; @@ -135,7 +136,16 @@ public class GDBProcessesTest extends BaseTestCase { Assert.assertTrue("Process data should be executable name " + EXEC_NAME + "but we got " + processData.getName(), processData.getName().contains(EXEC_NAME)); } - + + /* + * Return whether thread names are reported by the debugger. + * + * This defaults to false, and is overridden for specific versions of gdb. + */ + protected boolean threadNamesSupported() { + return false; + } + /* * getThreadData() for multiple threads */ @@ -175,9 +185,11 @@ public class GDBProcessesTest extends BaseTestCase { Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); //$NON-NLS-1$ Matcher matcher = pattern.matcher(threadData.getId()); assertTrue("Thread ID is a series of number", matcher.find()); + // Check thread name - assertEquals("main thread's name is the name of the executable", EXEC_NAME, threadData.getName()); - + String expectedThreadName = threadNamesSupported() ? EXEC_NAME : ""; + assertEquals("main thread's name is wrong", expectedThreadName, threadData.getName()); + fWait.waitReset(); } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java index e05cfe101da..2135125cc51 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Ericsson and others. + * Copyright (c) 2011, 2014 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Ericsson AB - Initial implementation of Test cases + * Simon Marchi (Ericsson) - Check for thread name support. *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; @@ -21,4 +22,12 @@ public class GDBProcessesTest_7_3 extends GDBProcessesTest_7_2 { protected void setGdbVersion() { setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3); } + + /* + * Thread names are reported starting with gdb 7.3, except on Windows. + */ + @Override + protected boolean threadNamesSupported() { + return !runningOnWindows(); + } } \ No newline at end of file