<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><font size="2"><span style="font-size:10pt;"><span style="font-family: Calibri,Arial,Helvetica,sans-serif; font-size: 12pt;"></span><span style="font-size: 11pt;">Catching
</span><span style="font-size: 11pt;">SIGABRT</span></span></font><span style="font-size: 11pt;"> seems reasonable for a graceful crash, but I'm also already making use of LLVM's internal fatal_error_handler. However said handler is only called for very specific
 things, the rest all use direct calls to assert, do I need to disable the LLVM_ENABLE_ASSERTIONS flag to change this?<br>
<br>
I also just noticed however that there's an exception handler flag too, which I didn't notice before as it's called "LLVM_ENABLE_EH". Will be rebuilding now with that enabled and will see if it works how I want it to, but I have to question the sensibility
 of naming the flag like that when there's already flags with much longer names...?</span><br>
</p>
<br>
<p>- Paul<br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Sanjoy Das <sanjoy@playingwithpointers.com><br>
<b>Sent:</b> 16 August 2016 09:27<br>
<b>To:</b> Paul Hancock<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] LLVM libraries and custom assertions.</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">You can consider catching SIGABRT, or maybe LD_PRELOAD'ing an<br>
implementation for abort (not sure if the latter is possible, but<br>
should be easy to try out).  I don't know how to do better than that<br>
without recompiling LLVM.<br>
<br>
Another option is to let LLVM's client register an "error handler"<br>
that gets called instead of abort() on a failed assert, but you'll<br>
have to change and rebuild LLVM to do this (and have a non-standard<br>
assert definition).  This can be a little cleaner, depending on what<br>
you're trying to do.  I don't have a good sense of what others think<br>
of this, but I'll be for upstreaming a mechanism of this sort to LLVM.<br>
<br>
-- Sanjoy<br>
<br>
On Mon, Aug 15, 2016 at 4:19 PM, Paul Hancock via llvm-dev<br>
<llvm-dev@lists.llvm.org> wrote:<br>
> Is there a simple method for compiling a custom assertion header/call into<br>
> all the LLVM libraries? I want my application to be able to handle any<br>
> thrown assertions (ie; as an exception) and recover or crash gracefully. I<br>
> already have a custom header in place in the application's source, however<br>
> this doesn't have an effect on [most of] the already compiled lib's.<br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a id="LPlnk553037" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_14713050636480.18182730388665302">
<table style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_14713050636460.47645657829985033" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_14713050636470.02458645378048152">
<div id="LPRemovePreviewContainer_14713050636470.03504335853236795"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_14713050636470.13579864885995974">
<a target="_blank" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="text-decoration: none;" id="LPUrlAnchor_14713050636470.09097670251478918">llvm-dev Info Page</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_14713050636480.32099558479575596">
lists.llvm.org</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_14713050636480.37487500338317736">
To see the collection of prior postings to the list, visit the llvm-dev Archives. Using llvm-dev: To post a message to all the list members, send ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
><br>
<br>
<br>
<br>
-- <br>
Sanjoy Das<br>
<a href="http://playingwithpointers.com">http://playingwithpointers.com</a><br>
</div>
</span></font></div>
</div>
</body>
</html>