ReadLongInteger() 공개 메소드

public ReadLongInteger ( ) : long
리턴 long
        void read_dynamic_info(Inferior inferior)
        {
            if (has_dynlink_info)
            {
                if (!first_link_map.IsNull)
                {
                    do_update_shlib_info(inferior);
                }
                return;
            }

            TargetAddress debug_base = main_bfd.ReadDynamicInfo(inferior);

            if (debug_base.IsNull)
            {
                return;
            }

            int size = 2 * inferior.TargetLongIntegerSize + 3 * inferior.TargetAddressSize;

            TargetReader reader = new TargetReader(inferior.ReadMemory(debug_base, size));

            if (reader.ReadLongInteger() != 1)
            {
                return;
            }

            first_link_map          = reader.ReadAddress();
            dynlink_breakpoint_addr = reader.ReadAddress();

            rdebug_state_addr = debug_base + reader.Offset;

            if (reader.ReadLongInteger() != 0)
            {
                return;
            }

            has_dynlink_info = true;

            Instruction insn = inferior.Architecture.ReadInstruction(inferior, dynlink_breakpoint_addr);

            if ((insn == null) || !insn.CanInterpretInstruction)
            {
                throw new InternalError("Unknown dynlink breakpoint: {0}", dynlink_breakpoint_addr);
            }

            dynlink_breakpoint = new DynlinkBreakpoint(this, insn);
            dynlink_breakpoint.Insert(inferior);

            do_update_shlib_info(inferior);

            check_loaded_library(inferior, main_bfd);
        }
예제 #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("");
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        void read_thread_table()
        {
            TargetAddress ptr = main_thread.ReadAddress(debugger_info.ThreadTable);

            while (!ptr.IsNull)
            {
                int          size   = 56 + main_thread.TargetMemoryInfo.TargetAddressSize;
                TargetReader reader = new TargetReader(main_thread.ReadMemory(ptr, size));

                long          tid      = reader.ReadLongInteger();
                TargetAddress lmf_addr = reader.ReadAddress();
                reader.ReadAddress();                  // end stack

                ptr = reader.ReadAddress();

                TargetAddress stack_start        = reader.ReadAddress();
                TargetAddress signal_stack_start = reader.ReadAddress();
                int           stack_size         = reader.ReadInteger();
                int           signal_stack_size  = reader.ReadInteger();

                bool found = false;
                foreach (CoreFileThread thread in threads)
                {
                    TargetAddress sp = thread.CurrentFrame.StackPointer;

                    if ((sp >= stack_start) && (sp < stack_start + stack_size))
                    {
                        thread.SetLMFAddress(tid, lmf_addr);
                        found = true;
                        break;
                    }
                    else if (!signal_stack_start.IsNull &&
                             (sp >= signal_stack_start) &&
                             (sp < signal_stack_start + signal_stack_size))
                    {
                        thread.SetLMFAddress(tid, lmf_addr);
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    Console.WriteLine("InternalError: did not find the address for the thread");
                }
            }
        }
예제 #5
0
        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);
예제 #6
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("");
            }
        }
예제 #7
0
파일: CoreFile.cs 프로젝트: baulig/debugger
        void read_thread_table()
        {
            TargetAddress ptr = main_thread.ReadAddress (debugger_info.ThreadTable);
            while (!ptr.IsNull) {
                int size = 56 + main_thread.TargetMemoryInfo.TargetAddressSize;
                TargetReader reader = new TargetReader (main_thread.ReadMemory (ptr, size));

                long tid = reader.ReadLongInteger ();
                TargetAddress lmf_addr = reader.ReadAddress ();
                reader.ReadAddress (); // end stack

                ptr = reader.ReadAddress ();

                TargetAddress stack_start = reader.ReadAddress ();
                TargetAddress signal_stack_start = reader.ReadAddress ();
                int stack_size = reader.ReadInteger ();
                int signal_stack_size = reader.ReadInteger ();

                bool found = false;
                foreach (CoreFileThread thread in threads) {
                    TargetAddress sp = thread.CurrentFrame.StackPointer;

                    if ((sp >= stack_start) && (sp < stack_start + stack_size)) {
                        thread.SetLMFAddress (tid, lmf_addr);
                        found = true;
                        break;
                    } else if (!signal_stack_start.IsNull &&
                           (sp >= signal_stack_start) &&
                           (sp < signal_stack_start + signal_stack_size)) {
                        thread.SetLMFAddress (tid, lmf_addr);
                        found = true;
                        break;
                    }
                }

                if (!found)
                    Console.WriteLine ("InternalError: did not find the address for the thread");
            }
        }
예제 #8
0
        void read_dynamic_info(Inferior inferior)
        {
            if (has_dynlink_info) {
                if (!first_link_map.IsNull)
                    do_update_shlib_info (inferior);
                return;
            }

            TargetAddress debug_base = main_bfd.ReadDynamicInfo (inferior);
            if (debug_base.IsNull)
                return;

            int size = 2 * inferior.TargetLongIntegerSize + 3 * inferior.TargetAddressSize;

            TargetReader reader = new TargetReader (inferior.ReadMemory (debug_base, size));
            if (reader.ReadLongInteger () != 1)
                return;

            first_link_map = reader.ReadAddress ();
            dynlink_breakpoint_addr = reader.ReadAddress ();

            rdebug_state_addr = debug_base + reader.Offset;

            if (reader.ReadLongInteger () != 0)
                return;

            has_dynlink_info = true;

            Instruction insn = inferior.Architecture.ReadInstruction (inferior, dynlink_breakpoint_addr);
            if ((insn == null) || !insn.CanInterpretInstruction)
                throw new InternalError ("Unknown dynlink breakpoint: {0}", dynlink_breakpoint_addr);

            dynlink_breakpoint = new DynlinkBreakpoint (this, insn);
            dynlink_breakpoint.Insert (inferior);

            do_update_shlib_info (inferior);

            check_loaded_library (inferior, main_bfd);
        }