This is an archive of the discontinued LLVM Phabricator instance.

[Error] Add runtime flag BreakOnError and a debug trap in the Error class
AbandonedPublic

Authored by sgraenitz on Aug 22 2018, 3:51 PM.

Details

Reviewers
lhames
Summary

Small debugging utility to stop immediately when an Error occurs and not only in abort() far up the stack.
Enable/disable in your debug session with one of these:

(lldb) expr BreakOnError = true
(lldb) expr llvm::Error::BreakOnError = true

Diff Detail

Event Timeline

sgraenitz created this revision.Aug 22 2018, 3:51 PM

Hi Stefan,

I usually find it better to put a breakpoint on the ErrorInfoBase constructor: that way you don't hit breakpoints when errors are just passed around.

Would using a breakpoint on ErrorInfoBase address your use case?

sgraenitz updated this revision to Diff 162202.Aug 23 2018, 9:25 AM

Move BreakOnError check to ErrorInfoBase constructor

Hi Lang, thanks for your feedback. Very good point. Changed that!

The additional static variable is not considered ABI-breaking right?

In fact, (lldb) b ErrorInfoBase::ErrorInfoBase is just as good and doesn't need any code change. Is it documented somewhere?

sgraenitz abandoned this revision.Aug 28 2018, 12:34 AM

Hi Stefan,

The additional static variable is not considered ABI-breaking right?

No, it would not be.

In fact, (lldb) b ErrorInfoBase::ErrorInfoBase is just as good and doesn't need any code change. Is it documented somewhere?

No, I do not think it is. That would be a good tip to add to the programmer's manual.