[Lldb-commits] [lldb] r285562 - Use the right dwarf attributes for parsing location list entries (fixup for r285441)
Author: labath Date: Mon Oct 31 06:53:13 2016 New Revision: 285562 URL: http://llvm.org/viewvc/llvm-project?rev=285562&view=rev Log: Use the right dwarf attributes for parsing location list entries (fixup for r285441) Note that the parsing code here is still incorrect wrt. the new draft of the dwarf 5 spec (seconds arguments to DW_LLE_startx_length should be uleb128, not u32). Once we have compilers actually emitting dwarf conformant with the new spec, we'll need to revisit this and figure out the proper behavior there. This should unbreak the linux bot. Modified: lldb/trunk/source/Expression/DWARFExpression.cpp Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=285562&r1=285561&r2=285562&view=diff == --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Mon Oct 31 06:53:13 2016 @@ -3031,14 +3031,14 @@ bool DWARFExpression::AddressRangeForLoc switch (debug_loc_data.GetU8(offset_ptr)) { case DW_LLE_end_of_list: return false; -case DW_LLE_start_end: { +case DW_LLE_startx_endx: { uint64_t index = debug_loc_data.GetULEB128(offset_ptr); low_pc = ReadAddressFromDebugAddrSection(dwarf_cu, index); index = debug_loc_data.GetULEB128(offset_ptr); high_pc = ReadAddressFromDebugAddrSection(dwarf_cu, index); return true; } -case DW_LLE_start_length: { +case DW_LLE_startx_length: { uint64_t index = debug_loc_data.GetULEB128(offset_ptr); low_pc = ReadAddressFromDebugAddrSection(dwarf_cu, index); uint32_t length = debug_loc_data.GetU32(offset_ptr); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26093: Limit LLDB_EXPORT_ALL_SYMBOLS to additionally export only the lldb_private namespace symbols
labath added a comment. The snippets you showed are pretty-much expected behavior. The backtrace that gets printed as a part of the log messages is coming from the backtrace(3) library, which has pretty limited backtracing capabilities -- it only looks at the symbols in the `.dynsym` section (because that's the only thing that is loaded into memory). I am pretty sure you would have problems backtracing if you compiled with -fomit-frame-pointer as well. I think you fix of just making sure that all symbols show up in the .dynsym section would be fine, were it not for that fact that we have an inconsistent linking policy, which means you get wildly different links depending on whether you export something or not. If we get that straight that this would just be a size optimization (that was the reason we introduced it), with no impact on the behavior, that we could even consider turning off by default (I personally have never used the -S option of logging, but I can see how it could be useful in some workflows). I'll get back to the link policy in a separate email. That said, you mentioned you also had some problems with setting breakpoints and stuff. Now, if this was true, that would be extremely worrying, but am not able to reproduce that on my side -- breakpoints everything else works fine. The reason for that is that lldb reads the .symtab section (if it is present, which it will be unless you strip the executable), and these linker options do not affect that section. If that is not the case, then we definitely need to figure that out (I suggest stepping through ObjectFileELF::GetSymtab() to get an initial idea of what is going on). FWIW, this is how a debug session looks like for me. The backtrace() output has addresses only, but lldb is able to symbolicate it with no problem: $ bin/lldb -- bin/lldb /bin/ls (lldb) target create "bin/lldb" Current executable set to 'bin/lldb' (x86_64). (lldb) settings set -- target.run-args "/bin/ls" (lldb) br set -n Log::VAPrintf Breakpoint 1: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. (lldb) pr la Process 87438 launched: '/usr/local/google/home/labath/ll/build/dbg/bin/lldb' (x86_64) 1 location added to breakpoint 1 Process 87438 stopped and restarted: thread 1 received signal: SIGCHLD (lldb) target create "/bin/ls" Current executable set to '/bin/ls' (x86_64). (lldb) log enable -S lldb process (lldb) pr la Process 87438 stopped * thread #1: tid = 87438, 0x70d1cfeb liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, format="ProcessLaunchInfo::%s at least one of stdin/stdout/stderr was not set, evaluating default handling", args=0x7fffc1a0) + 27 at Log.cpp:73, name = 'lldb', stop reason = breakpoint 1.1 frame #0: 0x70d1cfeb liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, format="ProcessLaunchInfo::%s at least one of stdin/stdout/stderr was not set, evaluating default handling", args=0x7fffc1a0) + 27 at Log.cpp:73 70 void Log::VAPrintf(const char *format, va_list args) { 71 // Make a copy of our stream shared pointer in case someone disables our 72 // log while we are logging and releases the stream -> 73 StreamSP stream_sp(m_stream_sp); 74 if (stream_sp) { 75 static uint32_t g_sequence_id = 0; 76 StreamString header; (lldb) c Process 87438 resuming ProcessLaunchInfo::FinalizeFileActions at least one of stdin/stdout/stderr was not set, evaluating default handling 0 liblldb.so.40 0x74d5a36f 1 liblldb.so.40 0x70d1d49f 2 liblldb.so.40 0x70d1cfbb 3 liblldb.so.40 0x70fff4c4 4 liblldb.so.40 0x7103ad63 5 liblldb.so.40 0x715c4f9f 6 liblldb.so.40 0x70e33fe0 7 liblldb.so.40 0x70e20317 8 liblldb.so.40 0x70e25c0d 9 liblldb.so.40 0x70e265a7 10 liblldb.so.40 0x70cf5a60 11 liblldb.so.40 0x70cb5c3c 12 liblldb.so.40 0x70e26fdf 13 liblldb.so.40 0x709d8d21 lldb::SBDebugger::RunCommandInterpreter(bool, bool) + 129 14 lldb 0x00407c15 15 lldb 0x00408257 16 libc.so.6 0x7fffeeeb8f45 __libc_start_main + 245 17 lldb 0x004038d9 Process 87438 stopped * thread #1: tid = 87438, 0x70d1cfeb liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, format="ProcessLaunchInfo::%s target stdin='%s', target stdout='%s', stderr='%s'", args=0x7fffc1a0) + 27 at Log.cpp:73, name = 'lldb', stop reason = breakpoint 1.1 frame #0: 0x70d1cfeb liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, format="ProcessLaunchInfo::%s target stdin='%s', target stdout='%s', stderr='%s'", args=0x7fffc1a0) + 27 at Log.cpp:73 70 void Log::VAPrin
[Lldb-commits] [PATCH] D26124: [LLDB-MI] Escape MI output in a more consistent manner
abidh accepted this revision. abidh added a comment. This revision is now accepted and ready to land. I have a quick look and it seems ok. Apart from fixing the issue, it is a useful clean up too. If testcases are ok then please free to commit. If you have noted that a function (AddSlashes?) is not longer needed after this then you may like to remove that too. Comment at: tools/lldb-mi/MICmnMIValueConst.cpp:48 +m_strValue = CMIUtilString::Format("\"%s\"", + m_strPartConst.Escape(true).c_str()); } else { So the Escape call here makes sure that we are escaping in all cases. Repository: rL LLVM https://reviews.llvm.org/D26124 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26093: Limit LLDB_EXPORT_ALL_SYMBOLS to additionally export only the lldb_private namespace symbols
tfiala added a comment. In https://reviews.llvm.org/D26093#583358, @labath wrote: > The snippets you showed are pretty-much expected behavior. The backtrace that > gets printed as a part of the log messages is coming from the backtrace(3) > library, which has pretty limited backtracing capabilities -- it only looks > at the symbols in the `.dynsym` section (because that's the only thing that > is loaded into memory). I am pretty sure you would have problems backtracing > if you compiled with -fomit-frame-pointer as well. > > I think you fix of just making sure that all symbols show up in the .dynsym > section would be fine, were it not for that fact that we have an inconsistent > linking policy, which means you get wildly different links depending on > whether you export something or not. If we get that straight that this would > just be a size optimization (that was the reason we introduced it), with no > impact on the behavior, that we could even consider turning off by default (I > personally have never used the -S option of logging, but I can see how it > could be useful in some workflows). I'll get back to the link policy in a > separate email. > > That said, you mentioned you also had some problems with setting breakpoints > and stuff. Now, if this was true, that would be extremely worrying, but am > not able to reproduce that on my side -- breakpoints everything else works > fine. The reason for that is that lldb reads the .symtab section (if it is > present, which it will be unless you strip the executable), and these linker > options do not affect that section. If that is not the case, then we > definitely need to figure that out (I suggest stepping through > ObjectFileELF::GetSymtab() to get an initial idea of what is going on). > > FWIW, this is how a debug session looks like for me. The backtrace() output > has addresses only, but lldb is able to symbolicate it with no problem: > > $ bin/lldb -- bin/lldb /bin/ls > (lldb) target create "bin/lldb" > Current executable set to 'bin/lldb' (x86_64). > (lldb) settings set -- target.run-args "/bin/ls" > (lldb) br set -n Log::VAPrintf > Breakpoint 1: no locations (pending). > WARNING: Unable to resolve breakpoint to any actual locations. > (lldb) pr la > Process 87438 launched: > '/usr/local/google/home/labath/ll/build/dbg/bin/lldb' (x86_64) > 1 location added to breakpoint 1 > Process 87438 stopped and restarted: thread 1 received signal: SIGCHLD > (lldb) target create "/bin/ls" > Current executable set to '/bin/ls' (x86_64). > (lldb) log enable -S lldb process > (lldb) pr la > Process 87438 stopped > * thread #1: tid = 87438, 0x70d1cfeb > liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, > format="ProcessLaunchInfo::%s at least one of stdin/stdout/stderr was not > set, evaluating default handling", args=0x7fffc1a0) + 27 at > Log.cpp:73, name = 'lldb', stop reason = breakpoint 1.1 > frame #0: 0x70d1cfeb > liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, > format="ProcessLaunchInfo::%s at least one of stdin/stdout/stderr was not > set, evaluating default handling", args=0x7fffc1a0) + 27 at Log.cpp:73 > 70 void Log::VAPrintf(const char *format, va_list args) { > 71 // Make a copy of our stream shared pointer in case someone > disables our > 72 // log while we are logging and releases the stream > -> 73 StreamSP stream_sp(m_stream_sp); > 74 if (stream_sp) { > 75 static uint32_t g_sequence_id = 0; > 76 StreamString header; > (lldb) c > Process 87438 resuming > ProcessLaunchInfo::FinalizeFileActions at least one of stdin/stdout/stderr > was not set, evaluating default handling > 0 liblldb.so.40 0x74d5a36f > 1 liblldb.so.40 0x70d1d49f > 2 liblldb.so.40 0x70d1cfbb > 3 liblldb.so.40 0x70fff4c4 > 4 liblldb.so.40 0x7103ad63 > 5 liblldb.so.40 0x715c4f9f > 6 liblldb.so.40 0x70e33fe0 > 7 liblldb.so.40 0x70e20317 > 8 liblldb.so.40 0x70e25c0d > 9 liblldb.so.40 0x70e265a7 > 10 liblldb.so.40 0x70cf5a60 > 11 liblldb.so.40 0x70cb5c3c > 12 liblldb.so.40 0x70e26fdf > 13 liblldb.so.40 0x709d8d21 > lldb::SBDebugger::RunCommandInterpreter(bool, bool) + 129 > 14 lldb 0x00407c15 > 15 lldb 0x00408257 > 16 libc.so.6 0x7fffeeeb8f45 __libc_start_main + 245 > 17 lldb 0x004038d9 > Process 87438 stopped > * thread #1: tid = 87438, 0x70d1cfeb > liblldb.so.40`lldb_private::Log::VAPrintf(this=0x0059a560, > format="ProcessLaunchInfo::%s target stdin='%s', target stdout='%s', > stderr='%s'", args=0x7fffc1a0) + 27 at Log.cpp:73, name = 'lldb', > stop reason = breakpoint 1.1 > frame #0: 0x70d1cfeb
[Lldb-commits] [lldb] r285584 - Minidump plugin: Adding x86_32 register context converter
Author: dvlahovski Date: Mon Oct 31 10:26:44 2016 New Revision: 285584 URL: http://llvm.org/viewvc/llvm-project?rev=285584&view=rev Log: Minidump plugin: Adding x86_32 register context converter Summary: This, like the x86_64 case, reads the register values from the minidump file, and emits a binary buffer that is ordered using the offsets from the RegisterInfoInterface argument. That way we can reuse an existing register context. Added unit tests. Reviewers: labath, zturner Subscribers: beanz, mgorny, modocache, amccarth, lldb-commits Differential Revision: https://reviews.llvm.org/D25832 Added: lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.h lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp Modified: lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h lldb/trunk/unittests/Process/minidump/CMakeLists.txt lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt?rev=285584&r1=285583&r2=285584&view=diff == --- lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt Mon Oct 31 10:26:44 2016 @@ -3,5 +3,6 @@ include_directories(../Utility) add_lldb_library(lldbPluginProcessMinidump MinidumpTypes.cpp MinidumpParser.cpp + RegisterContextMinidump_x86_32.cpp RegisterContextMinidump_x86_64.cpp ) Added: lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp?rev=285584&view=auto == --- lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp (added) +++ lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp Mon Oct 31 10:26:44 2016 @@ -0,0 +1,99 @@ +//===-- RegisterContextMinidump_x86_32.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +// Project includes +#include "RegisterContextMinidump_x86_32.h" + +// Other libraries and framework includes +#include "lldb/Core/DataBufferHeap.h" + +// C includes +// C++ includes + +using namespace lldb_private; +using namespace minidump; + +static void writeRegister(const void *reg_src, + llvm::MutableArrayRef reg_dest) { + memcpy(reg_dest.data(), reg_src, reg_dest.size()); +} + +lldb::DataBufferSP lldb_private::minidump::ConvertMinidumpContext_x86_32( +llvm::ArrayRef source_data, +RegisterInfoInterface *target_reg_interface) { + + const RegisterInfo *reg_info = target_reg_interface->GetRegisterInfo(); + + lldb::DataBufferSP result_context_buf( + new DataBufferHeap(target_reg_interface->GetGPRSize(), 0)); + uint8_t *result_base = result_context_buf->GetBytes(); + + if (source_data.size() < sizeof(MinidumpContext_x86_32)) +return nullptr; + + const MinidumpContext_x86_32 *context; + consumeObject(source_data, context); + + const MinidumpContext_x86_32_Flags context_flags = + static_cast( + static_cast(context->context_flags)); + auto x86_32_Flag = MinidumpContext_x86_32_Flags::x86_32_Flag; + auto ControlFlag = MinidumpContext_x86_32_Flags::Control; + auto IntegerFlag = MinidumpContext_x86_32_Flags::Integer; + auto SegmentsFlag = MinidumpContext_x86_32_Flags::Segments; + + if ((context_flags & x86_32_Flag) != x86_32_Flag) { +return nullptr; + } + + if ((context_flags & ControlFlag) == ControlFlag) { +writeRegister(&context->ebp, + reg_info[lldb_ebp_i386].mutable_data(result_base)); +writeRegister(&context->eip, + reg_info[lldb_eip_i386].mutable_data(result_base)); +writeRegister(&context->cs, + reg_info[lldb_cs_i386].mutable_data(result_base)); +writeRegister(&context->eflags, + reg_info[lldb_eflags_i386].mutable_data(result_base)); +writeRegister(&context->esp, + reg_info[lldb_esp_i386].mutable_data(result_base)); +writeRegister(&context->ss, + reg_info[lldb_ss_i386].mutable_data(result_base)); + } + + if ((context_flags & SegmentsFlag) == SegmentsFlag) { +writeRegister(&context->ds, + reg_info[lld
[Lldb-commits] [PATCH] D25832: Minidump plugin: Adding x86_32 register context converter
This revision was automatically updated to reflect the committed changes. Closed by commit rL285584: Minidump plugin: Adding x86_32 register context converter (authored by dvlahovski). Changed prior to commit: https://reviews.llvm.org/D25832?vs=75578&id=76414#toc Repository: rL LLVM https://reviews.llvm.org/D25832 Files: lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.h lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h lldb/trunk/unittests/Process/minidump/CMakeLists.txt lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Index: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp === --- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp +++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp @@ -8,9 +8,11 @@ //===--===// // Project includes +#include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" #include "Plugins/Process/minidump/MinidumpParser.h" #include "Plugins/Process/minidump/MinidumpTypes.h" +#include "Plugins/Process/minidump/RegisterContextMinidump_x86_32.h" #include "Plugins/Process/minidump/RegisterContextMinidump_x86_64.h" // Other libraries and framework includes @@ -61,7 +63,7 @@ std::unique_ptr parser; }; -TEST_F(MinidumpParserTest, GetThreads) { +TEST_F(MinidumpParserTest, GetThreadsAndGetThreadContext) { SetUpData("linux-x86_64.dmp"); llvm::ArrayRef thread_list; @@ -275,58 +277,97 @@ // Register stuff // TODO probably split register stuff tests into different file? -#define REG_VAL(x) *(reinterpret_cast(x)) +#define REG_VAL32(x) *(reinterpret_cast(x)) +#define REG_VAL64(x) *(reinterpret_cast(x)) -TEST_F(MinidumpParserTest, ConvertRegisterContext) { +TEST_F(MinidumpParserTest, ConvertMinidumpContext_x86_32) { + SetUpData("linux-i386.dmp"); + llvm::ArrayRef thread_list = parser->GetThreads(); + const MinidumpThread thread = thread_list[0]; + llvm::ArrayRef registers(parser->GetThreadContext(thread)); + + ArchSpec arch = parser->GetArchitecture(); + RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch); + lldb::DataBufferSP buf = + ConvertMinidumpContext_x86_32(registers, reg_interface); + ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize()); + + const RegisterInfo *reg_info = reg_interface->GetRegisterInfo(); + + std::map reg_values; + + reg_values[lldb_eax_i386] = 0x; + reg_values[lldb_ebx_i386] = 0xf7778000; + reg_values[lldb_ecx_i386] = 0x0001; + reg_values[lldb_edx_i386] = 0xff9dd4a3; + reg_values[lldb_edi_i386] = 0x080482a8; + reg_values[lldb_esi_i386] = 0xff9dd55c; + reg_values[lldb_ebp_i386] = 0xff9dd53c; + reg_values[lldb_esp_i386] = 0xff9dd52c; + reg_values[lldb_eip_i386] = 0x080482a0; + reg_values[lldb_eflags_i386] = 0x00010282; + reg_values[lldb_cs_i386] = 0x0023; + reg_values[lldb_fs_i386] = 0x; + reg_values[lldb_gs_i386] = 0x0063; + reg_values[lldb_ss_i386] = 0x002b; + reg_values[lldb_ds_i386] = 0x002b; + reg_values[lldb_es_i386] = 0x002b; + + for (uint32_t reg_index = 0; reg_index < reg_interface->GetRegisterCount(); + ++reg_index) { +if (reg_values.find(reg_index) != reg_values.end()) { + EXPECT_EQ(reg_values[reg_index], +REG_VAL32(buf->GetBytes() + reg_info[reg_index].byte_offset)); +} + } +} + +TEST_F(MinidumpParserTest, ConvertMinidumpContext_x86_64) { SetUpData("linux-x86_64.dmp"); llvm::ArrayRef thread_list = parser->GetThreads(); const MinidumpThread thread = thread_list[0]; - llvm::ArrayRef registers(parser->GetData().data() + -thread.thread_context.rva, -thread.thread_context.data_size); + llvm::ArrayRef registers(parser->GetThreadContext(thread)); ArchSpec arch = parser->GetArchitecture(); RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch); lldb::DataBufferSP buf = - ConvertMinidumpContextToRegIface(registers, reg_interface); + ConvertMinidumpContext_x86_64(registers, reg_interface); ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize()); const RegisterInfo *reg_info = reg_interface->GetRegisterInfo(); std::map reg_values; - // clang-format off - reg_values[lldb_rax_x86_64]= 0x; - reg_values[lldb_rbx_x86_64]= 0x; - reg_values[lldb_rcx_x86_64]= 0x0010; - reg_values[lldb_rdx_x86_64]= 0x; -
[Lldb-commits] [lldb] r285587 - Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull
Author: dvlahovski Date: Mon Oct 31 10:35:18 2016 New Revision: 285587 URL: http://llvm.org/viewvc/llvm-project?rev=285587&view=rev Log: Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull Summary: This plugin resembles the already existing Windows-only Minidump plugin. The WinMinidumpPlugin uses the Windows API for parsing Minidumps while this plugin is cross-platform because it includes a Minidump parser (which is already commited) It is able to produce a backtrace, to read the general puprose regiters, inspect local variables, show image list, do memory reads, etc. For now the only arches that this supports are x86_32 and x86_64. This is because I have only written register contexts for those. Others will come in next CLs. I copied the WinMinidump tests and adapted them a little bit for them to work with the new plugin (and they pass) I will add more tests, aiming for better code coverage. There is still functionality to be added, see TODOs in code. Reviewers: labath, zturner Subscribers: beanz, mgorny, modocache, lldb-commits, amccarth Differential Revision: https://reviews.llvm.org/D25905 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 (with props) lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed (with props) lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt lldb/trunk/source/Plugins/Process/minidump/NtStructures.h lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.cpp lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.h Modified: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=285587&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Mon Oct 31 10:35:18 2016 @@ -0,0 +1,100 @@ +""" +Test basics of Minidump debugging. +""" + +from __future__ import print_function +from six import iteritems + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class MiniDumpNewTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +NO_DEBUG_INFO_TESTCASE = True + +def test_process_info_in_minidump(self): +"""Test that lldb can read the process information from the Minidump.""" +# target create -c linux-x86_64.dmp +self.dbg.CreateTarget(None) +self.target = self.dbg.GetSelectedTarget() +self.process = self.target.LoadCore("linux-x86_64.dmp") +self.assertTrue(self.process, PROCESS_IS_VALID) +self.assertEqual(self.process.GetNumThreads(), 1) +self.assertEqual(self.process.GetProcessID(), 29917) + +def test_thread_info_in_minidump(self): +"""Test that lldb can read the thread information from the Minidump.""" +# target create -c linux-x86_64.dmp +self.dbg.CreateTarget(None) +self.target = self.dbg.GetSelectedTarget() +self.process = self.target.LoadCore("linux-x86_64.dmp") +# This process crashed due to a segmentation fault in its +# one and only thread. +self.assertEqual(self.process.GetNumThreads(), 1) +thread = self.process.GetThreadAtIndex(0) +self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal) +
[Lldb-commits] [PATCH] D25905: Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull
This revision was automatically updated to reflect the committed changes. Closed by commit rL285587: Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin… (authored by dvlahovski). Changed prior to commit: https://reviews.llvm.org/D25905?vs=76176&id=76416#toc Repository: rL LLVM https://reviews.llvm.org/D25905 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h lldb/trunk/source/Plugins/Process/minidump/NtStructures.h lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.cpp lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.h lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Index: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp === --- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp +++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp @@ -134,7 +134,7 @@ llvm::Optional name = parser->GetMinidumpString(modules[i].module_name_rva); ASSERT_TRUE(name.hasValue()); -ASSERT_EQ(module_names[i], name.getValue()); +EXPECT_EQ(module_names[i], name.getValue()); } } @@ -275,8 +275,46 @@ ASSERT_EQ(4440UL, pid.getValue()); } -// Register stuff -// TODO probably split register stuff tests into different file? +// wow64 +TEST_F(MinidumpParserTest, GetPidWow64) { + SetUpData("fizzbuzz_wow64.dmp"); + llvm::Optional pid = parser->GetPid(); + ASSERT_TRUE(pid.hasValue()); + ASSERT_EQ(7836UL, pid.getValue()); +} + +TEST_F(MinidumpParserTest, GetModuleListWow64) { + SetUpData("fizzbuzz_wow64.dmp"); + llvm::ArrayRef modules = parser->GetModuleList(); + ASSERT_EQ(16UL, modules.size()); + std::string module_names[16] = { + R"(D:\src\llvm\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\postmortem\wow64_minidump\fizzbuzz.exe)", + R"(C:\Windows\System32\ntdll.dll)", + R"(C:\Windows\System32\wow64.dll)", + R"(C:\Windows\System32\wow64win.dll)", + R"(C:\Windows\System32\wow64cpu.dll)", + R"(D:\src\llvm\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\postmortem\wow64_minidump\fizzbuzz.exe)", + R"(C:\Windows\SysWOW64\ntdll.dll)", + R"(C:\Windows\SysWOW64\kernel32.dll)", + R"(C:\Windows\SysWOW64\KERNELBASE.dll)", + R"(C:\Windows\SysWOW64\advapi32.dll)", + R"(C:\Windows\SysWOW64\msvcrt.dll)", + R"(C:\Windows\SysWOW64\sechost.dll)", + R"(C:\Windows\SysWOW64\rpcrt4.dll)", + R"(C:\Windows\SysWOW64\sspicli.dll)", + R"(C:\Windows\SysWOW64\CRYPTBASE.dll)", + R"(C:\Windows\System32\api-ms-win-core-synch-l1-2-0.DLL)", + }; + + for (int i = 0; i < 16; ++i) { +llvm::Optional name = +parser->GetMinidumpString(modules[i].module_name_rva); +ASSERT_TRUE(name.hasValue()); +EXPECT_EQ(module_names[i], name.getValue()); + } +} + +// Register tests #define REG_VAL32(x) *(reinterpret_cast(x)) #define REG_VAL64(x) *(reinterpret_cast(x)) @@ -371,3 +409,45 @@ } } } + +TEST_F(MinidumpParserTest, ConvertMinidumpContext_x86_32_wow64) { + SetUpData("fizzbuzz_wow64.dmp"); + llvm::ArrayRef thread_list = parser->GetThreads(); + const MinidumpThread thread = thread_list[0]; + llvm::ArrayRef registers(parser->GetThreadContextWow64(thread)); + + ArchSpec arch = parser->GetArchitecture(); + RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch); + lldb::DataBufferSP buf = + ConvertMinidumpContext_x86_32(registers, reg_interface); + ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize()); + + const RegisterInfo *reg_info = reg_interface->GetRegisterInfo(); + + std::map reg_values
[Lldb-commits] [PATCH] D26081: Improve ".." handling in FileSpec normalization
labath updated this revision to Diff 76426. labath added a comment. Fix handling of single dots and add tests for that. https://reviews.llvm.org/D26081 Files: include/lldb/Host/FileSpec.h source/Host/common/FileSpec.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp unittests/Host/FileSpecTest.cpp Index: unittests/Host/FileSpecTest.cpp === --- unittests/Host/FileSpecTest.cpp +++ unittests/Host/FileSpecTest.cpp @@ -131,7 +131,6 @@ Compare(forward, backward, !full_match, !remove_backup_dots, match); } -#if 0 TEST(FileSpecTest, EqualDotsWindows) { const bool full_match = true; const bool remove_backup_dots = true; @@ -142,6 +141,7 @@ {R"(C:\bar\baz)", R"(C:/foo/../bar/baz)"}, {R"(C:/bar/baz)", R"(C:\foo\..\bar\baz)"}, {R"(C:\bar)", R"(C:\foo\..\bar)"}, + {R"(C:\bar)", R"(C:\foo\.\bar)"}, }; for(const auto &test: tests) { @@ -151,20 +151,20 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#endif TEST(FileSpecTest, EqualDotsPosix) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { {R"(/foo/bar/baz)", R"(/foo/foo/../bar/baz)"}, {R"(/bar/baz)", R"(/foo/../bar/baz)"}, -// {R"(/bar)", R"(/foo/../bar)"}, + {R"(/bar)", R"(/foo/../bar)"}, + {R"(/foo/bar)", R"(/foo/./bar)"}, }; for(const auto &test: tests) { @@ -174,27 +174,84 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -//Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#if 0 TEST(FileSpecTest, EqualDotsPosixRoot) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { - {R"(/)", R"(/..)"}, - {R"(/)", R"(/foo/..)"}, + {R"(/)", R"(/..)"}, {R"(/)", R"(/.)"}, {R"(/)", R"(/foo/..)"}, }; for(const auto &test: tests) { FileSpec one(test.first, false, FileSpec::ePathSyntaxPosix); FileSpec two(test.second, false, FileSpec::ePathSyntaxPosix); EXPECT_NE(one, two); Compare(one, two, full_match, remove_backup_dots, match); -Compare(one, two, !full_match, remove_backup_dots, match); +Compare(one, two, full_match, !remove_backup_dots, !match); +Compare(one, two, !full_match, remove_backup_dots, !match); +Compare(one, two, !full_match, !remove_backup_dots, !match); + } +} + +TEST(FileSpecTest, GetNormalizedPath) { + std::pair posix_tests[] = { + {"/foo/../bar", "/bar"}, + {"/foo/./bar", "/foo/bar"}, + {"/foo/..", "/"}, + {"/foo/.", "/foo"}, + {"/./foo", "/foo"}, + {"/", "/"}, + {"//", "//"}, + {"//net", "//net"}, + {"/..", "/"}, + {"/.", "/"}, + {"..", ".."}, + {".", "."}, + {"../..", "../.."}, + {"foo/..", "."}, + {"foo/../bar", "bar"}, + {"../foo/..", ".."}, + {"./foo", "foo"}, + }; + for (auto test : posix_tests) { +EXPECT_EQ(test.second, + FileSpec(test.first, false, FileSpec::ePathSyntaxPosix) + .GetNormalizedPath() + .GetPath()); + } + + std::pair windows_tests[] = { + {R"(c:\bar\..\bar)", R"(c:\bar)"}, + {R"(c:\bar\.\bar)", R"(c:\bar\bar)"}, + {R"(c:\bar\..)", R"(c:\)"}, + {R"(c:\bar\.)", R"(c:\bar)"}, + {R"(c:\.\bar)", R"(c:\bar)"}, + {R"(\)", R"(\)"}, + // {R"(\\)", R"(\\)"}, + // {R"(\\net)", R"(\\net)"}, + {R"(c:\..)", R"(c:\)"}, + {R"(c:\.)", R"(c:\)"}, + {R"(\..)", R"(\)"}, + // {R"(c:..)", R"(c:..)"}, + {R"(..)", R"(..)"}, + {R"(.)", R"(.)"}, + {R"(c:..\..)", R"(c:..\..)"}, + {R"(..\..)", R"(..\..)"}, + {R"(foo\..)", R"(.)"}, + {R"(foo\..\bar)", R"(bar)"}, + {R"(..\foo\..)", R"(..)"}, + {R"(.\foo)", R"(foo)"}, + }; + for (auto test : windows_tests) { +EXPECT_EQ(test.second, + FileSpec(test.first, false, FileSpec::ePathSyntaxWindows) + .GetNormalizedPath() + .GetPath()) +<< "Original path: " << test.first; } } -#endif Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp === --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -5095,7 +5095,7 @@ FileSpec file_spec(path, true); // Remove any redundant part
[Lldb-commits] [PATCH] D26081: Improve ".." handling in FileSpec normalization
labath added inline comments. Comment at: source/Host/common/FileSpec.cpp:550 + (m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != ".")) +return *this; amccarth wrote: > Do we have to worry about an unnecessary single dot in the directory, like > `/foo/./bar/`? Are those handled when the FileSpec is constructed? Good catch. The fast path was too optimistic. I've replaced it with a much more conservative one. It can be beefed up, if we find that this is actually a performance problem. Comment at: unittests/Host/FileSpecTest.cpp:144 {R"(C:\bar)", R"(C:\foo\..\bar)"}, }; amccarth wrote: > How about a test to make sure `C:/foo/./bar` is the same as `C:/foo/bar`? I added a bunch more tests with single dots in various places. If you see more interesting corner cases, let me know. https://reviews.llvm.org/D26081 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26081: Improve ".." handling in FileSpec normalization
labath updated this revision to Diff 76428. labath added a comment. Fix typo in the test https://reviews.llvm.org/D26081 Files: include/lldb/Host/FileSpec.h source/Host/common/FileSpec.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp unittests/Host/FileSpecTest.cpp Index: unittests/Host/FileSpecTest.cpp === --- unittests/Host/FileSpecTest.cpp +++ unittests/Host/FileSpecTest.cpp @@ -131,7 +131,6 @@ Compare(forward, backward, !full_match, !remove_backup_dots, match); } -#if 0 TEST(FileSpecTest, EqualDotsWindows) { const bool full_match = true; const bool remove_backup_dots = true; @@ -142,6 +141,7 @@ {R"(C:\bar\baz)", R"(C:/foo/../bar/baz)"}, {R"(C:/bar/baz)", R"(C:\foo\..\bar\baz)"}, {R"(C:\bar)", R"(C:\foo\..\bar)"}, + {R"(C:\foo\bar)", R"(C:\foo\.\bar)"}, }; for(const auto &test: tests) { @@ -151,20 +151,20 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#endif TEST(FileSpecTest, EqualDotsPosix) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { {R"(/foo/bar/baz)", R"(/foo/foo/../bar/baz)"}, {R"(/bar/baz)", R"(/foo/../bar/baz)"}, -// {R"(/bar)", R"(/foo/../bar)"}, + {R"(/bar)", R"(/foo/../bar)"}, + {R"(/foo/bar)", R"(/foo/./bar)"}, }; for(const auto &test: tests) { @@ -174,27 +174,84 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -//Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#if 0 TEST(FileSpecTest, EqualDotsPosixRoot) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { - {R"(/)", R"(/..)"}, - {R"(/)", R"(/foo/..)"}, + {R"(/)", R"(/..)"}, {R"(/)", R"(/.)"}, {R"(/)", R"(/foo/..)"}, }; for(const auto &test: tests) { FileSpec one(test.first, false, FileSpec::ePathSyntaxPosix); FileSpec two(test.second, false, FileSpec::ePathSyntaxPosix); EXPECT_NE(one, two); Compare(one, two, full_match, remove_backup_dots, match); -Compare(one, two, !full_match, remove_backup_dots, match); +Compare(one, two, full_match, !remove_backup_dots, !match); +Compare(one, two, !full_match, remove_backup_dots, !match); +Compare(one, two, !full_match, !remove_backup_dots, !match); + } +} + +TEST(FileSpecTest, GetNormalizedPath) { + std::pair posix_tests[] = { + {"/foo/../bar", "/bar"}, + {"/foo/./bar", "/foo/bar"}, + {"/foo/..", "/"}, + {"/foo/.", "/foo"}, + {"/./foo", "/foo"}, + {"/", "/"}, + {"//", "//"}, + {"//net", "//net"}, + {"/..", "/"}, + {"/.", "/"}, + {"..", ".."}, + {".", "."}, + {"../..", "../.."}, + {"foo/..", "."}, + {"foo/../bar", "bar"}, + {"../foo/..", ".."}, + {"./foo", "foo"}, + }; + for (auto test : posix_tests) { +EXPECT_EQ(test.second, + FileSpec(test.first, false, FileSpec::ePathSyntaxPosix) + .GetNormalizedPath() + .GetPath()); + } + + std::pair windows_tests[] = { + {R"(c:\bar\..\bar)", R"(c:\bar)"}, + {R"(c:\bar\.\bar)", R"(c:\bar\bar)"}, + {R"(c:\bar\..)", R"(c:\)"}, + {R"(c:\bar\.)", R"(c:\bar)"}, + {R"(c:\.\bar)", R"(c:\bar)"}, + {R"(\)", R"(\)"}, + // {R"(\\)", R"(\\)"}, + // {R"(\\net)", R"(\\net)"}, + {R"(c:\..)", R"(c:\)"}, + {R"(c:\.)", R"(c:\)"}, + {R"(\..)", R"(\)"}, + // {R"(c:..)", R"(c:..)"}, + {R"(..)", R"(..)"}, + {R"(.)", R"(.)"}, + {R"(c:..\..)", R"(c:..\..)"}, + {R"(..\..)", R"(..\..)"}, + {R"(foo\..)", R"(.)"}, + {R"(foo\..\bar)", R"(bar)"}, + {R"(..\foo\..)", R"(..)"}, + {R"(.\foo)", R"(foo)"}, + }; + for (auto test : windows_tests) { +EXPECT_EQ(test.second, + FileSpec(test.first, false, FileSpec::ePathSyntaxWindows) + .GetNormalizedPath() + .GetPath()) +<< "Original path: " << test.first; } } -#endif Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp === --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -5095,7 +5095,7 @@ FileSpec file_spec(path, true); // Remove any redundant parts of the path (like "../foo
[Lldb-commits] [lldb] r285593 - Improve ".." handling in FileSpec normalization
Author: labath Date: Mon Oct 31 11:22:07 2016 New Revision: 285593 URL: http://llvm.org/viewvc/llvm-project?rev=285593&view=rev Log: Improve ".." handling in FileSpec normalization Summary: .. handling for windows path was completely broken because the function was expecting \ as path separators, but we were passing it normalized file paths, where these have been replaced by forward slashes. Apart from this, the function was incorrect for posix paths as well in some corner cases, as well as being generally hard to follow. The corner cases were: - /../bar -> should be same as /bar - /bar/.. -> should be same as / (slightly dodgy as the former depends on /bar actually existing, but since we're doing it in an abstract way, I think the transformation is reasonable) I rewrite the function to fix these corner cases and handle windows paths more correctly. The function should now handle the posix paths (modulo symlinks, but we cannot really do anything about that without a real filesystem). For windows paths, there are a couple of corner cases left, mostly to do with drive letter handling, which cannot be fixed until the rest of the class understands drive letters better. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26081 Modified: lldb/trunk/include/lldb/Host/FileSpec.h lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/unittests/Host/FileSpecTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=285593&r1=285592&r2=285593&view=diff == --- lldb/trunk/include/lldb/Host/FileSpec.h (original) +++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Oct 31 11:22:07 2016 @@ -620,22 +620,7 @@ public: /// Normalize a pathname by collapsing redundant separators and /// up-level references. //-- - void NormalizePath(); - - //-- - /// Run through the input string, replaying the effect of any ".." and produce - /// the resultant path. The input path is not required to be in the host file - /// system - /// format, but it is required to be normalized to that system. - /// - /// @param[in] input - /// The input path to analyze. - /// - /// @param[out] result - /// The backup-resolved path will be written here. - //-- - static void RemoveBackupDots(const ConstString &input_const_str, - ConstString &result_const_str); + FileSpec GetNormalizedPath() const; //-- /// Change the file specified with a new path. Modified: lldb/trunk/source/Host/common/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=285593&r1=285592&r2=285593&view=diff == --- lldb/trunk/source/Host/common/FileSpec.cpp (original) +++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Oct 31 11:22:07 2016 @@ -533,120 +533,73 @@ bool FileSpec::Equal(const FileSpec &a, if (!full && (a.GetDirectory().IsEmpty() || b.GetDirectory().IsEmpty())) return ConstString::Equals(a.m_filename, b.m_filename, case_sensitive); - else if (remove_backups == false) + + if (remove_backups == false) return a == b; - else { -if (!ConstString::Equals(a.m_filename, b.m_filename, case_sensitive)) - return false; -if (ConstString::Equals(a.m_directory, b.m_directory, case_sensitive)) - return true; -ConstString a_without_dots; -ConstString b_without_dots; - -RemoveBackupDots(a.m_directory, a_without_dots); -RemoveBackupDots(b.m_directory, b_without_dots); -return ConstString::Equals(a_without_dots, b_without_dots, case_sensitive); - } -} -void FileSpec::NormalizePath() { - ConstString normalized_directory; - FileSpec::RemoveBackupDots(m_directory, normalized_directory); - m_directory = normalized_directory; -} + if (a == b) +return true; -void FileSpec::RemoveBackupDots(const ConstString &input_const_str, -ConstString &result_const_str) { - const char *input = input_const_str.GetCString(); - result_const_str.Clear(); - if (!input || input[0] == '\0') -return; - - const char win_sep = '\\'; - const char unix_sep = '/'; - char found_sep; - const char *win_backup = "\\.."; - const char *unix_backup = "/.."; - - bool is_win = false; - - // Determine the platform for the path (win or unix): - - if (input[0] == win_sep) -is_win = true; - else if (input[0] == unix_sep) -is_win = false; - else if (input[1] == ':') -is_win
[Lldb-commits] [PATCH] D26081: Improve ".." handling in FileSpec normalization
This revision was automatically updated to reflect the committed changes. Closed by commit rL285593: Improve ".." handling in FileSpec normalization (authored by labath). Changed prior to commit: https://reviews.llvm.org/D26081?vs=76428&id=76432#toc Repository: rL LLVM https://reviews.llvm.org/D26081 Files: lldb/trunk/include/lldb/Host/FileSpec.h lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/unittests/Host/FileSpecTest.cpp Index: lldb/trunk/include/lldb/Host/FileSpec.h === --- lldb/trunk/include/lldb/Host/FileSpec.h +++ lldb/trunk/include/lldb/Host/FileSpec.h @@ -620,22 +620,7 @@ /// Normalize a pathname by collapsing redundant separators and /// up-level references. //-- - void NormalizePath(); - - //-- - /// Run through the input string, replaying the effect of any ".." and produce - /// the resultant path. The input path is not required to be in the host file - /// system - /// format, but it is required to be normalized to that system. - /// - /// @param[in] input - /// The input path to analyze. - /// - /// @param[out] result - /// The backup-resolved path will be written here. - //-- - static void RemoveBackupDots(const ConstString &input_const_str, - ConstString &result_const_str); + FileSpec GetNormalizedPath() const; //-- /// Change the file specified with a new path. Index: lldb/trunk/unittests/Host/FileSpecTest.cpp === --- lldb/trunk/unittests/Host/FileSpecTest.cpp +++ lldb/trunk/unittests/Host/FileSpecTest.cpp @@ -131,7 +131,6 @@ Compare(forward, backward, !full_match, !remove_backup_dots, match); } -#if 0 TEST(FileSpecTest, EqualDotsWindows) { const bool full_match = true; const bool remove_backup_dots = true; @@ -142,6 +141,7 @@ {R"(C:\bar\baz)", R"(C:/foo/../bar/baz)"}, {R"(C:/bar/baz)", R"(C:\foo\..\bar\baz)"}, {R"(C:\bar)", R"(C:\foo\..\bar)"}, + {R"(C:\foo\bar)", R"(C:\foo\.\bar)"}, }; for(const auto &test: tests) { @@ -151,20 +151,20 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#endif TEST(FileSpecTest, EqualDotsPosix) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { {R"(/foo/bar/baz)", R"(/foo/foo/../bar/baz)"}, {R"(/bar/baz)", R"(/foo/../bar/baz)"}, -// {R"(/bar)", R"(/foo/../bar)"}, + {R"(/bar)", R"(/foo/../bar)"}, + {R"(/foo/bar)", R"(/foo/./bar)"}, }; for(const auto &test: tests) { @@ -174,27 +174,84 @@ Compare(one, two, full_match, remove_backup_dots, match); Compare(one, two, full_match, !remove_backup_dots, !match); Compare(one, two, !full_match, remove_backup_dots, match); -//Compare(one, two, !full_match, !remove_backup_dots, match); +Compare(one, two, !full_match, !remove_backup_dots, !match); } } -#if 0 TEST(FileSpecTest, EqualDotsPosixRoot) { const bool full_match = true; const bool remove_backup_dots = true; const bool match = true; std::pair tests[] = { - {R"(/)", R"(/..)"}, - {R"(/)", R"(/foo/..)"}, + {R"(/)", R"(/..)"}, {R"(/)", R"(/.)"}, {R"(/)", R"(/foo/..)"}, }; for(const auto &test: tests) { FileSpec one(test.first, false, FileSpec::ePathSyntaxPosix); FileSpec two(test.second, false, FileSpec::ePathSyntaxPosix); EXPECT_NE(one, two); Compare(one, two, full_match, remove_backup_dots, match); -Compare(one, two, !full_match, remove_backup_dots, match); +Compare(one, two, full_match, !remove_backup_dots, !match); +Compare(one, two, !full_match, remove_backup_dots, !match); +Compare(one, two, !full_match, !remove_backup_dots, !match); + } +} + +TEST(FileSpecTest, GetNormalizedPath) { + std::pair posix_tests[] = { + {"/foo/../bar", "/bar"}, + {"/foo/./bar", "/foo/bar"}, + {"/foo/..", "/"}, + {"/foo/.", "/foo"}, + {"/./foo", "/foo"}, + {"/", "/"}, + {"//", "//"}, + {"//net", "//net"}, + {"/..", "/"}, + {"/.", "/"}, + {"..", ".."}, + {".", "."}, + {"../..", "../.."}, + {"foo/..", "."}, + {"foo/../bar", "bar"}, + {"../foo/..", ".."}, + {"./foo", "foo"}, + }; + for (auto test : posix_tests) { +EXPECT_
[Lldb-commits] [PATCH] D25864: Fix arm64 floating point register spill recording in UnwindPlan analysis
tberghammer accepted this revision. tberghammer added a comment. This revision is now accepted and ready to land. The patch generally looks good to me. I added a few high level thought about register context but they are clearly out of scope for this change. Also next time please upload your patch with full context as it is much easier to review that way. In https://reviews.llvm.org/D25864#578173, @jasonmolenda wrote: > Hi Tamas, sorry for not replying earlier, something urgent came up that I > needed to look at. > > Thanks for the review. I agree with using your existing arm64 register enums > in lldb-arm64-register-enums.h. I'd like to remove the enums in > RegisterInfos_arm64.h instead of having two copies that could diverge. > > You asked about having EmulateInstructionARM64 handle both eRegisterKindDWARF > and eRegisterKindLLDB. I'm not sure how that would work - each UnwindPlan > must can use only one register numbering scheme. We could use > eRegisterKindDWARF if there were no floating point register save/restores - > but that seems a bit complicated; we'd conditionally use eRegisterKindLLDB > sometimes, eRegisterKindDWARF most of the time. My idea is based on the fact that every register access goes through the GetRegisterInfo function what gets a "register kind" and a "register number" so if we can teach that function to be able to fetch the correct register info both for eRegisterKindLLDB and for eRegisterKindDWARF then the actual emulate functions can use both. It would mean something like the following, but I don't know what should we put in place of the "...": if (reg_kind == eRegisterKindLLDB) return LLDBTableGetRegisterInfo(reg_num, reg_info); if (reg_kind == eRegisterKindDwarf) return ... > As for the GetRegisterName() function in ARM64_LLDB_Registers.cpp, we could > have EmulateInstructionARM64 with the register file definition (we need to > define seven preprocessor symbols before we can include RegisterInfos_arm64.h > and then we'll need to write a GetRegisterName() method in > EmulateInstructionARM64.cpp. Wouldn't it be clearer to have a > lldb-arm64-register-enums.cpp with this method? RegisterInfos_arm64.h already contains a register name and an alternative name so I would prefer to use them as they are already specified but I have no problem with having a GetRegisterName() function if we can have a single copy of it. My main problem with your previous approach was that you are adding a second copy of it (current one is in ARM64_DWARF_Registers.cpp) Regarding including RegisterInfos_arm64.h I am not too keen on the approach of having a large table and defining a set of macros as it is very verbose and limits the flexibility (e.g. big/little endian issue we found recently) but I haven't come up with a better idea yet. > I was talking about these register numbering problems with Greg Clayton and > he half-jokingly said we should switch from register numbers to using > ConstString register names in the UnwindPlans. It's not a bad idea! As long > as everyone can agree on the register names for an architecture, anyway. Personally I really don't like ConstString because of the global pool behind it (kind of leaks memory) so I think having some sort of register number is better. I think a betetr approach would be to agree that inside LLDB everything should use eRegisterKindLLDB and we do the register number translation at the communication boundaries (gdb-remote communication, eh_frame parsing, dwarf reading) Repository: rL LLVM https://reviews.llvm.org/D25864 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r285596 - Add the new minidump plugin files to the Xcode project
Author: enrico Date: Mon Oct 31 12:00:54 2016 New Revision: 285596 URL: http://llvm.org/viewvc/llvm-project?rev=285596&view=rev Log: Add the new minidump plugin files to the Xcode project Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=285596&r1=285595&r2=285596&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Oct 31 12:00:54 2016 @@ -835,6 +835,9 @@ 9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */; }; 9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */; settings = {ATTRIBUTES = (Public, ); }; }; 947A1D641616476B0017C8D1 /* CommandObjectPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */; }; + 947CF7711DC7B1EE00EF980B /* ProcessMinidump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp */; }; + 947CF7761DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7741DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp */; }; + 947CF7771DC7B20D00EF980B /* ThreadMinidump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp */; }; 949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; }; 949EEDA01BA74B6D008C63CF /* CoreMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949EED9E1BA74B64008C63CF /* CoreMedia.cpp */; }; 949EEDA31BA76577008C63CF /* Cocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949EEDA11BA76571008C63CF /* Cocoa.cpp */; }; @@ -2736,6 +2739,12 @@ 9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeNameSpecifier.cpp; path = source/API/SBTypeNameSpecifier.cpp; sourceTree = ""; }; 947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectPlugin.cpp; path = source/Commands/CommandObjectPlugin.cpp; sourceTree = ""; }; 947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectPlugin.h; path = source/Commands/CommandObjectPlugin.h; sourceTree = ""; }; + 947CF76F1DC7B1E300EF980B /* ProcessMinidump.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcessMinidump.h; sourceTree = ""; }; + 947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessMinidump.cpp; sourceTree = ""; }; + 947CF7721DC7B20300EF980B /* RegisterContextMinidump_x86_32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegisterContextMinidump_x86_32.h; sourceTree = ""; }; + 947CF7731DC7B20300EF980B /* ThreadMinidump.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadMinidump.h; sourceTree = ""; }; + 947CF7741DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_32.cpp; sourceTree = ""; }; + 947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadMinidump.cpp; sourceTree = ""; }; 9481FE6B1B5F2D9200DED357 /* Either.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Either.h; path = include/lldb/Utility/Either.h; sourceTree = ""; }; 949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectConstResultImpl.h; path = include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = ""; }; 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = source/Core/ValueObjectConstResultImpl.cpp; sourceTree = ""; }; @@ -3551,6 +3560,12 @@ 23
[Lldb-commits] [lldb] r285599 - Remove a couple of old TODOs and don't make a new ConstString each time; none of this is super-critical since it applies to older versions of macOS (or OSX, I guess?) b
Author: enrico Date: Mon Oct 31 12:12:16 2016 New Revision: 285599 URL: http://llvm.org/viewvc/llvm-project?rev=285599&view=rev Log: Remove a couple of old TODOs and don't make a new ConstString each time; none of this is super-critical since it applies to older versions of macOS (or OSX, I guess?) but still.. Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=285599&r1=285598&r2=285599&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Oct 31 12:12:16 2016 @@ -1911,8 +1911,6 @@ void AppleObjCRuntimeV2::WarnIfNoClasses } } -// TODO: should we have a transparent_kvo parameter here to say if we -// want to replace the KVO swizzled class with the actual user-level type? ConstString AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) { if (isa == g_objc_Tagged_ISA) { @@ -2166,23 +2164,28 @@ AppleObjCRuntimeV2::TaggedPointerVendorL uint64_t class_bits = (ptr & 0xE) >> 1; ConstString name; - // TODO: make a table + static ConstString g_NSAtom("NSAtom"); + static ConstString g_NSNumber("NSNumber"); + static ConstString g_NSDateTS("NSDateTS"); + static ConstString g_NSManagedObject("NSManagedObject"); + static ConstString g_NSDate("NSDate"); + if (foundation_version >= 900) { switch (class_bits) { case 0: - name = ConstString("NSAtom"); + name = g_NSAtom; break; case 3: - name = ConstString("NSNumber"); + name = g_NSNumber; break; case 4: - name = ConstString("NSDateTS"); + name = g_NSDateTS; break; case 5: - name = ConstString("NSManagedObject"); + name = g_NSManagedObject; break; case 6: - name = ConstString("NSDate"); + name = g_NSDate; break; default: return ObjCLanguageRuntime::ClassDescriptorSP(); @@ -2190,16 +2193,16 @@ AppleObjCRuntimeV2::TaggedPointerVendorL } else { switch (class_bits) { case 1: - name = ConstString("NSNumber"); + name = g_NSNumber; break; case 5: - name = ConstString("NSManagedObject"); + name = g_NSManagedObject; break; case 6: - name = ConstString("NSDate"); + name = g_NSDate; break; case 7: - name = ConstString("NSDateTS"); + name = g_NSDateTS; break; default: return ObjCLanguageRuntime::ClassDescriptorSP(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D25391: Remove usages of TimeValue from gdb-remote process plugin
labath updated this revision to Diff 76442. labath added a comment. Clean up the code a bit now that I have learned better how to use the chrono library. https://reviews.llvm.org/D25391 Files: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp === --- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -20,12 +20,14 @@ #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/StructuredData.h" #include "llvm/ADT/ArrayRef.h" using namespace lldb_private::process_gdb_remote; using namespace lldb_private; using namespace lldb; +using namespace llvm; namespace { @@ -45,8 +47,7 @@ ASSERT_EQ(PacketResult::Success, server.SendUnimplementedResponse(nullptr)); } -void HandlePacket(MockServer &server, llvm::StringRef expected, - llvm::StringRef response) { +void HandlePacket(MockServer &server, StringRef expected, StringRef response) { StringExtractorGDBRemote request; ASSERT_EQ(PacketResult::Success, server.GetPacket(request)); ASSERT_EQ(expected, request.GetStringRef()); @@ -260,3 +261,45 @@ ASSERT_FALSE(async_result.get().hasValue()) << "response was: " << response; } } + +TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) { + TestClient client; + MockServer server; + Connect(client, server); + if (HasFailure()) +return; + + std::thread server_thread([&server] { +StringExtractorGDBRemote request; +PacketResult result = server.GetPacket(request); +if (result == PacketResult::ErrorDisconnected) + return; +ASSERT_EQ(PacketResult::Success, result); +StringRef ref = request.GetStringRef(); +ASSERT_TRUE(ref.consume_front("qSpeedTest:response_size:")); +int size; +ASSERT_FALSE(ref.consumeInteger(10, size)) << "ref: " << ref; +std::string response(size, 'X'); +ASSERT_EQ(PacketResult::Success, server.SendPacket(response)); + }); + + StreamString ss; + client.TestPacketSpeed(10, 32, 32, true, ss); + client.Disconnect(); + server_thread.join(); + + auto object_sp = StructuredData::ParseJSON(ss.GetString()); + ASSERT_TRUE(bool(object_sp)); + auto dict_sp = object_sp->GetAsDictionary(); + ASSERT_TRUE(bool(dict_sp)); + + object_sp = dict_sp->GetValueForKey("packet_speeds"); + ASSERT_TRUE(bool(object_sp)); + dict_sp = object_sp->GetAsDictionary(); + ASSERT_TRUE(bool(dict_sp)); + + int num_packets; + ASSERT_TRUE(dict_sp->GetValueForKeyAsInteger("num_packets", num_packets)) + << ss.GetString(); + ASSERT_EQ(10, num_packets); +} Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -46,7 +46,6 @@ #include "lldb/Host/StringConvert.h" #include "lldb/Host/Symbols.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Host/XML.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -289,7 +288,7 @@ const uint64_t timeout_seconds = GetGlobalPluginProperties()->GetPacketTimeout(); if (timeout_seconds > 0) -m_gdb_comm.SetPacketTimeout(timeout_seconds); +m_gdb_comm.SetPacketTimeout(std::chrono::seconds(timeout_seconds)); } //-- @@ -424,9 +423,9 @@ // Check if qHostInfo specified a specific packet timeout for this connection. // If so then lets update our setting so the user knows what the timeout is // and can see it. - const uint32_t host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout(); - if (host_packet_timeout) { -GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout); + const auto host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout(); + if (host_packet_timeout > std::chrono::seconds(0)) { +GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout.count()); } // Register info search order: @@ -899,7 +898,8 @@ { // Scope for the scoped timeout object -GDBRemoteCommunication::ScopedTimeout timeout(m_g
[Lldb-commits] [lldb] r285602 - Remove usages of TimeValue from gdb-remote process plugin
Author: labath Date: Mon Oct 31 12:19:42 2016 New Revision: 285602 URL: http://llvm.org/viewvc/llvm-project?rev=285602&view=rev Log: Remove usages of TimeValue from gdb-remote process plugin Summary: Most of the changes are very straight-forward, the only tricky part was the "packet speed-test" function, which is very time-heavy. As the function was completely untested, I added a quick unit smoke test for it. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D25391 Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=285602&r1=285601&r2=285602&view=diff == --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original) +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Mon Oct 31 12:19:42 2016 @@ -445,7 +445,7 @@ Error PlatformRemoteGDBServer::LaunchPro { // Scope for the scoped timeout object process_gdb_remote::GDBRemoteCommunication::ScopedTimeout timeout( -m_gdb_client, 5); +m_gdb_client, std::chrono::seconds(5)); arg_packet_err = m_gdb_client.SendArgumentsPacket(launch_info); } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp?rev=285602&r1=285601&r2=285602&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Mon Oct 31 12:19:42 2016 @@ -188,8 +188,11 @@ GDBRemoteClientBase::SendPacketAndWaitFo const size_t max_response_retries = 3; for (size_t i = 0; i < max_response_retries; ++i) { -packet_result = -ReadPacket(response, GetPacketTimeoutInMicroSeconds(), true); +packet_result = ReadPacket( +response, std::chrono::duration_cast( + GetPacketTimeout()) + .count(), +true); // Make sure we received a response if (packet_result != PacketResult::Success) return packet_result; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=285602&r1=285601&r2=285602&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Oct 31 12:19:42 2016 @@ -28,7 +28,6 @@ #include "lldb/Host/Socket.h" #include "lldb/Host/StringConvert.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "llvm/ADT/SmallString.h" @@ -262,8 +261,11 @@ GDBRemoteCommunication::SendPacketNoLock GDBRemoteCommunication::PacketResult GDBRemoteCommunication::GetAck() { StringExtractorGDBRemote packet; - PacketResult result = - ReadPacket(packet, GetPacketTimeoutInMicroSeconds(), false); + PacketResult result = ReadPacket( + packet, + std::chrono::duration_cast(GetPacketTimeout()) + .count(), + false); if (result == PacketResult::Success) { if (packet.GetResponseType() == StringExtractorGDBRemote::ResponseType::eAck) @@ -1320,7 +1322,7 @@ Error GDBRemoteCommunication::StartDebug void GDBRemoteCommunication::DumpHistory(Stream &strm) { m_history.Dump(strm); } GDBRemoteCommunication::ScopedTimeout::ScopedTimeout( -GDBRemoteCommunication &gdb_comm, uint32_t timeout) +GDBRemoteCommunication &gdb_comm, std::chrono::seconds timeout) : m_gdb_comm(gdb_comm) { m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/
[Lldb-commits] [PATCH] D25391: Remove usages of TimeValue from gdb-remote process plugin
This revision was automatically updated to reflect the committed changes. Closed by commit rL285602: Remove usages of TimeValue from gdb-remote process plugin (authored by labath). Changed prior to commit: https://reviews.llvm.org/D25391?vs=76442&id=76443#toc Repository: rL LLVM https://reviews.llvm.org/D25391 Files: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp === --- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -20,12 +20,14 @@ #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/StructuredData.h" #include "llvm/ADT/ArrayRef.h" using namespace lldb_private::process_gdb_remote; using namespace lldb_private; using namespace lldb; +using namespace llvm; namespace { @@ -45,8 +47,7 @@ ASSERT_EQ(PacketResult::Success, server.SendUnimplementedResponse(nullptr)); } -void HandlePacket(MockServer &server, llvm::StringRef expected, - llvm::StringRef response) { +void HandlePacket(MockServer &server, StringRef expected, StringRef response) { StringExtractorGDBRemote request; ASSERT_EQ(PacketResult::Success, server.GetPacket(request)); ASSERT_EQ(expected, request.GetStringRef()); @@ -260,3 +261,45 @@ ASSERT_FALSE(async_result.get().hasValue()) << "response was: " << response; } } + +TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) { + TestClient client; + MockServer server; + Connect(client, server); + if (HasFailure()) +return; + + std::thread server_thread([&server] { +StringExtractorGDBRemote request; +PacketResult result = server.GetPacket(request); +if (result == PacketResult::ErrorDisconnected) + return; +ASSERT_EQ(PacketResult::Success, result); +StringRef ref = request.GetStringRef(); +ASSERT_TRUE(ref.consume_front("qSpeedTest:response_size:")); +int size; +ASSERT_FALSE(ref.consumeInteger(10, size)) << "ref: " << ref; +std::string response(size, 'X'); +ASSERT_EQ(PacketResult::Success, server.SendPacket(response)); + }); + + StreamString ss; + client.TestPacketSpeed(10, 32, 32, true, ss); + client.Disconnect(); + server_thread.join(); + + auto object_sp = StructuredData::ParseJSON(ss.GetString()); + ASSERT_TRUE(bool(object_sp)); + auto dict_sp = object_sp->GetAsDictionary(); + ASSERT_TRUE(bool(dict_sp)); + + object_sp = dict_sp->GetValueForKey("packet_speeds"); + ASSERT_TRUE(bool(object_sp)); + dict_sp = object_sp->GetAsDictionary(); + ASSERT_TRUE(bool(dict_sp)); + + int num_packets; + ASSERT_TRUE(dict_sp->GetValueForKeyAsInteger("num_packets", num_packets)) + << ss.GetString(); + ASSERT_EQ(10, num_packets); +} Index: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp === --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -445,7 +445,7 @@ { // Scope for the scoped timeout object process_gdb_remote::GDBRemoteCommunication::ScopedTimeout timeout( -m_gdb_client, 5); +m_gdb_client, std::chrono::seconds(5)); arg_packet_err = m_gdb_client.SendArgumentsPacket(launch_info); } Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -24,7 +24,6 @@ #include "lldb/Core/Listener.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Predicate.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Interpreter/Args.h" #include "lldb/lldb-public.h" @@ -83,12 +82,13 @@ // created ScopedTimeout object got out of scope class ScopedTimeout { public: -ScopedTimeout(GDBRemoteCommunication &gdb_comm, uint32_t timeout); +ScopedTimeout(GDBRemoteCommunication &gdb_comm, + std::chrono::secon
[Lldb-commits] [lldb] r285646 - [Test-Suite] Speculative fix for darwin bots
Author: cbieneman Date: Mon Oct 31 17:06:52 2016 New Revision: 285646 URL: http://llvm.org/viewvc/llvm-project?rev=285646&view=rev Log: [Test-Suite] Speculative fix for darwin bots When building with Xcode it looks like some of the logic in my test changes went haywire. This should fix it. Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=285646&r1=285645&r2=285646&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Oct 31 17:06:52 2016 @@ -688,8 +688,8 @@ def setupSysPath(): configuration.skipCategories.append("lldb-mi") lldbPythonDir = None # The directory that contains 'lldb/__init__.py' -if os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")): -configuration.lldbFrameworkPath = lldbLibDir +if not configuration.lldbFrameworkPath and os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")): +configuration.lldbFrameworkPath = os.path.join(lldbLibDir, "LLDB.framework") if configuration.lldbFrameworkPath: lldbtest_config.lldbFrameworkPath = configuration.lldbFrameworkPath candidatePath = os.path.join( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r285651 - [CMake] Populate the build directory's framework
Author: cbieneman Date: Mon Oct 31 17:31:07 2016 New Revision: 285651 URL: http://llvm.org/viewvc/llvm-project?rev=285651&view=rev Log: [CMake] Populate the build directory's framework This ensures that the Resources and clang headers are properly symlinked in LLDB's framework. This should fix the modules-related tests when building on Darwin with CMake if you are building a framework. I have another fix coming which gets them working on Darwin if you're building liblldb instead of a framework. Modified: lldb/trunk/source/API/CMakeLists.txt lldb/trunk/test/CMakeLists.txt Modified: lldb/trunk/source/API/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=285651&r1=285650&r2=285651&view=diff == --- lldb/trunk/source/API/CMakeLists.txt (original) +++ lldb/trunk/source/API/CMakeLists.txt Mon Oct 31 17:31:07 2016 @@ -140,16 +140,22 @@ if(LLDB_BUILD_FRAMEWORK) LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${public_headers}") + set(symlink_commands +COMMAND ${CMAKE_COMMAND} -E make_directory $ +COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang +) + # This works around a CMake bug where POST_BUILD steps are not applied to # framework targets. This fix is merged into the CMake release branch and # should be available with CMake 3.7 rc2: # https://gitlab.kitware.com/cmake/cmake/issues/16363 if(CMAKE_VERSION VERSION_GREATER 3.6.99) -add_custom_command(TARGET liblldb POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $/Headers) +add_custom_command(TARGET liblldb POST_BUILD ${symlink_commands}) else() add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers - COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $/Headers) + ${symlink_commands}) add_custom_target(lldb_header_symlink DEPENDS ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers) endif() Modified: lldb/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=285651&r1=285650&r2=285651&view=diff == --- lldb/trunk/test/CMakeLists.txt (original) +++ lldb/trunk/test/CMakeLists.txt Mon Oct 31 17:31:07 2016 @@ -27,6 +27,11 @@ if(TARGET lldb-mi) list(APPEND LLDB_TEST_DEPS lldb-mi) endif() +# This target will only exist if the user is using a CMake older than 3.7 +if(TARGET lldb_header_symlink) + list(APPEND LLDB_TEST_DEPS lldb_header_symlink) +endif() + if ("${LLDB_TEST_COMPILER}" STREQUAL "") string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26170: Find clang resource directory via *nix-style lookup
beanz created this revision. beanz added reviewers: zturner, labath, spyffe, tfiala. beanz added a subscriber: lldb-commits. This patch allows the Darwin build to fall back to to Posix-style lookups for the clang resource directory if the debugger library isn't inside a framework. The patch also includes a bit of refactoring and cleanup around the *nix resolution of the binary and lib directories to reuse the code instead of duplicating it. With this patch Darwin builds that don't build a framework only have 3 failing tests on my system (TestExec.py). https://reviews.llvm.org/D26170 Files: include/lldb/Host/posix/HostInfoPosix.h source/Host/macosx/HostInfoMacOSX.mm source/Host/posix/HostInfoPosix.cpp Index: source/Host/posix/HostInfoPosix.cpp === --- source/Host/posix/HostInfoPosix.cpp +++ source/Host/posix/HostInfoPosix.cpp @@ -14,7 +14,10 @@ #include "lldb/Core/Log.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "clang/Basic/Version.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include @@ -124,44 +127,55 @@ FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh", false); } -bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) { +bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec, + llvm::StringRef dir) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); FileSpec lldb_file_spec; if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec)) return false; - char raw_path[PATH_MAX]; - lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); + std::string raw_path = lldb_file_spec.GetPath(); + // drop filename and library directory + llvm::StringRef parent_path = + llvm::sys::path::parent_path(llvm::sys::path::parent_path(raw_path)); // Most Posix systems (e.g. Linux/*BSD) will attempt to replace a */lib with - // */bin as the base - // directory for helper exe programs. This will fail if the /lib and /bin - // directories are - // rooted in entirely different trees. + // */bin as the base directory for helper exe programs. This will fail if the + // /lib and /bin directories are rooted in entirely different trees. if (log) log->Printf("HostInfoPosix::ComputeSupportExeDirectory() attempting to " "derive the bin path (ePathTypeSupportExecutableDir) from " "this path: %s", -raw_path); - char *lib_pos = ::strstr(raw_path, "/lib"); - if (lib_pos != nullptr) { +raw_path.c_str()); + + if (!parent_path.empty()) { // Now write in bin in place of lib. -::snprintf(lib_pos, PATH_MAX - (lib_pos - raw_path), "/bin"); +raw_path = (parent_path + dir).str(); if (log) log->Printf("Host::%s() derived the bin path as: %s", __FUNCTION__, - raw_path); + raw_path.c_str()); } else { if (log) log->Printf("Host::%s() failed to find /lib/liblldb within the shared " "lib path, bailing on bin path construction", __FUNCTION__); } - file_spec.GetDirectory().SetCString(raw_path); + file_spec.GetDirectory().SetString(raw_path); return (bool)file_spec.GetDirectory(); } +bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) { + return ComputePathRelativeToLibrary(file_spec, "/bin"); +} + +bool HostInfoPosix::ComputeClangDirectory(FileSpec &file_spec) { + return ComputePathRelativeToLibrary( + file_spec, + llvm::Twine("/lib/clang/", llvm::StringRef(CLANG_VERSION_STRING)).str()); +} + bool HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec) { FileSpec temp_file("/opt/local/include/lldb", false); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); Index: source/Host/macosx/HostInfoMacOSX.mm === --- source/Host/macosx/HostInfoMacOSX.mm +++ source/Host/macosx/HostInfoMacOSX.mm @@ -233,11 +233,13 @@ std::string raw_path = lldb_file_spec.GetPath(); size_t framework_pos = raw_path.find("LLDB.framework"); - if (framework_pos != std::string::npos) { -framework_pos += strlen("LLDB.framework"); -raw_path.resize(framework_pos); -raw_path.append("/Resources/Clang"); - } + if (framework_pos == std::string::npos) +return HostInfoPosix::ComputeClangDirectory(file_spec); + + framework_pos += strlen("LLDB.framework"); + raw_path.resize(framework_pos); + raw_path.append("/Resources/Clang"); + file_spec.SetFile(raw_path.c_str(), true); return true; } Index: include/lldb/Host/posix/HostInfoPosix.h === --- include/lldb/Host/posix/HostInfoPosix.h +++ include/lldb/Host/posix/HostInfoPosix.h @@ -37,6 +37,9 @@
[Lldb-commits] [PATCH] D26171: [LLDB] Fix RHEL 6 build and some Include What You Use warnings
Eugene.Zelenko created this revision. Eugene.Zelenko added reviewers: labath, zturner. Eugene.Zelenko added a subscriber: lldb-commits. Eugene.Zelenko set the repository for this revision to rL LLVM. Build problem happens because of errno. Repository: rL LLVM https://reviews.llvm.org/D26171 Files: lldb-svn.src/source/Host/posix/MainLoopPosix.cpp Index: lldb-svn.src/source/Host/posix/MainLoopPosix.cpp === --- lldb-svn.src/source/Host/posix/MainLoopPosix.cpp +++ lldb-svn.src/source/Host/posix/MainLoopPosix.cpp @@ -8,11 +8,14 @@ //===--===// #include "lldb/Host/posix/MainLoopPosix.h" - +#include "lldb/Core/Error.h" +#include +#include +#include +#include #include +#include -#include "lldb/Core/Error.h" - using namespace lldb; using namespace lldb_private; Index: lldb-svn.src/source/Host/posix/MainLoopPosix.cpp === --- lldb-svn.src/source/Host/posix/MainLoopPosix.cpp +++ lldb-svn.src/source/Host/posix/MainLoopPosix.cpp @@ -8,11 +8,14 @@ //===--===// #include "lldb/Host/posix/MainLoopPosix.h" - +#include "lldb/Core/Error.h" +#include +#include +#include +#include #include +#include -#include "lldb/Core/Error.h" - using namespace lldb; using namespace lldb_private; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r285587 - Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull
I think the new mini-dump test case added here might be flaky. See: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/381 The next build was successful. -Chris > On Oct 31, 2016, at 8:35 AM, Dimitar Vlahovski via lldb-commits > wrote: > > Author: dvlahovski > Date: Mon Oct 31 10:35:18 2016 > New Revision: 285587 > > URL: http://llvm.org/viewvc/llvm-project?rev=285587&view=rev > Log: > Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the > plugin in SystemInitializerFull > > Summary: > This plugin resembles the already existing Windows-only Minidump plugin. > The WinMinidumpPlugin uses the Windows API for parsing Minidumps > while this plugin is cross-platform because it includes a Minidump > parser (which is already commited) > > It is able to produce a backtrace, to read the general puprose regiters, > inspect local variables, show image list, do memory reads, etc. > > For now the only arches that this supports are x86_32 and x86_64. > This is because I have only written register contexts for those. > Others will come in next CLs. > > I copied the WinMinidump tests and adapted them a little bit for them to > work with the new plugin (and they pass) > I will add more tests, aiming for better code coverage. > > There is still functionality to be added, see TODOs in code. > > Reviewers: labath, zturner > > Subscribers: beanz, mgorny, modocache, lldb-commits, amccarth > > Differential Revision: https://reviews.llvm.org/D25905 > > Added: > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 >(with props) > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed >(with props) > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt >lldb/trunk/source/Plugins/Process/minidump/NtStructures.h >lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp >lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h >lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.cpp >lldb/trunk/source/Plugins/Process/minidump/ThreadMinidump.h > Modified: >lldb/trunk/source/API/SystemInitializerFull.cpp >lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt >lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp >lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h >lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h >lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp > > Added: > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=285587&view=auto > == > --- > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py > (added) > +++ > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py > Mon Oct 31 10:35:18 2016 > @@ -0,0 +1,100 @@ > +""" > +Test basics of Minidump debugging. > +""" > + > +from __future__ import print_function > +from six import iteritems > + > + > +import lldb > +from lldbsuite.test.decorators import * > +from lldbsuite.test.lldbtest import * > +from lldbsuite.test import lldbutil > + > + > +class MiniDumpNewTestCase(TestBase): > + > +mydir = TestBase.compute_mydir(__file__) > + > +NO_DEBUG_INFO_TESTCASE = True > + > +def test_process_info_in_minidump(self): > +"""Test that lldb can read the process information from the > Minidump.""" > +# target create -c linux-x86_64.dmp > +self.dbg.CreateTarget(None) > +self.target = self.dbg.GetSelectedTarget() > +self.process = self.target.LoadCore("linux-x86_64.dmp") > +self.assertTrue(self.process, PROCESS_IS_VALID) > +self.assertEqual(self.process.GetNumThreads(), 1) > +self.assertEqual(self.process.GetProcessID(), 29917) > + > +def test_thread_info_in_minidump(self): > +"""Test that lldb can read the thread information from the > Minidump.""" > +
[Lldb-commits] [lldb] r285658 - Remove executable bit on a source file
Author: sas Date: Mon Oct 31 19:21:57 2016 New Revision: 285658 URL: http://llvm.org/viewvc/llvm-project?rev=285658&view=rev Log: Remove executable bit on a source file Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp (contents, props changed) Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=285658&r1=285657&r2=285658&view=diff == (empty) Propchange: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp -- --- svn:executable (original) +++ svn:executable (removed) @@ -1 +0,0 @@ -* ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26170: Find clang resource directory via *nix-style lookup
tfiala accepted this revision. tfiala added a comment. This revision is now accepted and ready to land. Looks reasonable. Comment at: source/Host/macosx/HostInfoMacOSX.mm:235-239 size_t framework_pos = raw_path.find("LLDB.framework"); - if (framework_pos != std::string::npos) { -framework_pos += strlen("LLDB.framework"); -raw_path.resize(framework_pos); -raw_path.append("/Resources/Clang"); - } + if (framework_pos == std::string::npos) +return HostInfoPosix::ComputeClangDirectory(file_spec); + + framework_pos += strlen("LLDB.framework"); We should have a const in place of the two uses of "LLDB.framework", but that can be a separate cleanup. https://reviews.llvm.org/D26170 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r285662 - Fix a bug where the EmulateInstructionARM64 handling of STP/LDP instructions
Author: jmolenda Date: Mon Oct 31 20:26:54 2016 New Revision: 285662 URL: http://llvm.org/viewvc/llvm-project?rev=285662&view=rev Log: Fix a bug where the EmulateInstructionARM64 handling of STP/LDP instructions for floating point registers was not recording them correctly. I needed to change the EmulateInstructionARM64 unwind plans from using the DWARF register numbering scheme to using the LLDB register numbering scheme (because dwarf doesn't define register numbers for the 64-bit "d" registers). Updated the EmulateInstructionARM64 unit tests to work with the LLDB register numbering scheme and added a unit test to check the floating point register spills & restores are correctly recorded. https://reviews.llvm.org/D25864 Modified: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp Modified: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=285662&r1=285661&r2=285662&view=diff == --- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Mon Oct 31 20:26:54 2016 @@ -21,7 +21,24 @@ #include "Plugins/Process/Utility/ARMDefines.h" #include "Plugins/Process/Utility/ARMUtils.h" -#include "Utility/ARM64_DWARF_Registers.h" +#include "Plugins/Process/Utility/lldb-arm64-register-enums.h" + +#define GPR_OFFSET(idx) ((idx)*8) +#define GPR_OFFSET_NAME(reg) 0 +#define FPU_OFFSET(idx) ((idx)*16) +#define FPU_OFFSET_NAME(reg) 0 +#define EXC_OFFSET_NAME(reg) 0 +#define DBG_OFFSET_NAME(reg) 0 +#define DBG_OFFSET_NAME(reg) 0 +#define DEFINE_DBG(re, y) \ + "na", nullptr, 8, 0, lldb::eEncodingUint, lldb::eFormatHex, \ + {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \ + LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM}, \ + nullptr, nullptr, nullptr, 0 + +#define DECLARE_REGISTER_INFOS_ARM64_STRUCT + +#include "Plugins/Process/Utility/RegisterInfos_arm64.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" // for SignExtend32 template function @@ -32,6 +49,13 @@ using namespace lldb; using namespace lldb_private; +static bool LLDBTableGetRegisterInfo(uint32_t reg_num, RegisterInfo ®_info) { + if (reg_num >= llvm::array_lengthof(g_register_infos_arm64_le)) +return false; + reg_info = g_register_infos_arm64_le[reg_num]; + return true; +} + #define No_VFP 0 #define VFPv1 (1u << 1) #define VFPv2 (1u << 2) @@ -168,41 +192,33 @@ bool EmulateInstructionARM64::GetRegiste if (reg_kind == eRegisterKindGeneric) { switch (reg_num) { case LLDB_REGNUM_GENERIC_PC: - reg_kind = eRegisterKindDWARF; - reg_num = arm64_dwarf::pc; + reg_kind = eRegisterKindLLDB; + reg_num = gpr_pc_arm64; break; case LLDB_REGNUM_GENERIC_SP: - reg_kind = eRegisterKindDWARF; - reg_num = arm64_dwarf::sp; + reg_kind = eRegisterKindLLDB; + reg_num = gpr_sp_arm64; break; case LLDB_REGNUM_GENERIC_FP: - reg_kind = eRegisterKindDWARF; - reg_num = arm64_dwarf::fp; + reg_kind = eRegisterKindLLDB; + reg_num = gpr_fp_arm64; break; case LLDB_REGNUM_GENERIC_RA: - reg_kind = eRegisterKindDWARF; - reg_num = arm64_dwarf::lr; + reg_kind = eRegisterKindLLDB; + reg_num = gpr_lr_arm64; break; case LLDB_REGNUM_GENERIC_FLAGS: - // There is no DWARF register number for the CPSR right now... - reg_info.name = "cpsr"; - reg_info.alt_name = NULL; - reg_info.byte_size = 4; - reg_info.byte_offset = 0; - reg_info.encoding = eEncodingUint; - reg_info.format = eFormatHex; - for (uint32_t i = 0; i < lldb::kNumRegisterKinds; ++i) -reg_info.kinds[reg_kind] = LLDB_INVALID_REGNUM; - reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FLAGS; - return true; + reg_kind = eRegisterKindLLDB; + reg_num = gpr_cpsr_arm64; + break; default: return false; } } - if (reg_kind == eRegisterKindDWARF) -return arm64_dwarf::GetRegisterInfo(reg_num, reg_info); + if (reg_kind == eRegisterKindLLDB) +return LLDBTableGetRegisterInfo(reg_num, reg_info); return false; } @@ -429,12 +445,8 @@ bool EmulateInstructionARM64::EvaluateIn bool success = false; //if (m_opcode_cpsr == 0 || m_ignore_conditions == false) //{ - //m_opcode_cpsr = ReadRegisterUnsigned (eRegisterKindGeneric, - //// use eRegisterKindDWARF is we ever get a cpsr DWARF register - //number - // LLDB_REGNUM_GENERI
[Lldb-commits] [PATCH] D25864: Fix arm64 floating point register spill recording in UnwindPlan analysis
jasonmolenda closed this revision. jasonmolenda added a comment. Committed in r285662. Repository: rL LLVM https://reviews.llvm.org/D25864 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D25864: Fix arm64 floating point register spill recording in UnwindPlan analysis
> On Oct 31, 2016, at 9:35 AM, Tamas Berghammer wrote: > > tberghammer accepted this revision. > tberghammer added a comment. > This revision is now accepted and ready to land. > > The patch generally looks good to me. I added a few high level thought about > register context but they are clearly out of scope for this change. Also next > time please upload your patch with full context as it is much easier to > review that way. Thanks for the help with the patch Tamas, I just committed it. I meant to include additional context in the patch but couldn't remember how to get svn diff to do that - I should have looked it up. :/ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits