summaryrefslogtreecommitdiff
path: root/lib/msan
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-06-06 14:06:14 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-06-06 14:06:14 +0000
commite7f67408ac21d1a065aacf7399a280fa838c292d (patch)
treef22a3e65514f6c954f69dd655077ad420a4f96bc /lib/msan
parent5312e023a688586444800b7ded39d2728823b348 (diff)
[msan] Fix wrong endianness when printing shadow.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@210335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan')
-rw-r--r--lib/msan/msan.cc4
-rw-r--r--lib/msan/msan_report.cc6
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc
index 15714e7d5..4c58200f1 100644
--- a/lib/msan/msan.cc
+++ b/lib/msan/msan.cc
@@ -440,7 +440,11 @@ void __msan_dump_shadow(const void *x, uptr size) {
unsigned char *s = (unsigned char*)MEM_TO_SHADOW(x);
for (uptr i = 0; i < size; i++) {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ Printf("%x%x ", s[i] & 0xf, s[i] >> 4);
+#else
Printf("%x%x ", s[i] >> 4, s[i] & 0xf);
+#endif
}
Printf("\n");
}
diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc
index 8a3fd04cb..566034c66 100644
--- a/lib/msan/msan_report.cc
+++ b/lib/msan/msan_report.cc
@@ -221,7 +221,11 @@ void DescribeMemoryRange(const void *x, uptr size) {
} else {
unsigned char v = *(unsigned char *)s;
if (v) last_quad_poisoned = true;
- Printf("%02x", v);
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ Printf("%x%x", v & 0xf, v >> 4);
+#else
+ Printf("%x%x", v >> 4, v & 0xf);
+#endif
}
// Group end.
if (pos % 4 == 3 && with_origins) {