Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Win32 info shared

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.69
diff -u -r1.69 ChangeLog
--- ChangeLog	17 Jan 2003 21:33:33 -0000	1.69
+++ ChangeLog	18 Jan 2003 00:32:54 -0000
@@ -1,5 +1,11 @@
 2003-01-17 Alain Magloire
 
+	* src/.../mi/core/output/MIInfoSharedLibraryInfo.java (parseWinShared):
+	Break the methods in parserUnixShared() and parseWinShared() to cope
+	with the different formats.
+
+2003-01-17 Alain Magloire
+
 	* src/.../mi/core/cdi/SharedLibraryManager.java (loadSymbols):
 	New method takes and array of ICDISharedLibrary.
 	* src/.../mi/core/cdi/SharedLibrary.java (loadSymbols):
Index: src/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java,v
retrieving revision 1.1
diff -u -r1.1 MIInfoSharedLibraryInfo.java
--- src/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java	16 Jan 2003 03:12:02 -0000	1.1
+++ src/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java	18 Jan 2003 00:32:57 -0000
@@ -18,6 +18,8 @@
 public class MIInfoSharedLibraryInfo extends MIInfo {
 
 	MIShared[] shared;
+	boolean isUnixFormat = true;
+	boolean hasProcessHeader = false;
 
 	public MIInfoSharedLibraryInfo(MIOutput out) {
 		super(out);
@@ -49,6 +51,20 @@
 	}
 
 	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) {
 			// Pass the header
 			if (Character.isDigit(str.charAt(0))) {
@@ -87,5 +103,27 @@
 				aList.add(s);
 			}
 		}
+	}
+	
+	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);
 	}
 }




Back to the top