ROSE  0.11.87.0
ModulesLinux.h
1 #ifndef ROSE_BinaryAnalysis_Partitioner2_ModulesLinux_H
2 #define ROSE_BinaryAnalysis_Partitioner2_ModulesLinux_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 #include <Rose/BinaryAnalysis/Partitioner2/Modules.h>
6 
7 #include <Rose/BinaryAnalysis/SystemCall.h>
8 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics/Dispatcher.h>
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace Partitioner2 {
13 
15 namespace ModulesLinux {
16 
18 SystemCall systemCallAnalyzer(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
19 
25  SystemCall analyzer_;
26 protected:
27  SyscallSuccessors(const Partitioner&, const boost::filesystem::path &syscallHeader);
28 public:
32  static Ptr instance(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
33 
34  virtual bool operator()(bool chain, const Args&) override;
35 };
36 
43 public:
46 
47  static Ptr instance() { return Ptr(new LibcStartMain); }
48  virtual bool operator()(bool chain, const Args&) override;
49 
51  void nameMainFunction(const Partitioner&) const;
52 
53 private:
54  // Read a value from the stack
56  readStack(const Partitioner &partitioner, const InstructionSemantics2::BaseSemantics::DispatcherPtr &cpu, int byteOffset,
57  size_t nBitsToRead, RegisterDescriptor segmentRegister);
58 };
59 
64 void nameSystemCalls(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
65 
66 } // namespace
67 } // namespace
68 } // namespace
69 } // namespace
70 
71 #endif
72 #endif
Base class for adjusting basic blocks during discovery.
Definition: Modules.h:42
Basic block callback to detect system calls that don't return.
Definition: ModulesLinux.h:24
Basic block callback to add "main" address as a function.
Definition: ModulesLinux.h:41
Sawyer::SharedPointer< LibcStartMain > Ptr
Shared ownership pointer to LibcStartMain callback.
Definition: ModulesLinux.h:45
Main namespace for the ROSE library.
SystemCall systemCallAnalyzer(const Partitioner &, const boost::filesystem::path &syscallHeader="")
Create a system call analyzer suitable for this architecture.
static Ptr instance(const Partitioner &, const boost::filesystem::path &syscallHeader="")
Allocating constructor.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
Analyzes basic blocks to get system call names.
Definition: SystemCall.h:22
void nameMainFunction(const Partitioner &) const
Give the name "main" to the main function if it has no name yet.
virtual bool operator()(bool chain, const Args &) override
Callback method.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
void nameSystemCalls(const Partitioner &, const boost::filesystem::path &syscallHeader="")
Adds comments to system call instructions.
Describes (part of) a physical CPU register.
virtual bool operator()(bool chain, const Args &) override
Callback method.
Partitions instructions into basic blocks and functions.
Definition: Partitioner.h:289