-
Notifications
You must be signed in to change notification settings - Fork 21
/
debug.cc
70 lines (63 loc) · 1.89 KB
/
debug.cc
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
// debug.cc -- May 10, 2009
// by geohot
// part of "The Embedded Disassembler"
// released under GPLv3, see http://gplv3.fsf.org/
//
// Various functions to assist debugging
#include "data.h"
#include "debug.h"
#include <iostream>
#include <iomanip>
using namespace std;
void eda::DebugPrint(Changelist* a) {
if (a == NULL) {
cout << "This is a null pointer" << endl;
return;
}
cout << "Changelist number: " << a->get_changelist_number() << endl;
cout << "Owned by: " << a->get_owner()->get_name() << endl;
bool first = true;
if (a->get_size() > 0) {
ChangelistIterator it;
a->get_first_change(&it);
do {
if(it->first->get_name() != "") {
if(!first) cout << endl;
else first = false;
cout << hex << setfill(' ') << setw(4) << hex << it->first->get_name() << " = " << setw(2) << setfill('0') << (uint32_t)it->second;
} else
cout << hex << " " << setw(2) << setfill('0') << (uint32_t)it->second;
} while(a->get_next_change(&it));
cout << endl;
}
else
cout << "This is a blank Changelist" << endl;
}
void eda::DebugPrint(StatelessChangelist* a) {
if (a == NULL) {
cout << "This is a null pointer" << endl;
return;
}
if (a->get_size() > 0) {
StatelessChangelistIterator it;
a->get_first_change(&it);
do {
cout << setw(4) << it->first.first << "(" << it->second.first << ") (" << it->first.second << ")= " << it->second.second << endl;
} while(a->get_next_change(&it));
}
else
cout << "This is a blank Changelist" << endl;
}
void eda::DebugPrint(vector<int>* v) {
for (vector<int>::iterator it = v->begin(); it != v->end(); ++it) {
cout << (*it) << " ";
}
cout << endl;
}
void eda::DebugPrint(ParsedInstruction* i) {
/*for (vector<string>::iterator it = i->args_.begin(); it != i->args_.end(); ++it) {
cout << *it;
}
cout << endl;*/
cout << i->GetConsoleString() << endl;
}