<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">That is definitely the other option.<div>I tend to agree with Ed’s argument that the main.cpp is not doing anything illegal or that real programmers who use LLDB won’t ever run into.</div><div>It seems a reasonable thing to test: what happens when a data formatter encounters random memory.</div><div>On OSX it happens to be 0-filled so no special behavior will occur, but on other platforms we might mask out potential issues by doing the explicit zero<i>ing</i></div><div>My vote goes with letting LLDB read and dump data and just checking the first byte - as long as we produce the “X and don’t crash, we are doing the right thing for the user</div><div><br><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style=" orphans: 2; widows: 2; border-collapse: separate; border-spacing: 0px;"><span style="font-size: 12px; orphans: auto; widows: auto;">Enrico Granata</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">📩 egranata@</span><font color="#ff2600" style="font-size: 12px; orphans: auto; widows: auto;"></font><span style="font-size: 12px; orphans: auto; widows: auto;">.com</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">☎️ 27683</span></div></div></div>
</div>
<br><div><div>On Jun 25, 2013, at 10:28 AM, "Malea, Daniel" <<a href="mailto:daniel.malea@intel.com">daniel.malea@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I don't think the test is supposed to depend on null-allocated stack.<br>Unless we're explicitly testing what happens when LLDB reads random<br>memory, I vote we initialize the char* properly, like:<br><br>diff --git<span class="Apple-converted-space"> </span><br>a/test/functionalities/data-formatter/data-formatter-advanced/main.cpp<br>b/test/functionalities/data-formatter/data-formatter-advanced/main.cpp<br>index 8e5ea0c..2462e28 100644<br>--- a/test/functionalities/data-formatter/data-formatter-advanced/main.cpp<br>+++ b/test/functionalities/data-formatter/data-formatter-advanced/main.cpp<br>@@ -61,8 +61,11 @@ struct SimpleWithPointers<br>       SimpleWithPointers(int X, float Y, char Z) :<br>       x(new int (X)),<br>       y(new float (Y)),<br>-       z(new char (Z))<br>-       {}<br>+       z(new char[2])<br>+       {<br>+          z[0] = Z;<br>+          z[1] = '\0';<br>+        }<br>};<br><br><br>Cheers,<br>Dan<br><br><br><br>On 2013-06-25 1:06 PM, "Ed Maste" <<a href="mailto:emaste@freebsd.org">emaste@freebsd.org</a>> wrote:<br><br><blockquote type="cite">To see if there's a common set of root causes for test failures on<br>FreeBSD I took a quick look at a sample of failing test cases.  One<br>that I happened to look at, which doesn't have a common failure cause,<br>is AdvDataFormatterTestCase.<br><br>It relies on a zeroed stack to pass. My FreeBSD desktop runs with<br>memory diagnostics enabled, so memory is filled with 0xa5 by default.<br>Running the command from the test case gives me:<br><br>(lldb) frame variable couple<br>(Couple) couple = {<br>sp = {<br>  x = 0x0000000801808098<br>  y = 0x000000080180809c<br>  z = 0x0000000801809104 "X\xa53\xa56\xa59\xa5"<br>}<br>s = 0x0000000801807050<br><br>and if I turn off the memory diagnostics, I get:<br><br>(lldb) frame variable couple<br>(Couple) couple = {<br>sp = {<br>  x = 0x0000000801808098<br>  y = 0x000000080180809c<br>  z = 0x0000000801809104 "X"<br>}<br>s = 0x0000000801807050<br><br>We could change main.cpp to avoid this, but it is a case<br>representative of real debugging experience, so I'm tempted to just<br>drop the final " from the match string:<br><br>-            substrs = ['(Couple) couple =  {','sp = {','z =','"X"'])<br>+            substrs = ['(Couple) couple =  {','sp = {','z =','"X'])<br><br>Seem reasonable?<br>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br></blockquote><br><br>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a></div></blockquote></div><br></div></body></html>