[cfe-dev] How to break in debugger when -fsanitize=undefined prints something?
ashaduri at gmail.com
Thu May 30 12:15:23 PDT 2013
On Tue, 28 May 2013 13:05:41 -0700
Richard Smith wrote:
> > 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.
For this particular warning I found that the correct function is
> 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.
Yes, the lack of documentation (including on the switch you mention)
is unfortunate. I found that an easier way to do this is to search the
warning text in "projects/compiler-rt/lib/ubsan/ubsan_handlers.cc" and
just break on the function name it's mentioned in.
> 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
Yes, a backtrace would be great! Not sure I'm able to provide any
patches at this point though.
Thanks a lot for your help,
More information about the cfe-dev