[Lldb-commits] [PATCH] Don't abort on "memory read -s N" for N=3 5 6 or 7

Ed Maste emaste at freebsd.org
Tue Sep 17 08:56:31 PDT 2013


"memory read -s N" calls GetMaxU64Bitfield for N <= 8.  However, that function handles only 1,2,4 or 8 byte reads.

This change falls through to the existing > 8 byte case for 3 5 6 or 7 byte reads.


http://llvm-reviews.chandlerc.com/D1699

Files:
  source/Core/DataExtractor.cpp

Index: source/Core/DataExtractor.cpp
===================================================================
--- source/Core/DataExtractor.cpp
+++ source/Core/DataExtractor.cpp
@@ -1703,12 +1703,16 @@
         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
-                {
+                    break;
+                default:
+                    {
                     assert (item_bit_size == 0 && item_bit_offset == 0);
                     s->PutCString("0x");
                     const uint8_t *bytes = (const uint8_t* )GetData(&offset, item_byte_size);
@@ -1726,7 +1730,8 @@
                                 s->Printf(wantsuppercase ? "%2.2X" : "%2.2x", bytes[item_byte_size - 1 - idx]);
                         }
                     }
-                }
+                    }
+                    break;
             }
             break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1699.1.patch
Type: text/x-patch
Size: 1381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130917/3bf4bf83/attachment.bin>


More information about the lldb-commits mailing list