public AssemblerLine(string label, TargetAddress address, byte size, string text) { this.Label = label; this.Address = address; this.InstructionSize = size; this.Text = text; }
public TargetMemoryArea(TargetAddress start, TargetAddress end, TargetMemoryFlags flags, string name) { this.start = start; this.end = end; this.flags = flags; this.name = name; }
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; }
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; }
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; }
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; }
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); }
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); }
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; }
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()); }
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); } }
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; } }
public InitializeBreakpoint(MonoThreadManager manager, TargetAddress address) : base("initialize", ThreadGroup.System, address) { this.manager = manager; }
public abstract Symbol SimpleLookup(TargetAddress address, bool exact_match);
public abstract byte ReadByte(TargetAddress address);
public void WriteAddress(TargetAddress address) { if (AddressSize == 8) WriteInt64 (address.Address); else WriteInt32 ((int) address.Address); }
internal AddressBreakpoint(HardwareWatchType type, TargetAddress address) : base(GetEventType (type), address.ToString (), ThreadGroup.Global) { this.address = address; }
public abstract NativeExecutableReader LookupLibrary(TargetAddress address);
public abstract void WriteLongInteger(TargetAddress address, long value);
public abstract void WriteInteger(TargetAddress address, int value);
public abstract void WriteByte(TargetAddress address, byte value);
public abstract void WriteBuffer(TargetAddress address, byte[] buffer);
public abstract byte[] ReadBuffer(TargetAddress address, int size);
public abstract TargetBlob ReadMemory(TargetAddress address, int size);
public abstract string ReadString(TargetAddress address);
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; }
public abstract NativeExecutableReader AddExecutableFile(Inferior inferior, string filename, TargetAddress base_address, bool step_info, bool is_loaded);
public abstract void WriteAddress(TargetAddress address, TargetAddress value);
public abstract TargetAddress ReadAddress(TargetAddress address);
public TargetMemoryException(TargetAddress address) : this(String.Format("Cannot read target memory at address {0:x}", address)) { }
// <summary> // Get the size of the current instruction. // </summary> public abstract int GetInstructionSize(TargetMemoryAccess memory, TargetAddress address);
public TargetMemoryException(TargetAddress address, int size) : this(String.Format("Cannot read {1} bytes from target memory at address {0:x}", address, size)) { }
public abstract int ReadInteger(TargetAddress address);
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")) { }
public Symbol SimpleLookup(TargetAddress address, bool exact_match) { return(SymbolFile.SimpleLookup(address, exact_match)); }
public void SetValue(TargetAddress address, long value) { this.valid = true; this.addr_on_stack = address; this.value = value; }
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); }
public void SetValue(TargetAddress value) { this.valid = true; this.addr_on_stack = TargetAddress.Null; this.value = value.Address; }
public override bool CheckBreakpointHit(Thread target, TargetAddress address) { return true; }
// <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);
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 ())); }
public MdbDissassemblyBuffer(MD.Thread thread, MD.TargetAddress addr) : base(addr.Address) { this.thread = thread; this.baseAddr = addr; }
public AssemblerLine(TargetAddress address, byte size, string text) : this(null, address, size, text) { }
public abstract bool GetTrampoline(TargetMemoryAccess memory, TargetAddress address, out TargetAddress trampoline, out bool is_start);
public Symbol(string name, TargetAddress address, int offset) { this.Name = name; this.Address = address; this.Offset = offset; }
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); } }
public abstract long ReadLongInteger(TargetAddress address);
public SymbolRangeEntry(TargetAddress start, TargetAddress end) { this.start = start; this.end = end; }
protected SymbolTable(TargetAddress start_address, TargetAddress end_address) { this.is_continuous = true; this.start_address = start_address; this.end_address = end_address; }
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); }
internal abstract void InsertBreakpoint(BreakpointHandle breakpoint, TargetAddress address, int domain);
internal AddressBreakpoint(string name, ThreadGroup group, TargetAddress address) : base(EventType.Breakpoint, name, group) { this.address = address; }
public StepFrame(Language language, StepMode mode, TargetAddress until) : this(language, mode, null, TargetAddress.Null, until) { }
public abstract SourceAddress Lookup(TargetAddress address);
public void PokeAddress(TargetAddress address) { PokeAddress (pos, address.Address); }
public override bool CheckBreakpointHit(Thread target, TargetAddress address) { return(target.Process.ProcessStart.StopInMain); }
public int InsertHardwareWatchPoint(Thread target, TargetAddress address) { Event handle = target.Process.Session.InsertHardwareWatchPoint ( target, address, HardwareWatchType.WatchWrite); return handle.Index; }