Add the missing operator<< for InstructionSet and use it in the disassembler.
Change-Id: I9de4a8a00d9fcbad79f6893eff2aa28aafa8e6e3
diff --git a/src/constants.cc b/src/constants.cc
index c32f136..65af2fb 100644
--- a/src/constants.cc
+++ b/src/constants.cc
@@ -18,6 +18,18 @@
namespace art {
+std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs) {
+ switch (rhs) {
+ case kNone: os << "none"; break;
+ case kArm: os << "ARM"; break;
+ case kThumb2: os << "Thumb2"; break;
+ case kX86: os << "x86"; break;
+ case kMips: os << "MIPS"; break;
+ default: os << "InstructionSet[" << static_cast<int>(rhs) << "]"; break;
+ }
+ return os;
+}
+
std::ostream& operator<<(std::ostream& os, const InvokeType& rhs) {
switch (rhs) {
case kStatic: os << "static"; break;
diff --git a/src/constants.h b/src/constants.h
index bb17c2d..832d6f7 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -29,6 +29,8 @@
kMips
};
+std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs);
+
enum InvokeType {
kStatic, kDirect, kVirtual, kSuper, kInterface,
kMaxInvokeType = kInterface
diff --git a/src/disassembler.cc b/src/disassembler.cc
index ae781dc..5e3f500 100644
--- a/src/disassembler.cc
+++ b/src/disassembler.cc
@@ -27,8 +27,7 @@
if (instruction_set == kArm || instruction_set == kThumb2) {
return new arm::DisassemblerArm();
} else {
- // TODO: give a better fatal message
- UNIMPLEMENTED(FATAL);
+ UNIMPLEMENTED(FATAL) << "no disassembler for " << instruction_set;
return NULL;
}
}