summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
commit344a3780b2e33f6ca763666c380202b18aab72a3 (patch)
treef0b203ee6eb71d7fdd792373e3c81eb18d6934dd /lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
parentb60736ec1405bb0a8dd40989f67ef4c93da068ab (diff)
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp')
-rw-r--r--lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index c1fceeb1482c..8a5528f1e474 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -10,6 +10,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "DynamicLoaderStatic.h"
@@ -105,6 +106,15 @@ void DynamicLoaderStatic::LoadAllImagesAtFileAddresses() {
// the file...
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp) {
+ // If this section already has a load address set in the target,
+ // don't re-set it to the file address. Something may have
+ // set it to a more correct value already.
+ if (m_process->GetTarget()
+ .GetSectionLoadList()
+ .GetSectionLoadAddress(section_sp) !=
+ LLDB_INVALID_ADDRESS) {
+ continue;
+ }
if (m_process->GetTarget().SetSectionLoadAddress(
section_sp, section_sp->GetFileAddress()))
changed = true;