void do_update_shlib_info(Inferior inferior)
        {
            bool          first = true;
            TargetAddress map   = first_link_map;

            while (!map.IsNull)
            {
                int          the_size   = 4 * inferior.TargetAddressSize;
                TargetReader map_reader = new TargetReader(inferior.ReadMemory(map, the_size));

                TargetAddress l_addr = map_reader.ReadAddress();
                TargetAddress l_name = map_reader.ReadAddress();
                map_reader.ReadAddress();

                string name;
                try {
                    name = inferior.ReadString(l_name);
                    // glibc 2.3.x uses the empty string for the virtual
                    // "linux-gate.so.1".
                    if ((name != null) && (name == ""))
                    {
                        name = null;
                    }
                } catch {
                    name = null;
                }

                map = map_reader.ReadAddress();

                if (first)
                {
                    first = false;
                    continue;
                }

                if (name == null)
                {
                    continue;
                }

                if (bfd_hash.Contains(name))
                {
                    continue;
                }

                bool step_into = Process.ProcessStart.LoadNativeSymbolTable;
                AddExecutableFile(inferior, name, l_addr, step_into, true);
            }
        }
示例#2
0
        void do_update_shlib_info(Inferior inferior)
        {
//			if (Process.MonoRuntimeFound)
//				return;
            if (!dyld_all_image_infos.IsNull)
            {
                int          size   = 2 * inferior.TargetLongIntegerSize + 2 * inferior.TargetAddressSize;
                TargetReader reader = new TargetReader(inferior.ReadMemory(dyld_all_image_infos, size));

                reader.ReadLongInteger();                  // version
                int           infoArrayCount = (int)reader.ReadLongInteger();
                TargetAddress infoArray      = reader.ReadAddress();

                size   = infoArrayCount * (inferior.TargetLongIntegerSize + 2 * inferior.TargetAddressSize);
                reader = new TargetReader(inferior.ReadMemory(infoArray, size));
                Console.Write("Loading symbols for shared libraries:");
                for (int i = 0; i < infoArrayCount; i++)
                {
                    TargetAddress imageLoadAddress = reader.ReadAddress();
                    TargetAddress imageFilePath    = reader.ReadAddress();
                    reader.ReadLongInteger();                     //imageFileModDate
                    string name = inferior.ReadString(imageFilePath);

                    if (name == null)
                    {
                        continue;
                    }

                    if (bfd_hash.Contains(name))
                    {
                        continue;
                    }

                    try {
                        Console.Write(".");
                        AddExecutableFile(inferior, name, imageLoadAddress /*TargetAddress.Null*/, false, true);
                    }
                    catch (SymbolTableException e)
                    {
                        Console.WriteLine("Unable to load binary for " + name);
                        bfd_hash.Add(name, null);
                    }
                }
                Console.WriteLine("");
            }
        }