<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;">Hi Ashok,<div>thanks for submitting an LLDB patch :)</div><div><br></div><div>I have looked at the code and while I see where the patch is coming from, I see a potential issue with it.</div><div><br></div><div>The code in ReadUTFBufferAndDumpToStream, which is what you are editing, is meant to work on a partial string (i.e. one that does not have a NULL terminator at the end). The reason for that is that you might have a wstring that is 1GB long and we would not want to try and read all of it and then display it. What we do is pick a size and only extract that much data. For obvious reasons, your string might be longer than our upper boundary, so you would get a chunk of valid bytes and then no end-of-buffer marker.</div><div><br></div><div>It looks like your code would fail in that case and produce no summary for a string if an EIO was received before \0.</div><div><br></div><div>Is there any reason why you can’t just check if (error == EIO and data_read > 0) and if so treat this as a “partial string” condition and keep going?</div><div>Would that break/crash anything?</div><div><br></div><div>Best,</div><div><div><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-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="font-size: medium; 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>
<br><div><div>On Mar 27, 2013, at 2:52 PM, "Thirumurthi, Ashok" <<a href="mailto:ashok.thirumurthi@intel.com">ashok.thirumurthi@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="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;">The root cause for Bug 15038 is a ptrace EIO that can occur because we don't know the size of a (UTF) string and so read a fixed number of characters for strings.  The attached fix accepts EIO in the case where data has been read and a null terminator of the correct size and alignment was found.<br><br>- Ashok<br><br>-----Original Message-----<br>From:<span class="Apple-converted-space"> </span><a href="mailto:lldb-dev-bounces@cs.uiuc.edu">lldb-dev-bounces@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>[<a href="mailto:lldb-dev-bounces@cs.uiuc.edu">mailto:lldb-dev-bounces@cs.uiuc.edu</a>] On Behalf Of<a href="mailto:bugzilla-daemon@llvm.org">bugzilla-daemon@llvm.org</a><br>Sent: Tuesday, January 22, 2013 10:13 AM<br>To:<span class="Apple-converted-space"> </span><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>Subject: [lldb-dev] [Bug 15038] New: LLDB does not support printing wide-character variables on Linux<br><br><a href="http://llvm.org/bugs/show_bug.cgi?id=15038">http://llvm.org/bugs/show_bug.cgi?id=15038</a><br><br>            Bug #: 15038<br>          Summary: LLDB does not support printing wide-character<br>                   variables on Linux<br>          Product: lldb<br>          Version: unspecified<br>         Platform: PC<br>       OS/Version: Linux<br>           Status: NEW<br>         Severity: enhancement<br>         Priority: P<br>        Component: All Bugs<br>       AssignedTo:<span class="Apple-converted-space"> </span><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>       ReportedBy:<span class="Apple-converted-space"> </span><a href="mailto:daniel.malea@intel.com">daniel.malea@intel.com</a><br>   Classification: Unclassified<br><br><br>Printing a variable of wchar_t type does not behave as expected and results in garbage being printed on the screen.<br><br>To reproduce, remove the @expectedFailureLinux decorator from TestChar1632T.py and TestCxxWCharT.py and run:<br><br>python dotest.py --executable <path-to-lldb> lang/cpp/char1632_t lang/cpp/wchar_t<br><br>--<br>Configure bugmail:<span class="Apple-converted-space"> </span><a href="http://llvm.org/bugs/userprefs.cgi?tab=email">http://llvm.org/bugs/userprefs.cgi?tab=email</a><br>------- You are receiving this mail because: ------- You are the assignee for the bug.<br>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br><span><read-strings.diff></span>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a></div></blockquote></div><br></div></div></body></html>