Fix bug when trying to output uint16_t or uint32_t.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122615 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2010-12-29 02:30:49 +00:00
parent b40a71fda1
commit a7e450574c
2 changed files with 54 additions and 2 deletions

View File

@ -799,11 +799,18 @@ void MCDwarfFrameEmitter::EncodeAdvanceLoc(uint64_t AddrDelta,
OS << uint8_t(dwarf::DW_CFA_advance_loc1);
OS << uint8_t(AddrDelta);
} else if (isUInt<16>(AddrDelta)) {
// FIXME: check what is the correct behavior on a big endian machine.
OS << uint8_t(dwarf::DW_CFA_advance_loc2);
OS << uint16_t(AddrDelta);
OS << uint8_t( AddrDelta & 0xff);
OS << uint8_t((AddrDelta >> 8) & 0xff);
} else {
// FIXME: check what is the correct behavior on a big endian machine.
assert(isUInt<32>(AddrDelta));
OS << uint8_t(dwarf::DW_CFA_advance_loc4);
OS << uint32_t(AddrDelta);
OS << uint8_t( AddrDelta & 0xff);
OS << uint8_t((AddrDelta >> 8) & 0xff);
OS << uint8_t((AddrDelta >> 16) & 0xff);
OS << uint8_t((AddrDelta >> 24) & 0xff);
}
}