Skip to content

Commit 245188b

Browse files
committed
DBG: "setfreezestack 1/0" command to freeze the stack
1 parent ce3daae commit 245188b

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

src/dbg/debugger.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ void dbgsetisdetachedbyuser(bool b)
155155
isDetachedByUser = b;
156156
}
157157

158+
void dbgsetfreezestack(bool freeze)
159+
{
160+
bFreezeStack = freeze;
161+
}
162+
158163
void dbgclearignoredexceptions()
159164
{
160165
ignoredExceptionRange.clear();
@@ -1128,6 +1133,7 @@ DWORD WINAPI threadDebugLoop(void* lpParameter)
11281133
bIsAttached = false;
11291134
bSkipExceptions = false;
11301135
bBreakOnNextDll = false;
1136+
bFreezeStack = false;
11311137
INIT_STRUCT* init = (INIT_STRUCT*)lpParameter;
11321138
bFileIsDll = IsFileDLLW(StringUtils::Utf8ToUtf16(init->exe).c_str(), 0);
11331139
pDebuggedEntry = GetPE32DataW(StringUtils::Utf8ToUtf16(init->exe).c_str(), 0, UE_OEP);
@@ -1421,6 +1427,7 @@ DWORD WINAPI threadAttachLoop(void* lpParameter)
14211427
lock(WAITID_STOP);
14221428
bIsAttached = true;
14231429
bSkipExceptions = false;
1430+
bFreezeStack = false;
14241431
DWORD pid = (DWORD)lpParameter;
14251432
static PROCESS_INFORMATION pi_attached;
14261433
fdProcessInfo = &pi_attached;

src/dbg/debugger.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void dbgsetskipexceptions(bool skip);
7474
void dbgsetstepping(bool stepping);
7575
void dbgsetispausedbyuser(bool b);
7676
void dbgsetisdetachedbyuser(bool b);
77+
void dbgsetfreezestack(bool freeze);
7778
void dbgclearignoredexceptions();
7879
void dbgaddignoredexception(ExceptionRange range);
7980
bool dbgisignoredexception(unsigned int exception);

src/dbg/debugger_commands.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,3 +2091,16 @@ CMDRESULT cbDebugSkip(int argc, char* argv[])
20912091
DebugUpdateGui(cip, false); //update GUI
20922092
return STATUS_CONTINUE;
20932093
}
2094+
2095+
CMDRESULT cbDebugSetfreezestack(int argc, char* argv[])
2096+
{
2097+
if (argc < 2)
2098+
{
2099+
dputs("Not enough arguments!");
2100+
return STATUS_ERROR;
2101+
}
2102+
bool freeze = *argv[1] != '0';
2103+
dbgsetfreezestack(freeze);
2104+
dprintf("Stack is now %s\n", freeze ? "freezed" : "unfreezed");
2105+
return STATUS_CONTINUE;
2106+
}

src/dbg/debugger_commands.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[]);
6464
CMDRESULT cbDebugGetPageRights(int argc, char* argv[]);
6565
CMDRESULT cbDebugSetPageRights(int argc, char* argv[]);
6666
CMDRESULT cbDebugSkip(int argc, char* argv[]);
67+
CMDRESULT cbDebugSetfreezestack(int argc, char* argv[]);
6768

6869
//misc
6970
void showcommandlineerror(cmdline_error_t* cmdline_error);

src/dbg/x64_dbg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ static void registercommands()
212212
dbgcmdnew("virtualmod", cbInstrVirtualmod, true); //virtual module
213213
dbgcmdnew("findallmem\1findmemall", cbInstrFindMemAll, true); //memory map pattern find
214214
dbgcmdnew("setmaxfindresult\1findsetmaxresult", cbInstrSetMaxFindResult, false); //set the maximum number of occurences found
215+
dbgcmdnew("setfreezestack", cbDebugSetfreezestack, false); //freeze the stack from auto updates
215216
}
216217

217218
static bool cbCommandProvider(char* cmd, int maxlen)

0 commit comments

Comments
 (0)