[Lldb-commits] [PATCH] D136761: [lldb][FormatEntity] Fix closing parenthesis for function.name-with-args frame format
Michael Buch via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 26 05:38:18 PDT 2022
Michael137 updated this revision to Diff 470791.
Michael137 added a comment.
- Add more test cases
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136761/new/
https://reviews.llvm.org/D136761
Files:
lldb/source/Core/FormatEntity.cpp
lldb/test/Shell/Settings/Inputs/names.cpp
lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -0,0 +1,19 @@
+# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+settings set -f frame-format "frame ${function.name-with-args}\n"
+break set -n foo
+run
+# CHECK: frame int foo<int ()>(t={{.*}})
+c
+# CHECK: frame int foo<std::__1::function<int ()>>(t= Function = bar() )
+c
+# CHECK: frame int foo<(anonymous namespace)::$_0>(t={{.*}})
+c
+# CHECK: frame int foo<std::__1::function<int ()>>(t= Function = (anonymous namespace)::anon_bar() )
+c
+# CHECK: frame int foo<void (Foo::*)(std::__1::function<int (int)> const&) const noexcept>(t={{.*}})
+c
+# CHECK: frame void Foo::foo<std::__1::function<int ()>>(this={{.*}}, t= Function = bar() ) const
+c
+# CHECK: frame void Foo::foo<std::__1::function<int ()>>(this={{.*}}, t= Function = (anonymous namespace)::anon_bar() ) const
+q
Index: lldb/test/Shell/Settings/Inputs/names.cpp
===================================================================
--- /dev/null
+++ lldb/test/Shell/Settings/Inputs/names.cpp
@@ -0,0 +1,26 @@
+#include <functional>
+
+struct Foo {
+ template <typename T> void foo(T const &t) const noexcept(true) {}
+};
+
+template <typename T> int foo(T const &t) { return 0; }
+
+int bar() { return 1; }
+
+namespace {
+int anon_bar() { return 1; }
+auto anon_lambda = [](std::function<int(int (*)(int))>) mutable {};
+} // namespace
+
+int main() {
+ foo(bar);
+ foo(std::function{bar});
+ foo(anon_lambda);
+ foo(std::function{anon_bar});
+ foo(&Foo::foo<std::function<int(int)>>);
+ Foo f;
+ f.foo(std::function{bar});
+ f.foo(std::function{anon_bar});
+ return 0;
+}
Index: lldb/source/Core/FormatEntity.cpp
===================================================================
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -1670,9 +1670,9 @@
open_paren =
strchr(open_paren + strlen("(anonymous namespace)"), '(');
if (open_paren)
- close_paren = strchr(open_paren, ')');
+ close_paren = strrchr(open_paren, ')');
} else
- close_paren = strchr(open_paren, ')');
+ close_paren = strrchr(open_paren, ')');
}
if (open_paren)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136761.470791.patch
Type: text/x-patch
Size: 2477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221026/24fbe8f5/attachment-0001.bin>
More information about the lldb-commits
mailing list