[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le
alexandreyy updated this revision to Diff 123151. alexandreyy added a comment. Herald added a subscriber: JDevlieghere. Removed enums without namespaces. https://reviews.llvm.org/D39681 Files: packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out source/Plugins/Process/Utility/CMakeLists.txt source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h source/Plugins/Process/Utility/RegisterInfos_ppc64le.h source/Plugins/Process/elf-core/CMakeLists.txt source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h source/Plugins/Process/elf-core/elf-core-enums.h Index: source/Plugins/Process/elf-core/elf-core-enums.h === --- /dev/null +++ source/Plugins/Process/elf-core/elf-core-enums.h @@ -0,0 +1,60 @@ +//===-- elf-core-enums.h *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef elf_core_enums_h +#define elf_core_enums_h + +/// Core files PT_NOTE segment descriptor types + +namespace FREEBSD { + enum { +NT_PRSTATUS = 1, +NT_FPREGSET, +NT_PRPSINFO, +NT_THRMISC = 7, +NT_PROCSTAT_AUXV = 16, +NT_PPC_VMX = 0x100 + }; +} + +namespace NETBSD { + enum { +NT_PROCINFO = 1, +NT_AUXV, +NT_AMD64_REGS = 33, +NT_AMD64_FPREGS = 35 + }; +} + +namespace OPENBSD { + enum { +NT_PROCINFO = 10, +NT_AUXV = 11, +NT_REGS = 20, +NT_FPREGS = 21, + }; +} + +namespace LINUX { + enum { +NT_PRSTATUS = 1, +NT_FPREGSET, +NT_PRPSINFO, +NT_TASKSTRUCT, +NT_PLATFORM, +NT_AUXV, +NT_FILE = 0x46494c45, +NT_SIGINFO = 0x53494749, +NT_PPC_VMX = 0x100, +NT_PPC_VSX = 0x102, +NT_PRXFPREG = 0x46e62b7f, + }; +} + +#endif // #ifndef elf_core_enums_h Index: source/Plugins/Process/elf-core/ThreadElfCore.h === --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -18,6 +18,7 @@ // Project includes #include "lldb/Target/Thread.h" #include "lldb/Utility/DataExtractor.h" +#include "llvm/ADT/DenseMap.h" struct compat_timeval { alignas(8) uint64_t tv_sec; @@ -131,6 +132,7 @@ lldb_private::DataExtractor gpregset; lldb_private::DataExtractor fpregset; lldb_private::DataExtractor vregset; + llvm::DenseMap regsets; lldb::tid_t tid; int signo = 0; int prstatus_sig = 0; @@ -179,6 +181,7 @@ lldb_private::DataExtractor m_gpregset_data; lldb_private::DataExtractor m_fpregset_data; lldb_private::DataExtractor m_vregset_data; + llvm::DenseMap m_regsets_data; bool CalculateStopInfo() override; }; Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -28,13 +28,15 @@ #include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" +#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h" #include "ProcessElfCore.h" #include "RegisterContextPOSIXCore_arm.h" #include "RegisterContextPOSIXCore_arm64.h" #include "RegisterContextPOSIXCore_mips64.h" #include "RegisterContextPOSIXCore_powerpc.h" #include "RegisterContextPOSIXCore_s390x.h" #include "RegisterContextPOSIXCore_x86_64.h" +#include "RegisterContextPOSIXCore_ppc64le.h" #include "ThreadElfCore.h" using namespace lldb; @@ -46,7 +48,8 @@ ThreadElfCore::ThreadElfCore(Process &process, const ThreadData &td) : Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(), m_signo(td.signo), m_gpregset_data(td.gpregset), - m_fpregset_data(td.fpregset), m_vregset_data(td.vregset) {} + m_fpregset_data(td.fpregset), m_vregset_data(td.vregset), + m_regsets_data(td.regsets) {} ThreadElfCore::~ThreadElfCore() { DestroyThread(); } @@ -142,6 +145,9 @@ case llvm::Triple::mips64: reg_interface = new RegisterContextLinux_mips64(arch); break; + case llvm::Triple::ppc64le: +reg_interface = new RegisterInfoPOSIX_ppc64le(arch); +
[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le
alexandreyy added a comment. In https://reviews.llvm.org/D39681#925864, @labath wrote: > Also, I have trouble downloading the core file from phabricator. Alexandre, > can you sent them to me directly? Sent the test files by e-mail. Thanks. https://reviews.llvm.org/D39681 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r318399 - Implement core dump debugging for PPC64le
Author: labath Date: Thu Nov 16 05:38:57 2017 New Revision: 318399 URL: http://llvm.org/viewvc/llvm-project?rev=318399&view=rev Log: Implement core dump debugging for PPC64le Summary: Implement core dump debugging for PPC64le. Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, krytarowski, clayborg, labath, lbianc, nemanjai, gut, anajuliapc, mgorny, kbarton, lldb-commits Differential Revision: https://reviews.llvm.org/D39681 Patch by Alexandre Yukio Yamashita Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out (with props) lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h lldb/trunk/source/Plugins/Process/elf-core/elf-core-enums.h Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.h Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=318399&r1=318398&r2=318399&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py Thu Nov 16 05:38:57 2017 @@ -24,11 +24,13 @@ class LinuxCoreTestCase(TestBase): _mips64_n64_pid = 25619 _mips64_n32_pid = 3670 _mips_o32_pid = 3532 +_ppc64le_pid = 28147 _i386_regions = 4 _x86_64_regions = 5 _s390x_regions = 2 _mips_regions = 5 +_ppc64le_regions = 2 def setUp(self): super(LinuxCoreTestCase, self).setUp() @@ -58,6 +60,12 @@ class LinuxCoreTestCase(TestBase): @skipIf(oslist=['windows']) @skipIf(triple='^mips') +def test_ppc64le(self): +"""Test that lldb can read the process information from an ppc64le linux core file.""" +self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions) + +@skipIf(oslist=['windows']) +@skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core?rev=318399&view=auto == Binary files lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core (added) and lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core Thu Nov 16 05:38:57 2017 differ Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out?rev=318399&view=auto == Binary files lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out (added) and lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out Thu Nov 16 05:38:57 2017 differ Propchange: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out -- svn:executable = * Modified: lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt?rev=318399&r1=318398&r2=318399&view=diff == --- lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt Thu Nov 16 05:38:57
[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le
This revision was automatically updated to reflect the committed changes. Closed by commit rL318399: Implement core dump debugging for PPC64le (authored by labath). Changed prior to commit: https://reviews.llvm.org/D39681?vs=123151&id=123166#toc Repository: rL LLVM https://reviews.llvm.org/D39681 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.h lldb/trunk/source/Plugins/Process/elf-core/elf-core-enums.h Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -24,11 +24,13 @@ _mips64_n64_pid = 25619 _mips64_n32_pid = 3670 _mips_o32_pid = 3532 +_ppc64le_pid = 28147 _i386_regions = 4 _x86_64_regions = 5 _s390x_regions = 2 _mips_regions = 5 +_ppc64le_regions = 2 def setUp(self): super(LinuxCoreTestCase, self).setUp() @@ -58,6 +60,12 @@ @skipIf(oslist=['windows']) @skipIf(triple='^mips') +def test_ppc64le(self): +"""Test that lldb can read the process information from an ppc64le linux core file.""" +self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions) + +@skipIf(oslist=['windows']) +@skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions) Index: lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt === --- lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt +++ lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt @@ -7,6 +7,7 @@ RegisterContextPOSIXCore_arm64.cpp RegisterContextPOSIXCore_mips64.cpp RegisterContextPOSIXCore_powerpc.cpp + RegisterContextPOSIXCore_ppc64le.cpp RegisterContextPOSIXCore_s390x.cpp RegisterContextPOSIXCore_x86_64.cpp Index: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h === --- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h +++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h @@ -0,0 +1,52 @@ +//===-- RegisterContextPOSIXCore_ppc64le.h --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef liblldb_RegisterContextCorePOSIX_ppc64le_h_ +#define liblldb_RegisterContextCorePOSIX_ppc64le_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h" +#include "lldb/Utility/DataExtractor.h" +#include "llvm/ADT/DenseMap.h" + +class RegisterContextCorePOSIX_ppc64le : public RegisterContextPOSIX_ppc64le { +public: + RegisterContextCorePOSIX_ppc64le( + lldb_private::Thread &thread, + lldb_private::RegisterInfoInterface *register_info, + const llvm::DenseMap ®sets); + + bool ReadRegister(const lldb_private::RegisterInfo *reg_info, +lldb_private::RegisterValue &value) override; + + bool WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; + +protected: + size_t GetFPRSize() const; + + size_t GetVMXSize() const; + + size_t GetVSXSize() const; + +private: + lldb::DataBufferSP m_gpr_buffer; + lldb::DataBufferSP m_fpr_buffer; + lldb::DataBufferSP m_vmx_buffer; + lldb::DataBufferSP m_vsx_buffer; + lldb_private::DataExtractor m_gpr; + lldb_priva
[Lldb-commits] [PATCH] D40133: elf-core: Convert remaining register context to use register set maps
labath created this revision. Herald added subscribers: kbarton, kristof.beyls, javed.absar, nemanjai, emaste, aemerson. In https://reviews.llvm.org/D39681, we started using a map instead passing a long list of register sets to the ppc64le register context. However, existing register sets were still using the old method. This converts remaining register contexts to use the register set map. While doing this, I realized that using OS-specific keys for the map was not a good idea, as sometimes we have a register context shared between two OSs (e.g. linux and freebsd share the arm/arm64 register contexts). Therefore, I create a new enum to represent register sets in an OS-independent manner (the enum contains the generic GPR and FPR values, but the rest of the values are likely to be architecture-specific). This saves a bit of code now, but the real impact I see here is that it can potentially pave the way for reduction of the number of register context classes (for example RegisterContextPOSIXCore_arm and RegisterContextPOSIXCore_arm64 are identical except that we initialize them with a different RegisterInfoInterface object). https://reviews.llvm.org/D40133 Files: source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h source/Plugins/Process/elf-core/elf-core-enums.h source/Plugins/Process/minidump/ThreadMinidump.cpp Index: source/Plugins/Process/minidump/ThreadMinidump.cpp === --- source/Plugins/Process/minidump/ThreadMinidump.cpp +++ source/Plugins/Process/minidump/ThreadMinidump.cpp @@ -17,8 +17,8 @@ // Other libraries and framework includes #include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" - #include "Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h" +#include "Plugins/Process/elf-core/elf-core-enums.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" @@ -74,20 +74,20 @@ reg_interface = new RegisterContextLinux_i386(arch); lldb::DataBufferSP buf = ConvertMinidumpContext_x86_32(m_gpregset_data, reg_interface); - DataExtractor gpregs(buf, lldb::eByteOrderLittle, 4); - DataExtractor fpregs; - m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64( - *this, reg_interface, gpregs, fpregs)); + CoreRegsetMap regsets; + regsets[CoreRegset::GPR] = DataExtractor(buf, lldb::eByteOrderLittle, 4); + m_thread_reg_ctx_sp.reset( + new RegisterContextCorePOSIX_x86_64(*this, reg_interface, regsets)); break; } case llvm::Triple::x86_64: { reg_interface = new RegisterContextLinux_x86_64(arch); lldb::DataBufferSP buf = ConvertMinidumpContext_x86_64(m_gpregset_data, reg_interface); - DataExtractor gpregs(buf, lldb::eByteOrderLittle, 8); - DataExtractor fpregs; - m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64( - *this, reg_interface, gpregs, fpregs)); + CoreRegsetMap regsets; + regsets[CoreRegset::GPR] = DataExtractor(buf, lldb::eByteOrderLittle, 8); + m_thread_reg_ctx_sp.reset( + new RegisterContextCorePOSIX_x86_64(*this, reg_interface, regsets)); break; } default: Index: source/Plugins/Process/elf-core/elf-core-enums.h === --- source/Plugins/Process/elf-core/elf-core-enums.h +++ source/Plugins/Process/elf-core/elf-core-enums.h @@ -10,6 +10,9 @@ #ifndef LLDB_ELF_CORE_ENUMS_H #define LLDB_ELF_CORE_ENUMS_H +#include "llvm/ADT/DenseMap.h" + +namespace lldb_private { /// Core files PT_NOTE segment descriptor types namespace FREEBSD { @@ -52,4 +55,17 @@ }; } +enum class CoreRegset : uint8_t { GPR, FPR, PPC_VMX, PPC_VSX }; + +struct CoreRegsetInfo { + static inline CoreRegset getEmptyKey() { return CoreRegset(-1); } + stat
[Lldb-commits] [lldb] r318424 - Fixed up to use a class for the commands, renamed the commands and added a way to just dump the compile unit full paths and optionally their support files with the new
Author: gclayton Date: Thu Nov 16 09:14:48 2017 New Revision: 318424 URL: http://llvm.org/viewvc/llvm-project?rev=318424&view=rev Log: Fixed up to use a class for the commands, renamed the commands and added a way to just dump the compile unit full paths and optionally their support files with the new "dump-files"command. Modified: lldb/trunk/examples/python/lldb_module_utils.py Modified: lldb/trunk/examples/python/lldb_module_utils.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/lldb_module_utils.py?rev=318424&r1=318423&r2=318424&view=diff == --- lldb/trunk/examples/python/lldb_module_utils.py (original) +++ lldb/trunk/examples/python/lldb_module_utils.py Thu Nov 16 09:14:48 2017 @@ -7,72 +7,185 @@ import string import sys -def create_dump_module_line_tables_options(): -usage = "usage: dump_module_line_tables [options] MODULE1 [MODULE2 ...]" -description = '''Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.''' -parser = optparse.OptionParser( -description=description, -prog='start_gdb_log', -usage=usage) -parser.add_option( -'-v', -'--verbose', -action='store_true', -dest='verbose', -help='Display verbose output.', -default=False) -return parser - - -def dump_module_line_tables(debugger, command, result, dict): -'''Dumps all line tables from all compile units for any modules specified as arguments.''' -command_args = shlex.split(command) - -parser = create_dump_module_line_tables_options() -try: -(options, args) = parser.parse_args(command_args) -except: -return -if command_args: -target = debugger.GetSelectedTarget() -lldb.target = target -for module_name in command_args: -result.PutCString('Searching for module "%s"' % (module_name,)) -module_fspec = lldb.SBFileSpec(module_name, False) -module = target.FindModule(module_fspec) -if module: -for cu_idx in range(module.GetNumCompileUnits()): -cu = module.GetCompileUnitAtIndex(cu_idx) -result.PutCString("\n%s:" % (cu.file)) -for line_idx in range(cu.GetNumLineEntries()): -line_entry = cu.GetLineEntryAtIndex(line_idx) -start_file_addr = line_entry.addr.file_addr -end_file_addr = line_entry.end_addr.file_addr -# If the two addresses are equal, this line table entry -# is a termination entry -if options.verbose: -if start_file_addr != end_file_addr: -result.PutCString( -'[%#x - %#x): %s' % -(start_file_addr, end_file_addr, line_entry)) -else: -if start_file_addr == end_file_addr: -result.PutCString('%#x: END' % - (start_file_addr)) -else: -result.PutCString( -'%#x: %s' % -(start_file_addr, line_entry)) +class DumpLineTables: +command_name = "dump-line-tables" +short_decription = "Dumps full paths to compile unit files and optionally all line table files." +description = 'Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.' +usage = "usage: %prog [options] MODULE1 [MODULE2 ...]" +def create_options(self): +self.parser = optparse.OptionParser( +description=self.description, +prog=self.command_name, +usage=self.usage) + +self.parser.add_option( +'-v', +'--verbose', +action='store_true', +dest='verbose', +help='Display verbose output.', +default=False) + +def get_short_help(self): +return self.short_decription + +def get_long_help(self): +return self.help_string + +def __init__(self, debugger, unused): +self.create_options() +self.help_string = self.parser.format_help() + +def __call__(self, debugger, command, exe_ctx, result): +# Use the Shell Lexer to properly parse up command options just like a +# shell would +command_args = shlex.split(command) + +try: +(options, args) = self.parser.parse_args(command_args) +except: +# if you don't handle exceptions, passing an i
[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le
bsdjhb added inline comments. Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14 +/// Core files PT_NOTE segment descriptor types +enum { + NT_PRSTATUS = 1, krytarowski wrote: > labath wrote: > > krytarowski wrote: > > > alexandreyy wrote: > > > > krytarowski wrote: > > > > > alexandreyy wrote: > > > > > > krytarowski wrote: > > > > > > > No namespace here? > > > > > > I think these constants are used for multiple OSs. > > > > > > Am I correct? > > > > > > Do you have a suggestion for a namespace? > > > > > There is rumor that they came from SVR4.. but I don't have the specs > > > > > to make sure. > > > > > > > > > > Multiple in this case does not mean "all". This is not true for at > > > > > least NetBSD. > > > > I can remove these constants and modify the first "if" in > > > > ParseThreadContextsFromNoteSegment to: > > > > > > > > if (((note.n_type == LINUX::NT_PRSTATUS || > > > > note.n_type == FREEBSD::NT_PRSTATUS) && have_prstatus) || > > > > ((note.n_type == LINUX::NT_PRPSINFO || > > > > note.n_type == FREEBSD::NT_PRPSINFO) && have_prpsinfo)) { > > > > assert(thread_data->gpregset.GetByteSize() > 0); > > > > > > > > What do you think? > > > > But NT_PRSTATUS and NT_PRPSINFO have the same value for Linux and > > > > FreeBSD . > > > I propose to put NT_PRSTATUS, NT_PRFPREG, NT_PRPSINFO into this namespace > > > and call it SVR4. > > > > > > SmartOS uses the same values. > > With the addition of all the bsd variants, the note parsing code has grown > > pretty big. > > > > My plan was to refactor it a bit after this is committed. I wanted to split > > it into two stages: first we just determine the OS from the notes; and then > > we dispatch to an appropriate os-specific function to do the actual parsing > > (with each function just using the NT constants from its own namespace). If > > you agree with that direction then I propose to go with the > > LINUX::NT_PRSTATUS || FREEBSD::NT_PRSTATUS proposed by alexandreyy in the > > interim. > Sounds good. Yes, that is probably the right approach. In binutils the note parsing code switches on the note name ("FreeBSD" vs "NetBSD" vs "CORE" vs "Linux", etc.) and then inside name-specific functions switches on the note type. I've been adding support for more notes to GDB for FreeBSD and ended up splitting out a handler for "FreeBSD" notes inline with this approach. Even notes with the same type (NT_PRSTATUS, etc.) have different layouts across OS's. Repository: rL LLVM https://reviews.llvm.org/D39681 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40133: elf-core: Convert remaining register context to use register set maps
krytarowski added a comment. Looks reasonable! I'm just thinking whether change code like `CoreRegset::PPC_VMX` to `CoreRegset::PPC::VMX`. I'm planning to add `CoreRegset::X86_64::XSAVE` in future. https://reviews.llvm.org/D40133 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40133: elf-core: Convert remaining register context to use register set maps
alexandreyy added a comment. Looks good to me! https://reviews.llvm.org/D40133 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r318495 - "source list -a" was calling DisplaySourceLinesWithNumbers incorrectly.
Author: jingham Date: Thu Nov 16 17:19:59 2017 New Revision: 318495 URL: http://llvm.org/viewvc/llvm-project?rev=318495&view=rev Log: "source list -a" was calling DisplaySourceLinesWithNumbers incorrectly. The parameters were just passed in the wrong order. Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=318495&r1=318494&r2=318495&view=diff == --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Thu Nov 16 17:19:59 2017 @@ -902,7 +902,7 @@ protected: // We don't care about the column here. const uint32_t column = 0; return target->GetSourceManager().DisplaySourceLinesWithLineNumbers( - start_file, line_no, 0, m_options.num_lines, column, "", + start_file, line_no, column, 0, m_options.num_lines, "", &result.GetOutputStream(), GetBreakpointLocations()); } else { result.AppendErrorWithFormat( @@ -1161,7 +1161,7 @@ protected: ? sc.line_entry.column : 0; target->GetSourceManager().DisplaySourceLinesWithLineNumbers( - sc.comp_unit, sc.line_entry.line, lines_to_back_up, column, + sc.comp_unit, sc.line_entry.line, column, lines_to_back_up, m_options.num_lines - lines_to_back_up, "->", &result.GetOutputStream(), GetBreakpointLocations()); result.SetStatus(eReturnStatusSuccessFinishResult); @@ -1283,8 +1283,9 @@ protected: m_options.num_lines = 10; const uint32_t column = 0; target->GetSourceManager().DisplaySourceLinesWithLineNumbers( - sc.comp_unit, m_options.start_line, 0, m_options.num_lines, - column, "", &result.GetOutputStream(), GetBreakpointLocations()); + sc.comp_unit, m_options.start_line, column, + 0, m_options.num_lines, + "", &result.GetOutputStream(), GetBreakpointLocations()); result.SetStatus(eReturnStatusSuccessFinishResult); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r318496 - Recognize another magic token sent in the LaunchInfo's EventData.
Author: jingham Date: Thu Nov 16 17:22:34 2017 New Revision: 318496 URL: http://llvm.org/viewvc/llvm-project?rev=318496&view=rev Log: Recognize another magic token sent in the LaunchInfo's EventData. Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=318496&r1=318495&r2=318496&view=diff == --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Thu Nov 16 17:22:34 2017 @@ -45,6 +45,26 @@ #include "CFBundle.h" #include "CFString.h" +static void SplitEventData(const char *data, std::vector &elements) +{ + elements.clear(); + if (!data) +return; + + const char *start = data; + + while (*start != '\0') { +const char *token = strchr(start, ':'); +if (!token) { + elements.push_back(std::string(start)); + return; +} +if (token != start) + elements.push_back(std::string(start, token - start)); +start = ++token; + } +} + #ifdef WITH_SPRINGBOARD #include @@ -112,7 +132,9 @@ static bool CallBoardSystemServiceOpenAp if (!cstr) cstr = ""; - DNBLog("About to launch process for bundle ID: %s", cstr); + NSString *description = [options description]; + DNBLog("About to launch process for bundle ID: %s - options:\n%s", cstr, +[description UTF8String]); [system_service openApplication:bundleIDNSStr options:options @@ -222,21 +244,31 @@ static void SetBKSError(NSInteger error_ static bool BKSAddEventDataToOptions(NSMutableDictionary *options, const char *event_data, DNBError &option_error) { - if (strcmp(event_data, "BackgroundContentFetching") == 0) { -DNBLog("Setting ActivateForEvent key in options dictionary."); -NSDictionary *event_details = [NSDictionary dictionary]; -NSDictionary *event_dictionary = [NSDictionary -dictionaryWithObject:event_details - forKey: - BKSActivateForEventOptionTypeBackgroundContentFetching]; -[options setObject:event_dictionary -forKey:BKSOpenApplicationOptionKeyActivateForEvent]; -return true; - } else { -DNBLogError("Unrecognized event type: %s. Ignoring.", event_data); -option_error.SetErrorString("Unrecognized event data."); -return false; + std::vector values; + SplitEventData(event_data, values); + bool found_one = false; + for (std::string value : values) + { + if (value.compare("BackgroundContentFetching") == 0) { +DNBLog("Setting ActivateForEvent key in options dictionary."); +NSDictionary *event_details = [NSDictionary dictionary]; +NSDictionary *event_dictionary = [NSDictionary +dictionaryWithObject:event_details + forKey: + BKSActivateForEventOptionTypeBackgroundContentFetching]; +[options setObject:event_dictionary +forKey:BKSOpenApplicationOptionKeyActivateForEvent]; +found_one = true; + } else if (value.compare("ActivateSuspended") == 0) { +DNBLog("Setting ActivateSuspended key in options dictionary."); +[options setObject:@YES forKey: BKSOpenApplicationOptionKeyActivateSuspended]; +found_one = true; + } else { +DNBLogError("Unrecognized event type: %s. Ignoring.", value.c_str()); +option_error.SetErrorString("Unrecognized event data"); + } } + return found_one; } static NSMutableDictionary *BKSCreateOptionsDictionary( @@ -322,21 +354,31 @@ static void SetFBSError(NSInteger error_ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, const char *event_data, DNBError &option_error) { - if (strcmp(event_data, "BackgroundContentFetching") == 0) { -DNBLog("Setting ActivateForEvent key in options dictionary."); -NSDictionary *event_details = [NSDictionary dictionary]; -NSDictionary *event_dictionary = [NSDictionary -dictionaryWithObject:event_details - forKey: - FBSActivateForEventOptionTypeBackgroundContentFetching]; -[options setObject:event_dictionary -forKey:FBSOpenApplicationOptionKeyActivateForEvent]; -return true; - } else { -DNBLogError("Unrecognized event type: %s. Ignoring.", event_data); -option_error.SetErrorString("Unrecognized event data."); -return false; + std::vector values; + SplitEventData(event_data, values); + bool found_one = false; + for (std::string value : values) + { + if (value.compare("BackgroundContentFetching") == 0) { +DNBLog(
[Lldb-commits] [lldb] r318500 - Update xcode project file to build new ppc64le files.
Author: jmolenda Date: Thu Nov 16 17:55:50 2017 New Revision: 318500 URL: http://llvm.org/viewvc/llvm-project?rev=318500&view=rev Log: Update xcode project file to build new ppc64le files. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=318500&r1=318499&r2=318500&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 16 17:55:50 2017 @@ -950,6 +950,10 @@ AF1F7B07189C904B0087DB9C /* AppleGetPendingItemsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF1F7B05189C904B0087DB9C /* AppleGetPendingItemsHandler.cpp */; }; AF20F7661AF18F8500751A6E /* ABISysV_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF20F7641AF18F8500751A6E /* ABISysV_arm.cpp */; }; AF20F76A1AF18F9000751A6E /* ABISysV_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF20F7681AF18F9000751A6E /* ABISysV_arm64.cpp */; }; + AF235EB01FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF235EAE1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp */; }; + AF235EB11FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF235EAF1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h */; }; + AF235EB41FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF235EB21FBE7857009C5541 /* RegisterInfoPOSIX_ppc64le.h */; }; + AF235EB51FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF235EB31FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp */; }; AF23B4DB19009C66003E2A58 /* FreeBSDSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF23B4D919009C66003E2A58 /* FreeBSDSignals.cpp */; }; AF248A4D1DA71C77000B814D /* TestArm64InstEmulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF248A4C1DA71C77000B814D /* TestArm64InstEmulation.cpp */; }; AF254E31170CCC33007AE5C9 /* PlatformDarwinKernel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF254E2F170CCC33007AE5C9 /* PlatformDarwinKernel.cpp */; }; @@ -992,6 +996,8 @@ AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = AF90106315AB7C5700FF120D /* lldb.1 */; }; AF9107EE168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; }; AF9107EF168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; }; + AF9113FD1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9113FB1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp */; }; + AF9113FE1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF9113FC1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h */; }; AF9B8F33182DB52900DA866F /* SystemRuntimeMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9B8F31182DB52900DA866F /* SystemRuntimeMacOSX.cpp */; }; AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; }; AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; }; @@ -3021,6 +3027,10 @@ AF20F7681AF18F9000751A6E /* ABISysV_arm64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ABISysV_arm64.cpp; path = "SysV-arm64/ABISysV_arm64.cpp"; sourceTree = ""; }; AF20F7691AF18F9000751A6E /* ABISysV_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ABISysV_arm64.h; path = "SysV-arm64/ABISysV_arm64.h"; sourceTree = ""; }; AF20F76C1AF18FC700751A6E /* SBLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBLanguageRuntime.cpp; path = source/API/SBLanguageRuntime.cpp; sourceTree = ""; }; + AF235EAE1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextPOSIX_ppc64le.cpp; path = Utility/Re
[Lldb-commits] [lldb] r318504 - Fix LLDB build.
Author: eugene Date: Thu Nov 16 19:28:58 2017 New Revision: 318504 URL: http://llvm.org/viewvc/llvm-project?rev=318504&view=rev Log: Fix LLDB build. It was broken by r318489. Modified: lldb/trunk/source/Utility/StructuredData.cpp Modified: lldb/trunk/source/Utility/StructuredData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StructuredData.cpp?rev=318504&r1=318503&r2=318504&view=diff == --- lldb/trunk/source/Utility/StructuredData.cpp (original) +++ lldb/trunk/source/Utility/StructuredData.cpp Thu Nov 16 19:28:58 2017 @@ -15,6 +15,7 @@ #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" #include "llvm/ADT/STLExtras.h" // for make_unique +#include "llvm/Support/MemoryBuffer.h" #include #include #include ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits