Commit Graph

22 Commits

Author SHA1 Message Date
Alessandro Di Federico 329fcb3707 Introduce tracing support 2016-08-20 03:10:45 +02:00
Alessandro Di Federico 0d035a93e1 Introduce clang support: fixes and cleanup 2016-08-20 03:10:45 +02:00
Alessandro Di Federico fbca5bba2e Import OSRA and update SET
* Import OSRA
* Improve the SET (aka `JumpTargetFromConstants`) by introducing the
  `OperationsStack` class.
* Review `harvest` logic
* Allow to disable OSRA (along with the sumjump heuristic)
* Take the core of `getNextPC` out of it and move it to `getPC`, a
  function returning both the current and the next PC. Also, fix a bug
  when reaching the beginning of a basic block.
* Detect "reliable" jump targets: a "reliable" jump target is a jump
  target obtained from a store to a PC but it's not a fallthrough jump.
2016-08-20 03:10:39 +02:00
Alessandro Di Federico c94fad95e4 Produce coverage CSV
Implement producing a CSV file containing information about the which
PCs have been translated. For each PC it is specified whether its a jump
target or not.
2016-04-14 16:10:13 +02:00
Alessandro Di Federico 0d58bc3cf7 Introduce logging framework 2016-01-12 22:43:04 +01:00
Alessandro Di Federico d510fea8c7 Simplify command line usage exploiting ELF info
* s/`importGlobalData`/`parseELF`/
* Save the entry point specified in the ELF header, which will be used
  if the user doesn't provide an address.
* Let parse `parseELF` take care of informing libtinycode about what
  has to be mmap'd and where.
* Remove some support scripts used during testing, now no longer
  necessary.
* Various cleanups
2016-01-09 13:37:03 +01:00
Alessandro Di Federico ac316cd758 Add support for ELF and import its global data
* Use `llvm::object` framework to obtain useful information from the ELF
  binary such as pointer size and endianess.
* Introduce `CodeGenerator::importGlobalData`: import global (read-only
  and writeable data) from the input binary directly into the generated
  module.
* Introduce the `--linking-info` parameter: path to a CSV file where
  sections containing global data extracted from the input binary are
  listed with their name, start and end address.
* Expand the `Architecture` class with constructors and support accessor
  methods.
2016-01-07 14:16:05 +01:00
Alessandro Di Federico 0f2ddd80a0 Remove -o parameter: use the second argument 2016-01-05 15:35:44 +01:00
Alessandro Di Federico 5d130b7072 Split ptctollvmir.cpp into multiple files 2015-11-24 15:21:17 +01:00
Alessandro Di Federico 94864e49b5 Introduce support for virtual addresses
* mmap on the PTC side before doing any translation
* Update usages of virtual addresses
* Refactor options to have --load-at and --entry
* Update tests according to the changes
2015-11-10 00:05:21 +01:00
Alessandro Di Federico ba950d26f2 Split CodeGenerator::translate and use CPUState from the QEMU helpers
* Implement an handler for PTC_INSTRUCTION_op_debug_insn_start
* Implement an handler for calls to helpers
* Implement an handler for all the remaining instructions
* Discover automatically path of the helpers module
* Import the IRReader module
* Remove support for predefined global variables
* Implement getByCPUStateOffset which returns or creates a global
  variable from an offset in the CPUState structure
* Remove the VariableManager::createGlobal function
* Implement getTypeAtOffset which searches for the data type at the
  specified offset, recursively exploring sub-structs
* Autodetect the CPUState structure by election on the struct parameters
  of the helper functions
* CodeGenerator::translate returns void
* Multiplication should sign-extend, not zero-extend
* Fix wrong update of alloca insertion point
* Implement PTC_INSTRUCTION_op_mul{u,s}2_i{32,64} instructions
2015-11-07 15:02:11 +01:00
Alessandro Di Federico 711b798be6 Refactoring
* Fix whitespaces
* Fix case of method names
2015-11-07 15:02:11 +01:00
Alessandro Di Federico ee850e39bc Introduce C++ wrapper of the PTC library
* s/PTC/PTCInterface/
* Implement InstructionArgumentsIterator
* Implement Instrcution and CallInstruction
2015-11-07 15:02:11 +01:00
Alessandro Di Federico bd898de98f Fix propagation of OutputPath and DebugPath 2015-11-07 15:01:34 +01:00
Alessandro Di Federico 9007943839 Refactor the Translate function
* Create the CodeGenerator class from most of the logic that was in the
  Translate function.
* Extract debug information handling logic from the Translate function and move
  it into the DebugManager class.
* Add include guards.
* Remove some dead code and add and fix documentation.
2015-10-27 17:19:52 +01:00
Alessandro Di Federico 15cfbee422 Make reference to QEMU install path and dlopen an absolute path 2015-10-27 11:56:08 +01:00
Alessandro Di Federico 2b5823c6bc Dump useful information in case an unsupported helper is called 2015-10-27 08:54:05 +01:00
Alessandro Di Federico a4fdf0f1b5 Improve debug info handling
* Add support to specify a path for debug source
* Annotate generated LLVM with original assembly and PTC
* As debug source, use the same .ll as the compiled one
2015-10-27 08:54:05 +01:00
Alessandro Di Federico 089bfd2461 Introduce support for LLVM IR debugging information 2015-10-27 08:54:05 +01:00
Alessandro Di Federico 3b0588b75d Add support for PTC debug info 2015-10-27 08:54:04 +01:00
Alessandro Di Federico 8f88625e94 Add metadata with original and PTC instructions to each new instruction
* Convert ptcdump.cpp to use streams and export more fine-grained functions
* Add documentation to ptcdump.h
* Create metadata for the original instruction when a
  PTC_INSTRUCTION_op_debug_insn_start instruction is met.
2015-10-17 22:44:42 +02:00
Alessandro Di Federico 5ee7b1dd8a Initial import 2015-09-26 15:17:32 +02:00