ROSE  0.11.145.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/InstructionSemantics/BaseSemantics/BasicTypes.h>
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace Partitioner2 {
13 
15 namespace ModulesLinux {
16 
18 SystemCall systemCallAnalyzer(const PartitionerConstPtr&, const boost::filesystem::path &syscallHeader = "");
19 
25  SystemCall analyzer_;
26 protected:
27  SyscallSuccessors(const PartitionerConstPtr&, const boost::filesystem::path &syscallHeader);
28 public:
32  static Ptr instance(const PartitionerConstPtr&, 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 PartitionerConstPtr&) const;
52 
53 private:
54  // Read a value from the stack
56  readStack(const PartitionerConstPtr &partitioner, const InstructionSemantics::BaseSemantics::DispatcherPtr &cpu, int byteOffset,
57  size_t nBitsToRead, RegisterDescriptor segmentRegister);
58 };
59 
64 void nameSystemCalls(const PartitionerConstPtr&, 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:39
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
SystemCall systemCallAnalyzer(const PartitionerConstPtr &, const boost::filesystem::path &syscallHeader="")
Create a system call analyzer suitable for this architecture.
Sawyer::SharedPointer< LibcStartMain > Ptr
Shared ownership pointer to LibcStartMain callback.
Definition: ModulesLinux.h:45
Main namespace for the ROSE library.
void nameMainFunction(const PartitionerConstPtr &) const
Give the name "main" to the main function if it has no name yet.
Analyzes basic blocks to get system call names.
Definition: SystemCall.h:22
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
virtual bool operator()(bool chain, const Args &) override
Callback method.
Describes (part of) a physical CPU register.
virtual bool operator()(bool chain, const Args &) override
Callback method.
void nameSystemCalls(const PartitionerConstPtr &, const boost::filesystem::path &syscallHeader="")
Adds comments to system call instructions.
static Ptr instance(const PartitionerConstPtr &, const boost::filesystem::path &syscallHeader="")
Allocating constructor.