/// <summary> /// Starts a scan at address <paramref name="paddr"/> on the user's request. /// </summary> /// <param name="paddr"></param> /// <returns>a ProcedureBase, because the target procedure may have been a thunk or /// an linked procedure the user has decreed not decompileable.</returns> public ProcedureBase ScanProcedure(ProgramAddress paddr, IProcessorArchitecture arch) { var program = paddr.Program; if (scanner == null) //$TODO: it's unfortunate that we depend on the scanner of the Decompiler class. { scanner = CreateScanner(program); } var procName = program.User.Procedures.TryGetValue( paddr.Address, out var sProc) ? sProc.Name : null; return(scanner.ScanProcedure( arch, paddr.Address, procName, program.Architecture.CreateProcessorState())); }
private void ScanProgram(Program program) { if (!program.NeedsScanning) { return; } try { eventListener.ShowStatus("Rewriting reachable machine code."); scanner = CreateScanner(program); scanner.ScanImage(); eventListener.ShowStatus("Finished rewriting reachable machine code."); } finally { eventListener.ShowStatus("Writing .asm and .dis files."); host.WriteDisassembly(program, (n, items, w) => DumpAssembler(program, n, items, w)); host.WriteIntermediateCode(program, (n, procs, w) => EmitProgram(program, procs, null, n, w)); // Use the following for debugging. // WriteSccs(program); } }