[Lldb-commits] [PATCH] D29078: This patch implements a command to access and manipulate the Intel(R) MPX Boundary Tables.

Valentina Giusti via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 26 07:16:57 PST 2017


valentinagiusti marked 2 inline comments as done.
valentinagiusti added inline comments.


================
Comment at: tools/intel-mpx/IntelMPXTablePlugin.cpp:219
+}
+
+static std::vector<uint8_t> uIntToU8(uint64_t input, size_t size) {
----------------
clayborg wrote:
> I'll fix SBData and this should work
Thanks, now it works :)


================
Comment at: tools/intel-mpx/IntelMPXTablePlugin.cpp:315
+  return true;
+}
+
----------------
clayborg wrote:
> The GetValueAsUnsigned() should work. If you look at an x86_64 program:
> 
> ```
> (lldb) script
> >>> r = lldb.frame.FindRegister('rax')
> >>> print r
> (unsigned long) rax = 0x0000000100000f10
> >>> print r.GetValueAsUnsigned(0)
> 4294971152
> >>> hex(4294971152)
> '0x100000f10'
> ```
> 
> Maybe you defined "bndcfgu" the register in a way that makes this not work? This should work and you should step through the code to see why this fails for "bndcfgu". Let me know what you find.
You are right, bndcfgu is defined as eEncodingVector, whereas rax is eEncodingUint, and this is the reason why this method doesn't work in my case.

GetValueAsUnsigned() executes the following line (source/API/SBValue.cpp:1059):
    return value_sp->GetValueAsUnsigned(fail_value);
which uses the operator overloading (defined in include/lldb/Utility/SharingPtr.h:148):
   element_type *operator->() const { return ptr_; }

which in its turn simply cannot work with a vector register... So I don't think that this is a bug, it just that this method is probably not intended for this kind of registers.

Is it ok if I just keep my original code or is there a better way to extract data from a vector register?



https://reviews.llvm.org/D29078





More information about the lldb-commits mailing list