-
Notifications
You must be signed in to change notification settings - Fork 352
[lldb][FrameRecognizer] Make VerboseTrapFrameRecognizer aware of Swift-C++ interop frames #9306
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
Changes from all commits
7e8aa85
d9596f1
0b21e70
567a5d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| SWIFT_SOURCES := main.swift | ||
| SWIFT_CXX_INTEROP := 1 | ||
| SWIFTFLAGS_EXTRAS = -Xcc -I$(SRCDIR) | ||
| include Makefile.rules |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
|
|
||
| """ | ||
| Test that verbose_trap works on forward interop mode. | ||
| """ | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test.decorators import * | ||
|
|
||
|
|
||
| class TestSwiftForwardInteropVerboseTrap(TestBase): | ||
|
|
||
| @swiftTest | ||
| def test(self): | ||
| self.build() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just do: ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it because we don't expect tp hit the breakpoint?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, Might be worth creating a wrapper for the "just launch the executable" case. That way we could make use of |
||
| target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) | ||
| self.assertTrue(target, VALID_TARGET) | ||
|
|
||
| target.BreakpointCreateByName("Break here", "a.out") | ||
| process = target.LaunchSimple(None, None, self.get_process_working_directory()) | ||
| self.assertTrue(process, PROCESS_IS_VALID) | ||
|
|
||
| # Make sure we stopped in the first user-level frame. | ||
| self.assertTrue(self.frame().name.startswith("a.takes<")) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #include <iterator> | ||
|
|
||
| namespace std { | ||
| void function_that_aborts() { __builtin_verbose_trap("Error", "from C++"); } | ||
|
|
||
| struct ConstIterator { | ||
| private: | ||
| int value; | ||
|
|
||
| public: | ||
| // Make sure this auto-conforms to UnsafeCxxInputIterator | ||
|
|
||
| using iterator_category = std::input_iterator_tag; | ||
| using value_type = int; | ||
| using pointer = int *; | ||
| using reference = const int &; | ||
| using difference_type = int; | ||
|
|
||
| ConstIterator(int value) : value(value) {} | ||
|
|
||
| void operator*() const { std::function_that_aborts(); } | ||
|
|
||
| ConstIterator &operator++() { return *this; } | ||
| ConstIterator operator++(int) { return ConstIterator(value); } | ||
|
|
||
| bool operator==(const ConstIterator &other) const { return false; } | ||
| bool operator!=(const ConstIterator &other) const { return true; } | ||
| }; | ||
|
|
||
| } // namespace std |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import Aborts | ||
|
|
||
| func takes(_ t: some UnsafeCxxInputIterator) { | ||
| t.pointee | ||
| } | ||
|
|
||
| func main() { | ||
| var x = std.ConstIterator(137); | ||
| takes(x); | ||
| print("Break here"); | ||
| } | ||
|
|
||
| main() | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module Aborts { | ||
| header "aborts.h" | ||
| requires cplusplus | ||
| } | ||
|
|
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.
stray
;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.
FYI, maybe it'd be okay to remove all protocol witnesses.