Re: [Lldb-commits] [PATCH] D26528: Fix uninitialized members.
No that sounds like a good change. Lgtm On Mon, Nov 14, 2016 at 3:00 AM Sam McCall wrote: > Agreed, I updated the patch. > > For the classes I touched, I also removed init-list initializers that had > no effect (e.g. where the member is ConstString and the initalizer > explictly called the default constructor). To me this seems part and parcel > of using in-class initializers consistently, but LMK if I should revert > that. > > On Fri, Nov 11, 2016 at 6:11 PM, Zachary Turner > wrote: > > Yea, I agree doing it for a whole class at a time should be the standard > On Fri, Nov 11, 2016 at 9:10 AM Jim Ingham wrote: > > > > On Nov 10, 2016, at 8:57 PM, Zachary Turner via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > > > Maybe just inline the initializations so we don't have to repeat code > across multiple constructors? i.e. > > > > bool m_is_resolved = false; > > > > in the header file. > > I actually like the ability to do this in the header file, that seems > clearer to me. But if we're going to start doing this more widely I think > it would be better to do it consistently - maybe converting on a class by > class basis when you touch one of the ivars in the class? Having to look > in two places for all these default initializations with only history as > the pattern seems like it will make the code harder to read. > > Jim > > > > > > On Thu, Nov 10, 2016 at 8:54 PM Sam McCall via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > sammccall created this revision. > > sammccall added a subscriber: lldb-commits. > > > > Fix uninitialized members. > > > > > > https://reviews.llvm.org/D26528 > > > > Files: > > source/Host/common/FileSpec.cpp > > source/Target/Process.cpp > > > > > > Index: source/Target/Process.cpp > > === > > --- source/Target/Process.cpp > > +++ source/Target/Process.cpp > > @@ -4581,7 +4581,7 @@ > >: IOHandler(process->GetTarget().GetDebugger(), > >IOHandler::Type::ProcessIO), > > m_process(process), m_read_file(), m_write_file(write_fd, > false), > > -m_pipe() { > > +m_pipe(), m_is_running(false) { > > m_pipe.CreateNew(false); > > m_read_file.SetDescriptor(GetInputFD(), false); > >} > > Index: source/Host/common/FileSpec.cpp > > === > > --- source/Host/common/FileSpec.cpp > > +++ source/Host/common/FileSpec.cpp > > @@ -278,8 +278,8 @@ > > } > > > > FileSpec::FileSpec() > > -: m_directory(), m_filename(), > m_syntax(FileSystem::GetNativePathSyntax()) { > > -} > > +: m_directory(), m_filename(), m_is_resolved(false), > > + m_syntax(FileSystem::GetNativePathSyntax()) {} > > > > //-- > > // Default constructor that can take an optional full path to a > > > > > > ___ > > lldb-commits mailing list > > lldb-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > ___ > > lldb-commits mailing list > > lldb-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString
zturner created this revision. zturner added reviewers: tfiala, beanz. zturner added a subscriber: lldb-commits. I have locally a a very large patch which removes the method of `StreamString` that returns a reference to the underlying `std::string` buffer, and instead returns a `StringRef`. There were 1 or 2 instances where someone was relying on this function to reach into the underlying buffer and do stuff like insert or erase from it. This seems like a huge hack, and in the future as I move code towards `llvm::raw_ostream` this will be incompatible with LLVM's api anyway since it does not allow such things. The only non-trivial fix to this was in something Cocoa related. I don't really understand this code, and I can't test it, but the patch here is intended to be NFC and just re-writing the logic in terms of something that doesn't modify the internal Stream buffer. If someone could test it for me I would appreciate. https://reviews.llvm.org/D26618 Files: source/Plugins/Language/ObjC/Cocoa.cpp Index: source/Plugins/Language/ObjC/Cocoa.cpp === --- source/Plugins/Language/ObjC/Cocoa.cpp +++ source/Plugins/Language/ObjC/Cocoa.cpp @@ -559,42 +559,44 @@ if (!valobj_addr) return false; - const char *class_name = descriptor->GetClassName().GetCString(); + llvm::StringRef class_name = descriptor->GetClassName().GetStringRef(); - if (!class_name || !*class_name) + if (!class_name.equals("NSURL")) return false; - if (strcmp(class_name, "NSURL") == 0) { -uint64_t offset_text = ptr_size + ptr_size + - 8; // ISA + pointer + 8 bytes of data (even on 32bit) -uint64_t offset_base = offset_text + ptr_size; -CompilerType type(valobj.GetCompilerType()); -ValueObjectSP text( -valobj.GetSyntheticChildAtOffset(offset_text, type, true)); -ValueObjectSP base( -valobj.GetSyntheticChildAtOffset(offset_base, type, true)); -if (!text) - return false; -if (text->GetValueAsUnsigned(0) == 0) - return false; -StreamString summary; -if (!NSStringSummaryProvider(*text, summary, options)) - return false; -if (base && base->GetValueAsUnsigned(0)) { - if (summary.GetSize() > 0) -summary.GetString().resize(summary.GetSize() - 1); - summary.Printf(" -- "); - StreamString base_summary; - if (NSURLSummaryProvider(*base, base_summary, options) && - base_summary.GetSize() > 0) -summary.Printf("%s", base_summary.GetSize() > 2 - ? base_summary.GetData() + 2 - : base_summary.GetData()); -} -if (summary.GetSize()) { - stream.Printf("%s", summary.GetData()); - return true; + uint64_t offset_text = ptr_size + ptr_size + + 8; // ISA + pointer + 8 bytes of data (even on 32bit) + uint64_t offset_base = offset_text + ptr_size; + CompilerType type(valobj.GetCompilerType()); + ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true)); + ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true)); + if (!text) +return false; + if (text->GetValueAsUnsigned(0) == 0) +return false; + StreamString summary; + if (!NSStringSummaryProvider(*text, summary, options)) +return false; + if (base && base->GetValueAsUnsigned(0)) { +std::string summary_str = summary.GetString(); + +if (!summary_str.empty()) + summary_str.pop_back(); +summary_str += " -- "; +StreamString base_summary; +if (NSURLSummaryProvider(*base, base_summary, options) && +!base_summary.Empty()) { + llvm::StringRef base_str = base_summary.GetString(); + if (base_str.size() > 2) +base_str = base_str.drop_front(2); + summary_str += base_str; } +summary.Clear(); +summary.PutCString(summary_str); + } + if (!summary.Empty()) { +stream.PutCString(summary.GetString()); +return true; } return false; Index: source/Plugins/Language/ObjC/Cocoa.cpp === --- source/Plugins/Language/ObjC/Cocoa.cpp +++ source/Plugins/Language/ObjC/Cocoa.cpp @@ -559,42 +559,44 @@ if (!valobj_addr) return false; - const char *class_name = descriptor->GetClassName().GetCString(); + llvm::StringRef class_name = descriptor->GetClassName().GetStringRef(); - if (!class_name || !*class_name) + if (!class_name.equals("NSURL")) return false; - if (strcmp(class_name, "NSURL") == 0) { -uint64_t offset_text = ptr_size + ptr_size + - 8; // ISA + pointer + 8 bytes of data (even on 32bit) -uint64_t offset_base = offset_text + ptr_size; -CompilerType type(valobj.GetCompilerType()); -ValueObjectSP text( -valobj.GetSyntheticChildAtOffset(offset_text, type, true)); -ValueObjectSP base( -valobj.GetSyntheticCh
[Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString
tfiala added a comment. I will give this a run a bit later this morning. Should be no later than early afternoon. https://reviews.llvm.org/D26618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString
I will gladly let Todd run tests on your diff, but I just thought I'd explain what is going on there In Cocoa, some NSURL objects are represented as "sub-URLs", e.g. you can start from www.apple.com and represent www.apple.com/macos as NSURL(base="www.apple.com", next="/macos") This can be recursively done, so you can have NSURL(base=NSURL(base="www.apple.com", next="/macos"), next="/sierra") The data formatter is attempting to represent the URL as "%s --- %s" % (summary(base), summary(next)) On 11/14/16 10:00 AM, Zachary Turner via lldb-commits wrote: zturner created this revision. zturner added reviewers: tfiala, beanz. zturner added a subscriber: lldb-commits. I have locally a a very large patch which removes the method of `StreamString` that returns a reference to the underlying `std::string` buffer, and instead returns a `StringRef`. There were 1 or 2 instances where someone was relying on this function to reach into the underlying buffer and do stuff like insert or erase from it. This seems like a huge hack, and in the future as I move code towards `llvm::raw_ostream` this will be incompatible with LLVM's api anyway since it does not allow such things. The only non-trivial fix to this was in something Cocoa related. I don't really understand this code, and I can't test it, but the patch here is intended to be NFC and just re-writing the logic in terms of something that doesn't modify the internal Stream buffer. If someone could test it for me I would appreciate. https://reviews.llvm.org/D26618 Files: source/Plugins/Language/ObjC/Cocoa.cpp Index: source/Plugins/Language/ObjC/Cocoa.cpp === --- source/Plugins/Language/ObjC/Cocoa.cpp +++ source/Plugins/Language/ObjC/Cocoa.cpp @@ -559,42 +559,44 @@ if (!valobj_addr) return false; - const char *class_name = descriptor->GetClassName().GetCString(); + llvm::StringRef class_name = descriptor->GetClassName().GetStringRef(); - if (!class_name || !*class_name) + if (!class_name.equals("NSURL")) return false; - if (strcmp(class_name, "NSURL") == 0) { -uint64_t offset_text = ptr_size + ptr_size + - 8; // ISA + pointer + 8 bytes of data (even on 32bit) -uint64_t offset_base = offset_text + ptr_size; -CompilerType type(valobj.GetCompilerType()); -ValueObjectSP text( -valobj.GetSyntheticChildAtOffset(offset_text, type, true)); -ValueObjectSP base( -valobj.GetSyntheticChildAtOffset(offset_base, type, true)); -if (!text) - return false; -if (text->GetValueAsUnsigned(0) == 0) - return false; -StreamString summary; -if (!NSStringSummaryProvider(*text, summary, options)) - return false; -if (base && base->GetValueAsUnsigned(0)) { - if (summary.GetSize() > 0) -summary.GetString().resize(summary.GetSize() - 1); - summary.Printf(" -- "); - StreamString base_summary; - if (NSURLSummaryProvider(*base, base_summary, options) && - base_summary.GetSize() > 0) -summary.Printf("%s", base_summary.GetSize() > 2 - ? base_summary.GetData() + 2 - : base_summary.GetData()); -} -if (summary.GetSize()) { - stream.Printf("%s", summary.GetData()); - return true; + uint64_t offset_text = ptr_size + ptr_size + + 8; // ISA + pointer + 8 bytes of data (even on 32bit) + uint64_t offset_base = offset_text + ptr_size; + CompilerType type(valobj.GetCompilerType()); + ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true)); + ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true)); + if (!text) +return false; + if (text->GetValueAsUnsigned(0) == 0) +return false; + StreamString summary; + if (!NSStringSummaryProvider(*text, summary, options)) +return false; + if (base && base->GetValueAsUnsigned(0)) { +std::string summary_str = summary.GetString(); + +if (!summary_str.empty()) + summary_str.pop_back(); +summary_str += " -- "; +StreamString base_summary; +if (NSURLSummaryProvider(*base, base_summary, options) && +!base_summary.Empty()) { + llvm::StringRef base_str = base_summary.GetString(); + if (base_str.size() > 2) +base_str = base_str.drop_front(2); + summary_str += base_str; } +summary.Clear(); +summary.PutCString(summary_str); + } + if (!summary.Empty()) { +stream.PutCString(summary.GetString()); +return true; } return false; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26528: Fix uninitialized members.
jingham accepted this revision. jingham added a reviewer: jingham. jingham added a comment. This revision is now accepted and ready to land. Looks fine to me. https://reviews.llvm.org/D26528 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString
tfiala accepted this revision. tfiala added a comment. This revision is now accepted and ready to land. LGTM. Built and passed all existing tests. https://reviews.llvm.org/D26618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26300: ELF core: Adding parsing of the floating-point and SSE registers on x86 32/64 bit elf core files
emaste added a comment. I applied this change on top of my WIP https://reviews.llvm.org/D26617 (which adds a FreeBSD core test). LLDB builds and my new test passes, so no objections from me. Once it's in I'll see about porting the new SSE test to FreeBSD too. https://reviews.llvm.org/D26300 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286899 - One more cleanup to lldb version printing
Author: cbieneman Date: Mon Nov 14 16:43:08 2016 New Revision: 286899 URL: http://llvm.org/viewvc/llvm-project?rev=286899&view=rev Log: One more cleanup to lldb version printing With this patch LLDB_VERSION_STRING replaces "lldb version x.x.x" if it is set. This allows builds to not display the open source version numbers if the people making the distribution overrides the LLDB_VERSION_STRING. Since LLDB_VERSION_STRING is always overridden on Darwin, this means the first line of lldb -version on Darwin is: lldb-360.99.0 ( revision ) Modified: lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py lldb/trunk/source/lldb.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py?rev=286899&r1=286898&r2=286899&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py Mon Nov 14 16:43:08 2016 @@ -88,13 +88,10 @@ class HelpCommandTestCase(TestBase): """Test 'help version' and 'version' commands.""" self.expect("help version", substrs=['Show the LLDB debugger version.']) -version_str = self.version_number_string() import re +version_str = self.version_number_string() match = re.match('[0-9]+', version_str) -if sys.platform.startswith("darwin"): -search_regexp = ['lldb-' + (version_str if match else '[0-9]+')] -else: -search_regexp = ['lldb version (\d|\.)+.*\n'] +search_regexp = ['lldb( version|-' + (version_str if match else '[0-9]+') + ').*\n'] self.expect("version", patterns=search_regexp) Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=286899&r1=286898&r2=286899&view=diff == --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Mon Nov 14 16:43:08 2016 @@ -47,25 +47,26 @@ const char *lldb_private::GetVersion() { // as the clang tool. static std::string g_version_str; if (g_version_str.empty()) { + +#ifdef LLDB_VERSION_STRING +g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING); +#else g_version_str += "lldb version "; g_version_str += CLANG_VERSION_STRING; +#endif const char *lldb_repo = GetLLDBRepository(); -if (lldb_repo) { - g_version_str += " ("; - g_version_str += lldb_repo; -} - const char *lldb_rev = GetLLDBRevision(); -if (lldb_rev) { - g_version_str += " revision "; - g_version_str += lldb_rev; +if (lldb_repo || lldb_rev) { + g_version_str += " ("; + if (lldb_repo) +g_version_str += lldb_repo; + if (lldb_rev) { +g_version_str += " revision "; +g_version_str += lldb_rev; + } g_version_str += ")"; } -#ifdef LLDB_VERSION_STRING -g_version_str += " ("; -g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING); -g_version_str += ")"; -#endif + std::string clang_rev(clang::getClangRevision()); if (clang_rev.length() > 0) { g_version_str += "\n clang revision "; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286906 - Fix some StringRef Printf warnings.
Author: zturner Date: Mon Nov 14 17:23:31 2016 New Revision: 286906 URL: http://llvm.org/viewvc/llvm-project?rev=286906&view=rev Log: Fix some StringRef Printf warnings. Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/CommandObject.cpp Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=286906&r1=286905&r2=286906&view=diff == --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Mon Nov 14 17:23:31 2016 @@ -257,7 +257,7 @@ void CommandObjectMultiword::AproposAllS CommandObject *sub_cmd_obj = pos->second.get(); StreamString complete_command_name; -complete_command_name.Printf("%s %s", prefix, command_name); +complete_command_name << prefix << " " << command_name; if (sub_cmd_obj->HelpTextContainsWord(search_word)) { commands_found.AppendString(complete_command_name.GetData()); Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=286906&r1=286905&r2=286906&view=diff == --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Nov 14 17:23:31 2016 @@ -2245,7 +2245,7 @@ void CommandInterpreter::HandleCommands( if (options.GetPrintResults()) { if (tmp_result.Succeeded()) -result.AppendMessageWithFormat("%s", tmp_result.GetOutputData()); +result.AppendMessage(tmp_result.GetOutputData()); } if (!success || !tmp_result.Succeeded()) { Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=286906&r1=286905&r2=286906&view=diff == --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Mon Nov 14 17:23:31 2016 @@ -862,7 +862,7 @@ void CommandObject::GenerateHelpText(Str 1); } else interpreter.OutputFormattedHelpText(output_strm, "", "", GetHelp(), 1); - output_strm.Printf("\nSyntax: %s\n", GetSyntax()); + output_strm << "\nSyntax: " << GetSyntax() << "\n"; Options *options = GetOptions(); if (options != nullptr) { options->GenerateOptionUsage( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26643: Fix TestMiniDumpNew.py test for Python 2/3 issue
amccarth created this revision. amccarth added a reviewer: zturner. amccarth added a subscriber: lldb-commits. On Windows, where we use Python 3 for testing, we have to be more explicit about converting between binary and string representations. I believe this should still work for Python 2, but I don't have a convenient way to try it out. https://reviews.llvm.org/D26643 Files: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py === --- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -108,15 +108,16 @@ /proc/PID/status which is written in the file """ shutil.copyfile(core, newcore) -with open(newcore, "r+") as f: +with open(newcore, "rb+") as f: f.seek(offset) -self.assertEqual(f.read(5), oldpid) +currentpid = f.read(5).decode('utf-8') +self.assertEqual(currentpid, oldpid) f.seek(offset) if len(newpid) < len(oldpid): newpid += " " * (len(oldpid) - len(newpid)) newpid += "\n" -f.write(newpid) +f.write(newpid.encode('utf-8')) def test_deeper_stack_in_minidump_with_same_pid_running(self): """Test that we read the information from the core correctly even if we Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py === --- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -108,15 +108,16 @@ /proc/PID/status which is written in the file """ shutil.copyfile(core, newcore) -with open(newcore, "r+") as f: +with open(newcore, "rb+") as f: f.seek(offset) -self.assertEqual(f.read(5), oldpid) +currentpid = f.read(5).decode('utf-8') +self.assertEqual(currentpid, oldpid) f.seek(offset) if len(newpid) < len(oldpid): newpid += " " * (len(oldpid) - len(newpid)) newpid += "\n" -f.write(newpid) +f.write(newpid.encode('utf-8')) def test_deeper_stack_in_minidump_with_same_pid_running(self): """Test that we read the information from the core correctly even if we ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286908 - Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary.
Author: gclayton Date: Mon Nov 14 17:45:50 2016 New Revision: 286908 URL: http://llvm.org/viewvc/llvm-project?rev=286908&view=rev Log: Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary. This was a regression that was caused by svn revision 269877: commit 1ded4a2a25d60dd2c81bd432bcf63b6ded58e5d6 Author: Saleem Abdulrasool Date: Wed May 18 01:59:10 2016 + remove use of Mutex in favour of std::{,recursive_}mutex This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@269877 91177308-0d34-0410-b5e6-96231b3b80d8 This change actually changed the Platform::m_mutex to be non-recursive which caused the regression. Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=286908&r1=286907&r2=286908&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Mon Nov 14 17:45:50 2016 @@ -263,7 +263,7 @@ EnumerateDirectoryCallback(void *baton, } const char *PlatformAppleWatchSimulator::GetSDKDirectoryAsCString() { - std::lock_guard guard(m_mutex); + std::lock_guard guard(m_sdk_dir_mutex); if (m_sdk_directory.empty()) { const char *developer_dir = GetDeveloperDirectory(); if (developer_dir) { Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h?rev=286908&r1=286907&r2=286908&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h Mon Nov 14 17:45:50 2016 @@ -86,6 +86,7 @@ public: } protected: + std::mutex m_sdk_dir_mutex; std::string m_sdk_directory; std::string m_build_update; Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=286908&r1=286907&r2=286908&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Mon Nov 14 17:45:50 2016 @@ -258,6 +258,7 @@ PlatformRemoteAppleTV::GetContainedFiles bool PlatformRemoteAppleTV::UpdateSDKDirectoryInfosIfNeeded() { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + std::lock_guard guard(m_sdk_dir_mutex); if (m_sdk_directory_infos.empty()) { const char *device_support_dir = GetDeviceSupportDirectory(); if (log) { Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h?rev=286908&r1=286907&r2=286908&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h Mon Nov 14 17:45:50 2016 @@ -96,6 +96,7 @@ protected: bool user_cached; }; typedef std::vector SDKDirectoryInfoCollection; + std::mutex m_sdk_dir_mutex; SDKDirectoryInfoCollection m_sdk_directory_infos; std::string m_device_support_directory; std::string m_device_support_directory_for_os_version; Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=286908&r1
[Lldb-commits] [lldb] r286909 - Fix TestMiniDumpNew.py test for Python 2/3 issue
Author: amccarth Date: Mon Nov 14 17:53:45 2016 New Revision: 286909 URL: http://llvm.org/viewvc/llvm-project?rev=286909&view=rev Log: Fix TestMiniDumpNew.py test for Python 2/3 issue On Windows, where we use Python 3 for testing, we have to be more explicit about converting between binary and string representations. I believe this should still work for Python 2, but I don't have a convenient way to try it out. Differential Revision: https://reviews.llvm.org/D26643 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=286909&r1=286908&r2=286909&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Mon Nov 14 17:53:45 2016 @@ -108,15 +108,16 @@ class MiniDumpNewTestCase(TestBase): /proc/PID/status which is written in the file """ shutil.copyfile(core, newcore) -with open(newcore, "r+") as f: +with open(newcore, "rb+") as f: f.seek(offset) -self.assertEqual(f.read(5), oldpid) +currentpid = f.read(5).decode('utf-8') +self.assertEqual(currentpid, oldpid) f.seek(offset) if len(newpid) < len(oldpid): newpid += " " * (len(oldpid) - len(newpid)) newpid += "\n" -f.write(newpid) +f.write(newpid.encode('utf-8')) def test_deeper_stack_in_minidump_with_same_pid_running(self): """Test that we read the information from the core correctly even if we ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26643: Fix TestMiniDumpNew.py test for Python 2/3 issue
This revision was automatically updated to reflect the committed changes. Closed by commit rL286909: Fix TestMiniDumpNew.py test for Python 2/3 issue (authored by amccarth). Changed prior to commit: https://reviews.llvm.org/D26643?vs=77900&id=77907#toc Repository: rL LLVM https://reviews.llvm.org/D26643 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -108,15 +108,16 @@ /proc/PID/status which is written in the file """ shutil.copyfile(core, newcore) -with open(newcore, "r+") as f: +with open(newcore, "rb+") as f: f.seek(offset) -self.assertEqual(f.read(5), oldpid) +currentpid = f.read(5).decode('utf-8') +self.assertEqual(currentpid, oldpid) f.seek(offset) if len(newpid) < len(oldpid): newpid += " " * (len(oldpid) - len(newpid)) newpid += "\n" -f.write(newpid) +f.write(newpid.encode('utf-8')) def test_deeper_stack_in_minidump_with_same_pid_running(self): """Test that we read the information from the core correctly even if we Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -108,15 +108,16 @@ /proc/PID/status which is written in the file """ shutil.copyfile(core, newcore) -with open(newcore, "r+") as f: +with open(newcore, "rb+") as f: f.seek(offset) -self.assertEqual(f.read(5), oldpid) +currentpid = f.read(5).decode('utf-8') +self.assertEqual(currentpid, oldpid) f.seek(offset) if len(newpid) < len(oldpid): newpid += " " * (len(oldpid) - len(newpid)) newpid += "\n" -f.write(newpid) +f.write(newpid.encode('utf-8')) def test_deeper_stack_in_minidump_with_same_pid_running(self): """Test that we read the information from the core correctly even if we ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286915 - Fix some more StringRef printf warnings.
Author: zturner Date: Mon Nov 14 18:45:18 2016 New Revision: 286915 URL: http://llvm.org/viewvc/llvm-project?rev=286915&view=rev Log: Fix some more StringRef printf warnings. Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Interpreter/CommandAlias.cpp Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=286915&r1=286914&r2=286915&view=diff == --- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Mon Nov 14 18:45:18 2016 @@ -1746,7 +1746,7 @@ public: // Print out an usage syntax on an empty command line. if (raw_command_line[0] == '\0') { - result.GetOutputStream().Printf("%s\n", this->GetSyntax()); + result.GetOutputStream().Printf("%s\n", this->GetSyntax().str().c_str()); return true; } Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=286915&r1=286914&r2=286915&view=diff == --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Mon Nov 14 18:45:18 2016 @@ -1037,7 +1037,7 @@ protected: } } else if (m_options.m_until_addrs.empty()) { result.AppendErrorWithFormat("No line number or address provided:\n%s", - GetSyntax()); + GetSyntax().str().c_str()); result.SetStatus(eReturnStatusFailed); return false; } Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=286915&r1=286914&r2=286915&view=diff == --- lldb/trunk/source/Interpreter/CommandAlias.cpp (original) +++ lldb/trunk/source/Interpreter/CommandAlias.cpp Mon Nov 14 18:45:18 2016 @@ -90,7 +90,7 @@ CommandAlias::CommandAlias(CommandInterp GetAliasExpansion(sstr); translation_and_help.Printf("(%s) %s", sstr.GetData(), - GetUnderlyingCommand()->GetHelp()); + GetUnderlyingCommand()->GetHelp().str().c_str()); SetHelp(translation_and_help.GetData()); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286916 - Fix some more Printf warnings.
Author: zturner Date: Mon Nov 14 18:45:23 2016 New Revision: 286916 URL: http://llvm.org/viewvc/llvm-project?rev=286916&view=rev Log: Fix some more Printf warnings. Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=286916&r1=286915&r2=286916&view=diff == --- lldb/trunk/source/Interpreter/CommandAlias.cpp (original) +++ lldb/trunk/source/Interpreter/CommandAlias.cpp Mon Nov 14 18:45:23 2016 @@ -89,8 +89,9 @@ CommandAlias::CommandAlias(CommandInterp StreamString translation_and_help; GetAliasExpansion(sstr); - translation_and_help.Printf("(%s) %s", sstr.GetData(), - GetUnderlyingCommand()->GetHelp().str().c_str()); + translation_and_help.Printf( + "(%s) %s", sstr.GetData(), + GetUnderlyingCommand()->GetHelp().str().c_str()); SetHelp(translation_and_help.GetData()); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286926 - Change the kernel searching code to not go through the
Author: jmolenda Date: Mon Nov 14 19:41:27 2016 New Revision: 286926 URL: http://llvm.org/viewvc/llvm-project?rev=286926&view=rev Log: Change the kernel searching code to not go through the memory cache subsystem so we're reading only the 4 bytes needed to check for the magic word at the start of a mach-o binary instead of the default 512 block. It can be a small performance help to reduce the size of memory reads from possibly unmapped memory. Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=286926&r1=286925&r2=286926&view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Mon Nov 14 19:41:27 2016 @@ -239,27 +239,40 @@ DynamicLoaderDarwinKernel::SearchForKern return LLDB_INVALID_ADDRESS; Error read_err; - addr_t addr = LLDB_INVALID_ADDRESS; addr_t kernel_addresses_64[] = { 0xfff04010ULL, // newest arm64 devices 0xff804010ULL, // 2014-2015-ish arm64 devices 0xff802010ULL, // oldest arm64 devices LLDB_INVALID_ADDRESS}; addr_t kernel_addresses_32[] = {0x0110, LLDB_INVALID_ADDRESS}; + + uint8_t uval[8]; + if (process->GetAddressByteSize() == 8) { for (size_t i = 0; kernel_addresses_64[i] != LLDB_INVALID_ADDRESS; i++) { -addr = process->ReadUnsignedIntegerFromMemory( -kernel_addresses_64[i], 8, LLDB_INVALID_ADDRESS, read_err); -if (CheckForKernelImageAtAddress(addr, process).IsValid()) { - return addr; -} + if (process->ReadMemoryFromInferior (kernel_addresses_64[i], uval, 8, read_err) == 8) + { + DataExtractor data (&uval, 8, process->GetByteOrder(), process->GetAddressByteSize()); + offset_t offset = 0; + uint64_t addr = data.GetU64 (&offset); + if (CheckForKernelImageAtAddress(addr, process).IsValid()) { + return addr; + } + } + } } + if (process->GetAddressByteSize() == 4) { for (size_t i = 0; kernel_addresses_32[i] != LLDB_INVALID_ADDRESS; i++) { -addr = process->ReadUnsignedIntegerFromMemory( -kernel_addresses_32[i], 4, LLDB_INVALID_ADDRESS, read_err); -if (CheckForKernelImageAtAddress(addr, process).IsValid()) { - return addr; -} + if (process->ReadMemoryFromInferior (kernel_addresses_32[i], uval, 4, read_err) == 4) + { + DataExtractor data (&uval, 4, process->GetByteOrder(), process->GetAddressByteSize()); + offset_t offset = 0; + uint32_t addr = data.GetU32 (&offset); + if (CheckForKernelImageAtAddress(addr, process).IsValid()) { + return addr; + } + } + } } return LLDB_INVALID_ADDRESS; @@ -380,12 +393,19 @@ DynamicLoaderDarwinKernel::CheckForKerne // (the first field of the mach_header/mach_header_64 struct). Error read_error; - uint64_t result = process->ReadUnsignedIntegerFromMemory( - addr, 4, LLDB_INVALID_ADDRESS, read_error); - if (result != llvm::MachO::MH_MAGIC_64 && result != llvm::MachO::MH_MAGIC && - result != llvm::MachO::MH_CIGAM && result != llvm::MachO::MH_CIGAM_64) { -return UUID(); - } + uint8_t magicbuf[4]; + if (process->ReadMemoryFromInferior (addr, magicbuf, sizeof (magicbuf), read_error) != sizeof (magicbuf)) + return UUID(); + + const uint32_t magicks[] = { llvm::MachO::MH_MAGIC_64, llvm::MachO::MH_MAGIC, llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64}; + + bool found_matching_pattern = false; + for (int i = 0; i < llvm::array_lengthof (magicks); i++) +if (::memcmp (magicbuf, &magicks[i], sizeof (magicbuf)) == 0) +found_matching_pattern = true; + + if (found_matching_pattern == false) + return UUID(); // Read the mach header and see whether it looks like a kernel llvm::MachO::mach_header header; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits