-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove LOG(FATAL) #3164
Remove LOG(FATAL) #3164
Conversation
src/attached_probe.cpp
Outdated
@@ -1248,18 +1249,20 @@ | |||
// FIXME when iovisor/bcc#2064 is merged, optionally pass probe_.path | |||
ctx = bcc_usdt_new_frompid(pid, nullptr); | |||
if (!ctx) | |||
LOG(FATAL) << "Error initializing context for probe: " + probe_.name + | |||
", for PID: " + std::to_string(pid); | |||
throw std::runtime_error( |
Check notice
Code scanning / CodeQL
FIXME comment Note
Can |
I think creating a custom exception is useful but I don't like the idea of |
Additionally, the way
|
c33a8de
to
71adb27
Compare
@@ -253,8 +253,7 @@ llvm::Type *IRBuilderBPF::GetType(const SizedType &stype) | |||
ty = getInt8Ty(); | |||
break; | |||
default: | |||
LOG(FATAL) << stype.GetSize() | |||
<< " is not a valid type size for GetType"; | |||
LOG(BUG) << stype.GetSize() << " is not a valid type size for GetType"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These errors irbuilderbpf all seemed like internal bugs. Please correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that you're right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -253,8 +253,7 @@ llvm::Type *IRBuilderBPF::GetType(const SizedType &stype) | |||
ty = getInt8Ty(); | |||
break; | |||
default: | |||
LOG(FATAL) << stype.GetSize() | |||
<< " is not a valid type size for GetType"; | |||
LOG(BUG) << stype.GetSize() << " is not a valid type size for GetType"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that you're right.
Replace these with either LOG(BUG), LOG(ERROR) and exit(1) in main.cpp, or `throw FatalUserException`. This is to avoid calling `abort` for user errors and removes the confusion between `LOG(ERROR)` and `LOG(FATAL)`. Issue: bpftrace#3163
Replace these with either LOG(BUG), LOG(ERROR) and exit(1) in main.cpp, or
throw std::runtime_error
.This is to avoid calling
abort
for user errors and removes the confusion betweenLOG(ERROR)
andLOG(FATAL)
.Issue: #3163
Checklist
man/adoc/bpftrace.adoc
CHANGELOG.md