1 #ifndef ROSE_BinaryAnalysis_VxcoreParser_H
2 #define ROSE_BinaryAnalysis_VxcoreParser_H
4 #include <featureTests.h>
5 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
7 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/RegisterState.h>
8 #include <boost/filesystem.hpp>
9 #include <boost/lexical_cast.hpp>
10 #include <Rose/Diagnostics.h>
11 #include <Rose/BinaryAnalysis/MemoryMap.h>
12 #include <Rose/StringUtility.h>
15 namespace BinaryAnalysis {
52 boost::filesystem::path fileName_;
57 Exception(
const boost::filesystem::path &fileName,
size_t offset,
const std::string &what)
58 :
Rose::
Exception(what), fileName_(fileName), offset_(offset) {}
64 return StringUtility::cEscape(fileName_.string()) +
":" + boost::lexical_cast<std::string>(offset_) +
": " + what();
70 void print(std::ostream &out)
const {
74 friend std::ostream& operator<<(std::ostream &out,
const Exception &e) {
86 static void initDiagnostics();
103 boost::filesystem::path
parseUrl(
const std::string&);
138 const std::string &outputName =
"output");
141 const std::string &outputName =
"output");
145 const std::string &outputName =
"output");
151 const std::string&
isaName()
const {
return isaName_; }
158 bool parseMemory(
const std::string &header, std::istream&,
const MemoryMap::Ptr&,
const std::string &inputName,
159 size_t headerOffset);
164 const std::string &inputName,
size_t headerOffset);
Exception(const boost::filesystem::path &fileName, size_t offset, const std::string &what)
Create a new exception with a location and error message.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
void print(std::ostream &out) const
Emit this exception to a stream.
unsigned version
Format version number.
void settings(const Settings &s)
Property: Settings for parsing and unparsing.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
Main namespace for the ROSE library.
ROSE_UTIL_API std::string cEscape(const std::string &, char context= '"')
Escapes characters that are special to C/C++.
const Settings & settings() const
Property: Settings for parsing and unparsing.
Exception thrown for parse errors.
void parse(const boost::filesystem::path &, const MemoryMap::Ptr &)
Parse input file.
Settings & settings()
Property: Settings for parsing and unparsing.
void unparse(std::ostream &, const MemoryMap::Ptr &, const AddressInterval &memoryLimit, const std::string &outputName="output")
Unparse memory and/or registers to this format.
static Sawyer::Message::Facility mlog
Diagnostic facility for vxcore file format.
Sawyer::Optional< unsigned > protOverride
Memory protection to overrides parsed values.
Parser for Vxcore format files.
unsigned protDefault
Default memory protection when none are specified or overridden.
boost::filesystem::path parseUrl(const std::string &)
Parse a URL and adjust the settings.
const std::string & isaName() const
Parsed instruction set architecture name.
Base class for all ROSE exceptions.
Settings that control the parser and unparser.
std::string toString() const
Render this exception as a string.