}
void visit(StackFrame *frame) {
- if (frame->module != NULL) {
- os << frame->module << " ";
- }
- if (frame->function != NULL) {
- os << "at " << frame->function << "() ";
- }
- if (frame->filename != NULL) {
- os << "at " << frame->filename;
- if (frame->linenumber >= 0) {
- os << ":" << frame->linenumber << " ";
- }
- }
- else {
- if (frame->offset >= 0) {
- os << "[" << "0x" << std::hex << frame->offset << std::dec << "]";
- }
- }
+ frame->dump(os);
}
void visit(Backtrace & backtrace) {
#include <map>
#include <vector>
+#include <ostream>
namespace trace {
offset(-1)
{
}
+
+ void dump(std::ostream &os) {
+ os << (this->module ? this->module : "?");
+ if (this->function != NULL) {
+ os << ": " << this->function;
+ }
+ if (this->offset >= 0) {
+ os << "+0x" << std::hex << this->offset << std::dec;
+ }
+ if (this->filename != NULL) {
+ os << ": " << this->filename;
+ if (this->linenumber >= 0) {
+ os << ":" << this->linenumber;
+ }
+ }
+ }
};
class StackFrame : public RawStackFrame {