Continued ripping up the source.
[aesalon.git] / monitor / src / ProgramManager.h
blobd1bcc8f7028f2828d3aa43d78a4b93e8b7aaa176
1 #ifndef AESALON_MONITOR_PROGRAM_MANAGER_H
2 #define AESALON_MONITOR_PROGRAM_MANAGER_H
4 #include "misc/SmartPointer.h"
5 #include "platform/BidirectionalPipe.h"
6 #include "misc/ArgumentList.h"
7 #include "ptrace/Portal.h"
8 #include "elf/Parser.h"
9 #include "dwarf/Parser.h"
10 #include "asm/Disassembler.h"
11 #include "TaintTracker.h"
13 namespace Aesalon {
14 namespace Monitor {
16 class ProgramManager {
17 private:
18 Misc::SmartPointer<Misc::ArgumentList> argument_list;
20 bool running;
22 Misc::SmartPointer<PTrace::Portal> ptrace_portal;
24 Misc::SmartPointer<ELF::Parser> elf_parser, libc_parser;
25 Misc::SmartPointer<DWARF::Parser> dwarf_parser;
26 Misc::SmartPointer<ASM::Disassembler> disassembler;
28 Misc::SmartPointer<TaintTracker> taint_tracker;
30 std::size_t malloc_breakpoint_id;
31 std::size_t free_breakpoint_id;
32 std::size_t realloc_breakpoint_id;
33 public:
34 ProgramManager(Misc::SmartPointer<Misc::ArgumentList> argument_list);
35 virtual ~ProgramManager() {}
37 void execute();
38 void wait();
40 /* called from a PTrace signal observer when the first SIGTRAP is caught, e.g. the child is loaded into memory */
41 void place_initial_breakpoints();
43 Misc::SmartPointer<PTrace::Portal> get_ptrace_portal() const { return ptrace_portal; }
44 Misc::SmartPointer<ELF::Parser> get_elf_parser() const { return elf_parser; }
45 Misc::SmartPointer<ELF::Parser> get_libc_parser() const { return libc_parser; }
47 Misc::SmartPointer<Misc::ArgumentList> get_argument_list() const { return argument_list; }
49 void set_running(bool new_running) { running = new_running; }
50 bool is_running() const { return running; }
52 std::size_t get_malloc_breakpoint_id() const { return malloc_breakpoint_id; }
53 std::size_t get_free_breakpoint_id() const { return free_breakpoint_id; }
54 std::size_t get_realloc_breakpoint_id() const { return realloc_breakpoint_id; }
56 Misc::SmartPointer<TaintTracker> get_taint_tracker() const { return taint_tracker; }
59 } // namespace Monitor
60 } // namespace Aesalon
62 #endif