1#ifndef ROSE_BinaryAnalysis_SRecord_H 
    2#define ROSE_BinaryAnalysis_SRecord_H 
    3#include <featureTests.h> 
    4#ifdef ROSE_ENABLE_BINARY_ANALYSIS 
    6#include <Rose/BinaryAnalysis/Address.h> 
    7#include <Rose/BinaryAnalysis/AddressIntervalSet.h> 
    8#include <Rose/BinaryAnalysis/MemoryMap.h> 
   10#include <Sawyer/Optional.h> 
   17namespace BinaryAnalysis {
 
   74    std::vector<uint8_t> data_;
 
   88        : type_(
type), addr_(addr), data_(
data) {}
 
 
   90        : type_(
type), addr_(addr), data_(buffer+0, buffer+bufsz) {}
 
 
  107    static std::vector<SRecord> 
parse(std::istream&);
 
  127                                             unsigned accessPermissions, 
const std::string &segmentName,
 
  189    const std::vector<uint8_t>& 
data()
 const { 
return data_; }
 
  190    std::vector<uint8_t>& 
data() { 
return data_; }
 
  197    const std::string& 
error()
 const { 
return error_; }
 
  210        size_t nDataRecords_;
 
  214            : nDataRecords_(0) {}
 
 
 
 
Clobber
Overwrite (parts of) existing segments?
 
Run-length encoding information.
 
void insert(const SRecord &)
Insert an S-Record into the data sumarized by this class.
 
RunLengthEncoding()
Default constructor.
 
Sawyer::Optional< Address > dataAddress(const SRecord &) const
Returns the memory address for the start of a data record, or nothing.
 
size_t nDataRecords() const
Number of data records seen.
 
Address baseDataAddress() const
Base data address.
 
Sawyer::Optional< Address > executionAddress() const
Returns the execution starting address if one was specified.
 
S-Record hexadecimal data formats.
 
const std::string & error() const
Property: record error messsage.
 
static AddressIntervalSet dataAddresses(const std::vector< SRecord > &)
Addresses occupied by all data.
 
static Sawyer::Optional< Address > load(const std::vector< SRecord > &, const MemoryMapPtr &)
Load S-Records into a memory map.
 
const std::vector< uint8_t > & data() const
Property: record data.
 
std::vector< uint8_t > & data()
Property: record data.
 
static SRecord parse(const std::string &)
Construct an S-Record by parsing a string.
 
void print(std::ostream &) const
Print an S-Record to a stream.
 
static size_t addressNBytes(Type)
Size of address in bytes.
 
static Sawyer::Optional< Address > load(const std::vector< SRecord > &, const MemoryMapPtr &, Address alignment, unsigned accessPerms, const std::string &name, MemoryMap::Clobber)
Load S-Records into a memory map, creating segments if necessary.
 
static Sawyer::Optional< Address > parseBigEndianInteger(const std::string &, size_t start, size_t nChars)
Parse a hexadecimal string to an unsigned integer.
 
static SRecord parseMotorola(const std::string &)
Construct a Motorola S-Record by parsing a string.
 
SRecord & address(Address addr)
Property: record starting address.
 
friend std::ostream & operator<<(std::ostream &, const SRecord &)
Print an S-Record to a stream.
 
static std::vector< SRecord > create(const MemoryMapPtr &, Syntax, size_t bytesPerRecord=28, size_t preferredAddrSize=4)
Create S-Records from a memory map.
 
SRecord & type(Type type)
Property: record type.
 
static std::vector< SRecord > parse(std::istream &)
Construct S-Records by parsing a file.
 
Address address() const
Property: record starting address.
 
Syntax syntax() const
Property: syntax family.
 
SRecord(Type type, Address addr, const std::vector< uint8_t > data)
Construct an S-Record with data.
 
static unsigned bigEndian(const std::vector< uint8_t > &data, size_t nBytes)
Convert the first few bytes of the buffer to a big-endian integer.
 
std::string toString() const
Convert an S-Record to a string.
 
SRecord & data(const std::vector< uint8_t > &data)
Property: record data.
 
Type type() const
Property: record type.
 
static AddressIntervalSet createSegments(const std::vector< SRecord > &, const MemoryMapPtr &map, Address alignment, unsigned accessPermissions, const std::string &segmentName, MemoryMap::Clobber clobber)
Create segments for S-Records.
 
SRecord & error(const std::string &error)
Property: record error messsage.
 
static SRecord parseIntel(const std::string &)
Construct an Intel S-Record by parsing a string.
 
SRecord()
Construct an empty S-Record.
 
SRecord(Type type, Address addr, const uint8_t *buffer, size_t bufsz)
Construct an S-Record with data.
 
static uint8_t checksum(Syntax, const std::string &, size_t start, size_t n)
Compute a checksum for part of a record.
 
Syntax
Syntax of the S-Record.
 
@ SREC_UNKNOWN_SYNTAX
Unknown or no syntax.
 
@ SREC_MOTOROLA
Motorola syntax S-Record.
 
@ SREC_INTEL
Intel syntax S-Record.
 
@ SREC_M_RESERVED
Motorola reserved.
 
@ SREC_M_DATA16
Motorola data with 16-bit address.
 
@ SREC_M_COUNT24
Motorola 24-bit count of data records.
 
@ SREC_M_DATA24
Motorola data with 24-bit address.
 
@ SREC_M_COUNT16
Motorola 16-bit count of data records.
 
@ SREC_M_START16
Motorola 16-bit starting address.
 
@ SREC_I_EXTENDED_SA
Intel extended segment address.
 
@ SREC_I_END
Intel end record.
 
@ SREC_I_START_SA
Intel starting segment address.
 
@ SREC_I_DATA
Intel data record.
 
@ SREC_UNKNOWN_TYPE
Not a valid S-Record.
 
@ SREC_M_DATA32
Motorola data with 32-bit address.
 
@ SREC_I_EXTENDED_LA
Intel extended linear address.
 
@ SREC_M_START32
Motorola 32-bit starting address.
 
@ SREC_I_START_LA
Intel starting linear address.
 
@ SREC_M_START24
Motorola 24-bit starting address.
 
@ SREC_M_HEADER
Motorola vendor-specific header, usually NUL-terminated ASCII.
 
Holds a value or nothing.
 
std::uint64_t Address
Address.