Example #1
0
 public IDictionary<Address, FunctionType> LoadCallSignatures(
     Program program, 
     ICollection<SerializedCall_v1> userCalls)
 {
     return
         userCalls
         .Where(sc => sc != null && sc.Signature != null)
         .Select(sc =>
         {
         //$BUG: need access to platform.Metadata.
             var sser = program.CreateProcedureSerializer();
             Address addr;
             if (program.Architecture.TryParseAddress(sc.InstructionAddress, out addr))
             {
                 return new KeyValuePair<Address, FunctionType>(
                     addr,
                     sser.Deserialize(sc.Signature, program.Architecture.CreateFrame()));
             }
             else
                 return new KeyValuePair<Address, FunctionType>(null, null);
         })
         .ToDictionary(item => item.Key, item => item.Value);
 }
 public void ApplyChangesToProcedure(Program program, Procedure procedure)
 {
     var ser = program.CreateProcedureSerializer();
     var sp = new SignatureParser(arch);
     sp.Parse(dlg.Signature.Text);
     Debug.Assert(sp.IsValid);
     procedure.Signature = ser.Deserialize(sp.Signature, procedure.Frame);
 }
Example #3
0
        public void ScanImageSymbol(Program program, ImageSymbol sym, bool isEntryPoint)
        {
            try
            {
                Address addr = sym.Address;
                Procedure proc;
                if (program.Procedures.TryGetValue(addr, out proc))
                    return; // Already scanned. Do nothing.
                if (sym.NoDecompile || IsNoDecompiledProcedure(addr))
                    return;

                proc = EnsureProcedure(addr, sym.Name);
                if (sym.Signature != null)
                {
                    var sser = program.CreateProcedureSerializer();
                    proc.Signature = sser.Deserialize(sym.Signature, proc.Frame);
                }
                else if (sym.Name != null)
                {
                    var exp = program.Platform.SignatureFromName(sym.Name);
                    if (exp != null)
                    {
                        proc.Name = exp.Name;
                        proc.Signature = exp.Signature;
                        proc.EnclosingType = exp.EnclosingType;
                    }
                    else
                    {
                        proc.Name = sym.Name;
                    }
                }

                //if (sp.Characteristics != null)
                //{
                //    proc.Characteristics = sp.Characteristics;
                //}

                var pb = ScanProcedure(sym.Address, sym.Name, sym.ProcessorState);
                proc = pb as Procedure;
                if (isEntryPoint && proc != null)
                {
                    program.CallGraph.AddEntryPoint(proc);
                }
            }
            catch (AddressCorrelatedException aex)
            {
                Error(aex.Address, aex.Message);
            }
        }