mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
Bug 451396 - Improve extensibility to process MI -thread-info
Change-Id: I90060bf267b24a0a641ea20dfa6dfb870610e9ea Reviewed-on: https://git.eclipse.org/r/36438 Tested-by: Hudson CI Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
4e7fd1ddaf
commit
2add4e809f
3 changed files with 45 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 Ericsson and others.
|
||||
* Copyright (c) 2010, 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
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service;
|
||||
|
||||
|
@ -176,23 +177,7 @@ 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 = ""; //$NON-NLS-1$
|
||||
if (thread.getOsId() != null) {
|
||||
id = thread.getOsId();
|
||||
}
|
||||
// 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) {
|
||||
if (!id.isEmpty()) id += " "; //$NON-NLS-1$
|
||||
id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
// We must indicate and empty id by using null
|
||||
if (id.isEmpty()) id = null;
|
||||
|
||||
String core = thread.getCore();
|
||||
threadData = new MIThreadDMData_7_1("", id, //$NON-NLS-1$
|
||||
core == null ? null : new String[] { core });
|
||||
threadData = createThreadDMData(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,6 +195,29 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.6
|
||||
*/
|
||||
protected IGdbThreadDMData createThreadDMData(MIThread thread) {
|
||||
String id = ""; //$NON-NLS-1$
|
||||
if (thread.getOsId() != null) {
|
||||
id = thread.getOsId();
|
||||
}
|
||||
// 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) {
|
||||
if (!id.isEmpty()) id += " "; //$NON-NLS-1$
|
||||
id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
// We must indicate and empty id by using null
|
||||
if (id.isEmpty()) id = null;
|
||||
|
||||
String core = thread.getCore();
|
||||
return new MIThreadDMData_7_1("", id, //$NON-NLS-1$
|
||||
core == null ? null : new String[] { core });
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void eventDispatched_7_1(IResumedDMEvent e) {
|
||||
if (e instanceof IContainerResumedDMEvent) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2013 Ericsson and others.
|
||||
* Copyright (c) 2008, 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
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Ericsson - Initial API and implementation
|
||||
* Xavier Raynaud (Kalray) - MIThread can be overridden (Bug 429124)
|
||||
* Alvaro Sanchez-Leon - Bug 451396 - Improve extensibility to process MI "-thread-info" results
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
@ -316,7 +317,7 @@ public class MIListThreadGroupsInfo extends MIInfo {
|
|||
}
|
||||
} else if (var.equals("threads")) { //$NON-NLS-1$
|
||||
// Re-use the MIThreadInfoInfo parsing
|
||||
fThreadInfo = new MIThreadInfoInfo(out);
|
||||
fThreadInfo = createMIThreadInfoInfo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,10 +326,17 @@ public class MIListThreadGroupsInfo extends MIInfo {
|
|||
fGroupList = new IThreadGroupInfo[0];
|
||||
}
|
||||
if (fThreadInfo == null) {
|
||||
fThreadInfo = new MIThreadInfoInfo(null);
|
||||
fThreadInfo = createMIThreadInfoInfo(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.6
|
||||
*/
|
||||
protected MIThreadInfoInfo createMIThreadInfoInfo(MIOutput output) {
|
||||
return new MIThreadInfoInfo(output);
|
||||
}
|
||||
|
||||
/** @since 4.4 */
|
||||
protected void parseGroups(MIList list) {
|
||||
MIValue[] values = list.getMIValues();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2013 Ericsson and others.
|
||||
* Copyright (c) 2008, 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
|
||||
|
@ -10,6 +10,7 @@
|
|||
* Wind River Systems - refactored to match pattern in package
|
||||
* John Dallaway - GDB 7.x getOsId() pattern match too restrictive (Bug 325552)
|
||||
* Xavier Raynaud (Kalray) - MIThread can be overridden (Bug 429124)
|
||||
* Alvaro Sanchez-Leon - Bug 451396 - Improve extensibility to process MI "-thread-info" results
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
||||
|
@ -128,7 +129,10 @@ public class MIThread {
|
|||
private static Pattern fgOsIdPattern3 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\S+)", 0); //$NON-NLS-1$
|
||||
private static Pattern fgOsIdPattern4 = Pattern.compile("[Pp][Rr][Oo][Cc][Ee][Ss][Ss]\\s*(\\S+)", 0); //$NON-NLS-1$
|
||||
|
||||
static String parseOsId(String str) {
|
||||
/**
|
||||
* @since 4.6
|
||||
*/
|
||||
protected static String parseOsId(String str) {
|
||||
// General format:
|
||||
// "Thread 0xb7c8ab90 (LWP 7010)"
|
||||
// ^^^^
|
||||
|
@ -169,8 +173,9 @@ public class MIThread {
|
|||
* This is used to parse the same ID fed to {@link #parseOsId(String)}. The
|
||||
* difference is that we return the first portion when the ID is in format
|
||||
* "Thread pppp.tttt". If the ID is not in that format, we return null.
|
||||
* @since 4.6
|
||||
*/
|
||||
static String parseParentId(String str) {
|
||||
protected static String parseParentId(String str) {
|
||||
// General format:
|
||||
// "Thread 162.32942"
|
||||
// ^^^
|
||||
|
|
Loading…
Add table
Reference in a new issue