[Lldb-commits] [PATCH] D52719: Pull FixupBreakpointPCAsNeeded into base class
labath created this revision. labath added a reviewer: krytarowski. This function existed (with identical code) in both NativeProcessLinux and NativeProcessNetBSD, and it is likely that it would be useful to any future implementation of NativeProcessProtocol. Therefore I move it to the base class. https://reviews.llvm.org/D52719 Files: include/lldb/Host/common/NativeProcessProtocol.h source/Host/common/NativeProcessProtocol.cpp source/Plugins/Process/Linux/NativeProcessLinux.cpp source/Plugins/Process/Linux/NativeProcessLinux.h source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp source/Plugins/Process/NetBSD/NativeProcessNetBSD.h Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.h === --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h @@ -112,7 +112,6 @@ void MonitorSIGTRAP(lldb::pid_t pid); void MonitorSignal(lldb::pid_t pid, int signal); - Status FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread); Status PopulateMemoryRegionCache(); void SigchldHandler(); Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp === --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -322,81 +322,6 @@ return error; } -Status -NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); - Status error; - // Find out the size of a breakpoint (might depend on where we are in the - // code). - NativeRegisterContext& context = thread.GetRegisterContext(); - uint32_t breakpoint_size = GetSoftwareBreakpointPCOffset(); - LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size); - - // First try probing for a breakpoint at a software breakpoint location: PC - - // breakpoint size. - const lldb::addr_t initial_pc_addr = - context.GetPCfromBreakpointLocation(); - lldb::addr_t breakpoint_addr = initial_pc_addr; - if (breakpoint_size > 0) { -// Do not allow breakpoint probe to wrap around. -if (breakpoint_addr >= breakpoint_size) - breakpoint_addr -= breakpoint_size; - } - // Check if we stopped because of a breakpoint. - NativeBreakpointSP breakpoint_sp; - error = m_breakpoint_list.GetBreakpoint(breakpoint_addr, breakpoint_sp); - if (!error.Success() || !breakpoint_sp) { -// We didn't find one at a software probe location. Nothing to do. -LLDB_LOG(log, - "pid {0} no lldb breakpoint found at current pc with " - "adjustment: {1}", - GetID(), breakpoint_addr); -return Status(); - } - // If the breakpoint is not a software breakpoint, nothing to do. - if (!breakpoint_sp->IsSoftwareBreakpoint()) { -LLDB_LOG( -log, -"pid {0} breakpoint found at {1:x}, not software, nothing to adjust", -GetID(), breakpoint_addr); -return Status(); - } - // - // We have a software breakpoint and need to adjust the PC. - // - // Sanity check. - if (breakpoint_size == 0) { -// Nothing to do! How did we get here? -LLDB_LOG(log, - "pid {0} breakpoint found at {1:x}, it is software, but the " - "size is zero, nothing to do (unexpected)", - GetID(), breakpoint_addr); -return Status(); - } - // - // We have a software breakpoint and need to adjust the PC. - // - // Sanity check. - if (breakpoint_size == 0) { -// Nothing to do! How did we get here? -LLDB_LOG(log, - "pid {0} breakpoint found at {1:x}, it is software, but the " - "size is zero, nothing to do (unexpected)", - GetID(), breakpoint_addr); -return Status(); - } - // Change the program counter. - LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(), - thread.GetID(), initial_pc_addr, breakpoint_addr); - error = context.SetPC(breakpoint_addr); - if (error.Fail()) { -LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(), - thread.GetID(), error); -return error; - } - return error; -} - Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); Index: source/Plugins/Process/Linux/NativeProcessLinux.h === --- source/Plugins/Process/Linux/NativeProcessLinux.h +++ source/Plugins/Process/Linux/NativeProcessLinux.h @@ -182,8 +182,6 @@ NativeThreadLinux &AddThread(lldb::tid_t thread_id); - Status FixupBreakpointPCAsNeeded(NativeThreadLinux &thread); - /// Writes a siginfo_t structure corresponding to the given thread ID to the /// memory region pointed to by @p siginfo. Status GetSignalInfo(lldb::tid_t tid, void *sigin
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
labath added inline comments. Comment at: lit/Expr/TestIRMemoryMapWindows.test:1-12 +# REQUIRES: windows + +# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t + +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic + The only difference in this test is the command line used to compile the inferior right? That sounds like something that we will run into for a lot of lit test, so I think it's important to work something our right away. Making a windows-flavoured copy of each test is not tractable. Is there a reason you have to use clang-cl here? I was under the impression that clang.exe worked fine on windows too (and used a gcc-compatible command line)... https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52461: [PDB] Introduce `PDBNameParser`
labath added a comment. In https://reviews.llvm.org/D52461#1250555, @aleksandr.urakov wrote: > I've tried to parse with it a name like > > N0::`unnamed namespase'::Name > > > and it can't parse it correctly. May be it just can't parse MSVC demangled > names? I expect the backqoutes are confusing it. If you try something without anonymous namespaces, it should work fine, and adding support for them shouldn't be too hard (though we may run also into problems with function pointers or other funky names, if they don't demangle the same way as with itanium). Regardless of how this is exactly implemented, I think it's important to make the CPlusPlusLanguage::MethodName class understand these MSVC names, as this class is already used in a bunch of places. So, if it chokes on MSVC names, you're bound to run into more problems down the line. > Unfortunately, I can't look at the tests right now, I have a vacation. I'll > look at these a week later, ok? That's fine. There's no hurry here.. Repository: rLLDB LLDB https://reviews.llvm.org/D52461 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
One idea would be to define some lit substitutions like %debuginfo. It’s true you can produce a gcc style command line that will be equivalent to a clang-cl invocation but it won’t be easy. eg you’ll needing to pass -fms-compatibility as well as various -I for includes. It may be easier to have substitutions instead On Mon, Oct 1, 2018 at 4:54 AM Pavel Labath via Phabricator < revi...@reviews.llvm.org> wrote: > labath added inline comments. > > > > Comment at: lit/Expr/TestIRMemoryMapWindows.test:1-12 > +# REQUIRES: windows > + > +# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t > + > +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic > +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic > + > > The only difference in this test is the command line used to compile the > inferior right? That sounds like something that we will run into for a lot > of lit test, so I think it's important to work something our right away. > Making a windows-flavoured copy of each test is not tractable. > > Is there a reason you have to use clang-cl here? I was under the > impression that clang.exe worked fine on windows too (and used a > gcc-compatible command line)... > > > https://reviews.llvm.org/D52618 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
zturner added a comment. One idea would be to define some lit substitutions like %debuginfo. It’s true you can produce a gcc style command line that will be equivalent to a clang-cl invocation but it won’t be easy. eg you’ll needing to pass -fms-compatibility as well as various -I for includes. It may be easier to have substitutions instead https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343470 - Escape newlines in default disassembly format.
Author: jdevlieghere Date: Mon Oct 1 06:20:15 2018 New Revision: 343470 URL: http://llvm.org/viewvc/llvm-project?rev=343470&view=rev Log: Escape newlines in default disassembly format. We can safely escape newlines in format strings because they will be ignored by the format entity parser. Modified: lldb/trunk/source/Core/Debugger.cpp Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=343470&r1=343469&r2=343470&view=diff == --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Mon Oct 1 06:20:15 2018 @@ -163,8 +163,8 @@ static constexpr OptionEnumValueElement // address <+offset>: #define DEFAULT_DISASSEMBLY_FORMAT \ "{${function.initial-function}{${module.file.basename}`}{${function.name-" \ - "without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${" \ - "function.name-without-args}}:\n}{${current-pc-arrow} " \ + "without-args}}:\\n}{${function.changed}\\n{${module.file.basename}`}{${" \ + "function.name-without-args}}:\\n}{${current-pc-arrow} " \ "}${addr-file-or-load}{ " \ "<${function.concrete-only-addr-offset-no-padding}>}: " ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343471 - [Interpreter] Escape backticks when dumping format entities.
Author: jdevlieghere Date: Mon Oct 1 06:22:24 2018 New Revision: 343471 URL: http://llvm.org/viewvc/llvm-project?rev=343471&view=rev Log: [Interpreter] Escape backticks when dumping format entities. Currently we reject our own default disassembly-format string because it contains two backticks which causes everything in between to be interpreter as an expression by the command interpreter. This patch fixes that by escaping backticks when dumping format strings. Added: lldb/trunk/lit/Settings/TestDisassemblyFormat.test Modified: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp Added: lldb/trunk/lit/Settings/TestDisassemblyFormat.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestDisassemblyFormat.test?rev=343471&view=auto == --- lldb/trunk/lit/Settings/TestDisassemblyFormat.test (added) +++ lldb/trunk/lit/Settings/TestDisassemblyFormat.test Mon Oct 1 06:22:24 2018 @@ -0,0 +1,2 @@ +# RUN: %lldb -x -b -o "settings show disassembly-format" | FileCheck %s +# CHECK: disassembly-format (format-string) = "{${function.initial-function}{${module.file.basename}\`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}\`}{${function.name-without-args}}:\n}{${current-pc-arrow} }${addr-file-or-load}{ <${function.concrete-only-addr-offset-no-padding}>}: " Modified: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp?rev=343471&r1=343470&r2=343471&view=diff == --- lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp Mon Oct 1 06:22:24 2018 @@ -41,6 +41,20 @@ bool OptionValueFormatEntity::Clear() { return true; } +static void EscapeBackticks(llvm::StringRef str, std::string &dst) { + dst.clear(); + dst.reserve(str.size()); + + for (size_t i = 0, e = str.size(); i != e; ++i) { +char c = str[i]; +if (c == '`') { + if (i == 0 || str[i - 1] != '\\') +dst += '\\'; +} +dst += c; + } +} + void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) { if (dump_mask & eDumpOptionType) @@ -48,7 +62,9 @@ void OptionValueFormatEntity::DumpValue( if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) strm.PutCString(" = \""); -strm << m_current_format.c_str() << '"'; +std::string escaped; +EscapeBackticks(m_current_format, escaped); +strm << escaped << '"'; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52651: Add functionality to export settings
JDevlieghere updated this revision to Diff 167722. JDevlieghere edited the summary of this revision. JDevlieghere added a comment. - Rebase https://reviews.llvm.org/D52651 Files: include/lldb/Interpreter/OptionValue.h lit/Settings/TestExport.test source/Commands/CommandObjectSettings.cpp source/Interpreter/OptionValueArray.cpp source/Interpreter/OptionValueDictionary.cpp source/Interpreter/OptionValueFileSpecLIst.cpp source/Interpreter/OptionValueFormatEntity.cpp source/Interpreter/OptionValueLanguage.cpp source/Interpreter/Property.cpp Index: source/Interpreter/Property.cpp === --- source/Interpreter/Property.cpp +++ source/Interpreter/Property.cpp @@ -233,7 +233,10 @@ uint32_t dump_mask) const { if (m_value_sp) { const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription; +const bool dump_cmd = dump_mask & OptionValue::eDumpOptionCommand; const bool transparent = m_value_sp->ValueIsTransparent(); +if (dump_cmd && !transparent) + strm << "settings set "; if (dump_desc || !transparent) { if ((dump_mask & OptionValue::eDumpOptionName) && m_name) { DumpQualifiedName(strm); Index: source/Interpreter/OptionValueLanguage.cpp === --- source/Interpreter/OptionValueLanguage.cpp +++ source/Interpreter/OptionValueLanguage.cpp @@ -28,7 +28,8 @@ if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) strm.PutCString(" = "); -strm.PutCString(Language::GetNameForLanguageType(m_current_value)); +if (m_current_value != eLanguageTypeUnknown) + strm.PutCString(Language::GetNameForLanguageType(m_current_value)); } } Index: source/Interpreter/OptionValueFormatEntity.cpp === --- source/Interpreter/OptionValueFormatEntity.cpp +++ source/Interpreter/OptionValueFormatEntity.cpp @@ -61,10 +61,10 @@ strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) - strm.PutCString(" = \""); + strm.PutCString(" = "); std::string escaped; EscapeBackticks(m_current_format, escaped); -strm << escaped << '"'; +strm << '"' << escaped << '"'; } } Index: source/Interpreter/OptionValueFileSpecLIst.cpp === --- source/Interpreter/OptionValueFileSpecLIst.cpp +++ source/Interpreter/OptionValueFileSpecLIst.cpp @@ -25,16 +25,24 @@ if (dump_mask & eDumpOptionType) strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { -if (dump_mask & eDumpOptionType) - strm.Printf(" =%s", m_current_value.GetSize() > 0 ? "\n" : ""); -strm.IndentMore(); +const bool one_line = dump_mask & eDumpOptionCommand; const uint32_t size = m_current_value.GetSize(); +if (dump_mask & eDumpOptionType) + strm.Printf(" =%s", + (m_current_value.GetSize() > 0 && !one_line) ? "\n" : ""); +if (!one_line) + strm.IndentMore(); for (uint32_t i = 0; i < size; ++i) { - strm.Indent(); - strm.Printf("[%u]: ", i); + if (!one_line) { +strm.Indent(); +strm.Printf("[%u]: ", i); + } m_current_value.GetFileSpecAtIndex(i).Dump(&strm); + if (one_line) +strm << ' '; } -strm.IndentLess(); +if (!one_line) + strm.IndentLess(); } } Index: source/Interpreter/OptionValueDictionary.cpp === --- source/Interpreter/OptionValueDictionary.cpp +++ source/Interpreter/OptionValueDictionary.cpp @@ -33,16 +33,23 @@ strm.Printf("(%s)", GetTypeAsCString()); } if (dump_mask & eDumpOptionValue) { +const bool one_line = dump_mask & eDumpOptionCommand; if (dump_mask & eDumpOptionType) strm.PutCString(" ="); collection::iterator pos, end = m_values.end(); -strm.IndentMore(); +if (!one_line) + strm.IndentMore(); for (pos = m_values.begin(); pos != end; ++pos) { OptionValue *option_value = pos->second.get(); - strm.EOL(); + + if (one_line) +strm << ' '; + else +strm.EOL(); + strm.Indent(pos->first.GetCString()); const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0; @@ -74,7 +81,8 @@ break; } } -strm.IndentLess(); +if (!one_line) + strm.IndentLess(); } } Index: source/Interpreter/OptionValueArray.cpp === --- source/Interpreter/OptionValueArray.cpp +++ source/Interpreter/OptionValueArray.cpp @@ -31,13 +31,17 @@ strm.Printf("(%s)", GetTypeAsCString()); } if (dump_mask & eDumpOptionValue) { -if (dump_mask & eDumpOptionType) - strm.Printf(" =%s", (m_val
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
stella.stamenova added a comment. In https://reviews.llvm.org/D52618#1250909, @zturner wrote: > One idea would be to define some lit substitutions like %debuginfo. It’s > true you can produce a gcc style command line that will be equivalent to a > clang-cl invocation but it won’t be easy. eg you’ll needing to pass > -fms-compatibility as well as various -I for includes. > > It may be easier to have substitutions instead Another option would be to define a way in lit to specify a command to run based on requirements - similar how we can use "windows" or "linux" in the "requires" command. https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
zturner added a comment. In https://reviews.llvm.org/D52618#1251076, @stella.stamenova wrote: > In https://reviews.llvm.org/D52618#1250909, @zturner wrote: > > > One idea would be to define some lit substitutions like %debuginfo. It’s > > true you can produce a gcc style command line that will be equivalent to a > > clang-cl invocation but it won’t be easy. eg you’ll needing to pass > > -fms-compatibility as well as various -I for includes. > > > > It may be easier to have substitutions instead > > > Another option would be to define a way in lit to specify a command to run > based on requirements - similar how we can use "windows" or "linux" in the > "requires" command. Yea that would work too. `REQUIRES` isn't quite the right thing because that just makes the infrastructure decide whether to run or skip your test. It would need to be something different, like `COMPILATION_SETTINGS: debug, opt, noexcept`. But I think that would be quite a bit of work and probably not fit nicely with the existing `ShTest`. You might need a subclass of `ShTest` like `LLDBShTest` that can extend its functionality a bit. https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343497 - [lldb] Start a new line for the next output if there are no symbols in the current symtab
Author: asmith Date: Mon Oct 1 10:08:51 2018 New Revision: 343497 URL: http://llvm.org/viewvc/llvm-project?rev=343497&view=rev Log: [lldb] Start a new line for the next output if there are no symbols in the current symtab Summary: If there is no newline the "lldb" prompt could be on the wrong line. To reproduce the missing newline you can do 'image dump smytab' on any binary. Previously Symtab, file = D:\upstream\build\Debug\bin\clang-diff.exe, num_symbols = 0(lldb) Now Symtab, file = D:\upstream\build\Debug\bin\clang-diff.exe, num_symbols = 0 (lldb) Reviewers: zturner, aleksandr.urakov, lldb-commits Subscribers: abidh Differential Revision: https://reviews.llvm.org/D52627 Modified: lldb/trunk/source/Symbol/Symtab.cpp Modified: lldb/trunk/source/Symbol/Symtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=343497&r1=343496&r2=343497&view=diff == --- lldb/trunk/source/Symbol/Symtab.cpp (original) +++ lldb/trunk/source/Symbol/Symtab.cpp Mon Oct 1 10:08:51 2018 @@ -139,6 +139,8 @@ void Symtab::Dump(Stream *s, Target *tar } break; } + } else { +s->PutCString("\n"); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52627: [lldb] Start a new line for the next output if there are no symbols in the current symtab
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL343497: [lldb] Start a new line for the next output if there are no symbols in the… (authored by asmith, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D52627?vs=167670&id=167762#toc Repository: rL LLVM https://reviews.llvm.org/D52627 Files: lldb/trunk/source/Symbol/Symtab.cpp Index: lldb/trunk/source/Symbol/Symtab.cpp === --- lldb/trunk/source/Symbol/Symtab.cpp +++ lldb/trunk/source/Symbol/Symtab.cpp @@ -139,6 +139,8 @@ } break; } + } else { +s->PutCString("\n"); } } Index: lldb/trunk/source/Symbol/Symtab.cpp === --- lldb/trunk/source/Symbol/Symtab.cpp +++ lldb/trunk/source/Symbol/Symtab.cpp @@ -139,6 +139,8 @@ } break; } + } else { +s->PutCString("\n"); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343500 - Fix build with GCC < 5.0 (PR39131)
Author: tkrasnukha Date: Mon Oct 1 10:14:12 2018 New Revision: 343500 URL: http://llvm.org/viewvc/llvm-project?rev=343500&view=rev Log: Fix build with GCC < 5.0 (PR39131) Modified: lldb/trunk/source/Commands/CommandObjectType.cpp Modified: lldb/trunk/source/Commands/CommandObjectType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=343500&r1=343499&r2=343500&view=diff == --- lldb/trunk/source/Commands/CommandObjectType.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Oct 1 10:14:12 2018 @@ -1055,7 +1055,7 @@ class CommandObjectTypeFormatterList : p } llvm::ArrayRef GetDefinitions() override { - static constexpr OptionDefinition g_option_table[] = { + static constexpr OptionDefinition g_option_table[] { // clang-format off {LLDB_OPT_SET_1, false, "category-regex", 'w', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Only show categories matching this filter."}, {LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Only show the category for a specific language."} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343502 - Fix tests affected by printing change.
Author: jdevlieghere Date: Mon Oct 1 10:20:57 2018 New Revision: 343502 URL: http://llvm.org/viewvc/llvm-project?rev=343502&view=rev Log: Fix tests affected by printing change. I forgot to update some tests that were affected by the escaping of backticks in the format string, landed in r343471. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py?rev=343502&r1=343501&r2=343502&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py Mon Oct 1 10:20:57 2018 @@ -35,7 +35,7 @@ class MixedLanguagesTestCase(TestBase): self.format_string = m.group(1) # Change the default format to print the language. -format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{, lang=${language}}\n" +format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{, lang=${language}}\n" self.runCmd("settings set frame-format %s" % format_string) self.expect("settings show frame-format", SETTING_MSG("frame-format"), substrs=[format_string]) Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=343502&r1=343501&r2=343502&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Mon Oct 1 10:20:57 2018 @@ -132,7 +132,7 @@ class SettingsCommandTestCase(TestBase): # Change the default format to print function.name rather than # function.name-with-args -format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n" +format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n" self.runCmd("settings set frame-format %s" % format_string) # Immediately test the setting. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52651: Add functionality to export settings
teemperor requested changes to this revision. teemperor added a comment. This revision now requires changes to proceed. Runnings `settings export` crashes LLDB: (lldb) down ❲ 8❳ CommandObjectSettingsExport::DoExecute(this=0x55652a80, args=0x7fffd6b8, result=0x7fffdd80) at CommandObjectSettings.cpp:356 ❮liblldb.so.8svn❯ 353 result.SetStatus(eReturnStatusSuccessFinishResult); 354 355 // Open file for dumping the exported settings. -> 356 const std::string export_path = args.GetArgumentAtIndex(0); 357 const uint32_t options = File::eOpenOptionWrite | 358 File::eOpenOptionTruncate | 359 File::eOpenOptionCanCreate; (lldb) bt * thread #1, name = 'lldb', stop reason = signal SIGABRT ❲ 0❳ __GI_raise ❮libc.so.6❯ ❲ 1❳ __GI_abort ❮libc.so.6❯ ❲ 2❳ __gnu_cxx::__verbose_terminate_handler() (.cold.1) at vterminate.cc:95 ❮libstdc++.so.6❯ ❲ 3❳ __cxxabiv1::__terminate(void (*)()) at eh_terminate.cc:47 ❮libstdc++.so.6❯ ❲ 4❳ std::terminate() at eh_terminate.cc:57 ❮libstdc++.so.6❯ ❲ 5❳ __cxxabiv1::__cxa_throw(obj=, tinfo=, dest=)(void *)) at eh_throw.cc:95 ❮libstdc++.so.6❯ ❲ 6❳ std::__throw_logic_error(char const*) (.cold.0) at functexcept.cc:66 ❮libstdc++.so.6❯ ❲ 7❳ void std::__cxx11::basic_string, std::allocator >::_M_construct(this="8, __beg=0x, __end=, (null)=forward_iterator_tag @ 0x7fffd3f0) at basic_string.tcc:212 ❮libstdc++.so.6❯ * ❲ 8❳ CommandObjectSettingsExport::DoExecute(this=0x55652a80, args=0x7fffd6b8, result=0x7fffdd80) at CommandObjectSettings.cpp:356 ❮liblldb.so.8svn❯ ❲ 9❳ lldb_private::CommandObjectParsed::Execute(this=0x55652a80, args_string="", result=0x7fffdd80) at CommandObject.cpp:978 ❮liblldb.so.8svn❯ ❲10❳ lldb_private::CommandInterpreter::HandleCommand(this=0x5562be30, command_line="settings export", lazy_add_to_history=eLazyBoolCalculate, result=0x7fffdd80, override_context=0x, repeat_on_empty_command=true, no_context_switching=false) at CommandInterpreter.cpp:1702 ❮liblldb.so.8svn❯ ❲11❳ lldb_private::CommandInterpreter::IOHandlerInputComplete(this=0x5562be30, io_handler=0x55743b60, line="X) at CommandInterpreter.cpp:2711 ❮liblldb.so.8svn❯ ❲12❳ lldb_private::IOHandlerEditline::Run(this=0x55743b60) at IOHandler.cpp:562 ❮liblldb.so.8svn❯ ❲13❳ lldb_private::Debugger::ExecuteIOHandlers(this=0x5562a620) at Debugger.cpp:975 ❮liblldb.so.8svn❯ ❲14❳ lldb_private::CommandInterpreter::RunCommandInterpreter(this=0x5562be30, auto_handle_events=true, spawn_thread=false, options=0x7fffe080) at CommandInterpreter.cpp:2911 ❮liblldb.so.8svn❯ ❲15❳ lldb::SBDebugger::RunCommandInterpreter(this=0x7fffe4c0, auto_handle_events=true, spawn_thread=false) at SBDebugger.cpp:928 ❮liblldb.so.8svn❯ ❲16❳ Driver::MainLoop(this=0x7fffe4a0) at Driver.cpp:1139 ❮lldb❯ ❲17❳ main(argc=1, argv=0x7fffe6f8) at Driver.cpp:1244 ❮lldb❯ ❲18❳ __libc_start_main ❮libc.so.6❯ ❲19❳ _start ❮lldb❯ https://reviews.llvm.org/D52651 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52651: Add functionality to export settings
teemperor added a comment. - Running `settings export /home/teemperor/foobar1 /home/teemperor/foobar2` will actually just create foobar1, but will not report any error that foobar2 is silently ignored. - Do we actually have a way to have file completion for the argument? (This doesn't have to be addressed in this review). - Using tilde in the export path doesn't work. E.g. `settings export ~/foo` doesn't create a `foo` file for me on Linux. https://reviews.llvm.org/D52651 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
aprantl updated this revision to Diff 167827. aprantl added a comment. Thanks, that was excellent feedback! Updated the patch to set the expression's module instead. https://reviews.llvm.org/D52678 Files: include/lldb/Expression/DWARFExpression.h packages/Python/lldbsuite/test/functionalities/target_var/Makefile packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py packages/Python/lldbsuite/test/functionalities/target_var/globals.c packages/Python/lldbsuite/test/functionalities/target_var/globals.ll source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3464,6 +3464,10 @@ // context scope to be that of the main executable so the file // address will resolve correctly. bool linked_oso_file_addr = false; +// Set the module of the expression to the linked module instead +// of the oject file so the relocated address can be found there. +location.SetModule(debug_map_symfile->GetObjectFile()->GetModule()); + if (is_external && location_DW_OP_addr == 0) { // we have a possible uninitialized extern global ConstString const_name(mangled ? mangled : name); Index: packages/Python/lldbsuite/test/functionalities/target_var/globals.ll === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/target_var/globals.ll @@ -0,0 +1,42 @@ +source_filename = "globals.c" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.14.0" + +@i = global i32 42, align 4 +@p = global i32* @i, align 8, !dbg !0, !dbg !6 + +; Function Attrs: noinline nounwind optnone ssp uwtable +define i32 @main() #0 !dbg !15 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %0 = load i32*, i32** @p, align 8, !dbg !18 + %1 = load i32, i32* %0, align 4, !dbg !18 + ret i32 %1, !dbg !18 +} + +attributes #0 = { noinline nounwind optnone ssp uwtable } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!10, !11, !12, !13} +!llvm.ident = !{!14} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_deref)) +!1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, globals: !5, nameTableKind: None) +!3 = !DIFile(filename: "globals.c", directory: "/") +!4 = !{} +!5 = !{!0, !6} +!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) +!7 = distinct !DIGlobalVariable(name: "p", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true) +!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64) +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!10 = !{i32 2, !"Dwarf Version", i32 4} +!11 = !{i32 2, !"Debug Info Version", i32 3} +!12 = !{i32 1, !"wchar_size", i32 4} +!13 = !{i32 7, !"PIC Level", i32 2} +!14 = !{!"clang version 8.0.0 (trunk 340838) (llvm/trunk 340843)"} +!15 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !16, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !2, retainedNodes: !4) +!16 = !DISubroutineType(types: !17) +!17 = !{!9} +!18 = !DILocation(line: 5, scope: !15) Index: packages/Python/lldbsuite/test/functionalities/target_var/globals.c === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/target_var/globals.c @@ -0,0 +1,6 @@ +int i = 42; +int *p = &i; + +int main() { + return *p; +} Index: packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py @@ -0,0 +1,22 @@ +""" +Test that target var can resolve complex DWARF expressions. +""" + +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class targetCommandTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +@skipIfDarwinEmbedded # needs x86_64 +@skipIf(debug_info="gmodules") # not relevant +def testTargetVarExpr(self): +self.build() +lldbutil.run_to_name_breakpoint(self, 'main') +self.expect("target variable i", substrs=['i', '42']) Index: packages/Python/lldbsuite/test/functionalities/target_var/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/target_var/Makefile @
[Lldb-commits] [lldb] r343545 - Enable C++ tests to run in the -gmodules configuration on Darwin.
Author: adrian Date: Mon Oct 1 15:27:42 2018 New Revision: 343545 URL: http://llvm.org/viewvc/llvm-project?rev=343545&view=rev Log: Enable C++ tests to run in the -gmodules configuration on Darwin. This addresses PR36048 (http://llvm.org/bugs/show_bug.cgi?id=36048) rdar://problem/36776281 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py?rev=343545&r1=343544&r2=343545&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py Mon Oct 1 15:27:42 2018 @@ -51,8 +51,6 @@ class LibcxxVectorDataFormatterTestCase( substrs=['1234']) @add_test_categories(["libc++"]) -@skipIf(debug_info="gmodules", -bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048";) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() @@ -180,8 +178,6 @@ class LibcxxVectorDataFormatterTestCase( substrs=['vector has 0 items']) @add_test_categories(["libc++"]) -@skipIf(debug_info="gmodules", -bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048";) def test_ref_and_ptr(self): """Test that that file and class static variables display correctly.""" self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=343545&r1=343544&r2=343545&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original) +++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Mon Oct 1 15:27:42 2018 @@ -246,6 +246,10 @@ MANDATORY_MODULE_BUILD_CFLAGS := -fmodul ifeq "$(MAKE_GMODULES)" "YES" CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + CXXFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + ifeq "$(OS)" "Darwin" + CXXFLAGS += -fcxx-modules + endif endif CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52651: Add functionality to export settings
jingham added a comment. To Raphael's points: Argument completion handlers are set by the command object implementing HandleArgumentCompletion and dispatching to the CommandCompletions::eDiskFileCompletion. An example of this is in CommandObjectProcessLaunch. Note, arguments currently have a kind (as do options) but for historical reasons, those kinds don't automatically bind to completers. Be nice to finish that bit of the design at some point... But till then, this way though boilerplate is straightforward. The StreamFile constructor doesn't handle ~. Maybe it should? Or you could make a FileSpec, they do handle ~ completion, and there's a StreamFile constructor that takes a FileSpec. Breakpoints use "breakpoint write" and "breakpoint read" to save themselves. Maybe it would be clearer if we use the same word for saving breakpoints and saving settings? I also wonder if it would be good to add a "settings {import, read?}" command to go along with the settings {export,write}. It is a little odd to do "settings export" to export the settings, and "command source" to read them back in. That's relying on the accident that you are exporting the settings as commands, which (a) would be better not to tie ourselves to and (b) users shouldn't have to know that... It also might be nice to have the output file be a -f option and then I could do: (lldb) settings export -f foo.cmds to export all settings and: (lldb) settings export -f foo.cmds target to export all the target commands, etc... That might be more flexible for ordinary use. If you do that, the easiest way to specify a completer is by using OptionGroupFile. Comment at: source/Commands/CommandObjectSettings.cpp:213 +} + // Split the raw command into var_name and value pair. "settings clear" also clears the settings value. I'm not sure I'm in favor of having two ways of doing this, especially when the second one is undocumented. Presumably this isn't intrinsic to exporting settings, so it should be done as a separate patch anyway. Comment at: source/Commands/CommandObjectSettings.cpp:331 +var_name_arg.arg_repetition = eArgRepeatOptional; + +// There is only one variant this argument could be; put it into the Shouldn't this be eArgRepeatPlain? You don't do anything in the case where there's no filename argument. BTW, I don't think these argument repeat counts are actually enforced. They are used to write out the help strings, but not to check incoming arguments for commands so far as I can see. The development of these and the argument kind specifications stalled when the person who originally worked on them left, and is waiting for somebody to pick them back up again. Comment at: source/Commands/CommandObjectSettings.cpp:356 +// Open file for dumping the exported settings. +const std::string export_path = args.GetArgumentAtIndex(0); +const uint32_t options = File::eOpenOptionWrite | You don't know that you actually got an argument. You should check that here. https://reviews.llvm.org/D52651 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
jingham added a comment. The only thing that worries me about this fix is that it's addressing a problem that's a pretty easy mistake to make. Is there ever a case that you would want to resolve a DWARF expression in the context of a .o file module? If not, is there some way we can make this happen automatically. This fix seems a bit ad hoc. https://reviews.llvm.org/D52678 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits