Tue, May 28, 2013 at 11:35 AM, Alexander Shaduri <span dir="ltr"><<a href="mailto:ashaduri@gmail.com" target="_blank">ashaduri@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hello,<br>
<br>
I'm trying out the -fsanitize=undefined option with clang<br>
(Linux, x86-64) and I'm getting a few runtime warnings<br>
with the code I'm working with.<br>
<br>
I'd like to set a breakpoint on a function that prints these<br>
warnings so that I can actually see the backtrace, but<br>
I can't figure out how to do that.<br>
<br>
I know there's -fsanitize-undefined-trap-on-error, but it<br>
causes "Illegal Instruction" on the first warning, and due<br>
to this warning being in another library, I cannot fix it and<br>
continue to my own code.<br>
<br>
Here's one of the warnings I get, but cannot debug because<br>
I cannot find the actual location:<br>
liblocal_qwt.so:0x4732fe: runtime error: load of value 4294967199, which is not a valid value for type 'Qt::AlignmentFlag'<br></blockquote><div><br></div><div>For this error, you can break on __ubsan_handle_type_mismatch.</div>
<div><br></div><div>We don't have documentation explaining how the checks map to handler functions yet. To find the handler name in general, you can build a program which exhibits the diagnostic with -fno-sanitize-recover, break on calls to '__sanitizer::Die()', and find the __ubsan_handle_* function in the backtrace.</div>
<div><br></div><div>I would also like to include a backtrace with the ubsan warnings, but that is not implemented yet. Patches very much welcome! (The backtrace functionality from the other sanitizers could almost certainly be reused here.)</div>
</div>