mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
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>
This commit is contained in:
parent
61492f65a2
commit
9b4dba0458
2 changed files with 70 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue