From b1311abea792f952fef973f2437e3f934c92c30a Mon Sep 17 00:00:00 2001 From: ajin Date: Fri, 21 Dec 2012 13:40:19 -0500 Subject: [PATCH] Bug 397039 For some gdb implementations the "osId" cannot be retrieved because the "TreadIDs" output does not follow the Linux gdb format. Catch the "null" return and not output it as a string. Change-Id: I8d4b711d935c5d81d1e8ff3adb0de5e3fe220061 Reviewed-on: https://git.eclipse.org/r/9334 Reviewed-by: Marc Khouzam IP-Clean: Marc Khouzam Tested-by: Marc Khouzam --- .../org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java | 8 ++++++-- .../org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_1.java | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java index 7ce98f2e180..d889776ddcd 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java @@ -10,6 +10,7 @@ * Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306) * John Dallaway - GDB 7.x MI thread details field ignored (Bug 325556) * Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748) + * Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service; @@ -774,12 +775,15 @@ public class GDBProcesses_7_0 extends AbstractDsfService if (getData().getThreadList().length != 0) { MIThread thread = getData().getThreadList()[0]; if (thread.getThreadId().equals(threadDmc.getId())) { - String id = thread.getOsId(); + String id = ""; //$NON-NLS-1$ + if (thread.getOsId() != null) { + id = thread.getOsId() + " "; //$NON-NLS-1$ + } // append thread details (if any) to the thread ID // as for GDB 6.x with CLIInfoThreadsInfo#getOsId() final String details = thread.getDetails(); if (details != null && details.length() > 0) { - id += " (" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } threadData = new MIThreadDMData("", id); //$NON-NLS-1$ } 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 98bce344a70..f52071c3a41 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 @@ -7,6 +7,7 @@ * * Contributors: * Ericsson - initial API and implementation + * Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service; @@ -175,12 +176,15 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 { if (getData().getThreadList().length != 0) { MIThread thread = getData().getThreadList()[0]; if (thread.getThreadId().equals(threadDmc.getId())) { - String id = thread.getOsId(); + String id = ""; //$NON-NLS-1$ + if (thread.getOsId() != null) { + id = thread.getOsId() + " "; //$NON-NLS-1$ + } // append thread details (if any) to the thread ID // as for GDB 6.x with CLIInfoThreadsInfo#getOsId() final String details = thread.getDetails(); if (details != null && details.length() > 0) { - id += " (" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } String core = thread.getCore();