@@ -6189,10 +6189,6 @@ Section *ObjectFileMachO::GetMachHeaderSection() {
6189
6189
bool ObjectFileMachO::SectionIsLoadable (const Section *section) {
6190
6190
if (!section)
6191
6191
return false ;
6192
- const bool is_dsym = (m_header.filetype == MH_DSYM);
6193
- if (section->GetFileSize () == 0 && !is_dsym &&
6194
- section->GetName () != GetSegmentNameDATA ())
6195
- return false ;
6196
6192
if (section->IsThreadSpecific ())
6197
6193
return false ;
6198
6194
if (GetModule ().get () != section->GetModule ().get ())
@@ -6232,6 +6228,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage(
6232
6228
6233
6229
bool ObjectFileMachO::SetLoadAddress (Target &target, lldb::addr_t value,
6234
6230
bool value_is_offset) {
6231
+ Log *log (GetLog (LLDBLog::DynamicLoader));
6235
6232
ModuleSP module_sp = GetModule ();
6236
6233
if (!module_sp)
6237
6234
return false ;
@@ -6247,17 +6244,33 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
6247
6244
// malformed.
6248
6245
const bool warn_multiple = true ;
6249
6246
6247
+ if (log) {
6248
+ StreamString logmsg;
6249
+ logmsg << " ObjectFileMachO::SetLoadAddress " ;
6250
+ if (GetFileSpec ())
6251
+ logmsg << " path='" << GetFileSpec ().GetPath () << " ' " ;
6252
+ if (GetUUID ()) {
6253
+ logmsg << " uuid=" << GetUUID ().GetAsString ();
6254
+ }
6255
+ LLDB_LOGF (log, " %s" , logmsg.GetData ());
6256
+ }
6250
6257
if (value_is_offset) {
6251
6258
// "value" is an offset to apply to each top level segment
6252
6259
for (size_t sect_idx = 0 ; sect_idx < num_sections; ++sect_idx) {
6253
6260
// Iterate through the object file sections to find all of the
6254
6261
// sections that size on disk (to avoid __PAGEZERO) and load them
6255
6262
SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
6256
- if (SectionIsLoadable (section_sp.get ()))
6263
+ if (SectionIsLoadable (section_sp.get ())) {
6264
+ LLDB_LOGF (log,
6265
+ " ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
6266
+ " 0x%" PRIx64,
6267
+ section_sp->GetName ().AsCString (),
6268
+ section_sp->GetFileAddress () + value);
6257
6269
if (target.GetSectionLoadList ().SetSectionLoadAddress (
6258
6270
section_sp, section_sp->GetFileAddress () + value,
6259
6271
warn_multiple))
6260
6272
++num_loaded_sections;
6273
+ }
6261
6274
}
6262
6275
} else {
6263
6276
// "value" is the new base address of the mach_header, adjust each
@@ -6272,6 +6285,10 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
6272
6285
CalculateSectionLoadAddressForMemoryImage (
6273
6286
value, mach_header_section, section_sp.get ());
6274
6287
if (section_load_addr != LLDB_INVALID_ADDRESS) {
6288
+ LLDB_LOGF (log,
6289
+ " ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
6290
+ " 0x%" PRIx64,
6291
+ section_sp->GetName ().AsCString (), section_load_addr);
6275
6292
if (target.GetSectionLoadList ().SetSectionLoadAddress (
6276
6293
section_sp, section_load_addr, warn_multiple))
6277
6294
++num_loaded_sections;
0 commit comments