use of com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper in project binnavi by google.
the class CDebuggerFunctions method stepEnd.
/**
* Lets the debugger step to the end of the function.
*
* @param parent Parent window used for dialogs.
* @param debugger The debugger that steps to the end of the function.
* @param graph The graph where the step operation happens.
*/
public static void stepEnd(final JFrame parent, final IDebugger debugger, final ZyGraph graph) {
checkArguments(parent, debugger, graph);
if (!debugger.isConnected()) {
return;
}
final TargetProcessThread activeThread = debugger.getProcessManager().getActiveThread();
if (activeThread == null) {
return;
}
final RelocatedAddress currentAddress = activeThread.getCurrentAddress();
if (currentAddress == null) {
CMessageBox.showError(parent, "Could not step because the selected thread is not suspended");
return;
}
final Set<BreakpointAddress> relocatedBlockAddresses = CStepEndHelper.getEndAddresses(graph);
if (relocatedBlockAddresses.isEmpty()) {
CMessageBox.showError(parent, "Couldn't step to the end of the function");
return;
} else {
debugger.getProcessManager().setActiveThread(null);
debugger.getBreakpointManager().addBreakpoints(BreakpointType.STEP, relocatedBlockAddresses);
try {
debugger.resume();
} catch (final DebugExceptionWrapper e) {
debugger.getBreakpointManager().removeBreakpoints(BreakpointType.STEP, relocatedBlockAddresses);
debugger.getProcessManager().setActiveThread(activeThread);
CUtilityFunctions.logException(e);
final String innerMessage = "E00086: " + "Could not send step end command to the debug client";
final String innerDescription = CUtilityFunctions.createDescription("BinNavi could not send the step end command to the debug client.", new String[] { "There was a problem with the connection to the debug client." }, new String[] { "The state of the debugged process remains unchanged." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper in project binnavi by google.
the class CDebuggerFunctions method sendDebuggerEventSettings.
public static void sendDebuggerEventSettings(final JFrame parent, final IDebugger debugger, final DebugTargetSettings debugTarget) {
try {
final DebuggerEventSettingsStorage eventSettingsStorage = new DebuggerEventSettingsStorage(debugger, debugTarget);
debugger.setDebuggerEventSettings(eventSettingsStorage.deserialize());
} catch (final DebugExceptionWrapper exception) {
CUtilityFunctions.logException(exception);
final String message = "Debugger event settings could not be sent to the debugger.";
final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not send the debugger event settings to the debug client."), new String[] {}, new String[] { "The default debugger event settings will be used during this session." });
NaviErrorDialog.show(parent, message, description, exception);
} catch (final CouldntLoadDataException exception) {
CUtilityFunctions.logException(exception);
final String message = "Debugger event settings could not be retrieved from the database.";
final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not send the debugger event settings to the debug client."), new String[] {}, new String[] { "The default debugger event settings will be used during this session." });
NaviErrorDialog.show(parent, message, description, exception);
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper in project binnavi by google.
the class ModuleUnloadedSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final ModuleUnloadedReply reply) {
final ProcessManager processManager = getDebugger().getProcessManager();
final MemoryModule replyModule = reply.getModule();
final MemoryModule existingModule = processManager.getModule(replyModule.getBaseAddress());
if (existingModule == null) {
processManager.removeNonExistingModule(replyModule);
} else {
processManager.removeModule(existingModule);
CBreakpointModuleSynchronizer.disableEchoBreakpoints(getDebugger(), existingModule);
CBreakpointModuleSynchronizer.disableRegularBreakpoints(getDebugger(), existingModule);
}
if (needsResume()) {
try {
getDebugger().resume();
} catch (final DebugExceptionWrapper e) {
NaviLogger.severe("Error: Could not resume the debugger. Exception: %s", e);
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper in project binnavi by google.
the class ProcessStartSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final ProcessStartReply reply) {
final TargetProcessThread thread = reply.getProcessStart().getThread();
final MemoryModule module = reply.getProcessStart().getModule();
getDebugger().getProcessManager().addThread(thread);
getDebugger().getProcessManager().setActiveThread(thread);
refreshRegisters();
CRelocationNotifier.relocateModule(getDebugger(), module);
getDebugger().getProcessManager().addModule(module);
CBreakpointModuleSynchronizer.enableRegularBreakpoints(getDebugger(), module);
try {
getDebugger().resume();
} catch (final DebugExceptionWrapper e) {
NaviLogger.severe("Error: Could not resume debugger. Exception: %s", e);
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper in project binnavi by google.
the class TargetInformationSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final TargetInformationReply reply) {
final IDebugger debugger = getDebugger();
final ProcessManager processManager = getDebugger().getProcessManager();
final TargetInformation info = reply.getTargetInformation();
processManager.setTargetInformation(info);
if (info.getDebuggerOptions().canMemmap()) {
try {
// As soon as we are attached to the target process, we
// try to find out the memory structure of the target
// process.
debugger.getMemoryMap();
} catch (final DebugExceptionWrapper e) {
NaviLogger.severe("Error: Debugger could not get memory map. Exception %s", e);
issueDebugException(e);
}
}
}
Aggregations