1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 429124 - MIThread, MIThtreadInfo, MIThreadInfoInfo can be overridden

Change-Id: If08bc919031bbe675ca59b90c0c2b782a59841a7
Signed-off-by: Xavier Raynaud <xavier.raynaud@kalray.eu>
Reviewed-on: https://git.eclipse.org/r/22553
Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com>
Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Xavier Raynaud 2014-02-26 16:13:52 +01:00 committed by Marc Khouzam
parent e91e3669b7
commit 95c8e7ffdd
3 changed files with 33 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2013 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 - Initial API and implementation
* Xavier Raynaud (Kalray) - MIThread can be overridden (Bug 429124)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@ -193,8 +194,9 @@ public class MIListThreadGroupsInfo extends MIInfo {
MIThread[] getThreads();
}
/** @since 4.4 */
@Immutable
private static class ThreadGroupInfo implements IThreadGroupInfo2 {
protected static class ThreadGroupInfo implements IThreadGroupInfo2 {
final String fGroupId;
final String fDescription;
final String fName;
@ -221,7 +223,7 @@ public class MIListThreadGroupsInfo extends MIInfo {
fThreadList = threads;
}
private static String parseName(String desc) {
protected String parseName(String desc) {
String name = ""; //$NON-NLS-1$
// Find the string "name: " followed by the smallest set of characters that
@ -298,7 +300,8 @@ public class MIListThreadGroupsInfo extends MIInfo {
public IThreadGroupInfo[] getGroupList() { return fGroupList; }
public MIThreadInfoInfo getThreadInfo() { return fThreadInfo; }
private void parse() {
/** @since 4.4 */
protected void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
@ -326,7 +329,8 @@ public class MIListThreadGroupsInfo extends MIInfo {
}
}
private void parseGroups(MIList list) {
/** @since 4.4 */
protected void parseGroups(MIList list) {
MIValue[] values = list.getMIValues();
fGroupList = new IThreadGroupInfo[values.length];
for (int i = 0; i < values.length; i++) {
@ -384,10 +388,9 @@ public class MIListThreadGroupsInfo extends MIInfo {
}
} else if (var.equals("threads")) { //$NON-NLS-1$
// Staring with GDB 7.1
// Re-use the MIThreadInfoInfo parsing
MIValue value = result.getMIValue();
if (value instanceof MIList) {
threads = MIThreadInfoInfo.parseThreads(((MIList)value));
threads = parseThreads(((MIList)value));
}
}
}
@ -403,7 +406,14 @@ public class MIListThreadGroupsInfo extends MIInfo {
}
}
private String[] parseCores(MIList list) {
/** @since 4.4 */
// Re-use the MIThreadInfoInfo parsing
protected MIThread[] parseThreads(MIList value) {
return MIThreadInfoInfo.parseThreads(value);
}
/** @since 4.4 */
protected String[] parseCores(MIList list) {
List<String> cores = new ArrayList<String>();
MIValue[] values = list.getMIValues();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2013 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
@ -9,6 +9,7 @@
* Ericsson - Initial API and implementation
* 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)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@ -39,8 +40,9 @@ public class MIThread {
final private String fState;
final private String fCore;
private MIThread(String threadId, String targetId, String osId, String parentId,
MIFrame topFrame, String details, String state, String core) {
/** @since 4.4 */
protected MIThread(String threadId, String targetId, String osId, String parentId,
MIFrame topFrame, String details, String state, String core) {
fThreadId = threadId;
fTargetId = targetId;
fOsId = osId;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2013 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
* Wind River Systems - refactored to match pattern in package
* Xavier Raynaud (Kalray) - MIThread can be overridden (Bug 429124)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@ -106,7 +107,8 @@ public class MIThreadInfoInfo extends MIInfo {
// General format:
// threads=[{...}],current-thread-id="n"
private void parse() {
/** @since 4.4 */
protected void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
@ -117,7 +119,7 @@ public class MIThreadInfoInfo extends MIInfo {
if (var.equals("threads")) { //$NON-NLS-1$
MIValue val = results[i].getMIValue();
if (val instanceof MIList) {
fThreadList = parseThreads((MIList) val);
fThreadList = parseThreadsImpl((MIList) val);
}
}
else if (var.equals("current-thread-id")) { //$NON-NLS-1$
@ -134,6 +136,11 @@ public class MIThreadInfoInfo extends MIInfo {
}
}
/** @since 4.4 */
protected MIThread[] parseThreadsImpl(MIList list) {
return parseThreads(list);
}
// General formats:
// id="n",target-id="Thread 0xb7c8ab90 (LWP 7010)",frame={...},state="stopped"
// id="n",target-id="Thread 0xb7c8eb90 (LWP 7807)",state="running"