mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
fix for parsing the output.
This commit is contained in:
parent
0024353521
commit
247737caff
1 changed files with 29 additions and 18 deletions
|
@ -64,6 +64,12 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We do the parsing backward because on some Un*x system, the To or the From
|
||||||
|
* and even the "Sym Read" can be empty....
|
||||||
|
* @param str
|
||||||
|
* @param aList
|
||||||
|
*/
|
||||||
void parseUnixShared(String str, List aList) {
|
void parseUnixShared(String str, List aList) {
|
||||||
if (str.length() > 0) {
|
if (str.length() > 0) {
|
||||||
// Pass the header
|
// Pass the header
|
||||||
|
@ -72,34 +78,39 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
long from = 0;
|
long from = 0;
|
||||||
long to = 0;
|
long to = 0;
|
||||||
boolean syms = false;
|
boolean syms = false;
|
||||||
|
String name = "";
|
||||||
|
|
||||||
for (int i = 0; i < 3 && (index = str.indexOf(' ')) != -1; i++) {
|
for (int i = 0; (index = str.lastIndexOf(' ')) != -1 || i <= 3; i++) {
|
||||||
String sub = str.substring(0, index).trim();
|
if (index == -1) {
|
||||||
// advance to next column
|
index = 0;
|
||||||
str = str.substring(index).trim();
|
}
|
||||||
switch (i) {
|
String sub = str.substring(index).trim();
|
||||||
case 0: // first column is "From"
|
// move to previous column
|
||||||
try {
|
str = str.substring(0, index).trim();
|
||||||
from = Long.decode(sub).longValue();
|
switch(i) {
|
||||||
} catch (NumberFormatException e) {
|
case 0:
|
||||||
|
name = sub;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (sub.equalsIgnoreCase("Yes")) {
|
||||||
|
syms = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // second column is "To"
|
case 2: // second column is "To"
|
||||||
try {
|
try {
|
||||||
to = Long.decode(sub).longValue();
|
to = Long.decode(sub).longValue();
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // third column is "Syms Read"
|
case 3: // first column is "From"
|
||||||
if (sub.equalsIgnoreCase("Yes")) {
|
try {
|
||||||
syms = true;
|
from = Long.decode(sub).longValue();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: // last column is "Shared object library"
|
|
||||||
i = 3; // bail out. use the entire string
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MIShared s = new MIShared(from, to, syms, str.trim());
|
MIShared s = new MIShared(from, to, syms, name);
|
||||||
aList.add(s);
|
aList.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +124,7 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
int index = str.lastIndexOf(' ');
|
int index = str.lastIndexOf(' ');
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
String sub = str.substring(index).trim();
|
String sub = str.substring(index).trim();
|
||||||
// Go figure they do not print the "0x" to indicate hexadicimal!!
|
// Go figure they do not print the "0x" to indicate hexadecimal!!
|
||||||
if (!sub.startsWith("0x")) {
|
if (!sub.startsWith("0x")) {
|
||||||
sub = "0x" + sub;
|
sub = "0x" + sub;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue