blob: 7964a9150c60bcdbb218b54a9bccc474ac59f739 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*******************************************************************************
* Copyright (c) 2007 Nokia 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nokia - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.output;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
public class CLIInfoLineInfo extends MIInfo {
private int lineNumber;
private BigInteger startAddress;
private BigInteger endAddress;
private String startLocation;
private String endLocation;
private String fileName;
public CLIInfoLineInfo(MIOutput out) {
super(out);
parse();
}
public int getLineNumber() {
return lineNumber;
}
public BigInteger getStartAddress() {
return startAddress;
}
public BigInteger getEndAddress() {
return endAddress;
}
public String getStartLocation() {
return startLocation;
}
public String getEndLocation() {
return endLocation;
}
public String getFileName() {
return fileName;
}
protected void parse() {
List aList = new ArrayList();
if (isDone()) {
MIOutput out = getMIOutput();
MIOOBRecord[] oobs = out.getMIOOBRecords();
for (int i = 0; i < oobs.length; i++) {
if (oobs[i] instanceof MIConsoleStreamOutput) {
MIStreamRecord cons = (MIStreamRecord) oobs[i];
String str = cons.getString();
// We are interested in finding the current thread
parseLineInfo(str.trim(), aList);
}
}
}
}
protected void parseLineInfo(String str, List aList) {
if (str.endsWith("."))
str = str.substring(0, str.length()-1);
String[] strbits = str.split("\\s"); //$NON-NLS-1$
for (int i = 0; i < strbits.length; i++) {
if (strbits[i].equals("Line")) //$NON-NLS-1$
{
lineNumber = Integer.parseInt(strbits[i+1]);
}
else
if (strbits[i].equals("starts")) //$NON-NLS-1$
{
startAddress = new BigInteger(strbits[i+3].substring(2), 16);
startLocation = strbits[i+4];
}
else
if (strbits[i].equals("ends")) //$NON-NLS-1$
{
endAddress = new BigInteger(strbits[i+2].substring(2), 16);
endLocation = i+3<strbits.length? strbits[i+3]: null;
}
}
strbits = str.split("\""); //$NON-NLS-1$
if (strbits.length>0) fileName = strbits[1];
}
}
|