I don't think there's a good reason for this behavior to be considered
ObjC-specific. We can generalize this.
Details
- Reviewers
davide JDevlieghere jingham kubamracek clayborg - Commits
- rZORG5dedc5659959: [Target] Generalize some behavior in Thread
rZORGb9932a9830ef: [Target] Generalize some behavior in Thread
rG5dedc5659959: [Target] Generalize some behavior in Thread
rGb9932a9830ef: [Target] Generalize some behavior in Thread
rGbd3adfe5e3bc: [Target] Generalize some behavior in Thread
rL360741: [Target] Generalize some behavior in Thread
rLLDB360741: [Target] Generalize some behavior in Thread
Diff Detail
- Repository
- rLLDB LLDB
Event Timeline
If you really are going to support many languages you need to figure out how to tell folks what really happened with more specificity. For instance, you can use C++ to throw anything, so you could throw an ObjC object from a C++ exception throw. So you need to distinguish between the language of the exception thrown (which is captured by the ValueObject you return) and the language runtime throwing the language. So we need a way to query that. Also, there's no formula reason why you couldn't have two languages throwing an exception at the same time (for instance if a C++ exception is unwinding the stack and the destructor of some ObjC object that is getting destroyed throws an NSException, etc... So there needs to be some way to handle that.
This change isn't wrong but it gives a false impression of generality which makes it less well motivated.
I agree.
For instance, you can use C++ to throw anything, so you could throw an ObjC object from a C++ exception throw. So you need to distinguish between the language of the exception thrown (which is captured by the ValueObject you return) and the language runtime throwing the language. So we need a way to query that. Also, there's no formula reason why you couldn't have two languages throwing an exception at the same time (for instance if a C++ exception is unwinding the stack and the destructor of some ObjC object that is getting destroyed throws an NSException, etc... So there needs to be some way to handle that.
This change isn't wrong but it gives a false impression of generality which makes it less well motivated.
Better support for exception handling is definitely something we should work towards. This patch doesn't actually change behavior, but I understand your concern that generalizing will make it look like things are better supported than they actually are. My motivation behind this change is removing language-specific knowledge from Thread, which is a goal that I think is worth pursuing. I could preserve/modify the comments that were there noting that only ObjC works right now.
Unfortunately I can't land this patch as-is. With this patch applied, TestObjCExceptions fails. It looks like c++ exceptions are supported at the bare minimum as a part of the objc exception handling logic.
It was failing 2 subtests: test_objc_exceptions_at_throw and test_cxx_exceptions_at_abort. The first test was failing because of a minor bug that I will include a fix for in this patch. The second test is failing because of an assertion that the current exception we get should not be valid, but now it is valid. That is because we are able to get the exception object from the C++ runtime now. However, the assertion that the exception backtrace isn't valid still holds (since that isn't implemented for C++). I'm going to update this patch to reflect this new information in the near future and then request another review from y'all.