[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Patch for GDB exitcode
|
Hi,
org.eclipse.cdt.debug.mi.commands.MIGDBShowExitCode is currently using an
improperly-defined command to get at the exit code of the inferior. "show
convenience" returns a list of all the installed convenience variables.
It does not take any arguments.
Instead, use -data-evaluate-expression to get at $_exitcode. This patch
modifies MIGDBShowExitCode.java and MIGDBShowExitCodeInfo.java to use this
route.
(BTW, is there a way for eclipse to generate a patch against multiple
files at once? Whenever I have more than one file selected, the
Team->Create Patch... option is disabled.)
Keith
Index: MIGDBShowExitCode.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/MIGDBShowExitCode.java,v
retrieving revision 1.1
diff -u -r1.1 MIGDBShowExitCode.java
--- MIGDBShowExitCode.java 12 Aug 2002 03:16:56 -0000 1.1
+++ MIGDBShowExitCode.java 8 Oct 2002 16:07:19 -0000
@@ -18,9 +18,9 @@
* Show the current value of a GDB variable.
*
*/
-public class MIGDBShowExitCode extends MIGDBShow {
+public class MIGDBShowExitCode extends MICommand {
public MIGDBShowExitCode() {
- super(new String[] { "convenience", "$_exitcode" });
+ super("-data-evaluate-expression", new String[]{"$_exitcode" });
}
public MIGDBShowExitCodeInfo getMIGDBShowExitCodeInfo() throws MIException {
Index: MIGDBShowExitCodeInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/output/MIGDBShowExitCodeInfo.java,v
retrieving revision 1.1
diff -u -r1.1 MIGDBShowExitCodeInfo.java
--- MIGDBShowExitCodeInfo.java 12 Aug 2002 03:16:56 -0000 1.1
+++ MIGDBShowExitCodeInfo.java 8 Oct 2002 16:08:49 -0000
@@ -16,7 +16,7 @@
* ~"\n"
* ^done
*/
-public class MIGDBShowExitCodeInfo extends MIInfo {
+public class MIGDBShowExitCodeInfo extends MIDataEvaluateExpressionInfo {
int code;
@@ -27,28 +27,5 @@
public int getCode() {
return code;
- }
-
- void parse() {
- 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();
- if (str.startsWith("$_exitcode")) {
- int j = str.indexOf('=');
- if (j != -1) {
- String sub = str.substring(j + 1).trim();
- try {
- code = Integer.parseInt(sub);
- } catch (NumberFormatException e) {
- }
- }
- }
- }
- }
- }
}
}