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

Greg Clayton gclayton at apple.com
Tue Sep 17 09:45:55 PDT 2013


Looks good.

On Sep 17, 2013, at 8:56 AM, Ed Maste <emaste at freebsd.org> wrote:

> "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;
> <D1699.1.patch>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list