[Lldb-commits] [lldb] r286349 - Remove TimeValue usage from Core/Module
Author: labath Date: Wed Nov 9 03:59:18 2016 New Revision: 286349 URL: http://llvm.org/viewvc/llvm-project?rev=286349&view=rev Log: Remove TimeValue usage from Core/Module Summary: The only interesting part here is that TimePoint and TimeValue have different natural string representations, which affects "target modules list" output. It is now "2016-07-09 04:02:21.0", whereas previously in was "Sat Jul 9 04:02:21 2016". I wanted to check if we're OK with that. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26275 Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Host/TimeValue.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/common/TimeValue.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=286349&r1=286348&r2=286349&view=diff == --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Wed Nov 9 03:59:18 2016 @@ -10,26 +10,27 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ -// C Includes -// C++ Includes -#include -#include -#include -#include +#include "lldb/Symbol/SymbolContextScope.h" -// Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/UUID.h" #include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" -#include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" #include "lldb/lldb-forward.h" +// Other libraries and framework includes #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Chrono.h" + +// C Includes +// C++ Includes +#include +#include +#include +#include namespace lldb_private { @@ -92,10 +93,11 @@ public: /// module within a module (.a files and modules that contain /// multiple architectures). //-- - Module(const FileSpec &file_spec, const ArchSpec &arch, - const ConstString *object_name = nullptr, - lldb::offset_t object_offset = 0, - const TimeValue *object_mod_time_ptr = nullptr); + Module( + const FileSpec &file_spec, const ArchSpec &arch, + const ConstString *object_name = nullptr, + lldb::offset_t object_offset = 0, + const llvm::sys::TimePoint<> &object_mod_time = llvm::sys::TimePoint<>()); Module(const ModuleSpec &module_spec); @@ -557,13 +559,15 @@ public: void SetSymbolFileFileSpec(const FileSpec &file); - const TimeValue &GetModificationTime() const { return m_mod_time; } + const llvm::sys::TimePoint<> &GetModificationTime() const { +return m_mod_time; + } - const TimeValue &GetObjectModificationTime() const { + const llvm::sys::TimePoint<> &GetObjectModificationTime() const { return m_object_mod_time; } - void SetObjectModificationTime(const TimeValue &mod_time) { + void SetObjectModificationTime(const llvm::sys::TimePoint<> &mod_time) { m_mod_time = mod_time; } @@ -1025,8 +1029,10 @@ protected: //-- mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy ///in multi-threaded environments. - TimeValue m_mod_time; ///< The modification time for this module when it was -///created. + + /// The modification time for this module when it was created. + llvm::sys::TimePoint<> m_mod_time; + ArchSpec m_arch; ///< The architecture for this module. UUID m_uuid; ///< Each module is assumed to have a unique identifier to help ///match it up to debug symbols. @@ -1044,7 +1050,7 @@ protected: ///selected, or empty of the module is represented ///by \a m_file. uint64_t m_object_offset; - TimeValue m_object_mod_time; + llvm::sys::TimePoint<> m_object_mod_time; lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file ///parser for this module as it may or may ///not be shared with the SymbolFile Modified: lldb/trunk/include/lldb/Host/TimeValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/TimeValue.h?rev=286349&r1=286348&r2=286349&view=diff == --- lldb/trunk/include/lldb/Host/TimeValue.h (original) +++ lldb/trunk/include/lldb/Host/TimeValue.h Wed Nov 9 03:59:18 2016 @@ -14,12 +1
[Lldb-commits] [PATCH] D26275: Remove TimeValue usage from Core/Module
This revision was automatically updated to reflect the committed changes. Closed by commit rL286349: Remove TimeValue usage from Core/Module (authored by labath). Changed prior to commit: https://reviews.llvm.org/D26275?vs=77209&id=77323#toc Repository: rL LLVM https://reviews.llvm.org/D26275 Files: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Host/TimeValue.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/common/TimeValue.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -35,6 +35,7 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/VariableList.h" +#include "llvm/Support/ScopedPrinter.h" #include "LogChannelDWARF.h" #include "SymbolFileDWARF.h" @@ -175,9 +176,8 @@ DebugMapModule(const ModuleSP &exe_module_sp, uint32_t cu_idx, const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name, off_t object_offset, - const TimeValue *object_mod_time_ptr) - : Module(file_spec, arch, object_name, object_offset, - object_mod_time_ptr), + const llvm::sys::TimePoint<> object_mod_time) + : Module(file_spec, arch, object_name, object_offset, object_mod_time), m_exe_module_wp(exe_module_sp), m_cu_idx(cu_idx) {} ~DebugMapModule() override = default; @@ -355,9 +355,8 @@ m_compile_unit_infos[i].so_file.SetFile( so_symbol->GetName().AsCString(), false); m_compile_unit_infos[i].oso_path = oso_symbol->GetName(); - TimeValue oso_mod_time; - oso_mod_time.OffsetWithSeconds(oso_symbol->GetIntegerValue(0)); - m_compile_unit_infos[i].oso_mod_time = oso_mod_time; + m_compile_unit_infos[i].oso_mod_time = + llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0)); uint32_t sibling_idx = so_symbol->GetSiblingIndex(); // The sibling index can't be less that or equal to the current index // "i" @@ -425,15 +424,14 @@ FileSpec oso_file(oso_path, false); ConstString oso_object; if (oso_file.Exists()) { -TimeValue oso_mod_time(FileSystem::GetModificationTime(oso_file)); +auto oso_mod_time = FileSystem::GetModificationTime(oso_file); if (oso_mod_time != comp_unit_info->oso_mod_time) { obj_file->GetModule()->ReportError( "debug map object file '%s' has changed (actual time is " - "0x%" PRIx64 ", debug map time is 0x%" PRIx64 + "%s, debug map time is %s" ") since this executable was linked, file will be ignored", - oso_file.GetPath().c_str(), - oso_mod_time.GetAsSecondsSinceJan1_1970(), - comp_unit_info->oso_mod_time.GetAsSecondsSinceJan1_1970()); + oso_file.GetPath().c_str(), llvm::to_string(oso_mod_time).c_str(), + llvm::to_string(comp_unit_info->oso_mod_time).c_str()); return NULL; } @@ -464,7 +462,8 @@ comp_unit_info->oso_sp->module_sp.reset(new DebugMapModule( obj_file->GetModule(), GetCompUnitInfoIndex(comp_unit_info), oso_file, oso_arch, oso_object ? &oso_object : NULL, 0, - oso_object ? &comp_unit_info->oso_mod_time : NULL)); + oso_object ? comp_unit_info->oso_mod_time + : llvm::sys::TimePoint<>())); } } if (comp_unit_info->oso_sp) Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -14,8 +14,8 @@ #include #include "lldb/Core/RangeMap.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Symbol/SymbolFile.h" +#include "llvm/Support/Chrono.h" #include "UniqueDWARFASTType.h" @@ -155,7 +155,7 @@ struct CompileUnitInfo { lldb_private::FileSpec so_file; lldb_private::ConstString oso_path; -lldb_private::TimeValue oso_mod_time; +llvm::sys::TimePoint<> oso_mod_time; OSOInfoSP oso_sp; lldb::CompUnitSP compile_unit_sp; uint32_t first_symbol_index; Index: lldb/trunk/source/Commands/CommandObjectTarget.cpp === --- lldb/trunk/source/Commands/CommandObjectTarget.cpp +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp @@ -9,11 +9,6 @@ #include "Command
[Lldb-commits] [PATCH] D26393: Disable windows-only minidump plugin
labath added a comment. Yeah, feel free to take over. I was not planning to do any more work here - just wanted to wrap things up. I am going to commit this then, and leave the rest to you. https://reviews.llvm.org/D26393 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286352 - Disable windows-only minidump plugin
Author: labath Date: Wed Nov 9 04:16:11 2016 New Revision: 286352 URL: http://llvm.org/viewvc/llvm-project?rev=286352&view=rev Log: Disable windows-only minidump plugin Summary: This commit disables the windows-only minidump plugin and enables the new cross-platform plugin for windows minidump files. Test decorators are adjusted to reflect that: windows minidump tests can now run on all platforms. The exception is the tests that create minidump files, as that functionality is not available yet. I've checked that this works on windows and linux. Reviewers: amccarth, zturner Subscribers: dvlahovski, lldb-commits Differential Revision: https://reviews.llvm.org/D26393 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py?rev=286352&r1=286351&r2=286352&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py Wed Nov 9 04:16:11 2016 @@ -15,9 +15,8 @@ from lldbsuite.test import lldbutil class MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_process_info_in_mini_dump(self): """Test that lldb can read the process information from the minidump.""" # target create -c fizzbuzz_no_heap.dmp @@ -28,8 +27,6 @@ class MiniDumpTestCase(TestBase): self.assertEqual(self.process.GetNumThreads(), 1) self.assertEqual(self.process.GetProcessID(), 4440) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_thread_info_in_mini_dump(self): """Test that lldb can read the thread information from the minidump.""" # target create -c fizzbuzz_no_heap.dmp @@ -44,8 +41,6 @@ class MiniDumpTestCase(TestBase): stop_description = thread.GetStopDescription(256) self.assertTrue("0xc005" in stop_description) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_stack_info_in_mini_dump(self): """Test that we can see a trivial stack in a VS-generate mini dump.""" # target create -c fizzbuzz_no_heap.dmp @@ -63,8 +58,7 @@ class MiniDumpTestCase(TestBase): self.assertTrue(eip.IsValid()) self.assertEqual(pc, eip.GetValueAsUnsigned()) -@skipUnlessWindows -@not_remote_testsuite_ready +@skipUnlessWindows # Minidump saving works only on windows def test_deeper_stack_in_mini_dump(self): """Test that we can examine a more interesting stack in a mini dump.""" self.build() @@ -100,8 +94,7 @@ class MiniDumpTestCase(TestBase): if (os.path.isfile(core)): os.unlink(core) -@skipUnlessWindows -@not_remote_testsuite_ready +@skipUnlessWindows # Minidump saving works only on windows def test_local_variables_in_mini_dump(self): """Test that we can examine local variables in a mini dump.""" self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py?rev=286352&r1=286351&r2=286352&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py Wed Nov 9 04:16:11 2016 @@ -20,9 +20,8 @@ from lldbsuite.test import lldbutil class Wow64MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_wow64_mini_dump(self): """Test that lldb can read the process information from the minidump.""" # target create -c fizzbuzz_wow64.dmp @@ -32,8 +31,6 @@ class Wow64MiniDumpTestCase(TestBase): self.assertEqual(process.G
[Lldb-commits] [PATCH] D26393: Disable windows-only minidump plugin
This revision was automatically updated to reflect the committed changes. Closed by commit rL286352: Disable windows-only minidump plugin (authored by labath). Changed prior to commit: https://reviews.llvm.org/D26393?vs=77175&id=77325#toc Repository: rL LLVM https://reviews.llvm.org/D26393 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -15,9 +15,8 @@ class MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_process_info_in_mini_dump(self): """Test that lldb can read the process information from the minidump.""" # target create -c fizzbuzz_no_heap.dmp @@ -28,8 +27,6 @@ self.assertEqual(self.process.GetNumThreads(), 1) self.assertEqual(self.process.GetProcessID(), 4440) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_thread_info_in_mini_dump(self): """Test that lldb can read the thread information from the minidump.""" # target create -c fizzbuzz_no_heap.dmp @@ -44,8 +41,6 @@ stop_description = thread.GetStopDescription(256) self.assertTrue("0xc005" in stop_description) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_stack_info_in_mini_dump(self): """Test that we can see a trivial stack in a VS-generate mini dump.""" # target create -c fizzbuzz_no_heap.dmp @@ -63,8 +58,7 @@ self.assertTrue(eip.IsValid()) self.assertEqual(pc, eip.GetValueAsUnsigned()) -@skipUnlessWindows -@not_remote_testsuite_ready +@skipUnlessWindows # Minidump saving works only on windows def test_deeper_stack_in_mini_dump(self): """Test that we can examine a more interesting stack in a mini dump.""" self.build() @@ -100,8 +94,7 @@ if (os.path.isfile(core)): os.unlink(core) -@skipUnlessWindows -@not_remote_testsuite_ready +@skipUnlessWindows # Minidump saving works only on windows def test_local_variables_in_mini_dump(self): """Test that we can examine local variables in a mini dump.""" self.build() Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py @@ -20,9 +20,8 @@ class Wow64MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_wow64_mini_dump(self): """Test that lldb can read the process information from the minidump.""" # target create -c fizzbuzz_wow64.dmp @@ -32,8 +31,6 @@ self.assertEqual(process.GetNumThreads(), 1) self.assertEqual(process.GetProcessID(), 0x1E9C) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_thread_info_in_wow64_mini_dump(self): """Test that lldb can read the thread information from the minidump.""" # target create -c fizzbuzz_wow64.dmp @@ -50,8 +47,6 @@ thread = process.GetThreadAtIndex(0) self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) -@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts -@no_debug_info_test def test_stack_info_in_wow64_mini_dump(self): """Test that we can see a trivial stack in a VS-generate mini dump.""" # target create -c fizzbuzz_no_heap.dmp Index: lldb/trunk/source/API/SystemInitializerFull.cpp === --- lldb/trunk/source/API/SystemInitializerFull.cpp +++ lldb/trunk/source/API/SystemInitializerFull.cpp @@ -109,7 +109,6 @@ #if defined(_MSC_VER) #include "Plugins/Process/Windows/Live/ProcessWindowsLive.
[Lldb-commits] [lldb] r286355 - Display the pointer value in the libstdc++ unique_ptr summary
Author: labath Date: Wed Nov 9 04:42:29 2016 New Revision: 286355 URL: http://llvm.org/viewvc/llvm-project?rev=286355&view=rev Log: Display the pointer value in the libstdc++ unique_ptr summary Summary: r284830 added a summary provider for unique_ptr in libstdc++, whose value printed the value of the pointee. This is a bit unintuitive as it becomes unobvious that the value actually is a pointer, and we lose the way to actually obtain the pointer value. Change that to print the pointer value instead. The pointee value can still be obtained through the synthetic children. Reviewers: tberghammer, granata.enrico Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26403 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py?rev=286355&r1=286354&r2=286355&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py Wed Nov 9 04:42:29 2016 @@ -34,12 +34,12 @@ class StdUniquePtrDataFormatterTestCase( self.assertTrue(frame.IsValid()) self.expect("frame variable nup", substrs=['nup = nullptr']) -self.expect("frame variable iup", substrs=['iup = 123', 'object = 123']) -self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = "foobar"']) +self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123']) +self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"']) self.expect("frame variable ndp", substrs=['ndp = nullptr']) -self.expect("frame variable idp", substrs=['idp = 456', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) -self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) +self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) +self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned()) self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid()) Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=286355&r1=286354&r2=286355&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Wed Nov 9 04:42:29 2016 @@ -126,23 +126,14 @@ bool LibStdcppUniquePtrSyntheticFrontEnd if (!m_ptr_obj) return false; - if (m_ptr_obj->GetValueAsUnsigned(0) == 0) { + bool success; + uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success); + if (!success) +return false; + if (ptr_value == 0) stream.Printf("nullptr"); - } else { -Error error; -bool print_pointee = false; -if (m_obj_obj) { - if (m_obj_obj->DumpPrintableRepresentation( - stream, ValueObject::eValueObjectRepresentationStyleSummary, - lldb::eFormatInvalid, - ValueObject::PrintableRepresentationSpecialCases::eDisable, - false)) { -print_pointee = true; - } -} -if (!print_pointee) - stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0)); - } + else +stream.Printf("0x%" PRIx64, ptr_value); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary
This revision was automatically updated to reflect the committed changes. Closed by commit rL286355: Display the pointer value in the libstdc++ unique_ptr summary (authored by labath). Changed prior to commit: https://reviews.llvm.org/D26403?vs=77202&id=77329#toc Repository: rL LLVM https://reviews.llvm.org/D26403 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py @@ -34,12 +34,12 @@ self.assertTrue(frame.IsValid()) self.expect("frame variable nup", substrs=['nup = nullptr']) -self.expect("frame variable iup", substrs=['iup = 123', 'object = 123']) -self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = "foobar"']) +self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123']) +self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"']) self.expect("frame variable ndp", substrs=['ndp = nullptr']) -self.expect("frame variable idp", substrs=['idp = 456', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) -self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) +self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) +self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned()) self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid()) Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp === --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -126,23 +126,14 @@ if (!m_ptr_obj) return false; - if (m_ptr_obj->GetValueAsUnsigned(0) == 0) { + bool success; + uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success); + if (!success) +return false; + if (ptr_value == 0) stream.Printf("nullptr"); - } else { -Error error; -bool print_pointee = false; -if (m_obj_obj) { - if (m_obj_obj->DumpPrintableRepresentation( - stream, ValueObject::eValueObjectRepresentationStyleSummary, - lldb::eFormatInvalid, - ValueObject::PrintableRepresentationSpecialCases::eDisable, - false)) { -print_pointee = true; - } -} -if (!print_pointee) - stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0)); - } + else +stream.Printf("0x%" PRIx64, ptr_value); return true; } Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py @@ -34,12 +34,12 @@ self.assertTrue(frame.IsValid()) self.expect("frame variable nup", substrs=['nup = nullptr']) -self.expect("frame variable iup", substrs=['iup = 123', 'object = 123']) -self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = "foobar"']) +self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123']) +self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"']) self.expect("frame variable ndp", substrs=['ndp = nullptr']) -self.expect("frame variable idp", substrs=['idp = 456', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) -self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) +self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) +self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) self
[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary
labath added inline comments. Comment at: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:129 if (m_ptr_obj->GetValueAsUnsigned(0) == 0) { stream.Printf("nullptr"); granata.enrico wrote: > This is very nitpick-y but why not > > lldb::addr_t ptr_value = m_ptr_obj->GetValueAsUnsigned(LLDB_INVALID_ADDRESS) > switch (ptr_value) { > case 0: stream.Printf("nullptr"); break; > case LLDB_INVALID_ADDRESS: return false; > default: stream.Printf("0x%" PRIx64, ptr_value); break; > } > > modulo clang-formatting the above, of course. > I've changed this to: ``` uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success); if (!success) return false; if (ptr_value == 0) stream.Printf("nullptr"); else stream.Printf("0x%" PRIx64, ptr_value); ``` This should address the issue of not printing a bogus value if we fail to read the value, but avoid the case where the pointer value *is* 0x.. (which it can legitimately be, e.g. with custom deleters, or if the inferior corrupts it's memory). At that point, the switch is not necessary. https://reviews.llvm.org/D26403 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286360 - Fix expectation in TestStaticVariables.py after rL286302
Author: tberghammer Date: Wed Nov 9 05:52:12 2016 New Revision: 286360 URL: http://llvm.org/viewvc/llvm-project?rev=286360&view=rev Log: Fix expectation in TestStaticVariables.py after rL286302 The debug info emitted by clang for static variables improved by rL286302 and it exposed an incorrect test expactation because now LLDB able to displays more data 9thanks to better debug info) then before. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py?rev=286360&r1=286359&r2=286360&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Wed Nov 9 05:52:12 2016 @@ -44,7 +44,7 @@ class StaticVariableTestCase(TestBase): self.expect( 'target variable A::g_points', VARIABLES_DISPLAYED_CORRECTLY, -patterns=['\(PointType \[[1-9]*\]\) A::g_points = {.*}']) +patterns=['\(PointType \[[1-9]*\]\) A::g_points = {']) self.expect('target variable g_points', VARIABLES_DISPLAYED_CORRECTLY, substrs=['(PointType [2]) g_points']) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286366 - Remove TimeValue usage from lldb/Core. NFC.
Author: labath Date: Wed Nov 9 08:04:08 2016 New Revision: 286366 URL: http://llvm.org/viewvc/llvm-project?rev=286366&view=rev Log: Remove TimeValue usage from lldb/Core. NFC. Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h lldb/trunk/include/lldb/Core/SourceManager.h lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=286366&r1=286365&r2=286366&view=diff == --- lldb/trunk/include/lldb/Core/ModuleSpec.h (original) +++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Nov 9 08:04:08 2016 @@ -10,20 +10,21 @@ #ifndef liblldb_ModuleSpec_h_ #define liblldb_ModuleSpec_h_ -// C Includes -// C++ Includes -#include -#include - -// Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Stream.h" #include "lldb/Core/UUID.h" #include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Target/PathMappingList.h" +// Other libraries and framework includes +#include "llvm/Support/Chrono.h" + +// C Includes +// C++ Includes +#include +#include + namespace lldb_private { class ModuleSpec { @@ -31,19 +32,17 @@ public: ModuleSpec() : m_file(), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(), m_object_name(), m_object_offset(0), m_object_size(0), -m_object_mod_time(), m_source_mappings() {} +m_source_mappings() {} ModuleSpec(const FileSpec &file_spec) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(), m_object_name(), m_object_offset(0), -m_object_size(file_spec.GetByteSize()), m_object_mod_time(), -m_source_mappings() {} +m_object_size(file_spec.GetByteSize()), m_source_mappings() {} ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch), m_uuid(), m_object_name(), m_object_offset(0), -m_object_size(file_spec.GetByteSize()), m_object_mod_time(), -m_source_mappings() {} +m_object_size(file_spec.GetByteSize()), m_source_mappings() {} ModuleSpec(const ModuleSpec &rhs) : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file), @@ -139,9 +138,11 @@ public: void SetObjectSize(uint64_t object_size) { m_object_size = object_size; } - TimeValue &GetObjectModificationTime() { return m_object_mod_time; } + llvm::sys::TimePoint<> &GetObjectModificationTime() { +return m_object_mod_time; + } - const TimeValue &GetObjectModificationTime() const { + const llvm::sys::TimePoint<> &GetObjectModificationTime() const { return m_object_mod_time; } @@ -157,7 +158,7 @@ public: m_object_offset = 0; m_object_size = 0; m_source_mappings.Clear(false); -m_object_mod_time.Clear(); +m_object_mod_time = llvm::sys::TimePoint<>(); } explicit operator bool() const { @@ -175,7 +176,7 @@ public: return true; if (m_object_size) return true; -if (m_object_mod_time.IsValid()) +if (m_object_mod_time != llvm::sys::TimePoint<>()) return true; return false; } @@ -236,11 +237,11 @@ public: strm.Printf("object size = %" PRIu64, m_object_size); dumped_something = true; } -if (m_object_mod_time.IsValid()) { +if (m_object_mod_time != llvm::sys::TimePoint<>()) { if (dumped_something) strm.PutCString(", "); strm.Printf("object_mod_time = 0x%" PRIx64, - m_object_mod_time.GetAsSecondsSinceJan1_1970()); + llvm::sys::toTimeT(m_object_mod_time)); } } @@ -294,7 +295,7 @@ protected: ConstString m_object_name; uint64_t m_object_offset; uint64_t m_object_size; - TimeValue m_object_mod_time; + llvm::sys::TimePoint<> m_object_mod_time; mutable PathMappingList m_source_mappings; }; Modified: lldb/trunk/include/lldb/Core/SourceManager.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=286366&r1=286365&r2=286366&view=diff == --- lldb/trunk/include/lldb/Core/SourceManager.h (original) +++ lldb/trunk/include/lldb/Core/SourceManager.h Wed Nov 9 08:04:08 2016 @@ -10,18 +10,19 @@ #ifndef liblldb_SourceManager_h_ #define liblldb_SourceManager_h_ +// Project includes +#include "lldb/Host/FileSpec.h" +#include "lldb/lldb-private.h" + +// Other libraries and framework includes +#include "llvm/Support/Chrono.h" + // C Includes // C++ Includes #include #include #include -// Other libraries and framework includes -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" -#include "lldb/lldb-privat
[Lldb-commits] [lldb] r286369 - Remove TimeValue usage from lldb/Interpreter
Author: labath Date: Wed Nov 9 08:33:22 2016 New Revision: 286369 URL: http://llvm.org/viewvc/llvm-project?rev=286369&view=rev Log: Remove TimeValue usage from lldb/Interpreter Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=286369&r1=286368&r2=286369&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Wed Nov 9 08:33:22 2016 @@ -13,7 +13,7 @@ #include "lldb/Interpreter/OptionValue.h" #include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" +#include "llvm/Support/Chrono.h" namespace lldb_private { @@ -48,7 +48,7 @@ public: m_current_value = m_default_value; m_value_was_set = false; m_data_sp.reset(); -m_data_mod_time.Clear(); +m_data_mod_time = llvm::sys::TimePoint<>(); return true; } @@ -85,7 +85,7 @@ protected: FileSpec m_current_value; FileSpec m_default_value; lldb::DataBufferSP m_data_sp; - TimeValue m_data_mod_time; + llvm::sys::TimePoint<> m_data_mod_time; uint32_t m_completion_mask; bool m_resolve; }; Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=286369&r1=286368&r2=286369&view=diff == --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Nov 9 08:33:22 2016 @@ -21,6 +21,7 @@ #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Host/StringConvert.h" #include "lldb/Host/Symbols.h" +#include "lldb/Host/TimeValue.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=286369&r1=286368&r2=286369&view=diff == --- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Wed Nov 9 08:33:22 2016 @@ -79,7 +79,7 @@ Error OptionValueFileSpec::SetValueFromS m_value_was_set = true; m_current_value.SetFile(value.str(), m_resolve); m_data_sp.reset(); - m_data_mod_time.Clear(); + m_data_mod_time = llvm::sys::TimePoint<>(); NotifyValueChanged(); } else { error.SetErrorString("invalid value string"); @@ -117,8 +117,7 @@ size_t OptionValueFileSpec::AutoComplete const lldb::DataBufferSP & OptionValueFileSpec::GetFileContents(bool null_terminate) { if (m_current_value) { -const TimeValue file_mod_time = -FileSystem::GetModificationTime(m_current_value); +const auto file_mod_time = FileSystem::GetModificationTime(m_current_value); if (m_data_sp && m_data_mod_time == file_mod_time) return m_data_sp; if (null_terminate) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286372 - Remove unused TimeValue include
Author: labath Date: Wed Nov 9 08:53:37 2016 New Revision: 286372 URL: http://llvm.org/viewvc/llvm-project?rev=286372&view=rev Log: Remove unused TimeValue include Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h?rev=286372&r1=286371&r2=286372&view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Wed Nov 9 08:53:37 2016 @@ -20,7 +20,6 @@ // Project includes #include "lldb/Core/UUID.h" #include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286371 - Remove TimeValue usage from lldb/Host
Author: labath Date: Wed Nov 9 08:53:32 2016 New Revision: 286371 URL: http://llvm.org/viewvc/llvm-project?rev=286371&view=rev Log: Remove TimeValue usage from lldb/Host Modified: lldb/trunk/source/Host/common/Socket.cpp lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp Modified: lldb/trunk/source/Host/common/Socket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=286371&r1=286370&r2=286371&view=diff == --- lldb/trunk/source/Host/common/Socket.cpp (original) +++ lldb/trunk/source/Host/common/Socket.cpp Wed Nov 9 08:53:32 2016 @@ -15,7 +15,6 @@ #include "lldb/Host/Host.h" #include "lldb/Host/SocketAddress.h" #include "lldb/Host/StringConvert.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/common/UDPSocket.h" Modified: lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp?rev=286371&r1=286370&r2=286371&view=diff == --- lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp (original) +++ lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp Wed Nov 9 08:53:32 2016 @@ -10,7 +10,6 @@ #include "lldb/Host/windows/ConnectionGenericFileWindows.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" -#include "lldb/Host/TimeValue.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" @@ -195,9 +194,7 @@ size_t ConnectionGenericFile::Read(void // The expected return path. The operation is pending. Wait for the // operation to complete // or be interrupted. - TimeValue time_value; - time_value.OffsetWithMicroSeconds(timeout_usec); - DWORD milliseconds = time_value.milliseconds(); + DWORD milliseconds = timeout_usec/1000; DWORD wait_result = ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), m_event_handles, FALSE, milliseconds); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286374 - Remove TimeValue usage from lldb/Target
Author: labath Date: Wed Nov 9 09:05:48 2016 New Revision: 286374 URL: http://llvm.org/viewvc/llvm-project?rev=286374&view=rev Log: Remove TimeValue usage from lldb/Target It was only used for declaring unused variables. :) Modified: lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=286374&r1=286373&r2=286374&view=diff == --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Wed Nov 9 09:05:48 2016 @@ -35,7 +35,6 @@ #include "lldb/Host/Pipe.h" #include "lldb/Host/Terminal.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Symbol/Function.h" @@ -5093,8 +5092,6 @@ Process::RunThreadPlan(ExecutionContext // The expression evaluation should still succeed. bool miss_first_event = true; #endif -TimeValue one_thread_timeout; -TimeValue final_timeout; std::chrono::microseconds timeout = std::chrono::microseconds(0); while (true) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286373 - Remove TimeValue usage from ObjectContainerBSDArchive
Author: labath Date: Wed Nov 9 09:05:45 2016 New Revision: 286373 URL: http://llvm.org/viewvc/llvm-project?rev=286373&view=rev Log: Remove TimeValue usage from ObjectContainerBSDArchive Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=286373&r1=286372&r2=286373&view=diff == --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original) +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Wed Nov 9 09:05:45 2016 @@ -134,7 +134,7 @@ ObjectContainerBSDArchive::Object::Extra } ObjectContainerBSDArchive::Archive::Archive(const lldb_private::ArchSpec &arch, -const lldb_private::TimeValue &time, +const llvm::sys::TimePoint<> &time, lldb::offset_t file_offset, lldb_private::DataExtractor &data) : m_arch(arch), m_time(time), m_file_offset(file_offset), m_objects(), @@ -169,13 +169,14 @@ size_t ObjectContainerBSDArchive::Archiv ObjectContainerBSDArchive::Object * ObjectContainerBSDArchive::Archive::FindObject( -const ConstString &object_name, const TimeValue &object_mod_time) { +const ConstString &object_name, +const llvm::sys::TimePoint<> &object_mod_time) { const ObjectNameToIndexMap::Entry *match = m_object_name_to_index_map.FindFirstValueForName( object_name.GetStringRef()); if (match) { -if (object_mod_time.IsValid()) { - const uint64_t object_date = object_mod_time.GetAsSecondsSinceJan1_1970(); +if (object_mod_time != llvm::sys::TimePoint<>()) { + const uint64_t object_date = llvm::sys::toTimeT(object_mod_time); if (m_objects[match->value].ar_date == object_date) return &m_objects[match->value]; const ObjectNameToIndexMap::Entry *next_match = @@ -195,8 +196,8 @@ ObjectContainerBSDArchive::Archive::Find ObjectContainerBSDArchive::Archive::shared_ptr ObjectContainerBSDArchive::Archive::FindCachedArchive( -const FileSpec &file, const ArchSpec &arch, const TimeValue &time, -lldb::offset_t file_offset) { +const FileSpec &file, const ArchSpec &arch, +const llvm::sys::TimePoint<> &time, lldb::offset_t file_offset) { std::lock_guard guard(Archive::GetArchiveCacheMutex()); shared_ptr archive_sp; Archive::Map &archive_map = Archive::GetArchiveCache(); @@ -236,8 +237,9 @@ ObjectContainerBSDArchive::Archive::Find ObjectContainerBSDArchive::Archive::shared_ptr ObjectContainerBSDArchive::Archive::ParseAndCacheArchiveForFile( -const FileSpec &file, const ArchSpec &arch, const TimeValue &time, -lldb::offset_t file_offset, DataExtractor &data) { +const FileSpec &file, const ArchSpec &arch, +const llvm::sys::TimePoint<> &time, lldb::offset_t file_offset, +DataExtractor &data) { shared_ptr archive_sp(new Archive(arch, time, file_offset, data)); if (archive_sp) { const size_t num_objects = archive_sp->ParseObjects(); @@ -453,7 +455,8 @@ size_t ObjectContainerBSDArchive::GetMod data.SetData(data_sp, data_offset, data_sp->GetByteSize()); if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) { const size_t initial_count = specs.GetSize(); -TimeValue file_mod_time = FileSystem::GetModificationTime(file); +llvm::sys::TimePoint<> file_mod_time = +FileSystem::GetModificationTime(file); Archive::shared_ptr archive_sp(Archive::FindCachedArchive( file, ArchSpec(), file_mod_time, file_offset)); bool set_archive_arch = false; @@ -480,8 +483,8 @@ size_t ObjectContainerBSDArchive::GetMod specs)) { ModuleSpec &spec = specs.GetModuleSpecRefAtIndex(specs.GetSize() - 1); - TimeValue object_mod_time; - object_mod_time.OffsetWithSeconds(object->ar_date); + llvm::sys::TimePoint<> object_mod_time( + std::chrono::seconds(object->ar_date)); spec.GetObjectName() = object->ar_name; spec.SetObjectOffset(object_file_offset); spec.SetObjectSize(file_size - object_file_offset); Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=286373&r1=286372&r2=286373&view=diff
[Lldb-commits] [PATCH] D26451: Remove TimeValue class
labath created this revision. labath added reviewers: clayborg, zturner. labath added a subscriber: lldb-commits. Herald added a subscriber: mgorny. All usages have been replaced by appropriate std::chrono funcionality, and the class is now unused. The only used part of the cpp file is the DumpTimePoint function, which I have moved into the only caller (CommandObjectTarget.cpp). https://reviews.llvm.org/D26451 Files: include/lldb/Host/TimeValue.h include/lldb/lldb-forward.h lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectTarget.cpp source/Host/CMakeLists.txt source/Host/common/TimeValue.cpp Index: source/Host/common/TimeValue.cpp === --- source/Host/common/TimeValue.cpp +++ /dev/null @@ -1,155 +0,0 @@ -//===-- TimeValue.cpp ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#include "lldb/Host/TimeValue.h" -#include "lldb/Host/Config.h" - -// C Includes -#include -#include -#include - -#ifdef _MSC_VER -#include "lldb/Host/windows/windows.h" -#endif - -// C++ Includes -#include - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Stream.h" - -using namespace lldb_private; - -//-- -// TimeValue constructor -//-- -TimeValue::TimeValue() : m_nano_seconds(0) {} - -//-- -// TimeValue copy constructor -//-- -TimeValue::TimeValue(const TimeValue &rhs) -: m_nano_seconds(rhs.m_nano_seconds) {} - -TimeValue::TimeValue(const struct timespec &ts) -: m_nano_seconds((uint64_t)ts.tv_sec * NanoSecPerSec + ts.tv_nsec) {} - -TimeValue::TimeValue(uint32_t seconds, uint64_t nanos) -: m_nano_seconds((uint64_t)seconds * NanoSecPerSec + nanos) {} - -//-- -// Destructor -//-- -TimeValue::~TimeValue() {} - -uint64_t TimeValue::GetAsNanoSecondsSinceJan1_1970() const { - return m_nano_seconds; -} - -uint64_t TimeValue::GetAsMicroSecondsSinceJan1_1970() const { - return m_nano_seconds / NanoSecPerMicroSec; -} - -uint64_t TimeValue::GetAsSecondsSinceJan1_1970() const { - return m_nano_seconds / NanoSecPerSec; -} - -struct timespec TimeValue::GetAsTimeSpec() const { - struct timespec ts; - ts.tv_sec = m_nano_seconds / NanoSecPerSec; - ts.tv_nsec = m_nano_seconds % NanoSecPerSec; - return ts; -} - -void TimeValue::Clear() { m_nano_seconds = 0; } - -bool TimeValue::IsValid() const { return m_nano_seconds != 0; } - -void TimeValue::OffsetWithSeconds(uint64_t sec) { - m_nano_seconds += sec * NanoSecPerSec; -} - -void TimeValue::OffsetWithMicroSeconds(uint64_t usec) { - m_nano_seconds += usec * NanoSecPerMicroSec; -} - -void TimeValue::OffsetWithNanoSeconds(uint64_t nsec) { m_nano_seconds += nsec; } - -TimeValue TimeValue::Now() { - using namespace std::chrono; - auto now = system_clock::now(); - auto ns_since_epoch = - duration_cast(now.time_since_epoch()).count(); - - return TimeValue(0, ns_since_epoch); -} - -//-- -// TimeValue assignment operator -//-- -const TimeValue &TimeValue::operator=(const TimeValue &rhs) { - m_nano_seconds = rhs.m_nano_seconds; - return *this; -} - -bool lldb_private::operator==(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() == - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -bool lldb_private::operator!=(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() != - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -bool lldb_private::operator<(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() < - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -bool lldb_private::operator<=(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() <= - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -bool lldb_private::operator>(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() > - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -bool lldb_private::operator>=(const TimeValue &lhs, const TimeValue &rhs) { - return lhs.GetAsNanoSecondsSinceJan1_1970() >= - rhs.GetAsNanoSecondsSinceJan1_1970(); -} - -uint64_t lldb_private::operator-(const Time
[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary
granata.enrico added a comment. Makes sense. Feel free to commit. Repository: rL LLVM https://reviews.llvm.org/D26403 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286387 - [RenderScript] Fix reduction argument printing
Author: ldrumm Date: Wed Nov 9 13:20:39 2016 New Revision: 286387 URL: http://llvm.org/viewvc/llvm-project?rev=286387&view=rev Log: [RenderScript] Fix reduction argument printing When placing function name breakpoints on RenderScript Reduction kernel functions, we were not skipping over the function prologue meaning that inspection of the arguments could be garbled as the function was not finished setting up the stack/registers. In [122fe8f](https://github.com/llvm-mirror/lldb/commit/122fe8f47255ec850155495d10526fccc51f95fb) Aidan added the `SkipPrologue` function that allows us to trivially fix up the kernel's functions' resolved addresses, falling gracefully back to the old behaviour if we don't know how to handle the prologue or can't resolve its size. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=286387&r1=286386&r2=286387&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Nov 9 13:20:39 2016 @@ -883,6 +883,10 @@ RSReduceBreakpointResolver::SearchCallba auto address = symbol->GetAddress(); if (filter.AddressPasses(address)) { bool new_bp; + if (!SkipPrologue(module, address)) { +if (log) + log->Printf("%s: Error trying to skip prologue", __FUNCTION__); + } m_breakpoint->AddLocation(address, &new_bp); if (log) log->Printf("%s: %s reduction breakpoint on %s in %s", __FUNCTION__, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
tfiala created this revision. tfiala added a reviewer: jingham. tfiala added a subscriber: lldb-commits. This change fixes an issue where I was leaking a weakly-linked symbol in the SBAPI. It also updates the docs to call out what I did wrong. https://reviews.llvm.org/D26470 Files: API/SBStructuredData.cpp SB-api-coding-rules.html lldb/API/SBStructuredData.h Index: SB-api-coding-rules.html === --- SB-api-coding-rules.html +++ SB-api-coding-rules.html @@ -48,7 +48,10 @@ make the SB object hold a shared or unique pointer to the Impl object. The theory behind this is that if you need more state in the SB object, those needs are likely to change over time, and this way the impl class can pick up members without changing the size of the object. -An example of this is the SBValue class. +An example of this is the SBValue class. Please note it is necessary for the Impl class to +not be a class embedded in the SB class, but rather should be a separate class that is not +present in the public lldb namespace. Failure to do so leads to leakage of weak-linked symbols +in the SBAPI. In order to fit into the Python API's, we need to be able to default construct all the SB objects. Since the ivars of the classes are all pointers of one sort or other, this can easily be done, but Index: API/SBStructuredData.cpp === --- API/SBStructuredData.cpp +++ API/SBStructuredData.cpp @@ -20,66 +20,62 @@ using namespace lldb_private; #pragma mark-- -#pragma mark Impl +#pragma mark StructuredDataImpl -class SBStructuredData::Impl { +class StructuredDataImpl { public: - Impl() : m_plugin_wp(), m_data_sp() {} + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} - Impl(const Impl &rhs) = default; + StructuredDataImpl(const StructuredDataImpl &rhs) = default; - Impl(const EventSP &event_sp) + StructuredDataImpl(const EventSP &event_sp) : m_plugin_wp( EventDataStructuredData::GetPluginFromEvent(event_sp.get())), m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { } - ~Impl() = default; + ~StructuredDataImpl() = default; - Impl &operator=(const Impl &rhs) = default; + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; bool IsValid() const { return m_data_sp.get() != nullptr; } void Clear() { m_plugin_wp.reset(); m_data_sp.reset(); } - SBError GetAsJSON(lldb::SBStream &stream) const { + SBError GetAsJSON(lldb_private::Stream &stream) const { SBError sb_error; if (!m_data_sp) { sb_error.SetErrorString("No structured data."); return sb_error; } -m_data_sp->Dump(stream.ref()); +m_data_sp->Dump(stream); return sb_error; } - lldb::SBError GetDescription(lldb::SBStream &stream) const { -SBError sb_error; + Error GetDescription(lldb_private::Stream &stream) const { +Error error; if (!m_data_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; } // Grab the plugin. auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); if (!plugin_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; } // Get the data's description. -auto error = plugin_sp->GetDescription(m_data_sp, stream.ref()); -if (!error.Success()) - sb_error.SetError(error); - -return sb_error; +return plugin_sp->GetDescription(m_data_sp, stream); } private: @@ -90,13 +86,13 @@ #pragma mark-- #pragma mark SBStructuredData -SBStructuredData::SBStructuredData() : m_impl_up(new Impl()) {} +SBStructuredData::SBStructuredData() : m_impl_up(new StructuredDataImpl()) {} SBStructuredData::SBStructuredData(const lldb::SBStructuredData &rhs) -: m_impl_up(new Impl(*rhs.m_impl_up.get())) {} +: m_impl_up(new StructuredDataImpl(*rhs.m_impl_up.get())) {} SBStructuredData::SBStructuredData(const lldb::EventSP &event_sp) -: m_impl_up(new Impl(event_sp)) {} +: m_impl_up(new Struc
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
jingham added a comment. This is fine with one comment on the text. Comment at: SB-api-coding-rules.html:51-54 +An example of this is the SBValue class. Please note it is necessary for the Impl class to +not be a class embedded in the SB class, but rather should be a separate class that is not +present in the public lldb namespace. Failure to do so leads to leakage of weak-linked symbols +in the SBAPI. I think it's more straightforward to say: Please note that you should not put this Impl class in the lldb namespace. Failure to do so... After all, it would be equally bad to have put it inside the "namespace lldb" but not in the class. https://reviews.llvm.org/D26470 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
tfiala added a comment. Making changes to the text... Comment at: SB-api-coding-rules.html:51-54 +An example of this is the SBValue class. Please note it is necessary for the Impl class to +not be a class embedded in the SB class, but rather should be a separate class that is not +present in the public lldb namespace. Failure to do so leads to leakage of weak-linked symbols +in the SBAPI. jingham wrote: > I think it's more straightforward to say: > > Please note that you should not put this Impl class in the lldb namespace. > Failure to do so... > > After all, it would be equally bad to have put it inside the "namespace lldb" > but not in the class. > Okay, I can use your verbiage. The end of one sentence did explicitly call out having it not be in the public lldb namespace: "...but rather should be a separate class that is not present in the public lldb namespace." but I think your prose is clearer, though. Thank you! https://reviews.llvm.org/D26470 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26478: Unify Darwin and Non-Darwin printing of version output
beanz created this revision. beanz added a reviewer: lldb-commits. beanz added a subscriber: tfiala. Herald added a subscriber: mgorny. This change unifies and simplifies the code paths between the Darwin and non-Darwin code to print the LLDB version information. It also introduces a new variable in CMake LLDB_VERSION_STRING which can be used to specify custom version information. With the LLDB_VERSION_STRING variable set to lldb-360.0.0, the -version output is: > ./bin/lldb -version lldb version 4.0.0 (lldb-360.0.0) clang revision 286264 llvm revision 286265 This behavior is unified across all target platforms. https://reviews.llvm.org/D26478 Files: lldb.xcodeproj/project.pbxproj source/CMakeLists.txt source/lldb.cpp Index: source/lldb.cpp === --- source/lldb.cpp +++ source/lldb.cpp @@ -12,10 +12,6 @@ using namespace lldb; using namespace lldb_private; -#if defined(__APPLE__) -extern "C" const unsigned char liblldb_coreVersionString[]; -#else - #include "clang/Basic/Version.h" #ifdef HAVE_SVN_VERSION_INC @@ -38,33 +34,8 @@ #endif } -#endif const char *lldb_private::GetVersion() { -#if defined(__APPLE__) - static char g_version_string[32]; - if (g_version_string[0] == '\0') { -const char *version_string = -::strstr((const char *)liblldb_coreVersionString, "PROJECT:"); - -if (version_string) - version_string += sizeof("PROJECT:") - 1; -else - version_string = "unknown"; - -const char *newline_loc = strchr(version_string, '\n'); - -size_t version_len = sizeof(g_version_string) - 1; - -if (newline_loc && -(newline_loc - version_string < static_cast(version_len))) - version_len = newline_loc - version_string; - -::snprintf(g_version_string, version_len + 1, "%s", version_string); - } - - return g_version_string; -#else // On platforms other than Darwin, report a version number in the same style // as the clang tool. static std::string g_version_str; @@ -81,21 +52,24 @@ 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 += LLDB_VERSION_STRING; +g_version_str += ")"; +#endif std::string clang_rev(clang::getClangRevision()); if (clang_rev.length() > 0) { - g_version_str += " clang revision "; + g_version_str += "\n clang revision "; g_version_str += clang_rev; } std::string llvm_rev(clang::getLLVMRevision()); if (llvm_rev.length() > 0) { - g_version_str += " llvm revision "; + g_version_str += "\n llvm revision "; g_version_str += llvm_rev; } - -if (lldb_repo) - g_version_str += ")"; + } return g_version_str.c_str(); -#endif } Index: source/CMakeLists.txt === --- source/CMakeLists.txt +++ source/CMakeLists.txt @@ -25,21 +25,6 @@ lldb.cpp ) -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) - add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} -COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl -${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core -> ${LLDB_VERS_GENERATED_FILE} -DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl -${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj) - set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) - # Add this to lldbBase since lldb.cpp uses the symbol defined here. - list(APPEND lldbBase_SOURCES ${LLDB_VERS_GENERATED_FILE}) - add_custom_target(lldbGeneratedVersion -DEPENDS ${LLDB_VERS_GENERATED_FILE}) -endif() - foreach(file "${LLDB_SOURCE_DIR}/.git/logs/HEAD" # Git "${LLDB_SOURCE_DIR}/.svn/wc.db" # SVN 1.7 @@ -75,14 +60,15 @@ list(APPEND lldbBase_SOURCES ${version_inc}) endif() +if(LLDB_VERSION_STRING) + set_source_files_properties(lldb.cpp +PROPERTIES COMPILE_DEFINITIONS "LLDB_VERSION_STRING=\"${LLDB_VERSION_STRING}\"") +endif() + add_lldb_library(lldbBase ${lldbBase_SOURCES} ) -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_dependencies(lldbBase lldbGeneratedVersion) -endif() - add_subdirectory(Breakpoint) add_subdirectory(Commands) add_subdirectory(Core) Index: lldb.xcodeproj/project.pbxproj === --- lldb.xcodeproj/project.pbxproj +++ lldb.xcodeproj/project.pbxproj @@ -8775,6 +8775,20 @@ "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", ); GCC_INLINES_ARE_PRIVATE_EXTERN = NO; +GCC_PREPROCESSOR_DEFINITIONS = ( + __STDC_CONSTANT_MACROS, + __STDC_LIMIT_MACROS, + LLDB_CONFIGURATION_DEBUG, + "LLDB_VERSION_STRING=\"lldb-${CURRENT_PROJECT_VERSION}\"", +); +"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphone
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
tfiala updated this revision to Diff 77405. tfiala added a comment. Adjusted web docs. https://reviews.llvm.org/D26470 Files: API/SBStructuredData.cpp SB-api-coding-rules.html lldb/API/SBStructuredData.h Index: SB-api-coding-rules.html === --- SB-api-coding-rules.html +++ SB-api-coding-rules.html @@ -36,7 +36,7 @@ You also need to choose the ivars for the class with care, since you can't add or remove ivars without breaking binary compatibility. In some cases, the SB class is a thin wrapper around -an interal lldb_private object. In that case, the class can have a single ivar, which is +an internal lldb_private object. In that case, the class can have a single ivar, which is either a pointer, shared_ptr or unique_ptr to the object in the lldb_private API. All the lldb_private classes that get used this way are declared as opaque classes in lldb_forward.h, which is included in SBDefines.h. So if you need an SB class to wrap an lldb_private class @@ -47,8 +47,9 @@ as a direct ivar in the SB Class. Instead, make an Impl class in the SB's .cpp file, and then make the SB object hold a shared or unique pointer to the Impl object. The theory behind this is that if you need more state in the SB object, those needs are likely to change over time, -and this way the impl class can pick up members without changing the size of the object. -An example of this is the SBValue class. +and this way the Impl class can pick up members without changing the size of the object. +An example of this is the SBValue class. Please note that you should not put this Impl class +in the lldb namespace. Failure to do so leads to leakage of weak-linked symbols in the SBAPI. In order to fit into the Python API's, we need to be able to default construct all the SB objects. Since the ivars of the classes are all pointers of one sort or other, this can easily be done, but Index: API/SBStructuredData.cpp === --- API/SBStructuredData.cpp +++ API/SBStructuredData.cpp @@ -20,66 +20,62 @@ using namespace lldb_private; #pragma mark-- -#pragma mark Impl +#pragma mark StructuredDataImpl -class SBStructuredData::Impl { +class StructuredDataImpl { public: - Impl() : m_plugin_wp(), m_data_sp() {} + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} - Impl(const Impl &rhs) = default; + StructuredDataImpl(const StructuredDataImpl &rhs) = default; - Impl(const EventSP &event_sp) + StructuredDataImpl(const EventSP &event_sp) : m_plugin_wp( EventDataStructuredData::GetPluginFromEvent(event_sp.get())), m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { } - ~Impl() = default; + ~StructuredDataImpl() = default; - Impl &operator=(const Impl &rhs) = default; + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; bool IsValid() const { return m_data_sp.get() != nullptr; } void Clear() { m_plugin_wp.reset(); m_data_sp.reset(); } - SBError GetAsJSON(lldb::SBStream &stream) const { + SBError GetAsJSON(lldb_private::Stream &stream) const { SBError sb_error; if (!m_data_sp) { sb_error.SetErrorString("No structured data."); return sb_error; } -m_data_sp->Dump(stream.ref()); +m_data_sp->Dump(stream); return sb_error; } - lldb::SBError GetDescription(lldb::SBStream &stream) const { -SBError sb_error; + Error GetDescription(lldb_private::Stream &stream) const { +Error error; if (!m_data_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; } // Grab the plugin. auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); if (!plugin_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " +
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
jingham accepted this revision. jingham added a comment. This revision is now accepted and ready to land. Looks good. https://reviews.llvm.org/D26470 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26478: Unify Darwin and Non-Darwin printing of version output
tfiala accepted this revision. tfiala added a reviewer: tfiala. tfiala added a comment. This revision is now accepted and ready to land. Looks good, @beanz! https://reviews.llvm.org/D26478 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
tfiala added a comment. Thanks, Jim! https://reviews.llvm.org/D26470 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r286413 - Fix weak symbol linkage in SBStructuredData, update docs.
Author: tfiala Date: Wed Nov 9 17:21:04 2016 New Revision: 286413 URL: http://llvm.org/viewvc/llvm-project?rev=286413&view=rev Log: Fix weak symbol linkage in SBStructuredData, update docs. Summary: This change fixes an issue where I was leaking a weakly-linked symbol in the SBAPI. It also updates the docs to call out what I did wrong. Fixes: rdar://28882483 Reviewers: jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26470 Modified: lldb/trunk/include/lldb/API/SBStructuredData.h lldb/trunk/source/API/SBStructuredData.cpp lldb/trunk/www/SB-api-coding-rules.html Modified: lldb/trunk/include/lldb/API/SBStructuredData.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=286413&r1=286412&r2=286413&view=diff == --- lldb/trunk/include/lldb/API/SBStructuredData.h (original) +++ lldb/trunk/include/lldb/API/SBStructuredData.h Wed Nov 9 17:21:04 2016 @@ -13,6 +13,8 @@ #include "lldb/API/SBDefines.h" #include "lldb/API/SBModule.h" +class StructuredDataImpl; + namespace lldb { class SBStructuredData { @@ -36,8 +38,7 @@ public: lldb::SBError GetDescription(lldb::SBStream &stream) const; private: - class Impl; - std::unique_ptr m_impl_up; + std::unique_ptr m_impl_up; }; } Modified: lldb/trunk/source/API/SBStructuredData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStructuredData.cpp?rev=286413&r1=286412&r2=286413&view=diff == --- lldb/trunk/source/API/SBStructuredData.cpp (original) +++ lldb/trunk/source/API/SBStructuredData.cpp Wed Nov 9 17:21:04 2016 @@ -20,23 +20,23 @@ using namespace lldb; using namespace lldb_private; #pragma mark-- -#pragma mark Impl +#pragma mark StructuredDataImpl -class SBStructuredData::Impl { +class StructuredDataImpl { public: - Impl() : m_plugin_wp(), m_data_sp() {} + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} - Impl(const Impl &rhs) = default; + StructuredDataImpl(const StructuredDataImpl &rhs) = default; - Impl(const EventSP &event_sp) + StructuredDataImpl(const EventSP &event_sp) : m_plugin_wp( EventDataStructuredData::GetPluginFromEvent(event_sp.get())), m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { } - ~Impl() = default; + ~StructuredDataImpl() = default; - Impl &operator=(const Impl &rhs) = default; + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; bool IsValid() const { return m_data_sp.get() != nullptr; } @@ -45,7 +45,7 @@ public: m_data_sp.reset(); } - SBError GetAsJSON(lldb::SBStream &stream) const { + SBError GetAsJSON(lldb_private::Stream &stream) const { SBError sb_error; if (!m_data_sp) { @@ -53,33 +53,29 @@ public: return sb_error; } -m_data_sp->Dump(stream.ref()); +m_data_sp->Dump(stream); return sb_error; } - lldb::SBError GetDescription(lldb::SBStream &stream) const { -SBError sb_error; + Error GetDescription(lldb_private::Stream &stream) const { +Error error; if (!m_data_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; } // Grab the plugin. auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); if (!plugin_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; } // Get the data's description. -auto error = plugin_sp->GetDescription(m_data_sp, stream.ref()); -if (!error.Success()) - sb_error.SetError(error); - -return sb_error; +return plugin_sp->GetDescription(m_data_sp, stream); } private: @@ -90,13 +86,13 @@ private: #pragma mark-- #pragma mark SBStructuredData -SBStructuredData::SBStructuredData() : m_impl_up(new Impl()) {} +SBStructuredData::SBStructuredData() : m_impl_up(new StructuredDataImpl()) {} SBStructuredData::SBStructuredData(const lldb::SBStructuredData &rhs) -: m_impl_up(new Impl(*rhs.m_impl_up.get())) {} +: m_impl_up(new StructuredDataImpl(*rhs.m_impl_up.get())) {} SBStructuredData::SBStructuredData(const lldb::EventSP &event_sp) -: m_impl_up(new Impl(event_sp)) {} +: m_impl_up(new StructuredDataImpl(event_sp)) {} SBStructuredData::~SBStructuredData() {} @@ -111,9 +107,12 @@ bool SBStructuredData::IsValid() const { void SBStructuredData::Clear() { m_impl_up->Clear(); } SBError SBStructuredData::G
[Lldb-commits] [PATCH] D26470: Fix weak symbol linkage in SBStructuredData, update docs.
This revision was automatically updated to reflect the committed changes. Closed by commit rL286413: Fix weak symbol linkage in SBStructuredData, update docs. (authored by tfiala). Changed prior to commit: https://reviews.llvm.org/D26470?vs=77405&id=77411#toc Repository: rL LLVM https://reviews.llvm.org/D26470 Files: lldb/trunk/include/lldb/API/SBStructuredData.h lldb/trunk/source/API/SBStructuredData.cpp lldb/trunk/www/SB-api-coding-rules.html Index: lldb/trunk/source/API/SBStructuredData.cpp === --- lldb/trunk/source/API/SBStructuredData.cpp +++ lldb/trunk/source/API/SBStructuredData.cpp @@ -20,66 +20,62 @@ using namespace lldb_private; #pragma mark-- -#pragma mark Impl +#pragma mark StructuredDataImpl -class SBStructuredData::Impl { +class StructuredDataImpl { public: - Impl() : m_plugin_wp(), m_data_sp() {} + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} - Impl(const Impl &rhs) = default; + StructuredDataImpl(const StructuredDataImpl &rhs) = default; - Impl(const EventSP &event_sp) + StructuredDataImpl(const EventSP &event_sp) : m_plugin_wp( EventDataStructuredData::GetPluginFromEvent(event_sp.get())), m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { } - ~Impl() = default; + ~StructuredDataImpl() = default; - Impl &operator=(const Impl &rhs) = default; + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; bool IsValid() const { return m_data_sp.get() != nullptr; } void Clear() { m_plugin_wp.reset(); m_data_sp.reset(); } - SBError GetAsJSON(lldb::SBStream &stream) const { + SBError GetAsJSON(lldb_private::Stream &stream) const { SBError sb_error; if (!m_data_sp) { sb_error.SetErrorString("No structured data."); return sb_error; } -m_data_sp->Dump(stream.ref()); +m_data_sp->Dump(stream); return sb_error; } - lldb::SBError GetDescription(lldb::SBStream &stream) const { -SBError sb_error; + Error GetDescription(lldb_private::Stream &stream) const { +Error error; if (!m_data_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; } // Grab the plugin. auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); if (!plugin_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; } // Get the data's description. -auto error = plugin_sp->GetDescription(m_data_sp, stream.ref()); -if (!error.Success()) - sb_error.SetError(error); - -return sb_error; +return plugin_sp->GetDescription(m_data_sp, stream); } private: @@ -90,13 +86,13 @@ #pragma mark-- #pragma mark SBStructuredData -SBStructuredData::SBStructuredData() : m_impl_up(new Impl()) {} +SBStructuredData::SBStructuredData() : m_impl_up(new StructuredDataImpl()) {} SBStructuredData::SBStructuredData(const lldb::SBStructuredData &rhs) -: m_impl_up(new Impl(*rhs.m_impl_up.get())) {} +: m_impl_up(new StructuredDataImpl(*rhs.m_impl_up.get())) {} SBStructuredData::SBStructuredData(const lldb::EventSP &event_sp) -: m_impl_up(new Impl(event_sp)) {} +: m_impl_up(new StructuredDataImpl(event_sp)) {} SBStructuredData::~SBStructuredData() {} @@ -111,9 +107,12 @@ void SBStructuredData::Clear() { m_impl_up->Clear(); } SBError SBStructuredData::GetAsJSON(lldb::SBStream &stream) const { - return m_impl_up->GetAsJSON(stream); + return m_impl_up->GetAsJSON(stream.ref()); } lldb::SBError SBStructuredData::GetDescription(lldb::SBStream &stream) const { - return m_impl_up->GetDescription(stream); + Error error = m_impl_up->GetDescription(stream.ref()); + SBError sb_error; + sb_error.SetError(error); + return sb_error; } Index: lldb/trunk/www/SB-api-coding-rules.html === --- lldb/trunk/www/SB-api-coding-rules.html +++ lldb/trunk/www/SB-api-coding-rules.html @@ -36,7 +36,7 @@ You also need to choose the ivars for the class with care, since you can't add or remove ivars without breaking binary compatibility. In some cases, the SB class is a thin wrapper around -an interal lldb_private object. In that case, the class can have a single ivar, which is +an internal lldb_private object. In that case, the class c