diff options
Diffstat (limited to 'src/processor/cfi_frame_info.cc')
-rw-r--r-- | src/processor/cfi_frame_info.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/processor/cfi_frame_info.cc b/src/processor/cfi_frame_info.cc index 0cca6646..668bdeb8 100644 --- a/src/processor/cfi_frame_info.cc +++ b/src/processor/cfi_frame_info.cc @@ -33,6 +33,7 @@ // See cfi_frame_info.h for details. #include <cstring> +#include <sstream> #include "processor/cfi_frame_info.h" #include "processor/postfix_evaluator-inl.h" @@ -94,6 +95,28 @@ template bool CFIFrameInfo::FindCallerRegs<u_int64_t>( const MemoryRegion &memory, RegisterValueMap<u_int64_t> *caller_registers) const; +string CFIFrameInfo::Serialize() const { + std::ostringstream stream; + + if (!cfa_rule_.empty()) { + stream << ".cfa: " << cfa_rule_; + } + if (!ra_rule_.empty()) { + if (stream.tellp() != 0) + stream << " "; + stream << ".ra: " << ra_rule_; + } + for (RuleMap::const_iterator iter = register_rules_.begin(); + iter != register_rules_.end(); + ++iter) { + if (stream.tellp() != 0) + stream << " "; + stream << iter->first << ": " << iter->second; + } + + return stream.str(); +} + bool CFIRuleParser::Parse(const string &rule_set) { size_t rule_set_len = rule_set.size(); scoped_array<char> working_copy(new char[rule_set_len + 1]); |