[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Enable tracing of the org.eclipse.debug.mi.core plugin
|
Eclipse provides plugins a way to trace by having an .options file,
this mechanism is use to print out the mi exchange between gdb
and the plugin. To enable this in the debug launch one must enable
"tracing" and set for the "org.eclipse.debug.mi.core/debug" to true.
But one problem, the console will simply blow taking down eclipse,
for big MI line response, say 4k length, for example asking the children
of "char buffer[4096]", -var-list-children varxx.
This seem only to happen in Eclipse-gtk or Eclipse-motif
on GNU/Linux, so it will be break in smaller chunks to give a chance to
the console.
* .options: Set debug to true.
* src/.../core/MIPlugin.java (debugLog): Break the log line in small chuncks of 100.
* src/.../MISession.java (postCommand): Print the gdb/mi command.
* src/.../RxThread.java (run): Print gdb/mi responses.
Index: .options
===================================================================
RCS file: .options
diff -N .options
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ .options 21 Oct 2002 02:53:47 -0000
@@ -0,0 +1 @@
+org.eclipse.cdt.debug.mi.core/debug=true
\ No newline at end of file
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.11
diff -u -r1.11 ChangeLog
--- ChangeLog 20 Oct 2002 23:30:22 -0000 1.11
+++ ChangeLog 21 Oct 2002 02:53:48 -0000
@@ -1,5 +1,23 @@
2002-10-20 Alain Magloire
+ Eclipse provides plugins a way to trace by having an .options file,
+ this mechanism is use to print out the mi exchange between gdb
+ and the plugin. To enable this in the debug launch one must enable
+ "tracing" and set for the "org.eclipse.debug.mi.core/debug" to true.
+ But one problem, the console will simply blow taking down eclipse,
+ for big MI line response, say 4k length, for example asking the children
+ of "char buffer[4096]", -var-list-children varxx.
+ This seem only to happen in Eclipse-gtk or Eclipse-motif
+ on GNU/Linux, so it will be break in smaller chunks to give a chance to
+ the console.
+
+ * .options: Set debug to true.
+ * src/.../core/MIPlugin.java (debugLog): Break the log line in small chuncks of 100.
+ * src/.../MISession.java (postCommand): Print the gdb/mi command.
+ * src/.../RxThread.java (run): Print gdb/mi responses.
+
+2002-10-20 Alain Magloire
+
-data-write-register-values is not in the texinfo manual but implemented in
gdb-5.2.1/gdb/mi/mim-main.c:
Write given values into registers. The registers and values are
Index: src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java,v
retrieving revision 1.29
diff -u -r1.29 MIPlugin.java
--- src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 9 Oct 2002 14:14:24 -0000 1.29
+++ src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 21 Oct 2002 02:53:50 -0000
@@ -24,6 +24,13 @@
* GDB/MI Plugin.
*/
public class MIPlugin extends Plugin {
+
+ /**
+ * The plug-in identifier of the Java core support
+ * (value <code>"org.eclipse.jdt.core"</code>).
+ */
+ public static final String PLUGIN_ID = "org.eclipse.cdt.debug.mi.core" ; //$NON-NLS-1$
+
//The shared instance.
private static MIPlugin plugin;
@@ -186,20 +193,30 @@
// If the default instance is not yet initialized,
// return a static identifier. This identifier must
// match the plugin id defined in plugin.xml
- return "org.eclipse.cdt.debug.mi.core"; //$NON-NLS-1$
+ return PLUGIN_ID;
}
return getDefault().getDescriptor().getUniqueIdentifier();
}
public static void debugLog(String message) {
- // if ( getDefault().isDebugging() ) {
- // getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null));
- if (message.endsWith("\n")) {
- System.err.print(message);
- } else {
- System.err.println(message);
+ if (getDefault().isDebugging()) {
+ // This is to verbose for a log file, better use the console.
+ // getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null));
+ // ALERT:FIXME: For example for big buffers say 4k length,
+ // the console will simply blow taking down eclipse.
+ // This seems only to happen in Eclipse-gtk and Eclipse-motif
+ // on GNU/Linux, so it will be break in smaller chunks.
+ while (message.length() > 100) {
+ String partial = message.substring(0, 100);
+ message = message.substring(100);
+ System.err.println(partial + "\\");
+ }
+ if (message.endsWith("\n")) {
+ System.err.print(message);
+ } else {
+ System.err.println(message);
+ }
}
- // }
}
/* (non-Javadoc)
Index: src/org/eclipse/cdt/debug/mi/core/MISession.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java,v
retrieving revision 1.35
diff -u -r1.35 MISession.java
--- src/org/eclipse/cdt/debug/mi/core/MISession.java 10 Oct 2002 22:05:53 -0000 1.35
+++ src/org/eclipse/cdt/debug/mi/core/MISession.java 21 Oct 2002 02:53:49 -0000
@@ -74,7 +74,9 @@
long cmdTimeout;
MIInferior inferior;
-
+
+ int cmdCount = 1;
+
/**
* Create the gdb session.
*
@@ -232,10 +234,10 @@
/**
* Sends a command to gdb, and wait(timeout) for a response.
*/
- static int number = 1;
public synchronized void postCommand(Command cmd, long timeout) throws MIException {
-//MIPlugin.getDefault().debugLog(number++ + " " + cmd.toString());
+ // TRACING: print the command;
+ MIPlugin.getDefault().debugLog(cmdCount++ + " " + cmd.toString());
// Test if we are in a sane state.
if (!txThread.isAlive() || !rxThread.isAlive()) {
Index: src/org/eclipse/cdt/debug/mi/core/RxThread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java,v
retrieving revision 1.32
diff -u -r1.32 RxThread.java
--- src/org/eclipse/cdt/debug/mi/core/RxThread.java 13 Oct 2002 02:28:14 -0000 1.32
+++ src/org/eclipse/cdt/debug/mi/core/RxThread.java 21 Oct 2002 02:53:49 -0000
@@ -68,8 +68,8 @@
try {
String line;
while ((line = reader.readLine()) != null) {
-//String text = (line.length() > 500) ? line.substring(0, 500) : line;
-//MIPlugin.getDefault().debugLog(text);
+ // TRACING: print the output.
+ MIPlugin.getDefault().debugLog(line);
processMIOutput(line + "\n");
}
} catch (IOException e) {