Skip to content

Commit 4dd4146

Browse files
committed
[lldb] review changes.
1 parent cb2db78 commit 4dd4146

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,9 @@ lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
17381738
g_category);
17391739
if (g_category) {
17401740
// NOTE: the libstdcpp formatters are loaded after libcxx formatters
1741-
// because of a conflict matching the `__debug`namespace in libstdcpp.
1742-
// since lldb priorities the last loaded matching formatter.
1741+
// because we don't want to the libcxx formatters to match the potential
1742+
// `__debug` inline namespace that libstdcpp may use. since LLDB
1743+
// priorities the last loaded matching formatter.
17431744
LoadLibCxxFormatters(g_category);
17441745
LoadLibStdcppFormatters(g_category);
17451746
LoadSystemFormatters(g_category);

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,24 @@ def setUp(self):
1919
@add_test_categories(["libstdcxx"])
2020
@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
2121
def test_with_run_command(self):
22+
build_args = {"EXE": "a.out"}
23+
self.with_run_command("", build_args)
24+
25+
@add_test_categories(["libstdcxx"])
26+
@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
27+
def test_with_run_command_debug(self):
28+
build_args = {"CXXFLAGS": "-D_GLIBCXX_DEBUG", "EXE": "debug_a.out"}
29+
self.with_run_command("__debug::", build_args)
30+
31+
def with_run_command(self, namespace: str, dictionary: dict):
2232
"""Test that that file and class static variables display correctly."""
2333
self.build()
2434
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
35+
self.build(dictionary=dictionary)
36+
artifact_name = dictionary.get("EXE", "a.out")
37+
self.runCmd(
38+
"file " + self.getBuildArtifact(artifact_name), CURRENT_EXECUTABLE_SET
39+
)
2540

2641
lldbutil.run_break_set_by_source_regexp(self, "Set break point at this line.")
2742

@@ -47,8 +62,10 @@ def cleanup():
4762

4863
self.runCmd("frame variable ii --show-types")
4964

65+
match = f"std::{namespace}map<"
5066
self.runCmd(
5167
'type summary add -x "std::map<" --summary-string "map has ${svar%#} items" -e'
68+
f'type summary add -x "{match}" --summary-string "map has ${{svar%#}} items" -e'
5269
)
5370

5471
self.expect("frame variable ii", substrs=["map has 0 items", "{}"])

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,21 @@ def setUp(self):
1818

1919
@add_test_categories(["libstdcxx"])
2020
def test_with_run_command(self):
21+
self.with_run_command({})
22+
23+
@add_test_categories(["libstdcxx"])
24+
def test_with_run_command_debug(self):
25+
build_args = {"CXXFLAGS": "-D_GLIBCXX_DEBUG"}
26+
self.with_run_command(build_args)
27+
28+
def with_run_command(self, dictionary: dict):
2129
"""Test that that file and class static variables display correctly."""
22-
self.build()
23-
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
30+
self.build(dictionary=dictionary)
31+
artifact_name = dictionary.get("EXE", "a.out")
32+
self.runCmd("file " + self.getBuildArtifact(artifact_name), CURRENT_EXECUTABLE_SET)
33+
self.runCmd(
34+
"file " + self.getBuildArtifact(artifact_name), CURRENT_EXECUTABLE_SET
35+
)
2436

2537
lldbutil.run_break_set_by_file_and_line(
2638
self, "main.cpp", self.line, num_expected_locations=-1

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ def setUp(self):
1919
@add_test_categories(["libstdcxx"])
2020
@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
2121
def test_with_run_command(self):
22+
self.with_run_command({})
23+
24+
@add_test_categories(["libstdcxx"])
25+
@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
26+
def test_with_run_command_debug(self):
27+
build_args = {"CXXFLAGS": "-D_GLIBCXX_DEBUG"}
28+
self.with_run_command(build_args)
29+
30+
def with_run_command(self, dictionary: dict):
2231
"""Test that that file and class static variables display correctly."""
23-
self.build()
24-
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
32+
self.build(dictionary=dictionary)
33+
artifact_name = "a.out"
34+
self.runCmd("file " + self.getBuildArtifact(artifact_name), CURRENT_EXECUTABLE_SET)
2535

2636
lldbutil.run_break_set_by_source_regexp(self, "Set break point at this line.")
2737

0 commit comments

Comments
 (0)