-
Notifications
You must be signed in to change notification settings - Fork 9
/
bpt_operation_event.cpp
72 lines (60 loc) · 1.63 KB
/
bpt_operation_event.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "bpt_events.hpp"
#include "bpt_bytes_io.hpp"
#include "bpt_visitor.hpp"
namespace bpt {
struct operation_event::impl {
impl(const char* d, OPCODE o, ADDRINT a, UINT32 size, THREADID t)
: disasm(d)
, opcode(o)
, addr(a)
, tid(t)
, bytes(io::from_mem(addr, size)) {}
const char* disasm;
OPCODE opcode;
ADDRINT addr;
THREADID tid;
bytes_type bytes;
};
operation_event::operation_event(const char* disasm, OPCODE opcode,
ADDRINT addr, UINT32 size, THREADID tid)
: pimpl(new impl(disasm, opcode, addr, size, tid)) {}
OPCODE operation_event::opcode() const {
return pimpl->opcode;
}
ADDRINT operation_event::addr() const {
return pimpl->addr;
}
THREADID operation_event::tid() const {
return pimpl->tid;
}
const bytes_type& operation_event::bytes() const {
return pimpl->bytes;
}
std::string operation_event::name() const {
return OPCODE_StringShort(pimpl->opcode);
}
const char* operation_event::disasm() const {
return pimpl->disasm;
}
void operation_event::do_accept(visitor& out) const {
out.visit(*this);
}
std::ostream& operation_event::operator<<(std::ostream& out) const {
using namespace io::code;
return out << this->name()
<< '('
<< this->tid()
<< ','
<< "0x"
<< std::hex
<< this->addr()
<< std::dec
<< ':'
<< sizeof(ADDRINT)*8
<< ')'
<< '['
<< this->bytes()
<< "] "
<< this->disasm();
}
} //namespace bpt