Skip to content

Commit

Permalink
Only use the LLIL/MLIL/HLIL if they are available. Fix crash when ste…
Browse files Browse the repository at this point in the history
…pping fast. Fix Vector35#537
  • Loading branch information
xusheng6 committed Jan 31, 2024
1 parent 4719177 commit 00d741d
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions core/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ DebugStopReason DebuggerController::StepIntoIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
LowLevelILFunctionRef llil = func->GetLowLevelIL();
LowLevelILFunctionRef llil = func->GetLowLevelILIfAvailable();
if (!llil)
return SingleStep;

size_t start = llil->GetInstructionStart(m_liveView->GetDefaultArchitecture(), newRemoteRip);
if (start < llil->GetInstructionCount())
{
Expand All @@ -397,7 +400,10 @@ DebugStopReason DebuggerController::StepIntoIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
MediumLevelILFunctionRef mlil = func->GetMediumLevelIL();
MediumLevelILFunctionRef mlil = func->GetMediumLevelILIfAvailable();
if (!mlil)
return SingleStep;

size_t start = mlil->GetInstructionStart(m_liveView->GetDefaultArchitecture(), newRemoteRip);
if (start < mlil->GetInstructionCount())
{
Expand Down Expand Up @@ -425,7 +431,10 @@ DebugStopReason DebuggerController::StepIntoIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
HighLevelILFunctionRef hlil = func->GetHighLevelIL();
HighLevelILFunctionRef hlil = func->GetHighLevelILIfAvailable();
if (!hlil)
return SingleStep;

for (size_t i = 0; i < hlil->GetInstructionCount(); i++)
{
if (hlil->GetInstruction(i).address == newRemoteRip)
Expand Down Expand Up @@ -491,7 +500,10 @@ DebugStopReason DebuggerController::StepOverIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
LowLevelILFunctionRef llil = func->GetLowLevelIL();
LowLevelILFunctionRef llil = func->GetLowLevelILIfAvailable();
if (!llil)
return SingleStep;

size_t start = llil->GetInstructionStart(m_liveView->GetDefaultArchitecture(), newRemoteRip);
if (start < llil->GetInstructionCount())
{
Expand All @@ -517,7 +529,10 @@ DebugStopReason DebuggerController::StepOverIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
MediumLevelILFunctionRef mlil = func->GetMediumLevelIL();
MediumLevelILFunctionRef mlil = func->GetMediumLevelILIfAvailable();
if (!mlil)
return SingleStep;

size_t start = mlil->GetInstructionStart(m_liveView->GetDefaultArchitecture(), newRemoteRip);
if (start < mlil->GetInstructionCount())
{
Expand Down Expand Up @@ -545,7 +560,10 @@ DebugStopReason DebuggerController::StepOverIL(BNFunctionGraphType il)

for (FunctionRef& func : functions)
{
HighLevelILFunctionRef hlil = func->GetHighLevelIL();
HighLevelILFunctionRef hlil = func->GetHighLevelILIfAvailable();
if (!hlil)
return SingleStep;

for (size_t i = 0; i < hlil->GetInstructionCount(); i++)
{
if (hlil->GetInstruction(i).address == newRemoteRip)
Expand Down

0 comments on commit 00d741d

Please sign in to comment.