This is an archive of the discontinued LLVM Phabricator instance.

Add Logging API Callback for All *SAN Passes
AbandonedPublic

Authored by Ben0mega on Apr 16 2018, 2:22 PM.

Details

Summary

Intercept all *SAN printf calls and provide the resulting string to a user-provided callback. This can be used to extract error messages and log them appropriately.

Diff Detail

Event Timeline

Ben0mega created this revision.Apr 16 2018, 2:22 PM
Herald added subscribers: Restricted Project, llvm-commits, kubamracek. · View Herald TranscriptApr 16 2018, 2:22 PM

Can you please reupload with more context (-U9999 or similar when creating the diff)?

Can we also get a testcase that actually uses this feature? It looks like the change in error_report_callback.cc doesn't really check that the callback is called, how many times it's called or that the strings are what's expected.

Don't we already have something like this in another form?

@kcc: I am hoping that this work is duplicated and I can use something else - I am more than open to another, existing API.

@kubamracek : I am not sure how to reupload with context - I have a raw diff - but I will work on that (and the test case).

Ben0mega updated this revision to Diff 142703.Apr 16 2018, 2:55 PM

More context.

We have WriteOneLineToSyslog, but I guess it's used on Android only?

It seems that the existing weak OnPrint could fulfill the purpose of an application defined "callback" .
Right now it's not be used by any of the sanitizers, and having a weak function & 8 callbacks serving the same purpose seems overkill.

It seems that the existing weak OnPrint could fulfill the purpose of an application defined "callback" .

That looks like it would be perfect for my needs - thank you!

Ben0mega abandoned this revision.Apr 18 2018, 1:48 PM