mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
new methods parseWinShared() and parseUnixShared() to deal with
the different variables.
This commit is contained in:
parent
6cf0504156
commit
ff80a0489c
1 changed files with 38 additions and 0 deletions
|
@ -18,6 +18,8 @@ import java.util.List;
|
||||||
public class MIInfoSharedLibraryInfo extends MIInfo {
|
public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
|
|
||||||
MIShared[] shared;
|
MIShared[] shared;
|
||||||
|
boolean isUnixFormat = true;
|
||||||
|
boolean hasProcessHeader = false;
|
||||||
|
|
||||||
public MIInfoSharedLibraryInfo(MIOutput out) {
|
public MIInfoSharedLibraryInfo(MIOutput out) {
|
||||||
super(out);
|
super(out);
|
||||||
|
@ -49,6 +51,20 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseShared(String str, List aList) {
|
void parseShared(String str, List aList) {
|
||||||
|
if (!hasProcessHeader) {
|
||||||
|
// Process the header and choose a type.
|
||||||
|
if (str.startsWith("DLL")) {
|
||||||
|
isUnixFormat = false;
|
||||||
|
}
|
||||||
|
hasProcessHeader = true;
|
||||||
|
} else if (isUnixFormat) {
|
||||||
|
parseUnixShared(str, aList);
|
||||||
|
} else {
|
||||||
|
parseWinShared(str, aList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void parseUnixShared(String str, List aList) {
|
||||||
if (str.length() > 0) {
|
if (str.length() > 0) {
|
||||||
// Pass the header
|
// Pass the header
|
||||||
if (Character.isDigit(str.charAt(0))) {
|
if (Character.isDigit(str.charAt(0))) {
|
||||||
|
@ -88,4 +104,26 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parseWinShared(String str, List aList) {
|
||||||
|
long from = 0;
|
||||||
|
long to = 0;
|
||||||
|
boolean syms = true;
|
||||||
|
|
||||||
|
int index = str.lastIndexOf(' ');
|
||||||
|
if (index > 0) {
|
||||||
|
String sub = str.substring(index).trim();
|
||||||
|
// Go figure they do not print the "0x" to indicate hexadicimal!!
|
||||||
|
if (!sub.startsWith("0x")) {
|
||||||
|
sub = "0x" + sub;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
from = Long.decode(sub).longValue();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
str = str.substring(0, index).trim();
|
||||||
|
}
|
||||||
|
MIShared s = new MIShared(from, to, syms, str.trim());
|
||||||
|
aList.add(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue