Commit Graph

6664 Commits

Author SHA1 Message Date
Alessandro Di Federico dcc795c424 Drop Logger's StaticEnabled feature 2025-10-31 14:49:05 +01:00
Alessandro Di Federico aa796af917 VariableManager: move fields declarations to top 2025-10-31 14:49:05 +01:00
Alessandro Di Federico 1cafd2288d RawBinaryView: outline to .cpp 2025-10-31 14:49:05 +01:00
Alessandro Di Federico b1feb5b989 Introduce libtcg
This commit drops libptc in favor of its new form libtcg.

It brings several improvements, among which:

* The QEMU version we work on has been upgraded.
* CPUStateAccessAnalysis has been reimplemented in a way that makes it
  easier to debug and solves some limitations (e.g., tracking leaking
  pointers).
* Identification of pieces of the CPU state that are read by each helper
  and fixing access to the CPU state is now performed at build-time.
* We no longer mmap the code we need to translate, dropping all the
  issues related to code that needed to be mapped where something is
  already present.
* We now have two distinct flavors of helper modules: the full one and
  the "slim" one. The latter contains the definition only of functions
  we intend to inline. It is used in most of the pipeline, a good thing
  since we spend less time optimizing code we don't really care about.
  The full module is only used on the re-compilation branch of the
  pipeline.
* We no longer split the `cpu_loop` function.
* We change MetaAddress to rely on architectures from `model::` as
  opposed to the LLVM ones.
* We no longer attach debug info to LLVM IR containing the original
  assembly.
* We now verify that the lifted code only contains code we expect.
2025-10-31 14:49:05 +01:00
Alessandro Di Federico 8f21f3b5e1 check-conventions for older commits 2025-10-31 13:23:45 +01:00
Pietro Fezzardi 5ed8dc7877 tmp-fix-dla 2025-10-31 12:22:28 +01:00
Lauri Vasama a77fdd3f99 Add new RecursiveCoroutine unit test 2025-10-31 09:30:54 +01:00
Lauri Vasama 7311f3d665 Remove RecursiveCoroutine operator*
* Add rc_eval to force evaluation.
2025-10-31 09:30:54 +01:00
Lauri Vasama febf08188e RecursiveCoroutine improvements 2025-10-31 09:30:54 +01:00
Lauri Vasama 4689e4c4ec Add UniqueCoroutineHandle 2025-10-31 09:30:54 +01:00
Ivan Krysak 5b419540cc Disable IRBuilder checks in some additional places 2025-10-31 09:04:59 +01:00
Alessandro Di Federico c63380cf8c Merge branch 'feature/prepare-libtcg-3' 2025-10-29 15:24:50 +01:00
Alessandro Di Federico 0d5e05688d collectTuple: add non-recursive implementation 2025-10-29 15:10:18 +01:00
Alessandro Di Federico dfbe005307 ReadFields: switch to vectors 2025-10-29 15:10:18 +01:00
Alessandro Di Federico c5d8911b8d Disasm: do not merge non-existing successor block 2025-10-29 15:10:18 +01:00
Alessandro Di Federico 5a0a01794d PrettyIntFormattingPass: improve ImmArg handling 2025-10-29 15:10:18 +01:00
Alessandro Di Federico ecc88b156d IsolateFunctions: Unexpected is no direct branch 2025-10-29 15:10:18 +01:00
Alessandro Di Federico dad1634065 RemoveHelperCalls: drop copy of OpaqueRegisterUser 2025-10-29 15:10:18 +01:00
Alessandro Di Federico 46a0af46c8 TupleTree visits: improve handling of upcast 2025-10-29 15:10:18 +01:00
Alessandro Di Federico 724703910c QuickMetadata: add support for bool 2025-10-29 10:57:41 +01:00
Alessandro Di Federico 246e0d9b59 Logger: handle nameless loggers 2025-10-29 10:57:19 +01:00
Alessandro Di Federico 97e75d0019 MetaAddress: improve verify 2025-10-29 10:56:59 +01:00
Alessandro Di Federico e81dbfd898 Minor changes 2025-10-29 10:56:50 +01:00
Alessandro Di Federico 5807520df0 Merge branch 'feature/prepare-libtcg-2' 2025-10-28 16:29:41 +01:00
Alessandro Di Federico fd216ef374 daemon: improve logging 2025-10-28 11:43:22 +01:00
Alessandro Di Federico c9e7ba7943 TupleTree visits: bypass access tracking
Use non-`const` version to bypass tracking.
2025-10-28 09:18:27 +01:00
Alessandro Di Federico db8eb227b9 TupleTreePath: rewrite with TraitfulAny 2025-10-28 09:18:27 +01:00
Alessandro Di Federico 90f21a10a8 check-conventions: enable excluding specific files 2025-10-28 09:18:24 +01:00
Alessandro Di Federico ee0060bb16 LLVMContainer: fix metadata handling
The way we were saving metadata during cloneFiltered was incorrect and
led to subtle corruptions due to reattaching metadata coming from one
module to the other.

We now collect all the metadata we want to preserve in a named metadata
(a "global" metadata), so that it will get properly copied.
2025-10-24 18:33:41 +02:00
Alessandro Di Federico faa53cdfc1 InitModelTypes: fix memory corruption 2025-10-24 18:27:15 +02:00
Alessandro Di Federico f2f79dcee0 FunctionCallIdentification: relax assertion 2025-10-24 18:25:59 +02:00
Alessandro Di Federico 118e916b6a HoistStructPhis: various improvements 2025-10-24 18:25:14 +02:00
Alessandro Di Federico 97415b5ffe TupleTree visits: fix handling of upcast
We now suspend tracking before calling `.upcast`.
2025-10-24 18:24:25 +02:00
Alessandro Di Federico 0d066767f2 mips: fix f register size 2025-10-24 18:24:03 +02:00
Alessandro Di Federico 8cef543257 MFP: improve logging 2025-10-24 18:23:44 +02:00
Alessandro Di Federico 1e55635b65 Introduce efa::FunctionEdgeType::Unexpected 2025-10-24 18:23:23 +02:00
Alessandro Di Federico 5b4439f93c DisassemblyHelper: relax rules on delay slots 2025-10-24 18:22:01 +02:00
Alessandro Di Federico 81f063d30c Old backend: suppress -Wshift-count-overflow 2025-10-24 18:21:13 +02:00
Alessandro Di Federico fb80f4b8bd FunctionCallIdentification: handle delay slot 2025-10-24 18:21:07 +02:00
Alessandro Di Federico ed3fc26166 MaterializedValue: handle loading mutable data 2025-10-24 18:20:54 +02:00
Alessandro Di Federico 4fb6b5f4e1 Minor changes 2025-10-24 18:20:48 +02:00
Alessandro Di Federico bd02e95390 Merge branch 'feature/prepare-libtcg' 2025-10-24 15:34:47 +02:00
Pietro Fezzardi e32e224572 Treat llvm.fshl and llvm.fshr as statements
This forces all such instructions to get their value stored into a local
variable in SwitchToStatements.
The reason for doing this is that they often contribute to the formation
of pathological dataflows, causing exponential path explosion when
expanded into C expressions during decompilation.
Serializing their value into a dedicated local variable breaks such an
exponential path explosion.

This is a temporary workaround, that we've already put in place for
SelectInst too, and that will be replaced in the future by a more
principled approach for splitting pathological dataflows that lead to
exponential path esplosion.
2025-10-24 15:34:12 +02:00
Lauri Vasama 9305d3e472 Add Clifter support for pointer comparisons 2025-10-24 15:34:12 +02:00
Alessandro Di Federico f8bd4c3bac Move around some files in preparation for libtcg
* Make the following private headers public:
  * Lift/CPUStateAccessAnalysisPass.h
  * Lift/CSVOffsets.h
  * Lift/PTCDump.h
  * Lift/VariableManager.h
* Move from revngSupport to revngLift:
  * IRAnnotators.{h,cpp}
  * SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
  * FunctionTags.{h,cpp}
  * ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
  * OriginalAssemblyAnnotationWriter.{h,cpp}
2025-10-24 15:34:11 +02:00
Alessandro Di Federico c813654739 Merge branch 'feature/revng-ir-builder' 2025-10-24 15:26:49 +02:00
Ivan Krysak 2ba5ca3e3d Suppress selected IRBuilder checks 2025-10-21 19:17:37 +03:00
Ivan Krysak 0392f94406 LocalVariableBuilder: improve debug info handling 2025-10-21 19:17:11 +03:00
Ivan Krysak 8bbbe10396 Ban unwrapped IRBuilder 2025-10-21 19:17:08 +03:00
Ivan Krysak 3561c2b907 Adopt IRBuilder wrapper 2025-10-21 19:17:01 +03:00