1
0
Fork 0

Remove the attach breakpoint functionality

This commit is contained in:
Duncan Ogilvie 2020-11-12 03:32:59 +01:00
parent c69ab584fe
commit a510dfb444
5 changed files with 94 additions and 100 deletions

View File

@ -1460,6 +1460,8 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
threadInfo.lpStartAddress = CreateProcessInfo->lpStartAddress;
threadInfo.lpThreadLocalBase = CreateProcessInfo->lpThreadLocalBase;
ThreadCreate(&threadInfo);
hActiveThread = ThreadGetHandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
}
static void cbExitProcess(EXIT_PROCESS_DEBUG_INFO* ExitProcess)
@ -1618,10 +1620,7 @@ static void cbSystemBreakpoint(void* ExceptionData) // TODO: System breakpoint e
GuiUpdateAllViews();
//log message
if(bIsAttached)
dputs(QT_TRANSLATE_NOOP("DBG", "Attach breakpoint reached!"));
else
dputs(QT_TRANSLATE_NOOP("DBG", "System breakpoint reached!"));
dputs(QT_TRANSLATE_NOOP("DBG", "System breakpoint reached!"));
dbgsetskipexceptions(false); //we are not skipping first-chance exceptions
//plugin callbacks
@ -1636,7 +1635,7 @@ static void cbSystemBreakpoint(void* ExceptionData) // TODO: System breakpoint e
dputs(QT_TRANSLATE_NOOP("DBG", "It has been detected that the debuggee entry point is in the MZ header of the executable. This will cause strange behavior, so the system breakpoint has been enabled regardless of your setting. Be careful!"));
systemBreakpoint = true;
}
if(bIsAttached ? settingboolget("Events", "AttachBreakpoint") : systemBreakpoint)
if(systemBreakpoint)
{
//lock
GuiSetDebugStateAsync(paused);
@ -2012,6 +2011,20 @@ static void cbAttachDebugger()
tidToResume = 0;
}
varset("$pid", fdProcessInfo->dwProcessId, true);
//Get on top of things
SetForegroundWindow(GuiGetWindowHandle());
// Update GUI (this should be the first triggered event)
duint cip = GetContextDataEx(hActiveThread, UE_CIP);
GuiDumpAt(MemFindBaseAddr(cip, 0, true)); //dump somewhere
DebugUpdateGuiSetStateAsync(cip, true, running);
MemInitRemoteProcessCookie(cookie.cookie);
GuiUpdateAllViews();
dputs(QT_TRANSLATE_NOOP("DBG", "Attached to process!"));
dbgsetskipexceptions(false); //we are not skipping first-chance exceptions
}
cmdline_qoutes_placement_t getqoutesplacement(const char* cmdline)

View File

@ -56,7 +56,6 @@ void SettingsDialog::LoadSettings()
settings.eventSystemBreakpoint = true;
settings.eventTlsCallbacks = true;
settings.eventEntryBreakpoint = true;
settings.eventAttachBreakpoint = true;
settings.eventNtTerminateProcess = false;
settings.engineType = DebugEngineTitanEngine;
settings.engineCalcType = calc_unsigned;
@ -97,7 +96,6 @@ void SettingsDialog::LoadSettings()
GetSettingBool("Events", "DllEntry", &settings.eventDllEntry);
GetSettingBool("Events", "DllEntrySystem", &settings.eventDllEntrySystem);
GetSettingBool("Events", "ThreadEntry", &settings.eventThreadEntry);
GetSettingBool("Events", "AttachBreakpoint", &settings.eventAttachBreakpoint);
GetSettingBool("Events", "DllLoad", &settings.eventDllLoad);
GetSettingBool("Events", "DllUnload", &settings.eventDllUnload);
GetSettingBool("Events", "DllLoadSystem", &settings.eventDllLoadSystem);
@ -113,7 +111,6 @@ void SettingsDialog::LoadSettings()
ui->chkDllEntry->setCheckState(bool2check(settings.eventDllEntry));
ui->chkDllEntrySystem->setCheckState(bool2check(settings.eventDllEntrySystem));
ui->chkThreadEntry->setCheckState(bool2check(settings.eventThreadEntry));
ui->chkAttachBreakpoint->setCheckState(bool2check(settings.eventAttachBreakpoint));
ui->chkDllLoad->setCheckState(bool2check(settings.eventDllLoad));
ui->chkDllUnload->setCheckState(bool2check(settings.eventDllUnload));
ui->chkDllLoadSystem->setCheckState(bool2check(settings.eventDllLoadSystem));
@ -367,7 +364,6 @@ void SettingsDialog::SaveSettings()
BridgeSettingSetUint("Events", "DllEntry", settings.eventDllEntry);
BridgeSettingSetUint("Events", "DllEntrySystem", settings.eventDllEntrySystem);
BridgeSettingSetUint("Events", "ThreadEntry", settings.eventThreadEntry);
BridgeSettingSetUint("Events", "AttachBreakpoint", settings.eventAttachBreakpoint);
BridgeSettingSetUint("Events", "DllLoad", settings.eventDllLoad);
BridgeSettingSetUint("Events", "DllUnload", settings.eventDllUnload);
BridgeSettingSetUint("Events", "DllLoadSystem", settings.eventDllLoadSystem);
@ -564,11 +560,6 @@ void SettingsDialog::on_chkThreadEntry_stateChanged(int arg1)
settings.eventThreadEntry = arg1 != Qt::Unchecked;
}
void SettingsDialog::on_chkAttachBreakpoint_stateChanged(int arg1)
{
settings.eventAttachBreakpoint = arg1 != Qt::Unchecked;
}
void SettingsDialog::on_chkConfirmBeforeAtt_stateChanged(int arg1)
{
settings.miscSetJITAuto = arg1 != Qt::Unchecked;

View File

@ -36,7 +36,6 @@ private slots:
void on_chkDllEntry_stateChanged(int arg1);
void on_chkDllEntrySystem_stateChanged(int arg1);
void on_chkThreadEntry_stateChanged(int arg1);
void on_chkAttachBreakpoint_stateChanged(int arg1);
void on_chkDllLoad_stateChanged(int arg1);
void on_chkDllUnload_stateChanged(int arg1);
void on_chkDllLoadSystem_stateChanged(int arg1);
@ -149,7 +148,6 @@ private:
bool eventDllEntry;
bool eventDllEntrySystem;
bool eventThreadEntry;
bool eventAttachBreakpoint;
bool eventDllLoad;
bool eventDllUnload;
bool eventDllLoadSystem;

View File

@ -40,31 +40,10 @@
<string>Events</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="chkThreadEntry">
<item row="11" column="1">
<widget class="QCheckBox" name="chkDllUnloadSystem">
<property name="text">
<string>Thread Entry</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="chkThreadStart">
<property name="text">
<string>Thread Start</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="chkDllLoad">
<property name="text">
<string>DLL Load</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkThreadEnd">
<property name="text">
<string>Thread End</string>
<string>System DLL Unload</string>
</property>
</widget>
</item>
@ -81,27 +60,6 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="chkDebugStrings">
<property name="text">
<string>Debug Strings</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblBreakOn">
<property name="text">
<string>Break on:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="chkDllEntry">
<property name="text">
<string>DLL Entry</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkEntryBreakpoint">
<property name="text">
@ -112,10 +70,10 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkAttachBreakpoint">
<item row="8" column="1">
<widget class="QCheckBox" name="chkDllEntrySystem">
<property name="text">
<string>Attach Breakpoint</string>
<string>System DLL Entry</string>
</property>
</widget>
</item>
@ -129,23 +87,6 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="chkDllUnload">
<property name="text">
<string>DLL Unload</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="chkTlsCallbacks">
<property name="text">
<string>TLS Callbacks*</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkNtTerminateProcess">
<property name="text">
@ -153,20 +94,6 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="chkTlsCallbacksSystem">
<property name="text">
<string>System TLS Callbacks*</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="chkDllEntrySystem">
<property name="text">
<string>System DLL Entry</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="chkDllLoadSystem">
<property name="text">
@ -174,10 +101,76 @@
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="chkDllUnloadSystem">
<item row="2" column="1">
<widget class="QCheckBox" name="chkThreadStart">
<property name="text">
<string>System DLL Unload</string>
<string>Thread Start</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblBreakOn">
<property name="text">
<string>Break on:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkThreadEnd">
<property name="text">
<string>Thread End</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="chkDebugStrings">
<property name="text">
<string>Debug Strings</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="chkThreadEntry">
<property name="text">
<string>Thread Entry</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="chkTlsCallbacksSystem">
<property name="text">
<string>System TLS Callbacks*</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkTlsCallbacks">
<property name="text">
<string>TLS Callbacks*</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="chkDllEntry">
<property name="text">
<string>DLL Entry</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="chkDllLoad">
<property name="text">
<string>DLL Load</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="chkDllUnload">
<property name="text">
<string>DLL Unload</string>
</property>
</widget>
</item>
@ -995,7 +988,6 @@
<tabstop>tabWidget</tabstop>
<tabstop>chkSystemBreakpoint</tabstop>
<tabstop>chkEntryBreakpoint</tabstop>
<tabstop>chkDllEntry</tabstop>
<tabstop>radioInt3Short</tabstop>
<tabstop>radioInt3Long</tabstop>
<tabstop>radioUd2</tabstop>

View File

@ -51,7 +51,7 @@
<item>
<widget class="QGroupBox" name="groupBoxDebuggee">
<property name="title">
<string>2. System breakpoint script for a specific process (attach to a process to specify)</string>
<string>2. System breakpoint script for a specific process (debug a process to specify)</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>