<div dir="ltr">Yep, looks like r282565 fixed the <a href="http://llvm.org">llvm.org</a> tests, but broke another bot. r282566 fixed the other bot, but broke the <a href="http://llvm.org">llvm.org</a> tests again.<div><br></div><div><a href="http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/20757/">http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/20757/</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 1:48 PM, Tim Hammerquist <span dir="ltr"><<a href="mailto:penryu@gmail.com" target="_blank">penryu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Looks like there was some work to address this in r282565 here:<div><br></div><div><a href="http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/20756/" target="_blank">http://lab.llvm.org:8080/<wbr>green/view/LLDB/job/lldb_<wbr>build_test/20756/</a><br></div><div><br></div><div>However, the issue occurred again on the very next run.</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 1:41 PM, Tim Hammerquist <span dir="ltr"><<a href="mailto:penryu@gmail.com" target="_blank">penryu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>This change seems to have introduced a linker failure while building the gtest suite:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Ld build/Release/lldb-gtest normal x86_64</font></div><div><font face="monospace, monospace">    cd "/Users/buildslave/jenkins/sha<wbr>redspace/lldb@2/lldb"</font></div><div><font face="monospace, monospace">    export MACOSX_DEPLOYMENT_TARGET=10.9</font></div><div><font face="monospace, monospace">    /Applications/Xcode.app/Conten<wbr>ts/Developer/Toolchains/XcodeD<wbr>efault.xctoolchain/usr/bin/<wbr>clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Conten<wbr>ts/Developer/Platforms/MacOSX.<wbr>platform/Developer/SDKs/<wbr>MacOSX10.11.sdk -L/Users/buildslave/jenkins/sh<wbr>aredspace/lldb@2/lldb/build/Re<wbr>lease -F/Users/buildslave/jenkins/sh<wbr>aredspace/lldb@2/lldb/build/Re<wbr>lease -F/Applications/Xcode.app/Cont<wbr>ents/Developer/Platforms/MacOS<wbr>X.platform/Developer/SDKs/<wbr>MacOSX10.11.sdk/System/Library<wbr>/PrivateFrameworks -F/Applications/Xcode.app/Cont<wbr>ents/Developer/Platforms/MacOS<wbr>X.platform/Developer/SDKs/<wbr>MacOSX10.11.sdk/System/Library<wbr>/Frameworks/CoreServices.<wbr>framework/Frameworks -filelist /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/build/lldb<wbr>.build/Release/lldb-gtest-buil<wbr>d.build/Objects-normal/x86_64/<wbr>lldb-gtest.LinkFileList -mmacosx-version-min=10.9 -weak-lcompression -lz -filelist /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/llvm-build<wbr>/Release+Asserts/archives.txt -framework Foundation -framework DebugSymbols -framework Security -framework CoreServices -framework ApplicationServices /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/llvm-build<wbr>/Release+Asserts/x86_64/lib/<wbr>libgtest.a -L /System/Library/Frameworks/Pyt<wbr>hon.framework/Versions/2.7/lib -l python2.7 -stdlib=libc++ -lxml2.2 -lpanel -ledit -lz -lncurses /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/build/Rele<wbr>ase/liblldb-core.a -Xlinker -dependency_info -Xlinker /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/build/lldb<wbr>.build/Release/lldb-gtest-buil<wbr>d.build/Objects-normal/x86_64/<wbr>lldb-gtest_dependency_info.dat -o /Users/buildslave/jenkins/shar<wbr>edspace/lldb@2/lldb/build/Rele<wbr>ase/lldb-gtest</font></div><div><font face="monospace, monospace">Undefined symbols for architecture x86_64:</font></div><div><font face="monospace, monospace">  "lldb_private::minidump::Conve<wbr>rtMinidumpContextToRegIface(<wbr>llvm::ArrayRef<unsigned char>, lldb_private::RegisterInfoInte<wbr>rface*)", referenced from:</font></div><div><font face="monospace, monospace">      MinidumpParserTest_ConvertRegi<wbr>sterContext_Test::TestBody() in MinidumpParserTest.o</font></div><div><font face="monospace, monospace">ld: symbol(s) not found for architecture x86_64</font></div></blockquote><div><br></div><div>It first struck yesterday afternoon:</div><div><br></div><div><a href="http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/20745/console" target="_blank">http://lab.llvm.org:8080/green<wbr>/view/LLDB/job/lldb_build_<wbr>test/20745/console</a></div><div><br></div><div>and recurring through today:</div><div><br></div><div><a href="http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/20770/console" target="_blank">http://lab.llvm.org:8080/green<wbr>/view/LLDB/job/lldb_build_<wbr>test/20770/console</a></div><div><br></div><div>Is there a change that needs to be made to the test suite to address this?</div><div><br></div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Tue, Sep 27, 2016 at 12:05 PM, Dimitar Vlahovski via lldb-commits <span dir="ltr"><<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dvlahovski<br>
Date: Tue Sep 27 14:05:55 2016<br>
New Revision: 282529<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=282529&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=282529&view=rev</a><br>
Log:<br>
Adding a RegisterContextMinidump_x86_64 converter<br>
<br>
Summary:<br>
This is a register context converter from Minidump to Linux reg context.<br>
This knows the layout of the register context in the Minidump file<br>
(which is the same as in Windows FYI) and as a result emits a binary data<br>
buffer that matches the Linux register context binary layout.<br>
This way we can reuse the existing RegisterContextLinux_x86_64 and<br>
RegisterContextCorePOSIX_x86_6<wbr>4 classes.<br>
<br>
Reviewers: labath, zturner<br>
<br>
Subscribers: beanz, mgorny, lldb-commits, amccarth<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D24919" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2491<wbr>9</a><br>
<br>
Added:<br>
    lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.cpp<br>
    lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.h<br>
Modified:<br>
    lldb/trunk/include/lldb/lldb-p<wbr>rivate-types.h<br>
    lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/CMakeLists.txt<br>
    lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.cp<wbr>p<br>
    lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.h<br>
    lldb/trunk/unittests/Process/m<wbr>inidump/MinidumpParserTest.cpp<br>
<br>
Modified: lldb/trunk/include/lldb/lldb-p<wbr>rivate-types.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-types.h?rev=282529&r1=282528&r2=282529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/include/lldb/<wbr>lldb-private-types.h?rev=28252<wbr>9&r1=282528&r2=282529&view=dif<wbr>f</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/include/lldb/lldb-p<wbr>rivate-types.h (original)<br>
+++ lldb/trunk/include/lldb/lldb-p<wbr>rivate-types.h Tue Sep 27 14:05:55 2016<br>
@@ -14,6 +14,8 @@<br>
<br>
 #include "lldb/lldb-private.h"<br>
<br>
+#include "llvm/ADT/ArrayRef.h"<br>
+<br>
 namespace llvm {<br>
 namespace sys {<br>
 class DynamicLibrary;<br>
@@ -61,6 +63,15 @@ struct RegisterInfo {<br>
   // the byte size of this register.<br>
   size_t dynamic_size_dwarf_len; // The length of the DWARF expression in bytes<br>
                                  // in the dynamic_size_dwarf_expr_bytes member.<br>
+<br>
+  llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {<br>
+    return llvm::ArrayRef<uint8_t>(contex<wbr>t_base + byte_offset, byte_size);<br>
+  }<br>
+<br>
+  llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {<br>
+    return llvm::MutableArrayRef<uint8_t><wbr>(context_base + byte_offset,<br>
+                                          byte_size);<br>
+  }<br>
 };<br>
<br>
 //---------------------------<wbr>------------------------------<wbr>-------------<br>
<br>
Modified: lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt?rev=282529&r1=282528&r2=282529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/source/Plugin<wbr>s/Process/minidump/CMakeLists.<wbr>txt?rev=282529&r1=282528&r2=28<wbr>2529&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/CMakeLists.txt (original)<br>
+++ lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/CMakeLists.txt Tue Sep 27 14:05:55 2016<br>
@@ -3,4 +3,5 @@ include_directories(../Utility<wbr>)<br>
 add_lldb_library(lldbPluginPr<wbr>ocessMinidump<br>
   MinidumpTypes.cpp<br>
   MinidumpParser.cpp<br>
+  RegisterContextMinidump_x86_64<wbr>.cpp<br>
   )<br>
<br>
Modified: lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.cp<wbr>p<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp?rev=282529&r1=282528&r2=282529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/source/Plugin<wbr>s/Process/minidump/MinidumpPar<wbr>ser.cpp?rev=282529&r1=282528&r<wbr>2=282529&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.cp<wbr>p (original)<br>
+++ lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.cp<wbr>p Tue Sep 27 14:05:55 2016<br>
@@ -64,8 +64,9 @@ MinidumpParser::MinidumpParser<wbr>(<br>
     : m_data_sp(data_buf_sp), m_header(header), m_directory_map(directory_map) {<br>
 }<br>
<br>
-lldb::offset_t MinidumpParser::GetByteSize() {<br>
-  return m_data_sp->GetByteSize();<br>
+llvm::ArrayRef<uint8_t> MinidumpParser::GetData() {<br>
+  return llvm::ArrayRef<uint8_t>(m_data<wbr>_sp->GetBytes(),<br>
+                                 m_data_sp->GetByteSize());<br>
 }<br>
<br>
 llvm::ArrayRef<uint8_t><br>
<br>
Modified: lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h?rev=282529&r1=282528&r2=282529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/source/Plugin<wbr>s/Process/minidump/MinidumpPar<wbr>ser.h?rev=282529&r1=282528&r2=<wbr>282529&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.h (original)<br>
+++ lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/MinidumpParser.h Tue Sep 27 14:05:55 2016<br>
@@ -39,7 +39,7 @@ public:<br>
   static llvm::Optional<MinidumpParser><br>
   Create(const lldb::DataBufferSP &data_buf_sp);<br>
<br>
-  lldb::offset_t GetByteSize();<br>
+  llvm::ArrayRef<uint8_t> GetData();<br>
<br>
   llvm::ArrayRef<uint8_t> GetStream(MinidumpStreamType stream_type);<br>
<br>
@@ -71,6 +71,6 @@ private:<br>
       llvm::DenseMap<uint32_t, MinidumpLocationDescriptor> &&directory_map);<br>
 };<br>
<br>
-} // namespace minidump<br>
-} // namespace lldb_private<br>
+} // end namespace minidump<br>
+} // end namespace lldb_private<br>
 #endif // liblldb_MinidumpParser_h_<br>
<br>
Added: lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp?rev=282529&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/source/Plugin<wbr>s/Process/minidump/RegisterCon<wbr>textMinidump_x86_64.cpp?rev=28<wbr>2529&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.cpp (added)<br>
+++ lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.cpp Tue Sep 27 14:05:55 2016<br>
@@ -0,0 +1,158 @@<br>
+//===-- RegisterContextMinidump_x86_64<wbr>.cpp ----------------------*- C++ -*-===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// Project includes<br>
+#include "RegisterContextMinidump_x86_6<wbr>4.h"<br>
+<br>
+// Other libraries and framework includes<br>
+#include "lldb/Core/DataBufferHeap.h"<br>
+<br>
+// C includes<br>
+// C++ includes<br>
+<br>
+using namespace lldb_private;<br>
+using namespace minidump;<br>
+<br>
+void writeRegister(llvm::ArrayRef<u<wbr>int8_t> &reg_src,<br>
+                   llvm::MutableArrayRef<uint8_t<wbr>> reg_dest) {<br>
+  memcpy(reg_dest.data(), reg_src.data(), reg_dest.size());<br>
+  reg_src = reg_src.drop_front(<a href="http://reg_dest.si" target="_blank">reg_dest.si</a><wbr>ze());<br>
+}<br>
+<br>
+llvm::MutableArrayRef<uint8_t<wbr>> getDestRegister(uint8_t *context,<br>
+                                               uint32_t lldb_reg_num,<br>
+                                               const RegisterInfo &reg) {<br>
+  auto bytes = reg.mutable_data(context);<br>
+<br>
+  switch (lldb_reg_num) {<br>
+  case lldb_cs_x86_64:<br>
+  case lldb_ds_x86_64:<br>
+  case lldb_es_x86_64:<br>
+  case lldb_fs_x86_64:<br>
+  case lldb_gs_x86_64:<br>
+  case lldb_ss_x86_64:<br>
+    return bytes.take_front(2);<br>
+    break;<br>
+  case lldb_rflags_x86_64:<br>
+    return bytes.take_front(4);<br>
+    break;<br>
+  default:<br>
+    return bytes.take_front(8);<br>
+    break;<br>
+  }<br>
+}<br>
+<br>
+lldb::DataBufferSP lldb_private::minidump::Conver<wbr>tMinidumpContextToRegIface(<br>
+    llvm::ArrayRef<uint8_t> source_data,<br>
+    RegisterInfoInterface *target_reg_interface) {<br>
+<br>
+  const RegisterInfo *reg_info = target_reg_interface->GetRegis<wbr>terInfo();<br>
+<br>
+  lldb::DataBufferSP result_context_buf(<br>
+      new DataBufferHeap(target_reg_inte<wbr>rface->GetGPRSize(), 0));<br>
+  uint8_t *result_base = result_context_buf->GetBytes()<wbr>;<br>
+<br>
+  source_data = source_data.drop_front(6 * 8); // p[1-6] home registers<br>
+  const uint32_t *context_flags;<br>
+  consumeObject(source_data, context_flags);<br>
+  const uint32_t x86_64_Flag =<br>
+      static_cast<uint32_t>(Minidump<wbr>Context_x86_64_Flags::x86_64_F<wbr>lag);<br>
+  const uint32_t ControlFlag =<br>
+      static_cast<uint32_t>(Minidump<wbr>Context_x86_64_Flags::Control)<wbr>;<br>
+  const uint32_t IntegerFlag =<br>
+      static_cast<uint32_t>(Minidump<wbr>Context_x86_64_Flags::Integer)<wbr>;<br>
+  const uint32_t SegmentsFlag =<br>
+      static_cast<uint32_t>(Minidump<wbr>Context_x86_64_Flags::Segments<wbr>);<br>
+  const uint32_t DebugRegistersFlag =<br>
+      static_cast<uint32_t>(Minidump<wbr>Context_x86_64_Flags::DebugReg<wbr>isters);<br>
+<br>
+  if (!(*context_flags & x86_64_Flag)) {<br>
+    return result_context_buf; // error<br>
+  }<br>
+<br>
+  source_data = source_data.drop_front(4); // mx_csr<br>
+<br>
+  if (*context_flags & ControlFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_cs_x86_64,<br>
+                                               reg_info[lldb_cs_x86_64]));<br>
+  }<br>
+<br>
+  if (*context_flags & SegmentsFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_ds_x86_64,<br>
+                                               reg_info[lldb_ds_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_es_x86_64,<br>
+                                               reg_info[lldb_es_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_fs_x86_64,<br>
+                                               reg_info[lldb_fs_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_gs_x86_64,<br>
+                                               reg_info[lldb_gs_x86_64]));<br>
+  }<br>
+<br>
+  if (*context_flags & ControlFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_ss_x86_64,<br>
+                                               reg_info[lldb_ss_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rflags_x86_64,<br>
+                                               reg_info[lldb_rflags_x86_64])<wbr>);<br>
+  }<br>
+<br>
+  if (*context_flags & DebugRegistersFlag) {<br>
+    source_data =<br>
+        source_data.drop_front(6 * 8); // 6 debug registers 64 bit each<br>
+  }<br>
+<br>
+  if (*context_flags & IntegerFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rax_x86_64,<br>
+                                               reg_info[lldb_rax_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rcx_x86_64,<br>
+                                               reg_info[lldb_rcx_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rdx_x86_64,<br>
+                                               reg_info[lldb_rdx_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rbx_x86_64,<br>
+                                               reg_info[lldb_rbx_x86_64]));<br>
+  }<br>
+<br>
+  if (*context_flags & ControlFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rsp_x86_64,<br>
+                                               reg_info[lldb_rsp_x86_64]));<br>
+  }<br>
+<br>
+  if (*context_flags & IntegerFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rbp_x86_64,<br>
+                                               reg_info[lldb_rbp_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rsi_x86_64,<br>
+                                               reg_info[lldb_rsi_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rdi_x86_64,<br>
+                                               reg_info[lldb_rdi_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r8_x86_64,<br>
+                                               reg_info[lldb_r8_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r9_x86_64,<br>
+                                               reg_info[lldb_r9_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r10_x86_64,<br>
+                                               reg_info[lldb_r10_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r11_x86_64,<br>
+                                               reg_info[lldb_r11_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r12_x86_64,<br>
+                                               reg_info[lldb_r12_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r13_x86_64,<br>
+                                               reg_info[lldb_r13_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r14_x86_64,<br>
+                                               reg_info[lldb_r14_x86_64]));<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_r15_x86_64,<br>
+                                               reg_info[lldb_r15_x86_64]));<br>
+  }<br>
+<br>
+  if (*context_flags & ControlFlag) {<br>
+    writeRegister(source_data, getDestRegister(result_base, lldb_rip_x86_64,<br>
+                                               reg_info[lldb_rip_x86_64]));<br>
+  }<br>
+<br>
+  // TODO parse the floating point registers<br>
+<br>
+  return result_context_buf;<br>
+}<br>
<br>
Added: lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h?rev=282529&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/source/Plugin<wbr>s/Process/minidump/RegisterCon<wbr>textMinidump_x86_64.h?rev=2825<wbr>29&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.h (added)<br>
+++ lldb/trunk/source/Plugins/Proc<wbr>ess/minidump/RegisterContextMi<wbr>nidump_x86_64.h Tue Sep 27 14:05:55 2016<br>
@@ -0,0 +1,119 @@<br>
+//===-- RegisterContextMinidump_x86_64<wbr>.h ------------------------*- C++ -*-===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+#ifndef liblldb_RegisterContextMinidum<wbr>p_h_<br>
+#define liblldb_RegisterContextMinidum<wbr>p_h_<br>
+<br>
+// Project includes<br>
+#include "MinidumpTypes.h"<br>
+<br>
+// Other libraries and framework includes<br>
+#include "Plugins/Process/Utility/Regis<wbr>terInfoInterface.h"<br>
+#include "Plugins/Process/Utility/lldb-<wbr>x86-register-enums.h"<br>
+<br>
+#include "lldb/Target/RegisterContext.h<wbr>"<br>
+<br>
+#include "llvm/ADT/ArrayRef.h"<br>
+#include "llvm/ADT/BitmaskEnum.h"<br>
+<br>
+// C includes<br>
+// C++ includes<br>
+<br>
+namespace lldb_private {<br>
+<br>
+namespace minidump {<br>
+<br>
+// The content of the Minidump register context is as follows:<br>
+// (for reference see breakpad's source or WinNT.h)<br>
+// Register parameter home addresses: (p1_home .. p6_home)<br>
+// - uint64_t p1_home<br>
+// - uint64_t p2_home<br>
+// - uint64_t p3_home<br>
+// - uint64_t p4_home<br>
+// - uint64_t p5_home<br>
+// - uint64_t p6_home<br>
+//<br>
+// - uint32_t context_flags - field that determines the layout of the structure<br>
+//     and which parts of it are populated<br>
+// - uint32_t mx_csr<br>
+//<br>
+// - uint16_t cs - included if MinidumpContext_x86_64_Flags::<wbr>Control<br>
+//<br>
+// - uint16_t ds - included if MinidumpContext_x86_64_Flags::<wbr>Segments<br>
+// - uint16_t es - included if MinidumpContext_x86_64_Flags::<wbr>Segments<br>
+// - uint16_t fs - included if MinidumpContext_x86_64_Flags::<wbr>Segments<br>
+// - uint16_t gs - included if MinidumpContext_x86_64_Flags::<wbr>Segments<br>
+//<br>
+// - uint16_t ss     - included if MinidumpContext_x86_64_Flags::<wbr>Control<br>
+// - uint32_t rflags - included if MinidumpContext_x86_64_Flags::<wbr>Control<br>
+//<br>
+// Debug registers: (included if MinidumpContext_x86_64_Flags::<wbr>DebugRegisters)<br>
+// - uint64_t dr0<br>
+// - uint64_t dr1<br>
+// - uint64_t dr2<br>
+// - uint64_t dr3<br>
+// - uint64_t dr6<br>
+// - uint64_t dr7<br>
+//<br>
+// The next 4 registers are included if MinidumpContext_x86_64_Flags::<wbr>Integer<br>
+// - uint64_t rax<br>
+// - uint64_t rcx<br>
+// - uint64_t rdx<br>
+// - uint64_t rbx<br>
+//<br>
+// - uint64_t rsp - included if MinidumpContext_x86_64_Flags::<wbr>Control<br>
+//<br>
+// The next 11 registers are included if MinidumpContext_x86_64_Flags::<wbr>Integer<br>
+// - uint64_t rbp<br>
+// - uint64_t rsi<br>
+// - uint64_t rdi<br>
+// - uint64_t r8<br>
+// - uint64_t r9<br>
+// - uint64_t r10<br>
+// - uint64_t r11<br>
+// - uint64_t r12<br>
+// - uint64_t r13<br>
+// - uint64_t r14<br>
+// - uint64_t r15<br>
+//<br>
+// - uint64_t rip - included if MinidumpContext_x86_64_Flags::<wbr>Control<br>
+//<br>
+// TODO: add floating point registers here<br>
+<br>
+// This function receives an ArrayRef pointing to the bytes of the Minidump<br>
+// register context and returns a DataBuffer that's ordered by the offsets<br>
+// specified in the RegisterInfoInterface argument<br>
+// This way we can reuse the already existing register contexts<br>
+lldb::DataBufferSP<br>
+ConvertMinidumpContextToRegIf<wbr>ace(llvm::ArrayRef<uint8_t> source_data,<br>
+                                 RegisterInfoInterface *target_reg_interface);<br>
+<br>
+// For context_flags. These values indicate the type of<br>
+// context stored in the structure.  The high 24 bits identify the CPU, the<br>
+// low 8 bits identify the type of context saved.<br>
+LLVM_ENABLE_BITMASK_ENUMS_IN_<wbr>NAMESPACE();<br>
+<br>
+enum class MinidumpContext_x86_64_Flags : uint32_t {<br>
+  x86_64_Flag = 0x00100000,<br>
+  Control = x86_64_Flag | 0x00000001,<br>
+  Integer = x86_64_Flag | 0x00000002,<br>
+  Segments = x86_64_Flag | 0x00000004,<br>
+  FloatingPoint = x86_64_Flag | 0x00000008,<br>
+  DebugRegisters = x86_64_Flag | 0x00000010,<br>
+  XState = x86_64_Flag | 0x00000040,<br>
+<br>
+  Full = Control | Integer | FloatingPoint,<br>
+  All = Full | Segments | DebugRegisters,<br>
+<br>
+  LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ All)<br>
+};<br>
+<br>
+} // end namespace minidump<br>
+} // end namespace lldb_private<br>
+#endif // liblldb_RegisterContextMinidum<wbr>p_h_<br>
<br>
Modified: lldb/trunk/unittests/Process/m<wbr>inidump/MinidumpParserTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=282529&r1=282528&r2=282529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lldb/trunk/unittests/Pro<wbr>cess/minidump/MinidumpParserTe<wbr>st.cpp?rev=282529&r1=282528&r2<wbr>=282529&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lldb/trunk/unittests/Process/m<wbr>inidump/MinidumpParserTest.cpp (original)<br>
+++ lldb/trunk/unittests/Process/m<wbr>inidump/MinidumpParserTest.cpp Tue Sep 27 14:05:55 2016<br>
@@ -8,8 +8,10 @@<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
<br>
 // Project includes<br>
+#include "Plugins/Process/Utility/Regis<wbr>terContextLinux_x86_64.h"<br>
 #include "Plugins/Process/minidump/Mini<wbr>dumpParser.h"<br>
 #include "Plugins/Process/minidump/Mini<wbr>dumpTypes.h"<br>
+#include "Plugins/Process/minidump/Regi<wbr>sterContextMinidump_x86_64.h"<br>
<br>
 // Other libraries and framework includes<br>
 #include "gtest/gtest.h"<br>
@@ -18,6 +20,7 @@<br>
 #include "lldb/Core/DataExtractor.h"<br>
 #include "lldb/Host/FileSpec.h"<br>
<br>
+#include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/ADT/Optional.h"<br>
 #include "llvm/Support/FileSystem.h"<br>
 #include "llvm/Support/Path.h"<br>
@@ -50,7 +53,7 @@ public:<br>
         MinidumpParser::Create(data_s<wbr>p);<br>
     ASSERT_TRUE(optional_parser.h<wbr>asValue());<br>
     parser.reset(new MinidumpParser(optional_parser<wbr>.getValue()));<br>
-    ASSERT_GT(parser->GetByteSize(<wbr>), 0UL);<br>
+    ASSERT_GT(parser->GetData().si<wbr>ze(), 0UL);<br>
   }<br>
<br>
   llvm::SmallString<128> inputs_folder;<br>
@@ -167,3 +170,61 @@ TEST_F(MinidumpParserTest, GetPidWindows<br>
   ASSERT_TRUE(pid.hasValue());<br>
   ASSERT_EQ(4440UL, pid.getValue());<br>
 }<br>
+<br>
+// Register stuff<br>
+// TODO probably split register stuff tests into different file?<br>
+#define REG_VAL(x) *(reinterpret_cast<uint64_t *>(x))<br>
+<br>
+TEST_F(MinidumpParserTest, ConvertRegisterContext) {<br>
+  SetUpData("linux-x86_64.dmp");<br>
+  llvm::ArrayRef<MinidumpThread> thread_list = parser->GetThreads();<br>
+  const MinidumpThread thread = thread_list[0];<br>
+  llvm::ArrayRef<uint8_t> registers(parser->GetData().da<wbr>ta() +<br>
+                                        thread.thread_context.rva,<br>
+                                    thread.thread_context.data_siz<wbr>e);<br>
+<br>
+  ArchSpec arch = parser->GetArchitecture();<br>
+  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(ar<wbr>ch);<br>
+  lldb::DataBufferSP buf =<br>
+      ConvertMinidumpContextToRegIfa<wbr>ce(registers, reg_interface);<br>
+  ASSERT_EQ(reg_interface->GetGP<wbr>RSize(), buf->GetByteSize());<br>
+<br>
+  const RegisterInfo *reg_info = reg_interface->GetRegisterInfo<wbr>();<br>
+<br>
+  std::map<uint64_t, uint64_t> reg_values;<br>
+<br>
+  // clang-format off<br>
+  reg_values[lldb_rax_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_rbx_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_rcx_x86_64]    =  0x0000000000000010;<br>
+  reg_values[lldb_rdx_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_rdi_x86_64]    =  0x00007ffceb349cf0;<br>
+  reg_values[lldb_rsi_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_rbp_x86_64]    =  0x00007ffceb34a210;<br>
+  reg_values[lldb_rsp_x86_64]    =  0x00007ffceb34a210;<br>
+  reg_values[lldb_r8_x86_64]     =  0x00007fe9bc1aa9c0;<br>
+  reg_values[lldb_r9_x86_64]     =  0x0000000000000000;<br>
+  reg_values[lldb_r10_x86_64]    =  0x00007fe9bc3f16a0;<br>
+  reg_values[lldb_r11_x86_64]    =  0x0000000000000246;<br>
+  reg_values[lldb_r12_x86_64]    =  0x0000000000401c92;<br>
+  reg_values[lldb_r13_x86_64]    =  0x00007ffceb34a430;<br>
+  reg_values[lldb_r14_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_r15_x86_64]    =  0x0000000000000000;<br>
+  reg_values[lldb_rip_x86_64]    =  0x0000000000401dc6;<br>
+  reg_values[lldb_rflags_x86_64] =  0x0000000000010206;<br>
+  reg_values[lldb_cs_x86_64]     =  0x0000000000000033;<br>
+  reg_values[lldb_fs_x86_64]     =  0x0000000000000000;<br>
+  reg_values[lldb_gs_x86_64]     =  0x0000000000000000;<br>
+  reg_values[lldb_ss_x86_64]     =  0x0000000000000000;<br>
+  reg_values[lldb_ds_x86_64]     =  0x0000000000000000;<br>
+  reg_values[lldb_es_x86_64]     =  0x0000000000000000;<br>
+  // clang-format on<br>
+<br>
+  for (uint32_t reg_index = 0; reg_index < reg_interface->GetRegisterCoun<wbr>t();<br>
+       ++reg_index) {<br>
+    if (reg_values.find(reg_index) != reg_values.end()) {<br>
+      EXPECT_EQ(reg_values[reg_index<wbr>],<br>
+                REG_VAL(buf->GetBytes() + reg_info[reg_index].byte_offse<wbr>t));<br>
+    }<br>
+  }<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div data-smartmail="gmail_signature">Tim <<a href="mailto:penryu@gmail.com" target="_blank">penryu@gmail.com</a>></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div data-smartmail="gmail_signature">Tim <<a href="mailto:penryu@gmail.com" target="_blank">penryu@gmail.com</a>></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Tim <<a href="mailto:penryu@gmail.com" target="_blank">penryu@gmail.com</a>></div>
</div>