<div dir="ltr">I was able to track this down to a bug in Clang.  I have a patch up for review.  <br><br><a href="http://reviews.llvm.org/D13276">http://reviews.llvm.org/D13276</a><div><br></div><div>I'm not sure what part of the TypeSystem refactor caused this to finally be exposed, but in any case I expect that patch will go through and this bug will be fixed.</div><div><br></div><div><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 29, 2015 at 3:40 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Resending since the wrong list was CC'ed.</div><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 29, 2015 at 3:39 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Greg.  I'm responding on this thread since you said lldb-dev is a better place for questions.  <div><br></div><div><div style="font-size:small;line-height:20px">I had a chance to look at this some more. It looks like the way we're constructing the clang::RecordDecl is incorrect on Windows.  I'm not sure what record layout is like on non-Windows platforms, but if we have this code:</div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">class A { </div><div style="font-size:small;line-height:20px">    virtual ~A() {}</div><div style="font-size:small;line-height:20px">    int a;</div><div style="font-size:small;line-height:20px">};</div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">class B : public A {</div><div style="font-size:small;line-height:20px">    virtual ~B() {}</div><div style="font-size:small;line-height:20px">    int b;</div><div style="font-size:small;line-height:20px">};</div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">A * pa = new B ();</div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">then using the MS ABI, offset of a is 4 and offset of B is 8.  I verified this by modifying the source of sbvalue-cast.cpp to print the offsets.</div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">d:\src\llvm\tools\lldb\test\lang\cpp\dynamic-value>a.out</div><div style="font-size:small;line-height:20px">DerivedA::ctor()-></div><div style="font-size:small;line-height:20px">m_base_val=20</div><div style="font-size:small;line-height:20px">m_a_val=10</div><div style="font-size:small;line-height:20px"><b>offset of DerivedA::m_a_val is 8</b></div><div style="font-size:small;line-height:20px"><b>offset of DerivedA::m_base_val is 4</b></div><div style="font-size:small;line-height:20px"><br></div><div style="font-size:small;line-height:20px">Clang agrees with me as well.  Compiling with -Xclang -emit-llvm-only -Xclang -fdump-record-layouts gives me the following AST Record Layout</div></div><div><br></div><div><div>*** Dumping AST Record Layout</div><div>   0 | class DerivedA</div><div>   0 |   class Base (primary base)</div><div>   0 |     (Base vftable pointer)</div><div> <b>  4 |     int m_base_val</b></div><div>   8 |   int m_a_val</div><div>     | [sizeof=12, align=4</div><div>     |  nvsize=12, nvalign=4]</div></div><div><br></div><div>On the LLDB side, we have ClangASTContext::GetChildCompilerTypeAtIndex which computes the byte offset, field name, etc for the ValueObject.  On line 5754 it begins querying the name and byte offset of the field.  The name returns `m_base_val`, but the field_offset returns 8 bytes, which we can see above is wrong.</div><div><br></div><div>Any suggestions where I might look to dig further?</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 23, 2015 at 10:34 AM Greg Clayton <<a href="mailto:clayborg@gmail.com" target="_blank">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I responded in another e-mail with follow stuff you will need to send me. Always send questions to lldb-dev and not lldb-commits as there is so much traffic in lldb-commmits it might get lost. I keep up with lldb-dev daily.<br>
<br>
> On Sep 22, 2015, at 10:12 AM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br>
><br>
> In regards to this CL: <a href="http://llvm.org/viewvc/llvm-project?rev=247953&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=247953&view=rev</a><br>
><br>
> It has broken TestCppValueCast on Windows and fixed TestCxxWcharT on Windows as well.  Although these appear to be platform specific behavioral changes, as I don't see anyone else reporting failures or fixes, the description of the CL leads me to infer that this change was supposed to have no functional change.  I haven't gotten any response pinging the thread so I'll pose it to the wider list for visibility in case someone can shed some light on this.  In particular, is this supposed to come with a functional change, and if so what?<br>
><br>
> Unfortunately I don't have buildbots running tests on Windows yet, so I can't justify reverting the CL (and it's too old to revert now anyway since other things depend on it), but it would greatly appreciate if someone can take a look at this and see if they can identify the source of the behavioral change<br>
><br>
> I do plan to have a buildbot running tests within a week or two, so hopefully we can catch this kind of thing much sooner next time.<br>
<br>
</blockquote></div></blockquote></div></div></blockquote></div></div></div>