Skip to content

Commit

Permalink
fix: fixed deadlock when processing single step
Browse files Browse the repository at this point in the history
  • Loading branch information
sssooonnnggg committed Jan 6, 2025
1 parent 72742b2 commit 72a68ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions debugger/src/internal/debug_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <internal/vm_registry.h>

#include "debugger.h"
#include "internal/utils/dap_utils.h"

namespace luau::debugger {

Expand Down Expand Up @@ -111,7 +110,9 @@ StackTraceResponse DebugBridge::getStackTrace(std::int64_t threadId) {
if (!isDebugBreak())
return StackTraceResponse{};

lua_State* L = threadId == 1 ? break_vm_ : vm_registry_.getThread(static_cast<int>(threadId));
lua_State* L = threadId == 1
? break_vm_
: vm_registry_.getThread(static_cast<int>(threadId));

StackTraceResponse response;
lua_utils::DisableDebugStep _(break_vm_);
Expand Down
5 changes: 4 additions & 1 deletion debugger/src/internal/variable_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ void VariableRegistry::update(
if (vm_with_ancestors.empty())
return;

auto* first_state = vm_with_ancestors[0][0];
lua_utils::DisableDebugStep _(first_state);

for (const auto& chain : vm_with_ancestors) {
depth_ = 0;
lua_State* src = chain[0];
for (lua_State* L : chain)
fetch(L, src);
}

fetchGlobals(vm_with_ancestors[0][0]);
fetchGlobals(first_state);
clearDirtyScopes();
}

Expand Down

0 comments on commit 72a68ea

Please sign in to comment.