diff options
author | Ed Maste <emaste@freebsd.org> | 2013-09-17 17:51:33 +0000 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2013-09-17 17:51:33 +0000 |
commit | 74a23ea4942e832a0b9671ab2e4a3d3835c3fee2 (patch) | |
tree | d5adb6693f297f1d59a2b34d44430a64c0873e03 /lldb | |
parent | bac7af21da68a7d9c9f80fa304ae0b6f78e060a5 (diff) | |
download | bcm5719-llvm-74a23ea4942e832a0b9671ab2e4a3d3835c3fee2.tar.gz bcm5719-llvm-74a23ea4942e832a0b9671ab2e4a3d3835c3fee2.zip |
Avoid abort on "memory read -s N" for N=3,5,6,7
We cannot use "GetMaxU64Bitfield" for non-power-of-two sizes, so just use
the same code that handles N > 8 for these.
Review: http://llvm-reviews.chandlerc.com/D1699
llvm-svn: 190873
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 8c0ee038567..fc3dfc4050f 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1703,30 +1703,35 @@ DataExtractor::Dump (Stream *s, case eFormatHexUppercase: { bool wantsuppercase = (item_format == eFormatHexUppercase); - if (item_byte_size <= 8) + switch (item_byte_size) { + case 1: + case 2: + case 4: + case 8: s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64, (int)(2 * item_byte_size), (int)(2 * item_byte_size), GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); - } - else - { - assert (item_bit_size == 0 && item_bit_offset == 0); - s->PutCString("0x"); - const uint8_t *bytes = (const uint8_t* )GetData(&offset, item_byte_size); - if (bytes) + break; + default: { - uint32_t idx; - if (m_byte_order == eByteOrderBig) - { - for (idx = 0; idx < item_byte_size; ++idx) - s->Printf(wantsuppercase ? "%2.2X" : "%2.2x", bytes[idx]); - } - else + assert (item_bit_size == 0 && item_bit_offset == 0); + s->PutCString("0x"); + const uint8_t *bytes = (const uint8_t* )GetData(&offset, item_byte_size); + if (bytes) { - for (idx = 0; idx < item_byte_size; ++idx) - s->Printf(wantsuppercase ? "%2.2X" : "%2.2x", bytes[item_byte_size - 1 - idx]); + uint32_t idx; + if (m_byte_order == eByteOrderBig) + { + for (idx = 0; idx < item_byte_size; ++idx) + s->Printf(wantsuppercase ? "%2.2X" : "%2.2x", bytes[idx]); + } + else + { + for (idx = 0; idx < item_byte_size; ++idx) + s->Printf(wantsuppercase ? "%2.2X" : "%2.2x", bytes[item_byte_size - 1 - idx]); + } } } - } + break; } break; |