@@ -6207,6 +6207,10 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
6207
6207
size_t num_loaded_sections = 0 ;
6208
6208
const size_t num_sections = section_list->GetSize ();
6209
6209
6210
+ // Warn if some top-level segments map to the same address. The binary may be
6211
+ // malformed.
6212
+ const bool warn_multiple = true ;
6213
+
6210
6214
if (value_is_offset) {
6211
6215
// "value" is an offset to apply to each top level segment
6212
6216
for (size_t sect_idx = 0 ; sect_idx < num_sections; ++sect_idx) {
@@ -6215,7 +6219,8 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
6215
6219
SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
6216
6220
if (SectionIsLoadable (section_sp.get ()))
6217
6221
if (target.GetSectionLoadList ().SetSectionLoadAddress (
6218
- section_sp, section_sp->GetFileAddress () + value))
6222
+ section_sp, section_sp->GetFileAddress () + value,
6223
+ warn_multiple))
6219
6224
++num_loaded_sections;
6220
6225
}
6221
6226
} else {
@@ -6232,7 +6237,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
6232
6237
value, mach_header_section, section_sp.get ());
6233
6238
if (section_load_addr != LLDB_INVALID_ADDRESS) {
6234
6239
if (target.GetSectionLoadList ().SetSectionLoadAddress (
6235
- section_sp, section_load_addr))
6240
+ section_sp, section_load_addr, warn_multiple ))
6236
6241
++num_loaded_sections;
6237
6242
}
6238
6243
}
0 commit comments