Example #1
0
 public AssemblerLine(string label, TargetAddress address, byte size, string text)
 {
     this.Label = label;
     this.Address = address;
     this.InstructionSize = size;
     this.Text = text;
 }
Example #2
0
        public TargetMemoryArea(TargetAddress start, TargetAddress end,
					 TargetMemoryFlags flags, string name)
        {
            this.start = start;
            this.end = end;
            this.flags = flags;
            this.name = name;
        }
Example #3
0
        public StepFrame(Language language, StepMode mode, StackFrame stack,
				  TargetAddress start, TargetAddress end)
        {
            this.start = start;
            this.end = end;
            this.stack = stack;
            this.language = language;
            this.mode = mode;
        }
Example #4
0
        public LineEntry(TargetAddress address, int file, int line, bool is_hidden,
				  SourceRange? source_range)
        {
            this.Address = address;;
            this.File = file;
            this.Line = line;
            this.IsHidden = is_hidden;
            this.SourceRange = source_range;
        }
Example #5
0
        public Register(Registers registers, string name, int index, int size,
				 bool valid, long value)
        {
            this.registers = registers;
            this.Name = name;
            this.Index = index;
            this.Size = size;
            this.valid = valid;
            this.value = value;
            this.addr_on_stack = TargetAddress.Null;
        }
Example #6
0
        public override bool GetTrampoline(TargetMemoryAccess memory, TargetAddress address,
						    out TargetAddress trampoline, out bool is_start)
        {
            foreach (Bfd bfd in bfd_hash.Values) {
                if (bfd.GetTrampoline (memory, address, out trampoline, out is_start))
                    return true;
            }

            is_start = false;
            trampoline = TargetAddress.Null;
            return false;
        }
Example #7
0
        public MethodAddress(TargetBinaryReader reader,
				      AddressDomain domain, Architecture arch)
        {
            // here we read the MonoDebugMethodAddress structure
            // as written out in mono_debug_add_method.
            reader.Position = 16;
            ReadAddress (reader, domain); // wrapper_data
            MonoMethod = ReadAddress (reader, domain);
            ReadAddress (reader, domain); // address_list
            StartAddress = ReadAddress (reader, domain);
            WrapperAddress = ReadAddress (reader, domain);
            int code_size = reader.ReadInt32 ();

            EndAddress = StartAddress + code_size;

            int prologue_end = reader.ReadLeb128 ();
            int epilogue_begin = reader.ReadLeb128 ();

            MethodStartAddress = prologue_end > 0 ?
                StartAddress + prologue_end : StartAddress;
            MethodEndAddress = epilogue_begin > 0 ?
                StartAddress + epilogue_begin : EndAddress;

            int num_line_numbers = reader.ReadLeb128 ();
            LineNumbers = new List<JitLineNumberEntry> ();

            for (int i = 0; i < num_line_numbers; i++) {
                int il_offset = reader.ReadSLeb128 ();
                int native_offset = reader.ReadSLeb128 ();

                if (il_offset < 0)
                    continue;

                LineNumbers.Add (new JitLineNumberEntry (il_offset, native_offset));
            }

            HasThis = reader.ReadByte () != 0;
            if (HasThis)
                ThisVariableInfo = new VariableInfo (arch, reader);

            int num_params = reader.ReadLeb128 ();
            ParamVariableInfo = new VariableInfo [num_params];
            for (int i = 0; i < num_params; i++)
                ParamVariableInfo [i] = new VariableInfo (arch, reader);

            int num_locals = reader.ReadLeb128 ();
            LocalVariableInfo = new VariableInfo [num_locals];
            for (int i = 0; i < num_locals; i++)
                LocalVariableInfo [i] = new VariableInfo (arch, reader);
        }
Example #8
0
        internal bool CheckException(MonoLanguageBackend mono, TargetMemoryAccess target,
					      TargetAddress address)
        {
            TargetClassObject exc = mono.CreateObject (target, address) as TargetClassObject;
            if (exc == null)
                return false; // OOOPS

            if (exception == null)
                exception = mono.LookupType (Name);
            if (exception == null)
                return false;

            return IsSubclassOf (target, exc.Type, exception);
        }
Example #9
0
        public override NativeExecutableReader AddExecutableFile(Inferior inferior, string filename,
									  TargetAddress base_address, bool step_into,
									  bool is_loaded)
        {
            check_disposed ();
            Bfd bfd = (Bfd) bfd_hash [filename];
            if (bfd != null)
                return bfd;

            bfd = new Bfd (this, inferior.TargetMemoryInfo, filename, base_address, is_loaded);
            bfd_hash.Add (filename, bfd);
            check_loaded_library (inferior, bfd);
            return bfd;
        }
Example #10
0
        public override AssemblyLine[] GetLines(long startAddr, long endAddr)
        {
            List <AssemblyLine> lines = new List <AssemblyLine> ();

            MD.TargetAddress addr = baseAddr + (startAddr - baseAddr.Address);
            while (addr.Address <= endAddr)
            {
                try {
                    MD.AssemblerLine line = thread.DisassembleInstruction(null, addr);
                    lines.Add(new AssemblyLine(addr.Address, line.Text));
                    addr += line.InstructionSize;
                } catch {
                    Console.WriteLine("failed " + addr.Address);
                    lines.Add(new AssemblyLine(addr.Address, "??"));
                    addr++;
                }
            }
            return(lines.ToArray());
        }
Example #11
0
        public override AssemblerLine DisassembleInstruction(TargetMemoryAccess memory,
								      Method method,
								      TargetAddress address)
        {
            lock (this) {
                memory_exception = null;
                sb = new StringBuilder ();

                address = new TargetAddress (memory.AddressDomain, address.Address);

                string insn;
                int insn_size;
                try {
                    this.memory = memory;
                    current_method = method;
                    insn_size = bfd_glue_disassemble_insn (handle, address.Address);
                    if (memory_exception != null)
                        return null;
                    insn = sb.ToString ();
                } finally {
                    sb = null;
                    this.memory = null;
                    memory_exception = null;
                    current_method = null;
                }

                Symbol label = null;
                if (process != null)
                    label = process.SymbolTableManager.SimpleLookup (address, true);

                string label_name = null;
                if (label != null)
                    label_name = label.ToString ();

                return new AssemblerLine (
                    label_name, address, (byte) insn_size, insn);
            }
        }
Example #12
0
        public override int GetInstructionSize(TargetMemoryAccess memory, TargetAddress address)
        {
            memory_exception = null;

            try {
                this.memory = memory;
                int count = bfd_glue_disassemble_insn (handle, address.Address);
                if (memory_exception != null)
                    throw memory_exception;
                return count;
            } finally {
                this.memory = null;
                memory_exception = null;
            }
        }
Example #13
0
 public InitializeBreakpoint(MonoThreadManager manager, TargetAddress address)
     : base("initialize", ThreadGroup.System, address)
 {
     this.manager = manager;
 }
Example #14
0
 public abstract Symbol SimpleLookup(TargetAddress address, bool exact_match);
Example #15
0
 public abstract byte ReadByte(TargetAddress address);
Example #16
0
 public void WriteAddress(TargetAddress address)
 {
     if (AddressSize == 8)
         WriteInt64 (address.Address);
     else
         WriteInt32 ((int) address.Address);
 }
Example #17
0
 internal AddressBreakpoint(HardwareWatchType type, TargetAddress address)
     : base(GetEventType (type), address.ToString (), ThreadGroup.Global)
 {
     this.address = address;
 }
Example #18
0
 public abstract NativeExecutableReader LookupLibrary(TargetAddress address);
Example #19
0
 public abstract void WriteLongInteger(TargetAddress address, long value);
Example #20
0
 public abstract void WriteInteger(TargetAddress address, int value);
Example #21
0
 public abstract void WriteByte(TargetAddress address, byte value);
Example #22
0
 public abstract void WriteBuffer(TargetAddress address, byte[] buffer);
Example #23
0
 public abstract byte[] ReadBuffer(TargetAddress address, int size);
Example #24
0
 public abstract TargetBlob ReadMemory(TargetAddress address, int size);
Example #25
0
 public abstract string ReadString(TargetAddress address);
Example #26
0
 int read_memory_func(long address, IntPtr data, int size)
 {
     try {
         TargetAddress location = new TargetAddress (
             memory.AddressDomain, address);
         byte[] buffer = memory.ReadBuffer (location, size);
         Marshal.Copy (buffer, 0, data, size);
     } catch (Exception e) {
         memory_exception = e;
         return 1;
     }
     return 0;
 }
Example #27
0
        public abstract NativeExecutableReader AddExecutableFile(Inferior inferior, string filename,
									  TargetAddress base_address,
									  bool step_info, bool is_loaded);
Example #28
0
 public abstract void WriteAddress(TargetAddress address, TargetAddress value);
Example #29
0
 public abstract TargetAddress ReadAddress(TargetAddress address);
Example #30
0
 public TargetMemoryException(TargetAddress address)
     : this(String.Format("Cannot read target memory at address {0:x}", address))
 {
 }
Example #31
0
        // <summary>
        //   Get the size of the current instruction.
        // </summary>
        public abstract int GetInstructionSize(TargetMemoryAccess memory,
							TargetAddress address);
Example #32
0
 public TargetMemoryException(TargetAddress address, int size)
     : this(String.Format("Cannot read {1} bytes from target memory at address {0:x}",
                          address, size))
 {
 }
Example #33
0
 public abstract int ReadInteger(TargetAddress address);
Example #34
0
 public TargetMemoryReadOnlyException(TargetAddress address)
     : base(String.Format("Can't write to target memory at address 0x{0:x}: {1}",
                          address, "the current target's memory is read-only"))
 {
 }
Example #35
0
 public Symbol SimpleLookup(TargetAddress address, bool exact_match)
 {
     return(SymbolFile.SimpleLookup(address, exact_match));
 }
Example #36
0
 public void SetValue(TargetAddress address, long value)
 {
     this.valid         = true;
     this.addr_on_stack = address;
     this.value         = value;
 }
Example #37
0
 internal void InitCodeBuffer(Inferior inferior, TargetAddress code_buffer)
 {
     HasCodeBuffer = true;
     mono_debugger_server_initialize_code_buffer (
         mono_runtime_info, code_buffer.Address,
         debugger_info.ExecutableCodeBufferSize);
 }
Example #38
0
 public void SetValue(TargetAddress value)
 {
     this.valid         = true;
     this.addr_on_stack = TargetAddress.Null;
     this.value         = value.Address;
 }
Example #39
0
 public override bool CheckBreakpointHit(Thread target, TargetAddress address)
 {
     return true;
 }
Example #40
0
 // <summary>
 //   Disassemble one instruction.
 //   If @imethod is non-null, it specifies the current method which will
 //   be used to lookup function names from trampoline calls.
 // </summary>
 public abstract AssemblerLine DisassembleInstruction(TargetMemoryAccess memory,
                                                      Method method,
                                                      TargetAddress address);
Example #41
0
        void print_address_func(long address)
        {
            TargetAddress maddress = new TargetAddress (
                memory.AddressDomain, address);

            if (current_method != null) {
                try {
                    MethodSource method = current_method.GetTrampoline (
                        memory, maddress);

                    if (method != null) {
                        output_func (method.Name);
                        return;
                    }
                } catch (TargetException) {
                }
            }

            Symbol name = null;
            if (process != null)
                name = process.SymbolTableManager.SimpleLookup (maddress, false);

            if (name == null)
                output_func (address);
            else
                output_func (String.Format ("0x{0:x}:{1}", address, name.ToString ()));
        }
Example #42
0
 public MdbDissassemblyBuffer(MD.Thread thread, MD.TargetAddress addr) : base(addr.Address)
 {
     this.thread   = thread;
     this.baseAddr = addr;
 }
Example #43
0
 public AssemblerLine(TargetAddress address, byte size, string text)
     : this(null, address, size, text)
 {
 }
Example #44
0
 public AssemblerLine(TargetAddress address, byte size, string text)
     : this(null, address, size, text)
 {
 }
Example #45
0
        public abstract bool GetTrampoline(TargetMemoryAccess memory, TargetAddress address,
						    out TargetAddress trampoline, out bool is_start);
Example #46
0
 public Symbol(string name, TargetAddress address, int offset)
 {
     this.Name = name;
     this.Address = address;
     this.Offset = offset;
 }
Example #47
0
        protected override TargetObject DoEvaluateObject(ScriptingContext context)
        {
            StackFrame frame = context.CurrentFrame;
            Register register = frame.Registers [name];
            if (register == null)
                throw new ScriptingException ("No such register `{0}'.", name);

            try {
                long value = register.Value;
                TargetAddress address = new TargetAddress (
                    context.AddressDomain, value);
                return context.CurrentLanguage.CreatePointer (frame, address);
            } catch {
                throw new ScriptingException (
                    "Can't access register `{0}' selected stack frame.", name);
            }
        }
Example #48
0
 public abstract long ReadLongInteger(TargetAddress address);
Example #49
0
 public SymbolRangeEntry(TargetAddress start, TargetAddress end)
 {
     this.start = start;
     this.end   = end;
 }
Example #50
0
 protected SymbolTable(TargetAddress start_address, TargetAddress end_address)
 {
     this.is_continuous = true;
     this.start_address = start_address;
     this.end_address   = end_address;
 }
Example #51
0
        internal void InitializeMono(Inferior inferior, TargetAddress mdb_debug_info)
        {
            MonoRuntimeFound = true;
            mono_manager = MonoThreadManager.Initialize (this, inferior, mdb_debug_info, is_attached);

            InitializeThreads (inferior, !is_attached);

            if (mono_manager == null)
                return;

            mono_manager.InitializeThreads (inferior);

            if (is_attached)
                mono_manager.InitializeAfterAttach (inferior);
        }
Example #52
0
 internal abstract void InsertBreakpoint(BreakpointHandle breakpoint,
                                         TargetAddress address, int domain);
Example #53
0
 internal AddressBreakpoint(string name, ThreadGroup group, TargetAddress address)
     : base(EventType.Breakpoint, name, group)
 {
     this.address = address;
 }
Example #54
0
 public StepFrame(Language language, StepMode mode, TargetAddress until)
     : this(language, mode, null, TargetAddress.Null, until)
 {
 }
Example #55
0
        // <summary>
        //   Disassemble one instruction.
        //   If @imethod is non-null, it specifies the current method which will
        //   be used to lookup function names from trampoline calls.
        // </summary>
        public abstract AssemblerLine DisassembleInstruction(TargetMemoryAccess memory,
								      Method method,
								      TargetAddress address);
Example #56
0
 public abstract SourceAddress Lookup(TargetAddress address);
Example #57
0
 public void PokeAddress(TargetAddress address)
 {
     PokeAddress (pos, address.Address);
 }
 public override bool CheckBreakpointHit(Thread target, TargetAddress address)
 {
     return(target.Process.ProcessStart.StopInMain);
 }
Example #59
0
 public int InsertHardwareWatchPoint(Thread target, TargetAddress address)
 {
     Event handle = target.Process.Session.InsertHardwareWatchPoint (
         target, address, HardwareWatchType.WatchWrite);
     return handle.Index;
 }
Example #60
0
 // <summary>
 //   Get the size of the current instruction.
 // </summary>
 public abstract int GetInstructionSize(TargetMemoryAccess memory,
                                        TargetAddress address);