[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=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 _module_sp, uint32_t cu_idx, const FileSpec _spec, const ArchSpec , 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 ? _object : NULL, 0, - oso_object ? _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 "CommandObjectTarget.h" -// C
[Lldb-commits] [PATCH] D26275: Remove TimeValue usage from Core/Module
labath updated this revision to Diff 77209. labath added a comment. It turns out this was the only usage of TimeValue::Dump. I've changed that into a standalone function so it can be called without a TimeValue. Once Zachary lands the formatting change in llvm I'd like add a more generic time formatting function there, and remove this custom one. https://reviews.llvm.org/D26275 Files: include/lldb/Core/Module.h include/lldb/Host/TimeValue.h source/Commands/CommandObjectTarget.cpp source/Core/Module.cpp source/Host/common/TimeValue.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ 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: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ 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 _module_sp, uint32_t cu_idx, const FileSpec _spec, const ArchSpec , 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 ? _object : NULL, 0, - oso_object ? _unit_info->oso_mod_time : NULL)); + oso_object ? comp_unit_info->oso_mod_time + : llvm::sys::TimePoint<>())); } } if (comp_unit_info->oso_sp) Index: source/Host/common/TimeValue.cpp === --- source/Host/common/TimeValue.cpp +++ source/Host/common/TimeValue.cpp @@ -100,27 +100,6 @@ return *this; } -void TimeValue::Dump(Stream *s, uint32_t width) const { - if (s == NULL) -return; - -#ifndef LLDB_DISABLE_POSIX - char
[Lldb-commits] [PATCH] D26275: Remove TimeValue usage from Core/Module
clayborg added a comment. It would be great if we can match the old format somehow. It is definitely clearer. If we can't, don't worry about it too much as it isn't shown by default. Hopefully no one is text scraping. https://reviews.llvm.org/D26275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26275: Remove TimeValue usage from Core/Module
labath created this revision. labath added a reviewer: clayborg. labath added a subscriber: lldb-commits. 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. https://reviews.llvm.org/D26275 Files: include/lldb/Core/Module.h include/lldb/Host/TimeValue.h source/Commands/CommandObjectTarget.cpp source/Core/Module.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ 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: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ 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 _module_sp, uint32_t cu_idx, const FileSpec _spec, const ArchSpec , 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 ? _object : NULL, 0, - oso_object ? _unit_info->oso_mod_time : NULL)); + oso_object ? comp_unit_info->oso_mod_time + : llvm::sys::TimePoint<>())); } } if (comp_unit_info->oso_sp) Index: source/Core/Module.cpp === --- source/Core/Module.cpp +++ source/Core/Module.cpp @@ -229,10 +229,11 @@ Module::Module(const FileSpec _spec, const ArchSpec , const ConstString *object_name, lldb::offset_t object_offset, - const TimeValue