mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 302927 - Don't cache strings in oobList if we're not expecting an out of band response
Generics
This commit is contained in:
parent
4a3ee8350b
commit
5ce1a9ed45
1 changed files with 14 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -66,7 +66,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||||
public class RxThread extends Thread {
|
public class RxThread extends Thread {
|
||||||
|
|
||||||
final MISession session;
|
final MISession session;
|
||||||
List oobList;
|
List<MIStreamRecord> oobList;
|
||||||
CLIProcessor cli;
|
CLIProcessor cli;
|
||||||
int prompt = 1; // 1 --> Primary prompt "(gdb)"; 2 --> Secondary Prompt ">"
|
int prompt = 1; // 1 --> Primary prompt "(gdb)"; 2 --> Secondary Prompt ">"
|
||||||
boolean fEnableConsole = true;
|
boolean fEnableConsole = true;
|
||||||
|
@ -75,7 +75,7 @@ public class RxThread extends Thread {
|
||||||
super("MI RX Thread"); //$NON-NLS-1$
|
super("MI RX Thread"); //$NON-NLS-1$
|
||||||
session = s;
|
session = s;
|
||||||
cli = new CLIProcessor(session);
|
cli = new CLIProcessor(session);
|
||||||
oobList = new ArrayList();
|
oobList = new ArrayList<MIStreamRecord>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -168,7 +168,7 @@ public class RxThread extends Thread {
|
||||||
void processMIOutput(String buffer) {
|
void processMIOutput(String buffer) {
|
||||||
MIOutput response = session.parse(buffer);
|
MIOutput response = session.parse(buffer);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
List list = new ArrayList();
|
List<MIEvent> list = new ArrayList<MIEvent>();
|
||||||
CommandQueue rxQueue = session.getRxQueue();
|
CommandQueue rxQueue = session.getRxQueue();
|
||||||
|
|
||||||
MIResultRecord rr = response.getMIResultRecord();
|
MIResultRecord rr = response.getMIResultRecord();
|
||||||
|
@ -259,9 +259,12 @@ public class RxThread extends Thread {
|
||||||
for (int i = 0; i < oobs.length; i++) {
|
for (int i = 0; i < oobs.length; i++) {
|
||||||
processMIOOBRecord(oobs[i], list);
|
processMIOOBRecord(oobs[i], list);
|
||||||
}
|
}
|
||||||
|
// If not waiting for any command results, don't need the result in the oobList
|
||||||
|
if (rxQueue.isEmpty())
|
||||||
|
oobList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
MIEvent[] events = (MIEvent[]) list.toArray(new MIEvent[list.size()]);
|
MIEvent[] events = list.toArray(new MIEvent[list.size()]);
|
||||||
session.fireEvents(events);
|
session.fireEvents(events);
|
||||||
} // if response != null
|
} // if response != null
|
||||||
}
|
}
|
||||||
|
@ -269,7 +272,7 @@ public class RxThread extends Thread {
|
||||||
/**
|
/**
|
||||||
* Dispatch a thread to deal with the listeners.
|
* Dispatch a thread to deal with the listeners.
|
||||||
*/
|
*/
|
||||||
void processMIOOBRecord(MIOOBRecord oob, List list) {
|
void processMIOOBRecord(MIOOBRecord oob, List<MIEvent> list) {
|
||||||
if (oob instanceof MIAsyncRecord) {
|
if (oob instanceof MIAsyncRecord) {
|
||||||
processMIOOBRecord((MIAsyncRecord) oob, list);
|
processMIOOBRecord((MIAsyncRecord) oob, list);
|
||||||
oobList.clear();
|
oobList.clear();
|
||||||
|
@ -278,7 +281,7 @@ public class RxThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void processMIOOBRecord(MIAsyncRecord async, List list) {
|
void processMIOOBRecord(MIAsyncRecord async, List<MIEvent> list) {
|
||||||
if (async instanceof MIExecAsyncOutput) {
|
if (async instanceof MIExecAsyncOutput) {
|
||||||
MIExecAsyncOutput exec = (MIExecAsyncOutput) async;
|
MIExecAsyncOutput exec = (MIExecAsyncOutput) async;
|
||||||
// Change of state.
|
// Change of state.
|
||||||
|
@ -393,7 +396,7 @@ public class RxThread extends Thread {
|
||||||
/**
|
/**
|
||||||
* Check for any info that we can gather form the console.
|
* Check for any info that we can gather form the console.
|
||||||
*/
|
*/
|
||||||
void processMIOOBRecord(MIResultRecord rr, List list) {
|
void processMIOOBRecord(MIResultRecord rr, List<MIEvent> list) {
|
||||||
MIResult[] results = rr.getMIResults();
|
MIResult[] results = rr.getMIResults();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
String var = results[i].getVariable();
|
String var = results[i].getVariable();
|
||||||
|
@ -526,8 +529,8 @@ public class RxThread extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] getStreamRecords() {
|
String[] getStreamRecords() {
|
||||||
List streamRecords = new ArrayList();
|
List<String> streamRecords = new ArrayList<String>();
|
||||||
MIOOBRecord[] oobRecords = (MIOOBRecord[]) oobList.toArray(new MIOOBRecord[0]);
|
MIOOBRecord[] oobRecords = oobList.toArray(new MIOOBRecord[0]);
|
||||||
for (int i = 0; i < oobRecords.length; i++) {
|
for (int i = 0; i < oobRecords.length; i++) {
|
||||||
if (oobRecords[i] instanceof MIStreamRecord) {
|
if (oobRecords[i] instanceof MIStreamRecord) {
|
||||||
String s = ((MIStreamRecord) oobRecords[i]).getString().trim();
|
String s = ((MIStreamRecord) oobRecords[i]).getString().trim();
|
||||||
|
@ -536,7 +539,7 @@ public class RxThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String[]) streamRecords.toArray(new String[0]);
|
return streamRecords.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue