@@ -224,6 +224,16 @@ static bool load_standalone_binary(UUID uuid, addr_t value,
224
224
target.SetArchitecture (module_sp->GetObjectFile ()->GetArchitecture ());
225
225
target.GetImages ().AppendIfNeeded (module_sp, false );
226
226
227
+ // TODO: Instead of using the load address as a value, if we create a
228
+ // memory module from that address, we could get the correct segment
229
+ // offset values from the in-memory load commands and set them correctly.
230
+ // In case the load address we were given is not correct for all segments,
231
+ // e.g. something in the shared cache. DynamicLoaderDarwinKernel does
232
+ // something similar for kexts. In the context of a corefile, this would
233
+ // be an inexpensive operation. Not all binaries in a corefile will have
234
+ // a Mach-O header/load commands in memory, so this will not work in all
235
+ // cases.
236
+
227
237
bool changed = false ;
228
238
if (module_sp->GetObjectFile ()) {
229
239
if (value != LLDB_INVALID_ADDRESS) {
@@ -355,6 +365,8 @@ Status ProcessMachCore::DoLoadCore() {
355
365
if (objfile_binary_value != LLDB_INVALID_ADDRESS &&
356
366
!objfile_binary_value_is_offset) {
357
367
if (type == ObjectFile::eBinaryTypeUser) {
368
+ load_standalone_binary (objfile_binary_uuid, objfile_binary_value,
369
+ objfile_binary_value_is_offset, GetTarget ());
358
370
m_dyld_addr = objfile_binary_value;
359
371
m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic ();
360
372
found_main_binary_definitively = true ;
0 commit comments