<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;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 31, 2016, at 11:15 AM, Zachary Turner via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I think it depends on how bad the thing that happens is.  If you are out of memory, sure you can assert.  If a syscall fails that is supposed to never fail, you can assert.  </div></div></blockquote><div><br class=""></div><div>Admittedly, if you’re out of memory there’s not much forward progress you’re going to be able to make. But, in general, I’d argue that a library shouldn’t assert. The process that is using LLDB might actually know how to deal with an out-of-memory, and it’s not our job as a library to say otherwise.</div><div><br class=""></div><div>lldbassert() is what you should be using - it will assert() in a debug build, which is what you want - but in a release build, it will print out some spiel about what happened, where it happened, and asking to file a bug against lldb - and then continue. Admittedly, you might crash somewhere down the road anyway, but that crash should be considered a bug.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">But if one piece of debug info appears corrupt, I don't think it's worth bringing down the whole process, which could be an entire IDE.  (FWIW yes I agree that having LLDB out of process would be an even better solution to this, but that's quite a large undertaking).  You could be debugging other processes using other debug info which is not corrupt, but you terminate all those sessions because one piece of unrelated debug info in an unrelated process is bad.  Doesn't seem right to me.<div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>+100</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">debug info is program input, and you would never assert on program input, you have to be able to handle unreasonable values gracefully.</div></div><br class=""></div></blockquote><div><br class=""></div><div>+200</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Mar 31, 2016 at 11:06 AM Jim Ingham via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">jingham added a subscriber: jingham.<br class="">
jingham added a comment.<br class="">
<br class="">
I don't agree that asserts are good in released code unless you have no way of backing out of the situation you find yourself in.  After all, you are saying to some unlucky user out there that they can't use the debugger on their app and in general there's nothing they can do about it.  Greg's suggestion is for this low-level API to say "I couldn't find this DIE" and then if that's something higher layers can work around - by saying "Yeah I couldn't find that type" then you've allowed the user to continue their debug session instead of stopping them cold.<br class="">
<br class="">
Not asserting prematurely is particularly important for handling debug information; since we don't control the compiler we need to handle as much junk information as gracefully as possible.<br class="">
<br class="">
Also, asserts, especially for debug information, don't tend to be very helpful in the field.  You get a crash trace which really doesn't tell you the important stuff - what debug file was this, what DIE was bad, etc...  And given the nature of life, this error is going to occur for a user who can't give you their project to repro the bug and can't reduce it to a smaller test case.  Logs are pretty much all you have to go on.  So an un-annotated assert like this is not a good idea.<br class="">
<br class="">
So orthogonal to the assert issue, if you find something not copacetic in the debug information, you should log out as much local information as you can regardless of what you are going to do with the error.<br class="">
<br class="">
Jim<br class="">
<br class="">
<br class="">
Repository:<br class="">
  rL LLVM<br class="">
<br class="">
<a href="http://reviews.llvm.org/D18646" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D18646</a><br class="">
<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
lldb-commits mailing list<br class="">
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="">
</blockquote></div>
_______________________________________________<br class="">lldb-commits mailing list<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits<br class=""></div></blockquote></div><br class=""><div class="">
<div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; 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;"><br class="Apple-interchange-newline">Thanks,</div><div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; 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 class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div>
</div>
<br class=""></body></html>