示例#1
0
        public AssemblerMethod(Method method, AssemblerLine[] lines)
        {
            this.method = method;
            this.lines = lines;
            addresses = new ArrayList ();

            ArrayList contents = new ArrayList ();
            foreach (AssemblerLine line in lines) {
                if (line.Label != null) {
                    if (end_row > 0) {
                        contents.Add ("");
                        end_row++;
                    } else
                        start_row++;
                    contents.Add (String.Format ("{0}:", line.Label));
                    end_row++;
                }

                addresses.Add (new LineEntry (line.Address, 0, ++end_row));
                contents.Add (String.Format ("  {0:x}   {1}", line.Address, line.Text));
            }

            string[] text = new string [contents.Count];
            contents.CopyTo (text);

            buffer = new SourceBuffer (method.Name, text);
        }
示例#2
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());
        }
示例#3
0
 public void PrintInstruction(AssemblerLine line)
 {
     if (line.Label != null)
         Print ("{0}:", line.Label);
     Print ("{0:11x}\t{1}", line.Address, line.Text);
 }
示例#4
0
文件: Style.cs 项目: baulig/debugger
        public override void TargetStopped(Interpreter interpreter, StackFrame frame,
						    AssemblerLine current_insn)
        {
            if (frame == null)
                return;

            if (frame != null && frame.SourceAddress != null)
                Console.WriteLine ("\x1A\x1A{0}:{1}:beg:{2}",
                           frame.SourceAddress.Name, "55" /* XXX */,
                           "0x80594d8" /* XXX */);
        }
示例#5
0
文件: Style.cs 项目: baulig/debugger
        public abstract void UnhandledException(Interpreter interpreter, StackFrame frame,
							 AssemblerLine current_insn);
示例#6
0
文件: Style.cs 项目: baulig/debugger
        public abstract void TargetStopped(Interpreter interpreter, StackFrame frame,
						    AssemblerLine current_insn);
示例#7
0
文件: Style.cs 项目: baulig/debugger
        public override void UnhandledException(Interpreter interpreter, StackFrame frame,
							 AssemblerLine insn)
        {
            TargetStopped (interpreter, frame, insn);
        }
示例#8
0
文件: Style.cs 项目: baulig/debugger
        public override void TargetStopped(Interpreter interpreter, StackFrame frame,
						    AssemblerLine current_insn)
        {
            if (frame != null) {
                if (!PrintSource (interpreter, frame))
                    native = true;

                interpreter.ShowDisplays (frame);
            }
            if (native && (current_insn != null))
                interpreter.PrintInstruction (current_insn);
        }
示例#9
0
        public override AssemblerMethod DisassembleMethod(TargetMemoryAccess memory, Method method)
        {
            lock (this) {
                ArrayList list = new ArrayList ();
                TargetAddress current = method.StartAddress;
                while (current < method.EndAddress) {
                    AssemblerLine line = DisassembleInstruction (
                        memory, method, current);
                    if (line == null)
                        break;

                    current += line.InstructionSize;
                    list.Add (line);
                }

                AssemblerLine[] lines = new AssemblerLine [list.Count];
                list.CopyTo (lines, 0);

                return new AssemblerMethod (method, lines);
            }
        }