Skip to content

Commit 53f20aa

Browse files
Alexander Yermolovichkusmour
authored andcommitted
[LLDB] Add API to SBTarget not to flush for SetSectionLoadAddress
Summary: A custom JIT can be invoked in the middle of unwinding to load debug information. In this case we do not want to flush the process. Test Plan: ninja check-lldb Rollback Plan: Reviewers: gclayton, joh, #lldb_team Reviewed By: gclayton Differential Revision: https://phabricator.intern.facebook.com/D77634921 Tasks: T227178858
1 parent 6029238 commit 53f20aa

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lldb/include/lldb/API/SBTarget.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,25 @@ class LLDB_API SBTarget {
395395
lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
396396
lldb::addr_t section_base_addr);
397397

398+
/// Set the base load address for a module section.
399+
///
400+
/// \param[in] section
401+
/// The section whose base load address will be set within this
402+
/// target.
403+
///
404+
/// \param[in] section_base_addr
405+
/// The base address for the section.
406+
///
407+
/// \param[in] should_flush
408+
/// Controls whether process should be flushed after adddress is set.
409+
///
410+
/// \return
411+
/// An error to indicate success, fail, and any reason for
412+
/// failure.
413+
lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
414+
lldb::addr_t section_base_addr,
415+
bool should_flush);
416+
398417
/// Clear the base load address for a module section.
399418
///
400419
/// \param[in] section

lldb/source/API/SBTarget.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,12 @@ SBTarget::GetInstructionsWithFlavor(lldb::addr_t base_addr,
20712071

20722072
SBError SBTarget::SetSectionLoadAddress(lldb::SBSection section,
20732073
lldb::addr_t section_base_addr) {
2074+
return SetSectionLoadAddress(section, section_base_addr, true);
2075+
}
2076+
2077+
SBError SBTarget::SetSectionLoadAddress(lldb::SBSection section,
2078+
lldb::addr_t section_base_addr,
2079+
bool should_flush) {
20742080
LLDB_INSTRUMENT_VA(this, section, section_base_addr);
20752081

20762082
SBError sb_error;
@@ -2093,7 +2099,7 @@ SBError SBTarget::SetSectionLoadAddress(lldb::SBSection section,
20932099
target_sp->ModulesDidLoad(module_list);
20942100
}
20952101
// Flush info in the process (stack frames, etc)
2096-
if (process_sp)
2102+
if (process_sp && should_flush)
20972103
process_sp->Flush();
20982104
}
20992105
}

0 commit comments

Comments
 (0)