<div dir="ltr">Great!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 9:38 AM, Doug Snyder <span dir="ltr"><<a href="mailto:dsnyder@blueshiftinc.com" target="_blank">dsnyder@blueshiftinc.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">that's worth a try.<div><br></div><div>i'll work on that this morning</div><div><br></div><div><br>
</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 9:11 AM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.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">Hey I wonder if we can solve this using your thought on making it compiler agnostic, by having lldb use a "step out" rather than a "step" at that point? I would hope the debugger can manage to step out of the function doing that approach regardless of the "number of steps" it would take to do it with a gcc vs. clang exe.<div>
<br></div><div>Just a thought. That would avoid needing separate paths for gcc and clang.</div><div><br></div><div>Otherwise, it for sure seems like the current test flow would need to change based on compiler. I like going with the first approach, if that's valid, so we can avoid having (say) yet another compiler do something else which requires yet a different path.</div>
<div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 5:30 PM, Doug Snyder <span dir="ltr"><<a href="mailto:dsnyder@blueshiftinc.com" target="_blank">dsnyder@blueshiftinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>the test case “test_step_over_with_dwarf_python” for unit test "functionalities/step-avoids-no debug” passes when compiling the unit test with clang and fails when compiling with gcc, when i run the unit test in linux (ubuntu 14.04). note: to run this test case in linux, you have to comment out the “@skipIfLinux # intermittent failure” line.</div>
<div><br></div><div>the failure happens when the python code in TestStepNoDebug.py does the first self.thread.StepOut() after the breakpoint.</div><div><br></div><div>this appears to be caused by gcc generating significantly different code than clang. clang associates 20 bytes of machine code (all of the machine code related to the source line) to the breakpoint source line (line 12), but gcc only associates the first 3 bytes of machine code to line 12. gcc associates the remaining bytes related to line 12 with line 13. the corresponding code for both versions is shown at the bottom of this email.</div>
<div><br></div><div>this difference means that when the self.thread.StepOut() is executed in the clang version, the program steps to the source line of the calling routine (line 19), but the gcc version steps to the next source line (line 13). this mismatch causes TestStepNoDebug.py to report a failure not really caused by lldb, but really just a compiler difference.</div>
<div><br></div><div>it seems like the tests in TestStepNoDebug.py should be rewritten to include different tests for clang and gcc, or the test should be restructured to not rely on compiler differences - at least not clang and gcc differences.</div>
<div><br></div><div><br></div><div><br></div><div>shown below is the objdump for the clang version. the 20 bytes from 40055c thru 40056f (inclusive) are associated with source line 12 (no bytes are associated with source line 13).</div>
<div><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">int</div><div style="margin:0px;font-size:11px;font-family:Menlo">called_from_nodebug_actual(int some_value)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
{</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400530:<span style="white-space:pre-wrap"> </span>55 <span style="white-space:pre-wrap"> </span>push %rbp</div><div style="margin:0px;font-size:11px;font-family:Menlo">
400531:<span style="white-space:pre-wrap"> </span>48 89 e5 <span style="white-space:pre-wrap"> </span>mov %rsp,%rbp</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400534:<span style="white-space:pre-wrap"> </span>48 83 ec 10 <span style="white-space:pre-wrap"> </span>sub $0x10,%rsp</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400538:<span style="white-space:pre-wrap"> </span>48 b8 d4 06 40 00 00 <span style="white-space:pre-wrap"> </span>movabs $0x4006d4,%rax</div><div style="margin:0px;font-size:11px;font-family:Menlo">
40053f:<span style="white-space:pre-wrap"> </span>00 00 00 </div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400542:<span style="white-space:pre-wrap"> </span>89 7d fc <span style="white-space:pre-wrap"> </span>mov %edi,-0x4(%rbp)</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> int return_value = 0;</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400545:<span style="white-space:pre-wrap"> </span>c7 45 f8 00 00 00 00 <span style="white-space:pre-wrap"> </span>movl $0x0,-0x8(%rbp)</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> return_value = printf ("Length: %d.\n", some_value);</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 40054c:<span style="white-space:pre-wrap"> </span>8b 75 fc <span style="white-space:pre-wrap"> </span>mov -0x4(%rbp),%esi</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 40054f:<span style="white-space:pre-wrap"> </span>48 89 c7 <span style="white-space:pre-wrap"> </span>mov %rax,%rdi</div><div style="margin:0px;font-size:11px;font-family:Menlo">
400552:<span style="white-space:pre-wrap"> </span>b0 00 <span style="white-space:pre-wrap"> </span>mov $0x0,%al</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400554:<span style="white-space:pre-wrap"> </span>e8 b7 fe ff ff <span style="white-space:pre-wrap"> </span>callq 400410 <printf@plt></div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400559:<span style="white-space:pre-wrap"> </span>89 45 f8 <span style="white-space:pre-wrap"> </span>mov %eax,-0x8(%rbp)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
return return_value; // Stop here and step out of me</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 40055c:<span style="white-space:pre-wrap"> </span>8b 45 f8 <span style="white-space:pre-wrap"> </span>mov -0x8(%rbp),%eax</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 40055f:<span style="white-space:pre-wrap"> </span>48 83 c4 10 <span style="white-space:pre-wrap"> </span>add $0x10,%rsp</div><div style="margin:0px;font-size:11px;font-family:Menlo">
400563:<span style="white-space:pre-wrap"> </span>5d <span style="white-space:pre-wrap"> </span>pop %rbp</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400564:<span style="white-space:pre-wrap"> </span>c3 <span style="white-space:pre-wrap"> </span>retq </div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400565:<span style="white-space:pre-wrap"> </span>66 66 2e 0f 1f 84 00 <span style="white-space:pre-wrap"> </span>data32 nopw %cs:0x0(%rax,%rax,1)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
40056c:<span style="white-space:pre-wrap"> </span>00 00 00 00 </div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">0000000000400570 <called_from_nodebug>:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">}</div><div><br></div><div><br></div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo"><div style="font-family:Helvetica;font-size:12px">
shown below is the objdump for the gcc version. the 3 bytes from 400556 thru 400558 (inclusive) are associated with source line 12, and the 2 bytes from 400559 thru 40055a (inclusive) are associated with source line 13.</div>
<div><br></div></div><div style="margin:0px;font-size:11px;font-family:Menlo">called_from_nodebug_actual(int some_value)</div><div style="margin:0px;font-size:11px;font-family:Menlo">{</div><div style="margin:0px;font-size:11px;font-family:Menlo">
40052d:<span style="white-space:pre-wrap"> </span>55 <span style="white-space:pre-wrap"> </span>push %rbp</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 40052e:<span style="white-space:pre-wrap"> </span>48 89 e5 <span style="white-space:pre-wrap"> </span>mov %rsp,%rbp</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400531:<span style="white-space:pre-wrap"> </span>48 83 ec 20 <span style="white-space:pre-wrap"> </span>sub $0x20,%rsp</div><div style="margin:0px;font-size:11px;font-family:Menlo">
400535:<span style="white-space:pre-wrap"> </span>89 7d ec <span style="white-space:pre-wrap"> </span>mov %edi,-0x14(%rbp)</div><div style="margin:0px;font-size:11px;font-family:Menlo"> int return_value = 0;</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400538:<span style="white-space:pre-wrap"> </span>c7 45 fc 00 00 00 00 <span style="white-space:pre-wrap"> </span>movl $0x0,-0x4(%rbp)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
return_value = printf ("Length: %d.\n", some_value);</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 40053f:<span style="white-space:pre-wrap"> </span>8b 45 ec <span style="white-space:pre-wrap"> </span>mov -0x14(%rbp),%eax</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400542:<span style="white-space:pre-wrap"> </span>89 c6 <span style="white-space:pre-wrap"> </span>mov %eax,%esi</div><div style="margin:0px;font-size:11px;font-family:Menlo">
400544:<span style="white-space:pre-wrap"> </span>bf 94 06 40 00 <span style="white-space:pre-wrap"> </span>mov $0x400694,%edi</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400549:<span style="white-space:pre-wrap"> </span>b8 00 00 00 00 <span style="white-space:pre-wrap"> </span>mov $0x0,%eax</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 40054e:<span style="white-space:pre-wrap"> </span>e8 bd fe ff ff <span style="white-space:pre-wrap"> </span>callq 400410 <printf@plt></div><div style="margin:0px;font-size:11px;font-family:Menlo">
400553:<span style="white-space:pre-wrap"> </span>89 45 fc <span style="white-space:pre-wrap"> </span>mov %eax,-0x4(%rbp)</div><div style="margin:0px;font-size:11px;font-family:Menlo"> return return_value; // Stop here and step out of me</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> 400556:<span style="white-space:pre-wrap"> </span>8b 45 fc <span style="white-space:pre-wrap"> </span>mov -0x4(%rbp),%eax</div><div style="margin:0px;font-size:11px;font-family:Menlo">
}</div><div style="margin:0px;font-size:11px;font-family:Menlo"> 400559:<span style="white-space:pre-wrap"> </span>c9 <span style="white-space:pre-wrap"> </span>leaveq </div><div style="margin:0px;font-size:11px;font-family:Menlo">
40055a:<span style="white-space:pre-wrap"> </span>c3 <span style="white-space:pre-wrap"> </span>retq </div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">
000000000040055b <called_from_nodebug>:</div></div><div><br></div><div><br></div><div>doug</div><div><br></div></div><br>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'">
<tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>