return j.first >= i.first && j.first < i.first + Length;
}
-static uint64_t DumpDataInCode(const char *bytes, uint64_t Length,
+static uint64_t DumpDataInCode(const uint8_t *bytes, uint64_t Length,
unsigned short Kind) {
uint32_t Value, Size = 1;
case MachO::DICE_KIND_DATA:
if (Length >= 4) {
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 4));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 4));
Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
outs() << "\t.long " << Value;
Size = 4;
} else if (Length >= 2) {
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 2));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 2));
Value = bytes[1] << 8 | bytes[0];
outs() << "\t.short " << Value;
Size = 2;
} else {
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 2));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 2));
Value = bytes[0];
outs() << "\t.byte " << Value;
Size = 1;
break;
case MachO::DICE_KIND_JUMP_TABLE8:
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 1));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 1));
Value = bytes[0];
outs() << "\t.byte " << format("%3u", Value) << "\t@ KIND_JUMP_TABLE8\n";
Size = 1;
break;
case MachO::DICE_KIND_JUMP_TABLE16:
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 2));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 2));
Value = bytes[1] << 8 | bytes[0];
outs() << "\t.short " << format("%5u", Value & 0xffff)
<< "\t@ KIND_JUMP_TABLE16\n";
case MachO::DICE_KIND_JUMP_TABLE32:
case MachO::DICE_KIND_ABS_JUMP_TABLE32:
if (!NoShowRawInsn)
- DumpBytes(StringRef(bytes, 4));
+ DumpBytes(ArrayRef<uint8_t>(bytes, 4));
Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
outs() << "\t.long " << Value;
if (Kind == MachO::DICE_KIND_JUMP_TABLE32)
DTI->second.getLength(Length);
uint16_t Kind;
DTI->second.getKind(Kind);
- Size = DumpDataInCode(reinterpret_cast<const char *>(Bytes.data()) +
- Index,
- Length, Kind);
+ Size = DumpDataInCode(Bytes.data() + Index, Length, Kind);
if ((Kind == MachO::DICE_KIND_JUMP_TABLE8) &&
(PC == (DTI->first + Length - 1)) && (Length & 1))
Size++;
DebugOut, Annotations);
if (gotInst) {
if (!NoShowRawInsn) {
- DumpBytes(StringRef(
- reinterpret_cast<const char *>(Bytes.data()) + Index, Size));
+ DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size));
}
formatted_raw_ostream FormattedOS(outs());
Annotations.flush();
}
if (!NoShowRawInsn) {
outs() << "\t";
- DumpBytes(
- StringRef(reinterpret_cast<const char *>(Bytes.data()) + Index,
- InstSize));
+ DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize));
}
IP->printInst(&Inst, outs(), "");
outs() << "\n";