ROSE  0.11.21.0
ModulesLinux.h
1 #ifndef ROSE_Partitioner2_ModulesLinux_H
2 #define ROSE_Partitioner2_ModulesLinux_H
3 
4 #include <featureTests.h>
5 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Partitioner2/Modules.h>
7 
8 #include <BinarySystemCall.h>
9 #include <BaseSemanticsDispatcher.h>
10 
11 namespace Rose {
12 namespace BinaryAnalysis {
13 namespace Partitioner2 {
14 
16 namespace ModulesLinux {
17 
19 SystemCall systemCallAnalyzer(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
20 
26  SystemCall analyzer_;
27 protected:
28  SyscallSuccessors(const Partitioner&, const boost::filesystem::path &syscallHeader);
29 public:
33  static Ptr instance(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
34 
35  virtual bool operator()(bool chain, const Args&) ROSE_OVERRIDE;
36 };
37 
44 public:
47 
48  static Ptr instance() { return Ptr(new LibcStartMain); }
49  virtual bool operator()(bool chain, const Args&) ROSE_OVERRIDE;
50 
52  void nameMainFunction(const Partitioner&) const;
53 
54 private:
55  // Read a value from the stack
56  InstructionSemantics2::BaseSemantics::SValuePtr
57  readStack(const Partitioner &partitioner, const InstructionSemantics2::BaseSemantics::DispatcherPtr &cpu, int byteOffset,
58  size_t nBitsToRead, RegisterDescriptor segmentRegister);
59 };
60 
65 void nameSystemCalls(const Partitioner&, const boost::filesystem::path &syscallHeader = "");
66 
67 } // namespace
68 } // namespace
69 } // namespace
70 } // namespace
71 
72 #endif
73 #endif
virtual bool operator()(bool chain, const Args &) ROSE_OVERRIDE
Callback method.
Base class for adjusting basic blocks during discovery.
Definition: Modules.h:43
Basic block callback to detect system calls that don't return.
Definition: ModulesLinux.h:25
Basic block callback to add "main" address as a function.
Definition: ModulesLinux.h:42
virtual bool operator()(bool chain, const Args &) ROSE_OVERRIDE
Callback method.
Sawyer::SharedPointer< LibcStartMain > Ptr
Shared ownership pointer to LibcStartMain callback.
Definition: ModulesLinux.h:46
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.
void nameMainFunction(const Partitioner &) const
Give the name "main" to the main function if it has no name yet.
void nameSystemCalls(const Partitioner &, const boost::filesystem::path &syscallHeader="")
Adds comments to system call instructions.
Describes (part of) a physical CPU register.
Partitions instructions into basic blocks and functions.
Definition: Partitioner.h:322