[Lldb-commits] [PATCH] D26908: Improve detection of global vs local variables
abidh added subscribers: clayborg, abidh. abidh added a comment. Please add @clayborg as reviewer. Also paste the dwarf generated for this case from both gcc and clang. Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3911 +is_static_lifetime |= has_explicit_mangled; +is_static_lifetime |= (has_explicit_location && !location.IsValid()); // Check if the location has a DW_OP_addr with any address value... Why not put the checks in the same line. Something like... bool is_static_lifetime = has_explicit_mangled || (has_explicit_location && !location.IsValid()); You probably need logical operator and not the bitwise. Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3925 } + is_static_lifetime |= location_DW_OP_addr != LLDB_INVALID_ADDRESS; } similar issue here https://reviews.llvm.org/D26908 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”
On 18 November 2016 at 19:54, Jim Ingham wrote: > If we are going to do that, I wonder if we should start having tests share > their inputs. We don’t do that for source files because the cost of > duplication is so small, and then you don’t have the hassle of adding > something to a source fie for test A messes up test B. But for binaries like > core files, it might be worth that hassle. Especially as we need to pick up > core files for a bunch of different architectures. I certainly agree that we should avoid copying the core files around, but I am not sure we actually need to do something special to make that possible. If we just place all the tests that access the same core file in the same folder then they will end up sharing it naturally (The only reason we tend to have tests in separate folders right now is because it's hard to teach make to build the proper executable with many source files together). If we ever need to reuse the same file for tests that are so logically separate that it makes sense for them to live in different places, we can come up with a some sort of a central core file repository, but I think that can wait until we encounter such situation. pl ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r287542 - Fix remote-linux regression due to stringRef changes
Author: omjavaid Date: Mon Nov 21 09:18:58 2016 New Revision: 287542 URL: http://llvm.org/viewvc/llvm-project?rev=287542&view=rev Log: Fix remote-linux regression due to stringRef changes This is to fix a regression in remote-linux lldb-server connections. We were wrongly passing a copy of uri and expecting a stringRef back. Modified: lldb/trunk/tools/lldb-server/Acceptor.cpp Modified: lldb/trunk/tools/lldb-server/Acceptor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/Acceptor.cpp?rev=287542&r1=287541&r2=287542&view=diff == --- lldb/trunk/tools/lldb-server/Acceptor.cpp (original) +++ lldb/trunk/tools/lldb-server/Acceptor.cpp Mon Nov 21 09:18:58 2016 @@ -90,7 +90,7 @@ std::unique_ptr Acceptor::Crea int port; StringRef scheme, host, path; // Try to match socket name as URL - e.g., tcp://localhost: - if (UriParser::Parse(name.str(), scheme, host, port, path)) { + if (UriParser::Parse(name, scheme, host, port, path)) { if (!FindProtocolByScheme(scheme.str().c_str(), socket_protocol)) error.SetErrorStringWithFormat("Unknown protocol scheme \"%s\"", scheme.str().c_str()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API
jingham added a comment. In https://reviews.llvm.org/D26883#600683, @labath wrote: > I don't know how deep do you want this refactor to be, but there is one issue > I would like us to consider, if only to decide it is out of scope of this > change. I am talking about the `quote_char` thingy. The main problem for me > is that I don't think it's possible to sanely define the meaning of that > field. According to POSIX quoting rules (which our command line more-or-less > follows) a single argument can be quoted in a great many ways, using various > combinations of quote characters. For example, these are all valid ways to > represent the argument `asdf` in a POSIX shell: > > asdf > "asdf" > 'asdf' > a"sd"f > "as"df > "as""df" > "as"'df' > "a"s'd'"f" > ... (you get my point) > > > I don't think there is a self-consistent way to define what the `quote_char` > field will be for each of these options. Moreover, I don't see why one would > ever need to use that field. It can only encourage someone to try to "quote" > the argument by doing `quote_char+value+quote_char`, which is absolutely > wrong if you ever want that result to be machine parsable.(*) For proper > quoting I think we should just have a free-standing `std::string > quote_for_posix_shell(llvm::StringRef)` function (and maybe > `quote_for_windows_cmd`, and whatever else quoting scheme we need), and then > the user can decide which one to use based on who is going to be consuming > it. Then we can just kill the `quote` field. The only thing is... I have no > idea how much work that will be (but I am ready to chip in to make it happen). > > So, yea, if we decide not to do that, then I think the interface looks great. > Otherwise, I think we can design a slightly simpler (and more consistent) one. > > (*) Bonus question: Try to start an executable under lldb, so that in enters > `main()` with `argc=2` and `argv[1]="'"` I.e., as if it had been started > this way via bash: > > $ /bin/cat \' > The outermost quote character is syntactically significant in the lldb command language. If you say: memory read -c `count_var` 0x123345 then lldb evaluates the expression in the backticks, replacing the argument with the result of the expression. So you can't get rid of the quote character altogether. The other use is in completion to figure out what an unterminated quoted string should be completed with. Since only the outermost quoting character is important, I think the problem is more tractable than your examples would suggest. https://reviews.llvm.org/D26883 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26908: Improve detection of global vs local variables
clayborg added a comment. Looks fine. https://reviews.llvm.org/D26908 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API
zturner added a comment. Instead of storing the quote char, I think we could just store two `StringRef`s. `str` and `quoted_str`, where `str = quoted_str.trim(quote_char);`, and if there is no quote char, then they are equal. I'd rather do that in a followup since this `ArgEntry` class has already been here for some time and is kind of orthogonal to what's going on here, but it seems like a sane approach, as then you don't have to worry about anyone reconstructing the quoted version from the unquoted version, it's just already there. https://reviews.llvm.org/D26883 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] LLVM buildmaster will be restarted tonight
Hello everyone, LLVM buildmaster will be updated and restarted after 7 PM Pacific time today. Thanks Galina ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r287597 - Add the new Args / entry-access API.
Author: zturner Date: Mon Nov 21 17:18:07 2016 New Revision: 287597 URL: http://llvm.org/viewvc/llvm-project?rev=287597&view=rev Log: Add the new Args / entry-access API. The long-term goal here is to get rid of the functions GetArgumentAtIndex() and GetQuoteCharAtIndex(), instead replacing them with operator based access and range-based for enumeration. There are a lot of callsites, though, so the changes will be done incrementally, starting with this one. Differential Revision: https://reviews.llvm.org/D26883 Modified: lldb/trunk/include/lldb/Interpreter/Args.h lldb/trunk/source/Breakpoint/BreakpointIDList.cpp lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectSettings.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Modified: lldb/trunk/include/lldb/Interpreter/Args.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=287597&r1=287596&r2=287597&view=diff == --- lldb/trunk/include/lldb/Interpreter/Args.h (original) +++ lldb/trunk/include/lldb/Interpreter/Args.h Mon Nov 21 17:18:07 2016 @@ -150,9 +150,14 @@ public: const char *GetArgumentAtIndex(size_t idx) const; llvm::ArrayRef entries() const { return m_entries; } - char GetArgumentQuoteCharAtIndex(size_t idx) const; + auto begin() const { return m_entries.begin(); } + auto end() const { return m_entries.end(); } + + size_t size() const { return GetArgumentCount(); } + const ArgEntry &operator[](size_t n) const { return m_entries[n]; } + //-- /// Gets the argument vector. /// Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=287597&r1=287596&r2=287597&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Mon Nov 21 17:18:07 2016 @@ -122,13 +122,12 @@ void BreakpointIDList::FindAndReplaceIDR llvm::StringRef range_from; llvm::StringRef range_to; llvm::StringRef current_arg; - const size_t num_old_args = old_args.GetArgumentCount(); std::set names_found; - for (size_t i = 0; i < num_old_args; ++i) { + for (size_t i = 0; i < old_args.size(); ++i) { bool is_range = false; -current_arg = old_args.GetArgumentAtIndex(i); +current_arg = old_args[i].ref; if (!allow_locations && current_arg.contains('.')) { result.AppendErrorWithFormat( "Breakpoint locations not allowed, saw location: %s.", @@ -152,19 +151,17 @@ void BreakpointIDList::FindAndReplaceIDR return; } else names_found.insert(current_arg); -} else if ((i + 2 < num_old_args) && - BreakpointID::IsRangeIdentifier( - old_args.GetArgumentAtIndex(i + 1)) && +} else if ((i + 2 < old_args.size()) && + BreakpointID::IsRangeIdentifier(old_args[i + 1].ref) && BreakpointID::IsValidIDExpression(current_arg) && - BreakpointID::IsValidIDExpression( - old_args.GetArgumentAtIndex(i + 2))) { + BreakpointID::IsValidIDExpression(old_args[i + 2].ref)) { range_from = current_arg; - range_to = old_args.GetArgumentAtIndex(i + 2); + range_to = old_args[i + 2].ref; is_range = true; i = i + 2; } else { // See if user has specified id.* - llvm::StringRef tmp_str = old_args.GetArgumentAtIndex(i); + llvm::StringRef tmp_str = old_args[i].ref; size_t pos = tmp_str.find('.'); if (pos != llvm::StringRef::npos) { llvm::StringRef bp_id_str = tmp_str.substr(0, pos); Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=287597&r1=287596&r2=287597&view=diff == --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Mon Nov 21 17:18:07 2016 @@ -1476,12 +1476,12 @@ public: int match_start_point, int max_return_elements, bool &word_complete, StringList &matches) override { -std::string completion_str(input.GetArgumentAtIndex(cursor_index)); -completion_str.erase(cursor_char_position); +llvm::StringRef completion_str = input[cursor_index].ref; +completion_str = completion_str.take_front(cursor_char_position); Comman
[Lldb-commits] [lldb] r287598 - Fix a bug caught by adding LLVM_NODISCARD to StringRef.
Author: zturner Date: Mon Nov 21 17:18:13 2016 New Revision: 287598 URL: http://llvm.org/viewvc/llvm-project?rev=287598&view=rev Log: Fix a bug caught by adding LLVM_NODISCARD to StringRef. Modified: lldb/trunk/source/Target/StackFrame.cpp Modified: lldb/trunk/source/Target/StackFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=287598&r1=287597&r2=287598&view=diff == --- lldb/trunk/source/Target/StackFrame.cpp (original) +++ lldb/trunk/source/Target/StackFrame.cpp Mon Nov 21 17:18:13 2016 @@ -931,7 +931,7 @@ ValueObjectSP StackFrame::GetValueForVar return ValueObjectSP(); } - index_expr.drop_front(); + index_expr = index_expr.drop_front(); long final_index = 0; if (index_expr.getAsInteger(0, final_index)) { error.SetErrorStringWithFormat("invalid range expression \"'%s'\"", ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API
This revision was automatically updated to reflect the committed changes. Closed by commit rL287597: Add the new Args / entry-access API. (authored by zturner). Changed prior to commit: https://reviews.llvm.org/D26883?vs=78617&id=78796#toc Repository: rL LLVM https://reviews.llvm.org/D26883 Files: lldb/trunk/include/lldb/Interpreter/Args.h lldb/trunk/source/Breakpoint/BreakpointIDList.cpp lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectSettings.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp === --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -1859,9 +1859,8 @@ // put an empty string in element 0. std::string command_partial_str; if (cursor_index >= 0) - command_partial_str.assign(parsed_line.GetArgumentAtIndex(cursor_index), - parsed_line.GetArgumentAtIndex(cursor_index) + - cursor_char_position); + command_partial_str = + parsed_line[cursor_index].ref.take_front(cursor_char_position); std::string common_prefix; matches.LongestCommonPrefix(common_prefix); @@ -1872,7 +1871,7 @@ // Only do this if the completer told us this was a complete word, // however... if (num_command_matches == 1 && word_complete) { - char quote_char = parsed_line.GetArgumentQuoteCharAtIndex(cursor_index); + char quote_char = parsed_line[cursor_index].quote; common_prefix = Args::EscapeLLDBCommandArgument(common_prefix, quote_char); if (quote_char != '\0') Index: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp === --- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp +++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp @@ -101,73 +101,74 @@ case eVarSetOperationAppend: case eVarSetOperationReplace: case eVarSetOperationAssign: -if (argc > 0) { - for (size_t i = 0; i < argc; ++i) { -llvm::StringRef key_and_value(args.GetArgumentAtIndex(i)); -if (!key_and_value.empty()) { - if (key_and_value.find('=') == llvm::StringRef::npos) { -error.SetErrorString( -"assign operation takes one or more key=value arguments"); -return error; - } +if (argc == 0) { + error.SetErrorString( + "assign operation takes one or more key=value arguments"); + return error; +} +for (const auto &entry : args) { + if (entry.ref.empty()) { +error.SetErrorString("empty argument"); +return error; + } + if (!entry.ref.contains('=')) { +error.SetErrorString( +"assign operation takes one or more key=value arguments"); +return error; + } + + llvm::StringRef key, value; + std::tie(key, value) = entry.ref.split('='); + bool key_valid = false; + if (key.empty()) { +error.SetErrorString("empty dictionary key"); +return error; + } - std::pair kvp( - key_and_value.split('=')); - llvm::StringRef key = kvp.first; - bool key_valid = false; - if (!key.empty()) { -if (key.front() == '[') { - // Key name starts with '[', so the key value must be in single or - // double quotes like: - // [''] - // [""] - if ((key.size() > 2) && (key.back() == ']')) { -// Strip leading '[' and trailing ']' -key = key.substr(1, key.size() - 2); -const char quote_char = key.front(); -if ((quote_char == '\'') || (quote_char == '"')) { - if ((key.size() > 2) && (key.back() == quote_char)) { -// Strip the quotes -key = key.substr(1, key.size() - 2); -key_valid = true; - } -} else { - // square brackets, no quotes - key_valid = true; -} - } -} else { - // No square brackets or quotes + if (key.front() == '[') { +// Key name starts with '[', so the key value must be in single or +// double quotes like: +// [''] +// [""] +if ((key.size() > 2) && (key.back() == ']')) { + // Strip leading '[' and trailing ']' + key = key.substr(1, key.size() - 2); + const char quote_char = key.front(); + if ((quote_char == '\'') || (quote_char == '"')) { +if ((key.
[Lldb-commits] [lldb] r287609 - Turn on LLDB_EDITLINE_USE_WCHAR on FreeBSD
Author: emaste Date: Mon Nov 21 20:25:41 2016 New Revision: 287609 URL: http://llvm.org/viewvc/llvm-project?rev=287609&view=rev Log: Turn on LLDB_EDITLINE_USE_WCHAR on FreeBSD Modified: lldb/trunk/include/lldb/Host/Editline.h Modified: lldb/trunk/include/lldb/Host/Editline.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=287609&r1=287608&r2=287609&view=diff == --- lldb/trunk/include/lldb/Host/Editline.h (original) +++ lldb/trunk/include/lldb/Host/Editline.h Mon Nov 21 20:25:41 2016 @@ -43,7 +43,7 @@ // will only be // used in cases where this is true. This is a compile time dependecy, for now // selected per target Platform -#if defined(__APPLE__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) #define LLDB_EDITLINE_USE_WCHAR 1 #include #else ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r287597 - Add the new Args / entry-access API.
On 21 November 2016 at 18:18, Zachary Turner via lldb-commits wrote: > Author: zturner > Date: Mon Nov 21 17:18:07 2016 > New Revision: 287597 > > URL: http://llvm.org/viewvc/llvm-project?rev=287597&view=rev > Log: > Add the new Args / entry-access API. FreeBSD buildbot is now failing with: http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/1462 [2160/2918] Building CXX object tools/lldb/source/Symbol/CMakeFiles/lldbSymbol.dir/Function.cpp.o FAILED: tools/lldb/source/Symbol/CMakeFiles/lldbSymbol.dir/Function.cpp.o /usr/bin/CC -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLDB_USE_BUILTIN_DEMANGLER -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lldb/source/Symbol -I/usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/Symbol -I/usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include -Itools/lldb/include -Iinclude -I/usr/home/buildbot/scratch/scratch/llvm/include -I/usr/local/include -I/usr/local/include/python2.7 -I/usr/home/buildbot/scratch/scratch/llvm/tools/clang/include -Itools/lldb/../clang/include -I/usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/. -I/usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/Plugins/Process/FreeBSD -I/usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/Plugins/Process/POSIX -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Werror=date-time -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -fPIC -fPIC -O3 -DNDEBUG -fno-exceptions -fno-rtti -MMD -MT tools/lldb/source/Symbol/CMakeFiles/lldbSymbol.dir/Function.cpp.o -MF tools/lldb/source/Symbol/CMakeFiles/lldbSymbol.dir/Function.cpp.o.d -o tools/lldb/source/Symbol/CMakeFiles/lldbSymbol.dir/Function.cpp.o -c /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/Symbol/Function.cpp In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/source/Symbol/Function.cpp:20: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Target/Language.h:25: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/DataFormatters/FormatClasses.h:22: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/DataFormatters/TypeFormat.h:27: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Core/ValueObject.h:34: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Target/Process.h:43: In file included from /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Interpreter/Options.h:20: /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Interpreter/Args.h:155:3: error: 'auto' return without trailing return type; deduced return types are a C++14 extension auto begin() const { return m_entries.begin(); } ^ /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Interpreter/Args.h:156:3: error: 'auto' return without trailing return type; deduced return types are a C++14 extension auto end() const { return m_entries.end(); } ^ /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Interpreter/Args.h:155:31: error: no viable conversion from 'const_iterator' (aka '__wrap_iter') to 'int' auto begin() const { return m_entries.begin(); } ^ /usr/home/buildbot/scratch/scratch/llvm/tools/lldb/include/lldb/Interpreter/Args.h:156:29: error: no viable conversion from 'const_iterator' (aka '__wrap_iter') to 'int' auto end() const { return m_entries.end(); } ^~~ 4 errors generated. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits