diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 2a42eb22938d7..bd19ac513d017 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1605,7 +1605,6 @@ static size_t LookupTypeInModule(Target *target, TypeList type_list; if (module && name_cstr && name_cstr[0]) { const uint32_t max_num_matches = UINT32_MAX; - size_t num_matches = 0; bool name_is_fully_qualified = false; ConstString name(name_cstr); @@ -1616,8 +1615,10 @@ static size_t LookupTypeInModule(Target *target, if (type_list.Empty()) return 0; + const uint64_t num_matches = type_list.GetSize(); + strm.Indent(); - strm.Printf("%" PRIu64 " match%s found in ", (uint64_t)num_matches, + strm.Printf("%" PRIu64 " match%s found in ", num_matches, num_matches > 1 ? "es" : ""); DumpFullpath(strm, &module->GetFileSpec(), 0); strm.PutCString(":\n"); diff --git a/lldb/test/API/commands/target/basic/TestTargetCommand.py b/lldb/test/API/commands/target/basic/TestTargetCommand.py index 30cb9d7d6c84f..9904eb02394a9 100644 --- a/lldb/test/API/commands/target/basic/TestTargetCommand.py +++ b/lldb/test/API/commands/target/basic/TestTargetCommand.py @@ -468,3 +468,11 @@ def test_target_modules_search_paths_query(self): # Invalid arguments. self.expect("target modules search-paths query faz baz", error=True, substrs=["query requires one argument"]) + + @no_debug_info_test + def test_target_modules_type(self): + self.buildB() + self.runCmd("file " + self.getBuildArtifact("b.out"), + CURRENT_EXECUTABLE_SET) + self.expect("target modules lookup --type int", + substrs=["1 match found", 'name = "int"'])