diff options
| author | Greg Clayton <gclayton@fb.com> | 2025-01-14 20:12:46 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-14 20:12:46 -0800 |
| commit | c4fb7180cbbe977f1ab1ce945a691550f8fdd1fb (patch) | |
| tree | 9c9e2c55a12a2935dab5e1e43a59fb0818106adf /lldb/source/Target/Target.cpp | |
| parent | 9ac6a55ec54fe4cd4a99c69ef1a4ddaea49e6688 (diff) | |
[lldb][NFC] Make the target's SectionLoadList private. (#113278)
Lots of code around LLDB was directly accessing the target's section
load list. This NFC patch makes the section load list private so the
Target class can access it, but everyone else now uses accessor
functions. This allows us to control the resolving of addresses and will
allow for functionality in LLDB which can lazily resolve addresses in
JIT plug-ins with a future patch.
Diffstat (limited to 'lldb/source/Target/Target.cpp')
| -rw-r--r-- | lldb/source/Target/Target.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 46216ba2d566..8d7709747765 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -270,12 +270,18 @@ void Target::DeleteCurrentProcess() { if (m_process_sp) { // We dispose any active tracing sessions on the current process m_trace_sp.reset(); - m_section_load_history.Clear(); + if (m_process_sp->IsAlive()) m_process_sp->Destroy(false); m_process_sp->Finalize(false /* not destructing */); + // Let the process finalize itself first, then clear the section load + // history. Some objects owned by the process might end up calling + // SectionLoadHistory::SetSectionUnloaded() which can create entries in + // the section load history that can mess up subsequent processes. + m_section_load_history.Clear(); + CleanupProcess(); m_process_sp.reset(); @@ -3217,8 +3223,9 @@ Status Target::Install(ProcessLaunchInfo *launch_info) { } bool Target::ResolveLoadAddress(addr_t load_addr, Address &so_addr, - uint32_t stop_id) { - return m_section_load_history.ResolveLoadAddress(stop_id, load_addr, so_addr); + uint32_t stop_id, bool allow_section_end) { + return m_section_load_history.ResolveLoadAddress(stop_id, load_addr, so_addr, + allow_section_end); } bool Target::ResolveFileAddress(lldb::addr_t file_addr, @@ -5147,3 +5154,15 @@ Target::ReportStatistics(const lldb_private::StatisticsOptions &options) { } void Target::ResetStatistics() { m_stats.Reset(*this); } + +bool Target::HasLoadedSections() { return !GetSectionLoadList().IsEmpty(); } + +lldb::addr_t Target::GetSectionLoadAddress(const lldb::SectionSP §ion_sp) { + return GetSectionLoadList().GetSectionLoadAddress(section_sp); +} + +void Target::ClearSectionLoadList() { GetSectionLoadList().Clear(); } + +void Target::DumpSectionLoadList(Stream &s) { + GetSectionLoadList().Dump(s, this); +} |
