Re: [Lldb-commits] [PATCH] D13234: Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator
enlight updated this revision to Diff 36072. enlight added a comment. This revision is now accepted and ready to land. Added an explanation of the generator expression used in this patch. Repository: rL LLVM http://reviews.llvm.org/D13234 Files: cmake/modules/LLDBConfig.cmake Index: cmake/modules/LLDBConfig.cmake === --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -48,15 +48,39 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") if (NOT "${PYTHON_HOME}" STREQUAL "") file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME) - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") -file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXECUTABLE) -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_LIBRARY) -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DLL) - else() -file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXECUTABLE) -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_LIBRARY) -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL) - endif() + file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE) + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_DEBUG_LIB) + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DEBUG_DLL) + + file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE) + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_RELEASE_LIB) + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_RELEASE_DLL) + + # Generator expressions are evaluated in the context of each build configuration generated + # by CMake. Here we use the $:VALUE logical generator expression to ensure + # that the debug Python library, DLL, and executable are used in the Debug build configuration. + # + # Generator expressions can be difficult to grok at first so here's a breakdown of the one + # used for PYTHON_LIBRARY: + # + # 1. $ evaluates to 1 when the Debug configuration is being generated, + #or 0 in all other cases. + # 2. $<$:${PYTHON_DEBUG_LIB}> expands to ${PYTHON_DEBUG_LIB} when the Debug + #configuration is being generated, or nothing (literally) in all other cases. + # 3. $<$>:${PYTHON_RELEASE_LIB}> expands to ${PYTHON_RELEASE_LIB} when + #any configuration other than Debug is being generated, or nothing in all other cases. + # 4. The conditionals in 2 & 3 are mutually exclusive. + # 5. A logical expression with a conditional that evaluates to 0 yields no value at all. + # + # Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a single value specific to each + # build configuration. In this example the value will be ${PYTHON_DEBUG_LIB} when generating the + # Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any other configuration. + # Note that it's imperative that there is no whitespace between the two expressions, otherwise + # CMake will insert a semicolon between the two. + + set (PYTHON_EXECUTABLE $<$:${PYTHON_DEBUG_EXE}>$<$>:${PYTHON_RELEASE_EXE}>) + set (PYTHON_LIBRARY $<$:${PYTHON_DEBUG_LIB}>$<$>:${PYTHON_RELEASE_LIB}>) + set (PYTHON_DLL $<$:${PYTHON_DEBUG_DLL}>$<$>:${PYTHON_RELEASE_DLL}>) file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR) if (NOT LLDB_RELOCATABLE_PYTHON) Index: cmake/modules/LLDBConfig.cmake === --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -48,15 +48,39 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") if (NOT "${PYTHON_HOME}" STREQUAL "") file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME) - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") -file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXECUTABLE) -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_LIBRARY) -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DLL) - else() -file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXECUTABLE) -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_LIBRARY) -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL) - endif() + file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE) + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_DEBUG_LIB) + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DEBUG_DLL) + + file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE) + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_RELEASE_LIB) + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_RELEASE_DLL) + + # Generator expressions are evaluated in the context of each build configuration generated + # by CMake. Here
Re: [Lldb-commits] [PATCH] D13268: Simple readline functionality for interactive python on linux.
labath added a subscriber: labath. Comment at: scripts/Python/modules/readline/readline.cpp:17 @@ -15,3 +16,3 @@ moduleDocumentation, "Stub module meant to effectively disable readline support."); Given the code you are adding, this comment seems out of date. Repository: rL LLVM http://reviews.llvm.org/D13268 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13282: [MIPS] Emulate microMIPS instructions
bhushan created this revision. bhushan added reviewers: clayborg, tberghammer. bhushan added subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, sagar, jaydeep. bhushan set the repository for this revision to rL LLVM. This patch includes: 1. Emulation of prologue/epilogue and branch instructions for microMIPS. 2. Setting up alternate disassembler (to be used for microMIPS). So there will be two disassembler instances, one for microMIPS and other for MIPS. Appropriate disassembler will be used based on the address class of instruction address. 3. Some of the branch instructions does not have fixed sized delay slot, that means delay slot instruction can be of 2-byte or 4-byte. For this "m_next_inst_size" has been introduced which stores the size of next instruction (i.e size of delay slot instruction in case of branch). This can be used wherever the size of next instruction is required. 4. A minor change to use mips32 register names instead of mips64 names. Repository: rL LLVM http://reviews.llvm.org/D13282 Files: source/Plugins/ABI/SysV-mips/ABISysV_mips.h source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h === --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -91,7 +91,12 @@ virtual bool EvaluateInstruction (uint32_t evaluate_options); - + +bool +SetInstruction (const lldb_private::Opcode &insn_opcode, +const lldb_private::Address &inst_addr, +lldb_private::Target *target) override; + virtual bool TestEmulation (lldb_private::Stream *out_stream, lldb_private::ArchSpec &arch, @@ -121,6 +126,9 @@ static MipsOpcode* GetOpcodeForInstruction (const char *op_name); +uint32_t +GetSizeOfInstruction (lldb_private::DataExtractor& data, uint64_t inst_addr); + bool Emulate_ADDiu (llvm::MCInst& insn); @@ -131,6 +139,27 @@ Emulate_LW (llvm::MCInst& insn); bool +Emulate_ADDIUSP (llvm::MCInst& insn); + +bool +Emulate_ADDIUS5 (llvm::MCInst& insn); + +bool +Emulate_SWSP (llvm::MCInst& insn); + +bool +Emulate_SWM16_32 (llvm::MCInst& insn); + +bool +Emulate_LWSP (llvm::MCInst& insn); + +bool +Emulate_LWM16_32 (llvm::MCInst& insn); + +bool +Emulate_JRADDIUSP (llvm::MCInst& insn); + +bool Emulate_LDST_Imm (llvm::MCInst& insn); bool @@ -338,18 +367,37 @@ Emulate_MSA_Branch_V (llvm::MCInst& insn, bool bnz); bool +Emulate_B16_MM (llvm::MCInst& insn); + +bool +Emulate_Branch_MM (llvm::MCInst& insn); + +bool +Emulate_JALRx16_MM (llvm::MCInst& insn); + +bool +Emulate_JALx (llvm::MCInst& insn); + +bool +Emulate_JALRS (llvm::MCInst& insn); + +bool nonvolatile_reg_p (uint32_t regnum); const char * GetRegisterName (unsigned reg_num, bool altnernate_name); private: std::unique_ptr m_disasm; +std::unique_ptr m_alt_disasm; std::unique_ptr m_subtype_info; +std::unique_ptr m_alt_subtype_info; std::unique_ptr m_reg_info; std::unique_ptrm_asm_info; std::unique_ptrm_context; std::unique_ptr m_insn_info; +uint32_tm_next_inst_size; +boolm_use_alt_disaasm; }; #endif // EmulateInstructionMIPS_h_ Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp === --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -29,6 +29,7 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Stream.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Target/Target.h" #include "llvm/ADT/STLExtras.h" @@ -132,10 +133,6 @@ features += "+dsp,"; if (arch_flags & ArchSpec::eMIPSAse_dspr2) features += "+dspr2,"; -if (arch_flags & ArchSpec::eMIPSAse_mips16) -features += "+mips16,"; -if (arch_flags & ArchSpec::eMIPSAse_micromips) -features += "+micromips,"; m_reg_info.reset (target->createMCRegInfo (triple.getTriple())); assert (m_reg_info.get()); @@ -152,6 +149,21 @@ m_disasm.reset (target->createMCDisassembler (*m_subtype_info, *m_context)); assert (m_disasm.get()); + +/* Create alternate disassembler for microMIPS */ +if (arch_flags & ArchSpec::eMIPSAse_mips16) +features += "+mips16,"; +else if (arch_flags & ArchSpec::eMIPSAse_micromips) +features += "+micromips,"; + +m_alt_subtype_info.reset (target->createMCSubtargetInfo (triple.getTriple(), cpu, features)); +assert (m_alt_subtype_info.get()); +
Re: [Lldb-commits] [PATCH] D12184: [MIPS] Avoid breakpoint in delay slot
bhushan closed this revision. bhushan added a comment. Closed by commit http://reviews.llvm.org/rL246015 Repository: rL LLVM http://reviews.llvm.org/D12184 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248889 - Fix TestAttachDenied on linux
Author: labath Date: Wed Sep 30 05:59:39 2015 New Revision: 248889 URL: http://llvm.org/viewvc/llvm-project?rev=248889&view=rev Log: Fix TestAttachDenied on linux This test was timing out because the test inferior was forking a child, which was not terminated correctly. The test contained provisions to terminate this child, but these were no longer working. The idea was to wake up upon receiving SIGTERM and then kill the child. However, this was failing because the test first tried to use SIGHUP, which ended up killing the inferior. Fix: make sure we catch SIGHUP also. Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py?rev=248889&r1=24&r2=248889&view=diff == --- lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py (original) +++ lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py Wed Sep 30 05:59:39 2015 @@ -21,7 +21,6 @@ class AttachDeniedTestCase(TestBase): return (err, shell_command.GetStatus(), shell_command.GetOutput()) @skipIfWindows -@skipIfLinux # hanging after reviews D13124 change went in def test_attach_to_process_by_id_denied(self): """Test attach by process id denied""" self.build() Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp?rev=248889&r1=24&r2=248889&view=diff == --- lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp (original) +++ lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp Wed Sep 30 05:59:39 2015 @@ -54,7 +54,7 @@ bool writePid (const char* file_name, co return res; } -void sigterm_handler (int) +void signal_handler (int) { } @@ -75,8 +75,10 @@ int main (int argc, char const *argv[]) if (pid > 0) { -// Make pause call to return when SIGTERM is received. -signal (SIGTERM, sigterm_handler); +// Make pause call to return when a signal is received. Normally this happens when the +// test runner tries to terminate us. +signal (SIGHUP, signal_handler); +signal (SIGTERM, signal_handler); if (ptrace (ATTACH_REQUEST, pid, NULL, 0) == -1) { fprintf (stderr, "ptrace(ATTACH) failed: %s\n", strerror (errno)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13288: Restrict the scope of a hack in DYLDRendezvous
tberghammer created this revision. tberghammer added a reviewer: labath. tberghammer added a subscriber: lldb-commits. Herald added subscribers: srhines, danalbert, tberghammer. Restrict the scope of a hack in DYLDRendezvous The hack is there to work around an incorrect load address reported by the android linker on API 21 and 22 devices. This CL restricts the hack to those android API levels. http://reviews.llvm.org/D13288 Files: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp source/Plugins/Platform/Android/PlatformAndroid.cpp source/Plugins/Platform/Android/PlatformAndroid.h Index: source/Plugins/Platform/Android/PlatformAndroid.h === --- source/Plugins/Platform/Android/PlatformAndroid.h +++ source/Plugins/Platform/Android/PlatformAndroid.h @@ -76,7 +76,10 @@ uint32_t GetSdkVersion(); - + +bool +GetRemoteOSVersion() override; + Error DisconnectRemote () override; Index: source/Plugins/Platform/Android/PlatformAndroid.cpp === --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -362,3 +362,12 @@ // Download the symbolfile from the remote device return GetFile(symfile_platform_filespec, dst_file_spec); } + +bool +PlatformAndroid::GetRemoteOSVersion () +{ +m_major_os_version = GetSdkVersion(); +m_minor_os_version = 0; +m_update_os_version = 0; +return m_major_os_version != 0; +} Index: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp === --- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -17,6 +17,7 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -413,10 +414,13 @@ std::string file_path = ReadStringFromMemory(entry.path_addr); entry.file_spec.SetFile(file_path, false); -// On Android L (5.0, 5.1) the load address of the "/system/bin/linker" isn't filled in +// On Android L (API 21, 22) the load address of the "/system/bin/linker" isn't filled in // correctly. To get the correct load address we fetch the load address of the file from the // proc file system. -if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && entry.base_addr == 0 && +uint32_t os_major = 0, os_minor = 0, os_update = 0; +if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && +m_process->GetTarget().GetPlatform()->GetOSVersion(os_major, os_minor, os_update) && +(os_major == 21 || os_major == 22) && (file_path == "/system/bin/linker" || file_path == "/system/bin/linker64")) { lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; Index: source/Plugins/Platform/Android/PlatformAndroid.h === --- source/Plugins/Platform/Android/PlatformAndroid.h +++ source/Plugins/Platform/Android/PlatformAndroid.h @@ -76,7 +76,10 @@ uint32_t GetSdkVersion(); - + +bool +GetRemoteOSVersion() override; + Error DisconnectRemote () override; Index: source/Plugins/Platform/Android/PlatformAndroid.cpp === --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -362,3 +362,12 @@ // Download the symbolfile from the remote device return GetFile(symfile_platform_filespec, dst_file_spec); } + +bool +PlatformAndroid::GetRemoteOSVersion () +{ +m_major_os_version = GetSdkVersion(); +m_minor_os_version = 0; +m_update_os_version = 0; +return m_major_os_version != 0; +} Index: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp === --- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -17,6 +17,7 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -413,10 +414,13 @@ std::string file_path = ReadStringFromMemory(entry.path_addr); entry.file_spec.SetFile(file_path, false); -// On Android L (5.0, 5.1) the load address of the "/system/bin/linker" isn't filled in +// On Android L (API 21, 22) the load address of the "/system/bin/linker" isn't filled in // correctly. To get the correct load address we fetch the load address of the file from the
[Lldb-commits] [lldb] r248901 - XFAIL 2 test in TestTargetCommands on android-aarch64
Author: tberghammer Date: Wed Sep 30 08:42:06 2015 New Revision: 248901 URL: http://llvm.org/viewvc/llvm-project?rev=248901&view=rev Log: XFAIL 2 test in TestTargetCommands on android-aarch64 The 2 test just get enabled with the recemt test system refactor. Modified: lldb/trunk/test/functionalities/target_command/TestTargetCommand.py Modified: lldb/trunk/test/functionalities/target_command/TestTargetCommand.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/target_command/TestTargetCommand.py?rev=248901&r1=248900&r2=248901&view=diff == --- lldb/trunk/test/functionalities/target_command/TestTargetCommand.py (original) +++ lldb/trunk/test/functionalities/target_command/TestTargetCommand.py Wed Sep 30 08:42:06 2015 @@ -37,6 +37,7 @@ class targetCommandTestCase(TestBase): # rdar://problem/9763907 # 'target variable' command fails if the target program has been run +@expectedFailureAndroid(archs=['aarch64']) def test_target_variable_command(self): """Test 'target variable' command before and after starting the inferior.""" d = {'C_SOURCES': 'globals.c', 'EXE': 'globals'} @@ -45,6 +46,7 @@ class targetCommandTestCase(TestBase): self.do_target_variable_command('globals') +@expectedFailureAndroid(archs=['aarch64']) def test_target_variable_command_no_fail(self): """Test 'target variable' command before and after starting the inferior.""" d = {'C_SOURCES': 'globals.c', 'EXE': 'globals'} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13288: Restrict the scope of a hack in DYLDRendezvous
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. looks good Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp:421 @@ +420,3 @@ +uint32_t os_major = 0, os_minor = 0, os_update = 0; +if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && +m_process->GetTarget().GetPlatform()->GetOSVersion(os_major, os_minor, os_update) && This is condition is getting quite complicated. Consider putting it in a function (`bool isBaseAddressBuggy(string file)` perhaps?). http://reviews.llvm.org/D13288 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13245: Add support for .ARM.exidx unwind information
tberghammer marked an inline comment as done. Comment at: source/Symbol/ArmUnwindInfo.cpp:62 @@ +61,3 @@ +static uint64_t +GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) +{ labath wrote: > Is there a reason DataExtractor::GetULEB128 could not be reused? DataExtractor is reading from a stream of bytes while the arm unwind info is encoded in a bit more complicated (and strange way). It is encoded as a list of 4 byte words and then the 1 byte values have to be read from it from the MSB byte to the LSB byte what isn't match with the order used by the DataExtractor. http://reviews.llvm.org/D13245 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248903 - Add support for .ARM.exidx unwind information
Author: tberghammer Date: Wed Sep 30 08:50:14 2015 New Revision: 248903 URL: http://llvm.org/viewvc/llvm-project?rev=248903&view=rev Log: Add support for .ARM.exidx unwind information .ARM.exidx/.ARM.extab sections contain unwind information used on ARM architecture from unwinding from an exception. Differential revision: http://reviews.llvm.org/D13245 Added: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h lldb/trunk/source/Symbol/ArmUnwindInfo.cpp Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h lldb/trunk/include/lldb/Symbol/UnwindTable.h lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Symbol/CMakeLists.txt lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Symbol/UnwindTable.cpp lldb/trunk/source/Utility/ConvertEnum.cpp Added: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h?rev=248903&view=auto == --- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h (added) +++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h Wed Sep 30 08:50:14 2015 @@ -0,0 +1,55 @@ +//===-- ArmUnwindInfo.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_ArmUnwindInfo_h_ +#define liblldb_ArmUnwindInfo_h_ + +#include + +#include "lldb/Core/DataExtractor.h" +#include "lldb/Core/RangeMap.h" +#include "lldb/Host/Mutex.h" +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/lldb-private.h" + +/* + * Unwind information reader and parser for the ARM exception handling ABI + * + * Implemented based on: + * Exception Handling ABI for the ARM Architecture + * Document number: ARM IHI 0038A (current through ABI r2.09) + * Date of Issue: 25th January 2007, reissued 30th November 2012 + * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf + */ + +namespace lldb_private { + +class ArmUnwindInfo +{ +public: +ArmUnwindInfo (ObjectFile& objfile, lldb::SectionSP& arm_exidx, lldb::SectionSP& arm_extab); +~ArmUnwindInfo(); + +bool +GetUnwindPlan (Target &target, const Address& addr, UnwindPlan& unwind_plan); + +private: +const uint8_t* +GetExceptionHandlingTableEntry(const Address& addr); + +lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section +lldb::SectionSP m_arm_extab_sp; // .ARM.extab section + +DataExtractor m_arm_exidx_data; // .ARM.exidx section data +DataExtractor m_arm_extab_data; // .ARM.extab section data +}; + +} // namespace lldb_private + +#endif // liblldb_ArmUnwindInfo_h_ Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=248903&r1=248902&r2=248903&view=diff == --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original) +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Wed Sep 30 08:50:14 2015 @@ -103,6 +103,9 @@ public: GetCompactUnwindUnwindPlan (Target &target, int current_offset); lldb::UnwindPlanSP +GetArmUnwindUnwindPlan (Target &target, int current_offset); + +lldb::UnwindPlanSP GetArchDefaultUnwindPlan (Thread &thread); lldb::UnwindPlanSP @@ -122,6 +125,7 @@ private: lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp; lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by assembly inspection so it's valid everywhere std::vector m_unwind_plan_compact_unwind; +lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp; lldb::UnwindPlanSP m_unwind_plan_fast_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp; @@ -132,6 +136,7 @@ private: m_tried_unwind_plan_eh_frame:1, m_tried_unwind_plan_eh_frame_augmented:1, m_tried_unwind_plan_compact_unwind:1, + m_tried_unwind_plan_arm_unwind:1, m_tried_unwind_fast:1, m_tried_unwind_arch_default:1, m_tried_unwind_arch_default_at_func_entry:1; Modified: lldb/trunk/include/lldb/Symbol/UnwindTable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindTable.h?rev=248903&r1=24890
Re: [Lldb-commits] [PATCH] D13245: Add support for .ARM.exidx unwind information
This revision was automatically updated to reflect the committed changes. Closed by commit rL248903: Add support for .ARM.exidx unwind information (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D13245?vs=35970&id=36101#toc Repository: rL LLVM http://reviews.llvm.org/D13245 Files: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h lldb/trunk/include/lldb/Symbol/FuncUnwinders.h lldb/trunk/include/lldb/Symbol/UnwindTable.h lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Symbol/ArmUnwindInfo.cpp lldb/trunk/source/Symbol/CMakeLists.txt lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Symbol/UnwindTable.cpp lldb/trunk/source/Utility/ConvertEnum.cpp Index: lldb/trunk/include/lldb/lldb-enumerations.h === --- lldb/trunk/include/lldb/lldb-enumerations.h +++ lldb/trunk/include/lldb/lldb-enumerations.h @@ -616,6 +616,8 @@ eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section eSectionTypeEHFrame, +eSectionTypeARMexidx, +eSectionTypeARMextab, eSectionTypeCompactUnwind,// compact unwind section in Mach-O, __TEXT,__unwind_info eSectionTypeGoSymtab, eSectionTypeOther Index: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h === --- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h +++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h @@ -0,0 +1,55 @@ +//===-- ArmUnwindInfo.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_ArmUnwindInfo_h_ +#define liblldb_ArmUnwindInfo_h_ + +#include + +#include "lldb/Core/DataExtractor.h" +#include "lldb/Core/RangeMap.h" +#include "lldb/Host/Mutex.h" +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/lldb-private.h" + +/* + * Unwind information reader and parser for the ARM exception handling ABI + * + * Implemented based on: + * Exception Handling ABI for the ARM Architecture + * Document number: ARM IHI 0038A (current through ABI r2.09) + * Date of Issue: 25th January 2007, reissued 30th November 2012 + * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf + */ + +namespace lldb_private { + +class ArmUnwindInfo +{ +public: +ArmUnwindInfo (ObjectFile& objfile, lldb::SectionSP& arm_exidx, lldb::SectionSP& arm_extab); +~ArmUnwindInfo(); + +bool +GetUnwindPlan (Target &target, const Address& addr, UnwindPlan& unwind_plan); + +private: +const uint8_t* +GetExceptionHandlingTableEntry(const Address& addr); + +lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section +lldb::SectionSP m_arm_extab_sp; // .ARM.extab section + +DataExtractor m_arm_exidx_data; // .ARM.exidx section data +DataExtractor m_arm_extab_data; // .ARM.extab section data +}; + +} // namespace lldb_private + +#endif // liblldb_ArmUnwindInfo_h_ Index: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h === --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h @@ -103,6 +103,9 @@ GetCompactUnwindUnwindPlan (Target &target, int current_offset); lldb::UnwindPlanSP +GetArmUnwindUnwindPlan (Target &target, int current_offset); + +lldb::UnwindPlanSP GetArchDefaultUnwindPlan (Thread &thread); lldb::UnwindPlanSP @@ -122,6 +125,7 @@ lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp; lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by assembly inspection so it's valid everywhere std::vector m_unwind_plan_compact_unwind; +lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp; lldb::UnwindPlanSP m_unwind_plan_fast_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp; @@ -132,6 +136,7 @@ m_tried_unwind_plan_eh_frame:1, m_tried_unwind_plan_eh_frame_augmented:1, m_tried_unwind_plan_compact_unwind:1, + m_tried_unwind_plan_arm_unwind:1, m_tried_unwind_fast:1, m_tried_unwind_arch_default:1, m_tried_unwind_arch_default_
[Lldb-commits] [PATCH] D13291: Make the ArmUnwindInfo parsing code endian independent
tberghammer created this revision. tberghammer added a reviewer: labath. tberghammer added a subscriber: lldb-commits. Herald added subscribers: rengolin, aemerson. Make the ArmUnwindInfo parsing code endian independent http://reviews.llvm.org/D13291 Files: include/lldb/Symbol/ArmUnwindInfo.h source/Symbol/ArmUnwindInfo.cpp Index: source/Symbol/ArmUnwindInfo.cpp === --- source/Symbol/ArmUnwindInfo.cpp +++ source/Symbol/ArmUnwindInfo.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" +#include "lldb/Host/Endian.h" #include "lldb/Symbol/ArmUnwindInfo.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/UnwindPlan.h" @@ -38,7 +39,10 @@ }; }; -ArmUnwindInfo::ArmUnwindInfo(ObjectFile& objfile, SectionSP& arm_exidx, SectionSP& arm_extab) : +ArmUnwindInfo::ArmUnwindInfo(const ObjectFile& objfile, + SectionSP& arm_exidx, + SectionSP& arm_extab) : +m_objfile(objfile), m_arm_exidx_sp(arm_exidx), m_arm_extab_sp(arm_extab) { @@ -50,22 +54,26 @@ { } -static uint8_t -GetNextByte(const uint32_t* data, uint16_t offset) +// Read a byte from the unwind instruction stream with the given offset. +// Custome function is required because have to red in order of significance within their containing +// word (most significant byte first) and in increasing word address order. +uint8_t +ArmUnwindInfo::GetByteAtOffset(const uint32_t* data, uint16_t offset) const { -data += offset / 4; -offset = offset % 4; -return (data[0] >> ((3 - offset) * 8)) & 0xff; +uint32_t value = data[offset / 4]; +if (m_objfile.GetByteOrder() != endian::InlHostByteOrder()) +value = llvm::ByteSwap_32(value); +return (data[0] >> ((3 - (offset % 4)) * 8)) & 0xff; } -static uint64_t -GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) +uint64_t +ArmUnwindInfo::GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const { uint64_t result = 0; uint8_t shift = 0; while (offset < max_offset) { -uint8_t byte = GetNextByte(data, offset++); +uint8_t byte = GetByteAtOffset(data, offset++); result |= (byte & 0x7f) << shift; if ((byte & 0x80) == 0) break; @@ -116,7 +124,7 @@ while (byte_offset < byte_count) { -uint8_t byte1 = GetNextByte(data, byte_offset++); +uint8_t byte1 = GetByteAtOffset(data, byte_offset++); if ((byte1&0xc0) == 0x00) { // 00xx @@ -134,7 +142,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); if (byte1 == 0x80 && byte2 == 0) { // 1000 @@ -210,7 +218,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); if ((byte2&0xff) == 0x00) { // 10110001 @@ -251,7 +259,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) @@ -305,7 +313,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) @@ -321,7 +329,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) Index: include/lldb/Symbol/ArmUnwindInfo.h === --- include/lldb/Symbol/ArmUnwindInfo.h +++ include/lldb/Symbol/ArmUnwindInfo.h @@ -33,19 +33,28 @@ class ArmUnwindInfo { public: -ArmUnwindInfo (ObjectFile& objfile, lldb::SectionSP& arm_exidx, lldb::SectionSP& arm_extab); +ArmUnwindInfo(const ObjectFile& objfile, + lldb::SectionSP& arm_exidx, + lldb::SectionSP& arm_extab); + ~ArmUnwindInfo(); bool -GetUnwindPlan (Target &target, const Address& addr, UnwindPlan& unwind_plan); +GetUnwindPlan(Target &target, c
[Lldb-commits] [lldb] r248908 - Fix xcode build after rL248903
Author: tberghammer Date: Wed Sep 30 09:55:08 2015 New Revision: 248908 URL: http://llvm.org/viewvc/llvm-project?rev=248908&view=rev Log: Fix xcode build after rL248903 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=248908&r1=248907&r2=248908&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Sep 30 09:55:08 2015 @@ -713,6 +713,7 @@ 6D95DC001B9DC057000E318A /* DIERef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFD1B9DC057000E318A /* DIERef.cpp */; }; 6D95DC011B9DC057000E318A /* HashedNameToDIE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFE1B9DC057000E318A /* HashedNameToDIE.cpp */; }; 6D95DC021B9DC057000E318A /* SymbolFileDWARFDwo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFF1B9DC057000E318A /* SymbolFileDWARFDwo.cpp */; }; + 6D99A3631BBC2F3200979793 /* ArmUnwindInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D99A3621BBC2F3200979793 /* ArmUnwindInfo.cpp */; }; 8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; }; 8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; }; 8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; }; @@ -2403,6 +2404,8 @@ 6D95DBFF1B9DC057000E318A /* SymbolFileDWARFDwo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFileDWARFDwo.cpp; sourceTree = ""; }; 6D95DC031B9DC06F000E318A /* DIERef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DIERef.h; sourceTree = ""; }; 6D95DC041B9DC06F000E318A /* SymbolFileDWARFDwo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileDWARFDwo.h; sourceTree = ""; }; + 6D99A3611BBC2F1600979793 /* ArmUnwindInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ArmUnwindInfo.h; path = include/lldb/Symbol/ArmUnwindInfo.h; sourceTree = ""; }; + 6D99A3621BBC2F3200979793 /* ArmUnwindInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArmUnwindInfo.cpp; path = source/Symbol/ArmUnwindInfo.cpp; sourceTree = ""; }; 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryHistory.cpp; path = source/Target/MemoryHistory.cpp; sourceTree = ""; }; 8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; path = include/lldb/Target/MemoryHistory.h; sourceTree = ""; }; 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryHistoryASan.cpp; sourceTree = ""; }; @@ -4207,6 +4210,8 @@ 26BC7C4B10F1B6C100F91463 /* Symbol */ = { isa = PBXGroup; children = ( + 6D99A3621BBC2F3200979793 /* ArmUnwindInfo.cpp */, + 6D99A3611BBC2F1600979793 /* ArmUnwindInfo.h */, 26BC7C5510F1B6E900F91463 /* Block.h */, 26BC7F1310F1B8EC00F91463 /* Block.cpp */, 26BC7C5610F1B6E900F91463 /* ClangASTContext.h */, @@ -6289,6 +6294,7 @@ 4984BA161B979973008658D4 /* ExpressionVariable.cpp in Sources */, 2689004C13353E0400698AC0 /* SourceManager.cpp in Sources */, 2689004D13353E0400698AC0 /* State.cpp in Sources */, + 6D99A3631BBC2F3200979793 /* ArmUnwindInfo.cpp in Sources */, 4984BA131B978C55008658D4 /* ClangExpressionVariable.cpp in Sources */, 3F81691A1ABA2419001DA9DF /* NameMatches.cpp in Sources */, AF0E22F018A09FB20009B7D1 /* AppleGetItemInfoHandler.cpp in Sources */, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248909 - Removed an unused member variable. Affects Windows only.
Author: amccarth Date: Wed Sep 30 09:57:21 2015 New Revision: 248909 URL: http://llvm.org/viewvc/llvm-project?rev=248909&view=rev Log: Removed an unused member variable. Affects Windows only. Modified: lldb/trunk/source/Plugins/Process/Windows/Live/TargetThreadWindows.h Modified: lldb/trunk/source/Plugins/Process/Windows/Live/TargetThreadWindows.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Live/TargetThreadWindows.h?rev=248909&r1=248908&r2=248909&view=diff == --- lldb/trunk/source/Plugins/Process/Windows/Live/TargetThreadWindows.h (original) +++ lldb/trunk/source/Plugins/Process/Windows/Live/TargetThreadWindows.h Wed Sep 30 09:57:21 2015 @@ -48,8 +48,6 @@ class TargetThreadWindows : public lldb_ private: lldb::RegisterContextSP CreateRegisterContextForFrameIndex(uint32_t idx); -lldb::StackFrameUP m_stack_frame; - HostThread m_host_thread; }; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13291: Make the ArmUnwindInfo parsing code endian independent
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Looks good, after fixing some typos. Comment at: include/lldb/Symbol/ArmUnwindInfo.h:55 @@ -46,1 +54,3 @@ + +const ObjectFile& m_objfile; lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section For consideration: storing just the byte order instead of the whole ObjectFile. (if it's clear that the ObjectFile object outlives this object then I'm fine with this also). Comment at: source/Symbol/ArmUnwindInfo.cpp:58 @@ +57,3 @@ +// Read a byte from the unwind instruction stream with the given offset. +// Custome function is required because have to red in order of significance within their containing +// word (most significant byte first) and in increasing word address order. s/Custome/Custom/ s/red/read/ Comment at: source/Symbol/ArmUnwindInfo.cpp:66 @@ -59,1 +65,3 @@ +value = llvm::ByteSwap_32(value); +return (data[0] >> ((3 - (offset % 4)) * 8)) & 0xff; } s/data[0]/value ? http://reviews.llvm.org/D13291 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13291: Make the ArmUnwindInfo parsing code endian independent
This revision was automatically updated to reflect the committed changes. tberghammer marked 2 inline comments as done. Closed by commit rL248910: Make the ArmUnwindInfo parsing code endian independent (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D13291?vs=36103&id=36108#toc Repository: rL LLVM http://reviews.llvm.org/D13291 Files: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h lldb/trunk/source/Symbol/ArmUnwindInfo.cpp Index: lldb/trunk/source/Symbol/ArmUnwindInfo.cpp === --- lldb/trunk/source/Symbol/ArmUnwindInfo.cpp +++ lldb/trunk/source/Symbol/ArmUnwindInfo.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" +#include "lldb/Host/Endian.h" #include "lldb/Symbol/ArmUnwindInfo.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/UnwindPlan.h" @@ -38,7 +39,10 @@ }; }; -ArmUnwindInfo::ArmUnwindInfo(ObjectFile& objfile, SectionSP& arm_exidx, SectionSP& arm_extab) : +ArmUnwindInfo::ArmUnwindInfo(const ObjectFile& objfile, + SectionSP& arm_exidx, + SectionSP& arm_extab) : +m_byte_order(objfile.GetByteOrder()), m_arm_exidx_sp(arm_exidx), m_arm_extab_sp(arm_extab) { @@ -50,22 +54,26 @@ { } -static uint8_t -GetNextByte(const uint32_t* data, uint16_t offset) +// Read a byte from the unwind instruction stream with the given offset. +// Custom function is required because have to red in order of significance within their containing +// word (most significant byte first) and in increasing word address order. +uint8_t +ArmUnwindInfo::GetByteAtOffset(const uint32_t* data, uint16_t offset) const { -data += offset / 4; -offset = offset % 4; -return (data[0] >> ((3 - offset) * 8)) & 0xff; +uint32_t value = data[offset / 4]; +if (m_byte_order != endian::InlHostByteOrder()) +value = llvm::ByteSwap_32(value); +return (value >> ((3 - (offset % 4)) * 8)) & 0xff; } -static uint64_t -GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) +uint64_t +ArmUnwindInfo::GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const { uint64_t result = 0; uint8_t shift = 0; while (offset < max_offset) { -uint8_t byte = GetNextByte(data, offset++); +uint8_t byte = GetByteAtOffset(data, offset++); result |= (byte & 0x7f) << shift; if ((byte & 0x80) == 0) break; @@ -116,7 +124,7 @@ while (byte_offset < byte_count) { -uint8_t byte1 = GetNextByte(data, byte_offset++); +uint8_t byte1 = GetByteAtOffset(data, byte_offset++); if ((byte1&0xc0) == 0x00) { // 00xx @@ -134,7 +142,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); if (byte1 == 0x80 && byte2 == 0) { // 1000 @@ -210,7 +218,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); if ((byte2&0xff) == 0x00) { // 10110001 @@ -251,7 +259,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) @@ -305,7 +313,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) @@ -321,7 +329,7 @@ if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); uint8_t s = (byte2&0xf0) >> 4; uint8_t c = (byte2&0x0f) >> 0; for (uint8_t i = 0; i <= c; ++i) Index: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h === --- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h +++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h @@ -33,19 +33,28 @@ class ArmUnwindInfo { public: -ArmUnwindInfo (ObjectFile& objfile, lldb::SectionSP& arm_exidx, lldb::SectionSP& arm_extab); +ArmUnwindInfo(const ObjectFile& objfile, + lldb::SectionSP& arm_exidx,
[Lldb-commits] [lldb] r248910 - Make the ArmUnwindInfo parsing code endian independent
Author: tberghammer Date: Wed Sep 30 10:17:06 2015 New Revision: 248910 URL: http://llvm.org/viewvc/llvm-project?rev=248910&view=rev Log: Make the ArmUnwindInfo parsing code endian independent Differential revision: http://reviews.llvm.org/D13291 Modified: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h lldb/trunk/source/Symbol/ArmUnwindInfo.cpp Modified: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h?rev=248910&r1=248909&r2=248910&view=diff == --- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h (original) +++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h Wed Sep 30 10:17:06 2015 @@ -33,19 +33,28 @@ namespace lldb_private { class ArmUnwindInfo { public: -ArmUnwindInfo (ObjectFile& objfile, lldb::SectionSP& arm_exidx, lldb::SectionSP& arm_extab); +ArmUnwindInfo(const ObjectFile& objfile, + lldb::SectionSP& arm_exidx, + lldb::SectionSP& arm_extab); + ~ArmUnwindInfo(); bool -GetUnwindPlan (Target &target, const Address& addr, UnwindPlan& unwind_plan); +GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan); private: const uint8_t* GetExceptionHandlingTableEntry(const Address& addr); - + +uint8_t +GetByteAtOffset(const uint32_t* data, uint16_t offset) const; + +uint64_t +GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const; + +const lldb::ByteOrder m_byte_order; lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section lldb::SectionSP m_arm_extab_sp; // .ARM.extab section - DataExtractor m_arm_exidx_data; // .ARM.exidx section data DataExtractor m_arm_extab_data; // .ARM.extab section data }; Modified: lldb/trunk/source/Symbol/ArmUnwindInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ArmUnwindInfo.cpp?rev=248910&r1=248909&r2=248910&view=diff == --- lldb/trunk/source/Symbol/ArmUnwindInfo.cpp (original) +++ lldb/trunk/source/Symbol/ArmUnwindInfo.cpp Wed Sep 30 10:17:06 2015 @@ -11,6 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" +#include "lldb/Host/Endian.h" #include "lldb/Symbol/ArmUnwindInfo.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/UnwindPlan.h" @@ -38,7 +39,10 @@ namespace }; }; -ArmUnwindInfo::ArmUnwindInfo(ObjectFile& objfile, SectionSP& arm_exidx, SectionSP& arm_extab) : +ArmUnwindInfo::ArmUnwindInfo(const ObjectFile& objfile, + SectionSP& arm_exidx, + SectionSP& arm_extab) : +m_byte_order(objfile.GetByteOrder()), m_arm_exidx_sp(arm_exidx), m_arm_extab_sp(arm_extab) { @@ -50,22 +54,26 @@ ArmUnwindInfo::~ArmUnwindInfo() { } -static uint8_t -GetNextByte(const uint32_t* data, uint16_t offset) +// Read a byte from the unwind instruction stream with the given offset. +// Custom function is required because have to red in order of significance within their containing +// word (most significant byte first) and in increasing word address order. +uint8_t +ArmUnwindInfo::GetByteAtOffset(const uint32_t* data, uint16_t offset) const { -data += offset / 4; -offset = offset % 4; -return (data[0] >> ((3 - offset) * 8)) & 0xff; +uint32_t value = data[offset / 4]; +if (m_byte_order != endian::InlHostByteOrder()) +value = llvm::ByteSwap_32(value); +return (value >> ((3 - (offset % 4)) * 8)) & 0xff; } -static uint64_t -GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) +uint64_t +ArmUnwindInfo::GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const { uint64_t result = 0; uint8_t shift = 0; while (offset < max_offset) { -uint8_t byte = GetNextByte(data, offset++); +uint8_t byte = GetByteAtOffset(data, offset++); result |= (byte & 0x7f) << shift; if ((byte & 0x80) == 0) break; @@ -116,7 +124,7 @@ ArmUnwindInfo::GetUnwindPlan(Target &tar while (byte_offset < byte_count) { -uint8_t byte1 = GetNextByte(data, byte_offset++); +uint8_t byte1 = GetByteAtOffset(data, byte_offset++); if ((byte1&0xc0) == 0x00) { // 00xx @@ -134,7 +142,7 @@ ArmUnwindInfo::GetUnwindPlan(Target &tar if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextByte(data, byte_offset++); +uint8_t byte2 = GetByteAtOffset(data, byte_offset++); if (byte1 == 0x80 && byte2 == 0) { // 1000 @@ -210,7 +218,7 @@ ArmUnwindInfo::GetUnwindPlan(Target &tar if (byte_offset >= byte_count) return false; -uint8_t byte2 = GetNextBy
Re: [Lldb-commits] [PATCH] D13282: [MIPS] Emulate microMIPS instructions
tberghammer accepted this revision. tberghammer added a comment. This revision is now accepted and ready to land. LGTM Comment at: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp:683 @@ +682,3 @@ + +if (m_use_alt_disaasm == true) +decode_status = m_alt_disasm->getInstruction (mc_insn, next_inst_size, raw_insn, inst_addr, llvm::nulls(), llvm::nulls()); (nit): "if (m_use_alt_disaasm)" Comment at: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp:775 @@ -660,2 +774,3 @@ llvm::ArrayRef raw_insn (data.GetDataStart(), data.GetByteSize()); -decode_status = m_disasm->getInstruction (mc_insn, insn_size, raw_insn, m_addr, llvm::nulls(), llvm::nulls()); +if (m_use_alt_disaasm == true) +decode_status = m_alt_disasm->getInstruction (mc_insn, insn_size, raw_insn, m_addr, llvm::nulls(), llvm::nulls()); (nit): "if (m_use_alt_disaasm)" Comment at: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp:848-849 @@ -729,4 +847,4 @@ // Our previous PC is in the RA row->SetRegisterLocationToRegister(dwarf_pc_mips, dwarf_ra_mips, can_replace); You don't need this if you use SetReturnAddressRegister Repository: rL LLVM http://reviews.llvm.org/D13282 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13293: Trim the output of mktem in PlatformAndroid::DownloadSymbolFile
tberghammer created this revision. tberghammer added a reviewer: ovyalov. tberghammer added a subscriber: lldb-commits. Herald added subscribers: danalbert, tberghammer. Trim the output of mktem in PlatformAndroid::DownloadSymbolFile http://reviews.llvm.org/D13293 Files: source/Plugins/Platform/Android/PlatformAndroid.cpp Index: source/Plugins/Platform/Android/PlatformAndroid.cpp === --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -331,7 +331,7 @@ Error error = adb.Shell("mktemp --directory --tmpdir /data/local/tmp", 5000 /* ms */, &tmpdir); if (error.Fail() || tmpdir.empty()) return Error("Failed to generate temporary directory on the device (%s)", error.AsCString()); -tmpdir.erase(tmpdir.size() - 1); // Remove trailing new line +tmpdir = llvm::StringRef(tmpdir).trim().str(); // Create file remover for the temporary directory created on the device std::unique_ptr> tmpdir_remover( Index: source/Plugins/Platform/Android/PlatformAndroid.cpp === --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -331,7 +331,7 @@ Error error = adb.Shell("mktemp --directory --tmpdir /data/local/tmp", 5000 /* ms */, &tmpdir); if (error.Fail() || tmpdir.empty()) return Error("Failed to generate temporary directory on the device (%s)", error.AsCString()); -tmpdir.erase(tmpdir.size() - 1); // Remove trailing new line +tmpdir = llvm::StringRef(tmpdir).trim().str(); // Create file remover for the temporary directory created on the device std::unique_ptr> tmpdir_remover( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13162: Change oat symbolization code for android to work on non-rooted devices
I haven't managed to reproduce the issue you reported (what OS and Android version do you use?), but based on the description this change (not committed in yet) might fix the issue: http://reviews.llvm.org/D13293. Can you take a look? Thanks, Tamas On Wed, Sep 30, 2015 at 12:49 AM Oleksiy Vyalov wrote: > ovyalov added inline comments. > > > Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:341 > @@ -347,1 +340,3 @@ > +AdbClient adb(m_device_id); > + > StreamString command; > > I tried this CL on my device and it's failing to download a symbol file - > "Failed to pull file: No such file or directory". As I can see tmpdir isn't > fully cleared from tail symbols, like \r\n > > > Repository: > rL LLVM > > http://reviews.llvm.org/D13162 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12968: Fix for lldb-mi crash in Listener code if -exec-abort MI command was invoked without getting process stopped
labath added a comment. This is definitely not a proper fix for this problem, it merely sweeps the problem under the carpet. If something like this makes a difference then it means something has gone horribly wrong a long time ago. I haven't been able to reproduce this locally, but I'd recommend trying to set up some memory-allocation/thread-race checker and see what it produces. I still think the original solution of hijacking the listener was correct, but we need to figure out what is the right point at which to hijack it. I'll try to look into this when I get a bit of time. Repository: rL LLVM http://reviews.llvm.org/D12968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13234: Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator
Ok, looks good On Wed, Sep 30, 2015 at 12:27 AM Vadim Macagon wrote: > enlight updated this revision to Diff 36072. > enlight added a comment. > This revision is now accepted and ready to land. > > Added an explanation of the generator expression used in this patch. > > > Repository: > rL LLVM > > http://reviews.llvm.org/D13234 > > Files: > cmake/modules/LLDBConfig.cmake > > Index: cmake/modules/LLDBConfig.cmake > === > --- cmake/modules/LLDBConfig.cmake > +++ cmake/modules/LLDBConfig.cmake > @@ -48,15 +48,39 @@ >if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") > if (NOT "${PYTHON_HOME}" STREQUAL "") >file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME) > - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") > -file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" > PYTHON_EXECUTABLE) > -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" > PYTHON_LIBRARY) > -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DLL) > - else() > -file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXECUTABLE) > -file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" > PYTHON_LIBRARY) > -file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL) > - endif() > + file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE) > + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" > PYTHON_DEBUG_LIB) > + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DEBUG_DLL) > + > + file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE) > + file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" > PYTHON_RELEASE_LIB) > + file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_RELEASE_DLL) > + > + # Generator expressions are evaluated in the context of each build > configuration generated > + # by CMake. Here we use the $:VALUE logical generator > expression to ensure > + # that the debug Python library, DLL, and executable are used in > the Debug build configuration. > + # > + # Generator expressions can be difficult to grok at first so here's > a breakdown of the one > + # used for PYTHON_LIBRARY: > + # > + # 1. $ evaluates to 1 when the Debug configuration is > being generated, > + #or 0 in all other cases. > + # 2. $<$:${PYTHON_DEBUG_LIB}> expands to > ${PYTHON_DEBUG_LIB} when the Debug > + #configuration is being generated, or nothing (literally) in > all other cases. > + # 3. $<$>:${PYTHON_RELEASE_LIB}> expands to > ${PYTHON_RELEASE_LIB} when > + #any configuration other than Debug is being generated, or > nothing in all other cases. > + # 4. The conditionals in 2 & 3 are mutually exclusive. > + # 5. A logical expression with a conditional that evaluates to 0 > yields no value at all. > + # > + # Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a > single value specific to each > + # build configuration. In this example the value will be > ${PYTHON_DEBUG_LIB} when generating the > + # Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any > other configuration. > + # Note that it's imperative that there is no whitespace between the > two expressions, otherwise > + # CMake will insert a semicolon between the two. > + > + set (PYTHON_EXECUTABLE > $<$:${PYTHON_DEBUG_EXE}>$<$>:${PYTHON_RELEASE_EXE}>) > + set (PYTHON_LIBRARY > $<$:${PYTHON_DEBUG_LIB}>$<$>:${PYTHON_RELEASE_LIB}>) > + set (PYTHON_DLL > $<$:${PYTHON_DEBUG_DLL}>$<$>:${PYTHON_RELEASE_DLL}>) > >file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR) >if (NOT LLDB_RELOCATABLE_PYTHON) > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13241: [LLDB][MIPS] Fix hit_count for mips watchpoints
zturner added a comment. Ahh, so the test was already failing and you're just fixing it? That's fine then, thanks. Repository: rL LLVM http://reviews.llvm.org/D13241 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13241: [LLDB][MIPS] Fix hit_count for mips watchpoints
Ahh, so the test was already failing and you're just fixing it? That's fine then, thanks. On Tue, Sep 29, 2015 at 11:24 PM Jason Molenda wrote: > jasonmolenda added a comment. > > I see, this seems reasonable to me. > > > Repository: > rL LLVM > > http://reviews.llvm.org/D13241 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13296: [LLDB] Fix watchpoint ignore feature for architectures with watchpoint_exceptions_received=before
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: clayborg, jingham. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. For archs like MIPS, where watchpoints are triggered before associated instruction runs, we need to disable watchpoint, single step and re-enable watchpoint, so that process resumes without reporting same watchpoint. This is provided by code at Target/StopInfo.cpp:719 But if we check for ignore_count condition before this functionality, it reports same watchpoint again and again and gets ignored before ignore condition gets false. So shifting this condition to appropriate location. This solves TestWatchpointIgnoreCount.py testcase for MIPS. Repository: rL LLVM http://reviews.llvm.org/D13296 Files: source/Breakpoint/Watchpoint.cpp source/Target/StopInfo.cpp Index: source/Target/StopInfo.cpp === --- source/Target/StopInfo.cpp +++ source/Target/StopInfo.cpp @@ -759,6 +759,9 @@ if (!wp_hit_sp) m_should_stop = false; } + +if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) +m_should_stop = false; if (m_should_stop && wp_sp->GetConditionText() != NULL) { Index: source/Breakpoint/Watchpoint.cpp === --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -190,9 +190,6 @@ if (!IsEnabled()) return false; -if (GetHitCount() <= GetIgnoreCount()) -return false; - return true; } Index: source/Target/StopInfo.cpp === --- source/Target/StopInfo.cpp +++ source/Target/StopInfo.cpp @@ -759,6 +759,9 @@ if (!wp_hit_sp) m_should_stop = false; } + +if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) +m_should_stop = false; if (m_should_stop && wp_sp->GetConditionText() != NULL) { Index: source/Breakpoint/Watchpoint.cpp === --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -190,9 +190,6 @@ if (!IsEnabled()) return false; -if (GetHitCount() <= GetIgnoreCount()) -return false; - return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
KLapshin added inline comments. Comment at: test/tools/lldb-mi/control/TestMiExec.py:16 @@ +15,3 @@ +@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented +def test_lldbmi_exec_run(self): +"""Test that 'lldb-mi --interpreter' can stop at entry.""" KLapshin wrote: > ki.stfu wrote: > > This test doesn't pass on Linux due to missing *stopped notification: > > ``` > > $ bin/lldb-mi echo > > (gdb) > > -file-exec-and-symbols "echo" > > ^done > > (gdb) > > =library-loaded,id="/bin/echo",target-name="/bin/echo",host-name="/bin/echo",symbols-loaded="0",loaded_addr="-",size="0" > > -exec-run --start > > ^running > > =thread-group-started,id="i1",pid="28031" > > (gdb) > > =thread-created,id="1",group-id="i1" > > =thread-selected,id="1" > > (gdb) > > =library-loaded,id="/bin/echo",target-name="/bin/echo",host-name="/bin/echo",symbols-loaded="0",loaded_addr="-",size="0" > > process status > > Process 28031 stopped > > * thread #1: tid = 28031, 0x77dd9cd0, name = 'echo', stop reason = > > signal SIGSTOP > > frame #0: 0x77dd9cd0 > > -> 0x77dd9cd0: movq %rsp, %rdi > > 0x77dd9cd3: callq 0x77dddc30 > > 0x77dd9cd8: movq %rax, %r12 > > 0x77dd9cdb: movl 0x22310f(%rip), %eax > > ^done > > (gdb) > > ``` > > > > You can XFAIL this test case with the link to the corresponding issue on > > bug tracker (create a new one if needed). > Ilia, thank you for checking on Linux - I just don't have lldb Linux build on > hands yet, will setup it and do checks on Linux as well. > > Will mark test as expected to fail on Linux yet with reference to issue on > bug tracker. Bug about missing *stopped notification on Linux platform has been entered: https://llvm.org/bugs/show_bug.cgi?id=25000 Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
KLapshin updated this revision to Diff 36128. KLapshin added a comment. Test has been marked as XFAILed for Linux (x86_64) case. Repository: rL LLVM http://reviews.llvm.org/D12977 Files: test/tools/lldb-mi/control/TestMiExec.py tools/lldb-mi/MICmdCmdExec.cpp tools/lldb-mi/MICmdCmdExec.h tools/lldb-mi/MICmdCmdSupportList.cpp Index: tools/lldb-mi/MICmdCmdExec.cpp === --- tools/lldb-mi/MICmdCmdExec.cpp +++ tools/lldb-mi/MICmdCmdExec.cpp @@ -48,6 +48,7 @@ // Throws: None. //-- CMICmdCmdExecRun::CMICmdCmdExecRun() +: m_constStrArgStart("start") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-run"; @@ -68,6 +69,23 @@ } //++ +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type:Overridden. +// Args:None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. +//-- +bool +CMICmdCmdExecRun::ParseArgs() +{ +m_setCmdArgs.Add( +new CMICmdArgValOptionLong(m_constStrArgStart, false, true, CMICmdArgValListBase::eArgValType_OptionLong, 0)); +return ParseValidateCmdOptions(); +} + +//++ // Details: The invoker requires this function. The command does work in this function. // The command is likely to communicate with the LLDB SBDebugger in here. // Type:Overridden. @@ -84,6 +102,15 @@ lldb::SBStream errMsg; lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo(); launchInfo.SetListener(rSessionInfo.GetListener()); + +CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart); + +// Run to first instruction or main() requested ? +if (pArgStart->GetFound()) +{ +launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() | lldb::eLaunchFlagStopAtEntry); +} + lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error); if ((!process.IsValid()) || (error.Fail())) { @@ -103,6 +130,7 @@ //++ // Details: The invoker requires this function. The command prepares a MI Record Result // for the work carried out in the Execute(). +// Called only in case if Execute() set status as successful on completion. // Type:Overridden. // Args:None. // Return: MIstatus::success - Functional succeeded. @@ -112,31 +140,21 @@ bool CMICmdCmdExecRun::Acknowledge() { -if (m_lldbResult.GetErrorSize() > 0) -{ -const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); -const CMICmnMIValueResult miValueResult("message", miValueConst); -const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); -m_miResultRecord = miRecordResult; -} -else -{ -const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); -m_miResultRecord = miRecordResult; +const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); +m_miResultRecord = miRecordResult; -CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); -lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID(); -// Give the client '=thread-group-started,id="i1" pid="xyz"' -m_bHasResultRecordExtra = true; -const CMICmnMIValueConst miValueConst2("i1"); -const CMICmnMIValueResult miValueResult2("id", miValueConst2); -const CMIUtilString strPid(CMIUtilString::Format("%lld", pid)); -const CMICmnMIValueConst miValueConst(strPid); -const CMICmnMIValueResult miValueResult("pid", miValueConst); -CMICmnMIOutOfBandRecord miOutOfBand(CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2); -miOutOfBand.Add(miValueResult); -m_miResultRecordExtra = miOutOfBand.GetString(); -} +CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); +lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID(); +// Give the client '=thread-group-started,id="i1" pid="xyz"' +m_bHasResultRecordExtra = true; +const CMICmnMIValueConst miValueConst2("i1"); +const CMICmnMIValueResult miValueResult2("id", miValueConst2); +const CMIUtilString strPid(CMIUtilString::Format("%lld", pid)); +const CMICmnMIValueConst miValueConst(strPid); +const CMICmnMIValueResult miValueResult("pid", miValueConst); +CMICmnMIOutOfBandRecord miOutOfBand(CMICmnMIOutOfBandRecord::eOutOfBand_Th
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
KLapshin marked an inline comment as done. KLapshin added a comment. Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12968: Fix for lldb-mi crash in Listener code if -exec-abort MI command was invoked without getting process stopped
KLapshin added a comment. In http://reviews.llvm.org/D12968#256563, @labath wrote: > This is definitely not a proper fix for this problem, it merely sweeps the > problem under the carpet. If something like this makes a difference then it > means something has gone horribly wrong a long time ago. I haven't been able > to reproduce this locally, but I'd recommend trying to set up some > memory-allocation/thread-race checker and see what it produces. > > I still think the original solution of hijacking the listener was correct, > but we need to figure out what is the right point at which to hijack it. I'll > try to look into this when I get a bit of time. @labath, Yes, I even noticed what latest "fix" patch is just hint to fact what whole Process m_listener object looks like freed or unitialized memory - m_events collection size in Listener before crash happened looks invalid absolutely - random value, in my case about 8 millions events (!). This looks about threads race condition, so still investigating - slow because bit bust with other issues, excuse me. Repository: rL LLVM http://reviews.llvm.org/D12968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
KLapshin added inline comments. Comment at: test/tools/lldb-mi/control/TestMiExec.py:16 @@ +15,3 @@ +@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented +@expectedFailureAll("llvm.org/pr25000", oslist=["linux"]) +def test_lldbmi_exec_run(self): It looks like lldb-mi didn't received SIGSTOP evbent on Linux platform because event was not rebroadcasted because "Process::WaitForProcessToStop (timeout = (nil)) Process::WaitForProcessToStop returning without waiting for events; process private and public states are already 'stopped'. " - see full log (process, event channel) attached to llvm.org/pr25000 bug. Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13300: Run tests with dwo symbol files
tberghammer created this revision. tberghammer added reviewers: clayborg, tfiala, zturner, emaste, labath. tberghammer added a subscriber: lldb-commits. Herald added subscribers: srhines, danalbert, tberghammer. Run tests with dwo symbol file dwo symbol files are generated when code compiled with the "-gsplit-dwarf" command option (https://gcc.gnu.org/wiki/DebugFission). This CL modifies the test system to run tests with inferiors compile with the "-gsplit-dwarf" I tested "-gsplit-dwarf" on OSX, Linux and Android and there are no regression on these platform, for other platforms I have no access to at the moment but all recent compiler should support split dwarf (gcc 4.7+, clang 3.5+). If somebody know about configurations where split dwarf test should be disabled then please let me know, or disable them after commit by setting dont_do_dwo_test in dotest.py (see setting of dont_do_dsym_test in line 1520) http://reviews.llvm.org/D13300 Files: test/dotest.py test/dotest_args.py test/functionalities/dead-strip/TestDeadStrip.py test/lldbtest.py test/make/Makefile.rules test/plugins/builder_base.py Index: test/plugins/builder_base.py === --- test/plugins/builder_base.py +++ test/plugins/builder_base.py @@ -113,6 +113,17 @@ # True signifies that we can handle building dwarf. return True +def buildDwo(sender=None, architecture=None, compiler=None, dictionary=None, clean=True): +"""Build the binaries with dwarf debug info.""" +commands = [] +if clean: +commands.append([getMake(), "clean", getCmdLine(dictionary)]) +commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)]) + +lldbtest.system(commands, sender=sender) +# True signifies that we can handle building dwo. +return True + def cleanup(sender=None, dictionary=None): """Perform a platform-specific cleanup after the test.""" #import traceback Index: test/make/Makefile.rules === --- test/make/Makefile.rules +++ test/make/Makefile.rules @@ -185,6 +185,10 @@ CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS) endif +ifeq "$(MAKE_DWO)" "YES" + CFLAGS += -gsplit-dwarf +endif + CXXFLAGS += -std=c++11 CXXFLAGS += $(CFLAGS) LD = $(CC) Index: test/lldbtest.py === --- test/lldbtest.py +++ test/lldbtest.py @@ -567,6 +567,23 @@ wrapper.__dwarf_test__ = True return wrapper +def dwo_test(func): +"""Decorate the item as a dwo test.""" +if isinstance(func, type) and issubclass(func, unittest2.TestCase): +raise Exception("@dwo_test can only be used to decorate a test method") +@wraps(func) +def wrapper(self, *args, **kwargs): +try: +if lldb.dont_do_dwo_test: +self.skipTest("dwo tests") +except AttributeError: +pass +return func(self, *args, **kwargs) + +# Mark this function as such to separate them from the regular tests. +wrapper.__dwo_test__ = True +return wrapper + def debugserver_test(func): """Decorate the item as a debugserver test.""" if isinstance(func, type) and issubclass(func, unittest2.TestCase): @@ -657,10 +674,13 @@ return expectedFailure(fn, bugnumber) def expectedFailureDwarf(bugnumber=None): -return expectedFailureAll(bugnumber==bugnumber, debug_info="dwarf") +return expectedFailureAll(bugnumber=bugnumber, debug_info="dwarf") + +def expectedFailureDwo(bugnumber=None): +return expectedFailureAll(bugnumber=bugnumber, debug_info="dwo") def expectedFailureDsym(bugnumber=None): -return expectedFailureAll(bugnumber==bugnumber, debug_info="dsym") +return expectedFailureAll(bugnumber=bugnumber, debug_info="dsym") def expectedFailureCompiler(compiler, compiler_version=None, bugnumber=None): if compiler_version is None: @@ -2123,6 +2143,16 @@ if not module.buildDwarf(self, architecture, compiler, dictionary, clean): raise Exception("Don't know how to build binary with dwarf") +def buildDwo(self, architecture=None, compiler=None, dictionary=None, clean=True): +"""Platform specific way to build binaries with dwarf maps.""" +if lldb.skip_build_and_cleanup: +return +module = builder_module() +if target_is_android(): +dictionary = append_android_envs(dictionary) +if not module.buildDwo(self, architecture, compiler, dictionary, clean): +raise Exception("Don't know how to build binary with dwo") + def buildGo(self): """Build the default go binary. """ @@ -2240,6 +2270,14 @@ dwarf_method_name = attrname + "_dwarf" dwarf_test_method.__name__ = dwarf_method_name
[Lldb-commits] [lldb] r248934 - Now persistent expression data no longer lives with the Target, but rather with
Author: spyffe Date: Wed Sep 30 14:57:57 2015 New Revision: 248934 URL: http://llvm.org/viewvc/llvm-project?rev=248934&view=rev Log: Now persistent expression data no longer lives with the Target, but rather with the corresponding TypeSystem. This makes sense because what kind of data there is -- and how it can be looked up -- depends on the language. Functionality that is common to all type systems is factored out into PersistentExpressionState. Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/include/lldb/Symbol/TypeSystem.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Expression/ExpressionSourceCode.cpp lldb/trunk/source/Expression/ExpressionVariable.cpp lldb/trunk/source/Expression/Materializer.cpp lldb/trunk/source/Expression/UserExpression.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Target/ABI.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=248934&r1=248933&r2=248934&view=diff == --- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original) +++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Wed Sep 30 14:57:57 2015 @@ -265,6 +265,36 @@ private: std::vector m_variables; }; +class PersistentExpressionState : public ExpressionVariableList { +public: +//-- +// See TypeSystem.h for how to add subclasses to this. +//-- +enum LLVMCastKind { +eKindClang, +eKindSwift, +eKindGo, +kNumKinds +}; + +LLVMCastKind getKind() const { return m_kind; } + +PersistentExpressionState(LLVMCastKind kind) : +m_kind(kind) +{ +} + +virtual ~PersistentExpressionState (); + +virtual ConstString +GetNextPersistentVariableName () = 0; + +virtual void +RemovePersistentVariable (lldb::ExpressionVariableSP variable) = 0; +private: +LLVMCastKind m_kind; +}; + } #endif /* liblldb_ExpressionVariable_h_ */ Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=248934&r1=248933&r2=248934&view=diff == --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Wed Sep 30 14:57:57 2015 @@ -20,6 +20,8 @@ #include // Other libraries and framework includes +#include "ClangPersistentVariables.h" + #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" #include "clang/AST/TemplateBase.h" @@ -1188,8 +1190,12 @@ public: UtilityFunction * GetUtilityFunction(const char *text, const char *name) override; + +PersistentExpressionState * +GetPersistentExpressionState() override; private: lldb::TargetWP m_target_wp; +lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser. }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=248934&r1=248933&r2=248934&view=diff == --- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original) +++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Wed Sep 30 14:57:57 2015 @@ -504,6 +504,12 @@ public: return nullptr; } +virtual PersistentExpressionState * +GetPersistentExpressionState() +{ +return nullptr; +} + virtual CompilerType GetTypeForFormatters (void* type); Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=248934&r1=248933&r2=248934&view=diff
[Lldb-commits] [lldb] r248936 - Fixes a potential hang in test runner timeout logic.
Author: tfiala Date: Wed Sep 30 15:13:58 2015 New Revision: 248936 URL: http://llvm.org/viewvc/llvm-project?rev=248936&view=rev Log: Fixes a potential hang in test runner timeout logic. Part of https://llvm.org/bugs/show_bug.cgi?id=25002 In writing the new process_control test included here, I discovered that the scenario would hang indefinitely, bypassing the timeout logic. This fixes the indefinite hang, converting an error in the new test to a failure. I'll fix the failure next. This one was heinous enough to fix on its own, though. Modified: lldb/trunk/test/test_runner/lib/process_control.py lldb/trunk/test/test_runner/test/inferior.py lldb/trunk/test/test_runner/test/process_control_tests.py Modified: lldb/trunk/test/test_runner/lib/process_control.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/lib/process_control.py?rev=248936&r1=248935&r2=248936&view=diff == --- lldb/trunk/test/test_runner/lib/process_control.py (original) +++ lldb/trunk/test/test_runner/lib/process_control.py Wed Sep 30 15:13:58 2015 @@ -297,17 +297,23 @@ class UnixProcessHelper(ProcessHelper): log_file.write("skipping soft_terminate(): no process id") return False -# Don't kill if it's already dead. -popen_process.poll() -if popen_process.returncode is not None: -# It has a returncode. It has already stopped. -if log_file: -log_file.write( -"requested to terminate pid {} but it has already " -"terminated, returncode {}".format( -popen_process.pid, popen_process.returncode)) -# Move along... -return False +# We only do the process liveness check if we're not using +# process groups. With process groups, checking if the main +# inferior process is dead and short circuiting here is no +# good - children of it in the process group could still be +# alive, and they should be killed during a timeout. +if not popen_process.using_process_groups: +# Don't kill if it's already dead. +popen_process.poll() +if popen_process.returncode is not None: +# It has a returncode. It has already stopped. +if log_file: +log_file.write( +"requested to terminate pid {} but it has already " +"terminated, returncode {}".format( +popen_process.pid, popen_process.returncode)) +# Move along... +return False # Good to go. return True Modified: lldb/trunk/test/test_runner/test/inferior.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/test_runner/test/inferior.py?rev=248936&r1=248935&r2=248936&view=diff == --- lldb/trunk/test/test_runner/test/inferior.py (original) +++ lldb/trunk/test/test_runner/test/inferior.py Wed Sep 30 15:13:58 2015 @@ -3,6 +3,7 @@ import argparse import datetime import signal +import subprocess import sys import time @@ -25,6 +26,15 @@ def parse_args(command_line): default=[], help="ignore the given signal number (if possible)") parser.add_argument( +"--launch-child-share-handles", +action="store_true", +help=("launch a child inferior.py that shares stdout/stderr/stdio and " + "never returns")) +parser.add_argument( +"--never-return", +action="store_true", +help="run in an infinite loop, never return") +parser.add_argument( "--return-code", "-r", type=int, @@ -43,7 +53,7 @@ def parse_args(command_line): return parser.parse_args(command_line) -def maybe_ignore_signals(options, signals): +def handle_ignore_signals(options, signals): """Ignores any signals provided to it. @param options the command line options parsed by the program. @@ -61,7 +71,7 @@ def maybe_ignore_signals(options, signal signal.signal(signum, signal.SIG_IGN) -def maybe_sleep(options, sleep_seconds): +def handle_sleep(options, sleep_seconds): """Sleeps the number of seconds specified, restarting as needed. @param options the command line options parsed by the program. @@ -90,7 +100,27 @@ def maybe_sleep(options, sleep_seconds): sleep_seconds = sleep_interval.total_seconds() if sleep_seconds > 0: time.sleep(sleep_seconds) -except: +except: # pylint: disable=bare-except +pass + + +def handle_launch_children(options): +if options.launch_child_share_handles: +# Launch the child, share our file handles. +# We won't bother reaping it since it will likely outlive us. +
[Lldb-commits] LLVM buildnaster will be restarted tonight
Hello everyone, LLVM buildmaster will be restarted after 6 PM Pacific time today. Thanks Galina ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248956 - Fix Linux build.
Author: ovyalov Date: Wed Sep 30 17:27:55 2015 New Revision: 248956 URL: http://llvm.org/viewvc/llvm-project?rev=248956&view=rev Log: Fix Linux build. Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=248956&r1=248955&r2=248956&view=diff == --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Wed Sep 30 17:27:55 2015 @@ -20,7 +20,7 @@ #include // Other libraries and framework includes -#include "ClangPersistentVariables.h" +#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13312: Fix Windows build due to missing path.
amccarth created this revision. amccarth added reviewers: zturner, spyffe. amccarth added a subscriber: lldb-commits. This fixes the Windows build break introduced by r248934. I'm not sure why it didn't break other platforms. http://reviews.llvm.org/D13312 Files: include/lldb/Symbol/ClangASTContext.h Index: include/lldb/Symbol/ClangASTContext.h === --- include/lldb/Symbol/ClangASTContext.h +++ include/lldb/Symbol/ClangASTContext.h @@ -20,7 +20,7 @@ #include // Other libraries and framework includes -#include "ClangPersistentVariables.h" +#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" Index: include/lldb/Symbol/ClangASTContext.h === --- include/lldb/Symbol/ClangASTContext.h +++ include/lldb/Symbol/ClangASTContext.h @@ -20,7 +20,7 @@ #include // Other libraries and framework includes -#include "ClangPersistentVariables.h" +#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13312: Fix Windows build due to missing path.
emaste added a subscriber: emaste. emaste added a comment. > I'm not sure why it didn't break other platforms. It did - perhaps it worked only on OS X due to xcode path differences? It was fixed by http://reviews.llvm.org/rL248956. http://reviews.llvm.org/D13312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13312: Fix Windows build due to missing path.
amccarth abandoned this revision. amccarth added a comment. Same fix was already committed to fix the Linux build. http://reviews.llvm.org/D13312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248960 - Introudce a IsTopLevelFunction() API on Language and Function
Author: enrico Date: Wed Sep 30 18:12:22 2015 New Revision: 248960 URL: http://llvm.org/viewvc/llvm-project?rev=248960&view=rev Log: Introudce a IsTopLevelFunction() API on Language and Function This is meant to support languages that have a scripting mode with top-level code that acts as global For now, this flag only controls whether 'frame variable' will attempt to treat globals as locals when within such a function Modified: lldb/trunk/include/lldb/Symbol/Function.h lldb/trunk/include/lldb/Target/Language.h lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Symbol/Function.cpp lldb/trunk/source/Target/Language.cpp Modified: lldb/trunk/include/lldb/Symbol/Function.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=248960&r1=248959&r2=248960&view=diff == --- lldb/trunk/include/lldb/Symbol/Function.h (original) +++ lldb/trunk/include/lldb/Symbol/Function.h Wed Sep 30 18:12:22 2015 @@ -631,6 +631,24 @@ public: //-- bool GetIsOptimized (); + +//-- +/// Get whether this function represents a 'top-level' function +/// +/// The concept of a top-level function is language-specific, mostly +/// meant to represent the notion of scripting-style code that has +/// global visibility of the variables/symbols/functions/... +/// defined within the containing file/module +/// +/// If stopped in a top-level function, LLDB will expose global variables +/// as-if locals in the 'frame variable' command +/// +/// @return +/// Returns 'true' if this function is a top-level function, +/// 'false' otherwise. +//-- +bool +IsTopLevelFunction (); lldb::DisassemblerSP GetInstructions (const ExecutionContext &exe_ctx, Modified: lldb/trunk/include/lldb/Target/Language.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=248960&r1=248959&r2=248960&view=diff == --- lldb/trunk/include/lldb/Target/Language.h (original) +++ lldb/trunk/include/lldb/Target/Language.h Wed Sep 30 18:12:22 2015 @@ -41,6 +41,9 @@ public: virtual lldb::LanguageType GetLanguageType () const = 0; +bool +IsTopLevelFunction (Function& function); + virtual lldb::TypeCategoryImplSP GetFormatters (); Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=248960&r1=248959&r2=248960&view=diff == --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Sep 30 18:12:22 2015 @@ -35,6 +35,7 @@ #include "lldb/Interpreter/OptionGroupVariable.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" @@ -409,6 +410,10 @@ protected: DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(eLanguageRuntimeDescriptionDisplayVerbosityFull,eFormatDefault,summary_format_sp)); +const SymbolContext& sym_ctx = frame->GetSymbolContext(eSymbolContextFunction); +if (sym_ctx.function && sym_ctx.function->IsTopLevelFunction()) +m_option_variable.show_globals = true; + if (variable_list) { const Format format = m_option_format.GetFormat(); Modified: lldb/trunk/source/Symbol/Function.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=248960&r1=248959&r2=248960&view=diff == --- lldb/trunk/source/Symbol/Function.cpp (original) +++ lldb/trunk/source/Symbol/Function.cpp Wed Sep 30 18:12:22 2015 @@ -17,6 +17,7 @@ #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Target/Language.h" #include "llvm/Support/Casting.h" using namespace lldb; @@ -481,6 +482,17 @@ Function::GetIsOptimized () return result; } +bool +Function::IsTopLevelFunction () +{ +bool result = false; + +if (Language* language = Language::FindPlugin(GetLanguage())) +result = language->IsTopLevelFunction(*this); + +return result; +} + ConstString Function::GetDisplayName () const { Modified: lldb/trunk/source/Target/Language.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Targ
Re: [Lldb-commits] [PATCH] D13162: Change oat symbolization code for android to work on non-rooted devices
ovyalov added a comment. I tried Nexus 5 and 6P with Android M. Thanks for the new patch - it's fixing the problem. Repository: rL LLVM http://reviews.llvm.org/D13162 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13293: Trim the output of mktem in PlatformAndroid::DownloadSymbolFile
ovyalov accepted this revision. ovyalov added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D13293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248970 - Changed PersistentExpressionState to allow symbol lookups. Clang doesn't
Author: spyffe Date: Wed Sep 30 19:38:06 2015 New Revision: 248970 URL: http://llvm.org/viewvc/llvm-project?rev=248970&view=rev Log: Changed PersistentExpressionState to allow symbol lookups. Clang doesn't report any (yet). Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=248970&r1=248969&r2=248970&view=diff == --- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original) +++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Wed Sep 30 19:38:06 2015 @@ -291,6 +291,10 @@ public: virtual void RemovePersistentVariable (lldb::ExpressionVariableSP variable) = 0; + +virtual lldb::addr_t +LookupSymbol (const ConstString &name) = 0; + private: LLVMCastKind m_kind; }; Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h?rev=248970&r1=248969&r2=248970&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h Wed Sep 30 19:38:06 2015 @@ -69,6 +69,9 @@ public: void RemovePersistentVariable (lldb::ExpressionVariableSP variable) override; + +lldb::addr_t +LookupSymbol (const ConstString &name) override { return LLDB_INVALID_ADDRESS; } void RegisterPersistentType (const ConstString &name, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248971 - Use the preferred display language when making a persistent variable from a
Author: spyffe Date: Wed Sep 30 19:39:03 2015 New Revision: 248971 URL: http://llvm.org/viewvc/llvm-project?rev=248971&view=rev Log: Use the preferred display language when making a persistent variable from a ValueObject. Modified: lldb/trunk/source/Core/ValueObject.cpp Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=248971&r1=248970&r2=248971&view=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Wed Sep 30 19:39:03 2015 @@ -4277,7 +4277,7 @@ ValueObject::Persist () if (!target_sp) return nullptr; -PersistentExpressionState *persistent_state = target_sp->GetScratchTypeSystemForLanguage(GetCompilerType().GetMinimumLanguage())->GetPersistentExpressionState(); +PersistentExpressionState *persistent_state = target_sp->GetScratchTypeSystemForLanguage(GetPreferredDisplayLanguage())->GetPersistentExpressionState(); if (!persistent_state) return nullptr; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r248971 - Use the preferred display language when making a persistent variable from a
Hi Sean, would it be possible to add a test for this? On Wed, Sep 30, 2015 at 5:40 PM Sean Callanan via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: spyffe > Date: Wed Sep 30 19:39:03 2015 > New Revision: 248971 > > URL: http://llvm.org/viewvc/llvm-project?rev=248971&view=rev > Log: > Use the preferred display language when making a persistent variable from a > ValueObject. > > Modified: > lldb/trunk/source/Core/ValueObject.cpp > > Modified: lldb/trunk/source/Core/ValueObject.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=248971&r1=248970&r2=248971&view=diff > > == > --- lldb/trunk/source/Core/ValueObject.cpp (original) > +++ lldb/trunk/source/Core/ValueObject.cpp Wed Sep 30 19:39:03 2015 > @@ -4277,7 +4277,7 @@ ValueObject::Persist () > if (!target_sp) > return nullptr; > > -PersistentExpressionState *persistent_state = > target_sp->GetScratchTypeSystemForLanguage(GetCompilerType().GetMinimumLanguage())->GetPersistentExpressionState(); > +PersistentExpressionState *persistent_state = > target_sp->GetScratchTypeSystemForLanguage(GetPreferredDisplayLanguage())->GetPersistentExpressionState(); > > if (!persistent_state) > return nullptr; > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13323: Use %HOME%/.lldb/module_cache as a default module cache directory
ovyalov created this revision. ovyalov added reviewers: clayborg, tberghammer. ovyalov added a subscriber: lldb-commits. Use %HOME%/.lldb/module_cache as a default module cache directory. http://reviews.llvm.org/D13323 Files: source/Target/Platform.cpp Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -39,9 +39,11 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Utils.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" #include "Utility/ModuleCache.h" + // Define these constants from POSIX mman.h rather than include the file // so that they will be correct even when compiled on Linux. #define MAP_PRIVATE 2 @@ -99,13 +101,17 @@ m_collection_sp->Initialize (g_properties); auto module_cache_dir = GetModuleCacheDirectory (); -if (!module_cache_dir) -{ -if (!HostInfo::GetLLDBPath (ePathTypeGlobalLLDBTempSystemDir, module_cache_dir)) -module_cache_dir = FileSpec ("/tmp/lldb", false); -module_cache_dir.AppendPathComponent ("module_cache"); -SetModuleCacheDirectory (module_cache_dir); -} +if (module_cache_dir) +return; + +llvm::SmallString<64> user_home_dir; +if (!llvm::sys::path::home_directory (user_home_dir)) +return; + +module_cache_dir = FileSpec (user_home_dir.c_str(), false); +module_cache_dir.AppendPathComponent (".lldb"); +module_cache_dir.AppendPathComponent ("module_cache"); +SetModuleCacheDirectory (module_cache_dir); } bool @@ -1847,7 +1853,8 @@ bool *did_create_ptr) { if (IsHost() || -!GetGlobalPlatformProperties ()->GetUseModuleCache ()) +!GetGlobalPlatformProperties ()->GetUseModuleCache () || +!GetGlobalPlatformProperties ()->GetModuleCacheDirectory ()) return false; Log *log = GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PLATFORM); Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -39,9 +39,11 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Utils.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" #include "Utility/ModuleCache.h" + // Define these constants from POSIX mman.h rather than include the file // so that they will be correct even when compiled on Linux. #define MAP_PRIVATE 2 @@ -99,13 +101,17 @@ m_collection_sp->Initialize (g_properties); auto module_cache_dir = GetModuleCacheDirectory (); -if (!module_cache_dir) -{ -if (!HostInfo::GetLLDBPath (ePathTypeGlobalLLDBTempSystemDir, module_cache_dir)) -module_cache_dir = FileSpec ("/tmp/lldb", false); -module_cache_dir.AppendPathComponent ("module_cache"); -SetModuleCacheDirectory (module_cache_dir); -} +if (module_cache_dir) +return; + +llvm::SmallString<64> user_home_dir; +if (!llvm::sys::path::home_directory (user_home_dir)) +return; + +module_cache_dir = FileSpec (user_home_dir.c_str(), false); +module_cache_dir.AppendPathComponent (".lldb"); +module_cache_dir.AppendPathComponent ("module_cache"); +SetModuleCacheDirectory (module_cache_dir); } bool @@ -1847,7 +1853,8 @@ bool *did_create_ptr) { if (IsHost() || -!GetGlobalPlatformProperties ()->GetUseModuleCache ()) +!GetGlobalPlatformProperties ()->GetUseModuleCache () || +!GetGlobalPlatformProperties ()->GetModuleCacheDirectory ()) return false; Log *log = GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PLATFORM); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
ki.stfu accepted this revision. ki.stfu added a comment. lgtm Comment at: test/tools/lldb-mi/control/TestMiExec.py:16 @@ +15,3 @@ +@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented +@expectedFailureAll("llvm.org/pr25000", oslist=["linux"]) +def test_lldbmi_exec_run(self): KLapshin wrote: > It looks like lldb-mi didn't received SIGSTOP evbent on Linux platform > because event was not rebroadcasted because "Process::WaitForProcessToStop > (timeout = (nil)) > Process::WaitForProcessToStop returning without waiting for events; process > private and public states are already 'stopped'. > " - see full log (process, event channel) attached to llvm.org/pr25000 bug. just use ``` @expectedFailureLinux # llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped ... ``` Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248985 - Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
Author: jmolenda Date: Thu Oct 1 00:37:22 2015 New Revision: 248985 URL: http://llvm.org/viewvc/llvm-project?rev=248985&view=rev Log: Fixing a subtle issue on Mac OS X systems with dSYMs (possibly introduced by r235737 but I didn't look into it too closely). A dSYM can have a per-UUID plist in it which tells lldb where to find an executable binary for the dSYM (DBGSymbolRichExecutable) - other information can be included in this plist, like how to remap the source file paths from their build pathnames to their long-term storage pathnames. This per-UUID plist is a unusual; it is used probably exclusively inside apple with our build system. It is not created by default in normal dSYMs. The problem was like this: 1. lldb wants to find an executable, given only a UUID (this happens when lldb is doing cross-host debugging and doesn't have a copy of the target system's binaries) 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols which does a spotlight search for the dSYM on the local system, and failing that, tries the DBGShellCommands command to find the dSYM. 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. The dSYM has a DBGSymbolRichExecutable kv pair pointing to the binary on a network filesystem. 4. Using the binary on the network filesystem, lldb now goes to find the dSYM. 5. It starts by looking for a dSYM next to the binary it found. 6. lldb is now reading the dSYM over a network filesystem, ignoring the one it found on its local filesystem earlier. Everything still *works* but it's much slower. This would be a tricky one to write up in a testsuite case; you really need the binary to not exist on the local system. And LocateMacOSXFilesUsingDebugSymbols will only compile on Mac OS X - even if I found a way to write up a test case, it would not run anywhere but on a mac. One change Greg wanted while I was touching this code was to have LocateMacOSXFilesUsingDebugSymbols (which could be asked to find a binary OR find a dSYM) to instead return a ModuleSpec with the sum total of everything it could find. This change of passing around a ModuleSpec instead of a FileSpec was percolated up into ModuleList::GetSharedModule. The changes to LocateMacOSXFilesUsingDebugSymbols look larger than they really are - there's a lot of simple whitespace changes in there. I ran the testsuites on mac, no new regressions introduced Modified: lldb/trunk/include/lldb/Host/Symbols.h lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Modified: lldb/trunk/include/lldb/Host/Symbols.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=248985&r1=248984&r2=248985&view=diff == --- lldb/trunk/include/lldb/Host/Symbols.h (original) +++ lldb/trunk/include/lldb/Host/Symbols.h Thu Oct 1 00:37:22 2015 @@ -29,7 +29,7 @@ public: // Locating the file should happen only on the local computer or using // the current computers global settings. //-- -static FileSpec +static ModuleSpec LocateExecutableObjectFile (const ModuleSpec &module_spec); //-- Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=248985&r1=248984&r2=248985&view=diff == --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Oct 1 00:37:22 2015 @@ -1045,19 +1045,19 @@ ModuleList::GetSharedModule // Fixup the incoming path in case the path points to a valid file, yet // the arch or UUID (if one was passed in) don't match. -FileSpec file_spec = Symbols::LocateExecutableObjectFile (module_spec); +ModuleSpec located_binary_modulespec = Symbols::LocateExecutableObjectFile (module_spec); // Don't look for the file if it appears to be the same one we already // checked for above... -if (file_spec != module_file_spec) +if (located_binary_modulespec.GetFileSpec() != module_file_spec) { -if (!file_spec.Exists()) +if (!located_binary_modulespec.GetFileSpec().Exists()) { -file_spec.GetPath(path, sizeof(path)); +located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path)); if (path[0] == '\0') module_file_spec.GetPath(path, sizeof(path)); // How can this check ever be true? This branch it is false, and we haven't modified file_spec. -if (file_spec.Exists()) +if (located_binary_modulespec.GetFileSpec().Ex
Re: [Lldb-commits] [lldb] r248985 - Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
This is a good example of where unit tests are useful. There's already a small suite of unit tests but I'm going to start being proactive about growing it (in part by evangelizing it in response to people's commits ;-). It's not integrated into the Xcode build, but it would certainly be easy to do so. The nice thing about a unit test is that you can set everything up exactly the way you need it and just call the one native code method you want to test, and verify the outputs. You could make up your own ModuleSpec, you could make a mock implementation of `Symbols` that delegates to the real `Symbols` implementation for everything except the part where it checks if the file exists, and have that method simply return false so it goes to the fallback path, etc. Anyway, just throwing this out there as an option. This is MacOSX only code so it's not a huge priority for me to push it strongly, but if you think it would be useful I'm happy to help you figure out how to run them and/or write a new one. On Wed, Sep 30, 2015 at 10:39 PM Jason Molenda via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: jmolenda > Date: Thu Oct 1 00:37:22 2015 > New Revision: 248985 > > URL: http://llvm.org/viewvc/llvm-project?rev=248985&view=rev > Log: > Fixing a subtle issue on Mac OS X systems with dSYMs (possibly > introduced by r235737 but I didn't look into it too closely). > > A dSYM can have a per-UUID plist in it which tells lldb where > to find an executable binary for the dSYM (DBGSymbolRichExecutable) > - other information can be included in this plist, like how to > remap the source file paths from their build pathnames to their > long-term storage pathnames. > > This per-UUID plist is a unusual; it is used probably exclusively > inside apple with our build system. It is not created by default > in normal dSYMs. > > The problem was like this: > > 1. lldb wants to find an executable, given only a UUID > (this happens when lldb is doing cross-host debugging > and doesn't have a copy of the target system's binaries) > > 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols > which does a spotlight search for the dSYM on the local > system, and failing that, tries the DBGShellCommands > command to find the dSYM. > > 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. > The dSYM has a DBGSymbolRichExecutable kv pair pointing to > the binary on a network filesystem. > > 4. Using the binary on the network filesystem, lldb now goes > to find the dSYM. > > 5. It starts by looking for a dSYM next to the binary it found. > > 6. lldb is now reading the dSYM over a network filesystem, > ignoring the one it found on its local filesystem earlier. > > Everything still *works* but it's much slower. > > This would be a tricky one to write up in a testsuite case; > you really need the binary to not exist on the local system. > And LocateMacOSXFilesUsingDebugSymbols will only compile on > Mac OS X - even if I found a way to write up a test case, it > would not run anywhere but on a mac. > > One change Greg wanted while I was touching this code was to > have LocateMacOSXFilesUsingDebugSymbols (which could be asked > to find a binary OR find a dSYM) to instead return a ModuleSpec > with the sum total of everything it could find. This > change of passing around a ModuleSpec instead of a FileSpec > was percolated up into ModuleList::GetSharedModule. > > The changes to LocateMacOSXFilesUsingDebugSymbols look larger > than they really are - there's a lot of simple whitespace changes > in there. > > I ran the testsuites on mac, no new regressions introduced > > > > Modified: > lldb/trunk/include/lldb/Host/Symbols.h > lldb/trunk/source/Core/ModuleList.cpp > lldb/trunk/source/Host/common/Symbols.cpp > lldb/trunk/source/Host/macosx/Symbols.cpp > lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp > > Modified: lldb/trunk/include/lldb/Host/Symbols.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=248985&r1=248984&r2=248985&view=diff > > == > --- lldb/trunk/include/lldb/Host/Symbols.h (original) > +++ lldb/trunk/include/lldb/Host/Symbols.h Thu Oct 1 00:37:22 2015 > @@ -29,7 +29,7 @@ public: > // Locating the file should happen only on the local computer or using > // the current computers global settings. > > //-- > -static FileSpec > +static ModuleSpec > LocateExecutableObjectFile (const ModuleSpec &module_spec); > > > //-- > > Modified: lldb/trunk/source/Core/ModuleList.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=248985&r1=248984&r2=248985&view=diff > >
Re: [Lldb-commits] [lldb] r248985 - Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
Thanks for the idea Zachary, I haven't been following that. I'll look at this tomorrow. I was trying to imagine how to write a normal test case for this and it'd involve running a binary, deleting the binary off disk, then lldb attach to the process, letting it find a dSYM via spotlight which points to a copy of the binary in another location and there's another copy of the dSYM next to that binary. And I'd want to check that lldb stuck with the original dSYM that it found, instead of picking up the second dSYM sitting next to the binary. It might be possible to replicate the behavior entirely self-hosted. But it definitely only works on a mac because of the DebugSymbols private framework calls lldb makes while doing all of this. > On Sep 30, 2015, at 10:58 PM, Zachary Turner wrote: > > This is a good example of where unit tests are useful. There's already a > small suite of unit tests but I'm going to start being proactive about > growing it (in part by evangelizing it in response to people's commits ;-). > It's not integrated into the Xcode build, but it would certainly be easy to > do so. The nice thing about a unit test is that you can set everything up > exactly the way you need it and just call the one native code method you want > to test, and verify the outputs. You could make up your own ModuleSpec, you > could make a mock implementation of `Symbols` that delegates to the real > `Symbols` implementation for everything except the part where it checks if > the file exists, and have that method simply return false so it goes to the > fallback path, etc. > > Anyway, just throwing this out there as an option. This is MacOSX only code > so it's not a huge priority for me to push it strongly, but if you think it > would be useful I'm happy to help you figure out how to run them and/or write > a new one. > > On Wed, Sep 30, 2015 at 10:39 PM Jason Molenda via lldb-commits > wrote: > Author: jmolenda > Date: Thu Oct 1 00:37:22 2015 > New Revision: 248985 > > URL: http://llvm.org/viewvc/llvm-project?rev=248985&view=rev > Log: > Fixing a subtle issue on Mac OS X systems with dSYMs (possibly > introduced by r235737 but I didn't look into it too closely). > > A dSYM can have a per-UUID plist in it which tells lldb where > to find an executable binary for the dSYM (DBGSymbolRichExecutable) > - other information can be included in this plist, like how to > remap the source file paths from their build pathnames to their > long-term storage pathnames. > > This per-UUID plist is a unusual; it is used probably exclusively > inside apple with our build system. It is not created by default > in normal dSYMs. > > The problem was like this: > > 1. lldb wants to find an executable, given only a UUID > (this happens when lldb is doing cross-host debugging > and doesn't have a copy of the target system's binaries) > > 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols > which does a spotlight search for the dSYM on the local > system, and failing that, tries the DBGShellCommands > command to find the dSYM. > > 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. > The dSYM has a DBGSymbolRichExecutable kv pair pointing to > the binary on a network filesystem. > > 4. Using the binary on the network filesystem, lldb now goes > to find the dSYM. > > 5. It starts by looking for a dSYM next to the binary it found. > > 6. lldb is now reading the dSYM over a network filesystem, > ignoring the one it found on its local filesystem earlier. > > Everything still *works* but it's much slower. > > This would be a tricky one to write up in a testsuite case; > you really need the binary to not exist on the local system. > And LocateMacOSXFilesUsingDebugSymbols will only compile on > Mac OS X - even if I found a way to write up a test case, it > would not run anywhere but on a mac. > > One change Greg wanted while I was touching this code was to > have LocateMacOSXFilesUsingDebugSymbols (which could be asked > to find a binary OR find a dSYM) to instead return a ModuleSpec > with the sum total of everything it could find. This > change of passing around a ModuleSpec instead of a FileSpec > was percolated up into ModuleList::GetSharedModule. > > The changes to LocateMacOSXFilesUsingDebugSymbols look larger > than they really are - there's a lot of simple whitespace changes > in there. > > I ran the testsuites on mac, no new regressions introduced > > > > Modified: > lldb/trunk/include/lldb/Host/Symbols.h > lldb/trunk/source/Core/ModuleList.cpp > lldb/trunk/source/Host/common/Symbols.cpp > lldb/trunk/source/Host/macosx/Symbols.cpp > lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp > > Modified: lldb/trunk/include/lldb/Host/Symbols.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=248985&r1=248984&r2=248985&view=diff > ==
Re: [Lldb-commits] [lldb] r248985 - Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
Yea. It's definitely hard to write a normal test case for this. It's also a common problem when dealing with remote debugging scenarios. It's both hard and resource demanding (needing to have just the right Host -> Target configuration available) to test that by going through the full debugging stack. But it's often easy to write a test for a specific bug by finding the point of failure, and writing a simple unit test that verifies the inputs and outputs of a single method. Many of LLDB's abstractions aren't designed to be able to handle this very well (for example, dependency injection is a common technique, but requires the functionality to be abstracted correctly to be able to inject mock interfaces), but there's no reason they couldn't be changed to be. On Wed, Sep 30, 2015 at 11:03 PM Jason Molenda wrote: > Thanks for the idea Zachary, I haven't been following that. I'll look at > this tomorrow. I was trying to imagine how to write a normal test case for > this and it'd involve running a binary, deleting the binary off disk, then > lldb attach to the process, letting it find a dSYM via spotlight which > points to a copy of the binary in another location and there's another copy > of the dSYM next to that binary. And I'd want to check that lldb stuck with > the original dSYM that it found, instead of picking up the second dSYM > sitting next to the binary. It might be possible to replicate the behavior > entirely self-hosted. But it definitely only works on a mac because of the > DebugSymbols private framework calls lldb makes while doing all of this. > > > > On Sep 30, 2015, at 10:58 PM, Zachary Turner wrote: > > > > This is a good example of where unit tests are useful. There's already > a small suite of unit tests but I'm going to start being proactive about > growing it (in part by evangelizing it in response to people's commits > ;-). It's not integrated into the Xcode build, but it would certainly be > easy to do so. The nice thing about a unit test is that you can set > everything up exactly the way you need it and just call the one native code > method you want to test, and verify the outputs. You could make up your > own ModuleSpec, you could make a mock implementation of `Symbols` that > delegates to the real `Symbols` implementation for everything except the > part where it checks if the file exists, and have that method simply return > false so it goes to the fallback path, etc. > > > > Anyway, just throwing this out there as an option. This is MacOSX only > code so it's not a huge priority for me to push it strongly, but if you > think it would be useful I'm happy to help you figure out how to run them > and/or write a new one. > > > > On Wed, Sep 30, 2015 at 10:39 PM Jason Molenda via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > Author: jmolenda > > Date: Thu Oct 1 00:37:22 2015 > > New Revision: 248985 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=248985&view=rev > > Log: > > Fixing a subtle issue on Mac OS X systems with dSYMs (possibly > > introduced by r235737 but I didn't look into it too closely). > > > > A dSYM can have a per-UUID plist in it which tells lldb where > > to find an executable binary for the dSYM (DBGSymbolRichExecutable) > > - other information can be included in this plist, like how to > > remap the source file paths from their build pathnames to their > > long-term storage pathnames. > > > > This per-UUID plist is a unusual; it is used probably exclusively > > inside apple with our build system. It is not created by default > > in normal dSYMs. > > > > The problem was like this: > > > > 1. lldb wants to find an executable, given only a UUID > > (this happens when lldb is doing cross-host debugging > > and doesn't have a copy of the target system's binaries) > > > > 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols > > which does a spotlight search for the dSYM on the local > > system, and failing that, tries the DBGShellCommands > > command to find the dSYM. > > > > 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. > > The dSYM has a DBGSymbolRichExecutable kv pair pointing to > > the binary on a network filesystem. > > > > 4. Using the binary on the network filesystem, lldb now goes > > to find the dSYM. > > > > 5. It starts by looking for a dSYM next to the binary it found. > > > > 6. lldb is now reading the dSYM over a network filesystem, > > ignoring the one it found on its local filesystem earlier. > > > > Everything still *works* but it's much slower. > > > > This would be a tricky one to write up in a testsuite case; > > you really need the binary to not exist on the local system. > > And LocateMacOSXFilesUsingDebugSymbols will only compile on > > Mac OS X - even if I found a way to write up a test case, it > > would not run anywhere but on a mac. > > > > One change Greg wanted while I was touching this code was to > > have LocateMacOSXFilesUsi