diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java index fae1cc3f2c2..01c7c99e70a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java @@ -9,6 +9,7 @@ * Ericsson - initial API and implementation * Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039) * Alvaro Sanchez-Leon - Bug 451396 - Improve extensibility to process MI "-thread-info" results + * Simon Marchi (Ericsson) - Bug 378154 - Pass thread name from MIThread to the data model *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service; @@ -200,6 +201,7 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 { */ protected IGdbThreadDMData createThreadDMData(MIThread thread) { String id = ""; //$NON-NLS-1$ + if (thread.getOsId() != null) { id = thread.getOsId(); } @@ -212,10 +214,10 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 { } // We must indicate and empty id by using null if (id.isEmpty()) id = null; - + + String name = thread.getName(); String core = thread.getCore(); - return new MIThreadDMData_7_1("", id, //$NON-NLS-1$ - core == null ? null : new String[] { core }); + return new MIThreadDMData_7_1(name == null ? "" : name, id, core == null ? null : new String[] { core }); } @DsfServiceEventHandler 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 773c08aa3b5..58772e108fe 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 @@ -175,8 +175,8 @@ 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()); - // Name is blank in case of GDB back end - assertEquals("Thread name is should have been blank for GDB Back end", "", threadData.getName()); + // Check thread name + assertEquals("main thread's name is the name of the executable", EXEC_NAME, threadData.getName()); fWait.waitReset(); }