|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2007 QNX Software Systems and others. |
2 |
* Copyright (c) 2000, 2010 QNX Software Systems and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 66-72
Link Here
|
| 66 |
public class RxThread extends Thread { |
66 |
public class RxThread extends Thread { |
| 67 |
|
67 |
|
| 68 |
final MISession session; |
68 |
final MISession session; |
| 69 |
List oobList; |
69 |
List<MIStreamRecord> oobList; |
| 70 |
CLIProcessor cli; |
70 |
CLIProcessor cli; |
| 71 |
int prompt = 1; // 1 --> Primary prompt "(gdb)"; 2 --> Secondary Prompt ">" |
71 |
int prompt = 1; // 1 --> Primary prompt "(gdb)"; 2 --> Secondary Prompt ">" |
| 72 |
boolean fEnableConsole = true; |
72 |
boolean fEnableConsole = true; |
|
Lines 75-81
Link Here
|
| 75 |
super("MI RX Thread"); //$NON-NLS-1$ |
75 |
super("MI RX Thread"); //$NON-NLS-1$ |
| 76 |
session = s; |
76 |
session = s; |
| 77 |
cli = new CLIProcessor(session); |
77 |
cli = new CLIProcessor(session); |
| 78 |
oobList = new ArrayList(); |
78 |
oobList = new ArrayList<MIStreamRecord>(); |
| 79 |
} |
79 |
} |
| 80 |
|
80 |
|
| 81 |
/* |
81 |
/* |
|
Lines 168-174
Link Here
|
| 168 |
void processMIOutput(String buffer) { |
168 |
void processMIOutput(String buffer) { |
| 169 |
MIOutput response = session.parse(buffer); |
169 |
MIOutput response = session.parse(buffer); |
| 170 |
if (response != null) { |
170 |
if (response != null) { |
| 171 |
List list = new ArrayList(); |
171 |
List<MIEvent> list = new ArrayList<MIEvent>(); |
| 172 |
CommandQueue rxQueue = session.getRxQueue(); |
172 |
CommandQueue rxQueue = session.getRxQueue(); |
| 173 |
|
173 |
|
| 174 |
MIResultRecord rr = response.getMIResultRecord(); |
174 |
MIResultRecord rr = response.getMIResultRecord(); |
|
Lines 259-267
Link Here
|
| 259 |
for (int i = 0; i < oobs.length; i++) { |
259 |
for (int i = 0; i < oobs.length; i++) { |
| 260 |
processMIOOBRecord(oobs[i], list); |
260 |
processMIOOBRecord(oobs[i], list); |
| 261 |
} |
261 |
} |
|
|
262 |
// If not waiting for any command results, don't need the result in the oobList |
| 263 |
if (rxQueue.isEmpty()) |
| 264 |
oobList.clear(); |
| 262 |
} |
265 |
} |
| 263 |
|
266 |
|
| 264 |
MIEvent[] events = (MIEvent[]) list.toArray(new MIEvent[list.size()]); |
267 |
MIEvent[] events = list.toArray(new MIEvent[list.size()]); |
| 265 |
session.fireEvents(events); |
268 |
session.fireEvents(events); |
| 266 |
} // if response != null |
269 |
} // if response != null |
| 267 |
} |
270 |
} |
|
Lines 269-275
Link Here
|
| 269 |
/** |
272 |
/** |
| 270 |
* Dispatch a thread to deal with the listeners. |
273 |
* Dispatch a thread to deal with the listeners. |
| 271 |
*/ |
274 |
*/ |
| 272 |
void processMIOOBRecord(MIOOBRecord oob, List list) { |
275 |
void processMIOOBRecord(MIOOBRecord oob, List<MIEvent> list) { |
| 273 |
if (oob instanceof MIAsyncRecord) { |
276 |
if (oob instanceof MIAsyncRecord) { |
| 274 |
processMIOOBRecord((MIAsyncRecord) oob, list); |
277 |
processMIOOBRecord((MIAsyncRecord) oob, list); |
| 275 |
oobList.clear(); |
278 |
oobList.clear(); |
|
Lines 278-284
Link Here
|
| 278 |
} |
281 |
} |
| 279 |
} |
282 |
} |
| 280 |
|
283 |
|
| 281 |
void processMIOOBRecord(MIAsyncRecord async, List list) { |
284 |
void processMIOOBRecord(MIAsyncRecord async, List<MIEvent> list) { |
| 282 |
if (async instanceof MIExecAsyncOutput) { |
285 |
if (async instanceof MIExecAsyncOutput) { |
| 283 |
MIExecAsyncOutput exec = (MIExecAsyncOutput) async; |
286 |
MIExecAsyncOutput exec = (MIExecAsyncOutput) async; |
| 284 |
// Change of state. |
287 |
// Change of state. |
|
Lines 393-399
Link Here
|
| 393 |
/** |
396 |
/** |
| 394 |
* Check for any info that we can gather form the console. |
397 |
* Check for any info that we can gather form the console. |
| 395 |
*/ |
398 |
*/ |
| 396 |
void processMIOOBRecord(MIResultRecord rr, List list) { |
399 |
void processMIOOBRecord(MIResultRecord rr, List<MIEvent> list) { |
| 397 |
MIResult[] results = rr.getMIResults(); |
400 |
MIResult[] results = rr.getMIResults(); |
| 398 |
for (int i = 0; i < results.length; i++) { |
401 |
for (int i = 0; i < results.length; i++) { |
| 399 |
String var = results[i].getVariable(); |
402 |
String var = results[i].getVariable(); |
|
Lines 526-533
Link Here
|
| 526 |
} |
529 |
} |
| 527 |
|
530 |
|
| 528 |
String[] getStreamRecords() { |
531 |
String[] getStreamRecords() { |
| 529 |
List streamRecords = new ArrayList(); |
532 |
List<String> streamRecords = new ArrayList<String>(); |
| 530 |
MIOOBRecord[] oobRecords = (MIOOBRecord[]) oobList.toArray(new MIOOBRecord[0]); |
533 |
MIOOBRecord[] oobRecords = oobList.toArray(new MIOOBRecord[0]); |
| 531 |
for (int i = 0; i < oobRecords.length; i++) { |
534 |
for (int i = 0; i < oobRecords.length; i++) { |
| 532 |
if (oobRecords[i] instanceof MIStreamRecord) { |
535 |
if (oobRecords[i] instanceof MIStreamRecord) { |
| 533 |
String s = ((MIStreamRecord) oobRecords[i]).getString().trim(); |
536 |
String s = ((MIStreamRecord) oobRecords[i]).getString().trim(); |
|
Lines 536-542
Link Here
|
| 536 |
} |
539 |
} |
| 537 |
} |
540 |
} |
| 538 |
} |
541 |
} |
| 539 |
return (String[]) streamRecords.toArray(new String[0]); |
542 |
return streamRecords.toArray(new String[0]); |
| 540 |
} |
543 |
} |
| 541 |
|
544 |
|
| 542 |
} |
545 |
} |