[cfe-dev] How to break in debugger when -fsanitize=undefined prints something?
richard at metafoo.co.uk
Tue May 28 13:05:41 PDT 2013
Tue, May 28, 2013 at 11:35 AM, Alexander Shaduri <ashaduri at gmail.com>wrote:
> I'm trying out the -fsanitize=undefined option with clang
> (Linux, x86-64) and I'm getting a few runtime warnings
> with the code I'm working with.
> I'd like to set a breakpoint on a function that prints these
> warnings so that I can actually see the backtrace, but
> I can't figure out how to do that.
> I know there's -fsanitize-undefined-trap-on-error, but it
> causes "Illegal Instruction" on the first warning, and due
> to this warning being in another library, I cannot fix it and
> continue to my own code.
> Here's one of the warnings I get, but cannot debug because
> I cannot find the actual location:
> liblocal_qwt.so:0x4732fe: runtime error: load of value 4294967199, which
> is not a valid value for type 'Qt::AlignmentFlag'
For this error, you can break on __ubsan_handle_type_mismatch.
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
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev