Skip to content

Commit 0555e18

Browse files
Alexander Yermolovichroyitaqi
authored andcommitted
[roar][lldb] Fix m_making_external_plugin_call getting reset.
Summary: I discovered this issue, when trying to switch roar shims from ReadFromTarget to ReadFromProcess. Due to recursive calls the m_making_external_plugin_call would get set to false. Because of this SBProcess::ReadMemory will return error "process is running. Recursive stack trace: {F1981033265} In lldb_roar_private::JITLoaderROARSB::HandleNameBreakpointEvent We enter a scope and m_making_external_plugin_call is set to true. {F1981033274} through call to SetCallback we end up in ReadJITEntries() {F1981033299} where we enter another scope m_making_external_plugin_call is set to true, and then false as scope is exited. So when m_roar_di->HandleBreakpointByAddress is called and we end up reading from process the m_making_external_plugin_call is false, and error is returned. Test Plan: ninja check-lldb Rollback Plan: Reviewers: jpporto, #roar-jit, #lldb_team, ottoni Reviewed By: jpporto Differential Revision: https://phabricator.intern.facebook.com/D79913869 Tasks: T233982208 Tags: auto_accept2ship (cherry picked from commit b529c0588ea76c3ac251a3050da6aca576d8c1a0)
1 parent 9c8cad5 commit 0555e18

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lldb/source/Plugins/JITLoader/ROAR/JITLoaderROAR.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,17 @@ void lldb_roar_private::JITLoaderROARSB::HandleNameBreakpointEvent(
474474
lldb_private::Target *target = &m_process->GetTarget();
475475
addr_t load_address = addr.GetLoadAddress(target);
476476
JITLoaderROARError err;
477+
bool IsFunctionTrampoline = false;
478+
{
479+
PluginSync sync(*m_process);
480+
IsFunctionTrampoline =
481+
GetGlobalPluginProperties().GetDisableTrampolineStop() &&
482+
m_roar_di->IsFunctionTrampoline(load_address, err);
483+
}
484+
if (IsFunctionTrampoline)
485+
bp_loc->SetCallback(JITDebugTrampolineBreakpointHit, this, true);
477486
{
478487
PluginSync sync(*m_process);
479-
if (GetGlobalPluginProperties().GetDisableTrampolineStop() &&
480-
m_roar_di->IsFunctionTrampoline(load_address, err))
481-
bp_loc->SetCallback(JITDebugTrampolineBreakpointHit, this, true);
482-
483488
m_roar_di->HandleBreakpointByAddress(
484489
load_address, BreakpointOrLocationPtr{bp_loc.get()}.getOpaqueValue(),
485490
add_bp_locs, err);

0 commit comments

Comments
 (0)