Don't crash trying to print bytecode for unreachable switch targets
In some circumstances, the label associated with a branch doesn't get set, and the corresponding branch target ends up pointing to one byte before the start of the unit's bytecode. In that case, we were crashing when trying to dump the bytecode.
Esse commit está contido em:
+23
-19
@@ -793,25 +793,29 @@ std::string instrToString(const Opcode* it, const Unit* u /* = NULL */) {
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define READSVEC() do { \
|
||||
int sz = readData<int>(it); \
|
||||
out << " <"; \
|
||||
const char* sep = ""; \
|
||||
for (int i = 0; i < sz; ++i) { \
|
||||
out << sep; \
|
||||
if (op == OpSSwitch) { \
|
||||
READLITSTR(""); \
|
||||
out << ":"; \
|
||||
} \
|
||||
Offset o = readData<Offset>(it); \
|
||||
if (u != nullptr) { \
|
||||
out << u->offsetOf(iStart + o); \
|
||||
} else { \
|
||||
out << o; \
|
||||
} \
|
||||
sep = " "; \
|
||||
} \
|
||||
out << ">"; \
|
||||
#define READSVEC() do { \
|
||||
int sz = readData<int>(it); \
|
||||
out << " <"; \
|
||||
const char* sep = ""; \
|
||||
for (int i = 0; i < sz; ++i) { \
|
||||
out << sep; \
|
||||
if (op == OpSSwitch) { \
|
||||
READLITSTR(""); \
|
||||
out << ":"; \
|
||||
} \
|
||||
Offset o = readData<Offset>(it); \
|
||||
if (u != nullptr) { \
|
||||
if (iStart + o == u->entry() - 1) { \
|
||||
out << "Invalid"; \
|
||||
} else { \
|
||||
out << u->offsetOf(iStart + o); \
|
||||
} \
|
||||
} else { \
|
||||
out << o; \
|
||||
} \
|
||||
sep = " "; \
|
||||
} \
|
||||
out << ">"; \
|
||||
} while (false)
|
||||
|
||||
#define ONE(a) H_##a
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário