[Lldb-commits] [lldb] r263205 - skip newly segfaulting test on OS X public CI
Author: tfiala Date: Fri Mar 11 02:12:36 2016 New Revision: 263205 URL: http://llvm.org/viewvc/llvm-project?rev=263205&view=rev Log: skip newly segfaulting test on OS X public CI Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=263205&r1=263204&r2=263205&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Mar 11 02:12:36 2016 @@ -114,6 +114,7 @@ class APIDefaultConstructorTestCase(Test @add_test_categories(['pyapi']) @no_debug_info_test +@skipIfDarwin # seg faulting, bugnumber="" def test_SBDebugger(self): obj = lldb.SBDebugger() if self.TraceOn(): ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263207 - Fix a couple of cornercases in FileSpec + tests
Author: labath Date: Fri Mar 11 02:44:44 2016 New Revision: 263207 URL: http://llvm.org/viewvc/llvm-project?rev=263207&view=rev Log: Fix a couple of cornercases in FileSpec + tests Summary: This fixes a couple of corner cases in FileSpec, related to AppendPathComponent and handling of root directory (/) file spec. I add a bunch of unit tests for the new behavior. Summary of changes: FileSpec("/bar").GetCString(): before "//bar", after "/bar". FileSpec("/").CopyByAppendingPathComponent("bar").GetCString(): before "//bar", after "/bar". FileSpec("C:", ePathSyntaxWindows).CopyByAppendingPathComponent("bar").GetCString(): before "C:/bar", after "C:\bar". Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D18044 Added: lldb/trunk/unittests/Host/FileSpecTest.cpp Modified: lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/unittests/Host/CMakeLists.txt Modified: lldb/trunk/source/Host/common/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=263207&r1=263206&r2=263207&view=diff == --- lldb/trunk/source/Host/common/FileSpec.cpp (original) +++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Mar 11 02:44:44 2016 @@ -918,7 +918,7 @@ void FileSpec::GetPath(llvm::SmallVectorImpl &path, bool denormalize) const { path.append(m_directory.GetStringRef().begin(), m_directory.GetStringRef().end()); -if (m_directory) +if (m_directory && !(m_directory.GetLength() == 1 && m_directory.GetCString()[0] == '/')) path.insert(path.end(), '/'); path.append(m_filename.GetStringRef().begin(), m_filename.GetStringRef().end()); Normalize(path, m_syntax); @@ -1331,17 +1331,9 @@ FileSpec::EnumerateDirectory FileSpec FileSpec::CopyByAppendingPathComponent (const char *new_path) const { -const bool resolve = false; -if (m_filename.IsEmpty() && m_directory.IsEmpty()) -return FileSpec(new_path,resolve); -StreamString stream; -if (m_filename.IsEmpty()) -stream.Printf("%s/%s",m_directory.GetCString(),new_path); -else if (m_directory.IsEmpty()) -stream.Printf("%s/%s",m_filename.GetCString(),new_path); -else -stream.Printf("%s/%s/%s",m_directory.GetCString(), m_filename.GetCString(),new_path); -return FileSpec(stream.GetData(),resolve); +FileSpec ret = *this; +ret.AppendPathComponent(new_path); +return ret; } FileSpec @@ -1442,20 +1434,26 @@ void FileSpec::AppendPathComponent(const char *new_path) { if (!new_path) return; -const bool resolve = false; -if (m_filename.IsEmpty() && m_directory.IsEmpty()) + +StreamString stream; +if (!m_directory.IsEmpty()) { -SetFile(new_path, resolve); -return; +stream.PutCString(m_directory.GetCString()); +if (m_directory.GetLength() != 1 || m_directory.GetCString()[0] != '/') +stream.PutChar('/'); } -StreamString stream; -if (m_filename.IsEmpty() || (m_filename.GetLength() == 1 && m_filename.GetCString()[0] == '.')) -stream.Printf("%s/%s", m_directory.GetCString(), new_path); -else if (m_directory.IsEmpty()) -stream.Printf("%s/%s", m_filename.GetCString(), new_path); -else -stream.Printf("%s/%s/%s", m_directory.GetCString(), m_filename.GetCString(), new_path); -SetFile(stream.GetData(), resolve); + +if (!m_filename.IsEmpty()) +{ +stream.PutCString(m_filename.GetCString()); +if (m_filename.GetLength() != 1 || m_filename.GetCString()[0] != '/') +stream.PutChar('/'); +} + +stream.PutCString(new_path); + +const bool resolve = false; +SetFile(stream.GetData(), resolve, m_syntax); } void Modified: lldb/trunk/unittests/Host/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=263207&r1=263206&r2=263207&view=diff == --- lldb/trunk/unittests/Host/CMakeLists.txt (original) +++ lldb/trunk/unittests/Host/CMakeLists.txt Fri Mar 11 02:44:44 2016 @@ -1,4 +1,5 @@ add_lldb_unittest(HostTests + FileSpecTest.cpp SocketAddressTest.cpp SocketTest.cpp SymbolsTest.cpp Added: lldb/trunk/unittests/Host/FileSpecTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSpecTest.cpp?rev=263207&view=auto == --- lldb/trunk/unittests/Host/FileSpecTest.cpp (added) +++ lldb/trunk/unittests/Host/FileSpecTest.cpp Fri Mar 11 02:44:44 2016 @@ -0,0 +1,94 @@ +//===-- FileSpecTest.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===-
Re: [Lldb-commits] [PATCH] D18044: Fix a couple of cornercases in FileSpec + tests
This revision was automatically updated to reflect the committed changes. Closed by commit rL263207: Fix a couple of cornercases in FileSpec + tests (authored by labath). Changed prior to commit: http://reviews.llvm.org/D18044?vs=50275&id=50396#toc Repository: rL LLVM http://reviews.llvm.org/D18044 Files: lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/unittests/Host/CMakeLists.txt lldb/trunk/unittests/Host/FileSpecTest.cpp Index: lldb/trunk/unittests/Host/FileSpecTest.cpp === --- lldb/trunk/unittests/Host/FileSpecTest.cpp +++ lldb/trunk/unittests/Host/FileSpecTest.cpp @@ -0,0 +1,94 @@ +//===-- FileSpecTest.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "lldb/Host/FileSpec.h" + +using namespace lldb_private; + +TEST(FileSpecTest, FileAndDirectoryComponents) +{ +FileSpec fs_posix("/foo/bar", false, FileSpec::ePathSyntaxPosix); +EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); +EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString()); + +FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows); +EXPECT_STREQ("F:\\bar", fs_windows.GetCString()); +EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString()); + +FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix); +EXPECT_STREQ("/", fs_posix_root.GetCString()); +EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString()); +EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString()); + +FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows); +EXPECT_STREQ("F:", fs_windows_root.GetCString()); +EXPECT_EQ(nullptr, fs_windows_root.GetDirectory().GetCString()); +EXPECT_STREQ("F:", fs_windows_root.GetFilename().GetCString()); + +FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::ePathSyntaxPosix); +EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString()); +EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString()); +EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString()); + +FileSpec fs_windows_long("F:\\bar\\baz", false, FileSpec::ePathSyntaxWindows); +EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString()); +// We get "F:/bar" instead. +// EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString()); +EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString()); + +FileSpec fs_posix_trailing_slash("/foo/bar/", false, FileSpec::ePathSyntaxPosix); +EXPECT_STREQ("/foo/bar/.", fs_posix_trailing_slash.GetCString()); +EXPECT_STREQ("/foo/bar", fs_posix_trailing_slash.GetDirectory().GetCString()); +EXPECT_STREQ(".", fs_posix_trailing_slash.GetFilename().GetCString()); + +FileSpec fs_windows_trailing_slash("F:\\bar\\", false, FileSpec::ePathSyntaxWindows); +EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString()); +// We get "F:/bar" instead. +// EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetDirectory().GetCString()); +EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString()); +} + +TEST(FileSpecTest, AppendPathComponent) +{ +FileSpec fs_posix("/foo", false, FileSpec::ePathSyntaxPosix); +fs_posix.AppendPathComponent("bar"); +EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); +EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString()); + +FileSpec fs_windows("F:", false, FileSpec::ePathSyntaxWindows); +fs_windows.AppendPathComponent("bar"); +EXPECT_STREQ("F:\\bar", fs_windows.GetCString()); +EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString()); + +FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix); +fs_posix_root.AppendPathComponent("bar"); +EXPECT_STREQ("/bar", fs_posix_root.GetCString()); +EXPECT_STREQ("/", fs_posix_root.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_posix_root.GetFilename().GetCString()); + +FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows); +fs_windows_root.AppendPathComponent("bar"); +EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString()); +EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString()); +EXPECT_STREQ("bar", fs_windows_root.GetFilename().GetCString()); +} + +TEST(FileSpecTest, CopyByAppendingPathComponent) +{ +FileSpec fs = FileSpec("/foo", false, FileSpec::ePathSyntaxPosix).CopyByAppendingPathComponent("bar"); +EXPECT_STREQ("/foo/bar", fs.GetCS
[Lldb-commits] [lldb] r263209 - Fix a bunch of signedness warnings in unittests
Author: labath Date: Fri Mar 11 03:00:23 2016 New Revision: 263209 URL: http://llvm.org/viewvc/llvm-project?rev=263209&view=rev Log: Fix a bunch of signedness warnings in unittests Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=263209&r1=263208&r2=263209&view=diff == --- lldb/trunk/unittests/Editline/EditlineTest.cpp (original) +++ lldb/trunk/unittests/Editline/EditlineTest.cpp Fri Mar 11 03:00:23 2016 @@ -191,8 +191,9 @@ EditlineAdapter::SendLine (const std::st eoln, eoln_length * sizeof (char)); -EXPECT_EQ (eoln_length * sizeof (char), input_bytes_written); -return eoln_length * sizeof (char) == input_bytes_written; +EXPECT_NE(-1, input_bytes_written) << strerror(errno); +EXPECT_EQ (eoln_length * sizeof (char), size_t(input_bytes_written)); +return eoln_length * sizeof (char) == size_t(input_bytes_written); } bool @@ -363,7 +364,7 @@ TEST_F(EditlineTestFixture, EditlineRece EXPECT_EQ (input_lines.size (), el_reported_lines.GetSize ()); if (input_lines.size () == el_reported_lines.GetSize ()) { -for (auto i = 0; i < input_lines.size(); ++i) +for (size_t i = 0; i < input_lines.size(); ++i) EXPECT_EQ (input_lines[i], el_reported_lines[i]); } } Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=263209&r1=263208&r2=263209&view=diff == --- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original) +++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Fri Mar 11 03:00:23 2016 @@ -108,7 +108,7 @@ protected: bool ContainsCompileUnit(const SymbolContextList &sc_list, const FileSpec &spec) const { -for (int i = 0; i < sc_list.GetSize(); ++i) +for (size_t i = 0; i < sc_list.GetSize(); ++i) { const SymbolContext &sc = sc_list[i]; if (FileSpecMatchesAsBaseOrFull(*sc.comp_unit, spec)) @@ -173,7 +173,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ FileSpec header_spec("test-pdb.cpp", false); SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); -EXPECT_EQ(1, result_count); +EXPECT_EQ(1u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec)); } @@ -192,7 +192,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ FileSpec header_spec(R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec", false); SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); -EXPECT_GE(1, result_count); +EXPECT_GE(1u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec)); } @@ -216,7 +216,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ { SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list); -EXPECT_EQ(2, result_count); +EXPECT_EQ(2u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec)); EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec)); } @@ -240,7 +240,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ { SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list); -EXPECT_EQ(0, result_count); +EXPECT_EQ(0u, result_count); } } @@ -259,13 +259,13 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ FileSpec header1("test-pdb.h", false); FileSpec header2("test-pdb-nested.h", false); uint32_t cus = symfile->GetNumCompileUnits(); -EXPECT_EQ(2, cus); +EXPECT_EQ(2u, cus); SymbolContextList sc_list; uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry; uint32_t count = symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list); -EXPECT_EQ(1, count); +EXPECT_EQ(1u, count); SymbolContext sc; EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc)); @@ -273,7 +273,7 @@ TEST_F(SymbolFilePDBTests, REQUIRES_DIA_ EXPECT_NE(nullptr, lt); count = lt->GetSize(); // We expect one extra entry for termination (per function) -EXPECT_EQ(16, count); +EXPECT_EQ(16u, count); VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040); VerifyLineEntry(module, sc, source_file, *lt, 8, 0x401043); @@ -
Re: [Lldb-commits] [PATCH] D17856: Fix expression evaluation with operator new
labath added a comment. Any thoughts on this? http://reviews.llvm.org/D17856 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions
EwanCrawford added a comment. friendly ping Repository: rL LLVM http://reviews.llvm.org/D17957 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D18082: [LLDB]{MIPS] Fix TestPlatformProcessConnect.py
nitesh.jain created this revision. nitesh.jain added reviewers: clayborg, tberghammer, labath. nitesh.jain added subscribers: jaydeep, bhushan, sagar, mohit.bhakkad, lldb-commits. nitesh.jain set the repository for this revision to rL LLVM. The patch http://reviews.llvm.org/D14952 which modifies the platform connect with automatically connecting to the process instance if it was started by the remote platform. However this fails for Linux Platform. Since PlatformRemoteGDBServer doesn't implement "ConnectToWaitingProcesses". Thus Platform::ConnectToWaitingProcesses was called and LLDB failed connecting to the remote process instance. This Patch implements "ConnectToWaitingProcesses" for PlatformRemoteGDBServer and hence fixes TestPlatformProcessConnect.py failure for linux Platform. Repository: rL LLVM http://reviews.llvm.org/D18082 Files: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h === --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -224,6 +224,9 @@ lldb_private::Target *target, lldb_private::Error &error) override; +size_t +ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error) override; + virtual size_t GetPendingGdbServerList(std::vector& connection_urls); Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp === --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -1002,6 +1002,22 @@ } size_t +PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger& debugger, Error& error) +{ +std::vector connection_urls; +GetPendingGdbServerList(connection_urls); + +for (size_t i = 0; i < connection_urls.size(); ++i) +{ +ConnectProcess(connection_urls[i].c_str(), nullptr, debugger, nullptr, error); +if (error.Fail()) +return i; // We already connected to i process succsessfully +} +return connection_urls.size(); + +} + +size_t PlatformRemoteGDBServer::GetPendingGdbServerList(std::vector& connection_urls) { std::vector> remote_servers; Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h === --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -224,6 +224,9 @@ lldb_private::Target *target, lldb_private::Error &error) override; +size_t +ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error) override; + virtual size_t GetPendingGdbServerList(std::vector& connection_urls); Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp === --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -1002,6 +1002,22 @@ } size_t +PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger& debugger, Error& error) +{ +std::vector connection_urls; +GetPendingGdbServerList(connection_urls); + +for (size_t i = 0; i < connection_urls.size(); ++i) +{ +ConnectProcess(connection_urls[i].c_str(), nullptr, debugger, nullptr, error); +if (error.Fail()) +return i; // We already connected to i process succsessfully +} +return connection_urls.size(); + +} + +size_t PlatformRemoteGDBServer::GetPendingGdbServerList(std::vector& connection_urls) { std::vector> remote_servers; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18082: [LLDB]{MIPS] Fix TestPlatformProcessConnect.py
labath added a comment. If I understand correctly, you have simply copied the implementation from PlatformRemoteAndroidGDBServer. Could you also remove it from that class, since it's going to inherit the implementation anyway? Apart from that, it looks good to me, but let's give a chance for @clayborg to respond first. Repository: rL LLVM http://reviews.llvm.org/D18082 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush
This revision was automatically updated to reflect the committed changes. Closed by commit rL263233: Fixed MemoryCache L1 cache flush (authored by mamai). Changed prior to commit: http://reviews.llvm.org/D18050?vs=50297&id=50422#toc Repository: rL LLVM http://reviews.llvm.org/D18050 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp lldb/trunk/source/Target/Memory.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py @@ -0,0 +1,62 @@ +""" +Test the MemoryCache L1 flush. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class MemoryCacheTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_memory_cache(self): +"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +# Read a chunk of memory containing &my_ints[0]. The number of bytes read +# must be greater than m_L2_cache_line_byte_size to make sure the L1 +# cache is used. +self.runCmd('memory read -f d -c 201 `&my_ints - 100`') + +# Check the value of my_ints[0] is the same as set in main.cpp. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x0042 == int(line.split(':')[1], 0)) + +# Change the value of my_ints[0] in memory. +self.runCmd("memory write `&my_ints` AA") + +# Re-read the chunk of memory. The cache line should have been +# flushed because of the 'memory write'. +self.runCmd('memory read -f d -c 201 `&my_ints - 100`') + +# Check the value of my_ints[0] have been updated correctly. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x00AA == int(line.split(':')[1], 0)) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp @@ -0,0 +1,14 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +int main () +{ +int my_ints[] = {0x42}; +return 0; // Set break point at this line. +} Index: lldb/trunk/source/Target/Memory.cpp === --- lldb/trunk/source/Target/Memory.cpp +++ lldb/trunk/source/Target/Memory.cpp @@ -78,7 +78,11 @@ if (!m_L1_cache.empty()) { AddrRange flush_range(addr, size); -BlockMap::iterator pos = m_L1_cache.lower_bound(addr); +BlockMap::iterator pos = m_L1_cache.upper_bound(addr); +if (pos != m_L1_cache.begin()) +{ +
[Lldb-commits] [lldb] r263233 - Fixed MemoryCache L1 cache flush
Author: mamai Date: Fri Mar 11 07:50:10 2016 New Revision: 263233 URL: http://llvm.org/viewvc/llvm-project?rev=263233&view=rev Log: Fixed MemoryCache L1 cache flush Use the same method to find the cache line as in Read(). Differential Revision: http://reviews.llvm.org/D18050 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp Modified: lldb/trunk/source/Target/Memory.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile?rev=263233&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile Fri Mar 11 07:50:10 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py?rev=263233&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py Fri Mar 11 07:50:10 2016 @@ -0,0 +1,62 @@ +""" +Test the MemoryCache L1 flush. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class MemoryCacheTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_memory_cache(self): +"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +# Read a chunk of memory containing &my_ints[0]. The number of bytes read +# must be greater than m_L2_cache_line_byte_size to make sure the L1 +# cache is used. +self.runCmd('memory read -f d -c 201 `&my_ints - 100`') + +# Check the value of my_ints[0] is the same as set in main.cpp. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x0042 == int(line.split(':')[1], 0)) + +# Change the value of my_ints[0] in memory. +self.runCmd("memory write `&my_ints` AA") + +# Re-read the chunk of memory. The cache line should have been +# flushed because of the 'memory write'. +self.runCmd('memory read -f d -c 201 `&my_ints - 100`') + +# Check the value of my_ints[0] have been updated correctly. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x00AA == int(line.split(':')[1], 0)) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp?rev=263233&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp Fri Mar 11 07:50:10 2016 @@ -0,0 +1,14 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT fo
Re: [Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions
clayborg resigned from this revision. clayborg removed a reviewer: clayborg. clayborg added a comment. I will let Sean Callanan review this one as the expression parser is his area. Repository: rL LLVM http://reviews.llvm.org/D17957 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18082: [LLDB]{MIPS] Fix TestPlatformProcessConnect.py
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. Repository: rL LLVM http://reviews.llvm.org/D18082 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions
spyffe requested changes to this revision. spyffe added a comment. This revision now requires changes to proceed. There are a few changes I'd recommend to this patch. The biggest one is to move mangling knowledge from IRExecutionUnit to LanguageCPlusPlus, where it logically fits better. The testsuite change should be applied across the board in my opinion, but I'm going to add Greg Clayton as a reviewer to cover that part. Comment at: packages/Python/lldbsuite/test/expression_command/call-overloaded-c-fuction/Makefile:9 @@ +8,3 @@ +ifneq (,$(findstring clang,$(CC))) + CFLAGS_EXTRAS += -fno-limit-debug-info +endif Should we do this for all tests? **Greg**? Comment at: source/Expression/IRExecutionUnit.cpp:736 @@ +735,3 @@ +return ConstString(modified_str); +} + I'm pretty sure this should be on `LanguageCPlusPlus`, along with the code in `CollectCandidateCPlusPlusNames` that tries `_ZN` -> `_ZNK` and `_Z` -> `_ZL`. `LanguageCPlusPlus` should have a method that takes a name and collects "equivalent" mangled names. That way all this mangling knowledge is kept in one place. Comment at: source/Expression/IRExecutionUnit.cpp:815 @@ -766,1 +814,3 @@ +ConstString ulong_fixup = SubstituteMangledParameters(name.AsCString(), llvm::StringRef("y"), llvm::StringRef("m")); +CPP_specs.push_back(SearchSpec(ulong_fixup, lldb::eFunctionNameTypeFull)); } This is going to add `SearchSpec`s regardless of whether `SubstituteMangledParameters` did anything, slowing down symbol lookups for cases where it isn't necessary. This should only add specs if there was actually a difference. Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:2081 @@ -2078,1 +2080,3 @@ +extern_c = !CPlusPlusLanguage::IsCPPMangledName(function->GetMangled().GetMangledName().AsCString()); + if (!function_type) Two things: - Why does this have to happen down here? Couldn't it be done up at the declaration of `extern_c` so that the `bool` stays `const`? - Looking at this logic, it might also be cool to also set `extern_c` if the compile unit is C++ but the function in the DWARF has a non-mangled name... but that's solving a separate problem Repository: rL LLVM http://reviews.llvm.org/D17957 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17957: Expression evaluation for overloaded C functions
spyffe added a reviewer: clayborg. spyffe added a comment. Added Greg to look at the testsuite changes. Repository: rL LLVM http://reviews.llvm.org/D17957 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
cameron314 updated this revision to Diff 50447. cameron314 added a comment. Here we go! http://reviews.llvm.org/D17549 has been committed, so I've rebased this patch onto that latest version (r263233). http://reviews.llvm.org/D17107 Files: /lldb/trunkcmake/modules/LLDBConfig.cmake /lldb/trunkinclude/lldb/Host/FileSystem.h /lldb/trunkinclude/lldb/Host/posix/HostInfoPosix.h /lldb/trunkinclude/lldb/Host/windows/HostInfoWindows.h /lldb/trunkpackages/Python/lldbsuite/test/dotest.py /lldb/trunksource/Commands/CommandCompletions.cpp /lldb/trunksource/Core/ConnectionSharedMemory.cpp /lldb/trunksource/Core/Disassembler.cpp /lldb/trunksource/Host/common/File.cpp /lldb/trunksource/Host/common/FileSpec.cpp /lldb/trunksource/Host/posix/FileSystem.cpp /lldb/trunksource/Host/posix/HostInfoPosix.cpp /lldb/trunksource/Host/windows/ConnectionGenericFileWindows.cpp /lldb/trunksource/Host/windows/FileSystem.cpp /lldb/trunksource/Host/windows/Host.cpp /lldb/trunksource/Host/windows/HostInfoWindows.cpp /lldb/trunksource/Host/windows/HostProcessWindows.cpp /lldb/trunksource/Host/windows/PipeWindows.cpp /lldb/trunksource/Host/windows/ProcessLauncherWindows.cpp /lldb/trunksource/Host/windows/Windows.cpp /lldb/trunksource/Plugins/Process/Windows/Live/DebuggerThread.cpp /lldb/trunksource/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp /lldb/trunksource/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp /lldb/trunksource/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp /lldb/trunksource/Target/ProcessLaunchInfo.cpp /lldb/trunktools/driver/Driver.cpp /lldb/trunktools/driver/Platform.h /lldb/trunktools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp /lldb/trunktools/lldb-mi/MIUtilFileStd.cpp /lldb/trunktools/lldb-mi/Platform.h Index: /lldb/trunktools/lldb-mi/Platform.h === --- /dev/null +++ /lldb/trunktools/lldb-mi/Platform.h @@ -60,7 +60,7 @@ typedef long pid_t; #define STDIN_FILENO 0 -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #define snprintf _snprintf extern int ioctl(int d, int request, ...); Index: /lldb/trunktools/lldb-mi/MIUtilFileStd.cpp === --- /dev/null +++ /lldb/trunktools/lldb-mi/MIUtilFileStd.cpp @@ -17,6 +17,8 @@ #include "MIUtilFileStd.h" #include "MICmnResources.h" +#include "llvm/Support/ConvertUTF.h" + //++ // Details: CMIUtilFileStd constructor. // Type:Method. @@ -82,7 +84,14 @@ m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb"); #else // Open a file with exclusive write and shared read permissions -m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR); +std::wstring path; +if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR); +else +{ +errno = EINVAL; +m_pFileHandle = nullptr; +} #endif // !defined( _MSC_VER ) if (m_pFileHandle == nullptr) @@ -222,7 +231,14 @@ return false; FILE *pTmp = nullptr; +#ifdef _WIN32 +std::wstring path; +if (!llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +return false; +pTmp = ::_wfopen(path.c_str(), L"wb"); +#else pTmp = ::fopen(vFileNamePath.c_str(), "wb"); +#endif if (pTmp != nullptr) { ::fclose(pTmp); Index: /lldb/trunktools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- /dev/null +++ /lldb/trunktools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -27,6 +27,7 @@ #include "MICmnMIValueTuple.h" #include "MICmdData.h" #include "MICmnLLDBUtilSBValue.h" +#include "Platform.h" //++ // Details: CMICmnLLDBDebugSessionInfo constructor. @@ -614,7 +615,7 @@ { lldb::SBFrame &rFrame = const_cast(vrFrame); -static char pBuffer[MAX_PATH]; +static char pBuffer[PATH_MAX]; const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath(&pBuffer[0], sizeof(pBuffer)); MIunused(nBytes); CMIUtilString strResolvedPath(&pBuffer[0]); Index: /lldb/trunktools/driver/Platform.h === --- /dev/null +++ /lldb/trunktools/driver/Platform.h @@ -81,7 +81,7 @@ typedef long pid_t; #define snprintf _snprintf extern sighandler_t signal( int sig, sighandler_t ); -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #endif #define STDIN_FILENO 0 Index: /lldb/trunktools/driver/Driver.cpp === --- /dev/null +++ /lldb/trunktools/driver/Driver.cpp @@ -42,6 +42,7 @@ #include "lldb/API/SBTarget.h" #include "lldb/API/SBThread.h" #include "lldb/API/SBProcess.h" +#include "llvm/Suppor
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
cameron314 updated this revision to Diff 50448. cameron314 added a comment. Oops, was missing a slash in the dst-prefix of the previous patch update. http://reviews.llvm.org/D17107 Files: /lldb/trunk/cmake/modules/LLDBConfig.cmake /lldb/trunk/include/lldb/Host/FileSystem.h /lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h /lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h /lldb/trunk/packages/Python/lldbsuite/test/dotest.py /lldb/trunk/source/Commands/CommandCompletions.cpp /lldb/trunk/source/Core/ConnectionSharedMemory.cpp /lldb/trunk/source/Core/Disassembler.cpp /lldb/trunk/source/Host/common/File.cpp /lldb/trunk/source/Host/common/FileSpec.cpp /lldb/trunk/source/Host/posix/FileSystem.cpp /lldb/trunk/source/Host/posix/HostInfoPosix.cpp /lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp /lldb/trunk/source/Host/windows/FileSystem.cpp /lldb/trunk/source/Host/windows/Host.cpp /lldb/trunk/source/Host/windows/HostInfoWindows.cpp /lldb/trunk/source/Host/windows/HostProcessWindows.cpp /lldb/trunk/source/Host/windows/PipeWindows.cpp /lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp /lldb/trunk/source/Host/windows/Windows.cpp /lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp /lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp /lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp /lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp /lldb/trunk/source/Target/ProcessLaunchInfo.cpp /lldb/trunk/tools/driver/Driver.cpp /lldb/trunk/tools/driver/Platform.h /lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp /lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp /lldb/trunk/tools/lldb-mi/Platform.h Index: /lldb/trunk/tools/lldb-mi/Platform.h === --- /dev/null +++ /lldb/trunk/tools/lldb-mi/Platform.h @@ -60,7 +60,7 @@ typedef long pid_t; #define STDIN_FILENO 0 -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #define snprintf _snprintf extern int ioctl(int d, int request, ...); Index: /lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp === --- /dev/null +++ /lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp @@ -17,6 +17,8 @@ #include "MIUtilFileStd.h" #include "MICmnResources.h" +#include "llvm/Support/ConvertUTF.h" + //++ // Details: CMIUtilFileStd constructor. // Type:Method. @@ -82,7 +84,14 @@ m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb"); #else // Open a file with exclusive write and shared read permissions -m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR); +std::wstring path; +if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR); +else +{ +errno = EINVAL; +m_pFileHandle = nullptr; +} #endif // !defined( _MSC_VER ) if (m_pFileHandle == nullptr) @@ -222,7 +231,14 @@ return false; FILE *pTmp = nullptr; +#ifdef _WIN32 +std::wstring path; +if (!llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +return false; +pTmp = ::_wfopen(path.c_str(), L"wb"); +#else pTmp = ::fopen(vFileNamePath.c_str(), "wb"); +#endif if (pTmp != nullptr) { ::fclose(pTmp); Index: /lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- /dev/null +++ /lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -27,6 +27,7 @@ #include "MICmnMIValueTuple.h" #include "MICmdData.h" #include "MICmnLLDBUtilSBValue.h" +#include "Platform.h" //++ // Details: CMICmnLLDBDebugSessionInfo constructor. @@ -614,7 +615,7 @@ { lldb::SBFrame &rFrame = const_cast(vrFrame); -static char pBuffer[MAX_PATH]; +static char pBuffer[PATH_MAX]; const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath(&pBuffer[0], sizeof(pBuffer)); MIunused(nBytes); CMIUtilString strResolvedPath(&pBuffer[0]); Index: /lldb/trunk/tools/driver/Platform.h === --- /dev/null +++ /lldb/trunk/tools/driver/Platform.h @@ -81,7 +81,7 @@ typedef long pid_t; #define snprintf _snprintf extern sighandler_t signal( int sig, sighandler_t ); -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #endif #define STDIN_FILENO 0 Index: /lldb/trunk/tools/driver/Driver.cpp === --- /dev/null +++ /lldb/trunk/tools/driver/Driver.cpp @@ -42,6 +42,7 @@ #include "lldb/API/SBTarget.h" #include "lldb/API/SBThread.h" #include "lldb/API/SBProcess.h" +#include "llvm/Support/ConvertUTF.
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
cameron314 updated this revision to Diff 50449. cameron314 added a comment. ... and had a slash too many at the start of the path prefixes. Sorry for the spam. http://reviews.llvm.org/D17107 Files: lldb/trunk/cmake/modules/LLDBConfig.cmake lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Core/ConnectionSharedMemory.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Host/posix/HostInfoPosix.cpp lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp lldb/trunk/source/Host/windows/FileSystem.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Host/windows/HostProcessWindows.cpp lldb/trunk/source/Host/windows/PipeWindows.cpp lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp lldb/trunk/source/Host/windows/Windows.cpp lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Target/ProcessLaunchInfo.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Platform.h lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp lldb/trunk/tools/lldb-mi/Platform.h Index: lldb/trunk/tools/lldb-mi/Platform.h === --- lldb/trunk/tools/lldb-mi/Platform.h +++ lldb/trunk/tools/lldb-mi/Platform.h @@ -60,7 +60,7 @@ typedef long pid_t; #define STDIN_FILENO 0 -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #define snprintf _snprintf extern int ioctl(int d, int request, ...); Index: lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp === --- lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp +++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp @@ -17,6 +17,8 @@ #include "MIUtilFileStd.h" #include "MICmnResources.h" +#include "llvm/Support/ConvertUTF.h" + //++ // Details: CMIUtilFileStd constructor. // Type:Method. @@ -82,7 +84,14 @@ m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb"); #else // Open a file with exclusive write and shared read permissions -m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR); +std::wstring path; +if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR); +else +{ +errno = EINVAL; +m_pFileHandle = nullptr; +} #endif // !defined( _MSC_VER ) if (m_pFileHandle == nullptr) @@ -222,7 +231,14 @@ return false; FILE *pTmp = nullptr; +#ifdef _WIN32 +std::wstring path; +if (!llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +return false; +pTmp = ::_wfopen(path.c_str(), L"wb"); +#else pTmp = ::fopen(vFileNamePath.c_str(), "wb"); +#endif if (pTmp != nullptr) { ::fclose(pTmp); Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -27,6 +27,7 @@ #include "MICmnMIValueTuple.h" #include "MICmdData.h" #include "MICmnLLDBUtilSBValue.h" +#include "Platform.h" //++ // Details: CMICmnLLDBDebugSessionInfo constructor. @@ -614,7 +615,7 @@ { lldb::SBFrame &rFrame = const_cast(vrFrame); -static char pBuffer[MAX_PATH]; +static char pBuffer[PATH_MAX]; const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath(&pBuffer[0], sizeof(pBuffer)); MIunused(nBytes); CMIUtilString strResolvedPath(&pBuffer[0]); Index: lldb/trunk/tools/driver/Platform.h === --- lldb/trunk/tools/driver/Platform.h +++ lldb/trunk/tools/driver/Platform.h @@ -81,7 +81,7 @@ typedef long pid_t; #define snprintf _snprintf extern sighandler_t signal( int sig, sighandler_t ); -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #endif #define STDIN_FILENO 0 Index: lldb/trunk/tools/driver/Driver.cpp === --- lldb/trunk/tools/driver/Driver.cpp +++ lldb/trunk/tools/driver/Driver.cpp @@ -42,6 +42,7 @@ #inclu
[Lldb-commits] [lldb] r263274 - Check for a NULL input filehandle before referencing it.
Author: jingham Date: Fri Mar 11 12:49:38 2016 New Revision: 263274 URL: http://llvm.org/viewvc/llvm-project?rev=263274&view=rev Log: Check for a NULL input filehandle before referencing it. Modified: lldb/trunk/scripts/Python/python-typemaps.swig Modified: lldb/trunk/scripts/Python/python-typemaps.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=263274&r1=263273&r2=263274&view=diff == --- lldb/trunk/scripts/Python/python-typemaps.swig (original) +++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Mar 11 12:49:38 2016 @@ -536,14 +536,17 @@ char mode[4] = {0}; #ifdef __APPLE__ int i = 0; - short flags = $1->_flags; + if ($1) + { + short flags = $1->_flags; - if (flags & __SRD) - mode[i++] = 'r'; - else if (flags & __SWR) - mode[i++] = 'w'; - else // if (flags & __SRW) - mode[i++] = 'a'; + if (flags & __SRD) + mode[i++] = 'r'; + else if (flags & __SWR) + mode[i++] = 'w'; + else // if (flags & __SRW) + mode[i++] = 'a'; +} #endif using namespace lldb_private; File file($1, false); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263283 - Remove the skip if Darwin since I fixed the crash.
Author: jingham Date: Fri Mar 11 13:15:03 2016 New Revision: 263283 URL: http://llvm.org/viewvc/llvm-project?rev=263283&view=rev Log: Remove the skip if Darwin since I fixed the crash. Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=263283&r1=263282&r2=263283&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Mar 11 13:15:03 2016 @@ -114,7 +114,6 @@ class APIDefaultConstructorTestCase(Test @add_test_categories(['pyapi']) @no_debug_info_test -@skipIfDarwin # seg faulting, bugnumber="" def test_SBDebugger(self): obj = lldb.SBDebugger() if self.TraceOn(): ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c
fjricci updated this revision to Diff 50454. fjricci added a comment. Use vector of tids for iteration, rather than iterating over unlocked threadlist http://reviews.llvm.org/D18075 Files: source/Commands/CommandObjectThread.cpp Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -66,61 +66,65 @@ if (command.GetArgumentCount() == 0) { Thread *thread = m_exe_ctx.GetThreadPtr(); -if (!HandleOneThread (*thread, result)) +if (!HandleOneThread (thread->GetID(), result)) return false; +return result.Succeeded(); } -else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0) + +// Use tids instead of ThreadSPs to prevent deadlocking problems which result from JIT-ing +// code while iterating over the (locked) ThreadSP list. +std::vector tids; + +if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0) { Process *process = m_exe_ctx.GetProcessPtr(); -uint32_t idx = 0; -for (ThreadSP thread_sp : process->Threads()) -{ -if (idx != 0 && m_add_return) -result.AppendMessage(""); -if (!HandleOneThread(*(thread_sp.get()), result)) -return false; -++idx; -} +for (ThreadSP thread_sp : process->Threads()) +tids.push_back(thread_sp->GetID()); } else { const size_t num_args = command.GetArgumentCount(); Process *process = m_exe_ctx.GetProcessPtr(); + Mutex::Locker locker (process->GetThreadList().GetMutex()); -std::vector thread_sps; for (size_t i = 0; i < num_args; i++) { bool success; - + uint32_t thread_idx = StringConvert::ToUInt32(command.GetArgumentAtIndex(i), 0, 0, &success); if (!success) { result.AppendErrorWithFormat ("invalid thread specification: \"%s\"\n", command.GetArgumentAtIndex(i)); result.SetStatus (eReturnStatusFailed); return false; } - -thread_sps.push_back(process->GetThreadList().FindThreadByIndexID(thread_idx)); - -if (!thread_sps[i]) + +ThreadSP thread = process->GetThreadList().FindThreadByIndexID(thread_idx); + +if (!thread) { result.AppendErrorWithFormat ("no thread with index: \"%s\"\n", command.GetArgumentAtIndex(i)); result.SetStatus (eReturnStatusFailed); return false; } -} - -for (uint32_t i = 0; i < num_args; i++) -{ -if (!HandleOneThread (*(thread_sps[i].get()), result)) -return false; -if (i < num_args - 1 && m_add_return) -result.AppendMessage(""); +tids.push_back(thread->GetID()); } } + +uint32_t idx = 0; +for (const lldb::tid_t &tid : tids) +{ +if (idx != 0 && m_add_return) +result.AppendMessage(""); + +if (!HandleOneThread (tid, result)) +return false; + +++idx; +} return result.Succeeded(); } @@ -133,7 +137,7 @@ // If m_add_return is true, a blank line will be inserted between each of the listings (except the last one.) virtual bool -HandleOneThread (Thread &thread, CommandReturnObject &result) = 0; +HandleOneThread (lldb::tid_t, CommandReturnObject &result) = 0; ReturnStatus m_success_return = eReturnStatusSuccessFinishResult; bool m_add_return = true; @@ -275,25 +279,35 @@ } bool -HandleOneThread (Thread &thread, CommandReturnObject &result) override +HandleOneThread (lldb::tid_t tid, CommandReturnObject &result) override { +ThreadSP thread_sp = m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid); +if (!thread_sp) +{ +result.AppendErrorWithFormat ("thread disappeared while computing backtraces: 0x%" PRIx64 "\n", tid); +result.SetStatus (eReturnStatusFailed); +return false; +} + +Thread *thread = thread_sp.get(); + Stream &strm = result.GetOutputStream(); // Don't show source context when doing backtraces. const uint32_t num_frames_with_source = 0; -if (!thread.GetStatus (strm, - m_options.m_start, -
Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c
jingham accepted this revision. jingham added a comment. This revision is now accepted and ready to land. That looks good, thanks. http://reviews.llvm.org/D18075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c
clayborg accepted this revision. clayborg added a comment. Looks good. http://reviews.llvm.org/D18075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D18096: accept any build-id length between 4 and 20 bytes inclusive
emaste created this revision. emaste added a reviewer: lldb-commits. There's a proposed patch D18091 adding build-id support to lld that would produce a 64-bit ID. There's some concern as existing tools typically expect the build-id to be either 16 or 20 bytes. Prior to this change lldb would reject such a build-id, but that doesn't make sense given that lldb will fall back to a 4-byte crc32, a poorer quality identifier. Now we accept the build-id if it is 4 bytes or more. http://reviews.llvm.org/D18096 Files: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1411,7 +1411,7 @@ if (!uuid.IsValid()) { // 16 bytes is UUID|MD5, 20 bytes is SHA1 -if ((note.n_descsz == 16 || note.n_descsz == 20)) +if (note.n_descsz >= 4 && note.n_descsz <= 20) { uint8_t uuidbuf[20]; if (data.GetU8 (&offset, &uuidbuf, note.n_descsz) == nullptr) Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1411,7 +1411,7 @@ if (!uuid.IsValid()) { // 16 bytes is UUID|MD5, 20 bytes is SHA1 -if ((note.n_descsz == 16 || note.n_descsz == 20)) +if (note.n_descsz >= 4 && note.n_descsz <= 20) { uint8_t uuidbuf[20]; if (data.GetU8 (&offset, &uuidbuf, note.n_descsz) == nullptr) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263289 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
Author: eugenezelenko Date: Fri Mar 11 14:20:38 2016 New Revision: 263289 URL: http://llvm.org/viewvc/llvm-project?rev=263289&view=rev Log: Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes. Modified: lldb/trunk/source/Core/IOHandler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp Modified: lldb/trunk/source/Core/IOHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=263289&r1=263288&r2=263289&view=diff == --- lldb/trunk/source/Core/IOHandler.cpp (original) +++ lldb/trunk/source/Core/IOHandler.cpp Fri Mar 11 14:20:38 2016 @@ -38,8 +38,14 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/ThreadPlan.h" - - +#ifndef LLDB_DISABLE_CURSES +#include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/VariableList.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Thread.h" +#include "lldb/Target/StackFrame.h" +#endif using namespace lldb; using namespace lldb_private; @@ -67,7 +73,7 @@ IOHandler::IOHandler (Debugger &debugger m_popped (false), m_flags (flags), m_type (type), -m_user_data (NULL), +m_user_data(nullptr), m_done (false), m_active (false) { @@ -83,49 +89,37 @@ IOHandler::~IOHandler() = default; int IOHandler::GetInputFD() { -if (m_input_sp) -return m_input_sp->GetFile().GetDescriptor(); -return -1; +return (m_input_sp ? m_input_sp->GetFile().GetDescriptor() : -1); } int IOHandler::GetOutputFD() { -if (m_output_sp) -return m_output_sp->GetFile().GetDescriptor(); -return -1; +return (m_output_sp ? m_output_sp->GetFile().GetDescriptor() : -1); } int IOHandler::GetErrorFD() { -if (m_error_sp) -return m_error_sp->GetFile().GetDescriptor(); -return -1; +return (m_error_sp ? m_error_sp->GetFile().GetDescriptor() : -1); } FILE * IOHandler::GetInputFILE() { -if (m_input_sp) -return m_input_sp->GetFile().GetStream(); -return NULL; +return (m_input_sp ? m_input_sp->GetFile().GetStream() : nullptr); } FILE * IOHandler::GetOutputFILE() { -if (m_output_sp) -return m_output_sp->GetFile().GetStream(); -return NULL; +return (m_output_sp ? m_output_sp->GetFile().GetStream() : nullptr); } FILE * IOHandler::GetErrorFILE() { -if (m_error_sp) -return m_error_sp->GetFile().GetStream(); -return NULL; +return (m_error_sp ? m_error_sp->GetFile().GetStream() : nullptr); } StreamFileSP & @@ -186,9 +180,9 @@ IOHandlerConfirm::IOHandlerConfirm (Debu bool default_response) : IOHandlerEditline(debugger, IOHandler::Type::Confirm, - NULL, // NULL editline_name means no history loaded/saved - NULL, // No prompt - NULL, // No continuation prompt + nullptr, // nullptr editline_name means no history loaded/saved + nullptr, // No prompt + nullptr, // No continuation prompt false,// Multi-line false,// Don't colorize the prompt (i.e. the confirm message.) 0, @@ -204,7 +198,6 @@ IOHandlerConfirm::IOHandlerConfirm (Debu prompt_stream.Printf(": [y/N] "); SetPrompt (prompt_stream.GetString().c_str()); - } IOHandlerConfirm::~IOHandlerConfirm() = default; @@ -304,14 +297,14 @@ IOHandlerDelegate::IOHandlerComplete (IO --word_start; while (word_start > current_line && !isspace(*word_start)) --word_start; -CommandCompletions::InvokeCommonCompletionCallbacks (io_handler.GetDebugger().GetCommandInterpreter(), - CommandCompletions::eVariablePathCompletion, - word_start, - skip_first_n_matches, - max_matches, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(io_handler.GetDebugger().GetCommandInterpreter(), + CommandCompletions::eVariablePathCompletion, +word_start, + skip_first_n_matches, +
[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] r263300 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
Author: eugenezelenko Date: Fri Mar 11 15:55:47 2016 New Revision: 263300 URL: http://llvm.org/viewvc/llvm-project?rev=263300&view=rev Log: Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes. Modified: lldb/trunk/source/Core/Logging.cpp lldb/trunk/source/Core/Opcode.cpp lldb/trunk/source/Core/PluginManager.cpp Modified: lldb/trunk/source/Core/Logging.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Logging.cpp?rev=263300&r1=263299&r2=263300&view=diff == --- lldb/trunk/source/Core/Logging.cpp (original) +++ lldb/trunk/source/Core/Logging.cpp Fri Mar 11 15:55:47 2016 @@ -11,30 +11,31 @@ // C Includes // C++ Includes +#include #include + // Other libraries and framework includes // Project includes #include "lldb/Interpreter/Args.h" #include "lldb/Core/Log.h" #include "lldb/Core/StreamFile.h" -#include using namespace lldb; using namespace lldb_private; - // We want to avoid global constructors where code needs to be run so here we // control access to our static g_log_sp by hiding it in a singleton function // that will construct the static g_lob_sp the first time this function is // called. static std::atomic g_log_enabled {false}; -static Log * g_log = NULL; +static Log * g_log = nullptr; + static Log * GetLog () { if (!g_log_enabled) -return NULL; +return nullptr; return g_log; } @@ -62,7 +63,7 @@ lldb_private::GetLogIfAllCategoriesSet ( { uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) -return NULL; +return nullptr; } return log; } @@ -84,7 +85,7 @@ void lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...) { Log *log(GetLogIfAnyCategoriesSet (mask)); -if (log) +if (log != nullptr) { va_list args; va_start (args, format); @@ -97,9 +98,9 @@ Log * lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask) { Log *log(GetLog ()); -if (log && mask && (mask & log->GetMask().Get())) +if (log != nullptr && mask && (mask & log->GetMask().Get())) return log; -return NULL; +return nullptr; } void @@ -107,13 +108,13 @@ lldb_private::DisableLog (const char **c { Log *log(GetLog ()); -if (log) +if (log != nullptr) { uint32_t flag_bits = 0; -if (categories[0] != NULL) +if (categories[0] != nullptr) { flag_bits = log->GetMask().Get(); -for (size_t i = 0; categories[i] != NULL; ++i) +for (size_t i = 0; categories[i] != nullptr; ++i) { const char *arg = categories[i]; @@ -164,8 +165,6 @@ lldb_private::DisableLog (const char **c g_log_enabled = false; } } - -return; } Log * @@ -174,7 +173,7 @@ lldb_private::EnableLog (StreamSP &log_s // Try see if there already is a log - that way we can reuse its settings. // We could reuse the log in toto, but we don't know that the stream is the same. uint32_t flag_bits; -if (g_log) +if (g_log != nullptr) flag_bits = g_log->GetMask().Get(); else flag_bits = 0; @@ -182,15 +181,15 @@ lldb_private::EnableLog (StreamSP &log_s // Now make a new log with this stream if one was provided if (log_stream_sp) { -if (g_log) +if (g_log != nullptr) g_log->SetStream(log_stream_sp); else g_log = new Log(log_stream_sp); } -if (g_log) +if (g_log != nullptr) { -for (size_t i=0; categories[i] != NULL; ++i) +for (size_t i = 0; categories[i] != nullptr; ++i) { const char *arg = categories[i]; @@ -241,7 +240,6 @@ lldb_private::EnableLog (StreamSP &log_s return g_log; } - void lldb_private::ListLogCategories (Stream *strm) { Modified: lldb/trunk/source/Core/Opcode.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Opcode.cpp?rev=263300&r1=263299&r2=263300&view=diff == --- lldb/trunk/source/Core/Opcode.cpp (original) +++ lldb/trunk/source/Core/Opcode.cpp Fri Mar 11 15:55:47 2016 @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes #include "llvm/ADT/Triple.h" + // Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBufferHeap.h" @@ -20,11 +21,9 @@ #include "lldb/Core/Stream.h" #include "lldb/Host/Endian.h" - using namespace lldb; using namespace lldb_private; - int Opcode::Dump (Stream *s, uint32_t min_byte_width) { @@ -50,13 +49,11 @@ Opcode::Dump (Stream *s, uint32_t min_by break; case Opcode::eTypeBytes: +for (uint32_t i = 0; i < m_data.inst.length; ++i) { -for (uint32_t i=0; i 0) -
Re: [Lldb-commits] [PATCH] D17777: Add regression test for expressions calling functions taking anonymous struct typedef arguments
spyffe accepted this revision. spyffe added a comment. This revision is now accepted and ready to land. This looks fine. Overloadable C functions are being tested separately, so this is fine to go in. http://reviews.llvm.org/D1 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263312 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
Author: eugenezelenko Date: Fri Mar 11 18:31:13 2016 New Revision: 263312 URL: http://llvm.org/viewvc/llvm-project?rev=263312&view=rev Log: Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes. Modified: lldb/trunk/include/lldb/Core/SearchFilter.h lldb/trunk/source/Core/RegisterValue.cpp lldb/trunk/source/Core/RegularExpression.cpp lldb/trunk/source/Core/Scalar.cpp lldb/trunk/source/Core/SearchFilter.cpp Modified: lldb/trunk/include/lldb/Core/SearchFilter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=263312&r1=263311&r2=263312&view=diff == --- lldb/trunk/include/lldb/Core/SearchFilter.h (original) +++ lldb/trunk/include/lldb/Core/SearchFilter.h Fri Mar 11 18:31:13 2016 @@ -94,7 +94,6 @@ public: class SearchFilter { public: - //-- /// The basic constructor takes a Target, which gives the space to search. /// @@ -108,7 +107,7 @@ public: virtual ~SearchFilter (); -const SearchFilter& +SearchFilter& operator=(const SearchFilter& rhs); //-- @@ -294,7 +293,6 @@ class SearchFilterByModule : public SearchFilter { public: - //-- /// The basic constructor takes a Target, which gives the space to search, /// and the module to restrict the search to. @@ -312,7 +310,7 @@ public: ~SearchFilterByModule() override; -const SearchFilterByModule& +SearchFilterByModule& operator=(const SearchFilterByModule& rhs); bool @@ -354,7 +352,6 @@ class SearchFilterByModuleList : public SearchFilter { public: - //-- /// The basic constructor takes a Target, which gives the space to search, /// and the module list to restrict the search to. @@ -372,7 +369,7 @@ public: ~SearchFilterByModuleList() override; -const SearchFilterByModuleList& +SearchFilterByModuleList& operator=(const SearchFilterByModuleList& rhs); bool @@ -414,7 +411,6 @@ class SearchFilterByModuleListAndCU : public SearchFilterByModuleList { public: - //-- /// The basic constructor takes a Target, which gives the space to search, /// and the module list to restrict the search to. @@ -433,7 +429,7 @@ public: ~SearchFilterByModuleListAndCU() override; -const SearchFilterByModuleListAndCU& +SearchFilterByModuleListAndCU& operator=(const SearchFilterByModuleListAndCU& rhs); bool Modified: lldb/trunk/source/Core/RegisterValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=263312&r1=263311&r2=263312&view=diff == --- lldb/trunk/source/Core/RegisterValue.cpp (original) +++ lldb/trunk/source/Core/RegisterValue.cpp Fri Mar 11 18:31:13 2016 @@ -1,4 +1,4 @@ -//===-- RegisterValue.cpp *- C++ -*-===// +//===-- RegisterValue.cpp ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,7 +11,11 @@ // C Includes // C++ Includes +#include + // Other libraries and framework includes +#include "llvm/ADT/StringRef.h" + // Project includes #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Error.h" @@ -24,7 +28,6 @@ using namespace lldb; using namespace lldb_private; - bool RegisterValue::Dump (Stream *s, const RegisterInfo *reg_info, @@ -98,14 +101,12 @@ RegisterValue::Dump (Stream *s, return false; } - bool RegisterValue::GetData (DataExtractor &data) const { return data.SetData(GetBytes(), GetByteSize(), GetByteOrder()) > 0; } - uint32_t RegisterValue::GetAsMemoryData (const RegisterInfo *reg_info, void *dst, @@ -113,7 +114,7 @@ RegisterValue::GetAsMemoryData (const Re lldb::ByteOrder dst_byte_order, Error &error) const { -if (reg_info == NULL) +if (reg_info == nullptr) { error.SetErrorString ("invalid register info argument."); return 0; @@ -163,7 +164,7 @@ RegisterValue::SetFromMemoryData (const lldb::ByteOrder src_byte_order, Error &error) { -if (reg_info == NULL) +if (reg_info == nullptr) { error.SetErrorString ("invalid register info argument."); return 0; @@ -405,8 +406,6 @@ RegisterValue::SetValueFromData (const R return error; } -#include "llvm/ADT/Stri
Re: [Lldb-commits] [lldb] r263312 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
We use UINT32_MAX and so forth all over in lldb. Were you planning to switch over all the uses? That seem like something you should not do unilaterally, but we should decide on as a group. I originally thought maybe this would buy us some type safety, but it looks like (and the docs seem to indicate) this is strictly equivalent to UINT32_MAX. So as far as I can tell the change (unlike NULL -> nullptr) has no benefit. If that's true, then we should only do this if we agree it is a good idea. I would prefer not to make this wholesale change. Substituting a small number of very readable characters where all of them are significant for a much larger number that bury the interesting bit in the template argument does not to me improve readability. Jim > On Mar 11, 2016, at 4:31 PM, Eugene Zelenko via lldb-commits > wrote: > > -if (no_modules_in_filter || m_module_spec_list.FindFileIndex(0, > module_sp->GetFileSpec(), false) != UINT32_MAX) > +if (no_modules_in_filter || > +m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), > false) != std::numeric_limits::max()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263326 - This change introduces a "ExpressionExecutionThread" to the ThreadList.
Author: jingham Date: Fri Mar 11 20:45:34 2016 New Revision: 263326 URL: http://llvm.org/viewvc/llvm-project?rev=263326&view=rev Log: This change introduces a "ExpressionExecutionThread" to the ThreadList. Turns out that most of the code that runs expressions (e.g. the ObjC runtime grubber) on behalf of the expression parser was using the currently selected thread. But sometimes, e.g. when we are evaluating breakpoint conditions/commands, we don't select the thread we're running on, we instead set the context for the interpreter, and explicitly pass that to other callers. That wasn't getting communicated to these utility expressions, so they would run on some other thread instead, and that could cause a variety of subtle and hard to reproduce problems. I also went through the commands and cleaned up the use of GetSelectedThread. All those uses should have been trying the thread in the m_exe_ctx belonging to the command object first. It would actually have been pretty hard to get misbehavior in these cases, but for correctness sake it is good to make this usage consistent. Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/include/lldb/Target/ThreadList.h lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Commands/CommandObjectType.cpp lldb/trunk/source/DataFormatters/FormattersHelpers.cpp lldb/trunk/source/Interpreter/CommandObject.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/trunk/source/Target/StopInfo.cpp lldb/trunk/source/Target/ThreadList.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=263326&r1=263325&r2=263326&view=diff == --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Fri Mar 11 20:45:34 2016 @@ -481,6 +481,12 @@ protected: // is present you want to prime the dummy target with entities that will be copied over to new targets. Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); Target *GetDummyTarget(); + +// If a command needs to use the "current" thread, use this call. +// Command objects will have an ExecutionContext to use, and that may or may not have a thread in it. If it +// does, you should use that by default, if not, then use the ExecutionContext's target's selected thread, etc... +// This call insulates you from the details of this calculation. +Thread *GetDefaultThread(); //-- /// Check the command to make sure anything required by this Modified: lldb/trunk/include/lldb/Target/ThreadList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=263326&r1=263325&r2=263326&view=diff == --- lldb/trunk/include/lldb/Target/ThreadList.h (original) +++ lldb/trunk/include/lldb/Target/ThreadList.h Fri Mar 11 20:45:34 2016 @@ -16,6 +16,7 @@ #include "lldb/Core/UserID.h" #include "lldb/Utility/Iterable.h" #include "lldb/Target/ThreadCollection.h" +#include "lldb/Target/Thread.h" namespace lldb_private { @@ -44,7 +45,43 @@ public: // selected at index 0. lldb::ThreadSP GetSelectedThread (); + +// Manage the thread to use for running expressions. This is usually the Selected thread, +// but sometimes (e.g. when evaluating breakpoint conditions & stop hooks) it isn't. +class ExpressionExecutionThreadPusher +{ +public: +ExpressionExecutionThreadPusher(ThreadList &thread_list, lldb::tid_t tid) : +m_thread_list(&thread_list), +m_tid(tid) +{ +m_thread_list->PushExpressionExecutionThread(m_tid); +} + +ExpressionExecutionThreadPusher(lldb::ThreadSP thread_sp); + +~ExpressionExecutionThreadPusher() +{ +if (m_thread_list) +m_thread_list->PopExpressionExecutionThread(m_tid); +} + +private: +ThreadList *m_thread_list; +lldb::tid_t m_tid; +}; +lldb::ThreadSP +GetExpressionExecutionThread(); + +protected: +void +PushExpressionExecutionThread(lldb::tid_t tid); + +void +PopExpressi
[Lldb-commits] [lldb] r263333 - Let's not convert from UINT32_MAX to the std::numeric_limits version.
Author: jingham Date: Fri Mar 11 21:33:36 2016 New Revision: 26 URL: http://llvm.org/viewvc/llvm-project?rev=26&view=rev Log: Let's not convert from UINT32_MAX to the std::numeric_limits version. Modified: lldb/trunk/source/Core/DataEncoder.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Core/FileSpecList.cpp lldb/trunk/source/Core/SearchFilter.cpp Modified: lldb/trunk/source/Core/DataEncoder.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataEncoder.cpp?rev=26&r1=263332&r2=26&view=diff == --- lldb/trunk/source/Core/DataEncoder.cpp (original) +++ lldb/trunk/source/Core/DataEncoder.cpp Fri Mar 11 21:33:36 2016 @@ -233,7 +233,7 @@ DataEncoder::PutU8 (uint32_t offset, uin m_start[offset] = value; return offset + 1; } -return std::numeric_limits::max(); +return UINT32_MAX; } uint32_t @@ -248,7 +248,7 @@ DataEncoder::PutU16 (uint32_t offset, ui return offset + sizeof (value); } -return std::numeric_limits::max(); +return UINT32_MAX; } uint32_t @@ -263,7 +263,7 @@ DataEncoder::PutU32 (uint32_t offset, ui return offset + sizeof (value); } -return std::numeric_limits::max(); +return UINT32_MAX; } uint32_t @@ -278,7 +278,7 @@ DataEncoder::PutU64 (uint32_t offset, ui return offset + sizeof (value); } -return std::numeric_limits::max(); +return UINT32_MAX; } //-- @@ -304,7 +304,7 @@ DataEncoder::PutMaxU64 (uint32_t offset, assert(!"GetMax64 unhandled case!"); break; } -return std::numeric_limits::max(); +return UINT32_MAX; } uint32_t @@ -318,7 +318,7 @@ DataEncoder::PutData (uint32_t offset, c memcpy (m_start + offset, src, src_len); return offset + src_len; } -return std::numeric_limits::max(); +return UINT32_MAX; } uint32_t @@ -332,5 +332,5 @@ DataEncoder::PutCString (uint32_t offset { if (cstr != nullptr) return PutData (offset, cstr, strlen(cstr) + 1); -return std::numeric_limits::max(); +return UINT32_MAX; } Modified: lldb/trunk/source/Core/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=26&r1=263332&r2=26&view=diff == --- lldb/trunk/source/Core/Disassembler.cpp (original) +++ lldb/trunk/source/Core/Disassembler.cpp Fri Mar 11 21:33:36 2016 @@ -1036,7 +1036,7 @@ InstructionList::GetIndexOfNextBranchIns { size_t num_instructions = m_instructions.size(); -uint32_t next_branch = std::numeric_limits::max(); +uint32_t next_branch = UINT32_MAX; size_t i; for (i = start; i < num_instructions; i++) { @@ -1053,7 +1053,7 @@ InstructionList::GetIndexOfNextBranchIns if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon) { // If we didn't find a branch, find the last packet start. -if (next_branch == std::numeric_limits::max()) +if (next_branch == UINT32_MAX) { i = num_instructions - 1; } @@ -1086,7 +1086,7 @@ InstructionList::GetIndexOfNextBranchIns } } -if (next_branch == std::numeric_limits::max()) +if (next_branch == UINT32_MAX) { // We couldn't find the previous packet, so return start next_branch = start; @@ -1099,7 +1099,7 @@ uint32_t InstructionList::GetIndexOfInstructionAtAddress (const Address &address) { size_t num_instructions = m_instructions.size(); -uint32_t index = std::numeric_limits::max(); +uint32_t index = UINT32_MAX; for (size_t i = 0; i < num_instructions; i++) { if (m_instructions[i]->GetAddress() == address) @@ -1152,7 +1152,7 @@ Disassembler::ParseInstructions (const E m_arch.GetByteOrder(), m_arch.GetAddressByteSize()); const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS; -return DecodeInstructions(range.GetBaseAddress(), data, 0, std::numeric_limits::max(), false, +return DecodeInstructions(range.GetBaseAddress(), data, 0, UINT32_MAX, false, data_from_file); } else if (error_strm_ptr) Modified: lldb/trunk/source/Core/FileSpecList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpecList.cpp?rev=26&r1=263332&r2=26&view=diff == --- lldb/trunk/source/Core/FileSpecList.cpp (original) +++ lldb/trunk/source/Core/FileSpecList.cpp Fri Mar 11 21:33:36 2016 @@ -125,7 +125,7 @@ FileSpecList::FindFileIndex (size_t star }