void read_dynamic_info(Inferior inferior)
{
if (has_dynlink_info) {
if (!dyld_all_image_infos.IsNull)
do_update_shlib_info (inferior);
return;
}
TargetMemoryInfo info = Inferior.GetTargetMemoryInfo (AddressDomain.Global);
Bfd dyld_image = new Bfd (this, info, "/usr/lib/dyld", TargetAddress.Null, true);
dyld_all_image_infos = dyld_image.LookupSymbol("dyld_all_image_infos");
if (dyld_all_image_infos.IsNull)
return;
int size = 2 * inferior.TargetLongIntegerSize + 2 * inferior.TargetAddressSize;
TargetReader reader = new TargetReader (inferior.ReadMemory (dyld_all_image_infos, size));
reader.ReadLongInteger (); // version
reader.ReadLongInteger (); // infoArrayCount
reader.ReadAddress (); // infoArray
TargetAddress dyld_image_notifier = reader.ReadAddress ();
has_dynlink_info = true;
Instruction insn = inferior.Architecture.ReadInstruction (inferior, dyld_image_notifier);
if ((insn == null) || !insn.CanInterpretInstruction)
throw new InternalError ("Unknown dynlink breakpoint: {0}", dyld_image_notifier);
dynlink_breakpoint = new DynlinkBreakpoint (this, insn);
dynlink_breakpoint.Insert (inferior);
do_update_shlib_info (inferior);
check_loaded_library (inferior, main_bfd);