[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64
DavidSpickett edited reviewers, added: omjavaid; removed: DavidSpickett. DavidSpickett added a comment. I don't know enough to approve, Omair is the expert here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148752/new/ https://reviews.llvm.org/D148752 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b767b05 - [lldb][tests] TestPreferredName.py: Fix for older compilers
Author: Michael Buch Date: 2023-04-24T08:33:07-04:00 New Revision: b767b050414399940f8d7f96e4564a1e5c84879f URL: https://github.com/llvm/llvm-project/commit/b767b050414399940f8d7f96e4564a1e5c84879f DIFF: https://github.com/llvm/llvm-project/commit/b767b050414399940f8d7f96e4564a1e5c84879f.diff LOG: [lldb][tests] TestPreferredName.py: Fix for older compilers This only works as of D145803, where we re-point the `DW_AT_type` based on existence of `[[clang::preferred_name]]` Added: Modified: lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py Removed: diff --git a/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py b/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py index ce8be32099711..9c3f0e6a05229 100644 --- a/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py +++ b/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py @@ -11,6 +11,7 @@ class TestPreferredName(TestBase): +@skipIf(compiler="clang", compiler_version=['<', '16.0']) def test_frame_var(self): self.build() lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp")) @@ -26,6 +27,7 @@ def test_frame_var(self): self.expect("frame variable varChar", substrs=["Bar"]) self.expect("frame variable varFooInt", substrs=["Foo"]) +@skipIf(compiler="clang", compiler_version=['<', '16.0']) def test_expr(self): self.build() lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp")) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b4cae6b - [lldb][tests] TestPreferredName.py: add missing import
Author: Michael Buch Date: 2023-04-24T08:40:32-04:00 New Revision: b4cae6bf53b92583e8d58f41e889704e9a473391 URL: https://github.com/llvm/llvm-project/commit/b4cae6bf53b92583e8d58f41e889704e9a473391 DIFF: https://github.com/llvm/llvm-project/commit/b4cae6bf53b92583e8d58f41e889704e9a473391.diff LOG: [lldb][tests] TestPreferredName.py: add missing import Added: Modified: lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py Removed: diff --git a/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py b/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py index 9c3f0e6a0522..6deb9bffa375 100644 --- a/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py +++ b/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py @@ -6,8 +6,7 @@ import lldb import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.lldbtest import * -from lldbsuite.test import decorators - +from lldbsuite.test.decorators import * class TestPreferredName(TestBase): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5379189 - [lldb][test] TestCPP20Standard.py: skip on older compilers
Author: Michael Buch Date: 2023-04-24T12:05:20-04:00 New Revision: 53791896de3fcc5606c190fa4e4552383ee1dcb8 URL: https://github.com/llvm/llvm-project/commit/53791896de3fcc5606c190fa4e4552383ee1dcb8 DIFF: https://github.com/llvm/llvm-project/commit/53791896de3fcc5606c190fa4e4552383ee1dcb8.diff LOG: [lldb][test] TestCPP20Standard.py: skip on older compilers Requires C++20 support (at least for the spaceship operator). Seems to work back to Clang-11 Added: Modified: lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py Removed: diff --git a/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py b/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py index dbca9092e3abf..017e621fd06e5 100644 --- a/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py +++ b/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py @@ -4,6 +4,7 @@ from lldbsuite.test import lldbutil class TestCPP20Standard(TestBase): +@skipIf(compiler="clang", compiler_version=['<', '11.0']) def test_cpp20(self): """ Tests that we can evaluate an expression in C++20 mode ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D148397: [lldb/Utility] Add opt-in shadow mode to event listeners
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148397/new/ https://reviews.llvm.org/D148397 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D149096: [lldb] Speed up looking for dSYM next to executable
bulbazord created this revision. bulbazord added reviewers: JDevlieghere, mib, jingham, jasonmolenda, clayborg. Herald added a project: All. bulbazord requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. The goal of this patch is to speed up the code that searches for a dSYM next to an executable. I generated a project with 10,000 c source files and accompanying header files using a script that I wrote. I generated objects for each of them (with debug info in it) but intentionally did not create a dSYM for anything. I also built a driver, and then linked everything into one binary. The project itself is very simple, but the number of object files involved is very large. I then measured lldb's performance debugging this binary. (NB: I plan on putting this script into lldb's script directory at some point after some cleanups) Using the command `lldb -x -b -o 'b main' $binary` (launch lldb with no lldbinit, place a breakpoint on main, and then quit), I measured how long this takes and measured where time was being spent. On my machine, I used hyperfine to get some statistics about how long this actually took: alex@alangford many-objects % hyperfine -w 3 -- "$lldb -x -b -o 'b main' $binary" Benchmark 1: $lldb -x -b -o 'b main' $binary Time (mean ± σ): 4.395 s ± 0.046 s[User: 3.239 s, System: 1.245 s] Range (min … max):4.343 s … 4.471 s10 runs Out of the ~4.4 seconds of work, it looks like ~630ms were being spent on `LocateDSYMInVincinityOfExecutable`. After digging in further, we were spending the majority of our time manipulating paths in `FileSpec` with `RemoveLastPathComponent` and `AppendPathComponent`. There were a lot of FileSystem operations as well, so I made an attempt to minimize the amount of calls to `Exists` and `Resolve` as well. Given how widely used the code in FileSpec is, I opted to improve this codepath specifically rather than attempt to refactor the internals of FileSpec. I believe that improving FileSpec is also worth doing, but as it is a larger change with far reaching implications, I opted to make this change instead. With this change, we shave off approximately 600ms: alex@alangford many-objects % hyperfine -w 3 -- "$lldb -x -b -o 'b main' $binary" Benchmark 1: $lldb -x -b -o 'b main' $binary Time (mean ± σ): 3.822 s ± 0.056 s[User: 2.749 s, System: 1.167 s] Range (min … max):3.750 s … 3.920 s10 runs Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D149096 Files: lldb/source/Symbol/LocateSymbolFile.cpp Index: lldb/source/Symbol/LocateSymbolFile.cpp === --- lldb/source/Symbol/LocateSymbolFile.cpp +++ lldb/source/Symbol/LocateSymbolFile.cpp @@ -80,58 +80,47 @@ // expanded/uncompressed dSYM and return that filepath in dsym_fspec. static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec, -const FileSpec &exec_fspec, +llvm::StringRef executable_path, +llvm::sys::path::Style path_style, FileSpec &dsym_fspec) { - ConstString filename = exec_fspec.GetFilename(); - FileSpec dsym_directory = exec_fspec; - dsym_directory.RemoveLastPathComponent(); - - std::string dsym_filename = filename.AsCString(); - dsym_filename += ".dSYM"; - dsym_directory.AppendPathComponent(dsym_filename); - dsym_directory.AppendPathComponent("Contents"); - dsym_directory.AppendPathComponent("Resources"); - dsym_directory.AppendPathComponent("DWARF"); - - if (FileSystem::Instance().Exists(dsym_directory)) { - -// See if the binary name exists in the dSYM DWARF -// subdir. -dsym_fspec = dsym_directory; -dsym_fspec.AppendPathComponent(filename.AsCString()); -if (FileSystem::Instance().Exists(dsym_fspec) && -FileAtPathContainsArchAndUUID(dsym_fspec, mod_spec.GetArchitecturePtr(), + llvm::StringRef filename = llvm::sys::path::filename(executable_path, path_style); + llvm::SmallString<64> dsym_file = executable_path; + + dsym_file.append(".dSYM"); + llvm::sys::path::append(dsym_file, path_style, "Contents", "Resources", + "DWARF", filename); + + // First, see if the binary name exists in the dSYM DWARF subdir + if (FileSystem::Instance().Exists(dsym_file)) { +dsym_fspec.SetFile(dsym_file, path_style); +if (FileAtPathContainsArchAndUUID(dsym_fspec, mod_spec.GetArchitecturePtr(), mod_spec.GetUUIDPtr())) { return true; } + } -// See if we have "../CF.framework" - so we'll look for -// CF.framework.dSYM/Contents/Resources/DWARF/CF -// We need to drop the last suffix after '.' to match -// 'CF' in the DWARF subdir. -std::string binary_name(filename.AsCString()); -auto last_dot = bi
[Lldb-commits] [PATCH] D149096: [lldb] Speed up looking for dSYM next to executable
bulbazord added a comment. Perhaps the right thing to do would be to try to do the larger FileSpec changes instead? The changes in `Symbols::LocateExecutableSymbolFile` can probably go in regardless though. We call `Resolve` on all the file specs in `debug_file_search_paths` on line 307, so no need to call `Resolve` twice. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149096/new/ https://reviews.llvm.org/D149096 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D149111: [lldb] Add support for specifying language when setting watchpoint by expression
bulbazord created this revision. bulbazord added reviewers: JDevlieghere, mib, jingham, jasonmolenda, kastiglione, Michael137. Herald added a project: All. bulbazord requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. This is useful in contexts where you have multiple languages in play: You may be stopped in a frame for language A, but want to set a breakpoint with an expression using language B. The current way to do this is to use the setting `target.language` while setting the watchpoint and unset it after the watchpoint is set, but that's kind of clunky and somewhat error-prone. This should add a better way to do this. rdar://108202559 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D149111 Files: lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h lldb/source/Commands/CommandObjectWatchpoint.cpp lldb/source/Interpreter/OptionGroupWatchpoint.cpp lldb/test/Shell/Watchpoint/ExpressionLanguage.test lldb/test/Shell/Watchpoint/Inputs/languages.cpp Index: lldb/test/Shell/Watchpoint/Inputs/languages.cpp === --- /dev/null +++ lldb/test/Shell/Watchpoint/Inputs/languages.cpp @@ -0,0 +1,12 @@ +#include +#include + +uint64_t g_foo = 5; +uint64_t g_bar = 6; +uint64_t g_baz = 7; + +int main() { + int val = 8; + printf("Hello world! %d\n", val); + return 0; +} Index: lldb/test/Shell/Watchpoint/ExpressionLanguage.test === --- /dev/null +++ lldb/test/Shell/Watchpoint/ExpressionLanguage.test @@ -0,0 +1,19 @@ +# RUN: %clangxx_host %p/Inputs/languages.cpp -g -o %t.out +# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %s %t.out 2>&1 | FileCheck %s + +settings show interpreter.stop-command-source-on-error +# CHECK: interpreter.stop-command-source-on-error (boolean) = false + +b main +run +# CHECK: stopped +# CHECK-NEXT: stop reason = breakpoint + +watchpoint set expression -- &g_foo +# CHECK: Watchpoint created: + +watchpoint set expression -l c++ -- &g_bar +# CHECK: Watchpoint created: + +watchpoint set expression -l fake -- &g_baz +# CHECK: Unknown language type: 'fake' for expression. List of supported languages: Index: lldb/source/Interpreter/OptionGroupWatchpoint.cpp === --- lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -10,6 +10,7 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/OptionArgParser.h" +#include "lldb/Target/Language.h" #include "lldb/lldb-enumerations.h" using namespace lldb; @@ -62,7 +63,17 @@ "Specify the type of watching to perform."}, {LLDB_OPT_SET_1, false, "size", 's', OptionParser::eRequiredArgument, nullptr, OptionEnumValues(g_watch_size), 0, eArgTypeByteSize, - "Number of bytes to use to watch a region."}}; + "Number of bytes to use to watch a region."}, +{LLDB_OPT_SET_2, + false, + "language", + 'l', + OptionParser::eRequiredArgument, + nullptr, + {}, + 0, + eArgTypeLanguage, + "Language of expression to run"}}; bool OptionGroupWatchpoint::IsWatchSizeSupported(uint32_t watch_size) { for (const auto& size : g_watch_size) { @@ -81,6 +92,18 @@ Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { + case 'l': { +language_type = Language::GetLanguageTypeFromString(option_arg); +if (language_type == eLanguageTypeUnknown) { + StreamString sstr; + sstr.Printf("Unknown language type: '%s' for expression. List of " + "supported languages:\n", + option_arg.str().c_str()); + Language::PrintSupportedLanguagesForExpressions(sstr, " ", "\n"); + error.SetErrorString(sstr.GetString()); +} +break; + } case 'w': { WatchType tmp_watch_type; tmp_watch_type = (WatchType)OptionArgParser::ToOptionEnum( @@ -108,6 +131,7 @@ watch_type_specified = false; watch_type = eWatchInvalid; watch_size = 0; + language_type = eLanguageTypeUnknown; } llvm::ArrayRef OptionGroupWatchpoint::GetDefinitions() { Index: lldb/source/Commands/CommandObjectWatchpoint.cpp === --- lldb/source/Commands/CommandObjectWatchpoint.cpp +++ lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -835,8 +835,7 @@ m_arguments.push_back(arg); // Absorb the '-w' and '-s' options into our option group. -m_option_group.Append(&m_option_watchpoint, LLDB_OPT_SET_ALL, - LLDB_OPT_SET_1); +m_option_group.Append(&m_option_watchpoint, LLDB_OPT_SET_1, LLDB_OPT_SET_1); m_option_group.Finalize(); } @@ -990,6 +989,7 @@ : CommandObjectRaw( interpreter, "watchpoint set expression", "Set a watchpoint on
[Lldb-commits] [PATCH] D148282: Fix the help for "type X delete" to make the -a & -w behaviors clear
jingham updated this revision to Diff 516590. jingham added a comment. Adopt suggestions from Alex. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148282/new/ https://reviews.llvm.org/D148282 Files: lldb/source/Commands/CommandObjectType.cpp Index: lldb/source/Commands/CommandObjectType.cpp === --- lldb/source/Commands/CommandObjectType.cpp +++ lldb/source/Commands/CommandObjectType.cpp @@ -39,9 +39,6 @@ #include #include -#define CHECK_FORMATTER_KIND_MASK(VAL) \ - ((m_formatter_kind_mask & (VAL)) == (VAL)) - using namespace lldb; using namespace lldb_private; @@ -100,6 +97,22 @@ return false; } +const char *FormatCategoryToString(FormatCategoryItem item, bool long_name) { + switch (item) { + case eFormatCategoryItemSummary: +return "summary"; + case eFormatCategoryItemFilter: +return "filter"; + case eFormatCategoryItemSynth: +if (long_name) + return "synthetic child provider"; +return "synthetic"; + case eFormatCategoryItemFormat: +return "format"; + } + llvm_unreachable("Fully covered switch above!"); +}; + #define LLDB_OPTIONS_type_summary_add #include "CommandOptions.inc" @@ -754,16 +767,25 @@ }; CommandOptions m_options; - uint32_t m_formatter_kind_mask; + FormatCategoryItem m_formatter_kind; Options *GetOptions() override { return &m_options; } + + static constexpr const char *g_short_help_template = + "Delete an existing %s for a type."; + + static constexpr const char *g_long_help_template = + "Delete an existing %s for a type. Unless you specify a " + "specific category or all categories, only the " + "'default' category is searched. The names must be exactly as " + "shown in the 'type %s list' output"; public: CommandObjectTypeFormatterDelete(CommandInterpreter &interpreter, - uint32_t formatter_kind_mask, - const char *name, const char *help) - : CommandObjectParsed(interpreter, name, help, nullptr), -m_formatter_kind_mask(formatter_kind_mask) { + FormatCategoryItem formatter_kind) + : CommandObjectParsed(interpreter, +FormatCategoryToString(formatter_kind, false)), +m_formatter_kind(formatter_kind) { CommandArgumentEntry type_arg; CommandArgumentData type_style_arg; @@ -773,6 +795,19 @@ type_arg.push_back(type_style_arg); m_arguments.push_back(type_arg); + +const char *kind = FormatCategoryToString(formatter_kind, true); +const char *short_kind = FormatCategoryToString(formatter_kind, false); + +StreamString s; +s.Printf(g_short_help_template, kind); +SetHelp(s.GetData()); +s.Clear(); +s.Printf(g_long_help_template, kind, short_kind); +SetHelpLong(s.GetData()); +s.Clear(); +s.Printf("type %s delete", short_kind); +SetCommandName(s.GetData()); } ~CommandObjectTypeFormatterDelete() override = default; @@ -785,7 +820,7 @@ DataVisualization::Categories::ForEach( [this, &request](const lldb::TypeCategoryImplSP &category_sp) { - category_sp->AutoComplete(request, m_formatter_kind_mask); + category_sp->AutoComplete(request, m_formatter_kind); return true; }); } @@ -812,7 +847,7 @@ if (m_options.m_delete_all) { DataVisualization::Categories::ForEach( [this, typeCS](const lldb::TypeCategoryImplSP &category_sp) -> bool { -category_sp->Delete(typeCS, m_formatter_kind_mask); +category_sp->Delete(typeCS, m_formatter_kind); return true; }); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -827,14 +862,14 @@ DataVisualization::Categories::GetCategory(m_options.m_language, category); if (category) -delete_category = category->Delete(typeCS, m_formatter_kind_mask); +delete_category = category->Delete(typeCS, m_formatter_kind); extra_deletion = FormatterSpecificDeletion(typeCS); } else { lldb::TypeCategoryImplSP category; DataVisualization::Categories::GetCategory( ConstString(m_options.m_category.c_str()), category); if (category) -delete_category = category->Delete(typeCS, m_formatter_kind_mask); +delete_category = category->Delete(typeCS, m_formatter_kind); extra_deletion = FormatterSpecificDeletion(typeCS); } @@ -888,16 +923,16 @@ }; CommandOptions m_options; - uint32_t m_formatter_kind_mask; + FormatCategoryItem m_formatter_kind; Options *GetOptions() override { return &m_options; } public: CommandObjectTypeFormatterClear(CommandInterpreter &interpreter, -
[Lldb-commits] [PATCH] D148282: Fix the help for "type X delete" to make the -a & -w behaviors clear
jingham marked 2 inline comments as done. jingham added inline comments. Comment at: lldb/source/Commands/CommandObjectType.cpp:879-885 +const char *CommandObjectTypeFormatterDelete::g_short_help_template = +"Delete an existing %s for a type."; +const char *CommandObjectTypeFormatterDelete::g_long_help_template = +"Delete an existing %s for a type. Unless you specify a " +"specific category or all categories, only the " +"'default' category is searched. The names must be exactly as " +"shown in the 'type %s list' output"; bulbazord wrote: > You could define these in the class and not out-of-line if you use constexpr. > So for example, above in the class you can do: > > ``` > static constexpr const char *g_short_help_template = "Delete an existing %s > for a type."; > ``` > > That's neat though I'm not 100% sure why it has to be so ugly... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148282/new/ https://reviews.llvm.org/D148282 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits