mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-3276 Put all C++ classes in ghidra namespace
This commit is contained in:
parent
ca9a56b5f4
commit
fe137f20f3
217 changed files with 1635 additions and 554 deletions
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#include "coreaction.hh"
|
#include "coreaction.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Specify the name, group, and properties of the Action
|
/// Specify the name, group, and properties of the Action
|
||||||
/// \param f is the collection of property flags
|
/// \param f is the collection of property flags
|
||||||
/// \param nm is the Action name
|
/// \param nm is the Action name
|
||||||
|
@ -1156,3 +1158,5 @@ Action *ActionDatabase::deriveAction(const string &baseaction, const string &grp
|
||||||
registerAction(grp,newact);
|
registerAction(grp,newact);
|
||||||
return newact;
|
return newact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
*/
|
*/
|
||||||
/// \file action.hh
|
/// \file action.hh
|
||||||
/// \brief Action, Rule, and other associates classes supporting transformations on function data-flow
|
/// \brief Action, Rule, and other associates classes supporting transformations on function data-flow
|
||||||
#ifndef __CPUI_ACTION__
|
#ifndef __ACTION_HH__
|
||||||
#define __CPUI_ACTION__
|
#define __ACTION_HH__
|
||||||
|
|
||||||
#include "block.hh"
|
#include "block.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief The list of groups defining a \e root Action
|
/// \brief The list of groups defining a \e root Action
|
||||||
///
|
///
|
||||||
/// Any Rule or \e leaf Action belongs to a \b group. This class
|
/// Any Rule or \e leaf Action belongs to a \b group. This class
|
||||||
|
@ -321,4 +323,5 @@ public:
|
||||||
void universalAction(Architecture *glb); ///< Build the universal action
|
void universalAction(Architecture *glb); ///< Build the universal action
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End ghidra namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "address.hh"
|
#include "address.hh"
|
||||||
#include "translate.hh"
|
#include "translate.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_FIRST = AttributeId("first",27);
|
AttributeId ATTRIB_FIRST = AttributeId("first",27);
|
||||||
AttributeId ATTRIB_LAST = AttributeId("last",28);
|
AttributeId ATTRIB_LAST = AttributeId("last",28);
|
||||||
AttributeId ATTRIB_UNIQ = AttributeId("uniq",29);
|
AttributeId ATTRIB_UNIQ = AttributeId("uniq",29);
|
||||||
|
@ -991,3 +993,5 @@ int4 power2Divide(int4 n,uint8 divisor,uint8 &q,uint8 &r)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -23,11 +23,13 @@
|
||||||
/// by placing them in their own space, separate from RAM. Indirection
|
/// by placing them in their own space, separate from RAM. Indirection
|
||||||
/// (i.e. pointers) must be simulated through the LOAD and STORE ops.
|
/// (i.e. pointers) must be simulated through the LOAD and STORE ops.
|
||||||
|
|
||||||
#ifndef __CPUI_ADDR__
|
#ifndef __ADDRESS_HH__
|
||||||
#define __CPUI_ADDR__
|
#define __ADDRESS_HH__
|
||||||
|
|
||||||
#include "space.hh"
|
#include "space.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class AddrSpaceManager;
|
class AddrSpaceManager;
|
||||||
|
|
||||||
extern AttributeId ATTRIB_FIRST; ///< Marshaling attribute "first"
|
extern AttributeId ATTRIB_FIRST; ///< Marshaling attribute "first"
|
||||||
|
@ -555,4 +557,5 @@ extern void unsignedSubtract128(uint8 *a,uint8 *b);
|
||||||
extern int4 unsignedCompare128(uint8 *a,uint8 *b);
|
extern int4 unsignedCompare128(uint8 *a,uint8 *b);
|
||||||
extern int4 power2Divide(int4 n,uint8 divisor,uint8 &q,uint8 &r);
|
extern int4 power2Divide(int4 n,uint8 divisor,uint8 &q,uint8 &r);
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
#endif
|
#endif
|
||||||
#ifdef CPUI_STATISTICS
|
#ifdef CPUI_STATISTICS
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
|
#ifdef CPUI_STATISTICS
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1532,3 +1537,5 @@ void Statistics::printResults(ostream &s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
/// \file architecture.hh
|
/// \file architecture.hh
|
||||||
/// \brief Architecture and associated classes that help manage a single processor architecture and load image
|
/// \brief Architecture and associated classes that help manage a single processor architecture and load image
|
||||||
#ifndef __CPUI_ARCHITECTURE__
|
#ifndef __ARCHITECTURE_HH__
|
||||||
#define __CPUI_ARCHITECTURE__
|
#define __ARCHITECTURE_HH__
|
||||||
|
|
||||||
#include "capability.hh"
|
#include "capability.hh"
|
||||||
#include "varmap.hh"
|
#include "varmap.hh"
|
||||||
|
@ -34,6 +34,8 @@
|
||||||
#include "transform.hh"
|
#include "transform.hh"
|
||||||
#include "prefersplit.hh"
|
#include "prefersplit.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
#ifdef CPUI_STATISTICS
|
#ifdef CPUI_STATISTICS
|
||||||
/// \brief Class for collecting statistics while processing over multiple functions
|
/// \brief Class for collecting statistics while processing over multiple functions
|
||||||
///
|
///
|
||||||
|
@ -397,4 +399,5 @@ inline bool Architecture::highPtrPossible(const Address &loc,int4 size) const {
|
||||||
return !nohighptr.inRange(loc,size);
|
return !nohighptr.inRange(loc,size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
#include "bfd_arch.hh"
|
#include "bfd_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Constructing this object registers capability
|
// Constructing this object registers capability
|
||||||
BfdArchitectureCapability BfdArchitectureCapability::bfdArchitectureCapability;
|
BfdArchitectureCapability BfdArchitectureCapability::bfdArchitectureCapability;
|
||||||
|
|
||||||
|
@ -169,3 +171,5 @@ void BfdArchitecture::restoreXml(DocumentStorage &store)
|
||||||
SleighArchitecture::restoreXml(store);
|
SleighArchitecture::restoreXml(store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,10 +16,14 @@
|
||||||
*/
|
*/
|
||||||
/// \file bfd_arch.hh
|
/// \file bfd_arch.hh
|
||||||
/// \brief Specific implementation of Architecture using GNU BFD libraries
|
/// \brief Specific implementation of Architecture using GNU BFD libraries
|
||||||
|
#ifndef __BFD_ARCH_HH__
|
||||||
|
#define __BFD_ARCH_HH__
|
||||||
|
|
||||||
#include "sleigh_arch.hh"
|
#include "sleigh_arch.hh"
|
||||||
#include "loadimage_bfd.hh"
|
#include "loadimage_bfd.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern ElementId ELEM_BFD_SAVEFILE; ///< Marshaling element \<bfd_savefile>
|
extern ElementId ELEM_BFD_SAVEFILE; ///< Marshaling element \<bfd_savefile>
|
||||||
|
|
||||||
/// \brief Extension point for building a GNU BFD capable Architecture
|
/// \brief Extension point for building a GNU BFD capable Architecture
|
||||||
|
@ -47,3 +51,6 @@ public:
|
||||||
BfdArchitecture(const string &fname,const string &targ,ostream *estream); ///< Constructor
|
BfdArchitecture(const string &fname,const string &targ,ostream *estream); ///< Constructor
|
||||||
virtual ~BfdArchitecture(void) {}
|
virtual ~BfdArchitecture(void) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "block.hh"
|
#include "block.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_ALTINDEX = AttributeId("altindex",75);
|
AttributeId ATTRIB_ALTINDEX = AttributeId("altindex",75);
|
||||||
AttributeId ATTRIB_DEPTH = AttributeId("depth",76);
|
AttributeId ATTRIB_DEPTH = AttributeId("depth",76);
|
||||||
AttributeId ATTRIB_END = AttributeId("end",77);
|
AttributeId ATTRIB_END = AttributeId("end",77);
|
||||||
|
@ -3566,3 +3568,5 @@ FlowBlock *BlockMap::createBlock(const string &name)
|
||||||
sortlist.push_back(bl);
|
sortlist.push_back(bl);
|
||||||
return bl;
|
return bl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file block.hh
|
/// \file block.hh
|
||||||
/// \brief Classes related to \e basic \e blocks and control-flow structuring
|
/// \brief Classes related to \e basic \e blocks and control-flow structuring
|
||||||
|
|
||||||
#ifndef __CPUI_BLOCK__
|
#ifndef __BLOCK_HH__
|
||||||
#define __CPUI_BLOCK__
|
#define __BLOCK_HH__
|
||||||
|
|
||||||
#include "jumptable.hh"
|
#include "jumptable.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class BlockBasic; // Forward declarations
|
class BlockBasic; // Forward declarations
|
||||||
class BlockList;
|
class BlockList;
|
||||||
class BlockCopy;
|
class BlockCopy;
|
||||||
|
@ -816,4 +818,5 @@ inline bool BlockSwitch::CaseOrder::compare(const CaseOrder &a,const CaseOrder &
|
||||||
return (a.depth < b.depth);
|
return (a.depth < b.depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "blockaction.hh"
|
#include "blockaction.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Retrieve the current edge (as a \e top FlowBlock and the index of the outgoing edge).
|
/// Retrieve the current edge (as a \e top FlowBlock and the index of the outgoing edge).
|
||||||
/// If the end-points have been collapsed together, this returns NULL.
|
/// If the end-points have been collapsed together, this returns NULL.
|
||||||
/// The top and bottom nodes of the edge are updated to FlowBlocks in the current collapsed graph.
|
/// The top and bottom nodes of the edge are updated to FlowBlocks in the current collapsed graph.
|
||||||
|
@ -2350,3 +2352,5 @@ int4 ActionNodeJoin::apply(Funcdata &data)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,14 +13,16 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __BLOCK_ACTION__
|
#ifndef __BLOCKACTION_HH__
|
||||||
#define __BLOCK_ACTION__
|
#define __BLOCKACTION_HH__
|
||||||
|
|
||||||
/// \file blockaction.hh
|
/// \file blockaction.hh
|
||||||
/// \brief Actions and classes associated with transforming and structuring the control-flow graph
|
/// \brief Actions and classes associated with transforming and structuring the control-flow graph
|
||||||
|
|
||||||
#include "action.hh"
|
#include "action.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Class for holding an edge while the underlying graph is being manipulated
|
/// \brief Class for holding an edge while the underlying graph is being manipulated
|
||||||
///
|
///
|
||||||
/// The original FlowBlock nodes that define the end-points of the edge may get
|
/// The original FlowBlock nodes that define the end-points of the edge may get
|
||||||
|
@ -355,4 +357,5 @@ public:
|
||||||
virtual int4 apply(Funcdata &data);
|
virtual int4 apply(Funcdata &data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "callgraph.hh"
|
#include "callgraph.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ElementId ELEM_CALLGRAPH = ElementId("callgraph",226);
|
ElementId ELEM_CALLGRAPH = ElementId("callgraph",226);
|
||||||
ElementId ELEM_NODE = ElementId("node",227);
|
ElementId ELEM_NODE = ElementId("node",227);
|
||||||
|
|
||||||
|
@ -463,3 +465,4 @@ void CallGraph::decoder(Decoder &decoder)
|
||||||
decoder.closeElement(elemId);
|
decoder.closeElement(elemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CPUI_CALLGRAPH__
|
#ifndef __CALLGRAPH_HH__
|
||||||
#define __CPUI_CALLGRAPH__
|
#define __CALLGRAPH_HH__
|
||||||
|
|
||||||
#include "address.hh"
|
#include "address.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class Architecture;
|
class Architecture;
|
||||||
class Funcdata;
|
class Funcdata;
|
||||||
|
@ -122,4 +124,5 @@ public:
|
||||||
void decoder(Decoder &decoder);
|
void decoder(Decoder &decoder);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "capability.hh"
|
#include "capability.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Access static vector of CapabilityPoint objects that are registered during static initialization
|
/// Access static vector of CapabilityPoint objects that are registered during static initialization
|
||||||
/// The list itself is created once on the first call to this method
|
/// The list itself is created once on the first call to this method
|
||||||
/// \e after all the static initializers have run
|
/// \e after all the static initializers have run
|
||||||
|
@ -46,3 +48,4 @@ void CapabilityPoint::initializeAll(void)
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,13 +15,15 @@
|
||||||
*/
|
*/
|
||||||
/// \file capability.hh
|
/// \file capability.hh
|
||||||
/// \brief Infrastructure for discovering code extensions to the decompiler
|
/// \brief Infrastructure for discovering code extensions to the decompiler
|
||||||
#ifndef __CAPABILITY__
|
#ifndef __CAPABILITY_HH__
|
||||||
#define __CAPABILITY__
|
#define __CAPABILITY_HH__
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -49,5 +51,5 @@ public:
|
||||||
static void initializeAll(void); ///< Finish initialization for all extension points
|
static void initializeAll(void); ///< Finish initialization for all extension points
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "cast.hh"
|
#include "cast.hh"
|
||||||
#include "op.hh"
|
#include "op.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Sets the TypeFactory used to produce data-types for the arithmeticOutputStandard() method
|
/// Sets the TypeFactory used to produce data-types for the arithmeticOutputStandard() method
|
||||||
/// \param t is the TypeFactory
|
/// \param t is the TypeFactory
|
||||||
void CastStrategy::setTypeFactory(TypeFactory *t)
|
void CastStrategy::setTypeFactory(TypeFactory *t)
|
||||||
|
@ -530,3 +532,5 @@ bool CastStrategyJava::isZextCast(Datatype *outtype,Datatype *intype) const
|
||||||
if (intype->getSize()>=4) return false; // cast is not zext for int and long
|
if (intype->getSize()>=4) return false; // cast is not zext for int and long
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file cast.hh
|
/// \file cast.hh
|
||||||
/// \brief API and specific strategies for applying type casts
|
/// \brief API and specific strategies for applying type casts
|
||||||
|
|
||||||
#ifndef __CPUI_CAST__
|
#ifndef __CAST_HH__
|
||||||
#define __CPUI_CAST__
|
#define __CAST_HH__
|
||||||
|
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class Varnode;
|
class Varnode;
|
||||||
class PcodeOp;
|
class PcodeOp;
|
||||||
|
|
||||||
|
@ -199,4 +201,5 @@ public:
|
||||||
virtual bool isZextCast(Datatype *outtype,Datatype *intype) const;
|
virtual bool isZextCast(Datatype *outtype,Datatype *intype) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "codedata.hh"
|
#include "codedata.hh"
|
||||||
#include "loadimage_bfd.hh"
|
#include "loadimage_bfd.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Constructing this registers the capability
|
// Constructing this registers the capability
|
||||||
IfaceCodeDataCapability IfaceCodeDataCapability::ifaceCodeDataCapability;
|
IfaceCodeDataCapability IfaceCodeDataCapability::ifaceCodeDataCapability;
|
||||||
|
|
||||||
|
@ -786,3 +788,5 @@ void IfcCodeDataDumpTargetHits::execute(istream &s)
|
||||||
{
|
{
|
||||||
codedata->dumpTargetHits(*status->fileoptr);
|
codedata->dumpTargetHits(*status->fileoptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CPUI_CODEDATA__
|
#ifndef __CODEDATA_HH__
|
||||||
#define __CPUI_CODEDATA__
|
#define __CODEDATA_HH__
|
||||||
|
|
||||||
#include "ifacedecomp.hh"
|
#include "ifacedecomp.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class IfaceCodeDataCapability : public IfaceCapability {
|
class IfaceCodeDataCapability : public IfaceCapability {
|
||||||
static IfaceCodeDataCapability ifaceCodeDataCapability; // Singleton instance
|
static IfaceCodeDataCapability ifaceCodeDataCapability; // Singleton instance
|
||||||
IfaceCodeDataCapability(void); // Singleton
|
IfaceCodeDataCapability(void); // Singleton
|
||||||
|
@ -194,4 +196,5 @@ public:
|
||||||
virtual void execute(istream &s);
|
virtual void execute(istream &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "comment.hh"
|
#include "comment.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ElementId ELEM_COMMENT = ElementId("comment",86);
|
ElementId ELEM_COMMENT = ElementId("comment",86);
|
||||||
ElementId ELEM_COMMENTDB = ElementId("commentdb",87);
|
ElementId ELEM_COMMENTDB = ElementId("commentdb",87);
|
||||||
ElementId ELEM_TEXT = ElementId("text",88);
|
ElementId ELEM_TEXT = ElementId("text",88);
|
||||||
|
@ -400,3 +402,5 @@ void CommentSorter::setupHeader(uint4 headerType)
|
||||||
subsort.pos = 0xffffffff;
|
subsort.pos = 0xffffffff;
|
||||||
opstop = commmap.upper_bound(subsort);
|
opstop = commmap.upper_bound(subsort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file comment.hh
|
/// \file comment.hh
|
||||||
/// \brief A database interface for high-level language comments
|
/// \brief A database interface for high-level language comments
|
||||||
|
|
||||||
#ifndef __CPUI_COMMENT__
|
#ifndef __COMMENT_HH__
|
||||||
#define __CPUI_COMMENT__
|
#define __COMMENT_HH__
|
||||||
|
|
||||||
#include "address.hh"
|
#include "address.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class FlowBlock;
|
class FlowBlock;
|
||||||
class PcodeOp;
|
class PcodeOp;
|
||||||
class Funcdata;
|
class Funcdata;
|
||||||
|
@ -249,4 +251,5 @@ public:
|
||||||
Comment *getNext(void) const { Comment *res=(*start).second; ++start; return res; } ///< Advance to the next comment
|
Comment *getNext(void) const { Comment *res=(*start).second; ++start; return res; } ///< Advance to the next comment
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "comment_ghidra.hh"
|
#include "comment_ghidra.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
CommentDatabaseGhidra::CommentDatabaseGhidra(ArchitectureGhidra *g)
|
CommentDatabaseGhidra::CommentDatabaseGhidra(ArchitectureGhidra *g)
|
||||||
: CommentDatabase()
|
: CommentDatabase()
|
||||||
{
|
{
|
||||||
|
@ -78,3 +80,4 @@ CommentSet::const_iterator CommentDatabaseGhidra::endComment(const Address &fad)
|
||||||
return cache.endComment(fad);
|
return cache.endComment(fad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
*/
|
*/
|
||||||
/// \file comment_ghidra.hh
|
/// \file comment_ghidra.hh
|
||||||
/// \brief Obtain comments by talking to a Ghidra client
|
/// \brief Obtain comments by talking to a Ghidra client
|
||||||
#ifndef __COMMENT_GHIDRA__
|
#ifndef __COMMENT_GHIDRA_HH__
|
||||||
#define __COMMENT_GHIDRA__
|
#define __COMMENT_GHIDRA_HH__
|
||||||
|
|
||||||
#include "comment.hh"
|
#include "comment.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An implementation of CommentDatabase backed by a Ghidra client
|
/// \brief An implementation of CommentDatabase backed by a Ghidra client
|
||||||
///
|
///
|
||||||
/// Comment information about particular functions is obtained by querying
|
/// Comment information about particular functions is obtained by querying
|
||||||
|
@ -51,4 +53,5 @@ public:
|
||||||
throw LowlevelError("CommentDatabaseGhidra::decode unimplemented"); }
|
throw LowlevelError("CommentDatabaseGhidra::decode unimplemented"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "condexe.hh"
|
#include "condexe.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ConditionMarker::ConditionMarker(void)
|
ConditionMarker::ConditionMarker(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1094,3 +1096,5 @@ int4 RuleOrPredicate::applyOp(PcodeOp *op,Funcdata &data)
|
||||||
data.opSetOpcode(op,CPUI_COPY);
|
data.opSetOpcode(op,CPUI_COPY);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
*/
|
*/
|
||||||
/// \file condexe.hh
|
/// \file condexe.hh
|
||||||
/// \brief Classes for simplifying control-flow with shared conditional expressions
|
/// \brief Classes for simplifying control-flow with shared conditional expressions
|
||||||
#ifndef __CONDEXE__
|
#ifndef __CONDEXE_HH__
|
||||||
#define __CONDEXE__
|
#define __CONDEXE_HH__
|
||||||
|
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief A helper class for describing the similarity of the boolean condition between 2 CBRANCH operations
|
/// \brief A helper class for describing the similarity of the boolean condition between 2 CBRANCH operations
|
||||||
///
|
///
|
||||||
/// This class determines if two CBRANCHs share the same condition. It also determines if the conditions
|
/// This class determines if two CBRANCHs share the same condition. It also determines if the conditions
|
||||||
|
@ -234,4 +236,5 @@ public:
|
||||||
virtual int4 applyOp(PcodeOp *op,Funcdata &data);
|
virtual int4 applyOp(PcodeOp *op,Funcdata &data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
*/
|
*/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include "libdecomp.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
|
||||||
#include "libdecomp.hh"
|
|
||||||
|
|
||||||
class IfcLoadFile : public IfaceDecompCommand {
|
class IfcLoadFile : public IfaceDecompCommand {
|
||||||
public:
|
public:
|
||||||
virtual void execute(istream &s);
|
virtual void execute(istream &s);
|
||||||
|
@ -170,9 +171,13 @@ void IfcRestore::execute(istream &s)
|
||||||
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
int main(int argc,char **argv)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
using namespace ghidra;
|
||||||
|
|
||||||
const char *initscript = (const char *)0;
|
const char *initscript = (const char *)0;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -244,4 +249,3 @@ int main(int argc,char **argv)
|
||||||
|
|
||||||
exit(retval);
|
exit(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "slghsymbol.hh"
|
#include "slghsymbol.hh"
|
||||||
#include "translate.hh"
|
#include "translate.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ParserContext::ParserContext(ContextCache *ccache,Translate *trans)
|
ParserContext::ParserContext(ContextCache *ccache,Translate *trans)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -234,3 +236,4 @@ void ParserWalkerChange::calcCurrentLength(int4 length,int4 numopers)
|
||||||
point->length = length - point->offset; // Convert back to relative length
|
point->length = length - point->offset; // Convert back to relative length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,12 +13,14 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CONTEXT__
|
#ifndef __CONTEXT_HH__
|
||||||
#define __CONTEXT__
|
#define __CONTEXT_HH__
|
||||||
|
|
||||||
#include "globalcontext.hh"
|
#include "globalcontext.hh"
|
||||||
#include "opcodes.hh"
|
#include "opcodes.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class Token { // A multiple-byte sized chunk of pattern in a bitstream
|
class Token { // A multiple-byte sized chunk of pattern in a bitstream
|
||||||
string name;
|
string name;
|
||||||
int4 size; // Number of bytes in token;
|
int4 size; // Number of bytes in token;
|
||||||
|
@ -198,4 +200,5 @@ inline void ParserContext::allocateOperand(int4 i,ParserWalkerChange &walker) {
|
||||||
walker.breadcrumb[walker.depth] = 0;
|
walker.breadcrumb[walker.depth] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "double.hh"
|
#include "double.hh"
|
||||||
#include "subflow.hh"
|
#include "subflow.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief A stack equation
|
/// \brief A stack equation
|
||||||
struct StackEqn {
|
struct StackEqn {
|
||||||
int4 var1; ///< Variable with 1 coefficient
|
int4 var1; ///< Variable with 1 coefficient
|
||||||
|
@ -5500,3 +5502,5 @@ void ActionDatabase::universalAction(Architecture *conf)
|
||||||
act->addAction( new ActionPrototypeWarnings("protorecovery") );
|
act->addAction( new ActionPrototypeWarnings("protorecovery") );
|
||||||
act->addAction( new ActionStop("base") );
|
act->addAction( new ActionStop("base") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -21,13 +21,15 @@
|
||||||
/// (if they do they must check the covers themselves)
|
/// (if they do they must check the covers themselves)
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CORE_ACTION__
|
#ifndef __COREACTION_HH__
|
||||||
#define __CORE_ACTION__
|
#define __COREACTION_HH__
|
||||||
|
|
||||||
#include "ruleaction.hh"
|
#include "ruleaction.hh"
|
||||||
#include "blockaction.hh"
|
#include "blockaction.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Gather raw p-code for a function.
|
/// \brief Gather raw p-code for a function.
|
||||||
class ActionStart : public Action {
|
class ActionStart : public Action {
|
||||||
public:
|
public:
|
||||||
|
@ -1088,4 +1090,5 @@ public:
|
||||||
inline bool TermOrder::additiveCompare(const AdditiveEdge *op1,const AdditiveEdge *op2) {
|
inline bool TermOrder::additiveCompare(const AdditiveEdge *op1,const AdditiveEdge *op2) {
|
||||||
return (-1 == op1->getVarnode()->termOrder(op2->getVarnode())); }
|
return (-1 == op1->getVarnode()->termOrder(op2->getVarnode())); }
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "cover.hh"
|
#include "cover.hh"
|
||||||
#include "block.hh"
|
#include "block.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
const CoverBlock Cover::emptyBlock;
|
const CoverBlock Cover::emptyBlock;
|
||||||
|
|
||||||
/// PcodeOp objects and a CoverBlock start/stop boundaries have
|
/// PcodeOp objects and a CoverBlock start/stop boundaries have
|
||||||
|
@ -562,3 +564,5 @@ void Cover::print(ostream &s) const
|
||||||
s << endl;
|
s << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
*/
|
*/
|
||||||
/// \file cover.hh
|
/// \file cover.hh
|
||||||
/// \brief Classes describing the topological scope of variables within a function
|
/// \brief Classes describing the topological scope of variables within a function
|
||||||
#ifndef __CPUI_COVER__
|
#ifndef __COVER_HH__
|
||||||
#define __CPUI_COVER__
|
#define __COVER_HH__
|
||||||
|
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class PcodeOp;
|
class PcodeOp;
|
||||||
class FlowBlock;
|
class FlowBlock;
|
||||||
class Varnode;
|
class Varnode;
|
||||||
|
@ -89,4 +91,5 @@ public:
|
||||||
map<int4,CoverBlock>::const_iterator end(void) const { return cover.end(); } ///< Get end of CoverBlocks
|
map<int4,CoverBlock>::const_iterator end(void) const { return cover.end(); } ///< Get end of CoverBlocks
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "cpool.hh"
|
#include "cpool.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_A = AttributeId("a",80);
|
AttributeId ATTRIB_A = AttributeId("a",80);
|
||||||
AttributeId ATTRIB_B = AttributeId("b",81);
|
AttributeId ATTRIB_B = AttributeId("b",81);
|
||||||
AttributeId ATTRIB_LENGTH = AttributeId("length",82);
|
AttributeId ATTRIB_LENGTH = AttributeId("length",82);
|
||||||
|
@ -239,3 +241,5 @@ void ConstantPoolInternal::decode(Decoder &decoder,TypeFactory &typegrp)
|
||||||
}
|
}
|
||||||
decoder.closeElement(elemId);
|
decoder.closeElement(elemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file cpool.hh
|
/// \file cpool.hh
|
||||||
/// \brief Definitions to support a constant pool for \e deferred compilation languages (i.e. java byte-code)
|
/// \brief Definitions to support a constant pool for \e deferred compilation languages (i.e. java byte-code)
|
||||||
|
|
||||||
#ifndef __CPOOL__
|
#ifndef __CPOOL_HH__
|
||||||
#define __CPOOL__
|
#define __CPOOL_HH__
|
||||||
|
|
||||||
#include "type.hh"
|
#include "type.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern AttributeId ATTRIB_A; ///< Marshaling attribute "a"
|
extern AttributeId ATTRIB_A; ///< Marshaling attribute "a"
|
||||||
extern AttributeId ATTRIB_B; ///< Marshaling attribute "b"
|
extern AttributeId ATTRIB_B; ///< Marshaling attribute "b"
|
||||||
extern AttributeId ATTRIB_LENGTH; ///< Marshaling attribute "length"
|
extern AttributeId ATTRIB_LENGTH; ///< Marshaling attribute "length"
|
||||||
|
@ -205,4 +207,5 @@ public:
|
||||||
virtual void decode(Decoder &decoder,TypeFactory &typegrp);
|
virtual void decode(Decoder &decoder,TypeFactory &typegrp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "cpool_ghidra.hh"
|
#include "cpool_ghidra.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ConstantPoolGhidra::ConstantPoolGhidra(ArchitectureGhidra *g)
|
ConstantPoolGhidra::ConstantPoolGhidra(ArchitectureGhidra *g)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -64,3 +66,5 @@ void ConstantPoolGhidra::decode(Decoder &decoder,TypeFactory &typegrp)
|
||||||
{
|
{
|
||||||
throw LowlevelError("Cannot access constant pool with this method");
|
throw LowlevelError("Cannot access constant pool with this method");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file cpool_ghidra.hh
|
/// \file cpool_ghidra.hh
|
||||||
/// \brief Utility for implementing a \e constant \e pool backed by a Ghidra client
|
/// \brief Utility for implementing a \e constant \e pool backed by a Ghidra client
|
||||||
|
|
||||||
#ifndef __CPOOL_GHIDRA__
|
#ifndef __CPOOL_GHIDRA_HH__
|
||||||
#define __CPOOL_GHIDRA__
|
#define __CPOOL_GHIDRA_HH__
|
||||||
|
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An implementation of ConstantPool using a Ghidra client as the backing storage
|
/// \brief An implementation of ConstantPool using a Ghidra client as the backing storage
|
||||||
///
|
///
|
||||||
/// The actual CPoolRecord objects are cached locally, but new queries are placed
|
/// The actual CPoolRecord objects are cached locally, but new queries are placed
|
||||||
|
@ -41,4 +43,5 @@ public:
|
||||||
virtual void decode(Decoder &decoder,TypeFactory &typegrp);
|
virtual void decode(Decoder &decoder,TypeFactory &typegrp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "crc32.hh"
|
#include "crc32.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Table for bytewise calculation of a 32-bit Cyclic Redundancy Check
|
// Table for bytewise calculation of a 32-bit Cyclic Redundancy Check
|
||||||
uint4 crc32tab[] = {
|
uint4 crc32tab[] = {
|
||||||
0x0,0x77073096,0xee0e612c,0x990951ba,0x76dc419,0x706af48f,
|
0x0,0x77073096,0xee0e612c,0x990951ba,0x76dc419,0x706af48f,
|
||||||
|
@ -70,3 +71,4 @@ uint4 crc32tab[] = {
|
||||||
0x54de5729,0x23d967bf,0xb3667a2e,0xc4614ab8,0x5d681b02,
|
0x54de5729,0x23d967bf,0xb3667a2e,0xc4614ab8,0x5d681b02,
|
||||||
0x2a6f2b94,0xb40bbe37,0xc30c8ea1,0x5a05df1b,0x2d02ef8d };
|
0x2a6f2b94,0xb40bbe37,0xc30c8ea1,0x5a05df1b,0x2d02ef8d };
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file crc32.hh
|
/// \file crc32.hh
|
||||||
/// \brief Table and function for computing a CRC32
|
/// \brief Table and function for computing a CRC32
|
||||||
|
|
||||||
#ifndef __CRC32__
|
#ifndef __CRC32_HH__
|
||||||
#define __CRC32__
|
#define __CRC32_HH__
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern uint4 crc32tab[]; ///< Table for quickly computing a 32-bit Cyclic Redundacy Check (CRC)
|
extern uint4 crc32tab[]; ///< Table for quickly computing a 32-bit Cyclic Redundacy Check (CRC)
|
||||||
|
|
||||||
/// \brief Feed 8 bits into a CRC register
|
/// \brief Feed 8 bits into a CRC register
|
||||||
|
@ -31,4 +33,5 @@ extern uint4 crc32tab[]; ///< Table for quickly computing a 32-bit Cyclic Redund
|
||||||
inline uint4 crc_update(uint4 reg,uint4 val) {
|
inline uint4 crc_update(uint4 reg,uint4 val) {
|
||||||
return crc32tab[(reg ^ val)&0xff] ^ (reg>>8); }
|
return crc32tab[(reg ^ val)&0xff] ^ (reg>>8); }
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "crc32.hh"
|
#include "crc32.hh"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_CAT = AttributeId("cat",61);
|
AttributeId ATTRIB_CAT = AttributeId("cat",61);
|
||||||
AttributeId ATTRIB_FIELD = AttributeId("field",62);
|
AttributeId ATTRIB_FIELD = AttributeId("field",62);
|
||||||
AttributeId ATTRIB_MERGE = AttributeId("merge",63);
|
AttributeId ATTRIB_MERGE = AttributeId("merge",63);
|
||||||
|
@ -3364,3 +3366,5 @@ void Database::decodeScope(Decoder &decoder,Scope *newScope)
|
||||||
}
|
}
|
||||||
decoder.closeElement(elemId);
|
decoder.closeElement(elemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -20,13 +20,15 @@
|
||||||
/// scopes, namespaces etc. Search can be by name or the address of the Symbol storage
|
/// scopes, namespaces etc. Search can be by name or the address of the Symbol storage
|
||||||
/// location.
|
/// location.
|
||||||
|
|
||||||
#ifndef __CPUI_DATABASE__
|
#ifndef __DATABASE_HH__
|
||||||
#define __CPUI_DATABASE__
|
#define __DATABASE_HH__
|
||||||
|
|
||||||
#include "variable.hh"
|
#include "variable.hh"
|
||||||
#include "partmap.hh"
|
#include "partmap.hh"
|
||||||
#include "rangemap.hh"
|
#include "rangemap.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class Architecture;
|
class Architecture;
|
||||||
class Funcdata;
|
class Funcdata;
|
||||||
class Scope;
|
class Scope;
|
||||||
|
@ -976,4 +978,5 @@ inline Symbol::Symbol(Scope *sc)
|
||||||
depthResolution = 0;
|
depthResolution = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "database_ghidra.hh"
|
#include "database_ghidra.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
Scope *ScopeGhidra::buildSubScope(uint8 id,const string &nm)
|
Scope *ScopeGhidra::buildSubScope(uint8 id,const string &nm)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -389,3 +391,5 @@ bool ScopeGhidraNamespace::isNameUsed(const string &nm,const Scope *op2) const
|
||||||
uint8 otherId = (otherScope != (const ScopeGhidraNamespace *)0) ? otherScope->getId() : 0;
|
uint8 otherId = (otherScope != (const ScopeGhidraNamespace *)0) ? otherScope->getId() : 0;
|
||||||
return ghidra->isNameUsed(nm, uniqueId, otherId);
|
return ghidra->isNameUsed(nm, uniqueId, otherId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file database_ghidra.hh
|
/// \file database_ghidra.hh
|
||||||
/// \brief Facilities for retrieving symbol information from a Ghidra client
|
/// \brief Facilities for retrieving symbol information from a Ghidra client
|
||||||
|
|
||||||
#ifndef __DATABASE_GHIDRA__
|
#ifndef __DATABASE_GHIDRA_HH__
|
||||||
#define __DATABASE_GHIDRA__
|
#define __DATABASE_GHIDRA_HH__
|
||||||
|
|
||||||
#include "database.hh"
|
#include "database.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An implementation of the Scope interface by querying a Ghidra client for Symbol information
|
/// \brief An implementation of the Scope interface by querying a Ghidra client for Symbol information
|
||||||
///
|
///
|
||||||
/// This object is generally instantiated once for an executable and
|
/// This object is generally instantiated once for an executable and
|
||||||
|
@ -137,4 +139,5 @@ public:
|
||||||
virtual bool isNameUsed(const string &nm,const Scope *op2) const;
|
virtual bool isNameUsed(const string &nm,const Scope *op2) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "double.hh"
|
#include "double.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Internally, the \b lo and \b hi Varnodes are set to null, and the \b val field
|
/// Internally, the \b lo and \b hi Varnodes are set to null, and the \b val field
|
||||||
/// holds the constant value.
|
/// holds the constant value.
|
||||||
/// \param sz is the size in bytes of the constant
|
/// \param sz is the size in bytes of the constant
|
||||||
|
@ -3484,3 +3486,5 @@ void RuleDoubleStore::reassignIndirects(Funcdata &data,PcodeOp *newStore,const v
|
||||||
data.opSetInput(op,data.newVarnodeIop(newStore),1); // Assign the INDIRECT to the new STORE
|
data.opSetInput(op,data.newVarnodeIop(newStore),1); // Assign the INDIRECT to the new STORE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,12 +13,14 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CPUI_DOUBLE__
|
#ifndef __DOUBLE_HH__
|
||||||
#define __CPUI_DOUBLE__
|
#define __DOUBLE_HH__
|
||||||
|
|
||||||
#include "ruleaction.hh"
|
#include "ruleaction.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief A logical value whose storage is split between two Varnodes
|
/// \brief A logical value whose storage is split between two Varnodes
|
||||||
///
|
///
|
||||||
/// This is usually a pair of Varnodes \b lo and \b hi holding the least and
|
/// This is usually a pair of Varnodes \b lo and \b hi holding the least and
|
||||||
|
@ -339,4 +341,6 @@ public:
|
||||||
static bool testIndirectUse(PcodeOp *op1,PcodeOp *op2,const vector<PcodeOp *> &indirects);
|
static bool testIndirectUse(PcodeOp *op1,PcodeOp *op2,const vector<PcodeOp *> &indirects);
|
||||||
static void reassignIndirects(Funcdata &data,PcodeOp *newStore,const vector<PcodeOp *> &indirects);
|
static void reassignIndirects(Funcdata &data,PcodeOp *newStore,const vector<PcodeOp *> &indirects);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
#include "crc32.hh"
|
#include "crc32.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Table for how to hash opcodes, lumps certain operators (i.e. ADD SUB PTRADD PTRSUB) into one hash
|
// Table for how to hash opcodes, lumps certain operators (i.e. ADD SUB PTRADD PTRSUB) into one hash
|
||||||
// zero indicates the operator should be skipped
|
// zero indicates the operator should be skipped
|
||||||
const uint4 DynamicHash::transtable[] = {
|
const uint4 DynamicHash::transtable[] = {
|
||||||
|
@ -763,3 +765,5 @@ void DynamicHash::clearTotalPosition(uint8 &h)
|
||||||
val = ~val;
|
val = ~val;
|
||||||
h &= val;
|
h &= val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -17,11 +17,13 @@
|
||||||
/// \brief Utilities for making references to \b dynamic variables: defined as
|
/// \brief Utilities for making references to \b dynamic variables: defined as
|
||||||
/// locations and constants that can only be identified by their context within the data-flow graph.
|
/// locations and constants that can only be identified by their context within the data-flow graph.
|
||||||
|
|
||||||
#ifndef __CPUI_DYNAMIC__
|
#ifndef __DYNAMIC_HH__
|
||||||
#define __CPUI_DYNAMIC__
|
#define __DYNAMIC_HH__
|
||||||
|
|
||||||
#include "varnode.hh"
|
#include "varnode.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An edge between a Varnode and a PcodeOp
|
/// \brief An edge between a Varnode and a PcodeOp
|
||||||
///
|
///
|
||||||
/// A DynamicHash is defined on a sub-graph of the data-flow, and this defines an edge
|
/// A DynamicHash is defined on a sub-graph of the data-flow, and this defines an edge
|
||||||
|
@ -102,4 +104,5 @@ public:
|
||||||
static const uint4 transtable[]; ///< Translation of op-codes to hash values
|
static const uint4 transtable[]; ///< Translation of op-codes to hash values
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "emulate.hh"
|
#include "emulate.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Any time the emulator is about to execute a user-defined pcode op with the given name,
|
/// Any time the emulator is about to execute a user-defined pcode op with the given name,
|
||||||
/// the indicated breakpoint is invoked first. The break table does \e not assume responsibility
|
/// the indicated breakpoint is invoked first. The break table does \e not assume responsibility
|
||||||
/// for freeing the breakpoint object.
|
/// for freeing the breakpoint object.
|
||||||
|
@ -454,3 +456,5 @@ void EmulatePcodeCache::executeInstruction(void)
|
||||||
executeCurrentOp();
|
executeCurrentOp();
|
||||||
} while(!instruction_start);
|
} while(!instruction_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file emulate.hh
|
/// \file emulate.hh
|
||||||
/// \brief Classes for emulating p-code
|
/// \brief Classes for emulating p-code
|
||||||
|
|
||||||
#ifndef __CPUI_EMULATE__
|
#ifndef __EMULATE_HH__
|
||||||
#define __CPUI_EMULATE__
|
#define __EMULATE_HH__
|
||||||
|
|
||||||
#include "memstate.hh"
|
#include "memstate.hh"
|
||||||
#include "translate.hh"
|
#include "translate.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class Emulate; // Forward declaration
|
class Emulate; // Forward declaration
|
||||||
|
|
||||||
/// \brief A collection of breakpoints for the emulator
|
/// \brief A collection of breakpoints for the emulator
|
||||||
|
@ -545,4 +547,5 @@ inline Address EmulatePcodeCache::getExecuteAddress(void) const
|
||||||
- VarnodeData
|
- VarnodeData
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "architecture.hh"
|
#include "architecture.hh"
|
||||||
#include "emulateutil.hh"
|
#include "emulateutil.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \param g is the Architecture providing the LoadImage
|
/// \param g is the Architecture providing the LoadImage
|
||||||
EmulatePcodeOp::EmulatePcodeOp(Architecture *g)
|
EmulatePcodeOp::EmulatePcodeOp(Architecture *g)
|
||||||
|
|
||||||
|
@ -391,3 +393,5 @@ uintb EmulateSnippet::getTempValue(uintb offset) const
|
||||||
return 0;
|
return 0;
|
||||||
return (*iter).second;
|
return (*iter).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file emulateutil.hh
|
/// \file emulateutil.hh
|
||||||
/// \brief (Lightweight) emulation interface for executing PcodeOp objects within a syntax tree
|
/// \brief (Lightweight) emulation interface for executing PcodeOp objects within a syntax tree
|
||||||
/// or for executing snippets defined with PcodeOpRaw objects
|
/// or for executing snippets defined with PcodeOpRaw objects
|
||||||
#ifndef __CPUI_EMUTREE__
|
#ifndef __EMULATEUTIL_HH__
|
||||||
#define __CPUI_EMUTREE__
|
#define __EMULATEUTIL_HH__
|
||||||
|
|
||||||
#include "emulate.hh"
|
#include "emulate.hh"
|
||||||
#include "op.hh"
|
#include "op.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Emulation based on (existing) PcodeOps and Varnodes.
|
/// \brief Emulation based on (existing) PcodeOps and Varnodes.
|
||||||
///
|
///
|
||||||
/// This is still an abstract class. It does most of the work of emulating
|
/// This is still an abstract class. It does most of the work of emulating
|
||||||
|
@ -172,4 +174,5 @@ public:
|
||||||
uintb getTempValue(uintb offset) const;
|
uintb getTempValue(uintb offset) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
///
|
///
|
||||||
/// This is also doubles as a place to list the common include files
|
/// This is also doubles as a place to list the common include files
|
||||||
|
|
||||||
#ifndef __CPUI_ERROR__
|
#ifndef __ERROR_HH__
|
||||||
#define __CPUI_ERROR__
|
#define __ERROR_HH__
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -33,6 +33,8 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::set;
|
using std::set;
|
||||||
|
@ -95,4 +97,5 @@ struct ParseError : public LowlevelError { // Parsing error
|
||||||
ParseError(const string &s) : LowlevelError(s) {}
|
ParseError(const string &s) : LowlevelError(s) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,6 +29,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Path name separator
|
// Path name separator
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
char FileManage::separator = '\\';
|
char FileManage::separator = '\\';
|
||||||
|
@ -381,3 +383,5 @@ string FileManage::discoverGhidraRoot(const char *argv0)
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
// Generic (POSIX) class for searching files and managing paths
|
// Generic (POSIX) class for searching files and managing paths
|
||||||
|
|
||||||
#ifndef __FILEMANAGE__
|
#ifndef __FILEMANAGE_HH__
|
||||||
#define __FILEMANAGE__
|
#define __FILEMANAGE_HH__
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
|
@ -49,4 +51,5 @@ public:
|
||||||
static string discoverGhidraRoot(const char *argv0);
|
static string discoverGhidraRoot(const char *argv0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::ldexp;
|
using std::ldexp;
|
||||||
using std::frexp;
|
using std::frexp;
|
||||||
using std::signbit;
|
using std::signbit;
|
||||||
|
@ -687,3 +690,5 @@ void FloatFormat::restoreXml(const Element *el)
|
||||||
maxexponent = (1<<exp_size)-1;
|
maxexponent = (1<<exp_size)-1;
|
||||||
calcPrecision();
|
calcPrecision();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file float.hh
|
/// \file float.hh
|
||||||
/// \brief Support for decoding different floating-point formats
|
/// \brief Support for decoding different floating-point formats
|
||||||
|
|
||||||
#ifndef __CPUI_FLOATFORMAT__
|
#ifndef __FLOAT_HH__
|
||||||
#define __CPUI_FLOATFORMAT__
|
#define __FLOAT_HH__
|
||||||
|
|
||||||
#include "xml.hh"
|
#include "xml.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Encoding information for a single floating-point format
|
/// \brief Encoding information for a single floating-point format
|
||||||
///
|
///
|
||||||
/// This class supports manipulation of a single floating-point encoding.
|
/// This class supports manipulation of a single floating-point encoding.
|
||||||
|
@ -96,4 +98,5 @@ public:
|
||||||
void restoreXml(const Element *el); ///< Restore the format from XML
|
void restoreXml(const Element *el); ///< Restore the format from XML
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "flow.hh"
|
#include "flow.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Prepare for tracing flow for a new function.
|
/// Prepare for tracing flow for a new function.
|
||||||
/// The Funcdata object and references to its internal containers must be explicitly given.
|
/// The Funcdata object and references to its internal containers must be explicitly given.
|
||||||
/// \param d is the new function to trace
|
/// \param d is the new function to trace
|
||||||
|
@ -1416,3 +1418,4 @@ void FlowInfo::recoverJumpTables(vector<JumpTable *> &newTables,vector<PcodeOp *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file flow.hh
|
/// \file flow.hh
|
||||||
/// \brief Utilities for following control-flow in p-code generated from machine instructions
|
/// \brief Utilities for following control-flow in p-code generated from machine instructions
|
||||||
|
|
||||||
#ifndef __CPUI_FLOW__
|
#ifndef __FLOW_HH__
|
||||||
#define __CPUI_FLOW__
|
#define __FLOW_HH__
|
||||||
|
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief A class for generating the control-flow structure for a single function
|
/// \brief A class for generating the control-flow structure for a single function
|
||||||
///
|
///
|
||||||
/// Control-flow for the function is generated in two phases: the method generateOps() produces
|
/// Control-flow for the function is generated in two phases: the method generateOps() produces
|
||||||
|
@ -165,4 +167,5 @@ public:
|
||||||
bool doesJumpRecord(void) const { return ((flags & record_jumploads)!=0); } ///< Should jump table structure be recorded
|
bool doesJumpRecord(void) const { return ((flags & record_jumploads)!=0); } ///< Should jump table structure be recorded
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "fspec.hh"
|
#include "fspec.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_CUSTOM = AttributeId("custom",114);
|
AttributeId ATTRIB_CUSTOM = AttributeId("custom",114);
|
||||||
AttributeId ATTRIB_DOTDOTDOT = AttributeId("dotdotdot",115);
|
AttributeId ATTRIB_DOTDOTDOT = AttributeId("dotdotdot",115);
|
||||||
AttributeId ATTRIB_EXTENSION = AttributeId("extension",116);
|
AttributeId ATTRIB_EXTENSION = AttributeId("extension",116);
|
||||||
|
@ -5623,3 +5625,5 @@ void FuncCallSpecs::countMatchingCalls(const vector<FuncCallSpecs *> &qlst)
|
||||||
for(;lastChange<i;++lastChange)
|
for(;lastChange<i;++lastChange)
|
||||||
copyList[lastChange]->matchCallCount = num;
|
copyList[lastChange]->matchCallCount = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file fspec.hh
|
/// \file fspec.hh
|
||||||
/// \brief Definitions for specifying functions prototypes
|
/// \brief Definitions for specifying functions prototypes
|
||||||
|
|
||||||
#ifndef __CPUI_FSPEC__
|
#ifndef __FSPEC_HH__
|
||||||
#define __CPUI_FSPEC__
|
#define __FSPEC_HH__
|
||||||
|
|
||||||
#include "op.hh"
|
#include "op.hh"
|
||||||
#include "rangemap.hh"
|
#include "rangemap.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class JoinRecord;
|
class JoinRecord;
|
||||||
|
|
||||||
extern AttributeId ATTRIB_CUSTOM; ///< Marshaling attribute "custom"
|
extern AttributeId ATTRIB_CUSTOM; ///< Marshaling attribute "custom"
|
||||||
|
@ -1717,4 +1719,5 @@ inline bool EffectRecord::operator!=(const EffectRecord &op2) const
|
||||||
return (type != op2.type);
|
return (type != op2.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
AttributeId ATTRIB_NOCODE = AttributeId("nocode",84);
|
AttributeId ATTRIB_NOCODE = AttributeId("nocode",84);
|
||||||
|
|
||||||
ElementId ELEM_AST = ElementId("ast",115);
|
ElementId ELEM_AST = ElementId("ast",115);
|
||||||
|
@ -1044,3 +1046,4 @@ void Funcdata::debugPrintRange(int4 i) const
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CPUI_FUNCDATA__
|
#ifndef __FUNCDATA_HH__
|
||||||
#define __CPUI_FUNCDATA__
|
#define __FUNCDATA_HH__
|
||||||
|
|
||||||
/// \file funcdata.hh
|
/// \file funcdata.hh
|
||||||
/// \brief Utilities for processing data structures associated with a single function
|
/// \brief Utilities for processing data structures associated with a single function
|
||||||
|
@ -26,6 +26,8 @@
|
||||||
#include "dynamic.hh"
|
#include "dynamic.hh"
|
||||||
#include "unionresolve.hh"
|
#include "unionresolve.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class FlowInfo;
|
class FlowInfo;
|
||||||
|
|
||||||
extern AttributeId ATTRIB_NOCODE; ///< Marshaling attribute "nocode"
|
extern AttributeId ATTRIB_NOCODE; ///< Marshaling attribute "nocode"
|
||||||
|
@ -682,4 +684,5 @@ extern PcodeOp *cseElimination(Funcdata &data,PcodeOp *op1,PcodeOp *op2);
|
||||||
extern void cseEliminateList(Funcdata &data,vector< pair<uintm,PcodeOp *> > &list,
|
extern void cseEliminateList(Funcdata &data,vector< pair<uintm,PcodeOp *> > &list,
|
||||||
vector<Varnode *> &outlist);
|
vector<Varnode *> &outlist);
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
#include "flow.hh"
|
#include "flow.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Funcdata members pertaining directly to blocks
|
// Funcdata members pertaining directly to blocks
|
||||||
|
|
||||||
/// A description of each block in the current structure hierarchy is
|
/// A description of each block in the current structure hierarchy is
|
||||||
|
@ -1085,3 +1087,5 @@ void Funcdata::spliceBlockBasic(BlockBasic *bl)
|
||||||
bblocks.spliceBlock(bl);
|
bblocks.spliceBlock(bl);
|
||||||
structureReset();
|
structureReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
#include "flow.hh"
|
#include "flow.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Funcdata members pertaining directly to ops
|
// Funcdata members pertaining directly to ops
|
||||||
|
|
||||||
/// \param op is the given PcodeOp
|
/// \param op is the given PcodeOp
|
||||||
|
@ -1412,3 +1414,5 @@ bool Funcdata::moveRespectingCover(PcodeOp *op,PcodeOp *lastOp)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Funcdata members pertaining directly to varnodes
|
// Funcdata members pertaining directly to varnodes
|
||||||
|
|
||||||
/// Properties of a given storage location are gathered from symbol information and
|
/// Properties of a given storage location are gathered from symbol information and
|
||||||
|
@ -2044,3 +2046,5 @@ bool AncestorRealistic::execute(PcodeOp *op,int4 slot,ParamTrial *t,bool allowFa
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "cpool_ghidra.hh"
|
#include "cpool_ghidra.hh"
|
||||||
#include "inject_ghidra.hh"
|
#include "inject_ghidra.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
//AttributeId ATTRIB_BADDATA = AttributeId("baddata",145);
|
//AttributeId ATTRIB_BADDATA = AttributeId("baddata",145);
|
||||||
|
|
||||||
ElementId ELEM_COMMAND_ISNAMEUSED = ElementId("command_isnameused",239);
|
ElementId ELEM_COMMAND_ISNAMEUSED = ElementId("command_isnameused",239);
|
||||||
|
@ -935,3 +937,4 @@ bool ArchitectureGhidra::isDynamicSymbolName(const string &nm)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file ghidra_arch.hh
|
/// \file ghidra_arch.hh
|
||||||
/// \brief Ghidra specific architecture information and connection to a Ghidra client
|
/// \brief Ghidra specific architecture information and connection to a Ghidra client
|
||||||
|
|
||||||
#ifndef __GHIDRA_ARCH__
|
#ifndef __GHIDRA_ARCH_HH__
|
||||||
#define __GHIDRA_ARCH__
|
#define __GHIDRA_ARCH_HH__
|
||||||
|
|
||||||
#include "architecture.hh"
|
#include "architecture.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern ElementId ELEM_COMMAND_ISNAMEUSED; ///< Marshaling element \<command_isnameused>
|
extern ElementId ELEM_COMMAND_ISNAMEUSED; ///< Marshaling element \<command_isnameused>
|
||||||
extern ElementId ELEM_COMMAND_GETBYTES; ///< Marshaling element \<command_getbytes>
|
extern ElementId ELEM_COMMAND_GETBYTES; ///< Marshaling element \<command_getbytes>
|
||||||
extern ElementId ELEM_COMMAND_GETCALLFIXUP; ///< Marshaling element \<command_getcallfixup>
|
extern ElementId ELEM_COMMAND_GETCALLFIXUP; ///< Marshaling element \<command_getcallfixup>
|
||||||
|
@ -166,4 +168,5 @@ public:
|
||||||
static bool isDynamicSymbolName(const string &nm); ///< Check if name is of form FUN_.. or DAT_..
|
static bool isDynamicSymbolName(const string &nm); ///< Check if name is of form FUN_.. or DAT_..
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "ghidra_context.hh"
|
#include "ghidra_context.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
const TrackedSet &ContextGhidra::getTrackedSet(const Address &addr) const
|
const TrackedSet &ContextGhidra::getTrackedSet(const Address &addr) const
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -40,3 +42,4 @@ void ContextGhidra::decodeFromSpec(Decoder &decoder)
|
||||||
decoder.skipElement(); // Ignore details handled by ghidra
|
decoder.skipElement(); // Ignore details handled by ghidra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CONTEXT_GHIDRA__
|
#ifndef __GHIDRA_CONTEXT_HH__
|
||||||
#define __CONTEXT_GHIDRA__
|
#define __GHIDRA_CONTEXT_HH__
|
||||||
|
|
||||||
/// \file ghidra_context.hh
|
/// \file ghidra_context.hh
|
||||||
/// \brief Obtaining context information from a Ghidra client
|
/// \brief Obtaining context information from a Ghidra client
|
||||||
|
@ -22,6 +22,8 @@
|
||||||
#include "globalcontext.hh"
|
#include "globalcontext.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An implementation of a ContextDatabase obtaining context information via a Ghidra client
|
/// \brief An implementation of a ContextDatabase obtaining context information via a Ghidra client
|
||||||
///
|
///
|
||||||
/// This only implements the tracked register parts of the interface. In fact, this only implements
|
/// This only implements the tracked register parts of the interface. In fact, this only implements
|
||||||
|
@ -72,4 +74,5 @@ public:
|
||||||
throw LowlevelError("getTrackedDefault should not be called for GHIDRA"); }
|
throw LowlevelError("getTrackedDefault should not be called for GHIDRA"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,9 +23,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __REMOTE_SOCKET__
|
#ifdef __REMOTE_SOCKET__
|
||||||
|
|
||||||
#include "ifacedecomp.hh"
|
#include "ifacedecomp.hh"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
|
#ifdef __REMOTE_SOCKET__
|
||||||
|
|
||||||
static IfaceStatus *ghidra_dcp = (IfaceStatus *)0;
|
static IfaceStatus *ghidra_dcp = (IfaceStatus *)0;
|
||||||
static RemoteSocket *remote = (RemoteSocket *)0;
|
static RemoteSocket *remote = (RemoteSocket *)0;
|
||||||
|
@ -502,9 +505,13 @@ void GhidraDecompCapability::initialize(void)
|
||||||
commandmap["setOptions"] = new SetOptions();
|
commandmap["setOptions"] = new SetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
int main(int argc,char **argv)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
using namespace ghidra;
|
||||||
|
|
||||||
signal(SIGSEGV, &ArchitectureGhidra::segvHandler); // Exit on SEGV errors
|
signal(SIGSEGV, &ArchitectureGhidra::segvHandler); // Exit on SEGV errors
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
// Force i/o streams to be in binary mode
|
// Force i/o streams to be in binary mode
|
||||||
|
@ -520,4 +527,3 @@ int main(int argc,char **argv)
|
||||||
}
|
}
|
||||||
GhidraCapability::shutDown();
|
GhidraCapability::shutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
/// \file ghidra_process.hh
|
/// \file ghidra_process.hh
|
||||||
/// \brief The formal commands that can be issued to the decompiler by the Ghidra client
|
/// \brief The formal commands that can be issued to the decompiler by the Ghidra client
|
||||||
|
|
||||||
#ifndef __GHIDRA_PROCESS__
|
#ifndef __GHIDRA_PROCESS_HH__
|
||||||
#define __GHIDRA_PROCESS__
|
#define __GHIDRA_PROCESS_HH__
|
||||||
|
|
||||||
#include "capability.hh"
|
#include "capability.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
@ -27,6 +27,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
||||||
|
@ -239,4 +241,5 @@ public:
|
||||||
extern void connect_to_console(Funcdata *fd);
|
extern void connect_to_console(Funcdata *fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "ghidra_translate.hh"
|
#include "ghidra_translate.hh"
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Associate a Varnode with a register name
|
/// \brief Associate a Varnode with a register name
|
||||||
///
|
///
|
||||||
/// \param nm is the register name
|
/// \param nm is the register name
|
||||||
|
@ -154,3 +156,4 @@ void GhidraTranslate::decode(Decoder &decoder)
|
||||||
decoder.closeElement(elemId);
|
decoder.closeElement(elemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file ghidra_translate.hh
|
/// \file ghidra_translate.hh
|
||||||
/// \brief Class for fetching p-code from a Ghidra client
|
/// \brief Class for fetching p-code from a Ghidra client
|
||||||
|
|
||||||
#ifndef __TRANSLATE_GHIDRA__
|
#ifndef __GHIDRA_TRANSLATE_HH__
|
||||||
#define __TRANSLATE_GHIDRA__
|
#define __GHIDRA_TRANSLATE_HH__
|
||||||
|
|
||||||
#include "translate.hh"
|
#include "translate.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An implementation of Translate that queries a Ghidra client for p-code information
|
/// \brief An implementation of Translate that queries a Ghidra client for p-code information
|
||||||
///
|
///
|
||||||
/// This class provides:
|
/// This class provides:
|
||||||
|
@ -53,4 +55,5 @@ public:
|
||||||
throw LowlevelError("Cannot dump assembly through this interface"); }
|
throw LowlevelError("Cannot dump assembly through this interface"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "globalcontext.hh"
|
#include "globalcontext.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
ElementId ELEM_CONTEXT_DATA = ElementId("context_data",120);
|
ElementId ELEM_CONTEXT_DATA = ElementId("context_data",120);
|
||||||
ElementId ELEM_CONTEXT_POINTS = ElementId("context_points",121);
|
ElementId ELEM_CONTEXT_POINTS = ElementId("context_points",121);
|
||||||
ElementId ELEM_CONTEXT_POINTSET = ElementId("context_pointset",122);
|
ElementId ELEM_CONTEXT_POINTSET = ElementId("context_pointset",122);
|
||||||
|
@ -613,3 +615,4 @@ void ContextCache::setContext(const Address &addr1,const Address &addr2,int4 num
|
||||||
curspace = (AddrSpace *)0; // Invalidate cache
|
curspace = (AddrSpace *)0; // Invalidate cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __GLOBALCONTEXT__
|
#ifndef __GLOBALCONTEXT_HH__
|
||||||
#define __GLOBALCONTEXT__
|
#define __GLOBALCONTEXT_HH__
|
||||||
|
|
||||||
/// \file globalcontext.hh
|
/// \file globalcontext.hh
|
||||||
/// \brief Utilities for getting address-based context to the disassembler and decompiler
|
/// \brief Utilities for getting address-based context to the disassembler and decompiler
|
||||||
|
@ -22,6 +22,8 @@
|
||||||
#include "pcoderaw.hh"
|
#include "pcoderaw.hh"
|
||||||
#include "partmap.hh"
|
#include "partmap.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern ElementId ELEM_CONTEXT_DATA; ///< Marshaling element \<context_data>
|
extern ElementId ELEM_CONTEXT_DATA; ///< Marshaling element \<context_data>
|
||||||
extern ElementId ELEM_CONTEXT_POINTS; ///< Marshaling element \<context_points>
|
extern ElementId ELEM_CONTEXT_POINTS; ///< Marshaling element \<context_points>
|
||||||
extern ElementId ELEM_CONTEXT_POINTSET; ///< Marshaling element \<context_pointset>
|
extern ElementId ELEM_CONTEXT_POINTSET; ///< Marshaling element \<context_pointset>
|
||||||
|
@ -328,4 +330,5 @@ public:
|
||||||
void setContext(const Address &addr1,const Address &addr2,int4 num,uintm mask,uintm value);
|
void setContext(const Address &addr1,const Address &addr2,int4 num,uintm mask,uintm value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,6 +90,8 @@
|
||||||
|
|
||||||
#include "grammar.hh"
|
#include "grammar.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern int grammarlex(void);
|
extern int grammarlex(void);
|
||||||
extern int grammarerror(const char *str);
|
extern int grammarerror(const char *str);
|
||||||
static CParse *parse;
|
static CParse *parse;
|
||||||
|
@ -484,14 +486,14 @@ static const yytype_uint8 yytranslate[] =
|
||||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||||
static const yytype_uint8 yyrline[] =
|
static const yytype_uint8 yyrline[] =
|
||||||
{
|
{
|
||||||
0, 60, 60, 61, 65, 66, 70, 71, 72, 73,
|
0, 62, 62, 63, 67, 68, 72, 73, 74, 75,
|
||||||
74, 75, 76, 77, 81, 82, 86, 91, 92, 93,
|
76, 77, 78, 79, 83, 84, 88, 93, 94, 95,
|
||||||
97, 98, 99, 100, 101, 102, 106, 107, 111, 115,
|
99, 100, 101, 102, 103, 104, 108, 109, 113, 117,
|
||||||
116, 117, 118, 122, 123, 127, 132, 133, 134, 135,
|
118, 119, 120, 124, 125, 129, 134, 135, 136, 137,
|
||||||
136, 140, 141, 145, 146, 150, 151, 155, 156, 157,
|
138, 142, 143, 147, 148, 152, 153, 157, 158, 159,
|
||||||
158, 160, 165, 166, 167, 168, 172, 173, 177, 178,
|
160, 162, 167, 168, 169, 170, 174, 175, 179, 180,
|
||||||
182, 183, 187, 188, 189, 193, 194, 195, 199, 201,
|
184, 185, 189, 190, 191, 195, 196, 197, 201, 203,
|
||||||
203, 207
|
205, 209
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3360,3 +3362,4 @@ Address parse_machaddr(istream &s,int4 &defaultsize,const TypeFactory &typegrp,b
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __CPUI_GRAMMAR__
|
#ifndef __GRAMMAR_HH__
|
||||||
#define __CPUI_GRAMMAR__
|
#define __GRAMMAR_HH__
|
||||||
|
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class GrammarToken {
|
class GrammarToken {
|
||||||
friend class GrammarLexer;
|
friend class GrammarLexer;
|
||||||
public:
|
public:
|
||||||
|
@ -288,4 +290,5 @@ extern Address parse_machaddr(istream &s,int4 &defaultsize,const TypeFactory &ty
|
||||||
extern Address parse_varnode(istream &s,int4 &size,Address &pc,uintm &uq,const TypeFactory &typegrp);
|
extern Address parse_varnode(istream &s,int4 &size,Address &pc,uintm &uq,const TypeFactory &typegrp);
|
||||||
extern Address parse_op(istream &s,uintm &uq,const TypeFactory &typegrp);
|
extern Address parse_op(istream &s,uintm &uq,const TypeFactory &typegrp);
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
%{
|
%{
|
||||||
#include "grammar.hh"
|
#include "grammar.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern int grammarlex(void);
|
extern int grammarlex(void);
|
||||||
extern int grammarerror(const char *str);
|
extern int grammarerror(const char *str);
|
||||||
static CParse *parse;
|
static CParse *parse;
|
||||||
|
@ -1567,3 +1569,4 @@ Address parse_machaddr(istream &s,int4 &defaultsize,const TypeFactory &typegrp,b
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
#include "graph.hh"
|
#include "graph.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
static void print_varnode_vertex(Varnode *vn,ostream &s)
|
static void print_varnode_vertex(Varnode *vn,ostream &s)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -496,3 +498,5 @@ void dump_dom_graph(const string &name,const BlockGraph &graph,ostream &s)
|
||||||
dump_block_vertex(graph,s,falsenode);
|
dump_block_vertex(graph,s,falsenode);
|
||||||
dump_dom_edges(graph,s,falsenode);
|
dump_dom_edges(graph,s,falsenode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -14,8 +13,16 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef __GRAPH_HH__
|
||||||
|
#define __GRAPH_HH__
|
||||||
|
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
extern void dump_dataflow_graph(Funcdata &data,ostream &s);
|
extern void dump_dataflow_graph(Funcdata &data,ostream &s);
|
||||||
extern void dump_controlflow_graph(const string &name,const BlockGraph &graph,ostream &s);
|
extern void dump_controlflow_graph(const string &name,const BlockGraph &graph,ostream &s);
|
||||||
extern void dump_dom_graph(const string &name,const BlockGraph &graph,ostream &s);
|
extern void dump_dom_graph(const string &name,const BlockGraph &graph,ostream &s);
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "funcdata.hh"
|
#include "funcdata.hh"
|
||||||
#include "prefersplit.hh"
|
#include "prefersplit.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Update disjoint cover making sure (addr,size) is contained in a single element and return
|
/// Update disjoint cover making sure (addr,size) is contained in a single element and return
|
||||||
/// an iterator to this element. The element's \b pass number is set to be the smallest value
|
/// an iterator to this element. The element's \b pass number is set to be the smallest value
|
||||||
/// of any previous intersecting element. Additionally an \b intersect code is passed back:
|
/// of any previous intersecting element. Additionally an \b intersect code is passed back:
|
||||||
|
@ -2670,3 +2672,5 @@ void Heritage::clear(void)
|
||||||
maxdepth = -1;
|
maxdepth = -1;
|
||||||
pass = 0;
|
pass = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -17,11 +17,13 @@
|
||||||
/// \file heritage.hh
|
/// \file heritage.hh
|
||||||
/// \brief Utilities for building Static Single Assignment (SSA) form
|
/// \brief Utilities for building Static Single Assignment (SSA) form
|
||||||
|
|
||||||
#ifndef __CPUI_HERITAGE__
|
#ifndef __HERITAGE_HH__
|
||||||
#define __CPUI_HERITAGE__
|
#define __HERITAGE_HH__
|
||||||
|
|
||||||
#include "block.hh"
|
#include "block.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// Container holding the stack system for the renaming algorithm. Every disjoint address
|
/// Container holding the stack system for the renaming algorithm. Every disjoint address
|
||||||
/// range (indexed by its initial address) maps to its own Varnode stack.
|
/// range (indexed by its initial address) maps to its own Varnode stack.
|
||||||
typedef map<Address,vector<Varnode *> > VariableStack;
|
typedef map<Address,vector<Varnode *> > VariableStack;
|
||||||
|
@ -294,4 +296,5 @@ public:
|
||||||
const LoadGuard *getStoreGuard(PcodeOp *op) const; ///< Get LoadGuard record associated with given PcodeOp
|
const LoadGuard *getStoreGuard(PcodeOp *op) const; ///< Get LoadGuard record associated with given PcodeOp
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,8 @@ extern "C" {
|
||||||
#include "pcodeparse.hh"
|
#include "pcodeparse.hh"
|
||||||
#include "blockaction.hh"
|
#include "blockaction.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Constructing this registers the capability
|
// Constructing this registers the capability
|
||||||
IfaceDecompCapability IfaceDecompCapability::ifaceDecompCapability;
|
IfaceDecompCapability IfaceDecompCapability::ifaceDecompCapability;
|
||||||
|
|
||||||
|
@ -3612,3 +3614,5 @@ void IfcSource::execute(istream &s)
|
||||||
s >> filename;
|
s >> filename;
|
||||||
status->pushScript(filename,filename+"> ");
|
status->pushScript(filename,filename+"> ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
/// \file ifacedecomp.hh
|
/// \file ifacedecomp.hh
|
||||||
/// \brief Console interface commands for the decompiler engine
|
/// \brief Console interface commands for the decompiler engine
|
||||||
|
|
||||||
#ifndef __IFACE_DECOMP__
|
#ifndef __IFACEDECOMP_HH__
|
||||||
#define __IFACE_DECOMP__
|
#define __IFACEDECOMP_HH__
|
||||||
|
|
||||||
#include "graph.hh"
|
#include "graph.hh"
|
||||||
#include "grammar.hh"
|
#include "grammar.hh"
|
||||||
|
@ -28,6 +28,8 @@
|
||||||
#include "rulecompile.hh"
|
#include "rulecompile.hh"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Interface capability point for all decompiler commands
|
/// \brief Interface capability point for all decompiler commands
|
||||||
class IfaceDecompCapability : public IfaceCapability {
|
class IfaceDecompCapability : public IfaceCapability {
|
||||||
static IfaceDecompCapability ifaceDecompCapability; ///< Singleton instance
|
static IfaceDecompCapability ifaceDecompCapability; ///< Singleton instance
|
||||||
|
@ -656,4 +658,5 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "ifaceterm.hh"
|
#include "ifaceterm.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
IfaceTerm::IfaceTerm(const string &prmpt,istream &is,ostream &os)
|
IfaceTerm::IfaceTerm(const string &prmpt,istream &is,ostream &os)
|
||||||
: IfaceStatus(prmpt,os)
|
: IfaceStatus(prmpt,os)
|
||||||
{
|
{
|
||||||
|
@ -265,3 +267,5 @@ bool IfaceTerm::isStreamFinished(void) const
|
||||||
if (done||inerror) return true;
|
if (done||inerror) return true;
|
||||||
return sptr->eof();
|
return sptr->eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
/// \file ifaceterm.hh
|
/// \file ifaceterm.hh
|
||||||
/// \brief Add some terminal capabilities to the command-line interface (IfaceStatus)
|
/// \brief Add some terminal capabilities to the command-line interface (IfaceStatus)
|
||||||
|
|
||||||
|
#ifndef __IFACETERM_HH__
|
||||||
|
#define __IFACETERM_HH__
|
||||||
|
|
||||||
#include "interface.hh"
|
#include "interface.hh"
|
||||||
|
|
||||||
#ifdef __TERMINAL__
|
#ifdef __TERMINAL__
|
||||||
|
@ -25,6 +28,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Implement the command-line interface on top of a specific input stream
|
/// \brief Implement the command-line interface on top of a specific input stream
|
||||||
///
|
///
|
||||||
/// An initial input stream is provided as the base stream to parse for commands.
|
/// An initial input stream is provided as the base stream to parse for commands.
|
||||||
|
@ -48,3 +53,6 @@ public:
|
||||||
virtual void popScript(void);
|
virtual void popScript(void);
|
||||||
virtual bool isStreamFinished(void) const;
|
virtual bool isStreamFinished(void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "inject_ghidra.hh"
|
#include "inject_ghidra.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
void InjectContextGhidra::encode(Encoder &encoder) const
|
void InjectContextGhidra::encode(Encoder &encoder) const
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -230,3 +232,5 @@ int4 PcodeInjectLibraryGhidra::manualCallOtherFixup(const string &name,const str
|
||||||
{
|
{
|
||||||
return 0; // We don't have to do anything
|
return 0; // We don't have to do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file inject_ghidra.hh
|
/// \file inject_ghidra.hh
|
||||||
/// \brief P-code injection classes using a Ghidra client as the back-end for generating p-code
|
/// \brief P-code injection classes using a Ghidra client as the back-end for generating p-code
|
||||||
|
|
||||||
#ifndef __INJECT_GHIDRA__
|
#ifndef __INJECT_GHIDRA_HH__
|
||||||
#define __INJECT_GHIDRA__
|
#define __INJECT_GHIDRA_HH__
|
||||||
|
|
||||||
#include "pcodeinject.hh"
|
#include "pcodeinject.hh"
|
||||||
#include "ghidra_arch.hh"
|
#include "ghidra_arch.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief An injection context that can be serialized and sent to the Ghidra client
|
/// \brief An injection context that can be serialized and sent to the Ghidra client
|
||||||
///
|
///
|
||||||
/// This adds the capability to wrap up the context data in \<context> XML tag
|
/// This adds the capability to wrap up the context data in \<context> XML tag
|
||||||
|
@ -91,4 +93,5 @@ public:
|
||||||
virtual const vector<OpBehavior *> &getBehaviors(void);
|
virtual const vector<OpBehavior *> &getBehaviors(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "pcodeparse.hh"
|
#include "pcodeparse.hh"
|
||||||
#include "architecture.hh"
|
#include "architecture.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
InjectContextSleigh::~InjectContextSleigh(void)
|
InjectContextSleigh::~InjectContextSleigh(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -468,3 +470,5 @@ int4 PcodeInjectLibrarySleigh::manualCallOtherFixup(const string &name,const str
|
||||||
registerInject(injectid);
|
registerInject(injectid);
|
||||||
return injectid;
|
return injectid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -13,12 +13,14 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef __INJECT_SLEIGH__
|
#ifndef __INJECT_SLEIGH_HH__
|
||||||
#define __INJECT_SLEIGH__
|
#define __INJECT_SLEIGH_HH__
|
||||||
|
|
||||||
#include "pcodeinject.hh"
|
#include "pcodeinject.hh"
|
||||||
#include "sleigh.hh"
|
#include "sleigh.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class InjectContextSleigh : public InjectContext {
|
class InjectContextSleigh : public InjectContext {
|
||||||
public:
|
public:
|
||||||
PcodeCacher cacher;
|
PcodeCacher cacher;
|
||||||
|
@ -109,4 +111,5 @@ public:
|
||||||
virtual const vector<OpBehavior *> &getBehaviors(void);
|
virtual const vector<OpBehavior *> &getBehaviors(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "ext/stdio_filebuf.h"
|
#include "ext/stdio_filebuf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
vector<IfaceCapability *> IfaceCapability::thelist;
|
vector<IfaceCapability *> IfaceCapability::thelist;
|
||||||
|
|
||||||
void IfaceCapability::initialize(void)
|
void IfaceCapability::initialize(void)
|
||||||
|
@ -612,3 +614,5 @@ void IfcEcho::execute(istream &s)
|
||||||
status->fileoptr->put(c);
|
status->fileoptr->put(c);
|
||||||
*status->fileoptr << endl;
|
*status->fileoptr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
/// \file interface.hh
|
/// \file interface.hh
|
||||||
/// \brief Classes and utilities for a \e generic command-line interface
|
/// \brief Classes and utilities for a \e generic command-line interface
|
||||||
|
|
||||||
#ifndef __INTERFACE__
|
#ifndef __INTERFACE_HH__
|
||||||
#define __INTERFACE__
|
#define __INTERFACE_HH__
|
||||||
|
|
||||||
#include "capability.hh"
|
#include "capability.hh"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -26,6 +26,8 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::istream;
|
using std::istream;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
@ -295,4 +297,5 @@ public:
|
||||||
virtual void execute(istream &s);
|
virtual void execute(istream &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
#include "emulate.hh"
|
#include "emulate.hh"
|
||||||
#include "flow.hh"
|
#include "flow.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
|
|
||||||
AttributeId ATTRIB_LABEL = AttributeId("label",131);
|
AttributeId ATTRIB_LABEL = AttributeId("label",131);
|
||||||
AttributeId ATTRIB_NUM = AttributeId("num",132);
|
AttributeId ATTRIB_NUM = AttributeId("num",132);
|
||||||
|
|
||||||
|
@ -2811,3 +2814,5 @@ bool JumpTable::checkForMultistage(Funcdata *fd)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/// \file jumptable.hh
|
/// \file jumptable.hh
|
||||||
/// \brief Classes to support jump-tables and their recovery
|
/// \brief Classes to support jump-tables and their recovery
|
||||||
|
|
||||||
#ifndef __CPUI_JUMPTABLE__
|
#ifndef __JUMPTABLE_HH__
|
||||||
#define __CPUI_JUMPTABLE__
|
#define __JUMPTABLE_HH__
|
||||||
|
|
||||||
#include "emulateutil.hh"
|
#include "emulateutil.hh"
|
||||||
#include "rangeutil.hh"
|
#include "rangeutil.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
class EmulateFunction;
|
class EmulateFunction;
|
||||||
|
|
||||||
extern AttributeId ATTRIB_LABEL; ///< Marshaling attribute "label"
|
extern AttributeId ATTRIB_LABEL; ///< Marshaling attribute "label"
|
||||||
|
@ -601,4 +603,5 @@ inline bool JumpTable::IndexPair::compareByPosition(const IndexPair &op1,const I
|
||||||
return (op1.blockPosition < op2.blockPosition);
|
return (op1.blockPosition < op2.blockPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "libdecomp.hh"
|
#include "libdecomp.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
void startDecompilerLibrary(const char *sleighhome)
|
void startDecompilerLibrary(const char *sleighhome)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -59,3 +61,4 @@ void shutdownDecompilerLibrary(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -17,13 +17,15 @@
|
||||||
// You should be able to include this header to get all functionality
|
// You should be able to include this header to get all functionality
|
||||||
// and we put a startup and shutdown routine here
|
// and we put a startup and shutdown routine here
|
||||||
|
|
||||||
#ifndef __LIBDECOMP__
|
#ifndef __LIBDECOMP_HH__
|
||||||
#define __LIBDECOMP__
|
#define __LIBDECOMP_HH__
|
||||||
|
|
||||||
#include "architecture.hh"
|
#include "architecture.hh"
|
||||||
#include "sleigh_arch.hh"
|
#include "sleigh_arch.hh"
|
||||||
#include "ifacedecomp.hh"
|
#include "ifacedecomp.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
// Initialize all decompiler capabilities and register any sleigh specifications
|
// Initialize all decompiler capabilities and register any sleigh specifications
|
||||||
// If you have an entire ghidra distribution, you can specify its root with the -sleighhome- input,
|
// If you have an entire ghidra distribution, you can specify its root with the -sleighhome- input,
|
||||||
// otherwise you can provide a list of directories that contain '.lspec' files.
|
// otherwise you can provide a list of directories that contain '.lspec' files.
|
||||||
|
@ -33,4 +35,5 @@ extern void startDecompilerLibrary(const char *sleighhome,const vector<string> &
|
||||||
|
|
||||||
extern void shutdownDecompilerLibrary(void);
|
extern void shutdownDecompilerLibrary(void);
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
#include "loadimage.hh"
|
#include "loadimage.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// This is a convenience method wrapped around the core
|
/// This is a convenience method wrapped around the core
|
||||||
/// loadFill() routine. It automatically allocates an array
|
/// loadFill() routine. It automatically allocates an array
|
||||||
/// of the desired size, and then fills it with load image data.
|
/// of the desired size, and then fills it with load image data.
|
||||||
|
@ -110,3 +112,5 @@ void RawLoadImage::loadFill(uint1 *ptr,int4 size,const Address &addr)
|
||||||
throw DataUnavailError(errmsg.str());
|
throw DataUnavailError(errmsg.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
/// \file loadimage.hh
|
/// \file loadimage.hh
|
||||||
/// \brief Classes and API for accessing a binary load image
|
/// \brief Classes and API for accessing a binary load image
|
||||||
|
|
||||||
#ifndef __CPUI_LOADIMAGE__
|
#ifndef __LOADIMAGE_HH__
|
||||||
#define __CPUI_LOADIMAGE__
|
#define __LOADIMAGE_HH__
|
||||||
|
|
||||||
#include "address.hh"
|
#include "address.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
/// \brief Exception indicating data was not available
|
/// \brief Exception indicating data was not available
|
||||||
///
|
///
|
||||||
/// This exception is thrown when a request for load image
|
/// This exception is thrown when a request for load image
|
||||||
|
@ -224,4 +226,5 @@ inline void LoadImage::getReadonly(RangeList &list) const {
|
||||||
/// \param size is the number of bytes to retrieve from the image
|
/// \param size is the number of bytes to retrieve from the image
|
||||||
/// \param addr is the starting address of the bytes to retrieve
|
/// \param addr is the starting address of the bytes to retrieve
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
#include "loadimage_bfd.hh"
|
#include "loadimage_bfd.hh"
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
int4 LoadImageBfd::bfdinit = 0; // Global initialization variable
|
int4 LoadImageBfd::bfdinit = 0; // Global initialization variable
|
||||||
|
|
||||||
LoadImageBfd::LoadImageBfd(const string &f,const string &t) : LoadImage(f)
|
LoadImageBfd::LoadImageBfd(const string &f,const string &t) : LoadImage(f)
|
||||||
|
@ -297,3 +299,5 @@ void LoadImageBfd::getReadonly(RangeList &list) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
// Use the GNU bfd library to manipulate a load image
|
// Use the GNU bfd library to manipulate a load image
|
||||||
|
|
||||||
#ifndef __LOADIMAGE_BFD__
|
#ifndef __LOADIMAGE_BFD_HH__
|
||||||
#define __LOADIMAGE_BFD__
|
#define __LOADIMAGE_BFD_HH__
|
||||||
|
|
||||||
#include "loadimage.hh"
|
#include "loadimage.hh"
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
#undef __LOADIMAGE_BFD__DEFINED_PACKAGE_VERSION
|
#undef __LOADIMAGE_BFD__DEFINED_PACKAGE_VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ghidra {
|
||||||
|
|
||||||
struct ImportRecord {
|
struct ImportRecord {
|
||||||
string dllname;
|
string dllname;
|
||||||
string funcname;
|
string funcname;
|
||||||
|
@ -88,4 +90,5 @@ public:
|
||||||
virtual void adjustVma(long adjust);
|
virtual void adjustVma(long adjust);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End namespace ghidra
|
||||||
#endif
|
#endif
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue