<div dir="ltr">We don't have the wheel though. For example, it's not implemented on Android and it's not implemented on Windows. I could duplicate a bunch of code from LLVM, but why? The code is already there in LLVM. And what about the Android people? There's currently about 3 completely different implementations of backtracing (MacOSX, FreeBSD, Linux). All of them print backtraces in a different format. We can call 1 function and have backtraces in the same format for everyone, including Windows and Android, right now. This seems like kind of a straightforward case of code reuse to me, and a clear win, so I'm not sure why it's that contentious.<br><div><br></div><div>If we need to interoperate with StreamString, then we should implement an overload **in LLVM** that returns an std::string.</div></div><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 5:30 PM Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> 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><blockquote type="cite"><div>On Mar 4, 2015, at 5:18 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:</div><br><div><div dir="ltr">Hmm, I'm not sure I agree. Whether it prints to a Stream or directly to stderr is kind of an implementation detail. Not very important since it just ends up to stdout or stderr anwyay and we don't do anything else with the backtrace except print it and throw it away. <br><div><br></div><div>llvm already has functionality built in to serve exactly this purpose. Why shouldn't we use it? Not only are we sure that it's implemented on all platforms that LLVM supports,</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>If that is a concern, I posit that we should implement Host::Backtrace() on all platforms</div><div><br></div><div>The alternative of course would be to get rid of Host::Backtrace() entirely, and use the similar LLVM facility - but given how our own facility uses Streams instead of FILE*, I don’t think that is actually a good change</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div dir="ltr"><div> but the format is consistent on all of these platforms, and anyway why reinvent the wheel?</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>Except in this case we already have the wheel</div><br><blockquote type="cite"><div></div></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 5:15 PM Enrico Granata <<a href="mailto:granata.enrico@gmail.com" target="_blank">granata.enrico@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">================<br>
Comment at: source/Utility/LLDBAssert.cpp:<u></u>14<br>
@@ -13,1 +13,3 @@<br>
+<br>
+#include "llvm/Support/Signals.h"<br>
<br>
----------------<br>
I would not do this.<br>
Printing to a Stream is the LLDB way to do this, no reason for switching to this LLVM API<br>
<br>
================<br>
Comment at: source/Utility/LLDBAssert.cpp:<u></u>36<br>
@@ -37,1 +35,3 @@<br>
+ llvm::sys::PrintStackTrace(<u></u>stderr);<br>
+ fprintf(stderr, "please file a bug report against lldb reporting this failure log, and as many details as possible\n");<br>
}<br>
----------------<br>
Printing to stderr is probably a good idea<br>
But, again, I prefer to stick to the LLDB host layer<br>
<br>
It's probably fine to reimplement Host::Backtrace() in terms of LLVM APIs if it can be done generally and with decent performance, but I don't see much in terms of added value in this change<br>
<br>
<a href="http://reviews.llvm.org/D8069" target="_blank">http://reviews.llvm.org/D8069</a><br>
<br>
EMAIL PREFERENCES<br>
<a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/<u></u>settings/panel/<u></u>emailpreferences/</a><br>
<br>
<br>
</blockquote></div></div></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div>
_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br></div></blockquote></div><br></div></blockquote></div>