示例#1
0
        private string Dump()
        {
            StringWriter w = new StringWriter();

            DataFlow.EmitRegisters(arch, "", 0, vl.Identifiers, w);
            return(w.ToString());
        }
示例#2
0
 private TextWriter DumpProcedureSummaries(TextWriter writer)
 {
     foreach (Procedure proc in prog.Procedures.Values)
     {
         DataFlow.EmitRegisters(prog.Architecture, proc.Name, flow[proc].grfTrashed, flow[proc].TrashedRegisters, writer);
         writer.WriteLine();
         if (flow[proc].ConstantRegisters.Count > 0)
         {
             DataFlow.EmitRegisterValues("const", flow[proc].ConstantRegisters, writer);
             writer.WriteLine();
         }
         foreach (var block in proc.ControlGraph.Blocks.OrderBy(b => b, new Procedure.BlockComparer()))
         {
             DataFlow.EmitRegisterValues("    " + block.Name, flow[block].SymbolicIn.RegisterState, writer);
             writer.WriteLine();
         }
         writer.WriteLine();
     }
     return(writer);
 }
示例#3
0
        protected void DumpProcedureFlows(Program program, DataFlowAnalysis dfa, RegisterLiveness live, TextWriter w)
        {
            foreach (Procedure proc in program.Procedures.Values)
            {
                w.WriteLine("// {0} /////////////////////", proc.Name);
                ProcedureFlow flow = dfa.ProgramDataFlow[proc];
                DataFlow.EmitRegisters(program.Architecture, "\tLiveOut:  ", flow.grfLiveOut, flow.LiveOut, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tMayUseIn: ", flow.grfMayUse, flow.MayUse, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tBypassIn: ", flow.grfMayUse, flow.ByPass, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tTrashed:  ", flow.grfTrashed, flow.TrashedRegisters, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tPreserved:", flow.grfPreserved, flow.PreservedRegisters, w);
                w.WriteLine();

                w.WriteLine("// {0}", proc.Name);
                proc.Signature.Emit(proc.Name, FunctionType.EmitFlags.None, new TextFormatter(w));
                w.WriteLine();
                foreach (Block block in proc.SortBlocksByName())
                {
                    if (live != null)
                    {
                        var bFlow = dfa.ProgramDataFlow[block];
                        bFlow.WriteBefore(program.Architecture, w);
                        block.Write(w);
                        bFlow.WriteAfter(program.Architecture, w);
                        w.WriteLine();
                    }
                    else
                    {
                        block.Write(w);
                    }
                }
            }
        }
示例#4
0
        protected void DumpProcedureFlows(Program program, DataFlowAnalysis dfa, TextWriter w)
        {
            foreach (Procedure proc in program.Procedures.Values)
            {
                w.WriteLine("// {0} /////////////////////", proc.Name);
                ProcedureFlow flow = dfa.ProgramDataFlow[proc];
                DataFlow.EmitRegisters(program.Architecture, "\tLiveOut:  ", flow.grfLiveOut, flow.BitsLiveOut, w);
                w.WriteLine();
                DataFlow.EmitRegisterValues("\tBitsUsed: ", flow.BitsUsed, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tTrashed:  ", flow.grfTrashed, flow.Trashed, w);
                w.WriteLine();
                DataFlow.EmitRegisters(program.Architecture, "\tPreserved:", flow.grfPreserved, flow.Preserved, w);
                w.WriteLine();

                w.WriteLine("// {0}", proc.Name);
                proc.Signature.Emit(proc.Name, FunctionType.EmitFlags.None, new TextFormatter(w));
                w.WriteLine();
                foreach (Block block in proc.SortBlocksByName())
                {
                    block.Write(w);
                }
            }
        }