-
Notifications
You must be signed in to change notification settings - Fork 12.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
[lldb][FrameRecognizer] Display the first non-std frame on verbose_trap #108825
Changes from 1 commit
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,22 @@ | ||
namespace std { | ||
void definitely_aborts() { __builtin_verbose_trap("Failed", "Invariant violated"); } | ||
|
||
void aborts_soon() { definitely_aborts(); } | ||
} // namespace std | ||
|
||
void g() { std::aborts_soon(); } | ||
|
||
namespace std { | ||
namespace detail { | ||
void eventually_aborts() { g(); } | ||
} // namespace detail | ||
|
||
inline namespace __1 { | ||
void eventually_aborts() { detail::eventually_aborts(); } | ||
} // namespace __1 | ||
} // namespace std | ||
|
||
int main() { | ||
std::eventually_aborts(); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace std { | ||
namespace detail { | ||
void function_that_aborts() { __builtin_verbose_trap("Bounds error", "out-of-bounds access"); } | ||
} // namespace detail | ||
|
||
inline namespace __1 { | ||
template <typename T> struct vector { | ||
void operator[](unsigned) { detail::function_that_aborts(); } | ||
}; | ||
} // namespace __1 | ||
} // namespace std | ||
|
||
void g() { | ||
std::vector<int> v; | ||
v[10]; | ||
} | ||
|
||
int main() { | ||
g(); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace std { | ||
inline namespace __1 { | ||
template <typename T> struct vector { | ||
void operator[](unsigned) { __builtin_verbose_trap("Bounds error", "out-of-bounds access"); } | ||
}; | ||
} // namespace __1 | ||
} // namespace std | ||
|
||
void g() { | ||
std::vector<int> v; | ||
v[10]; | ||
} | ||
|
||
int main() { | ||
g(); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tests that we show the first non-STL frame when | ||
# a verbose_trap triggers from within the STL. | ||
|
||
# UNSUPPORTED: system-windows | ||
# | ||
# RUN: %clang_host -g -O0 %S/Inputs/verbose_trap-in-stl-callback.cpp -o %t.out | ||
# RUN: %lldb -b -s %s %t.out | FileCheck %s --check-prefixes=CHECK | ||
|
||
run | ||
# CHECK: thread #{{.*}}stop reason = Failed: Invariant violated | ||
frame info | ||
# CHECK: frame #{{.*}}`g() at verbose_trap-in-stl-callback.cpp | ||
q |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tests that we show the first non-STL frame when | ||
# a verbose_trap triggers from within the STL. | ||
|
||
# UNSUPPORTED: system-windows | ||
# | ||
# RUN: %clang_host -g -O0 %S/Inputs/verbose_trap-in-stl-nested.cpp -o %t.out | ||
# RUN: %lldb -b -s %s %t.out | FileCheck %s --check-prefixes=CHECK | ||
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 there a good reason why this isn't an API test? 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. I find it much easier to understand what the test is trying to check when it's done as a From the Testing FAQ:
And later:
IMO these tests fit into the latter category. But I'm happy to change these to API tests if that is more appropriate. |
||
|
||
run | ||
# CHECK: thread #{{.*}}stop reason = Bounds error: out-of-bounds access | ||
frame info | ||
# CHECK: frame #{{.*}}`g() at verbose_trap-in-stl-nested.cpp | ||
q |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tests that we show the first non-STL frame when | ||
# a verbose_trap triggers from within the STL. | ||
|
||
# UNSUPPORTED: system-windows | ||
# | ||
# RUN: %clang_host -g -O0 %S/Inputs/verbose_trap-in-stl.cpp -o %t.out | ||
# RUN: %lldb -b -s %s %t.out | FileCheck %s --check-prefixes=CHECK | ||
|
||
run | ||
# CHECK: thread #{{.*}}stop reason = Bounds error: out-of-bounds access | ||
frame info | ||
# CHECK: frame #{{.*}}`g() at verbose_trap-in-stl.cpp | ||
q |
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.
can you add an upper bound for the loop? I'm afraid that this recognizer might be triggered when looking at the backtrace of an infinite recursion, for example, and then LLDB just hangs.