Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Ward2016-06-16 14:30:50 +0000
committerElena Laskavaia2016-07-04 18:09:17 +0000
commit9b4dba04585fc4ed9aac2b36baeb90ab12bab136 (patch)
tree1d2f2bfef25504832d0678c6d63d0dbb710f8fa1
parent61492f65a25fe07595661dc356f256548b527637 (diff)
downloadorg.eclipse.cdt-9b4dba04585fc4ed9aac2b36baeb90ab12bab136.tar.gz
org.eclipse.cdt-9b4dba04585fc4ed9aac2b36baeb90ab12bab136.tar.xz
org.eclipse.cdt-9b4dba04585fc4ed9aac2b36baeb90ab12bab136.zip
Bug 496415. Show reason for crash when core debugging.
Changes: When a core debugging session starts a MIConsoleStreamOuput is received by MIRunControlEventProcessor or MIRunControlEventProcessor_7_0 which contains a string of the form "Program terminated with signal <signal>, <reason>". The signal and reason are parsed from the string and a new signal event created and dispatched. The label of the last executing thread (one that received the signal) in the debug view then shows the signal that caused the core file to be created Testing: Tested on Windows and a Lubuntu VM Change-Id: I02fa4b2fe458005f159341fcbcaaaa2fe57a7871 Signed-off-by: Adam Ward <award@blackberry.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java35
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java35
2 files changed, 70 insertions, 0 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
index c60010f524a..8ce3d754eb2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java
@@ -14,6 +14,8 @@ package org.eclipse.cdt.dsf.mi.service.command;
import java.util.LinkedList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
@@ -55,6 +57,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MISteppingRangeEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIConsoleStreamOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIExecAsyncOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
@@ -172,6 +175,38 @@ public class MIRunControlEventProcessor
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
}
}
+ } else if (oobr instanceof MIConsoleStreamOutput) {
+ MIConsoleStreamOutput stream = (MIConsoleStreamOutput) oobr;
+ if (stream.getCString().startsWith("Program terminated with signal")) {//$NON-NLS-1$
+
+ /*
+ * The string should be in the form "Program terminated with signal <signal>, <reason>."
+ * For Example: Program terminated with signal SIGABRT, Aborted.
+ */
+
+ // Parse the <signal> and the <reason>
+ Pattern pattern = Pattern.compile("Program terminated with signal (.*), (.*)\\..*"); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(stream.getCString());
+ if (matcher.matches()) {
+ MIExecAsyncOutput exec = new MIExecAsyncOutput();
+
+ MIResult name = new MIResult();
+ name.setVariable("signal-name"); //$NON-NLS-1$
+ MIConst nameValue = new MIConst();
+ nameValue.setCString(matcher.group(1));
+ name.setMIValue(nameValue);
+
+ MIResult meaning = new MIResult();
+ meaning.setVariable("signal-meaning"); //$NON-NLS-1$
+ MIConst meaningValue = new MIConst();
+ meaningValue.setCString(matcher.group(2));
+ meaning.setMIValue(meaningValue);
+
+ exec.setMIResults(new MIResult[] { name, meaning });
+ MIEvent<?> event = createEvent("signal-received", exec); //$NON-NLS-1$
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
index 39a7384b25d..d179514749d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java
@@ -15,6 +15,8 @@ package org.eclipse.cdt.dsf.mi.service.command;
import java.util.LinkedList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
@@ -54,6 +56,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadGroupCreatedEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadGroupExitedEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIConsoleStreamOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIExecAsyncOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
@@ -270,6 +273,38 @@ public class MIRunControlEventProcessor_7_0
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
}
}
+ } else if (oobr instanceof MIConsoleStreamOutput) {
+ MIConsoleStreamOutput stream = (MIConsoleStreamOutput) oobr;
+ if (stream.getCString().startsWith("Program terminated with signal")) {//$NON-NLS-1$
+
+ /*
+ * The string should be in the form "Program terminated with signal <signal>, <reason>."
+ * For Example: Program terminated with signal SIGABRT, Aborted.
+ */
+
+ // Parse the <signal> and the <reason>
+ Pattern pattern = Pattern.compile("Program terminated with signal (.*), (.*)\\..*"); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(stream.getCString());
+ if (matcher.matches()) {
+ MIExecAsyncOutput exec = new MIExecAsyncOutput();
+
+ MIResult name = new MIResult();
+ name.setVariable("signal-name"); //$NON-NLS-1$
+ MIConst nameValue = new MIConst();
+ nameValue.setCString(matcher.group(1));
+ name.setMIValue(nameValue);
+
+ MIResult meaning = new MIResult();
+ meaning.setVariable("signal-meaning"); //$NON-NLS-1$
+ MIConst meaningValue = new MIConst();
+ meaningValue.setCString(matcher.group(2));
+ meaning.setMIValue(meaningValue);
+
+ exec.setMIResults(new MIResult[] { name, meaning });
+ MIEvent<?> event = createEvent("signal-received", exec); //$NON-NLS-1$
+ fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
+ }
+ }
}
}
}

Back to the top