aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt42
-rw-r--r--CODE_OWNERS.txt5
-rw-r--r--cmake/LLDBDependencies.cmake52
-rw-r--r--cmake/modules/AddLLDB.cmake40
-rw-r--r--cmake/modules/LLDBConfig.cmake14
-rw-r--r--cmake/modules/LLDBGenerateConfig.cmake4
-rw-r--r--cmake/modules/LLDBStandalone.cmake4
-rw-r--r--examples/darwin/heap_find/heap.py94
-rw-r--r--examples/python/cmdtemplate.py180
-rwxr-xr-xexamples/python/crashlog.py13
-rw-r--r--examples/python/lldb_module_utils.py249
-rw-r--r--examples/python/step_and_print.py24
-rw-r--r--examples/synthetic/libcxx.py15
-rw-r--r--include/lldb/API/LLDB.h2
-rw-r--r--include/lldb/API/SBBreakpoint.h14
-rw-r--r--include/lldb/API/SBBreakpointLocation.h11
-rw-r--r--include/lldb/API/SBBreakpointName.h118
-rw-r--r--include/lldb/API/SBCommandInterpreter.h2
-rw-r--r--include/lldb/API/SBDebugger.h21
-rw-r--r--include/lldb/API/SBDefines.h7
-rw-r--r--include/lldb/API/SBError.h1
-rw-r--r--include/lldb/API/SBFileSpec.h1
-rw-r--r--include/lldb/API/SBProcess.h10
-rw-r--r--include/lldb/API/SBProcessInfo.h64
-rw-r--r--include/lldb/API/SBStream.h1
-rw-r--r--include/lldb/API/SBStringList.h2
-rw-r--r--include/lldb/API/SBStructuredData.h1
-rw-r--r--include/lldb/API/SBTarget.h13
-rw-r--r--include/lldb/API/SBThread.h1
-rw-r--r--include/lldb/Breakpoint/Breakpoint.h50
-rw-r--r--include/lldb/Breakpoint/BreakpointIDList.h4
-rw-r--r--include/lldb/Breakpoint/BreakpointList.h9
-rw-r--r--include/lldb/Breakpoint/BreakpointLocation.h23
-rw-r--r--include/lldb/Breakpoint/BreakpointName.h213
-rw-r--r--include/lldb/Breakpoint/BreakpointOptions.h89
-rw-r--r--include/lldb/Core/Architecture.h43
-rw-r--r--include/lldb/Core/Disassembler.h4
-rw-r--r--include/lldb/Core/EmulateInstruction.h5
-rw-r--r--include/lldb/Core/IOHandler.h3
-rw-r--r--include/lldb/Core/MappedHash.h15
-rw-r--r--include/lldb/Core/Module.h4
-rw-r--r--include/lldb/Core/ModuleSpec.h2
-rw-r--r--include/lldb/Core/PluginManager.h16
-rw-r--r--include/lldb/Core/RangeMap.h1
-rw-r--r--include/lldb/Core/Section.h9
-rw-r--r--include/lldb/Expression/DWARFExpression.h44
-rw-r--r--include/lldb/Expression/ExpressionParser.h1
-rw-r--r--include/lldb/Expression/IRExecutionUnit.h4
-rw-r--r--include/lldb/Host/Config.h.cmake2
-rw-r--r--include/lldb/Host/Host.h6
-rw-r--r--include/lldb/Host/HostInfoBase.h11
-rw-r--r--include/lldb/Host/MainLoop.h2
-rw-r--r--include/lldb/Host/PseudoTerminal.h6
-rw-r--r--include/lldb/Host/TaskPool.h (renamed from include/lldb/Utility/TaskPool.h)6
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h23
-rw-r--r--include/lldb/Host/common/NativeRegisterContext.h5
-rw-r--r--include/lldb/Host/common/NativeThreadProtocol.h5
-rw-r--r--include/lldb/Interpreter/Args.h1
-rw-r--r--include/lldb/Interpreter/CommandInterpreter.h21
-rw-r--r--include/lldb/Interpreter/OptionGroupArchitecture.h6
-rw-r--r--include/lldb/Interpreter/OptionValueArch.h6
-rw-r--r--include/lldb/Symbol/ArmUnwindInfo.h2
-rw-r--r--include/lldb/Symbol/ClangASTContext.h31
-rw-r--r--include/lldb/Symbol/CompilerType.h16
-rw-r--r--include/lldb/Symbol/DeclVendor.h11
-rw-r--r--include/lldb/Symbol/FuncUnwinders.h6
-rw-r--r--include/lldb/Symbol/GoASTContext.h6
-rw-r--r--include/lldb/Symbol/JavaASTContext.h4
-rw-r--r--include/lldb/Symbol/OCamlASTContext.h6
-rw-r--r--include/lldb/Symbol/ObjectFile.h26
-rw-r--r--include/lldb/Symbol/TypeSystem.h9
-rw-r--r--include/lldb/Target/Platform.h26
-rw-r--r--include/lldb/Target/Process.h9
-rw-r--r--include/lldb/Target/ProcessInfo.h2
-rw-r--r--include/lldb/Target/ProcessLaunchInfo.h4
-rw-r--r--include/lldb/Target/Target.h62
-rw-r--r--include/lldb/Target/UnwindAssembly.h2
-rw-r--r--include/lldb/Utility/ArchSpec.h (renamed from include/lldb/Core/ArchSpec.h)74
-rw-r--r--include/lldb/Utility/DataExtractor.h34
-rw-r--r--include/lldb/Utility/FileSpec.h2
-rw-r--r--include/lldb/Utility/Log.h5
-rw-r--r--include/lldb/Utility/Logging.h2
-rw-r--r--include/lldb/Utility/SharingPtr.h9
-rw-r--r--include/lldb/Utility/Status.h13
-rw-r--r--include/lldb/Utility/StringList.h2
-rw-r--r--include/lldb/Utility/UUID.h2
-rw-r--r--include/lldb/lldb-enumerations.h13
-rw-r--r--include/lldb/lldb-forward.h2
-rw-r--r--include/lldb/lldb-private-defines.h3
-rw-r--r--include/lldb/lldb-private-forward.h4
-rw-r--r--lit/CMakeLists.txt18
-rw-r--r--lit/Modules/compressed-sections.yaml30
-rw-r--r--lit/Modules/lit.local.cfg1
-rw-r--r--lit/Unit/lit.cfg15
-rw-r--r--lit/lit.cfg109
-rw-r--r--lit/lit.site.cfg.in19
-rw-r--r--lldb.xcodeproj/project.pbxproj383
-rw-r--r--lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme1
-rw-r--r--lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme3
-rw-r--r--lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme2
-rw-r--r--packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py45
-rw-r--r--packages/Python/lldbsuite/test/arm/breakpoint-it/main.c14
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py (renamed from packages/Python/lldbsuite/test/arm_emulation/TestEmulations.py)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-10-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-10-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-11-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-11-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-12-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-12-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-9-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-9-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-10-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-10-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-11-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-11-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-12-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-12-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-9-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-9-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrh-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrh-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-10-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-10-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-11-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-11-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-12-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-12-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-13-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-13-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-14-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-14-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-15-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-15-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-16-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-16-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-17-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-17-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-18-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-18-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-19-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-19-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-20-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-20-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-21-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-21-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-22-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-22-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-23-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-23-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-24-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-24-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-25-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-25-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-26-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-26-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-27-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-27-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-28-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-28-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-29-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-29-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-30-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-30-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-31-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-31-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-7-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-7-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-8-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-8-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-9-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-9-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-moveq-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-moveq-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-movs-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-movs-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-5-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-5-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strbt-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strbt-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strd-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strd-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strt-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strt-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-10-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-10-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-8-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-8-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-9-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-9-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-arm.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-arm.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-10-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-10-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-4-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-4-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-5-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-5-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-6-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-6-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-8-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-8-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-9-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-9-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-1-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-1-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-2-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-2-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-3-thumb.dat (renamed from packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-3-thumb.dat)0
-rw-r--r--packages/Python/lldbsuite/test/decorators.py24
-rw-r--r--packages/Python/lldbsuite/test/example/TestSequenceFunctions.py3
-rw-r--r--packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/expression_command/call-function/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py15
-rw-r--r--packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py5
-rw-r--r--packages/Python/lldbsuite/test/expression_command/fixits/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py4
-rw-r--r--packages/Python/lldbsuite/test/expression_command/po_verbosity/Makefile2
-rw-r--r--packages/Python/lldbsuite/test/expression_command/po_verbosity/main.m2
-rw-r--r--packages/Python/lldbsuite/test/expression_command/top-level/Makefile13
-rw-r--r--packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py17
-rw-r--r--packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp16
-rw-r--r--packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py104
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c19
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py31
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py109
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp27
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py108
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py264
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py46
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h11
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_source/.lldb3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_source/commands.txt2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py46
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py53
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp11
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py51
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp11
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/exec/TestExec.py50
-rw-r--r--packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/load_unload/.categories1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/load_unload/Makefile8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py15
-rw-r--r--packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py76
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.corebin0 -> 330648 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.outbin0 -> 3128 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py39
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py30
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py55
-rw-r--r--packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py60
-rw-r--r--packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/type_completion/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/.categories1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py6
-rw-r--r--packages/Python/lldbsuite/test/help/TestHelp.py9
-rw-r--r--packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py6
-rw-r--r--packages/Python/lldbsuite/test/lang/c/inlines/main.c2
-rw-r--r--packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py3
-rw-r--r--packages/Python/lldbsuite/test/lang/c/step-target/.categories1
-rw-r--r--packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py3
-rw-r--r--packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/auto/Makefile2
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py1
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/stl/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/template/Makefile2
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile16
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile28
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py1
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py60
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py6
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py1
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m6
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py1
-rw-r--r--packages/Python/lldbsuite/test/linux/add-symbols/Makefile12
-rw-r--r--packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py52
-rw-r--r--packages/Python/lldbsuite/test/linux/add-symbols/main.c6
-rw-r--r--packages/Python/lldbsuite/test/lldbinline.py5
-rw-r--r--packages/Python/lldbsuite/test/lldbplatform.py10
-rw-r--r--packages/Python/lldbsuite/test/lldbplatformutil.py11
-rw-r--r--packages/Python/lldbsuite/test/lldbtest.py31
-rw-r--r--packages/Python/lldbsuite/test/macosx/add-dsym/Makefile15
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py5
-rw-r--r--packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py6
-rw-r--r--packages/Python/lldbsuite/test/macosx/queues/TestQueues.py4
-rw-r--r--packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py9
-rw-r--r--packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py3
-rw-r--r--packages/Python/lldbsuite/test/make/Android.rules8
-rw-r--r--packages/Python/lldbsuite/test/make/Makefile.rules34
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py22
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py42
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py4
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py22
-rw-r--r--packages/Python/lldbsuite/test/python_api/exprpath_synthetic/main.mm2
-rw-r--r--packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py0
-rw-r--r--packages/Python/lldbsuite/test/python_api/frame/TestFrames.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/main.c7
-rw-r--r--packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py22
-rw-r--r--packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py76
-rw-r--r--packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py3
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbtype_typeclass/main.m2
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/.categories1
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py9
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py4
-rw-r--r--packages/Python/lldbsuite/test/settings/TestSettings.py2
-rw-r--r--packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py10
-rw-r--r--packages/Python/lldbsuite/test/settings/quoting/main.c10
-rw-r--r--packages/Python/lldbsuite/test/test_categories.py8
-rw-r--r--packages/Python/lldbsuite/test/test_result.py28
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/.categories1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py9
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py13
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp2
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py3
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py7
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py7
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py4
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py5
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py5
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py2
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py12
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py32
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubReverseConnect.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py3
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py2
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py1
-rw-r--r--packages/Python/lldbsuite/test/types/AbstractBase.py2
-rw-r--r--packages/Python/lldbsuite/test/types/basic_type.cpp142
-rw-r--r--scripts/CMakeLists.txt4
-rw-r--r--scripts/Python/python-extensions.swig15
-rw-r--r--scripts/Python/python-swigsafecast.swig7
-rwxr-xr-xscripts/Xcode/build-llvm.py33
-rw-r--r--scripts/Xcode/lldbbuild.py9
-rwxr-xr-xscripts/build-lldb-llvm-clang4
-rwxr-xr-xscripts/framework-header-fix.sh13
-rw-r--r--scripts/interface/SBBreakpoint.i43
-rw-r--r--scripts/interface/SBBreakpointLocation.i11
-rw-r--r--scripts/interface/SBBreakpointName.i111
-rw-r--r--scripts/interface/SBCommandInterpreter.i14
-rw-r--r--scripts/interface/SBDebugger.i33
-rw-r--r--scripts/interface/SBProcess.i12
-rw-r--r--scripts/interface/SBProcessInfo.i66
-rw-r--r--scripts/interface/SBTarget.i4
-rw-r--r--scripts/interface/SBValue.i8
-rw-r--r--scripts/lldb.swig4
-rw-r--r--source/API/CMakeLists.txt60
-rw-r--r--source/API/SBBreakpoint.cpp87
-rw-r--r--source/API/SBBreakpointLocation.cpp57
-rw-r--r--source/API/SBBreakpointName.cpp685
-rw-r--r--source/API/SBBreakpointOptionCommon.cpp85
-rw-r--r--source/API/SBBreakpointOptionCommon.h37
-rw-r--r--source/API/SBCommandInterpreter.cpp4
-rw-r--r--source/API/SBDebugger.cpp84
-rw-r--r--source/API/SBInstruction.cpp7
-rw-r--r--source/API/SBPlatform.cpp2
-rw-r--r--source/API/SBProcess.cpp10
-rw-r--r--source/API/SBProcessInfo.cpp145
-rw-r--r--source/API/SBTarget.cpp46
-rw-r--r--source/API/SBType.cpp28
-rw-r--r--source/API/SystemInitializerFull.cpp6
-rw-r--r--source/Breakpoint/Breakpoint.cpp30
-rw-r--r--source/Breakpoint/BreakpointID.cpp11
-rw-r--r--source/Breakpoint/BreakpointIDList.cpp35
-rw-r--r--source/Breakpoint/BreakpointList.cpp33
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp76
-rw-r--r--source/Breakpoint/BreakpointLocationList.cpp2
-rw-r--r--source/Breakpoint/BreakpointName.cpp91
-rw-r--r--source/Breakpoint/BreakpointOptions.cpp231
-rw-r--r--source/Breakpoint/CMakeLists.txt1
-rw-r--r--source/Commands/CommandCompletions.cpp8
-rw-r--r--source/Commands/CommandObjectBreakpoint.cpp982
-rw-r--r--source/Commands/CommandObjectBreakpoint.h19
-rw-r--r--source/Commands/CommandObjectBreakpointCommand.cpp72
-rw-r--r--source/Commands/CommandObjectDisassemble.cpp3
-rw-r--r--source/Commands/CommandObjectDisassemble.h6
-rw-r--r--source/Commands/CommandObjectExpression.cpp11
-rw-r--r--source/Commands/CommandObjectFrame.h5
-rw-r--r--source/Commands/CommandObjectPlatform.cpp6
-rw-r--r--source/Commands/CommandObjectSource.cpp9
-rw-r--r--source/Commands/CommandObjectTarget.cpp52
-rw-r--r--source/Commands/CommandObjectTarget.h5
-rw-r--r--source/Commands/CommandObjectThread.cpp8
-rw-r--r--source/Core/Address.cpp2
-rw-r--r--source/Core/AddressRange.cpp1
-rw-r--r--source/Core/CMakeLists.txt1
-rw-r--r--source/Core/Debugger.cpp2
-rw-r--r--source/Core/DumpDataExtractor.cpp7
-rw-r--r--source/Core/FileSpecList.cpp33
-rw-r--r--source/Core/FormatEntity.cpp2
-rw-r--r--source/Core/IOHandler.cpp2
-rw-r--r--source/Core/Module.cpp37
-rw-r--r--source/Core/ModuleList.cpp3
-rw-r--r--source/Core/PluginManager.cpp48
-rw-r--r--source/Core/RegisterValue.cpp3
-rw-r--r--source/Core/Section.cpp8
-rw-r--r--source/Core/Value.cpp31
-rw-r--r--source/Core/ValueObjectDynamicValue.cpp4
-rw-r--r--source/Core/ValueObjectMemory.cpp4
-rw-r--r--source/Core/ValueObjectVariable.cpp6
-rw-r--r--source/Expression/DWARFExpression.cpp35
-rw-r--r--source/Expression/IRExecutionUnit.cpp6
-rw-r--r--source/Expression/IRInterpreter.cpp5
-rw-r--r--source/Host/CMakeLists.txt1
-rw-r--r--source/Host/common/Host.cpp4
-rw-r--r--source/Host/common/HostInfoBase.cpp31
-rw-r--r--source/Host/common/MainLoop.cpp37
-rw-r--r--source/Host/common/NativeProcessProtocol.cpp121
-rw-r--r--source/Host/common/NativeRegisterContext.cpp22
-rw-r--r--source/Host/common/NativeThreadProtocol.cpp26
-rw-r--r--source/Host/common/PseudoTerminal.cpp2
-rw-r--r--source/Host/common/Socket.cpp2
-rw-r--r--source/Host/common/Symbols.cpp48
-rw-r--r--source/Host/common/TaskPool.cpp (renamed from source/Utility/TaskPool.cpp)38
-rw-r--r--source/Host/common/XML.cpp2
-rw-r--r--source/Host/freebsd/Host.cpp9
-rw-r--r--source/Host/macosx/Host.mm4
-rw-r--r--source/Host/macosx/Symbols.cpp21
-rw-r--r--source/Host/posix/HostThreadPosix.cpp2
-rw-r--r--source/Host/posix/ProcessLauncherPosixFork.cpp6
-rw-r--r--source/Initialization/SystemInitializerCommon.cpp4
-rw-r--r--source/Interpreter/Args.cpp5
-rw-r--r--source/Interpreter/CommandInterpreter.cpp100
-rw-r--r--source/Interpreter/CommandObject.cpp7
-rw-r--r--source/Interpreter/OptionGroupArchitecture.cpp11
-rw-r--r--source/Interpreter/OptionGroupFormat.cpp5
-rw-r--r--source/Interpreter/OptionValueDictionary.cpp3
-rw-r--r--source/Interpreter/ScriptInterpreter.cpp5
-rw-r--r--source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp9
-rw-r--r--source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp2
-rw-r--r--source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp11
-rw-r--r--source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp41
-rw-r--r--source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp41
-rw-r--r--source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp99
-rw-r--r--source/Plugins/Architecture/Arm/ArchitectureArm.cpp131
-rw-r--r--source/Plugins/Architecture/Arm/ArchitectureArm.h35
-rw-r--r--source/Plugins/Architecture/Arm/CMakeLists.txt11
-rw-r--r--source/Plugins/Architecture/CMakeLists.txt1
-rw-r--r--source/Plugins/CMakeLists.txt1
-rw-r--r--source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp12
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp4
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp5
-rw-r--r--source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp44
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp357
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangASTSource.h107
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp268
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h17
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp12
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h2
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h1
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp8
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h1
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp1
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp9
-rw-r--r--source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp2
-rw-r--r--source/Plugins/Instruction/ARM/EmulationStateARM.cpp3
-rw-r--r--source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp7
-rw-r--r--source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp7
-rw-r--r--source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp82
-rw-r--r--source/Plugins/Language/CPlusPlus/CMakeLists.txt3
-rw-r--r--source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp39
-rw-r--r--source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp2
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxx.cpp3
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxx.h14
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp107
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp5
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxList.cpp268
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxMap.cpp9
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp61
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp83
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp5
-rw-r--r--source/Plugins/Language/CPlusPlus/LibCxxVector.cpp3
-rw-r--r--source/Plugins/Language/CPlusPlus/LibStdcpp.cpp7
-rw-r--r--source/Plugins/Language/ObjC/CMakeLists.txt12
-rw-r--r--source/Plugins/Language/ObjC/NSArray.cpp624
-rw-r--r--source/Plugins/Language/ObjC/NSDictionary.cpp319
-rw-r--r--source/Plugins/Language/ObjC/NSSet.cpp84
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp10
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h2
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h2
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp281
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h21
-rw-r--r--source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp24
-rw-r--r--source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp2
-rw-r--r--source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h3
-rw-r--r--source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp2
-rw-r--r--source/Plugins/ObjectFile/ELF/CMakeLists.txt1
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp167
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.h36
-rw-r--r--source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp11
-rw-r--r--source/Plugins/ObjectFile/JIT/ObjectFileJIT.h8
-rw-r--r--source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp5
-rw-r--r--source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp13
-rw-r--r--source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp1
-rw-r--r--source/Plugins/Platform/Android/AdbClient.cpp2
-rw-r--r--source/Plugins/Platform/Android/PlatformAndroid.cpp20
-rw-r--r--source/Plugins/Platform/Android/PlatformAndroid.h3
-rw-r--r--source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp12
-rw-r--r--source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h6
-rw-r--r--source/Plugins/Platform/Linux/PlatformLinux.cpp12
-rw-r--r--source/Plugins/Platform/Linux/PlatformLinux.h6
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformDarwin.cpp21
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp31
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp1
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm1
-rw-r--r--source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp12
-rw-r--r--source/Plugins/Platform/NetBSD/PlatformNetBSD.h6
-rw-r--r--source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp12
-rw-r--r--source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h6
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.cpp7
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.h3
-rw-r--r--source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp2
-rw-r--r--source/Plugins/Process/Darwin/MachException.cpp35
-rw-r--r--source/Plugins/Process/Darwin/NativeProcessDarwin.h30
-rw-r--r--source/Plugins/Process/FreeBSD/FreeBSDThread.cpp29
-rw-r--r--source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp16
-rw-r--r--source/Plugins/Process/FreeBSD/POSIXStopInfo.h13
-rw-r--r--source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp26
-rw-r--r--source/Plugins/Process/FreeBSD/ProcessMonitor.cpp6
-rw-r--r--source/Plugins/Process/FreeBSD/RegisterContextPOSIX.h2
-rw-r--r--source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp46
-rw-r--r--source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h2
-rw-r--r--source/Plugins/Process/Linux/CMakeLists.txt3
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.cpp282
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.h9
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp16
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux.h19
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp22
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h3
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp34
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h3
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp26
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h6
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp801
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h149
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp14
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h3
-rwxr-xr-xsource/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp120
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h8
-rw-r--r--source/Plugins/Process/Linux/NativeThreadLinux.cpp42
-rw-r--r--source/Plugins/Process/Linux/NativeThreadLinux.h11
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h2
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp2
-rw-r--r--source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp117
-rw-r--r--source/Plugins/Process/NetBSD/NativeProcessNetBSD.h10
-rw-r--r--source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp4
-rw-r--r--source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h4
-rw-r--r--source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp11
-rw-r--r--source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h3
-rw-r--r--source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp36
-rw-r--r--source/Plugins/Process/NetBSD/NativeThreadNetBSD.h4
-rw-r--r--source/Plugins/Process/Utility/CMakeLists.txt2
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.cpp6
-rw-r--r--source/Plugins/Process/Utility/InferiorCallPOSIX.cpp12
-rw-r--r--source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp4
-rw-r--r--source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp8
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMach_arm.cpp16
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMach_i386.cpp12
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp12
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp216
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h82
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp22
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h6
-rw-r--r--source/Plugins/Process/Utility/RegisterContext_mips.h5
-rw-r--r--source/Plugins/Process/Utility/RegisterContext_x86.h39
-rw-r--r--source/Plugins/Process/Utility/RegisterInfoInterface.h5
-rw-r--r--source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp66
-rw-r--r--source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h32
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_i386.h18
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_ppc64le.h476
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_x86_64.h27
-rw-r--r--source/Plugins/Process/Utility/StopInfoMachException.cpp1
-rw-r--r--source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp10
-rw-r--r--source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h210
-rw-r--r--source/Plugins/Process/elf-core/CMakeLists.txt2
-rw-r--r--source/Plugins/Process/elf-core/ProcessElfCore.cpp496
-rw-r--r--source/Plugins/Process/elf-core/ProcessElfCore.h24
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp2
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h7
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp4
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h7
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp5
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h7
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp8
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h8
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp132
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h49
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp4
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h7
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp4
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h7
-rw-r--r--source/Plugins/Process/elf-core/RegisterUtilities.cpp39
-rw-r--r--source/Plugins/Process/elf-core/RegisterUtilities.h110
-rw-r--r--source/Plugins/Process/elf-core/ThreadElfCore.cpp44
-rw-r--r--source/Plugins/Process/elf-core/ThreadElfCore.h29
-rw-r--r--source/Plugins/Process/gdb-remote/CMakeLists.txt5
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp46
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h10
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp49
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h4
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp7
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp329
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h29
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp5
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp2
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp24
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.h9
-rw-r--r--source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp1
-rw-r--r--source/Plugins/Process/mach-core/ProcessMachCore.cpp2
-rw-r--r--source/Plugins/Process/mach-core/ThreadMachCore.cpp2
-rw-r--r--source/Plugins/Process/minidump/MinidumpParser.h3
-rw-r--r--source/Plugins/Process/minidump/ProcessMinidump.h8
-rw-r--r--source/Plugins/Process/minidump/ThreadMinidump.cpp14
-rw-r--r--source/Plugins/Process/minidump/ThreadMinidump.h2
-rw-r--r--source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp54
-rw-r--r--source/Plugins/SymbolFile/DWARF/CMakeLists.txt3
-rw-r--r--source/Plugins/SymbolFile/DWARF/DIERef.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp30
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp70
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h53
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp12
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp24
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp102
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h6
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp21
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h14
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp37
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp36
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFFormValue.h1
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp99
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h22
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp25
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h9
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp36
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h34
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp142
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h55
-rw-r--r--source/Plugins/SymbolFile/PDB/PDBASTParser.cpp48
-rw-r--r--source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp15
-rw-r--r--source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp21
-rw-r--r--source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp2
-rw-r--r--source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp2
-rw-r--r--source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h5
-rw-r--r--source/Symbol/ArmUnwindInfo.cpp2
-rw-r--r--source/Symbol/ClangASTContext.cpp286
-rw-r--r--source/Symbol/ClangExternalASTSourceCommon.cpp16
-rw-r--r--source/Symbol/CompactUnwindInfo.cpp10
-rw-r--r--source/Symbol/CompilerType.cpp21
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp9
-rw-r--r--source/Symbol/JavaASTContext.cpp25
-rw-r--r--source/Symbol/ObjectFile.cpp33
-rw-r--r--source/Symbol/Symtab.cpp29
-rw-r--r--source/Symbol/Type.cpp2
-rw-r--r--source/Symbol/TypeSystem.cpp40
-rw-r--r--source/Symbol/Variable.cpp8
-rw-r--r--source/Target/PathMappingList.cpp1
-rw-r--r--source/Target/Platform.cpp52
-rw-r--r--source/Target/Process.cpp39
-rw-r--r--source/Target/ProcessLaunchInfo.cpp14
-rw-r--r--source/Target/RegisterContext.cpp136
-rw-r--r--source/Target/StackFrame.cpp4
-rw-r--r--source/Target/StopInfo.cpp54
-rw-r--r--source/Target/Target.cpp257
-rw-r--r--source/Target/Thread.cpp8
-rw-r--r--source/Target/ThreadPlanStepInRange.cpp8
-rw-r--r--source/Target/ThreadPlanTracer.cpp3
-rw-r--r--source/Target/UnixSignals.cpp2
-rw-r--r--source/Utility/ArchSpec.cpp (renamed from source/Core/ArchSpec.cpp)237
-rw-r--r--source/Utility/CMakeLists.txt46
-rw-r--r--source/Utility/DataEncoder.cpp44
-rw-r--r--source/Utility/DataExtractor.cpp111
-rw-r--r--source/Utility/FileSpec.cpp12
-rw-r--r--source/Utility/JSON.cpp5
-rw-r--r--source/Utility/Log.cpp19
-rw-r--r--source/Utility/Logging.cpp2
-rw-r--r--source/Utility/PPC64LE_DWARF_Registers.h194
-rw-r--r--source/Utility/PPC64LE_ehframe_Registers.h194
-rw-r--r--source/Utility/SelectHelper.cpp1
-rw-r--r--source/Utility/Status.cpp10
-rw-r--r--source/Utility/StringExtractorGDBRemote.cpp1
-rw-r--r--source/Utility/StructuredData.cpp1
-rw-r--r--source/Utility/UUID.cpp28
-rw-r--r--source/Utility/UriParser.cpp4
-rw-r--r--source/lldb.cpp12
-rw-r--r--test/CMakeLists.txt30
-rw-r--r--tools/CMakeLists.txt3
-rw-r--r--tools/argdumper/CMakeLists.txt4
-rw-r--r--tools/debugserver/source/CMakeLists.txt112
-rw-r--r--tools/debugserver/source/DNB.cpp6
-rw-r--r--tools/debugserver/source/DNBDataRef.cpp12
-rw-r--r--tools/debugserver/source/DNBRegisterInfo.cpp4
-rw-r--r--tools/debugserver/source/JSON.cpp3
-rw-r--r--tools/debugserver/source/MacOSX/MachException.cpp21
-rw-r--r--tools/debugserver/source/MacOSX/MachException.h9
-rw-r--r--tools/debugserver/source/MacOSX/MachProcess.mm112
-rw-r--r--tools/debugserver/source/MacOSX/MachTask.mm2
-rw-r--r--tools/debugserver/source/MacOSX/MachThread.cpp10
-rw-r--r--tools/debugserver/source/MacOSX/OsLogger.cpp4
-rw-r--r--tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp12
-rw-r--r--tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp12
-rw-r--r--tools/debugserver/source/RNBRemote.cpp76
-rw-r--r--tools/debugserver/source/RNBServices.cpp2
-rw-r--r--tools/debugserver/source/RNBSocket.cpp5
-rw-r--r--tools/debugserver/source/debugserver.cpp6
-rw-r--r--tools/driver/CMakeLists.txt2
-rw-r--r--tools/driver/Driver.cpp10
-rw-r--r--tools/intel-features/CMakeLists.txt67
-rw-r--r--tools/intel-features/README.txt73
-rw-r--r--tools/intel-features/cli-wrapper.cpp43
-rw-r--r--tools/intel-features/intel-mpx/CMakeLists.txt9
-rw-r--r--tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp (renamed from tools/intel-mpx/IntelMPXTablePlugin.cpp)22
-rw-r--r--tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h12
-rw-r--r--tools/intel-features/intel-mpx/test/Makefile (renamed from tools/intel-mpx/test/Makefile)0
-rw-r--r--tools/intel-features/intel-mpx/test/README.txt (renamed from tools/intel-mpx/test/README.txt)2
-rw-r--r--tools/intel-features/intel-mpx/test/TestMPXTable.py (renamed from tools/intel-mpx/test/TestMPXTable.py)11
-rw-r--r--tools/intel-features/intel-mpx/test/main.cpp (renamed from tools/intel-mpx/test/main.cpp)3
-rw-r--r--tools/intel-features/intel-pt/CMakeLists.txt31
-rw-r--r--tools/intel-features/intel-pt/Decoder.cpp904
-rw-r--r--tools/intel-features/intel-pt/Decoder.h327
-rw-r--r--tools/intel-features/intel-pt/PTDecoder.cpp175
-rw-r--r--tools/intel-features/intel-pt/PTDecoder.h310
-rw-r--r--tools/intel-features/intel-pt/README_CLI.txt123
-rw-r--r--tools/intel-features/intel-pt/README_TOOL.txt311
-rw-r--r--tools/intel-features/intel-pt/cli-wrapper-pt.cpp583
-rw-r--r--tools/intel-features/intel-pt/cli-wrapper-pt.h13
-rw-r--r--tools/intel-features/intel-pt/interface/PTDecoder.i10
-rw-r--r--tools/intel-features/scripts/CMakeLists.txt37
-rw-r--r--tools/intel-features/scripts/lldb-intel-features.swig16
-rw-r--r--tools/intel-features/scripts/python-typemaps.txt31
-rw-r--r--tools/intel-mpx/CMakeLists.txt15
-rw-r--r--tools/lldb-mi/MICmdCmdVar.cpp14
-rw-r--r--tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp4
-rw-r--r--tools/lldb-mi/MIDriverMain.cpp8
-rw-r--r--tools/lldb-server/CMakeLists.txt37
-rw-r--r--tools/lldb-server/lldb-gdbserver.cpp99
-rw-r--r--tools/lldb-test/CMakeLists.txt27
-rw-r--r--tools/lldb-test/FormatUtil.cpp69
-rw-r--r--tools/lldb-test/FormatUtil.h75
-rw-r--r--tools/lldb-test/SystemInitializerTest.cpp345
-rw-r--r--tools/lldb-test/SystemInitializerTest.h35
-rw-r--r--tools/lldb-test/lldb-test.cpp126
-rw-r--r--unittests/CMakeLists.txt7
-rw-r--r--unittests/Core/CMakeLists.txt1
-rw-r--r--unittests/Core/DataExtractorTest.cpp117
-rw-r--r--unittests/Editline/EditlineTest.cpp4
-rw-r--r--unittests/Host/CMakeLists.txt2
-rw-r--r--unittests/Host/HostInfoTest.cpp45
-rw-r--r--unittests/Host/MainLoopTest.cpp20
-rw-r--r--unittests/Host/TaskPoolTest.cpp (renamed from unittests/Utility/TaskPoolTest.cpp)4
-rw-r--r--unittests/Interpreter/CMakeLists.txt1
-rw-r--r--unittests/Interpreter/TestArgs.cpp11
-rw-r--r--unittests/Interpreter/TestCompletion.cpp2
-rw-r--r--unittests/ObjectFile/ELF/TestObjectFileELF.cpp7
-rw-r--r--unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp42
-rw-r--r--unittests/Process/minidump/MinidumpParserTest.cpp8
-rw-r--r--unittests/Symbol/TestClangASTContext.cpp56
-rw-r--r--unittests/Symbol/TestDWARFCallFrameInfo.cpp5
-rw-r--r--unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp4
-rw-r--r--unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp4
-rw-r--r--unittests/Target/ModuleCacheTest.cpp2
-rw-r--r--unittests/TestingSupport/CMakeLists.txt (renamed from unittests/Utility/Helpers/CMakeLists.txt)0
-rw-r--r--unittests/TestingSupport/MockTildeExpressionResolver.cpp (renamed from unittests/Utility/Helpers/MockTildeExpressionResolver.cpp)0
-rw-r--r--unittests/TestingSupport/MockTildeExpressionResolver.h (renamed from unittests/Utility/Helpers/MockTildeExpressionResolver.h)0
-rw-r--r--unittests/TestingSupport/TestUtilities.cpp (renamed from unittests/Utility/Helpers/TestUtilities.cpp)0
-rw-r--r--unittests/TestingSupport/TestUtilities.h (renamed from unittests/Utility/Helpers/TestUtilities.h)0
-rw-r--r--unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp12
-rw-r--r--unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp6
-rw-r--r--unittests/Utility/ArchSpecTest.cpp (renamed from unittests/Core/ArchSpecTest.cpp)3
-rw-r--r--unittests/Utility/CMakeLists.txt5
-rw-r--r--unittests/Utility/JSONTest.cpp26
-rw-r--r--unittests/Utility/StructuredDataTest.cpp2
-rw-r--r--unittests/Utility/TildeExpressionResolverTest.cpp2
-rw-r--r--unittests/Utility/VASprintfTest.cpp12
-rw-r--r--unittests/debugserver/CMakeLists.txt19
-rw-r--r--unittests/tools/CMakeLists.txt2
-rw-r--r--unittests/tools/lldb-server/CMakeLists.txt18
-rw-r--r--unittests/tools/lldb-server/inferior/environment_check.cpp20
-rw-r--r--unittests/tools/lldb-server/tests/CMakeLists.txt8
-rw-r--r--unittests/tools/lldb-server/tests/LLGSTest.cpp36
-rw-r--r--unittests/tools/lldb-server/tests/MessageObjects.cpp152
-rw-r--r--unittests/tools/lldb-server/tests/MessageObjects.h85
-rw-r--r--unittests/tools/lldb-server/tests/TestBase.cpp36
-rw-r--r--unittests/tools/lldb-server/tests/TestBase.h48
-rw-r--r--unittests/tools/lldb-server/tests/TestClient.cpp291
-rw-r--r--unittests/tools/lldb-server/tests/TestClient.h74
-rw-r--r--unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp46
-rwxr-xr-xwww/build.html28
-rw-r--r--www/remote.html140
-rw-r--r--www/test.html176
-rwxr-xr-xwww/troubleshooting.html16
-rwxr-xr-xwww/tutorial.html67
979 files changed, 20235 insertions, 7065 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ada293811b3e..c6b082e104e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,13 @@ include(LLDBStandalone)
include(LLDBConfig)
include(AddLLDB)
+# Define the LLDB_CONFIGURATION_xxx matching the build type
+if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
+ add_definitions( -DLLDB_CONFIGURATION_DEBUG )
+else()
+ add_definitions( -DLLDB_CONFIGURATION_RELEASE )
+endif()
+
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
else()
@@ -24,6 +31,10 @@ if (LLDB_DISABLE_LIBEDIT)
add_definitions( -DLLDB_DISABLE_LIBEDIT )
endif()
+if(APPLE)
+ add_definitions(-DLLDB_USE_OS_LOG)
+endif()
+
# add_subdirectory(include)
add_subdirectory(docs)
if (NOT LLDB_DISABLE_PYTHON)
@@ -32,22 +43,45 @@ if (NOT LLDB_DISABLE_PYTHON)
endif()
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
+ set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
if(LLDB_BUILD_FRAMEWORK)
set(LLDB_PYTHON_TARGET_DIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+ set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
else()
# Don't set -m when building the framework.
set(FINISH_EXTRA_ARGS "-m")
endif()
- set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
+
add_subdirectory(scripts)
endif ()
add_subdirectory(source)
-add_subdirectory(test)
add_subdirectory(tools)
-add_subdirectory(unittests)
-add_subdirectory(lit)
+
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests."
+ ${LLVM_INCLUDE_TESTS})
+if(LLDB_INCLUDE_TESTS)
+ if (TARGET clang)
+ set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
+ set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+ else()
+ set(LLDB_DEFAULT_TEST_C_COMPILER "")
+ set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
+ endif()
+
+ set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
+ set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors")
+
+ if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
+ ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
+ message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run")
+ endif()
+
+ add_subdirectory(test)
+ add_subdirectory(unittests)
+ add_subdirectory(lit)
+endif()
if (NOT LLDB_DISABLE_PYTHON)
# Add a Post-Build Event to copy over Python files and create the symlink
diff --git a/CODE_OWNERS.txt b/CODE_OWNERS.txt
index 8fe43284cf6c..dac886870779 100644
--- a/CODE_OWNERS.txt
+++ b/CODE_OWNERS.txt
@@ -8,10 +8,6 @@ beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
-N: Sean Callanan
-E: scallanan@apple.com
-D: Expression evaluator, IR interpreter, Clang integration
-
N: Greg Clayton
E: clayborg@gmail.com
D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, Mac-specific code,
@@ -22,6 +18,7 @@ N: Jim Ingham
E: jingham@apple.com
D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, Breakpoints, ABI
D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C Language runtime
+D: Expression evaluator, IR interpreter, Clang integration
D: Data Formatters
N: Ilia K
diff --git a/cmake/LLDBDependencies.cmake b/cmake/LLDBDependencies.cmake
deleted file mode 100644
index 55ce37908563..000000000000
--- a/cmake/LLDBDependencies.cmake
+++ /dev/null
@@ -1,52 +0,0 @@
-set(LLDB_SYSTEM_LIBS)
-
-# Windows-only libraries
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
- list(APPEND LLDB_SYSTEM_LIBS
- ws2_32
- rpcrt4
- )
-endif ()
-
-if (NOT LLDB_DISABLE_LIBEDIT)
- list(APPEND LLDB_SYSTEM_LIBS edit)
-endif()
-if (NOT LLDB_DISABLE_CURSES)
- list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
- if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
- list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
- endif()
-endif()
-
-if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
- list(APPEND LLDB_SYSTEM_LIBS atomic)
-endif()
-
-list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
-
-if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
- list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
-endif()
-
-list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
-
-if (LLVM_BUILD_STATIC)
- if (NOT LLDB_DISABLE_PYTHON)
- list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
- endif()
- if (NOT LLDB_DISABLE_CURSES)
- list(APPEND LLDB_SYSTEM_LIBS gpm)
- endif()
-endif()
-
-if ( NOT LLDB_DISABLE_PYTHON )
- set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
- if (CLANG_CL)
- set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES COMPILE_FLAGS -Wno-unused-function)
- endif()
- if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
- NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
- set_property(SOURCE ${LLDB_WRAP_PYTHON}
- APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
- endif ()
-endif()
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
index 4c6f1efd673d..2fd8b384d9e3 100644
--- a/cmake/modules/AddLLDB.cmake
+++ b/cmake/modules/AddLLDB.cmake
@@ -4,7 +4,7 @@ function(add_lldb_library name)
cmake_parse_arguments(PARAM
"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
""
- "DEPENDS;LINK_LIBS;LINK_COMPONENTS"
+ "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
${ARGN})
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
@@ -35,6 +35,8 @@ function(add_lldb_library name)
endif()
#PIC not needed on Win
+ # FIXME: Setting CMAKE_CXX_FLAGS here is a no-op, use target_compile_options
+ # or omit this logic instead.
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
@@ -64,11 +66,9 @@ function(add_lldb_library name)
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
endif()
@@ -76,10 +76,10 @@ function(add_lldb_library name)
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
# but it is simple enough to make all of LLDB depend on some of those
# headers without negatively impacting much of anything.
- get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS)
- if(CLANG_TABLEGEN_TARGETS)
- add_dependencies(${name} ${CLANG_TABLEGEN_TARGETS})
- endif()
+ add_dependencies(${name} clang-tablegen-targets)
+
+ # Add in any extra C++ compilation flags for this library.
+ target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
endfunction(add_lldb_library)
@@ -95,17 +95,21 @@ function(add_lldb_executable name)
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
- target_link_libraries(${name} ${ARG_LINK_LIBS})
+ target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
set_target_properties(${name} PROPERTIES
FOLDER "lldb executables")
if(LLDB_BUILD_FRAMEWORK)
if(ARG_INCLUDE_IN_FRAMEWORK)
+ if(NOT IOS)
+ set(resource_dir "/Resources")
+ set(resource_dots "../")
+ endif()
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
set_target_properties(${name} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>/Resources
+ RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir}
BUILD_WITH_INSTALL_RPATH On
- INSTALL_RPATH "@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
+ INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
# For things inside the framework we don't need functional install targets
# because CMake copies the resources and headers from the build directory.
# But we still need this target to exist in order to use the
@@ -115,6 +119,8 @@ function(add_lldb_executable name)
if(ARG_GENERATE_INSTALL)
add_custom_target(install-${name} DEPENDS ${name})
add_dependencies(install-liblldb ${name})
+ add_custom_target(install-${name}-stripped DEPENDS ${name})
+ add_dependencies(install-liblldb-stripped ${name})
endif()
else()
set_target_properties(${name} PROPERTIES
@@ -128,11 +134,9 @@ function(add_lldb_executable name)
COMPONENT ${name}
RUNTIME DESTINATION bin)
if (NOT CMAKE_CONFIGURATION_TYPES)
- add_custom_target(install-${name}
- DEPENDS ${name}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index 726552675f47..8f75880dfbff 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -22,10 +22,6 @@ elseif(IOS)
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
endif()
-if(IOS)
- add_definitions(-DNO_XPC_SERVICES)
-endif()
-
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
"Disables the Python scripting integration.")
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
@@ -235,6 +231,12 @@ if (CXX_SUPPORTS_NO_VLA_EXTENSION)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
endif ()
+check_cxx_compiler_flag("-Wno-gnu-anonymous-struct"
+ CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
+
+check_cxx_compiler_flag("-Wno-nested-anon-types"
+ CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
+
# Disable MSVC warnings
if( MSVC )
add_definitions(
@@ -282,6 +284,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
PATTERN "Config.h" EXCLUDE
+ PATTERN "lldb-*.h" EXCLUDE
+ PATTERN "API/*.h" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
@@ -291,6 +295,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
+ PATTERN "lldb-*.h" EXCLUDE
+ PATTERN "API/*.h" EXCLUDE
)
endif()
diff --git a/cmake/modules/LLDBGenerateConfig.cmake b/cmake/modules/LLDBGenerateConfig.cmake
index d3d0cb220b93..ca2d5842a806 100644
--- a/cmake/modules/LLDBGenerateConfig.cmake
+++ b/cmake/modules/LLDBGenerateConfig.cmake
@@ -3,11 +3,13 @@
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckIncludeFiles)
+include(CheckLibraryExists)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
set(CMAKE_REQUIRED_DEFINITIONS)
check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
+check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
check_include_file(termios.h HAVE_TERMIOS_H)
check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
@@ -21,6 +23,8 @@ check_cxx_source_compiles("
int main() { return __NR_process_vm_readv; }"
HAVE_NR_PROCESS_VM_READV)
+check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
+
# These checks exist in LLVM's configuration, so I want to match the LLVM names
# so that the check isn't duplicated, but we translate them into the LLDB names
# so that I don't have to change all the uses at the moment.
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index 2f959c91fdd7..f07a3fcb57b6 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -3,10 +3,6 @@
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(lldb)
- if (POLICY CMP0022)
- cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
- endif()
-
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
# Rely on llvm-config.
diff --git a/examples/darwin/heap_find/heap.py b/examples/darwin/heap_find/heap.py
index 2189077a4e1c..81f36adb9c51 100644
--- a/examples/darwin/heap_find/heap.py
+++ b/examples/darwin/heap_find/heap.py
@@ -576,19 +576,19 @@ typedef struct $malloc_stack_history {
unsigned idx;
malloc_stack_entry entries[MAX_HISTORY];
} $malloc_stack_history;
-$malloc_stack_history info = { (task_t)mach_task_self(), 0 };
+$malloc_stack_history lldb_info = { (task_t)mach_task_self(), 0 };
uint32_t max_stack_frames = MAX_FRAMES;
enumerate_callback_t callback = [] (mach_stack_logging_record_t stack_record, void *baton) -> void {
- $malloc_stack_history *info = ($malloc_stack_history *)baton;
- if (info->idx < MAX_HISTORY) {
- malloc_stack_entry *stack_entry = &(info->entries[info->idx]);
+ $malloc_stack_history *lldb_info = ($malloc_stack_history *)baton;
+ if (lldb_info->idx < MAX_HISTORY) {
+ malloc_stack_entry *stack_entry = &(lldb_info->entries[lldb_info->idx]);
stack_entry->address = stack_record.address;
stack_entry->type_flags = stack_record.type_flags;
stack_entry->argument = stack_record.argument;
stack_entry->num_frames = 0;
stack_entry->frames[0] = 0;
stack_entry->frames_err = (kern_return_t)__mach_stack_logging_frames_for_uniqued_stack (
- info->task,
+ lldb_info->task,
stack_record.stack_identifier,
stack_entry->frames,
(uint32_t)MAX_FRAMES,
@@ -597,10 +597,10 @@ enumerate_callback_t callback = [] (mach_stack_logging_record_t stack_record, vo
if (stack_entry->num_frames < MAX_FRAMES)
stack_entry->frames[stack_entry->num_frames] = 0;
}
- ++info->idx;
+ ++lldb_info->idx;
};
-(kern_return_t)__mach_stack_logging_enumerate_records (info.task, (uint64_t)0x%x, callback, &info);
-info''' % (options.max_frames, options.max_history, addr)
+(kern_return_t)__mach_stack_logging_enumerate_records (lldb_info.task, (uint64_t)0x%x, callback, &lldb_info);
+lldb_info''' % (options.max_frames, options.max_history, addr)
frame = lldb.debugger.GetSelectedTarget().GetProcess(
).GetSelectedThread().GetSelectedFrame()
@@ -924,18 +924,18 @@ typedef struct callback_baton_t {
void *ptr;
} callback_baton_t;
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
- callback_baton_t *info = (callback_baton_t *)baton;
+ callback_baton_t *lldb_info = (callback_baton_t *)baton;
typedef void* T;
const unsigned size = sizeof(T);
T *array = (T*)ptr_addr;
for (unsigned idx = 0; ((idx + 1) * sizeof(T)) <= ptr_size; ++idx) {
- if (array[idx] == info->ptr) {
- if (info->num_matches < MAX_MATCHES) {
- info->matches[info->num_matches].addr = (void*)ptr_addr;
- info->matches[info->num_matches].size = ptr_size;
- info->matches[info->num_matches].offset = idx*sizeof(T);
- info->matches[info->num_matches].type = type;
- ++info->num_matches;
+ if (array[idx] == lldb_info->ptr) {
+ if (lldb_info->num_matches < MAX_MATCHES) {
+ lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
+ lldb_info->matches[lldb_info->num_matches].size = ptr_size;
+ lldb_info->matches[lldb_info->num_matches].offset = idx*sizeof(T);
+ lldb_info->matches[lldb_info->num_matches].type = type;
+ ++lldb_info->num_matches;
}
}
}
@@ -1033,18 +1033,18 @@ typedef struct callback_baton_t {
unsigned cstr_len;
} callback_baton_t;
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
- callback_baton_t *info = (callback_baton_t *)baton;
- if (info->cstr_len < ptr_size) {
+ callback_baton_t *lldb_info = (callback_baton_t *)baton;
+ if (lldb_info->cstr_len < ptr_size) {
const char *begin = (const char *)ptr_addr;
const char *end = begin + ptr_size - info->cstr_len;
for (const char *s = begin; s < end; ++s) {
- if ((int)memcmp(s, info->cstr, info->cstr_len) == 0) {
- if (info->num_matches < MAX_MATCHES) {
- info->matches[info->num_matches].addr = (void*)ptr_addr;
- info->matches[info->num_matches].size = ptr_size;
- info->matches[info->num_matches].offset = s - begin;
- info->matches[info->num_matches].type = type;
- ++info->num_matches;
+ if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) {
+ if (lldb_info->num_matches < MAX_MATCHES) {
+ lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
+ lldb_info->matches[lldb_info->num_matches].size = ptr_size;
+ lldb_info->matches[lldb_info->num_matches].offset = s - begin;
+ lldb_info->matches[lldb_info->num_matches].type = type;
+ ++lldb_info->num_matches;
}
}
}
@@ -1135,17 +1135,17 @@ typedef struct callback_baton_t {
void *ptr;
} callback_baton_t;
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
- callback_baton_t *info = (callback_baton_t *)baton;
- if (info->num_matches == 0) {
- uint8_t *p = (uint8_t *)info->ptr;
+ callback_baton_t *lldb_info = (callback_baton_t *)baton;
+ if (lldb_info->num_matches == 0) {
+ uint8_t *p = (uint8_t *)lldb_info->ptr;
uint8_t *lo = (uint8_t *)ptr_addr;
uint8_t *hi = lo + ptr_size;
if (lo <= p && p < hi) {
- info->matches[info->num_matches].addr = (void*)ptr_addr;
- info->matches[info->num_matches].size = ptr_size;
- info->matches[info->num_matches].offset = p - lo;
- info->matches[info->num_matches].type = type;
- info->num_matches = 1;
+ lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
+ lldb_info->matches[lldb_info->num_matches].size = ptr_size;
+ lldb_info->matches[lldb_info->num_matches].offset = p - lo;
+ lldb_info->matches[lldb_info->num_matches].type = type;
+ lldb_info->num_matches = 1;
}
}
};
@@ -1397,24 +1397,24 @@ compare_callback_t compare_callback = [](const void *a, const void *b) -> int {
typedef Class (*class_getSuperclass_type)(void *isa);
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
class_getSuperclass_type class_getSuperclass_impl = (class_getSuperclass_type)class_getSuperclass;
- callback_baton_t *info = (callback_baton_t *)baton;
+ callback_baton_t *lldb_info = (callback_baton_t *)baton;
if (sizeof(Class) <= ptr_size) {
Class *curr_class_ptr = (Class *)ptr_addr;
Class *matching_class_ptr = (Class *)bsearch (curr_class_ptr,
- (const void *)info->classes,
- sizeof(info->classes)/sizeof(Class),
+ (const void *)lldb_info->classes,
+ sizeof(lldb_info->classes)/sizeof(Class),
sizeof(Class),
- info->compare_callback);
+ lldb_info->compare_callback);
if (matching_class_ptr) {
bool match = false;
- if (info->isa) {
+ if (lldb_info->isa) {
Class isa = *curr_class_ptr;
- if (info->isa == isa)
+ if (lldb_info->isa == isa)
match = true;
- else { // if (info->objc.match_superclasses) {
+ else { // if (lldb_info->objc.match_superclasses) {
Class super = class_getSuperclass_impl(isa);
while (super) {
- if (super == info->isa) {
+ if (super == lldb_info->isa) {
match = true;
break;
}
@@ -1425,12 +1425,12 @@ range_callback_t range_callback = [](task_t task, void *baton, unsigned type, ui
else
match = true;
if (match) {
- if (info->num_matches < MAX_MATCHES) {
- info->matches[info->num_matches].addr = (void*)ptr_addr;
- info->matches[info->num_matches].size = ptr_size;
- info->matches[info->num_matches].offset = 0;
- info->matches[info->num_matches].type = type;
- ++info->num_matches;
+ if (lldb_info->num_matches < MAX_MATCHES) {
+ lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
+ lldb_info->matches[lldb_info->num_matches].size = ptr_size;
+ lldb_info->matches[lldb_info->num_matches].offset = 0;
+ lldb_info->matches[lldb_info->num_matches].type = type;
+ ++lldb_info->num_matches;
}
}
}
diff --git a/examples/python/cmdtemplate.py b/examples/python/cmdtemplate.py
index dfe3e6fa52b9..4d506b91aaf8 100644
--- a/examples/python/cmdtemplate.py
+++ b/examples/python/cmdtemplate.py
@@ -14,99 +14,109 @@ import commands
import optparse
import shlex
+class FrameStatCommand:
+ def create_options(self):
-def create_framestats_options():
- usage = "usage: %prog [options]"
- description = '''This command is meant to be an example of how to make an LLDB command that
+ usage = "usage: %prog [options]"
+ description = '''This command is meant to be an example of how to make an LLDB command that
does something useful, follows best practices, and exploits the SB API.
Specifically, this command computes the aggregate and average size of the variables in the current frame
and allows you to tweak exactly which variables are to be accounted in the computation.
'''
- parser = optparse.OptionParser(
- description=description,
- prog='framestats',
- usage=usage)
- parser.add_option(
- '-i',
- '--in-scope',
- action='store_true',
- dest='inscope',
- help='in_scope_only = True',
- default=False)
- parser.add_option(
- '-a',
- '--arguments',
- action='store_true',
- dest='arguments',
- help='arguments = True',
- default=False)
- parser.add_option(
- '-l',
- '--locals',
- action='store_true',
- dest='locals',
- help='locals = True',
- default=False)
- parser.add_option(
- '-s',
- '--statics',
- action='store_true',
- dest='statics',
- help='statics = True',
- default=False)
- return parser
-
-
-def the_framestats_command(debugger, command, result, dict):
- # Use the Shell Lexer to properly parse up command options just like a
- # shell would
- command_args = shlex.split(command)
- parser = create_framestats_options()
- try:
- (options, args) = parser.parse_args(command_args)
- except:
- # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
- # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
- result.SetError("option parsing failed")
- return
-
- # in a command - the lldb.* convenience variables are not to be used
- # and their values (if any) are undefined
- # this is the best practice to access those objects from within a command
- target = debugger.GetSelectedTarget()
- process = target.GetProcess()
- thread = process.GetSelectedThread()
- frame = thread.GetSelectedFrame()
- if not frame.IsValid():
- return "no frame here"
- # from now on, replace lldb.<thing>.whatever with <thing>.whatever
- variables_list = frame.GetVariables(
- options.arguments,
- options.locals,
- options.statics,
- options.inscope)
- variables_count = variables_list.GetSize()
- if variables_count == 0:
- print >> result, "no variables here"
- return
- total_size = 0
- for i in range(0, variables_count):
- variable = variables_list.GetValueAtIndex(i)
- variable_type = variable.GetType()
- total_size = total_size + variable_type.GetByteSize()
- average_size = float(total_size) / variables_count
- print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (
- variables_count, total_size, average_size)
- # not returning anything is akin to returning success
+
+ # Pass add_help_option = False, since this keeps the command in line with lldb commands,
+ # and we wire up "help command" to work by providing the long & short help methods below.
+ self.parser = optparse.OptionParser(
+ description = description,
+ prog = 'framestats',
+ usage = usage,
+ add_help_option = False)
+
+ self.parser.add_option(
+ '-i',
+ '--in-scope',
+ action = 'store_true',
+ dest = 'inscope',
+ help = 'in_scope_only = True',
+ default = True)
+
+ self.parser.add_option(
+ '-a',
+ '--arguments',
+ action = 'store_true',
+ dest = 'arguments',
+ help = 'arguments = True',
+ default = True)
+
+ self.parser.add_option(
+ '-l',
+ '--locals',
+ action = 'store_true',
+ dest = 'locals',
+ help = 'locals = True',
+ default = True)
+
+ self.parser.add_option(
+ '-s',
+ '--statics',
+ action = 'store_true',
+ dest = 'statics',
+ help = 'statics = True',
+ default = True)
+
+ def get_short_help(self):
+ return "Example command for use in debugging"
+
+ def get_long_help(self):
+ return self.help_string
+
+ def __init__(self, debugger, unused):
+ self.create_options()
+ self.help_string = self.parser.format_help()
+
+ def __call__(self, debugger, command, exe_ctx, result):
+ # Use the Shell Lexer to properly parse up command options just like a
+ # shell would
+ command_args = shlex.split(command)
+
+ try:
+ (options, args) = self.parser.parse_args(command_args)
+ except:
+ # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
+ # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
+ result.SetError("option parsing failed")
+ return
+
+ # Always get program state from the SBExecutionContext passed in as exe_ctx
+ frame = exe_ctx.GetFrame()
+ if not frame.IsValid():
+ result.SetError("invalid frame")
+ return
+
+ variables_list = frame.GetVariables(
+ options.arguments,
+ options.locals,
+ options.statics,
+ options.inscope)
+ variables_count = variables_list.GetSize()
+ if variables_count == 0:
+ print >> result, "no variables here"
+ return
+ total_size = 0
+ for i in range(0, variables_count):
+ variable = variables_list.GetValueAtIndex(i)
+ variable_type = variable.GetType()
+ total_size = total_size + variable_type.GetByteSize()
+ average_size = float(total_size) / variables_count
+ print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (
+ variables_count, total_size, average_size)
+ # not returning anything is akin to returning success
def __lldb_init_module(debugger, dict):
# This initializer is being run from LLDB in the embedded command interpreter
- # Make the options so we can generate the help text for the new LLDB
- # command line command prior to registering it with LLDB below
- parser = create_framestats_options()
- the_framestats_command.__doc__ = parser.format_help()
+
# Add any commands contained in this module to LLDB
debugger.HandleCommand(
- 'command script add -f cmdtemplate.the_framestats_command framestats')
- print 'The "framestats" command has been installed, type "help framestats" or "framestats --help" for detailed help.'
+ 'command script add -c cmdtemplate.FrameStatCommand framestats')
+ print 'The "framestats" command has been installed, type "help framestats" for detailed help.'
diff --git a/examples/python/crashlog.py b/examples/python/crashlog.py
index 7270f60f4373..227fce114052 100755
--- a/examples/python/crashlog.py
+++ b/examples/python/crashlog.py
@@ -680,7 +680,7 @@ def interactive_crashlogs(options, args):
interpreter.cmdloop()
-def save_crashlog(debugger, command, result, dict):
+def save_crashlog(debugger, command, exe_ctx, result, dict):
usage = "usage: %prog [options] <output-path>"
description = '''Export the state of current target into a crashlog file'''
parser = optparse.OptionParser(
@@ -709,11 +709,12 @@ def save_crashlog(debugger, command, result, dict):
"error: failed to open file '%s' for writing...",
args[0])
return
- target = debugger.GetSelectedTarget()
+ target = exe_ctx.target
if target:
identifier = target.executable.basename
- if lldb.process:
- pid = lldb.process.id
+ process = exe_ctx.process
+ if process:
+ pid = process.id
if pid != lldb.LLDB_INVALID_PROCESS_ID:
out_file.write(
'Process: %s [%u]\n' %
@@ -726,8 +727,8 @@ def save_crashlog(debugger, command, result, dict):
'OS Version: Mac OS X %s (%s)\n' %
(platform.mac_ver()[0], commands.getoutput('sysctl -n kern.osversion')))
out_file.write('Report Version: 9\n')
- for thread_idx in range(lldb.process.num_threads):
- thread = lldb.process.thread[thread_idx]
+ for thread_idx in range(process.num_threads):
+ thread = process.thread[thread_idx]
out_file.write('\nThread %u:\n' % (thread_idx))
for (frame_idx, frame) in enumerate(thread.frames):
frame_pc = frame.pc
diff --git a/examples/python/lldb_module_utils.py b/examples/python/lldb_module_utils.py
index eb00a489ce01..006f232681f8 100644
--- a/examples/python/lldb_module_utils.py
+++ b/examples/python/lldb_module_utils.py
@@ -7,72 +7,185 @@ import string
import sys
-def create_dump_module_line_tables_options():
- usage = "usage: dump_module_line_tables [options] MODULE1 [MODULE2 ...]"
- description = '''Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.'''
- parser = optparse.OptionParser(
- description=description,
- prog='start_gdb_log',
- usage=usage)
- parser.add_option(
- '-v',
- '--verbose',
- action='store_true',
- dest='verbose',
- help='Display verbose output.',
- default=False)
- return parser
-
-
-def dump_module_line_tables(debugger, command, result, dict):
- '''Dumps all line tables from all compile units for any modules specified as arguments.'''
- command_args = shlex.split(command)
-
- parser = create_dump_module_line_tables_options()
- try:
- (options, args) = parser.parse_args(command_args)
- except:
- return
- if command_args:
- target = debugger.GetSelectedTarget()
- lldb.target = target
- for module_name in command_args:
- result.PutCString('Searching for module "%s"' % (module_name,))
- module_fspec = lldb.SBFileSpec(module_name, False)
- module = target.FindModule(module_fspec)
- if module:
- for cu_idx in range(module.GetNumCompileUnits()):
- cu = module.GetCompileUnitAtIndex(cu_idx)
- result.PutCString("\n%s:" % (cu.file))
- for line_idx in range(cu.GetNumLineEntries()):
- line_entry = cu.GetLineEntryAtIndex(line_idx)
- start_file_addr = line_entry.addr.file_addr
- end_file_addr = line_entry.end_addr.file_addr
- # If the two addresses are equal, this line table entry
- # is a termination entry
- if options.verbose:
- if start_file_addr != end_file_addr:
- result.PutCString(
- '[%#x - %#x): %s' %
- (start_file_addr, end_file_addr, line_entry))
- else:
- if start_file_addr == end_file_addr:
- result.PutCString('%#x: END' %
- (start_file_addr))
- else:
- result.PutCString(
- '%#x: %s' %
- (start_file_addr, line_entry))
+class DumpLineTables:
+ command_name = "dump-line-tables"
+ short_decription = "Dumps full paths to compile unit files and optionally all line table files."
+ description = 'Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.'
+ usage = "usage: %prog [options] MODULE1 [MODULE2 ...]"
+ def create_options(self):
+ self.parser = optparse.OptionParser(
+ description=self.description,
+ prog=self.command_name,
+ usage=self.usage)
+
+ self.parser.add_option(
+ '-v',
+ '--verbose',
+ action='store_true',
+ dest='verbose',
+ help='Display verbose output.',
+ default=False)
+
+ def get_short_help(self):
+ return self.short_decription
+
+ def get_long_help(self):
+ return self.help_string
+
+ def __init__(self, debugger, unused):
+ self.create_options()
+ self.help_string = self.parser.format_help()
+
+ def __call__(self, debugger, command, exe_ctx, result):
+ # Use the Shell Lexer to properly parse up command options just like a
+ # shell would
+ command_args = shlex.split(command)
+
+ try:
+ (options, args) = self.parser.parse_args(command_args)
+ except:
+ # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
+ # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
+ result.SetError("option parsing failed")
+ return
+
+ # Always get program state from the SBExecutionContext passed in as exe_ctx
+ target = exe_ctx.GetTarget()
+ if not target.IsValid():
+ result.SetError("invalid target")
+ return
+
+ for module_path in args:
+ module = target.module[module_path]
+ if not module:
+ result.SetError('no module found that matches "%s".' % (module_path))
+ return
+ num_cus = module.GetNumCompileUnits()
+ print >>result, 'Module: "%s"' % (module.file.fullpath),
+ if num_cus == 0:
+ print >>result, 'no debug info.'
+ continue
+ print >>result, 'has %u compile units:' % (num_cus)
+ for cu_idx in range(num_cus):
+ cu = module.GetCompileUnitAtIndex(cu_idx)
+ print >>result, ' Compile Unit: %s' % (cu.file.fullpath)
+ for line_idx in range(cu.GetNumLineEntries()):
+ line_entry = cu.GetLineEntryAtIndex(line_idx)
+ start_file_addr = line_entry.addr.file_addr
+ end_file_addr = line_entry.end_addr.file_addr
+ # If the two addresses are equal, this line table entry
+ # is a termination entry
+ if options.verbose:
+ if start_file_addr != end_file_addr:
+ result.PutCString(
+ ' [%#x - %#x): %s' %
+ (start_file_addr, end_file_addr, line_entry))
+ else:
if start_file_addr == end_file_addr:
- result.Printf("\n")
- else:
- result.PutCString("no module for '%s'" % module)
- else:
- result.PutCString("error: invalid target")
-
-parser = create_dump_module_line_tables_options()
-dump_module_line_tables.__doc__ = parser.format_help()
-lldb.debugger.HandleCommand(
- 'command script add -f %s.dump_module_line_tables dump_module_line_tables' %
- __name__)
-print 'Installed "dump_module_line_tables" command'
+ result.PutCString(' %#x: END' %
+ (start_file_addr))
+ else:
+ result.PutCString(
+ ' %#x: %s' %
+ (start_file_addr, line_entry))
+ if start_file_addr == end_file_addr:
+ result.PutCString("\n")
+
+
+class DumpFiles:
+ command_name = "dump-files"
+ short_description = "Dumps full paths to compile unit files and optionally all line table files."
+ usage = "usage: %prog [options] MODULE1 [MODULE2 ...]"
+ description = '''This class adds a dump-files command to the LLDB interpreter.
+
+This command will dump all compile unit file paths found for each source file
+for the binaries specified as arguments in the current target. Specify the
+--support-files or -s option to see all file paths that a compile unit uses in
+its lines tables. This is handy for troubleshooting why breakpoints aren't
+working in IDEs that specify full paths to source files when setting file and
+line breakpoints. Sometimes symlinks cause the debug info to contain the symlink
+path and an IDE will resolve the path to the actual file and use the resolved
+path when setting breakpoints.
+'''
+ def create_options(self):
+ # Pass add_help_option = False, since this keeps the command in line with lldb commands,
+ # and we wire up "help command" to work by providing the long & short help methods below.
+ self.parser = optparse.OptionParser(
+ description = self.description,
+ prog = self.command_name,
+ usage = self.usage,
+ add_help_option = False)
+
+ self.parser.add_option(
+ '-s',
+ '--support-files',
+ action = 'store_true',
+ dest = 'support_files',
+ help = 'Dumps full paths to all files used in a compile unit.',
+ default = False)
+
+ def get_short_help(self):
+ return self.short_description
+
+ def get_long_help(self):
+ return self.help_string
+
+ def __init__(self, debugger, unused):
+ self.create_options()
+ self.help_string = self.parser.format_help()
+
+ def __call__(self, debugger, command, exe_ctx, result):
+ # Use the Shell Lexer to properly parse up command options just like a
+ # shell would
+ command_args = shlex.split(command)
+
+ try:
+ (options, args) = self.parser.parse_args(command_args)
+ except:
+ # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
+ # (courtesy of OptParse dealing with argument errors by throwing SystemExit)
+ result.SetError("option parsing failed")
+ return
+
+ # Always get program state from the SBExecutionContext passed in as exe_ctx
+ target = exe_ctx.GetTarget()
+ if not target.IsValid():
+ result.SetError("invalid target")
+ return
+
+ if len(args) == 0:
+ result.SetError("one or more executable paths must be specified")
+ return
+
+ for module_path in args:
+ module = target.module[module_path]
+ if not module:
+ result.SetError('no module found that matches "%s".' % (module_path))
+ return
+ num_cus = module.GetNumCompileUnits()
+ print >>result, 'Module: "%s"' % (module.file.fullpath),
+ if num_cus == 0:
+ print >>result, 'no debug info.'
+ continue
+ print >>result, 'has %u compile units:' % (num_cus)
+ for i in range(num_cus):
+ cu = module.GetCompileUnitAtIndex(i)
+ print >>result, ' Compile Unit: %s' % (cu.file.fullpath)
+ if options.support_files:
+ num_support_files = cu.GetNumSupportFiles()
+ for j in range(num_support_files):
+ path = cu.GetSupportFileAtIndex(j).fullpath
+ print >>result, ' file[%u]: %s' % (j, path)
+
+
+def __lldb_init_module(debugger, dict):
+ # This initializer is being run from LLDB in the embedded command interpreter
+
+ # Add any commands contained in this module to LLDB
+ debugger.HandleCommand(
+ 'command script add -c %s.DumpLineTables %s' % (__name__,
+ DumpLineTables.command_name))
+ debugger.HandleCommand(
+ 'command script add -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name))
+ print 'The "%s" and "%s" commands have been installed.' % (DumpLineTables.command_name,
+ DumpFiles.command_name)
diff --git a/examples/python/step_and_print.py b/examples/python/step_and_print.py
new file mode 100644
index 000000000000..41364ef97ba8
--- /dev/null
+++ b/examples/python/step_and_print.py
@@ -0,0 +1,24 @@
+""" Does a step-over then prints the local variables or only the ones passed in """
+import lldb
+
+class StepAndPrint:
+ def __init__(self, debugger, unused):
+ return
+
+ def __call__(self, debugger, command, exe_ctx, result):
+ # Set the command to synchronous so the step will complete
+ # before we try to run the frame variable.
+ old_async = debugger.GetAsync()
+ debugger.SetAsync(False)
+
+ debugger.HandleCommand("thread step-over")
+ print("---------- Values: -------------------\n")
+ debugger.HandleCommand("frame variable %s"%(command))
+
+ debugger.SetAsync(old_async)
+
+ def get_short_help(self):
+ return "Does a step-over then runs frame variable passing the command args to it\n"
+
+def __lldb_init_module(debugger, unused):
+ debugger.HandleCommand("command script add -c step_and_print.StepAndPrint sap")
diff --git a/examples/synthetic/libcxx.py b/examples/synthetic/libcxx.py
index e6f8223e2dad..97593725a246 100644
--- a/examples/synthetic/libcxx.py
+++ b/examples/synthetic/libcxx.py
@@ -693,6 +693,13 @@ class stddeque_SynthProvider:
except:
return None
+ def _get_value_of_compressed_pair(self, pair):
+ value = pair.GetChildMemberWithName("__value_")
+ if not value.IsValid():
+ # pre-r300140 member name
+ value = pair.GetChildMemberWithName("__first_")
+ return value.GetValueAsUnsigned(0)
+
def update(self):
logger = lldb.formatters.Logger.Logger()
try:
@@ -709,8 +716,8 @@ class stddeque_SynthProvider:
# variable tells which element in this NxM array is the 0th
# one, and the 'size' element gives the number of elements
# in the deque.
- count = self.valobj.GetChildMemberWithName(
- '__size_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ count = self._get_value_of_compressed_pair(
+ self.valobj.GetChildMemberWithName('__size_'))
# give up now if we cant access memory reliably
if self.block_size < 0:
logger.write("block_size < 0")
@@ -724,8 +731,8 @@ class stddeque_SynthProvider:
'__begin_').GetValueAsUnsigned(0)
map_end = map_.GetChildMemberWithName(
'__end_').GetValueAsUnsigned(0)
- map_endcap = map_.GetChildMemberWithName(
- '__end_cap_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ map_endcap = self._get_value_of_compressed_pair(
+ map_.GetChildMemberWithName( '__end_cap_'))
# check consistency
if not map_first <= map_begin <= map_end <= map_endcap:
logger.write("map pointers are not monotonic")
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h
index cf61b10184d6..c51ced893d7a 100644
--- a/include/lldb/API/LLDB.h
+++ b/include/lldb/API/LLDB.h
@@ -18,6 +18,7 @@
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBBreakpointName.h"
#include "lldb/API/SBBreakpointLocation.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBCommandInterpreter.h"
@@ -49,6 +50,7 @@
#include "lldb/API/SBModuleSpec.h"
#include "lldb/API/SBPlatform.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBProcessInfo.h"
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBSection.h"
diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h
index 9abc9cd39dcb..216d675b9d22 100644
--- a/include/lldb/API/SBBreakpoint.h
+++ b/include/lldb/API/SBBreakpoint.h
@@ -18,9 +18,6 @@ namespace lldb {
class LLDB_API SBBreakpoint {
public:
- typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
- SBThread &thread,
- lldb::SBBreakpointLocation &location);
SBBreakpoint();
@@ -70,6 +67,10 @@ public:
const char *GetCondition();
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
void SetThreadID(lldb::tid_t sb_thread_id);
lldb::tid_t GetThreadID();
@@ -86,7 +87,7 @@ public:
const char *GetQueueName() const;
- void SetCallback(BreakpointHitCallback callback, void *baton);
+ void SetCallback(SBBreakpointHitCallback callback, void *baton);
void SetScriptCallbackFunction(const char *callback_function_name);
@@ -129,14 +130,11 @@ public:
private:
friend class SBBreakpointList;
friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
friend class SBTarget;
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
- static bool PrivateBreakpointHitCallback(
- void *baton, lldb_private::StoppointCallbackContext *context,
- lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
-
lldb::BreakpointSP GetSP() const;
lldb::BreakpointWP m_opaque_wp;
diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h
index 0b5ba79d784f..4b34bcbf1f28 100644
--- a/include/lldb/API/SBBreakpointLocation.h
+++ b/include/lldb/API/SBBreakpointLocation.h
@@ -38,6 +38,8 @@ public:
bool IsEnabled();
+ uint32_t GetHitCount();
+
uint32_t GetIgnoreCount();
void SetIgnoreCount(uint32_t n);
@@ -45,11 +47,19 @@ public:
void SetCondition(const char *condition);
const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
void SetScriptCallbackFunction(const char *callback_function_name);
SBError SetScriptCallbackBody(const char *script_body_text);
+
+ void SetCommandLineCommands(SBStringList &commands);
+ bool GetCommandLineCommands(SBStringList &commands);
+
void SetThreadID(lldb::tid_t sb_thread_id);
lldb::tid_t GetThreadID();
@@ -76,6 +86,7 @@ public:
private:
friend class SBBreakpoint;
+ friend class SBBreakpointCallbackBaton;
void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
BreakpointLocationSP GetSP() const;
diff --git a/include/lldb/API/SBBreakpointName.h b/include/lldb/API/SBBreakpointName.h
new file mode 100644
index 000000000000..321f0d784d6f
--- /dev/null
+++ b/include/lldb/API/SBBreakpointName.h
@@ -0,0 +1,118 @@
+//===-- SBBreakpointName.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBreakpointName_h_
+#define LLDB_SBBreakpointName_h_
+
+#include "lldb/API/SBDefines.h"
+
+class SBBreakpointNameImpl;
+
+namespace lldb {
+
+class LLDB_API SBBreakpointName {
+public:
+// typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
+// SBThread &thread,
+// lldb::SBBreakpointLocation &location);
+
+ SBBreakpointName();
+
+ SBBreakpointName(SBTarget &target, const char *name);
+
+ SBBreakpointName(SBBreakpoint &bkpt, const char *name);
+
+ SBBreakpointName(const lldb::SBBreakpointName &rhs);
+
+ ~SBBreakpointName();
+
+ const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs);
+
+ // Tests to see if the opaque breakpoint object in this object matches the
+ // opaque breakpoint object in "rhs".
+ bool operator==(const lldb::SBBreakpointName &rhs);
+
+ bool operator!=(const lldb::SBBreakpointName &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName() const;
+
+ void SetEnabled(bool enable);
+
+ bool IsEnabled();
+
+ void SetOneShot(bool one_shot);
+
+ bool IsOneShot() const;
+
+ void SetIgnoreCount(uint32_t count);
+
+ uint32_t GetIgnoreCount() const;
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ void SetCallback(SBBreakpointHitCallback callback, void *baton);
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ const char *GetHelpString() const;
+ void SetHelpString(const char *help_string);
+
+ bool GetAllowList() const;
+ void SetAllowList(bool value);
+
+ bool GetAllowDelete();
+ void SetAllowDelete(bool value);
+
+ bool GetAllowDisable();
+ void SetAllowDisable(bool value);
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBTarget;
+
+ lldb_private::BreakpointName *GetBreakpointName() const;
+ void UpdateName(lldb_private::BreakpointName &bp_name);
+
+ std::unique_ptr<SBBreakpointNameImpl> m_impl_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBreakpointName_h_
diff --git a/include/lldb/API/SBCommandInterpreter.h b/include/lldb/API/SBCommandInterpreter.h
index f684071740e3..80f24ceca7b4 100644
--- a/include/lldb/API/SBCommandInterpreter.h
+++ b/include/lldb/API/SBCommandInterpreter.h
@@ -165,6 +165,8 @@ public:
int match_start_point, int max_return_elements,
lldb::SBStringList &matches);
+ bool WasInterrupted() const;
+
// Catch commands before they execute by registering a callback that will
// get called when the command gets executed. This allows GUI or command
// line interfaces to intercept a command and stop it from happening
diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h
index 9084943b9131..8379a6911afc 100644
--- a/include/lldb/API/SBDebugger.h
+++ b/include/lldb/API/SBDebugger.h
@@ -109,6 +109,8 @@ public:
const char *archname);
lldb::SBTarget CreateTarget(const char *filename);
+
+ lldb::SBTarget GetDummyTarget();
// Return true if target is deleted from the target list of the debugger.
bool DeleteTarget(lldb::SBTarget &target);
@@ -132,6 +134,25 @@ public:
void SetSelectedPlatform(lldb::SBPlatform &platform);
+ /// Get the number of currently active platforms.
+ uint32_t GetNumPlatforms();
+
+ /// Get one of the currently active platforms.
+ lldb::SBPlatform GetPlatformAtIndex(uint32_t idx);
+
+ /// Get the number of available platforms.
+ ///
+ /// The return value should match the number of entries output by the
+ /// "platform list" command.
+ uint32_t GetNumAvailablePlatforms();
+
+ /// Get the name and description of one of the available platforms.
+ ///
+ /// @param[in] idx
+ /// Zero-based index of the platform for which info should be retrieved,
+ /// must be less than the value returned by GetNumAvailablePlatforms().
+ lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx);
+
lldb::SBSourceManager GetSourceManager();
// REMOVE: just for a quick fix, need to expose platforms through
diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h
index d70e912d9200..ec92c9196737 100644
--- a/include/lldb/API/SBDefines.h
+++ b/include/lldb/API/SBDefines.h
@@ -32,6 +32,8 @@ class LLDB_API SBAddress;
class LLDB_API SBBlock;
class LLDB_API SBBreakpoint;
class LLDB_API SBBreakpointLocation;
+class LLDB_API SBBreakpointName;
+class LLDB_API SBBreakpointNameImpl;
class LLDB_API SBBroadcaster;
class LLDB_API SBCommand;
class LLDB_API SBCommandInterpreter;
@@ -65,6 +67,7 @@ class LLDB_API SBModule;
class LLDB_API SBModuleSpec;
class LLDB_API SBModuleSpecList;
class LLDB_API SBProcess;
+class LLDB_API SBProcessInfo;
class LLDB_API SBQueue;
class LLDB_API SBQueueItem;
class LLDB_API SBSection;
@@ -98,6 +101,10 @@ class LLDB_API SBValueList;
class LLDB_API SBVariablesOptions;
class LLDB_API SBWatchpoint;
class LLDB_API SBUnixSignals;
+
+typedef bool (*SBBreakpointHitCallback)(void *baton, SBProcess &process,
+ SBThread &thread,
+ lldb::SBBreakpointLocation &location);
}
#endif // LLDB_SBDefines_h_
diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h
index a099a9be271a..a27d2d042690 100644
--- a/include/lldb/API/SBError.h
+++ b/include/lldb/API/SBError.h
@@ -67,6 +67,7 @@ protected:
friend class SBWatchpoint;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
lldb_private::Status *get();
diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h
index a31d95abb493..33e48f5c7c41 100644
--- a/include/lldb/API/SBFileSpec.h
+++ b/include/lldb/API/SBFileSpec.h
@@ -65,6 +65,7 @@ private:
friend class SBModuleSpec;
friend class SBPlatform;
friend class SBProcess;
+ friend class SBProcessInfo;
friend class SBSourceManager;
friend class SBThread;
friend class SBTarget;
diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h
index d57d5ce04f59..2e8925941fb7 100644
--- a/include/lldb/API/SBProcess.h
+++ b/include/lldb/API/SBProcess.h
@@ -12,6 +12,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
+#include "lldb/API/SBProcessInfo.h"
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBTarget.h"
#include <stdio.h>
@@ -380,6 +381,15 @@ public:
//------------------------------------------------------------------
lldb::SBMemoryRegionInfoList GetMemoryRegions();
+ //------------------------------------------------------------------
+ /// Return information about the process.
+ ///
+ /// Valid process info will only be returned when the process is
+ /// alive, use SBProcessInfo::IsValid() to check returned info is
+ /// valid.
+ //------------------------------------------------------------------
+ lldb::SBProcessInfo GetProcessInfo();
+
protected:
friend class SBAddress;
friend class SBBreakpoint;
diff --git a/include/lldb/API/SBProcessInfo.h b/include/lldb/API/SBProcessInfo.h
new file mode 100644
index 000000000000..421227f82c2d
--- /dev/null
+++ b/include/lldb/API/SBProcessInfo.h
@@ -0,0 +1,64 @@
+//===-- SBProcessInfo.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBProcessInfo_h_
+#define LLDB_SBProcessInfo_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBProcessInfo {
+public:
+ SBProcessInfo();
+ SBProcessInfo(const SBProcessInfo &rhs);
+
+ ~SBProcessInfo();
+
+ SBProcessInfo &operator=(const SBProcessInfo &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ SBFileSpec GetExecutableFile();
+
+ lldb::pid_t GetProcessID();
+
+ uint32_t GetUserID();
+
+ uint32_t GetGroupID();
+
+ bool UserIDIsValid();
+
+ bool GroupIDIsValid();
+
+ uint32_t GetEffectiveUserID();
+
+ uint32_t GetEffectiveGroupID();
+
+ bool EffectiveUserIDIsValid();
+
+ bool EffectiveGroupIDIsValid();
+
+ lldb::pid_t GetParentProcessID();
+
+private:
+ friend class SBProcess;
+
+ lldb_private::ProcessInstanceInfo &ref();
+
+ void SetProcessInfo(const lldb_private::ProcessInstanceInfo &proc_info_ref);
+
+ std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_ap;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBProcessInfo_h_
diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h
index 68fcae21c08e..a75afc7ee375 100644
--- a/include/lldb/API/SBStream.h
+++ b/include/lldb/API/SBStream.h
@@ -53,6 +53,7 @@ protected:
friend class SBBlock;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
friend class SBCommandReturnObject;
friend class SBCompileUnit;
friend class SBData;
diff --git a/include/lldb/API/SBStringList.h b/include/lldb/API/SBStringList.h
index 66b5172a0b3e..943384e544cd 100644
--- a/include/lldb/API/SBStringList.h
+++ b/include/lldb/API/SBStringList.h
@@ -44,6 +44,8 @@ protected:
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
SBStringList(const lldb_private::StringList *lldb_strings);
diff --git a/include/lldb/API/SBStructuredData.h b/include/lldb/API/SBStructuredData.h
index f7a6469bb8de..f3baaf7c4801 100644
--- a/include/lldb/API/SBStructuredData.h
+++ b/include/lldb/API/SBStructuredData.h
@@ -98,6 +98,7 @@ public:
protected:
friend class SBTraceOptions;
+ friend class SBDebugger;
StructuredDataImplUP m_impl_up;
};
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 62398fcd4b94..4085a16b43fb 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -218,14 +218,6 @@ public:
lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
lldb::SBError &error);
-#if defined(__APPLE__)
- // We need to keep this around for a build or two since Xcode links
- // to the 32 bit version of this function. We will take it out soon.
- lldb::SBProcess AttachToProcessWithID(SBListener &listener,
- ::pid_t pid, // 32 bit int process ID
- lldb::SBError &error); // DEPRECATED
-#endif
-
//------------------------------------------------------------------
/// Attach to process with name.
///
@@ -724,6 +716,10 @@ public:
// Finds all breakpoints by name, returning the list in bkpt_list. Returns
// false if the name is not a valid breakpoint name, true otherwise.
bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
+
+ void GetBreakpointNames(SBStringList &names);
+
+ void DeleteBreakpointName(const char *name);
bool EnableAllBreakpoints();
@@ -818,6 +814,7 @@ protected:
friend class SBAddress;
friend class SBBlock;
friend class SBBreakpointList;
+ friend class SBBreakpointNameImpl;
friend class SBDebugger;
friend class SBExecutionContext;
friend class SBFunction;
diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h
index 502e5c973ef5..7f1cf10cc456 100644
--- a/include/lldb/API/SBThread.h
+++ b/include/lldb/API/SBThread.h
@@ -196,6 +196,7 @@ public:
protected:
friend class SBBreakpoint;
friend class SBBreakpointLocation;
+ friend class SBBreakpointCallbackBaton;
friend class SBExecutionContext;
friend class SBFrame;
friend class SBProcess;
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h
index 41241334dcf9..9a798090a59f 100644
--- a/include/lldb/Breakpoint/Breakpoint.h
+++ b/include/lldb/Breakpoint/Breakpoint.h
@@ -22,6 +22,7 @@
#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/BreakpointLocationList.h"
+#include "lldb/Breakpoint/BreakpointName.h"
#include "lldb/Breakpoint/BreakpointOptions.h"
#include "lldb/Breakpoint/Stoppoint.h"
#include "lldb/Core/Event.h"
@@ -421,6 +422,18 @@ public:
bool IsOneShot() const;
//------------------------------------------------------------------
+ /// If \a auto_continue is \b true, breakpoint will auto-continue when on hit.
+ //------------------------------------------------------------------
+ void SetAutoContinue(bool auto_continue);
+
+ //------------------------------------------------------------------
+ /// Check the AutoContinue state.
+ /// @return
+ /// \b true if the breakpoint is set to auto-continue, \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsAutoContinue() const;
+
+ //------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
/// @param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
@@ -591,6 +604,16 @@ public:
BreakpointOptions *GetOptions();
//------------------------------------------------------------------
+ /// Returns the BreakpointOptions structure set at the breakpoint level.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// @return
+ /// A pointer to this breakpoint's BreakpointOptions.
+ //------------------------------------------------------------------
+ const BreakpointOptions *GetOptions() const;
+
+ //------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
/// Meant to be used by the BreakpointLocation class.
@@ -613,13 +636,16 @@ public:
lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
- bool AddName(llvm::StringRef new_name, Status &error);
+private: // The target needs to manage adding & removing names. It will do the
+ // checking for name validity as well.
+ bool AddName(llvm::StringRef new_name);
void RemoveName(const char *name_to_remove) {
if (name_to_remove)
m_name_list.erase(name_to_remove);
}
-
+
+public:
bool MatchesName(const char *name) {
return m_name_list.find(name) != m_name_list.end();
}
@@ -651,6 +677,25 @@ public:
bool EvaluatePrecondition(StoppointCallbackContext &context);
BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
+
+ // Produces the OR'ed values for all the names assigned to this breakpoint.
+ const BreakpointName::Permissions &GetPermissions() const {
+ return m_permissions;
+ }
+
+ BreakpointName::Permissions &GetPermissions() {
+ return m_permissions;
+ }
+
+ bool AllowList() const {
+ return GetPermissions().GetAllowList();
+ }
+ bool AllowDisable() const {
+ return GetPermissions().GetAllowDisable();
+ }
+ bool AllowDelete() const {
+ return GetPermissions().GetAllowDelete();
+ }
protected:
friend class Target;
@@ -750,6 +795,7 @@ private:
// hit. This is kept
// separately from the locations hit counts, since locations can go away when
// their backing library gets unloaded, and we would lose hit counts.
+ BreakpointName::Permissions m_permissions;
void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
diff --git a/include/lldb/Breakpoint/BreakpointIDList.h b/include/lldb/Breakpoint/BreakpointIDList.h
index 34cfbfe3268d..5877b6c551ad 100644
--- a/include/lldb/Breakpoint/BreakpointIDList.h
+++ b/include/lldb/Breakpoint/BreakpointIDList.h
@@ -18,7 +18,9 @@
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-enumerations.h"
#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointName.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -64,6 +66,8 @@ public:
static void FindAndReplaceIDRanges(Args &old_args, Target *target,
bool allow_locations,
+ BreakpointName::Permissions
+ ::PermissionKinds purpose,
CommandReturnObject &result,
Args &new_args);
diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h
index 2865288acc59..9f38f8aa120d 100644
--- a/include/lldb/Breakpoint/BreakpointList.h
+++ b/include/lldb/Breakpoint/BreakpointList.h
@@ -154,12 +154,21 @@ public:
void SetEnabledAll(bool enabled);
+ void SetEnabledAllowed(bool enabled);
+
//------------------------------------------------------------------
/// Removes all the breakpoints from this list.
//------------------------------------------------------------------
void RemoveAll(bool notify);
//------------------------------------------------------------------
+ /// Removes all the breakpoints from this list - first checking the
+ /// ePermDelete on the breakpoints. This call should be used unless you
+ /// are shutting down and need to actually clear them all.
+ //------------------------------------------------------------------
+ void RemoveAllowed(bool notify);
+
+ //------------------------------------------------------------------
/// Tell all the breakpoints to update themselves due to a change in the
/// modules in \a module_list. \a added says whether the module was loaded
/// or unloaded.
diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h
index a1086aa3fe5f..b68a9ffad04c 100644
--- a/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/include/lldb/Breakpoint/BreakpointLocation.h
@@ -17,6 +17,7 @@
// Other libraries and framework includes
// Project includes
+#include "lldb/Breakpoint/BreakpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/Address.h"
#include "lldb/Utility/UserID.h"
@@ -106,6 +107,19 @@ public:
bool IsEnabled() const;
//------------------------------------------------------------------
+ /// If \a auto_continue is \b true, set the breakpoint to continue when hit.
+ //------------------------------------------------------------------
+ void SetAutoContinue(bool auto_continue);
+
+ //------------------------------------------------------------------
+ /// Check the AutoContinue state.
+ ///
+ /// @return
+ /// \b true if the breakpoint is set to auto-continue, \b false if not.
+ //------------------------------------------------------------------
+ bool IsAutoContinue() const;
+
+ //------------------------------------------------------------------
/// Return the current Ignore Count.
///
/// @return
@@ -255,14 +269,17 @@ public:
//------------------------------------------------------------------
/// Use this to access breakpoint options from this breakpoint location.
- /// This will point to the owning breakpoint's options unless options have
- /// been set specifically on this location.
+ /// This will return the options that have a setting for the specified
+ /// BreakpointOptions kind.
///
+ /// @param[in] kind
+ /// The particular option you are looking up.
/// @return
/// A pointer to the containing breakpoint's options if this
/// location doesn't have its own copy.
//------------------------------------------------------------------
- const BreakpointOptions *GetOptionsNoCreate() const;
+ const BreakpointOptions *GetOptionsSpecifyingKind(
+ BreakpointOptions::OptionKind kind) const;
bool ValidForThisThread(Thread *thread);
diff --git a/include/lldb/Breakpoint/BreakpointName.h b/include/lldb/Breakpoint/BreakpointName.h
new file mode 100644
index 000000000000..1cfa141011a0
--- /dev/null
+++ b/include/lldb/Breakpoint/BreakpointName.h
@@ -0,0 +1,213 @@
+//===-- BreakpointName.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_Breakpoint_Name_h_
+#define liblldb_Breakpoint_Name_h_
+
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/BreakpointLocationList.h"
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/Core/Event.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+class BreakpointName {
+public:
+ class Permissions
+ {
+ public:
+
+ enum PermissionKinds { listPerm = 0, disablePerm = 1,
+ deletePerm = 2, allPerms = 3 };
+
+ Permissions(bool in_list, bool in_disable, bool in_delete)
+ {
+ m_permissions[listPerm] = in_list;
+ m_permissions[disablePerm] = in_disable;
+ m_permissions[deletePerm] = in_delete;
+ m_set_mask.Set(permissions_mask[allPerms]);
+ }
+
+ Permissions(const Permissions &rhs)
+ {
+ m_permissions[listPerm] = rhs.m_permissions[listPerm];
+ m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
+ m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
+ m_set_mask = rhs.m_set_mask;
+ }
+
+ Permissions()
+ {
+ m_permissions[listPerm] = true;
+ m_permissions[disablePerm] = true;
+ m_permissions[deletePerm] = true;
+ m_set_mask.Clear();
+ }
+
+ const Permissions &operator= (const Permissions &rhs)
+ {
+ if (this != &rhs) {
+ m_permissions[listPerm] = rhs.m_permissions[listPerm];
+ m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
+ m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
+ m_set_mask = rhs.m_set_mask;
+ }
+ return *this;
+ }
+
+ void Clear() {
+ *this = Permissions();
+ }
+
+ // Merge the permissions from incoming into this set of permissions.
+ // Only merge set permissions, and most restrictive permission wins.
+ void MergeInto(const Permissions &incoming)
+ {
+ MergePermission(incoming, listPerm);
+ MergePermission(incoming, disablePerm);
+ MergePermission(incoming, deletePerm);
+ }
+
+ bool GetAllowList() const { return GetPermission(listPerm); }
+ bool SetAllowList(bool value) { return SetPermission(listPerm, value); }
+
+ bool GetAllowDelete() const { return GetPermission(deletePerm); }
+ bool SetAllowDelete(bool value) { return SetPermission(deletePerm, value); }
+
+ bool GetAllowDisable() const { return GetPermission(disablePerm); }
+ bool SetAllowDisable(bool value) { return SetPermission(disablePerm,
+ value); }
+
+ bool GetPermission(enum PermissionKinds permission) const
+ {
+ return m_permissions[permission];
+ }
+
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ bool IsSet(enum PermissionKinds permission) const
+ {
+ return m_set_mask.Test(permissions_mask[permission]);
+ }
+
+ bool AnySet() {
+ return m_set_mask.AnySet(permissions_mask[allPerms]);
+ }
+
+ private:
+ static const Flags::ValueType permissions_mask[allPerms + 1];
+
+ bool m_permissions[allPerms];
+ Flags m_set_mask;
+
+ bool SetPermission(enum PermissionKinds permission, bool value)
+ {
+ bool old_value = m_permissions[permission];
+ m_permissions[permission] = value;
+ m_set_mask.Set(permissions_mask[permission]);
+ return old_value;
+ }
+
+ // If either side disallows the permission, the resultant disallows it.
+ void MergePermission(const Permissions &incoming,
+ enum PermissionKinds permission)
+ {
+ if (incoming.IsSet(permission))
+ {
+ SetPermission(permission, !(m_permissions[permission] |
+ incoming.m_permissions[permission]));
+ }
+ }
+ };
+
+ BreakpointName(const ConstString &name, const char *help = nullptr) :
+ m_name(name), m_options(false)
+ {
+ SetHelp(help);
+ }
+
+ BreakpointName(const ConstString &name,
+ BreakpointOptions &options,
+ const Permissions &permissions = Permissions(),
+ const char *help = nullptr) :
+ m_name(name), m_options(options),
+ m_permissions(permissions) {
+ SetHelp(help);
+ };
+
+ BreakpointName(const BreakpointName &rhs) :
+ m_name(rhs.m_name), m_options(rhs.m_options),
+ m_permissions(rhs.m_permissions), m_help(rhs.m_help)
+ {}
+
+ BreakpointName(const ConstString &name, const Breakpoint &bkpt,
+ const char *help);
+
+ const ConstString &GetName() const { return m_name; }
+ BreakpointOptions &GetOptions() { return m_options; }
+ const BreakpointOptions &GetOptions() const { return m_options; }
+
+ void SetOptions(const BreakpointOptions &options) {
+ m_options = options;
+ }
+
+ Permissions &GetPermissions() { return m_permissions; }
+ const Permissions &GetPermissions() const { return m_permissions; }
+ void SetPermissions(const Permissions &permissions) {
+ m_permissions = permissions;
+ }
+
+ bool GetPermission(Permissions::PermissionKinds permission) const
+ {
+ return m_permissions.GetPermission(permission);
+ }
+
+ void SetHelp(const char *description)
+ {
+ if (description)
+ m_help.assign(description);
+ else
+ m_help.clear();
+ }
+
+ const char *GetHelp()
+ {
+ return m_help.c_str();
+ }
+
+ // Returns true if any options were set in the name
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ void ConfigureBreakpoint(lldb::BreakpointSP bp_sp);
+
+private:
+ ConstString m_name;
+ BreakpointOptions m_options;
+ Permissions m_permissions;
+ std::string m_help;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Breakpoint_Name_h_
diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h
index 420d5915fd44..0229d52df471 100644
--- a/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/include/lldb/Breakpoint/BreakpointOptions.h
@@ -18,6 +18,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Utility/Baton.h"
+#include "lldb/Utility/Flags.h"
#include "lldb/Utility/StringList.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
@@ -32,7 +33,23 @@ namespace lldb_private {
//----------------------------------------------------------------------
class BreakpointOptions {
+friend class BreakpointLocation;
+friend class BreakpointName;
+friend class lldb_private::BreakpointOptionGroup;
+friend class Breakpoint;
+
public:
+ enum OptionKind {
+ eCallback = 1 << 0,
+ eEnabled = 1 << 1,
+ eOneShot = 1 << 2,
+ eIgnoreCount = 1 << 3,
+ eThreadSpec = 1 << 4,
+ eCondition = 1 << 5,
+ eAutoContinue = 1 << 6,
+ eAllOptions = (eCallback | eEnabled | eOneShot | eIgnoreCount | eThreadSpec
+ | eCondition | eAutoContinue)
+ };
struct CommandData {
CommandData()
: user_source(), script_source(),
@@ -87,14 +104,6 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- //------------------------------------------------------------------
- /// Default constructor. The breakpoint is enabled, and has no condition,
- /// callback, ignore count, etc...
- //------------------------------------------------------------------
- BreakpointOptions();
- BreakpointOptions(const BreakpointOptions &rhs);
-
- static BreakpointOptions *CopyOptionsNoCallback(BreakpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the breakpoint options
@@ -112,7 +121,15 @@ public:
///
//------------------------------------------------------------------
BreakpointOptions(const char *condition, bool enabled = true,
- int32_t ignore = 0, bool one_shot = false);
+ int32_t ignore = 0, bool one_shot = false,
+ bool auto_continue = false);
+
+ //------------------------------------------------------------------
+ /// Breakpoints make options with all flags set. Locations and Names make options
+ /// with no flags set.
+ //------------------------------------------------------------------
+ BreakpointOptions(bool all_flags_set);
+ BreakpointOptions(const BreakpointOptions &rhs);
virtual ~BreakpointOptions();
@@ -129,6 +146,11 @@ public:
// Operators
//------------------------------------------------------------------
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
+
+ //------------------------------------------------------------------
+ /// Copy over only the options set in the incoming BreakpointOptions.
+ //------------------------------------------------------------------
+ void CopyOverSetOptions(const BreakpointOptions &rhs);
//------------------------------------------------------------------
// Callbacks
@@ -290,7 +312,25 @@ public:
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
- void SetEnabled(bool enabled) { m_enabled = enabled; }
+ void SetEnabled(bool enabled) {
+ m_enabled = enabled;
+ m_set_flags.Set(eEnabled);
+ }
+
+ //------------------------------------------------------------------
+ /// Check the auto-continue state.
+ /// @return
+ /// \b true if the breakpoint is set to auto-continue, \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsAutoContinue() const { return m_auto_continue; }
+
+ //------------------------------------------------------------------
+ /// Set the auto-continue state.
+ //------------------------------------------------------------------
+ void SetAutoContinue(bool auto_continue) {
+ m_auto_continue = auto_continue;
+ m_set_flags.Set(eAutoContinue);
+ }
//------------------------------------------------------------------
/// Check the One-shot state.
@@ -302,7 +342,10 @@ public:
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
- void SetOneShot(bool one_shot) { m_one_shot = one_shot; }
+ void SetOneShot(bool one_shot) {
+ m_one_shot = one_shot;
+ m_set_flags.Set(eOneShot);
+ }
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
@@ -310,7 +353,10 @@ public:
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
- void SetIgnoreCount(uint32_t n) { m_ignore_count = n; }
+ void SetIgnoreCount(uint32_t n) {
+ m_ignore_count = n;
+ m_set_flags.Set(eIgnoreCount);
+ }
//------------------------------------------------------------------
/// Return the current Ignore Count.
@@ -360,16 +406,28 @@ public:
/// The breakpoint will take ownership of pointer held by this object.
//------------------------------------------------------------------
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
-
+
+ void Clear();
+
+ bool AnySet() const {
+ return m_set_flags.AnySet(eAllOptions);
+ }
+
protected:
- //------------------------------------------------------------------
+//------------------------------------------------------------------
// Classes that inherit from BreakpointOptions can see and modify these
//------------------------------------------------------------------
+ bool IsOptionSet(OptionKind kind)
+ {
+ return m_set_flags.Test(kind);
+ }
+
enum class OptionNames {
ConditionText = 0,
IgnoreCount,
EnabledState,
OneShotState,
+ AutoContinue,
LastOptionName
};
static const char *g_option_names[(size_t)OptionNames::LastOptionName];
@@ -400,6 +458,9 @@ private:
std::string m_condition_text; // The condition to test.
size_t m_condition_text_hash; // Its hash, so that locations know when the
// condition is updated.
+ bool m_auto_continue; // If set, auto-continue from breakpoint.
+ Flags m_set_flags; // Which options are set at this level. Drawn
+ // from BreakpointOptions::SetOptionsFlags.
};
} // namespace lldb_private
diff --git a/include/lldb/Core/Architecture.h b/include/lldb/Core/Architecture.h
new file mode 100644
index 000000000000..af774ecdaf9c
--- /dev/null
+++ b/include/lldb/Core/Architecture.h
@@ -0,0 +1,43 @@
+//===-- Architecture.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_ARCHITECTURE_H
+#define LLDB_CORE_ARCHITECTURE_H
+
+#include "lldb/Core/PluginInterface.h"
+
+namespace lldb_private {
+
+class Architecture : public PluginInterface {
+public:
+ Architecture() = default;
+ virtual ~Architecture() = default;
+
+ //------------------------------------------------------------------
+ /// This is currently intended to handle cases where a
+ /// program stops at an instruction that won't get executed and it
+ /// allows the stop reason, like "breakpoint hit", to be replaced
+ /// with a different stop reason like "no stop reason".
+ ///
+ /// This is specifically used for ARM in Thumb code when we stop in
+ /// an IT instruction (if/then/else) where the instruction won't get
+ /// executed and therefore it wouldn't be correct to show the program
+ /// stopped at the current PC. The code is generic and applies to all
+ /// ARM CPUs.
+ //------------------------------------------------------------------
+ virtual void OverrideStopInfo(Thread &thread) = 0;
+
+private:
+ Architecture(const Architecture &) = delete;
+ void operator=(const Architecture &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_CORE_ARCHITECTURE_H
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h
index addc83ad5e9d..fa5e6a636aaf 100644
--- a/include/lldb/Core/Disassembler.h
+++ b/include/lldb/Core/Disassembler.h
@@ -11,7 +11,6 @@
#define liblldb_Disassembler_h_
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/FormatEntity.h" // for FormatEntity
#include "lldb/Core/Opcode.h"
@@ -19,7 +18,8 @@
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Target/ExecutionContext.h" // for ExecutionContext
-#include "lldb/Utility/ConstString.h" // for ConstString
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/ConstString.h" // for ConstString
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
#include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass...
diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h
index bfc9ef054d7a..b0a4267a00a2 100644
--- a/include/lldb/Core/EmulateInstruction.h
+++ b/include/lldb/Core/EmulateInstruction.h
@@ -12,11 +12,10 @@
#include <string>
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Address.h" // for Address
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginInterface.h"
-
-#include "lldb/Core/Address.h" // for Address
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
#include "lldb/lldb-enumerations.h" // for RegisterKind, ByteOrder
#include "lldb/lldb-private-enumerations.h" // for InstructionType
diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h
index ebf56d7908b4..e8cfbade5c61 100644
--- a/include/lldb/Core/IOHandler.h
+++ b/include/lldb/Core/IOHandler.h
@@ -195,7 +195,7 @@ public:
enum class Completion { None, LLDBCommand, Expression };
IOHandlerDelegate(Completion completion = Completion::None)
- : m_completion(completion), m_io_handler_done(false) {}
+ : m_completion(completion) {}
virtual ~IOHandlerDelegate() = default;
@@ -296,7 +296,6 @@ public:
protected:
Completion m_completion; // Support for common builtin completions
- bool m_io_handler_done;
};
//----------------------------------------------------------------------
diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h
index 18d383ed581c..d56a6d537868 100644
--- a/include/lldb/Core/MappedHash.h
+++ b/include/lldb/Core/MappedHash.h
@@ -357,21 +357,24 @@ public:
}
uint32_t GetHashIndex(uint32_t bucket_idx) const {
+ uint32_t result = UINT32_MAX;
if (m_hash_indexes && bucket_idx < m_header.bucket_count)
- return m_hash_indexes[bucket_idx];
- return UINT32_MAX;
+ memcpy(&result, m_hash_indexes + bucket_idx, sizeof(uint32_t));
+ return result;
}
uint32_t GetHashValue(uint32_t hash_idx) const {
+ uint32_t result = UINT32_MAX;
if (m_hash_values && hash_idx < m_header.hashes_count)
- return m_hash_values[hash_idx];
- return UINT32_MAX;
+ memcpy(&result, m_hash_values + hash_idx, sizeof(uint32_t));
+ return result;
}
uint32_t GetHashDataOffset(uint32_t hash_idx) const {
+ uint32_t result = UINT32_MAX;
if (m_hash_offsets && hash_idx < m_header.hashes_count)
- return m_hash_offsets[hash_idx];
- return UINT32_MAX;
+ memcpy(&result, m_hash_offsets + hash_idx, sizeof(uint32_t));
+ return result;
}
bool Find(const char *name, Pair &pair) const {
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 2ffe57ad8a4d..da981ade78ba 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -10,12 +10,12 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_
-#include "lldb/Core/Address.h" // for Address
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Address.h" // for Address
#include "lldb/Core/ModuleSpec.h" // for ModuleSpec
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h" // for ConstString
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h" // for Status
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h
index ce851d8af5fc..cc95bd0a0638 100644
--- a/include/lldb/Core/ModuleSpec.h
+++ b/include/lldb/Core/ModuleSpec.h
@@ -11,8 +11,8 @@
#define liblldb_ModuleSpec_h_
// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/UUID.h"
diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h
index d9851e5ecfc1..68e6ca20b266 100644
--- a/include/lldb/Core/PluginManager.h
+++ b/include/lldb/Core/PluginManager.h
@@ -10,6 +10,7 @@
#ifndef liblldb_PluginManager_h_
#define liblldb_PluginManager_h_
+#include "lldb/Core/Architecture.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h" // for Status
#include "lldb/lldb-enumerations.h" // for ScriptLanguage
@@ -54,6 +55,21 @@ public:
GetABICreateCallbackForPluginName(const ConstString &name);
//------------------------------------------------------------------
+ // Architecture
+ //------------------------------------------------------------------
+ using ArchitectureCreateInstance =
+ std::unique_ptr<Architecture> (*)(const ArchSpec &);
+
+ static void RegisterPlugin(const ConstString &name,
+ llvm::StringRef description,
+ ArchitectureCreateInstance create_callback);
+
+ static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
+
+ static std::unique_ptr<Architecture>
+ CreateArchitectureInstance(const ArchSpec &arch);
+
+ //------------------------------------------------------------------
// Disassembler
//------------------------------------------------------------------
static bool RegisterPlugin(const ConstString &name, const char *description,
diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h
index e37dcd7df443..91fd409fb4ed 100644
--- a/include/lldb/Core/RangeMap.h
+++ b/include/lldb/Core/RangeMap.h
@@ -975,7 +975,6 @@ public:
#endif
if (!m_entries.empty()) {
- typename Collection::const_iterator pos;
for (const auto &entry : m_entries) {
if (entry.Contains(addr))
indexes.push_back(entry.data);
diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h
index 0466693edbc4..2d5d6443ba7f 100644
--- a/include/lldb/Core/Section.h
+++ b/include/lldb/Core/Section.h
@@ -238,7 +238,7 @@ public:
/// section has no data or \a offset is not a valid offset
/// in this section.
//------------------------------------------------------------------
- lldb::offset_t GetSectionData(DataExtractor &data) const;
+ lldb::offset_t GetSectionData(DataExtractor &data);
uint32_t GetLog2Align() { return m_log2align; }
@@ -247,6 +247,10 @@ public:
// Get the number of host bytes required to hold a target byte
uint32_t GetTargetByteSize() const { return m_target_byte_size; }
+ bool IsRelocated() const { return m_relocated; }
+
+ void SetIsRelocated(bool b) { m_relocated = b; }
+
protected:
ObjectFile *m_obj_file; // The object file that data for this section should
// be read from
@@ -274,7 +278,8 @@ protected:
m_thread_specific : 1, // This section is thread specific
m_readable : 1, // If this section has read permissions
m_writable : 1, // If this section has write permissions
- m_executable : 1; // If this section has executable permissions
+ m_executable : 1, // If this section has executable permissions
+ m_relocated : 1; // If this section has had relocations applied
uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size.
// This is specified as
// as a multiple number of a host bytes
diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h
index 1816c3b7a00f..c85aaa5c1f9a 100644
--- a/include/lldb/Expression/DWARFExpression.h
+++ b/include/lldb/Expression/DWARFExpression.h
@@ -22,10 +22,6 @@ class DWARFCompileUnit;
namespace lldb_private {
-class ClangExpressionDeclMap;
-class ClangExpressionVariable;
-class ClangExpressionVariableList;
-
//----------------------------------------------------------------------
/// @class DWARFExpression DWARFExpression.h "lldb/Expression/DWARFExpression.h"
/// @brief Encapsulates a DWARF location expression and interprets it.
@@ -262,8 +258,6 @@ public:
/// member variables to populate many operands
//------------------------------------------------------------------
bool Evaluate(ExecutionContextScope *exe_scope,
- ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr, const Value *object_address_ptr,
Value &result, Status *error_ptr) const;
@@ -272,9 +266,7 @@ public:
/// Wrapper for the static evaluate function that uses member
/// variables to populate many operands
//------------------------------------------------------------------
- bool Evaluate(ExecutionContext *exe_ctx,
- ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
+ bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr, const Value *object_address_ptr,
Value &result, Status *error_ptr) const;
@@ -338,32 +330,14 @@ public:
/// True on success; false otherwise. If error_ptr is non-NULL,
/// details of the failure are provided through it.
//------------------------------------------------------------------
- static bool
- Evaluate(ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
- lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
- DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
- const lldb::offset_t length, const lldb::RegisterKind reg_set,
- const Value *initial_value_ptr, const Value *object_address_ptr,
- Value &result, Status *error_ptr);
-
- //------------------------------------------------------------------
- /// Loads a ClangExpressionVariableList into the object
- ///
- /// @param[in] locals
- /// If non-NULL, the list of locals used by this expression.
- /// See Evaluate().
- //------------------------------------------------------------------
- void SetExpressionLocalVariableList(ClangExpressionVariableList *locals);
-
- //------------------------------------------------------------------
- /// Loads a ClangExpressionDeclMap into the object
- ///
- /// @param[in] locals
- /// If non-NULL, the list of external variables used by this
- /// expression. See Evaluate().
- //------------------------------------------------------------------
- void SetExpressionDeclMap(ClangExpressionDeclMap *decl_map);
+ static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
+ lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
+ DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
+ const lldb::offset_t length,
+ const lldb::RegisterKind reg_set,
+ const Value *initial_value_ptr,
+ const Value *object_address_ptr, Value &result,
+ Status *error_ptr);
bool GetExpressionData(DataExtractor &data) const {
data = m_data;
diff --git a/include/lldb/Expression/ExpressionParser.h b/include/lldb/Expression/ExpressionParser.h
index 19526d28b9b3..a550d576f437 100644
--- a/include/lldb/Expression/ExpressionParser.h
+++ b/include/lldb/Expression/ExpressionParser.h
@@ -11,6 +11,7 @@
#define liblldb_ExpressionParser_h_
#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private-enumerations.h"
#include "lldb/lldb-public.h"
namespace lldb_private {
diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h
index b0b4d7a5c586..703fcd152af4 100644
--- a/include/lldb/Expression/IRExecutionUnit.h
+++ b/include/lldb/Expression/IRExecutionUnit.h
@@ -421,8 +421,8 @@ private:
lldb::addr_t m_function_load_addr;
lldb::addr_t m_function_end_load_addr;
- bool m_strip_underscore; ///< True for platforms where global symbols have a _
- ///prefix
+ bool m_strip_underscore = true; ///< True for platforms where global symbols
+ /// have a _ prefix
bool m_reported_allocations; ///< True after allocations have been reported.
///It is possible that
///< sections will be allocated when this is true, in which case they weren't
diff --git a/include/lldb/Host/Config.h.cmake b/include/lldb/Host/Config.h.cmake
index 0deedd151a5e..73f4b8f6cc4a 100644
--- a/include/lldb/Host/Config.h.cmake
+++ b/include/lldb/Host/Config.h.cmake
@@ -24,4 +24,6 @@
#cmakedefine01 HAVE_NR_PROCESS_VM_READV
+#cmakedefine HAVE_LIBCOMPRESSION
+
#endif // #ifndef LLDB_HOST_CONFIG_H
diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h
index da0b8e14c4a7..f099c72381be 100644
--- a/include/lldb/Host/Host.h
+++ b/include/lldb/Host/Host.h
@@ -48,6 +48,12 @@ struct WaitStatus {
static WaitStatus Decode(int wstatus);
};
+inline bool operator==(WaitStatus a, WaitStatus b) {
+ return a.type == b.type && a.status == b.status;
+}
+
+inline bool operator!=(WaitStatus a, WaitStatus b) { return !(a == b); }
+
//----------------------------------------------------------------------
/// @class Host Host.h "lldb/Host/Host.h"
/// @brief A class that provides host computer information.
diff --git a/include/lldb/Host/HostInfoBase.h b/include/lldb/Host/HostInfoBase.h
index 42e3fc3fd1da..52648d2031fc 100644
--- a/include/lldb/Host/HostInfoBase.h
+++ b/include/lldb/Host/HostInfoBase.h
@@ -10,7 +10,7 @@
#ifndef lldb_Host_HostInfoBase_h_
#define lldb_Host_HostInfoBase_h_
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-enumerations.h"
@@ -61,6 +61,8 @@ public:
static const ArchSpec &
GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
+ static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
+
//------------------------------------------------------------------
/// Find a resource files that are related to LLDB.
///
@@ -81,6 +83,13 @@ public:
//------------------------------------------------------------------
static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
+ //---------------------------------------------------------------------------
+ /// If the triple does not specify the vendor, os, and environment parts, we
+ /// "augment" these using information from the host and return the resulting
+ /// ArchSpec object.
+ //---------------------------------------------------------------------------
+ static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
+
protected:
static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
diff --git a/include/lldb/Host/MainLoop.h b/include/lldb/Host/MainLoop.h
index 5ac145ff865b..c59a5aa5b0e8 100644
--- a/include/lldb/Host/MainLoop.h
+++ b/include/lldb/Host/MainLoop.h
@@ -15,7 +15,7 @@
#include "llvm/ADT/DenseMap.h"
#include <csignal>
-#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H
+#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__)
#define SIGNAL_POLLING_UNSUPPORTED 1
#endif
diff --git a/include/lldb/Host/PseudoTerminal.h b/include/lldb/Host/PseudoTerminal.h
index fdbf6df1a186..00c0da6f3315 100644
--- a/include/lldb/Host/PseudoTerminal.h
+++ b/include/lldb/Host/PseudoTerminal.h
@@ -9,14 +9,13 @@
#ifndef LLDB_HOST_PSEUDOTERMINAL_H
#define LLDB_HOST_PSEUDOTERMINAL_H
-#if defined(__cplusplus)
#include <fcntl.h>
#include <string>
#include "lldb/lldb-defines.h"
-namespace lldb_utility {
+namespace lldb_private {
//----------------------------------------------------------------------
/// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h"
@@ -246,7 +245,6 @@ private:
DISALLOW_COPY_AND_ASSIGN(PseudoTerminal);
};
-} // namespace lldb_utility
+} // namespace lldb_private
-#endif // #if defined(__cplusplus)
#endif // #ifndef liblldb_PseudoTerminal_h_
diff --git a/include/lldb/Utility/TaskPool.h b/include/lldb/Host/TaskPool.h
index f2deaee506b8..13076e7eb70b 100644
--- a/include/lldb/Utility/TaskPool.h
+++ b/include/lldb/Host/TaskPool.h
@@ -18,6 +18,8 @@
#include <mutex> // for mutex, unique_lock, condition_variable
#include <type_traits> // for forward, result_of, move
+namespace lldb_private {
+
// Global TaskPool class for running tasks in parallel on a set of worker thread
// created the first
// time the task pool is used. The TaskPool provide no guarantee about the order
@@ -89,4 +91,8 @@ template <> struct TaskPool::RunTaskImpl<> {
void TaskMapOverInt(size_t begin, size_t end,
const llvm::function_ref<void(size_t)> &func);
+unsigned GetHardwareConcurrencyHint();
+
+} // namespace lldb_private
+
#endif // #ifndef utility_TaskPool_h_
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index 9671d710fc02..bd8b8744b115 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -10,8 +10,12 @@
#ifndef liblldb_NativeProcessProtocol_h_
#define liblldb_NativeProcessProtocol_h_
+#include "NativeBreakpointList.h"
+#include "NativeThreadProtocol.h"
+#include "NativeWatchpointList.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/MainLoop.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/TraceOptions.h"
#include "lldb/lldb-private-forward.h"
@@ -23,9 +27,6 @@
#include "llvm/Support/MemoryBuffer.h"
#include <vector>
-#include "NativeBreakpointList.h"
-#include "NativeWatchpointList.h"
-
namespace lldb_private {
class MemoryRegionInfo;
class ResumeActionList;
@@ -100,7 +101,7 @@ public:
virtual size_t UpdateThreads() = 0;
- virtual bool GetArchitecture(ArchSpec &arch) const = 0;
+ virtual const ArchSpec &GetArchitecture() const = 0;
//----------------------------------------------------------------------
// Breakpoint functions
@@ -151,7 +152,9 @@ public:
bool CanResume() const { return m_state == lldb::eStateStopped; }
- bool GetByteOrder(lldb::ByteOrder &byte_order) const;
+ lldb::ByteOrder GetByteOrder() const {
+ return GetArchitecture().GetByteOrder();
+ }
virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
GetAuxvData() const = 0;
@@ -166,15 +169,15 @@ public:
//----------------------------------------------------------------------
// Access to threads
//----------------------------------------------------------------------
- NativeThreadProtocolSP GetThreadAtIndex(uint32_t idx);
+ NativeThreadProtocol *GetThreadAtIndex(uint32_t idx);
- NativeThreadProtocolSP GetThreadByID(lldb::tid_t tid);
+ NativeThreadProtocol *GetThreadByID(lldb::tid_t tid);
void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; }
lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; }
- NativeThreadProtocolSP GetCurrentThread() {
+ NativeThreadProtocol *GetCurrentThread() {
return GetThreadByID(m_current_thread_id);
}
@@ -401,7 +404,7 @@ public:
protected:
lldb::pid_t m_pid;
- std::vector<NativeThreadProtocolSP> m_threads;
+ std::vector<std::unique_ptr<NativeThreadProtocol>> m_threads;
lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID;
mutable std::recursive_mutex m_threads_mutex;
@@ -461,7 +464,7 @@ protected:
// -----------------------------------------------------------
void NotifyDidExec();
- NativeThreadProtocolSP GetThreadByIDUnlocked(lldb::tid_t tid);
+ NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid);
// -----------------------------------------------------------
// Static helper methods for derived classes.
diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h
index 982d81b9ac4c..a8c5fa17e264 100644
--- a/include/lldb/Host/common/NativeRegisterContext.h
+++ b/include/lldb/Host/common/NativeRegisterContext.h
@@ -27,8 +27,7 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- NativeRegisterContext(NativeThreadProtocol &thread,
- uint32_t concrete_frame_idx);
+ NativeRegisterContext(NativeThreadProtocol &thread);
virtual ~NativeRegisterContext();
@@ -184,8 +183,6 @@ protected:
//------------------------------------------------------------------
NativeThreadProtocol
&m_thread; // The thread that this register context belongs to.
- uint32_t m_concrete_frame_idx; // The concrete frame index for this register
- // context
// uint32_t m_stop_id; // The stop ID that any data in this
// context is valid for
diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h
index d96f71311185..5609cdda4eea 100644
--- a/include/lldb/Host/common/NativeThreadProtocol.h
+++ b/include/lldb/Host/common/NativeThreadProtocol.h
@@ -20,8 +20,7 @@ namespace lldb_private {
//------------------------------------------------------------------
// NativeThreadProtocol
//------------------------------------------------------------------
-class NativeThreadProtocol
- : public std::enable_shared_from_this<NativeThreadProtocol> {
+class NativeThreadProtocol {
public:
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
@@ -31,7 +30,7 @@ public:
virtual lldb::StateType GetState() = 0;
- virtual NativeRegisterContextSP GetRegisterContext() = 0;
+ virtual NativeRegisterContext &GetRegisterContext() = 0;
virtual Status ReadRegister(uint32_t reg, RegisterValue &reg_value);
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h
index 98046cd59545..19d7ac418566 100644
--- a/include/lldb/Interpreter/Args.h
+++ b/include/lldb/Interpreter/Args.h
@@ -86,6 +86,7 @@ public:
Args(llvm::StringRef command = llvm::StringRef());
Args(const Args &rhs);
+ explicit Args(const StringList &list);
Args &operator=(const Args &rhs);
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h
index 73bd7d6e6220..5e561f47946d 100644
--- a/include/lldb/Interpreter/CommandInterpreter.h
+++ b/include/lldb/Interpreter/CommandInterpreter.h
@@ -242,6 +242,8 @@ public:
bool repeat_on_empty_command = true,
bool no_context_switching = false);
+ bool WasInterrupted() const;
+
//------------------------------------------------------------------
/// Execute a list of commands in sequence.
///
@@ -522,6 +524,25 @@ private:
StringList &commands_help,
CommandObject::CommandMap &command_map);
+ // An interruptible wrapper around the stream output
+ void PrintCommandOutput(Stream &stream, llvm::StringRef str);
+
+ // A very simple state machine which models the command handling transitions
+ enum class CommandHandlingState {
+ eIdle,
+ eInProgress,
+ eInterrupted,
+ };
+
+ std::atomic<CommandHandlingState> m_command_state{
+ CommandHandlingState::eIdle};
+
+ int m_iohandler_nesting_level = 0;
+
+ void StartHandlingCommand();
+ void FinishHandlingCommand();
+ bool InterruptCommand();
+
Debugger &m_debugger; // The debugger session that this interpreter is
// associated with
ExecutionContextRef m_exe_ctx_ref; // The current execution context to use
diff --git a/include/lldb/Interpreter/OptionGroupArchitecture.h b/include/lldb/Interpreter/OptionGroupArchitecture.h
index e73a53421f28..2cecaa65a0fd 100644
--- a/include/lldb/Interpreter/OptionGroupArchitecture.h
+++ b/include/lldb/Interpreter/OptionGroupArchitecture.h
@@ -10,12 +10,8 @@
#ifndef liblldb_OptionGroupArchitecture_h_
#define liblldb_OptionGroupArchitecture_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
namespace lldb_private {
diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h
index e1a354d4ae21..d66448aa2bed 100644
--- a/include/lldb/Interpreter/OptionValueArch.h
+++ b/include/lldb/Interpreter/OptionValueArch.h
@@ -10,12 +10,8 @@
#ifndef liblldb_OptionValueArch_h_
#define liblldb_OptionValueArch_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Utility/ArchSpec.h"
namespace lldb_private {
diff --git a/include/lldb/Symbol/ArmUnwindInfo.h b/include/lldb/Symbol/ArmUnwindInfo.h
index ef67a31e7d0d..422408b034c6 100644
--- a/include/lldb/Symbol/ArmUnwindInfo.h
+++ b/include/lldb/Symbol/ArmUnwindInfo.h
@@ -31,7 +31,7 @@ namespace lldb_private {
class ArmUnwindInfo {
public:
- ArmUnwindInfo(const ObjectFile &objfile, lldb::SectionSP &arm_exidx,
+ ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx,
lldb::SectionSP &arm_extab);
~ArmUnwindInfo();
diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h
index 9d0a08414e93..2d2c804eb025 100644
--- a/include/lldb/Symbol/ClangASTContext.h
+++ b/include/lldb/Symbol/ClangASTContext.h
@@ -25,6 +25,7 @@
// Other libraries and framework includes
#include "clang/AST/ASTContext.h"
+#include "clang/AST/ExternalASTMerger.h"
#include "clang/AST/TemplateBase.h"
#include "llvm/ADT/SmallVector.h"
@@ -396,7 +397,8 @@ public:
CompilerType CreateEnumerationType(const char *name,
clang::DeclContext *decl_ctx,
const Declaration &decl,
- const CompilerType &integer_qual_type);
+ const CompilerType &integer_qual_type,
+ bool is_scoped);
//------------------------------------------------------------------
// Integer type functions
@@ -780,9 +782,14 @@ public:
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
- CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) override;
+ lldb::TemplateArgumentKind
+ GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+ CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+ llvm::Optional<CompilerType::IntegralTemplateArgument>
+ GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
CompilerType GetTypeForFormatters(void *type) override;
@@ -964,8 +971,14 @@ public:
clang::DeclarationName
GetDeclarationName(const char *name, const CompilerType &function_clang_type);
-
+
+ virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() {
+ return m_origins;
+ }
protected:
+ const clang::ClassTemplateSpecializationDecl *
+ GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
+
//------------------------------------------------------------------
// Classes that inherit from ClangASTContext can see and modify these
//------------------------------------------------------------------
@@ -990,6 +1003,7 @@ protected:
CompleteTagDeclCallback m_callback_tag_decl;
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
void * m_callback_baton;
+ clang::ExternalASTMerger::OriginMap m_origins;
uint32_t m_pointer_byte_size;
bool m_ast_owned;
bool m_can_evaluate_expressions;
@@ -1023,7 +1037,12 @@ public:
const char *name) override;
PersistentExpressionState *GetPersistentExpressionState() override;
-
+
+ clang::ExternalASTMerger &GetMergerUnchecked();
+
+ const clang::ExternalASTMerger::OriginMap &GetOriginMap() override {
+ return GetMergerUnchecked().GetOrigins();
+ }
private:
lldb::TargetWP m_target_wp;
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
diff --git a/include/lldb/Symbol/CompilerType.h b/include/lldb/Symbol/CompilerType.h
index c5bca54ed43f..70d56db7fc21 100644
--- a/include/lldb/Symbol/CompilerType.h
+++ b/include/lldb/Symbol/CompilerType.h
@@ -20,6 +20,7 @@
// Project includes
#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-private.h"
+#include "llvm/ADT/APSInt.h"
namespace lldb_private {
@@ -290,6 +291,8 @@ public:
// Exploring the type
//----------------------------------------------------------------------
+ struct IntegralTemplateArgument;
+
uint64_t GetByteSize(ExecutionContextScope *exe_scope) const;
uint64_t GetBitSize(ExecutionContextScope *exe_scope) const;
@@ -365,8 +368,12 @@ public:
size_t GetNumTemplateArguments() const;
- CompilerType GetTemplateArgument(size_t idx,
- lldb::TemplateArgumentKind &kind) const;
+ lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const;
+ CompilerType GetTypeTemplateArgument(size_t idx) const;
+
+ // Returns the value of the template argument and its type.
+ llvm::Optional<IntegralTemplateArgument>
+ GetIntegralTemplateArgument(size_t idx) const;
CompilerType GetTypeForFormatters() const;
@@ -429,6 +436,11 @@ private:
bool operator==(const CompilerType &lhs, const CompilerType &rhs);
bool operator!=(const CompilerType &lhs, const CompilerType &rhs);
+struct CompilerType::IntegralTemplateArgument {
+ llvm::APSInt value;
+ CompilerType type;
+};
+
} // namespace lldb_private
#endif // liblldb_CompilerType_h_
diff --git a/include/lldb/Symbol/DeclVendor.h b/include/lldb/Symbol/DeclVendor.h
index 16d514fdf1bd..f0ce9157cfa5 100644
--- a/include/lldb/Symbol/DeclVendor.h
+++ b/include/lldb/Symbol/DeclVendor.h
@@ -13,6 +13,8 @@
#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-defines.h"
+#include "clang/AST/ExternalASTMerger.h"
+
#include <vector>
namespace lldb_private {
@@ -53,6 +55,15 @@ public:
uint32_t max_matches,
std::vector<clang::NamedDecl *> &decls) = 0;
+ //------------------------------------------------------------------
+ /// Interface for ExternalASTMerger. Returns an ImporterSource
+ /// allowing type completion.
+ ///
+ /// @return
+ /// An ImporterSource for this DeclVendor.
+ //------------------------------------------------------------------
+ virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
+
private:
//------------------------------------------------------------------
// For DeclVendor only
diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h
index 64c222cce585..27f42cf425b2 100644
--- a/include/lldb/Symbol/FuncUnwinders.h
+++ b/include/lldb/Symbol/FuncUnwinders.h
@@ -1,13 +1,11 @@
#ifndef liblldb_FuncUnwinders_h
#define liblldb_FuncUnwinders_h
+#include "lldb/Core/AddressRange.h"
+#include "lldb/lldb-private-enumerations.h"
#include <mutex>
#include <vector>
-#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/ArchSpec.h"
-
namespace lldb_private {
class UnwindTable;
diff --git a/include/lldb/Symbol/GoASTContext.h b/include/lldb/Symbol/GoASTContext.h
index 6feac7abf162..ee111942c205 100644
--- a/include/lldb/Symbol/GoASTContext.h
+++ b/include/lldb/Symbol/GoASTContext.h
@@ -315,12 +315,6 @@ public:
return 0;
}
- CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) override {
- return CompilerType();
- }
-
//----------------------------------------------------------------------
// Dumping types
//----------------------------------------------------------------------
diff --git a/include/lldb/Symbol/JavaASTContext.h b/include/lldb/Symbol/JavaASTContext.h
index 4fdd2371b67e..41a881dcf4eb 100644
--- a/include/lldb/Symbol/JavaASTContext.h
+++ b/include/lldb/Symbol/JavaASTContext.h
@@ -203,10 +203,6 @@ public:
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
- CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) override;
-
int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
diff --git a/include/lldb/Symbol/OCamlASTContext.h b/include/lldb/Symbol/OCamlASTContext.h
index a261d43519e0..7144886e1c75 100644
--- a/include/lldb/Symbol/OCamlASTContext.h
+++ b/include/lldb/Symbol/OCamlASTContext.h
@@ -231,12 +231,6 @@ public:
return 0;
}
- CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) override {
- return CompilerType();
- }
-
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
Stream *s, lldb::Format format, const DataExtractor &data,
lldb::offset_t data_offset, size_t data_byte_size,
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index a4c7b01ece17..3f9250af7e08 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -352,6 +352,12 @@ public:
virtual Symtab *GetSymtab() = 0;
//------------------------------------------------------------------
+ /// Perform relocations on the section if necessary.
+ ///
+ //------------------------------------------------------------------
+ virtual void RelocateSection(lldb_private::Section *section);
+
+ //------------------------------------------------------------------
/// Appends a Symbol for the specified so_addr to the symbol table.
///
/// If verify_unique is false, the symbol table is not searched
@@ -787,20 +793,26 @@ public:
static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp,
lldb::addr_t addr, size_t byte_size);
+ // This function returns raw file contents. Do not use it if you want
+ // transparent decompression of section contents.
size_t GetData(lldb::offset_t offset, size_t length,
DataExtractor &data) const;
+ // This function returns raw file contents. Do not use it if you want
+ // transparent decompression of section contents.
size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const;
- virtual size_t ReadSectionData(const Section *section,
+ // This function will transparently decompress section data if the section if
+ // compressed.
+ virtual size_t ReadSectionData(Section *section,
lldb::offset_t section_offset, void *dst,
- size_t dst_len) const;
-
- virtual size_t ReadSectionData(const Section *section,
- DataExtractor &section_data) const;
+ size_t dst_len);
- size_t MemoryMapSectionData(const Section *section,
- DataExtractor &section_data) const;
+ // This function will transparently decompress section data if the section if
+ // compressed. Note that for compressed section the resulting data size may be
+ // larger than what Section::GetFileSize reports.
+ virtual size_t ReadSectionData(Section *section,
+ DataExtractor &section_data);
bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h
index b4f84c0dd67c..ff85d8428746 100644
--- a/include/lldb/Symbol/TypeSystem.h
+++ b/include/lldb/Symbol/TypeSystem.h
@@ -351,9 +351,12 @@ public:
virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) = 0;
- virtual CompilerType
- GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
- lldb::TemplateArgumentKind &kind) = 0;
+ virtual lldb::TemplateArgumentKind
+ GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx);
+ virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx);
+ virtual llvm::Optional<CompilerType::IntegralTemplateArgument>
+ GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx);
//----------------------------------------------------------------------
// Dumping types
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index cc007d959c65..6288a3ab684f 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -21,10 +21,10 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private-forward.h"
@@ -53,6 +53,7 @@ public:
};
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
+typedef llvm::SmallVector<lldb::addr_t, 6> MmapArgList;
//----------------------------------------------------------------------
/// @class Platform Platform.h "lldb/Target/Platform.h"
@@ -116,9 +117,12 @@ public:
static lldb::PlatformSP Create(const ArchSpec &arch,
ArchSpec *platform_arch_ptr, Status &error);
- static uint32_t GetNumConnectedRemotePlatforms();
-
- static lldb::PlatformSP GetConnectedRemotePlatformAtIndex(uint32_t idx);
+ //------------------------------------------------------------------------
+ /// Augments the triple either with information from platform or the host
+ /// system (if platform is null).
+ //------------------------------------------------------------------------
+ static ArchSpec GetAugmentedArchSpec(Platform *platform,
+ llvm::StringRef triple);
//------------------------------------------------------------------
/// Find a platform plugin for a given process.
@@ -512,6 +516,13 @@ public:
m_os_version_set_while_connected = m_system_arch.IsValid();
}
+ //---------------------------------------------------------------------------
+ /// If the triple contains not specify the vendor, os, and environment parts,
+ /// we "augment" these using information from the platform and return the
+ /// resulting ArchSpec object.
+ //---------------------------------------------------------------------------
+ ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
+
// Used for column widths
size_t GetMaxUserIDNameLength() const { return m_max_uid_name_len; }
@@ -628,8 +639,11 @@ public:
virtual Status Unlink(const FileSpec &file_spec);
- virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags);
+ virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch,
+ lldb::addr_t addr,
+ lldb::addr_t length,
+ unsigned prot, unsigned flags,
+ lldb::addr_t fd, lldb::addr_t offset);
virtual bool GetSupportsRSync() { return m_supports_rsync; }
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index df09570057a1..16f37f4dd5dc 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -27,7 +27,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointSiteList.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/Event.h"
@@ -46,6 +45,7 @@
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/ThreadList.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StructuredData.h"
@@ -99,6 +99,8 @@ public:
bool GetWarningsOptimization() const;
+ bool GetStopOnExec() const;
+
protected:
static void OptionValueChangedCallback(void *baton,
OptionValue *option_value);
@@ -2514,10 +2516,6 @@ public:
OperatingSystem *GetOperatingSystem() { return m_os_ap.get(); }
- ArchSpec::StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const {
- return m_stop_info_override_callback;
- }
-
virtual LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
bool retry_if_null = true);
@@ -3106,7 +3104,6 @@ protected:
std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
ProcessRunLock m_public_run_lock;
ProcessRunLock m_private_run_lock;
- ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or
// m_currently_handling_do_on_removals are true,
diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h
index 03b15242f7ee..4077abf89baf 100644
--- a/include/lldb/Target/ProcessInfo.h
+++ b/include/lldb/Target/ProcessInfo.h
@@ -11,8 +11,8 @@
#define liblldb_ProcessInfo_h_
// LLDB headers
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h
index 93a1a9ebd239..fc715f28544d 100644
--- a/include/lldb/Target/ProcessLaunchInfo.h
+++ b/include/lldb/Target/ProcessLaunchInfo.h
@@ -117,7 +117,7 @@ public:
bool MonitorProcess() const;
- lldb_utility::PseudoTerminal &GetPTY() { return *m_pty; }
+ PseudoTerminal &GetPTY() { return *m_pty; }
// Get and set the actual listener that will be used for the process events
lldb::ListenerSP GetListener() const { return m_listener_sp; }
@@ -150,7 +150,7 @@ protected:
FileSpec m_shell;
Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
std::vector<FileAction> m_file_actions; // File actions for any other files
- std::shared_ptr<lldb_utility::PseudoTerminal> m_pty;
+ std::shared_ptr<PseudoTerminal> m_pty;
uint32_t m_resume_count; // How many times do we resume after launching
Host::MonitorChildProcessCallback m_monitor_callback;
void *m_monitor_callback_baton;
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index ff9451939909..242ec14165eb 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -21,8 +21,9 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointList.h"
+#include "lldb/Breakpoint/BreakpointName.h"
#include "lldb/Breakpoint/WatchpointList.h"
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Architecture.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/ModuleList.h"
@@ -33,6 +34,7 @@
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/SectionLoadHistory.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Timeout.h"
#include "lldb/lldb-public.h"
@@ -195,6 +197,8 @@ public:
void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
+ bool GetUseModernTypeLookup() const;
+
private:
//------------------------------------------------------------------
// Callbacks for m_launch_info.
@@ -651,12 +655,45 @@ public:
}
WatchpointList &GetWatchpointList() { return m_watchpoint_list; }
-
+
+ // Manages breakpoint names:
+ void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
+
+ void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
+ Status &error);
+
+ void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
+ const ConstString &name);
+
+ BreakpointName *FindBreakpointName(const ConstString &name, bool can_create,
+ Status &error);
+
+ void DeleteBreakpointName(const ConstString &name);
+
+ void ConfigureBreakpointName(BreakpointName &bp_name,
+ const BreakpointOptions &options,
+ const BreakpointName::Permissions &permissions);
+ void ApplyNameToBreakpoints(BreakpointName &bp_name);
+
+
+ // This takes ownership of the name obj passed in.
+ void AddBreakpointName(BreakpointName *bp_name);
+
+ void GetBreakpointNames(std::vector<std::string> &names);
+
+ //This call removes ALL breakpoints regardless of permission.
void RemoveAllBreakpoints(bool internal_also = false);
+
+ // This removes all the breakpoints, but obeys the ePermDelete on them.
+ void RemoveAllowedBreakpoints();
void DisableAllBreakpoints(bool internal_also = false);
+
+ void DisableAllowedBreakpoints();
void EnableAllBreakpoints(bool internal_also = false);
+
+ void EnableAllowedBreakpoints();
bool DisableBreakpointByID(lldb::break_id_t break_id);
@@ -881,7 +918,7 @@ public:
bool
ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp);
- const ArchSpec &GetArchitecture() const { return m_arch; }
+ const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
//------------------------------------------------------------------
/// Set the architecture for this target.
@@ -912,6 +949,8 @@ public:
bool MergeArchitecture(const ArchSpec &arch_spec);
+ Architecture *GetArchitecturePlugin() { return m_arch.GetPlugin(); }
+
Debugger &GetDebugger() { return m_debugger; }
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
@@ -1205,6 +1244,18 @@ protected:
const lldb::ModuleSP &new_module_sp) override;
void WillClearList(const ModuleList &module_list) override;
+ class Arch {
+ public:
+ explicit Arch(const ArchSpec &spec);
+ const Arch &operator=(const ArchSpec &spec);
+
+ const ArchSpec &GetSpec() const { return m_spec; }
+ Architecture *GetPlugin() const { return m_plugin_up.get(); }
+
+ private:
+ ArchSpec m_spec;
+ std::unique_ptr<Architecture> m_plugin_up;
+ };
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
@@ -1212,12 +1263,15 @@ protected:
lldb::PlatformSP m_platform_sp; ///< The platform for this target.
std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
/// classes make the SB interface thread safe
- ArchSpec m_arch;
+ Arch m_arch;
ModuleList m_images; ///< The list of images for this process (shared
/// libraries and anything dynamically loaded).
SectionLoadHistory m_section_load_history;
BreakpointList m_breakpoint_list;
BreakpointList m_internal_breakpoint_list;
+ using BreakpointNameList = std::map<ConstString, BreakpointName *>;
+ BreakpointNameList m_breakpoint_names;
+
lldb::BreakpointSP m_last_created_breakpoint;
WatchpointList m_watchpoint_list;
lldb::WatchpointSP m_last_created_watchpoint;
diff --git a/include/lldb/Target/UnwindAssembly.h b/include/lldb/Target/UnwindAssembly.h
index 66fc27f71aa1..3028ffeaa51d 100644
--- a/include/lldb/Target/UnwindAssembly.h
+++ b/include/lldb/Target/UnwindAssembly.h
@@ -10,8 +10,8 @@
#ifndef utility_UnwindAssembly_h_
#define utility_UnwindAssembly_h_
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Utility/ArchSpec.h
index 75c7079be08d..50f69606e3df 100644
--- a/include/lldb/Core/ArchSpec.h
+++ b/include/lldb/Utility/ArchSpec.h
@@ -7,39 +7,23 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ArchSpec_h_
-#define liblldb_ArchSpec_h_
-
-#if defined(__cplusplus)
+#ifndef LLDB_UTILITY_ARCHSPEC_H
+#define LLDB_UTILITY_ARCHSPEC_H
#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
#include "lldb/lldb-private-enumerations.h"
#include "llvm/ADT/StringRef.h" // for StringRef
#include "llvm/ADT/Triple.h"
-
-#include <string> // for string
-
-#include <stddef.h> // for size_t
-#include <stdint.h> // for uint32_t
-
-namespace lldb_private {
-class Platform;
-}
-namespace lldb_private {
-class Stream;
-}
-namespace lldb_private {
-class StringList;
-}
-namespace lldb_private {
-class Thread;
-}
+#include <cstddef> // for size_t
+#include <cstdint> // for uint32_t
+#include <string> // for string
namespace lldb_private {
//----------------------------------------------------------------------
-/// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h"
+/// @class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h"
/// @brief An architecture specification class.
///
/// A class designed to be created from a cpu type and subtype, a
@@ -177,6 +161,7 @@ public:
eCore_ppc_ppc7450,
eCore_ppc_ppc970,
+ eCore_ppc64le_generic,
eCore_ppc64_generic,
eCore_ppc64_ppc970_64,
@@ -257,8 +242,6 @@ public:
};
- typedef void (*StopInfoOverrideCallbackType)(lldb_private::Thread &thread);
-
//------------------------------------------------------------------
/// Default constructor.
///
@@ -276,8 +259,6 @@ public:
explicit ArchSpec(const llvm::Triple &triple);
explicit ArchSpec(const char *triple_cstr);
explicit ArchSpec(llvm::StringRef triple_str);
- ArchSpec(const char *triple_cstr, Platform *platform);
- ArchSpec(llvm::StringRef triple_str, Platform *platform);
//------------------------------------------------------------------
/// Constructor over architecture name.
///
@@ -301,6 +282,12 @@ public:
//------------------------------------------------------------------
const ArchSpec &operator=(const ArchSpec &rhs);
+ //---------------------------------------------------------------------------
+ /// Returns true if the OS, vendor and environment fields of the triple are
+ /// unset. The triple is expected to be normalized (llvm::Triple::normalize).
+ //---------------------------------------------------------------------------
+ static bool ContainsOnlyArch(const llvm::Triple &normalized_triple);
+
static size_t AutoComplete(llvm::StringRef name, StringList &matches);
//------------------------------------------------------------------
@@ -533,10 +520,6 @@ public:
bool SetTriple(const llvm::Triple &triple);
bool SetTriple(llvm::StringRef triple_str);
- bool SetTriple(llvm::StringRef triple_str, Platform *platform);
-
- bool SetTriple(const char *triple_cstr);
- bool SetTriple(const char *triple_cstr, Platform *platform);
//------------------------------------------------------------------
/// Returns the default endianness of the architecture.
@@ -573,34 +556,12 @@ public:
//------------------------------------------------------------------
bool IsCompatibleMatch(const ArchSpec &rhs) const;
- //------------------------------------------------------------------
- /// Get a stop info override callback for the current architecture.
- ///
- /// Most platform specific code should go in lldb_private::Platform,
- /// but there are cases where no matter which platform you are on
- /// certain things hold true.
- ///
- /// This callback is currently intended to handle cases where a
- /// program stops at an instruction that won't get executed and it
- /// allows the stop reasonm, like "breakpoint hit", to be replaced
- /// with a different stop reason like "no stop reason".
- ///
- /// This is specifically used for ARM in Thumb code when we stop in
- /// an IT instruction (if/then/else) where the instruction won't get
- /// executed and therefore it wouldn't be correct to show the program
- /// stopped at the current PC. The code is generic and applies to all
- /// ARM CPUs.
- ///
- /// @return NULL or a valid stop info override callback for the
- /// current architecture.
- //------------------------------------------------------------------
- StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const;
-
bool IsFullySpecifiedTriple() const;
void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_different,
bool &vendor_different, bool &os_different,
- bool &os_version_different, bool &env_different);
+ bool &os_version_different,
+ bool &env_different) const;
//------------------------------------------------------------------
/// Detect whether this architecture uses thumb code exclusively
@@ -661,5 +622,4 @@ bool ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str, ArchSpec &arch);
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // #ifndef liblldb_ArchSpec_h_
+#endif // #ifndef LLDB_UTILITY_ARCHSPEC_H
diff --git a/include/lldb/Utility/DataExtractor.h b/include/lldb/Utility/DataExtractor.h
index 4ef78c1af492..8107a3554422 100644
--- a/include/lldb/Utility/DataExtractor.h
+++ b/include/lldb/Utility/DataExtractor.h
@@ -513,10 +513,8 @@ public:
///
/// Extract a single integer value and update the offset pointed to
/// by \a offset_ptr. The size of the extracted integer is specified
- /// by the \a byte_size argument. \a byte_size should have a value
- /// >= 1 and <= 4 since the return value is only 32 bits wide. Any
- /// \a byte_size values less than 1 or greater than 4 will result in
- /// nothing being extracted, and zero being returned.
+ /// by the \a byte_size argument. \a byte_size must have a value
+ /// >= 1 and <= 4 since the return value is only 32 bits wide.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -539,11 +537,9 @@ public:
///
/// Extract a single unsigned integer value and update the offset
/// pointed to by \a offset_ptr. The size of the extracted integer
- /// is specified by the \a byte_size argument. \a byte_size should
+ /// is specified by the \a byte_size argument. \a byte_size must
/// have a value greater than or equal to one and less than or equal
- /// to eight since the return value is 64 bits wide. Any
- /// \a byte_size values less than 1 or greater than 8 will result in
- /// nothing being extracted, and zero being returned.
+ /// to eight since the return value is 64 bits wide.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -570,10 +566,9 @@ public:
/// Extract a single signed integer value (sign extending if required)
/// and update the offset pointed to by \a offset_ptr. The size of
/// the extracted integer is specified by the \a byte_size argument.
- /// \a byte_size should have a value greater than or equal to one
- /// and less than or equal to eight since the return value is 64
- /// bits wide. Any \a byte_size values less than 1 or greater than
- /// 8 will result in nothing being extracted, and zero being returned.
+ /// \a byte_size must have a value greater than or equal to one and
+ /// less than or equal to eight since the return value is 64 bits
+ /// wide.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -589,7 +584,7 @@ public:
/// The sign extended signed integer value that was extracted,
/// or zero on failure.
//------------------------------------------------------------------
- int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t size) const;
+ int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t byte_size) const;
//------------------------------------------------------------------
/// Extract an unsigned integer of size \a byte_size from \a
@@ -598,11 +593,9 @@ public:
///
/// Extract a single unsigned integer value and update the offset
/// pointed to by \a offset_ptr. The size of the extracted integer
- /// is specified by the \a byte_size argument. \a byte_size should
+ /// is specified by the \a byte_size argument. \a byte_size must
/// have a value greater than or equal to one and less than or equal
- /// to 8 since the return value is 64 bits wide. Any
- /// \a byte_size values less than 1 or greater than 8 will result in
- /// nothing being extracted, and zero being returned.
+ /// to 8 since the return value is 64 bits wide.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -641,10 +634,9 @@ public:
/// Extract a single signed integer value (sign extending if required)
/// and update the offset pointed to by \a offset_ptr. The size of
/// the extracted integer is specified by the \a byte_size argument.
- /// \a byte_size should have a value greater than or equal to one
- /// and less than or equal to eight since the return value is 64
- /// bits wide. Any \a byte_size values less than 1 or greater than
- /// 8 will result in nothing being extracted, and zero being returned.
+ /// \a byte_size must have a value greater than or equal to one and
+ /// less than or equal to eight since the return value is 64 bits
+ /// wide.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
diff --git a/include/lldb/Utility/FileSpec.h b/include/lldb/Utility/FileSpec.h
index 67926d01e529..55d44d84087d 100644
--- a/include/lldb/Utility/FileSpec.h
+++ b/include/lldb/Utility/FileSpec.h
@@ -61,7 +61,7 @@ namespace lldb_private {
//----------------------------------------------------------------------
class FileSpec {
public:
- enum PathSyntax {
+ enum PathSyntax : unsigned char {
ePathSyntaxPosix,
ePathSyntaxWindows,
ePathSyntaxHostNative
diff --git a/include/lldb/Utility/Log.h b/include/lldb/Utility/Log.h
index d856fc81eb0d..80a80fc16485 100644
--- a/include/lldb/Utility/Log.h
+++ b/include/lldb/Utility/Log.h
@@ -96,6 +96,9 @@ public:
}
};
+
+ static void Initialize();
+
//------------------------------------------------------------------
// Static accessors for logging channels
//------------------------------------------------------------------
@@ -193,6 +196,8 @@ private:
static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry,
llvm::ArrayRef<const char *> categories);
+ static void DisableLoggingChild();
+
Log(const Log &) = delete;
void operator=(const Log &) = delete;
};
diff --git a/include/lldb/Utility/Logging.h b/include/lldb/Utility/Logging.h
index 865097e7c194..2c75a3bf218b 100644
--- a/include/lldb/Utility/Logging.h
+++ b/include/lldb/Utility/Logging.h
@@ -62,7 +62,7 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask);
Log *GetLogIfAnyCategoriesSet(uint32_t mask);
-void InitializeLog();
+void InitializeLldbChannel();
} // namespace lldb_private
diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h
index 49b0020da3ef..41fa0c8121d8 100644
--- a/include/lldb/Utility/SharingPtr.h
+++ b/include/lldb/Utility/SharingPtr.h
@@ -529,16 +529,7 @@ public:
~IntrusiveSharingPtr() {
release_shared();
-#if defined(LLDB_CONFIGURATION_DEBUG) || defined(LLDB_CONFIGURATION_RELEASE)
- // NULL out the pointer in objects which can help with leaks detection.
- // We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or
- // when none of the LLDB_CONFIGURATION_XXX macros are defined since
- // those would be builds for release. But for debug and release builds
- // that are for development, we NULL out the pointers to catch potential
- // issues.
ptr_ = nullptr;
-#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined
- // (LLDB_CONFIGURATION_RELEASE)
}
T &operator*() const { return *ptr_; }
diff --git a/include/lldb/Utility/Status.h b/include/lldb/Utility/Status.h
index d520ebd942ee..8c3e009a8c2e 100644
--- a/include/lldb/Utility/Status.h
+++ b/include/lldb/Utility/Status.h
@@ -88,19 +88,6 @@ public:
//------------------------------------------------------------------
const Status &operator=(const Status &rhs);
- //------------------------------------------------------------------
- /// Assignment operator from a kern_return_t.
- ///
- /// Sets the type to \c MachKernel and the error code to \a err.
- ///
- /// @param[in] err
- /// A mach error code.
- ///
- /// @return
- /// A const reference to this object.
- //------------------------------------------------------------------
- const Status &operator=(uint32_t err);
-
~Status();
// llvm::Error support
diff --git a/include/lldb/Utility/StringList.h b/include/lldb/Utility/StringList.h
index 2be9a6bd8346..6553e5dfdfb9 100644
--- a/include/lldb/Utility/StringList.h
+++ b/include/lldb/Utility/StringList.h
@@ -29,7 +29,7 @@ class StringList {
public:
StringList();
- StringList(const char *str);
+ explicit StringList(const char *str);
StringList(const char **strv, int strc);
diff --git a/include/lldb/Utility/UUID.h b/include/lldb/Utility/UUID.h
index 6313025dec15..5e64e9079789 100644
--- a/include/lldb/Utility/UUID.h
+++ b/include/lldb/Utility/UUID.h
@@ -46,7 +46,7 @@ public:
const void *GetBytes() const;
- size_t GetByteSize();
+ size_t GetByteSize() const;
bool IsValid() const;
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index 14bae6ca206d..760e12b0e799 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -380,7 +380,8 @@ FLAGS_ENUM(BreakpointEventType){
eBreakpointEventTypeCommandChanged = (1u << 8),
eBreakpointEventTypeConditionChanged = (1u << 9),
eBreakpointEventTypeIgnoreChanged = (1u << 10),
- eBreakpointEventTypeThreadChanged = (1u << 11)};
+ eBreakpointEventTypeThreadChanged = (1u << 11),
+ eBreakpointEventTypeAutoContinueChanged = (1u << 12)};
FLAGS_ENUM(WatchpointEventType){
eWatchpointEventTypeInvalidType = (1u << 0),
@@ -566,6 +567,7 @@ enum CommandArgumentType {
eArgTypeWatchpointIDRange,
eArgTypeWatchType,
eArgRawInput,
+ eArgTypeCommand,
eArgTypeLastArg // Always keep this entry as the last entry in this
// enumeration!!
};
@@ -626,6 +628,7 @@ enum SectionType {
eSectionTypeDWARFDebugAbbrev,
eSectionTypeDWARFDebugAddr,
eSectionTypeDWARFDebugAranges,
+ eSectionTypeDWARFDebugCuIndex,
eSectionTypeDWARFDebugFrame,
eSectionTypeDWARFDebugInfo,
eSectionTypeDWARFDebugLine,
@@ -764,8 +767,8 @@ enum TemplateArgumentKind {
eTemplateArgumentKindTemplate,
eTemplateArgumentKindTemplateExpansion,
eTemplateArgumentKindExpression,
- eTemplateArgumentKindPack
-
+ eTemplateArgumentKindPack,
+ eTemplateArgumentKindNullPtr,
};
//----------------------------------------------------------------------
@@ -931,8 +934,8 @@ enum ExpressionEvaluationPhase {
// Indicates what types of events cause the watchpoint to fire.
// Used by Native*Protocol-related classes.
//----------------------------------------------------------------------
-FLAGS_ENUM(WatchpointKind){eWatchpointKindRead = (1u << 0),
- eWatchpointKindWrite = (1u << 1)};
+FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0),
+ eWatchpointKindRead = (1u << 1)};
enum GdbSignal {
eGdbSignalBadAccess = 0x91,
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index 392dc641558d..a324edf9da3b 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -38,6 +38,8 @@ class BreakpointList;
class BreakpointLocation;
class BreakpointLocationCollection;
class BreakpointLocationList;
+class BreakpointName;
+class BreakpointOptionGroup;
class BreakpointOptions;
class BreakpointResolver;
class BreakpointSite;
diff --git a/include/lldb/lldb-private-defines.h b/include/lldb/lldb-private-defines.h
index 53c5f31bab8c..22172366c259 100644
--- a/include/lldb/lldb-private-defines.h
+++ b/include/lldb/lldb-private-defines.h
@@ -13,8 +13,7 @@
#if defined(__cplusplus)
// Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then
-// Compiler.h
-// later tries to redefine it.
+// Compiler.h later tries to redefine it.
#include "llvm/Support/Compiler.h"
#ifndef LLVM_FALLTHROUGH
diff --git a/include/lldb/lldb-private-forward.h b/include/lldb/lldb-private-forward.h
index 296facb1a0bd..ea122525ef90 100644
--- a/include/lldb/lldb-private-forward.h
+++ b/include/lldb/lldb-private-forward.h
@@ -30,10 +30,6 @@ class UnixSignals;
// SP/WP decls.
// ---------------------------------------------------------------
typedef std::shared_ptr<NativeBreakpoint> NativeBreakpointSP;
-typedef std::shared_ptr<lldb_private::NativeRegisterContext>
- NativeRegisterContextSP;
-typedef std::shared_ptr<lldb_private::NativeThreadProtocol>
- NativeThreadProtocolSP;
}
#endif // #if defined(__cplusplus)
diff --git a/lit/CMakeLists.txt b/lit/CMakeLists.txt
index 07d490619649..5488154318a9 100644
--- a/lit/CMakeLists.txt
+++ b/lit/CMakeLists.txt
@@ -11,10 +11,6 @@ else()
set(ENABLE_SHARED 0)
endif(BUILD_SHARED_LIBS)
-option(LLDB_TEST_CLANG "Use in-tree clang when testing lldb" Off)
-set(LLDB_TEST_C_COMPILER "" CACHE STRING "C compiler to use when testing LLDB")
-set(LLDB_TEST_CXX_COMPILER "" CACHE STRING "C++ compiler to use when testing LLDB")
-
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
@@ -26,10 +22,11 @@ configure_lit_site_cfg(
set(LLDB_TEST_DEPS
LLDBUnitTests
lldb
+ lldb-test
)
if(NOT LLDB_BUILT_STANDALONE)
- list(APPEND LLDB_TEST_DEPS FileCheck not)
+ list(APPEND LLDB_TEST_DEPS FileCheck not yaml2obj)
endif()
# lldb-server is not built on every platform.
@@ -41,10 +38,7 @@ if(APPLE)
list(APPEND LLDB_TEST_DEPS debugserver)
endif()
-if(LLDB_TEST_CLANG)
- if(LLDB_TEST_C_COMPILER OR LLDB_TEST_CXX_COMPILER)
- message(SEND_ERROR "Cannot override LLDB_TEST_<LANG>_COMPILER and set LLDB_TEST_CLANG.")
- endif()
+if(TARGET clang)
list(APPEND LLDB_TEST_DEPS clang)
endif()
@@ -61,6 +55,12 @@ add_lit_testsuite(check-lldb-lit "Running lldb lit test suite"
set_target_properties(check-lldb-lit PROPERTIES FOLDER "LLDB tests")
+# If we're building with an in-tree clang, then list clang as a dependency
+# to run tests.
+if (TARGET clang)
+ add_dependencies(check-lldb-lit clang)
+endif()
+
add_lit_testsuites(LLDB ${CMAKE_CURRENT_SOURCE_DIR}
PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
diff --git a/lit/Modules/compressed-sections.yaml b/lit/Modules/compressed-sections.yaml
new file mode 100644
index 000000000000..0eabd99f2d6d
--- /dev/null
+++ b/lit/Modules/compressed-sections.yaml
@@ -0,0 +1,30 @@
+# REQUIRES: zlib
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test module-sections --contents %t | FileCheck %s
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_386
+Sections:
+ - Name: .hello_elf
+ Type: SHT_PROGBITS
+ Flags: [ SHF_COMPRESSED ]
+ Content: 010000000800000001000000789c5330700848286898000009c802c1
+ - Name: .bogus
+ Type: SHT_PROGBITS
+ Flags: [ SHF_COMPRESSED ]
+ Content: deadbeefbaadf00d
+
+# CHECK: Name: .hello_elf
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 28
+# CHECK-NEXT: Data:
+# CHECK-NEXT: 20304050 60708090
+
+# CHECK: Name: .bogus
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 8
+# CHECK-NEXT: Data:
+# CHECK-NEXT: DEADBEEF BAADF00D
diff --git a/lit/Modules/lit.local.cfg b/lit/Modules/lit.local.cfg
new file mode 100644
index 000000000000..8169b9f95e11
--- /dev/null
+++ b/lit/Modules/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.yaml']
diff --git a/lit/Unit/lit.cfg b/lit/Unit/lit.cfg
index 7dfb344e6fae..338adfd7bd9a 100644
--- a/lit/Unit/lit.cfg
+++ b/lit/Unit/lit.cfg
@@ -6,19 +6,6 @@ import os
import lit.formats
-# Check that the object root is known.
-if config.test_exec_root is None:
- # Otherwise, we haven't loaded the site specific configuration (the user is
- # probably trying to run on a test file directly, and either the site
- # configuration hasn't been created by the build system, or we are in an
- # out-of-tree build situation).
-
- # Check for 'llvm_unit_site_config' user parameter, and use that if available.
- site_cfg = lit_config.params.get('lldb_unit_site_config', None)
- if site_cfg and os.path.exists(site_cfg):
- lit_config.load_config(config, site_cfg)
- raise SystemExit
-
# name: The name of this test suite.
config.name = 'lldb-Unit'
@@ -31,6 +18,4 @@ config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests')
config.test_exec_root = config.test_source_root
# testFormat: The test format to use to interpret tests.
-if not hasattr(config, 'llvm_build_mode'):
- lit_config.fatal("unable to find llvm_build_mode value on config")
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
diff --git a/lit/lit.cfg b/lit/lit.cfg
index 8dea61b27169..402d03947ca8 100644
--- a/lit/lit.cfg
+++ b/lit/lit.cfg
@@ -9,6 +9,9 @@ import locale
import lit.formats
import lit.util
+def binary_feature(on, feature, off_prefix):
+ return feature if on else off_prefix + feature
+
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
@@ -29,94 +32,24 @@ config.suffixes = []
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
-lldb_obj_root = getattr(config, 'lldb_obj_root', None)
-if lldb_obj_root is not None:
- config.test_exec_root = os.path.join(lldb_obj_root, 'lit')
-
-# Set llvm_{src,obj}_root for use by others.
-config.llvm_src_root = getattr(config, 'llvm_src_root', None)
-config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
+config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
# Tweak the PATH to include the tools dir and the scripts dir.
-if lldb_obj_root is not None:
- lldb_tools_dir = getattr(config, 'lldb_tools_dir', None)
- if not lldb_tools_dir:
- lit_config.fatal('No LLDB tools dir set!')
- llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
- if not llvm_tools_dir:
- lit_config.fatal('No LLVM tools dir set!')
- path = os.path.pathsep.join((lldb_tools_dir, llvm_tools_dir, config.environment['PATH']))
- path = os.path.pathsep.join((os.path.join(getattr(config, 'llvm_src_root', None),'test','Scripts'),path))
-
- config.environment['PATH'] = path
-
- lldb_libs_dir = getattr(config, 'lldb_libs_dir', None)
- if not lldb_libs_dir:
- lit_config.fatal('No LLDB libs dir set!')
- llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
- if not llvm_libs_dir:
- lit_config.fatal('No LLVM libs dir set!')
- path = os.path.pathsep.join((lldb_libs_dir, llvm_libs_dir,
- config.environment.get('LD_LIBRARY_PATH','')))
- config.environment['LD_LIBRARY_PATH'] = path
-
- # Propagate LLVM_SRC_ROOT into the environment.
- config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
-
- # Propagate PYTHON_EXECUTABLE into the environment
- config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',
- '')
-###
-
-# Check that the object root is known.
-if config.test_exec_root is None:
- # Otherwise, we haven't loaded the site specific configuration (the user is
- # probably trying to run on a test file directly, and either the site
- # configuration hasn't been created by the build system, or we are in an
- # out-of-tree build situation).
-
- # Check for 'lldb_site_config' user parameter, and use that if available.
- site_cfg = lit_config.params.get('lldb_site_config', None)
- if site_cfg and os.path.exists(site_cfg):
- lit_config.load_config(config, site_cfg)
- raise SystemExit
-
- # Try to detect the situation where we are using an out-of-tree build by
- # looking for 'llvm-config'.
- #
- # FIXME: I debated (i.e., wrote and threw away) adding logic to
- # automagically generate the lit.site.cfg if we are in some kind of fresh
- # build situation. This means knowing how to invoke the build system though,
- # and I decided it was too much magic. We should solve this by just having
- # the .cfg files generated during the configuration step.
-
- llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
- if not llvm_config:
- lit_config.fatal('No site specific configuration available!')
-
- # Get the source and object roots.
- llvm_src_root = subprocess.check_output(['llvm-config', '--src-root']).strip()
- llvm_obj_root = subprocess.check_output(['llvm-config', '--obj-root']).strip()
- lldb_src_root = os.path.join(llvm_src_root, "tools", "lldb")
- lldb_obj_root = os.path.join(llvm_obj_root, "tools", "lldb")
-
- # Validate that we got a tree which points to here, using the standard
- # tools/lldb layout.
- this_src_root = os.path.dirname(config.test_source_root)
- if os.path.realpath(lldb_src_root) != os.path.realpath(this_src_root):
- lit_config.fatal('No site specific configuration available!')
-
- # Check that the site specific configuration exists.
- site_cfg = os.path.join(lldb_obj_root, 'test', 'lit.site.cfg')
- if not os.path.exists(site_cfg):
- lit_config.fatal(
- 'No site specific configuration available! You may need to '
- 'run "make test" in your lldb build directory.')
-
- # Okay, that worked. Notify the user of the automagic, and reconfigure.
- lit_config.note('using out-of-tree build at %r' % lldb_obj_root)
- lit_config.load_config(config, site_cfg)
- raise SystemExit
+lldb_tools_dir = config.lldb_tools_dir
+llvm_tools_dir = config.llvm_tools_dir
+path = os.path.pathsep.join((config.lldb_tools_dir, config.llvm_tools_dir, config.environment['PATH']))
+
+config.environment['PATH'] = path
+
+path = os.path.pathsep.join((config.lldb_libs_dir, config.llvm_libs_dir,
+ config.environment.get('LD_LIBRARY_PATH','')))
+config.environment['LD_LIBRARY_PATH'] = path
+
+# Propagate LLVM_SRC_ROOT into the environment.
+config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
+
+# Propagate PYTHON_EXECUTABLE into the environment
+config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '')
# Register substitutions
config.substitutions.append(('%python', config.python_executable))
@@ -151,6 +84,8 @@ if debugserver is not None:
config.substitutions.append(('%debugserver', debugserver))
for pattern in [r"\bFileCheck\b",
+ r"\blldb-test\b",
+ r"\byaml2obj\b",
r"\| \bnot\b"]:
tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
pattern)
@@ -195,6 +130,8 @@ elif re.match(r'gcc', config.cc):
elif re.match(r'cl', config.cc):
config.available_features.add("compiler-msvc")
+config.available_features.add(binary_feature(config.have_zlib, "zlib", "no"))
+
# llvm-config knows whether it is compiled with asserts (and)
# whether we are operating in release/debug mode.
import subprocess
diff --git a/lit/lit.site.cfg.in b/lit/lit.site.cfg.in
index 03aa3df9ac55..2cfa677651a1 100644
--- a/lit/lit.site.cfg.in
+++ b/lit/lit.site.cfg.in
@@ -10,22 +10,9 @@ config.lldb_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
config.lldb_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
config.target_triple = "@TARGET_TRIPLE@"
config.python_executable = "@PYTHON_EXECUTABLE@"
-config.cc = "@CMAKE_C_COMPILER@"
-config.cxx = "@CMAKE_CXX_COMPILER@"
-
-test_c_compiler = "@LLDB_TEST_C_COMPILER@"
-test_cxx_compiler = "@LLDB_TEST_CXX_COMPILER@"
-test_clang = "@LLDB_TEST_CLANG@".lower()
-test_clang = test_clang == "on" or test_clang == "true" or test_clang == "1"
-
-if len(test_c_compiler) > 0:
- config.cc = test_c_compiler
-if len(test_c_compiler) > 0:
- config.cxx = test_cxx_compiler
-
-if test_clang:
- config.cc = 'clang'
- config.cxx = 'clang++'
+config.cc = "@LLDB_TEST_C_COMPILER@"
+config.cxx = "@LLDB_TEST_CXX_COMPILER@"
+config.have_zlib = @HAVE_LIBZ@
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
diff --git a/lldb.xcodeproj/project.pbxproj b/lldb.xcodeproj/project.pbxproj
index 8353da30bd8e..d69ef3280129 100644
--- a/lldb.xcodeproj/project.pbxproj
+++ b/lldb.xcodeproj/project.pbxproj
@@ -393,7 +393,6 @@
2689002C13353E0400698AC0 /* AddressResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034011752C6B0086C050 /* AddressResolver.cpp */; };
2689002D13353E0400698AC0 /* AddressResolverFileLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034211752C720086C050 /* AddressResolverFileLine.cpp */; };
2689002E13353E0400698AC0 /* AddressResolverName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034411752C790086C050 /* AddressResolverName.cpp */; };
- 2689002F13353E0400698AC0 /* ArchSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */; };
2689003113353E0400698AC0 /* Broadcaster.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */; };
2689003213353E0400698AC0 /* Communication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6E10F1B85900F91463 /* Communication.cpp */; };
2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; };
@@ -690,12 +689,12 @@
3FDFED2D19C257A0009756A7 /* HostProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FDFED2C19C257A0009756A7 /* HostProcess.cpp */; };
490A36C0180F0E6F00BA31F8 /* PlatformWindows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490A36BD180F0E6F00BA31F8 /* PlatformWindows.cpp */; };
490A966B1628C3BF00F0002E /* SBDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9452573816262CEF00325455 /* SBDeclaration.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 492DB7E71EC662B100B9E9AF /* Status.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 492DB7E61EC662B100B9E9AF /* Status.h */; };
492DB7EB1EC662E200B9E9AF /* Status.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 492DB7E81EC662D100B9E9AF /* Status.cpp */; };
4939EA8D1BD56B6D00084382 /* REPL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4939EA8C1BD56B6D00084382 /* REPL.cpp */; };
494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494260D914579144003C1C78 /* VerifyDecl.cpp */; };
4959511F1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4959511E1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp */; };
4966DCC4148978A10028481B /* ClangExternalASTSourceCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4966DCC3148978A10028481B /* ClangExternalASTSourceCommon.cpp */; };
+ 4971D4B51F30ECFB00823171 /* SBProcessInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4987FB1E1F30EC7E00E5C17D /* SBProcessInfo.cpp */; };
4984BA131B978C55008658D4 /* ClangExpressionVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4984BA0E1B978C3E008658D4 /* ClangExpressionVariable.cpp */; };
4984BA161B979973008658D4 /* ExpressionVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4984BA151B979973008658D4 /* ExpressionVariable.cpp */; };
4984BA181B979C08008658D4 /* ExpressionVariable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4984BA171B979C08008658D4 /* ExpressionVariable.h */; };
@@ -714,15 +713,23 @@
49E4F66B1C9CAD16008487EA /* DiagnosticManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E4F6681C9CAD12008487EA /* DiagnosticManager.cpp */; };
49F811F31E931B2100F4E163 /* CPlusPlusNameParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49F811EF1E931B1500F4E163 /* CPlusPlusNameParser.cpp */; };
4C0083401B9F9BA900D5CF24 /* UtilityFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C00833F1B9F9BA900D5CF24 /* UtilityFunction.cpp */; };
+ 4C05332B1F62121E00DED368 /* SBBreakpointOptionCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0533291F6211FB00DED368 /* SBBreakpointOptionCommon.cpp */; };
4C2479BD1BA39295009C9A7B /* FunctionCaller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0083321B9A5DE200D5CF24 /* FunctionCaller.cpp */; };
4C3ADCD61810D88B00357218 /* BreakpointResolverFileRegex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CAA56141422D986001FFA01 /* BreakpointResolverFileRegex.cpp */; };
4C4EB7811E6A4DCC002035C0 /* DumpDataExtractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C4EB77F1E6A4DB8002035C0 /* DumpDataExtractor.cpp */; };
+ 4C54B27B1F61CE2800D469CA /* SBBreakpointName.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C54B2781F61CE1200D469CA /* SBBreakpointName.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4C54B27E1F61CE6300D469CA /* SBBreakpointName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C54B27C1F61CE5300D469CA /* SBBreakpointName.cpp */; };
4C562CC71CC07DF700C52EAC /* PDBASTParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */; };
4C56543119D1EFAA002E9C44 /* ThreadPlanPython.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C56543019D1EFAA002E9C44 /* ThreadPlanPython.cpp */; };
4C56543519D2297A002E9C44 /* SBThreadPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C56543419D2297A002E9C44 /* SBThreadPlan.h */; settings = {ATTRIBUTES = (Public, ); }; };
4C56543719D22B32002E9C44 /* SBThreadPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C56543619D22B32002E9C44 /* SBThreadPlan.cpp */; };
+ 4C7D48241F5099A1005314B4 /* SymbolFileDWARFDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */; };
+ 4C7D48251F5099B2005314B4 /* SymbolFileDWARFDwoDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481F1F509964005314B4 /* SymbolFileDWARFDwoDwp.cpp */; };
+ 4C877B391F30EF990068FCFB /* SBProcessInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FB201F30EC9900E5C17D /* SBProcessInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
4C88BC2A1BA3722B00AA0964 /* Expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C88BC291BA3722B00AA0964 /* Expression.cpp */; };
4C88BC2D1BA391B000AA0964 /* UserExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0083331B9A5DE200D5CF24 /* UserExpression.cpp */; };
+ 4CA9D1401FCE07CD00300E18 /* RegisterUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9D13C1FCE07AF00300E18 /* RegisterUtilities.cpp */; };
+ 4CAA19E61F5A40040099E692 /* BreakpointName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D48281F509CCD005314B4 /* BreakpointName.cpp */; };
4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; };
4CC7C6501D5298F30076FF94 /* OCamlLanguage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7C64D1D5298E20076FF94 /* OCamlLanguage.cpp */; };
4CC7C6571D52997A0076FF94 /* OCamlASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7C6551D52996C0076FF94 /* OCamlASTContext.cpp */; };
@@ -768,6 +775,7 @@
8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; };
8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; };
8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */; };
+ 8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */; };
8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; };
8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
8CCB018319BA51BF0009FD44 /* SBThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */; };
@@ -868,12 +876,27 @@
966C6B7C18E6A56A0093F5EC /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 966C6B7818E6A56A0093F5EC /* libz.dylib */; };
9694FA711B32AA64005EBB16 /* ABISysV_mips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9694FA6F1B32AA64005EBB16 /* ABISysV_mips.cpp */; };
9A0FDEA71E8EF5110086B2F5 /* RegisterContextLinux_mips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0FDE971E8EF5010086B2F5 /* RegisterContextLinux_mips.cpp */; };
- 9A1542F91F0EE48600DEA1D8 /* MockTildeExpressionResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1542F51F0EE44000DEA1D8 /* MockTildeExpressionResolver.cpp */; };
- 9A1542FA1F0EE48600DEA1D8 /* TestUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1542F71F0EE44000DEA1D8 /* TestUtilities.cpp */; };
+ 9A18903B1F47D5E600394BCA /* MockTildeExpressionResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1890321F47D5D400394BCA /* MockTildeExpressionResolver.cpp */; };
+ 9A18903C1F47D5E600394BCA /* TestUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1890341F47D5D400394BCA /* TestUtilities.cpp */; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp */; };
+ 9A2057031F3A605200F6C293 /* VASprintfTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp */; };
+ 9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057061F3B818600F6C293 /* MemoryRegionInfoTest.cpp */; };
+ 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */; };
+ 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A20570E1F3B821A00F6C293 /* test-dwarf.exe */; };
+ 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */; };
+ 9A2057171F3B861400F6C293 /* TestDWARFCallFrameInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057131F3B860D00F6C293 /* TestDWARFCallFrameInfo.cpp */; };
+ 9A2057181F3B861400F6C293 /* TestType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057141F3B860D00F6C293 /* TestType.cpp */; };
+ 9A20571C1F3B867400F6C293 /* PlatformDarwinTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20571A1F3B866F00F6C293 /* PlatformDarwinTest.cpp */; };
+ 9A2057201F3B8D2500F6C293 /* UnixSignalsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20571E1F3B8D2100F6C293 /* UnixSignalsTest.cpp */; };
+ 9A2057281F3B8DDB00F6C293 /* TestELFHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057241F3B8DD200F6C293 /* TestELFHeader.cpp */; };
+ 9A2057291F3B8DDB00F6C293 /* TestObjectFileELF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057251F3B8DD200F6C293 /* TestObjectFileELF.cpp */; };
+ 9A20572D1F3B8E6600F6C293 /* TestCompletion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20572B1F3B8E6200F6C293 /* TestCompletion.cpp */; };
+ 9A2057381F3B8E7E00F6C293 /* FileSystemTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20572E1F3B8E7600F6C293 /* FileSystemTest.cpp */; };
+ 9A2057391F3B8E7E00F6C293 /* HostTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20572F1F3B8E7600F6C293 /* HostTest.cpp */; };
+ 9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057301F3B8E7600F6C293 /* MainLoopTest.cpp */; };
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* EmulateInstructionARM.cpp */; };
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* EmulationStateARM.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -884,6 +907,17 @@
9A3576AA116E9AC700E8ED2F /* SBHostOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */; };
9A36D24D1EB3BE7F00AAD9EA /* SBTrace.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A1E59581EB2B10D002206A5 /* SBTrace.h */; settings = {ATTRIBUTES = (Public, ); }; };
9A36D24E1EB3BE7F00AAD9EA /* SBTraceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 9A3D43D61F3151C400EB767C /* ConstStringTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C81F3150D200EB767C /* ConstStringTest.cpp */; };
+ 9A3D43D71F3151C400EB767C /* LogTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C71F3150D200EB767C /* LogTest.cpp */; };
+ 9A3D43D81F3151C400EB767C /* NameMatchesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43CB1F3150D200EB767C /* NameMatchesTest.cpp */; };
+ 9A3D43D91F3151C400EB767C /* StatusTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C61F3150D200EB767C /* StatusTest.cpp */; };
+ 9A3D43DA1F3151C400EB767C /* StructuredDataTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43CA1F3150D200EB767C /* StructuredDataTest.cpp */; };
+ 9A3D43DB1F3151C400EB767C /* TildeExpressionResolverTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C91F3150D200EB767C /* TildeExpressionResolverTest.cpp */; };
+ 9A3D43DC1F3151C400EB767C /* TimeoutTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43CC1F3150D200EB767C /* TimeoutTest.cpp */; };
+ 9A3D43DD1F3151C400EB767C /* TimerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C51F3150D200EB767C /* TimerTest.cpp */; };
+ 9A3D43EC1F3237F900EB767C /* ListenerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43E31F3237D500EB767C /* ListenerTest.cpp */; };
+ 9A3D43ED1F3237F900EB767C /* StateTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43E21F3237D500EB767C /* StateTest.cpp */; };
+ 9A3D43EE1F3237F900EB767C /* StreamCallbackTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43E11F3237D500EB767C /* StreamCallbackTest.cpp */; };
9A4F35101368A51A00823F52 /* StreamAsynchronousIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4F350F1368A51A00823F52 /* StreamAsynchronousIO.cpp */; };
9A77AD541E64E2760025CE04 /* RegisterInfoPOSIX_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A77AD501E64E24E0025CE04 /* RegisterInfoPOSIX_arm.cpp */; };
9AC7038E117674FB0086C050 /* SBInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC7038D117674EB0086C050 /* SBInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -917,6 +951,10 @@
AF1F7B07189C904B0087DB9C /* AppleGetPendingItemsHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF1F7B05189C904B0087DB9C /* AppleGetPendingItemsHandler.cpp */; };
AF20F7661AF18F8500751A6E /* ABISysV_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF20F7641AF18F8500751A6E /* ABISysV_arm.cpp */; };
AF20F76A1AF18F9000751A6E /* ABISysV_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF20F7681AF18F9000751A6E /* ABISysV_arm64.cpp */; };
+ AF235EB01FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF235EAE1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp */; };
+ AF235EB11FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF235EAF1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h */; };
+ AF235EB41FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF235EB21FBE7857009C5541 /* RegisterInfoPOSIX_ppc64le.h */; };
+ AF235EB51FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF235EB31FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp */; };
AF23B4DB19009C66003E2A58 /* FreeBSDSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF23B4D919009C66003E2A58 /* FreeBSDSignals.cpp */; };
AF248A4D1DA71C77000B814D /* TestArm64InstEmulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF248A4C1DA71C77000B814D /* TestArm64InstEmulation.cpp */; };
AF254E31170CCC33007AE5C9 /* PlatformDarwinKernel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF254E2F170CCC33007AE5C9 /* PlatformDarwinKernel.cpp */; };
@@ -928,6 +966,8 @@
AF2907BF1D3F082400E10654 /* DynamicLoaderMacOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF2907BD1D3F082400E10654 /* DynamicLoaderMacOS.cpp */; };
AF2BA6EC1A707E3400C5248A /* UriParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33064C991A5C7A330033D415 /* UriParser.cpp */; };
AF2BCA6C18C7EFDE005B4526 /* JITLoaderGDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF2BCA6918C7EFDE005B4526 /* JITLoaderGDB.cpp */; };
+ AF2E02A31FA2CEAF00A86C34 /* ArchitectureArm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF2E02A11FA2CEAF00A86C34 /* ArchitectureArm.cpp */; };
+ AF2E02A41FA2CEAF00A86C34 /* ArchitectureArm.h in Headers */ = {isa = PBXBuildFile; fileRef = AF2E02A21FA2CEAF00A86C34 /* ArchitectureArm.h */; };
AF33B4BE1C1FA441001B28D9 /* NetBSDSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF33B4BC1C1FA441001B28D9 /* NetBSDSignals.cpp */; };
AF33B4BF1C1FA441001B28D9 /* NetBSDSignals.h in Headers */ = {isa = PBXBuildFile; fileRef = AF33B4BD1C1FA441001B28D9 /* NetBSDSignals.h */; };
AF37E10A17C861F20061E18E /* ProcessRunLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF37E10917C861F20061E18E /* ProcessRunLock.cpp */; };
@@ -938,6 +978,8 @@
AF45FDE518A1F3AC0007051C /* AppleGetThreadItemInfoHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF45FDE318A1F3AC0007051C /* AppleGetThreadItemInfoHandler.cpp */; };
AF6335E21C87B21E00F7D554 /* SymbolFilePDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF6335E01C87B21E00F7D554 /* SymbolFilePDB.cpp */; };
AF6335E31C87B21E00F7D554 /* SymbolFilePDB.h in Headers */ = {isa = PBXBuildFile; fileRef = AF6335E11C87B21E00F7D554 /* SymbolFilePDB.h */; };
+ AF6CA6661FBBAF28005A0DC3 /* ArchSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF6CA6651FBBAF27005A0DC3 /* ArchSpec.cpp */; };
+ AF6CA6681FBBAF37005A0DC3 /* ArchSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = AF6CA6671FBBAF37005A0DC3 /* ArchSpec.h */; };
AF77E08F1A033C700096C0EA /* ABISysV_ppc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF77E08D1A033C700096C0EA /* ABISysV_ppc.cpp */; };
AF77E0931A033C7F0096C0EA /* ABISysV_ppc64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF77E0911A033C7F0096C0EA /* ABISysV_ppc64.cpp */; };
AF77E0A11A033D360096C0EA /* RegisterContextFreeBSD_powerpc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF77E09A1A033D360096C0EA /* RegisterContextFreeBSD_powerpc.cpp */; };
@@ -955,7 +997,11 @@
AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = AF90106315AB7C5700FF120D /* lldb.1 */; };
AF9107EE168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; };
AF9107EF168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; };
+ AF9113FD1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9113FB1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp */; };
+ AF9113FE1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h in Headers */ = {isa = PBXBuildFile; fileRef = AF9113FC1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h */; };
AF9B8F33182DB52900DA866F /* SystemRuntimeMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9B8F31182DB52900DA866F /* SystemRuntimeMacOSX.cpp */; };
+ AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; };
+ AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; };
AFAFD80A1E57E1B90017A14F /* ModuleCacheTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFAFD8091E57E1B90017A14F /* ModuleCacheTest.cpp */; };
AFB3D2801AC262AB003B4B30 /* MICmdCmdGdbShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFB3D27E1AC262AB003B4B30 /* MICmdCmdGdbShow.cpp */; };
AFC234091AF85CE100CDE8B6 /* CommandObjectLanguage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFC234061AF85CE000CDE8B6 /* CommandObjectLanguage.cpp */; };
@@ -966,6 +1012,7 @@
AFC2DCF31E6E30CF00283714 /* History.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFC2DCF21E6E30CF00283714 /* History.cpp */; };
AFC2DCF61E6E316A00283714 /* StreamCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFC2DCF51E6E316A00283714 /* StreamCallback.cpp */; };
AFC2DCF91E6E318000283714 /* StreamGDBRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFC2DCF81E6E318000283714 /* StreamGDBRemote.cpp */; };
+ AFC67B151FBBB03600860ECB /* LibCxxBitset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFC67B141FBBB03500860ECB /* LibCxxBitset.cpp */; };
AFCB2BBD1BF577F40018B553 /* PythonExceptionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFCB2BBB1BF577F40018B553 /* PythonExceptionState.cpp */; };
AFCB2BBE1BF577F40018B553 /* PythonExceptionState.h in Headers */ = {isa = PBXBuildFile; fileRef = AFCB2BBC1BF577F40018B553 /* PythonExceptionState.h */; };
AFD65C811D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFD65C7F1D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp */; };
@@ -1198,7 +1245,8 @@
dstPath = "$(DEVELOPER_INSTALL_DIR)/usr/share/man/man1";
dstSubfolderSpec = 0;
files = (
- 492DB7E71EC662B100B9E9AF /* Status.h in CopyFiles */,
+ 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */,
+ 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */,
AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
@@ -1288,7 +1336,6 @@
238F2BA71D2C85FA001FF92A /* StructuredDataDarwinLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructuredDataDarwinLog.h; sourceTree = "<group>"; };
239481851C59EBDD00DF7168 /* libncurses.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libncurses.dylib; path = ../../../../../usr/lib/libncurses.dylib; sourceTree = "<group>"; };
239504C21BDD3FD600963CEA /* gtest_common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gtest_common.h; sourceTree = "<group>"; };
- 239504C61BDD3FF300963CEA /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
239504D41BDD451400963CEA /* lldb-gtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "lldb-gtest"; sourceTree = BUILT_PRODUCTS_DIR; };
23AB052D199FF639003B8084 /* FreeBSDThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FreeBSDThread.cpp; sourceTree = "<group>"; };
23AB052E199FF639003B8084 /* FreeBSDThread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FreeBSDThread.h; sourceTree = "<group>"; };
@@ -1314,8 +1361,6 @@
23CB15101D66CF6900EDDDE1 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
23CB15131D66CF8700EDDDE1 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
23CB15141D66CF8700EDDDE1 /* SymbolFilePDBTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFilePDBTests.cpp; sourceTree = "<group>"; };
- 23CB15191D66CFAC00EDDDE1 /* test-dwarf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "test-dwarf.cpp"; sourceTree = "<group>"; };
- 23CB151A1D66CFAC00EDDDE1 /* test-dwarf.exe */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test-dwarf.exe"; sourceTree = "<group>"; };
23CB151B1D66CFAC00EDDDE1 /* test-pdb-alt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "test-pdb-alt.cpp"; sourceTree = "<group>"; };
23CB151C1D66CFAC00EDDDE1 /* test-pdb-nested.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "test-pdb-nested.h"; sourceTree = "<group>"; };
23CB151D1D66CFAC00EDDDE1 /* test-pdb-types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "test-pdb-types.cpp"; sourceTree = "<group>"; };
@@ -1349,7 +1394,6 @@
23E2E51F1D903726006F38BB /* linux-x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "linux-x86_64.cpp"; sourceTree = "<group>"; };
23E2E5201D903726006F38BB /* linux-x86_64.dmp */ = {isa = PBXFileReference; lastKnownFileType = file; path = "linux-x86_64.dmp"; sourceTree = "<group>"; };
23E2E52D1D90382B006F38BB /* BreakpointIDTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BreakpointIDTest.cpp; sourceTree = "<group>"; };
- 23E2E52E1D90382B006F38BB /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
23E2E5361D9048FB006F38BB /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
23E2E5371D9048FB006F38BB /* MinidumpParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MinidumpParser.cpp; sourceTree = "<group>"; };
23E2E5381D9048FB006F38BB /* MinidumpParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MinidumpParser.h; sourceTree = "<group>"; };
@@ -2045,7 +2089,6 @@
26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree = "<group>"; };
26BC7D5010F1B77400F91463 /* Address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Address.h; path = include/lldb/Core/Address.h; sourceTree = "<group>"; };
26BC7D5110F1B77400F91463 /* AddressRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressRange.h; path = include/lldb/Core/AddressRange.h; sourceTree = "<group>"; };
- 26BC7D5210F1B77400F91463 /* ArchSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArchSpec.h; path = include/lldb/Core/ArchSpec.h; sourceTree = "<group>"; };
26BC7D5310F1B77400F91463 /* Args.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Args.h; path = include/lldb/Interpreter/Args.h; sourceTree = "<group>"; };
26BC7D5410F1B77400F91463 /* Broadcaster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Broadcaster.h; path = include/lldb/Core/Broadcaster.h; sourceTree = "<group>"; };
26BC7D5510F1B77400F91463 /* ClangForward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangForward.h; path = include/lldb/Core/ClangForward.h; sourceTree = "<group>"; };
@@ -2129,7 +2172,6 @@
26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectThread.cpp; path = source/Commands/CommandObjectThread.cpp; sourceTree = "<group>"; };
26BC7E6910F1B85900F91463 /* Address.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Address.cpp; path = source/Core/Address.cpp; sourceTree = "<group>"; };
26BC7E6A10F1B85900F91463 /* AddressRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressRange.cpp; path = source/Core/AddressRange.cpp; sourceTree = "<group>"; };
- 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArchSpec.cpp; path = source/Core/ArchSpec.cpp; sourceTree = "<group>"; };
26BC7E6C10F1B85900F91463 /* Args.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Args.cpp; path = source/Interpreter/Args.cpp; sourceTree = "<group>"; };
26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Broadcaster.cpp; path = source/Core/Broadcaster.cpp; sourceTree = "<group>"; };
26BC7E6E10F1B85900F91463 /* Communication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Communication.cpp; path = source/Core/Communication.cpp; sourceTree = "<group>"; };
@@ -2439,6 +2481,9 @@
4984BA0F1B978C3E008658D4 /* ClangExpressionVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExpressionVariable.h; path = ExpressionParser/Clang/ClangExpressionVariable.h; sourceTree = "<group>"; };
4984BA151B979973008658D4 /* ExpressionVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExpressionVariable.cpp; path = source/Expression/ExpressionVariable.cpp; sourceTree = "<group>"; };
4984BA171B979C08008658D4 /* ExpressionVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExpressionVariable.h; path = include/lldb/Expression/ExpressionVariable.h; sourceTree = "<group>"; };
+ 4987FB1C1F30EC6000E5C17D /* SBProcessInfo.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBProcessInfo.i; sourceTree = "<group>"; };
+ 4987FB1E1F30EC7E00E5C17D /* SBProcessInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBProcessInfo.cpp; path = source/API/SBProcessInfo.cpp; sourceTree = "<group>"; };
+ 4987FB201F30EC9900E5C17D /* SBProcessInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBProcessInfo.h; path = include/lldb/API/SBProcessInfo.h; sourceTree = "<group>"; };
499F381E11A5B3F300F5CE02 /* CommandObjectArgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectArgs.h; path = source/Commands/CommandObjectArgs.h; sourceTree = "<group>"; };
499F381F11A5B3F300F5CE02 /* CommandObjectArgs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectArgs.cpp; path = source/Commands/CommandObjectArgs.cpp; sourceTree = "<group>"; };
49A1CAC11430E21D00306AC9 /* ExpressionSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExpressionSourceCode.h; path = include/lldb/Expression/ExpressionSourceCode.h; sourceTree = "<group>"; };
@@ -2493,6 +2538,8 @@
4C00833F1B9F9BA900D5CF24 /* UtilityFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UtilityFunction.cpp; path = source/Expression/UtilityFunction.cpp; sourceTree = "<group>"; };
4C00986F11500B4300F316B0 /* UnixSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnixSignals.h; path = include/lldb/Target/UnixSignals.h; sourceTree = "<group>"; };
4C00987011500B4300F316B0 /* UnixSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignals.cpp; path = source/Target/UnixSignals.cpp; sourceTree = "<group>"; };
+ 4C0533291F6211FB00DED368 /* SBBreakpointOptionCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBreakpointOptionCommon.cpp; path = source/API/SBBreakpointOptionCommon.cpp; sourceTree = "<group>"; };
+ 4C05332C1F63092A00DED368 /* SBBreakpointName.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBBreakpointName.i; sourceTree = "<group>"; };
4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadSpec.cpp; path = source/Target/ThreadSpec.cpp; sourceTree = "<group>"; };
4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = "<group>"; };
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = "<group>"; };
@@ -2509,6 +2556,9 @@
4C43DF8A11069C3200E55CBF /* ThreadPlanStepOverRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverRange.cpp; path = source/Target/ThreadPlanStepOverRange.cpp; sourceTree = "<group>"; };
4C4EB77F1E6A4DB8002035C0 /* DumpDataExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DumpDataExtractor.cpp; path = source/Core/DumpDataExtractor.cpp; sourceTree = "<group>"; };
4C4EB7821E6A4DE7002035C0 /* DumpDataExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpDataExtractor.h; path = include/lldb/Core/DumpDataExtractor.h; sourceTree = "<group>"; };
+ 4C54B2781F61CE1200D469CA /* SBBreakpointName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBBreakpointName.h; path = include/lldb/API/SBBreakpointName.h; sourceTree = "<group>"; };
+ 4C54B27C1F61CE5300D469CA /* SBBreakpointName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBreakpointName.cpp; path = source/API/SBBreakpointName.cpp; sourceTree = "<group>"; };
+ 4C54B2811F62081300D469CA /* SBBreakpointOptionCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBBreakpointOptionCommon.h; path = include/lldb/API/SBBreakpointOptionCommon.h; sourceTree = "<group>"; };
4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PDBASTParser.cpp; path = PDB/PDBASTParser.cpp; sourceTree = "<group>"; };
4C562CC31CC07DDD00C52EAC /* PDBASTParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDBASTParser.h; path = PDB/PDBASTParser.h; sourceTree = "<group>"; };
4C56543019D1EFAA002E9C44 /* ThreadPlanPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanPython.cpp; path = source/Target/ThreadPlanPython.cpp; sourceTree = "<group>"; };
@@ -2521,6 +2571,12 @@
4C73152119B7D71700F865A4 /* Iterable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Iterable.h; path = include/lldb/Utility/Iterable.h; sourceTree = "<group>"; };
4C7CF7E31295E10E00B4FBB5 /* ThreadPlanCallUserExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanCallUserExpression.h; path = include/lldb/Target/ThreadPlanCallUserExpression.h; sourceTree = "<group>"; };
4C7CF7E51295E12B00B4FBB5 /* ThreadPlanCallUserExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanCallUserExpression.cpp; path = source/Target/ThreadPlanCallUserExpression.cpp; sourceTree = "<group>"; };
+ 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFileDWARFDwp.cpp; sourceTree = "<group>"; };
+ 4C7D481D1F509964005314B4 /* SymbolFileDWARFDwoDwp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileDWARFDwoDwp.h; sourceTree = "<group>"; };
+ 4C7D481E1F509964005314B4 /* SymbolFileDWARFDwp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileDWARFDwp.h; sourceTree = "<group>"; };
+ 4C7D481F1F509964005314B4 /* SymbolFileDWARFDwoDwp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFileDWARFDwoDwp.cpp; sourceTree = "<group>"; };
+ 4C7D48281F509CCD005314B4 /* BreakpointName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointName.cpp; path = source/Breakpoint/BreakpointName.cpp; sourceTree = "<group>"; };
+ 4C7D482B1F509CF5005314B4 /* BreakpointName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointName.h; path = include/lldb/Breakpoint/BreakpointName.h; sourceTree = "<group>"; };
4C88BC291BA3722B00AA0964 /* Expression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Expression.cpp; path = source/Expression/Expression.cpp; sourceTree = "<group>"; };
4C98D3DA118FB96F00E575D0 /* ClangFunctionCaller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangFunctionCaller.cpp; path = ExpressionParser/Clang/ClangFunctionCaller.cpp; sourceTree = "<group>"; };
4C98D3DB118FB96F00E575D0 /* IRExecutionUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IRExecutionUnit.cpp; path = source/Expression/IRExecutionUnit.cpp; sourceTree = "<group>"; };
@@ -2528,6 +2584,8 @@
4C98D3E1118FB98F00E575D0 /* IRExecutionUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRExecutionUnit.h; path = include/lldb/Expression/IRExecutionUnit.h; sourceTree = "<group>"; };
4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectApropos.cpp; path = source/Commands/CommandObjectApropos.cpp; sourceTree = "<group>"; };
4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectApropos.h; path = source/Commands/CommandObjectApropos.h; sourceTree = "<group>"; };
+ 4CA9D13C1FCE07AF00300E18 /* RegisterUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterUtilities.cpp; sourceTree = "<group>"; };
+ 4CA9D13D1FCE07AF00300E18 /* RegisterUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterUtilities.h; sourceTree = "<group>"; };
4CAA56121422D96A001FFA01 /* BreakpointResolverFileRegex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverFileRegex.h; path = include/lldb/Breakpoint/BreakpointResolverFileRegex.h; sourceTree = "<group>"; };
4CAA56141422D986001FFA01 /* BreakpointResolverFileRegex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverFileRegex.cpp; path = source/Breakpoint/BreakpointResolverFileRegex.cpp; sourceTree = "<group>"; };
4CAB257C18EC9DB800BAD33E /* SafeMachO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SafeMachO.h; path = include/lldb/Utility/SafeMachO.h; sourceTree = "<group>"; };
@@ -2541,6 +2599,7 @@
4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CPPLanguageRuntime.cpp; path = source/Target/CPPLanguageRuntime.cpp; sourceTree = "<group>"; };
4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjCLanguageRuntime.cpp; path = source/Target/ObjCLanguageRuntime.cpp; sourceTree = "<group>"; };
4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjCLanguageRuntime.h; path = include/lldb/Target/ObjCLanguageRuntime.h; sourceTree = "<group>"; };
+ 4CBFF0471F579A36004AFA92 /* Flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Flags.h; path = include/lldb/Utility/Flags.h; sourceTree = "<group>"; };
4CC2A148128C73ED001531C4 /* ThreadPlanTracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTracer.cpp; path = source/Target/ThreadPlanTracer.cpp; sourceTree = "<group>"; };
4CC2A14C128C7409001531C4 /* ThreadPlanTracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTracer.h; path = include/lldb/Target/ThreadPlanTracer.h; sourceTree = "<group>"; };
4CC7C64C1D5298E20076FF94 /* OCamlLanguage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OCamlLanguage.h; path = Language/OCaml/OCamlLanguage.h; sourceTree = "<group>"; };
@@ -2618,8 +2677,8 @@
6D99A3621BBC2F3200979793 /* ArmUnwindInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArmUnwindInfo.cpp; path = source/Symbol/ArmUnwindInfo.cpp; sourceTree = "<group>"; };
6D9AB3DC1BB2B74E003F2289 /* TypeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeMap.cpp; path = source/Symbol/TypeMap.cpp; sourceTree = "<group>"; };
6D9AB3DE1BB2B76B003F2289 /* TypeMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeMap.h; path = include/lldb/Symbol/TypeMap.h; sourceTree = "<group>"; };
- 6DEC6F381BD66D750091ABA6 /* TaskPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TaskPool.cpp; path = source/Utility/TaskPool.cpp; sourceTree = "<group>"; };
- 6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TaskPool.h; path = include/lldb/Utility/TaskPool.h; sourceTree = "<group>"; };
+ 6DEC6F381BD66D750091ABA6 /* TaskPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TaskPool.cpp; path = source/Host/common/TaskPool.cpp; sourceTree = "<group>"; };
+ 6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TaskPool.h; path = include/lldb/Host/TaskPool.h; sourceTree = "<group>"; };
8C26C4241C3EA4340031DF7C /* TSanRuntime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TSanRuntime.cpp; path = TSan/TSanRuntime.cpp; sourceTree = "<group>"; };
8C26C4251C3EA4340031DF7C /* TSanRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TSanRuntime.h; path = TSan/TSanRuntime.h; sourceTree = "<group>"; };
8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryHistory.cpp; path = source/Target/MemoryHistory.cpp; sourceTree = "<group>"; };
@@ -2628,6 +2687,7 @@
8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryHistoryASan.h; sourceTree = "<group>"; };
8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainThreadCheckerRuntime.h; sourceTree = "<group>"; };
8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadCheckerRuntime.cpp; sourceTree = "<group>"; };
+ 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSONTest.cpp; sourceTree = "<group>"; };
8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; sourceTree = "<group>"; };
8CCB017C19BA289B0009FD44 /* ThreadCollection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ThreadCollection.h; path = include/lldb/Target/ThreadCollection.h; sourceTree = "<group>"; };
8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SBThreadCollection.cpp; path = source/API/SBThreadCollection.cpp; sourceTree = "<group>"; };
@@ -2817,17 +2877,35 @@
9A0FDE991E8EF5010086B2F5 /* RegisterInfos_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterInfos_arm.h; path = Utility/RegisterInfos_arm.h; sourceTree = "<group>"; };
9A0FDE9A1E8EF5010086B2F5 /* RegisterInfos_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterInfos_arm64.h; path = Utility/RegisterInfos_arm64.h; sourceTree = "<group>"; };
9A0FDE9B1E8EF5010086B2F5 /* RegisterInfos_mips.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterInfos_mips.h; path = Utility/RegisterInfos_mips.h; sourceTree = "<group>"; };
- 9A1542F41F0EE44000DEA1D8 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
- 9A1542F51F0EE44000DEA1D8 /* MockTildeExpressionResolver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockTildeExpressionResolver.cpp; sourceTree = "<group>"; };
- 9A1542F61F0EE44000DEA1D8 /* MockTildeExpressionResolver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockTildeExpressionResolver.h; sourceTree = "<group>"; };
- 9A1542F71F0EE44000DEA1D8 /* TestUtilities.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TestUtilities.cpp; sourceTree = "<group>"; };
- 9A1542F81F0EE44000DEA1D8 /* TestUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestUtilities.h; sourceTree = "<group>"; };
+ 9A1890311F47D5D400394BCA /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CMakeLists.txt; path = TestingSupport/CMakeLists.txt; sourceTree = "<group>"; };
+ 9A1890321F47D5D400394BCA /* MockTildeExpressionResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MockTildeExpressionResolver.cpp; path = TestingSupport/MockTildeExpressionResolver.cpp; sourceTree = "<group>"; };
+ 9A1890331F47D5D400394BCA /* MockTildeExpressionResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockTildeExpressionResolver.h; path = TestingSupport/MockTildeExpressionResolver.h; sourceTree = "<group>"; };
+ 9A1890341F47D5D400394BCA /* TestUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestUtilities.cpp; path = TestingSupport/TestUtilities.cpp; sourceTree = "<group>"; };
+ 9A1890351F47D5D400394BCA /* TestUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestUtilities.h; path = TestingSupport/TestUtilities.h; sourceTree = "<group>"; };
9A19A6A51163BB7E00E0D453 /* SBValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBValue.h; path = include/lldb/API/SBValue.h; sourceTree = "<group>"; };
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBValue.cpp; path = source/API/SBValue.cpp; sourceTree = "<group>"; };
9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTrace.cpp; path = source/API/SBTrace.cpp; sourceTree = "<group>"; };
9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTraceOptions.cpp; path = source/API/SBTraceOptions.cpp; sourceTree = "<group>"; };
9A1E59581EB2B10D002206A5 /* SBTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTrace.h; path = include/lldb/API/SBTrace.h; sourceTree = "<group>"; };
9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTraceOptions.h; path = include/lldb/API/SBTraceOptions.h; sourceTree = "<group>"; };
+ 9A2057061F3B818600F6C293 /* MemoryRegionInfoTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryRegionInfoTest.cpp; path = Target/MemoryRegionInfoTest.cpp; sourceTree = "<group>"; };
+ 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolFileDWARFTests.cpp; path = DWARF/SymbolFileDWARFTests.cpp; sourceTree = "<group>"; };
+ 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "test-dwarf.cpp"; path = "DWARF/Inputs/test-dwarf.cpp"; sourceTree = "<group>"; };
+ 9A20570E1F3B821A00F6C293 /* test-dwarf.exe */ = {isa = PBXFileReference; lastKnownFileType = file; name = "test-dwarf.exe"; path = "DWARF/Inputs/test-dwarf.exe"; sourceTree = "<group>"; };
+ 9A2057131F3B860D00F6C293 /* TestDWARFCallFrameInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDWARFCallFrameInfo.cpp; sourceTree = "<group>"; };
+ 9A2057141F3B860D00F6C293 /* TestType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestType.cpp; sourceTree = "<group>"; };
+ 9A20571A1F3B866F00F6C293 /* PlatformDarwinTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformDarwinTest.cpp; path = Platform/PlatformDarwinTest.cpp; sourceTree = "<group>"; };
+ 9A20571E1F3B8D2100F6C293 /* UnixSignalsTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignalsTest.cpp; path = Signals/UnixSignalsTest.cpp; sourceTree = "<group>"; };
+ 9A2057241F3B8DD200F6C293 /* TestELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestELFHeader.cpp; path = ObjectFile/ELF/TestELFHeader.cpp; sourceTree = "<group>"; };
+ 9A2057251F3B8DD200F6C293 /* TestObjectFileELF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestObjectFileELF.cpp; path = ObjectFile/ELF/TestObjectFileELF.cpp; sourceTree = "<group>"; };
+ 9A20572B1F3B8E6200F6C293 /* TestCompletion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCompletion.cpp; sourceTree = "<group>"; };
+ 9A20572E1F3B8E7600F6C293 /* FileSystemTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemTest.cpp; sourceTree = "<group>"; };
+ 9A20572F1F3B8E7600F6C293 /* HostTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HostTest.cpp; sourceTree = "<group>"; };
+ 9A2057301F3B8E7600F6C293 /* MainLoopTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainLoopTest.cpp; sourceTree = "<group>"; };
+ 9A20573C1F3B8EA200F6C293 /* HostTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HostTest.cpp; path = linux/HostTest.cpp; sourceTree = "<group>"; };
+ 9A20573D1F3B8EA200F6C293 /* SupportTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SupportTest.cpp; path = linux/SupportTest.cpp; sourceTree = "<group>"; };
+ 9A2057441F3B905C00F6C293 /* debugserver_LogCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = debugserver_LogCallback.cpp; path = debugserver/debugserver_LogCallback.cpp; sourceTree = "<group>"; };
+ 9A2057451F3B905C00F6C293 /* RNBSocketTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RNBSocketTest.cpp; path = debugserver/RNBSocketTest.cpp; sourceTree = "<group>"; };
9A22A15D135E30370024DDC3 /* EmulateInstructionARM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmulateInstructionARM.cpp; sourceTree = "<group>"; };
9A22A15E135E30370024DDC3 /* EmulateInstructionARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmulateInstructionARM.h; sourceTree = "<group>"; };
9A22A15F135E30370024DDC3 /* EmulationStateARM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmulationStateARM.cpp; sourceTree = "<group>"; };
@@ -2840,6 +2918,19 @@
9A357672116E7B6400E8ED2F /* SBStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBStringList.cpp; path = source/API/SBStringList.cpp; sourceTree = "<group>"; };
9A3576A7116E9AB700E8ED2F /* SBHostOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBHostOS.h; path = include/lldb/API/SBHostOS.h; sourceTree = "<group>"; };
9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBHostOS.cpp; path = source/API/SBHostOS.cpp; sourceTree = "<group>"; };
+ 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VASprintfTest.cpp; sourceTree = "<group>"; };
+ 9A3D43C51F3150D200EB767C /* TimerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimerTest.cpp; sourceTree = "<group>"; };
+ 9A3D43C61F3150D200EB767C /* StatusTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatusTest.cpp; sourceTree = "<group>"; };
+ 9A3D43C71F3150D200EB767C /* LogTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LogTest.cpp; sourceTree = "<group>"; };
+ 9A3D43C81F3150D200EB767C /* ConstStringTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstStringTest.cpp; sourceTree = "<group>"; };
+ 9A3D43C91F3150D200EB767C /* TildeExpressionResolverTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TildeExpressionResolverTest.cpp; sourceTree = "<group>"; };
+ 9A3D43CA1F3150D200EB767C /* StructuredDataTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructuredDataTest.cpp; sourceTree = "<group>"; };
+ 9A3D43CB1F3150D200EB767C /* NameMatchesTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameMatchesTest.cpp; sourceTree = "<group>"; };
+ 9A3D43CC1F3150D200EB767C /* TimeoutTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeoutTest.cpp; sourceTree = "<group>"; };
+ 9A3D43DF1F31521200EB767C /* StructuredData-basic.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "StructuredData-basic.json"; sourceTree = "<group>"; };
+ 9A3D43E11F3237D500EB767C /* StreamCallbackTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamCallbackTest.cpp; sourceTree = "<group>"; };
+ 9A3D43E21F3237D500EB767C /* StateTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StateTest.cpp; sourceTree = "<group>"; };
+ 9A3D43E31F3237D500EB767C /* ListenerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListenerTest.cpp; sourceTree = "<group>"; };
9A42976111861A9F00FE05CD /* CommandObjectBreakpointCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectBreakpointCommand.h; path = source/Commands/CommandObjectBreakpointCommand.h; sourceTree = "<group>"; };
9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpointCommand.cpp; path = source/Commands/CommandObjectBreakpointCommand.cpp; sourceTree = "<group>"; };
9A4633DA11F65D8600955CE1 /* UserSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserSettingsController.h; path = include/lldb/Core/UserSettingsController.h; sourceTree = "<group>"; };
@@ -2939,6 +3030,10 @@
AF20F7681AF18F9000751A6E /* ABISysV_arm64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ABISysV_arm64.cpp; path = "SysV-arm64/ABISysV_arm64.cpp"; sourceTree = "<group>"; };
AF20F7691AF18F9000751A6E /* ABISysV_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ABISysV_arm64.h; path = "SysV-arm64/ABISysV_arm64.h"; sourceTree = "<group>"; };
AF20F76C1AF18FC700751A6E /* SBLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBLanguageRuntime.cpp; path = source/API/SBLanguageRuntime.cpp; sourceTree = "<group>"; };
+ AF235EAE1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextPOSIX_ppc64le.cpp; path = Utility/RegisterContextPOSIX_ppc64le.cpp; sourceTree = "<group>"; };
+ AF235EAF1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextPOSIX_ppc64le.h; path = Utility/RegisterContextPOSIX_ppc64le.h; sourceTree = "<group>"; };
+ AF235EB21FBE7857009C5541 /* RegisterInfoPOSIX_ppc64le.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterInfoPOSIX_ppc64le.h; path = Utility/RegisterInfoPOSIX_ppc64le.h; sourceTree = "<group>"; };
+ AF235EB31FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterInfoPOSIX_ppc64le.cpp; path = Utility/RegisterInfoPOSIX_ppc64le.cpp; sourceTree = "<group>"; };
AF23B4D919009C66003E2A58 /* FreeBSDSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FreeBSDSignals.cpp; path = Utility/FreeBSDSignals.cpp; sourceTree = "<group>"; };
AF23B4DA19009C66003E2A58 /* FreeBSDSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeBSDSignals.h; path = Utility/FreeBSDSignals.h; sourceTree = "<group>"; };
AF248A4C1DA71C77000B814D /* TestArm64InstEmulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestArm64InstEmulation.cpp; path = UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp; sourceTree = "<group>"; };
@@ -2954,6 +3049,8 @@
AF2907BE1D3F082400E10654 /* DynamicLoaderMacOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderMacOS.h; sourceTree = "<group>"; };
AF2BCA6918C7EFDE005B4526 /* JITLoaderGDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITLoaderGDB.cpp; sourceTree = "<group>"; };
AF2BCA6A18C7EFDE005B4526 /* JITLoaderGDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITLoaderGDB.h; sourceTree = "<group>"; };
+ AF2E02A11FA2CEAF00A86C34 /* ArchitectureArm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArchitectureArm.cpp; sourceTree = "<group>"; };
+ AF2E02A21FA2CEAF00A86C34 /* ArchitectureArm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchitectureArm.h; sourceTree = "<group>"; };
AF33B4BC1C1FA441001B28D9 /* NetBSDSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetBSDSignals.cpp; path = Utility/NetBSDSignals.cpp; sourceTree = "<group>"; };
AF33B4BD1C1FA441001B28D9 /* NetBSDSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetBSDSignals.h; path = Utility/NetBSDSignals.h; sourceTree = "<group>"; };
AF37E10917C861F20061E18E /* ProcessRunLock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessRunLock.cpp; sourceTree = "<group>"; };
@@ -2985,6 +3082,8 @@
AF68D2551255416E002FF25B /* RegisterContextLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextLLDB.h; path = Utility/RegisterContextLLDB.h; sourceTree = "<group>"; };
AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnwindLLDB.cpp; path = Utility/UnwindLLDB.cpp; sourceTree = "<group>"; };
AF68D3301255A110002FF25B /* UnwindLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindLLDB.h; path = Utility/UnwindLLDB.h; sourceTree = "<group>"; };
+ AF6CA6651FBBAF27005A0DC3 /* ArchSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArchSpec.cpp; path = source/Utility/ArchSpec.cpp; sourceTree = "<group>"; };
+ AF6CA6671FBBAF37005A0DC3 /* ArchSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArchSpec.h; path = include/lldb/Utility/ArchSpec.h; sourceTree = "<group>"; };
AF77E08D1A033C700096C0EA /* ABISysV_ppc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ABISysV_ppc.cpp; path = "SysV-ppc/ABISysV_ppc.cpp"; sourceTree = "<group>"; };
AF77E08E1A033C700096C0EA /* ABISysV_ppc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ABISysV_ppc.h; path = "SysV-ppc/ABISysV_ppc.h"; sourceTree = "<group>"; };
AF77E0911A033C7F0096C0EA /* ABISysV_ppc64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ABISysV_ppc64.cpp; path = "SysV-ppc64/ABISysV_ppc64.cpp"; sourceTree = "<group>"; };
@@ -3010,11 +3109,15 @@
AF90106315AB7C5700FF120D /* lldb.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; name = lldb.1; path = docs/lldb.1; sourceTree = "<group>"; };
AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextDarwin_arm64.cpp; path = Utility/RegisterContextDarwin_arm64.cpp; sourceTree = "<group>"; };
AF9107ED168570D200DBCD3C /* RegisterContextDarwin_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDarwin_arm64.h; path = Utility/RegisterContextDarwin_arm64.h; sourceTree = "<group>"; };
+ AF9113FB1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextPOSIXCore_ppc64le.cpp; sourceTree = "<group>"; };
+ AF9113FC1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterContextPOSIXCore_ppc64le.h; sourceTree = "<group>"; };
AF94005711C03F6500085DB9 /* SymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolVendor.cpp; path = source/Symbol/SymbolVendor.cpp; sourceTree = "<group>"; };
AF94726E1B575E430063D65C /* ValueObjectConstResultCast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResultCast.cpp; path = source/Core/ValueObjectConstResultCast.cpp; sourceTree = "<group>"; };
AF9472701B575E5F0063D65C /* ValueObjectConstResultCast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectConstResultCast.h; path = include/lldb/Core/ValueObjectConstResultCast.h; sourceTree = "<group>"; };
AF9B8F31182DB52900DA866F /* SystemRuntimeMacOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemRuntimeMacOSX.cpp; sourceTree = "<group>"; };
AF9B8F32182DB52900DA866F /* SystemRuntimeMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemRuntimeMacOSX.h; sourceTree = "<group>"; };
+ AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = "<group>"; };
+ AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = "<group>"; };
AFAFD8091E57E1B90017A14F /* ModuleCacheTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleCacheTest.cpp; path = Target/ModuleCacheTest.cpp; sourceTree = "<group>"; };
AFB3D27E1AC262AB003B4B30 /* MICmdCmdGdbShow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MICmdCmdGdbShow.cpp; path = "tools/lldb-mi/MICmdCmdGdbShow.cpp"; sourceTree = SOURCE_ROOT; };
AFB3D27F1AC262AB003B4B30 /* MICmdCmdGdbShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MICmdCmdGdbShow.h; path = "tools/lldb-mi/MICmdCmdGdbShow.h"; sourceTree = SOURCE_ROOT; };
@@ -3034,6 +3137,7 @@
AFC2DCF71E6E316F00283714 /* StreamCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StreamCallback.h; path = include/lldb/Utility/StreamCallback.h; sourceTree = "<group>"; };
AFC2DCF81E6E318000283714 /* StreamGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamGDBRemote.cpp; path = source/Utility/StreamGDBRemote.cpp; sourceTree = "<group>"; };
AFC2DCFA1E6E318600283714 /* StreamGDBRemote.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StreamGDBRemote.h; path = include/lldb/Utility/StreamGDBRemote.h; sourceTree = "<group>"; };
+ AFC67B141FBBB03500860ECB /* LibCxxBitset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibCxxBitset.cpp; path = Language/CPlusPlus/LibCxxBitset.cpp; sourceTree = "<group>"; };
AFCB2BBB1BF577F40018B553 /* PythonExceptionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonExceptionState.cpp; path = ScriptInterpreter/Python/PythonExceptionState.cpp; sourceTree = "<group>"; };
AFCB2BBC1BF577F40018B553 /* PythonExceptionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonExceptionState.h; path = ScriptInterpreter/Python/PythonExceptionState.h; sourceTree = "<group>"; };
AFD65C7F1D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_64.cpp; sourceTree = "<group>"; };
@@ -3259,17 +3363,21 @@
2321F9331BDD326500BA9A93 /* unittests */ = {
isa = PBXGroup;
children = (
+ 9A1890301F47D5BC00394BCA /* TestingSupport */,
23E2E52C1D903806006F38BB /* Breakpoint */,
- 239504C61BDD3FF300963CEA /* CMakeLists.txt */,
- 239504C21BDD3FD600963CEA /* gtest_common.h */,
23CB14E51D66CBEB00EDDDE1 /* Core */,
+ 9A2057421F3B904C00F6C293 /* debugserver */,
2326CF501BDD68CA00A5CEAC /* Editline */,
AEC6FF9D1BE97035007882C1 /* Expression */,
+ 239504C21BDD3FD600963CEA /* gtest_common.h */,
2321F9371BDD32ED00BA9A93 /* Host */,
2321F93C1BDD339A00BA9A93 /* Interpreter */,
23CB14F51D66CCB700EDDDE1 /* Language */,
+ 9A2057221F3B8DA600F6C293 /* ObjectFile */,
+ 9A2057191F3B864D00F6C293 /* Platform */,
2370A3781D66C549000E7BE6 /* Process */,
2321F93F1BDD33D800BA9A93 /* ScriptInterpreter */,
+ 9A20571D1F3B8D1100F6C293 /* Signals */,
23CB15091D66CF2B00EDDDE1 /* Symbol */,
23CB150A1D66CF3200EDDDE1 /* SymbolFile */,
AFAFD8081E57E19E0017A14F /* Target */,
@@ -3282,11 +3390,16 @@
2321F9371BDD32ED00BA9A93 /* Host */ = {
isa = PBXGroup;
children = (
+ 9A20573B1F3B8E8500F6C293 /* linux */,
+ 9A20572E1F3B8E7600F6C293 /* FileSystemTest.cpp */,
+ 9A20572F1F3B8E7600F6C293 /* HostTest.cpp */,
+ 9A2057301F3B8E7600F6C293 /* MainLoopTest.cpp */,
2321F9381BDD332400BA9A93 /* CMakeLists.txt */,
23CB14FD1D66CD2400EDDDE1 /* FileSpecTest.cpp */,
2321F9391BDD332400BA9A93 /* SocketAddressTest.cpp */,
2321F93A1BDD332400BA9A93 /* SocketTest.cpp */,
2321F93B1BDD332400BA9A93 /* SymbolsTest.cpp */,
+ 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
);
path = Host;
sourceTree = "<group>";
@@ -3294,6 +3407,7 @@
2321F93C1BDD339A00BA9A93 /* Interpreter */ = {
isa = PBXGroup;
children = (
+ 9A20572B1F3B8E6200F6C293 /* TestCompletion.cpp */,
2321F93D1BDD33CE00BA9A93 /* CMakeLists.txt */,
2321F93E1BDD33CE00BA9A93 /* TestArgs.cpp */,
);
@@ -3312,11 +3426,20 @@
2321F9421BDD343A00BA9A93 /* Utility */ = {
isa = PBXGroup;
children = (
- 9A1542F31F0EE44000DEA1D8 /* Helpers */,
+ 23E2E5161D903689006F38BB /* ArchSpecTest.cpp */,
+ 9A3D43C81F3150D200EB767C /* ConstStringTest.cpp */,
+ 9A3D43C71F3150D200EB767C /* LogTest.cpp */,
+ 9A3D43CB1F3150D200EB767C /* NameMatchesTest.cpp */,
+ 9A3D43C61F3150D200EB767C /* StatusTest.cpp */,
+ 9A3D43CA1F3150D200EB767C /* StructuredDataTest.cpp */,
+ 9A3D43C91F3150D200EB767C /* TildeExpressionResolverTest.cpp */,
+ 9A3D43CC1F3150D200EB767C /* TimeoutTest.cpp */,
+ 9A3D43C51F3150D200EB767C /* TimerTest.cpp */,
+ 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp */,
2321F9431BDD346100BA9A93 /* CMakeLists.txt */,
23CB15041D66CD9200EDDDE1 /* Inputs */,
2321F9441BDD346100BA9A93 /* StringExtractorTest.cpp */,
- 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
+ 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */,
2321F9461BDD346100BA9A93 /* UriParserTest.cpp */,
);
path = Utility;
@@ -3461,7 +3584,9 @@
23CB14E51D66CBEB00EDDDE1 /* Core */ = {
isa = PBXGroup;
children = (
- 23E2E5161D903689006F38BB /* ArchSpecTest.cpp */,
+ 9A3D43E31F3237D500EB767C /* ListenerTest.cpp */,
+ 9A3D43E21F3237D500EB767C /* StateTest.cpp */,
+ 9A3D43E11F3237D500EB767C /* StreamCallbackTest.cpp */,
23CB14E71D66CC0E00EDDDE1 /* CMakeLists.txt */,
23CB14E61D66CC0E00EDDDE1 /* BroadcasterTest.cpp */,
23CB14E81D66CC0E00EDDDE1 /* DataExtractorTest.cpp */,
@@ -3491,6 +3616,7 @@
23CB15041D66CD9200EDDDE1 /* Inputs */ = {
isa = PBXGroup;
children = (
+ 9A3D43DF1F31521200EB767C /* StructuredData-basic.json */,
23CB15051D66CDB400EDDDE1 /* TestModule.c */,
23CB15061D66CDB400EDDDE1 /* TestModule.so */,
);
@@ -3500,6 +3626,8 @@
23CB15091D66CF2B00EDDDE1 /* Symbol */ = {
isa = PBXGroup;
children = (
+ 9A2057131F3B860D00F6C293 /* TestDWARFCallFrameInfo.cpp */,
+ 9A2057141F3B860D00F6C293 /* TestType.cpp */,
23CB150B1D66CF5600EDDDE1 /* CMakeLists.txt */,
23CB150C1D66CF5600EDDDE1 /* TestClangASTContext.cpp */,
);
@@ -3510,6 +3638,7 @@
isa = PBXGroup;
children = (
23CB15101D66CF6900EDDDE1 /* CMakeLists.txt */,
+ 9A2057091F3B81DE00F6C293 /* DWARF */,
23CB15121D66CF6E00EDDDE1 /* PDB */,
);
path = SymbolFile;
@@ -3528,8 +3657,6 @@
23CB15181D66CF9500EDDDE1 /* Inputs */ = {
isa = PBXGroup;
children = (
- 23CB15191D66CFAC00EDDDE1 /* test-dwarf.cpp */,
- 23CB151A1D66CFAC00EDDDE1 /* test-dwarf.exe */,
23CB151B1D66CFAC00EDDDE1 /* test-pdb-alt.cpp */,
23CB151C1D66CFAC00EDDDE1 /* test-pdb-nested.h */,
23CB151D1D66CFAC00EDDDE1 /* test-pdb-types.cpp */,
@@ -3567,7 +3694,6 @@
isa = PBXGroup;
children = (
23E2E52D1D90382B006F38BB /* BreakpointIDTest.cpp */,
- 23E2E52E1D90382B006F38BB /* CMakeLists.txt */,
);
path = Breakpoint;
sourceTree = "<group>";
@@ -3595,6 +3721,7 @@
260C897110F57C5600BB2B04 /* Plugins */ = {
isa = PBXGroup;
children = (
+ AF2E029F1FA2CE8A00A86C34 /* Architecture */,
8CF02ADD19DCBEC200B14BE0 /* InstrumentationRuntime */,
8C2D6A58197A1FB9006989C9 /* MemoryHistory */,
26DB3E051379E7AD0080DC73 /* ABI */,
@@ -3806,6 +3933,10 @@
260C89DA10F57C5600BB2B04 /* SymbolFileDWARF.h */,
260C89DB10F57C5600BB2B04 /* SymbolFileDWARFDebugMap.cpp */,
260C89DC10F57C5600BB2B04 /* SymbolFileDWARFDebugMap.h */,
+ 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */,
+ 4C7D481E1F509964005314B4 /* SymbolFileDWARFDwp.h */,
+ 4C7D481F1F509964005314B4 /* SymbolFileDWARFDwoDwp.cpp */,
+ 4C7D481D1F509964005314B4 /* SymbolFileDWARFDwoDwp.h */,
26B8B42212EEC52A00A831B2 /* UniqueDWARFASTType.h */,
26B8B42312EEC52A00A831B2 /* UniqueDWARFASTType.cpp */,
);
@@ -3847,6 +3978,7 @@
2611FEF0142D83060017FEA3 /* SBBlock.i */,
2611FEF1142D83060017FEA3 /* SBBreakpoint.i */,
2611FEF2142D83060017FEA3 /* SBBreakpointLocation.i */,
+ 4C05332C1F63092A00DED368 /* SBBreakpointName.i */,
2611FEF3142D83060017FEA3 /* SBBroadcaster.i */,
2611FEF4142D83060017FEA3 /* SBCommandInterpreter.i */,
2611FEF5142D83060017FEA3 /* SBCommandReturnObject.i */,
@@ -3876,6 +4008,7 @@
263C493B178B61CC0070F12D /* SBModuleSpec.i */,
262F12B8183546C900AEB384 /* SBPlatform.i */,
2611FF07142D83060017FEA3 /* SBProcess.i */,
+ 4987FB1C1F30EC6000E5C17D /* SBProcessInfo.i */,
AF0EBBEE1859419F0059E52F /* SBQueue.i */,
AF0EBBEF1859419F0059E52F /* SBQueueItem.i */,
2611FF08142D83060017FEA3 /* SBSection.i */,
@@ -3939,6 +4072,10 @@
9AF16A9C11402D5B007A7B3F /* SBBreakpoint.cpp */,
9AF16CC611408686007A7B3F /* SBBreakpointLocation.h */,
9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */,
+ 4C54B2781F61CE1200D469CA /* SBBreakpointName.h */,
+ 4C54B27C1F61CE5300D469CA /* SBBreakpointName.cpp */,
+ 4C54B2811F62081300D469CA /* SBBreakpointOptionCommon.h */,
+ 4C0533291F6211FB00DED368 /* SBBreakpointOptionCommon.cpp */,
9A9830F31125FC5800A56CB0 /* SBBroadcaster.h */,
9A9830F21125FC5800A56CB0 /* SBBroadcaster.cpp */,
9A9830F71125FC5800A56CB0 /* SBCommandInterpreter.h */,
@@ -4001,6 +4138,8 @@
AF0EBBE7185940FB0059E52F /* SBQueueItem.cpp */,
9A9831041125FC5800A56CB0 /* SBProcess.h */,
9A9831031125FC5800A56CB0 /* SBProcess.cpp */,
+ 4987FB201F30EC9900E5C17D /* SBProcessInfo.h */,
+ 4987FB1E1F30EC7E00E5C17D /* SBProcessInfo.cpp */,
26B8283C142D01E9002DBC64 /* SBSection.h */,
26B8283F142D020F002DBC64 /* SBSection.cpp */,
9A9831061125FC5800A56CB0 /* SBSourceManager.h */,
@@ -4233,6 +4372,8 @@
2682F168115ED9C800CCFF99 /* Utility */ = {
isa = PBXGroup;
children = (
+ AF6CA6651FBBAF27005A0DC3 /* ArchSpec.cpp */,
+ AF6CA6671FBBAF37005A0DC3 /* ArchSpec.h */,
26BC7D5710F1B77400F91463 /* Connection.h */,
26BC7E6F10F1B85900F91463 /* Connection.cpp */,
26FA4315130103F400E71120 /* FileSpec.h */,
@@ -4258,6 +4399,7 @@
26BC7DD310F1B7D500F91463 /* Endian.h */,
AFC2DCE61E6E2ED000283714 /* FastDemangle.cpp */,
AFC2DCED1E6E2F9800283714 /* FastDemangle.h */,
+ 4CBFF0471F579A36004AFA92 /* Flags.h */,
AFC2DCF21E6E30CF00283714 /* History.cpp */,
AFC2DCF41E6E30D800283714 /* History.h */,
236124A61986B50E004EFC37 /* IOObject.h */,
@@ -4300,8 +4442,6 @@
AFEC3361194A8ABA00FF05C6 /* StructuredData.cpp */,
94BA8B6E176F8CA0005A91B5 /* Range.h */,
94BA8B6C176F8C9B005A91B5 /* Range.cpp */,
- 6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */,
- 6DEC6F381BD66D750091ABA6 /* TaskPool.cpp */,
AFF8FF0B1E779D4B003830EF /* TildeExpressionResolver.cpp */,
AFF8FF0D1E779D51003830EF /* TildeExpressionResolver.h */,
26BC7D7E10F1B77400F91463 /* Timer.h */,
@@ -4656,6 +4796,8 @@
26474CC518D0CB5B0073DEBA /* RegisterContextPOSIX_mips64.h */,
AF77E09D1A033D360096C0EA /* RegisterContextPOSIX_powerpc.cpp */,
AF77E09E1A033D360096C0EA /* RegisterContextPOSIX_powerpc.h */,
+ AF235EAE1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp */,
+ AF235EAF1FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h */,
267F68551CC02EAE0086832B /* RegisterContextPOSIX_s390x.cpp */,
267F68561CC02EAE0086832B /* RegisterContextPOSIX_s390x.h */,
26474CC618D0CB5B0073DEBA /* RegisterContextPOSIX_x86.cpp */,
@@ -4667,6 +4809,8 @@
9A77AD511E64E24E0025CE04 /* RegisterInfoPOSIX_arm.h */,
237A8BAB1DEC9BBC00CEBAFF /* RegisterInfoPOSIX_arm64.cpp */,
237A8BAC1DEC9BBC00CEBAFF /* RegisterInfoPOSIX_arm64.h */,
+ AF235EB31FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp */,
+ AF235EB21FBE7857009C5541 /* RegisterInfoPOSIX_ppc64le.h */,
26474CD018D0CB700073DEBA /* RegisterInfos_i386.h */,
26474CD118D0CB710073DEBA /* RegisterInfos_mips64.h */,
AF77E09F1A033D360096C0EA /* RegisterInfos_powerpc.h */,
@@ -4700,10 +4844,14 @@
26BC17A518C7F4CB00D2196D /* RegisterContextPOSIXCore_mips64.h */,
AF77E0A71A033D740096C0EA /* RegisterContextPOSIXCore_powerpc.cpp */,
AF77E0A81A033D740096C0EA /* RegisterContextPOSIXCore_powerpc.h */,
+ AF9113FB1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp */,
+ AF9113FC1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h */,
267F684D1CC02E270086832B /* RegisterContextPOSIXCore_s390x.cpp */,
267F684E1CC02E270086832B /* RegisterContextPOSIXCore_s390x.h */,
26BC17A618C7F4CB00D2196D /* RegisterContextPOSIXCore_x86_64.cpp */,
26BC17A718C7F4CB00D2196D /* RegisterContextPOSIXCore_x86_64.h */,
+ 4CA9D13C1FCE07AF00300E18 /* RegisterUtilities.cpp */,
+ 4CA9D13D1FCE07AF00300E18 /* RegisterUtilities.h */,
26BC17A818C7F4CB00D2196D /* ThreadElfCore.cpp */,
26BC17A918C7F4CB00D2196D /* ThreadElfCore.h */,
);
@@ -4736,8 +4884,6 @@
9AC7034211752C720086C050 /* AddressResolverFileLine.cpp */,
9AC7033F11752C590086C050 /* AddressResolverName.h */,
9AC7034411752C790086C050 /* AddressResolverName.cpp */,
- 26BC7D5210F1B77400F91463 /* ArchSpec.h */,
- 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */,
26BC7D5410F1B77400F91463 /* Broadcaster.h */,
26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */,
26BC7D5510F1B77400F91463 /* ClangForward.h */,
@@ -4946,6 +5092,8 @@
26BC7E0F10F1B83100F91463 /* BreakpointLocationCollection.cpp */,
26BC7CF410F1B71400F91463 /* BreakpointLocationList.h */,
26BC7E1010F1B83100F91463 /* BreakpointLocationList.cpp */,
+ 4C7D48281F509CCD005314B4 /* BreakpointName.cpp */,
+ 4C7D482B1F509CF5005314B4 /* BreakpointName.h */,
26BC7CF510F1B71400F91463 /* BreakpointOptions.h */,
26BC7E1110F1B83100F91463 /* BreakpointOptions.cpp */,
26BC7CF610F1B71400F91463 /* BreakpointResolver.h */,
@@ -5133,6 +5281,8 @@
267A47F21B14115A0021A5BC /* SoftwareBreakpoint.h */,
232CB613191E00CC00EF39FC /* SoftwareBreakpoint.cpp */,
2689B0A4113EE3CD00A4AEDB /* Symbols.h */,
+ 6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */,
+ 6DEC6F381BD66D750091ABA6 /* TaskPool.cpp */,
268DA871130095D000C9483A /* Terminal.h */,
3FDFED2319BA6D55009756A7 /* ThreadLauncher.h */,
267A48031B1416080021A5BC /* XML.h */,
@@ -6076,9 +6226,12 @@
945261B51B9A11E800BF138D /* LibCxx.cpp */,
9428BC2A1C6E64DC002A24D7 /* LibCxxAtomic.h */,
9428BC291C6E64DC002A24D7 /* LibCxxAtomic.cpp */,
+ AFC67B141FBBB03500860ECB /* LibCxxBitset.cpp */,
945261B71B9A11E800BF138D /* LibCxxInitializerList.cpp */,
945261B81B9A11E800BF138D /* LibCxxList.cpp */,
945261B91B9A11E800BF138D /* LibCxxMap.cpp */,
+ AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
+ AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */,
945261BB1B9A11E800BF138D /* LibCxxVector.cpp */,
945261BD1B9A11E800BF138D /* LibStdcpp.h */,
@@ -6224,16 +6377,85 @@
name = "SysV-mips";
sourceTree = "<group>";
};
- 9A1542F31F0EE44000DEA1D8 /* Helpers */ = {
+ 9A1890301F47D5BC00394BCA /* TestingSupport */ = {
+ isa = PBXGroup;
+ children = (
+ 9A1890311F47D5D400394BCA /* CMakeLists.txt */,
+ 9A1890321F47D5D400394BCA /* MockTildeExpressionResolver.cpp */,
+ 9A1890331F47D5D400394BCA /* MockTildeExpressionResolver.h */,
+ 9A1890341F47D5D400394BCA /* TestUtilities.cpp */,
+ 9A1890351F47D5D400394BCA /* TestUtilities.h */,
+ );
+ name = TestingSupport;
+ sourceTree = "<group>";
+ };
+ 9A2057091F3B81DE00F6C293 /* DWARF */ = {
+ isa = PBXGroup;
+ children = (
+ 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */,
+ 9A20570C1F3B81F800F6C293 /* Inputs */,
+ );
+ name = DWARF;
+ sourceTree = "<group>";
+ };
+ 9A20570C1F3B81F800F6C293 /* Inputs */ = {
+ isa = PBXGroup;
+ children = (
+ 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */,
+ 9A20570E1F3B821A00F6C293 /* test-dwarf.exe */,
+ );
+ name = Inputs;
+ sourceTree = "<group>";
+ };
+ 9A2057191F3B864D00F6C293 /* Platform */ = {
+ isa = PBXGroup;
+ children = (
+ 9A20571A1F3B866F00F6C293 /* PlatformDarwinTest.cpp */,
+ );
+ name = Platform;
+ sourceTree = "<group>";
+ };
+ 9A20571D1F3B8D1100F6C293 /* Signals */ = {
+ isa = PBXGroup;
+ children = (
+ 9A20571E1F3B8D2100F6C293 /* UnixSignalsTest.cpp */,
+ );
+ name = Signals;
+ sourceTree = "<group>";
+ };
+ 9A2057221F3B8DA600F6C293 /* ObjectFile */ = {
+ isa = PBXGroup;
+ children = (
+ 9A2057231F3B8DC100F6C293 /* ELF */,
+ );
+ name = ObjectFile;
+ sourceTree = "<group>";
+ };
+ 9A2057231F3B8DC100F6C293 /* ELF */ = {
+ isa = PBXGroup;
+ children = (
+ 9A2057241F3B8DD200F6C293 /* TestELFHeader.cpp */,
+ 9A2057251F3B8DD200F6C293 /* TestObjectFileELF.cpp */,
+ );
+ name = ELF;
+ sourceTree = "<group>";
+ };
+ 9A20573B1F3B8E8500F6C293 /* linux */ = {
isa = PBXGroup;
children = (
- 9A1542F41F0EE44000DEA1D8 /* CMakeLists.txt */,
- 9A1542F51F0EE44000DEA1D8 /* MockTildeExpressionResolver.cpp */,
- 9A1542F61F0EE44000DEA1D8 /* MockTildeExpressionResolver.h */,
- 9A1542F71F0EE44000DEA1D8 /* TestUtilities.cpp */,
- 9A1542F81F0EE44000DEA1D8 /* TestUtilities.h */,
+ 9A20573C1F3B8EA200F6C293 /* HostTest.cpp */,
+ 9A20573D1F3B8EA200F6C293 /* SupportTest.cpp */,
);
- path = Helpers;
+ name = linux;
+ sourceTree = "<group>";
+ };
+ 9A2057421F3B904C00F6C293 /* debugserver */ = {
+ isa = PBXGroup;
+ children = (
+ 9A2057441F3B905C00F6C293 /* debugserver_LogCallback.cpp */,
+ 9A2057451F3B905C00F6C293 /* RNBSocketTest.cpp */,
+ );
+ name = debugserver;
sourceTree = "<group>";
};
AE44FB371BB35A2E0033EB62 /* Go */ = {
@@ -6364,6 +6586,23 @@
path = GDB;
sourceTree = "<group>";
};
+ AF2E029F1FA2CE8A00A86C34 /* Architecture */ = {
+ isa = PBXGroup;
+ children = (
+ AF2E02A01FA2CE9900A86C34 /* Arm */,
+ );
+ path = Architecture;
+ sourceTree = "<group>";
+ };
+ AF2E02A01FA2CE9900A86C34 /* Arm */ = {
+ isa = PBXGroup;
+ children = (
+ AF2E02A11FA2CEAF00A86C34 /* ArchitectureArm.cpp */,
+ AF2E02A21FA2CEAF00A86C34 /* ArchitectureArm.h */,
+ );
+ path = Arm;
+ sourceTree = "<group>";
+ };
AF6335DF1C87B20A00F7D554 /* PDB */ = {
isa = PBXGroup;
children = (
@@ -6396,6 +6635,7 @@
AFAFD8081E57E19E0017A14F /* Target */ = {
isa = PBXGroup;
children = (
+ 9A2057061F3B818600F6C293 /* MemoryRegionInfoTest.cpp */,
AFAFD8091E57E1B90017A14F /* ModuleCacheTest.cpp */,
);
name = Target;
@@ -6473,6 +6713,7 @@
8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */,
9A36D24D1EB3BE7F00AAD9EA /* SBTrace.h in Headers */,
AF0EBBEC185941360059E52F /* SBQueue.h in Headers */,
+ 4C877B391F30EF990068FCFB /* SBProcessInfo.h in Headers */,
26680222115FD13D008E1FE4 /* SBError.h in Headers */,
26680223115FD13D008E1FE4 /* SBEvent.h in Headers */,
AFDCDBCB19DD0F42005EA55E /* SBExecutionContext.h in Headers */,
@@ -6496,6 +6737,7 @@
26C72C94124322890068DC16 /* SBStream.h in Headers */,
9A357671116E7B5200E8ED2F /* SBStringList.h in Headers */,
26DE205B11618FF600A093E2 /* SBSymbol.h in Headers */,
+ 4C54B27B1F61CE2800D469CA /* SBBreakpointName.h in Headers */,
262F12B71835469C00AEB384 /* SBPlatform.h in Headers */,
23DCBEA31D63E71F0084C36B /* SBStructuredData.h in Headers */,
26DE204111618AB900A093E2 /* SBSymbolContext.h in Headers */,
@@ -6530,10 +6772,15 @@
AF8AD6381BEC28C400150209 /* PlatformRemoteAppleTV.h in Headers */,
26EFB61C1BFE8D3E00544801 /* PlatformNetBSD.h in Headers */,
AF3A4AD31EA05C4700B5DEB4 /* PlatformRemoteDarwinDevice.h in Headers */,
+ AF9113FE1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h in Headers */,
AF33B4BF1C1FA441001B28D9 /* NetBSDSignals.h in Headers */,
AF6335E31C87B21E00F7D554 /* SymbolFilePDB.h in Headers */,
+ AF6CA6681FBBAF37005A0DC3 /* ArchSpec.h in Headers */,
+ AF235EB41FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.h in Headers */,
+ AF2E02A41FA2CEAF00A86C34 /* ArchitectureArm.h in Headers */,
267F685A1CC02EBE0086832B /* RegisterInfos_s390x.h in Headers */,
267F68541CC02E920086832B /* RegisterContextLinux_s390x.h in Headers */,
+ AF235EB11FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.h in Headers */,
267F68501CC02E270086832B /* RegisterContextPOSIXCore_s390x.h in Headers */,
4984BA181B979C08008658D4 /* ExpressionVariable.h in Headers */,
26C7C4841BFFEA7E009BD01F /* WindowsMiniDump.h in Headers */,
@@ -6918,6 +7165,7 @@
);
name = "Prepare Swig Bindings";
outputPaths = (
+ "$(BUILT_PRODUCTS_DIR)/LLDBWrapPython.cpp",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
@@ -7013,32 +7261,57 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 9A3D43D91F3151C400EB767C /* StatusTest.cpp in Sources */,
23CB15331D66DA9300EDDDE1 /* GoParserTest.cpp in Sources */,
+ 9A2057281F3B8DDB00F6C293 /* TestELFHeader.cpp in Sources */,
23CB15341D66DA9300EDDDE1 /* CPlusPlusLanguageTest.cpp in Sources */,
+ 9A2057381F3B8E7E00F6C293 /* FileSystemTest.cpp in Sources */,
+ 9A2057201F3B8D2500F6C293 /* UnixSignalsTest.cpp in Sources */,
AFAFD80A1E57E1B90017A14F /* ModuleCacheTest.cpp in Sources */,
+ 9A3D43DA1F3151C400EB767C /* StructuredDataTest.cpp in Sources */,
+ 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */,
+ 9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in Sources */,
23CB15351D66DA9300EDDDE1 /* UriParserTest.cpp in Sources */,
+ 8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */,
23CB15361D66DA9300EDDDE1 /* FileSpecTest.cpp in Sources */,
23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in Sources */,
+ 9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources */,
+ 9A20572D1F3B8E6600F6C293 /* TestCompletion.cpp in Sources */,
AF248A4D1DA71C77000B814D /* TestArm64InstEmulation.cpp in Sources */,
23CB15371D66DA9300EDDDE1 /* PythonTestSuite.cpp in Sources */,
23E2E5321D903832006F38BB /* BreakpointIDTest.cpp in Sources */,
23CB15381D66DA9300EDDDE1 /* PythonExceptionStateTests.cpp in Sources */,
- 9A1542F91F0EE48600DEA1D8 /* MockTildeExpressionResolver.cpp in Sources */,
+ 9A3D43D81F3151C400EB767C /* NameMatchesTest.cpp in Sources */,
23CB15391D66DA9300EDDDE1 /* DataExtractorTest.cpp in Sources */,
+ 9A3D43ED1F3237F900EB767C /* StateTest.cpp in Sources */,
23CB153A1D66DA9300EDDDE1 /* GDBRemoteClientBaseTest.cpp in Sources */,
23CB153B1D66DA9300EDDDE1 /* SocketTest.cpp in Sources */,
23CB153C1D66DA9300EDDDE1 /* TestArgs.cpp in Sources */,
+ 9A3D43DB1F3151C400EB767C /* TildeExpressionResolverTest.cpp in Sources */,
+ 9A2057291F3B8DDB00F6C293 /* TestObjectFileELF.cpp in Sources */,
23CB153D1D66DA9300EDDDE1 /* GDBRemoteCommunicationClientTest.cpp in Sources */,
23CB153E1D66DA9300EDDDE1 /* PythonDataObjectsTests.cpp in Sources */,
- 9A1542FA1F0EE48600DEA1D8 /* TestUtilities.cpp in Sources */,
+ 9A3D43D71F3151C400EB767C /* LogTest.cpp in Sources */,
+ 9A2057181F3B861400F6C293 /* TestType.cpp in Sources */,
+ 9A2057171F3B861400F6C293 /* TestDWARFCallFrameInfo.cpp in Sources */,
+ 9A3D43EC1F3237F900EB767C /* ListenerTest.cpp in Sources */,
+ 9A3D43DC1F3151C400EB767C /* TimeoutTest.cpp in Sources */,
+ 9A3D43D61F3151C400EB767C /* ConstStringTest.cpp in Sources */,
+ 9A20571C1F3B867400F6C293 /* PlatformDarwinTest.cpp in Sources */,
23CB153F1D66DA9300EDDDE1 /* SymbolsTest.cpp in Sources */,
AFEC5FD81D94F9380076A480 /* Testx86AssemblyInspectionEngine.cpp in Sources */,
23CB15401D66DA9300EDDDE1 /* TestClangASTContext.cpp in Sources */,
23CB15411D66DA9300EDDDE1 /* StringExtractorTest.cpp in Sources */,
+ 9A2057031F3A605200F6C293 /* VASprintfTest.cpp in Sources */,
+ 9A18903C1F47D5E600394BCA /* TestUtilities.cpp in Sources */,
23CB15421D66DA9300EDDDE1 /* TaskPoolTest.cpp in Sources */,
23CB15431D66DA9300EDDDE1 /* BroadcasterTest.cpp in Sources */,
+ 9A3D43EE1F3237F900EB767C /* StreamCallbackTest.cpp in Sources */,
+ 9A18903B1F47D5E600394BCA /* MockTildeExpressionResolver.cpp in Sources */,
23CB15441D66DA9300EDDDE1 /* ScalarTest.cpp in Sources */,
+ 9A2057391F3B8E7E00F6C293 /* HostTest.cpp in Sources */,
23CB15451D66DA9300EDDDE1 /* SocketAddressTest.cpp in Sources */,
+ 9A3D43DD1F3151C400EB767C /* TimerTest.cpp in Sources */,
23CB15461D66DA9300EDDDE1 /* GDBRemoteTestUtils.cpp in Sources */,
23E2E5271D903782006F38BB /* MinidumpParserTest.cpp in Sources */,
23CB15471D66DA9300EDDDE1 /* EditlineTest.cpp in Sources */,
@@ -7068,12 +7341,14 @@
26680326116005DB008E1FE4 /* SBTarget.cpp in Sources */,
23DCBEA21D63E7190084C36B /* SBStructuredData.cpp in Sources */,
26680327116005DC008E1FE4 /* SBSourceManager.cpp in Sources */,
+ 4971D4B51F30ECFB00823171 /* SBProcessInfo.cpp in Sources */,
3F81692C1ABB7A1E001DA9DF /* SystemInitializerFull.cpp in Sources */,
26680328116005DE008E1FE4 /* SBProcess.cpp in Sources */,
2668032A116005E0008E1FE4 /* SBListener.cpp in Sources */,
2668032C116005E2008E1FE4 /* SBFrame.cpp in Sources */,
2668032D116005E3008E1FE4 /* SBFileSpec.cpp in Sources */,
2668032E116005E5008E1FE4 /* SBEvent.cpp in Sources */,
+ 4C54B27E1F61CE6300D469CA /* SBBreakpointName.cpp in Sources */,
2668032F116005E6008E1FE4 /* SBError.cpp in Sources */,
23DCEA461D1C4D0F00A602B4 /* SBMemoryRegionInfo.cpp in Sources */,
26680330116005E7008E1FE4 /* SBDebugger.cpp in Sources */,
@@ -7097,6 +7372,7 @@
26DE20651161904E00A093E2 /* SBSymbol.cpp in Sources */,
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */,
261744781168585B005ADD65 /* SBType.cpp in Sources */,
+ 4C05332B1F62121E00DED368 /* SBBreakpointOptionCommon.cpp in Sources */,
9A35758E116CFE0F00E8ED2F /* SBValueList.cpp in Sources */,
9A357673116E7B6400E8ED2F /* SBStringList.cpp in Sources */,
9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */,
@@ -7160,6 +7436,7 @@
2689000513353DB600698AC0 /* BreakpointResolverName.cpp in Sources */,
6D762BEE1B1605D2006C929D /* LLDBServerUtilities.cpp in Sources */,
2689000713353DB600698AC0 /* BreakpointSite.cpp in Sources */,
+ AF235EB01FBE77B6009C5541 /* RegisterContextPOSIX_ppc64le.cpp in Sources */,
2689000913353DB600698AC0 /* BreakpointSiteList.cpp in Sources */,
26474CC918D0CB5B0073DEBA /* RegisterContextMemory.cpp in Sources */,
8CF02AEA19DCC02100B14BE0 /* ASanRuntime.cpp in Sources */,
@@ -7209,6 +7486,7 @@
6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */,
2666ADC61B3CB675001FAFD3 /* DynamicLoaderHexagonDYLD.cpp in Sources */,
3F8169331ABB7A6D001DA9DF /* SystemLifetimeManager.cpp in Sources */,
+ AF2E02A31FA2CEAF00A86C34 /* ArchitectureArm.cpp in Sources */,
4959511F1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp in Sources */,
26BC179918C7F2B300D2196D /* JITLoader.cpp in Sources */,
4CC7C6571D52997A0076FF94 /* OCamlASTContext.cpp in Sources */,
@@ -7226,7 +7504,6 @@
949EEDB11BA7672D008C63CF /* NSDictionary.cpp in Sources */,
2689002D13353E0400698AC0 /* AddressResolverFileLine.cpp in Sources */,
2689002E13353E0400698AC0 /* AddressResolverName.cpp in Sources */,
- 2689002F13353E0400698AC0 /* ArchSpec.cpp in Sources */,
250D6AE31A9679440049CC70 /* FileSystem.cpp in Sources */,
2689003113353E0400698AC0 /* Broadcaster.cpp in Sources */,
49DCF702170E70120092F75E /* Materializer.cpp in Sources */,
@@ -7322,6 +7599,7 @@
304B2E461CAAA57B007829FE /* ClangUtil.cpp in Sources */,
2689006E13353E1A00698AC0 /* File.cpp in Sources */,
2689006F13353E1A00698AC0 /* FileSpec.cpp in Sources */,
+ AF6CA6661FBBAF28005A0DC3 /* ArchSpec.cpp in Sources */,
2689007113353E1A00698AC0 /* Host.cpp in Sources */,
2635879417822FC2004C30BA /* SymbolVendorELF.cpp in Sources */,
25420ED21A649D88009ADBCB /* PipeBase.cpp in Sources */,
@@ -7337,6 +7615,7 @@
9A0FDEA71E8EF5110086B2F5 /* RegisterContextLinux_mips.cpp in Sources */,
94BA8B70176F97CE005A91B5 /* CommandHistory.cpp in Sources */,
2689007713353E1A00698AC0 /* CFCData.cpp in Sources */,
+ AFC67B151FBBB03600860ECB /* LibCxxBitset.cpp in Sources */,
2689007813353E1A00698AC0 /* CFCMutableArray.cpp in Sources */,
9418EBCD1AA910910058B02E /* VectorType.cpp in Sources */,
4C4EB7811E6A4DCC002035C0 /* DumpDataExtractor.cpp in Sources */,
@@ -7392,6 +7671,7 @@
9694FA711B32AA64005EBB16 /* ABISysV_mips.cpp in Sources */,
2689009F13353E4200698AC0 /* ProcessGDBRemote.cpp in Sources */,
268900A013353E4200698AC0 /* ProcessGDBRemoteLog.cpp in Sources */,
+ AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */,
268900A113353E4200698AC0 /* ThreadGDBRemote.cpp in Sources */,
AEEA34051AC88A7400AB639D /* TypeSystem.cpp in Sources */,
AF1729D6182C907200E0AB97 /* HistoryThread.cpp in Sources */,
@@ -7437,6 +7717,7 @@
947CF7771DC7B20D00EF980B /* ThreadMinidump.cpp in Sources */,
268900C913353E5F00698AC0 /* NameToDIE.cpp in Sources */,
268900CA13353E5F00698AC0 /* SymbolFileDWARF.cpp in Sources */,
+ 4CAA19E61F5A40040099E692 /* BreakpointName.cpp in Sources */,
268900CB13353E5F00698AC0 /* LogChannelDWARF.cpp in Sources */,
268900CC13353E5F00698AC0 /* SymbolFileDWARFDebugMap.cpp in Sources */,
268900CD13353E5F00698AC0 /* UniqueDWARFASTType.cpp in Sources */,
@@ -7467,6 +7748,7 @@
268900DC13353E6F00698AC0 /* ObjectFile.cpp in Sources */,
268900DD13353E6F00698AC0 /* Symbol.cpp in Sources */,
AF26703A1852D01E00B6CC36 /* Queue.cpp in Sources */,
+ 4C7D48241F5099A1005314B4 /* SymbolFileDWARFDwp.cpp in Sources */,
949EEDAE1BA7671C008C63CF /* CF.cpp in Sources */,
268900DE13353E6F00698AC0 /* SymbolContext.cpp in Sources */,
49CA97001E6AACC900C03FEE /* UUID.cpp in Sources */,
@@ -7523,6 +7805,7 @@
268900FD13353E6F00698AC0 /* ThreadPlanCallFunction.cpp in Sources */,
23D4007D1C2101F2000C3885 /* DWARFDebugMacro.cpp in Sources */,
94B6385D1B8FB178004FE1E4 /* CPlusPlusLanguage.cpp in Sources */,
+ AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */,
268900FE13353E6F00698AC0 /* ThreadPlanCallUserExpression.cpp in Sources */,
268900FF13353E6F00698AC0 /* ThreadPlanShouldStopHere.cpp in Sources */,
2579065F1BD0488D00178368 /* DomainSocket.cpp in Sources */,
@@ -7540,6 +7823,8 @@
2689010413353E6F00698AC0 /* ThreadPlanStepInRange.cpp in Sources */,
2689010513353E6F00698AC0 /* ThreadPlanStepOverRange.cpp in Sources */,
3FDFE56D19AF9C44009756A7 /* HostThreadPosix.cpp in Sources */,
+ 4CA9D1401FCE07CD00300E18 /* RegisterUtilities.cpp in Sources */,
+ AF235EB51FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.cpp in Sources */,
2689010613353E6F00698AC0 /* ThreadPlanRunToAddress.cpp in Sources */,
2689010713353E6F00698AC0 /* ThreadPlanStepThrough.cpp in Sources */,
2689010813353E6F00698AC0 /* ThreadPlanStepUntil.cpp in Sources */,
@@ -7648,6 +7933,7 @@
26957D9C13D381C900670048 /* RegisterContextDarwin_x86_64.cpp in Sources */,
94CD7D0919A3FBA300908B7C /* AppleObjCClassDescriptorV2.cpp in Sources */,
945261C31B9A11FC00BF138D /* LibCxxMap.cpp in Sources */,
+ 4C7D48251F5099B2005314B4 /* SymbolFileDWARFDwoDwp.cpp in Sources */,
265205A813D3E3F700132FE2 /* RegisterContextKDP_arm.cpp in Sources */,
265205AA13D3E3F700132FE2 /* RegisterContextKDP_i386.cpp in Sources */,
6DEC6F391BD66D750091ABA6 /* TaskPool.cpp in Sources */,
@@ -7659,6 +7945,7 @@
267A47FF1B1411D90021A5BC /* NativeWatchpointList.cpp in Sources */,
26F4A21C13FBA31A0064B613 /* ThreadMemory.cpp in Sources */,
3FBA69E11B6067120008F44A /* ScriptInterpreterNone.cpp in Sources */,
+ AF9113FD1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.cpp in Sources */,
266DFE9713FD656E00D0C574 /* OperatingSystem.cpp in Sources */,
AF8AD6391BEC28C400150209 /* PlatformRemoteAppleWatch.cpp in Sources */,
26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */,
@@ -8278,7 +8565,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8320,7 +8607,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8362,7 +8649,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8404,7 +8691,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8446,7 +8733,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -DYAML2OBJ=\"\\\"$(LLVM_BUILD_DIR)/x86_64/bin/yaml2obj\\\"\" -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8488,7 +8775,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -DYAML2OBJ=\"\\\"$(LLVM_BUILD_DIR)/x86_64/bin/yaml2obj\\\"\" -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8530,7 +8817,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -DYAML2OBJ=\"\\\"$(LLVM_BUILD_DIR)/x86_64/bin/yaml2obj\\\"\" -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
@@ -8572,7 +8859,7 @@
"$(LLVM_SOURCE_DIR)/tools/clang/include",
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include",
);
- LLDB_GTESTS_CFLAGS = "-I ${SOURCE_ROOT} -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
+ LLDB_GTESTS_CFLAGS = "-I unittests -I $(LLVM_SOURCE_DIR)/utils/unittest/googlemock/include -I $(LLVM_SOURCE_DIR)/utils/unittest/googletest/include -I $(LLVM_SOURCE_DIR)/include -I $(LLVM_BUILD_DIR)/x86_64/include -DYAML2OBJ=\"\\\"$(LLVM_BUILD_DIR)/x86_64/bin/yaml2obj\\\"\" -I include -I source -I $(PYTHON_FRAMEWORK_PATH)/Headers";
LLDB_GTESTS_LDFLAGS = "$(LLVM_BUILD_DIR)/x86_64/lib/libgtest.a -L $(PYTHON_FRAMEWORK_PATH)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib -l python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)";
OTHER_CFLAGS = (
"-fno-rtti",
diff --git a/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme b/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme
index 881829e27feb..82a97dfbe24f 100644
--- a/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme
+++ b/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme
@@ -54,6 +54,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
+ enableThreadSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme b/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme
index d8fa52cd63dc..352ef7194155 100644
--- a/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme
+++ b/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme
@@ -42,9 +42,10 @@
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
+ enableThreadSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme b/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
index 17aedff2ce52..7512a2813577 100644
--- a/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
+++ b/lldb.xcodeproj/xcshareddata/xcschemes/desktop.xcscheme
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@@ -36,6 +37,7 @@
buildConfiguration = "DebugClang"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile b/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
new file mode 100644
index 000000000000..5d2224cb6560
--- /dev/null
+++ b/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+CFLAGS_EXTRAS = -mthumb
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py b/packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py
new file mode 100644
index 000000000000..1abab39b1da3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py
@@ -0,0 +1,45 @@
+"""
+Test that breakpoints in an IT instruction don't fire if their condition is
+false.
+"""
+from __future__ import print_function
+
+
+import lldb
+import os
+import time
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBreakpointIt(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @skipIf(archs=no_match(["arm"]))
+ def test_false(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ self.runCmd("target create %s" % exe)
+ lldbutil.run_break_set_by_symbol(self, "bkpt_false",
+ extra_options="--skip-prologue 0")
+
+ self.runCmd("run")
+ self.assertEqual(self.process().GetState(), lldb.eStateExited,
+ "Breakpoint does not get hit")
+
+ @skipIf(archs=no_match(["arm"]))
+ def test_true(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ self.runCmd("target create %s" % exe)
+ bpid = lldbutil.run_break_set_by_symbol(self, "bkpt_true",
+ extra_options="--skip-prologue 0")
+
+ self.runCmd("run")
+ self.assertIsNotNone(lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ self.process(), bpid))
diff --git a/packages/Python/lldbsuite/test/arm/breakpoint-it/main.c b/packages/Python/lldbsuite/test/arm/breakpoint-it/main.c
new file mode 100644
index 000000000000..35d57bb1b843
--- /dev/null
+++ b/packages/Python/lldbsuite/test/arm/breakpoint-it/main.c
@@ -0,0 +1,14 @@
+int main() {
+ int value;
+ asm (
+ "cmp %1, %2\n\t"
+ "ite ne\n\t"
+ ".thumb_func\n\t"
+ "bkpt_true:\n\t"
+ "movne %0, %1\n\t"
+ ".thumb_func\n\t"
+ "bkpt_false:\n\t"
+ "moveq %0, %2\n\t"
+ : "=r" (value) : "r"(42), "r"(47));
+ return value;
+}
diff --git a/packages/Python/lldbsuite/test/arm_emulation/TestEmulations.py b/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py
index 4ddda525537c..4ddda525537c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/TestEmulations.py
+++ b/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-arm.dat
index 64b2506f9d56..64b2506f9d56 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-thumb.dat
index daa32d25a41a..daa32d25a41a 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-10-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-10-thumb.dat
index bb3d760219b4..bb3d760219b4 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-10-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-10-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-11-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-11-thumb.dat
index e26f2218cbcd..e26f2218cbcd 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-11-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-11-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-12-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-12-thumb.dat
index a7f7344e7d97..a7f7344e7d97 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-12-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-12-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-arm.dat
index cf6e0a9779a9..cf6e0a9779a9 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-thumb.dat
index 9a178a0a159d..9a178a0a159d 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-arm.dat
index 9fc44b79395c..9fc44b79395c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-thumb.dat
index c8f96ec09d3e..c8f96ec09d3e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-arm.dat
index 12b40ed76fce..12b40ed76fce 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-thumb.dat
index 922b8ecdba53..922b8ecdba53 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-arm.dat
index dfb6a87f014d..dfb6a87f014d 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-thumb.dat
index 16ff517436b0..16ff517436b0 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-5-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-arm.dat
index 8a87eff5f002..8a87eff5f002 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-thumb.dat
index e8abd6950f20..e8abd6950f20 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-6-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-arm.dat
index 312514246e3e..312514246e3e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-thumb.dat
index 506071309d7c..506071309d7c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-7-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-arm.dat
index 44a400f5287a..44a400f5287a 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-thumb.dat
index 8bc6c789a51d..8bc6c789a51d 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-8-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-9-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-9-thumb.dat
index 832af4cf0b48..832af4cf0b48 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-add-9-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-9-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-arm.dat
index c1cd4f15ab3e..c1cd4f15ab3e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-thumb.dat
index c62422650182..c62422650182 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-bic-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-bic-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-arm.dat
index e1922d9edb9a..e1922d9edb9a 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-thumb.dat
index 60a805e09d83..60a805e09d83 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-arm.dat
index 99401bbd2e21..99401bbd2e21 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-thumb.dat
index 39ecf947c6de..39ecf947c6de 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-arm.dat
index 427d7b27485c..427d7b27485c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-thumb.dat
index 9738073c038e..9738073c038e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldmia-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldmia-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-arm.dat
index 307402fd2f5c..307402fd2f5c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-thumb.dat
index 471669b0cb65..471669b0cb65 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-10-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-10-thumb.dat
index bc7693c9a684..bc7693c9a684 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-10-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-10-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-11-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-11-thumb.dat
index b5bf18127cd6..b5bf18127cd6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-11-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-11-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-12-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-12-thumb.dat
index 5c3a5485f0b3..5c3a5485f0b3 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-12-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-12-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-arm.dat
index 068297e3edce..068297e3edce 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-thumb.dat
index 27727831d6d5..27727831d6d5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-arm.dat
index f0d6d8aaba63..f0d6d8aaba63 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-thumb.dat
index 012e1c53e663..012e1c53e663 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-arm.dat
index e2d2aa6aa887..e2d2aa6aa887 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-thumb.dat
index 3eb6f167b488..3eb6f167b488 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-arm.dat
index 45210d9600d9..45210d9600d9 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-thumb.dat
index 45289e7e899c..45289e7e899c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-5-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-5-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-arm.dat
index 0f379fd49809..0f379fd49809 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-thumb.dat
index 5b3c119e7437..5b3c119e7437 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-6-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-6-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-arm.dat
index ff425ef5284f..ff425ef5284f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-thumb.dat
index db8d58796ca8..db8d58796ca8 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-7-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-7-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-arm.dat
index c11dfc133e5b..c11dfc133e5b 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-thumb.dat
index 01d7013ceaaa..01d7013ceaaa 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-8-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-8-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-9-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-9-thumb.dat
index cc3c4db2f4de..cc3c4db2f4de 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldr-9-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldr-9-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-arm.dat
index 970f8aa7c0a4..970f8aa7c0a4 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-thumb.dat
index 7ab41ce35dbe..7ab41ce35dbe 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-2-thumb.dat
index 70fe6f5cfff7..70fe6f5cfff7 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrd-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrd-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrh-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrh-1-thumb.dat
index 2a47002fb658..2a47002fb658 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrh-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrh-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-1-arm.dat
index cecf397f1d49..cecf397f1d49 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-2-arm.dat
index 660b3d3b5db7..660b3d3b5db7 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-ldrsh-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-ldrsh-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-arm.dat
index 232bc967fede..232bc967fede 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-thumb.dat
index 569510dbd3ba..569510dbd3ba 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-10-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-10-thumb.dat
index 6bf9b0d7ef7e..6bf9b0d7ef7e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-10-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-10-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-11-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-11-thumb.dat
index 82043ef335b1..82043ef335b1 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-11-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-11-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-12-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-12-thumb.dat
index 1fce18af917c..1fce18af917c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-12-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-12-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-13-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-13-thumb.dat
index d1c1a4428c9f..d1c1a4428c9f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-13-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-13-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-14-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-14-thumb.dat
index dfd89c265fbd..dfd89c265fbd 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-14-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-14-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-15-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-15-thumb.dat
index 0ff8e5d7dc5c..0ff8e5d7dc5c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-15-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-15-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-16-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-16-thumb.dat
index 1baf42dfc56c..1baf42dfc56c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-16-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-16-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-17-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-17-thumb.dat
index 70cee03fb54f..70cee03fb54f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-17-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-17-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-18-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-18-thumb.dat
index 1893e188b0d0..1893e188b0d0 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-18-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-18-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-19-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-19-thumb.dat
index 238e16b4aa42..238e16b4aa42 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-19-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-19-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-arm.dat
index 6d6c0cbf80c5..6d6c0cbf80c5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-thumb.dat
index ad6854427fbf..ad6854427fbf 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-20-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-20-thumb.dat
index 15ecd2ebfa0a..15ecd2ebfa0a 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-20-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-20-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-21-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-21-thumb.dat
index 6a38f1671b7c..6a38f1671b7c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-21-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-21-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-22-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-22-thumb.dat
index 242b56824194..242b56824194 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-22-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-22-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-23-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-23-thumb.dat
index 7f57440a8421..7f57440a8421 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-23-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-23-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-24-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-24-thumb.dat
index 9a1756e8473b..9a1756e8473b 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-24-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-24-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-25-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-25-thumb.dat
index c2fd6a739644..c2fd6a739644 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-25-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-25-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-26-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-26-thumb.dat
index 2cc155d8071c..2cc155d8071c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-26-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-26-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-27-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-27-thumb.dat
index 0b35377b08ee..0b35377b08ee 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-27-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-27-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-28-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-28-thumb.dat
index f7d7778a2512..f7d7778a2512 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-28-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-28-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-29-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-29-thumb.dat
index 5e9098f99d2f..5e9098f99d2f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-29-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-29-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-arm.dat
index 1fe7155bd3a3..1fe7155bd3a3 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-thumb.dat
index 8ce129682bf9..8ce129682bf9 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-30-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-30-thumb.dat
index a0dddad6b5a1..a0dddad6b5a1 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-30-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-30-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-31-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-31-thumb.dat
index 20d8dc7c06f6..20d8dc7c06f6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-31-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-31-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-arm.dat
index 8ef83b268055..8ef83b268055 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-thumb.dat
index f854ba26641e..f854ba26641e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-arm.dat
index ee85779083f6..ee85779083f6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-thumb.dat
index d6140bdb92d7..d6140bdb92d7 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-5-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-5-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-arm.dat
index 863a6d3e9bd8..863a6d3e9bd8 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-thumb.dat
index fac96bf5a5a8..fac96bf5a5a8 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-6-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-6-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-7-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-7-thumb.dat
index c537d30cb249..c537d30cb249 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-7-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-7-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-8-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-8-thumb.dat
index b724c79a0d56..b724c79a0d56 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-8-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-8-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-9-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-9-thumb.dat
index ccf7ea6c3423..ccf7ea6c3423 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mov-9-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mov-9-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-moveq-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-moveq-1-arm.dat
index f46b1bfd6e87..f46b1bfd6e87 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-moveq-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-moveq-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-movs-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-movs-1-arm.dat
index 38292508d43c..38292508d43c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-movs-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-movs-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-arm.dat
index 024dd9fa4bcb..024dd9fa4bcb 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-thumb.dat
index c5c385c8522d..c5c385c8522d 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-arm.dat
index 10df542fcad5..10df542fcad5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-thumb.dat
index 3c2f6f4da279..3c2f6f4da279 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-arm.dat
index 742708978b6d..742708978b6d 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-thumb.dat
index ff4ca7331a9f..ff4ca7331a9f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-arm.dat
index 4efc18cc5f28..4efc18cc5f28 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-thumb.dat
index f8b1569e9063..f8b1569e9063 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-mvn-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-mvn-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-arm.dat
index 07163f80aeb6..07163f80aeb6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-thumb.dat
index fad6765be9a8..fad6765be9a8 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-arm.dat
index 4b6ae43ca285..4b6ae43ca285 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-thumb.dat
index 9f3efe57e9d2..9f3efe57e9d2 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-3-thumb.dat
index a2adc418c4a5..a2adc418c4a5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-pop-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-pop-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-arm.dat
index b2f6e0965ab9..b2f6e0965ab9 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-thumb.dat
index 6f5b29ed1990..6f5b29ed1990 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-arm.dat
index 6f1f4389e80e..6f1f4389e80e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-thumb.dat
index 23e4df446bf4..23e4df446bf4 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-arm.dat
index 06847a5ff3ba..06847a5ff3ba 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-thumb.dat
index e3330f537cb6..e3330f537cb6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-push-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-push-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-arm.dat
index 70a5be3cb69c..70a5be3cb69c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-thumb.dat
index 3559652ce6c1..3559652ce6c1 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-arm.dat
index 3d77724b4f96..3d77724b4f96 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-thumb.dat
index 73e8cd3e548e..73e8cd3e548e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-arm.dat
index 97c90a0050c3..97c90a0050c3 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-thumb.dat
index 8e891c042879..8e891c042879 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-arm.dat
index ed3b54eaf38a..ed3b54eaf38a 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-thumb.dat
index ec9e2dc1e549..ec9e2dc1e549 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-5-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-5-arm.dat
index 98b8dfb16b37..98b8dfb16b37 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-str-5-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-str-5-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-1-arm.dat
index 2f7320d007ad..2f7320d007ad 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-2-arm.dat
index 495c8e720a11..495c8e720a11 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strb-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strb-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strbt-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strbt-1-arm.dat
index 494c49af9527..494c49af9527 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strbt-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strbt-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strd-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strd-1-thumb.dat
index 4876f8741b0e..4876f8741b0e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strd-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strd-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strt-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strt-1-arm.dat
index 9fc311565eaa..9fc311565eaa 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-strt-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-strt-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-arm.dat
index 98c435d616a5..98c435d616a5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-thumb.dat
index 482480d0cd43..482480d0cd43 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-10-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-10-arm.dat
index 9f07a947f7db..9f07a947f7db 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-10-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-10-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-arm.dat
index 9a67268196e2..9a67268196e2 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-thumb.dat
index 11d213803e2e..11d213803e2e 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-arm.dat
index 4dfe680ce470..4dfe680ce470 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-thumb.dat
index a017f5284302..a017f5284302 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-arm.dat
index 50d13c994755..50d13c994755 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-thumb.dat
index 214808d6a429..214808d6a429 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-arm.dat
index 58de27b5d4e2..58de27b5d4e2 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-thumb.dat
index 126882866859..126882866859 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-5-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-5-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-arm.dat
index be6891307dbe..be6891307dbe 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-thumb.dat
index d48c42eb8d8c..d48c42eb8d8c 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-6-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-6-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-8-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-8-arm.dat
index 21b17dfbcd80..21b17dfbcd80 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-8-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-8-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-9-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-9-arm.dat
index 06888ad3a4b7..06888ad3a4b7 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-sub-9-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-sub-9-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-arm.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-arm.dat
index 856a55749b18..856a55749b18 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-arm.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-arm.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-thumb.dat
index 63aa7b8ed13f..63aa7b8ed13f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-10-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-10-thumb.dat
index 75938b4e1d5b..75938b4e1d5b 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-10-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-10-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-2-thumb.dat
index 74bddcea97cb..74bddcea97cb 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-3-thumb.dat
index 965ebf370176..965ebf370176 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-4-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-4-thumb.dat
index 068724170d57..068724170d57 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-4-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-4-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-5-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-5-thumb.dat
index 72ed2ef25c0f..72ed2ef25c0f 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-5-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-5-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-6-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-6-thumb.dat
index 67133b2832e5..67133b2832e5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-6-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-6-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-8-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-8-thumb.dat
index 965ebf370176..965ebf370176 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-8-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-8-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-9-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-9-thumb.dat
index ea1597743162..ea1597743162 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-subs-9-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-subs-9-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-1-thumb.dat
index 22dd9d88b4b6..22dd9d88b4b6 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-2-thumb.dat
index e69cd9eef2d5..e69cd9eef2d5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-3-thumb.dat
index 375a92eaaab5..375a92eaaab5 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpop-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpop-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-1-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-1-thumb.dat
index ac4ef56be665..ac4ef56be665 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-1-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-1-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-2-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-2-thumb.dat
index 58055d6539ce..58055d6539ce 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-2-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-2-thumb.dat
diff --git a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-3-thumb.dat b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-3-thumb.dat
index 2658b43bc883..2658b43bc883 100644
--- a/packages/Python/lldbsuite/test/arm_emulation/new-test-files/test-vpush-3-thumb.dat
+++ b/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-vpush-3-thumb.dat
diff --git a/packages/Python/lldbsuite/test/decorators.py b/packages/Python/lldbsuite/test/decorators.py
index 2a36ee4b3707..95455f715cdc 100644
--- a/packages/Python/lldbsuite/test/decorators.py
+++ b/packages/Python/lldbsuite/test/decorators.py
@@ -505,13 +505,6 @@ def skipIfRemote(func):
return skipTestIfFn(is_remote)(func)
-def skipIfRemoteDueToDeadlock(func):
- """Decorate the item to skip tests if testing remotely due to the test deadlocking."""
- def is_remote():
- return "skip on remote platform (deadlocks)" if lldb.remote_platform else None
- return skipTestIfFn(is_remote)(func)
-
-
def skipIfNoSBHeaders(func):
"""Decorate the item to mark tests that should be skipped when LLDB is built with no SB API headers."""
def are_sb_headers_missing():
@@ -545,6 +538,23 @@ def skipIfiOSSimulator(func):
return "skip on the iOS Simulator" if configuration.lldb_platform_name == 'ios-simulator' else None
return skipTestIfFn(is_ios_simulator)(func)
+def skipIfiOS(func):
+ return skipIfPlatform(["ios"])(func)
+
+def skipIftvOS(func):
+ return skipIfPlatform(["tvos"])(func)
+
+def skipIfwatchOS(func):
+ return skipIfPlatform(["watchos"])(func)
+
+def skipIfbridgeOS(func):
+ return skipIfPlatform(["bridgeos"])(func)
+
+def skipIfDarwinEmbedded(func):
+ """Decorate the item to skip tests that should be skipped on Darwin armv7/arm64 targets."""
+ return skipIfPlatform(
+ lldbplatform.translate(
+ lldbplatform.darwin_embedded))(func)
def skipIfFreeBSD(func):
"""Decorate the item to skip tests that should be skipped on FreeBSD."""
diff --git a/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py b/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
index 8c5fedf58abc..eb3b0bbf8851 100644
--- a/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
+++ b/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
@@ -30,8 +30,5 @@ class SequenceFunctionsTestCase(unittest.TestCase):
for element in random.sample(self.seq, 5):
self.assertTrue(element in self.seq)
- def getCategories(self):
- return []
-
if __name__ == '__main__':
unittest.main()
diff --git a/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile b/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
index 7df664ac43e3..8a7102e347af 100644
--- a/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
+++ b/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/expression_command/call-function/Makefile b/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
index d4b82b3db276..9d4f3b7f1412 100644
--- a/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
+++ b/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
@@ -2,13 +2,6 @@ LEVEL = ../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
clean::
diff --git a/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py b/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
index 6645692f93ee..16736f798528 100644
--- a/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
+++ b/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
@@ -26,9 +26,6 @@ class ExprCommandCallFunctionTestCase(TestBase):
@expectedFailureAll(
compiler="icc",
bugnumber="llvm.org/pr14437, fails with ICC 13.1")
- @expectedFailureAll(
- oslist=['freebsd'],
- bugnumber='llvm.org/pr17807 Fails on FreeBSD buildbot')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_with(self):
"""Test calling std::String member function."""
@@ -47,5 +44,13 @@ class ExprCommandCallFunctionTestCase(TestBase):
# Calling this function now succeeds, but we follow the typedef return type through to
# const char *, and thus don't invoke the Summary formatter.
- self.expect("print str.c_str()",
- substrs=['Hello world'])
+
+ # clang's libstdc++ on ios arm64 inlines std::string::c_str() always;
+ # skip this part of the test.
+ triple = self.dbg.GetSelectedPlatform().GetTriple()
+ do_cstr_test = True
+ if triple == "arm64-apple-ios" or triple == "arm64-apple-tvos" or triple == "armv7k-apple-watchos" or triple == "arm64-apple-bridgeos":
+ do_cstr_test = False
+ if do_cstr_test:
+ self.expect("print str.c_str()",
+ substrs=['Hello world'])
diff --git a/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py b/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
index 74991999d926..445979f5c701 100644
--- a/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ b/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -58,7 +58,10 @@ class ExprCharTestCase(TestBase):
@expectedFailureAll(
archs=[
"i[3-6]86",
- "x86_64"],
+ "x86_64",
+ "arm64",
+ 'armv7',
+ 'armv7k'],
bugnumber="llvm.org/pr23069, <rdar://problem/28721938>")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
@expectedFailureAll(triple='mips*', bugnumber="llvm.org/pr23069")
diff --git a/packages/Python/lldbsuite/test/expression_command/fixits/Makefile b/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
index 7df664ac43e3..8a7102e347af 100644
--- a/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
+++ b/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py b/packages/Python/lldbsuite/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py
index b99fb727e8a5..e6c9d43adf04 100644
--- a/packages/Python/lldbsuite/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py
+++ b/packages/Python/lldbsuite/test/expression_command/persist_objc_pointeetype/TestPersistObjCPointeeType.py
@@ -22,10 +22,8 @@ class PersistObjCPointeeType(TestBase):
self.line = line_number('main.m', '// break here')
@skipUnlessDarwin
- @expectedFailureAll(
- bugnumber='http://llvm.org/pr23504',
- oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0'])
@skipIf(archs=["i386", "i686"])
+ @skipIf(debug_info="gmodules", archs=['arm64', 'armv7', 'armv7k']) # compile error with gmodules for iOS
def test_with(self):
"""Test that we can p *objcObject"""
self.build()
diff --git a/packages/Python/lldbsuite/test/expression_command/po_verbosity/Makefile b/packages/Python/lldbsuite/test/expression_command/po_verbosity/Makefile
index 4464e2ee9f5c..b6592745356d 100644
--- a/packages/Python/lldbsuite/test/expression_command/po_verbosity/Makefile
+++ b/packages/Python/lldbsuite/test/expression_command/po_verbosity/Makefile
@@ -3,4 +3,4 @@ LEVEL = ../../make
OBJC_SOURCES := main.m
include $(LEVEL)/Makefile.rules
-LDFLAGS += -framework Cocoa
+LDFLAGS += -framework Foundation
diff --git a/packages/Python/lldbsuite/test/expression_command/po_verbosity/main.m b/packages/Python/lldbsuite/test/expression_command/po_verbosity/main.m
index 3dbb024b2809..9c79f850bf28 100644
--- a/packages/Python/lldbsuite/test/expression_command/po_verbosity/main.m
+++ b/packages/Python/lldbsuite/test/expression_command/po_verbosity/main.m
@@ -1,4 +1,4 @@
-#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
int main()
{
diff --git a/packages/Python/lldbsuite/test/expression_command/top-level/Makefile b/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
index 7146f227b98a..48eec5c5d268 100644
--- a/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
+++ b/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
@@ -1,12 +1,13 @@
LEVEL = ../../make
-default: a.out dummy
-
CXX_SOURCES := main.cpp test.cpp
-dummy: dummy.cpp
+include $(LEVEL)/Makefile.rules
-clean::
- rm -rf dummy dummy.dSYM
+a.out: dummy
-include $(LEVEL)/Makefile.rules
+dummy:
+ $(MAKE) -f dummy.mk
+
+clean::
+ $(MAKE) -f dummy.mk clean
diff --git a/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py b/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
index 137c40398870..dfe95a1a9fa7 100644
--- a/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
+++ b/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
@@ -57,23 +57,6 @@ class TopLevelExpressionsTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(api_levels=[21, 22], bugnumber="llvm.org/pr27787")
- @expectedFailureAll(
- oslist=["linux"],
- archs=[
- "arm",
- "aarch64"],
- bugnumber="llvm.org/pr27787")
- @expectedFailureAll(
- bugnumber="llvm.org/pr28353",
- oslist=["linux"],
- archs=[
- "i386",
- "x86_64"],
- compiler="gcc",
- compiler_version=[
- "<",
- "4.9"])
@skipIf(debug_info="gmodules") # not relevant
@skipIf(oslist=["windows"]) # Error in record layout on Windows
def test_top_level_expressions(self):
diff --git a/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
index 31204b21d972..fa49bd4bda7e 100644
--- a/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
+++ b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
@@ -1,7 +1,15 @@
#include <stdio.h>
-int main()
-{
- printf("This is a dummy\n"); // Set breakpoint here
- return 0;
+// These are needed to make sure that the linker does not strip the parts of the
+// C++ abi library that are necessary to execute the expressions in the
+// debugger. It would be great if we did not need to do this, but the fact that
+// LLDB cannot conjure up the abi library on demand is not relevant for testing
+// top level expressions.
+struct DummyA {};
+struct DummyB : public virtual DummyA {};
+
+int main() {
+ DummyB b;
+ printf("This is a dummy\n"); // Set breakpoint here
+ return 0;
}
diff --git a/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk
new file mode 100644
index 000000000000..af97678b2cf5
--- /dev/null
+++ b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+CXX_SOURCES := dummy.cpp
+EXE := dummy
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
index 867b6053a570..a4e3948e81ca 100644
--- a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
+++ b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -34,6 +34,7 @@ class AvoidsFdLeakTestCase(TestBase):
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_basic(self):
self.do_test([])
@@ -45,6 +46,7 @@ class AvoidsFdLeakTestCase(TestBase):
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_log(self):
self.do_test(["log enable -f '/dev/null' lldb commands"])
@@ -76,6 +78,7 @@ class AvoidsFdLeakTestCase(TestBase):
# here.
@skipIfWindows
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch
def test_fd_leak_multitarget(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
new file mode 100644
index 000000000000..6067ee45e984
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+CFLAGS_EXTRAS += -std=c99
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
new file mode 100644
index 000000000000..9630e39e0142
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py
@@ -0,0 +1,104 @@
+"""
+Test that the breakpoint auto-continue flag works correctly.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class BreakpointAutoContinue(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_breakpoint_auto_continue(self):
+ """Make sure the auto continue continues with no other complications"""
+ self.build()
+ self.simple_auto_continue()
+
+ def test_auto_continue_with_command(self):
+ """Add a command, make sure the command gets run"""
+ self.build()
+ self.auto_continue_with_command()
+
+ def test_auto_continue_on_location(self):
+ """Set auto-continue on a location and make sure only that location continues"""
+ self.build()
+ self.auto_continue_location()
+
+ def make_target_and_bkpt(self, additional_options=None, num_expected_loc=1,
+ pattern="Set a breakpoint here"):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target.IsValid(), "Target is not valid")
+
+ extra_options_txt = "--auto-continue 1 "
+ if additional_options:
+ extra_options_txt += additional_options
+ bpno = lldbutil.run_break_set_by_source_regexp(self, pattern,
+ extra_options = extra_options_txt,
+ num_expected_locations = num_expected_loc)
+ return bpno
+
+ def launch_it (self, expected_state):
+ error = lldb.SBError()
+ launch_info = lldb.SBLaunchInfo(None)
+ launch_info.SetWorkingDirectory(self.get_process_working_directory())
+
+ process = self.target.Launch(launch_info, error)
+ self.assertTrue(error.Success(), "Launch failed.")
+
+ state = process.GetState()
+ self.assertEqual(state, expected_state, "Didn't get expected state")
+
+ return process
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ def simple_auto_continue(self):
+ bpno = self.make_target_and_bkpt()
+ process = self.launch_it(lldb.eStateExited)
+
+ bkpt = self.target.FindBreakpointByID(bpno)
+ self.assertEqual(bkpt.GetHitCount(), 2, "Should have run through the breakpoint twice")
+
+ def auto_continue_with_command(self):
+ bpno = self.make_target_and_bkpt("-N BKPT -C 'break modify --auto-continue 0 BKPT'")
+ process = self.launch_it(lldb.eStateStopped)
+ state = process.GetState()
+ self.assertEqual(state, lldb.eStateStopped, "Process should be stopped")
+ bkpt = self.target.FindBreakpointByID(bpno)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)
+ self.assertEqual(len(threads), 1, "There was a thread stopped at our breakpoint")
+ self.assertEqual(bkpt.GetHitCount(), 2, "Should have hit the breakpoint twice")
+
+ def auto_continue_location(self):
+ bpno = self.make_target_and_bkpt(pattern="Set a[^ ]* breakpoint here", num_expected_loc=2)
+ bkpt = self.target.FindBreakpointByID(bpno)
+ bkpt.SetAutoContinue(False)
+
+ loc = lldb.SBBreakpointLocation()
+ for i in range(0,2):
+ func_name = bkpt.location[i].GetAddress().function.name
+ if func_name == "main":
+ loc = bkpt.location[i]
+
+ self.assertTrue(loc.IsValid(), "Didn't find a location in main")
+ loc.SetAutoContinue(True)
+
+ process = self.launch_it(lldb.eStateStopped)
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)
+ self.assertEqual(len(threads), 1, "Didn't get one thread stopped at our breakpoint")
+ func_name = threads[0].frame[0].function.name
+ self.assertEqual(func_name, "call_me")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c
new file mode 100644
index 000000000000..a37f05e0290a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+void
+call_me()
+{
+ printf("Set another breakpoint here.\n");
+}
+
+int
+main()
+{
+ int change_me = 0;
+ for (int i = 0; i < 2; i++)
+ {
+ printf ("Set a breakpoint here: %d with: %d.\n", i, change_me);
+ }
+ call_me();
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index e67a6332d9d2..386eafbb0b60 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -24,12 +24,21 @@ class BreakpointCommandTestCase(TestBase):
cls.RemoveTempFile("output2.txt")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
- def test(self):
+ def test_breakpoint_command_sequence(self):
"""Test a sequence of breakpoint command add, list, and delete."""
self.build()
self.breakpoint_command_sequence()
+
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+ def test_script_parameters(self):
+ """Test a sequence of breakpoint command add, list, and delete."""
+ self.build()
self.breakpoint_command_script_parameters()
+ def test_commands_on_creation(self):
+ self.build()
+ self.breakpoint_commands_on_creation()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -268,3 +277,23 @@ class BreakpointCommandTestCase(TestBase):
# Now remove 'output-2.txt'
os.remove('output-2.txt')
+
+ def breakpoint_commands_on_creation(self):
+ """Test that setting breakpoint commands when creating the breakpoint works"""
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target.IsValid(), "Created an invalid target.")
+
+ # Add a breakpoint.
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True,
+ extra_options='-C bt -C "thread list" -C continue')
+
+ bkpt = target.FindBreakpointByID(1)
+ self.assertTrue(bkpt.IsValid(), "Couldn't find breakpoint 1")
+ com_list = lldb.SBStringList()
+ bkpt.GetCommandLineCommands(com_list)
+ self.assertEqual(com_list.GetSize(), 3, "Got the wrong number of commands")
+ self.assertEqual(com_list.GetStringAtIndex(0), "bt", "First bt")
+ self.assertEqual(com_list.GetStringAtIndex(1), "thread list", "Next thread list")
+ self.assertEqual(com_list.GetStringAtIndex(2), "continue", "Last continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
new file mode 100644
index 000000000000..5d7b6f9169ad
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
@@ -0,0 +1,109 @@
+"""
+Test breakpoint hit count features.
+"""
+
+from __future__ import print_function
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class BreakpointHitCountTestCase(TestBase):
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @add_test_categories(['pyapi'])
+ def test_breakpoint_location_hit_count(self):
+ """Use Python APIs to check breakpoint hit count."""
+ self.build()
+ self.do_test_breakpoint_location_hit_count()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ self.a_int_body_line_no = line_number(
+ 'main.cpp', '// Breakpoint Location 1')
+ self.a_float_body_line_no = line_number(
+ 'main.cpp', '// Breakpoint Location 2')
+
+ def do_test_breakpoint_location_hit_count(self):
+ """Use Python APIs to check breakpoint hit count."""
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Create a breakpoint in main.cpp by name 'a',
+ # there should be two locations.
+ breakpoint = target.BreakpointCreateByName('a', 'a.out')
+ self.assertTrue(breakpoint and
+ breakpoint.GetNumLocations() == 2,
+ VALID_BREAKPOINT)
+
+ # Verify all breakpoint locations are enabled.
+ location1 = breakpoint.GetLocationAtIndex(0)
+ self.assertTrue(location1 and
+ location1.IsEnabled(),
+ VALID_BREAKPOINT_LOCATION)
+
+ location2 = breakpoint.GetLocationAtIndex(1)
+ self.assertTrue(location2 and
+ location2.IsEnabled(),
+ VALID_BREAKPOINT_LOCATION)
+
+ # Launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # Verify 1st breakpoint location is hit.
+ from lldbsuite.test.lldbutil import get_stopped_thread
+ thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
+
+ frame0 = thread.GetFrameAtIndex(0)
+ location1 = breakpoint.FindLocationByAddress(frame0.GetPC())
+ self.assertTrue(
+ frame0.GetLineEntry().GetLine() == self.a_int_body_line_no,
+ "Stopped in int a(int)")
+ self.assertTrue(location1)
+ self.assertEqual(location1.GetHitCount(), 1)
+ self.assertEqual(breakpoint.GetHitCount(), 1)
+
+ process.Continue()
+
+ # Verify 2nd breakpoint location is hit.
+ thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
+
+ frame0 = thread.GetFrameAtIndex(0)
+ location2 = breakpoint.FindLocationByAddress(frame0.GetPC())
+ self.assertTrue(
+ frame0.GetLineEntry().GetLine() == self.a_float_body_line_no,
+ "Stopped in float a(float)")
+ self.assertTrue(location2)
+ self.assertEqual(location2.GetHitCount(), 1)
+ self.assertEqual(location1.GetHitCount(), 1)
+ self.assertEqual(breakpoint.GetHitCount(), 2)
+
+ process.Continue()
+
+ # Verify 2nd breakpoint location is hit again.
+ thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
+
+ self.assertEqual(location2.GetHitCount(), 2)
+ self.assertEqual(location1.GetHitCount(), 1)
+ self.assertEqual(breakpoint.GetHitCount(), 3)
+
+ process.Continue()
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp
new file mode 100644
index 000000000000..333e9b6405a7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp
@@ -0,0 +1,27 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int a(int val)
+{
+ return val; // Breakpoint Location 1
+}
+
+float a(float val)
+{
+ return val; // Breakpoint Location 2
+}
+
+int main (int argc, char const *argv[])
+{
+ int A1 = a(1);
+ float A2 = a(2.0f);
+ float A3 = a(3.0f);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index fdbd622f767b..de24d8b002d7 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -18,27 +18,40 @@ class BreakpointLocationsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
- def test(self):
+ def test_enable(self):
"""Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
self.build()
self.breakpoint_locations_test()
+ def test_shadowed_cond_options(self):
+ """Test that options set on the breakpoint and location behave correctly."""
+ self.build()
+ self.shadowed_bkpt_cond_test()
+
+
+ def test_shadowed_command_options(self):
+ """Test that options set on the breakpoint and location behave correctly."""
+ self.build()
+ self.shadowed_bkpt_command_test()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- def breakpoint_locations_test(self):
- """Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
+ def set_breakpoint (self):
exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, "Target %s is not valid"%(exe))
# This should create a breakpoint with 3 locations.
- lldbutil.run_break_set_by_file_and_line(
- self, "main.c", self.line, num_expected_locations=3)
+
+ bkpt = target.BreakpointCreateByLocation("main.c", self.line)
# The breakpoint list should show 3 locations.
+ self.assertEqual(bkpt.GetNumLocations(), 3, "Wrong number of locations")
+
self.expect(
"breakpoint list -f",
"Breakpoint locations shown correctly",
@@ -49,6 +62,87 @@ class BreakpointLocationsTestCase(TestBase):
"where = a.out`func_inlined .+unresolved, hit count = 0",
"where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
+ return bkpt
+
+ def shadowed_bkpt_cond_test(self):
+ """Test that options set on the breakpoint and location behave correctly."""
+ # Breakpoint option propagation from bkpt to loc used to be done the first time
+ # a breakpoint location option was specifically set. After that the other options
+ # on that location would stop tracking the breakpoint. That got fixed, and this test
+ # makes sure only the option touched is affected.
+
+ bkpt = self.set_breakpoint()
+ bkpt_cond = "1 == 0"
+ bkpt.SetCondition(bkpt_cond)
+ self.assertEqual(bkpt.GetCondition(), bkpt_cond,"Successfully set condition")
+ self.assertTrue(bkpt.location[0].GetCondition() == bkpt.GetCondition(), "Conditions are the same")
+
+ # Now set a condition on the locations, make sure that this doesn't effect the bkpt:
+ bkpt_loc_1_cond = "1 == 1"
+ bkpt.location[0].SetCondition(bkpt_loc_1_cond)
+ self.assertEqual(bkpt.location[0].GetCondition(), bkpt_loc_1_cond, "Successfully changed location condition")
+ self.assertNotEqual(bkpt.GetCondition(), bkpt_loc_1_cond, "Changed location changed Breakpoint condition")
+ self.assertEqual(bkpt.location[1].GetCondition(), bkpt_cond, "Changed another location's condition")
+
+ # Now make sure that setting one options doesn't fix the value of another:
+ bkpt.SetIgnoreCount(10)
+ self.assertEqual(bkpt.GetIgnoreCount(), 10, "Set the ignore count successfully")
+ self.assertEqual(bkpt.location[0].GetIgnoreCount(), 10, "Location doesn't track top-level bkpt.")
+
+ # Now make sure resetting the condition to "" resets the tracking:
+ bkpt.location[0].SetCondition("")
+ bkpt_new_cond = "1 == 3"
+ bkpt.SetCondition(bkpt_new_cond)
+ self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, "Didn't go back to tracking condition")
+
+ def shadowed_bkpt_command_test(self):
+ """Test that options set on the breakpoint and location behave correctly."""
+ # Breakpoint option propagation from bkpt to loc used to be done the first time
+ # a breakpoint location option was specifically set. After that the other options
+ # on that location would stop tracking the breakpoint. That got fixed, and this test
+ # makes sure only the option touched is affected.
+
+ bkpt = self.set_breakpoint()
+ commands = ["AAAAAA", "BBBBBB", "CCCCCC"]
+ str_list = lldb.SBStringList()
+ str_list.AppendList(commands, len(commands))
+
+ bkpt.SetCommandLineCommands(str_list)
+ cmd_list = lldb.SBStringList()
+ bkpt.GetCommandLineCommands(cmd_list)
+ list_size = str_list.GetSize()
+ self.assertEqual(cmd_list.GetSize() , list_size, "Added the right number of commands")
+ for i in range(0,list_size):
+ self.assertEqual(str_list.GetStringAtIndex(i), cmd_list.GetStringAtIndex(i), "Mismatched commands.")
+
+ commands = ["DDDDDD", "EEEEEE", "FFFFFF", "GGGGGG"]
+ loc_list = lldb.SBStringList()
+ loc_list.AppendList(commands, len(commands))
+ bkpt.location[1].SetCommandLineCommands(loc_list)
+ loc_cmd_list = lldb.SBStringList()
+ bkpt.location[1].GetCommandLineCommands(loc_cmd_list)
+
+ loc_list_size = loc_list.GetSize()
+
+ # Check that the location has the right commands:
+ self.assertEqual(loc_cmd_list.GetSize() , loc_list_size, "Added the right number of commands to location")
+ for i in range(0,loc_list_size):
+ self.assertEqual(loc_list.GetStringAtIndex(i), loc_cmd_list.GetStringAtIndex(i), "Mismatched commands.")
+
+ # Check that we didn't mess up the breakpoint level commands:
+ self.assertEqual(cmd_list.GetSize() , list_size, "Added the right number of commands")
+ for i in range(0,list_size):
+ self.assertEqual(str_list.GetStringAtIndex(i), cmd_list.GetStringAtIndex(i), "Mismatched commands.")
+
+ # And check we didn't mess up another location:
+ untouched_loc_cmds = lldb.SBStringList()
+ bkpt.location[0].GetCommandLineCommands(untouched_loc_cmds)
+ self.assertEqual(untouched_loc_cmds.GetSize() , 0, "Changed the wrong location")
+
+ def breakpoint_locations_test(self):
+ """Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
+ self.set_breakpoint()
+
# The 'breakpoint disable 3.*' command should fail gracefully.
self.expect("breakpoint disable 3.*",
"Disabling an invalid breakpoint should fail gracefully",
@@ -80,7 +174,7 @@ class BreakpointLocationsTestCase(TestBase):
"1 breakpoint locatons disabled correctly",
startstr="1 breakpoints disabled.")
- # Run the program againt. We should stop on the two breakpoint
+ # Run the program again. We should stop on the two breakpoint
# locations.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
index cc31ef80e8a3..b95d2cea550a 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -17,6 +17,7 @@ from lldbsuite.test import lldbutil
class BreakpointNames(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
@add_test_categories(['pyapi'])
def test_setting_names(self):
@@ -37,6 +38,25 @@ class BreakpointNames(TestBase):
self.setup_target()
self.do_check_using_names()
+ def test_configuring_names(self):
+ """Use Python APIs to test that configuring options on breakpoint names works correctly."""
+ self.build()
+ self.make_a_dummy_name()
+ self.setup_target()
+ self.do_check_configuring_names()
+
+ def test_configuring_permissions_sb(self):
+ """Use Python APIs to test that configuring permissions on names works correctly."""
+ self.build()
+ self.setup_target()
+ self.do_check_configuring_permissions_sb()
+
+ def test_configuring_permissions_cli(self):
+ """Use Python APIs to test that configuring permissions on names works correctly."""
+ self.build()
+ self.setup_target()
+ self.do_check_configuring_permissions_cli()
+
def setup_target(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -45,10 +65,36 @@ class BreakpointNames(TestBase):
self.assertTrue(self.target, VALID_TARGET)
self.main_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "main.c"))
+ def check_name_in_target(self, bkpt_name):
+ name_list = lldb.SBStringList()
+ self.target.GetBreakpointNames(name_list)
+ found_it = False
+ for name in name_list:
+ if name == bkpt_name:
+ found_it = True
+ break
+ self.assertTrue(found_it, "Didn't find the name %s in the target's name list:"%(bkpt_name))
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
+ # These are the settings we're going to be putting into names & breakpoints:
+ self.bp_name_string = "ABreakpoint"
+ self.is_one_shot = True
+ self.ignore_count = 1000
+ self.condition = "1 == 2"
+ self.auto_continue = True
+ self.tid = 0xaaaa
+ self.tidx = 10
+ self.thread_name = "Fooey"
+ self.queue_name = "Blooey"
+ self.cmd_list = lldb.SBStringList()
+ self.cmd_list.AppendString("frame var")
+ self.cmd_list.AppendString("bt")
+ self.help_string = "I do something interesting"
+
+
def do_check_names(self):
"""Use Python APIs to check that we can set & retrieve breakpoint names"""
bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
@@ -66,11 +112,15 @@ class BreakpointNames(TestBase):
matches = bkpt.MatchesName("NotABreakpoint")
self.assertTrue(not matches, "We matched a name we didn't set.")
+ # Make sure the name is also in the target:
+ self.check_name_in_target(bkpt_name)
+
# Add another name, make sure that works too:
bkpt.AddName(other_bkpt_name)
matches = bkpt.MatchesName(bkpt_name)
self.assertTrue(matches, "Adding a name means we didn't match the name we just set")
+ self.check_name_in_target(other_bkpt_name)
# Remove the name and make sure we no longer match it:
bkpt.RemoveName(bkpt_name)
@@ -89,26 +139,21 @@ class BreakpointNames(TestBase):
def do_check_illegal_names(self):
"""Use Python APIs to check that we reject illegal names."""
bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
- success = bkpt.AddName("-CantStartWithADash")
- self.assertTrue(not success,"We allowed a name starting with a dash.")
-
- success = bkpt.AddName("1CantStartWithANumber")
- self.assertTrue(not success, "We allowed a name starting with a number.")
-
- success = bkpt.AddName("^CantStartWithNonAlpha")
- self.assertTrue(not success, "We allowed a name starting with an ^.")
+ bad_names = ["-CantStartWithADash",
+ "1CantStartWithANumber",
+ "^CantStartWithNonAlpha",
+ "CantHave-ADash",
+ "Cant Have Spaces"]
+ for bad_name in bad_names:
+ success = bkpt.AddName(bad_name)
+ self.assertTrue(not success,"We allowed an illegal name: %s"%(bad_name))
+ bp_name = lldb.SBBreakpointName(self.target, bad_name)
+ self.assertFalse(bp_name.IsValid(), "We made a breakpoint name with an illegal name: %s"%(bad_name));
- success = bkpt.AddName("CantHave-ADash")
- self.assertTrue(not success, "We allowed a name with a dash in it.")
+ retval =lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("break set -n whatever -N '%s'"%(bad_name), retval)
+ self.assertTrue(not retval.Succeeded(), "break set succeeded with: illegal name: %s"%(bad_name))
- success = bkpt.AddName("Cant Have Spaces")
- self.assertTrue(not success, "We allowed a name with spaces.")
-
- # Check from the command line as well:
- retval =lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand("break set -n whatever -N has-dashes", retval)
- self.assertTrue(not retval.Succeeded(), "break set succeeded with: illegal name")
-
def do_check_using_names(self):
"""Use Python APIs to check names work in place of breakpoint ID's."""
@@ -133,9 +178,190 @@ class BreakpointNames(TestBase):
self.assertTrue(not bkpt.IsEnabled(), "We didn't disable the breakpoint.")
# Also make sure we don't apply commands to non-matching names:
- self.dbg.GetCommandInterpreter().HandleCommand("break modify --one-shot 1 %s"%(bkpt_name), retval)
+ self.dbg.GetCommandInterpreter().HandleCommand("break modify --one-shot 1 %s"%(other_bkpt_name), retval)
self.assertTrue(retval.Succeeded(), "break modify failed with: %s."%(retval.GetError()))
self.assertTrue(not bkpt.IsOneShot(), "We applied one-shot to the wrong breakpoint.")
+ def check_option_values(self, bp_object):
+ self.assertEqual(bp_object.IsOneShot(), self.is_one_shot, "IsOneShot")
+ self.assertEqual(bp_object.GetIgnoreCount(), self.ignore_count, "IgnoreCount")
+ self.assertEqual(bp_object.GetCondition(), self.condition, "Condition")
+ self.assertEqual(bp_object.GetAutoContinue(), self.auto_continue, "AutoContinue")
+ self.assertEqual(bp_object.GetThreadID(), self.tid, "Thread ID")
+ self.assertEqual(bp_object.GetThreadIndex(), self.tidx, "Thread Index")
+ self.assertEqual(bp_object.GetThreadName(), self.thread_name, "Thread Name")
+ self.assertEqual(bp_object.GetQueueName(), self.queue_name, "Queue Name")
+ set_cmds = lldb.SBStringList()
+ bp_object.GetCommandLineCommands(set_cmds)
+ self.assertEqual(set_cmds.GetSize(), self.cmd_list.GetSize(), "Size of command line commands")
+ for idx in range(0, set_cmds.GetSize()):
+ self.assertEqual(self.cmd_list.GetStringAtIndex(idx), set_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
+ def make_a_dummy_name(self):
+ "This makes a breakpoint name in the dummy target to make sure it gets copied over"
+
+ dummy_target = self.dbg.GetDummyTarget()
+ self.assertTrue(dummy_target.IsValid(), "Dummy target was not valid.")
+
+ def cleanup ():
+ self.dbg.GetDummyTarget().DeleteBreakpointName(self.bp_name_string)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+
+ # Now find it in the dummy target, and make sure these settings took:
+ bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string)
+ # Make sure the name is right:
+ self.assertTrue (bp_name.GetName() == self.bp_name_string, "Wrong bp_name: %s"%(bp_name.GetName()))
+ bp_name.SetOneShot(self.is_one_shot)
+ bp_name.SetIgnoreCount(self.ignore_count)
+ bp_name.SetCondition(self.condition)
+ bp_name.SetAutoContinue(self.auto_continue)
+ bp_name.SetThreadID(self.tid)
+ bp_name.SetThreadIndex(self.tidx)
+ bp_name.SetThreadName(self.thread_name)
+ bp_name.SetQueueName(self.queue_name)
+ bp_name.SetCommandLineCommands(self.cmd_list)
+
+ # Now look it up again, and make sure it got set correctly.
+ bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string)
+ self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.")
+ self.check_option_values(bp_name)
+
+ def do_check_configuring_names(self):
+ """Use Python APIs to check that configuring breakpoint names works correctly."""
+ other_bp_name_string = "AnotherBreakpointName"
+ cl_bp_name_string = "CLBreakpointName"
+
+ # Now find the version copied in from the dummy target, and make sure these settings took:
+ bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
+ self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.")
+ self.check_option_values(bp_name)
+
+ # Now add this name to a breakpoint, and make sure it gets configured properly
+ bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ success = bkpt.AddName(self.bp_name_string)
+ self.assertTrue(success, "Couldn't add this name to the breakpoint")
+ self.check_option_values(bkpt)
+
+ # Now make a name from this breakpoint, and make sure the new name is properly configured:
+ new_name = lldb.SBBreakpointName(bkpt, other_bp_name_string)
+ self.assertTrue(new_name.IsValid(), "Couldn't make a valid bp_name from a breakpoint.")
+ self.check_option_values(bkpt)
+
+ # Now change the name's option and make sure it gets propagated to
+ # the breakpoint:
+ new_auto_continue = not self.auto_continue
+ bp_name.SetAutoContinue(new_auto_continue)
+ self.assertEqual(bp_name.GetAutoContinue(), new_auto_continue, "Couldn't change auto-continue on the name")
+ self.assertEqual(bkpt.GetAutoContinue(), new_auto_continue, "Option didn't propagate to the breakpoint.")
+ # Now make this same breakpoint name - but from the command line
+ cmd_str = "breakpoint name configure %s -o %d -i %d -c '%s' -G %d -t %d -x %d -T '%s' -q '%s' -H '%s'"%(cl_bp_name_string,
+ self.is_one_shot,
+ self.ignore_count,
+ self.condition,
+ self.auto_continue,
+ self.tid,
+ self.tidx,
+ self.thread_name,
+ self.queue_name,
+ self.help_string)
+ for cmd in self.cmd_list:
+ cmd_str += " -C '%s'"%(cmd)
+
+ self.runCmd(cmd_str, check=True)
+ # Now look up this name again and check its options:
+ cl_name = lldb.SBBreakpointName(self.target, cl_bp_name_string)
+ self.check_option_values(cl_name)
+ # Also check the help string:
+ self.assertEqual(self.help_string, cl_name.GetHelpString(), "Help string didn't match")
+ # Change the name and make sure that works:
+ new_help = "I do something even more interesting"
+ cl_name.SetHelpString(new_help)
+ self.assertEqual(new_help, cl_name.GetHelpString(), "SetHelpString didn't")
+
+ # We should have three names now, make sure the target can list them:
+ name_list = lldb.SBStringList()
+ self.target.GetBreakpointNames(name_list)
+ for name_string in [self.bp_name_string, other_bp_name_string, cl_bp_name_string]:
+ self.assertTrue(name_string in name_list, "Didn't find %s in names"%(name_string))
+
+ # Delete the name from the current target. Make sure that works and deletes the
+ # name from the breakpoint as well:
+ self.target.DeleteBreakpointName(self.bp_name_string)
+ name_list.Clear()
+ self.target.GetBreakpointNames(name_list)
+ self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from a real target"%(self.bp_name_string))
+ # Also make sure the name got removed from breakpoints holding it:
+ self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.")
+
+ # Test that deleting the name we injected into the dummy target works (there's also a
+ # cleanup that will do this, but that won't test the result...
+ dummy_target = self.dbg.GetDummyTarget()
+ dummy_target.DeleteBreakpointName(self.bp_name_string)
+ name_list.Clear()
+ dummy_target.GetBreakpointNames(name_list)
+ self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from the dummy target"%(self.bp_name_string))
+ # Also make sure the name got removed from breakpoints holding it:
+ self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.")
+ def check_permission_results(self, bp_name):
+ self.assertEqual(bp_name.GetAllowDelete(), False, "Didn't set allow delete.")
+ protected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ protected_id = protected_bkpt.GetID()
+
+ unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ unprotected_id = unprotected_bkpt.GetID()
+
+ success = protected_bkpt.AddName(self.bp_name_string)
+ self.assertTrue(success, "Couldn't add this name to the breakpoint")
+
+ self.target.DisableAllBreakpoints()
+ self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled")
+ self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabling.")
+
+ # Try from the command line too:
+ unprotected_bkpt.SetEnabled(True)
+ result = lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("break disable", result)
+ self.assertTrue(result.Succeeded())
+ self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled")
+ self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabling.")
+
+ self.target.DeleteAllBreakpoints()
+ bkpt = self.target.FindBreakpointByID(protected_id)
+ self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.")
+ bkpt = self.target.FindBreakpointByID(unprotected_id)
+ self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.")
+
+ # Remake the unprotected breakpoint and try again from the command line:
+ unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ unprotected_id = unprotected_bkpt.GetID()
+
+ self.dbg.GetCommandInterpreter().HandleCommand("break delete -f", result)
+ self.assertTrue(result.Succeeded())
+ bkpt = self.target.FindBreakpointByID(protected_id)
+ self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.")
+ bkpt = self.target.FindBreakpointByID(unprotected_id)
+ self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.")
+
+ def do_check_configuring_permissions_sb(self):
+ bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
+
+ # Make a breakpoint name with delete disallowed:
+ bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
+ self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name for valid name.")
+
+ bp_name.SetAllowDelete(False)
+ bp_name.SetAllowDisable(False)
+ bp_name.SetAllowList(False)
+ self.check_permission_results(bp_name)
+
+ def do_check_configuring_permissions_cli(self):
+ # Make the name with the right options using the command line:
+ self.runCmd("breakpoint name configure -L 0 -D 0 -A 0 %s"%(self.bp_name_string), check=True)
+ # Now look up the breakpoint we made, and check that it works.
+ bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
+ self.assertTrue(bp_name.IsValid(), "Didn't make a breakpoint name we could find.")
+ self.check_permission_results(bp_name)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
new file mode 100644
index 000000000000..801c1041bbe1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
@@ -0,0 +1,8 @@
+LEVEL = ../../../make
+
+DYLIB_NAME := foo
+DYLIB_CXX_SOURCES := foo.cpp
+CXX_SOURCES := main.cpp
+CFLAGS_EXTRAS := -fPIC
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
new file mode 100644
index 000000000000..4dfa03d5fab4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
@@ -0,0 +1,46 @@
+"""
+Test that we can hit breakpoints in global constructors
+"""
+
+from __future__ import print_function
+
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBreakpointInGlobalConstructors(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line_foo = line_number('foo.cpp', '// !BR_foo')
+ self.line_main = line_number('main.cpp', '// !BR_main')
+
+ @expectedFailureAll(bugnumber="llvm.org/pr35480", oslist=["linux"])
+ def test(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file %s" % exe)
+
+ bp_main = lldbutil.run_break_set_by_file_and_line(
+ self, 'main.cpp', self.line_main)
+ bp_foo = lldbutil.run_break_set_by_file_and_line(
+ self, 'foo.cpp', self.line_foo)
+
+ self.runCmd("run")
+
+ self.assertIsNotNone(
+ lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ self.process(), bp_foo))
+
+ self.runCmd("continue")
+
+ self.assertIsNotNone(
+ lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ self.process(), bp_main))
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
new file mode 100644
index 000000000000..f959a295467f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
@@ -0,0 +1,7 @@
+#include "foo.h"
+
+Foo::Foo() : x(42) {
+ bool some_code = x == 42; // !BR_foo
+}
+
+Foo FooObj;
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h
new file mode 100644
index 000000000000..3bc63fed7555
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h
@@ -0,0 +1,11 @@
+#ifndef FOO_H
+#define FOO_H
+
+struct LLDB_TEST_API Foo {
+ Foo();
+ int x;
+};
+
+extern LLDB_TEST_API Foo FooObj;
+
+#endif
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
new file mode 100644
index 000000000000..d1c8038dfadb
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
@@ -0,0 +1,14 @@
+#include "foo.h"
+
+struct Main {
+ Main();
+ int x;
+};
+
+Main::Main() : x(47) {
+ bool some_code = x == 47; // !BR_main
+}
+
+Main MainObj;
+
+int main() { return MainObj.x + FooObj.x; }
diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/.lldb b/packages/Python/lldbsuite/test/functionalities/command_source/.lldb
index c544523832e7..ecbdcff44626 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_source/.lldb
+++ b/packages/Python/lldbsuite/test/functionalities/command_source/.lldb
@@ -1 +1,2 @@
-script import my
+# one more level of indirection to stress the command interpreter reentrancy
+command source commands.txt
diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt b/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt
new file mode 100644
index 000000000000..8e4de66d4690
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt
@@ -0,0 +1,2 @@
+script import my
+p 1 + 1
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
index 0459058f3ae9..410da702b93d 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
@@ -54,7 +54,7 @@ class DataFormatterBoolRefPtr(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- isiOS = (lldbplatformutil.getPlatform() == 'ios')
+ isiOS = (lldbplatformutil.getPlatform() == 'ios' or lldbplatformutil.getPlatform() == 'watchos')
# Now check that we use the right summary for BOOL&
self.expect('frame variable yes_ref',
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
index 2d66a941ed34..750e29460732 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
@@ -46,6 +46,7 @@ class NSIndexPathDataFormatterTestCase(TestBase):
@skipUnlessDarwin
@expectedFailureAll(archs=['i386'], bugnumber="rdar://28656605")
+ @expectedFailureAll(archs=['armv7', 'armv7k'], bugnumber="rdar://problem/34561607") # NSIndexPath formatter isn't working for 32-bit arm
def test_nsindexpath_with_run_command(self):
"""Test formatters for NSIndexPath."""
self.appkit_tester_impl(self.nsindexpath_data_formatter_commands)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
index a92cffcc319b..637404f1bd0a 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
@@ -1,14 +1,7 @@
LEVEL = ../../../make
CXX_SOURCES := main.cpp
-USE_LIBSTDCPP := 1
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
+USE_LIBSTDCPP := 0
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
index 5b52277e8b7a..b0b45cb831b0 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
@@ -172,23 +172,6 @@ class SkipSummaryDataFormatterTestCase(TestBase):
'm_child2 = {',
'm_some_text = "Just a test"'])
- # Expand within a standard string (might depend on the implementation
- # of the C++ stdlib you use)
- self.expect(
- 'frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=2',
- substrs=[
- '(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
- 'm_some_text = {',
- '_M_dataplus = (_M_p = "Just a test")'])
-
- # Repeat the above, but only skip 1 level of summaries
- self.expect(
- 'frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=1',
- substrs=[
- '(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
- 'm_some_text = "Just a test"',
- '}'])
-
# Change summary and expand, first without --no-summary-depth then with
# --no-summary-depth
self.runCmd(
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
new file mode 100644
index 000000000000..bf75013f531d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
new file mode 100644
index 000000000000..73a1b4e16bf6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
@@ -0,0 +1,46 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxBitset(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ primes = [1]*300
+ primes[0] = primes[1] = 0
+ for i in range(2, len(primes)):
+ for j in range(2*i, len(primes), i):
+ primes[j] = 0
+ self.primes = primes
+
+ def check(self, name, size):
+ var = self.frame().FindVariable(name)
+ self.assertTrue(var.IsValid())
+ self.assertEqual(var.GetNumChildren(), size)
+ for i in range(size):
+ child = var.GetChildAtIndex(i)
+ self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
+ "variable: %s, index: %d"%(name, size))
+
+ @add_test_categories(["libc++"])
+ def test(self):
+ """Test that std::bitset is displayed correctly"""
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, '// break here',
+ lldb.SBFileSpec("main.cpp", False))
+
+ self.check("empty", 0)
+ self.check("small", 13)
+ self.check("large", 200)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
new file mode 100644
index 000000000000..a80f97b80157
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
@@ -0,0 +1,20 @@
+#include <bitset>
+
+template<std::size_t N>
+void fill(std::bitset<N> &b) {
+ b.set();
+ b[0] = b[1] = false;
+ for (std::size_t i = 2; i < N; ++i) {
+ for (std::size_t j = 2*i; j < N; j+=i)
+ b[j] = false;
+ }
+}
+
+int main() {
+ std::bitset<0> empty;
+ std::bitset<13> small;
+ fill(small);
+ std::bitset<200> large;
+ fill(large);
+ return 0; // break here
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile
new file mode 100644
index 000000000000..bf75013f531d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py
new file mode 100644
index 000000000000..1cc454a473a8
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py
@@ -0,0 +1,53 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxForwardList(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line = line_number('main.cpp', '// break here')
+ ns = 'ndk' if lldbplatformutil.target_is_android() else ''
+ self.namespace = 'std::__' + ns + '1'
+
+ @add_test_categories(["libc++"])
+ def test(self):
+ """Test that std::forward_list is displayed correctly"""
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, '// break here',
+ lldb.SBFileSpec("main.cpp", False))
+
+ forward_list = self.namespace + '::forward_list'
+ self.expect("frame variable empty",
+ substrs=[forward_list,
+ 'size=0',
+ '{}'])
+
+ self.expect("frame variable one_elt",
+ substrs=[forward_list,
+ 'size=1',
+ '{',
+ '[0] = 47',
+ '}'])
+
+ self.expect("frame variable five_elts",
+ substrs=[forward_list,
+ 'size=5',
+ '{',
+ '[0] = 1',
+ '[1] = 22',
+ '[2] = 333',
+ '[3] = 4444',
+ '[4] = 55555',
+ '}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp
new file mode 100644
index 000000000000..73abda6e82e5
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp
@@ -0,0 +1,7 @@
+#include <forward_list>
+
+int main()
+{
+ std::forward_list<int> empty{}, one_elt{47}, five_elts{1,22,333,4444,55555};
+ return 0; // break here
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile
new file mode 100644
index 000000000000..bf75013f531d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py
new file mode 100644
index 000000000000..2b157f7f6fcc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py
@@ -0,0 +1,43 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxQueue(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ ns = 'ndk' if lldbplatformutil.target_is_android() else ''
+ self.namespace = 'std::__' + ns + '1'
+
+ def check_variable(self, name):
+ var = self.frame().FindVariable(name)
+ self.assertTrue(var.IsValid())
+
+ queue = self.namespace + '::queue'
+ self.assertTrue(queue in var.GetTypeName())
+ self.assertEqual(var.GetNumChildren(), 5)
+ for i in range(5):
+ ch = var.GetChildAtIndex(i)
+ self.assertTrue(ch.IsValid())
+ self.assertEqual(ch.GetValueAsSigned(), i+1)
+
+ @add_test_categories(["libc++"])
+ def test(self):
+ """Test that std::queue is displayed correctly"""
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, '// break here',
+ lldb.SBFileSpec("main.cpp", False))
+
+ self.check_variable('q1')
+ self.check_variable('q2')
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
new file mode 100644
index 000000000000..449be8d99cf6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
@@ -0,0 +1,11 @@
+#include <queue>
+#include <vector>
+
+using namespace std;
+
+int main() {
+ queue<int> q1{{1,2,3,4,5}};
+ queue<int, std::vector<int>> q2{{1,2,3,4,5}};
+ int ret = q1.size() + q2.size(); // break here
+ return ret;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile
new file mode 100644
index 000000000000..bf75013f531d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py
new file mode 100644
index 000000000000..b25540056a24
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py
@@ -0,0 +1,51 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxTuple(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line = line_number('main.cpp', '// break here')
+ ns = 'ndk' if lldbplatformutil.target_is_android() else ''
+ self.namespace = 'std::__' + ns + '1'
+
+ @add_test_categories(["libc++"])
+ def test(self):
+ """Test that std::tuple is displayed correctly"""
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, '// break here',
+ lldb.SBFileSpec("main.cpp", False))
+
+ tuple_name = self.namespace + '::tuple'
+ self.expect("frame variable empty",
+ substrs=[tuple_name,
+ 'size=0',
+ '{}'])
+
+ self.expect("frame variable one_elt",
+ substrs=[tuple_name,
+ 'size=1',
+ '{',
+ '[0] = 47',
+ '}'])
+
+ self.expect("frame variable three_elts",
+ substrs=[tuple_name,
+ 'size=3',
+ '{',
+ '[0] = 1',
+ '[1] = 47',
+ '[2] = "foo"',
+ '}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
new file mode 100644
index 000000000000..1c0d0f2ae774
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
@@ -0,0 +1,11 @@
+#include <tuple>
+#include <string>
+
+using namespace std;
+
+int main() {
+ tuple<> empty;
+ tuple<int> one_elt{47};
+ tuple<int, long, string> three_elts{1, 47l, "foo"};
+ return 0; // break here
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile
index 7fe01d004f03..2e8bcb9079bd 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
CFLAGS_EXTRAS += -O0
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
index ce5087dbc288..90a958d7cfe2 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
@@ -24,6 +24,7 @@ class StdIteratorDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that libstdcpp iterators format properly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile
index 7fe01d004f03..2e8bcb9079bd 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
CFLAGS_EXTRAS += -O0
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
index a7f8c4b1e174..a8f99f41665f 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
@@ -28,6 +28,7 @@ class StdListDataFormatterTestCase(TestBase):
'main.cpp', '// Set final break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile
index 2c6c3cf72842..17868d8a95fc 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile
@@ -4,11 +4,4 @@ CXX_SOURCES := main.cpp
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
index cdaec8392fe0..e25c410f91ce 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
@@ -25,6 +25,7 @@ class StdMapDataFormatterTestCase(TestBase):
@skipIfWindows # libstdcpp not ported to Windows
@skipIfFreeBSD
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
index 88cb026aba1c..63f2aaf9c75a 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
CXXFLAGS := -O0
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
index 8d940c2686a0..6809dd3c356d 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -18,6 +18,7 @@ class StdSmartPtrDataFormatterTestCase(TestBase):
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
index 7fe01d004f03..2e8bcb9079bd 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
CFLAGS_EXTRAS += -O0
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
index 67823c95f138..d4e9e4d30f77 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
@@ -25,6 +25,7 @@ class StdStringDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfWindows # libstdcpp not ported to Windows
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
index beb2fd583e7a..17868d8a95fc 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
@@ -3,6 +3,5 @@ LEVEL = ../../../../../make
CXX_SOURCES := main.cpp
USE_LIBSTDCPP := 1
-CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
index 56e231da8522..b38747d0f937 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
@@ -18,6 +18,7 @@ class StdTupleDataFormatterTestCase(TestBase):
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
index beb2fd583e7a..17868d8a95fc 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
@@ -3,6 +3,5 @@ LEVEL = ../../../../../make
CXX_SOURCES := main.cpp
USE_LIBSTDCPP := 1
-CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
index 37adb28d7d59..23da541120f6 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -18,6 +18,7 @@ class StdUniquePtrDataFormatterTestCase(TestBase):
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
@@ -67,6 +68,7 @@ class StdUniquePtrDataFormatterTestCase(TestBase):
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
@skipIfDarwin # doesn't compile on Darwin
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_recursive_unique_ptr(self):
# Tests that LLDB can handle when we have a loop in the unique_ptr
# reference chain and that it correctly handles the different options
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
index 17b369df3e6b..57c9e2fe5dc7 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
@@ -28,6 +28,7 @@ class StdVBoolDataFormatterTestCase(TestBase):
bugnumber='llvm.org/pr20548 fails to build on lab.llvm.org buildbot')
@skipIfWindows # libstdcpp not ported to Windows.
@skipIfDarwin
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile
index 88cb026aba1c..63f2aaf9c75a 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
CXXFLAGS := -O0
USE_LIBSTDCPP := 1
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
index e4ec703495b3..e3f21eb21ec0 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
@@ -25,6 +25,7 @@ class StdVectorDataFormatterTestCase(TestBase):
@skipIfFreeBSD
@skipIfWindows # libstdcpp not ported to Windows
+ @skipIfwatchOS # libstdcpp not ported to watchos
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile
index 04f39271f0cd..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
index 69dde1b76184..872bf6d20877 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
CXXFLAGS += -std=c++11
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
index 69dde1b76184..872bf6d20877 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
CXXFLAGS += -std=c++11
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile
index 04f39271f0cd..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile
index 18c35a7d84a5..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile
@@ -2,10 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-# Workaround for llvm.org/pr16214: clang doesn't emit structure definition DWARF
-# information without the flag below.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
index e5d81d8cefc0..cee472ccb51f 100644
--- a/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
@@ -45,7 +45,7 @@ class DisassemblyTestCase(TestBase):
if arch in ["", 'x86_64', 'i386', 'i686']:
breakpoint_opcodes = ["int3"]
instructions = [' mov', ' addl ', 'ret']
- elif arch in ["arm", "aarch64"]:
+ elif arch in ["arm", "aarch64", "arm64", "armv7", "armv7k"]:
breakpoint_opcodes = ["brk", "udf"]
instructions = [' add ', ' ldr ', ' str ']
elif re.match("mips", arch):
diff --git a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
index 65271c3894b8..965af3e4910a 100644
--- a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
+++ b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
@@ -24,11 +24,23 @@ def execute_command(command):
class ExecTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
- def test(self):
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
+ def test_hitting_exec (self):
+ self.do_test(False)
+
+ @skipUnlessDarwin
+ @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
+ def test_skipping_exec (self):
+ self.do_test(False)
+
+ def do_test(self, skip_exec):
if self.getArchitecture() == 'x86_64':
source = os.path.join(os.getcwd(), "main.cpp")
o_file = os.path.join(os.getcwd(), "main.o")
@@ -59,6 +71,16 @@ class ExecTestCase(TestBase):
None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
+ if skip_exec:
+ self.debugger.HandleCommand("settings set target.process.stop-on-exec false")
+ def cleanup():
+ self.runCmd("settings set target.process.stop-on-exec false",
+ check=False)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+
+
for i in range(6):
# The stop reason of the thread should be breakpoint.
self.assertTrue(process.GetState() == lldb.eStateStopped,
@@ -83,19 +105,25 @@ class ExecTestCase(TestBase):
# Run and we should stop due to exec
process.Continue()
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- "Process should be stopped at __dyld_start")
+ if not skip_exec:
+ self.assertTrue(process.GetState() == lldb.eStateStopped,
+ "Process should be stopped at __dyld_start")
+
+ threads = lldbutil.get_stopped_threads(
+ process, lldb.eStopReasonExec)
+ self.assertTrue(
+ len(threads) == 1,
+ "We got a thread stopped for exec.")
- threads = lldbutil.get_stopped_threads(
- process, lldb.eStopReasonExec)
- self.assertTrue(
- len(threads) == 1,
- "We got a thread stopped for exec.")
-
- # Run and we should stop at breakpoint in main after exec
- process.Continue()
+ # Run and we should stop at breakpoint in main after exec
+ process.Continue()
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
+ if self.TraceOn():
+ for t in process.threads:
+ print(t)
+ if t.GetStopReason() != lldb.eStopReasonBreakpoint:
+ self.runCmd("bt")
self.assertTrue(len(threads) == 1,
"Stopped at breakpoint in exec'ed process.")
diff --git a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
index 21d4357a6ff1..719f3f719934 100644
--- a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
+++ b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
@@ -16,15 +16,13 @@ from lldbsuite.test import lldbutil
class ExprDoesntDeadlockTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17946')
@expectedFailureAll(
oslist=["windows"],
bugnumber="Windows doesn't have pthreads, test needs to be ported")
+ @add_test_categories(["basic_process"])
def test_with_run_command(self):
"""Test that expr will time out and allow other threads to run if it blocks."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py
index 46264f3dfe8d..276760d30574 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py
@@ -15,6 +15,7 @@ class TestArray(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_array(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py
index dd8ff949fa98..6529e11fafa8 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py
@@ -15,6 +15,7 @@ class TestBadReference(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_bad_reference(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py
index a8708169bb3b..2e6fad5e1fdb 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py
@@ -15,6 +15,7 @@ class TestDiagnoseDereferenceArgument(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_diagnose_dereference_argument(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py
index 80128eec1f7e..7839a47a8f41 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py
@@ -15,6 +15,7 @@ class TestDiagnoseDereferenceArgument(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_diagnose_dereference_argument(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
index 5e097afdc9b6..8e5cd430293d 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
@@ -15,6 +15,7 @@ class TestDiagnoseDereferenceFunctionReturn(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
@expectedFailureAll(oslist=['macosx'], archs=['i386'], bugnumber="rdar://28656408")
def test_diagnose_dereference_function_return(self):
TestBase.setUp(self)
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py
index 233c9e403bd2..201923fb89d6 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py
@@ -15,6 +15,7 @@ class TestDiagnoseDereferenceThis(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_diagnose_dereference_this(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py
index 267223ad0854..08ef1c7fc5e6 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py
@@ -15,6 +15,7 @@ class TestDiagnoseInheritance(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_diagnose_inheritance(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py
index a1a17c941760..e962c2673faf 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py
@@ -15,6 +15,7 @@ class TestLocalVariable(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_local_variable(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py
index adf092d86157..bc11bd1afb78 100644
--- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py
@@ -15,6 +15,7 @@ class TestDiagnoseVirtualMethodCall(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64
def test_diagnose_virtual_method_call(self):
TestBase.setUp(self)
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
index d058b1cac560..b233d2f768e0 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
@@ -17,9 +17,6 @@ class CrashingInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(
- oslist=['freebsd'],
- bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
- @expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing(self):
@@ -60,7 +57,6 @@ class CrashingInferiorTestCase(TestBase):
self.build()
self.inferior_crashing_step()
- @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr24939')
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
@@ -76,6 +72,7 @@ class CrashingInferiorTestCase(TestBase):
# Inferior exits after stepping after a segfault. This is working as
# intended IMHO.
@skipIfLinux
+ @skipIfFreeBSD
def test_inferior_crashing_expr_step_and_expr(self):
"""Test that lldb expressions work before and after stepping after a crash."""
self.build()
@@ -110,7 +107,7 @@ class CrashingInferiorTestCase(TestBase):
# The exact stop reason depends on the platform
if self.platformIsDarwin():
stop_reason = 'stop reason = EXC_BAD_ACCESS'
- elif self.getPlatform() == "linux":
+ elif self.getPlatform() == "linux" or self.getPlatform() == "freebsd":
stop_reason = 'stop reason = signal SIGSEGV'
else:
stop_reason = 'stop reason = invalid address'
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
index f04173a3e8d2..9987377a83ec 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
@@ -16,9 +16,6 @@ class CrashingRecursiveInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(
- oslist=['freebsd'],
- bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_recursive_inferior_crashing(self):
"""Test that lldb reliably catches the inferior crashing (command)."""
@@ -50,7 +47,6 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.build()
self.recursive_inferior_crashing_step()
- @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr24939')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@skipIfTargetAndroid() # debuggerd interferes with this test on Android
def test_recursive_inferior_crashing_step_after_break(self):
@@ -61,6 +57,7 @@ class CrashingRecursiveInferiorTestCase(TestBase):
# Inferior exits after stepping after a segfault. This is working as
# intended IMHO.
@skipIfLinux
+ @skipIfFreeBSD
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_recursive_inferior_crashing_expr_step_and_expr(self):
"""Test that lldb expressions work before and after stepping after a crash."""
@@ -94,7 +91,7 @@ class CrashingRecursiveInferiorTestCase(TestBase):
# The exact stop reason depends on the platform
if self.platformIsDarwin():
stop_reason = 'stop reason = EXC_BAD_ACCESS'
- elif self.getPlatform() == "linux":
+ elif self.getPlatform() == "linux" or self.getPlatform() == "freebsd":
stop_reason = 'stop reason = signal SIGSEGV'
else:
stop_reason = 'stop reason = invalid address'
diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
index 0ebb99d3fd43..43fa5f9d33f2 100644
--- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
+++ b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
@@ -22,6 +22,7 @@ class LaunchWithShellExpandTestCase(TestBase):
"linux",
"freebsd"],
bugnumber="llvm.org/pr24778 llvm.org/pr22627")
+ @skipIfDarwinEmbedded # iOS etc don't launch the binary via a shell, so arg expansion won't happen
def test(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/.categories b/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
new file mode 100644
index 000000000000..c00c25822e4c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
@@ -0,0 +1 @@
+basic_process
diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile b/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
index 779745c4d26c..9a954a201cf2 100644
--- a/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
@@ -8,11 +8,17 @@ CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules
.PHONY:
-a.out: lib_a lib_b lib_c lib_d hidden_lib_d
+a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool
lib_%:
$(MAKE) -f $*.mk
+install_name_tool:
+ifeq ($(OS),Darwin)
+ install_name_tool -id @executable_path/libloadunload_d.dylib libloadunload_d.dylib
+endif
+
+
hidden_lib_d:
$(MAKE) -C hidden
diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
index 027968a727f1..98b0c9ca1971 100644
--- a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ b/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -17,9 +17,6 @@ from lldbsuite.test import lldbutil
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
class LoadUnloadTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -56,10 +53,14 @@ class LoadUnloadTestCase(TestBase):
Does nothing in case of non-remote platforms.
"""
if lldb.remote_platform:
- cwd = os.getcwd()
- shlibs = ['libloadunload_a.so', 'libloadunload_b.so',
- 'libloadunload_c.so', 'libloadunload_d.so']
+ ext = 'so'
+ if self.platformIsDarwin():
+ ext = 'dylib'
+
+ shlibs = ['libloadunload_a.' + ext, 'libloadunload_b.' + ext,
+ 'libloadunload_c.' + ext, 'libloadunload_d.' + ext]
wd = lldb.remote_platform.GetWorkingDirectory()
+ cwd = os.getcwd()
for f in shlibs:
err = lldb.remote_platform.Put(
lldb.SBFileSpec(os.path.join(cwd, f)),
@@ -69,7 +70,7 @@ class LoadUnloadTestCase(TestBase):
"Unable copy '%s' to '%s'.\n>>> %s" %
(f, wd, err.GetCString()))
if hidden_dir:
- shlib = 'libloadunload_d.so'
+ shlib = 'libloadunload_d.' + ext
hidden_dir = os.path.join(wd, 'hidden')
hidden_file = os.path.join(hidden_dir, shlib)
err = lldb.remote_platform.MakeDirectory(hidden_dir)
diff --git a/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py b/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
index 6a779ecfac5b..eb6981d04fad 100644
--- a/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
+++ b/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
@@ -17,6 +17,7 @@ class MTCSimpleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # Test file depends on AppKit which is not present on iOS etc.
def test(self):
self.mtc_dylib_path = findMainThreadCheckerDylib()
if self.mtc_dylib_path == "":
@@ -29,6 +30,7 @@ class MTCSimpleTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
+ @skipIf(archs=['i386'])
def mtc_tests(self):
# Load the test
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
new file mode 100644
index 000000000000..54ea33ad24a9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
@@ -0,0 +1,76 @@
+"""
+Test the lldb platform Python API.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class PlatformPythonTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
+ def test_platform_list(self):
+ """Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API"""
+ # Verify the host platform is present by default.
+ initial_num_platforms = self.dbg.GetNumPlatforms()
+ self.assertGreater(initial_num_platforms, 0)
+ host_platform = self.dbg.GetPlatformAtIndex(0)
+ self.assertTrue(host_platform.IsValid() and
+ host_platform.GetName() == 'host',
+ 'The host platform is present')
+ # Select another platform and verify that the platform is added to
+ # the platform list.
+ platform_idx = self.dbg.GetNumAvailablePlatforms() - 1
+ if platform_idx < 1:
+ self.fail('No platforms other than host are available')
+ platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(platform_idx)
+ platform_name = platform_data.GetValueForKey('name').GetStringValue(100)
+ self.assertNotEqual(platform_name, 'host')
+ self.dbg.SetCurrentPlatform(platform_name)
+ selected_platform = self.dbg.GetSelectedPlatform()
+ self.assertTrue(selected_platform.IsValid())
+ self.assertEqual(selected_platform.GetName(), platform_name)
+ self.assertEqual(self.dbg.GetNumPlatforms(), initial_num_platforms + 1)
+ platform_found = False
+ for platform_idx in range(self.dbg.GetNumPlatforms()):
+ platform = self.dbg.GetPlatformAtIndex(platform_idx)
+ if platform.GetName() == platform_name:
+ platform_found = True
+ break
+ self.assertTrue(platform_found)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
+ def test_available_platform_list(self):
+ """Test SBDebugger::GetNumAvailablePlatforms() and GetAvailablePlatformInfoAtIndex() API"""
+ num_platforms = self.dbg.GetNumAvailablePlatforms()
+ self.assertGreater(
+ num_platforms, 0,
+ 'There should be at least one platform available')
+
+ for i in range(num_platforms):
+ platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(i)
+ name_data = platform_data.GetValueForKey('name')
+ desc_data = platform_data.GetValueForKey('description')
+ self.assertTrue(
+ name_data and name_data.IsValid(),
+ 'Platform has a name')
+ self.assertEqual(
+ name_data.GetType(), lldb.eStructuredDataTypeString,
+ 'Platform name is a string')
+ self.assertTrue(
+ desc_data and desc_data.IsValid(),
+ 'Platform has a description')
+ self.assertEqual(
+ desc_data.GetType(), lldb.eStructuredDataTypeString,
+ 'Platform description is a string')
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
index 18c0da832606..63b93340cef3 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,11 +24,13 @@ class LinuxCoreTestCase(TestBase):
_mips64_n64_pid = 25619
_mips64_n32_pid = 3670
_mips_o32_pid = 3532
+ _ppc64le_pid = 28147
_i386_regions = 4
_x86_64_regions = 5
_s390x_regions = 2
_mips_regions = 5
+ _ppc64le_regions = 2
def setUp(self):
super(LinuxCoreTestCase, self).setUp()
@@ -58,6 +60,12 @@ class LinuxCoreTestCase(TestBase):
@skipIf(oslist=['windows'])
@skipIf(triple='^mips')
+ def test_ppc64le(self):
+ """Test that lldb can read the process information from an ppc64le linux core file."""
+ self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
def test_x86_64(self):
"""Test that lldb can read the process information from an x86_64 linux core file."""
self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)
@@ -137,7 +145,7 @@ class LinuxCoreTestCase(TestBase):
values = {}
values["fctrl"] = "0x037f"
values["fstat"] = "0x0000"
- values["ftag"] = "0xff"
+ values["ftag"] = "0x00ff"
values["fop"] = "0x0000"
values["fiseg"] = "0x00000000"
values["fioff"] = "0x0040011e"
@@ -244,6 +252,34 @@ class LinuxCoreTestCase(TestBase):
end_region.GetRegionBase())
self.assertEqual(end_region.GetRegionEnd(), lldb.LLDB_INVALID_ADDRESS)
+ def check_state(self, process):
+ with open(os.devnull) as devnul:
+ # sanitize test output
+ self.dbg.SetOutputFileHandle(devnul, False)
+ self.dbg.SetErrorFileHandle(devnul, False)
+
+ self.assertTrue(process.is_stopped)
+
+ # Process.Continue
+ error = process.Continue()
+ self.assertFalse(error.Success())
+ self.assertTrue(process.is_stopped)
+
+ # Thread.StepOut
+ thread = process.GetSelectedThread()
+ thread.StepOut()
+ self.assertTrue(process.is_stopped)
+
+ # command line
+ self.dbg.HandleCommand('s')
+ self.assertTrue(process.is_stopped)
+ self.dbg.HandleCommand('c')
+ self.assertTrue(process.is_stopped)
+
+ # restore file handles
+ self.dbg.SetOutputFileHandle(None, False)
+ self.dbg.SetErrorFileHandle(None, False)
+
def do_test(self, filename, pid, region_count):
target = self.dbg.CreateTarget(filename + ".out")
process = target.LoadCore(filename + ".core")
@@ -251,6 +287,8 @@ class LinuxCoreTestCase(TestBase):
self.assertEqual(process.GetNumThreads(), 1)
self.assertEqual(process.GetProcessID(), pid)
+ self.check_state(process)
+
thread = process.GetSelectedThread()
self.assertTrue(thread)
self.assertEqual(thread.GetThreadID(), pid)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core
new file mode 100644
index 000000000000..c0ed578bd796
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out
new file mode 100755
index 000000000000..05c69fd291b7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
index 9becd8756318..178bb678df7c 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -31,6 +31,34 @@ class MiniDumpNewTestCase(TestBase):
lldb.DBG.SetSelectedPlatform(self._initial_platform)
super(MiniDumpNewTestCase, self).tearDown()
+ def check_state(self):
+ with open(os.devnull) as devnul:
+ # sanitize test output
+ self.dbg.SetOutputFileHandle(devnul, False)
+ self.dbg.SetErrorFileHandle(devnul, False)
+
+ self.assertTrue(self.process.is_stopped)
+
+ # Process.Continue
+ error = self.process.Continue()
+ self.assertFalse(error.Success())
+ self.assertTrue(self.process.is_stopped)
+
+ # Thread.StepOut
+ thread = self.process.GetSelectedThread()
+ thread.StepOut()
+ self.assertTrue(self.process.is_stopped)
+
+ # command line
+ self.dbg.HandleCommand('s')
+ self.assertTrue(self.process.is_stopped)
+ self.dbg.HandleCommand('c')
+ self.assertTrue(self.process.is_stopped)
+
+ # restore file handles
+ self.dbg.SetOutputFileHandle(None, False)
+ self.dbg.SetErrorFileHandle(None, False)
+
def test_process_info_in_minidump(self):
"""Test that lldb can read the process information from the Minidump."""
# target create -c linux-x86_64.dmp
@@ -40,6 +68,7 @@ class MiniDumpNewTestCase(TestBase):
self.assertTrue(self.process, PROCESS_IS_VALID)
self.assertEqual(self.process.GetNumThreads(), 1)
self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
+ self.check_state()
def test_thread_info_in_minidump(self):
"""Test that lldb can read the thread information from the Minidump."""
@@ -47,6 +76,7 @@ class MiniDumpNewTestCase(TestBase):
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64.dmp")
+ self.check_state()
# This process crashed due to a segmentation fault in its
# one and only thread.
self.assertEqual(self.process.GetNumThreads(), 1)
@@ -61,6 +91,7 @@ class MiniDumpNewTestCase(TestBase):
self.dbg.CreateTarget("linux-x86_64")
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64.dmp")
+ self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
thread = self.process.GetThreadAtIndex(0)
@@ -81,6 +112,7 @@ class MiniDumpNewTestCase(TestBase):
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64_not_crashed.dmp")
+ self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
@@ -161,9 +193,10 @@ class MiniDumpNewTestCase(TestBase):
"""Test that we can examine local variables in a Minidump."""
# Launch with the Minidump, and inspect a local variable.
# target create linux-x86_64_not_crashed -c linux-x86_64_not_crashed.dmp
- target = self.dbg.CreateTarget("linux-x86_64_not_crashed")
- process = target.LoadCore("linux-x86_64_not_crashed.dmp")
- thread = process.GetThreadAtIndex(0)
+ self.target = self.dbg.CreateTarget("linux-x86_64_not_crashed")
+ self.process = self.target.LoadCore("linux-x86_64_not_crashed.dmp")
+ self.check_state()
+ thread = self.process.GetThreadAtIndex(0)
frame = thread.GetFrameAtIndex(1)
value = frame.EvaluateExpression('x')
self.assertEqual(value.GetValueAsSigned(), 3)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
index b89a305d0e88..c7b64d783c71 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
@@ -41,6 +41,7 @@ class MiniDumpTestCase(TestBase):
stop_description = thread.GetStopDescription(256)
self.assertTrue("0xc0000005" in stop_description)
+ @expectedFailureAll(bugnumber="llvm.org/pr35193", hostoslist=["windows"])
def test_stack_info_in_mini_dump(self):
"""Test that we can see a trivial stack in a VS-generate mini dump."""
# target create -c fizzbuzz_no_heap.dmp
@@ -49,14 +50,14 @@ class MiniDumpTestCase(TestBase):
self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp")
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
- # The crash is in main, so there should be one frame on the stack.
- self.assertEqual(thread.GetNumFrames(), 1)
- frame = thread.GetFrameAtIndex(0)
- self.assertTrue(frame.IsValid())
- pc = frame.GetPC()
- eip = frame.FindRegister("pc")
- self.assertTrue(eip.IsValid())
- self.assertEqual(pc, eip.GetValueAsUnsigned())
+
+ pc_list = [ 0x00164d14, 0x00167c79, 0x00167e6d, 0x7510336a, 0x77759882, 0x77759855]
+
+ self.assertEqual(thread.GetNumFrames(), len(pc_list))
+ for i in range(len(pc_list)):
+ frame = thread.GetFrameAtIndex(i)
+ self.assertTrue(frame.IsValid())
+ self.assertEqual(frame.GetPC(), pc_list[i])
@skipUnlessWindows # Minidump saving works only on windows
def test_deeper_stack_in_mini_dump(self):
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
index 716d0d4f5bc7..c4d372cd3d30 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
@@ -8,6 +8,7 @@ from __future__ import print_function
import os
import time
import lldb
+import shutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@@ -22,6 +23,7 @@ class ProcessAttachTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfiOSSimulator
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_attach_to_process_by_id(self):
"""Test attach by process id"""
self.build()
@@ -38,6 +40,34 @@ class ProcessAttachTestCase(TestBase):
process = target.GetProcess()
self.assertTrue(process, PROCESS_IS_VALID)
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
+ def test_attach_to_process_from_different_dir_by_id(self):
+ """Test attach by process id"""
+ try:
+ os.mkdir(os.path.join(os.getcwd(),'newdir'))
+ except OSError, e:
+ if e.errno != os.errno.EEXIST:
+ raise
+ testdir = os.getcwd()
+ newdir = os.path.join(testdir,'newdir')
+ exe = os.path.join(newdir, 'proc_attach')
+ self.buildProgram('main.cpp', exe)
+ self.addTearDownHook(lambda: shutil.rmtree(newdir))
+
+ # Spawn a new process
+ popen = self.spawnSubprocess(exe)
+ self.addTearDownHook(self.cleanupSubprocesses)
+
+ os.chdir('newdir')
+ self.addTearDownHook(lambda: os.chdir(testdir))
+ self.runCmd("process attach -p " + str(popen.pid))
+
+ target = self.dbg.GetSelectedTarget()
+
+ process = target.GetProcess()
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_attach_to_process_by_name(self):
"""Test attach by process name"""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
index 071f5d57c78f..5465b7155f50 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
@@ -21,6 +21,7 @@ class AttachDeniedTestCase(TestBase):
@skipIfWindows
@skipIfiOSSimulator
+ @skipIfDarwinEmbedded # ptrace(ATTACH_REQUEST...) won't work on ios/tvos/etc
def test_attach_to_process_by_id_denied(self):
"""Test attach by process id denied"""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
index 00b4d4153403..91436446ad99 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
@@ -23,6 +23,7 @@ class ChangeProcessGroupTestCase(TestBase):
@skipIfFreeBSD # Times out on FreeBSD llvm.org/pr23731
@skipIfWindows # setpgid call does not exist on Windows
@expectedFailureAndroid("http://llvm.org/pr23762", api_levels=[16])
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_setpgid(self):
self.build()
exe = os.path.join(os.getcwd(), 'a.out')
diff --git a/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
index fe6ce2c25a3e..83cc48847c99 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
+++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
@@ -45,7 +45,7 @@ class RegisterCommandsTestCase(TestBase):
self.runCmd("register read xmm0")
self.runCmd("register read ymm15") # may be available
self.runCmd("register read bnd0") # may be available
- elif self.getArchitecture() in ['arm']:
+ elif self.getArchitecture() in ['arm', 'armv7', 'armv7k', 'arm64']:
self.runCmd("register read s0")
self.runCmd("register read q15") # may be available
@@ -84,7 +84,10 @@ class RegisterCommandsTestCase(TestBase):
if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
gpr = "eax"
vector = "xmm0"
- elif self.getArchitecture() in ['arm']:
+ elif self.getArchitecture() in ['arm64', 'aarch64']:
+ gpr = "w0"
+ vector = "v0"
+ elif self.getArchitecture() in ['arm', 'armv7', 'armv7k']:
gpr = "r0"
vector = "q0"
@@ -269,14 +272,18 @@ class RegisterCommandsTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- lldbutil.run_break_set_by_symbol(
- self, "main", num_expected_locations=-1)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple(
- None, None, self.get_process_working_directory())
+ # Launch the process, stop at the entry point.
+ error = lldb.SBError()
+ process = target.Launch(
+ lldb.SBListener(),
+ None, None, # argv, envp
+ None, None, None, # stdin/out/err
+ self.get_process_working_directory(),
+ 0, # launch flags
+ True, # stop at entry
+ error)
+ self.assertTrue(error.Success(), "Launch succeeds. Error is :" + str(error))
- process = target.GetProcess()
self.assertTrue(
process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
@@ -317,7 +324,35 @@ class RegisterCommandsTestCase(TestBase):
("xmm15",
"{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}",
False))
- elif self.getArchitecture() in ['arm']:
+ elif self.getArchitecture() in ['arm64', 'aarch64']:
+ reg_list = [
+ # reg value
+ # must-have
+ ("fpsr", "0xfbf79f9f", True),
+ ("s0", "1.25", True),
+ ("s31", "0.75", True),
+ ("d1", "123", True),
+ ("d17", "987", False),
+ ("v1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True),
+ ("v14",
+ "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}",
+ False),
+ ]
+ elif self.getArchitecture() in ['armv7'] and self.platformIsDarwin():
+ reg_list = [
+ # reg value
+ # must-have
+ ("fpsr", "0xfbf79f9f", True),
+ ("s0", "1.25", True),
+ ("s31", "0.75", True),
+ ("d1", "123", True),
+ ("d17", "987", False),
+ ("q1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True),
+ ("q14",
+ "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}",
+ False),
+ ]
+ elif self.getArchitecture() in ['arm', 'armv7k']:
reg_list = [
# reg value
# must-have
diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
index 1750bd31b3df..606a71ff5019 100644
--- a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -22,6 +22,10 @@ class ReturnValueTestCase(TestBase):
return ("clang" in self.getCompiler() and self.getArchitecture() ==
"aarch64" and self.getPlatform() == "linux")
+ # ABIMacOSX_arm can't fetch simple values inside a structure
+ def affected_by_radar_34562999(self):
+ return (self.getArchitecture() == 'armv7' or self.getArchitecture() == 'armv7k') and self.platformIsDarwin()
+
@expectedFailureAll(oslist=["freebsd"], archs=["i386"])
@expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>")
@expectedFailureAll(
@@ -142,33 +146,34 @@ class ReturnValueTestCase(TestBase):
#self.assertTrue(in_float == return_float)
- self.return_and_test_struct_value("return_one_int")
- self.return_and_test_struct_value("return_two_int")
- self.return_and_test_struct_value("return_three_int")
- self.return_and_test_struct_value("return_four_int")
- if not self.affected_by_pr33042():
- self.return_and_test_struct_value("return_five_int")
-
- self.return_and_test_struct_value("return_two_double")
- self.return_and_test_struct_value("return_one_double_two_float")
- self.return_and_test_struct_value("return_one_int_one_float_one_int")
-
- self.return_and_test_struct_value("return_one_pointer")
- self.return_and_test_struct_value("return_two_pointer")
- self.return_and_test_struct_value("return_one_float_one_pointer")
- self.return_and_test_struct_value("return_one_int_one_pointer")
- self.return_and_test_struct_value("return_three_short_one_float")
-
- self.return_and_test_struct_value("return_one_int_one_double")
- self.return_and_test_struct_value("return_one_int_one_double_one_int")
- self.return_and_test_struct_value(
- "return_one_short_one_double_one_short")
- self.return_and_test_struct_value("return_one_float_one_int_one_float")
- self.return_and_test_struct_value("return_two_float")
- # I am leaving out the packed test until we have a way to tell CLANG
- # about alignment when reading DWARF for packed types.
- #self.return_and_test_struct_value ("return_one_int_one_double_packed")
- self.return_and_test_struct_value("return_one_int_one_long")
+ if not self.affected_by_radar_34562999():
+ self.return_and_test_struct_value("return_one_int")
+ self.return_and_test_struct_value("return_two_int")
+ self.return_and_test_struct_value("return_three_int")
+ self.return_and_test_struct_value("return_four_int")
+ if not self.affected_by_pr33042():
+ self.return_and_test_struct_value("return_five_int")
+
+ self.return_and_test_struct_value("return_two_double")
+ self.return_and_test_struct_value("return_one_double_two_float")
+ self.return_and_test_struct_value("return_one_int_one_float_one_int")
+
+ self.return_and_test_struct_value("return_one_pointer")
+ self.return_and_test_struct_value("return_two_pointer")
+ self.return_and_test_struct_value("return_one_float_one_pointer")
+ self.return_and_test_struct_value("return_one_int_one_pointer")
+ self.return_and_test_struct_value("return_three_short_one_float")
+
+ self.return_and_test_struct_value("return_one_int_one_double")
+ self.return_and_test_struct_value("return_one_int_one_double_one_int")
+ self.return_and_test_struct_value(
+ "return_one_short_one_double_one_short")
+ self.return_and_test_struct_value("return_one_float_one_int_one_float")
+ self.return_and_test_struct_value("return_two_float")
+ # I am leaving out the packed test until we have a way to tell CLANG
+ # about alignment when reading DWARF for packed types.
+ #self.return_and_test_struct_value ("return_one_int_one_double_packed")
+ self.return_and_test_struct_value("return_one_int_one_long")
@expectedFailureAll(oslist=["freebsd"], archs=["i386"])
@expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>")
@@ -181,6 +186,7 @@ class ReturnValueTestCase(TestBase):
archs=["i386"])
@expectedFailureAll(compiler=["gcc"], archs=["x86_64", "i386"])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
+ @skipIfDarwinEmbedded # <rdar://problem/33976032> ABIMacOSX_arm64 doesn't get structs this big correctly
def test_vector_values(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
index 16681fdbcdef..97de99640f50 100644
--- a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
+++ b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
@@ -18,9 +18,6 @@ class HandleSegvTestCase(TestBase):
@skipIfWindows # signals do not exist on Windows
@skipIfDarwin
- @expectedFailureAll(
- oslist=['freebsd'],
- bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
def test_inferior_handle_sigsegv(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
index b0b2e609ba6b..7ec934f26e0b 100644
--- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
+++ b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
@@ -52,6 +52,7 @@ class ReturnValueTestCase(TestBase):
"3.9"],
archs=["i386"],
bugnumber="llvm.org/pr28549")
+ @expectedFailureAll(oslist=["ios", "tvos", "bridgeos"], bugnumber="<rdar://problem/34026777>") # lldb doesn't step past last source line in function on arm64
def test_step_in_with_python(self):
"""Test stepping in using avoid-no-debug with dwarf."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
index fa5c6de05650..74088581bad4 100644
--- a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
+++ b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
@@ -39,6 +39,7 @@ class StopHookMechanismTestCase(TestBase):
@expectedFailureAll(
hostoslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIf(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k']) # <rdar://problem/34582291> problem with armv7 and step-over and stop-hook firing on ios etc systems
def test(self):
"""Test the stop-hook mechanism."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
index c600d8ed21be..275d54d2149c 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
@@ -14,9 +14,9 @@ class ConcurrentBreakpointsDelayedBreakpointOneWatchpoint(
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py
index 169903816fa9..c9cc6db96004 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py
@@ -13,9 +13,9 @@ class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
""" Test a thread that crashes while another thread hits a watchpoint."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py
index 4a58e7cf6d71..d99107b6e9b6 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py
@@ -13,9 +13,9 @@ class ConcurrentCrashWithWatchpointBreakpointSignal(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
""" Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py
index d5d4641bc164..28c5c68d4506 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py
@@ -13,9 +13,9 @@ class ConcurrentDelaySignalWatch(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test a watchpoint and a (1 second delay) signal in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py
index 9cbb40cb6019..2d7c984e0e1c 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py
@@ -13,9 +13,9 @@ class ConcurrentDelayWatchBreak(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test (1-second delay) watchpoint and a breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
index ccbeeb07d3a8..0564c86dfcbd 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
@@ -13,9 +13,9 @@ class ConcurrentDelayedCrashWithBreakpointWatchpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
""" Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
index 540b5148aefa..c888aa0b6eb6 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp
@@ -29,7 +29,7 @@ typedef std::vector<pthread_t> thread_vector;
pseudo_barrier_t g_barrier;
int g_breakpoint = 0;
int g_sigusr1_count = 0;
-std::atomic_int g_watchme;
+uint32_t g_watchme;
struct action_args {
int delay;
@@ -74,7 +74,7 @@ watchpoint_func (void *input) {
pseudo_barrier_wait(g_barrier);
do_action_args(input);
- g_watchme += 1; // watchpoint triggers here
+ g_watchme = 1; // watchpoint triggers here
return 0;
}
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py
index 73c1704e7e54..96b610f2b90b 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py
@@ -17,6 +17,7 @@ class ConcurrentManyWatchpoints(ConcurrentEventsBase):
"Skip this long running test")
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test 100 watchpoints from 100 threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py
index b9a7c5f568cb..b921ac04ccc5 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py
@@ -13,9 +13,9 @@ class ConcurrentNWatchNBreak(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test with 5 watchpoint and breakpoint threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py
index 128245343803..2f3b858854b8 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py
@@ -13,9 +13,9 @@ class ConcurrentSignalDelayWatch(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test a (1 second delay) watchpoint and a signal in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py
index 56217e1e8c3f..ebb13d99fb3c 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py
@@ -13,9 +13,9 @@ class ConcurrentSignalNWatchNBreak(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test one signal thread with 5 watchpoint and breakpoint threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py
index 001062896265..0fbaf364045d 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py
@@ -13,9 +13,9 @@ class ConcurrentSignalWatch(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test a watchpoint and a signal in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py
index d7725002f2bd..53da6658550d 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py
@@ -13,9 +13,9 @@ class ConcurrentSignalWatchBreak(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test a signal/watchpoint/breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py
index f26a5dc6f848..687be17ddc5a 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py
@@ -13,9 +13,9 @@ class ConcurrentTwoBreakpointsOneWatchpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a breakpoint and one watchpoint thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py
index 059e077be98c..025d91169451 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py
@@ -13,9 +13,9 @@ class ConcurrentTwoWatchpointThreads(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py
index 4b3c35ea8e68..5e95531ae09a 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py
@@ -13,9 +13,9 @@ class ConcurrentTwoWatchpointsOneBreakpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint and one breakpoint thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
index ae6f64451abf..aa57e816bb58 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
@@ -13,9 +13,9 @@ class ConcurrentTwoWatchpointsOneDelayBreakpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py
index 78f2dbbc8325..31b583c1a65a 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py
@@ -13,9 +13,10 @@ class ConcurrentTwoWatchpointsOneSignal(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @expectedFailureAll(bugnumber="llvm.org/pr35228", archs=["arm", "aarch64"])
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint and one signal thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py
index ffa6909129ad..241ea5b64a03 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py
@@ -13,9 +13,9 @@ class ConcurrentWatchBreak(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test watchpoint and a breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py
index 4c8b5b319ae4..79a54b620e53 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py
@@ -13,9 +13,9 @@ class ConcurrentWatchBreakDelay(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test watchpoint and a (1 second delay) breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
index 0d545b31230f..6a37abdbcbb8 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
@@ -13,9 +13,9 @@ class ConcurrentWatchpointDelayWatchpointOneBreakpoint(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py
index 56cd85da88d3..67ac92b853cd 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py
@@ -13,9 +13,9 @@ class ConcurrentWatchpointWithDelayWatchpointThreads(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
# Atomic sequences are not supported yet for MIPS in LLDB.
@skipIf(triple='^mips')
+ @add_test_categories(["watchpoint"])
def test(self):
"""Test two threads that trigger a watchpoint where one thread has a 1 second delay. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
index fb6208a0d3e5..442887ed4e13 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
@@ -23,6 +23,7 @@ class CreateAfterAttachTestCase(TestBase):
# Occasionally hangs on Windows, may be same as other issues.
@skipIfWindows
@skipIfiOSSimulator
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_create_after_attach_with_popen(self):
"""Test thread creation after process attach."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
@@ -33,6 +34,7 @@ class CreateAfterAttachTestCase(TestBase):
@skipIfRemote
@skipIfWindows # Windows doesn't have fork.
@skipIfiOSSimulator
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_create_after_attach_with_fork(self):
"""Test thread creation after process attach."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
index 5c0544f0ccab..456c890673cc 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
@@ -26,9 +26,6 @@ class ExitDuringBreakpointTestCase(TestBase):
@expectedFailureAll(
oslist=["linux"],
bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(
- oslist=["freebsd"],
- bugnumber="llvm.org/pr18190 thread states not properly maintained")
def test(self):
"""Test thread exit during breakpoint handling."""
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
index 85fa5d380cff..75a9b8873dda 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
@@ -8,6 +8,7 @@ from __future__ import print_function
import os
import time
import lldb
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
@@ -60,7 +61,8 @@ class NumberOfThreadsTestCase(TestBase):
self.assertTrue(
num_threads >= 13,
'Number of expected threads and actual threads do not match.')
-
+
+ @skipIfDarwin # rdar://33462362
def test_unique_stacks(self):
"""Test backtrace unique with multiple threads executing the same stack."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
index f043013b90ce..9c8bbf1eb081 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
@@ -40,6 +40,7 @@ class ThreadStepOutTestCase(TestBase):
oslist=["freebsd"],
bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
@expectedFailureAll(oslist=["windows"])
+ @expectedFailureAll(oslist=["watchos"], archs=['armv7k'], bugnumber="rdar://problem/34674488") # stop reason is trace when it should be step-out
def test_step_all_threads(self):
"""Test thread step out on all threads via command interpreter. """
self.build(dictionary=self.getBuildFlags())
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories b/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
new file mode 100644
index 000000000000..c00c25822e4c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
@@ -0,0 +1 @@
+basic_process
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
index ec34c9985d3e..d63d5c55bc82 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
@@ -15,9 +15,6 @@ class TestCStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
index 0377b0c0a80e..8f004e6d319b 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
@@ -20,6 +20,7 @@ class ThreadSpecificBreakTestCase(TestBase):
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"])
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563920') # armv7 ios problem - breakpoint with tid qualifier isn't working
def test_python(self):
"""Test that we obey thread conditioned breakpoints."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
index da9ba59f9924..3eddaca3e30d 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
@@ -24,6 +24,7 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase):
# hits break in another thread in testrun
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522')
@add_test_categories(['pyapi'])
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563348') # Two threads seem to end up with the same my_value when built for armv7.
def test_python(self):
"""Test that we obey thread conditioned breakpoints."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile b/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile
index b69775dc199a..8a7102e347af 100644
--- a/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile
@@ -2,11 +2,4 @@ LEVEL = ../../make
CXX_SOURCES := main.cpp
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
index e35bb966c918..598efbc5e030 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
@@ -19,6 +19,7 @@ class SigtrampUnwind(TestBase):
# On different platforms the "_sigtramp" and "__kill" frames are likely to be different.
# This test could probably be adapted to run on linux/*bsd easily enough.
@skipUnlessDarwin
+ @expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34006863>") # lldb skips 1 frame on arm64 above _sigtramp
def test(self):
"""Test that we can backtrace correctly with _sigtramp on the stack"""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories b/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories
new file mode 100644
index 000000000000..50c1613cda72
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories
@@ -0,0 +1 @@
+watchpoint
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
index 6a68730e08ed..9fac249936ea 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
@@ -33,8 +33,6 @@ class HelloWatchLocationTestCase(TestBase):
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -43,12 +41,6 @@ class HelloWatchLocationTestCase(TestBase):
@expectedFailureAll(triple=re.compile('^mips'))
# SystemZ also currently supports only one H/W watchpoint
@expectedFailureAll(archs=['s390x'])
- @expectedFailureAll(
- oslist=["linux"],
- archs=[
- "arm",
- "aarch64"],
- bugnumber="llvm.org/pr27795")
@skipIfDarwin
def test_hello_watchlocation(self):
"""Test watching a location with '-s size' option."""
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
index c74452fd375e..2cfba398bac9 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
@@ -15,9 +15,6 @@ from lldbsuite.test import lldbutil
class HelloWatchpointTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -34,11 +31,10 @@ class HelloWatchpointTestCase(TestBase):
self.exe_name = 'a.out'
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ @add_test_categories(["basic_process"])
def test_hello_watchpoint_using_watchpoint_set(self):
"""Test a simple sequence of watchpoint creation and watchpoint hit."""
self.build(dictionary=self.d)
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
index 2e58cb893b73..ac2c2fb8ec5a 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
@@ -30,8 +30,6 @@ class WatchpointSlotsTestCase(TestBase):
self.exe_name = 'a.out'
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
# This is a arm and aarch64 specific test case. No other architectures tested.
@skipIf(archs=no_match(['arm', 'aarch64']))
def test_multiple_watchpoints_on_same_word(self):
@@ -67,9 +65,12 @@ class WatchpointSlotsTestCase(TestBase):
# The hit count should be 0 initially.
self.expect("watchpoint list -v 1", substrs=['hit_count = 0'])
- # Try setting a watchpoint at byteArray[1]
- self.expect("watchpoint set variable byteArray[1]", error=True,
- substrs=['Watchpoint creation failed'])
+ # debugserver on ios doesn't give an error, it creates another watchpoint,
+ # only expect errors on non-darwin platforms.
+ if not self.platformIsDarwin():
+ # Try setting a watchpoint at byteArray[1]
+ self.expect("watchpoint set variable byteArray[1]", error=True,
+ substrs=['Watchpoint creation failed'])
self.runCmd("process continue")
@@ -90,8 +91,13 @@ class WatchpointSlotsTestCase(TestBase):
# We should be stopped due to the watchpoint.
# The stop reason of the thread should be watchpoint.
- self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT,
- substrs=['stopped', 'stop reason = watchpoint 3'])
+ if self.platformIsDarwin():
+ # On darwin we'll hit byteArray[3] which is watchpoint 2
+ self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 2'])
+ else:
+ self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 3'])
# Resume inferior.
self.runCmd("process continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
index 78273d6ec69c..0c5798fdddfe 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -18,8 +18,6 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -29,8 +27,6 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
self.setTearDownCleanup()
self.hello_multiple_threads()
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
index 15657708ce46..71686a5f5c49 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -13,11 +13,6 @@ class TestStepOverWatchpoint(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=[
@@ -29,6 +24,8 @@ class TestStepOverWatchpoint(TestBase):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
+ @expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34027183>") # watchpoint tests aren't working on arm64
+ @add_test_categories(["basic_process"])
def test(self):
"""Test stepping over watchpoints."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
index 7a9904c53f83..82865e646be5 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
@@ -36,8 +36,6 @@ class WatchpointCommandsTestCase(TestBase):
self.exe_name = self.testMethodName
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -109,8 +107,6 @@ class WatchpointCommandsTestCase(TestBase):
self.expect("watchpoint list -v",
substrs=['hit_count = 2'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -168,8 +164,6 @@ class WatchpointCommandsTestCase(TestBase):
self.expect("process status",
substrs=['exited'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -230,8 +224,6 @@ class WatchpointCommandsTestCase(TestBase):
self.expect("watchpoint list -v",
substrs=['hit_count = 2', 'ignore_count = 2'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -302,8 +294,6 @@ class WatchpointCommandsTestCase(TestBase):
self.expect("watchpoint list -v",
substrs=['hit_count = 1'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
index 5b89f14dd853..a4ceca34c086 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
@@ -33,8 +33,6 @@ class WatchpointLLDBCommandTestCase(TestBase):
self.exe_name = 'a%d.out' % self.test_number
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
@@ -103,8 +101,6 @@ class WatchpointLLDBCommandTestCase(TestBase):
self.expect("frame variable --show-globals cookie",
substrs=['(int32_t)', 'cookie = 777'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
index 16a34428ad70..50cd88bd8625 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -37,8 +37,6 @@ class WatchpointPythonCommandTestCase(TestBase):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
@@ -109,8 +107,6 @@ class WatchpointPythonCommandTestCase(TestBase):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 5a16856149ba..34502a6d1d36 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
@@ -33,8 +33,6 @@ class WatchpointConditionCmdTestCase(TestBase):
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
index aac001e9db5a..dad633f052c6 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
@@ -16,8 +16,6 @@ class TestWatchpointSetEnable(TestBase):
# Call super's setUp().
TestBase.setUp(self)
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -26,7 +24,6 @@ class TestWatchpointSetEnable(TestBase):
self.build()
self.do_test(False)
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
index 02180a127a8e..ea2580382520 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
@@ -22,8 +22,6 @@ class TestWatchpointEvents (TestBase):
self.main_source = "main.c"
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
index 3f301fd9f1a9..ee4b05c12659 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
@@ -17,8 +17,6 @@ class TestValueOfVectorVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
index 1a94276c58e8..b53e323cf4bd 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
@@ -30,8 +30,6 @@ class WatchLocationUsingWatchpointSetTestCase(TestBase):
# Build dictionary to have unique executable names for each test
# method.
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=[
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
index e342e34667fe..ee6402489330 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
@@ -31,8 +31,6 @@ class WatchpointSizeTestCase(TestBase):
self.exe_name = 'a.out'
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -42,8 +40,6 @@ class WatchpointSizeTestCase(TestBase):
"""Test to selectively watch different bytes in a 8-byte array."""
self.run_watchpoint_size_test('byteArray', 8, '1')
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -53,8 +49,6 @@ class WatchpointSizeTestCase(TestBase):
"""Test to selectively watch different words in an 8-byte word array."""
self.run_watchpoint_size_test('wordArray', 4, '2')
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/help/TestHelp.py b/packages/Python/lldbsuite/test/help/TestHelp.py
index 21eeb0bf63a1..2b89b49a6229 100644
--- a/packages/Python/lldbsuite/test/help/TestHelp.py
+++ b/packages/Python/lldbsuite/test/help/TestHelp.py
@@ -230,3 +230,12 @@ class HelpCommandTestCase(TestBase):
'command alias --long-help "I am a very friendly alias" -- averyfriendlyalias help')
self.expect("help averyfriendlyalias", matching=True,
substrs=['I am a very friendly alias'])
+ @no_debug_info_test
+ def test_help_format_output(self):
+ """Test that help output reaches TerminalWidth."""
+ self.runCmd(
+ 'settings set term-width 108')
+ self.expect(
+ "help format",
+ matching=True,
+ substrs=['<format> -- One of the format names'])
diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
index f54202edade3..dd4da061fdcf 100644
--- a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
@@ -22,12 +22,6 @@ class GlobalVariablesTestCase(TestBase):
self.shlib_names = ["a"]
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- @expectedFailureAll(
- "llvm.org/pr25872, <rdar://problem/28725399>",
- oslist=["macosx"],
- debug_info=[
- "dwarf",
- "gmodules"])
def test_c_global_variables(self):
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/c/inlines/main.c b/packages/Python/lldbsuite/test/lang/c/inlines/main.c
index f45e4e2b1497..415f97aedbd4 100644
--- a/packages/Python/lldbsuite/test/lang/c/inlines/main.c
+++ b/packages/Python/lldbsuite/test/lang/c/inlines/main.c
@@ -14,7 +14,7 @@ void test2(int b) {
void test1(int a) {
printf("test1(%d)\n", a);
- test2(a+1);//% self.dbg.HandleCommand("step")
+ test2(a+1);//% self.runCmd("step")
//% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["24"])
}
diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
index edc83bf58985..5505d15854d1 100644
--- a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
+++ b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
@@ -5,6 +5,7 @@ from __future__ import print_function
import unittest2
import lldb
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
@@ -34,10 +35,12 @@ class SharedLibTestCase(TestBase):
"expression GetMeASubFoo(my_foo_ptr)",
startstr="(sub_foo *) $")
+ @expectedFailureAll(oslist=["windows"])
def test_expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
self.common_test_expr(True)
+ @expectedFailureAll(oslist=["windows"])
def test_expr_no_preload(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled"""
self.common_test_expr(False)
diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/.categories b/packages/Python/lldbsuite/test/lang/c/step-target/.categories
new file mode 100644
index 000000000000..c00c25822e4c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/c/step-target/.categories
@@ -0,0 +1 @@
+basic_process
diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
index b1aa98c50ba4..90f07860afa7 100644
--- a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
+++ b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
@@ -14,9 +14,6 @@ class TestStepTarget(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
index d693e1dada51..e1916a550a12 100644
--- a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -15,16 +15,13 @@ class TestCStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers that we will step to in main:
self.main_source = "main.c"
- @add_test_categories(['pyapi'])
+ @add_test_categories(['pyapi', 'basic_process'])
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17932')
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr14437")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24777")
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
index c6952d4d904a..4388d95840eb 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
@@ -49,7 +49,9 @@ class TlsGlobalTestCase(TestBase):
"""Test thread-local storage."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ target = self.dbg.CreateTarget(exe)
+ if self.platformIsDarwin():
+ self.registerSharedLibrariesWithTarget(target, ['liba.dylib'])
line1 = line_number('main.c', '// thread breakpoint')
lldbutil.run_break_set_by_file_and_line(
diff --git a/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile b/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
index 194af7b32398..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ b/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,6 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
index e8d3284f6098..82e44fb1759f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
@@ -99,8 +99,8 @@ class CPP11EnumTypesTestCase(TestBase):
# Look up information about the 'DayType' enum type.
# Check for correct display.
self.expect("image lookup -t DayType", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs=['enum DayType {',
- 'Monday',
+ patterns=['enum( struct| class) DayType {'],
+ substrs=['Monday',
'Tuesday',
'Wednesday',
'Thursday',
diff --git a/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py b/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
index fb7fadffa783..fd19de7086da 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
@@ -11,7 +11,6 @@ class TestCppNsImport(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr25925")
def test_with_run_command(self):
"""Tests imported namespaces in C++."""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py b/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
index ce270b1ea391..d5ff93f0cc1f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
@@ -15,11 +15,6 @@ class TestCppScopes(TestBase):
def test_all_but_c(self):
self.do_test(False)
- # There's a global symbol in libsystem on Darwin that messes up
- # the lookup of class C. Breaking that test out from the others
- # since that is a odd failure, and I don't want it to mask the
- # real purpose of this test.
- @expectedFailureDarwin(bugnumber="<rdar://problem/28623427>")
@expectedFailureAll(oslist=["windows"])
def test_c(self):
self.do_test(True)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile b/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
index f61a6300a994..fe27980afe9b 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
+++ b/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
@@ -5,11 +5,4 @@ CFLAGS := -g -O0
clean: OBJECTS+=$(wildcard main.d.*)
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/cpp/template/Makefile b/packages/Python/lldbsuite/test/lang/cpp/template/Makefile
index 194af7b32398..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/template/Makefile
+++ b/packages/Python/lldbsuite/test/lang/cpp/template/Makefile
@@ -2,6 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
index 3d24348618da..2d6de6f1514b 100644
--- a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
@@ -1,6 +1,20 @@
LEVEL = ../../../make
-CFLAGS = -g -O0
+CC ?= clang
+ifeq "$(ARCH)" ""
+ ARCH = x86_64
+endif
+
+ifeq "$(OS)" ""
+ OS = $(shell uname -s)
+endif
+
+CFLAGS ?= -g -O0
+
+ifeq "$(OS)" "Darwin"
+ CFLAGS += -arch $(ARCH)
+endif
+
LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
all: a.out libTest.dylib libTestExt.dylib
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py
index 564a1e15c06c..df3a41fedf60 100644
--- a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py
@@ -21,6 +21,7 @@ class TestRealDefinition(TestBase):
if self.getArchitecture() == 'i386':
self.skipTest("requires modern objc runtime")
self.build()
+ self.shlib_names = ["libTestExt.dylib", "libTest.dylib"]
self.common_setup()
line = line_number('TestExt/TestExt.m', '// break here')
@@ -46,4 +47,7 @@ class TestRealDefinition(TestBase):
def common_setup(self):
exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
diff --git a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
index 329ceabeea97..bd940ab148c9 100644
--- a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
+++ b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
@@ -1,12 +1,28 @@
LEVEL = ../../../make
-myclass.o: myclass.h myclass.m
- $(CC) myclass.m -c -o myclass.o
+CC ?= clang
+ifeq "$(ARCH)" ""
+ ARCH = x86_64
+endif
-repro: myclass.o repro.m
- $(CC) -g -O0 myclass.o repro.m -framework Foundation
+ifeq "$(OS)" ""
+ OS = $(shell uname -s)
+endif
-cleanup:
- rm -r myclass.o
+CFLAGS ?= -g -O0
+CFLAGS_NO_DEBUG =
+ifeq "$(OS)" "Darwin"
+ CFLAGS += -arch $(ARCH)
+ CFLAGS_NO_DEBUG += -arch $(ARCH)
+endif
+
+all: aout
+
+aout:
+ $(CC) $(CFLAGS_NO_DEBUG) myclass.m -c -o myclass.o
+ $(CC) $(CFLAGS) myclass.o repro.m -framework Foundation
+
+clean::
+ rm -f myclass.o
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
index 79b7ee5dbfb0..d29476727bd6 100644
--- a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
+++ b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
@@ -30,15 +30,11 @@ class ObjCiVarIMPTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @skipIf(archs=['i386']) # objc file does not build for i386
@no_debug_info_test
def test_imp_ivar_type(self):
"""Test that dynamically discovered ivars of type IMP do not crash LLDB"""
- execute_command("make repro")
-
- def cleanup():
- execute_command("make cleanup")
- self.addTearDownHook(cleanup)
-
+ self.build()
exe = os.path.join(os.getcwd(), "a.out")
# Create a target from the debugger.
diff --git a/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py b/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
index 2904621a416c..328335dfe2c9 100644
--- a/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
+++ b/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
@@ -28,7 +28,6 @@ class ModulesInlineFunctionsTestCase(TestBase):
@skipUnlessDarwin
@skipIf(macos_version=["<", "10.12"])
- @expectedFailureDarwin("llvm.org/pr25743")
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py b/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
index 50ed2992ee79..562c0cfc1e7a 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
@@ -60,5 +60,9 @@ class TestObjCClassMethod(TestBase):
cmd_value = frame.EvaluateExpression(
"(int)[Foo doSomethingWithString:@\"Hello\"]")
+ if self.TraceOn():
+ if cmd_value.IsValid():
+ print("cmd_value is valid")
+ print("cmd_value has the value %d" % cmd_value.GetValueAsUnsigned())
self.assertTrue(cmd_value.IsValid())
self.assertTrue(cmd_value.GetValueAsUnsigned() == 5)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
index 96c5a33f14b0..84b12579166d 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
@@ -47,12 +47,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=[' resolved, hit count = 1'])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_read_array(self):
@@ -69,12 +63,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["foo"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_update_array(self):
@@ -91,12 +79,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["bar"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_read_dictionary(self):
@@ -113,12 +95,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["value"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_update_dictionary(self):
@@ -135,12 +111,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["object"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_array_literal(self):
@@ -155,12 +125,6 @@ class ObjCNewSyntaxTestCase(TestBase):
"bar"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_dictionary_literal(self):
@@ -174,12 +138,6 @@ class ObjCNewSyntaxTestCase(TestBase):
"object"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_char_literal(self):
@@ -189,12 +147,6 @@ class ObjCNewSyntaxTestCase(TestBase):
VARIABLES_DISPLAYED_CORRECTLY, substrs=[str(ord('a'))])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_integer_literals(self):
@@ -226,12 +178,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["1"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_float_literal(self):
@@ -241,12 +187,6 @@ class ObjCNewSyntaxTestCase(TestBase):
substrs=["NSNumber", "123.45"])
@skipUnlessDarwin
- @expectedFailureAll(
- oslist=['macosx'],
- compiler='clang',
- compiler_version=[
- '<',
- '7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
def test_expressions_in_literals(self):
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py b/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
index 8516ef3281ff..95eb6e5a212d 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
@@ -13,9 +13,6 @@ from lldbsuite.test import lldbutil
class TestObjCStepping(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -35,7 +32,7 @@ class TestObjCStepping(TestBase):
self.main_source, '// Step over nil should stop here.')
@skipUnlessDarwin
- @add_test_categories(['pyapi'])
+ @add_test_categories(['pyapi', 'basic_process'])
def test_with_python_api(self):
"""Test stepping through ObjC method dispatch in various forms."""
self.build()
@@ -162,6 +159,7 @@ class TestObjCStepping(TestBase):
newClassName = mySource_isa.GetSummary()
if self.TraceOn():
+ print("className is %s, newClassName is %s" % (className, newClassName))
print(mySource_isa)
self.assertTrue(
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
index 75f726340ef7..650923a729e4 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
@@ -25,6 +25,7 @@ class TestObjCStructArgument(TestBase):
@skipUnlessDarwin
@add_test_categories(['pyapi'])
+ @skipIf(debug_info=no_match(["gmodules"]), oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'arm64']) # this test program only builds for ios with -gmodules
def test_with_python_api(self):
"""Test passing structs to Objective-C methods."""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
index f013c5602395..337ab3408ce2 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
@@ -1,4 +1,10 @@
#import <Foundation/Foundation.h>
+#include <TargetConditionals.h>
+
+#if TARGET_OS_IPHONE
+@import CoreGraphics;
+typedef CGRect NSRect;
+#endif
struct things_to_sum {
int a;
diff --git a/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py b/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
index 26afe71d1de9..d1956d46e7b6 100644
--- a/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
@@ -46,13 +46,13 @@ class Rdar10967107TestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
# check that we correctly see the const char*, even with dynamic types
# on
- self.expect("frame variable my_string", substrs=['const char *'])
+ self.expect("frame variable -raw-output my_string", substrs=['const char *'])
self.expect(
- "frame variable my_string --dynamic-type run-target",
+ "frame variable my_string --raw-output --dynamic-type run-target",
substrs=['const char *'])
# check that expr also gets it right
- self.expect("expr my_string", substrs=['const char *'])
- self.expect("expr -d run -- my_string", substrs=['const char *'])
+ self.expect("e -R -- my_string", substrs=['const char *'])
+ self.expect("expr -R -d run -- my_string", substrs=['const char *'])
# but check that we get the real Foolie as such
self.expect("frame variable my_foolie", substrs=['FoolMeOnce *'])
self.expect(
diff --git a/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py b/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
index 97b137818a07..54011db1a120 100644
--- a/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
+++ b/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
@@ -27,6 +27,7 @@ class ObjCSingleEntryDictionaryTestCase(TestBase):
self.line = line_number('main.m', '// break here')
@skipUnlessDarwin
+ @expectedFailureAll(oslist=['watchos'], bugnumber="rdar://problem/34642736") # bug in NSDictionary formatting on watchos
def test_single_entry_dict(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
diff --git a/packages/Python/lldbsuite/test/linux/add-symbols/Makefile b/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
new file mode 100644
index 000000000000..c701797f0a7d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
@@ -0,0 +1,12 @@
+LEVEL = ../../make
+CXX_SOURCES := main.cpp
+LD_EXTRAS += -Wl,--build-id=none
+
+localall : stripped.out all
+stripped.out : a.out
+ $(OBJCOPY) --remove-section=.note.gnu.build-id --remove-section=.gnu_debuglink --strip-debug a.out stripped.out
+
+clean::
+ $(RM) stripped.out
+
+include $(LEVEL)/Makefile.rules \ No newline at end of file
diff --git a/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py b/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
new file mode 100644
index 000000000000..477ddf9c15b1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
@@ -0,0 +1,52 @@
+""" Testing explicit symbol loading via target symbols add. """
+import os
+import time
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TargetSymbolsAddCommand(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = 'main.c'
+
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @skipUnlessPlatform(['linux'])
+ def test_target_symbols_add(self):
+ """Test that 'target symbols add' can load the symbols
+ even if gnu.build-id and gnu_debuglink are not present in the module.
+ Similar to test_add_dsym_mid_execution test for macos."""
+ self.build(clean=True)
+ exe = os.path.join(os.getcwd(), "stripped.out")
+
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+
+ main_bp = self.target.BreakpointCreateByName("main", "stripped.out")
+ self.assertTrue(main_bp, VALID_BREAKPOINT)
+
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(self.process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped,
+ STOPPED_DUE_TO_BREAKPOINT)
+
+ exe_module = self.target.GetModuleAtIndex(0)
+
+ # Check that symbols are not loaded and main.c is not know to be
+ # the source file.
+ self.expect("frame select", substrs=['main.c'], matching=False)
+
+ # Tell LLDB that a.out has symbols for stripped.out
+ self.runCmd("target symbols add -s stripped.out a.out")
+
+ # Check that symbols are now loaded and main.c is in the output.
+ self.expect("frame select", substrs=['main.c'])
diff --git a/packages/Python/lldbsuite/test/linux/add-symbols/main.c b/packages/Python/lldbsuite/test/linux/add-symbols/main.c
new file mode 100644
index 000000000000..5a0915746b74
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/add-symbols/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+static int var = 5;
+int main() {
+ printf("%p is %d\n", &var, var);
+ return ++var;
+}
diff --git a/packages/Python/lldbsuite/test/lldbinline.py b/packages/Python/lldbsuite/test/lldbinline.py
index 727e69d412a2..70a0dda5343b 100644
--- a/packages/Python/lldbsuite/test/lldbinline.py
+++ b/packages/Python/lldbsuite/test/lldbinline.py
@@ -134,25 +134,28 @@ class InlineTest(TestBase):
makefile.flush()
makefile.close()
- @skipUnlessDarwin
+ @add_test_categories(["dsym"])
def __test_with_dsym(self):
self.using_dsym = True
self.BuildMakefile()
self.buildDsym()
self.do_test()
+ @add_test_categories(["dwarf"])
def __test_with_dwarf(self):
self.using_dsym = False
self.BuildMakefile()
self.buildDwarf()
self.do_test()
+ @add_test_categories(["dwo"])
def __test_with_dwo(self):
self.using_dsym = False
self.BuildMakefile()
self.buildDwo()
self.do_test()
+ @add_test_categories(["gmodules"])
def __test_with_gmodules(self):
self.using_dsym = False
self.BuildMakefile()
diff --git a/packages/Python/lldbsuite/test/lldbplatform.py b/packages/Python/lldbsuite/test/lldbplatform.py
index 84c027d88ff4..23d93e19d948 100644
--- a/packages/Python/lldbsuite/test/lldbplatform.py
+++ b/packages/Python/lldbsuite/test/lldbplatform.py
@@ -12,8 +12,8 @@ import six
import use_lldb_suite
import lldb
-windows, linux, macosx, darwin, ios, darwin_all, freebsd, netbsd, bsd_all, android = range(
- 10)
+windows, linux, macosx, darwin, ios, tvos, watchos, bridgeos, darwin_all, darwin_embedded, freebsd, netbsd, bsd_all, android = range(
+ 14)
__name_lookup = {
windows: ["windows"],
@@ -21,7 +21,11 @@ __name_lookup = {
macosx: ["macosx"],
darwin: ["darwin"],
ios: ["ios"],
- darwin_all: ["macosx", "darwin", "ios"],
+ tvos: ["tvos"],
+ watchos: ["watchos"],
+ bridgeos: ["bridgeos"],
+ darwin_all: ["macosx", "darwin", "ios", "tvos", "watchos", "bridgeos"],
+ darwin_embedded: ["ios", "tvos", "watchos", "bridgeos"],
freebsd: ["freebsd"],
netbsd: ["netbsd"],
bsd_all: ["freebsd", "netbsd"],
diff --git a/packages/Python/lldbsuite/test/lldbplatformutil.py b/packages/Python/lldbsuite/test/lldbplatformutil.py
index 4f45643241ed..f7da58bd5259 100644
--- a/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -25,9 +25,9 @@ def check_first_register_readable(test_case):
if arch in ['x86_64', 'i386']:
test_case.expect("register read eax", substrs=['eax = 0x'])
- elif arch in ['arm']:
+ elif arch in ['arm', 'armv7', 'armv7k']:
test_case.expect("register read r0", substrs=['r0 = 0x'])
- elif arch in ['aarch64']:
+ elif arch in ['aarch64', 'arm64']:
test_case.expect("register read x0", substrs=['x0 = 0x'])
elif re.match("mips", arch):
test_case.expect("register read zero", substrs=['zero = 0x'])
@@ -100,8 +100,7 @@ def finalize_build_dictionary(dictionary):
if dictionary is None:
dictionary = {}
dictionary["OS"] = "Android"
- if android_device_api() >= 16:
- dictionary["PIE"] = 1
+ dictionary["PIE"] = 1
return dictionary
@@ -123,7 +122,7 @@ def getHostPlatform():
def getDarwinOSTriples():
- return ['darwin', 'macosx', 'ios']
+ return ['darwin', 'macosx', 'ios', 'watchos', 'tvos', 'bridgeos']
def getPlatform():
@@ -175,6 +174,6 @@ def createPlatformContext():
def hasChattyStderr(test_case):
"""Some targets produce garbage on the standard error output. This utility function
determines whether the tests can be strict about the expected stderr contents."""
- if match_android_device(test_case.getArchitecture(), ['aarch64'], [22]):
+ if match_android_device(test_case.getArchitecture(), ['aarch64'], range(22, 25+1)):
return True # The dynamic linker on the device will complain about unknown DT entries
return False
diff --git a/packages/Python/lldbsuite/test/lldbtest.py b/packages/Python/lldbsuite/test/lldbtest.py
index f1d65cf2076d..ecc38f355436 100644
--- a/packages/Python/lldbsuite/test/lldbtest.py
+++ b/packages/Python/lldbsuite/test/lldbtest.py
@@ -706,7 +706,7 @@ class Base(unittest2.TestCase):
# This function removes all files from the current working directory while leaving
# the directories in place. The cleaup is required to reduce the disk space required
- # by the test suit while leaving the directories untached is neccessary because
+ # by the test suite while leaving the directories untouched is neccessary because
# sub-directories might belong to an other test
def clean_working_directory():
# TODO: Make it working on Windows when we need it for remote debugging support
@@ -1371,10 +1371,9 @@ class Base(unittest2.TestCase):
self.dumpSessionInfo()."""
arch = self.getArchitecture()
comp = self.getCompiler()
+ option_str = ""
if arch:
option_str = "-A " + arch
- else:
- option_str = ""
if comp:
option_str += " -C " + comp
return option_str
@@ -1511,6 +1510,7 @@ class Base(unittest2.TestCase):
clean=True):
"""Platform specific way to build binaries with dsym info."""
module = builder_module()
+ dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
if not module.buildDsym(
self,
architecture,
@@ -1561,6 +1561,7 @@ class Base(unittest2.TestCase):
clean=True):
"""Platform specific way to build binaries with gmodules info."""
module = builder_module()
+ dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
if not module.buildGModules(
self,
architecture,
@@ -1833,30 +1834,6 @@ class TestBase(Base):
# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
timeWaitNextLaunch = 1.0
- # Returns the list of categories to which this test case belongs
- # by default, look for a ".categories" file, and read its contents
- # if no such file exists, traverse the hierarchy - we guarantee
- # a .categories to exist at the top level directory so we do not end up
- # looping endlessly - subclasses are free to define their own categories
- # in whatever way makes sense to them
- def getCategories(self):
- import inspect
- import os.path
- folder = inspect.getfile(self.__class__)
- folder = os.path.dirname(folder)
- while folder != '/':
- categories_file_name = os.path.join(folder, ".categories")
- if os.path.exists(categories_file_name):
- categories_file = open(categories_file_name, 'r')
- categories = categories_file.readline()
- categories_file.close()
- categories = str.replace(categories, '\n', '')
- categories = str.replace(categories, '\r', '')
- return categories.split(',')
- else:
- folder = os.path.dirname(folder)
- continue
-
def generateSource(self, source):
template = source + '.template'
temp = os.path.join(os.getcwd(), template)
diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile b/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
index 4e4aa71de2a2..3a363ab98c17 100644
--- a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
+++ b/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
@@ -1,9 +1,22 @@
CC ?= clang
+ifeq "$(ARCH)" ""
+ ARCH = x86_64
+endif
+
+ifeq "$(OS)" ""
+ OS = $(shell uname -s)
+endif
+
+CFLAGS ?= -g -O0
+
+ifeq "$(OS)" "Darwin"
+ CFLAGS += -arch $(ARCH)
+endif
all: clean
mkdir hide.app
mkdir hide.app/Contents
- $(CC) -g main.c
+ $(CC) $(CFLAGS) -g main.c
mv a.out.dSYM hide.app/Contents
strip -x a.out
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py b/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
index e717e2ecdd90..afca8bcc0ded 100644
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
+++ b/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
@@ -31,6 +31,11 @@ class TestIndirectFunctions(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
+ if self.platformIsDarwin():
+ lib1 = os.path.join(os.getcwd(), 'libindirect.dylib')
+ lib2 = os.path.join(os.getcwd(), 'libreexport.dylib')
+ self.registerSharedLibrariesWithTarget(target, [lib1, lib2])
+
self.main_source_spec = lldb.SBFileSpec(self.main_source)
break1 = target.BreakpointCreateBySourceRegex(
diff --git a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py b/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
index 1e9596785f95..c2a27c570898 100644
--- a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
+++ b/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
@@ -14,17 +14,19 @@ import platform
import re
import sys
-from lldbsuite.test import decorators
+from lldbsuite.test.decorators import *
from lldbsuite.test import lldbtest
from lldbsuite.test import lldbtest_config
-@decorators.skipUnlessDarwin
class DarwinNSLogOutputTestCase(lldbtest.TestBase):
NO_DEBUG_INFO_TESTCASE = True
mydir = lldbtest.TestBase.compute_mydir(__file__)
+ @skipUnlessDarwin
+ @skipIfRemote # this test is currently written using lldb commands & assumes running on local system
+
def setUp(self):
# Call super's setUp().
super(DarwinNSLogOutputTestCase, self).setUp()
diff --git a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py b/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
index eae4ae2e42a3..8eabe9a76637 100644
--- a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
+++ b/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
@@ -18,7 +18,6 @@ class TestQueues(TestBase):
@skipUnlessDarwin
@add_test_categories(['pyapi'])
- @expectedFailureAll(bugnumber="rdar://30915340")
def test_with_python_api(self):
"""Test queues inspection SB APIs."""
self.build()
@@ -231,8 +230,9 @@ class TestQueues(TestBase):
"requested_qos.printable_name",
stream),
"Get QoS printable string for unspecified QoS thread")
+ qosName = stream.GetData()
self.assertTrue(
- stream.GetData() == "User Initiated",
+ qosName == "User Initiated" or qosName == "Default",
"unspecified QoS thread name is valid")
stream.Clear()
self.assertTrue(
diff --git a/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py b/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
index b6612b26bde6..ae2916c92de9 100644
--- a/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
+++ b/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
@@ -70,7 +70,14 @@ class TestInterruptThreadNames(TestBase):
inferior_set_up = lldb.SBValue()
retry = 5
while retry > 0:
- time.sleep(1)
+ arch = self.getArchitecture()
+ # when running the testsuite against a remote arm device, it may take
+ # a little longer for the process to start up. Use a "can't possibly take
+ # longer than this" value.
+ if arch == 'arm64' or arch == 'armv7':
+ time.sleep(10)
+ else:
+ time.sleep(1)
process.SendAsyncInterrupt()
self.assertTrue(self.wait_for_stop(process, listener), "Check that process is paused")
inferior_set_up = process.GetTarget().CreateValueFromExpression("threads_up_and_running", "threads_up_and_running")
diff --git a/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py b/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
index 988611935c1e..9a690e3ebb0b 100644
--- a/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
+++ b/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
@@ -26,6 +26,7 @@ class UniversalTestCase(TestBase):
@skipUnlessDarwin
@unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
'i386', 'x86_64'], "requires i386 or x86_64")
+ @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
def test_sbdebugger_create_target_with_file_and_target_triple(self):
"""Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
# Invoke the default build rule.
@@ -47,6 +48,7 @@ class UniversalTestCase(TestBase):
@skipUnlessDarwin
@unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
'i386', 'x86_64'], "requires i386 or x86_64")
+ @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
def test_process_launch_for_universal(self):
"""Test process launch of a universal binary."""
from lldbsuite.test.lldbutil import print_registers
@@ -117,6 +119,7 @@ class UniversalTestCase(TestBase):
@skipUnlessDarwin
@unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
'i386', 'x86_64'], "requires i386 or x86_64")
+ @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
def test_process_attach_with_wrong_arch(self):
"""Test that when we attach to a binary from the wrong fork of a universal binary, we fix up the ABI correctly."""
# Now keep the architecture at 32 bit, but switch the binary we launch to
diff --git a/packages/Python/lldbsuite/test/make/Android.rules b/packages/Python/lldbsuite/test/make/Android.rules
index 058401f425ad..f7b8e2459611 100644
--- a/packages/Python/lldbsuite/test/make/Android.rules
+++ b/packages/Python/lldbsuite/test/make/Android.rules
@@ -8,7 +8,7 @@ else ifeq "$(ARCH)" "i386"
API_LEVEL := 17
else
# lowest supported 32-bit API level
- API_LEVEL := 9
+ API_LEVEL := 16
endif
ifeq "$(ARCH)" "arm"
@@ -18,8 +18,8 @@ ifeq "$(ARCH)" "arm"
ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
else ifeq "$(ARCH)" "aarch64"
SYSROOT_ARCH := arm64
- TRIPLE := aarch64-none-linux-android
STL_ARCH := arm64-v8a
+ TRIPLE := aarch64-none-linux-android
else ifeq "$(ARCH)" "i386"
SYSROOT_ARCH := x86
STL_ARCH := x86
@@ -70,7 +70,9 @@ ifeq "$(findstring clang,$(CC))" "clang"
ARCH_LDFLAGS += -target $(TRIPLE) -gcc-toolchain $(GCC_TOOLCHAIN)
endif
-ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
+ -isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
+ -D__ANDROID_API__=$(API_LEVEL)
ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
ifeq (1,$(USE_LIBCPP))
diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules
index a7b94ef57380..4870cd95f80a 100644
--- a/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -78,6 +78,24 @@ ifneq "$(TRIPLE)" ""
endif
endif
endif
+ ifeq "$(TRIPLE_OS)" "watchos"
+ ifeq "$(SDKROOT)" ""
+ # Set SDKROOT if it wasn't set
+ ifneq (,$(findstring arm,$(ARCH)))
+ SDKROOT = $(shell xcrun --sdk watchos --show-sdk-path)
+ ifeq "$(TRIPLE_VERSION)" ""
+ TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
+ endif
+ ARCH_CFLAGS :=-mwatchos-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
+ else
+ SDKROOT = $(shell xcrun --sdk watchsimulator --show-sdk-path)
+ ifeq "$(TRIPLE_VERSION)" ""
+ TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/')
+ endif
+ ARCH_CFLAGS :=-mwatchos-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)"
+ endif
+ endif
+ endif
endif
endif
ifeq "$(OS)" "Android"
@@ -163,6 +181,9 @@ else
ifeq "$(ARCH)" "powerpc64"
override ARCH := $(subst powerpc64,64,$(ARCH))
endif
+ ifeq "$(ARCH)" "powerpc64le"
+ override ARCH := $(subst powerpc64le,64,$(ARCH))
+ endif
ifeq "$(ARCH)" "aarch64"
override ARCH :=
override ARCHFLAG :=
@@ -197,18 +218,19 @@ DEBUG_INFO_FLAG ?= -g
CFLAGS ?= $(DEBUG_INFO_FLAG) -O0 -fno-builtin
ifeq "$(OS)" "Darwin"
- CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+ CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include
else
- CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+ CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include
endif
-CFLAGS += -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) $(ARCH_CFLAGS)
+CFLAGS += -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR)
+CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
# Use this one if you want to build one part of the result without debug information:
ifeq "$(OS)" "Darwin"
- CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(ARCH_CFLAGS)
+ CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
else
- CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(ARCH_CFLAGS)
+ CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
endif
ifeq "$(MAKE_DWO)" "YES"
@@ -225,7 +247,7 @@ CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
-ifeq (,$(filter $(OS), Windows_NT Android))
+ifeq (,$(filter $(OS), Windows_NT Android Darwin))
ifneq (,$(filter YES,$(ENABLE_THREADS)))
LDFLAGS += -pthread
endif
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index 4739df000853..5c0c7bbd766a 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -73,6 +73,17 @@ class APIDefaultConstructorTestCase(TestBase):
@add_test_categories(['pyapi'])
@no_debug_info_test
+ def test_SBBreakpointName(self):
+ obj = lldb.SBBreakpointName()
+ if self.TraceOn():
+ print(obj)
+ self.assertFalse(obj)
+ # Do fuzz testing on the invalid obj, it should not crash lldb.
+ import sb_breakpointname
+ sb_breakpointname.fuzz_obj(obj)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
def test_SBBroadcaster(self):
obj = lldb.SBBroadcaster()
if self.TraceOn():
@@ -255,6 +266,17 @@ class APIDefaultConstructorTestCase(TestBase):
@add_test_categories(['pyapi'])
@no_debug_info_test
+ def test_SBProcessInfo(self):
+ obj = lldb.SBProcessInfo()
+ if self.TraceOn():
+ print(obj)
+ self.assertFalse(obj)
+ # Do fuzz testing on the invalid obj, it should not crash lldb.
+ import sb_process_info
+ sb_process_info.fuzz_obj(obj)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
def test_SBSection(self):
obj = lldb.SBSection()
if self.TraceOn():
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py
new file mode 100644
index 000000000000..56016c05c313
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py
@@ -0,0 +1,42 @@
+"""
+Fuzz tests an object after the default construction to make sure it does not crash lldb.
+"""
+
+import sys
+import lldb
+
+
+def fuzz_obj(obj):
+ obj.IsValid()
+ obj.GetName()
+ obj.SetEnabled(True)
+ obj.IsEnabled()
+ obj.SetOneShot(True)
+ obj.IsOneShot()
+ obj.SetIgnoreCount(1)
+ obj.GetIgnoreCount()
+ obj.SetCondition("1 == 2")
+ obj.GetCondition()
+ obj.SetAutoContinue(False)
+ obj.GetAutoContinue()
+ obj.SetThreadID(0x1234)
+ obj.GetThreadID()
+ obj.SetThreadIndex(10)
+ obj.GetThreadIndex()
+ obj.SetThreadName("AThread")
+ obj.GetThreadName()
+ obj.SetQueueName("AQueue")
+ obj.GetQueueName()
+ obj.SetScriptCallbackFunction("AFunction")
+ commands = lldb.SBStringList()
+ obj.SetCommandLineCommands(commands)
+ obj.GetCommandLineCommands(commands)
+ obj.SetScriptCallbackBody("Insert Python Code here")
+ obj.GetAllowList()
+ obj.SetAllowList(False)
+ obj.GetAllowDelete()
+ obj.SetAllowDelete(False)
+ obj.GetAllowDisable()
+ obj.SetAllowDisable(False)
+ stream = lldb.SBStream()
+ obj.GetDescription(stream)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
index 77e45c861e8d..ac0f9a8aeb94 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
@@ -30,6 +30,10 @@ def fuzz_obj(obj):
obj.FindTargetWithFileAndArch("a.out", "arm")
obj.GetNumTargets()
obj.GetSelectedTarget()
+ obj.GetNumPlatforms()
+ obj.GetPlatformAtIndex(0xffffffff)
+ obj.GetNumAvailablePlatforms()
+ obj.GetAvailablePlatformInfoAtIndex(0xffffffff)
obj.GetSourceManager()
obj.SetSelectedTarget(lldb.SBTarget())
obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py
new file mode 100644
index 000000000000..020ad4e10664
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py
@@ -0,0 +1,22 @@
+"""
+Fuzz tests an object after the default construction to make sure it does not crash lldb.
+"""
+
+import sys
+import lldb
+
+
+def fuzz_obj(obj):
+ obj.IsValid()
+ obj.GetName()
+ obj.GetExecutableFile()
+ obj.GetProcessID()
+ obj.GetUserID()
+ obj.GetGroupID()
+ obj.UserIDIsValid()
+ obj.GroupIDIsValid()
+ obj.GetEffectiveUserID()
+ obj.GetEffectiveGroupID()
+ obj.EffectiveUserIDIsValid()
+ obj.EffectiveGroupIDIsValid()
+ obj.GetParentProcessID()
diff --git a/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/main.mm b/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/main.mm
index f7383a5a14de..9d4630dc7c4c 100644
--- a/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/main.mm
+++ b/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/main.mm
@@ -6,7 +6,7 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
#include <vector>
int main (int argc, char const *argv[])
diff --git a/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py b/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
diff --git a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
index 06ca772073ac..a2d2cf12cdca 100644
--- a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
+++ b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
@@ -90,7 +90,7 @@ class FrameAPITestCase(TestBase):
# Make sure on arm targets we dont mismatch PC value on the basis of thumb bit.
# Frame PC will not have thumb bit set in case of a thumb
# instruction as PC.
- if self.getArchitecture() in ['arm']:
+ if self.getArchitecture() in ['arm', 'armv7', 'armv7k']:
pc_value_int &= ~1
self.assertTrue(
pc_value_int == frame.GetPC(),
diff --git a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
index 44dd4a618507..fb4e54aa0bc5 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
@@ -79,6 +79,7 @@ class HelloWorldTestCase(TestBase):
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24600")
@skipIfiOSSimulator
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_with_attach_to_process_with_id_api(self):
"""Create target, spawn a process, and attach to it with process id."""
self.build(dictionary=self.d)
@@ -108,6 +109,7 @@ class HelloWorldTestCase(TestBase):
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24600")
@skipIfiOSSimulator
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_with_attach_to_process_with_name_api(self):
"""Create target, spawn a process, and attach to it with process name."""
self.build(dictionary=self.d)
diff --git a/packages/Python/lldbsuite/test/python_api/hello_world/main.c b/packages/Python/lldbsuite/test/python_api/hello_world/main.c
index 1b942d0db159..001e9c01e6e5 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/main.c
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/main.c
@@ -1,5 +1,5 @@
#include <stdio.h>
-
+#include <unistd.h>
int main(int argc, char const *argv[])
{
lldb_enable_attach();
@@ -10,9 +10,8 @@ int main(int argc, char const *argv[])
// Waiting to be attached by the debugger, otherwise.
char line[100];
- while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached...
- printf("input line=>%s\n", line);
- }
+ while (1)
+ sleep (1); // Waiting to be attached...
printf("Exiting now\n");
}
diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
index 49a78888ad89..a19cc5c375f5 100644
--- a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -76,17 +76,18 @@ class RegistersIteratorTestCase(TestBase):
REGs = lldbutil.get_ESRs(frame)
if self.platformIsDarwin():
- num = len(REGs)
- if self.TraceOn():
- print(
- "\nNumber of exception state registers: %d" %
- num)
- for reg in REGs:
- self.assertTrue(reg)
+ if self.getArchitecture() != 'armv7' and self.getArchitecture() != 'armv7k':
+ num = len(REGs)
if self.TraceOn():
print(
- "%s => %s" %
- (reg.GetName(), reg.GetValue()))
+ "\nNumber of exception state registers: %d" %
+ num)
+ for reg in REGs:
+ self.assertTrue(reg)
+ if self.TraceOn():
+ print(
+ "%s => %s" %
+ (reg.GetName(), reg.GetValue()))
else:
self.assertIsNone(REGs)
@@ -99,7 +100,8 @@ class RegistersIteratorTestCase(TestBase):
REGs = lldbutil.get_registers(
frame, "Exception State Registers")
if self.platformIsDarwin():
- self.assertIsNotNone(REGs)
+ if self.getArchitecture() != 'armv7' and self.getArchitecture() != 'armv7k':
+ self.assertIsNotNone(REGs)
else:
self.assertIsNone(REGs)
diff --git a/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py b/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
index 1009536b3709..065c70744890 100644
--- a/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
@@ -325,3 +325,79 @@ class ProcessAPITestCase(TestBase):
num = process.GetNumSupportedHardwareWatchpoints(error)
if self.TraceOn() and error.Success():
print("Number of supported hardware watchpoints: %d" % num)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
+ def test_get_process_info(self):
+ """Test SBProcess::GetProcessInfo() API with a locally launched process."""
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Launch the process and stop at the entry point.
+ launch_info = lldb.SBLaunchInfo(None)
+ launch_info.SetWorkingDirectory(self.get_process_working_directory())
+ launch_flags = launch_info.GetLaunchFlags()
+ launch_flags |= lldb.eLaunchFlagStopAtEntry
+ launch_info.SetLaunchFlags(launch_flags)
+ error = lldb.SBError()
+ process = target.Launch(launch_info, error)
+
+ if not error.Success():
+ self.fail("Failed to launch process")
+
+ # Verify basic process info can be retrieved successfully
+ process_info = process.GetProcessInfo()
+ self.assertTrue(process_info.IsValid())
+ file_spec = process_info.GetExecutableFile()
+ self.assertTrue(file_spec.IsValid())
+ process_name = process_info.GetName()
+ self.assertIsNotNone(process_name, "Process has a name")
+ self.assertGreater(len(process_name), 0, "Process name isn't blank")
+ self.assertEqual(file_spec.GetFilename(), "a.out")
+ self.assertNotEqual(
+ process_info.GetProcessID(), lldb.LLDB_INVALID_PROCESS_ID,
+ "Process ID is valid")
+
+ # Additional process info varies by platform, so just check that
+ # whatever info was retrieved is consistent and nothing blows up.
+ if process_info.UserIDIsValid():
+ self.assertNotEqual(
+ process_info.GetUserID(), lldb.UINT32_MAX,
+ "Process user ID is valid")
+ else:
+ self.assertEqual(
+ process_info.GetUserID(), lldb.UINT32_MAX,
+ "Process user ID is invalid")
+
+ if process_info.GroupIDIsValid():
+ self.assertNotEqual(
+ process_info.GetGroupID(), lldb.UINT32_MAX,
+ "Process group ID is valid")
+ else:
+ self.assertEqual(
+ process_info.GetGroupID(), lldb.UINT32_MAX,
+ "Process group ID is invalid")
+
+ if process_info.EffectiveUserIDIsValid():
+ self.assertNotEqual(
+ process_info.GetEffectiveUserID(), lldb.UINT32_MAX,
+ "Process effective user ID is valid")
+ else:
+ self.assertEqual(
+ process_info.GetEffectiveUserID(), lldb.UINT32_MAX,
+ "Process effective user ID is invalid")
+
+ if process_info.EffectiveGroupIDIsValid():
+ self.assertNotEqual(
+ process_info.GetEffectiveGroupID(), lldb.UINT32_MAX,
+ "Process effective group ID is valid")
+ else:
+ self.assertEqual(
+ process_info.GetEffectiveGroupID(), lldb.UINT32_MAX,
+ "Process effective group ID is invalid")
+
+ process_info.GetParentProcessID()
diff --git a/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py b/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
index 5314930ff99e..71f77b368809 100644
--- a/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
+++ b/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
@@ -59,6 +59,7 @@ class ProcessIOTestCase(TestBase):
@skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
+ @skipIfDarwinEmbedded # debugserver can't create/write files on the device
def test_stdout_redirection(self):
"""Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT without specifying STDIN or STDERR."""
self.build()
@@ -72,6 +73,7 @@ class ProcessIOTestCase(TestBase):
@skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
+ @skipIfDarwinEmbedded # debugserver can't create/write files on the device
def test_stderr_redirection(self):
"""Exercise SBLaunchInfo::AddOpenFileAction() for STDERR without specifying STDIN or STDOUT."""
self.build()
@@ -85,6 +87,7 @@ class ProcessIOTestCase(TestBase):
@skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
+ @skipIfDarwinEmbedded # debugserver can't create/write files on the device
def test_stdout_stderr_redirection(self):
"""Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN."""
self.build()
diff --git a/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/main.m b/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/main.m
index 599d36107f41..6ac70d1d06b7 100644
--- a/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/main.m
+++ b/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/main.m
@@ -6,7 +6,7 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
@interface ThisClassTestsThings : NSObject
@end
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
index e5c7b9150738..ddffdcfb62d6 100644
--- a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
@@ -5,11 +5,4 @@ CXX_SOURCES := main.cpp
# Clean renamed executable on 'make clean'
clean: OBJECTS+=no_synth
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/.categories b/packages/Python/lldbsuite/test/python_api/watchpoint/.categories
new file mode 100644
index 000000000000..50c1613cda72
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/.categories
@@ -0,0 +1 @@
+watchpoint
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
index bc925ee693d4..cef8a0c4e81f 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
@@ -28,8 +28,6 @@ class SetWatchpointAPITestCase(TestBase):
self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
index 2685ef819cad..0d1ef809d291 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
@@ -28,8 +28,6 @@ class WatchpointIgnoreCountTestCase(TestBase):
self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
index 33f1be77ad57..ca5fca3acf9a 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
@@ -19,6 +19,10 @@ class WatchpointIteratorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ # hardware watchpoints are not reported with a hardware index # on armv7 on ios devices
+ def affected_by_radar_34564183(self):
+ return (self.getArchitecture() == 'armv7' or self.getArchitecture() == 'armv7k') and self.platformIsDarwin()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -29,8 +33,6 @@ class WatchpointIteratorTestCase(TestBase):
self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -99,7 +101,8 @@ class WatchpointIteratorTestCase(TestBase):
# meaningful hardware index at this point. Exercise the printed repr of
# SBWatchpointLocation.
print(watchpoint)
- self.assertTrue(watchpoint.GetHardwareIndex() != -1)
+ if not self.affected_by_radar_34564183():
+ self.assertTrue(watchpoint.GetHardwareIndex() != -1)
# SBWatchpoint.GetDescription() takes a description level arg.
print(lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull))
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
index 03c94b6d04fa..4b0216d7a602 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
@@ -33,8 +33,6 @@ class WatchpointConditionAPITestCase(TestBase):
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["linux"],
archs=["aarch64"],
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
index 1cbaf5f46f61..e6bc9c0a7654 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
@@ -31,8 +31,6 @@ class SetWatchlocationAPITestCase(TestBase):
self.violating_func = "do_bad_thing_with_location"
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 6078901c6697..80595060b42d 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -30,8 +30,6 @@ class TargetWatchAddressAPITestCase(TestBase):
self.violating_func = "do_bad_thing_with_location"
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@@ -107,8 +105,6 @@ class TargetWatchAddressAPITestCase(TestBase):
# This finishes our test.
@add_test_categories(['pyapi'])
- # Watchpoints not supported
- @expectedFailureAndroid(archs=['arm', 'aarch64'])
# No size constraint on MIPS for watches
@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
@skipIf(archs=['s390x']) # Likewise on SystemZ
diff --git a/packages/Python/lldbsuite/test/settings/TestSettings.py b/packages/Python/lldbsuite/test/settings/TestSettings.py
index a8bd57341edf..5e1cd44c01b9 100644
--- a/packages/Python/lldbsuite/test/settings/TestSettings.py
+++ b/packages/Python/lldbsuite/test/settings/TestSettings.py
@@ -215,6 +215,7 @@ class SettingsCommandTestCase(TestBase):
self.expect("disassemble -n numberfn",
substrs=["5ah"])
+ @skipIfDarwinEmbedded # <rdar://problem/34446098> debugserver on ios etc can't write files
def test_run_args_and_env_vars(self):
"""Test that run-args and env-vars are passed to the launched process."""
self.build()
@@ -286,6 +287,7 @@ class SettingsCommandTestCase(TestBase):
"The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
"The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
+ @skipIfDarwinEmbedded # <rdar://problem/34446098> debugserver on ios etc can't write files
def test_set_error_output_path(self):
"""Test that setting target.error/output-path for the launched process works."""
self.build()
diff --git a/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py b/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
index b193c81e6442..02110d1684f8 100644
--- a/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
+++ b/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
@@ -82,16 +82,16 @@ class SettingsCommandTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.runCmd("process launch -o stdout.txt -- " + args_in)
+ self.runCmd("process launch -- " + args_in)
if lldb.remote_platform:
- src_file_spec = lldb.SBFileSpec('stdout.txt', False)
- dst_file_spec = lldb.SBFileSpec('stdout.txt', True)
+ src_file_spec = lldb.SBFileSpec('output.txt', False)
+ dst_file_spec = lldb.SBFileSpec('output.txt', True)
lldb.remote_platform.Get(src_file_spec, dst_file_spec)
- with open('stdout.txt', 'r') as f:
+ with open('output.txt', 'r') as f:
output = f.read()
- self.RemoveTempFile("stdout.txt")
+ self.RemoveTempFile("output.txt")
self.assertEqual(output, args_out)
diff --git a/packages/Python/lldbsuite/test/settings/quoting/main.c b/packages/Python/lldbsuite/test/settings/quoting/main.c
index 6e01c2d1cd87..5e3e34f84a67 100644
--- a/packages/Python/lldbsuite/test/settings/quoting/main.c
+++ b/packages/Python/lldbsuite/test/settings/quoting/main.c
@@ -1,13 +1,21 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
/* This program writes its arguments (separated by '\0') to stdout. */
int
main(int argc, char const *argv[])
{
int i;
+
+ FILE *output = fopen ("output.txt", "w");
+ if (output == NULL)
+ exit (1);
+
for (i = 1; i < argc; ++i)
- fwrite(argv[i], strlen(argv[i])+1, 1, stdout);
+ fwrite(argv[i], strlen(argv[i])+1, 1, output);
+
+ fclose (output);
return 0;
}
diff --git a/packages/Python/lldbsuite/test/test_categories.py b/packages/Python/lldbsuite/test/test_categories.py
index a1c2859536d1..46e3f3409dfc 100644
--- a/packages/Python/lldbsuite/test/test_categories.py
+++ b/packages/Python/lldbsuite/test/test_categories.py
@@ -34,7 +34,9 @@ all_categories = {
'stresstest': 'Tests related to stressing lldb limits',
'flakey': 'Flakey test cases, i.e. tests that do not reliably pass at each execution',
'lldb-mi': 'lldb-mi tests',
- 'darwin-log': 'Darwin log tests'}
+ 'darwin-log': 'Darwin log tests',
+ 'watchpoint': 'Watchpoint-related tests',
+}
def unique_string_match(yourentry, list):
@@ -53,10 +55,10 @@ def is_supported_on_platform(category, platform, compiler_path):
# -gsplit-dwarf is not implemented by clang on Windows.
return platform in ["linux", "freebsd"]
elif category == "dsym":
- return platform in ["darwin", "macosx", "ios"]
+ return platform in ["darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"]
elif category == "gmodules":
# First, check to see if the platform can even support gmodules.
- if platform not in ["linux", "freebsd", "darwin", "macosx", "ios"]:
+ if platform not in ["linux", "freebsd", "darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"]:
return False
return gmodules.is_compiler_clang_with_gmodules(compiler_path)
return True
diff --git a/packages/Python/lldbsuite/test/test_result.py b/packages/Python/lldbsuite/test/test_result.py
index 7bfe9708386c..3f5e556040b2 100644
--- a/packages/Python/lldbsuite/test/test_result.py
+++ b/packages/Python/lldbsuite/test/test_result.py
@@ -105,6 +105,32 @@ class LLDBTestResult(unittest2.TextTestResult):
else:
return str(test)
+ @staticmethod
+ def _getFileBasedCategories(test):
+ """
+ Returns the list of categories to which this test case belongs by
+ looking for a ".categories" file. We start at the folder the test is in
+ an traverse the hierarchy upwards - we guarantee a .categories to exist
+ at the top level directory so we do not end up looping endlessly.
+ """
+ import inspect
+ import os.path
+ folder = inspect.getfile(test.__class__)
+ folder = os.path.dirname(folder)
+ while folder != '/':
+ categories_file_name = os.path.join(folder, ".categories")
+ if os.path.exists(categories_file_name):
+ categories_file = open(categories_file_name, 'r')
+ categories = categories_file.readline()
+ categories_file.close()
+ categories = str.replace(categories, '\n', '')
+ categories = str.replace(categories, '\r', '')
+ return categories.split(',')
+ else:
+ folder = os.path.dirname(folder)
+ continue
+
+
def getCategoriesForTest(self, test):
"""
Gets all the categories for the currently running test method in test case
@@ -114,7 +140,7 @@ class LLDBTestResult(unittest2.TextTestResult):
if test_method is not None and hasattr(test_method, "categories"):
test_categories.extend(test_method.categories)
- test_categories.extend(test.getCategories())
+ test_categories.extend(self._getFileBasedCategories(test))
return test_categories
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/.categories b/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
new file mode 100644
index 000000000000..8b5f00ce15ae
--- /dev/null
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
@@ -0,0 +1 @@
+lldb-mi
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
index 4e03d557b7a9..80ceadb6f268 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
@@ -15,6 +15,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFailureAll(
@@ -37,6 +38,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that lldb-mi is ready to execute next commands
self.expect(self.child_prompt, exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_abort(self):
@@ -87,6 +89,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^done")
self.expect("\*stopped,reason=\"exited-normally\"")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_set(self):
@@ -131,6 +134,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-interpreter-exec command \"print argv[4]\"")
self.expect("\\\"fourth=\\\\\\\"4th arg\\\\\\\"\\\"", exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_reset(self):
@@ -159,6 +163,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-data-evaluate-expression argc")
self.expect("\^done,value=\"1\"")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next(self):
@@ -214,6 +219,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-exec-next --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next_instruction(self):
@@ -273,6 +279,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-exec-next-instruction --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step(self):
@@ -355,6 +362,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-exec-step --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step_instruction(self):
@@ -430,6 +438,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-exec-step-instruction --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_finish(self):
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py b/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
index 0b521812384e..f3a277246862 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
@@ -16,6 +16,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_disassemble(self):
@@ -86,10 +87,9 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect(["{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; \\\\\"Hello, World!\\\\\\\\n\\\\\"\"}",
"{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; symbol stub for: printf\"}"])
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- # FIXME: the global case worked before refactoring
- @unittest2.skip("-data-evaluate-expression doesn't work on globals")
def test_lldbmi_data_read_memory_bytes_global(self):
"""Test that -data-read-memory-bytes can access global buffers."""
@@ -115,7 +115,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -data-read-memory-bytes works for char[] type (global)
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
self.expect(
- "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" %
+ "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1011121300\"}\]" %
(addr, addr + size))
# Get address of static char[]
@@ -127,9 +127,10 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -data-read-memory-bytes works for static char[] type
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
self.expect(
- "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" %
+ "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"2021222300\"}\]" %
(addr, addr + size))
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_read_memory_bytes_local(self):
@@ -269,6 +270,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd('-data-read-memory-bytes --thread 1 &array')
self.expect(r'\^error')
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_names(self):
@@ -295,6 +297,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-data-list-register-names 0")
self.expect("\^done,register-names=\[\".+?\"\]")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_values(self):
@@ -323,6 +326,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect(
"\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"}\]")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_info_line(self):
@@ -377,6 +381,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-data-info-line main.cpp:0")
self.expect("\^error,msg=\"error: zero is an invalid line number")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_evaluate_expression(self):
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp
index 8030fe891de2..85c38634f84b 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp
@@ -17,6 +17,8 @@ local_array_test_inner()
{
char array[] = { 0x01, 0x02, 0x03, 0x04 };
char *first_element_ptr = &array[0];
+ char g = g_CharArray[0];
+ char s = s_CharArray[0];
// BP_local_array_test_inner
return;
}
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py b/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
index a862609d6978..2226395dcf2e 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -14,9 +14,6 @@ class MiTestCaseBase(Base):
myexe = "a.out"
mylog = "child.log"
- def getCategories(self):
- return ['lldb-mi']
-
@classmethod
def classCleanup(cls):
TestBase.RemoveTempFile(cls.myexe)
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py b/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py
index 597969dd6c53..cea5e6f96e9c 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py
@@ -170,6 +170,7 @@ class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
"\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\""])
@skipUnlessDarwin
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stopped_when_segfault_remote(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (remote)."""
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py
index 454597c1c5dd..c5c10bc139f5 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py
@@ -17,6 +17,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_list_arguments(self):
"""Test that 'lldb-mi --interpreter' can shows arguments."""
@@ -89,6 +90,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_list_locals(self):
"""Test that 'lldb-mi --interpreter' can shows local variables."""
@@ -243,6 +245,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_list_variables(self):
"""Test that 'lldb-mi --interpreter' can shows local variables and arguments."""
@@ -389,6 +392,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_info_depth(self):
"""Test that 'lldb-mi --interpreter' can shows depth of the stack."""
@@ -423,6 +427,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipUnlessDarwin
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_info_frame(self):
"""Test that 'lldb-mi --interpreter' can show information about current frame."""
@@ -465,6 +470,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_list_frames(self):
"""Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
@@ -488,6 +494,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_stack_select_frame(self):
"""Test that 'lldb-mi --interpreter' can choose current frame."""
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
index 7673846d6df5..80b925993d31 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -14,6 +14,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_file(self):
@@ -59,6 +60,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that lldb-mi is ready when executable was loaded
self.expect(self.child_prompt, exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_absolute_path(self):
@@ -83,6 +85,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_relative_path(self):
@@ -126,6 +129,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that lldb-mi is ready when executable was loaded
self.expect(self.child_prompt, exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -168,6 +172,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^done,value=\"10\"")
self.expect(self.child_prompt, exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -232,6 +237,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that lldb-mi is ready after execution of --source start_script
self.expect(self.child_prompt, exactly=True)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_option(self):
@@ -264,6 +270,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
for f in logFile:
os.remove(f)
+ @skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_directory_option(self):
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
index d4685d39791a..6155858cf112 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
@@ -159,6 +159,7 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfDarwin # rdar://33462982
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_var_update(self):
"""Test that 'lldb-mi --interpreter' works for -var-update."""
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
index e53d80b48f9d..1696b599de65 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
@@ -12,6 +12,7 @@ class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def attach_with_vAttach(self):
# Start the inferior, start the debug monitor, nothing is attached yet.
procs = self.prep_debug_monitor_and_inferior(
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
index ffabefc70f8d..3c87ee61ab6f 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
@@ -13,6 +13,7 @@ class TestGdbRemoteAuxvSupport(gdbremote_testcase.GdbRemoteTestCaseBase):
AUXV_SUPPORT_FEATURE_NAME = "qXfer:auxv:read"
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def has_auxv_support(self):
inferior_args = ["message:main entered", "sleep:5"]
procs = self.prep_debug_monitor_and_inferior(
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
index dc2b99f54bd6..94e81963483a 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
@@ -11,6 +11,7 @@ class TestGdbRemoteExpeditedRegisters(
gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def gather_expedited_registers(self):
# Setup the stub and set the gdb remote command stream.
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
index d84511d54273..464cdce5e9e0 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteHostInfo.py
@@ -98,12 +98,14 @@ class TestGdbRemoteHostInfo(GdbRemoteTestCaseBase):
"qHostInfo is missing the following required "
"keys: " + str(missing_keys))
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_qHostInfo_returns_at_least_one_key_val_pair_debugserver(self):
self.init_debugserver_test()
self.build()
self.get_qHostInfo_response()
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@llgs_test
def test_qHostInfo_returns_at_least_one_key_val_pair_llgs(self):
self.init_llgs_test()
@@ -111,6 +113,7 @@ class TestGdbRemoteHostInfo(GdbRemoteTestCaseBase):
self.get_qHostInfo_response()
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_qHostInfo_contains_darwin_required_keys_debugserver(self):
self.init_debugserver_test()
@@ -119,6 +122,7 @@ class TestGdbRemoteHostInfo(GdbRemoteTestCaseBase):
self.validate_darwin_minimum_host_info_keys(host_info_dict)
@skipUnlessDarwin
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@llgs_test
def test_qHostInfo_contains_darwin_required_keys_llgs(self):
self.init_llgs_test()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
index c3ecf5bc24df..6b8ed3b4c502 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
@@ -11,6 +11,7 @@ from lldbsuite.test import lldbutil
class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def attach_commandline_kill_after_initial_stop(self):
procs = self.prep_debug_monitor_and_inferior()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
index 21af255cfd94..4f7123d789a4 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
@@ -36,6 +36,7 @@ class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
self.assertTrue(lldbgdbserverutils.process_is_running(pid, True))
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qProcessInfo_returns_running_process_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -67,6 +68,7 @@ class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
self.assertEqual(reported_pid, procs["inferior"].pid)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_attach_commandline_qProcessInfo_reports_correct_pid_debugserver(
self):
self.init_debugserver_test()
@@ -99,6 +101,7 @@ class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
self.assertTrue(endian in ["little", "big", "pdp"])
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qProcessInfo_reports_valid_endian_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -159,6 +162,7 @@ class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
@skipUnlessDarwin
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qProcessInfo_contains_cputype_cpusubtype_debugserver_darwin(self):
self.init_debugserver_test()
self.build()
@@ -180,6 +184,7 @@ class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
@skipUnlessDarwin
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qProcessInfo_does_not_contain_triple_debugserver_darwin(self):
self.init_debugserver_test()
self.build()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py
index b484bdcc4d57..3d9bb1d21bfe 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py
@@ -12,6 +12,7 @@ class TestGdbRemoteRegisterState(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def grp_register_save_restore_works(self, with_suffix):
# Start up the process, use thread suffix, grab main thread id.
inferior_args = ["message:main entered", "sleep:5"]
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
index bcb632dd4ef8..f4e1851ff98f 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
@@ -11,6 +11,7 @@ class TestGdbRemoteSingleStep(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_single_step_only_steps_one_instruction_with_s_debugserver(self):
self.init_debugserver_test()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
index b361b9e6d915..2bf0952e902e 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
@@ -175,6 +175,7 @@ class TestGdbRemoteThreadsInStopReply(
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_QListThreadsInStopReply_supported_debugserver(self):
self.init_debugserver_test()
@@ -196,6 +197,7 @@ class TestGdbRemoteThreadsInStopReply(
self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count)
self.assertEqual(len(stop_reply_threads), thread_count)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_stop_reply_reports_multiple_threads_debugserver(self):
self.init_debugserver_test()
@@ -216,6 +218,7 @@ class TestGdbRemoteThreadsInStopReply(
stop_reply_threads = self.gather_stop_reply_threads(None, thread_count)
self.assertEqual(len(stop_reply_threads), 0)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_no_QListThreadsInStopReply_supplies_no_threads_debugserver(self):
self.init_debugserver_test()
@@ -252,6 +255,7 @@ class TestGdbRemoteThreadsInStopReply(
for tid in threads:
self.assertTrue(tid in stop_reply_threads)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_stop_reply_reports_correct_threads_debugserver(self):
self.init_debugserver_test()
@@ -290,6 +294,7 @@ class TestGdbRemoteThreadsInStopReply(
self.set_inferior_startup_launch()
self.stop_reply_contains_thread_pcs(5)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
@debugserver_test
def test_stop_reply_contains_thread_pcs_debugserver(self):
self.init_debugserver_test()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
index 74e4849b0cb6..647e57832b05 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -15,6 +15,8 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
THREAD_COUNT = 5
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
+ @skipIfDarwinEmbedded # <rdar://problem/27005337>
def gather_stop_replies_via_qThreadStopInfo(self, thread_count):
# Set up the inferior args.
inferior_args = []
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
index 9d0645c5b99d..f0380c7167e1 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
@@ -39,54 +39,63 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
def vCont_supports_S(self):
self.vCont_supports_mode("S")
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_vCont_supports_c_debugserver(self):
self.init_debugserver_test()
self.build()
self.vCont_supports_c()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@llgs_test
def test_vCont_supports_c_llgs(self):
self.init_llgs_test()
self.build()
self.vCont_supports_c()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_vCont_supports_C_debugserver(self):
self.init_debugserver_test()
self.build()
self.vCont_supports_C()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@llgs_test
def test_vCont_supports_C_llgs(self):
self.init_llgs_test()
self.build()
self.vCont_supports_C()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_vCont_supports_s_debugserver(self):
self.init_debugserver_test()
self.build()
self.vCont_supports_s()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@llgs_test
def test_vCont_supports_s_llgs(self):
self.init_llgs_test()
self.build()
self.vCont_supports_s()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_vCont_supports_S_debugserver(self):
self.init_debugserver_test()
self.build()
self.vCont_supports_S()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@llgs_test
def test_vCont_supports_S_llgs(self):
self.init_llgs_test()
self.build()
self.vCont_supports_S()
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver(
self):
@@ -109,6 +118,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
"aarch64"],
bugnumber="llvm.org/pr24739")
@skipIf(triple='^mips')
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self):
self.init_llgs_test()
self.build()
@@ -116,6 +126,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
self.single_step_only_steps_one_instruction(
use_Hc_packet=True, step_instruction="vCont;s")
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
@debugserver_test
def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver(
self):
@@ -138,6 +149,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
"aarch64"],
bugnumber="llvm.org/pr24739")
@skipIf(triple='^mips')
+ @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337")
def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs(
self):
self.init_llgs_test()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
index 6f36fbea470b..a4f306efdc98 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -29,6 +29,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
mydir = TestBase.compute_mydir(__file__)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_exe_starts_debugserver(self):
self.init_debugserver_test()
server = self.connect_to_debug_monitor()
@@ -46,6 +47,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_start_no_ack_mode_debugserver(self):
self.init_debugserver_test()
self.start_no_ack_mode()
@@ -68,6 +70,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_thread_suffix_supported_debugserver(self):
self.init_debugserver_test()
self.thread_suffix_supported()
@@ -89,6 +92,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_list_threads_in_stop_reply_supported_debugserver(self):
self.init_debugserver_test()
self.list_threads_in_stop_reply_supported()
@@ -114,6 +118,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_c_packet_works_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -146,6 +151,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertIsNotNone(context)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_inferior_print_exit_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -181,6 +187,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_first_launch_stop_reply_thread_matches_first_qC_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -216,6 +223,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
procs["inferior"].pid, False))
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_attach_commandline_continue_app_exits_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -254,6 +262,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
@debugserver_test
@expectedFailureDarwin("llvm.org/pr25486")
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qRegisterInfo_returns_one_valid_result_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -286,6 +295,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
@debugserver_test
@expectedFailureDarwin("llvm.org/pr25486")
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qRegisterInfo_returns_all_valid_results_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -332,6 +342,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertTrue('flags' in generic_regs)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qRegisterInfo_contains_required_generics_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -367,6 +378,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertTrue(len(register_sets) >= 1)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qRegisterInfo_contains_at_least_one_register_set_debugserver(
self):
self.init_debugserver_test()
@@ -446,6 +458,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertEqual(len(threads), 1)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qThreadInfo_contains_thread_launch_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -460,6 +473,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qThreadInfo_contains_thread()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qThreadInfo_contains_thread_attach_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -502,6 +516,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertEqual(threads[0], QC_thread_id)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qThreadInfo_matches_qC_launch_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -516,6 +531,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qThreadInfo_matches_qC()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qThreadInfo_matches_qC_attach_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -579,6 +595,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
reg_index += 1
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_p_returns_correct_data_size_for_each_qRegisterInfo_launch_debugserver(
self):
self.init_debugserver_test()
@@ -595,6 +612,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.p_returns_correct_data_size_for_each_qRegisterInfo()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_debugserver(
self):
self.init_debugserver_test()
@@ -643,6 +661,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertEqual(int(context.get("thread_id"), 16), thread)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_Hg_switches_to_3_threads_launch_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -657,6 +676,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.Hg_switches_to_3_threads()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_Hg_switches_to_3_threads_attach_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -783,6 +803,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
@unittest2.expectedFailure()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_Hc_then_Csignal_signals_correct_thread_launch_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -852,6 +873,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertEqual(read_contents, MEMORY_CONTENTS)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_m_packet_reads_memory_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -877,6 +899,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qMemoryRegionInfo_is_supported_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -939,6 +962,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assert_address_within_memory_region(code_address, mem_region_dict)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qMemoryRegionInfo_reports_code_address_as_executable_debugserver(
self):
self.init_debugserver_test()
@@ -1003,6 +1027,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
stack_address, mem_region_dict)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qMemoryRegionInfo_reports_stack_address_as_readable_writeable_debugserver(
self):
self.init_debugserver_test()
@@ -1067,6 +1092,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assert_address_within_memory_region(heap_address, mem_region_dict)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qMemoryRegionInfo_reports_heap_address_as_readable_writeable_debugserver(
self):
self.init_debugserver_test()
@@ -1215,6 +1241,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertIsNotNone(context)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_software_breakpoint_set_and_remove_work_debugserver(self):
self.init_debugserver_test()
if self.getArchitecture() == "arm":
@@ -1241,6 +1268,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
@skipUnlessPlatform(oslist=['linux'])
@expectedFailureAndroid
@skipIf(archs=no_match(['arm', 'aarch64']))
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_hardware_breakpoint_set_and_remove_work_debugserver(self):
self.init_debugserver_test()
if self.getArchitecture() == "arm":
@@ -1280,6 +1308,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertTrue(len(supported_dict) > 0)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_qSupported_returns_known_stub_features_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -1353,6 +1382,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.assertEqual(printed_message, TEST_MESSAGE + "X")
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_written_M_content_reads_back_correctly_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -1402,6 +1432,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
# Come back to this. I have the test rigged to verify that at least some
# of the bit-flip writes work.
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_P_writes_all_gpr_registers_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -1526,6 +1557,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
# Note: as of this moment, a hefty number of the GPR writes are failing
# with E32 (everything except rax-rdx, rdi, rsi, rbp).
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_P_and_p_thread_suffix_work_debugserver(self):
self.init_debugserver_test()
self.build()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubReverseConnect.py b/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubReverseConnect.py
index c1a63af5424f..102f2e344af5 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubReverseConnect.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubReverseConnect.py
@@ -84,6 +84,7 @@ class TestStubReverseConnect(gdbremote_testcase.GdbRemoteTestCaseBase):
stub_socket.shutdown(socket.SHUT_RDWR)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_reverse_connect_works_debugserver(self):
self.init_debugserver_test(use_named_pipe=False)
self.set_inferior_startup_launch()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py b/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py
index e77f2b7acec0..5ef4249bd241 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/exit-code/TestGdbRemoteExitCode.py
@@ -53,6 +53,7 @@ class TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
self.fail("failed to launch inferior: " + fail_reason)
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_start_inferior_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -80,6 +81,7 @@ class TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_inferior_exit_0_debugserver(self):
self.init_debugserver_test()
self.build()
@@ -112,6 +114,7 @@ class TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
self.expect_gdbremote_sequence()
@debugserver_test
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_inferior_exit_42_debugserver(self):
self.init_debugserver_test()
self.build()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index 23cb86935857..67887256d97d 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -369,7 +369,7 @@ class GdbRemoteTestCaseBase(TestBase):
["*:{}".format(self.port)]
else:
commandline_args = self.debug_monitor_extra_args + \
- ["localhost:{}".format(self.port)]
+ ["127.0.0.1:{}".format(self.port)]
if attach_pid:
commandline_args += ["--attach=%d" % attach_pid]
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py b/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
index b417b3292e75..e905a85cc4d3 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -11,6 +11,7 @@ from lldbsuite.test import lldbutil
class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def inferior_abort_received(self):
procs = self.prep_debug_monitor_and_inferior(inferior_args=["abort"])
self.assertIsNotNone(procs)
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py b/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
index 5bbca3c146d1..316d5d7b82bf 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
@@ -13,6 +13,7 @@ class TestGdbRemoteSegFault(gdbremote_testcase.GdbRemoteTestCaseBase):
GDB_REMOTE_STOP_CODE_BAD_ACCESS = 0x91
+ @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def inferior_seg_fault_received(self, expected_signo):
procs = self.prep_debug_monitor_and_inferior(
inferior_args=["segfault"])
diff --git a/packages/Python/lldbsuite/test/types/AbstractBase.py b/packages/Python/lldbsuite/test/types/AbstractBase.py
index 044a085e020e..ee548954a741 100644
--- a/packages/Python/lldbsuite/test/types/AbstractBase.py
+++ b/packages/Python/lldbsuite/test/types/AbstractBase.py
@@ -98,7 +98,7 @@ class GenericTester(TestBase):
remote_path = lldbutil.append_to_process_working_directory(
"lldb-stdout-redirect.txt")
self.runCmd(
- 'process launch -o {remote}'.format(remote=remote_path))
+ 'process launch -- {remote}'.format(remote=remote_path))
# copy remote_path to local host
self.runCmd('platform get-file {remote} "{local}"'.format(
remote=remote_path, local=self.golden_filename))
diff --git a/packages/Python/lldbsuite/test/types/basic_type.cpp b/packages/Python/lldbsuite/test/types/basic_type.cpp
index 1651815fa0ca..3102806ab5bc 100644
--- a/packages/Python/lldbsuite/test/types/basic_type.cpp
+++ b/packages/Python/lldbsuite/test/types/basic_type.cpp
@@ -89,6 +89,16 @@ typedef struct a_union_nonzero_tag {
int
main (int argc, char const *argv[])
{
+ FILE *out = stdout;
+
+ // By default, output to stdout
+ // If a filename is provided as the command line argument,
+ // output to that file.
+ if (argc == 2 && argv[1] && argv[1][0] != '\0')
+ {
+ out = fopen (argv[1], "w");
+ }
+
T a = T_VALUE_1;
T* a_ptr = &a;
T& a_ref = a;
@@ -123,89 +133,93 @@ main (int argc, char const *argv[])
a_union_zero_t a_union_zero_array_unbounded[] = {{ T_VALUE_1 }, { T_VALUE_2 }};
#ifdef T_PRINTF_FORMAT
- printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
- printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
- printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
-
- printf ("%s[2]: a_array_bounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[0]);
- printf ("%s[2]: a_array_bounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[1]);
-
- printf ("%s[]: a_array_unbounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[0]);
- printf ("%s[]: a_array_unbounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[1]);
-
- printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
- printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
- printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
- printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
- printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
- printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
-
- printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
- printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
- printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
- printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
- printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
- printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
+ fprintf (out, "%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
+ fprintf (out, "%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
+ fprintf (out, "%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
+
+ fprintf (out, "%s[2]: a_array_bounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[0]);
+ fprintf (out, "%s[2]: a_array_bounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[1]);
+
+ fprintf (out, "%s[]: a_array_unbounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[0]);
+ fprintf (out, "%s[]: a_array_unbounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[1]);
+
+ fprintf (out, "(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
+ fprintf (out, "(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
+ fprintf (out, "(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
+ fprintf (out, "(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
+ fprintf (out, "(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
+ fprintf (out, "(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
+
+ fprintf (out, "(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
+ fprintf (out, "(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
+ fprintf (out, "(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
+ fprintf (out, "(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
+ fprintf (out, "(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
+ fprintf (out, "(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
- printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
- printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
- printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
+ fprintf (out, "(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
+ fprintf (out, "(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
+ fprintf (out, "(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
- printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
- printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
- printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
+ fprintf (out, "(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
+ fprintf (out, "(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
+ fprintf (out, "(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
- printf ("(a_struct_t[2]) a_struct_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].a);
- printf ("(a_struct_t[2]) a_struct_array_bounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].b);
- printf ("(a_struct_t[2]) a_struct_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].a);
- printf ("(a_struct_t[2]) a_struct_array_bounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].b);
+ fprintf (out, "(a_struct_t[2]) a_struct_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].a);
+ fprintf (out, "(a_struct_t[2]) a_struct_array_bounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].b);
+ fprintf (out, "(a_struct_t[2]) a_struct_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].a);
+ fprintf (out, "(a_struct_t[2]) a_struct_array_bounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].b);
- printf ("(a_struct_t[]) a_struct_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].a);
- printf ("(a_struct_t[]) a_struct_array_unbounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].b);
- printf ("(a_struct_t[]) a_struct_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].a);
- printf ("(a_struct_t[]) a_struct_array_unbounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].b);
+ fprintf (out, "(a_struct_t[]) a_struct_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].a);
+ fprintf (out, "(a_struct_t[]) a_struct_array_unbounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].b);
+ fprintf (out, "(a_struct_t[]) a_struct_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].a);
+ fprintf (out, "(a_struct_t[]) a_struct_array_unbounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].b);
- printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[0].a);
- printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[1].a);
+ fprintf (out, "(a_union_zero_t[2]) a_union_zero_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[0].a);
+ fprintf (out, "(a_union_zero_t[2]) a_union_zero_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[1].a);
- printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[0].a);
- printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[1].a);
+ fprintf (out, "(a_union_zero_t[]) a_union_zero_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[0].a);
+ fprintf (out, "(a_union_zero_t[]) a_union_zero_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[1].a);
#endif
puts("About to exit, break here to check values..."); // Here is the line we will break on to check variables.
#ifdef TEST_BLOCK_CAPTURED_VARS
void (^myBlock)() = ^() {
- printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
- printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
- printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
-
- printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
- printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
- printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
- printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
- printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
- printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
+ fprintf (out, "%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
+ fprintf (out, "%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
+ fprintf (out, "%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
+
+ fprintf (out, "(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
+ fprintf (out, "(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
+ fprintf (out, "(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
+ fprintf (out, "(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
+ fprintf (out, "(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
+ fprintf (out, "(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
- printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
- printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
- printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
- printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
- printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
- printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
+ fprintf (out, "(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
+ fprintf (out, "(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
+ fprintf (out, "(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
+ fprintf (out, "(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
+ fprintf (out, "(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
+ fprintf (out, "(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
- printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
- printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
- printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
+ fprintf (out, "(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
+ fprintf (out, "(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
+ fprintf (out, "(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
- printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
- printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
- printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
+ fprintf (out, "(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
+ fprintf (out, "(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
+ fprintf (out, "(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
- printf ("That's All Folks!\n"); // Break here to test block captured variables.
+ fprintf (out, "That's All Folks!\n"); // Break here to test block captured variables.
};
myBlock();
#endif
+
+ if (out != stdout)
+ fclose (out);
+
return 0;
}
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index fad841b37c09..1fe34115244b 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -48,10 +48,10 @@ add_custom_command(
--swigExecutable=${SWIG_EXECUTABLE}
VERBATIM
COMMENT "Python script building LLDB Python wrapper")
-set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
+add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
+
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
-add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
# Install the LLDB python module
install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
diff --git a/scripts/Python/python-extensions.swig b/scripts/Python/python-extensions.swig
index 693b06b9aab3..d79917b92158 100644
--- a/scripts/Python/python-extensions.swig
+++ b/scripts/Python/python-extensions.swig
@@ -71,6 +71,21 @@
}
}
+%extend lldb::SBBreakpointName {
+ PyObject *lldb::SBBreakpointName::__str__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description);
+ const char *desc = description.GetData();
+ size_t desc_len = description.GetSize();
+ if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
+ --desc_len;
+ if (desc_len > 0)
+ return lldb_private::PythonString(llvm::StringRef(desc, desc_len)).release();
+ else
+ return lldb_private::PythonString("").release();
+ }
+}
+
%extend lldb::SBBroadcaster {
%pythoncode %{
def __eq__(self, rhs):
diff --git a/scripts/Python/python-swigsafecast.swig b/scripts/Python/python-swigsafecast.swig
index ea3f21f859ad..ffd7546323a0 100644
--- a/scripts/Python/python-swigsafecast.swig
+++ b/scripts/Python/python-swigsafecast.swig
@@ -115,6 +115,13 @@ SBTypeToSWIGWrapper (lldb::SBBreakpointLocation* breakpoint_location_sb)
template <>
PyObject*
+SBTypeToSWIGWrapper (lldb::SBBreakpointName* breakpoint_name_sb)
+{
+ return SWIG_NewPointerObj((void *) breakpoint_name_sb, SWIGTYPE_p_lldb__SBBreakpointName, 0);
+}
+
+template <>
+PyObject*
SBTypeToSWIGWrapper (lldb::SBValue* value_sb)
{
return SWIG_NewPointerObj((void *) value_sb, SWIGTYPE_p_lldb__SBValue, 0);
diff --git a/scripts/Xcode/build-llvm.py b/scripts/Xcode/build-llvm.py
index e2a46de1a16c..4d868de6b109 100755
--- a/scripts/Xcode/build-llvm.py
+++ b/scripts/Xcode/build-llvm.py
@@ -14,7 +14,6 @@ from lldbbuild import *
#### SETTINGS ####
-
def LLVM_HASH_INCLUDES_DIFFS():
return False
@@ -42,7 +41,25 @@ def process_repo(r):
'ref': r["ref"]
}
+def fallback_repo(name):
+ return {
+ 'name': name,
+ 'vcs': None,
+ 'root': process_root(name),
+ 'url': None,
+ 'ref': None
+ }
+
+def dirs_exist(names):
+ for name in names:
+ if not os.path.isdir(process_root(name)):
+ return False
+ return True
+
def XCODE_REPOSITORIES():
+ names = ["llvm", "clang", "ninja"]
+ if dirs_exist(names):
+ return [fallback_repo(n) for n in names]
override = repo.get_override()
if override:
return [process_repo(r) for r in override]
@@ -207,7 +224,7 @@ def apply_patches(spec):
f, spec['name'] + '.*.diff')]
for p in patches:
run_in_directory(["patch",
- "-p0",
+ "-p1",
"-i",
os.path.join(lldb_source_path(),
'scripts',
@@ -233,6 +250,8 @@ def should_build_llvm():
def do_symlink(source_path, link_path):
print "Symlinking " + source_path + " to " + link_path
+ if os.path.islink(link_path):
+ os.remove(link_path)
if not os.path.exists(link_path):
os.symlink(source_path, link_path)
@@ -433,8 +452,8 @@ def build_llvm_if_needed():
#### MAIN LOGIC ####
-all_check_out_if_needed()
-build_llvm_if_needed()
-write_archives_txt()
-
-sys.exit(0)
+if __name__ == "__main__":
+ all_check_out_if_needed()
+ build_llvm_if_needed()
+ write_archives_txt()
+ sys.exit(0)
diff --git a/scripts/Xcode/lldbbuild.py b/scripts/Xcode/lldbbuild.py
index 8496cfabf3da..e70fe1bf803f 100644
--- a/scripts/Xcode/lldbbuild.py
+++ b/scripts/Xcode/lldbbuild.py
@@ -1,5 +1,6 @@
import os
import subprocess
+import sys
#### UTILITIES ####
@@ -14,7 +15,11 @@ def enum(*sequential, **named):
def lldb_source_path():
- return os.environ.get('SRCROOT')
+ path = os.environ.get('SRCROOT')
+ if path:
+ return path
+ else:
+ return "./"
def expected_llvm_build_path():
@@ -80,7 +85,7 @@ VCS = enum('git',
def run_in_directory(args, path):
- return subprocess.check_output(args, cwd=path)
+ return subprocess.check_output([str(arg) for arg in args], cwd=path)
class Git:
diff --git a/scripts/build-lldb-llvm-clang b/scripts/build-lldb-llvm-clang
index 822e9944bf6a..c71188ddd006 100755
--- a/scripts/build-lldb-llvm-clang
+++ b/scripts/build-lldb-llvm-clang
@@ -33,7 +33,7 @@ cd ..
for patch_file in ../scripts/llvm.*.diff
do
echo "Applying patch from '$patch_file'"
- patch -p0 < "$patch_file"
+ patch -p1 < "$patch_file"
done
# change directory to "./llvm/tools/clang"
@@ -41,7 +41,7 @@ cd tools/clang
for patch_file in ../../../scripts/clang.*.diff
do
echo "Applying patch from '$patch_file'"
- patch -p0 < "$patch_file"
+ patch -p1 < "$patch_file"
done
# change directory to "./"
diff --git a/scripts/framework-header-fix.sh b/scripts/framework-header-fix.sh
new file mode 100755
index 000000000000..c09d1458ff82
--- /dev/null
+++ b/scripts/framework-header-fix.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Usage: framework-header-fix.sh <source header dir> <LLDB Version>
+for file in `find $1 -name "*.h"`
+do
+ sed -i '' 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
+ sed -i '' 's|<LLDB/Utility|<LLDB|' "$file"
+ LLDB_VERSION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\1/g'`
+ LLDB_REVISION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\3/g'`
+ LLDB_VERSION_STRING=`echo $2`
+ sed -i '' "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
+ sed -i '' "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
+ sed -i '' "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
+done
diff --git a/scripts/interface/SBBreakpoint.i b/scripts/interface/SBBreakpoint.i
index 95bc0cda0051..525797ad91f1 100644
--- a/scripts/interface/SBBreakpoint.i
+++ b/scripts/interface/SBBreakpoint.i
@@ -6,7 +6,6 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
namespace lldb {
%feature("docstring",
@@ -81,11 +80,6 @@ class SBBreakpoint
{
public:
- typedef bool (*BreakpointHitCallback) (void *baton,
- SBProcess &process,
- SBThread &thread,
- lldb::SBBreakpointLocation &location);
-
SBBreakpoint ();
SBBreakpoint (const lldb::SBBreakpoint& rhs);
@@ -153,6 +147,10 @@ public:
const char *
GetCondition ();
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
void
SetThreadID (lldb::tid_t sb_thread_id);
@@ -251,6 +249,39 @@ public:
%pythoncode %{
+ class locations_access(object):
+ '''A helper object that will lazily hand out locations for a breakpoint when supplied an index.'''
+ def __init__(self, sbbreakpoint):
+ self.sbbreakpoint = sbbreakpoint
+
+ def __len__(self):
+ if self.sbbreakpoint:
+ return int(self.sbbreakpoint.GetNumLocations())
+ return 0
+
+ def __getitem__(self, key):
+ if type(key) is int and key < len(self):
+ return self.sbbreakpoint.GetLocationAtIndex(key)
+ return None
+
+ def get_locations_access_object(self):
+ '''An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.'''
+ return self.locations_access (self)
+
+ def get_breakpoint_location_list(self):
+ '''An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.'''
+ locations = []
+ accessor = self.get_locations_access_object()
+ for idx in range(len(accessor)):
+ locations.append(accessor[idx])
+ return locations
+
+ __swig_getmethods__["locations"] = get_breakpoint_location_list
+ if _newclass: locations = property(get_breakpoint_location_list, None, doc='''A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.''')
+
+ __swig_getmethods__["location"] = get_locations_access_object
+ if _newclass: location = property(get_locations_access_object, None, doc='''A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).''')
+
__swig_getmethods__["id"] = GetID
if _newclass: id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')
diff --git a/scripts/interface/SBBreakpointLocation.i b/scripts/interface/SBBreakpointLocation.i
index a3073538e676..7a9a15db8ffa 100644
--- a/scripts/interface/SBBreakpointLocation.i
+++ b/scripts/interface/SBBreakpointLocation.i
@@ -48,6 +48,9 @@ public:
IsEnabled ();
uint32_t
+ GetHitCount ();
+
+ uint32_t
GetIgnoreCount ();
void
@@ -70,6 +73,10 @@ public:
const char *
GetCondition ();
+ bool GetAutoContinue();
+
+ void SetAutoContinue(bool auto_continue);
+
%feature("docstring", "
//------------------------------------------------------------------
/// Set the callback to the given Python function name.
@@ -93,6 +100,10 @@ public:
SBError
SetScriptCallbackBody (const char *script_body_text);
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
void
SetThreadID (lldb::tid_t sb_thread_id);
diff --git a/scripts/interface/SBBreakpointName.i b/scripts/interface/SBBreakpointName.i
new file mode 100644
index 000000000000..dbc078b94adf
--- /dev/null
+++ b/scripts/interface/SBBreakpointName.i
@@ -0,0 +1,111 @@
+//===-- SWIG interface for SBBreakpointName.h -------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+namespace lldb {
+%feature("docstring",
+"Represents a breakpoint name registered in a given SBTarget.
+
+Breakpoint names provide a way to act on groups of breakpoints. When you add a
+name to a group of breakpoints, you can then use the name in all the command
+line lldb commands for that name. You can also configure the SBBreakpointName
+options and those options will be propagated to any SBBreakpoints currently
+using that name. Adding a name to a breakpoint will also apply any of the
+set options to that breakpoint.
+
+You can also set permissions on a breakpoint name to disable listing, deleting
+and disabling breakpoints. That will disallow the given operation for breakpoints
+except when the breakpoint is mentioned by ID. So for instance deleting all the
+breakpoints won't delete breakpoints so marked."
+) SBBreakpointName;
+class LLDB_API SBBreakpointName {
+public:
+ SBBreakpointName();
+
+ SBBreakpointName(SBTarget &target, const char *name);
+
+ SBBreakpointName(SBBreakpoint &bkpt, const char *name);
+
+ SBBreakpointName(const lldb::SBBreakpointName &rhs);
+
+ ~SBBreakpointName();
+
+ const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs);
+
+ // Tests to see if the opaque breakpoint object in this object matches the
+ // opaque breakpoint object in "rhs".
+ bool operator==(const lldb::SBBreakpointName &rhs);
+
+ bool operator!=(const lldb::SBBreakpointName &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName() const;
+
+ void SetEnabled(bool enable);
+
+ bool IsEnabled();
+
+ void SetOneShot(bool one_shot);
+
+ bool IsOneShot() const;
+
+ void SetIgnoreCount(uint32_t count);
+
+ uint32_t GetIgnoreCount() const;
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ const char *GetHelpString() const;
+ void SetHelpString(const char *help_string);
+
+ bool GetAllowList() const;
+ void SetAllowList(bool value);
+
+ bool GetAllowDelete();
+ void SetAllowDelete(bool value);
+
+ bool GetAllowDisable();
+ void SetAllowDisable(bool value);
+
+ bool GetDescription(lldb::SBStream &description);
+
+};
+
+} // namespace lldb
+
diff --git a/scripts/interface/SBCommandInterpreter.i b/scripts/interface/SBCommandInterpreter.i
index c427d38b14d8..255e8ba4496a 100644
--- a/scripts/interface/SBCommandInterpreter.i
+++ b/scripts/interface/SBCommandInterpreter.i
@@ -125,18 +125,18 @@ public:
{
eBroadcastBitThreadShouldExit = (1 << 0),
eBroadcastBitResetPrompt = (1 << 1),
- eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
+ eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
eBroadcastBitAsynchronousOutputData = (1 << 3),
eBroadcastBitAsynchronousErrorData = (1 << 4)
};
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
-
+
~SBCommandInterpreter ();
- static const char *
+ static const char *
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
-
+
static const char *
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
@@ -181,7 +181,7 @@ public:
lldb::SBProcess
GetProcess ();
-
+
lldb::SBDebugger
GetDebugger ();
@@ -209,10 +209,12 @@ public:
int match_start_point,
int max_return_elements,
lldb::SBStringList &matches);
-
+
bool
IsActive ();
+ bool
+ WasInterrupted () const;
};
} // namespace lldb
diff --git a/scripts/interface/SBDebugger.i b/scripts/interface/SBDebugger.i
index db774d350e9c..9f746d36348c 100644
--- a/scripts/interface/SBDebugger.i
+++ b/scripts/interface/SBDebugger.i
@@ -214,6 +214,11 @@ public:
CreateTarget (const char *filename);
%feature("docstring",
+ "The dummy target holds breakpoints and breakpoint names that will prime newly created targets."
+ ) GetDummyTarget;
+ lldb::SBTarget GetDummyTarget();
+
+ %feature("docstring",
"Return true if target is deleted from the target list of the debugger."
) DeleteTarget;
bool
@@ -247,6 +252,34 @@ public:
void
SetSelectedPlatform(lldb::SBPlatform &platform);
+ %feature("docstring",
+ "Get the number of currently active platforms."
+ ) GetNumPlatforms;
+ uint32_t
+ GetNumPlatforms ();
+
+ %feature("docstring",
+ "Get one of the currently active platforms."
+ ) GetPlatformAtIndex;
+ lldb::SBPlatform
+ GetPlatformAtIndex (uint32_t idx);
+
+ %feature("docstring",
+ "Get the number of available platforms."
+ ) GetNumAvailablePlatforms;
+ uint32_t
+ GetNumAvailablePlatforms ();
+
+ %feature("docstring", "
+ Get the name and description of one of the available platforms.
+
+ @param idx Zero-based index of the platform for which info should be
+ retrieved, must be less than the value returned by
+ GetNumAvailablePlatforms().
+ ") GetAvailablePlatformInfoAtIndex;
+ lldb::SBStructuredData
+ GetAvailablePlatformInfoAtIndex (uint32_t idx);
+
lldb::SBSourceManager
GetSourceManager ();
diff --git a/scripts/interface/SBProcess.i b/scripts/interface/SBProcess.i
index 527442e274ec..55d39f826b7d 100644
--- a/scripts/interface/SBProcess.i
+++ b/scripts/interface/SBProcess.i
@@ -417,6 +417,18 @@ public:
lldb::SBMemoryRegionInfoList
GetMemoryRegions();
+ %feature("autodoc", "
+ Get information about the process.
+ Valid process info will only be returned when the process is alive,
+ use IsValid() to check if the info returned is valid.
+
+ process_info = process.GetProcessInfo()
+ if process_info.IsValid():
+ process_info.GetProcessID()
+ ") GetProcessInfo;
+ lldb::SBProcessInfo
+ GetProcessInfo();
+
%pythoncode %{
def __get_is_alive__(self):
'''Returns "True" if the process is currently alive, "False" otherwise'''
diff --git a/scripts/interface/SBProcessInfo.i b/scripts/interface/SBProcessInfo.i
new file mode 100644
index 000000000000..7332e67a966a
--- /dev/null
+++ b/scripts/interface/SBProcessInfo.i
@@ -0,0 +1,66 @@
+//===-- SWIG Interface for SBProcessInfo-------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+namespace lldb {
+
+%feature("docstring",
+"Describes an existing process and any discoverable information that pertains to
+that process."
+) SBProcessInfo;
+
+class SBProcessInfo
+{
+public:
+ SBProcessInfo();
+
+ SBProcessInfo (const SBProcessInfo &rhs);
+
+ ~SBProcessInfo ();
+
+ bool
+ IsValid ();
+
+ const char *
+ GetName ();
+
+ SBFileSpec
+ GetExecutableFile ();
+
+ lldb::pid_t
+ GetProcessID ();
+
+ uint32_t
+ GetUserID ();
+
+ uint32_t
+ GetGroupID ();
+
+ bool
+ UserIDIsValid ();
+
+ bool
+ GroupIDIsValid ();
+
+ uint32_t
+ GetEffectiveUserID ();
+
+ uint32_t
+ GetEffectiveGroupID ();
+
+ bool
+ EffectiveUserIDIsValid ();
+
+ bool
+ EffectiveGroupIDIsValid ();
+
+ lldb::pid_t
+ GetParentProcessID ();
+};
+
+} // namespace lldb
diff --git a/scripts/interface/SBTarget.i b/scripts/interface/SBTarget.i
index c1d749c7ce75..bcec606005f4 100644
--- a/scripts/interface/SBTarget.i
+++ b/scripts/interface/SBTarget.i
@@ -711,6 +711,10 @@ public:
bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
+ void DeleteBreakpointName(const char *name);
+
+ void GetBreakpointNames(SBStringList &names);
+
bool
EnableAllBreakpoints ();
diff --git a/scripts/interface/SBValue.i b/scripts/interface/SBValue.i
index ef9fe3c74851..2063626fc240 100644
--- a/scripts/interface/SBValue.i
+++ b/scripts/interface/SBValue.i
@@ -16,15 +16,15 @@ SBValue supports iteration through its child, which in turn is represented
as an SBValue. For example, we can get the general purpose registers of a
frame as an SBValue, and iterate through all the registers,
- registerSet = frame.GetRegisters() # Returns an SBValueList.
+ registerSet = frame.registers # Returns an SBValueList.
for regs in registerSet:
- if 'general purpose registers' in regs.getName().lower():
+ if 'general purpose registers' in regs.name.lower():
GPRs = regs
break
- print('%s (number of children = %d):' % (GPRs.GetName(), GPRs.GetNumChildren()))
+ print('%s (number of children = %d):' % (GPRs.name, GPRs.num_children))
for reg in GPRs:
- print('Name: ', reg.GetName(), ' Value: ', reg.GetValue())
+ print('Name: ', reg.name, ' Value: ', reg.value)
produces the output:
diff --git a/scripts/lldb.swig b/scripts/lldb.swig
index 8345a4b95038..dc987040e768 100644
--- a/scripts/lldb.swig
+++ b/scripts/lldb.swig
@@ -82,6 +82,7 @@ import six
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBreakpointName.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBCommandInterpreter.h"
#include "lldb/API/SBCommandReturnObject.h"
@@ -111,6 +112,7 @@ import six
#include "lldb/API/SBModuleSpec.h"
#include "lldb/API/SBPlatform.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBProcessInfo.h"
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBSection.h"
@@ -167,6 +169,7 @@ import six
%include "./interface/SBBlock.i"
%include "./interface/SBBreakpoint.i"
%include "./interface/SBBreakpointLocation.i"
+%include "./interface/SBBreakpointName.i"
%include "./interface/SBBroadcaster.i"
%include "./interface/SBCommandInterpreter.i"
%include "./interface/SBCommandReturnObject.i"
@@ -196,6 +199,7 @@ import six
%include "./interface/SBModuleSpec.i"
%include "./interface/SBPlatform.i"
%include "./interface/SBProcess.i"
+%include "./interface/SBProcessInfo.i"
%include "./interface/SBQueue.i"
%include "./interface/SBQueueItem.i"
%include "./interface/SBSection.i"
diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
index 9dd21bcf2aaf..c96e59be5a44 100644
--- a/source/API/CMakeLists.txt
+++ b/source/API/CMakeLists.txt
@@ -2,10 +2,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
add_definitions( -DEXPORT_LIBLLDB )
endif()
-# Include this so that add_lldb_library() has the list of dependencies
-# for liblldb to link against
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7)
@@ -24,6 +20,8 @@ add_lldb_library(liblldb SHARED
SBBlock.cpp
SBBreakpoint.cpp
SBBreakpointLocation.cpp
+ SBBreakpointName.cpp
+ SBBreakpointOptionCommon.cpp
SBBroadcaster.cpp
SBCommandInterpreter.cpp
SBCommandReturnObject.cpp
@@ -53,6 +51,7 @@ add_lldb_library(liblldb SHARED
SBModuleSpec.cpp
SBPlatform.cpp
SBProcess.cpp
+ SBProcessInfo.cpp
SBQueue.cpp
SBQueueItem.cpp
SBSection.cpp
@@ -109,9 +108,17 @@ if (LLVM_ENABLE_WERROR)
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
endif()
endif()
+set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
+if (CLANG_CL)
+ set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+ PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+endif()
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+ NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+ set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+ PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+endif ()
-# This should not be part of LLDBDependencies.cmake, because we don't
-# want every single library taking a dependency on the script interpreters.
target_link_libraries(liblldb PRIVATE
lldbPluginScriptInterpreterNone
lldbPluginScriptInterpreterPython
@@ -153,22 +160,45 @@ endif()
if (LLDB_WRAP_PYTHON)
add_dependencies(liblldb swig_wrapper)
endif()
-target_link_libraries(liblldb PRIVATE ${LLDB_SYSTEM_LIBS})
if(LLDB_BUILD_FRAMEWORK)
- file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
+ file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
+ ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+ file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+ file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
+ list(REMOVE_ITEM root_public_headers ${root_private_headers})
+
+ foreach(header ${public_headers} ${root_public_headers} ${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h)
+ get_filename_component(basename ${header} NAME)
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}
+ DEPENDS ${header}
+ COMMAND ${CMAKE_COMMAND} -E copy ${header} ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
+ list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
+ endforeach()
+
+ add_custom_target(lldb-framework-headers DEPENDS ${framework_headers}
+ COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_VERSION})
+ add_dependencies(liblldb lldb-framework-headers)
+
set_target_properties(liblldb PROPERTIES
OUTPUT_NAME LLDB
FRAMEWORK On
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
- PUBLIC_HEADER "${public_headers}")
+ PUBLIC_HEADER "${framework_headers}")
+
+ if(NOT IOS)
+ add_custom_command(TARGET liblldb POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
+ COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
+ )
+ else()
+ add_custom_command(TARGET liblldb POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
+ )
+ endif()
- add_custom_command(TARGET liblldb POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:liblldb>/Versions/${LLDB_FRAMEWORK_VERSION}
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers
- COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
- )
endif()
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index bf9603248d71..6a0ff9536c2c 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -37,6 +37,8 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include "SBBreakpointOptionCommon.h"
+
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/STLExtras.h"
@@ -44,21 +46,6 @@
using namespace lldb;
using namespace lldb_private;
-struct CallbackData {
- SBBreakpoint::BreakpointHitCallback callback;
- void *callback_baton;
-};
-
-class SBBreakpointCallbackBaton : public TypedBaton<CallbackData> {
-public:
- SBBreakpointCallbackBaton(SBBreakpoint::BreakpointHitCallback callback,
- void *baton)
- : TypedBaton(llvm::make_unique<CallbackData>()) {
- getItem()->callback = callback;
- getItem()->callback_baton = baton;
- }
-};
-
SBBreakpoint::SBBreakpoint() {}
SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs)
@@ -264,6 +251,25 @@ const char *SBBreakpoint::GetCondition() {
return nullptr;
}
+void SBBreakpoint::SetAutoContinue(bool auto_continue) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
+ std::lock_guard<std::recursive_mutex> guard(
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetAutoContinue(auto_continue);
+ }
+}
+
+bool SBBreakpoint::GetAutoContinue() {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
+ std::lock_guard<std::recursive_mutex> guard(
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->IsAutoContinue();
+ }
+ return false;
+}
+
uint32_t SBBreakpoint::GetHitCount() const {
uint32_t count = 0;
BreakpointSP bkpt_sp = GetSP();
@@ -481,37 +487,9 @@ bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
return false;
}
-bool SBBreakpoint::PrivateBreakpointHitCallback(void *baton,
- StoppointCallbackContext *ctx,
- lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id) {
- ExecutionContext exe_ctx(ctx->exe_ctx_ref);
- BreakpointSP bp_sp(
- exe_ctx.GetTargetRef().GetBreakpointList().FindBreakpointByID(break_id));
- if (baton && bp_sp) {
- CallbackData *data = (CallbackData *)baton;
- lldb_private::Breakpoint *bp = bp_sp.get();
- if (bp && data->callback) {
- Process *process = exe_ctx.GetProcessPtr();
- if (process) {
- SBProcess sb_process(process->shared_from_this());
- SBThread sb_thread;
- SBBreakpointLocation sb_location;
- assert(bp_sp);
- sb_location.SetLocation(bp_sp->FindLocationByID(break_loc_id));
- Thread *thread = exe_ctx.GetThreadPtr();
- if (thread)
- sb_thread.SetThread(thread->shared_from_this());
-
- return data->callback(data->callback_baton, sb_process, sb_thread,
- sb_location);
- }
- }
- }
- return true; // Return true if we should stop at this breakpoint
-}
-
-void SBBreakpoint::SetCallback(BreakpointHitCallback callback, void *baton) {
+void SBBreakpoint
+ ::SetCallback(SBBreakpointHitCallback callback,
+ void *baton) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
BreakpointSP bkpt_sp = GetSP();
LLDB_LOG(log, "breakpoint = {0}, callback = {1}, baton = {2}", bkpt_sp.get(),
@@ -521,7 +499,8 @@ void SBBreakpoint::SetCallback(BreakpointHitCallback callback, void *baton) {
std::lock_guard<std::recursive_mutex> guard(
bkpt_sp->GetTarget().GetAPIMutex());
BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
- bkpt_sp->SetCallback(SBBreakpoint::PrivateBreakpointHitCallback, baton_sp,
+ bkpt_sp->SetCallback(SBBreakpointCallbackBaton
+ ::PrivateBreakpointHitCallback, baton_sp,
false);
}
}
@@ -580,10 +559,17 @@ bool SBBreakpoint::AddName(const char *new_name) {
bkpt_sp->GetTarget().GetAPIMutex());
Status error; // Think I'm just going to swallow the error here, it's
// probably more annoying to have to provide it.
- return bkpt_sp->AddName(new_name, error);
+ bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error);
+ if (error.Fail())
+ {
+ if (log)
+ log->Printf("Failed to add name: '%s' to breakpoint: %s",
+ new_name, error.AsCString());
+ return false;
+ }
}
- return false;
+ return true;
}
void SBBreakpoint::RemoveName(const char *name_to_remove) {
@@ -594,7 +580,8 @@ void SBBreakpoint::RemoveName(const char *name_to_remove) {
if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
bkpt_sp->GetTarget().GetAPIMutex());
- bkpt_sp->RemoveName(name_to_remove);
+ bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp,
+ ConstString(name_to_remove));
}
}
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index dc9c00d8dd57..99ac0277e700 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -12,6 +12,7 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
@@ -100,6 +101,16 @@ bool SBBreakpointLocation::IsEnabled() {
return false;
}
+uint32_t SBBreakpointLocation::GetHitCount() {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
+ std::lock_guard<std::recursive_mutex> guard(
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetHitCount();
+ } else
+ return 0;
+}
+
uint32_t SBBreakpointLocation::GetIgnoreCount() {
BreakpointLocationSP loc_sp = GetSP();
if (loc_sp) {
@@ -138,6 +149,25 @@ const char *SBBreakpointLocation::GetCondition() {
return NULL;
}
+void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
+ std::lock_guard<std::recursive_mutex> guard(
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetAutoContinue(auto_continue);
+ }
+}
+
+bool SBBreakpointLocation::GetAutoContinue() {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
+ std::lock_guard<std::recursive_mutex> guard(
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->IsAutoContinue();
+ }
+ return false;
+}
+
void SBBreakpointLocation::SetScriptCallbackFunction(
const char *callback_function_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
@@ -185,6 +215,33 @@ SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
return sb_error;
}
+void SBBreakpointLocation::SetCommandLineCommands(SBStringList &commands) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (!loc_sp)
+ return;
+ if (commands.GetSize() == 0)
+ return;
+
+ std::lock_guard<std::recursive_mutex> guard(
+ loc_sp->GetTarget().GetAPIMutex());
+ std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
+ new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
+
+ loc_sp->GetLocationOptions()->SetCommandDataCallback(cmd_data_up);
+}
+
+bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (!loc_sp)
+ return false;
+ StringList command_list;
+ bool has_commands =
+ loc_sp->GetLocationOptions()->GetCommandLineCallbacks(command_list);
+ if (has_commands)
+ commands.AppendList(command_list);
+ return has_commands;
+}
+
void SBBreakpointLocation::SetThreadID(tid_t thread_id) {
BreakpointLocationSP loc_sp = GetSP();
if (loc_sp) {
diff --git a/source/API/SBBreakpointName.cpp b/source/API/SBBreakpointName.cpp
new file mode 100644
index 000000000000..2205280b9e5f
--- /dev/null
+++ b/source/API/SBBreakpointName.cpp
@@ -0,0 +1,685 @@
+//===-- SBBreakpointName.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBTarget.h"
+
+#include "lldb/Breakpoint/BreakpointName.h"
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
+
+#include "SBBreakpointOptionCommon.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace lldb
+{
+class SBBreakpointNameImpl {
+public:
+ SBBreakpointNameImpl(TargetSP target_sp, const char *name) {
+ if (!name || name[0] == '\0')
+ return;
+ m_name.assign(name);
+
+ if (!target_sp)
+ return;
+
+ m_target_wp = target_sp;
+ }
+
+ SBBreakpointNameImpl(SBTarget &sb_target, const char *name);
+ bool operator==(const SBBreakpointNameImpl &rhs);
+ bool operator!=(const SBBreakpointNameImpl &rhs);
+
+ // For now we take a simple approach and only keep the name, and relook
+ // up the location when we need it.
+
+ TargetSP GetTarget() const {
+ return m_target_wp.lock();
+ }
+
+ const char *GetName() const {
+ return m_name.c_str();
+ }
+
+ bool IsValid() const {
+ return !m_name.empty() && m_target_wp.lock();
+ }
+
+ lldb_private::BreakpointName *GetBreakpointName() const;
+
+private:
+ TargetWP m_target_wp;
+ std::string m_name;
+};
+
+SBBreakpointNameImpl::SBBreakpointNameImpl(SBTarget &sb_target,
+ const char *name) {
+ if (!name || name[0] == '\0')
+ return;
+ m_name.assign(name);
+
+ if (!sb_target.IsValid())
+ return;
+
+ TargetSP target_sp = sb_target.GetSP();
+ if (!target_sp)
+ return;
+
+ m_target_wp = target_sp;
+}
+
+bool SBBreakpointNameImpl::operator==(const SBBreakpointNameImpl &rhs) {
+ return m_name == rhs.m_name && m_target_wp.lock() == rhs.m_target_wp.lock();
+}
+
+bool SBBreakpointNameImpl::operator!=(const SBBreakpointNameImpl &rhs) {
+ return m_name != rhs.m_name || m_target_wp.lock() != rhs.m_target_wp.lock();
+}
+
+lldb_private::BreakpointName *SBBreakpointNameImpl::GetBreakpointName() const {
+ if (!IsValid())
+ return nullptr;
+ TargetSP target_sp = GetTarget();
+ if (!target_sp)
+ return nullptr;
+ Status error;
+ return target_sp->FindBreakpointName(ConstString(m_name), true, error);
+}
+
+} // namespace lldb
+
+SBBreakpointName::SBBreakpointName() {}
+
+SBBreakpointName::SBBreakpointName(SBTarget &sb_target, const char *name)
+{
+ m_impl_up.reset(new SBBreakpointNameImpl(sb_target, name));
+ // Call FindBreakpointName here to make sure the name is valid, reset if
+ // not:
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ m_impl_up.reset();
+}
+
+SBBreakpointName::SBBreakpointName(SBBreakpoint &sb_bkpt, const char *name)
+{
+ if (!sb_bkpt.IsValid()) {
+ m_impl_up.reset();
+ return;
+ }
+ BreakpointSP bkpt_sp = sb_bkpt.GetSP();
+ Target &target = bkpt_sp->GetTarget();
+
+ m_impl_up.reset(new SBBreakpointNameImpl(target.shared_from_this(), name));
+
+ // Call FindBreakpointName here to make sure the name is valid, reset if
+ // not:
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name) {
+ m_impl_up.reset();
+ return;
+ }
+
+ // Now copy over the breakpoint's options:
+ target.ConfigureBreakpointName(*bp_name, *bkpt_sp->GetOptions(),
+ BreakpointName::Permissions());
+}
+
+SBBreakpointName::SBBreakpointName(const SBBreakpointName &rhs)
+{
+ if (!rhs.m_impl_up)
+ return;
+ else
+ m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(),
+ rhs.m_impl_up->GetName()));
+}
+
+SBBreakpointName::~SBBreakpointName() = default;
+
+const SBBreakpointName &SBBreakpointName::operator=(const SBBreakpointName &rhs)
+{
+ if (!rhs.m_impl_up) {
+ m_impl_up.reset();
+ return *this;
+ }
+
+ m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(),
+ rhs.m_impl_up->GetName()));
+ return *this;
+}
+
+bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) {
+ return *m_impl_up.get() == *rhs.m_impl_up.get();
+}
+
+bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) {
+ return *m_impl_up.get() != *rhs.m_impl_up.get();
+}
+
+bool SBBreakpointName::IsValid() const {
+ if (!m_impl_up)
+ return false;
+ return m_impl_up->IsValid();
+}
+
+const char *SBBreakpointName::GetName() const {
+ if (!m_impl_up)
+ return "<Invalid Breakpoint Name Object>";
+ return m_impl_up->GetName();
+}
+
+void SBBreakpointName::SetEnabled(bool enable) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} enabled: {1}\n", bp_name->GetName(), enable);
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetEnabled(enable);
+}
+
+void SBBreakpointName::UpdateName(BreakpointName &bp_name) {
+ if (!IsValid())
+ return;
+
+ TargetSP target_sp = m_impl_up->GetTarget();
+ if (!target_sp)
+ return;
+ target_sp->ApplyNameToBreakpoints(bp_name);
+
+}
+
+bool SBBreakpointName::IsEnabled() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().IsEnabled();
+}
+
+void SBBreakpointName::SetOneShot(bool one_shot) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(), one_shot);
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetOneShot(one_shot);
+ UpdateName(*bp_name);
+}
+
+bool SBBreakpointName::IsOneShot() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ const BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().IsOneShot();
+}
+
+void SBBreakpointName::SetIgnoreCount(uint32_t count) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(), count);
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetIgnoreCount(count);
+ UpdateName(*bp_name);
+}
+
+uint32_t SBBreakpointName::GetIgnoreCount() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetIgnoreCount();
+}
+
+void SBBreakpointName::SetCondition(const char *condition) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(),
+ condition ? condition : "<NULL>");
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetCondition(condition);
+ UpdateName(*bp_name);
+}
+
+const char *SBBreakpointName::GetCondition() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return nullptr;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetConditionText();
+}
+
+void SBBreakpointName::SetAutoContinue(bool auto_continue) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} auto-continue: {1}\n", bp_name->GetName(), auto_continue);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetAutoContinue(auto_continue);
+ UpdateName(*bp_name);
+}
+
+bool SBBreakpointName::GetAutoContinue() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().IsAutoContinue();
+}
+
+void SBBreakpointName::SetThreadID(tid_t tid) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} tid: {1:x}\n", bp_name->GetName(), tid);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().SetThreadID(tid);
+ UpdateName(*bp_name);
+}
+
+tid_t SBBreakpointName::GetThreadID() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return LLDB_INVALID_THREAD_ID;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetThreadSpec()->GetTID();
+}
+
+void SBBreakpointName::SetThreadIndex(uint32_t index) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} thread index: {1}\n", bp_name->GetName(), index);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().GetThreadSpec()->SetIndex(index);
+ UpdateName(*bp_name);
+}
+
+uint32_t SBBreakpointName::GetThreadIndex() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return LLDB_INVALID_THREAD_ID;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetThreadSpec()->GetIndex();
+}
+
+void SBBreakpointName::SetThreadName(const char *thread_name) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} thread name: {1}\n", bp_name->GetName(), thread_name);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().GetThreadSpec()->SetName(thread_name);
+ UpdateName(*bp_name);
+}
+
+const char *SBBreakpointName::GetThreadName() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return nullptr;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetThreadSpec()->GetName();
+}
+
+void SBBreakpointName::SetQueueName(const char *queue_name) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} queue name: {1}\n", bp_name->GetName(), queue_name);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ bp_name->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
+ UpdateName(*bp_name);
+}
+
+const char *SBBreakpointName::GetQueueName() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return nullptr;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ return bp_name->GetOptions().GetThreadSpec()->GetQueueName();
+}
+
+void SBBreakpointName::SetCommandLineCommands(SBStringList &commands) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+ if (commands.GetSize() == 0)
+ return;
+
+ LLDB_LOG(log, "Name: {0} commands\n", bp_name->GetName());
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+ std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
+ new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
+
+ bp_name->GetOptions().SetCommandDataCallback(cmd_data_up);
+ UpdateName(*bp_name);
+}
+
+bool SBBreakpointName::GetCommandLineCommands(SBStringList &commands) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ StringList command_list;
+ bool has_commands =
+ bp_name->GetOptions().GetCommandLineCallbacks(command_list);
+ if (has_commands)
+ commands.AppendList(command_list);
+ return has_commands;
+}
+
+const char *SBBreakpointName::GetHelpString() const {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return "";
+
+ LLDB_LOG(log, "Help: {0}\n", bp_name->GetHelp());
+ return bp_name->GetHelp();
+}
+
+void SBBreakpointName::SetHelpString(const char *help_string) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} help: {1}\n", bp_name->GetName(), help_string);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+ bp_name->SetHelp(help_string);
+}
+
+bool SBBreakpointName::GetDescription(SBStream &s) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ {
+ s.Printf("No value");
+ return false;
+ }
+
+ LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+ bp_name->GetDescription(s.get(), eDescriptionLevelFull);
+ return true;
+}
+
+void SBBreakpointName::SetCallback(SBBreakpointHitCallback callback,
+ void *baton) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+ LLDB_LOG(log, "callback = {1}, baton = {2}", callback, baton);
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
+ bp_name->GetOptions().SetCallback(SBBreakpointCallbackBaton
+ ::PrivateBreakpointHitCallback,
+ baton_sp,
+ false);
+ UpdateName(*bp_name);
+}
+
+void SBBreakpointName::SetScriptCallbackFunction(
+ const char *callback_function_name) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+
+ LLDB_LOG(log, "Name: {0} callback: {1}\n", bp_name->GetName(),
+ callback_function_name);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ BreakpointOptions &bp_options = bp_name->GetOptions();
+ m_impl_up->GetTarget()
+ ->GetDebugger()
+ .GetCommandInterpreter()
+ .GetScriptInterpreter()
+ ->SetBreakpointCommandCallbackFunction(&bp_options,
+ callback_function_name);
+ UpdateName(*bp_name);
+}
+
+SBError SBBreakpointName::SetScriptCallbackBody(const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ SBError sb_error;
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return sb_error;
+
+ LLDB_LOG(log, "Name: {0} callback: {1}\n", bp_name->GetName(),
+ callback_body_text);
+
+ std::lock_guard<std::recursive_mutex> guard(
+ m_impl_up->GetTarget()->GetAPIMutex());
+
+ BreakpointOptions &bp_options = bp_name->GetOptions();
+ Status error =
+ m_impl_up->GetTarget()
+ ->GetDebugger()
+ .GetCommandInterpreter()
+ .GetScriptInterpreter()
+ ->SetBreakpointCommandCallback(&bp_options, callback_body_text);
+ sb_error.SetError(error);
+ if (!sb_error.Fail())
+ UpdateName(*bp_name);
+
+ return sb_error;
+}
+
+bool SBBreakpointName::GetAllowList() const
+{
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+ return bp_name->GetPermissions().GetAllowList();
+}
+
+void SBBreakpointName::SetAllowList(bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+ if (log)
+ log->Printf("Setting allow list to %u for %s.", value,
+ bp_name->GetName().AsCString());
+ bp_name->GetPermissions().SetAllowList(value);
+}
+
+bool SBBreakpointName::GetAllowDelete()
+{
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+ return bp_name->GetPermissions().GetAllowDelete();
+}
+
+void SBBreakpointName::SetAllowDelete(bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+ if (log)
+ log->Printf("Setting allow delete to %u for %s.", value,
+ bp_name->GetName().AsCString());
+ bp_name->GetPermissions().SetAllowDelete(value);
+}
+
+bool SBBreakpointName::GetAllowDisable()
+{
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return false;
+ return bp_name->GetPermissions().GetAllowDisable();
+}
+
+void SBBreakpointName::SetAllowDisable(bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ BreakpointName *bp_name = GetBreakpointName();
+ if (!bp_name)
+ return;
+ if (log)
+ log->Printf("Setting allow disable to %u for %s.", value,
+ bp_name->GetName().AsCString());
+ bp_name->GetPermissions().SetAllowDisable(value);
+}
+
+lldb_private::BreakpointName *SBBreakpointName::GetBreakpointName() const
+{
+ if (!IsValid())
+ return nullptr;
+ return m_impl_up->GetBreakpointName();
+}
+
diff --git a/source/API/SBBreakpointOptionCommon.cpp b/source/API/SBBreakpointOptionCommon.cpp
new file mode 100644
index 000000000000..569b860a4235
--- /dev/null
+++ b/source/API/SBBreakpointOptionCommon.cpp
@@ -0,0 +1,85 @@
+//===-- SBBreakpointName.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBEvent.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBThread.h"
+
+#include "lldb/Breakpoint/BreakpointName.h"
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Address.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
+
+#include "lldb/lldb-enumerations.h"
+
+#include "SBBreakpointOptionCommon.h"
+
+#include "llvm/ADT/STLExtras.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(SBBreakpointHitCallback
+ callback,
+ void *baton)
+ : TypedBaton(llvm::make_unique<CallbackData>()) {
+ getItem()->callback = callback;
+ getItem()->callback_baton = baton;
+ }
+
+ bool SBBreakpointCallbackBaton::PrivateBreakpointHitCallback(void *baton,
+ StoppointCallbackContext *ctx,
+ lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id)
+{
+ ExecutionContext exe_ctx(ctx->exe_ctx_ref);
+ BreakpointSP bp_sp(
+ exe_ctx.GetTargetRef().GetBreakpointList().FindBreakpointByID(break_id));
+ if (baton && bp_sp) {
+ CallbackData *data = (CallbackData *)baton;
+ lldb_private::Breakpoint *bp = bp_sp.get();
+ if (bp && data->callback) {
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process) {
+ SBProcess sb_process(process->shared_from_this());
+ SBThread sb_thread;
+ SBBreakpointLocation sb_location;
+ assert(bp_sp);
+ sb_location.SetLocation(bp_sp->FindLocationByID(break_loc_id));
+ Thread *thread = exe_ctx.GetThreadPtr();
+ if (thread)
+ sb_thread.SetThread(thread->shared_from_this());
+
+ return data->callback(data->callback_baton, sb_process, sb_thread,
+ sb_location);
+ }
+ }
+ }
+ return true; // Return true if we should stop at this breakpoint
+}
+
+SBBreakpointCallbackBaton::~SBBreakpointCallbackBaton() = default;
diff --git a/source/API/SBBreakpointOptionCommon.h b/source/API/SBBreakpointOptionCommon.h
new file mode 100644
index 000000000000..fe276ac636fe
--- /dev/null
+++ b/source/API/SBBreakpointOptionCommon.h
@@ -0,0 +1,37 @@
+//===-- SBBreakpointOptionCommon.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBreakpointOptionCommons_h_
+#define LLDB_SBBreakpointOptionCommons_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/Utility/Baton.h"
+
+namespace lldb
+{
+struct CallbackData {
+ SBBreakpointHitCallback callback;
+ void *callback_baton;
+};
+
+class SBBreakpointCallbackBaton : public lldb_private::TypedBaton<CallbackData> {
+public:
+ SBBreakpointCallbackBaton(SBBreakpointHitCallback callback,
+ void *baton);
+
+ ~SBBreakpointCallbackBaton();
+
+ static bool PrivateBreakpointHitCallback(void *baton,
+ lldb_private::StoppointCallbackContext *ctx,
+ lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id);
+};
+
+} // namespace lldb
+#endif // LLDB_SBBreakpointOptionCommons_h_
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index aa4953999b84..c9bb8f65fa2e 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -161,6 +161,10 @@ bool SBCommandInterpreter::IsActive() {
return (IsValid() ? m_opaque_ptr->IsActive() : false);
}
+bool SBCommandInterpreter::WasInterrupted() const {
+ return (IsValid() ? m_opaque_ptr->WasInterrupted() : false);
+}
+
const char *SBCommandInterpreter::GetIOHandlerControlSequence(char ch) {
return (IsValid()
? m_opaque_ptr->GetDebugger()
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 3cdb6bbfd5f9..d3294dab582d 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -26,6 +26,7 @@
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBTypeCategory.h"
@@ -37,8 +38,10 @@
#include "lldb/API/SystemInitializerFull.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Interpreter/Args.h"
@@ -69,7 +72,7 @@ static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP &debugger_sp,
// TODO: mangle this differently for your system - on OSX, the first
// underscore needs to be removed and the second one stays
LLDBCommandPluginInit init_func =
- (LLDBCommandPluginInit)dynlib.getAddressOfSymbol(
+ (LLDBCommandPluginInit)(uintptr_t)dynlib.getAddressOfSymbol(
"_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
if (init_func) {
if (init_func(debugger_sb))
@@ -619,6 +622,20 @@ SBTarget SBDebugger::CreateTarget(const char *filename) {
return sb_target;
}
+SBTarget SBDebugger::GetDummyTarget() {
+ SBTarget sb_target;
+ if (m_opaque_sp) {
+ sb_target.SetSP(m_opaque_sp->GetDummyTarget()->shared_from_this());
+ }
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ if (log)
+ log->Printf(
+ "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
+ static_cast<void *>(m_opaque_sp.get()),
+ static_cast<void *>(sb_target.GetSP().get()));
+ return sb_target;
+}
+
bool SBDebugger::DeleteTarget(lldb::SBTarget &target) {
bool result = false;
if (m_opaque_sp) {
@@ -677,8 +694,8 @@ SBTarget SBDebugger::FindTargetWithFileAndArch(const char *filename,
SBTarget sb_target;
if (m_opaque_sp && filename && filename[0]) {
// No need to lock, the target list is thread safe
- ArchSpec arch(arch_name,
- m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
+ ArchSpec arch = Platform::GetAugmentedArchSpec(
+ m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
TargetSP target_sp(
m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
FileSpec(filename, false), arch_name ? &arch : nullptr));
@@ -774,6 +791,67 @@ void SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform) {
sb_platform.GetName());
}
+uint32_t SBDebugger::GetNumPlatforms() {
+ if (m_opaque_sp) {
+ // No need to lock, the platform list is thread safe
+ return m_opaque_sp->GetPlatformList().GetSize();
+ }
+ return 0;
+}
+
+SBPlatform SBDebugger::GetPlatformAtIndex(uint32_t idx) {
+ SBPlatform sb_platform;
+ if (m_opaque_sp) {
+ // No need to lock, the platform list is thread safe
+ sb_platform.SetSP(m_opaque_sp->GetPlatformList().GetAtIndex(idx));
+ }
+ return sb_platform;
+}
+
+uint32_t SBDebugger::GetNumAvailablePlatforms() {
+ uint32_t idx = 0;
+ while (true) {
+ if (!PluginManager::GetPlatformPluginNameAtIndex(idx)) {
+ break;
+ }
+ ++idx;
+ }
+ // +1 for the host platform, which should always appear first in the list.
+ return idx + 1;
+}
+
+SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) {
+ SBStructuredData data;
+ auto platform_dict = llvm::make_unique<StructuredData::Dictionary>();
+ llvm::StringRef name_str("name"), desc_str("description");
+
+ if (idx == 0) {
+ PlatformSP host_platform_sp(Platform::GetHostPlatform());
+ platform_dict->AddStringItem(
+ name_str, host_platform_sp->GetPluginName().GetStringRef());
+ platform_dict->AddStringItem(
+ desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
+ } else if (idx > 0) {
+ const char *plugin_name =
+ PluginManager::GetPlatformPluginNameAtIndex(idx - 1);
+ if (!plugin_name) {
+ return data;
+ }
+ platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
+
+ const char *plugin_desc =
+ PluginManager::GetPlatformPluginDescriptionAtIndex(idx - 1);
+ if (!plugin_desc) {
+ return data;
+ }
+ platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
+ }
+
+ data.m_impl_up->SetObjectSP(
+ StructuredData::ObjectSP(platform_dict.release()));
+ return data;
+}
+
void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) {
DispatchInput(data, data_len);
}
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 8b7deb7011be..1cca8db2afe8 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -14,15 +14,15 @@
#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTarget.h"
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
@@ -259,8 +259,7 @@ bool SBInstruction::EmulateWithFrame(lldb::SBFrame &frame,
bool SBInstruction::DumpEmulation(const char *triple) {
lldb::InstructionSP inst_sp(GetOpaque());
if (inst_sp && triple) {
- lldb_private::ArchSpec arch(triple, NULL);
- return inst_sp->DumpEmulation(arch);
+ return inst_sp->DumpEmulation(HostInfo::GetAugmentedArchSpec(triple));
}
return false;
}
diff --git a/source/API/SBPlatform.cpp b/source/API/SBPlatform.cpp
index 87cbc4537a3c..7ec43f13021f 100644
--- a/source/API/SBPlatform.cpp
+++ b/source/API/SBPlatform.cpp
@@ -12,11 +12,11 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBUnixSignals.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/File.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Status.h"
#include "llvm/Support/FileSystem.h"
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index caf07dbe3ce8..e08a7f4b08e0 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -1369,3 +1369,13 @@ lldb::SBMemoryRegionInfoList SBProcess::GetMemoryRegions() {
}
return sb_region_list;
}
+
+lldb::SBProcessInfo SBProcess::GetProcessInfo() {
+ lldb::SBProcessInfo sb_proc_info;
+ ProcessSP process_sp(GetSP());
+ ProcessInstanceInfo proc_info;
+ if (process_sp && process_sp->GetProcessInfo(proc_info)) {
+ sb_proc_info.SetProcessInfo(proc_info);
+ }
+ return sb_proc_info;
+}
diff --git a/source/API/SBProcessInfo.cpp b/source/API/SBProcessInfo.cpp
new file mode 100644
index 000000000000..38f6c1d1e699
--- /dev/null
+++ b/source/API/SBProcessInfo.cpp
@@ -0,0 +1,145 @@
+//===-- SBProcessInfo.cpp ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBProcessInfo.h"
+
+#include "lldb/API/SBFileSpec.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBProcessInfo::SBProcessInfo() : m_opaque_ap() {}
+
+SBProcessInfo::SBProcessInfo(const SBProcessInfo &rhs) : m_opaque_ap() {
+ if (rhs.IsValid()) {
+ ref() = *rhs.m_opaque_ap;
+ }
+}
+
+SBProcessInfo::~SBProcessInfo() {}
+
+SBProcessInfo &SBProcessInfo::operator=(const SBProcessInfo &rhs) {
+ if (this != &rhs) {
+ if (rhs.IsValid())
+ ref() = *rhs.m_opaque_ap;
+ else
+ m_opaque_ap.reset();
+ }
+ return *this;
+}
+
+ProcessInstanceInfo &SBProcessInfo::ref() {
+ if (m_opaque_ap.get() == nullptr) {
+ m_opaque_ap.reset(new ProcessInstanceInfo());
+ }
+ return *m_opaque_ap;
+}
+
+void SBProcessInfo::SetProcessInfo(const ProcessInstanceInfo &proc_info_ref) {
+ ref() = proc_info_ref;
+}
+
+bool SBProcessInfo::IsValid() const { return m_opaque_ap.get() != nullptr; }
+
+const char *SBProcessInfo::GetName() {
+ const char *name = nullptr;
+ if (m_opaque_ap) {
+ name = m_opaque_ap->GetName();
+ }
+ return name;
+}
+
+SBFileSpec SBProcessInfo::GetExecutableFile() {
+ SBFileSpec file_spec;
+ if (m_opaque_ap) {
+ file_spec.SetFileSpec(m_opaque_ap->GetExecutableFile());
+ }
+ return file_spec;
+}
+
+lldb::pid_t SBProcessInfo::GetProcessID() {
+ lldb::pid_t proc_id = LLDB_INVALID_PROCESS_ID;
+ if (m_opaque_ap) {
+ proc_id = m_opaque_ap->GetProcessID();
+ }
+ return proc_id;
+}
+
+uint32_t SBProcessInfo::GetUserID() {
+ uint32_t user_id = UINT32_MAX;
+ if (m_opaque_ap) {
+ user_id = m_opaque_ap->GetUserID();
+ }
+ return user_id;
+}
+
+uint32_t SBProcessInfo::GetGroupID() {
+ uint32_t group_id = UINT32_MAX;
+ if (m_opaque_ap) {
+ group_id = m_opaque_ap->GetGroupID();
+ }
+ return group_id;
+}
+
+bool SBProcessInfo::UserIDIsValid() {
+ bool is_valid = false;
+ if (m_opaque_ap) {
+ is_valid = m_opaque_ap->UserIDIsValid();
+ }
+ return is_valid;
+}
+
+bool SBProcessInfo::GroupIDIsValid() {
+ bool is_valid = false;
+ if (m_opaque_ap) {
+ is_valid = m_opaque_ap->GroupIDIsValid();
+ }
+ return is_valid;
+}
+
+uint32_t SBProcessInfo::GetEffectiveUserID() {
+ uint32_t user_id = UINT32_MAX;
+ if (m_opaque_ap) {
+ user_id = m_opaque_ap->GetEffectiveUserID();
+ }
+ return user_id;
+}
+
+uint32_t SBProcessInfo::GetEffectiveGroupID() {
+ uint32_t group_id = UINT32_MAX;
+ if (m_opaque_ap) {
+ group_id = m_opaque_ap->GetEffectiveGroupID();
+ }
+ return group_id;
+}
+
+bool SBProcessInfo::EffectiveUserIDIsValid() {
+ bool is_valid = false;
+ if (m_opaque_ap) {
+ is_valid = m_opaque_ap->EffectiveUserIDIsValid();
+ }
+ return is_valid;
+}
+
+bool SBProcessInfo::EffectiveGroupIDIsValid() {
+ bool is_valid = false;
+ if (m_opaque_ap) {
+ is_valid = m_opaque_ap->EffectiveGroupIDIsValid();
+ }
+ return is_valid;
+}
+
+lldb::pid_t SBProcessInfo::GetParentProcessID() {
+ lldb::pid_t proc_id = LLDB_INVALID_PROCESS_ID;
+ if (m_opaque_ap) {
+ proc_id = m_opaque_ap->GetParentProcessID();
+ }
+ return proc_id;
+}
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index c706344ee4a3..2c1c6bcac71b 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -31,7 +31,6 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressResolver.h"
#include "lldb/Core/AddressResolverName.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
@@ -58,6 +57,7 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/TargetList.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
@@ -414,16 +414,6 @@ lldb::SBProcess SBTarget::Attach(SBAttachInfo &sb_attach_info, SBError &error) {
return sb_process;
}
-#if defined(__APPLE__)
-
-lldb::SBProcess SBTarget::AttachToProcessWithID(SBListener &listener,
- ::pid_t pid,
- lldb::SBError &error) {
- return AttachToProcessWithID(listener, (lldb::pid_t)pid, error);
-}
-
-#endif // #if defined(__APPLE__)
-
lldb::SBProcess SBTarget::AttachToProcessWithID(
SBListener &listener,
lldb::pid_t pid, // The process ID to attach to
@@ -1097,11 +1087,35 @@ bool SBTarget::FindBreakpointsByName(const char *name,
return true;
}
+void SBTarget::GetBreakpointNames(SBStringList &names)
+{
+ names.Clear();
+
+ TargetSP target_sp(GetSP());
+ if (target_sp) {
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+
+ std::vector<std::string> name_vec;
+ target_sp->GetBreakpointNames(name_vec);
+ for (auto name : name_vec)
+ names.AppendString(name.c_str());
+ }
+}
+
+void SBTarget::DeleteBreakpointName(const char *name)
+{
+ TargetSP target_sp(GetSP());
+ if (target_sp) {
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ target_sp->DeleteBreakpointName(ConstString(name));
+ }
+}
+
bool SBTarget::EnableAllBreakpoints() {
TargetSP target_sp(GetSP());
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- target_sp->EnableAllBreakpoints();
+ target_sp->EnableAllowedBreakpoints();
return true;
}
return false;
@@ -1111,7 +1125,7 @@ bool SBTarget::DisableAllBreakpoints() {
TargetSP target_sp(GetSP());
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- target_sp->DisableAllBreakpoints();
+ target_sp->DisableAllowedBreakpoints();
return true;
}
return false;
@@ -1121,7 +1135,7 @@ bool SBTarget::DeleteAllBreakpoints() {
TargetSP target_sp(GetSP());
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- target_sp->RemoveAllBreakpoints();
+ target_sp->RemoveAllowedBreakpoints();
return true;
}
return false;
@@ -1428,8 +1442,8 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
module_spec.GetUUID().SetFromCString(uuid_cstr);
if (triple)
- module_spec.GetArchitecture().SetTriple(triple,
- target_sp->GetPlatform().get());
+ module_spec.GetArchitecture() = Platform::GetAugmentedArchSpec(
+ target_sp->GetPlatform().get(), triple);
else
module_spec.GetArchitecture() = target_sp->GetArchitecture();
diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp
index e2ef07cf5c47..80d48754c89b 100644
--- a/source/API/SBType.cpp
+++ b/source/API/SBType.cpp
@@ -415,21 +415,31 @@ uint32_t SBType::GetNumberOfTemplateArguments() {
}
lldb::SBType SBType::GetTemplateArgumentType(uint32_t idx) {
- if (IsValid()) {
- TemplateArgumentKind kind = eTemplateArgumentKindNull;
- CompilerType template_arg_type =
- m_opaque_sp->GetCompilerType(false).GetTemplateArgument(idx, kind);
- if (template_arg_type.IsValid())
- return SBType(template_arg_type);
+ if (!IsValid())
+ return SBType();
+
+ CompilerType type;
+ switch(GetTemplateArgumentKind(idx)) {
+ case eTemplateArgumentKindType:
+ type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument(idx);
+ break;
+ case eTemplateArgumentKindIntegral:
+ type = m_opaque_sp->GetCompilerType(false)
+ .GetIntegralTemplateArgument(idx)
+ ->type;
+ break;
+ default:
+ break;
}
+ if (type.IsValid())
+ return SBType(type);
return SBType();
}
lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) {
- TemplateArgumentKind kind = eTemplateArgumentKindNull;
if (IsValid())
- m_opaque_sp->GetCompilerType(false).GetTemplateArgument(idx, kind);
- return kind;
+ return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind(idx);
+ return eTemplateArgumentKindNull;
}
SBTypeList::SBTypeList() : m_opaque_ap(new TypeListImpl()) {}
diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp
index c505f61e42a6..977ebe62353e 100644
--- a/source/API/SystemInitializerFull.cpp
+++ b/source/API/SystemInitializerFull.cpp
@@ -42,6 +42,7 @@
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
+#include "Plugins/Architecture/Arm/ArchitectureArm.h"
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
@@ -50,9 +51,9 @@
#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
+#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
-#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/Go/GoLanguage.h"
@@ -304,6 +305,9 @@ void SystemInitializerFull::Initialize() {
ABISysV_mips::Initialize();
ABISysV_mips64::Initialize();
ABISysV_s390x::Initialize();
+
+ ArchitectureArm::Initialize();
+
DisassemblerLLVMC::Initialize();
JITLoaderGDB::Initialize();
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index 17c104ba0c60..3f6c63e1e5ba 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -53,7 +53,7 @@ Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp,
bool resolve_indirect_symbols)
: m_being_created(true), m_hardware(hardware), m_target(target),
m_filter_sp(filter_sp), m_resolver_sp(resolver_sp),
- m_options_up(new BreakpointOptions()), m_locations(*this),
+ m_options_up(new BreakpointOptions(true)), m_locations(*this),
m_resolve_indirect_symbols(resolve_indirect_symbols), m_hit_count(0) {
m_being_created = false;
}
@@ -210,7 +210,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData(
llvm::StringRef name;
Status error;
success = names_array->GetItemAtIndexAsString(i, name);
- result_sp->AddName(name, error);
+ target.AddNameToBreakpoint(result_sp, name.str().c_str(), error);
}
}
@@ -348,6 +348,14 @@ void Breakpoint::SetOneShot(bool one_shot) {
m_options_up->SetOneShot(one_shot);
}
+bool Breakpoint::IsAutoContinue() const {
+ return m_options_up->IsAutoContinue();
+}
+
+void Breakpoint::SetAutoContinue(bool auto_continue) {
+ m_options_up->SetAutoContinue(auto_continue);
+}
+
void Breakpoint::SetThreadID(lldb::tid_t thread_id) {
if (m_options_up->GetThreadSpec()->GetTID() == thread_id)
return;
@@ -447,6 +455,10 @@ bool Breakpoint::InvokeCallback(StoppointCallbackContext *context,
BreakpointOptions *Breakpoint::GetOptions() { return m_options_up.get(); }
+const BreakpointOptions *Breakpoint::GetOptions() const {
+ return m_options_up.get();
+}
+
void Breakpoint::ResolveBreakpoint() {
if (m_resolver_sp)
m_resolver_sp->ResolveBreakpoint(*m_filter_sp);
@@ -833,18 +845,8 @@ size_t Breakpoint::GetNumResolvedLocations() const {
size_t Breakpoint::GetNumLocations() const { return m_locations.GetSize(); }
-bool Breakpoint::AddName(llvm::StringRef new_name, Status &error) {
- if (new_name.empty())
- return false;
- if (!BreakpointID::StringIsBreakpointName(new_name, error)) {
- error.SetErrorStringWithFormatv("input name \"{0}\" not a breakpoint name.",
- new_name);
- return false;
- }
- if (!error.Success())
- return false;
-
- m_name_list.insert(new_name);
+bool Breakpoint::AddName(llvm::StringRef new_name) {
+ m_name_list.insert(new_name.str().c_str());
return true;
}
diff --git a/source/Breakpoint/BreakpointID.cpp b/source/Breakpoint/BreakpointID.cpp
index 112f7c0b5195..b80106546822 100644
--- a/source/Breakpoint/BreakpointID.cpp
+++ b/source/Breakpoint/BreakpointID.cpp
@@ -101,15 +101,24 @@ BreakpointID::ParseCanonicalReference(llvm::StringRef input) {
bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Status &error) {
error.Clear();
if (str.empty())
+ {
+ error.SetErrorStringWithFormat("Empty breakpoint names are not allowed");
return false;
+ }
// First character must be a letter or _
if (!isalpha(str[0]) && str[0] != '_')
+ {
+ error.SetErrorStringWithFormat("Breakpoint names must start with a "
+ "character or underscore: %s",
+ str.str().c_str());
return false;
+ }
// Cannot contain ., -, or space.
if (str.find_first_of(".- ") != llvm::StringRef::npos) {
- error.SetErrorStringWithFormat("invalid breakpoint name: \"%s\"",
+ error.SetErrorStringWithFormat("Breakpoint names cannot contain "
+ "'.' or '-': \"%s\"",
str.str().c_str());
return false;
}
diff --git a/source/Breakpoint/BreakpointIDList.cpp b/source/Breakpoint/BreakpointIDList.cpp
index 7b461147a4e9..6d610d512f3b 100644
--- a/source/Breakpoint/BreakpointIDList.cpp
+++ b/source/Breakpoint/BreakpointIDList.cpp
@@ -11,6 +11,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-enumerations.h"
#include "lldb/Breakpoint/BreakpointIDList.h"
#include "lldb/Breakpoint/Breakpoint.h"
@@ -117,6 +118,8 @@ void BreakpointIDList::InsertStringArray(const char **string_array,
void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
bool allow_locations,
+ BreakpointName::Permissions
+ ::PermissionKinds purpose,
CommandReturnObject &result,
Args &new_args) {
llvm::StringRef range_from;
@@ -136,7 +139,6 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
return;
}
- llvm::StringRef range_expr;
Status error;
std::tie(range_from, range_to) =
@@ -302,14 +304,29 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
}
// Okay, now see if we found any names, and if we did, add them:
- if (target && names_found.size()) {
- for (BreakpointSP bkpt_sp : target->GetBreakpointList().Breakpoints()) {
- for (std::string name : names_found) {
- if (bkpt_sp->MatchesName(name.c_str())) {
- StreamString canonical_id_str;
- BreakpointID::GetCanonicalReference(
- &canonical_id_str, bkpt_sp->GetID(), LLDB_INVALID_BREAK_ID);
- new_args.AppendArgument(canonical_id_str.GetString());
+ if (target && !names_found.empty()) {
+ Status error;
+ // Remove any names that aren't visible for this purpose:
+ auto iter = names_found.begin();
+ while (iter != names_found.end()) {
+ BreakpointName *bp_name = target->FindBreakpointName(ConstString(*iter),
+ true,
+ error);
+ if (bp_name && !bp_name->GetPermission(purpose))
+ iter = names_found.erase(iter);
+ else
+ iter++;
+ }
+
+ if (!names_found.empty()) {
+ for (BreakpointSP bkpt_sp : target->GetBreakpointList().Breakpoints()) {
+ for (std::string name : names_found) {
+ if (bkpt_sp->MatchesName(name.c_str())) {
+ StreamString canonical_id_str;
+ BreakpointID::GetCanonicalReference(
+ &canonical_id_str, bkpt_sp->GetID(), LLDB_INVALID_BREAK_ID);
+ new_args.AppendArgument(canonical_id_str.GetString());
+ }
}
}
}
diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp
index 15bcb34a3d85..01ac59f0a903 100644
--- a/source/Breakpoint/BreakpointList.cpp
+++ b/source/Breakpoint/BreakpointList.cpp
@@ -71,6 +71,13 @@ void BreakpointList::SetEnabledAll(bool enabled) {
bp_sp->SetEnabled(enabled);
}
+void BreakpointList::SetEnabledAllowed(bool enabled) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ for (const auto &bp_sp : m_breakpoints)
+ if (bp_sp->AllowDisable())
+ bp_sp->SetEnabled(enabled);
+}
+
void BreakpointList::RemoveAll(bool notify) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
ClearAllBreakpointSites();
@@ -90,6 +97,32 @@ void BreakpointList::RemoveAll(bool notify) {
m_breakpoints.erase(m_breakpoints.begin(), m_breakpoints.end());
}
+void BreakpointList::RemoveAllowed(bool notify) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+
+ bp_collection::iterator pos, end = m_breakpoints.end();
+ if (notify) {
+ for (pos = m_breakpoints.begin(); pos != end; ++pos) {
+ if(!(*pos)->AllowDelete())
+ continue;
+ if ((*pos)->GetTarget().EventTypeHasListeners(
+ Target::eBroadcastBitBreakpointChanged)) {
+ (*pos)->GetTarget().BroadcastEvent(
+ Target::eBroadcastBitBreakpointChanged,
+ new Breakpoint::BreakpointEventData(eBreakpointEventTypeRemoved,
+ *pos));
+ }
+ }
+ }
+ pos = m_breakpoints.begin();
+ while ( pos != end) {
+ if((*pos)->AllowDelete())
+ pos = m_breakpoints.erase(pos);
+ else
+ pos++;
+ }
+}
+
class BreakpointIDMatches {
public:
BreakpointIDMatches(break_id_t break_id) : m_break_id(break_id) {}
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index ec8f141e8d38..f59c334fe5c8 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -58,6 +58,15 @@ lldb::addr_t BreakpointLocation::GetLoadAddress() const {
return m_address.GetOpcodeLoadAddress(&m_owner.GetTarget());
}
+const BreakpointOptions *
+BreakpointLocation::GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind)
+const {
+ if (m_options_ap && m_options_ap->IsOptionSet(kind))
+ return m_options_ap.get();
+ else
+ return m_owner.GetOptions();
+}
+
Address &BreakpointLocation::GetAddress() { return m_address; }
Breakpoint &BreakpointLocation::GetBreakpoint() { return m_owner; }
@@ -84,6 +93,19 @@ void BreakpointLocation::SetEnabled(bool enabled) {
: eBreakpointEventTypeDisabled);
}
+bool BreakpointLocation::IsAutoContinue() const {
+ if (m_options_ap
+ && m_options_ap->IsOptionSet(BreakpointOptions::eAutoContinue))
+ return m_options_ap->IsAutoContinue();
+ else
+ return m_owner.IsAutoContinue();
+}
+
+void BreakpointLocation::SetAutoContinue(bool auto_continue) {
+ GetLocationOptions()->SetAutoContinue(auto_continue);
+ SendBreakpointLocationChangedEvent(eBreakpointEventTypeAutoContinueChanged);
+}
+
void BreakpointLocation::SetThreadID(lldb::tid_t thread_id) {
if (thread_id != LLDB_INVALID_THREAD_ID)
GetLocationOptions()->SetThreadID(thread_id);
@@ -97,8 +119,11 @@ void BreakpointLocation::SetThreadID(lldb::tid_t thread_id) {
}
lldb::tid_t BreakpointLocation::GetThreadID() {
- if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
- return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID();
+ const ThreadSpec *thread_spec =
+ GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate();
+ if (thread_spec)
+ return thread_spec->GetTID();
else
return LLDB_INVALID_THREAD_ID;
}
@@ -116,8 +141,11 @@ void BreakpointLocation::SetThreadIndex(uint32_t index) {
}
uint32_t BreakpointLocation::GetThreadIndex() const {
- if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
- return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetIndex();
+ const ThreadSpec *thread_spec =
+ GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate();
+ if (thread_spec)
+ return thread_spec->GetIndex();
else
return 0;
}
@@ -135,8 +163,11 @@ void BreakpointLocation::SetThreadName(const char *thread_name) {
}
const char *BreakpointLocation::GetThreadName() const {
- if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
- return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetName();
+ const ThreadSpec *thread_spec =
+ GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate();
+ if (thread_spec)
+ return thread_spec->GetName();
else
return nullptr;
}
@@ -154,8 +185,11 @@ void BreakpointLocation::SetQueueName(const char *queue_name) {
}
const char *BreakpointLocation::GetQueueName() const {
- if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
- return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetQueueName();
+ const ThreadSpec *thread_spec =
+ GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate();
+ if (thread_spec)
+ return thread_spec->GetQueueName();
else
return nullptr;
}
@@ -193,7 +227,8 @@ void BreakpointLocation::SetCondition(const char *condition) {
}
const char *BreakpointLocation::GetConditionText(size_t *hash) const {
- return GetOptionsNoCreate()->GetConditionText(hash);
+ return GetOptionsSpecifyingKind(BreakpointOptions::eCondition)
+ ->GetConditionText(hash);
}
bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
@@ -305,7 +340,8 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
}
uint32_t BreakpointLocation::GetIgnoreCount() {
- return GetOptionsNoCreate()->GetIgnoreCount();
+ return GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
+ ->GetIgnoreCount();
}
void BreakpointLocation::SetIgnoreCount(uint32_t n) {
@@ -335,26 +371,21 @@ bool BreakpointLocation::IgnoreCountShouldStop() {
return true;
}
-const BreakpointOptions *BreakpointLocation::GetOptionsNoCreate() const {
- if (m_options_ap.get() != nullptr)
- return m_options_ap.get();
- else
- return m_owner.GetOptions();
-}
-
BreakpointOptions *BreakpointLocation::GetLocationOptions() {
// If we make the copy we don't copy the callbacks because that is potentially
// expensive and we don't want to do that for the simple case where someone is
// just disabling the location.
if (m_options_ap.get() == nullptr)
m_options_ap.reset(
- BreakpointOptions::CopyOptionsNoCallback(*m_owner.GetOptions()));
+ new BreakpointOptions(false));
return m_options_ap.get();
}
bool BreakpointLocation::ValidForThisThread(Thread *thread) {
- return thread->MatchesSpec(GetOptionsNoCreate()->GetThreadSpecNoCreate());
+ return thread
+ ->MatchesSpec(GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate());
}
// RETURNS - true if we should stop at this breakpoint, false if we
@@ -600,17 +631,20 @@ void BreakpointLocation::Dump(Stream *s) const {
if (s == nullptr)
return;
+ lldb::tid_t tid = GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
+ ->GetThreadSpecNoCreate()->GetTID();
s->Printf(
"BreakpointLocation %u: tid = %4.4" PRIx64 " load addr = 0x%8.8" PRIx64
" state = %s type = %s breakpoint "
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
- GetID(), GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
+ GetID(), tid,
(uint64_t)m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()),
(m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled())
? "enabled "
: "disabled",
IsHardware() ? "hardware" : "software", GetHardwareIndex(), GetHitCount(),
- GetOptionsNoCreate()->GetIgnoreCount());
+ GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
+ ->GetIgnoreCount());
}
void BreakpointLocation::SendBreakpointLocationChangedEvent(
diff --git a/source/Breakpoint/BreakpointLocationList.cpp b/source/Breakpoint/BreakpointLocationList.cpp
index b4cf0c38e9c2..1e4b4412a427 100644
--- a/source/Breakpoint/BreakpointLocationList.cpp
+++ b/source/Breakpoint/BreakpointLocationList.cpp
@@ -15,11 +15,11 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Breakpoint/BreakpointName.cpp b/source/Breakpoint/BreakpointName.cpp
new file mode 100644
index 000000000000..be4710d7849c
--- /dev/null
+++ b/source/Breakpoint/BreakpointName.cpp
@@ -0,0 +1,91 @@
+//===-- Breakpoint.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details->
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+#include "llvm/Support/Casting.h"
+
+// Project includes
+#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Breakpoint/BreakpointResolverFileLine.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+const Flags::ValueType BreakpointName::Permissions::permissions_mask
+ [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = {
+ (1u << 0),
+ (1u << 1),
+ (1u << 2),
+ (0x5u)
+};
+
+BreakpointName::BreakpointName(const ConstString &name, const Breakpoint &bkpt,
+ const char *help) :
+ m_name(name), m_options(bkpt.GetOptions())
+{
+ SetHelp(help);
+}
+
+bool BreakpointName::Permissions::GetDescription(Stream *s,
+ lldb::DescriptionLevel level) {
+ if (!AnySet())
+ return false;
+ s->IndentMore();
+ s->Indent();
+ if (IsSet(listPerm))
+ s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed");
+
+ if (IsSet(disablePerm))
+ s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed");
+
+ if (IsSet(deletePerm))
+ s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed");
+ s->IndentLess();
+ return true;
+}
+
+bool BreakpointName::GetDescription(Stream *s, lldb::DescriptionLevel level) {
+ bool printed_any = false;
+ if (!m_help.empty())
+ s->Printf("Help: %s\n", m_help.c_str());
+
+ if (GetOptions().AnySet())
+ {
+ s->PutCString("Options: \n");
+ s->IndentMore();
+ s->Indent();
+ GetOptions().GetDescription(s, level);
+ printed_any = true;
+ s->IndentLess();
+ }
+ if (GetPermissions().AnySet())
+ {
+ s->PutCString("Permissions: \n");
+ s->IndentMore();
+ s->Indent();
+ GetPermissions().GetDescription(s, level);
+ printed_any = true;
+ s->IndentLess();
+ }
+ return printed_any;
+}
+
+void BreakpointName::ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
+{
+ bp_sp->GetOptions()->CopyOverSetOptions(GetOptions());
+ bp_sp->GetPermissions().MergeInto(GetPermissions());
+}
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp
index bef63cc0f222..662b288794d3 100644
--- a/source/Breakpoint/BreakpointOptions.cpp
+++ b/source/Breakpoint/BreakpointOptions.cpp
@@ -114,7 +114,8 @@ BreakpointOptions::CommandData::CreateFromStructuredData(
const char *BreakpointOptions::g_option_names[(
size_t)BreakpointOptions::OptionNames::LastOptionName]{
- "ConditionText", "IgnoreCount", "EnabledState", "OneShotState"};
+ "ConditionText", "IgnoreCount",
+ "EnabledState", "OneShotState", "AutoContinue"};
bool BreakpointOptions::NullCallback(void *baton,
StoppointCallbackContext *context,
@@ -126,20 +127,30 @@ bool BreakpointOptions::NullCallback(void *baton,
//----------------------------------------------------------------------
// BreakpointOptions constructor
//----------------------------------------------------------------------
-BreakpointOptions::BreakpointOptions()
+BreakpointOptions::BreakpointOptions(bool all_flags_set)
: m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(),
m_baton_is_command_baton(false), m_callback_is_synchronous(false),
m_enabled(true), m_one_shot(false), m_ignore_count(0), m_thread_spec_ap(),
- m_condition_text(), m_condition_text_hash(0) {}
+ m_condition_text(), m_condition_text_hash(0), m_auto_continue(false),
+ m_set_flags(0) {
+ if (all_flags_set)
+ m_set_flags.Set(~((Flags::ValueType) 0));
+ }
BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
- int32_t ignore, bool one_shot)
+ int32_t ignore, bool one_shot,
+ bool auto_continue)
: m_callback(nullptr), m_baton_is_command_baton(false),
m_callback_is_synchronous(false), m_enabled(enabled),
- m_one_shot(one_shot), m_ignore_count(ignore), m_condition_text(condition),
- m_condition_text_hash(0)
-
-{}
+ m_one_shot(one_shot), m_ignore_count(ignore),
+ m_condition_text_hash(0), m_auto_continue(auto_continue)
+{
+ m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot
+ | eAutoContinue);
+ if (condition && *condition != '\0') {
+ SetCondition(condition);
+ }
+}
//----------------------------------------------------------------------
// BreakpointOptions copy constructor
@@ -149,7 +160,9 @@ BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs)
m_baton_is_command_baton(rhs.m_baton_is_command_baton),
m_callback_is_synchronous(rhs.m_callback_is_synchronous),
m_enabled(rhs.m_enabled), m_one_shot(rhs.m_one_shot),
- m_ignore_count(rhs.m_ignore_count), m_thread_spec_ap() {
+ m_ignore_count(rhs.m_ignore_count), m_thread_spec_ap(),
+ m_auto_continue(rhs.m_auto_continue),
+ m_set_flags(rhs.m_set_flags) {
if (rhs.m_thread_spec_ap.get() != nullptr)
m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
m_condition_text = rhs.m_condition_text;
@@ -172,21 +185,62 @@ operator=(const BreakpointOptions &rhs) {
m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
m_condition_text = rhs.m_condition_text;
m_condition_text_hash = rhs.m_condition_text_hash;
+ m_auto_continue = rhs.m_auto_continue;
+ m_set_flags = rhs.m_set_flags;
return *this;
}
-BreakpointOptions *
-BreakpointOptions::CopyOptionsNoCallback(BreakpointOptions &orig) {
- BreakpointHitCallback orig_callback = orig.m_callback;
- lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
- bool orig_is_sync = orig.m_callback_is_synchronous;
-
- orig.ClearCallback();
- BreakpointOptions *ret_val = new BreakpointOptions(orig);
-
- orig.SetCallback(orig_callback, orig_callback_baton_sp, orig_is_sync);
-
- return ret_val;
+void BreakpointOptions::CopyOverSetOptions(const BreakpointOptions &incoming)
+{
+ if (incoming.m_set_flags.Test(eEnabled))
+ {
+ m_enabled = incoming.m_enabled;
+ m_set_flags.Set(eEnabled);
+ }
+ if (incoming.m_set_flags.Test(eOneShot))
+ {
+ m_one_shot = incoming.m_one_shot;
+ m_set_flags.Set(eOneShot);
+ }
+ if (incoming.m_set_flags.Test(eCallback))
+ {
+ m_callback = incoming.m_callback;
+ m_callback_baton_sp = incoming.m_callback_baton_sp;
+ m_callback_is_synchronous = incoming.m_callback_is_synchronous;
+ m_baton_is_command_baton = incoming.m_baton_is_command_baton;
+ m_set_flags.Set(eCallback);
+ }
+ if (incoming.m_set_flags.Test(eIgnoreCount))
+ {
+ m_ignore_count = incoming.m_ignore_count;
+ m_set_flags.Set(eIgnoreCount);
+ }
+ if (incoming.m_set_flags.Test(eCondition))
+ {
+ // If we're copying over an empty condition, mark it as unset.
+ if (incoming.m_condition_text.empty()) {
+ m_condition_text.clear();
+ m_condition_text_hash = 0;
+ m_set_flags.Clear(eCondition);
+ } else {
+ m_condition_text = incoming.m_condition_text;
+ m_condition_text_hash = incoming.m_condition_text_hash;
+ m_set_flags.Set(eCondition);
+ }
+ }
+ if (incoming.m_set_flags.Test(eAutoContinue))
+ {
+ m_auto_continue = incoming.m_auto_continue;
+ m_set_flags.Set(eAutoContinue);
+ }
+ if (incoming.m_set_flags.Test(eThreadSpec) && incoming.m_thread_spec_ap)
+ {
+ if (!m_thread_spec_ap)
+ m_thread_spec_ap.reset(new ThreadSpec(*incoming.m_thread_spec_ap.get()));
+ else
+ *m_thread_spec_ap.get() = *incoming.m_thread_spec_ap.get();
+ m_set_flags.Set(eThreadSpec);
+ }
}
//----------------------------------------------------------------------
@@ -199,30 +253,65 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
Status &error) {
bool enabled = true;
bool one_shot = false;
+ bool auto_continue = false;
int32_t ignore_count = 0;
- std::string condition_text;
-
- bool success = options_dict.GetValueForKeyAsBoolean(
- GetKey(OptionNames::EnabledState), enabled);
- if (!success) {
- error.SetErrorStringWithFormat("%s key is not a boolean.",
+ llvm::StringRef condition_ref("");
+ Flags set_options;
+
+ const char *key = GetKey(OptionNames::EnabledState);
+ bool success;
+ if (key) {
+ success = options_dict.GetValueForKeyAsBoolean(key, enabled);
+ if (!success) {
+ error.SetErrorStringWithFormat("%s key is not a boolean.",
GetKey(OptionNames::EnabledState));
- return nullptr;
+ return nullptr;
+ }
+ set_options.Set(eEnabled);
}
- success = options_dict.GetValueForKeyAsBoolean(
- GetKey(OptionNames::OneShotState), one_shot);
- if (!success) {
- error.SetErrorStringWithFormat("%s key is not a boolean.",
- GetKey(OptionNames::OneShotState));
- return nullptr;
+ key = GetKey(OptionNames::OneShotState);
+ if (key) {
+ success = options_dict.GetValueForKeyAsBoolean(key, one_shot);
+ if (!success) {
+ error.SetErrorStringWithFormat("%s key is not a boolean.",
+ GetKey(OptionNames::OneShotState));
+ return nullptr;
+ }
+ set_options.Set(eOneShot);
}
- success = options_dict.GetValueForKeyAsInteger(
- GetKey(OptionNames::IgnoreCount), ignore_count);
- if (!success) {
- error.SetErrorStringWithFormat("%s key is not an integer.",
- GetKey(OptionNames::IgnoreCount));
- return nullptr;
+
+ key = GetKey(OptionNames::AutoContinue);
+ if (key) {
+ success = options_dict.GetValueForKeyAsBoolean(key, auto_continue);
+ if (!success) {
+ error.SetErrorStringWithFormat("%s key is not a boolean.",
+ GetKey(OptionNames::AutoContinue));
+ return nullptr;
+ }
+ set_options.Set(eAutoContinue);
+ }
+
+ key = GetKey(OptionNames::IgnoreCount);
+ if (key) {
+ success = options_dict.GetValueForKeyAsInteger(key, ignore_count);
+ if (!success) {
+ error.SetErrorStringWithFormat("%s key is not an integer.",
+ GetKey(OptionNames::IgnoreCount));
+ return nullptr;
+ }
+ set_options.Set(eIgnoreCount);
+ }
+
+ key = GetKey(OptionNames::ConditionText);
+ if (key) {
+ success = options_dict.GetValueForKeyAsString(key, condition_ref);
+ if (!success) {
+ error.SetErrorStringWithFormat("%s key is not an string.",
+ GetKey(OptionNames::ConditionText));
+ return nullptr;
+ }
+ set_options.Set(eCondition);
}
std::unique_ptr<CommandData> cmd_data_up;
@@ -241,7 +330,8 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
}
auto bp_options = llvm::make_unique<BreakpointOptions>(
- condition_text.c_str(), enabled, ignore_count, one_shot);
+ condition_ref.str().c_str(), enabled,
+ ignore_count, one_shot, auto_continue);
if (cmd_data_up.get()) {
if (cmd_data_up->interpreter == eScriptLanguageNone)
bp_options->SetCommandDataCallback(cmd_data_up);
@@ -293,14 +383,23 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData() {
StructuredData::DictionarySP options_dict_sp(
new StructuredData::Dictionary());
- options_dict_sp->AddBooleanItem(GetKey(OptionNames::EnabledState), m_enabled);
- options_dict_sp->AddBooleanItem(GetKey(OptionNames::OneShotState),
- m_one_shot);
- options_dict_sp->AddIntegerItem(GetKey(OptionNames::IgnoreCount),
- m_ignore_count);
- options_dict_sp->AddStringItem(GetKey(OptionNames::ConditionText),
- m_condition_text);
- if (m_baton_is_command_baton) {
+ if (m_set_flags.Test(eEnabled))
+ options_dict_sp->AddBooleanItem(GetKey(OptionNames::EnabledState),
+ m_enabled);
+ if (m_set_flags.Test(eOneShot))
+ options_dict_sp->AddBooleanItem(GetKey(OptionNames::OneShotState),
+ m_one_shot);
+ if (m_set_flags.Test(eAutoContinue))
+ options_dict_sp->AddBooleanItem(GetKey(OptionNames::AutoContinue),
+ m_auto_continue);
+ if (m_set_flags.Test(eIgnoreCount))
+ options_dict_sp->AddIntegerItem(GetKey(OptionNames::IgnoreCount),
+ m_ignore_count);
+ if (m_set_flags.Test(eCondition))
+ options_dict_sp->AddStringItem(GetKey(OptionNames::ConditionText),
+ m_condition_text);
+
+ if (m_set_flags.Test(eCallback) && m_baton_is_command_baton) {
auto cmd_baton =
std::static_pointer_cast<CommandBaton>(m_callback_baton_sp);
StructuredData::ObjectSP commands_sp =
@@ -310,7 +409,7 @@ StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData() {
BreakpointOptions::CommandData::GetSerializationKey(), commands_sp);
}
}
- if (m_thread_spec_ap) {
+ if (m_set_flags.Test(eThreadSpec) && m_thread_spec_ap) {
StructuredData::ObjectSP thread_spec_sp =
m_thread_spec_ap->SerializeToStructuredData();
options_dict_sp->AddItem(ThreadSpec::GetSerializationKey(), thread_spec_sp);
@@ -340,6 +439,7 @@ void BreakpointOptions::SetCallback(BreakpointHitCallback callback,
m_callback = callback;
m_callback_baton_sp = callback_baton_sp;
m_baton_is_command_baton = false;
+ m_set_flags.Set(eCallback);
}
void BreakpointOptions::SetCallback(
@@ -350,6 +450,7 @@ void BreakpointOptions::SetCallback(
m_callback = callback;
m_callback_baton_sp = callback_baton_sp;
m_baton_is_command_baton = true;
+ m_set_flags.Set(eCallback);
}
void BreakpointOptions::ClearCallback() {
@@ -357,6 +458,7 @@ void BreakpointOptions::ClearCallback() {
m_callback_is_synchronous = false;
m_callback_baton_sp.reset();
m_baton_is_command_baton = false;
+ m_set_flags.Clear(eCallback);
}
Baton *BreakpointOptions::GetBaton() { return m_callback_baton_sp.get(); }
@@ -395,8 +497,12 @@ bool BreakpointOptions::GetCommandLineCallbacks(StringList &command_list) {
}
void BreakpointOptions::SetCondition(const char *condition) {
- if (!condition)
+ if (!condition || condition[0] == '\0') {
condition = "";
+ m_set_flags.Clear(eCondition);
+ }
+ else
+ m_set_flags.Set(eCondition);
m_condition_text.assign(condition);
std::hash<std::string> hasher;
@@ -427,11 +533,13 @@ ThreadSpec *BreakpointOptions::GetThreadSpec() {
void BreakpointOptions::SetThreadID(lldb::tid_t thread_id) {
GetThreadSpec()->SetTID(thread_id);
+ m_set_flags.Set(eThreadSpec);
}
void BreakpointOptions::SetThreadSpec(
std::unique_ptr<ThreadSpec> &thread_spec_up) {
m_thread_spec_ap = std::move(thread_spec_up);
+ m_set_flags.Set(eThreadSpec);
}
void BreakpointOptions::GetDescription(Stream *s,
@@ -440,7 +548,7 @@ void BreakpointOptions::GetDescription(Stream *s,
// print
// anything if there are:
- if (m_ignore_count != 0 || !m_enabled || m_one_shot ||
+ if (m_ignore_count != 0 || !m_enabled || m_one_shot || m_auto_continue ||
(GetThreadSpecNoCreate() != nullptr &&
GetThreadSpecNoCreate()->HasSpecification())) {
if (level == lldb::eDescriptionLevelVerbose) {
@@ -460,6 +568,9 @@ void BreakpointOptions::GetDescription(Stream *s,
if (m_one_shot)
s->Printf("one-shot ");
+ if (m_auto_continue)
+ s->Printf("auto-continue ");
+
if (m_thread_spec_ap.get())
m_thread_spec_ap->GetDescription(s, level);
@@ -520,6 +631,7 @@ void BreakpointOptions::SetCommandDataCallback(
cmd_data->interpreter = eScriptLanguageNone;
auto baton_sp = std::make_shared<CommandBaton>(std::move(cmd_data));
SetCallback(BreakpointOptions::BreakpointOptionsCallbackFunction, baton_sp);
+ m_set_flags.Set(eCallback);
}
bool BreakpointOptions::BreakpointOptionsCallbackFunction(
@@ -562,3 +674,18 @@ bool BreakpointOptions::BreakpointOptionsCallbackFunction(
}
return ret_value;
}
+
+void BreakpointOptions::Clear()
+{
+ m_set_flags.Clear();
+ m_thread_spec_ap.release();
+ m_one_shot = false;
+ m_ignore_count = 0;
+ m_auto_continue = false;
+ m_callback = nullptr;
+ m_callback_baton_sp.reset();
+ m_baton_is_command_baton = false;
+ m_callback_is_synchronous = false;
+ m_enabled = false;
+ m_condition_text.clear();
+}
diff --git a/source/Breakpoint/CMakeLists.txt b/source/Breakpoint/CMakeLists.txt
index f6278528eab8..f93d48579ad7 100644
--- a/source/Breakpoint/CMakeLists.txt
+++ b/source/Breakpoint/CMakeLists.txt
@@ -6,6 +6,7 @@ add_lldb_library(lldbBreakpoint
BreakpointLocation.cpp
BreakpointLocationCollection.cpp
BreakpointLocationList.cpp
+ BreakpointName.cpp
BreakpointOptions.cpp
BreakpointResolver.cpp
BreakpointResolverAddress.cpp
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index fd84e1c4f857..34cad970ff6e 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -199,14 +199,14 @@ static int DiskFilesOrDirectories(const llvm::Twine &partial_name,
// We have a match.
- fs::file_status st;
- if ((EC = Entry.status(st)))
+ llvm::ErrorOr<fs::basic_file_status> st = Entry.status();
+ if (!st)
continue;
// If it's a symlink, then we treat it as a directory as long as the target
// is a directory.
- bool is_dir = fs::is_directory(st);
- if (fs::is_symlink_file(st)) {
+ bool is_dir = fs::is_directory(*st);
+ if (fs::is_symlink_file(*st)) {
fs::file_status target_st;
if (!fs::status(Entry.path(), target_st))
is_dir = fs::is_directory(target_st);
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 266864d1a1f0..5a175d61060e 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -45,6 +45,203 @@ static void AddBreakpointDescription(Stream *s, Breakpoint *bp,
s->EOL();
}
+//-------------------------------------------------------------------------
+// Modifiable Breakpoint Options
+//-------------------------------------------------------------------------
+#pragma mark Modify::CommandOptions
+static OptionDefinition g_breakpoint_modify_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
+ { LLDB_OPT_SET_1, false, "one-shot", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
+ { LLDB_OPT_SET_1, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument." },
+ { LLDB_OPT_SET_1, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
+ { LLDB_OPT_SET_1, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument." },
+ { LLDB_OPT_SET_1, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by this argument." },
+ { LLDB_OPT_SET_1, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
+ { LLDB_OPT_SET_1, false, "auto-continue",'G', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "The breakpoint will auto-continue after running its commands." },
+ { LLDB_OPT_SET_2, false, "enable", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable the breakpoint." },
+ { LLDB_OPT_SET_3, false, "disable", 'd', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disable the breakpoint." },
+ { LLDB_OPT_SET_4, false, "command", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCommand, "A command to run when the breakpoint is hit, can be provided more than once, the commands will get run in order left to right." },
+ // clang-format on
+};
+class lldb_private::BreakpointOptionGroup : public OptionGroup
+{
+public:
+ BreakpointOptionGroup() :
+ OptionGroup(),
+ m_bp_opts(false) {}
+
+ ~BreakpointOptionGroup() override = default;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::makeArrayRef(g_breakpoint_modify_options);
+ }
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override {
+ Status error;
+ const int short_option = g_breakpoint_modify_options[option_idx].short_option;
+
+ switch (short_option) {
+ case 'c':
+ // Normally an empty breakpoint condition marks is as unset.
+ // But we need to say it was passed in.
+ m_bp_opts.SetCondition(option_arg.str().c_str());
+ m_bp_opts.m_set_flags.Set(BreakpointOptions::eCondition);
+ break;
+ case 'C':
+ m_commands.push_back(option_arg);
+ break;
+ case 'd':
+ m_bp_opts.SetEnabled(false);
+ break;
+ case 'e':
+ m_bp_opts.SetEnabled(true);
+ break;
+ case 'G': {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success) {
+ m_bp_opts.SetAutoContinue(value);
+ } else
+ error.SetErrorStringWithFormat(
+ "invalid boolean value '%s' passed for -G option",
+ option_arg.str().c_str());
+ }
+ break;
+ case 'i':
+ {
+ uint32_t ignore_count;
+ if (option_arg.getAsInteger(0, ignore_count))
+ error.SetErrorStringWithFormat("invalid ignore count '%s'",
+ option_arg.str().c_str());
+ else
+ m_bp_opts.SetIgnoreCount(ignore_count);
+ }
+ break;
+ case 'o': {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success) {
+ m_bp_opts.SetOneShot(value);
+ } else
+ error.SetErrorStringWithFormat(
+ "invalid boolean value '%s' passed for -o option",
+ option_arg.str().c_str());
+ } break;
+ case 't':
+ {
+ lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID;
+ if (option_arg[0] != '\0') {
+ if (option_arg.getAsInteger(0, thread_id))
+ error.SetErrorStringWithFormat("invalid thread id string '%s'",
+ option_arg.str().c_str());
+ }
+ m_bp_opts.SetThreadID(thread_id);
+ }
+ break;
+ case 'T':
+ m_bp_opts.GetThreadSpec()->SetName(option_arg.str().c_str());
+ break;
+ case 'q':
+ m_bp_opts.GetThreadSpec()->SetQueueName(option_arg.str().c_str());
+ break;
+ case 'x':
+ {
+ uint32_t thread_index = UINT32_MAX;
+ if (option_arg[0] != '\n') {
+ if (option_arg.getAsInteger(0, thread_index))
+ error.SetErrorStringWithFormat("invalid thread index string '%s'",
+ option_arg.str().c_str());
+ }
+ m_bp_opts.GetThreadSpec()->SetIndex(thread_index);
+ }
+ break;
+ default:
+ error.SetErrorStringWithFormat("unrecognized option '%c'",
+ short_option);
+ break;
+ }
+
+ return error;
+ }
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override {
+ m_bp_opts.Clear();
+ m_commands.clear();
+ }
+
+ Status OptionParsingFinished(ExecutionContext *execution_context) override {
+ if (!m_commands.empty())
+ {
+ if (!m_commands.empty())
+ {
+ auto cmd_data = llvm::make_unique<BreakpointOptions::CommandData>();
+
+ for (std::string &str : m_commands)
+ cmd_data->user_source.AppendString(str);
+
+ cmd_data->stop_on_error = true;
+ m_bp_opts.SetCommandDataCallback(cmd_data);
+ }
+ }
+ return Status();
+ }
+
+ const BreakpointOptions &GetBreakpointOptions()
+ {
+ return m_bp_opts;
+ }
+
+ std::vector<std::string> m_commands;
+ BreakpointOptions m_bp_opts;
+
+};
+static OptionDefinition g_breakpoint_dummy_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Act on Dummy breakpoints - i.e. breakpoints set before a file is provided, "
+ "which prime new targets." },
+ // clang-format on
+};
+
+class BreakpointDummyOptionGroup : public OptionGroup
+{
+public:
+ BreakpointDummyOptionGroup() :
+ OptionGroup() {}
+
+ ~BreakpointDummyOptionGroup() override = default;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::makeArrayRef(g_breakpoint_dummy_options);
+ }
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override {
+ Status error;
+ const int short_option = g_breakpoint_modify_options[option_idx].short_option;
+
+ switch (short_option) {
+ case 'D':
+ m_use_dummy = true;
+ break;
+ default:
+ error.SetErrorStringWithFormat("unrecognized option '%c'",
+ short_option);
+ break;
+ }
+
+ return error;
+ }
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override {
+ m_use_dummy = false;
+ }
+
+ bool m_use_dummy;
+
+};
+
// If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2)
@@ -58,16 +255,7 @@ static OptionDefinition g_breakpoint_set_options[] = {
// clang-format off
{ LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the breakpoint only in this shared library. Can repeat this option "
"multiple times to specify multiple shared libraries." },
- { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
- { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The breakpoint is deleted the first time it causes a stop." },
- { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
- { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose indeX matches this argument." },
- { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
- { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this "
- "argument." },
{ LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Require the breakpoint to use hardware breakpoints." },
- { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by "
- "this argument." },
{ LLDB_OPT_FILE, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file in which to set this breakpoint. Note, by default "
"lldb only looks for files that are #included if they use the standard include "
"file extensions. To set breakpoints on .c/.cpp/.m/.mm files that are "
@@ -125,8 +313,6 @@ static OptionDefinition g_breakpoint_set_options[] = {
"If not set the target.language setting is used." },
{ LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "sKip the prologue if the breakpoint is at the beginning of a function. "
"If not set the target.skip-prologue setting is used." },
- { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, "
- "which prime new targets." },
{ LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Adds this to the list of names for this breakpoint." },
{ LLDB_OPT_OFFSET_APPLIES, false, "address-slide", 'R', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress, "Add the specified offset to whatever address(es) the breakpoint resolves to. "
"At present this applies the offset directly as given, and doesn't try to align it to instruction boundaries." },
@@ -156,24 +342,30 @@ public:
interpreter, "breakpoint set",
"Sets a breakpoint or set of breakpoints in the executable.",
"breakpoint set <cmd-options>"),
- m_options() {}
+ m_bp_opts(), m_options() {
+ // We're picking up all the normal options, commands and disable.
+ m_all_options.Append(&m_bp_opts,
+ LLDB_OPT_SET_1 | LLDB_OPT_SET_3 | LLDB_OPT_SET_4,
+ LLDB_OPT_SET_ALL);
+ m_all_options.Append(&m_dummy_options, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
+ m_all_options.Append(&m_options);
+ m_all_options.Finalize();
+ }
~CommandObjectBreakpointSet() override = default;
- Options *GetOptions() override { return &m_options; }
+ Options *GetOptions() override { return &m_all_options; }
- class CommandOptions : public Options {
+ class CommandOptions : public OptionGroup {
public:
CommandOptions()
- : Options(), m_condition(), m_filenames(), m_line_num(0), m_column(0),
+ : OptionGroup(), m_condition(), m_filenames(), m_line_num(0), m_column(0),
m_func_names(), m_func_name_type_mask(eFunctionNameTypeNone),
m_func_regexp(), m_source_text_regexp(), m_modules(), m_load_addr(),
- m_ignore_count(0), m_thread_id(LLDB_INVALID_THREAD_ID),
- m_thread_index(UINT32_MAX), m_thread_name(), m_queue_name(),
m_catch_bp(false), m_throw_bp(true), m_hardware(false),
m_exception_language(eLanguageTypeUnknown),
m_language(lldb::eLanguageTypeUnknown),
- m_skip_prologue(eLazyBoolCalculate), m_one_shot(false),
+ m_skip_prologue(eLazyBoolCalculate),
m_all_files(false), m_move_to_nearest_code(eLazyBoolCalculate) {}
~CommandOptions() override = default;
@@ -181,7 +373,7 @@ public:
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) override {
Status error;
- const int short_option = m_getopt_table[option_idx].val;
+ const int short_option = g_breakpoint_set_options[option_idx].short_option;
switch (short_option) {
case 'a': {
@@ -204,14 +396,6 @@ public:
option_arg.str().c_str());
break;
- case 'c':
- m_condition.assign(option_arg);
- break;
-
- case 'D':
- m_use_dummy = true;
- break;
-
case 'E': {
LanguageType language = Language::GetLanguageTypeFromString(option_arg);
@@ -255,7 +439,7 @@ public:
m_func_names.push_back(option_arg);
m_func_name_type_mask |= eFunctionNameTypeFull;
break;
-
+
case 'h': {
bool success;
m_catch_bp = Args::StringToBoolean(option_arg, true, &success);
@@ -269,12 +453,6 @@ public:
m_hardware = true;
break;
- case 'i':
- if (option_arg.getAsInteger(0, m_ignore_count))
- error.SetErrorStringWithFormat("invalid ignore count '%s'",
- option_arg.str().c_str());
- break;
-
case 'K': {
bool success;
bool value;
@@ -347,10 +525,6 @@ public:
m_offset_addr = tmp_offset_addr;
} break;
- case 'o':
- m_one_shot = true;
- break;
-
case 'O':
m_exception_extra_args.AppendArgument("-O");
m_exception_extra_args.AppendArgument(option_arg);
@@ -360,10 +534,6 @@ public:
m_source_text_regexp.assign(option_arg);
break;
- case 'q':
- m_queue_name.assign(option_arg);
- break;
-
case 'r':
m_func_regexp.assign(option_arg);
break;
@@ -377,16 +547,6 @@ public:
m_func_name_type_mask |= eFunctionNameTypeSelector;
break;
- case 't':
- if (option_arg.getAsInteger(0, m_thread_id))
- error.SetErrorStringWithFormat("invalid thread id string '%s'",
- option_arg.str().c_str());
- break;
-
- case 'T':
- m_thread_name.assign(option_arg);
- break;
-
case 'w': {
bool success;
m_throw_bp = Args::StringToBoolean(option_arg, true, &success);
@@ -396,12 +556,6 @@ public:
option_arg.str().c_str());
} break;
- case 'x':
- if (option_arg.getAsInteger(0, m_thread_index))
- error.SetErrorStringWithFormat("invalid thread index string '%s'",
- option_arg.str().c_str());
- break;
-
case 'X':
m_source_regex_func_names.insert(option_arg);
break;
@@ -416,7 +570,6 @@ public:
}
void OptionParsingStarting(ExecutionContext *execution_context) override {
- m_condition.clear();
m_filenames.Clear();
m_line_num = 0;
m_column = 0;
@@ -427,19 +580,12 @@ public:
m_modules.Clear();
m_load_addr = LLDB_INVALID_ADDRESS;
m_offset_addr = 0;
- m_ignore_count = 0;
- m_thread_id = LLDB_INVALID_THREAD_ID;
- m_thread_index = UINT32_MAX;
- m_thread_name.clear();
- m_queue_name.clear();
m_catch_bp = false;
m_throw_bp = true;
m_hardware = false;
m_exception_language = eLanguageTypeUnknown;
m_language = lldb::eLanguageTypeUnknown;
m_skip_prologue = eLazyBoolCalculate;
- m_one_shot = false;
- m_use_dummy = false;
m_breakpoint_names.clear();
m_all_files = false;
m_exception_extra_args.Clear();
@@ -465,19 +611,12 @@ public:
FileSpecList m_modules;
lldb::addr_t m_load_addr;
lldb::addr_t m_offset_addr;
- uint32_t m_ignore_count;
- lldb::tid_t m_thread_id;
- uint32_t m_thread_index;
- std::string m_thread_name;
- std::string m_queue_name;
bool m_catch_bp;
bool m_throw_bp;
bool m_hardware; // Request to use hardware breakpoints
lldb::LanguageType m_exception_language;
lldb::LanguageType m_language;
LazyBool m_skip_prologue;
- bool m_one_shot;
- bool m_use_dummy;
bool m_all_files;
Args m_exception_extra_args;
LazyBool m_move_to_nearest_code;
@@ -486,7 +625,7 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
- Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
+ Target *target = GetSelectedOrDummyTarget(m_dummy_options.m_use_dummy);
if (target == nullptr) {
result.AppendError("Invalid target. Must set target before setting "
@@ -521,7 +660,7 @@ protected:
else if (m_options.m_exception_language != eLanguageTypeUnknown)
break_type = eSetTypeException;
- Breakpoint *bp = nullptr;
+ BreakpointSP bp_sp = nullptr;
FileSpec module_spec;
const bool internal = false;
@@ -553,35 +692,32 @@ protected:
// Only check for inline functions if
LazyBool check_inlines = eLazyBoolCalculate;
- bp = target
- ->CreateBreakpoint(&(m_options.m_modules), file,
- m_options.m_line_num, m_options.m_offset_addr,
- check_inlines, m_options.m_skip_prologue,
- internal, m_options.m_hardware,
- m_options.m_move_to_nearest_code)
- .get();
+ bp_sp = target->CreateBreakpoint(&(m_options.m_modules),
+ file,
+ m_options.m_line_num,
+ m_options.m_offset_addr,
+ check_inlines,
+ m_options.m_skip_prologue,
+ internal,
+ m_options.m_hardware,
+ m_options.m_move_to_nearest_code);
} break;
case eSetTypeAddress: // Breakpoint by address
{
// If a shared library has been specified, make an lldb_private::Address
- // with the library, and
- // use that. That way the address breakpoint will track the load location
- // of the library.
+ // with the library, and use that. That way the address breakpoint
+ // will track the load location of the library.
size_t num_modules_specified = m_options.m_modules.GetSize();
if (num_modules_specified == 1) {
const FileSpec *file_spec =
m_options.m_modules.GetFileSpecPointerAtIndex(0);
- bp = target
- ->CreateAddressInModuleBreakpoint(m_options.m_load_addr,
- internal, file_spec,
- m_options.m_hardware)
- .get();
+ bp_sp = target->CreateAddressInModuleBreakpoint(m_options.m_load_addr,
+ internal, file_spec,
+ m_options.m_hardware);
} else if (num_modules_specified == 0) {
- bp = target
- ->CreateBreakpoint(m_options.m_load_addr, internal,
- m_options.m_hardware)
- .get();
+ bp_sp = target->CreateBreakpoint(m_options.m_load_addr, internal,
+ m_options.m_hardware);
} else {
result.AppendError("Only one shared library can be specified for "
"address breakpoints.");
@@ -597,13 +733,15 @@ protected:
if (name_type_mask == 0)
name_type_mask = eFunctionNameTypeAuto;
- bp = target
- ->CreateBreakpoint(
- &(m_options.m_modules), &(m_options.m_filenames),
- m_options.m_func_names, name_type_mask, m_options.m_language,
- m_options.m_offset_addr, m_options.m_skip_prologue, internal,
- m_options.m_hardware)
- .get();
+ bp_sp = target->CreateBreakpoint(&(m_options.m_modules),
+ &(m_options.m_filenames),
+ m_options.m_func_names,
+ name_type_mask,
+ m_options.m_language,
+ m_options.m_offset_addr,
+ m_options.m_skip_prologue,
+ internal,
+ m_options.m_hardware);
} break;
case eSetTypeFunctionRegexp: // Breakpoint by regular expression function
@@ -620,12 +758,13 @@ protected:
return false;
}
- bp = target
- ->CreateFuncRegexBreakpoint(
- &(m_options.m_modules), &(m_options.m_filenames), regexp,
- m_options.m_language, m_options.m_skip_prologue, internal,
- m_options.m_hardware)
- .get();
+ bp_sp = target->CreateFuncRegexBreakpoint(&(m_options.m_modules),
+ &(m_options.m_filenames),
+ regexp,
+ m_options.m_language,
+ m_options.m_skip_prologue,
+ internal,
+ m_options.m_hardware);
}
break;
case eSetTypeSourceRegexp: // Breakpoint by regexp on source text.
@@ -654,26 +793,30 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
- bp = target
- ->CreateSourceRegexBreakpoint(
- &(m_options.m_modules), &(m_options.m_filenames),
- m_options.m_source_regex_func_names, regexp, internal,
- m_options.m_hardware, m_options.m_move_to_nearest_code)
- .get();
+ bp_sp =
+ target->CreateSourceRegexBreakpoint(&(m_options.m_modules),
+ &(m_options.m_filenames),
+ m_options
+ .m_source_regex_func_names,
+ regexp,
+ internal,
+ m_options.m_hardware,
+ m_options.m_move_to_nearest_code);
} break;
case eSetTypeException: {
Status precond_error;
- bp = target
- ->CreateExceptionBreakpoint(
- m_options.m_exception_language, m_options.m_catch_bp,
- m_options.m_throw_bp, internal,
- &m_options.m_exception_extra_args, &precond_error)
- .get();
+ bp_sp = target->CreateExceptionBreakpoint(m_options.m_exception_language,
+ m_options.m_catch_bp,
+ m_options.m_throw_bp,
+ internal,
+ &m_options
+ .m_exception_extra_args,
+ &precond_error);
if (precond_error.Fail()) {
result.AppendErrorWithFormat(
"Error setting extra exception arguments: %s",
precond_error.AsCString());
- target->RemoveBreakpointByID(bp->GetID());
+ target->RemoveBreakpointByID(bp_sp->GetID());
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -683,64 +826,43 @@ protected:
}
// Now set the various options that were passed in:
- if (bp) {
- if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
- bp->SetThreadID(m_options.m_thread_id);
-
- if (m_options.m_thread_index != UINT32_MAX)
- bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
-
- if (!m_options.m_thread_name.empty())
- bp->GetOptions()->GetThreadSpec()->SetName(
- m_options.m_thread_name.c_str());
-
- if (!m_options.m_queue_name.empty())
- bp->GetOptions()->GetThreadSpec()->SetQueueName(
- m_options.m_queue_name.c_str());
-
- if (m_options.m_ignore_count != 0)
- bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
-
- if (!m_options.m_condition.empty())
- bp->GetOptions()->SetCondition(m_options.m_condition.c_str());
+ if (bp_sp) {
+ bp_sp->GetOptions()->CopyOverSetOptions(m_bp_opts.GetBreakpointOptions());
if (!m_options.m_breakpoint_names.empty()) {
Status name_error;
for (auto name : m_options.m_breakpoint_names) {
- bp->AddName(name.c_str(), name_error);
+ target->AddNameToBreakpoint(bp_sp, name.c_str(), name_error);
if (name_error.Fail()) {
result.AppendErrorWithFormat("Invalid breakpoint name: %s",
name.c_str());
- target->RemoveBreakpointByID(bp->GetID());
+ target->RemoveBreakpointByID(bp_sp->GetID());
result.SetStatus(eReturnStatusFailed);
return false;
}
}
}
-
- bp->SetOneShot(m_options.m_one_shot);
}
-
- if (bp) {
+
+ if (bp_sp) {
Stream &output_stream = result.GetOutputStream();
const bool show_locations = false;
- bp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial,
+ bp_sp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial,
show_locations);
if (target == m_interpreter.GetDebugger().GetDummyTarget())
output_stream.Printf("Breakpoint set in dummy target, will get copied "
"into future targets.\n");
else {
// Don't print out this warning for exception breakpoints. They can get
- // set before the target
- // is set, but we won't know how to actually set the breakpoint till we
- // run.
- if (bp->GetNumLocations() == 0 && break_type != eSetTypeException) {
+ // set before the target is set, but we won't know how to actually set
+ // the breakpoint till we run.
+ if (bp_sp->GetNumLocations() == 0 && break_type != eSetTypeException) {
output_stream.Printf("WARNING: Unable to resolve breakpoint to any "
"actual locations.\n");
}
}
result.SetStatus(eReturnStatusSuccessFinishResult);
- } else if (!bp) {
+ } else if (!bp_sp) {
result.AppendError("Breakpoint creation failed: No breakpoint created.");
result.SetStatus(eReturnStatusFailed);
}
@@ -782,29 +904,15 @@ private:
return true;
}
+ BreakpointOptionGroup m_bp_opts;
+ BreakpointDummyOptionGroup m_dummy_options;
CommandOptions m_options;
+ OptionGroupOptions m_all_options;
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointModify
//-------------------------------------------------------------------------
-
-#pragma mark Modify::CommandOptions
-static OptionDefinition g_breakpoint_modify_options[] = {
- // clang-format off
- { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
- { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
- { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument." },
- { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
- { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument." },
- { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by this argument." },
- { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
- { LLDB_OPT_SET_1, false, "enable", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable the breakpoint." },
- { LLDB_OPT_SET_2, false, "disable", 'd', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disable the breakpoint." },
- { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
- // clang-format on
-};
-
#pragma mark Modify
class CommandObjectBreakpointModify : public CommandObjectParsed {
@@ -825,148 +933,21 @@ public:
// Add the entry for the first argument for this command to the object's
// arguments vector.
m_arguments.push_back(arg);
+
+ m_options.Append(&m_bp_opts,
+ LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3,
+ LLDB_OPT_SET_ALL);
+ m_options.Append(&m_dummy_opts, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
+ m_options.Finalize();
}
~CommandObjectBreakpointModify() override = default;
Options *GetOptions() override { return &m_options; }
- class CommandOptions : public Options {
- public:
- CommandOptions()
- : Options(), m_ignore_count(0), m_thread_id(LLDB_INVALID_THREAD_ID),
- m_thread_id_passed(false), m_thread_index(UINT32_MAX),
- m_thread_index_passed(false), m_thread_name(), m_queue_name(),
- m_condition(), m_one_shot(false), m_enable_passed(false),
- m_enable_value(false), m_name_passed(false), m_queue_passed(false),
- m_condition_passed(false), m_one_shot_passed(false),
- m_use_dummy(false) {}
-
- ~CommandOptions() override = default;
-
- Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
- ExecutionContext *execution_context) override {
- Status error;
- const int short_option = m_getopt_table[option_idx].val;
-
- switch (short_option) {
- case 'c':
- m_condition = option_arg;
- m_condition_passed = true;
- break;
- case 'd':
- m_enable_passed = true;
- m_enable_value = false;
- break;
- case 'D':
- m_use_dummy = true;
- break;
- case 'e':
- m_enable_passed = true;
- m_enable_value = true;
- break;
- case 'i':
- if (option_arg.getAsInteger(0, m_ignore_count))
- error.SetErrorStringWithFormat("invalid ignore count '%s'",
- option_arg.str().c_str());
- break;
- case 'o': {
- bool value, success;
- value = Args::StringToBoolean(option_arg, false, &success);
- if (success) {
- m_one_shot_passed = true;
- m_one_shot = value;
- } else
- error.SetErrorStringWithFormat(
- "invalid boolean value '%s' passed for -o option",
- option_arg.str().c_str());
- } break;
- case 't':
- if (option_arg[0] == '\0') {
- m_thread_id = LLDB_INVALID_THREAD_ID;
- m_thread_id_passed = true;
- } else {
- if (option_arg.getAsInteger(0, m_thread_id))
- error.SetErrorStringWithFormat("invalid thread id string '%s'",
- option_arg.str().c_str());
- else
- m_thread_id_passed = true;
- }
- break;
- case 'T':
- m_thread_name = option_arg;
- m_name_passed = true;
- break;
- case 'q':
- m_queue_name = option_arg;
- m_queue_passed = true;
- break;
- case 'x':
- if (option_arg[0] == '\n') {
- m_thread_index = UINT32_MAX;
- m_thread_index_passed = true;
- } else {
- if (option_arg.getAsInteger(0, m_thread_index))
- error.SetErrorStringWithFormat("invalid thread index string '%s'",
- option_arg.str().c_str());
- else
- m_thread_index_passed = true;
- }
- break;
- default:
- error.SetErrorStringWithFormat("unrecognized option '%c'",
- short_option);
- break;
- }
-
- return error;
- }
-
- void OptionParsingStarting(ExecutionContext *execution_context) override {
- m_ignore_count = 0;
- m_thread_id = LLDB_INVALID_THREAD_ID;
- m_thread_id_passed = false;
- m_thread_index = UINT32_MAX;
- m_thread_index_passed = false;
- m_thread_name.clear();
- m_queue_name.clear();
- m_condition.clear();
- m_one_shot = false;
- m_enable_passed = false;
- m_queue_passed = false;
- m_name_passed = false;
- m_condition_passed = false;
- m_one_shot_passed = false;
- m_use_dummy = false;
- }
-
- llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
- return llvm::makeArrayRef(g_breakpoint_modify_options);
- }
-
- // Instance variables to hold the values for command options.
-
- uint32_t m_ignore_count;
- lldb::tid_t m_thread_id;
- bool m_thread_id_passed;
- uint32_t m_thread_index;
- bool m_thread_index_passed;
- std::string m_thread_name;
- std::string m_queue_name;
- std::string m_condition;
- bool m_one_shot;
- bool m_enable_passed;
- bool m_enable_value;
- bool m_name_passed;
- bool m_queue_passed;
- bool m_condition_passed;
- bool m_one_shot_passed;
- bool m_use_dummy;
- };
-
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
- Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
+ Target *target = GetSelectedOrDummyTarget(m_dummy_opts.m_use_dummy);
if (target == nullptr) {
result.AppendError("Invalid target. No existing target or breakpoints.");
result.SetStatus(eReturnStatusFailed);
@@ -979,7 +960,8 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::disablePerm);
if (result.Succeeded()) {
const size_t count = valid_bp_ids.GetSize();
@@ -992,49 +974,12 @@ protected:
if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
BreakpointLocation *location =
bp->FindLocationByID(cur_bp_id.GetLocationID()).get();
- if (location) {
- if (m_options.m_thread_id_passed)
- location->SetThreadID(m_options.m_thread_id);
-
- if (m_options.m_thread_index_passed)
- location->SetThreadIndex(m_options.m_thread_index);
-
- if (m_options.m_name_passed)
- location->SetThreadName(m_options.m_thread_name.c_str());
-
- if (m_options.m_queue_passed)
- location->SetQueueName(m_options.m_queue_name.c_str());
-
- if (m_options.m_ignore_count != 0)
- location->SetIgnoreCount(m_options.m_ignore_count);
-
- if (m_options.m_enable_passed)
- location->SetEnabled(m_options.m_enable_value);
-
- if (m_options.m_condition_passed)
- location->SetCondition(m_options.m_condition.c_str());
- }
+ if (location)
+ location->GetLocationOptions()
+ ->CopyOverSetOptions(m_bp_opts.GetBreakpointOptions());
} else {
- if (m_options.m_thread_id_passed)
- bp->SetThreadID(m_options.m_thread_id);
-
- if (m_options.m_thread_index_passed)
- bp->SetThreadIndex(m_options.m_thread_index);
-
- if (m_options.m_name_passed)
- bp->SetThreadName(m_options.m_thread_name.c_str());
-
- if (m_options.m_queue_passed)
- bp->SetQueueName(m_options.m_queue_name.c_str());
-
- if (m_options.m_ignore_count != 0)
- bp->SetIgnoreCount(m_options.m_ignore_count);
-
- if (m_options.m_enable_passed)
- bp->SetEnabled(m_options.m_enable_value);
-
- if (m_options.m_condition_passed)
- bp->SetCondition(m_options.m_condition.c_str());
+ bp->GetOptions()
+ ->CopyOverSetOptions(m_bp_opts.GetBreakpointOptions());
}
}
}
@@ -1044,7 +989,9 @@ protected:
}
private:
- CommandOptions m_options;
+ BreakpointOptionGroup m_bp_opts;
+ BreakpointDummyOptionGroup m_dummy_opts;
+ OptionGroupOptions m_options;
};
//-------------------------------------------------------------------------
@@ -1093,7 +1040,7 @@ protected:
if (command.empty()) {
// No breakpoint selected; enable all currently set breakpoints.
- target->EnableAllBreakpoints();
+ target->EnableAllowedBreakpoints();
result.AppendMessageWithFormat("All breakpoints enabled. (%" PRIu64
" breakpoints)\n",
(uint64_t)num_breakpoints);
@@ -1102,7 +1049,8 @@ protected:
// Particular breakpoint selected; enable that breakpoint.
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::disablePerm);
if (result.Succeeded()) {
int enable_count = 0;
@@ -1206,7 +1154,7 @@ protected:
if (command.empty()) {
// No breakpoint selected; disable all currently set breakpoints.
- target->DisableAllBreakpoints();
+ target->DisableAllowedBreakpoints();
result.AppendMessageWithFormat("All breakpoints disabled. (%" PRIu64
" breakpoints)\n",
(uint64_t)num_breakpoints);
@@ -1216,7 +1164,8 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::disablePerm);
if (result.Succeeded()) {
int disable_count = 0;
@@ -1383,14 +1332,17 @@ protected:
result.AppendMessage("Current breakpoints:");
for (size_t i = 0; i < num_breakpoints; ++i) {
Breakpoint *breakpoint = breakpoints.GetBreakpointAtIndex(i).get();
- AddBreakpointDescription(&output_stream, breakpoint, m_options.m_level);
+ if (breakpoint->AllowList())
+ AddBreakpointDescription(&output_stream, breakpoint,
+ m_options.m_level);
}
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
// Particular breakpoints selected; show info about that breakpoint.
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {
for (size_t i = 0; i < valid_bp_ids.GetSize(); ++i) {
@@ -1678,7 +1630,7 @@ protected:
true)) {
result.AppendMessage("Operation cancelled...");
} else {
- target->RemoveAllBreakpoints();
+ target->RemoveAllowedBreakpoints();
result.AppendMessageWithFormat(
"All breakpoints removed. (%" PRIu64 " breakpoint%s)\n",
(uint64_t)num_breakpoints, num_breakpoints > 1 ? "s" : "");
@@ -1688,7 +1640,8 @@ protected:
// Particular breakpoint selected; disable that breakpoint.
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::deletePerm);
if (result.Succeeded()) {
int delete_count = 0;
@@ -1734,9 +1687,10 @@ private:
static OptionDefinition g_breakpoint_name_options[] = {
// clang-format off
- {LLDB_OPT_SET_1, false, "name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Specifies a breakpoint name to use."},
- {LLDB_OPT_SET_2, false, "breakpoint-id", 'B', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointID, "Specify a breakpoint ID to use."},
- {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Operate on Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
+ {LLDB_OPT_SET_1, false, "name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Specifies a breakpoint name to use."},
+ {LLDB_OPT_SET_2, false, "breakpoint-id", 'B', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointID, "Specify a breakpoint ID to use."},
+ {LLDB_OPT_SET_3, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Operate on Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
+ {LLDB_OPT_SET_4, false, "help-string", 'H', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "A help string describing the purpose of this name."},
// clang-format on
};
class BreakpointNameOptionGroup : public OptionGroup {
@@ -1762,7 +1716,6 @@ public:
error.Success())
m_name.SetValueFromString(option_arg);
break;
-
case 'B':
if (m_breakpoint.SetValueFromString(option_arg).Fail())
error.SetErrorStringWithFormat(
@@ -1775,6 +1728,9 @@ public:
"unrecognized value \"%s\" for use-dummy",
option_arg.str().c_str());
break;
+ case 'H':
+ m_help_string.SetValueFromString(option_arg);
+ break;
default:
error.SetErrorStringWithFormat("unrecognized short option '%c'",
@@ -1789,11 +1745,200 @@ public:
m_breakpoint.Clear();
m_use_dummy.Clear();
m_use_dummy.SetDefaultValue(false);
+ m_help_string.Clear();
}
OptionValueString m_name;
OptionValueUInt64 m_breakpoint;
OptionValueBoolean m_use_dummy;
+ OptionValueString m_help_string;
+};
+
+static OptionDefinition g_breakpoint_access_options[] = {
+ // clang-format off
+ {LLDB_OPT_SET_1, false, "allow-list", 'L', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Determines whether the breakpoint will show up in break list if not referred to explicitly."},
+ {LLDB_OPT_SET_2, false, "allow-disable", 'A', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Determines whether the breakpoint can be disabled by name or when all breakpoints are disabled."},
+ {LLDB_OPT_SET_3, false, "allow-delete", 'D', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Determines whether the breakpoint can be deleted by name or when all breakpoints are deleted."},
+ // clang-format on
+};
+
+class BreakpointAccessOptionGroup : public OptionGroup
+{
+public:
+ BreakpointAccessOptionGroup() :
+ OptionGroup()
+ {}
+
+ ~BreakpointAccessOptionGroup() override = default;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::makeArrayRef(g_breakpoint_access_options);
+ }
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override {
+ Status error;
+ const int short_option
+ = g_breakpoint_access_options[option_idx].short_option;
+
+ switch (short_option) {
+ case 'L': {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success) {
+ m_permissions.SetAllowList(value);
+ } else
+ error.SetErrorStringWithFormat(
+ "invalid boolean value '%s' passed for -L option",
+ option_arg.str().c_str());
+ } break;
+ case 'A': {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success) {
+ m_permissions.SetAllowDisable(value);
+ } else
+ error.SetErrorStringWithFormat(
+ "invalid boolean value '%s' passed for -L option",
+ option_arg.str().c_str());
+ } break;
+ case 'D': {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success) {
+ m_permissions.SetAllowDelete(value);
+ } else
+ error.SetErrorStringWithFormat(
+ "invalid boolean value '%s' passed for -L option",
+ option_arg.str().c_str());
+ } break;
+
+ }
+
+ return error;
+ }
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override {
+ }
+
+ const BreakpointName::Permissions &GetPermissions() const
+ {
+ return m_permissions;
+ }
+ BreakpointName::Permissions m_permissions;
+};
+
+class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
+public:
+ CommandObjectBreakpointNameConfigure(CommandInterpreter &interpreter)
+ : CommandObjectParsed(
+ interpreter, "configure", "Configure the options for the breakpoint"
+ " name provided. "
+ "If you provide a breakpoint id, the options will be copied from "
+ "the breakpoint, otherwise only the options specified will be set "
+ "on the name.",
+ "breakpoint name configure <command-options> "
+ "<breakpoint-name-list>"),
+ m_bp_opts(), m_option_group() {
+ // Create the first variant for the first (and only) argument for this
+ // command.
+ CommandArgumentEntry arg1;
+ CommandArgumentData id_arg;
+ id_arg.arg_type = eArgTypeBreakpointName;
+ id_arg.arg_repetition = eArgRepeatOptional;
+ arg1.push_back(id_arg);
+ m_arguments.push_back(arg1);
+
+ m_option_group.Append(&m_bp_opts,
+ LLDB_OPT_SET_ALL,
+ LLDB_OPT_SET_1);
+ m_option_group.Append(&m_access_options,
+ LLDB_OPT_SET_ALL,
+ LLDB_OPT_SET_ALL);
+ m_option_group.Append(&m_bp_id,
+ LLDB_OPT_SET_2|LLDB_OPT_SET_4,
+ LLDB_OPT_SET_ALL);
+ m_option_group.Finalize();
+ }
+
+ ~CommandObjectBreakpointNameConfigure() override = default;
+
+ Options *GetOptions() override { return &m_option_group; }
+
+protected:
+ bool DoExecute(Args &command, CommandReturnObject &result) override {
+
+ const size_t argc = command.GetArgumentCount();
+ if (argc == 0) {
+ result.AppendError("No names provided.");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ Target *target =
+ GetSelectedOrDummyTarget(false);
+
+ if (target == nullptr) {
+ result.AppendError("Invalid target. No existing target or breakpoints.");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetBreakpointList().GetListMutex(lock);
+
+ // Make a pass through first to see that all the names are legal.
+ for (auto &entry : command.entries()) {
+ Status error;
+ if (!BreakpointID::StringIsBreakpointName(entry.ref, error))
+ {
+ result.AppendErrorWithFormat("Invalid breakpoint name: %s - %s",
+ entry.c_str(), error.AsCString());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+ }
+ // Now configure them, we already pre-checked the names so we don't need
+ // to check the error:
+ BreakpointSP bp_sp;
+ if (m_bp_id.m_breakpoint.OptionWasSet())
+ {
+ lldb::break_id_t bp_id = m_bp_id.m_breakpoint.GetUInt64Value();
+ bp_sp = target->GetBreakpointByID(bp_id);
+ if (!bp_sp)
+ {
+ result.AppendErrorWithFormatv("Could not find specified breakpoint {0}",
+ bp_id);
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+ }
+
+ Status error;
+ for (auto &entry : command.entries()) {
+ ConstString name(entry.c_str());
+ BreakpointName *bp_name = target->FindBreakpointName(name, true, error);
+ if (!bp_name)
+ continue;
+ if (m_bp_id.m_help_string.OptionWasSet())
+ bp_name->SetHelp(m_bp_id.m_help_string.GetStringValue().str().c_str());
+
+ if (bp_sp)
+ target->ConfigureBreakpointName(*bp_name,
+ *bp_sp->GetOptions(),
+ m_access_options.GetPermissions());
+ else
+ target->ConfigureBreakpointName(*bp_name,
+ m_bp_opts.GetBreakpointOptions(),
+ m_access_options.GetPermissions());
+ }
+ return true;
+ }
+
+private:
+ BreakpointNameOptionGroup m_bp_id; // Only using the id part of this.
+ BreakpointOptionGroup m_bp_opts;
+ BreakpointAccessOptionGroup m_access_options;
+ OptionGroupOptions m_option_group;
};
class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
@@ -1851,7 +1996,8 @@ protected:
// Particular breakpoint selected; disable that breakpoint.
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {
if (valid_bp_ids.GetSize() == 0) {
@@ -1860,13 +2006,14 @@ protected:
return false;
}
size_t num_valid_ids = valid_bp_ids.GetSize();
+ const char *bp_name = m_name_options.m_name.GetCurrentValue();
+ Status error; // This error reports illegal names, but we've already
+ // checked that, so we don't need to check it again here.
for (size_t index = 0; index < num_valid_ids; index++) {
lldb::break_id_t bp_id =
valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
- Status error; // We don't need to check the error here, since the option
- // parser checked it...
- bp_sp->AddName(m_name_options.m_name.GetCurrentValue(), error);
+ target->AddNameToBreakpoint(bp_sp, bp_name, error);
}
}
@@ -1934,7 +2081,8 @@ protected:
// Particular breakpoint selected; disable that breakpoint.
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::deletePerm);
if (result.Succeeded()) {
if (valid_bp_ids.GetSize() == 0) {
@@ -1942,12 +2090,13 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
+ ConstString bp_name(m_name_options.m_name.GetCurrentValue());
size_t num_valid_ids = valid_bp_ids.GetSize();
for (size_t index = 0; index < num_valid_ids; index++) {
lldb::break_id_t bp_id =
valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
- bp_sp->RemoveName(m_name_options.m_name.GetCurrentValue());
+ target->RemoveNameFromBreakpoint(bp_sp, bp_name);
}
}
@@ -1963,11 +2112,12 @@ class CommandObjectBreakpointNameList : public CommandObjectParsed {
public:
CommandObjectBreakpointNameList(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "list",
- "List either the names for a breakpoint or the "
- "breakpoints for a given name.",
+ "List either the names for a breakpoint or info "
+ "about a given name. With no arguments, lists all "
+ "names",
"breakpoint name list <command-options>"),
m_name_options(), m_option_group() {
- m_option_group.Append(&m_name_options);
+ m_option_group.Append(&m_name_options, LLDB_OPT_SET_3, LLDB_OPT_SET_ALL);
m_option_group.Finalize();
}
@@ -1985,42 +2135,57 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
-
- if (m_name_options.m_name.OptionWasSet()) {
- const char *name = m_name_options.m_name.GetCurrentValue();
- std::unique_lock<std::recursive_mutex> lock;
- target->GetBreakpointList().GetListMutex(lock);
-
- BreakpointList &breakpoints = target->GetBreakpointList();
- for (BreakpointSP bp_sp : breakpoints.Breakpoints()) {
- if (bp_sp->MatchesName(name)) {
+
+
+ std::vector<std::string> name_list;
+ if (command.empty()) {
+ target->GetBreakpointNames(name_list);
+ } else {
+ for (const Args::ArgEntry &arg : command)
+ {
+ name_list.push_back(arg.c_str());
+ }
+ }
+
+ if (name_list.empty()) {
+ result.AppendMessage("No breakpoint names found.");
+ } else {
+ for (const std::string &name_str : name_list) {
+ const char *name = name_str.c_str();
+ // First print out the options for the name:
+ Status error;
+ BreakpointName *bp_name = target->FindBreakpointName(ConstString(name),
+ false,
+ error);
+ if (bp_name)
+ {
StreamString s;
- bp_sp->GetDescription(&s, eDescriptionLevelBrief);
- s.EOL();
- result.AppendMessage(s.GetString());
+ result.AppendMessageWithFormat("Name: %s\n", name);
+ if (bp_name->GetDescription(&s, eDescriptionLevelFull))
+ {
+ result.AppendMessage(s.GetString());
+ }
+
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetBreakpointList().GetListMutex(lock);
+
+ BreakpointList &breakpoints = target->GetBreakpointList();
+ bool any_set = false;
+ for (BreakpointSP bp_sp : breakpoints.Breakpoints()) {
+ if (bp_sp->MatchesName(name)) {
+ StreamString s;
+ any_set = true;
+ bp_sp->GetDescription(&s, eDescriptionLevelBrief);
+ s.EOL();
+ result.AppendMessage(s.GetString());
+ }
+ }
+ if (!any_set)
+ result.AppendMessage("No breakpoints using this name.");
+ } else {
+ result.AppendMessageWithFormat("Name: %s not found.\n", name);
}
}
-
- } else if (m_name_options.m_breakpoint.OptionWasSet()) {
- BreakpointSP bp_sp = target->GetBreakpointList().FindBreakpointByID(
- m_name_options.m_breakpoint.GetCurrentValue());
- if (bp_sp) {
- std::vector<std::string> names;
- bp_sp->GetNames(names);
- result.AppendMessage("Names:");
- for (auto name : names)
- result.AppendMessageWithFormat(" %s\n", name.c_str());
- } else {
- result.AppendErrorWithFormat(
- "Could not find breakpoint %" PRId64 ".\n",
- m_name_options.m_breakpoint.GetCurrentValue());
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
- } else {
- result.SetError("Must specify -N or -B option to list.");
- result.SetStatus(eReturnStatusFailed);
- return false;
}
return true;
}
@@ -2045,10 +2210,13 @@ public:
new CommandObjectBreakpointNameDelete(interpreter));
CommandObjectSP list_command_object(
new CommandObjectBreakpointNameList(interpreter));
+ CommandObjectSP configure_command_object(
+ new CommandObjectBreakpointNameConfigure(interpreter));
LoadSubCommand("add", add_command_object);
LoadSubCommand("delete", delete_command_object);
LoadSubCommand("list", list_command_object);
+ LoadSubCommand("configure", configure_command_object);
}
~CommandObjectBreakpointName() override = default;
@@ -2274,7 +2442,8 @@ protected:
BreakpointIDList valid_bp_ids;
if (!command.empty()) {
CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
if (!result.Succeeded()) {
result.SetStatus(eReturnStatusFailed);
@@ -2359,7 +2528,10 @@ CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint() = default;
void CommandObjectMultiwordBreakpoint::VerifyIDs(Args &args, Target *target,
bool allow_locations,
CommandReturnObject &result,
- BreakpointIDList *valid_ids) {
+ BreakpointIDList *valid_ids,
+ BreakpointName::Permissions
+ ::PermissionKinds
+ purpose) {
// args can be strings representing 1). integers (for breakpoint ids)
// 2). the full breakpoint & location
// canonical representation
@@ -2393,8 +2565,8 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(Args &args, Target *target,
// all the breakpoint ids in the range, and shove all of those breakpoint id
// strings into TEMP_ARGS.
- BreakpointIDList::FindAndReplaceIDRanges(args, target, allow_locations,
- result, temp_args);
+ BreakpointIDList::FindAndReplaceIDRanges(args, target, allow_locations,
+ purpose, result, temp_args);
// NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual
// BreakpointIDList:
diff --git a/source/Commands/CommandObjectBreakpoint.h b/source/Commands/CommandObjectBreakpoint.h
index 6e14b8f876a0..5e1026a6b7ea 100644
--- a/source/Commands/CommandObjectBreakpoint.h
+++ b/source/Commands/CommandObjectBreakpoint.h
@@ -18,11 +18,14 @@
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Breakpoint/BreakpointName.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/STLUtils.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/Options.h"
+
namespace lldb_private {
//-------------------------------------------------------------------------
@@ -37,20 +40,26 @@ public:
static void VerifyBreakpointOrLocationIDs(Args &args, Target *target,
CommandReturnObject &result,
- BreakpointIDList *valid_ids) {
- VerifyIDs(args, target, true, result, valid_ids);
+ BreakpointIDList *valid_ids,
+ BreakpointName::Permissions
+ ::PermissionKinds purpose) {
+ VerifyIDs(args, target, true, result, valid_ids, purpose);
}
static void VerifyBreakpointIDs(Args &args, Target *target,
CommandReturnObject &result,
- BreakpointIDList *valid_ids) {
- VerifyIDs(args, target, false, result, valid_ids);
+ BreakpointIDList *valid_ids,
+ BreakpointName::Permissions::PermissionKinds
+ purpose) {
+ VerifyIDs(args, target, false, result, valid_ids, purpose);
}
private:
static void VerifyIDs(Args &args, Target *target, bool allow_locations,
CommandReturnObject &result,
- BreakpointIDList *valid_ids);
+ BreakpointIDList *valid_ids,
+ BreakpointName::Permissions::PermissionKinds
+ purpose);
};
} // namespace lldb_private
diff --git a/source/Commands/CommandObjectBreakpointCommand.cpp b/source/Commands/CommandObjectBreakpointCommand.cpp
index de4911953107..170cb8513116 100644
--- a/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -390,7 +390,8 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
m_bp_options_vec.clear();
@@ -571,7 +572,8 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {
const size_t count = valid_bp_ids.GetSize();
@@ -662,7 +664,8 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
- command, target, result, &valid_bp_ids);
+ command, target, result, &valid_bp_ids,
+ BreakpointName::Permissions::PermissionKinds::listPerm);
if (result.Succeeded()) {
const size_t count = valid_bp_ids.GetSize();
@@ -673,48 +676,49 @@ protected:
target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
if (bp) {
- const BreakpointOptions *bp_options = nullptr;
+ BreakpointLocationSP bp_loc_sp;
if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
- BreakpointLocationSP bp_loc_sp(
- bp->FindLocationByID(cur_bp_id.GetLocationID()));
- if (bp_loc_sp)
- bp_options = bp_loc_sp->GetOptionsNoCreate();
- else {
+ bp_loc_sp = bp->FindLocationByID(cur_bp_id.GetLocationID());
+ if (!bp_loc_sp)
+ {
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
cur_bp_id.GetBreakpointID(),
cur_bp_id.GetLocationID());
result.SetStatus(eReturnStatusFailed);
return false;
}
- } else {
- bp_options = bp->GetOptions();
}
- if (bp_options) {
- StreamString id_str;
- BreakpointID::GetCanonicalReference(&id_str,
- cur_bp_id.GetBreakpointID(),
- cur_bp_id.GetLocationID());
- const Baton *baton = bp_options->GetBaton();
- if (baton) {
- result.GetOutputStream().Printf("Breakpoint %s:\n",
- id_str.GetData());
- result.GetOutputStream().IndentMore();
- baton->GetDescription(&result.GetOutputStream(),
- eDescriptionLevelFull);
- result.GetOutputStream().IndentLess();
- } else {
- result.AppendMessageWithFormat(
- "Breakpoint %s does not have an associated command.\n",
- id_str.GetData());
- }
+ StreamString id_str;
+ BreakpointID::GetCanonicalReference(&id_str,
+ cur_bp_id.GetBreakpointID(),
+ cur_bp_id.GetLocationID());
+ const Baton *baton = nullptr;
+ if (bp_loc_sp)
+ baton = bp_loc_sp
+ ->GetOptionsSpecifyingKind(BreakpointOptions::eCallback)
+ ->GetBaton();
+ else
+ baton = bp->GetOptions()->GetBaton();
+
+ if (baton) {
+ result.GetOutputStream().Printf("Breakpoint %s:\n",
+ id_str.GetData());
+ result.GetOutputStream().IndentMore();
+ baton->GetDescription(&result.GetOutputStream(),
+ eDescriptionLevelFull);
+ result.GetOutputStream().IndentLess();
+ } else {
+ result.AppendMessageWithFormat(
+ "Breakpoint %s does not have an associated command.\n",
+ id_str.GetData());
}
- result.SetStatus(eReturnStatusSuccessFinishResult);
- } else {
- result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
- cur_bp_id.GetBreakpointID());
- result.SetStatus(eReturnStatusFailed);
}
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ } else {
+ result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
+ cur_bp_id.GetBreakpointID());
+ result.SetStatus(eReturnStatusFailed);
}
}
}
diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp
index 5d0f2417f992..31c54b7d433b 100644
--- a/source/Commands/CommandObjectDisassemble.cpp
+++ b/source/Commands/CommandObjectDisassemble.cpp
@@ -163,8 +163,7 @@ Status CommandObjectDisassemble::CommandOptions::SetOptionValue(
auto target_sp =
execution_context ? execution_context->GetTargetSP() : TargetSP();
auto platform_sp = target_sp ? target_sp->GetPlatform() : PlatformSP();
- if (!arch.SetTriple(option_arg, platform_sp.get()))
- arch.SetTriple(option_arg);
+ arch = Platform::GetAugmentedArchSpec(platform_sp.get(), option_arg);
}
break;
diff --git a/source/Commands/CommandObjectDisassemble.h b/source/Commands/CommandObjectDisassemble.h
index 8ca390056dd8..af15d45eb76b 100644
--- a/source/Commands/CommandObjectDisassemble.h
+++ b/source/Commands/CommandObjectDisassemble.h
@@ -10,13 +10,9 @@
#ifndef liblldb_CommandObjectDisassemble_h_
#define liblldb_CommandObjectDisassemble_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
namespace lldb_private {
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index b6e0016c88e4..01ca31111555 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -228,6 +228,16 @@ CommandObjectExpression::CommandObjectExpression(
m_command_options(), m_expr_line_count(0), m_expr_lines() {
SetHelpLong(
R"(
+Single and multi-line expressions:
+
+)"
+ " The expression provided on the command line must be a complete expression \
+with no newlines. To evaluate a multi-line expression, \
+hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
+Hit return on an empty line to end the multi-line expression."
+
+ R"(
+
Timeouts:
)"
@@ -256,6 +266,7 @@ from the stack with \"thread return -x\" or if you are still interested in the e
you can issue the \"continue\" command and the expression evaluation will complete and the \
expression result will be available using the \"thread.completed-expression\" key in the thread \
format."
+
R"(
Examples:
diff --git a/source/Commands/CommandObjectFrame.h b/source/Commands/CommandObjectFrame.h
index 875bcc944a38..3199399163df 100644
--- a/source/Commands/CommandObjectFrame.h
+++ b/source/Commands/CommandObjectFrame.h
@@ -10,11 +10,6 @@
#ifndef liblldb_CommandObjectFrame_h_
#define liblldb_CommandObjectFrame_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/Options.h"
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index 5fa851f584a7..8ed003767d58 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -302,7 +302,7 @@ protected:
platform_sp->GetStatus(ostrm);
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
- result.AppendError("no platform us currently selected\n");
+ result.AppendError("no platform is currently selected\n");
result.SetStatus(eReturnStatusFailed);
}
return result.Succeeded();
@@ -1337,8 +1337,8 @@ protected:
PlatformSP platform_sp =
debugger_sp ? debugger_sp->GetPlatformList().GetSelectedPlatform()
: PlatformSP();
- match_info.GetProcessInfo().GetArchitecture().SetTriple(
- option_arg, platform_sp.get());
+ match_info.GetProcessInfo().GetArchitecture() =
+ Platform::GetAugmentedArchSpec(platform_sp.get(), option_arg);
} break;
case 'n':
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index f3c92b9a28c0..066cc59c5c31 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -902,7 +902,7 @@ protected:
// We don't care about the column here.
const uint32_t column = 0;
return target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
- start_file, line_no, 0, m_options.num_lines, column, "",
+ start_file, line_no, column, 0, m_options.num_lines, "",
&result.GetOutputStream(), GetBreakpointLocations());
} else {
result.AppendErrorWithFormat(
@@ -1161,7 +1161,7 @@ protected:
? sc.line_entry.column
: 0;
target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
- sc.comp_unit, sc.line_entry.line, lines_to_back_up, column,
+ sc.comp_unit, sc.line_entry.line, column, lines_to_back_up,
m_options.num_lines - lines_to_back_up, "->",
&result.GetOutputStream(), GetBreakpointLocations());
result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1283,8 +1283,9 @@ protected:
m_options.num_lines = 10;
const uint32_t column = 0;
target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
- sc.comp_unit, m_options.start_line, 0, m_options.num_lines,
- column, "", &result.GetOutputStream(), GetBreakpointLocations());
+ sc.comp_unit, m_options.start_line, column,
+ 0, m_options.num_lines,
+ "", &result.GetOutputStream(), GetBreakpointLocations());
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index a80acf19be2d..c83061d8de74 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -52,6 +52,7 @@
#include "lldb/Utility/Timer.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatAdapters.h"
// C Includes
// C++ Includes
@@ -135,25 +136,6 @@ static uint32_t DumpTargetList(TargetList &target_list,
return num_targets;
}
-// TODO: Remove this once llvm can pretty-print time points
-static void DumpTimePoint(llvm::sys::TimePoint<> tp, Stream &s, uint32_t width) {
-#ifndef LLDB_DISABLE_POSIX
- char time_buf[32];
- time_t time = llvm::sys::toTimeT(tp);
- char *time_cstr = ::ctime_r(&time, time_buf);
- if (time_cstr) {
- char *newline = ::strpbrk(time_cstr, "\n\r");
- if (newline)
- *newline = '\0';
- if (width > 0)
- s.Printf("%-*s", width, time_cstr);
- else
- s.PutCString(time_cstr);
- } else if (width > 0)
- s.Printf("%-*s", width, "");
-#endif
-}
-
#pragma mark CommandObjectTargetCreate
//-------------------------------------------------------------------------
@@ -2053,6 +2035,8 @@ protected:
result.GetOutputStream().EOL();
result.GetOutputStream().EOL();
}
+ if (m_interpreter.WasInterrupted())
+ break;
num_dumped++;
DumpModuleSymtab(
m_interpreter, result.GetOutputStream(),
@@ -2081,6 +2065,8 @@ protected:
result.GetOutputStream().EOL();
result.GetOutputStream().EOL();
}
+ if (m_interpreter.WasInterrupted())
+ break;
num_dumped++;
DumpModuleSymtab(m_interpreter, result.GetOutputStream(),
module, m_options.m_sort_order);
@@ -2146,6 +2132,8 @@ protected:
" modules.\n",
(uint64_t)num_modules);
for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) {
+ if (m_interpreter.WasInterrupted())
+ break;
num_dumped++;
DumpModuleSections(
m_interpreter, result.GetOutputStream(),
@@ -2167,6 +2155,8 @@ protected:
FindModulesByName(target, arg_cstr, module_list, true);
if (num_matches > 0) {
for (size_t i = 0; i < num_matches; ++i) {
+ if (m_interpreter.WasInterrupted())
+ break;
Module *module = module_list.GetModulePointerAtIndex(i);
if (module) {
num_dumped++;
@@ -2239,6 +2229,8 @@ protected:
" modules.\n",
(uint64_t)num_modules);
for (uint32_t image_idx = 0; image_idx < num_modules; ++image_idx) {
+ if (m_interpreter.WasInterrupted())
+ break;
if (DumpModuleSymbolVendor(
result.GetOutputStream(),
target_modules.GetModulePointerAtIndexUnlocked(image_idx)))
@@ -2260,6 +2252,8 @@ protected:
FindModulesByName(target, arg_cstr, module_list, true);
if (num_matches > 0) {
for (size_t i = 0; i < num_matches; ++i) {
+ if (m_interpreter.WasInterrupted())
+ break;
Module *module = module_list.GetModulePointerAtIndex(i);
if (module) {
if (DumpModuleSymbolVendor(result.GetOutputStream(), module))
@@ -2327,6 +2321,8 @@ protected:
if (num_modules > 0) {
uint32_t num_dumped = 0;
for (uint32_t i = 0; i < num_modules; ++i) {
+ if (m_interpreter.WasInterrupted())
+ break;
if (DumpCompileUnitLineTable(
m_interpreter, result.GetOutputStream(),
target_modules.GetModulePointerAtIndexUnlocked(i),
@@ -2572,7 +2568,7 @@ public:
"Fullpath or basename for module to load.", ""),
m_load_option(LLDB_OPT_SET_1, false, "load", 'l',
"Write file contents to the memory.", false, true),
- m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p',
+ m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p',
"Set PC to the entry point."
" Only applicable with '--load' option.",
false, true),
@@ -3162,7 +3158,8 @@ protected:
} break;
case 'm':
- DumpTimePoint(module->GetModificationTime(), strm, width);
+ strm.Format("{0:%c}", llvm::fmt_align(module->GetModificationTime(),
+ llvm::AlignStyle::Left, width));
break;
case 'p':
@@ -3969,7 +3966,8 @@ public:
"Add a debug symbol file to one of the target's current modules by "
"specifying a path to a debug symbols file, or using the options "
"to specify a module to download symbols for.",
- "target symbols add [<symfile>]", eCommandRequiresTarget),
+ "target symbols add <cmd-options> [<symfile>]",
+ eCommandRequiresTarget),
m_option_group(),
m_file_option(
LLDB_OPT_SET_1, false, "shlib", 's',
@@ -4289,18 +4287,22 @@ protected:
if (uuid_option_set) {
result.AppendError("specify either one or more paths to symbol files "
"or use the --uuid option without arguments");
- } else if (file_option_set) {
- result.AppendError("specify either one or more paths to symbol files "
- "or use the --file option without arguments");
} else if (frame_option_set) {
result.AppendError("specify either one or more paths to symbol files "
"or use the --frame option without arguments");
+ } else if (file_option_set && argc > 1) {
+ result.AppendError("specify at most one symbol file path when "
+ "--shlib option is set");
} else {
PlatformSP platform_sp(target->GetPlatform());
for (auto &entry : args.entries()) {
if (!entry.ref.empty()) {
module_spec.GetSymbolFileSpec().SetFile(entry.ref, true);
+ if (file_option_set) {
+ module_spec.GetFileSpec() =
+ m_file_option.GetOptionValue().GetCurrentValue();
+ }
if (platform_sp) {
FileSpec symfile_spec;
if (platform_sp
diff --git a/source/Commands/CommandObjectTarget.h b/source/Commands/CommandObjectTarget.h
index 865534111eec..643ce547dcb6 100644
--- a/source/Commands/CommandObjectTarget.h
+++ b/source/Commands/CommandObjectTarget.h
@@ -10,11 +10,6 @@
#ifndef liblldb_CommandObjectTarget_h_
#define liblldb_CommandObjectTarget_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/Options.h"
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 6a933df43e14..b68aa920b582 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -94,7 +94,7 @@ public:
bool all_threads = false;
if (command.GetArgumentCount() == 0) {
Thread *thread = m_exe_ctx.GetThreadPtr();
- if (!HandleOneThread(thread->GetID(), result))
+ if (!thread || !HandleOneThread(thread->GetID(), result))
return false;
return result.Succeeded();
} else if (command.GetArgumentCount() == 1) {
@@ -775,6 +775,12 @@ protected:
else
error = process->Resume();
+ if (!error.Success()) {
+ result.AppendMessage(error.AsCString());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
// There is a race condition where this thread will return up the call
// stack to the main command handler
// and show an (lldb) prompt before HandlePrivateEvent (from
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp
index 0c929c22f75f..54b485ce0354 100644
--- a/source/Core/Address.cpp
+++ b/source/Core/Address.cpp
@@ -8,8 +8,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/Address.h"
-
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h" // for ModuleList
diff --git a/source/Core/AddressRange.cpp b/source/Core/AddressRange.cpp
index c1507797b374..e125b693d6f6 100644
--- a/source/Core/AddressRange.cpp
+++ b/source/Core/AddressRange.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/Module.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ConstString.h" // for ConstString
diff --git a/source/Core/CMakeLists.txt b/source/Core/CMakeLists.txt
index c345afb4064a..cac56e29fc19 100644
--- a/source/Core/CMakeLists.txt
+++ b/source/Core/CMakeLists.txt
@@ -13,7 +13,6 @@ add_lldb_library(lldbCore
AddressResolver.cpp
AddressResolverFileLine.cpp
AddressResolverName.cpp
- ArchSpec.cpp
Broadcaster.cpp
Communication.cpp
Debugger.cpp
diff --git a/source/Core/Debugger.cpp b/source/Core/Debugger.cpp
index d42e4df56d8b..a4d78151c75f 100644
--- a/source/Core/Debugger.cpp
+++ b/source/Core/Debugger.cpp
@@ -1170,7 +1170,7 @@ TestPromptFormats (StackFrame *frame)
return;
StreamString s;
- const char *prompt_format =
+ const char *prompt_format =
"{addr = '${addr}'\n}"
"{addr-file-or-load = '${addr-file-or-load}'\n}"
"{current-pc-arrow = '${current-pc-arrow}'\n}"
diff --git a/source/Core/DumpDataExtractor.cpp b/source/Core/DumpDataExtractor.cpp
index c2a9115c3068..e564e86478fc 100644
--- a/source/Core/DumpDataExtractor.cpp
+++ b/source/Core/DumpDataExtractor.cpp
@@ -272,6 +272,13 @@ lldb::offset_t lldb_private::DumpDataExtractor(
case eFormatChar:
case eFormatCharPrintable:
case eFormatCharArray: {
+ // Reject invalid item_byte_size.
+ if (item_byte_size > 8) {
+ s->Printf("error: unsupported byte size (%" PRIu64 ") for char format",
+ (uint64_t)item_byte_size);
+ return offset;
+ }
+
// If we are only printing one character surround it with single
// quotes
if (item_count == 1 && item_format == eFormatChar)
diff --git a/source/Core/FileSpecList.cpp b/source/Core/FileSpecList.cpp
index a69f490f9aed..5b0bdac654e1 100644
--- a/source/Core/FileSpecList.cpp
+++ b/source/Core/FileSpecList.cpp
@@ -49,7 +49,7 @@ void FileSpecList::Append(const FileSpec &file_spec) {
// contained a copy of "file_spec".
//------------------------------------------------------------------
bool FileSpecList::AppendIfUnique(const FileSpec &file_spec) {
- collection::iterator pos, end = m_files.end();
+ collection::iterator end = m_files.end();
if (find(m_files.begin(), end, file_spec) == end) {
m_files.push_back(file_spec);
return true;
@@ -147,36 +147,5 @@ size_t FileSpecList::GetSize() const { return m_files.size(); }
size_t FileSpecList::GetFilesMatchingPartialPath(const char *path,
bool dir_okay,
FileSpecList &matches) {
-#if 0 // FIXME: Just sketching...
- matches.Clear();
- using namespace llvm::sys::fs;
- file_status stats;
- if (status(path, stats, false))
- return 0;
- if (exists(stats)) {
- if (is_symlink_file(stats)) {
- // Shouldn't there be a method that realpath's a file?
- }
- if (is_regular_file(stats) || (is_directory(stats) && dir_okay)) {
- matches.Append(FileSpec(path));
- return 1;
- } else if (is_directory(stats)) {
- // Fill the match list with all the files in the directory:
- } else {
- return 0;
- }
- } else {
- ConstString dir_name = path_spec.GetDirectory();
- ConstString file_name = GetFilename();
- if (dir_name == nullptr)
- {
- // Match files in the CWD.
- }
- else
- {
- // Match files in the given directory:
- }
- }
-#endif
return 0;
}
diff --git a/source/Core/FormatEntity.cpp b/source/Core/FormatEntity.cpp
index 6002efe9244d..0cb74cc7658d 100644
--- a/source/Core/FormatEntity.cpp
+++ b/source/Core/FormatEntity.cpp
@@ -11,7 +11,6 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h" // for AddressRange
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/RegisterValue.h" // for RegisterValue
@@ -42,6 +41,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/AnsiTerminal.h"
+#include "lldb/Utility/ArchSpec.h" // for ArchSpec
#include "lldb/Utility/ConstString.h" // for ConstString, oper...
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h" // for Log
diff --git a/source/Core/IOHandler.cpp b/source/Core/IOHandler.cpp
index 194fec8a8798..103b5ecde94a 100644
--- a/source/Core/IOHandler.cpp
+++ b/source/Core/IOHandler.cpp
@@ -1146,7 +1146,7 @@ public:
const char *text = m_delegate_sp->WindowDelegateGetHelpText();
KeyHelp *key_help = m_delegate_sp->WindowDelegateGetKeyHelp();
if ((text && text[0]) || key_help) {
- std::auto_ptr<HelpDialogDelegate> help_delegate_ap(
+ std::unique_ptr<HelpDialogDelegate> help_delegate_ap(
new HelpDialogDelegate(text, key_help));
const size_t num_lines = help_delegate_ap->GetNumLines();
const size_t max_length = help_delegate_ap->GetMaxLineLength();
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index aaae4700db35..8f80be45f1b0 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -129,43 +129,6 @@ Module *Module::GetAllocatedModuleAtIndex(size_t idx) {
return nullptr;
}
-#if 0
-// These functions help us to determine if modules are still loaded, yet don't require that
-// you have a command interpreter and can easily be called from an external debugger.
-namespace lldb {
-
- void
- ClearModuleInfo (void)
- {
- const bool mandatory = true;
- ModuleList::RemoveOrphanSharedModules(mandatory);
- }
-
- void
- DumpModuleInfo (void)
- {
- Mutex::Locker locker (Module::GetAllocationModuleCollectionMutex());
- ModuleCollection &modules = GetModuleCollection();
- const size_t count = modules.size();
- printf ("%s: %" PRIu64 " modules:\n", LLVM_PRETTY_FUNCTION, (uint64_t)count);
- for (size_t i = 0; i < count; ++i)
- {
-
- StreamString strm;
- Module *module = modules[i];
- const bool in_shared_module_list = ModuleList::ModuleIsInCache (module);
- module->GetDescription(&strm, eDescriptionLevelFull);
- printf ("%p: shared = %i, ref_count = %3u, module = %s\n",
- module,
- in_shared_module_list,
- (uint32_t)module->use_count(),
- strm.GetString().c_str());
- }
- }
-}
-
-#endif
-
Module::Module(const ModuleSpec &module_spec)
: m_object_offset(0), m_file_has_changed(false),
m_first_file_changed_log(false) {
diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index b04299ead804..3970052b7bf3 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -8,8 +8,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/ModuleList.h"
-
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/FileSpecList.h" // for FileSpecList
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -18,6 +16,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h" // for SymbolContextList, SymbolCon...
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Utility/ArchSpec.h" // for ArchSpec
#include "lldb/Utility/ConstString.h" // for ConstString
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Logging.h" // for GetLogIfAnyCategoriesSet
diff --git a/source/Core/PluginManager.cpp b/source/Core/PluginManager.cpp
index 9bb615b6a55e..a49fbc3f90fe 100644
--- a/source/Core/PluginManager.cpp
+++ b/source/Core/PluginManager.cpp
@@ -275,6 +275,54 @@ PluginManager::GetABICreateCallbackForPluginName(const ConstString &name) {
return nullptr;
}
+#pragma mark Architecture
+
+struct ArchitectureInstance {
+ ConstString name;
+ std::string description;
+ PluginManager::ArchitectureCreateInstance create_callback;
+};
+
+typedef std::vector<ArchitectureInstance> ArchitectureInstances;
+
+static std::mutex g_architecture_mutex;
+
+static ArchitectureInstances &GetArchitectureInstances() {
+ static ArchitectureInstances g_instances;
+ return g_instances;
+}
+
+void PluginManager::RegisterPlugin(const ConstString &name,
+ llvm::StringRef description,
+ ArchitectureCreateInstance create_callback) {
+ std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ GetArchitectureInstances().push_back({name, description, create_callback});
+}
+
+void PluginManager::UnregisterPlugin(
+ ArchitectureCreateInstance create_callback) {
+ std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ auto &instances = GetArchitectureInstances();
+
+ for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) {
+ if (pos->create_callback == create_callback) {
+ instances.erase(pos);
+ return;
+ }
+ }
+ llvm_unreachable("Plugin not found");
+}
+
+std::unique_ptr<Architecture>
+PluginManager::CreateArchitectureInstance(const ArchSpec &arch) {
+ std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ for (const auto &instances : GetArchitectureInstances()) {
+ if (auto plugin_up = instances.create_callback(arch))
+ return plugin_up;
+ }
+ return nullptr;
+}
+
#pragma mark Disassembler
struct DisassemblerInstance {
diff --git a/source/Core/RegisterValue.cpp b/source/Core/RegisterValue.cpp
index 28ce67e63dc2..f64c14019cc6 100644
--- a/source/Core/RegisterValue.cpp
+++ b/source/Core/RegisterValue.cpp
@@ -539,6 +539,9 @@ bool RegisterValue::SignExtend(uint32_t sign_bitpos) {
}
bool RegisterValue::CopyValue(const RegisterValue &rhs) {
+ if (this == &rhs)
+ return rhs.m_type == eTypeInvalid ? false : true;
+
m_type = rhs.m_type;
switch (m_type) {
case eTypeInvalid:
diff --git a/source/Core/Section.cpp b/source/Core/Section.cpp
index 3b76dd361ff3..c9faf9f89157 100644
--- a/source/Core/Section.cpp
+++ b/source/Core/Section.cpp
@@ -65,6 +65,8 @@ static const char *GetSectionTypeAsCString(lldb::SectionType sect_type) {
return "dwarf-addr";
case eSectionTypeDWARFDebugAranges:
return "dwarf-aranges";
+ case eSectionTypeDWARFDebugCuIndex:
+ return "dwarf-cu-index";
case eSectionTypeDWARFDebugFrame:
return "dwarf-frame";
case eSectionTypeDWARFDebugInfo:
@@ -133,7 +135,7 @@ Section::Section(const ModuleSP &module_sp, ObjectFile *obj_file,
m_file_offset(file_offset), m_file_size(file_size),
m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
m_thread_specific(false), m_readable(false), m_writable(false),
- m_executable(false), m_target_byte_size(target_byte_size) {
+ m_executable(false), m_relocated(false), m_target_byte_size(target_byte_size) {
// printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
// addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 "
// - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s\n",
@@ -155,7 +157,7 @@ Section::Section(const lldb::SectionSP &parent_section_sp,
m_file_offset(file_offset), m_file_size(file_size),
m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
m_thread_specific(false), m_readable(false), m_writable(false),
- m_executable(false), m_target_byte_size(target_byte_size) {
+ m_executable(false), m_relocated(false), m_target_byte_size(target_byte_size) {
// printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
// addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 "
// - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s.%s\n",
@@ -390,7 +392,7 @@ lldb::offset_t Section::GetSectionData(void *dst, lldb::offset_t dst_len,
return 0;
}
-lldb::offset_t Section::GetSectionData(DataExtractor &section_data) const {
+lldb::offset_t Section::GetSectionData(DataExtractor &section_data) {
if (m_obj_file)
return m_obj_file->ReadSectionData(this, section_data);
return 0;
diff --git a/source/Core/Value.cpp b/source/Core/Value.cpp
index 63385511edb6..d415f1b09eb7 100644
--- a/source/Core/Value.cpp
+++ b/source/Core/Value.cpp
@@ -10,7 +10,6 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/Address.h" // for Address
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/Module.h"
#include "lldb/Core/State.h"
#include "lldb/Symbol/CompilerType.h"
@@ -143,6 +142,9 @@ Type *Value::GetType() {
}
size_t Value::AppendDataToHostBuffer(const Value &rhs) {
+ if (this == &rhs)
+ return 0;
+
size_t curr_size = m_data_buffer.GetByteSize();
Status error;
switch (rhs.GetValueType()) {
@@ -379,31 +381,6 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
} else
address = LLDB_INVALID_ADDRESS;
}
- // else
- // {
- // ModuleSP exe_module_sp
- // (target->GetExecutableModule());
- // if (exe_module_sp)
- // {
- // address =
- // m_value.ULongLong(LLDB_INVALID_ADDRESS);
- // if (address != LLDB_INVALID_ADDRESS)
- // {
- // if
- // (exe_module_sp->ResolveFileAddress(address,
- // file_so_addr))
- // {
- // data.SetByteOrder(target->GetArchitecture().GetByteOrder());
- // data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
- // address_type = eAddressTypeFile;
- // }
- // else
- // {
- // address = LLDB_INVALID_ADDRESS;
- // }
- // }
- // }
- // }
} else {
error.SetErrorString("can't read load address (invalid process)");
}
@@ -560,7 +537,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
"trying to read from host address of 0.");
return error;
}
- memcpy(dst, (uint8_t *)NULL + address, byte_size);
+ memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
} else if ((address_type == eAddressTypeLoad) ||
(address_type == eAddressTypeFile)) {
if (file_so_addr.IsValid()) {
diff --git a/source/Core/ValueObjectDynamicValue.cpp b/source/Core/ValueObjectDynamicValue.cpp
index bb39caa767eb..0013d0dbf740 100644
--- a/source/Core/ValueObjectDynamicValue.cpp
+++ b/source/Core/ValueObjectDynamicValue.cpp
@@ -8,9 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/ValueObjectDynamicValue.h"
-
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
-#include "lldb/Core/Scalar.h" // for Scalar, operator!=
+#include "lldb/Core/Scalar.h" // for Scalar, operator!=
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
diff --git a/source/Core/ValueObjectMemory.cpp b/source/Core/ValueObjectMemory.cpp
index 713751110dce..e26900014c9d 100644
--- a/source/Core/ValueObjectMemory.cpp
+++ b/source/Core/ValueObjectMemory.cpp
@@ -8,9 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/ValueObjectMemory.h"
-
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
-#include "lldb/Core/Scalar.h" // for Scalar, operator!=
+#include "lldb/Core/Scalar.h" // for Scalar, operator!=
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/Type.h"
diff --git a/source/Core/ValueObjectVariable.cpp b/source/Core/ValueObjectVariable.cpp
index 9b9e51a0abb8..8436ba529a54 100644
--- a/source/Core/ValueObjectVariable.cpp
+++ b/source/Core/ValueObjectVariable.cpp
@@ -11,7 +11,6 @@
#include "lldb/Core/Address.h" // for Address
#include "lldb/Core/AddressRange.h" // for AddressRange
-#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/Module.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Scalar.h" // for Scalar, operator!=
@@ -156,9 +155,8 @@ bool ValueObjectVariable::UpdateValue() {
target);
}
Value old_value(m_value);
- if (expr.Evaluate(&exe_ctx, nullptr, nullptr, nullptr,
- loclist_base_load_addr, nullptr, nullptr, m_value,
- &m_error)) {
+ if (expr.Evaluate(&exe_ctx, nullptr, loclist_base_load_addr, nullptr,
+ nullptr, m_value, &m_error)) {
m_resolved_value = m_value;
m_value.SetContext(Value::eContextTypeVariable, variable);
diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp
index 592a30cdd780..14011aece7c9 100644
--- a/source/Expression/DWARFExpression.cpp
+++ b/source/Expression/DWARFExpression.cpp
@@ -24,9 +24,6 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/VMRange.h"
-#include "Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h"
-#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
-
#include "lldb/Host/Host.h"
#include "lldb/Utility/Endian.h"
@@ -1245,23 +1242,21 @@ bool DWARFExpression::DumpLocationForAddress(Stream *s,
}
bool DWARFExpression::Evaluate(ExecutionContextScope *exe_scope,
- ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr,
const Value *object_address_ptr, Value &result,
Status *error_ptr) const {
ExecutionContext exe_ctx(exe_scope);
- return Evaluate(&exe_ctx, expr_locals, decl_map, nullptr,
- loclist_base_load_addr, initial_value_ptr, object_address_ptr,
- result, error_ptr);
+ return Evaluate(&exe_ctx, nullptr, loclist_base_load_addr, initial_value_ptr,
+ object_address_ptr, result, error_ptr);
}
-bool DWARFExpression::Evaluate(
- ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
- lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr,
- const Value *object_address_ptr, Value &result, Status *error_ptr) const {
+bool DWARFExpression::Evaluate(ExecutionContext *exe_ctx,
+ RegisterContext *reg_ctx,
+ lldb::addr_t loclist_base_load_addr,
+ const Value *initial_value_ptr,
+ const Value *object_address_ptr, Value &result,
+ Status *error_ptr) const {
ModuleSP module_sp = m_module_wp.lock();
if (IsLocationList()) {
@@ -1307,9 +1302,9 @@ bool DWARFExpression::Evaluate(
if (length > 0 && lo_pc <= pc && pc < hi_pc) {
return DWARFExpression::Evaluate(
- exe_ctx, expr_locals, decl_map, reg_ctx, module_sp, m_data,
- m_dwarf_cu, offset, length, m_reg_kind, initial_value_ptr,
- object_address_ptr, result, error_ptr);
+ exe_ctx, reg_ctx, module_sp, m_data, m_dwarf_cu, offset, length,
+ m_reg_kind, initial_value_ptr, object_address_ptr, result,
+ error_ptr);
}
offset += length;
}
@@ -1321,14 +1316,12 @@ bool DWARFExpression::Evaluate(
// Not a location list, just a single expression.
return DWARFExpression::Evaluate(
- exe_ctx, expr_locals, decl_map, reg_ctx, module_sp, m_data, m_dwarf_cu, 0,
- m_data.GetByteSize(), m_reg_kind, initial_value_ptr, object_address_ptr,
- result, error_ptr);
+ exe_ctx, reg_ctx, module_sp, m_data, m_dwarf_cu, 0, m_data.GetByteSize(),
+ m_reg_kind, initial_value_ptr, object_address_ptr, result, error_ptr);
}
bool DWARFExpression::Evaluate(
- ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
- ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
+ ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::ModuleSP module_sp, const DataExtractor &opcodes,
DWARFCompileUnit *dwarf_cu, const lldb::offset_t opcodes_offset,
const lldb::offset_t opcodes_length, const lldb::RegisterKind reg_kind,
diff --git a/source/Expression/IRExecutionUnit.cpp b/source/Expression/IRExecutionUnit.cpp
index 363e6fe8678f..be53f37e0bcc 100644
--- a/source/Expression/IRExecutionUnit.cpp
+++ b/source/Expression/IRExecutionUnit.cpp
@@ -260,7 +260,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
llvm::Triple triple(m_module->getTargetTriple());
llvm::Reloc::Model relocModel;
- llvm::CodeModel::Model codeModel;
if (triple.isOSBinFormatELF()) {
relocModel = llvm::Reloc::Static;
@@ -268,9 +267,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
relocModel = llvm::Reloc::PIC_;
}
- // This will be small for 32-bit and large for 64-bit.
- codeModel = llvm::CodeModel::JITDefault;
-
m_module_ap->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
&error);
@@ -281,7 +277,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
.setRelocationModel(relocModel)
.setMCJITMemoryManager(
std::unique_ptr<MemoryManager>(new MemoryManager(*this)))
- .setCodeModel(codeModel)
.setOptLevel(llvm::CodeGenOpt::Less);
llvm::StringRef mArch;
@@ -1114,6 +1109,7 @@ bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp,
case lldb::eSectionTypeDWARFDebugAbbrev:
case lldb::eSectionTypeDWARFDebugAddr:
case lldb::eSectionTypeDWARFDebugAranges:
+ case lldb::eSectionTypeDWARFDebugCuIndex:
case lldb::eSectionTypeDWARFDebugFrame:
case lldb::eSectionTypeDWARFDebugInfo:
case lldb::eSectionTypeDWARFDebugLine:
diff --git a/source/Expression/IRInterpreter.cpp b/source/Expression/IRInterpreter.cpp
index 6b5e22329af8..a809bff20039 100644
--- a/source/Expression/IRInterpreter.cpp
+++ b/source/Expression/IRInterpreter.cpp
@@ -385,11 +385,6 @@ public:
return ret;
}
- lldb::addr_t MallocPointer() {
- return Malloc(m_target_data.getPointerSize(),
- m_target_data.getPointerPrefAlignment());
- }
-
lldb::addr_t Malloc(llvm::Type *type) {
lldb_private::Status alloc_error;
diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
index 1696e7eab6ea..2b6f0e48a3f2 100644
--- a/source/Host/CMakeLists.txt
+++ b/source/Host/CMakeLists.txt
@@ -31,6 +31,7 @@ add_host_subdirectory(common
common/SoftwareBreakpoint.cpp
common/StringConvert.cpp
common/Symbols.cpp
+ common/TaskPool.cpp
common/TCPSocket.cpp
common/Terminal.cpp
common/ThreadLauncher.cpp
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 8248aa3c5118..97581185ad9e 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -48,10 +48,6 @@
// C++ Includes
#include <csignal>
-// Other libraries and framework includes
-// Project includes
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostProcess.h"
diff --git a/source/Host/common/HostInfoBase.cpp b/source/Host/common/HostInfoBase.cpp
index a6c9e91a98e8..aff887f9f1d2 100644
--- a/source/Host/common/HostInfoBase.cpp
+++ b/source/Host/common/HostInfoBase.cpp
@@ -9,11 +9,11 @@
#include "lldb/Host/Config.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
@@ -103,6 +103,14 @@ const ArchSpec &HostInfoBase::GetArchitecture(ArchitectureKind arch_kind) {
: g_fields->m_host_arch_32;
}
+llvm::Optional<HostInfoBase::ArchitectureKind> HostInfoBase::ParseArchitectureKind(llvm::StringRef kind) {
+ return llvm::StringSwitch<llvm::Optional<ArchitectureKind>>(kind)
+ .Case(LLDB_ARCH_DEFAULT, eArchKindDefault)
+ .Case(LLDB_ARCH_DEFAULT_32BIT, eArchKind32)
+ .Case(LLDB_ARCH_DEFAULT_64BIT, eArchKind64)
+ .Default(llvm::None);
+}
+
bool HostInfoBase::GetLLDBPath(lldb::PathType type, FileSpec &file_spec) {
file_spec.Clear();
@@ -251,6 +259,27 @@ bool HostInfoBase::GetLLDBPath(lldb::PathType type, FileSpec &file_spec) {
return true;
}
+ArchSpec HostInfoBase::GetAugmentedArchSpec(llvm::StringRef triple) {
+ if (triple.empty())
+ return ArchSpec();
+ llvm::Triple normalized_triple(llvm::Triple::normalize(triple));
+ if (!ArchSpec::ContainsOnlyArch(normalized_triple))
+ return ArchSpec(triple);
+
+ if (auto kind = HostInfo::ParseArchitectureKind(triple))
+ return HostInfo::GetArchitecture(*kind);
+
+ llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple());
+
+ if (normalized_triple.getVendorName().empty())
+ normalized_triple.setVendor(host_triple.getVendor());
+ if (normalized_triple.getOSName().empty())
+ normalized_triple.setOS(host_triple.getOS());
+ if (normalized_triple.getEnvironmentName().empty())
+ normalized_triple.setEnvironment(host_triple.getEnvironment());
+ return ArchSpec(normalized_triple);
+}
+
bool HostInfoBase::ComputeSharedLibraryDirectory(FileSpec &file_spec) {
// To get paths related to LLDB we get the path to the executable that
// contains this function. On MacOSX this will be "LLDB.framework/.../LLDB",
diff --git a/source/Host/common/MainLoop.cpp b/source/Host/common/MainLoop.cpp
index d0e0d00a3151..6cbb5a842562 100644
--- a/source/Host/common/MainLoop.cpp
+++ b/source/Host/common/MainLoop.cpp
@@ -28,6 +28,8 @@
#include <sys/event.h>
#elif defined(LLVM_ON_WIN32)
#include <winsock2.h>
+#elif defined(__ANDROID__)
+#include <sys/syscall.h>
#else
#include <poll.h>
#endif
@@ -38,10 +40,6 @@
#define POLL poll
#endif
-#ifdef __ANDROID__
-#define FORCE_PSELECT
-#endif
-
#if SIGNAL_POLLING_UNSUPPORTED
#ifdef LLVM_ON_WIN32
typedef int sigset_t;
@@ -86,7 +84,7 @@ private:
int num_events = -1;
#else
-#ifdef FORCE_PSELECT
+#ifdef __ANDROID__
fd_set read_fd_set;
#else
std::vector<struct pollfd> read_fds;
@@ -134,7 +132,7 @@ void MainLoop::RunImpl::ProcessEvents() {
}
#else
MainLoop::RunImpl::RunImpl(MainLoop &loop) : loop(loop) {
-#ifndef FORCE_PSELECT
+#ifndef __ANDROID__
read_fds.reserve(loop.m_read_fds.size());
#endif
}
@@ -154,8 +152,14 @@ sigset_t MainLoop::RunImpl::get_sigmask() {
#endif
}
-#ifdef FORCE_PSELECT
+#ifdef __ANDROID__
Status MainLoop::RunImpl::Poll() {
+ // ppoll(2) is not supported on older all android versions. Also, older
+ // versions android (API <= 19) implemented pselect in a non-atomic way, as a
+ // combination of pthread_sigmask and select. This is not sufficient for us,
+ // as we rely on the atomicity to correctly implement signal polling, so we
+ // call the underlying syscall ourselves.
+
FD_ZERO(&read_fd_set);
int nfds = 0;
for (const auto &fd : loop.m_read_fds) {
@@ -163,8 +167,19 @@ Status MainLoop::RunImpl::Poll() {
nfds = std::max(nfds, fd.first + 1);
}
- sigset_t sigmask = get_sigmask();
- if (pselect(nfds, &read_fd_set, nullptr, nullptr, nullptr, &sigmask) == -1 &&
+ union {
+ sigset_t set;
+ uint64_t pad;
+ } kernel_sigset;
+ memset(&kernel_sigset, 0, sizeof(kernel_sigset));
+ kernel_sigset.set = get_sigmask();
+
+ struct {
+ void *sigset_ptr;
+ size_t sigset_len;
+ } extra_data = {&kernel_sigset, sizeof(kernel_sigset)};
+ if (syscall(__NR_pselect6, nfds, &read_fd_set, nullptr, nullptr, nullptr,
+ &extra_data) == -1 &&
errno != EINTR)
return Status(errno, eErrorTypePOSIX);
@@ -193,7 +208,7 @@ Status MainLoop::RunImpl::Poll() {
#endif
void MainLoop::RunImpl::ProcessEvents() {
-#ifdef FORCE_PSELECT
+#ifdef __ANDROID__
// Collect first all readable file descriptors into a separate vector and then
// iterate over it to invoke callbacks. Iterating directly over
// loop.m_read_fds is not possible because the callbacks can modify the
@@ -206,7 +221,7 @@ void MainLoop::RunImpl::ProcessEvents() {
for (const auto &handle : fds) {
#else
for (const auto &fd : read_fds) {
- if ((fd.revents & POLLIN) == 0)
+ if ((fd.revents & (POLLIN | POLLHUP)) == 0)
continue;
IOObject::WaitableHandle handle = fd.fd;
#endif
diff --git a/source/Host/common/NativeProcessProtocol.cpp b/source/Host/common/NativeProcessProtocol.cpp
index b5b6e9d8b923..1fcb11b8b6f5 100644
--- a/source/Host/common/NativeProcessProtocol.cpp
+++ b/source/Host/common/NativeProcessProtocol.cpp
@@ -8,8 +8,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/common/NativeProcessProtocol.h"
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Host/Host.h"
@@ -90,23 +88,23 @@ bool NativeProcessProtocol::SetExitStatus(WaitStatus status,
return true;
}
-NativeThreadProtocolSP NativeProcessProtocol::GetThreadAtIndex(uint32_t idx) {
+NativeThreadProtocol *NativeProcessProtocol::GetThreadAtIndex(uint32_t idx) {
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
if (idx < m_threads.size())
- return m_threads[idx];
- return NativeThreadProtocolSP();
+ return m_threads[idx].get();
+ return nullptr;
}
-NativeThreadProtocolSP
+NativeThreadProtocol *
NativeProcessProtocol::GetThreadByIDUnlocked(lldb::tid_t tid) {
- for (auto thread_sp : m_threads) {
- if (thread_sp->GetID() == tid)
- return thread_sp;
+ for (const auto &thread : m_threads) {
+ if (thread->GetID() == tid)
+ return thread.get();
}
- return NativeThreadProtocolSP();
+ return nullptr;
}
-NativeThreadProtocolSP NativeProcessProtocol::GetThreadByID(lldb::tid_t tid) {
+NativeThreadProtocol *NativeProcessProtocol::GetThreadByID(lldb::tid_t tid) {
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
return GetThreadByIDUnlocked(tid);
}
@@ -116,14 +114,6 @@ bool NativeProcessProtocol::IsAlive() const {
m_state != eStateInvalid && m_state != eStateUnloaded;
}
-bool NativeProcessProtocol::GetByteOrder(lldb::ByteOrder &byte_order) const {
- ArchSpec process_arch;
- if (!GetArchitecture(process_arch))
- return false;
- byte_order = process_arch.GetByteOrder();
- return true;
-}
-
const NativeWatchpointList::WatchpointMap &
NativeProcessProtocol::GetWatchpointMap() const {
return m_watchpoint_list.GetWatchpointMap();
@@ -134,27 +124,16 @@ NativeProcessProtocol::GetHardwareDebugSupportInfo() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
// get any thread
- NativeThreadProtocolSP thread_sp(
+ NativeThreadProtocol *thread(
const_cast<NativeProcessProtocol *>(this)->GetThreadAtIndex(0));
- if (!thread_sp) {
- if (log)
- log->Warning("NativeProcessProtocol::%s (): failed to find a thread to "
- "grab a NativeRegisterContext!",
- __FUNCTION__);
+ if (!thread) {
+ LLDB_LOG(log, "failed to find a thread to grab a NativeRegisterContext!");
return llvm::None;
}
- NativeRegisterContextSP reg_ctx_sp(thread_sp->GetRegisterContext());
- if (!reg_ctx_sp) {
- if (log)
- log->Warning("NativeProcessProtocol::%s (): failed to get a "
- "RegisterContextNativeProcess from the first thread!",
- __FUNCTION__);
- return llvm::None;
- }
-
- return std::make_pair(reg_ctx_sp->NumSupportedHardwareBreakpoints(),
- reg_ctx_sp->NumSupportedHardwareWatchpoints());
+ NativeRegisterContext &reg_ctx = thread->GetRegisterContext();
+ return std::make_pair(reg_ctx.NumSupportedHardwareBreakpoints(),
+ reg_ctx.NumSupportedHardwareWatchpoints());
}
Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size,
@@ -175,7 +154,7 @@ Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size,
// for. If one of the thread watchpoint setting operations fails,
// back off and remove the watchpoint for all the threads that
// were successfully set so we get back to a consistent state.
- std::vector<NativeThreadProtocolSP> watchpoint_established_threads;
+ std::vector<NativeThreadProtocol *> watchpoint_established_threads;
// Tell each thread to set a watchpoint. In the event that
// hardware watchpoints are requested but the SetWatchpoint fails,
@@ -184,40 +163,33 @@ Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size,
// watchpoints available, some of the threads will fail to set
// hardware watchpoints while software ones may be available.
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not have a NULL thread!");
- if (!thread_sp)
- continue;
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not have a NULL thread!");
Status thread_error =
- thread_sp->SetWatchpoint(addr, size, watch_flags, hardware);
+ thread->SetWatchpoint(addr, size, watch_flags, hardware);
if (thread_error.Fail() && hardware) {
// Try software watchpoints since we failed on hardware watchpoint setting
// and we may have just run out of hardware watchpoints.
- thread_error = thread_sp->SetWatchpoint(addr, size, watch_flags, false);
- if (thread_error.Success()) {
- if (log)
- log->Warning(
- "hardware watchpoint requested but software watchpoint set");
- }
+ thread_error = thread->SetWatchpoint(addr, size, watch_flags, false);
+ if (thread_error.Success())
+ LLDB_LOG(log,
+ "hardware watchpoint requested but software watchpoint set");
}
if (thread_error.Success()) {
// Remember that we set this watchpoint successfully in
// case we need to clear it later.
- watchpoint_established_threads.push_back(thread_sp);
+ watchpoint_established_threads.push_back(thread.get());
} else {
// Unset the watchpoint for each thread we successfully
// set so that we get back to a consistent state of "not
// set" for the watchpoint.
for (auto unwatch_thread_sp : watchpoint_established_threads) {
Status remove_error = unwatch_thread_sp->RemoveWatchpoint(addr);
- if (remove_error.Fail() && log) {
- log->Warning("NativeProcessProtocol::%s (): RemoveWatchpoint failed "
- "for pid=%" PRIu64 ", tid=%" PRIu64 ": %s",
- __FUNCTION__, GetID(), unwatch_thread_sp->GetID(),
- remove_error.AsCString());
- }
+ if (remove_error.Fail())
+ LLDB_LOG(log, "RemoveWatchpoint failed for pid={0}, tid={1}: {2}",
+ GetID(), unwatch_thread_sp->GetID(), remove_error);
}
return thread_error;
@@ -233,12 +205,10 @@ Status NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) {
Status overall_error;
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not have a NULL thread!");
- if (!thread_sp)
- continue;
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not have a NULL thread!");
- const Status thread_error = thread_sp->RemoveWatchpoint(addr);
+ const Status thread_error = thread->RemoveWatchpoint(addr);
if (thread_error.Fail()) {
// Keep track of the first thread error if any threads
// fail. We want to try to remove the watchpoint from
@@ -277,20 +247,18 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr,
// set this hardware breakpoint. If any of the current process threads fails
// to set this hardware breakpoint then roll back and remove this breakpoint
// for all the threads that had already set it successfully.
- std::vector<NativeThreadProtocolSP> breakpoint_established_threads;
+ std::vector<NativeThreadProtocol *> breakpoint_established_threads;
// Request to set a hardware breakpoint for each of current process threads.
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not have a NULL thread!");
- if (!thread_sp)
- continue;
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not have a NULL thread!");
- Status thread_error = thread_sp->SetHardwareBreakpoint(addr, size);
+ Status thread_error = thread->SetHardwareBreakpoint(addr, size);
if (thread_error.Success()) {
// Remember that we set this breakpoint successfully in
// case we need to clear it later.
- breakpoint_established_threads.push_back(thread_sp);
+ breakpoint_established_threads.push_back(thread.get());
} else {
// Unset the breakpoint for each thread we successfully
// set so that we get back to a consistent state of "not
@@ -298,12 +266,10 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr,
for (auto rollback_thread_sp : breakpoint_established_threads) {
Status remove_error =
rollback_thread_sp->RemoveHardwareBreakpoint(addr);
- if (remove_error.Fail() && log) {
- log->Warning("NativeProcessProtocol::%s (): RemoveHardwareBreakpoint"
- " failed for pid=%" PRIu64 ", tid=%" PRIu64 ": %s",
- __FUNCTION__, GetID(), rollback_thread_sp->GetID(),
- remove_error.AsCString());
- }
+ if (remove_error.Fail())
+ LLDB_LOG(log,
+ "RemoveHardwareBreakpoint failed for pid={0}, tid={1}: {2}",
+ GetID(), rollback_thread_sp->GetID(), remove_error);
}
return thread_error;
@@ -324,12 +290,9 @@ Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) {
Status error;
std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not have a NULL thread!");
- if (!thread_sp)
- continue;
-
- error = thread_sp->RemoveHardwareBreakpoint(addr);
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not have a NULL thread!");
+ error = thread->RemoveHardwareBreakpoint(addr);
}
// Also remove from hardware breakpoint map of current process.
diff --git a/source/Host/common/NativeRegisterContext.cpp b/source/Host/common/NativeRegisterContext.cpp
index 629b0247422d..60eaebdc94cd 100644
--- a/source/Host/common/NativeRegisterContext.cpp
+++ b/source/Host/common/NativeRegisterContext.cpp
@@ -19,9 +19,8 @@
using namespace lldb;
using namespace lldb_private;
-NativeRegisterContext::NativeRegisterContext(NativeThreadProtocol &thread,
- uint32_t concrete_frame_idx)
- : m_thread(thread), m_concrete_frame_idx(concrete_frame_idx) {}
+NativeRegisterContext::NativeRegisterContext(NativeThreadProtocol &thread)
+ : m_thread(thread) {}
//----------------------------------------------------------------------
// Destructor
@@ -368,13 +367,8 @@ Status NativeRegisterContext::ReadRegisterValueFromMemory(
// TODO: we might need to add a parameter to this function in case the byte
// order of the memory data doesn't match the process. For now we are assuming
// they are the same.
- lldb::ByteOrder byte_order;
- if (process.GetByteOrder(byte_order)) {
- error.SetErrorString("NativeProcessProtocol::GetByteOrder () failed");
- return error;
- }
-
- reg_value.SetFromMemoryData(reg_info, src, src_len, byte_order, error);
+ reg_value.SetFromMemoryData(reg_info, src, src_len, process.GetByteOrder(),
+ error);
return error;
}
@@ -393,12 +387,8 @@ Status NativeRegisterContext::WriteRegisterValueToMemory(
// order of the memory data doesn't match the process. For now we are
// assuming
// they are the same.
- lldb::ByteOrder byte_order;
- if (!process.GetByteOrder(byte_order))
- return Status("NativeProcessProtocol::GetByteOrder () failed");
-
- const size_t bytes_copied =
- reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error);
+ const size_t bytes_copied = reg_value.GetAsMemoryData(
+ reg_info, dst, dst_len, process.GetByteOrder(), error);
if (error.Success()) {
if (bytes_copied == 0) {
diff --git a/source/Host/common/NativeThreadProtocol.cpp b/source/Host/common/NativeThreadProtocol.cpp
index 54ac96dd3c6f..3f3915e006da 100644
--- a/source/Host/common/NativeThreadProtocol.cpp
+++ b/source/Host/common/NativeThreadProtocol.cpp
@@ -22,43 +22,33 @@ NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol &process,
Status NativeThreadProtocol::ReadRegister(uint32_t reg,
RegisterValue &reg_value) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
+ NativeRegisterContext &register_context = GetRegisterContext();
const RegisterInfo *const reg_info =
- register_context_sp->GetRegisterInfoAtIndex(reg);
+ register_context.GetRegisterInfoAtIndex(reg);
if (!reg_info)
return Status("no register info for reg num %" PRIu32, reg);
- return register_context_sp->ReadRegister(reg_info, reg_value);
+ return register_context.ReadRegister(reg_info, reg_value);
;
}
Status NativeThreadProtocol::WriteRegister(uint32_t reg,
const RegisterValue &reg_value) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
+ NativeRegisterContext& register_context = GetRegisterContext();
const RegisterInfo *const reg_info =
- register_context_sp->GetRegisterInfoAtIndex(reg);
+ register_context.GetRegisterInfoAtIndex(reg);
if (!reg_info)
return Status("no register info for reg num %" PRIu32, reg);
- return register_context_sp->WriteRegister(reg_info, reg_value);
+ return register_context.WriteRegister(reg_info, reg_value);
}
Status NativeThreadProtocol::SaveAllRegisters(lldb::DataBufferSP &data_sp) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
- return register_context_sp->WriteAllRegisterValues(data_sp);
+ return GetRegisterContext().WriteAllRegisterValues(data_sp);
}
Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
- return register_context_sp->ReadAllRegisterValues(data_sp);
+ return GetRegisterContext().ReadAllRegisterValues(data_sp);
}
diff --git a/source/Host/common/PseudoTerminal.cpp b/source/Host/common/PseudoTerminal.cpp
index 58c32e4a1c4b..9657cb6523dc 100644
--- a/source/Host/common/PseudoTerminal.cpp
+++ b/source/Host/common/PseudoTerminal.cpp
@@ -24,7 +24,7 @@
int posix_openpt(int flags);
#endif
-using namespace lldb_utility;
+using namespace lldb_private;
//----------------------------------------------------------------------
// PseudoTerminal constructor
diff --git a/source/Host/common/Socket.cpp b/source/Host/common/Socket.cpp
index 5490e9b30bda..4c23e4eb560c 100644
--- a/source/Host/common/Socket.cpp
+++ b/source/Host/common/Socket.cpp
@@ -450,7 +450,7 @@ NativeSocket Socket::AcceptSocket(NativeSocket sockfd, struct sockaddr *addr,
close(fd);
}
return fd;
-#elif defined(SOCK_CLOEXEC)
+#elif defined(SOCK_CLOEXEC) && defined(HAVE_ACCEPT4)
int flags = 0;
if (!child_processes_inherit) {
flags |= SOCK_CLOEXEC;
diff --git a/source/Host/common/Symbols.cpp b/source/Host/common/Symbols.cpp
index e7bdf084d385..3f70fdc4bf95 100644
--- a/source/Host/common/Symbols.cpp
+++ b/source/Host/common/Symbols.cpp
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Symbols.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
@@ -109,25 +109,25 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
// Remove the binary name from the FileSpec
parent_dirs.RemoveLastPathComponent();
- // Add a ".dSYM" name to each directory component of the path, stripping
- // off components. e.g. we may have a binary like
+ // Add a ".dSYM" name to each directory component of the path,
+ // stripping off components. e.g. we may have a binary like
// /S/L/F/Foundation.framework/Versions/A/Foundation
// and
// /S/L/F/Foundation.framework.dSYM
//
// so we'll need to start with /S/L/F/Foundation.framework/Versions/A,
// add the .dSYM part to the "A", and if that doesn't exist, strip off
- // the "A" and try it again with "Versions", etc., until we find a dSYM
- // bundle or we've stripped off enough path components that there's no
- // need to continue.
+ // the "A" and try it again with "Versions", etc., until we find a
+ // dSYM bundle or we've stripped off enough path components that
+ // there's no need to continue.
for (int i = 0; i < 4; i++) {
- // Does this part of the path have a "." character - could it be a bundle's
- // top level directory?
+ // Does this part of the path have a "." character - could it be a
+ // bundle's top level directory?
const char *fn = parent_dirs.GetFilename().AsCString();
if (fn == nullptr)
- break;
- if (::strchr (fn, '.') != nullptr) {
+ break;
+ if (::strchr(fn, '.') != nullptr) {
dsym_fspec = parent_dirs;
dsym_fspec.RemoveLastPathComponent();
@@ -140,16 +140,17 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
dsym_fspec.AppendPathComponent("Contents");
dsym_fspec.AppendPathComponent("Resources");
dsym_fspec.AppendPathComponent("DWARF");
- dsym_fspec.AppendPathComponent(exec_fspec->GetFilename().AsCString());
+ dsym_fspec.AppendPathComponent(
+ exec_fspec->GetFilename().AsCString());
if (dsym_fspec.Exists() &&
- FileAtPathContainsArchAndUUID(
- dsym_fspec, module_spec.GetArchitecturePtr(),
- module_spec.GetUUIDPtr())) {
- if (log) {
- log->Printf("dSYM with matching UUID & arch found at %s",
- dsym_fspec.GetPath().c_str());
- }
- return true;
+ FileAtPathContainsArchAndUUID(
+ dsym_fspec, module_spec.GetArchitecturePtr(),
+ module_spec.GetUUIDPtr())) {
+ if (log) {
+ log->Printf("dSYM with matching UUID & arch found at %s",
+ dsym_fspec.GetPath().c_str());
+ }
+ return true;
}
}
parent_dirs.RemoveLastPathComponent();
@@ -231,7 +232,8 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
#ifndef LLVM_ON_WIN32
#if defined(__NetBSD__)
// Add /usr/libdata/debug directory.
- debug_file_search_paths.AppendIfUnique(FileSpec("/usr/libdata/debug", true));
+ debug_file_search_paths.AppendIfUnique(
+ FileSpec("/usr/libdata/debug", true));
#else
// Add /usr/lib/debug directory.
debug_file_search_paths.AppendIfUnique(FileSpec("/usr/lib/debug", true));
@@ -285,7 +287,11 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
if (num_specs == 1) {
ModuleSpec mspec;
if (specs.GetModuleSpecAtIndex(0, mspec)) {
- if (mspec.GetUUID() == module_uuid)
+ // Skip the uuids check if module_uuid is invalid.
+ // For example, this happens for *.dwp files since
+ // at the moment llvm-dwp doesn't output build ids,
+ // nor does binutils dwp.
+ if (!module_uuid.IsValid() || module_uuid == mspec.GetUUID())
return file_spec;
}
}
diff --git a/source/Utility/TaskPool.cpp b/source/Host/common/TaskPool.cpp
index d33f23cd861c..156a07942998 100644
--- a/source/Utility/TaskPool.cpp
+++ b/source/Host/common/TaskPool.cpp
@@ -7,12 +7,15 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Utility/TaskPool.h"
+#include "lldb/Host/TaskPool.h"
+#include "lldb/Host/ThreadLauncher.h"
#include <cstdint> // for uint32_t
#include <queue> // for queue
#include <thread> // for thread
+namespace lldb_private {
+
namespace {
class TaskPoolImpl {
public:
@@ -23,6 +26,8 @@ public:
private:
TaskPoolImpl();
+ static lldb::thread_result_t WorkerPtr(void *pool);
+
static void Worker(TaskPoolImpl *pool);
std::queue<std::function<void()>> m_tasks;
@@ -43,21 +48,36 @@ void TaskPool::AddTaskImpl(std::function<void()> &&task_fn) {
TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {}
+unsigned GetHardwareConcurrencyHint() {
+ // std::thread::hardware_concurrency may return 0
+ // if the value is not well defined or not computable.
+ static const unsigned g_hardware_concurrency =
+ std::max(1u, std::thread::hardware_concurrency());
+ return g_hardware_concurrency;
+}
+
void TaskPoolImpl::AddTask(std::function<void()> &&task_fn) {
- static const uint32_t max_threads = std::thread::hardware_concurrency();
+ const size_t min_stack_size = 8 * 1024 * 1024;
std::unique_lock<std::mutex> lock(m_tasks_mutex);
m_tasks.emplace(std::move(task_fn));
- if (m_thread_count < max_threads) {
+ if (m_thread_count < GetHardwareConcurrencyHint()) {
m_thread_count++;
// Note that this detach call needs to happen with the m_tasks_mutex held.
// This prevents the thread
// from exiting prematurely and triggering a linux libc bug
// (https://sourceware.org/bugzilla/show_bug.cgi?id=19951).
- std::thread(Worker, this).detach();
+ lldb_private::ThreadLauncher::LaunchThread("task-pool.worker", WorkerPtr,
+ this, nullptr, min_stack_size)
+ .Release();
}
}
+lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
+ Worker((TaskPoolImpl *)pool);
+ return 0;
+}
+
void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
while (true) {
std::unique_lock<std::mutex> lock(pool->m_tasks_mutex);
@@ -66,7 +86,7 @@ void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
break;
}
- std::function<void()> f = pool->m_tasks.front();
+ std::function<void()> f = std::move(pool->m_tasks.front());
pool->m_tasks.pop();
lock.unlock();
@@ -76,10 +96,9 @@ void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
void TaskMapOverInt(size_t begin, size_t end,
const llvm::function_ref<void(size_t)> &func) {
+ const size_t num_workers = std::min<size_t>(end, GetHardwareConcurrencyHint());
std::atomic<size_t> idx{begin};
- size_t num_workers =
- std::min<size_t>(end, std::thread::hardware_concurrency());
-
+
auto wrapper = [&idx, end, &func]() {
while (true) {
size_t i = idx.fetch_add(1);
@@ -96,3 +115,6 @@ void TaskMapOverInt(size_t begin, size_t end,
for (size_t i = 0; i < num_workers; i++)
futures[i].wait();
}
+
+} // namespace lldb_private
+
diff --git a/source/Host/common/XML.cpp b/source/Host/common/XML.cpp
index c637d938dffa..c3169bd6e08d 100644
--- a/source/Host/common/XML.cpp
+++ b/source/Host/common/XML.cpp
@@ -339,7 +339,7 @@ XMLNode XMLNode::FindFirstChildElementWithName(const char *name) const {
#if defined(LIBXML2_DEFINED)
ForEachChildElementWithName(
- name, [&result_node, name](const XMLNode &node) -> bool {
+ name, [&result_node](const XMLNode &node) -> bool {
result_node = node;
// Stop iterating, we found the node we wanted
return false;
diff --git a/source/Host/freebsd/Host.cpp b/source/Host/freebsd/Host.cpp
index 037dfc7f5e03..124a8a760133 100644
--- a/source/Host/freebsd/Host.cpp
+++ b/source/Host/freebsd/Host.cpp
@@ -73,7 +73,14 @@ GetFreeBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
if (!cstr)
return false;
- process_info.GetExecutableFile().SetFile(cstr, false);
+ // Get pathname for pid. If that fails fall back to argv[0].
+ char pathname[MAXPATHLEN];
+ size_t pathname_len = sizeof(pathname);
+ mib[2] = KERN_PROC_PATHNAME;
+ if (::sysctl(mib, 4, pathname, &pathname_len, NULL, 0) == 0)
+ process_info.GetExecutableFile().SetFile(pathname, false);
+ else
+ process_info.GetExecutableFile().SetFile(cstr, false);
if (!(match_info_ptr == NULL ||
NameMatches(process_info.GetExecutableFile().GetFilename().GetCString(),
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index 75624ef21f43..7359815fdf70 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -20,7 +20,7 @@
#define __XPC_PRIVATE_H__
#include <xpc/xpc.h>
-#define LaunchUsingXPCRightName "com.apple.dt.Xcode.RootDebuggingXPCService"
+#define LaunchUsingXPCRightName "com.apple.lldb.RootDebuggingXPCService"
// These XPC messaging keys are used for communication between Host.mm and the
// XPC service.
@@ -54,7 +54,6 @@
#include <sys/types.h>
#include <unistd.h>
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -63,6 +62,7 @@
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/CleanUp.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
diff --git a/source/Host/macosx/Symbols.cpp b/source/Host/macosx/Symbols.cpp
index 9d1e8fe96ae9..98c110b1bed6 100644
--- a/source/Host/macosx/Symbols.cpp
+++ b/source/Host/macosx/Symbols.cpp
@@ -23,11 +23,11 @@
#include "Host/macosx/cfcpp/CFCData.h"
#include "Host/macosx/cfcpp/CFCReleaser.h"
#include "Host/macosx/cfcpp/CFCString.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/CleanUp.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataExtractor.h"
@@ -361,6 +361,7 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
// If we see DBGVersion with a value of 2 or higher, this is a new style
// DBGSourcePathRemapping dictionary
bool new_style_source_remapping_dictionary = false;
+ bool do_truncate_remapping_names = false;
std::string original_DBGSourcePath_value = DBGSourcePath;
cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
CFSTR("DBGVersion"));
@@ -372,6 +373,9 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
if (version_number > 1) {
new_style_source_remapping_dictionary = true;
}
+ if (version_number == 2) {
+ do_truncate_remapping_names = true;
+ }
}
}
@@ -409,9 +413,24 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
FileSpec resolved_source_path(DBGSourcePath.c_str(), true);
DBGSourcePath = resolved_source_path.GetPath();
}
+ // With version 2 of DBGSourcePathRemapping, we can chop off the
+ // last two filename parts from the source remapping and get a
+ // more general source remapping that still works. Add this as
+ // another option in addition to the full source path remap.
module_spec.GetSourceMappingList().Append(
ConstString(DBGBuildSourcePath.c_str()),
ConstString(DBGSourcePath.c_str()), true);
+ if (do_truncate_remapping_names) {
+ FileSpec build_path(DBGBuildSourcePath.c_str(), false);
+ FileSpec source_path(DBGSourcePath.c_str(), false);
+ build_path.RemoveLastPathComponent();
+ build_path.RemoveLastPathComponent();
+ source_path.RemoveLastPathComponent();
+ source_path.RemoveLastPathComponent();
+ module_spec.GetSourceMappingList().Append(
+ ConstString(build_path.GetPath().c_str()),
+ ConstString(source_path.GetPath().c_str()), true);
+ }
}
}
if (keys)
diff --git a/source/Host/posix/HostThreadPosix.cpp b/source/Host/posix/HostThreadPosix.cpp
index 0f4434d25e2e..71abb76dc600 100644
--- a/source/Host/posix/HostThreadPosix.cpp
+++ b/source/Host/posix/HostThreadPosix.cpp
@@ -43,7 +43,7 @@ Status HostThreadPosix::Cancel() {
if (IsJoinable()) {
#ifndef __ANDROID__
#ifndef __FreeBSD__
- assert(false && "someone is calling HostThread::Cancel()");
+ llvm_unreachable("someone is calling HostThread::Cancel()");
#endif
int err = ::pthread_cancel(m_thread);
error.SetError(err, eErrorTypePOSIX);
diff --git a/source/Host/posix/ProcessLauncherPosixFork.cpp b/source/Host/posix/ProcessLauncherPosixFork.cpp
index 66c0229e0dab..ac1d9011c2b7 100644
--- a/source/Host/posix/ProcessLauncherPosixFork.cpp
+++ b/source/Host/posix/ProcessLauncherPosixFork.cpp
@@ -29,7 +29,7 @@
#define PT_TRACE_ME PTRACE_TRACEME
#endif
-#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 15
#include <linux/personality.h>
#elif defined(__linux__)
#include <sys/personality.h>
@@ -95,10 +95,6 @@ static void DupDescriptor(int error_fd, const FileSpec &file_spec, int fd,
static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
const ProcessLaunchInfo &info) {
- // First, make sure we disable all logging. If we are logging to stdout, our
- // logs can be mistaken for inferior output.
- Log::DisableAllLogChannels();
-
// Do not inherit setgid powers.
if (setgid(getgid()) != 0)
ExitWithError(error_fd, "setgid");
diff --git a/source/Initialization/SystemInitializerCommon.cpp b/source/Initialization/SystemInitializerCommon.cpp
index e76ba4122bb6..a8fc46c119d8 100644
--- a/source/Initialization/SystemInitializerCommon.cpp
+++ b/source/Initialization/SystemInitializerCommon.cpp
@@ -69,8 +69,10 @@ void SystemInitializerCommon::Initialize() {
}
#endif
+#if not defined(__APPLE__)
llvm::EnablePrettyStackTrace();
- InitializeLog();
+#endif
+ Log::Initialize();
HostInfo::Initialize();
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
diff --git a/source/Interpreter/Args.cpp b/source/Interpreter/Args.cpp
index a23ba3094b22..07e5191f898a 100644
--- a/source/Interpreter/Args.cpp
+++ b/source/Interpreter/Args.cpp
@@ -185,6 +185,11 @@ Args::Args(llvm::StringRef command) { SetCommandString(command); }
Args::Args(const Args &rhs) { *this = rhs; }
+Args::Args(const StringList &list) : Args() {
+ for(size_t i = 0; i < list.GetSize(); ++i)
+ AppendArgument(list[i]);
+}
+
Args &Args::operator=(const Args &rhs) {
Clear();
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 986be7ffbf89..8dc5637b6e4e 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -546,7 +546,7 @@ void CommandInterpreter::LoadCommandDictionary() {
char buffer[1024];
int num_printed =
snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o");
- assert(num_printed < 1024);
+ lldbassert(num_printed < 1024);
UNUSED_IF_ASSERT_DISABLED(num_printed);
success =
tbreak_regex_cmd_ap->AddRegexCommand(break_regexes[i][0], buffer);
@@ -891,8 +891,8 @@ bool CommandInterpreter::AddCommand(llvm::StringRef name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace) {
if (cmd_sp.get())
- assert((this == &cmd_sp->GetCommandInterpreter()) &&
- "tried to add a CommandObject from a different interpreter");
+ lldbassert((this == &cmd_sp->GetCommandInterpreter()) &&
+ "tried to add a CommandObject from a different interpreter");
if (name.empty())
return false;
@@ -913,8 +913,8 @@ bool CommandInterpreter::AddUserCommand(llvm::StringRef name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace) {
if (cmd_sp.get())
- assert((this == &cmd_sp->GetCommandInterpreter()) &&
- "tried to add a CommandObject from a different interpreter");
+ lldbassert((this == &cmd_sp->GetCommandInterpreter()) &&
+ "tried to add a CommandObject from a different interpreter");
if (!name.empty()) {
// do not allow replacement of internal commands
@@ -1062,8 +1062,8 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name,
lldb::CommandObjectSP &command_obj_sp,
llvm::StringRef args_string) {
if (command_obj_sp.get())
- assert((this == &command_obj_sp->GetCommandInterpreter()) &&
- "tried to add a CommandObject from a different interpreter");
+ lldbassert((this == &command_obj_sp->GetCommandInterpreter()) &&
+ "tried to add a CommandObject from a different interpreter");
std::unique_ptr<CommandAlias> command_alias_up(
new CommandAlias(*this, command_obj_sp, args_string, alias_name));
@@ -1541,6 +1541,12 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
if (!no_context_switching)
UpdateExecutionContext(override_context);
+ if (WasInterrupted()) {
+ result.AppendError("interrupted");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
bool add_to_history;
if (lazy_add_to_history == eLazyBoolCalculate)
add_to_history = (m_command_source_depth == 0);
@@ -1839,7 +1845,7 @@ int CommandInterpreter::HandleCompletion(
matches.Clear();
// Only max_return_elements == -1 is supported at present:
- assert(max_return_elements == -1);
+ lldbassert(max_return_elements == -1);
bool word_complete;
num_command_matches = HandleCompletionMatches(
parsed_line, cursor_index, cursor_char_position, match_start_point,
@@ -2210,7 +2216,7 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
m_debugger.SetAsyncExecution(false);
}
- for (size_t idx = 0; idx < num_lines; idx++) {
+ for (size_t idx = 0; idx < num_lines && !WasInterrupted(); idx++) {
const char *cmd = commands.GetStringAtIndex(idx);
if (cmd[0] == '\0')
continue;
@@ -2569,7 +2575,7 @@ void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
while (!text.empty()) {
if (text.front() == '\n' ||
- (text.front() == ' ' && nextWordLength(text.ltrim(' ')) < chars_left)) {
+ (text.front() == ' ' && nextWordLength(text.ltrim(' ')) > chars_left)) {
strm.EOL();
strm.Indent();
chars_left = max_columns - indent_size;
@@ -2677,8 +2683,67 @@ size_t CommandInterpreter::GetProcessOutput() {
return total_bytes;
}
+void CommandInterpreter::StartHandlingCommand() {
+ auto idle_state = CommandHandlingState::eIdle;
+ if (m_command_state.compare_exchange_strong(
+ idle_state, CommandHandlingState::eInProgress))
+ lldbassert(m_iohandler_nesting_level == 0);
+ else
+ lldbassert(m_iohandler_nesting_level > 0);
+ ++m_iohandler_nesting_level;
+}
+
+void CommandInterpreter::FinishHandlingCommand() {
+ lldbassert(m_iohandler_nesting_level > 0);
+ if (--m_iohandler_nesting_level == 0) {
+ auto prev_state = m_command_state.exchange(CommandHandlingState::eIdle);
+ lldbassert(prev_state != CommandHandlingState::eIdle);
+ }
+}
+
+bool CommandInterpreter::InterruptCommand() {
+ auto in_progress = CommandHandlingState::eInProgress;
+ return m_command_state.compare_exchange_strong(
+ in_progress, CommandHandlingState::eInterrupted);
+}
+
+bool CommandInterpreter::WasInterrupted() const {
+ bool was_interrupted =
+ (m_command_state == CommandHandlingState::eInterrupted);
+ lldbassert(!was_interrupted || m_iohandler_nesting_level > 0);
+ return was_interrupted;
+}
+
+void CommandInterpreter::PrintCommandOutput(Stream &stream,
+ llvm::StringRef str) {
+ // Split the output into lines and poll for interrupt requests
+ const char *data = str.data();
+ size_t size = str.size();
+ while (size > 0 && !WasInterrupted()) {
+ size_t chunk_size = 0;
+ for (; chunk_size < size; ++chunk_size) {
+ lldbassert(data[chunk_size] != '\0');
+ if (data[chunk_size] == '\n') {
+ ++chunk_size;
+ break;
+ }
+ }
+ chunk_size = stream.Write(data, chunk_size);
+ lldbassert(size >= chunk_size);
+ data += chunk_size;
+ size -= chunk_size;
+ }
+ if (size > 0) {
+ stream.Printf("\n... Interrupted.\n");
+ }
+}
+
void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
std::string &line) {
+ // If we were interrupted, bail out...
+ if (WasInterrupted())
+ return;
+
const bool is_interactive = io_handler.GetIsInteractive();
if (is_interactive == false) {
// When we are not interactive, don't execute blank lines. This will happen
@@ -2700,6 +2765,8 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
line.c_str());
}
+ StartHandlingCommand();
+
lldb_private::CommandReturnObject result;
HandleCommand(line.c_str(), eLazyBoolCalculate, result);
@@ -2710,18 +2777,18 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
if (!result.GetImmediateOutputStream()) {
llvm::StringRef output = result.GetOutputData();
- if (!output.empty())
- io_handler.GetOutputStreamFile()->PutCString(output);
+ PrintCommandOutput(*io_handler.GetOutputStreamFile(), output);
}
// Now emit the command error text from the command we just executed
if (!result.GetImmediateErrorStream()) {
llvm::StringRef error = result.GetErrorData();
- if (!error.empty())
- io_handler.GetErrorStreamFile()->PutCString(error);
+ PrintCommandOutput(*io_handler.GetErrorStreamFile(), error);
}
}
+ FinishHandlingCommand();
+
switch (result.GetStatus()) {
case eReturnStatusInvalid:
case eReturnStatusSuccessFinishNoResult:
@@ -2777,6 +2844,9 @@ bool CommandInterpreter::IOHandlerInterrupt(IOHandler &io_handler) {
ExecutionContext exe_ctx(GetExecutionContext());
Process *process = exe_ctx.GetProcessPtr();
+ if (InterruptCommand())
+ return true;
+
if (process) {
StateType state = process->GetState();
if (StateIsRunningState(state)) {
@@ -2998,7 +3068,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
result.AppendRawError(error_msg.GetString());
} else {
// We didn't have only one match, otherwise we wouldn't get here.
- assert(num_matches == 0);
+ lldbassert(num_matches == 0);
result.AppendErrorWithFormat("'%s' is not a valid command.\n",
next_word.c_str());
}
diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp
index f9a5b10bb4b8..98a6a941864e 100644
--- a/source/Interpreter/CommandObject.cpp
+++ b/source/Interpreter/CommandObject.cpp
@@ -17,8 +17,8 @@
#include <stdlib.h>
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
// These are for the Sourcename completers.
// FIXME: Make a separate file for the completers.
@@ -57,7 +57,7 @@ llvm::StringRef CommandObject::GetHelp() { return m_cmd_help_short; }
llvm::StringRef CommandObject::GetHelpLong() { return m_cmd_help_long; }
llvm::StringRef CommandObject::GetSyntax() {
- if (m_cmd_syntax.empty())
+ if (!m_cmd_syntax.empty())
return m_cmd_syntax;
StreamString syntax_str;
@@ -1113,7 +1113,8 @@ CommandObject::ArgumentTableEntry CommandObject::g_arguments_data[] = {
{ eArgTypeWatchpointID, "watchpt-id", CommandCompletions::eNoCompletion, { nullptr, false }, "Watchpoint IDs are positive integers." },
{ eArgTypeWatchpointIDRange, "watchpt-id-list", CommandCompletions::eNoCompletion, { nullptr, false }, "For example, '1-3' or '1 to 3'." },
{ eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, { nullptr, false }, "Specify the type for a watchpoint." },
- { eArgRawInput, "raw-input", CommandCompletions::eNoCompletion, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." }
+ { eArgRawInput, "raw-input", CommandCompletions::eNoCompletion, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." },
+ { eArgTypeCommand, "command", CommandCompletions::eNoCompletion, { nullptr, false }, "An LLDB Command line command." }
// clang-format on
};
diff --git a/source/Interpreter/OptionGroupArchitecture.cpp b/source/Interpreter/OptionGroupArchitecture.cpp
index d5354fe0739c..bbd69b8f13fc 100644
--- a/source/Interpreter/OptionGroupArchitecture.cpp
+++ b/source/Interpreter/OptionGroupArchitecture.cpp
@@ -8,12 +8,8 @@
//===----------------------------------------------------------------------===//
#include "lldb/Interpreter/OptionGroupArchitecture.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
+#include "lldb/Target/Platform.h"
using namespace lldb;
using namespace lldb_private;
@@ -34,10 +30,7 @@ llvm::ArrayRef<OptionDefinition> OptionGroupArchitecture::GetDefinitions() {
bool OptionGroupArchitecture::GetArchitecture(Platform *platform,
ArchSpec &arch) {
- if (m_arch_str.empty())
- arch.Clear();
- else
- arch.SetTriple(m_arch_str.c_str(), platform);
+ arch = Platform::GetAugmentedArchSpec(platform, m_arch_str);
return arch.IsValid();
}
diff --git a/source/Interpreter/OptionGroupFormat.cpp b/source/Interpreter/OptionGroupFormat.cpp
index 7c4239f92642..75d8df950f18 100644
--- a/source/Interpreter/OptionGroupFormat.cpp
+++ b/source/Interpreter/OptionGroupFormat.cpp
@@ -9,11 +9,6 @@
#include "lldb/Interpreter/OptionGroupFormat.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/ExecutionContext.h"
diff --git a/source/Interpreter/OptionValueDictionary.cpp b/source/Interpreter/OptionValueDictionary.cpp
index b245a09c1951..a57ede486319 100644
--- a/source/Interpreter/OptionValueDictionary.cpp
+++ b/source/Interpreter/OptionValueDictionary.cpp
@@ -227,8 +227,7 @@ OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx,
}
assert(!temp.empty());
- llvm::StringRef key, value;
- llvm::StringRef quote_char;
+ llvm::StringRef key, quote_char;
if (temp[0] == '\"' || temp[0] == '\'') {
quote_char = temp.take_front();
diff --git a/source/Interpreter/ScriptInterpreter.cpp b/source/Interpreter/ScriptInterpreter.cpp
index 57f7eea6e4c1..497ad283f1a4 100644
--- a/source/Interpreter/ScriptInterpreter.cpp
+++ b/source/Interpreter/ScriptInterpreter.cpp
@@ -69,10 +69,9 @@ lldb::ScriptLanguage
ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) {
if (language.equals_lower(LanguageToString(eScriptLanguageNone)))
return eScriptLanguageNone;
- else if (language.equals_lower(LanguageToString(eScriptLanguagePython)))
+ if (language.equals_lower(LanguageToString(eScriptLanguagePython)))
return eScriptLanguagePython;
- else
- return eScriptLanguageUnknown;
+ return eScriptLanguageUnknown;
}
Status ScriptInterpreter::SetBreakpointCommandCallback(
diff --git a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
index fd5ee6ede4c3..1bd1c1bf8dd4 100644
--- a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
+++ b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
@@ -1413,10 +1413,6 @@ bool ABIMacOSX_arm::PrepareTrivialCall(Thread &thread, addr_t sp,
if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_num, return_addr))
return false;
- // Set "sp" to the requested value
- if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_num, sp))
- return false;
-
// If bit zero or 1 is set, this must be a thumb function, no need to figure
// this out from the symbols.
so_addr.SetLoadAddress(function_addr, target_sp.get());
@@ -1441,6 +1437,11 @@ bool ABIMacOSX_arm::PrepareTrivialCall(Thread &thread, addr_t sp,
function_addr &=
~1ull; // clear bit zero since the CPSR will take care of the mode for us
+ // Update the sp - stack pointer - to be aligned to 16-bytes
+ sp &= ~(0xfull);
+ if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_num, sp))
+ return false;
+
// Set "pc" to the address requested
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, function_addr))
return false;
diff --git a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
index f91ed851a3e5..dbe333c4649e 100644
--- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
+++ b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
@@ -2018,7 +2018,7 @@ bool ABISysV_arm64::RegisterIsVolatile(const RegisterInfo *reg_info) {
if (name[0] == 'l' && name[1] == 'r') // lr
return false;
- if (name[0] == 'x') {
+ if (name[0] == 'x' || name[0] == 'r') {
// Volatile registers: x0-x18
// Although documentation says only x19-28 + sp are callee saved
// We ll also have to treat x30 as non-volatile.
diff --git a/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
index 63da5a77b48f..d799c587dd07 100644
--- a/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
+++ b/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
@@ -205,11 +205,12 @@ ABISysV_i386::GetRegisterInfoArray(uint32_t &count) {
ABISP
ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
- if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
- arch.GetTriple().isOSLinux()) {
- if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_i386(process_sp));
- return g_abi_sp;
+ if (arch.GetTriple().getVendor() != llvm::Triple::Apple) {
+ if (arch.GetTriple().getArch() == llvm::Triple::x86) {
+ if (!g_abi_sp)
+ g_abi_sp.reset(new ABISysV_i386(process_sp));
+ return g_abi_sp;
+ }
}
return ABISP();
}
diff --git a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
index 06a8ce932fda..2fee176739f3 100644
--- a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
+++ b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
@@ -291,47 +291,6 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp,
RegisterValue reg_value;
-#if 0
- // This code adds an extra frame so that we don't lose the function that we came from
- // by pushing the PC and the FP and then writing the current FP to point to the FP value
- // we just pushed. It is disabled for now until the stack backtracing code can be debugged.
-
- // Save current PC
- const RegisterInfo *fp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP);
- if (reg_ctx->ReadRegister(pc_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current PC onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
-
- sp -= 8;
-
- // Save current FP
- if (reg_ctx->ReadRegister(fp_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current FP onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
- }
- // Setup FP backchain
- reg_value.SetUInt64 (sp);
-
- if (log)
- log->Printf("Writing FP: 0x%" PRIx64 " (for FP backchain)", reg_value.GetAsUInt64());
-
- if (!reg_ctx->WriteRegister(fp_reg_info, reg_value))
- {
- return false;
- }
-
- sp -= 8;
- }
-#endif
-
if (log)
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
": 0x%" PRIx64,
diff --git a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
index c090f01ccb1c..0348853c7fa0 100644
--- a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -291,47 +291,6 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
RegisterValue reg_value;
-#if 0
- // This code adds an extra frame so that we don't lose the function that we came from
- // by pushing the PC and the FP and then writing the current FP to point to the FP value
- // we just pushed. It is disabled for now until the stack backtracing code can be debugged.
-
- // Save current PC
- const RegisterInfo *fp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP);
- if (reg_ctx->ReadRegister(pc_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current PC onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
-
- sp -= 8;
-
- // Save current FP
- if (reg_ctx->ReadRegister(fp_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current FP onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
- }
- // Setup FP backchain
- reg_value.SetUInt64 (sp);
-
- if (log)
- log->Printf("Writing FP: 0x%" PRIx64 " (for FP backchain)", reg_value.GetAsUInt64());
-
- if (!reg_ctx->WriteRegister(fp_reg_info, reg_value))
- {
- return false;
- }
-
- sp -= 8;
- }
-#endif
-
if (log)
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
": 0x%" PRIx64,
diff --git a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 10bbae566491..41d146f24526 100644
--- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -13,6 +13,7 @@
// C++ Includes
// Other libraries and framework includes
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
// Project includes
@@ -1160,48 +1161,6 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
ProcessSP process_sp(thread.GetProcess());
RegisterValue reg_value;
-
-#if 0
- // This code adds an extra frame so that we don't lose the function that we came from
- // by pushing the PC and the FP and then writing the current FP to point to the FP value
- // we just pushed. It is disabled for now until the stack backtracing code can be debugged.
-
- // Save current PC
- const RegisterInfo *fp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP);
- if (reg_ctx->ReadRegister(pc_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current PC onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
-
- sp -= 8;
-
- // Save current FP
- if (reg_ctx->ReadRegister(fp_reg_info, reg_value))
- {
- if (log)
- log->Printf("Pushing the current FP onto the stack: 0x%" PRIx64 ": 0x%" PRIx64, (uint64_t)sp, reg_value.GetAsUInt64());
-
- if (!process_sp->WritePointerToMemory(sp, reg_value.GetAsUInt64(), error))
- return false;
- }
- // Setup FP backchain
- reg_value.SetUInt64 (sp);
-
- if (log)
- log->Printf("Writing FP: 0x%" PRIx64 " (for FP backchain)", reg_value.GetAsUInt64());
-
- if (!reg_ctx->WriteRegister(fp_reg_info, reg_value))
- {
- return false;
- }
-
- sp -= 8;
- }
-#endif
-
if (log)
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
": 0x%" PRIx64,
@@ -1908,52 +1867,16 @@ bool ABISysV_x86_64::RegisterIsVolatile(const RegisterInfo *reg_info) {
// It's being revised & updated at https://github.com/hjl-tools/x86-psABI/
bool ABISysV_x86_64::RegisterIsCalleeSaved(const RegisterInfo *reg_info) {
- if (reg_info) {
- // Preserved registers are :
- // rbx, rsp, rbp, r12, r13, r14, r15
- // mxcsr (partially preserved)
- // x87 control word
-
- const char *name = reg_info->name;
- if (name[0] == 'r') {
- switch (name[1]) {
- case '1': // r12, r13, r14, r15
- if (name[2] >= '2' && name[2] <= '5')
- return name[3] == '\0';
- break;
-
- default:
- break;
- }
- }
-
- // Accept shorter-variant versions, rbx/ebx, rip/ eip, etc.
- if (name[0] == 'r' || name[0] == 'e') {
- switch (name[1]) {
- case 'b': // rbp, rbx
- if (name[2] == 'p' || name[2] == 'x')
- return name[3] == '\0';
- break;
-
- case 'i': // rip
- if (name[2] == 'p')
- return name[3] == '\0';
- break;
-
- case 's': // rsp
- if (name[2] == 'p')
- return name[3] == '\0';
- break;
- }
- }
- if (name[0] == 's' && name[1] == 'p' && name[2] == '\0') // sp
- return true;
- if (name[0] == 'f' && name[1] == 'p' && name[2] == '\0') // fp
- return true;
- if (name[0] == 'p' && name[1] == 'c' && name[2] == '\0') // pc
- return true;
- }
- return false;
+ if (!reg_info)
+ return false;
+ assert(reg_info->name != nullptr && "unnamed register?");
+ std::string Name = std::string(reg_info->name);
+ bool IsCalleeSaved =
+ llvm::StringSwitch<bool>(Name)
+ .Cases("r12", "r13", "r14", "r15", "rbp", "ebp", "rbx", "ebx", true)
+ .Cases("rip", "eip", "rsp", "esp", "sp", "fp", "pc", true)
+ .Default(false);
+ return IsCalleeSaved;
}
void ABISysV_x86_64::Initialize() {
diff --git a/source/Plugins/Architecture/Arm/ArchitectureArm.cpp b/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
new file mode 100644
index 000000000000..abac6d3001af
--- /dev/null
+++ b/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
@@ -0,0 +1,131 @@
+//===-- ArchitectureArm.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Plugins/Architecture/Arm/ArchitectureArm.h"
+#include "Plugins/Process/Utility/ARMDefines.h"
+#include "Plugins/Process/Utility/InstructionUtils.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+ConstString ArchitectureArm::GetPluginNameStatic() {
+ return ConstString("arm");
+}
+
+void ArchitectureArm::Initialize() {
+ PluginManager::RegisterPlugin(GetPluginNameStatic(),
+ "Arm-specific algorithms",
+ &ArchitectureArm::Create);
+}
+
+void ArchitectureArm::Terminate() {
+ PluginManager::UnregisterPlugin(&ArchitectureArm::Create);
+}
+
+std::unique_ptr<Architecture> ArchitectureArm::Create(const ArchSpec &arch) {
+ if (arch.GetMachine() != llvm::Triple::arm)
+ return nullptr;
+ return std::unique_ptr<Architecture>(new ArchitectureArm());
+}
+
+ConstString ArchitectureArm::GetPluginName() { return GetPluginNameStatic(); }
+uint32_t ArchitectureArm::GetPluginVersion() { return 1; }
+
+void ArchitectureArm::OverrideStopInfo(Thread &thread) {
+ // We need to check if we are stopped in Thumb mode in a IT instruction
+ // and detect if the condition doesn't pass. If this is the case it means
+ // we won't actually execute this instruction. If this happens we need to
+ // clear the stop reason to no thread plans think we are stopped for a
+ // reason and the plans should keep going.
+ //
+ // We do this because when single stepping many ARM processes, debuggers
+ // often use the BVR/BCR registers that says "stop when the PC is not
+ // equal to its current value". This method of stepping means we can end
+ // up stopping on instructions inside an if/then block that wouldn't get
+ // executed. By fixing this we can stop the debugger from seeming like
+ // you stepped through both the "if" _and_ the "else" clause when source
+ // level stepping because the debugger stops regardless due to the BVR/BCR
+ // triggering a stop.
+ //
+ // It also means we can set breakpoints on instructions inside an an
+ // if/then block and correctly skip them if we use the BKPT instruction.
+ // The ARM and Thumb BKPT instructions are unconditional even when executed
+ // in a Thumb IT block.
+ //
+ // If your debugger inserts software traps in ARM/Thumb code, it will
+ // need to use 16 and 32 bit instruction for 16 and 32 bit thumb
+ // instructions respectively. If your debugger inserts a 16 bit thumb
+ // trap on top of a 32 bit thumb instruction for an opcode that is inside
+ // an if/then, it will change the it/then to conditionally execute your
+ // 16 bit trap and then cause your program to crash if it executes the
+ // trailing 16 bits (the second half of the 32 bit thumb instruction you
+ // partially overwrote).
+
+ RegisterContextSP reg_ctx_sp(thread.GetRegisterContext());
+ if (!reg_ctx_sp)
+ return;
+
+ const uint32_t cpsr = reg_ctx_sp->GetFlags(0);
+ if (cpsr == 0)
+ return;
+
+ // Read the J and T bits to get the ISETSTATE
+ const uint32_t J = Bit32(cpsr, 24);
+ const uint32_t T = Bit32(cpsr, 5);
+ const uint32_t ISETSTATE = J << 1 | T;
+ if (ISETSTATE == 0) {
+// NOTE: I am pretty sure we want to enable the code below
+// that detects when we stop on an instruction in ARM mode
+// that is conditional and the condition doesn't pass. This
+// can happen if you set a breakpoint on an instruction that
+// is conditional. We currently will _always_ stop on the
+// instruction which is bad. You can also run into this while
+// single stepping and you could appear to run code in the "if"
+// and in the "else" clause because it would stop at all of the
+// conditional instructions in both.
+// In such cases, we really don't want to stop at this location.
+// I will check with the lldb-dev list first before I enable this.
+#if 0
+ // ARM mode: check for condition on intsruction
+ const addr_t pc = reg_ctx_sp->GetPC();
+ Status error;
+ // If we fail to read the opcode we will get UINT64_MAX as the
+ // result in "opcode" which we can use to detect if we read a
+ // valid opcode.
+ const uint64_t opcode = thread.GetProcess()->ReadUnsignedIntegerFromMemory(pc, 4, UINT64_MAX, error);
+ if (opcode <= UINT32_MAX)
+ {
+ const uint32_t condition = Bits32((uint32_t)opcode, 31, 28);
+ if (!ARMConditionPassed(condition, cpsr))
+ {
+ // We ARE stopped on an ARM instruction whose condition doesn't
+ // pass so this instruction won't get executed.
+ // Regardless of why it stopped, we need to clear the stop info
+ thread.SetStopInfo (StopInfoSP());
+ }
+ }
+#endif
+ } else if (ISETSTATE == 1) {
+ // Thumb mode
+ const uint32_t ITSTATE = Bits32(cpsr, 15, 10) << 2 | Bits32(cpsr, 26, 25);
+ if (ITSTATE != 0) {
+ const uint32_t condition = Bits32(ITSTATE, 7, 4);
+ if (!ARMConditionPassed(condition, cpsr)) {
+ // We ARE stopped in a Thumb IT instruction on an instruction whose
+ // condition doesn't pass so this instruction won't get executed.
+ // Regardless of why it stopped, we need to clear the stop info
+ thread.SetStopInfo(StopInfoSP());
+ }
+ }
+ }
+}
diff --git a/source/Plugins/Architecture/Arm/ArchitectureArm.h b/source/Plugins/Architecture/Arm/ArchitectureArm.h
new file mode 100644
index 000000000000..9ce6c69ef271
--- /dev/null
+++ b/source/Plugins/Architecture/Arm/ArchitectureArm.h
@@ -0,0 +1,35 @@
+//===-- ArchitectureArm.h ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_PLUGIN_ARCHITECTURE_ARM_H
+#define LLDB_PLUGIN_ARCHITECTURE_ARM_H
+
+#include "lldb/Core/Architecture.h"
+
+namespace lldb_private {
+
+class ArchitectureArm : public Architecture {
+public:
+ static ConstString GetPluginNameStatic();
+ static void Initialize();
+ static void Terminate();
+
+ ConstString GetPluginName() override;
+ uint32_t GetPluginVersion() override;
+
+ void OverrideStopInfo(Thread &thread) override;
+
+private:
+ static std::unique_ptr<Architecture> Create(const ArchSpec &arch);
+ ArchitectureArm() = default;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_PLUGIN_ARCHITECTURE_ARM_H
diff --git a/source/Plugins/Architecture/Arm/CMakeLists.txt b/source/Plugins/Architecture/Arm/CMakeLists.txt
new file mode 100644
index 000000000000..60bbe69a99fb
--- /dev/null
+++ b/source/Plugins/Architecture/Arm/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_lldb_library(lldbPluginArchitectureArm PLUGIN
+ ArchitectureArm.cpp
+
+ LINK_LIBS
+ lldbPluginProcessUtility
+ lldbCore
+ lldbTarget
+ lldbUtility
+ LINK_COMPONENTS
+ Support
+ )
diff --git a/source/Plugins/Architecture/CMakeLists.txt b/source/Plugins/Architecture/CMakeLists.txt
new file mode 100644
index 000000000000..5abaa8e68231
--- /dev/null
+++ b/source/Plugins/Architecture/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Arm)
diff --git a/source/Plugins/CMakeLists.txt b/source/Plugins/CMakeLists.txt
index ac1afcbc331e..5092b210a12c 100644
--- a/source/Plugins/CMakeLists.txt
+++ b/source/Plugins/CMakeLists.txt
@@ -1,4 +1,5 @@
add_subdirectory(ABI)
+add_subdirectory(Architecture)
add_subdirectory(Disassembler)
add_subdirectory(DynamicLoader)
add_subdirectory(ExpressionParser)
diff --git a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index a82b3fe267b3..a81a0306671e 100644
--- a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -1229,6 +1229,16 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries(
break;
}
}
+ // If this "kext" entry is actually an alias for the kernel --
+ // the kext was compiled into the kernel or something -- then
+ // we don't want to load the kernel's text section at a different
+ // address. Ignore this kext entry.
+ if (kext_summaries[new_kext].GetUUID().IsValid()
+ && m_kernel.GetUUID().IsValid()
+ && kext_summaries[new_kext].GetUUID() == m_kernel.GetUUID()) {
+ to_be_added[new_kext] = false;
+ break;
+ }
if (add_this_one) {
number_of_new_kexts_being_added++;
}
@@ -1397,7 +1407,7 @@ bool DynamicLoaderDarwinKernel::ReadAllKextSummaries() {
void DynamicLoaderDarwinKernel::KextImageInfo::PutToLog(Log *log) const {
if (log == NULL)
return;
- const uint8_t *u = (uint8_t *)m_uuid.GetBytes();
+ const uint8_t *u = static_cast<const uint8_t *>(m_uuid.GetBytes());
if (m_load_address == LLDB_INVALID_ADDRESS) {
if (u) {
diff --git a/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
index 1ef1be5d0adb..c49cdc2f11b1 100644
--- a/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
+++ b/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index c1986976b0fc..e601d64f0d8d 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
@@ -18,6 +14,7 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
index c381326ebf4f..6502d7a7a58c 100644
--- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -11,8 +11,11 @@
#include "DynamicLoaderWindowsDYLD.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
+#include "lldb/Target/ThreadPlanStepInstruction.h"
#include "llvm/ADT/Triple.h"
@@ -72,5 +75,44 @@ uint32_t DynamicLoaderWindowsDYLD::GetPluginVersion() { return 1; }
ThreadPlanSP
DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread,
bool stop) {
- return ThreadPlanSP();
+ auto arch = m_process->GetTarget().GetArchitecture();
+ if (arch.GetMachine() != llvm::Triple::x86) {
+ return ThreadPlanSP();
+ }
+
+ uint64_t pc = thread.GetRegisterContext()->GetPC();
+ // Max size of an instruction in x86 is 15 bytes.
+ AddressRange range(pc, 2 * 15);
+
+ ExecutionContext exe_ctx(m_process->GetTarget());
+ DisassemblerSP disassembler_sp = Disassembler::DisassembleRange(
+ arch, nullptr, nullptr, exe_ctx, range, true);
+ if (!disassembler_sp) {
+ return ThreadPlanSP();
+ }
+
+ InstructionList *insn_list = &disassembler_sp->GetInstructionList();
+ if (insn_list == nullptr) {
+ return ThreadPlanSP();
+ }
+
+ // First instruction in a x86 Windows trampoline is going to be an indirect
+ // jump through the IAT and the next one will be a nop (usually there for
+ // alignment purposes). e.g.:
+ // 0x70ff4cfc <+956>: jmpl *0x7100c2a8
+ // 0x70ff4d02 <+962>: nop
+
+ auto first_insn = insn_list->GetInstructionAtIndex(0);
+ auto second_insn = insn_list->GetInstructionAtIndex(1);
+
+ if (first_insn == nullptr || second_insn == nullptr ||
+ strcmp(first_insn->GetMnemonic(&exe_ctx), "jmpl") != 0 ||
+ strcmp(second_insn->GetMnemonic(&exe_ctx), "nop") != 0) {
+ return ThreadPlanSP();
+ }
+
+ assert(first_insn->DoesBranch() && !second_insn->DoesBranch());
+
+ return ThreadPlanSP(new ThreadPlanStepInstruction(
+ thread, false, false, eVoteNoOpinion, eVoteNoOpinion));
}
diff --git a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 7622791778ba..7f031356b3c3 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -51,8 +51,94 @@ private:
};
}
+ClangASTSource::ClangASTSource(const lldb::TargetSP &target)
+ : m_import_in_progress(false), m_lookups_enabled(false), m_target(target),
+ m_ast_context(NULL), m_active_lexical_decls(), m_active_lookups() {
+ if (!target->GetUseModernTypeLookup()) {
+ m_ast_importer_sp = m_target->GetClangASTImporter();
+ }
+}
+
+void ClangASTSource::InstallASTContext(clang::ASTContext &ast_context,
+ clang::FileManager &file_manager,
+ bool is_shared_context) {
+ m_ast_context = &ast_context;
+ m_file_manager = &file_manager;
+ if (m_target->GetUseModernTypeLookup()) {
+ // Configure the ExternalASTMerger. The merger needs to be able to import
+ // types from any source that we would do lookups in, which includes the
+ // persistent AST context as well as the modules and Objective-C runtime
+ // AST contexts.
+
+ lldbassert(!m_merger_up);
+ clang::ExternalASTMerger::ImporterTarget target = {ast_context,
+ file_manager};
+ std::vector<clang::ExternalASTMerger::ImporterSource> sources;
+ for (lldb::ModuleSP module_sp : m_target->GetImages().Modules()) {
+ if (auto *module_ast_ctx = llvm::cast_or_null<ClangASTContext>(
+ module_sp->GetTypeSystemForLanguage(lldb::eLanguageTypeC))) {
+ lldbassert(module_ast_ctx->getASTContext());
+ lldbassert(module_ast_ctx->getFileManager());
+ sources.push_back({*module_ast_ctx->getASTContext(),
+ *module_ast_ctx->getFileManager(),
+ module_ast_ctx->GetOriginMap()
+ });
+ }
+ }
+
+ do {
+ lldb::ProcessSP process(m_target->GetProcessSP());
+
+ if (!process)
+ break;
+
+ ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+
+ if (!language_runtime)
+ break;
+
+ DeclVendor *runtime_decl_vendor = language_runtime->GetDeclVendor();
+
+ if (!runtime_decl_vendor)
+ break;
+
+ sources.push_back(runtime_decl_vendor->GetImporterSource());
+ } while (0);
+
+ do {
+ DeclVendor *modules_decl_vendor =
+ m_target->GetClangModulesDeclVendor();
+
+ if (!modules_decl_vendor)
+ break;
+
+ sources.push_back(modules_decl_vendor->GetImporterSource());
+ } while (0);
+
+ if (!is_shared_context) {
+ // Update the scratch AST context's merger to reflect any new sources we
+ // might have come across since the last time an expression was parsed.
+
+ auto scratch_ast_context = static_cast<ClangASTContextForExpressions*>(
+ m_target->GetScratchClangASTContext());
+
+ scratch_ast_context->GetMergerUnchecked().AddSources(sources);
+
+ sources.push_back({*scratch_ast_context->getASTContext(),
+ *scratch_ast_context->getFileManager(),
+ scratch_ast_context->GetOriginMap()});
+ } while (0);
+
+ m_merger_up =
+ llvm::make_unique<clang::ExternalASTMerger>(target, sources);
+ } else {
+ m_ast_importer_sp->InstallMapCompleter(&ast_context, *this);
+ }
+}
+
ClangASTSource::~ClangASTSource() {
- m_ast_importer_sp->ForgetDestination(m_ast_context);
+ if (m_ast_importer_sp)
+ m_ast_importer_sp->ForgetDestination(m_ast_context);
// We are in the process of destruction, don't create clang ast context on
// demand
@@ -69,7 +155,7 @@ ClangASTSource::~ClangASTSource() {
if (!scratch_ast_context)
return;
- if (m_ast_context != scratch_ast_context)
+ if (m_ast_context != scratch_ast_context && m_ast_importer_sp)
m_ast_importer_sp->ForgetSource(scratch_ast_context, m_ast_context);
}
@@ -203,6 +289,13 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
m_active_lexical_decls.insert(tag_decl);
ScopedLexicalDeclEraser eraser(m_active_lexical_decls, tag_decl);
+ if (!m_ast_importer_sp) {
+ if (HasMerger()) {
+ GetMergerUnchecked().CompleteType(tag_decl);
+ }
+ return;
+ }
+
if (!m_ast_importer_sp->CompleteTagDecl(tag_decl)) {
// We couldn't complete the type. Maybe there's a definition
// somewhere else that can be completed.
@@ -337,6 +430,22 @@ void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) {
dumper.ToLog(log, " [COID] ");
}
+ if (!m_ast_importer_sp) {
+ if (HasMerger()) {
+ ObjCInterfaceDecl *complete_iface_decl =
+ GetCompleteObjCInterface(interface_decl);
+
+ if (complete_iface_decl && (complete_iface_decl != interface_decl)) {
+ m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()});
+ }
+
+ GetMergerUnchecked().CompleteType(interface_decl);
+ } else {
+ lldbassert(0 && "No mechanism for completing a type!");
+ }
+ return;
+ }
+
Decl *original_decl = NULL;
ASTContext *original_ctx = NULL;
@@ -367,7 +476,7 @@ void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) {
}
clang::ObjCInterfaceDecl *ClangASTSource::GetCompleteObjCInterface(
- clang::ObjCInterfaceDecl *interface_decl) {
+ const clang::ObjCInterfaceDecl *interface_decl) {
lldb::ProcessSP process(m_target->GetProcessSP());
if (!process)
@@ -411,6 +520,22 @@ void ClangASTSource::FindExternalLexicalDecls(
const DeclContext *decl_context,
llvm::function_ref<bool(Decl::Kind)> predicate,
llvm::SmallVectorImpl<Decl *> &decls) {
+
+ if (HasMerger()) {
+ if (auto *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl_context)) {
+ ObjCInterfaceDecl *complete_iface_decl =
+ GetCompleteObjCInterface(interface_decl);
+
+ if (complete_iface_decl && (complete_iface_decl != interface_decl)) {
+ m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()});
+ }
+ }
+ return GetMergerUnchecked().FindExternalLexicalDecls(decl_context,
+ predicate,
+ decls);
+ } else if (!m_ast_importer_sp)
+ return;
+
ClangASTMetrics::RegisterLexicalQuery();
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -507,8 +632,7 @@ void ClangASTSource::FindExternalLexicalDecls(
decl->getDeclKindName(), ast_dumper.GetCString());
}
- Decl *copied_decl =
- m_ast_importer_sp->CopyDecl(m_ast_context, original_ctx, decl);
+ Decl *copied_decl = CopyDecl(decl);
if (!copied_decl)
continue;
@@ -568,12 +692,31 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
name.GetCString(), context.m_decl_context->getDeclKindName());
}
+ if (HasMerger() && !isa<TranslationUnitDecl>(context.m_decl_context)
+ /* possibly handle NamespaceDecls here? */) {
+ if (auto *interface_decl =
+ dyn_cast<ObjCInterfaceDecl>(context.m_decl_context)) {
+ ObjCInterfaceDecl *complete_iface_decl =
+ GetCompleteObjCInterface(interface_decl);
+
+ if (complete_iface_decl && (complete_iface_decl != interface_decl)) {
+ GetMergerUnchecked().ForceRecordOrigin(
+ interface_decl,
+ {complete_iface_decl, &complete_iface_decl->getASTContext()});
+ }
+ }
+
+ GetMergerUnchecked().FindExternalVisibleDeclsByName(context.m_decl_context,
+ context.m_decl_name);
+ return; // otherwise we may need to fall back
+ }
+
context.m_namespace_map.reset(new ClangASTImporter::NamespaceMap);
if (const NamespaceDecl *namespace_context =
dyn_cast<NamespaceDecl>(context.m_decl_context)) {
- ClangASTImporter::NamespaceMapSP namespace_map =
- m_ast_importer_sp->GetNamespaceMap(namespace_context);
+ ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer_sp ?
+ m_ast_importer_sp->GetNamespaceMap(namespace_context) : nullptr;
if (log && log->GetVerbose())
log->Printf(" CAS::FEVD[%u] Inspecting namespace map %p (%d entries)",
@@ -593,7 +736,7 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
FindExternalVisibleDecls(context, i->first, i->second, current_id);
}
- } else if (isa<ObjCInterfaceDecl>(context.m_decl_context)) {
+ } else if (isa<ObjCInterfaceDecl>(context.m_decl_context) && !HasMerger()) {
FindObjCPropertyAndIvarDecls(context);
} else if (!isa<TranslationUnitDecl>(context.m_decl_context)) {
// we shouldn't be getting FindExternalVisibleDecls calls for these
@@ -623,6 +766,25 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
}
}
+bool ClangASTSource::IgnoreName(const ConstString name,
+ bool ignore_all_dollar_names) {
+ static const ConstString id_name("id");
+ static const ConstString Class_name("Class");
+
+ if (name == id_name || name == Class_name)
+ return true;
+
+ StringRef name_string_ref = name.GetStringRef();
+
+ // The ClangASTSource is not responsible for finding $-names.
+ if (name_string_ref.empty() ||
+ (ignore_all_dollar_names && name_string_ref.startswith("$")) ||
+ name_string_ref.startswith("_$"))
+ return true;
+
+ return false;
+}
+
void ClangASTSource::FindExternalVisibleDecls(
NameSearchContext &context, lldb::ModuleSP module_sp,
CompilerDeclContext &namespace_decl, unsigned int current_id) {
@@ -633,20 +795,7 @@ void ClangASTSource::FindExternalVisibleDecls(
SymbolContextList sc_list;
const ConstString name(context.m_decl_name.getAsString().c_str());
-
- const char *name_unique_cstr = name.GetCString();
-
- static ConstString id_name("id");
- static ConstString Class_name("Class");
-
- if (name == id_name || name == Class_name)
- return;
-
- if (name_unique_cstr == NULL)
- return;
-
- // The ClangASTSource is not responsible for finding $-names.
- if (name_unique_cstr[0] == '$')
+ if (IgnoreName(name, true))
return;
if (module_sp && namespace_decl) {
@@ -671,7 +820,7 @@ void ClangASTSource::FindExternalVisibleDecls(
module_sp->GetFileSpec().GetFilename().GetCString());
}
}
- } else {
+ } else if (!HasMerger()) {
const ModuleList &target_images = m_target->GetImages();
std::lock_guard<std::recursive_mutex> guard(target_images.GetMutex());
@@ -774,9 +923,7 @@ void ClangASTSource::FindExternalVisibleDecls(
if (llvm::isa<clang::TypeDecl>(decl_from_modules) ||
llvm::isa<clang::ObjCContainerDecl>(decl_from_modules) ||
llvm::isa<clang::EnumConstantDecl>(decl_from_modules)) {
- clang::Decl *copied_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, &decl_from_modules->getASTContext(),
- decl_from_modules);
+ clang::Decl *copied_decl = CopyDecl(decl_from_modules);
clang::NamedDecl *copied_named_decl =
copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
@@ -831,8 +978,7 @@ void ClangASTSource::FindExternalVisibleDecls(
current_id, name.GetCString());
}
- clang::Decl *copied_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, &decls[0]->getASTContext(), decls[0]);
+ clang::Decl *copied_decl = CopyDecl(decls[0]);
clang::NamedDecl *copied_named_decl =
copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
@@ -875,7 +1021,7 @@ public:
DeclFromParser() : TaggedASTDecl<D>() {}
DeclFromParser(D *_decl) : TaggedASTDecl<D>(_decl) {}
- DeclFromUser<D> GetOrigin(ClangASTImporter *importer);
+ DeclFromUser<D> GetOrigin(ClangASTSource &source);
};
template <class D> class DeclFromUser : public TaggedASTDecl<D> {
@@ -883,32 +1029,29 @@ public:
DeclFromUser() : TaggedASTDecl<D>() {}
DeclFromUser(D *_decl) : TaggedASTDecl<D>(_decl) {}
- DeclFromParser<D> Import(ClangASTImporter *importer, ASTContext &dest_ctx);
+ DeclFromParser<D> Import(ClangASTSource &source);
};
template <class D>
-DeclFromUser<D> DeclFromParser<D>::GetOrigin(ClangASTImporter *importer) {
+DeclFromUser<D> DeclFromParser<D>::GetOrigin(ClangASTSource &source) {
DeclFromUser<> origin_decl;
- importer->ResolveDeclOrigin(this->decl, &origin_decl.decl, NULL);
+ source.ResolveDeclOrigin(this->decl, &origin_decl.decl, NULL);
if (origin_decl.IsInvalid())
return DeclFromUser<D>();
return DeclFromUser<D>(dyn_cast<D>(origin_decl.decl));
}
template <class D>
-DeclFromParser<D> DeclFromUser<D>::Import(ClangASTImporter *importer,
- ASTContext &dest_ctx) {
- DeclFromParser<> parser_generic_decl(
- importer->CopyDecl(&dest_ctx, &this->decl->getASTContext(), this->decl));
+DeclFromParser<D> DeclFromUser<D>::Import(ClangASTSource &source) {
+ DeclFromParser<> parser_generic_decl(source.CopyDecl(this->decl));
if (parser_generic_decl.IsInvalid())
return DeclFromParser<D>();
return DeclFromParser<D>(dyn_cast<D>(parser_generic_decl.decl));
}
-static bool FindObjCMethodDeclsWithOrigin(
+bool ClangASTSource::FindObjCMethodDeclsWithOrigin(
unsigned int current_id, NameSearchContext &context,
- ObjCInterfaceDecl *original_interface_decl, clang::ASTContext *ast_context,
- ClangASTImporter *ast_importer, const char *log_info) {
+ ObjCInterfaceDecl *original_interface_decl, const char *log_info) {
const DeclarationName &decl_name(context.m_decl_name);
clang::ASTContext *original_ctx = &original_interface_decl->getASTContext();
@@ -967,8 +1110,7 @@ static bool FindObjCMethodDeclsWithOrigin(
if (!result_method)
continue;
- Decl *copied_decl = ast_importer->CopyDecl(
- ast_context, &result_method->getASTContext(), result_method);
+ Decl *copied_decl = CopyDecl(result_method);
if (!copied_decl)
continue;
@@ -995,6 +1137,21 @@ static bool FindObjCMethodDeclsWithOrigin(
void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+ if (HasMerger()) {
+ if (auto *interface_decl = dyn_cast<ObjCInterfaceDecl>(context.m_decl_context)) {
+ ObjCInterfaceDecl *complete_iface_decl =
+ GetCompleteObjCInterface(interface_decl);
+
+ if (complete_iface_decl && (complete_iface_decl != context.m_decl_context)) {
+ m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()});
+ }
+ }
+
+ GetMergerUnchecked().FindExternalVisibleDeclsByName(context.m_decl_context,
+ context.m_decl_name);
+ return;
+ }
+
static unsigned int invocation_id = 0;
unsigned int current_id = invocation_id++;
@@ -1021,8 +1178,7 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
dyn_cast<ObjCInterfaceDecl>(original_decl);
if (FindObjCMethodDeclsWithOrigin(current_id, context,
- original_interface_decl, m_ast_context,
- m_ast_importer_sp.get(), "at origin"))
+ original_interface_decl, "at origin"))
return; // found it, no need to look any further
} while (0);
@@ -1160,8 +1316,7 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
continue;
if (found_interface_decl->getName() == interface_decl->getName()) {
- Decl *copied_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, &method_decl->getASTContext(), method_decl);
+ Decl *copied_decl = CopyDecl(method_decl);
if (!copied_decl)
continue;
@@ -1210,7 +1365,6 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
static_cast<void *>(&complete_iface_decl->getASTContext()));
FindObjCMethodDeclsWithOrigin(current_id, context, complete_interface_decl,
- m_ast_context, m_ast_importer_sp.get(),
"in debug info");
return;
@@ -1238,8 +1392,7 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
break;
if (FindObjCMethodDeclsWithOrigin(
- current_id, context, interface_decl_from_modules, m_ast_context,
- m_ast_importer_sp.get(), "in modules"))
+ current_id, context, interface_decl_from_modules, "in modules"))
return;
}
} while (0);
@@ -1278,14 +1431,12 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
break;
FindObjCMethodDeclsWithOrigin(current_id, context, runtime_interface_decl,
- m_ast_context, m_ast_importer_sp.get(),
"in runtime");
} while (0);
}
static bool FindObjCPropertyAndIvarDeclsWithOrigin(
- unsigned int current_id, NameSearchContext &context,
- clang::ASTContext &ast_context, ClangASTImporter *ast_importer,
+ unsigned int current_id, NameSearchContext &context, ClangASTSource &source,
DeclFromUser<const ObjCInterfaceDecl> &origin_iface_decl) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -1305,7 +1456,7 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin(
if (origin_property_decl.IsValid()) {
DeclFromParser<ObjCPropertyDecl> parser_property_decl(
- origin_property_decl.Import(ast_importer, ast_context));
+ origin_property_decl.Import(source));
if (parser_property_decl.IsValid()) {
if (log) {
ASTDumper dumper((Decl *)parser_property_decl.decl);
@@ -1323,7 +1474,7 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin(
if (origin_ivar_decl.IsValid()) {
DeclFromParser<ObjCIvarDecl> parser_ivar_decl(
- origin_ivar_decl.Import(ast_importer, ast_context));
+ origin_ivar_decl.Import(source));
if (parser_ivar_decl.IsValid()) {
if (log) {
ASTDumper dumper((Decl *)parser_ivar_decl.decl);
@@ -1348,7 +1499,7 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
DeclFromParser<const ObjCInterfaceDecl> parser_iface_decl(
cast<ObjCInterfaceDecl>(context.m_decl_context));
DeclFromUser<const ObjCInterfaceDecl> origin_iface_decl(
- parser_iface_decl.GetOrigin(m_ast_importer_sp.get()));
+ parser_iface_decl.GetOrigin(*this));
ConstString class_name(parser_iface_decl->getNameAsString().c_str());
@@ -1360,8 +1511,7 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
context.m_decl_name.getAsString().c_str());
if (FindObjCPropertyAndIvarDeclsWithOrigin(
- current_id, context, *m_ast_context, m_ast_importer_sp.get(),
- origin_iface_decl))
+ current_id, context, *this, origin_iface_decl))
return;
if (log)
@@ -1397,8 +1547,7 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
static_cast<const void *>(complete_iface_decl.decl),
static_cast<void *>(&complete_iface_decl->getASTContext()));
- FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *m_ast_context,
- m_ast_importer_sp.get(),
+ FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
complete_iface_decl);
return;
@@ -1435,9 +1584,8 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
static_cast<const void *>(interface_decl_from_modules.decl),
static_cast<void *>(&interface_decl_from_modules->getASTContext()));
- if (FindObjCPropertyAndIvarDeclsWithOrigin(
- current_id, context, *m_ast_context, m_ast_importer_sp.get(),
- interface_decl_from_modules))
+ if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
+ interface_decl_from_modules))
return;
} while (0);
@@ -1483,8 +1631,7 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
static_cast<void *>(&interface_decl_from_runtime->getASTContext()));
if (FindObjCPropertyAndIvarDeclsWithOrigin(
- current_id, context, *m_ast_context, m_ast_importer_sp.get(),
- interface_decl_from_runtime))
+ current_id, context, *this, interface_decl_from_runtime))
return;
} while (0);
}
@@ -1495,7 +1642,7 @@ typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetMap;
template <class D, class O>
static bool ImportOffsetMap(llvm::DenseMap<const D *, O> &destination_map,
llvm::DenseMap<const D *, O> &source_map,
- ClangASTImporter *importer, ASTContext &dest_ctx) {
+ ClangASTSource &source) {
// When importing fields into a new record, clang has a hard requirement that
// fields be imported in field offset order. Since they are stored in a
// DenseMap
@@ -1516,7 +1663,7 @@ static bool ImportOffsetMap(llvm::DenseMap<const D *, O> &destination_map,
for (const auto &item : sorted_items) {
DeclFromUser<D> user_decl(const_cast<D *>(item.first));
- DeclFromParser<D> parser_decl(user_decl.Import(importer, dest_ctx));
+ DeclFromParser<D> parser_decl(user_decl.Import(source));
if (parser_decl.IsInvalid())
return false;
destination_map.insert(
@@ -1593,7 +1740,7 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
DeclFromParser<const RecordDecl> parser_record(record);
DeclFromUser<const RecordDecl> origin_record(
- parser_record.GetOrigin(m_ast_importer_sp.get()));
+ parser_record.GetOrigin(*this));
if (origin_record.IsInvalid())
return false;
@@ -1629,7 +1776,7 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
field_idx++;
}
- ASTContext &parser_ast_context(record->getASTContext());
+ lldbassert(&record->getASTContext() == m_ast_context);
DeclFromUser<const CXXRecordDecl> origin_cxx_record(
DynCast<const CXXRecordDecl>(origin_record));
@@ -1642,12 +1789,10 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
return false;
}
- if (!ImportOffsetMap(field_offsets, origin_field_offsets,
- m_ast_importer_sp.get(), parser_ast_context) ||
- !ImportOffsetMap(base_offsets, origin_base_offsets,
- m_ast_importer_sp.get(), parser_ast_context) ||
+ if (!ImportOffsetMap(field_offsets, origin_field_offsets, *this) ||
+ !ImportOffsetMap(base_offsets, origin_base_offsets, *this) ||
!ImportOffsetMap(virtual_base_offsets, origin_virtual_base_offsets,
- m_ast_importer_sp.get(), parser_ast_context))
+ *this))
return false;
size = record_layout.getSize().getQuantity() * m_ast_context->getCharWidth();
@@ -1811,8 +1956,7 @@ NamespaceDecl *ClangASTSource::AddNamespace(
if (!src_namespace_decl)
return nullptr;
- Decl *copied_decl =
- m_ast_importer_sp->CopyDecl(m_ast_context, src_ast, src_namespace_decl);
+ Decl *copied_decl = CopyDecl(src_namespace_decl);
if (!copied_decl)
return nullptr;
@@ -1830,6 +1974,54 @@ NamespaceDecl *ClangASTSource::AddNamespace(
return dyn_cast<NamespaceDecl>(copied_decl);
}
+clang::QualType ClangASTSource::CopyTypeWithMerger(
+ clang::ASTContext &from_context,
+ clang::ExternalASTMerger &merger,
+ clang::QualType type) {
+ if (!merger.HasImporterForOrigin(from_context)) {
+ lldbassert(0 && "Couldn't find the importer for a source context!");
+ return QualType();
+ }
+
+ return merger.ImporterForOrigin(from_context).Import(type);
+}
+
+clang::Decl *ClangASTSource::CopyDecl(Decl *src_decl) {
+ clang::ASTContext &from_context = src_decl->getASTContext();
+ if (m_ast_importer_sp) {
+ return m_ast_importer_sp->CopyDecl(m_ast_context, &from_context, src_decl);
+ } else if (m_merger_up) {
+ if (!m_merger_up->HasImporterForOrigin(from_context)) {
+ lldbassert(0 && "Couldn't find the importer for a source context!");
+ return nullptr;
+ }
+
+ return m_merger_up->ImporterForOrigin(from_context).Import(src_decl);
+ } else {
+ lldbassert(0 && "No mechanism for copying a decl!");
+ return nullptr;
+ }
+}
+
+bool ClangASTSource::ResolveDeclOrigin(const clang::Decl *decl,
+ clang::Decl **original_decl,
+ clang::ASTContext **original_ctx) {
+ if (m_ast_importer_sp) {
+ return m_ast_importer_sp->ResolveDeclOrigin(decl, original_decl,
+ original_ctx);
+ } else if (m_merger_up) {
+ return false; // Implement this correctly in ExternalASTMerger
+ } else {
+ // this can happen early enough that no ExternalASTSource is installed.
+ return false;
+ }
+}
+
+clang::ExternalASTMerger &ClangASTSource::GetMergerUnchecked() {
+ lldbassert(m_merger_up != nullptr);
+ return *m_merger_up;
+}
+
CompilerType ClangASTSource::GuardedCopyType(const CompilerType &src_type) {
ClangASTContext *src_ast =
llvm::dyn_cast_or_null<ClangASTContext>(src_type.GetTypeSystem());
@@ -1840,9 +2032,20 @@ CompilerType ClangASTSource::GuardedCopyType(const CompilerType &src_type) {
SetImportInProgress(true);
- QualType copied_qual_type =
- m_ast_importer_sp->CopyType(m_ast_context, src_ast->getASTContext(),
- ClangUtil::GetQualType(src_type));
+ QualType copied_qual_type;
+
+ if (m_ast_importer_sp) {
+ copied_qual_type =
+ m_ast_importer_sp->CopyType(m_ast_context, src_ast->getASTContext(),
+ ClangUtil::GetQualType(src_type));
+ } else if (m_merger_up) {
+ copied_qual_type =
+ CopyTypeWithMerger(*src_ast->getASTContext(), *m_merger_up,
+ ClangUtil::GetQualType(src_type));
+ } else {
+ lldbassert(0 && "No mechanism for copying a type!");
+ return CompilerType();
+ }
SetImportInProgress(false);
diff --git a/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
index 6362f04cf488..6f72ad92dc8c 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
+++ b/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
@@ -16,6 +16,7 @@
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Target.h"
+#include "clang/AST/ExternalASTMerger.h"
#include "clang/Basic/IdentifierTable.h"
#include "llvm/ADT/SmallSet.h"
@@ -41,14 +42,10 @@ public:
///
/// Initializes class variables.
///
- /// @param[in] declMap
- /// A reference to the LLDB object that handles entity lookup.
+ /// @param[in] target
+ /// A reference to the target containing debug information to use.
//------------------------------------------------------------------
- ClangASTSource(const lldb::TargetSP &target)
- : m_import_in_progress(false), m_lookups_enabled(false), m_target(target),
- m_ast_context(NULL), m_active_lexical_decls(), m_active_lookups() {
- m_ast_importer_sp = m_target->GetClangASTImporter();
- }
+ ClangASTSource(const lldb::TargetSP &target);
//------------------------------------------------------------------
/// Destructor
@@ -70,10 +67,9 @@ public:
}
void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; }
- void InstallASTContext(clang::ASTContext *ast_context) {
- m_ast_context = ast_context;
- m_ast_importer_sp->InstallMapCompleter(ast_context, *this);
- }
+ void InstallASTContext(clang::ASTContext &ast_context,
+ clang::FileManager &file_manager,
+ bool is_shared_context = false);
//
// APIs for ExternalASTSource
@@ -313,7 +309,7 @@ protected:
/// the complete interface otherwise.
//------------------------------------------------------------------
clang::ObjCInterfaceDecl *
- GetCompleteObjCInterface(clang::ObjCInterfaceDecl *interface_decl);
+ GetCompleteObjCInterface(const clang::ObjCInterfaceDecl *interface_decl);
//------------------------------------------------------------------
/// Find all entities matching a given name in a given module,
@@ -376,6 +372,89 @@ protected:
//------------------------------------------------------------------
CompilerType GuardedCopyType(const CompilerType &src_type);
+public:
+ //------------------------------------------------------------------
+ /// Returns true if a name should be ignored by name lookup.
+ ///
+ /// @param[in] name
+ /// The name to be considered.
+ ///
+ /// @param[in] ignore_all_dollar_nmmes
+ /// True if $-names of all sorts should be ignored.
+ ///
+ /// @return
+ /// True if the name is one of a class of names that are ignored by
+ /// global lookup for performance reasons.
+ //------------------------------------------------------------------
+ bool IgnoreName(const ConstString name, bool ignore_all_dollar_names);
+
+public:
+ //------------------------------------------------------------------
+ /// Copies a single Decl into the parser's AST context.
+ ///
+ /// @param[in] src_decl
+ /// The Decl to copy.
+ ///
+ /// @return
+ /// A copy of the Decl in m_ast_context, or NULL if the copy failed.
+ //------------------------------------------------------------------
+ clang::Decl *CopyDecl(clang::Decl *src_decl);
+
+ //------------------------------------------------------------------
+ /// Copies a single Type to the target of the given ExternalASTMerger.
+ ///
+ /// @param[in] src_context
+ /// The ASTContext containing the type.
+ ///
+ /// @param[in] merger
+ /// The merger to use. This isn't just *m_merger_up because it might be
+ /// the persistent AST context's merger.
+ ///
+ /// @param[in] type
+ /// The type to copy.
+ ///
+ /// @return
+ /// A copy of the Type in the merger's target context.
+ //------------------------------------------------------------------
+ clang::QualType CopyTypeWithMerger(clang::ASTContext &src_context,
+ clang::ExternalASTMerger &merger,
+ clang::QualType type);
+
+ //------------------------------------------------------------------
+ /// Determined the origin of a single Decl, if it can be found.
+ ///
+ /// @param[in] decl
+ /// The Decl whose origin is to be found.
+ ///
+ /// @param[out] original_decl
+ /// A pointer whose target is filled in with the original Decl.
+ ///
+ /// @param[in] original_ctx
+ /// A pointer whose target is filled in with the original's ASTContext.
+ ///
+ /// @return
+ /// True if lookup succeeded; false otherwise.
+ //------------------------------------------------------------------
+ bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
+ clang::ASTContext **original_ctx);
+
+ //------------------------------------------------------------------
+ /// Returns m_merger_up. Only call this if the target is configured to use
+ /// modern lookup,
+ //------------------------------------------------------------------
+ clang::ExternalASTMerger &GetMergerUnchecked();
+
+ //------------------------------------------------------------------
+ /// Returns true if there is a merger. This only occurs if the target is
+ /// using modern lookup.
+ //------------------------------------------------------------------
+ bool HasMerger() { return (bool)m_merger_up; }
+
+protected:
+ bool FindObjCMethodDeclsWithOrigin(
+ unsigned int current_id, NameSearchContext &context,
+ clang::ObjCInterfaceDecl *original_interface_decl, const char *log_info);
+
friend struct NameSearchContext;
bool m_import_in_progress;
@@ -385,7 +464,11 @@ protected:
m_target; ///< The target to use in finding variables and types.
clang::ASTContext
*m_ast_context; ///< The AST context requests are coming in for.
+ clang::FileManager
+ *m_file_manager; ///< The file manager paired with the AST context.
lldb::ClangASTImporterSP m_ast_importer_sp; ///< The target's AST importer.
+ std::unique_ptr<clang::ExternalASTMerger> m_merger_up;
+ ///< The ExternalASTMerger for this parse.
std::set<const clang::Decl *> m_active_lexical_decls;
std::set<const char *> m_active_lookups;
};
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 8fde41052192..07ff2e97aac7 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -48,8 +48,10 @@
#include "lldb/lldb-private.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTImporter.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclarationName.h"
+#include "clang/AST/RecursiveASTVisitor.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -178,6 +180,134 @@ ClangExpressionDeclMap::TargetInfo ClangExpressionDeclMap::GetTargetInfo() {
return ret;
}
+namespace {
+/// This class walks an AST and ensures that all DeclContexts defined inside the
+/// current source file are properly complete.
+///
+/// This is used to ensure that persistent types defined in the current source
+/// file migrate completely to the persistent AST context before they are
+/// reused. If that didn't happen, it would be impoossible to complete them
+/// because their origin would be gone.
+///
+/// The stragtegy used by this class is to check the SourceLocation (to be
+/// specific, the FileID) and see if it's the FileID for the current expression.
+/// Alternate strategies could include checking whether an ExternalASTMerger,
+/// set up to not have the current context as a source, can find an original for
+/// the type.
+class Completer : public clang::RecursiveASTVisitor<Completer> {
+private:
+ clang::ASTImporter &m_exporter; /// Used to import Decl contents
+ clang::FileID m_file; /// The file that's going away
+ llvm::DenseSet<clang::Decl *> m_completed; /// Visited Decls, to avoid cycles
+
+ bool ImportAndCheckCompletable(clang::Decl *decl) {
+ (void)m_exporter.Import(decl);
+ if (m_completed.count(decl))
+ return false;
+ if (!llvm::isa<DeclContext>(decl))
+ return false;
+ const clang::SourceLocation loc = decl->getLocation();
+ if (!loc.isValid())
+ return false;
+ const clang::FileID file =
+ m_exporter.getFromContext().getSourceManager().getFileID(loc);
+ if (file != m_file)
+ return false;
+ // We are assuming the Decl was parsed in this very expression, so it should
+ // not have external storage.
+ lldbassert(!llvm::cast<DeclContext>(decl)->hasExternalLexicalStorage());
+ return true;
+ }
+
+ void Complete(clang::Decl *decl) {
+ m_completed.insert(decl);
+ auto *decl_context = llvm::cast<DeclContext>(decl);
+ (void)m_exporter.Import(decl);
+ m_exporter.CompleteDecl(decl);
+ for (Decl *child : decl_context->decls())
+ if (ImportAndCheckCompletable(child))
+ Complete(child);
+ }
+
+ void MaybeComplete(clang::Decl *decl) {
+ if (ImportAndCheckCompletable(decl))
+ Complete(decl);
+ }
+
+public:
+ Completer(clang::ASTImporter &exporter, clang::FileID file)
+ : m_exporter(exporter), m_file(file) {}
+
+ // Implements the RecursiveASTVisitor's core API. It is called on each Decl
+ // that the RecursiveASTVisitor encounters, and returns true if the traversal
+ // should continue.
+ bool VisitDecl(clang::Decl *decl) {
+ MaybeComplete(decl);
+ return true;
+ }
+};
+}
+
+static void CompleteAllDeclContexts(clang::ASTImporter &exporter,
+ clang::FileID file,
+ clang::QualType root) {
+ clang::QualType canonical_type = root.getCanonicalType();
+ if (clang::TagDecl *tag_decl = canonical_type->getAsTagDecl()) {
+ Completer(exporter, file).TraverseDecl(tag_decl);
+ } else if (auto interface_type = llvm::dyn_cast<ObjCInterfaceType>(
+ canonical_type.getTypePtr())) {
+ Completer(exporter, file).TraverseDecl(interface_type->getDecl());
+ } else {
+ Completer(exporter, file).TraverseType(canonical_type);
+ }
+}
+
+static clang::QualType ExportAllDeclaredTypes(
+ clang::ExternalASTMerger &merger,
+ clang::ASTContext &source, clang::FileManager &source_file_manager,
+ const clang::ExternalASTMerger::OriginMap &source_origin_map,
+ clang::FileID file, clang::QualType root) {
+ clang::ExternalASTMerger::ImporterSource importer_source =
+ { source, source_file_manager, source_origin_map };
+ merger.AddSources(importer_source);
+ clang::ASTImporter &exporter = merger.ImporterForOrigin(source);
+ CompleteAllDeclContexts(exporter, file, root);
+ clang::QualType ret = exporter.Import(root);
+ merger.RemoveSources(importer_source);
+ return ret;
+}
+
+TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target,
+ ClangASTContext &source,
+ TypeFromParser parser_type) {
+ assert (&target == m_target->GetScratchClangASTContext());
+ assert ((TypeSystem*)&source == parser_type.GetTypeSystem());
+ assert (source.getASTContext() == m_ast_context);
+
+ if (m_ast_importer_sp) {
+ return TypeFromUser(m_ast_importer_sp->DeportType(
+ target.getASTContext(), source.getASTContext(),
+ parser_type.GetOpaqueQualType()),
+ &target);
+ } else if (m_merger_up) {
+ clang::FileID source_file =
+ source.getASTContext()->getSourceManager().getFileID(
+ source.getASTContext()->getTranslationUnitDecl()->getLocation());
+ auto scratch_ast_context = static_cast<ClangASTContextForExpressions*>(
+ m_target->GetScratchClangASTContext());
+ clang::QualType exported_type = ExportAllDeclaredTypes(
+ scratch_ast_context->GetMergerUnchecked(),
+ *source.getASTContext(), *source.getFileManager(),
+ m_merger_up->GetOrigins(),
+ source_file,
+ clang::QualType::getFromOpaquePtr(parser_type.GetOpaqueQualType()));
+ return TypeFromUser(exported_type.getAsOpaquePtr(), &target);
+ } else {
+ lldbassert(0 && "No mechanism for deporting a type!");
+ return TypeFromUser();
+ }
+}
+
bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
const ConstString &name,
TypeFromParser parser_type,
@@ -198,12 +328,8 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
if (target == nullptr)
return false;
- ClangASTContext *context(target->GetScratchClangASTContext());
-
- TypeFromUser user_type(m_ast_importer_sp->DeportType(
- context->getASTContext(), ast->getASTContext(),
- parser_type.GetOpaqueQualType()),
- context);
+ TypeFromUser user_type =
+ DeportType(*target->GetScratchClangASTContext(), *ast, parser_type);
uint32_t offset = m_parser_vars->m_materializer->AddResultVariable(
user_type, is_lvalue, m_keep_result_in_memory, m_result_delegate, err);
@@ -240,10 +366,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
ClangASTContext *context(target->GetScratchClangASTContext());
- TypeFromUser user_type(m_ast_importer_sp->DeportType(
- context->getASTContext(), ast->getASTContext(),
- parser_type.GetOpaqueQualType()),
- context);
+ TypeFromUser user_type = DeportType(*context, *ast, parser_type);
if (!user_type.GetOpaqueQualType()) {
if (log)
@@ -688,16 +811,18 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
}
ClangASTImporter::NamespaceMapSP namespace_map =
- m_ast_importer_sp->GetNamespaceMap(namespace_context);
+ m_ast_importer_sp
+ ? m_ast_importer_sp->GetNamespaceMap(namespace_context)
+ : ClangASTImporter::NamespaceMapSP();
+
+ if (!namespace_map)
+ return;
if (log && log->GetVerbose())
log->Printf(" CEDM::FEVD[%u] Inspecting (NamespaceMap*)%p (%d entries)",
current_id, static_cast<void *>(namespace_map.get()),
(int)namespace_map->size());
-
- if (!namespace_map)
- return;
-
+
for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(),
e = namespace_map->end();
i != e; ++i) {
@@ -739,16 +864,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
SymbolContextList sc_list;
const ConstString name(context.m_decl_name.getAsString().c_str());
-
- const char *name_unique_cstr = name.GetCString();
-
- if (name_unique_cstr == NULL)
- return;
-
- static ConstString id_name("id");
- static ConstString Class_name("Class");
-
- if (name == id_name || name == Class_name)
+ if (IgnoreName(name, false))
return;
// Only look for functions by name out in our symbols if the function
@@ -784,8 +900,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
if (!persistent_decl)
break;
- Decl *parser_persistent_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, scratch_ast_context, persistent_decl);
+ Decl *parser_persistent_decl = CopyDecl(persistent_decl);
if (!parser_persistent_decl)
break;
@@ -809,7 +924,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
} while (0);
}
- if (name_unique_cstr[0] == '$' && !namespace_decl) {
+ if (name.GetCString()[0] == '$' && !namespace_decl) {
static ConstString g_lldb_class_name("$__lldb_class");
if (name == g_lldb_class_name) {
@@ -1041,7 +1156,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
if (ast) {
clang::NamespaceDecl *namespace_decl =
ClangASTContext::GetUniqueNamespaceDeclaration(
- m_ast_context, name_unique_cstr, nullptr);
+ m_ast_context, name.GetCString(), nullptr);
if (namespace_decl) {
context.AddNamedDecl(namespace_decl);
clang::DeclContext *clang_decl_ctx =
@@ -1056,7 +1171,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
}
// any other $__lldb names should be weeded out now
- if (!::strncmp(name_unique_cstr, "$__lldb", sizeof("$__lldb") - 1))
+ if (name.GetStringRef().startswith("$__lldb"))
return;
ExpressionVariableSP pvar_sp(
@@ -1329,8 +1444,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
for (clang::NamedDecl *decl : decls_from_modules) {
if (llvm::isa<clang::FunctionDecl>(decl)) {
clang::NamedDecl *copied_decl =
- llvm::cast_or_null<FunctionDecl>(m_ast_importer_sp->CopyDecl(
- m_ast_context, &decl->getASTContext(), decl));
+ llvm::cast_or_null<FunctionDecl>(CopyDecl(decl));
if (copied_decl) {
context.AddNamedDecl(copied_decl);
context.m_found.function_with_type_info = true;
@@ -1372,9 +1486,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
current_id, name.GetCString());
}
- clang::Decl *copied_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, &decl_from_modules->getASTContext(),
- decl_from_modules);
+ clang::Decl *copied_decl = CopyDecl(decl_from_modules);
clang::FunctionDecl *copied_function_decl =
copied_decl ? dyn_cast<clang::FunctionDecl>(copied_decl)
: nullptr;
@@ -1401,9 +1513,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
current_id, name.GetCString());
}
- clang::Decl *copied_decl = m_ast_importer_sp->CopyDecl(
- m_ast_context, &decl_from_modules->getASTContext(),
- decl_from_modules);
+ clang::Decl *copied_decl = CopyDecl(decl_from_modules);
clang::VarDecl *copied_var_decl =
copied_decl ? dyn_cast_or_null<clang::VarDecl>(copied_decl)
: nullptr;
@@ -1430,17 +1540,17 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
// a generic
// data symbol, and -- if it is found -- treat it as a variable.
Status error;
-
+
const Symbol *data_symbol =
m_parser_vars->m_sym_ctx.FindBestGlobalDataSymbol(name, error);
-
+
if (!error.Success()) {
const unsigned diag_id =
m_ast_context->getDiagnostics().getCustomDiagID(
clang::DiagnosticsEngine::Level::Error, "%0");
m_ast_context->getDiagnostics().Report(diag_id) << error.AsCString();
}
-
+
if (data_symbol) {
std::string warning("got name from symbols: ");
warning.append(name.AsCString());
@@ -1455,49 +1565,6 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
}
}
-// static opaque_compiler_type_t
-// MaybePromoteToBlockPointerType
-//(
-// ASTContext *ast_context,
-// opaque_compiler_type_t candidate_type
-//)
-//{
-// if (!candidate_type)
-// return candidate_type;
-//
-// QualType candidate_qual_type = QualType::getFromOpaquePtr(candidate_type);
-//
-// const PointerType *candidate_pointer_type =
-// dyn_cast<PointerType>(candidate_qual_type);
-//
-// if (!candidate_pointer_type)
-// return candidate_type;
-//
-// QualType pointee_qual_type = candidate_pointer_type->getPointeeType();
-//
-// const RecordType *pointee_record_type =
-// dyn_cast<RecordType>(pointee_qual_type);
-//
-// if (!pointee_record_type)
-// return candidate_type;
-//
-// RecordDecl *pointee_record_decl = pointee_record_type->getDecl();
-//
-// if (!pointee_record_decl->isRecord())
-// return candidate_type;
-//
-// if
-// (!pointee_record_decl->getName().startswith(llvm::StringRef("__block_literal_")))
-// return candidate_type;
-//
-// QualType generic_function_type =
-// ast_context->getFunctionNoProtoType(ast_context->UnknownAnyTy);
-// QualType block_pointer_type =
-// ast_context->getBlockPointerType(generic_function_type);
-//
-// return block_pointer_type.getAsOpaquePtr();
-//}
-
bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
lldb_private::Value &var_location,
TypeFromUser *user_type,
@@ -1537,7 +1604,6 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
"There is no AST context for the current execution context");
return false;
}
- // var_clang_type = MaybePromoteToBlockPointerType (ast, var_clang_type);
DWARFExpression &var_location_expr = var->LocationExpression();
@@ -1762,7 +1828,9 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
- ClangASTContext *scratch_ast_context = target->GetScratchClangASTContext();
+ ClangASTContextForExpressions *scratch_ast_context =
+ static_cast<ClangASTContextForExpressions*>(
+ target->GetScratchClangASTContext());
for (size_t index = 0, num_entities = m_found_entities.GetSize();
index < num_entities; ++index) {
@@ -1793,9 +1861,20 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
var_type.getAsOpaquePtr(),
ClangASTContext::GetASTContext(&var_decl->getASTContext()));
- lldb::opaque_compiler_type_t copied_type = m_ast_importer_sp->CopyType(
- scratch_ast_context->getASTContext(), &var_decl->getASTContext(),
- var_type.getAsOpaquePtr());
+ lldb::opaque_compiler_type_t copied_type = 0;
+ if (m_ast_importer_sp) {
+ copied_type = m_ast_importer_sp->CopyType(
+ scratch_ast_context->getASTContext(), &var_decl->getASTContext(),
+ var_type.getAsOpaquePtr());
+ } else if (HasMerger()) {
+ copied_type = CopyTypeWithMerger(
+ var_decl->getASTContext(),
+ scratch_ast_context->GetMergerUnchecked(),
+ var_type).getAsOpaquePtr();
+ } else {
+ lldbassert(0 && "No mechanism to copy a resolved unknown type!");
+ return false;
+ }
if (!copied_type) {
if (log)
@@ -1892,8 +1971,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
if (!extern_c) {
TypeSystem *type_system = function->GetDeclContext().GetTypeSystem();
- if (ClangASTContext *src_ast =
- llvm::dyn_cast<ClangASTContext>(type_system)) {
+ if (llvm::isa<ClangASTContext>(type_system)) {
clang::DeclContext *src_decl_context =
(clang::DeclContext *)function->GetDeclContext()
.GetOpaqueDeclContext();
@@ -1905,9 +1983,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
src_function_decl->getTemplateSpecializationInfo()->getTemplate();
clang::FunctionTemplateDecl *copied_function_template =
llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>(
- m_ast_importer_sp->CopyDecl(m_ast_context,
- src_ast->getASTContext(),
- function_template));
+ CopyDecl(function_template));
if (copied_function_template) {
if (log) {
ASTDumper ast_dumper((clang::Decl *)copied_function_template);
@@ -1928,9 +2004,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
} else if (src_function_decl) {
if (clang::FunctionDecl *copied_function_decl =
llvm::dyn_cast_or_null<clang::FunctionDecl>(
- m_ast_importer_sp->CopyDecl(m_ast_context,
- src_ast->getASTContext(),
- src_function_decl))) {
+ CopyDecl(src_function_decl))) {
if (log) {
ASTDumper ast_dumper((clang::Decl *)copied_function_decl);
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index e8a9ba6862db..d163ad4f7e29 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -613,6 +613,23 @@ private:
void AddThisType(NameSearchContext &context, TypeFromUser &type,
unsigned int current_id);
+ //------------------------------------------------------------------
+ /// Move a type out of the current ASTContext into another, but make sure to
+ /// export all components of the type also.
+ ///
+ /// @param[in] target
+ /// The ClangASTContext to move to.
+ /// @param[in] source
+ /// The ClangASTContext to move from. This is assumed to be going away.
+ /// @param[in] parser_type
+ /// The type as it appears in the source context.
+ ///
+ /// @return
+ /// Returns the moved type, or an empty type if there was a problem.
+ //------------------------------------------------------------------
+ TypeFromUser DeportType(ClangASTContext &target, ClangASTContext &source,
+ TypeFromParser parser_type);
+
ClangASTContext *GetClangASTContext();
};
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 4e20be79f68b..d9e53074b3fb 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -66,7 +66,6 @@
#include "ClangPersistentVariables.h"
#include "IRForTarget.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
@@ -351,7 +350,6 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
LLDB_LOGV(log, "LinkerVersion: '{0}'", opts.LinkerVersion);
StringList::LogDump(log, opts.FeaturesAsWritten, "FeaturesAsWritten");
StringList::LogDump(log, opts.Features, "Features");
- StringList::LogDump(log, opts.Reciprocals, "Reciprocals");
}
// 4. Create and install the target on the compiler.
@@ -391,6 +389,14 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
// FIXME: the following language option is a temporary workaround,
// to "ask for ObjC, get ObjC++" (see comment above).
m_compiler->getLangOpts().CPlusPlus = true;
+
+ // Clang now sets as default C++14 as the default standard (with
+ // GNU extensions), so we do the same here to avoid mismatches that
+ // cause compiler error when evaluating expressions (e.g. nullptr
+ // not found as it's a C++11 feature). Currently lldb evaluates
+ // C++14 as C++11 (see two lines below) so we decide to be consistent
+ // with that, but this could be re-evaluated in the future.
+ m_compiler->getLangOpts().CPlusPlus11 = true;
break;
case lldb::eLanguageTypeC_plus_plus:
case lldb::eLanguageTypeC_plus_plus_11:
@@ -526,7 +532,7 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
if (decl_map) {
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> ast_source(
decl_map->CreateProxy());
- decl_map->InstallASTContext(ast_context.get());
+ decl_map->InstallASTContext(*ast_context, m_compiler->getFileManager());
ast_context->setExternalSource(ast_source);
}
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
index 3e6a109a4af3..41f290f2e127 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
+++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
@@ -10,10 +10,10 @@
#ifndef liblldb_ClangExpressionParser_h_
#define liblldb_ClangExpressionParser_h_
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/ExpressionParser.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-public.h"
diff --git a/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
index 56d1d8412f78..0596d8fde7b9 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
+++ b/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
@@ -17,7 +17,6 @@
#include "ClangExpressionHelper.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectList.h"
diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index bce0eaf6d57e..b42ceb9afee8 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -85,6 +85,7 @@ public:
void ForEachMacro(const ModuleVector &modules,
std::function<bool(const std::string &)> handler) override;
+ clang::ExternalASTMerger::ImporterSource GetImporterSource() override;
private:
void
ReportModuleExportsHelper(std::set<ClangModulesDeclVendor::ModuleID> &exports,
@@ -109,6 +110,7 @@ private:
typedef std::set<ModuleID> ImportedModuleSet;
ImportedModuleMap m_imported_modules;
ImportedModuleSet m_user_imported_modules;
+ const clang::ExternalASTMerger::OriginMap m_origin_map;
};
} // anonymous namespace
@@ -548,6 +550,12 @@ ClangModulesDeclVendorImpl::DoGetModule(clang::ModuleIdPath path,
is_inclusion_directive);
}
+clang::ExternalASTMerger::ImporterSource
+ClangModulesDeclVendorImpl::GetImporterSource() {
+ return {m_compiler_instance->getASTContext(),
+ m_compiler_instance->getFileManager(), m_origin_map};
+}
+
static const char *ModuleImportBufferName = "LLDBModulesMemoryBuffer";
lldb_private::ClangModulesDeclVendor *
diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
index fbabcd736865..23769ccfb0c0 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
+++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
@@ -10,7 +10,6 @@
#ifndef liblldb_ClangModulesDeclVendor_h
#define liblldb_ClangModulesDeclVendor_h
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Target/Platform.h"
diff --git a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 2a6261a6df4d..18fe8b49227b 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -347,7 +347,6 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
//
ApplyObjcCastHack(m_expr_text);
- // ApplyUnicharHack(m_expr_text);
std::string prefix = m_expr_prefix;
diff --git a/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
index 065e5db4c9f8..0f2aeef27e57 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -138,15 +138,6 @@ bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager,
}
}
-#if 0
- // jingham: look here
- StreamFile logfile ("/tmp/exprs.txt", "a");
- logfile.Printf ("0x%16.16" PRIx64 ": func = %s, source =\n%s\n",
- m_jit_start_addr,
- m_function_name.c_str(),
- m_function_text.c_str());
-#endif
-
DeclMap()->DidParse();
ResetDeclMap();
diff --git a/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
index d0ef688f0773..262a7914d249 100644
--- a/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ b/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -12,12 +12,12 @@
#include "EmulateInstructionARM.h"
#include "EmulationStateARM.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Plugins/Instruction/ARM/EmulationStateARM.cpp b/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
index 5e90965c1881..d1032f56f31c 100644
--- a/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
+++ b/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
@@ -203,7 +203,8 @@ size_t EmulationStateARM::WritePseudoMemory(
uint32_t value1;
uint32_t value2;
memcpy (&value1, dst, sizeof (uint32_t));
- memcpy (&value2, (uint8_t *) dst + sizeof (uint32_t), sizeof (uint32_t));
+ memcpy(&value2, static_cast<const uint8_t *>(dst) + sizeof(uint32_t),
+ sizeof(uint32_t));
if (endian::InlHostByteOrder() == lldb::eByteOrderBig) {
value1 = llvm::ByteSwap_32(value1);
value2 = llvm::ByteSwap_32(value2);
diff --git a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
index 54dd237eb4b7..d882108c25f4 100644
--- a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
+++ b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
@@ -12,10 +12,10 @@
#include <stdlib.h>
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Stream.h"
@@ -167,10 +167,7 @@ EmulateInstructionARM64::CreateInstance(const ArchSpec &arch,
if (EmulateInstructionARM64::SupportsEmulatingInstructionsOfTypeStatic(
inst_type)) {
if (arch.GetTriple().getArch() == llvm::Triple::aarch64) {
- std::auto_ptr<EmulateInstructionARM64> emulate_insn_ap(
- new EmulateInstructionARM64(arch));
- if (emulate_insn_ap.get())
- return emulate_insn_ap.release();
+ return new EmulateInstructionARM64(arch);
}
}
diff --git a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
index 4d1d89abb1d0..db3d8fc1b8ca 100644
--- a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
+++ b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
@@ -12,12 +12,12 @@
#include <stdlib.h>
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Stream.h"
@@ -212,10 +212,7 @@ EmulateInstructionMIPS::CreateInstance(const ArchSpec &arch,
inst_type)) {
if (arch.GetTriple().getArch() == llvm::Triple::mips ||
arch.GetTriple().getArch() == llvm::Triple::mipsel) {
- std::auto_ptr<EmulateInstructionMIPS> emulate_insn_ap(
- new EmulateInstructionMIPS(arch));
- if (emulate_insn_ap.get())
- return emulate_insn_ap.release();
+ return new EmulateInstructionMIPS(arch);
}
}
diff --git a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
index 1e6d98756958..d298589afdd9 100644
--- a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
+++ b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
@@ -12,12 +12,12 @@
#include <stdlib.h>
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Stream.h"
@@ -199,10 +199,7 @@ EmulateInstructionMIPS64::CreateInstance(const ArchSpec &arch,
inst_type)) {
if (arch.GetTriple().getArch() == llvm::Triple::mips64 ||
arch.GetTriple().getArch() == llvm::Triple::mips64el) {
- std::auto_ptr<EmulateInstructionMIPS64> emulate_insn_ap(
- new EmulateInstructionMIPS64(arch));
- if (emulate_insn_ap.get())
- return emulate_insn_ap.release();
+ return new EmulateInstructionMIPS64(arch);
}
}
@@ -801,7 +798,9 @@ EmulateInstructionMIPS64::GetOpcodeForInstruction(const char *op_name) {
// Branch instructions
//----------------------------------------------------------------------
{"BEQ", &EmulateInstructionMIPS64::Emulate_BXX_3ops, "BEQ rs,rt,offset"},
+ {"BEQ64", &EmulateInstructionMIPS64::Emulate_BXX_3ops, "BEQ rs,rt,offset"},
{"BNE", &EmulateInstructionMIPS64::Emulate_BXX_3ops, "BNE rs,rt,offset"},
+ {"BNE64", &EmulateInstructionMIPS64::Emulate_BXX_3ops, "BNE rs,rt,offset"},
{"BEQL", &EmulateInstructionMIPS64::Emulate_BXX_3ops,
"BEQL rs,rt,offset"},
{"BNEL", &EmulateInstructionMIPS64::Emulate_BXX_3ops,
@@ -814,6 +813,7 @@ EmulateInstructionMIPS64::GetOpcodeForInstruction(const char *op_name) {
{"BALC", &EmulateInstructionMIPS64::Emulate_BALC, "BALC offset"},
{"BC", &EmulateInstructionMIPS64::Emulate_BC, "BC offset"},
{"BGEZ", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGEZ rs,offset"},
+ {"BGEZ64", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGEZ rs,offset"},
{"BLEZALC", &EmulateInstructionMIPS64::Emulate_Bcond_Link_C,
"BLEZALC rs,offset"},
{"BGEZALC", &EmulateInstructionMIPS64::Emulate_Bcond_Link_C,
@@ -828,34 +828,61 @@ EmulateInstructionMIPS64::GetOpcodeForInstruction(const char *op_name) {
"BNEZALC rs,offset"},
{"BEQC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BEQC rs,rt,offset"},
+ {"BEQC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BEQC rs,rt,offset"},
{"BNEC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BNEC rs,rt,offset"},
+ {"BNEC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BNEC rs,rt,offset"},
{"BLTC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BLTC rs,rt,offset"},
+ {"BLTC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BLTC rs,rt,offset"},
{"BGEC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BGEC rs,rt,offset"},
+ {"BGEC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BGEC rs,rt,offset"},
{"BLTUC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BLTUC rs,rt,offset"},
+ {"BLTUC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BLTUC rs,rt,offset"},
{"BGEUC", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
"BGEUC rs,rt,offset"},
+ {"BGEUC64", &EmulateInstructionMIPS64::Emulate_BXX_3ops_C,
+ "BGEUC rs,rt,offset"},
{"BLTZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BLTZC rt,offset"},
+ {"BLTZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BLTZC rt,offset"},
{"BLEZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BLEZC rt,offset"},
+ {"BLEZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BLEZC rt,offset"},
{"BGEZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BGEZC rt,offset"},
+ {"BGEZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BGEZC rt,offset"},
{"BGTZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BGTZC rt,offset"},
+ {"BGTZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BGTZC rt,offset"},
{"BEQZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BEQZC rt,offset"},
+ {"BEQZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BEQZC rt,offset"},
{"BNEZC", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
"BNEZC rt,offset"},
+ {"BNEZC64", &EmulateInstructionMIPS64::Emulate_BXX_2ops_C,
+ "BNEZC rt,offset"},
{"BGEZL", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGEZL rt,offset"},
{"BGTZ", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGTZ rt,offset"},
+ {"BGTZ64", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGTZ rt,offset"},
{"BGTZL", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BGTZL rt,offset"},
{"BLEZ", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BLEZ rt,offset"},
+ {"BLEZ64", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BLEZ rt,offset"},
{"BLEZL", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BLEZL rt,offset"},
{"BLTZ", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BLTZ rt,offset"},
+ {"BLTZ64", &EmulateInstructionMIPS64::Emulate_BXX_2ops, "BLTZ rt,offset"},
{"BLTZAL", &EmulateInstructionMIPS64::Emulate_Bcond_Link,
"BLTZAL rt,offset"},
{"BLTZALL", &EmulateInstructionMIPS64::Emulate_Bcond_Link,
@@ -872,8 +899,11 @@ EmulateInstructionMIPS64::GetOpcodeForInstruction(const char *op_name) {
{"JALR64", &EmulateInstructionMIPS64::Emulate_JALR, "JALR target"},
{"JALR_HB", &EmulateInstructionMIPS64::Emulate_JALR, "JALR.HB target"},
{"JIALC", &EmulateInstructionMIPS64::Emulate_JIALC, "JIALC rt,offset"},
+ {"JIALC64", &EmulateInstructionMIPS64::Emulate_JIALC, "JIALC rt,offset"},
{"JIC", &EmulateInstructionMIPS64::Emulate_JIC, "JIC rt,offset"},
+ {"JIC64", &EmulateInstructionMIPS64::Emulate_JIC, "JIC rt,offset"},
{"JR", &EmulateInstructionMIPS64::Emulate_JR, "JR target"},
+ {"JR64", &EmulateInstructionMIPS64::Emulate_JR, "JR target"},
{"JR_HB", &EmulateInstructionMIPS64::Emulate_JR, "JR.HB target"},
{"BC1F", &EmulateInstructionMIPS64::Emulate_FP_branch, "BC1F cc, offset"},
{"BC1T", &EmulateInstructionMIPS64::Emulate_FP_branch, "BC1T cc, offset"},
@@ -1338,12 +1368,14 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops(llvm::MCInst &insn) {
if (!success)
return false;
- if (!strcasecmp(op_name, "BEQ") || !strcasecmp(op_name, "BEQL")) {
+ if (!strcasecmp(op_name, "BEQ") || !strcasecmp(op_name, "BEQL")
+ || !strcasecmp(op_name, "BEQ64") ) {
if (rs_val == rt_val)
target = pc + offset;
else
target = pc + 8;
- } else if (!strcasecmp(op_name, "BNE") || !strcasecmp(op_name, "BNEL")) {
+ } else if (!strcasecmp(op_name, "BNE") || !strcasecmp(op_name, "BNEL")
+ || !strcasecmp(op_name, "BNE64")) {
if (rs_val != rt_val)
target = pc + offset;
else
@@ -1563,22 +1595,26 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops(llvm::MCInst &insn) {
if (!success)
return false;
- if (!strcasecmp(op_name, "BLTZL") || !strcasecmp(op_name, "BLTZ")) {
+ if (!strcasecmp(op_name, "BLTZL") || !strcasecmp(op_name, "BLTZ")
+ || !strcasecmp(op_name, "BLTZ64")) {
if (rs_val < 0)
target = pc + offset;
else
target = pc + 8;
- } else if (!strcasecmp(op_name, "BGEZL") || !strcasecmp(op_name, "BGEZ")) {
+ } else if (!strcasecmp(op_name, "BGEZL") || !strcasecmp(op_name, "BGEZ")
+ || !strcasecmp(op_name, "BGEZ64")) {
if (rs_val >= 0)
target = pc + offset;
else
target = pc + 8;
- } else if (!strcasecmp(op_name, "BGTZL") || !strcasecmp(op_name, "BGTZ")) {
+ } else if (!strcasecmp(op_name, "BGTZL") || !strcasecmp(op_name, "BGTZ")
+ || !strcasecmp(op_name, "BGTZ64")) {
if (rs_val > 0)
target = pc + offset;
else
target = pc + 8;
- } else if (!strcasecmp(op_name, "BLEZL") || !strcasecmp(op_name, "BLEZ")) {
+ } else if (!strcasecmp(op_name, "BLEZL") || !strcasecmp(op_name, "BLEZ")
+ || !strcasecmp(op_name, "BLEZ64")) {
if (rs_val <= 0)
target = pc + offset;
else
@@ -1657,32 +1693,32 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops_C(llvm::MCInst &insn) {
if (!success)
return false;
- if (!strcasecmp(op_name, "BEQC")) {
+ if (!strcasecmp(op_name, "BEQC") || !strcasecmp(op_name, "BEQC64")) {
if (rs_val == rt_val)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BNEC")) {
+ } else if (!strcasecmp(op_name, "BNEC") || !strcasecmp(op_name, "BNEC64")) {
if (rs_val != rt_val)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BLTC")) {
+ } else if (!strcasecmp(op_name, "BLTC") || !strcasecmp(op_name, "BLTC64")) {
if (rs_val < rt_val)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BGEC")) {
+ } else if (!strcasecmp(op_name, "BGEC64") || !strcasecmp(op_name, "BGEC")) {
if (rs_val >= rt_val)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BLTUC")) {
+ } else if (!strcasecmp(op_name, "BLTUC") || !strcasecmp(op_name, "BLTUC64")) {
if (rs_val < rt_val)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BGEUC")) {
+ } else if (!strcasecmp(op_name, "BGEUC") || !strcasecmp(op_name, "BGEUC64")) {
if ((uint32_t)rs_val >= (uint32_t)rt_val)
target = pc + offset;
else
@@ -1734,32 +1770,32 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops_C(llvm::MCInst &insn) {
if (!success)
return false;
- if (!strcasecmp(op_name, "BLTZC")) {
+ if (!strcasecmp(op_name, "BLTZC") || !strcasecmp(op_name, "BLTZC64")) {
if (rs_val < 0)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BLEZC")) {
+ } else if (!strcasecmp(op_name, "BLEZC") || !strcasecmp(op_name, "BLEZC64")) {
if (rs_val <= 0)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BGEZC")) {
+ } else if (!strcasecmp(op_name, "BGEZC") || !strcasecmp(op_name, "BGEZC64")) {
if (rs_val >= 0)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BGTZC")) {
+ } else if (!strcasecmp(op_name, "BGTZC") || !strcasecmp(op_name, "BGTZC64")) {
if (rs_val > 0)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BEQZC")) {
+ } else if (!strcasecmp(op_name, "BEQZC") || !strcasecmp(op_name, "BEQZC64")) {
if (rs_val == 0)
target = pc + offset;
else
target = pc + 4;
- } else if (!strcasecmp(op_name, "BNEZC")) {
+ } else if (!strcasecmp(op_name, "BNEZC") || !strcasecmp(op_name, "BNEZC64")) {
if (rs_val != 0)
target = pc + offset;
else
diff --git a/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 8f769c499987..180440a244a4 100644
--- a/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -5,9 +5,12 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
CxxStringTypes.cpp
LibCxx.cpp
LibCxxAtomic.cpp
+ LibCxxBitset.cpp
LibCxxInitializerList.cpp
LibCxxList.cpp
LibCxxMap.cpp
+ LibCxxQueue.cpp
+ LibCxxTuple.cpp
LibCxxUnorderedMap.cpp
LibCxxVector.cpp
LibStdcpp.cpp
diff --git a/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 1ae9418e4d9c..51ed88065c84 100644
--- a/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -422,12 +422,24 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
AddCXXSynthetic(
cpp_category_sp,
+ lldb_private::formatters::LibcxxBitsetSyntheticFrontEndCreator,
+ "libc++ std::bitset synthetic children",
+ ConstString("^std::__(ndk)?1::bitset<.+>(( )?&)?$"), stl_synth_flags,
+ true);
+ AddCXXSynthetic(
+ cpp_category_sp,
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
"libc++ std::vector synthetic children",
ConstString("^std::__(ndk)?1::vector<.+>(( )?&)?$"), stl_synth_flags,
true);
AddCXXSynthetic(
cpp_category_sp,
+ lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator,
+ "libc++ std::forward_list synthetic children",
+ ConstString("^std::__(ndk)?1::forward_list<.+>(( )?&)?$"),
+ stl_synth_flags, true);
+ AddCXXSynthetic(
+ cpp_category_sp,
lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
"libc++ std::list synthetic children",
ConstString("^std::__(ndk)?1::list<.+>(( )?&)?$"), stl_synth_flags, true);
@@ -467,6 +479,14 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
"libc++ std::initializer_list synthetic children",
ConstString("^std::initializer_list<.+>(( )?&)?$"), stl_synth_flags,
true);
+ AddCXXSynthetic(cpp_category_sp, LibcxxQueueFrontEndCreator,
+ "libc++ std::queue synthetic children",
+ ConstString("^std::__(ndk)?1::queue<.+>(( )?&)?$"),
+ stl_synth_flags, true);
+ AddCXXSynthetic(cpp_category_sp, LibcxxTupleFrontEndCreator,
+ "libc++ std::tuple synthetic children",
+ ConstString("^std::__(ndk)?1::tuple<.*>(( )?&)?$"), stl_synth_flags,
+ true);
AddCXXSynthetic(
cpp_category_sp,
lldb_private::formatters::LibcxxAtomicSyntheticFrontEndCreator,
@@ -497,12 +517,22 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
stl_summary_flags.SetSkipPointers(false);
AddCXXSummary(cpp_category_sp,
lldb_private::formatters::LibcxxContainerSummaryProvider,
+ "libc++ std::bitset summary provider",
+ ConstString("^std::__(ndk)?1::bitset<.+>(( )?&)?$"),
+ stl_summary_flags, true);
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxContainerSummaryProvider,
"libc++ std::vector summary provider",
ConstString("^std::__(ndk)?1::vector<.+>(( )?&)?$"),
stl_summary_flags, true);
AddCXXSummary(cpp_category_sp,
lldb_private::formatters::LibcxxContainerSummaryProvider,
"libc++ std::list summary provider",
+ ConstString("^std::__(ndk)?1::forward_list<.+>(( )?&)?$"),
+ stl_summary_flags, true);
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxContainerSummaryProvider,
+ "libc++ std::list summary provider",
ConstString("^std::__(ndk)?1::list<.+>(( )?&)?$"),
stl_summary_flags, true);
AddCXXSummary(cpp_category_sp,
@@ -517,6 +547,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
stl_summary_flags, true);
AddCXXSummary(cpp_category_sp,
lldb_private::formatters::LibcxxContainerSummaryProvider,
+ "libc++ std::queue summary provider",
+ ConstString("^std::__(ndk)?1::queue<.+>(( )?&)?$"),
+ stl_summary_flags, true);
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxContainerSummaryProvider,
"libc++ std::set summary provider",
ConstString("^std::__(ndk)?1::set<.+>(( )?&)?$"),
stl_summary_flags, true);
@@ -535,6 +570,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
"libc++ std::unordered containers summary provider",
ConstString("^(std::__(ndk)?1::)unordered_(multi)?(map|set)<.+> >$"),
stl_summary_flags, true);
+ AddCXXSummary(cpp_category_sp, LibcxxContainerSummaryProvider,
+ "libc++ std::tuple summary provider",
+ ConstString("^std::__(ndk)?1::tuple<.*>(( )?&)?$"), stl_summary_flags,
+ true);
AddCXXSummary(
cpp_category_sp, lldb_private::formatters::LibCxxAtomicSummaryProvider,
"libc++ std::atomic summary provider",
diff --git a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
index 88bdd68ff301..aebea6ae3569 100644
--- a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
+++ b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
@@ -628,7 +628,7 @@ static const clang::LangOptions &GetLangOptions() {
g_options.CPlusPlus = true;
g_options.CPlusPlus11 = true;
g_options.CPlusPlus14 = true;
- g_options.CPlusPlus1z = true;
+ g_options.CPlusPlus17 = true;
});
return g_options;
}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 11245e1310b7..f6d1f18cb596 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -153,12 +153,11 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
.get();
if (m_pair_ptr) {
auto __i_(valobj_sp->GetChildMemberWithName(g___i_, true));
- lldb::TemplateArgumentKind kind;
if (!__i_) {
m_pair_ptr = nullptr;
return false;
}
- CompilerType pair_type(__i_->GetCompilerType().GetTemplateArgument(0, kind));
+ CompilerType pair_type(__i_->GetCompilerType().GetTypeTemplateArgument(0));
std::string name; uint64_t bit_offset_ptr; uint32_t bitfield_bit_size_ptr; bool is_bitfield_ptr;
pair_type = pair_type.GetFieldAtIndex(0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);
if (!pair_type) {
diff --git a/source/Plugins/Language/CPlusPlus/LibCxx.h b/source/Plugins/Language/CPlusPlus/LibCxx.h
index 7610212b4245..3f6e0d6e14d7 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxx.h
+++ b/source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -93,6 +93,10 @@ private:
};
SyntheticChildrenFrontEnd *
+LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *
LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
@@ -105,6 +109,10 @@ LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
SyntheticChildrenFrontEnd *
+LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *
LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
@@ -119,6 +127,12 @@ LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
+SyntheticChildrenFrontEnd *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP);
+
} // namespace formatters
} // namespace lldb_private
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp b/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
new file mode 100644
index 000000000000..0cdb0b26cf3b
--- /dev/null
+++ b/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
@@ -0,0 +1,107 @@
+//===-- LibCxxBitset.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LibCxx.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class BitsetFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ BitsetFrontEnd(ValueObject &valobj);
+
+ size_t GetIndexOfChildWithName(const ConstString &name) override {
+ return formatters::ExtractIndexFromString(name.GetCString());
+ }
+
+ bool MightHaveChildren() override { return true; }
+ bool Update() override;
+ size_t CalculateNumChildren() override { return m_elements.size(); }
+ ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+private:
+ std::vector<ValueObjectSP> m_elements;
+ ValueObjectSP m_first;
+ CompilerType m_bool_type;
+ ByteOrder m_byte_order = eByteOrderInvalid;
+ uint8_t m_byte_size = 0;
+};
+} // namespace
+
+BitsetFrontEnd::BitsetFrontEnd(ValueObject &valobj)
+ : SyntheticChildrenFrontEnd(valobj) {
+ m_bool_type = valobj.GetCompilerType().GetBasicTypeFromAST(eBasicTypeBool);
+ if (auto target_sp = m_backend.GetTargetSP()) {
+ m_byte_order = target_sp->GetArchitecture().GetByteOrder();
+ m_byte_size = target_sp->GetArchitecture().GetAddressByteSize();
+ Update();
+ }
+}
+
+bool BitsetFrontEnd::Update() {
+ m_elements.clear();
+ m_first.reset();
+
+ TargetSP target_sp = m_backend.GetTargetSP();
+ if (!target_sp)
+ return false;
+ size_t capping_size = target_sp->GetMaximumNumberOfChildrenToDisplay();
+
+ size_t size = 0;
+ if (auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
+ size = arg->value.getLimitedValue(capping_size);
+
+ m_elements.assign(size, ValueObjectSP());
+
+ m_first = m_backend.GetChildMemberWithName(ConstString("__first_"), true);
+ return false;
+}
+
+ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) {
+ if (idx >= m_elements.size() || !m_first)
+ return ValueObjectSP();
+
+ if (m_elements[idx])
+ return m_elements[idx];
+
+ ExecutionContext ctx = m_backend.GetExecutionContextRef().Lock(false);
+ CompilerType type;
+ ValueObjectSP chunk;
+ // For small bitsets __first_ is not an array, but a plain size_t.
+ if (m_first->GetCompilerType().IsArrayType(&type, nullptr, nullptr))
+ chunk = m_first->GetChildAtIndex(
+ idx / type.GetBitSize(ctx.GetBestExecutionContextScope()), true);
+ else {
+ type = m_first->GetCompilerType();
+ chunk = m_first;
+ }
+ if (!type || !chunk)
+ return ValueObjectSP();
+
+ size_t chunk_idx = idx % type.GetBitSize(ctx.GetBestExecutionContextScope());
+ uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
+ DataExtractor data(&value, sizeof(value), m_byte_order, m_byte_size);
+
+ m_elements[idx] = CreateValueObjectFromData(llvm::formatv("[{0}]", idx).str(),
+ data, ctx, m_bool_type);
+
+ return m_elements[idx];
+}
+
+SyntheticChildrenFrontEnd *formatters::LibcxxBitsetSyntheticFrontEndCreator(
+ CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+ if (valobj_sp)
+ return new BitsetFrontEnd(*valobj_sp);
+ return nullptr;
+}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
index 4e839532afb7..5823f6f3e038 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
@@ -94,9 +94,8 @@ bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
m_start = nullptr;
m_num_elements = 0;
- lldb::TemplateArgumentKind kind;
- m_element_type = m_backend.GetCompilerType().GetTemplateArgument(0, kind);
- if (kind != lldb::eTemplateArgumentKindType || !m_element_type.IsValid())
+ m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
+ if (!m_element_type.IsValid())
return false;
m_element_size = m_element_type.GetByteSize(nullptr);
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index 56d8edaba72a..6407ae129ad7 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -114,58 +114,90 @@ private:
ListEntry m_entry;
};
-} // end anonymous namespace
-
-namespace lldb_private {
-namespace formatters {
-class LibcxxStdListSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+class AbstractListFrontEnd : public SyntheticChildrenFrontEnd {
public:
- LibcxxStdListSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+ size_t GetIndexOfChildWithName(const ConstString &name) override {
+ return ExtractIndexFromString(name.GetCString());
+ }
+ bool MightHaveChildren() override { return true; }
+ bool Update() override;
- ~LibcxxStdListSyntheticFrontEnd() override = default;
+protected:
+ AbstractListFrontEnd(ValueObject &valobj)
+ : SyntheticChildrenFrontEnd(valobj) {}
- size_t CalculateNumChildren() override;
+ size_t m_count;
+ ValueObject *m_head;
- lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+ static constexpr bool g_use_loop_detect = true;
+ size_t m_loop_detected; // The number of elements that have had loop detection
+ // run over them.
+ ListEntry m_slow_runner; // Used for loop detection
+ ListEntry m_fast_runner; // Used for loop detection
+
+ size_t m_list_capping_size;
+ CompilerType m_element_type;
+ std::map<size_t, ListIterator> m_iterators;
+
+ bool HasLoop(size_t count);
+ ValueObjectSP GetItem(size_t idx);
+};
+class ForwardListFrontEnd : public AbstractListFrontEnd {
+public:
+ ForwardListFrontEnd(ValueObject &valobj);
+
+ size_t CalculateNumChildren() override;
+ ValueObjectSP GetChildAtIndex(size_t idx) override;
bool Update() override;
+};
- bool MightHaveChildren() override;
+class ListFrontEnd : public AbstractListFrontEnd {
+public:
+ ListFrontEnd(lldb::ValueObjectSP valobj_sp);
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ ~ListFrontEnd() override = default;
-private:
- bool HasLoop(size_t count);
+ size_t CalculateNumChildren() override;
- size_t m_list_capping_size;
- static const bool g_use_loop_detect = true;
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
- size_t m_loop_detected; // The number of elements that have had loop detection
- // run over them.
- ListEntry m_slow_runner; // Used for loop detection
- ListEntry m_fast_runner; // Used for loop detection
+ bool Update() override;
+private:
lldb::addr_t m_node_address;
- ValueObject *m_head;
ValueObject *m_tail;
- CompilerType m_element_type;
- size_t m_count;
- std::map<size_t, ListIterator> m_iterators;
};
-} // namespace formatters
-} // namespace lldb_private
-
-lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
- LibcxxStdListSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
- : SyntheticChildrenFrontEnd(*valobj_sp), m_list_capping_size(0),
- m_loop_detected(0), m_node_address(), m_head(nullptr), m_tail(nullptr),
- m_element_type(), m_count(UINT32_MAX), m_iterators() {
- if (valobj_sp)
- Update();
+
+} // end anonymous namespace
+
+bool AbstractListFrontEnd::Update() {
+ m_loop_detected = 0;
+ m_count = UINT32_MAX;
+ m_head = nullptr;
+ m_list_capping_size = 0;
+ m_slow_runner.SetEntry(nullptr);
+ m_fast_runner.SetEntry(nullptr);
+ m_iterators.clear();
+
+ if (m_backend.GetTargetSP())
+ m_list_capping_size =
+ m_backend.GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
+ if (m_list_capping_size == 0)
+ m_list_capping_size = 255;
+
+ CompilerType list_type = m_backend.GetCompilerType();
+ if (list_type.IsReferenceType())
+ list_type = list_type.GetNonReferenceType();
+
+ if (list_type.GetNumTemplateArguments() == 0)
+ return false;
+ m_element_type = list_type.GetTypeTemplateArgument(0);
+
+ return false;
}
-bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::HasLoop(
- size_t count) {
+bool AbstractListFrontEnd::HasLoop(size_t count) {
if (!g_use_loop_detect)
return false;
// don't bother checking for a loop if we won't actually need to jump nodes
@@ -201,8 +233,105 @@ bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::HasLoop(
return m_slow_runner == m_fast_runner;
}
-size_t lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
- CalculateNumChildren() {
+ValueObjectSP AbstractListFrontEnd::GetItem(size_t idx) {
+ size_t advance = idx;
+ ListIterator current(m_head);
+ if (idx > 0) {
+ auto cached_iterator = m_iterators.find(idx - 1);
+ if (cached_iterator != m_iterators.end()) {
+ current = cached_iterator->second;
+ advance = 1;
+ }
+ }
+ ValueObjectSP value_sp = current.advance(advance);
+ m_iterators[idx] = current;
+ return value_sp;
+}
+
+ForwardListFrontEnd::ForwardListFrontEnd(ValueObject &valobj)
+ : AbstractListFrontEnd(valobj) {
+ Update();
+}
+
+size_t ForwardListFrontEnd::CalculateNumChildren() {
+ if (m_count != UINT32_MAX)
+ return m_count;
+
+ ListEntry current(m_head);
+ m_count = 0;
+ while (current && m_count < m_list_capping_size) {
+ ++m_count;
+ current = current.next();
+ }
+ return m_count;
+}
+
+ValueObjectSP ForwardListFrontEnd::GetChildAtIndex(size_t idx) {
+ if (idx >= CalculateNumChildren())
+ return nullptr;
+
+ if (!m_head)
+ return nullptr;
+
+ if (HasLoop(idx + 1))
+ return nullptr;
+
+ ValueObjectSP current_sp = GetItem(idx);
+ if (!current_sp)
+ return nullptr;
+
+ current_sp = current_sp->GetChildAtIndex(1, true); // get the __value_ child
+ if (!current_sp)
+ return nullptr;
+
+ // we need to copy current_sp into a new object otherwise we will end up with
+ // all items named __value_
+ DataExtractor data;
+ Status error;
+ current_sp->GetData(data, error);
+ if (error.Fail())
+ return nullptr;
+
+ return CreateValueObjectFromData(llvm::formatv("[{0}]", idx).str(), data,
+ m_backend.GetExecutionContextRef(),
+ m_element_type);
+}
+
+static ValueObjectSP GetValueOfCompressedPair(ValueObject &pair) {
+ ValueObjectSP value = pair.GetChildMemberWithName(ConstString("__value_"), true);
+ if (! value) {
+ // pre-r300140 member name
+ value = pair.GetChildMemberWithName(ConstString("__first_"), true);
+ }
+ return value;
+}
+
+bool ForwardListFrontEnd::Update() {
+ AbstractListFrontEnd::Update();
+
+ Status err;
+ ValueObjectSP backend_addr(m_backend.AddressOf(err));
+ if (err.Fail() || !backend_addr)
+ return false;
+
+ ValueObjectSP impl_sp(
+ m_backend.GetChildMemberWithName(ConstString("__before_begin_"), true));
+ if (!impl_sp)
+ return false;
+ impl_sp = GetValueOfCompressedPair(*impl_sp);
+ if (!impl_sp)
+ return false;
+ m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
+ return false;
+}
+
+ListFrontEnd::ListFrontEnd(lldb::ValueObjectSP valobj_sp)
+ : AbstractListFrontEnd(*valobj_sp), m_node_address(), m_tail(nullptr) {
+ if (valobj_sp)
+ Update();
+}
+
+size_t ListFrontEnd::CalculateNumChildren() {
if (m_count != UINT32_MAX)
return m_count;
if (!m_head || !m_tail || m_node_address == 0)
@@ -210,10 +339,9 @@ size_t lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
ValueObjectSP size_alloc(
m_backend.GetChildMemberWithName(ConstString("__size_alloc_"), true));
if (size_alloc) {
- ValueObjectSP first(
- size_alloc->GetChildMemberWithName(ConstString("__first_"), true));
- if (first) {
- m_count = first->GetValueAsUnsigned(UINT32_MAX);
+ ValueObjectSP value = GetValueOfCompressedPair(*size_alloc);
+ if (value) {
+ m_count = value->GetValueAsUnsigned(UINT32_MAX);
}
}
if (m_count != UINT32_MAX) {
@@ -239,9 +367,7 @@ size_t lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
}
}
-lldb::ValueObjectSP
-lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex(
- size_t idx) {
+lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) {
static ConstString g_value("__value_");
static ConstString g_next("__next_");
@@ -254,23 +380,10 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex(
if (HasLoop(idx + 1))
return lldb::ValueObjectSP();
- size_t actual_advance = idx;
-
- ListIterator current(m_head);
- if (idx > 0) {
- auto cached_iterator = m_iterators.find(idx - 1);
- if (cached_iterator != m_iterators.end()) {
- current = cached_iterator->second;
- actual_advance = 1;
- }
- }
-
- ValueObjectSP current_sp(current.advance(actual_advance));
+ ValueObjectSP current_sp = GetItem(idx);
if (!current_sp)
return lldb::ValueObjectSP();
- m_iterators[idx] = current;
-
current_sp = current_sp->GetChildAtIndex(1, true); // get the __value_ child
if (!current_sp)
return lldb::ValueObjectSP();
@@ -303,23 +416,13 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex(
m_element_type);
}
-bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() {
- m_iterators.clear();
- m_head = m_tail = nullptr;
+bool ListFrontEnd::Update() {
+ AbstractListFrontEnd::Update();
+ m_tail = nullptr;
m_node_address = 0;
- m_count = UINT32_MAX;
- m_loop_detected = 0;
- m_slow_runner.SetEntry(nullptr);
- m_fast_runner.SetEntry(nullptr);
Status err;
ValueObjectSP backend_addr(m_backend.AddressOf(err));
- m_list_capping_size = 0;
- if (m_backend.GetTargetSP())
- m_list_capping_size =
- m_backend.GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
- if (m_list_capping_size == 0)
- m_list_capping_size = 255;
if (err.Fail() || !backend_addr)
return false;
m_node_address = backend_addr->GetValueAsUnsigned(0);
@@ -329,31 +432,18 @@ bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() {
m_backend.GetChildMemberWithName(ConstString("__end_"), true));
if (!impl_sp)
return false;
- CompilerType list_type = m_backend.GetCompilerType();
- if (list_type.IsReferenceType())
- list_type = list_type.GetNonReferenceType();
-
- if (list_type.GetNumTemplateArguments() == 0)
- return false;
- lldb::TemplateArgumentKind kind;
- m_element_type = list_type.GetTemplateArgument(0, kind);
m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get();
return false;
}
-bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
- MightHaveChildren() {
- return true;
-}
-
-size_t lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::
- GetIndexOfChildWithName(const ConstString &name) {
- return ExtractIndexFromString(name.GetCString());
+SyntheticChildrenFrontEnd *formatters::LibcxxStdListSyntheticFrontEndCreator(
+ CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+ return (valobj_sp ? new ListFrontEnd(valobj_sp) : nullptr);
}
SyntheticChildrenFrontEnd *
-lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator(
+formatters::LibcxxStdForwardListSyntheticFrontEndCreator(
CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
- return (valobj_sp ? new LibcxxStdListSyntheticFrontEnd(valobj_sp) : nullptr);
+ return valobj_sp ? new ForwardListFrontEnd(*valobj_sp) : nullptr;
}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index b7215dbcbb48..be96a6d95bcd 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -268,13 +268,12 @@ bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() {
m_element_type = deref->GetCompilerType();
return true;
}
- lldb::TemplateArgumentKind kind;
deref = m_backend.GetChildAtNamePath({g_tree_, g_pair3});
if (!deref)
return false;
- m_element_type =
- deref->GetCompilerType().GetTemplateArgument(1, kind).GetTemplateArgument(
- 1, kind);
+ m_element_type = deref->GetCompilerType()
+ .GetTypeTemplateArgument(1)
+ .GetTypeTemplateArgument(1);
if (m_element_type) {
std::string name;
uint64_t bit_offset_ptr;
@@ -285,7 +284,7 @@ bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() {
m_element_type = m_element_type.GetTypedefedType();
return m_element_type.IsValid();
} else {
- m_element_type = m_backend.GetCompilerType().GetTemplateArgument(0, kind);
+ m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
return m_element_type.IsValid();
}
}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp b/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
new file mode 100644
index 000000000000..c4e0b66d4272
--- /dev/null
+++ b/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
@@ -0,0 +1,61 @@
+//===-- LibCxxQueue.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LibCxx.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class QueueFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ QueueFrontEnd(ValueObject &valobj) : SyntheticChildrenFrontEnd(valobj) {
+ Update();
+ }
+
+ size_t GetIndexOfChildWithName(const ConstString &name) override {
+ return m_container_sp ? m_container_sp->GetIndexOfChildWithName(name)
+ : UINT32_MAX;
+ }
+
+ bool MightHaveChildren() override { return true; }
+ bool Update() override;
+
+ size_t CalculateNumChildren() override {
+ return m_container_sp ? m_container_sp->GetNumChildren() : 0;
+ }
+
+ ValueObjectSP GetChildAtIndex(size_t idx) override {
+ return m_container_sp ? m_container_sp->GetChildAtIndex(idx, true)
+ : nullptr;
+ }
+
+private:
+ ValueObjectSP m_container_sp;
+};
+} // namespace
+
+bool QueueFrontEnd::Update() {
+ m_container_sp.reset();
+ ValueObjectSP c_sp = m_backend.GetChildMemberWithName(ConstString("c"), true);
+ if (!c_sp)
+ return false;
+ m_container_sp = c_sp->GetSyntheticValue();
+ return false;
+}
+
+SyntheticChildrenFrontEnd *
+formatters::LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP valobj_sp) {
+ if (valobj_sp)
+ return new QueueFrontEnd(*valobj_sp);
+ return nullptr;
+}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp b/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
new file mode 100644
index 000000000000..9b412a12f532
--- /dev/null
+++ b/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
@@ -0,0 +1,83 @@
+//===-- LibCxxTuple.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LibCxx.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class TupleFrontEnd: public SyntheticChildrenFrontEnd {
+public:
+ TupleFrontEnd(ValueObject &valobj) : SyntheticChildrenFrontEnd(valobj) {
+ Update();
+ }
+
+ size_t GetIndexOfChildWithName(const ConstString &name) override {
+ return formatters::ExtractIndexFromString(name.GetCString());
+ }
+
+ bool MightHaveChildren() override { return true; }
+ bool Update() override;
+ size_t CalculateNumChildren() override { return m_elements.size(); }
+ ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+private:
+ std::vector<ValueObjectSP> m_elements;
+ ValueObjectSP m_base_sp;
+};
+}
+
+bool TupleFrontEnd::Update() {
+ m_elements.clear();
+ m_base_sp = m_backend.GetChildMemberWithName(ConstString("__base_"), true);
+ if (! m_base_sp) {
+ // Pre r304382 name of the base element.
+ m_base_sp = m_backend.GetChildMemberWithName(ConstString("base_"), true);
+ }
+ if (! m_base_sp)
+ return false;
+ m_elements.assign(m_base_sp->GetCompilerType().GetNumDirectBaseClasses(),
+ ValueObjectSP());
+ return false;
+}
+
+ValueObjectSP TupleFrontEnd::GetChildAtIndex(size_t idx) {
+ if (idx >= m_elements.size())
+ return ValueObjectSP();
+ if (!m_base_sp)
+ return ValueObjectSP();
+ if (m_elements[idx])
+ return m_elements[idx];
+
+ CompilerType holder_type =
+ m_base_sp->GetCompilerType().GetDirectBaseClassAtIndex(idx, nullptr);
+ if (!holder_type)
+ return ValueObjectSP();
+ ValueObjectSP holder_sp = m_base_sp->GetChildAtIndex(idx, true);
+ if (!holder_sp)
+ return ValueObjectSP();
+
+ ValueObjectSP elem_sp = holder_sp->GetChildAtIndex(0, true);
+ if (elem_sp)
+ m_elements[idx] =
+ elem_sp->Clone(ConstString(llvm::formatv("[{0}]", idx).str()));
+
+ return m_elements[idx];
+}
+
+SyntheticChildrenFrontEnd *
+formatters::LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
+ lldb::ValueObjectSP valobj_sp) {
+ if (valobj_sp)
+ return new TupleFrontEnd(*valobj_sp);
+ return nullptr;
+}
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index 190b5f64381e..0f1c2537d651 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -121,11 +121,10 @@ lldb::ValueObjectSP lldb_private::formatters::
if (!first_sp)
return nullptr;
m_element_type = first_sp->GetCompilerType();
- lldb::TemplateArgumentKind kind;
- m_element_type = m_element_type.GetTemplateArgument(0, kind);
+ m_element_type = m_element_type.GetTypeTemplateArgument(0);
m_element_type = m_element_type.GetPointeeType();
m_node_type = m_element_type;
- m_element_type = m_element_type.GetTemplateArgument(0, kind);
+ m_element_type = m_element_type.GetTypeTemplateArgument(0);
std::string name;
m_element_type =
m_element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
diff --git a/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
index 6f601c9f6ccb..711130639cd2 100644
--- a/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
@@ -290,8 +290,7 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator(
CompilerType type = valobj_sp->GetCompilerType();
if (!type.IsValid() || type.GetNumTemplateArguments() == 0)
return nullptr;
- TemplateArgumentKind kind;
- CompilerType arg_type = type.GetTemplateArgument(0, kind);
+ CompilerType arg_type = type.GetTypeTemplateArgument(0);
if (arg_type.GetTypeName() == ConstString("bool"))
return new LibcxxVectorBoolSyntheticFrontEnd(valobj_sp);
return new LibcxxStdVectorSyntheticFrontEnd(valobj_sp);
diff --git a/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index e3018a1884be..3e2b7159f894 100644
--- a/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -117,11 +117,8 @@ bool LibstdcppMapIteratorSyntheticFrontEnd::Update() {
CompilerType my_type(valobj_sp->GetCompilerType());
if (my_type.GetNumTemplateArguments() >= 1) {
- TemplateArgumentKind kind;
- CompilerType pair_type = my_type.GetTemplateArgument(0, kind);
- if (kind != eTemplateArgumentKindType &&
- kind != eTemplateArgumentKindTemplate &&
- kind != eTemplateArgumentKindTemplateExpansion)
+ CompilerType pair_type = my_type.GetTypeTemplateArgument(0);
+ if (!pair_type)
return false;
m_pair_type = pair_type;
} else
diff --git a/source/Plugins/Language/ObjC/CMakeLists.txt b/source/Plugins/Language/ObjC/CMakeLists.txt
index 7cc93c7b0558..95ace3a3633a 100644
--- a/source/Plugins/Language/ObjC/CMakeLists.txt
+++ b/source/Plugins/Language/ObjC/CMakeLists.txt
@@ -1,3 +1,13 @@
+set(EXTRA_CXXFLAGS "")
+
+if (CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
+ set(EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS} -Wno-gnu-anonymous-struct)
+endif ()
+
+if (CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
+ set(EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS} -Wno-nested-anon-types)
+endif ()
+
add_lldb_library(lldbPluginObjCLanguage PLUGIN
ObjCLanguage.cpp
CF.cpp
@@ -21,4 +31,6 @@ add_lldb_library(lldbPluginObjCLanguage PLUGIN
lldbTarget
lldbUtility
lldbPluginAppleObjCRuntime
+
+ EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS}
)
diff --git a/source/Plugins/Language/ObjC/NSArray.cpp b/source/Plugins/Language/ObjC/NSArray.cpp
index 27cb9558c482..f6d159201951 100644
--- a/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/source/Plugins/Language/ObjC/NSArray.cpp
@@ -48,11 +48,11 @@ NSArray_Additionals::GetAdditionalSynthetics() {
return g_map;
}
-class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+class NSArrayMSyntheticFrontEndBase : public SyntheticChildrenFrontEnd {
public:
- NSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+ NSArrayMSyntheticFrontEndBase(lldb::ValueObjectSP valobj_sp);
- ~NSArrayMSyntheticFrontEnd() override = default;
+ ~NSArrayMSyntheticFrontEndBase() override = default;
size_t CalculateNumChildren() override;
@@ -78,11 +78,12 @@ protected:
CompilerType m_id_type;
};
-class NSArrayMSyntheticFrontEnd_109 : public NSArrayMSyntheticFrontEnd {
+template <typename D32, typename D64>
+class GenericNSArrayMSyntheticFrontEnd : public NSArrayMSyntheticFrontEndBase {
public:
- NSArrayMSyntheticFrontEnd_109(lldb::ValueObjectSP valobj_sp);
+ GenericNSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- ~NSArrayMSyntheticFrontEnd_109() override;
+ ~GenericNSArrayMSyntheticFrontEnd() override;
bool Update() override;
@@ -96,6 +97,11 @@ protected:
uint64_t GetSize() override;
private:
+ D32 *m_data_32;
+ D64 *m_data_64;
+};
+
+namespace Foundation109 {
struct DataDescriptor_32 {
uint32_t _used;
uint32_t _priv1 : 2;
@@ -105,7 +111,7 @@ private:
uint32_t _priv3;
uint32_t _data;
};
-
+
struct DataDescriptor_64 {
uint64_t _used;
uint64_t _priv1 : 2;
@@ -115,29 +121,12 @@ private:
uint32_t _priv3;
uint64_t _data;
};
-
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
-};
-
-class NSArrayMSyntheticFrontEnd_1010 : public NSArrayMSyntheticFrontEnd {
-public:
- NSArrayMSyntheticFrontEnd_1010(lldb::ValueObjectSP valobj_sp);
-
- ~NSArrayMSyntheticFrontEnd_1010() override;
-
- bool Update() override;
-
-protected:
- lldb::addr_t GetDataAddress() override;
-
- uint64_t GetUsedCount() override;
-
- uint64_t GetOffset() override;
-
- uint64_t GetSize() override;
-
-private:
+
+ using NSArrayMSyntheticFrontEnd =
+ GenericNSArrayMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
+namespace Foundation1010 {
struct DataDescriptor_32 {
uint32_t _used;
uint32_t _offset;
@@ -146,7 +135,7 @@ private:
uint32_t _priv2;
uint32_t _data;
};
-
+
struct DataDescriptor_64 {
uint64_t _used;
uint64_t _offset;
@@ -155,76 +144,86 @@ private:
uint32_t _priv2;
uint64_t _data;
};
-
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
-};
-
-class NSArrayMSyntheticFrontEnd_1400 : public NSArrayMSyntheticFrontEnd {
-public:
- NSArrayMSyntheticFrontEnd_1400(lldb::ValueObjectSP valobj_sp);
-
- ~NSArrayMSyntheticFrontEnd_1400() override;
-
- bool Update() override;
-
-protected:
- lldb::addr_t GetDataAddress() override;
-
- uint64_t GetUsedCount() override;
-
- uint64_t GetOffset() override;
-
- uint64_t GetSize() override;
-
-private:
+
+ using NSArrayMSyntheticFrontEnd =
+ GenericNSArrayMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
+namespace Foundation1428 {
struct DataDescriptor_32 {
- uint32_t used;
- uint32_t offset;
- uint32_t size;
- uint32_t list;
+ uint32_t _used;
+ uint32_t _offset;
+ uint32_t _size;
+ uint32_t _data;
};
-
+
struct DataDescriptor_64 {
- uint64_t used;
- uint64_t offset;
- uint64_t size;
- uint64_t list;
+ uint64_t _used;
+ uint64_t _offset;
+ uint64_t _size;
+ uint64_t _data;
};
+
+ using NSArrayMSyntheticFrontEnd =
+ GenericNSArrayMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
+namespace Foundation1437 {
+ template <typename PtrType>
+ struct DataDescriptor {
+ PtrType _cow;
+ // __deque
+ PtrType _data;
+ uint32_t _offset;
+ uint32_t _size;
+ union {
+ PtrType _mutations;
+ struct {
+ uint32_t _muts;
+ uint32_t _used;
+ };
+ };
+ };
+
+ using NSArrayMSyntheticFrontEnd =
+ GenericNSArrayMSyntheticFrontEnd<
+ DataDescriptor<uint32_t>, DataDescriptor<uint64_t>>;
+
+ template <typename DD>
+ uint64_t
+ __NSArrayMSize_Impl(lldb_private::Process &process,
+ lldb::addr_t valobj_addr, Status &error) {
+ const lldb::addr_t start_of_descriptor =
+ valobj_addr + process.GetAddressByteSize();
+ DD descriptor = DD();
+ process.ReadMemory(start_of_descriptor, &descriptor,
+ sizeof(descriptor), error);
+ if (error.Fail()) {
+ return 0;
+ }
+ return descriptor._used;
+ }
+
+ uint64_t
+ __NSArrayMSize(lldb_private::Process &process, lldb::addr_t valobj_addr,
+ Status &error) {
+ if (process.GetAddressByteSize() == 4) {
+ return __NSArrayMSize_Impl<DataDescriptor<uint32_t>>(process, valobj_addr,
+ error);
+ } else {
+ return __NSArrayMSize_Impl<DataDescriptor<uint64_t>>(process, valobj_addr,
+ error);
+ }
+ }
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
-};
-
-class NSArrayISyntheticFrontEnd_1300 : public SyntheticChildrenFrontEnd {
-public:
- NSArrayISyntheticFrontEnd_1300(lldb::ValueObjectSP valobj_sp);
-
- ~NSArrayISyntheticFrontEnd_1300() override = default;
-
- size_t CalculateNumChildren() override;
-
- lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
-
- bool Update() override;
-
- bool MightHaveChildren() override;
-
- size_t GetIndexOfChildWithName(const ConstString &name) override;
-
-private:
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- uint64_t m_items;
- lldb::addr_t m_data_ptr;
- CompilerType m_id_type;
-};
+}
-class NSArrayISyntheticFrontEnd_1400 : public SyntheticChildrenFrontEnd {
+template <typename D32, typename D64, bool Inline>
+class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
- NSArrayISyntheticFrontEnd_1400(lldb::ValueObjectSP valobj_sp);
+ GenericNSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- ~NSArrayISyntheticFrontEnd_1400() override;
+ ~GenericNSArrayISyntheticFrontEnd() override;
size_t CalculateNumChildren() override;
@@ -239,25 +238,58 @@ public:
private:
ExecutionContextRef m_exe_ctx_ref;
uint8_t m_ptr_size;
-
- struct DataDescriptor_32 {
- uint32_t used;
- uint32_t offset;
- uint32_t size;
- uint32_t list;
- };
-
- struct DataDescriptor_64 {
- uint64_t used;
- uint64_t offset;
- uint64_t size;
- uint64_t list;
- };
-
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
+
+ D32 *m_data_32;
+ D64 *m_data_64;
CompilerType m_id_type;
};
+
+namespace Foundation1300 {
+ struct IDD32 {
+ uint32_t used;
+ uint32_t list;
+ };
+
+ struct IDD64 {
+ uint64_t used;
+ uint64_t list;
+ };
+
+ using NSArrayISyntheticFrontEnd =
+ GenericNSArrayISyntheticFrontEnd<IDD32, IDD64, true>;
+}
+
+namespace Foundation1430 {
+ using NSArrayISyntheticFrontEnd =
+ Foundation1428::NSArrayMSyntheticFrontEnd;
+}
+
+namespace Foundation1436 {
+ struct IDD32 {
+ uint32_t used;
+ uint32_t list; // in Inline cases, this is the first element
+ };
+
+ struct IDD64 {
+ uint64_t used;
+ uint64_t list; // in Inline cases, this is the first element
+ };
+
+ using NSArrayI_TransferSyntheticFrontEnd =
+ GenericNSArrayISyntheticFrontEnd<IDD32, IDD64, false>;
+
+ using NSArrayISyntheticFrontEnd =
+ GenericNSArrayISyntheticFrontEnd<IDD32, IDD64, true>;
+
+ using NSFrozenArrayMSyntheticFrontEnd =
+ Foundation1437::NSArrayMSyntheticFrontEnd;
+
+ uint64_t
+ __NSFrozenArrayMSize(lldb_private::Process &process, lldb::addr_t valobj_addr,
+ Status &error) {
+ return Foundation1437::__NSArrayMSize(process, valobj_addr, error);
+ }
+}
class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
@@ -329,6 +361,8 @@ bool lldb_private::formatters::NSArraySummaryProvider(
static const ConstString g_NSArrayI("__NSArrayI");
static const ConstString g_NSArrayM("__NSArrayM");
+ static const ConstString g_NSArrayI_Transfer("__NSArrayI_Transfer");
+ static const ConstString g_NSFrozenArrayM("__NSFrozenArrayM");
static const ConstString g_NSArray0("__NSArray0");
static const ConstString g_NSArray1("__NSSingleObjectArrayI");
static const ConstString g_NSArrayCF("__NSCFArray");
@@ -345,11 +379,28 @@ bool lldb_private::formatters::NSArraySummaryProvider(
if (error.Fail())
return false;
} else if (class_name == g_NSArrayM) {
+ AppleObjCRuntime *apple_runtime =
+ llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
+ Status error;
+ if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1437) {
+ value = Foundation1437::__NSArrayMSize(*process_sp, valobj_addr, error);
+ } else {
+ value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+ ptr_size, 0, error);
+ }
+ if (error.Fail())
+ return false;
+ } else if (class_name == g_NSArrayI_Transfer) {
Status error;
value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
ptr_size, 0, error);
if (error.Fail())
return false;
+ } else if (class_name == g_NSFrozenArrayM) {
+ Status error;
+ value = Foundation1436::__NSFrozenArrayMSize(*process_sp, valobj_addr, error);
+ if (error.Fail())
+ return false;
} else if (class_name == g_NSArrayMLegacy) {
Status error;
value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
@@ -395,7 +446,7 @@ bool lldb_private::formatters::NSArraySummaryProvider(
return true;
}
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd(
+lldb_private::formatters::NSArrayMSyntheticFrontEndBase::NSArrayMSyntheticFrontEndBase(
lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
m_id_type() {
@@ -411,28 +462,20 @@ lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd(
}
}
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::
- NSArrayMSyntheticFrontEnd_109(lldb::ValueObjectSP valobj_sp)
- : NSArrayMSyntheticFrontEnd(valobj_sp), m_data_32(nullptr),
- m_data_64(nullptr) {}
-
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::
- NSArrayMSyntheticFrontEnd_1010(lldb::ValueObjectSP valobj_sp)
- : NSArrayMSyntheticFrontEnd(valobj_sp), m_data_32(nullptr),
- m_data_64(nullptr) {}
-
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::
- NSArrayMSyntheticFrontEnd_1400(lldb::ValueObjectSP valobj_sp)
- : NSArrayMSyntheticFrontEnd(valobj_sp), m_data_32(nullptr),
+template <typename D32, typename D64>
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+ : NSArrayMSyntheticFrontEndBase(valobj_sp), m_data_32(nullptr),
m_data_64(nullptr) {}
size_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren() {
+lldb_private::formatters::NSArrayMSyntheticFrontEndBase::CalculateNumChildren() {
return GetUsedCount();
}
lldb::ValueObjectSP
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex(
+lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetChildAtIndex(
size_t idx) {
if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
@@ -448,69 +491,10 @@ lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex(
m_exe_ctx_ref, m_id_type);
}
-bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::Update() {
- ValueObjectSP valobj_sp = m_backend.GetSP();
- m_ptr_size = 0;
- delete m_data_32;
- m_data_32 = nullptr;
- delete m_data_64;
- m_data_64 = nullptr;
- if (!valobj_sp)
- return false;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Status error;
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return false;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
- if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
- error);
- } else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
- error);
- }
- if (error.Fail())
- return false;
- return false;
-}
-
-bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::Update() {
- ValueObjectSP valobj_sp = m_backend.GetSP();
- m_ptr_size = 0;
- delete m_data_32;
- m_data_32 = nullptr;
- delete m_data_64;
- m_data_64 = nullptr;
- if (!valobj_sp)
- return false;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Status error;
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return false;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
- if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
- error);
- } else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
- error);
- }
- if (error.Fail())
- return false;
- return false;
-}
-
-bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::Update() {
+template <typename D32, typename D64>
+bool
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
delete m_data_32;
@@ -528,12 +512,12 @@ bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::Update() {
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+ m_data_32 = new D32();
+ process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
error);
} else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+ m_data_64 = new D64();
+ process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
error);
}
if (error.Fail())
@@ -541,12 +525,13 @@ bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::Update() {
return false;
}
-bool lldb_private::formatters::NSArrayMSyntheticFrontEnd::MightHaveChildren() {
+bool
+lldb_private::formatters::NSArrayMSyntheticFrontEndBase::MightHaveChildren() {
return true;
}
size_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName(
+lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName(
const ConstString &name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
@@ -555,187 +540,59 @@ lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName(
return idx;
}
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::
- ~NSArrayMSyntheticFrontEnd_109() {
+template <typename D32, typename D64>
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ ~GenericNSArrayMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
}
+template <typename D32, typename D64>
lldb::addr_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetDataAddress() {
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd::GetDataAddress() {
if (!m_data_32 && !m_data_64)
return LLDB_INVALID_ADDRESS;
return m_data_32 ? m_data_32->_data : m_data_64->_data;
}
+template <typename D32, typename D64>
uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetUsedCount() {
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd::GetUsedCount() {
if (!m_data_32 && !m_data_64)
return 0;
return m_data_32 ? m_data_32->_used : m_data_64->_used;
}
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetOffset() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->_offset : m_data_64->_offset;
-}
-
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetSize() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->_size : m_data_64->_size;
-}
-
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::
- ~NSArrayMSyntheticFrontEnd_1010() {
- delete m_data_32;
- m_data_32 = nullptr;
- delete m_data_64;
- m_data_64 = nullptr;
-}
-
-lldb::addr_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetDataAddress() {
- if (!m_data_32 && !m_data_64)
- return LLDB_INVALID_ADDRESS;
- return m_data_32 ? m_data_32->_data : m_data_64->_data;
-}
-
+template <typename D32, typename D64>
uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetUsedCount() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->_used : m_data_64->_used;
-}
-
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetOffset() {
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd::GetOffset() {
if (!m_data_32 && !m_data_64)
return 0;
return m_data_32 ? m_data_32->_offset : m_data_64->_offset;
}
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetSize() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->_size : m_data_64->_size;
-}
-
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::
- ~NSArrayMSyntheticFrontEnd_1400() {
- delete m_data_32;
- m_data_32 = nullptr;
- delete m_data_64;
- m_data_64 = nullptr;
-}
-
-lldb::addr_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::GetDataAddress() {
- if (!m_data_32 && !m_data_64)
- return LLDB_INVALID_ADDRESS;
- return m_data_32 ? m_data_32->list : m_data_64->list;
-}
-
+template <typename D32, typename D64>
uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::GetUsedCount() {
+lldb_private::formatters::
+ GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd::GetSize() {
if (!m_data_32 && !m_data_64)
return 0;
- return m_data_32 ? m_data_32->used : m_data_64->used;
-}
-
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::GetOffset() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->offset : m_data_64->offset;
-}
-
-uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1400::GetSize() {
- if (!m_data_32 && !m_data_64)
- return 0;
- return m_data_32 ? m_data_32->size : m_data_64->size;
-}
-
-
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::NSArrayISyntheticFrontEnd_1300(
- lldb::ValueObjectSP valobj_sp)
- : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
- m_items(0), m_data_ptr(0) {
- if (valobj_sp) {
- CompilerType type = valobj_sp->GetCompilerType();
- if (type) {
- ClangASTContext *ast = valobj_sp->GetExecutionContextRef()
- .GetTargetSP()
- ->GetScratchClangASTContext();
- if (ast)
- m_id_type = CompilerType(ast->getASTContext(),
- ast->getASTContext()->ObjCBuiltinIdTy);
- }
- }
-}
-
-size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::GetIndexOfChildWithName(
- const ConstString &name) {
- const char *item_name = name.GetCString();
- uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildren())
- return UINT32_MAX;
- return idx;
-}
-
-size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::CalculateNumChildren() {
- return m_items;
-}
-
-bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::Update() {
- m_ptr_size = 0;
- m_items = 0;
- m_data_ptr = 0;
- ValueObjectSP valobj_sp = m_backend.GetSP();
- if (!valobj_sp)
- return false;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Status error;
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return false;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
- m_items = process_sp->ReadPointerFromMemory(data_location, error);
- if (error.Fail())
- return false;
- m_data_ptr = data_location + m_ptr_size;
- return false;
-}
-
-bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::MightHaveChildren() {
- return true;
-}
-
-lldb::ValueObjectSP
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1300::GetChildAtIndex(
- size_t idx) {
- if (idx >= CalculateNumChildren())
- return lldb::ValueObjectSP();
- lldb::addr_t object_at_idx = m_data_ptr;
- object_at_idx += (idx * m_ptr_size);
- ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
- if (!process_sp)
- return lldb::ValueObjectSP();
- Status error;
- if (error.Fail())
- return lldb::ValueObjectSP();
- StreamString idx_name;
- idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
- return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
- m_exe_ctx_ref, m_id_type);
+ return m_data_32 ? m_data_32->_size : m_data_64->_size;
}
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::NSArrayISyntheticFrontEnd_1400(
+template <typename D32, typename D64, bool Inline>
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ GenericNSArrayISyntheticFrontEnd(
lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
m_data_32(nullptr), m_data_64(nullptr) {
@@ -752,16 +609,19 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::NSArrayISyntheticFront
}
}
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::~NSArrayISyntheticFrontEnd_1400() {
+template <typename D32, typename D64, bool Inline>
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ ~GenericNSArrayISyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
}
+template <typename D32, typename D64, bool Inline>
size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::GetIndexOfChildWithName(
- const ConstString &name) {
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ GetIndexOfChildWithName(const ConstString &name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -769,12 +629,17 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::GetIndexOfChildWithNam
return idx;
}
+template <typename D32, typename D64, bool Inline>
size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::CalculateNumChildren() {
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ CalculateNumChildren() {
return m_data_32 ? m_data_32->used : m_data_64->used;
}
-bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::Update() {
+template <typename D32, typename D64, bool Inline>
+bool
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
delete m_data_32;
@@ -792,12 +657,12 @@ bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::Update() {
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+ m_data_32 = new D32();
+ process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
error);
} else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+ m_data_64 = new D64();
+ process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
error);
}
if (error.Fail())
@@ -805,17 +670,29 @@ bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::Update() {
return false;
}
-bool lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::MightHaveChildren() {
+template <typename D32, typename D64, bool Inline>
+bool
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ MightHaveChildren() {
return true;
}
+template <typename D32, typename D64, bool Inline>
lldb::ValueObjectSP
-lldb_private::formatters::NSArrayISyntheticFrontEnd_1400::GetChildAtIndex(
- size_t idx) {
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ GetChildAtIndex(size_t idx) {
if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
- lldb::addr_t object_at_idx = m_data_32 ? m_data_32->list : m_data_64->list;
+ lldb::addr_t object_at_idx;
+ if (Inline) {
+ object_at_idx = m_backend.GetSP()->GetValueAsUnsigned(0) + m_ptr_size;
+ object_at_idx += m_ptr_size == 4 ? sizeof(D32) : sizeof(D64); // skip the data header
+ object_at_idx -= m_ptr_size; // we treat the last entry in the data header as the first pointer
+ } else {
+ object_at_idx = m_data_32 ? m_data_32->list : m_data_64->list;
+ }
object_at_idx += (idx * m_ptr_size);
+
ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
if (!process_sp)
return lldb::ValueObjectSP();
@@ -933,6 +810,8 @@ lldb_private::formatters::NSArraySyntheticFrontEndCreator(
ConstString class_name(descriptor->GetClassName());
static const ConstString g_NSArrayI("__NSArrayI");
+ static const ConstString g_NSArrayI_Transfer("__NSArrayI_Transfer");
+ static const ConstString g_NSFrozenArrayM("__NSFrozenArrayM");
static const ConstString g_NSArrayM("__NSArrayM");
static const ConstString g_NSArray0("__NSArray0");
static const ConstString g_NSArray1("__NSSingleObjectArrayI");
@@ -943,21 +822,30 @@ lldb_private::formatters::NSArraySyntheticFrontEndCreator(
return nullptr;
if (class_name == g_NSArrayI) {
- if (runtime->GetFoundationVersion() >= 1400)
- return (new NSArrayISyntheticFrontEnd_1400(valobj_sp));
- else
- return (new NSArrayISyntheticFrontEnd_1300(valobj_sp));
+ if (runtime->GetFoundationVersion() >= 1436)
+ return (new Foundation1436::NSArrayISyntheticFrontEnd(valobj_sp));
+ if (runtime->GetFoundationVersion() >= 1430)
+ return (new Foundation1430::NSArrayISyntheticFrontEnd(valobj_sp));
+ else
+ return (new Foundation1300::NSArrayISyntheticFrontEnd(valobj_sp));
+ } else if (class_name == g_NSArrayI_Transfer) {
+ return (new Foundation1436::NSArrayI_TransferSyntheticFrontEnd(valobj_sp));
+ } else if (class_name == g_NSArray0) {
+ } else if (class_name == g_NSFrozenArrayM) {
+ return (new Foundation1436::NSFrozenArrayMSyntheticFrontEnd(valobj_sp));
} else if (class_name == g_NSArray0) {
return (new NSArray0SyntheticFrontEnd(valobj_sp));
} else if (class_name == g_NSArray1) {
return (new NSArray1SyntheticFrontEnd(valobj_sp));
} else if (class_name == g_NSArrayM) {
- if (runtime->GetFoundationVersion() >= 1400)
- return (new NSArrayMSyntheticFrontEnd_1400(valobj_sp));
+ if (runtime->GetFoundationVersion() >= 1437)
+ return (new Foundation1437::NSArrayMSyntheticFrontEnd(valobj_sp));
+ if (runtime->GetFoundationVersion() >= 1428)
+ return (new Foundation1428::NSArrayMSyntheticFrontEnd(valobj_sp));
if (runtime->GetFoundationVersion() >= 1100)
- return (new NSArrayMSyntheticFrontEnd_1010(valobj_sp));
+ return (new Foundation1010::NSArrayMSyntheticFrontEnd(valobj_sp));
else
- return (new NSArrayMSyntheticFrontEnd_109(valobj_sp));
+ return (new Foundation109::NSArrayMSyntheticFrontEnd(valobj_sp));
} else {
auto &map(NSArray_Additionals::GetAdditionalSynthetics());
auto iter = map.find(class_name), end = map.end();
diff --git a/source/Plugins/Language/ObjC/NSDictionary.cpp b/source/Plugins/Language/ObjC/NSDictionary.cpp
index 50febbe39758..c564aa1a8571 100644
--- a/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -165,11 +165,12 @@ private:
ValueObjectSP m_pair;
};
-class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+template <typename D32, typename D64>
+class GenericNSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
- NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+ GenericNSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- ~NSDictionaryMSyntheticFrontEnd() override;
+ ~GenericNSDictionaryMSyntheticFrontEnd() override;
size_t CalculateNumChildren() override;
@@ -182,20 +183,6 @@ public:
size_t GetIndexOfChildWithName(const ConstString &name) override;
private:
- struct DataDescriptor_32 {
- uint32_t used : 26;
- uint32_t kvo : 1;
- uint32_t size;
- uint32_t buffer;
- };
-
- struct DataDescriptor_64 {
- uint64_t used : 58;
- uint32_t kvo : 1;
- uint64_t size;
- uint64_t buffer;
- };
-
struct DictionaryItemDescriptor {
lldb::addr_t key_ptr;
lldb::addr_t val_ptr;
@@ -205,61 +192,169 @@ private:
ExecutionContextRef m_exe_ctx_ref;
uint8_t m_ptr_size;
lldb::ByteOrder m_order;
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
+ D32 *m_data_32;
+ D64 *m_data_64;
CompilerType m_pair_type;
std::vector<DictionaryItemDescriptor> m_children;
};
-
-class NSDictionaryMLegacySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
-public:
- NSDictionaryMLegacySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
-
- ~NSDictionaryMLegacySyntheticFrontEnd() override;
-
- size_t CalculateNumChildren() override;
-
- lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
-
- bool Update() override;
-
- bool MightHaveChildren() override;
-
- size_t GetIndexOfChildWithName(const ConstString &name) override;
-
-private:
+
+namespace Foundation1100 {
+ class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+ NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+ ~NSDictionaryMSyntheticFrontEnd() override;
+
+ size_t CalculateNumChildren() override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+ bool Update() override;
+
+ bool MightHaveChildren() override;
+
+ size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+ private:
+ struct DataDescriptor_32 {
+ uint32_t _used : 26;
+ uint32_t _kvo : 1;
+ uint32_t _size;
+ uint32_t _mutations;
+ uint32_t _objs_addr;
+ uint32_t _keys_addr;
+ };
+
+ struct DataDescriptor_64 {
+ uint64_t _used : 58;
+ uint32_t _kvo : 1;
+ uint64_t _size;
+ uint64_t _mutations;
+ uint64_t _objs_addr;
+ uint64_t _keys_addr;
+ };
+
+ struct DictionaryItemDescriptor {
+ lldb::addr_t key_ptr;
+ lldb::addr_t val_ptr;
+ lldb::ValueObjectSP valobj_sp;
+ };
+
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ lldb::ByteOrder m_order;
+ DataDescriptor_32 *m_data_32;
+ DataDescriptor_64 *m_data_64;
+ CompilerType m_pair_type;
+ std::vector<DictionaryItemDescriptor> m_children;
+ };
+}
+
+namespace Foundation1428 {
struct DataDescriptor_32 {
uint32_t _used : 26;
uint32_t _kvo : 1;
uint32_t _size;
- uint32_t _mutations;
- uint32_t _objs_addr;
- uint32_t _keys_addr;
+ uint32_t _buffer;
+ uint64_t GetSize() { return _size; }
};
-
+
struct DataDescriptor_64 {
uint64_t _used : 58;
uint32_t _kvo : 1;
uint64_t _size;
- uint64_t _mutations;
- uint64_t _objs_addr;
- uint64_t _keys_addr;
+ uint64_t _buffer;
+ uint64_t GetSize() { return _size; }
};
-
- struct DictionaryItemDescriptor {
- lldb::addr_t key_ptr;
- lldb::addr_t val_ptr;
- lldb::ValueObjectSP valobj_sp;
+
+
+
+ using NSDictionaryMSyntheticFrontEnd =
+ GenericNSDictionaryMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
+namespace Foundation1437 {
+ static const uint64_t NSDictionaryCapacities[] = {
+ 0, 3, 7, 13, 23, 41, 71, 127, 191, 251, 383, 631, 1087, 1723,
+ 2803, 4523, 7351, 11959, 19447, 31231, 50683, 81919, 132607,
+ 214519, 346607, 561109, 907759, 1468927, 2376191, 3845119,
+ 6221311, 10066421, 16287743, 26354171, 42641881, 68996069,
+ 111638519, 180634607, 292272623, 472907251
+ };
+
+ static const size_t NSDictionaryNumSizeBuckets = sizeof(NSDictionaryCapacities) / sizeof(uint64_t);
+
+ struct DataDescriptor_32 {
+ uint32_t _buffer;
+ union {
+ struct {
+ uint32_t _mutations;
+ };
+ struct {
+ uint32_t _muts;
+ uint32_t _used:25;
+ uint32_t _kvo:1;
+ uint32_t _szidx:6;
+ };
+ };
+
+ uint64_t GetSize() {
+ return (_szidx) >= NSDictionaryNumSizeBuckets ?
+ 0 : NSDictionaryCapacities[_szidx];
+ }
};
+
+ struct DataDescriptor_64 {
+ uint64_t _buffer;
+ union {
+ struct {
+ uint64_t _mutations;
+ };
+ struct {
+ uint32_t _muts;
+ uint32_t _used:25;
+ uint32_t _kvo:1;
+ uint32_t _szidx:6;
+ };
+ };
+
+ uint64_t GetSize() {
+ return (_szidx) >= NSDictionaryNumSizeBuckets ?
+ 0 : NSDictionaryCapacities[_szidx];
+ }
+ };
+
+ using NSDictionaryMSyntheticFrontEnd =
+ GenericNSDictionaryMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+
+ template <typename DD>
+ uint64_t
+ __NSDictionaryMSize_Impl(lldb_private::Process &process,
+ lldb::addr_t valobj_addr, Status &error) {
+ const lldb::addr_t start_of_descriptor =
+ valobj_addr + process.GetAddressByteSize();
+ DD descriptor = DD();
+ process.ReadMemory(start_of_descriptor, &descriptor, sizeof(descriptor),
+ error);
+ if (error.Fail()) {
+ return 0;
+ }
+ return descriptor._used;
+ }
+
+ uint64_t
+ __NSDictionaryMSize(lldb_private::Process &process, lldb::addr_t valobj_addr,
+ Status &error) {
+ if (process.GetAddressByteSize() == 4) {
+ return __NSDictionaryMSize_Impl<DataDescriptor_32>(process, valobj_addr,
+ error);
+ } else {
+ return __NSDictionaryMSize_Impl<DataDescriptor_64>(process, valobj_addr,
+ error);
+ }
+ }
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- lldb::ByteOrder m_order;
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
- CompilerType m_pair_type;
- std::vector<DictionaryItemDescriptor> m_children;
-};
+}
} // namespace formatters
} // namespace lldb_private
@@ -313,12 +408,19 @@ bool lldb_private::formatters::NSDictionarySummaryProvider(
return false;
value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
} else if (class_name == g_DictionaryM || class_name == g_DictionaryMLegacy) {
+ AppleObjCRuntime *apple_runtime =
+ llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
Status error;
- value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
- ptr_size, 0, error);
+ if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1437) {
+ value = Foundation1437::__NSDictionaryMSize(*process_sp, valobj_addr,
+ error);
+ } else {
+ value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+ ptr_size, 0, error);
+ value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+ }
if (error.Fail())
return false;
- value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
} else if (class_name == g_Dictionary1) {
value = 1;
}
@@ -396,13 +498,15 @@ lldb_private::formatters::NSDictionarySyntheticFrontEndCreator(
if (class_name == g_DictionaryI) {
return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
} else if (class_name == g_DictionaryM) {
- if (runtime->GetFoundationVersion() > 1400) {
- return (new NSDictionaryMSyntheticFrontEnd(valobj_sp));
+ if (runtime->GetFoundationVersion() >= 1437) {
+ return (new Foundation1437::NSDictionaryMSyntheticFrontEnd(valobj_sp));
+ } else if (runtime->GetFoundationVersion() >= 1428) {
+ return (new Foundation1428::NSDictionaryMSyntheticFrontEnd(valobj_sp));
} else {
- return (new NSDictionaryMLegacySyntheticFrontEnd(valobj_sp));
+ return (new Foundation1100::NSDictionaryMSyntheticFrontEnd(valobj_sp));
}
} else if (class_name == g_DictionaryMLegacy) {
- return (new NSDictionaryMLegacySyntheticFrontEnd(valobj_sp));
+ return (new Foundation1100::NSDictionaryMSyntheticFrontEnd(valobj_sp));
} else if (class_name == g_Dictionary1) {
return (new NSDictionary1SyntheticFrontEnd(valobj_sp));
} else {
@@ -641,22 +745,25 @@ lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetChildAtIndex(
return m_pair;
}
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
- NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+template <typename D32, typename D64>
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
+ GenericNSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr),
m_pair_type() {}
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
- ~NSDictionaryMSyntheticFrontEnd() {
+template <typename D32, typename D64>
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
+ ~GenericNSDictionaryMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
}
-size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
- GetIndexOfChildWithName(const ConstString &name) {
+template <typename D32, typename D64>
+size_t
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>:: GetIndexOfChildWithName(const ConstString &name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -664,14 +771,18 @@ size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
return idx;
}
-size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
- CalculateNumChildren() {
+template <typename D32, typename D64>
+size_t
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
- return (m_data_32 ? m_data_32->used : m_data_64->used);
+ return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}
-bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update() {
+template <typename D32, typename D64>
+bool
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
+ Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
@@ -691,12 +802,12 @@ bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update() {
m_order = process_sp->GetByteOrder();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+ m_data_32 = new D32();
+ process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
error);
} else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+ m_data_64 = new D64();
+ process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
error);
}
if (error.Fail())
@@ -704,24 +815,28 @@ bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update() {
return false;
}
-bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+template <typename D32, typename D64>
+bool
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
MightHaveChildren() {
return true;
}
+template <typename D32, typename D64>
lldb::ValueObjectSP
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex(
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
+ GetChildAtIndex(
size_t idx) {
lldb::addr_t m_keys_ptr;
lldb::addr_t m_values_ptr;
if (m_data_32) {
- uint32_t size = m_data_32->size;
- m_keys_ptr = m_data_32->buffer;
- m_values_ptr = m_data_32->buffer + (m_ptr_size * size);
+ uint32_t size = m_data_32->GetSize();
+ m_keys_ptr = m_data_32->_buffer;
+ m_values_ptr = m_data_32->_buffer + (m_ptr_size * size);
} else {
- uint32_t size = m_data_64->size;
- m_keys_ptr = m_data_64->buffer;
- m_values_ptr = m_data_64->buffer + (m_ptr_size * size);
+ uint32_t size = m_data_64->GetSize();
+ m_keys_ptr = m_data_64->_buffer;
+ m_values_ptr = m_data_64->_buffer + (m_ptr_size * size);
}
uint32_t num_children = CalculateNumChildren();
@@ -800,22 +915,24 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex(
}
-lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
- NSDictionaryMLegacySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::
+ NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr),
m_pair_type() {}
-lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
- ~NSDictionaryMLegacySyntheticFrontEnd() {
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
}
-size_t lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
- GetIndexOfChildWithName(const ConstString &name) {
+size_t
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(const ConstString &name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -823,14 +940,17 @@ size_t lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
return idx;
}
-size_t lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
- CalculateNumChildren() {
+size_t
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}
-bool lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::Update() {
+bool
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
@@ -863,14 +983,15 @@ bool lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::Update() {
return false;
}
-bool lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::
- MightHaveChildren() {
+bool
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::MightHaveChildren() {
return true;
}
lldb::ValueObjectSP
-lldb_private::formatters::NSDictionaryMLegacySyntheticFrontEnd::GetChildAtIndex(
- size_t idx) {
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
lldb::addr_t m_keys_ptr =
(m_data_32 ? m_data_32->_keys_addr : m_data_64->_keys_addr);
lldb::addr_t m_values_ptr =
diff --git a/source/Plugins/Language/ObjC/NSSet.cpp b/source/Plugins/Language/ObjC/NSSet.cpp
index 2f3398775169..fa2483ecc094 100644
--- a/source/Plugins/Language/ObjC/NSSet.cpp
+++ b/source/Plugins/Language/ObjC/NSSet.cpp
@@ -135,7 +135,7 @@ namespace Foundation1300 {
GenericNSSetMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
}
-namespace Foundation1400 {
+namespace Foundation1428 {
struct DataDescriptor_32 {
uint32_t _used : 26;
uint32_t _size;
@@ -154,6 +154,64 @@ namespace Foundation1400 {
GenericNSSetMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
}
+namespace Foundation1437 {
+ struct DataDescriptor_32 {
+ uint32_t _cow;
+ // __table storage
+ uint32_t _objs_addr;
+ union {
+ uint32_t _mutations;
+ struct {
+ uint32_t _muts;
+ uint32_t _used : 26;
+ uint32_t _szidx : 6;
+ };
+ };
+ };
+
+ struct DataDescriptor_64 {
+ uint64_t _cow;
+ // __Table storage
+ uint64_t _objs_addr;
+ union {
+ uint64_t _mutations;
+ struct {
+ uint32_t _muts;
+ uint32_t _used : 26;
+ uint32_t _szidx : 6;
+ };
+ };
+ };
+
+ using NSSetMSyntheticFrontEnd =
+ GenericNSSetMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+
+ template <typename DD>
+ uint64_t
+ __NSSetMSize_Impl(lldb_private::Process &process, lldb::addr_t valobj_addr,
+ Status &error) {
+ const lldb::addr_t start_of_descriptor =
+ valobj_addr + process.GetAddressByteSize();
+ DD descriptor = DD();
+ process.ReadMemory(start_of_descriptor, &descriptor, sizeof(descriptor),
+ error);
+ if (error.Fail()) {
+ return 0;
+ }
+ return descriptor._used;
+ }
+
+ uint64_t
+ __NSSetMSize(lldb_private::Process &process, lldb::addr_t valobj_addr,
+ Status &error) {
+ if (process.GetAddressByteSize() == 4) {
+ return __NSSetMSize_Impl<DataDescriptor_32>(process, valobj_addr, error);
+ } else {
+ return __NSSetMSize_Impl<DataDescriptor_64>(process, valobj_addr, error);
+ }
+ }
+}
+
class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
NSSetCodeRunningSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
@@ -219,12 +277,18 @@ bool lldb_private::formatters::NSSetSummaryProvider(
return false;
value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
} else if (!strcmp(class_name, "__NSSetM")) {
+ AppleObjCRuntime *apple_runtime =
+ llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
Status error;
- value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
- ptr_size, 0, error);
+ if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1437) {
+ value = Foundation1437::__NSSetMSize(*process_sp, valobj_addr, error);
+ } else {
+ value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+ ptr_size, 0, error);
+ value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+ }
if (error.Fail())
return false;
- value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
}
/*else if (!strcmp(class_name,"__NSCFSet"))
{
@@ -312,10 +376,16 @@ lldb_private::formatters::NSSetSyntheticFrontEndCreator(
} else if (!strcmp(class_name, "__NSSetM")) {
AppleObjCRuntime *apple_runtime =
llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
- if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1400)
- return (new Foundation1400::NSSetMSyntheticFrontEnd(valobj_sp));
- else
+ if (apple_runtime) {
+ if (apple_runtime->GetFoundationVersion() >= 1437)
+ return (new Foundation1437::NSSetMSyntheticFrontEnd(valobj_sp));
+ else if (apple_runtime->GetFoundationVersion() >= 1428)
+ return (new Foundation1428::NSSetMSyntheticFrontEnd(valobj_sp));
+ else
+ return (new Foundation1300::NSSetMSyntheticFrontEnd(valobj_sp));
+ } else {
return (new Foundation1300::NSSetMSyntheticFrontEnd(valobj_sp));
+ }
} else {
auto &map(NSSet_Additionals::GetAdditionalSynthetics());
auto iter = map.find(class_name_cs), end = map.end();
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index e99fd74a352f..105c088b9e91 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -324,8 +324,6 @@ public:
clang::ASTContext &ast_ctx(interface_decl->getASTContext());
- clang::QualType return_qual_type;
-
const bool isInstance = instance;
const bool isVariadic = false;
const bool isSynthesized = false;
@@ -653,3 +651,11 @@ AppleObjCDeclVendor::FindDecls(const ConstString &name, bool append,
return ret;
}
+
+clang::ExternalASTMerger::ImporterSource
+AppleObjCDeclVendor::GetImporterSource() {
+ return {*m_ast_ctx.getASTContext(),
+ *m_ast_ctx.getFileManager(),
+ m_ast_ctx.GetOriginMap()
+ };
+}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
index 26824079d945..2f087da16bc1 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
@@ -30,6 +30,8 @@ public:
uint32_t FindDecls(const ConstString &name, bool append, uint32_t max_matches,
std::vector<clang::NamedDecl *> &decls) override;
+ clang::ExternalASTMerger::ImporterSource GetImporterSource() override;
+
friend class AppleObjCExternalASTSource;
private:
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index 57d98fbd7283..1b22ee4c3be1 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -95,6 +95,8 @@ public:
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
lldb::addr_t &cf_false);
+
+ virtual bool IsTaggedPointer (lldb::addr_t addr) { return false; }
protected:
// Call CreateInstance instead.
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 2a7735959a91..bdf79f7b82bd 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -62,6 +62,11 @@
#include "AppleObjCTrampolineHandler.h"
#include "AppleObjCTypeEncodingParser.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclObjC.h"
+
+#include <vector>
+
using namespace lldb;
using namespace lldb_private;
@@ -394,7 +399,7 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
}
bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
- ValueObject &in_value, DynamicValueType use_dynamic,
+ ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type) {
// We should never get here with a null process...
@@ -811,85 +816,43 @@ UtilityFunction *AppleObjCRuntimeV2::CreateObjectChecker(const char *name) {
int len = 0;
if (m_has_object_getClass) {
- len = ::snprintf(check_function_code, sizeof(check_function_code),
- "extern \"C\" void *gdb_object_getClass(void *); "
- " \n"
- "extern \"C\" int printf(const char *format, ...); "
- " \n"
- "extern \"C\" void "
- " \n"
- "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) "
- " \n"
- "{ "
- " \n"
- " if ($__lldb_arg_obj == (void *)0) "
- " \n"
- " return; // nil is ok "
- " \n"
- " if (!gdb_object_getClass($__lldb_arg_obj)) "
- " \n"
- " *((volatile int *)0) = 'ocgc'; "
- " \n"
- " else if ($__lldb_arg_selector != (void *)0) "
- " \n"
- " { "
- " \n"
- " signed char responds = (signed char) [(id) "
- "$__lldb_arg_obj \n"
- " "
- "respondsToSelector: \n"
- " (struct "
- "objc_selector *) $__lldb_arg_selector]; \n"
- " if (responds == (signed char) 0) "
- " \n"
- " *((volatile int *)0) = 'ocgc'; "
- " \n"
- " } "
- " \n"
- "} "
- " \n",
- name);
+ len = ::snprintf(check_function_code, sizeof(check_function_code), R"(
+ extern "C" void *gdb_object_getClass(void *);
+ extern "C" int printf(const char *format, ...);
+ extern "C" void
+ %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
+ if ($__lldb_arg_obj == (void *)0)
+ return; // nil is ok
+ if (!gdb_object_getClass($__lldb_arg_obj)) {
+ *((volatile int *)0) = 'ocgc';
+ } else if ($__lldb_arg_selector != (void *)0) {
+ signed char $responds = (signed char)
+ [(id)$__lldb_arg_obj respondsToSelector:
+ (void *) $__lldb_arg_selector];
+ if ($responds == (signed char) 0)
+ *((volatile int *)0) = 'ocgc';
+ }
+ })", name);
} else {
- len = ::snprintf(check_function_code, sizeof(check_function_code),
- "extern \"C\" void *gdb_class_getClass(void *); "
- " \n"
- "extern \"C\" int printf(const char *format, ...); "
- " \n"
- "extern \"C\" void "
- " \n"
- "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) "
- " \n"
- "{ "
- " \n"
- " if ($__lldb_arg_obj == (void *)0) "
- " \n"
- " return; // nil is ok "
- " \n"
- " void **$isa_ptr = (void **)$__lldb_arg_obj; "
- " \n"
- " if (*$isa_ptr == (void *)0 || "
- "!gdb_class_getClass(*$isa_ptr)) \n"
- " *((volatile int *)0) = 'ocgc'; "
- " \n"
- " else if ($__lldb_arg_selector != (void *)0) "
- " \n"
- " { "
- " \n"
- " signed char responds = (signed char) [(id) "
- "$__lldb_arg_obj \n"
- " "
- "respondsToSelector: \n"
- " (struct "
- "objc_selector *) $__lldb_arg_selector]; \n"
- " if (responds == (signed char) 0) "
- " \n"
- " *((volatile int *)0) = 'ocgc'; "
- " \n"
- " } "
- " \n"
- "} "
- " \n",
- name);
+ len = ::snprintf(check_function_code, sizeof(check_function_code), R"(
+ extern "C" void *gdb_class_getClass(void *);
+ extern "C" int printf(const char *format, ...);
+ extern "C" void
+ %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
+ if ($__lldb_arg_obj == (void *)0)
+ return; // nil is ok
+ void **$isa_ptr = (void **)$__lldb_arg_obj;
+ if (*$isa_ptr == (void *)0 ||
+ !gdb_class_getClass(*$isa_ptr))
+ *((volatile int *)0) = 'ocgc';
+ else if ($__lldb_arg_selector != (void *)0) {
+ signed char $responds = (signed char)
+ [(id)$__lldb_arg_obj respondsToSelector:
+ (void *) $__lldb_arg_selector];
+ if ($responds == (signed char) 0)
+ *((volatile int *)0) = 'ocgc';
+ }
+ })", name);
}
assert(len < (int)sizeof(check_function_code));
@@ -2022,6 +1985,8 @@ AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(
Status error;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
+
auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(
process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error);
if (error.Fail())
@@ -2038,12 +2003,47 @@ AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(
if (error.Fail())
return NULL;
+ if (log)
+ log->PutCString("AOCRT::NPI: Found all the non-indexed ISA masks");
+
+ bool foundError = false;
+ auto objc_debug_indexed_isa_magic_mask = ExtractRuntimeGlobalSymbol(
+ process, ConstString("objc_debug_indexed_isa_magic_mask"), objc_module_sp,
+ error);
+ foundError |= error.Fail();
+
+ auto objc_debug_indexed_isa_magic_value = ExtractRuntimeGlobalSymbol(
+ process, ConstString("objc_debug_indexed_isa_magic_value"),
+ objc_module_sp, error);
+ foundError |= error.Fail();
+
+ auto objc_debug_indexed_isa_index_mask = ExtractRuntimeGlobalSymbol(
+ process, ConstString("objc_debug_indexed_isa_index_mask"), objc_module_sp,
+ error);
+ foundError |= error.Fail();
+
+ auto objc_debug_indexed_isa_index_shift = ExtractRuntimeGlobalSymbol(
+ process, ConstString("objc_debug_indexed_isa_index_shift"),
+ objc_module_sp, error);
+ foundError |= error.Fail();
+
+ auto objc_indexed_classes =
+ ExtractRuntimeGlobalSymbol(process, ConstString("objc_indexed_classes"),
+ objc_module_sp, error, false);
+ foundError |= error.Fail();
+
+ if (log)
+ log->PutCString("AOCRT::NPI: Found all the indexed ISA masks");
+
// we might want to have some rules to outlaw these other values (e.g if the
// mask is zero but the value is non-zero, ...)
- return new NonPointerISACache(runtime, objc_debug_isa_class_mask,
- objc_debug_isa_magic_mask,
- objc_debug_isa_magic_value);
+ return new NonPointerISACache(
+ runtime, objc_module_sp, objc_debug_isa_class_mask,
+ objc_debug_isa_magic_mask, objc_debug_isa_magic_value,
+ objc_debug_indexed_isa_magic_mask, objc_debug_indexed_isa_magic_value,
+ objc_debug_indexed_isa_index_mask, objc_debug_indexed_isa_index_shift,
+ foundError ? 0 : objc_indexed_classes);
}
AppleObjCRuntimeV2::TaggedPointerVendorV2 *
@@ -2371,12 +2371,23 @@ AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor(
}
AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache(
- AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_isa_class_mask,
- uint64_t objc_debug_isa_magic_mask, uint64_t objc_debug_isa_magic_value)
- : m_runtime(runtime), m_cache(),
+ AppleObjCRuntimeV2 &runtime, const ModuleSP &objc_module_sp,
+ uint64_t objc_debug_isa_class_mask, uint64_t objc_debug_isa_magic_mask,
+ uint64_t objc_debug_isa_magic_value,
+ uint64_t objc_debug_indexed_isa_magic_mask,
+ uint64_t objc_debug_indexed_isa_magic_value,
+ uint64_t objc_debug_indexed_isa_index_mask,
+ uint64_t objc_debug_indexed_isa_index_shift,
+ lldb::addr_t objc_indexed_classes)
+ : m_runtime(runtime), m_cache(), m_objc_module_wp(objc_module_sp),
m_objc_debug_isa_class_mask(objc_debug_isa_class_mask),
m_objc_debug_isa_magic_mask(objc_debug_isa_magic_mask),
- m_objc_debug_isa_magic_value(objc_debug_isa_magic_value) {}
+ m_objc_debug_isa_magic_value(objc_debug_isa_magic_value),
+ m_objc_debug_indexed_isa_magic_mask(objc_debug_indexed_isa_magic_mask),
+ m_objc_debug_indexed_isa_magic_value(objc_debug_indexed_isa_magic_value),
+ m_objc_debug_indexed_isa_index_mask(objc_debug_indexed_isa_index_mask),
+ m_objc_debug_indexed_isa_index_shift(objc_debug_indexed_isa_index_shift),
+ m_objc_indexed_classes(objc_indexed_classes), m_indexed_isa_cache() {}
ObjCLanguageRuntime::ClassDescriptorSP
AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) {
@@ -2395,8 +2406,106 @@ AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) {
bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
ObjCISA isa, ObjCISA &ret_isa) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
+
+ if (log)
+ log->Printf("AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
+
if ((isa & ~m_objc_debug_isa_class_mask) == 0)
return false;
+
+ // If all of the indexed ISA variables are set, then its possible that
+ // this ISA is indexed, and we should first try to get its value using
+ // the index.
+ // Note, we check these varaibles first as the ObjC runtime will set at
+ // least one of their values to 0 if they aren't needed.
+ if (m_objc_debug_indexed_isa_magic_mask &&
+ m_objc_debug_indexed_isa_magic_value &&
+ m_objc_debug_indexed_isa_index_mask &&
+ m_objc_debug_indexed_isa_index_shift && m_objc_indexed_classes) {
+ if ((isa & ~m_objc_debug_indexed_isa_index_mask) == 0)
+ return false;
+
+ if ((isa & m_objc_debug_indexed_isa_magic_mask) ==
+ m_objc_debug_indexed_isa_magic_value) {
+ // Magic bits are correct, so try extract the index.
+ uintptr_t index = (isa & m_objc_debug_indexed_isa_index_mask) >>
+ m_objc_debug_indexed_isa_index_shift;
+ // If the index is out of bounds of the length of the array then
+ // check if the array has been updated. If that is the case then
+ // we should try read the count again, and update the cache if the
+ // count has been updated.
+ if (index > m_indexed_isa_cache.size()) {
+ if (log)
+ log->Printf("AOCRT::NPI (index = %" PRIu64
+ ") exceeds cache (size = %" PRIu64 ")",
+ (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
+
+ Process *process(m_runtime.GetProcess());
+
+ ModuleSP objc_module_sp(m_objc_module_wp.lock());
+ if (!objc_module_sp)
+ return false;
+
+ Status error;
+ auto objc_indexed_classes_count = ExtractRuntimeGlobalSymbol(
+ process, ConstString("objc_indexed_classes_count"), objc_module_sp,
+ error);
+ if (error.Fail())
+ return false;
+
+ if (log)
+ log->Printf("AOCRT::NPI (new class count = %" PRIu64 ")",
+ (uint64_t)objc_indexed_classes_count);
+
+ if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
+ // Read the class entries we don't have. We should just
+ // read all of them instead of just the one we need as then
+ // we can cache those we may need later.
+ auto num_new_classes =
+ objc_indexed_classes_count - m_indexed_isa_cache.size();
+ const uint32_t addr_size = process->GetAddressByteSize();
+ DataBufferHeap buffer(num_new_classes * addr_size, 0);
+
+ lldb::addr_t last_read_class =
+ m_objc_indexed_classes + (m_indexed_isa_cache.size() * addr_size);
+ size_t bytes_read = process->ReadMemory(
+ last_read_class, buffer.GetBytes(), buffer.GetByteSize(), error);
+ if (error.Fail() || bytes_read != buffer.GetByteSize())
+ return false;
+
+ if (log)
+ log->Printf("AOCRT::NPI (read new classes count = %" PRIu64 ")",
+ (uint64_t)num_new_classes);
+
+ // Append the new entries to the existing cache.
+ DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
+ process->GetByteOrder(),
+ process->GetAddressByteSize());
+
+ lldb::offset_t offset = 0;
+ for (unsigned i = 0; i != num_new_classes; ++i)
+ m_indexed_isa_cache.push_back(data.GetPointer(&offset));
+ }
+ }
+
+ // If the index is still out of range then this isn't a pointer.
+ if (index > m_indexed_isa_cache.size())
+ return false;
+
+ if (log)
+ log->Printf("AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
+ (uint64_t)m_indexed_isa_cache[index]);
+
+ ret_isa = m_indexed_isa_cache[index];
+ return (ret_isa != 0); // this is a pointer so 0 is not a valid value
+ }
+
+ return false;
+ }
+
+ // Definately not an indexed ISA, so try to use a mask to extract
+ // the pointer from the ISA.
if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) {
ret_isa = isa & m_objc_debug_isa_class_mask;
return (ret_isa != 0); // this is a pointer so 0 is not a valid value
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index 718073090406..89e81d5b181e 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -88,6 +88,8 @@ public:
EncodingToTypeSP GetEncodingToType() override;
+ bool IsTaggedPointer(lldb::addr_t ptr) override;
+
TaggedPointerVendor *GetTaggedPointerVendor() override {
return m_tagged_pointer_vendor_ap.get();
}
@@ -138,18 +140,33 @@ private:
private:
NonPointerISACache(AppleObjCRuntimeV2 &runtime,
+ const lldb::ModuleSP &objc_module_sp,
uint64_t objc_debug_isa_class_mask,
uint64_t objc_debug_isa_magic_mask,
- uint64_t objc_debug_isa_magic_value);
+ uint64_t objc_debug_isa_magic_value,
+ uint64_t objc_debug_indexed_isa_magic_mask,
+ uint64_t objc_debug_indexed_isa_magic_value,
+ uint64_t objc_debug_indexed_isa_index_mask,
+ uint64_t objc_debug_indexed_isa_index_shift,
+ lldb::addr_t objc_indexed_classes);
bool EvaluateNonPointerISA(ObjCISA isa, ObjCISA &ret_isa);
AppleObjCRuntimeV2 &m_runtime;
std::map<ObjCISA, ObjCLanguageRuntime::ClassDescriptorSP> m_cache;
+ lldb::ModuleWP m_objc_module_wp;
uint64_t m_objc_debug_isa_class_mask;
uint64_t m_objc_debug_isa_magic_mask;
uint64_t m_objc_debug_isa_magic_value;
+ uint64_t m_objc_debug_indexed_isa_magic_mask;
+ uint64_t m_objc_debug_indexed_isa_magic_value;
+ uint64_t m_objc_debug_indexed_isa_index_mask;
+ uint64_t m_objc_debug_indexed_isa_index_shift;
+ lldb::addr_t m_objc_indexed_classes;
+
+ std::vector<lldb::addr_t> m_indexed_isa_cache;
+
friend class AppleObjCRuntimeV2;
DISALLOW_COPY_AND_ASSIGN(NonPointerISACache);
@@ -279,8 +296,6 @@ private:
ObjCISA GetPointerISA(ObjCISA isa);
- bool IsTaggedPointer(lldb::addr_t ptr);
-
lldb::addr_t GetISAHashTablePointer();
bool UpdateISAToDescriptorMapFromMemory(RemoteNXMapTable &hash_table);
diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 7e46afcccdab..ad1083be0285 100644
--- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -3615,13 +3615,15 @@ RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) {
}
BreakpointResolverSP resolver_sp(new RSBreakpointResolver(nullptr, name));
- BreakpointSP bp = GetProcess()->GetTarget().CreateBreakpoint(
+ Target &target = GetProcess()->GetTarget();
+ BreakpointSP bp = target.CreateBreakpoint(
m_filtersp, resolver_sp, false, false, false);
// Give RS breakpoints a specific name, so the user can manipulate them as a
// group.
Status err;
- if (!bp->AddName("RenderScriptKernel", err))
+ target.AddNameToBreakpoint(bp, "RenderScriptKernel", err);
+ if (err.Fail() && log)
if (log)
log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
err.AsCString());
@@ -3643,14 +3645,15 @@ RenderScriptRuntime::CreateReductionBreakpoint(const ConstString &name,
BreakpointResolverSP resolver_sp(new RSReduceBreakpointResolver(
nullptr, name, &m_rsmodules, kernel_types));
- BreakpointSP bp = GetProcess()->GetTarget().CreateBreakpoint(
+ Target &target = GetProcess()->GetTarget();
+ BreakpointSP bp = target.CreateBreakpoint(
m_filtersp, resolver_sp, false, false, false);
// Give RS breakpoints a specific name, so the user can manipulate them as a
// group.
Status err;
- if (!bp->AddName("RenderScriptReduction", err))
- if (log)
+ target.AddNameToBreakpoint(bp, "RenderScriptReduction", err);
+ if (err.Fail() && log)
log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
err.AsCString());
@@ -3885,15 +3888,16 @@ RenderScriptRuntime::CreateScriptGroupBreakpoint(const ConstString &name,
BreakpointResolverSP resolver_sp(new RSScriptGroupBreakpointResolver(
nullptr, name, m_scriptGroups, stop_on_all));
- BreakpointSP bp = GetProcess()->GetTarget().CreateBreakpoint(
+ Target &target = GetProcess()->GetTarget();
+ BreakpointSP bp = target.CreateBreakpoint(
m_filtersp, resolver_sp, false, false, false);
// Give RS breakpoints a specific name, so the user can manipulate them as a
// group.
Status err;
- if (!bp->AddName(name.AsCString(), err))
- if (log)
- log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
- err.AsCString());
+ target.AddNameToBreakpoint(bp, name.GetCString(), err);
+ if (err.Fail() && log)
+ log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
+ err.AsCString());
// ask the breakpoint to resolve itself
bp->ResolveBreakpoint();
return bp;
diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 25bfce7a2b83..d7bef836d9d8 100644
--- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -27,12 +27,12 @@ typedef struct ar_hdr {
#include <ar.h>
#endif
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
index 0e10d47f2ce4..cb63eccff65e 100644
--- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -10,10 +10,9 @@
#ifndef liblldb_ObjectContainerBSDArchive_h_
#define liblldb_ObjectContainerBSDArchive_h_
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/ObjectContainer.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
diff --git a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 31eb17873f3e..0266bbe27e7d 100644
--- a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -8,12 +8,12 @@
//===----------------------------------------------------------------------===//
#include "ObjectContainerUniversalMachO.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Plugins/ObjectFile/ELF/CMakeLists.txt b/source/Plugins/ObjectFile/ELF/CMakeLists.txt
index e0680b07efc5..45a4edcbb1c9 100644
--- a/source/Plugins/ObjectFile/ELF/CMakeLists.txt
+++ b/source/Plugins/ObjectFile/ELF/CMakeLists.txt
@@ -9,5 +9,6 @@ add_lldb_library(lldbPluginObjectFileELF PLUGIN
lldbTarget
LINK_COMPONENTS
BinaryFormat
+ Object
Support
)
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 3b33cf1601fb..17d892450e4d 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -13,7 +13,6 @@
#include <cassert>
#include <unordered_map>
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -23,6 +22,8 @@
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
@@ -31,6 +32,7 @@
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Object/Decompressor.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -405,7 +407,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
lldb::offset_t length) {
if (!data_sp) {
data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -423,7 +425,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
// Update the data to contain the entire file if it doesn't already
if (data_sp->GetByteSize() < length) {
data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -451,7 +453,7 @@ ObjectFile *ObjectFileELF::CreateMemoryInstance(
if (ELFHeader::MagicBytesMatch(magic)) {
unsigned address_size = ELFHeader::AddressSizeInBytes(magic);
if (address_size == 4 || address_size == 8) {
- std::auto_ptr<ObjectFileELF> objfile_ap(
+ std::unique_ptr<ObjectFileELF> objfile_ap(
new ObjectFileELF(module_sp, data_sp, process_sp, header_addr));
ArchSpec spec;
if (objfile_ap->GetArchitecture(spec) &&
@@ -1818,6 +1820,12 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
if (!m_sections_ap.get() && ParseSectionHeaders()) {
m_sections_ap.reset(new SectionList());
+ // Object files frequently have 0 for every section address, meaning we
+ // need to compute synthetic addresses in order for "file addresses" from
+ // different sections to not overlap
+ bool synthaddrs = (CalculateType() == ObjectFile::Type::eTypeObjectFile);
+ uint64_t nextaddr = 0;
+
for (SectionHeaderCollIter I = m_section_headers.begin();
I != m_section_headers.end(); ++I) {
const ELFSectionHeaderInfo &header = *I;
@@ -1835,6 +1843,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
static ConstString g_sect_name_dwarf_debug_abbrev(".debug_abbrev");
static ConstString g_sect_name_dwarf_debug_addr(".debug_addr");
static ConstString g_sect_name_dwarf_debug_aranges(".debug_aranges");
+ static ConstString g_sect_name_dwarf_debug_cu_index(".debug_cu_index");
static ConstString g_sect_name_dwarf_debug_frame(".debug_frame");
static ConstString g_sect_name_dwarf_debug_info(".debug_info");
static ConstString g_sect_name_dwarf_debug_line(".debug_line");
@@ -1904,6 +1913,8 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
sect_type = eSectionTypeDWARFDebugAddr;
else if (name == g_sect_name_dwarf_debug_aranges)
sect_type = eSectionTypeDWARFDebugAranges;
+ else if (name == g_sect_name_dwarf_debug_cu_index)
+ sect_type = eSectionTypeDWARFDebugCuIndex;
else if (name == g_sect_name_dwarf_debug_frame)
sect_type = eSectionTypeDWARFDebugFrame;
else if (name == g_sect_name_dwarf_debug_info)
@@ -1987,9 +1998,18 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
? m_arch_spec.GetDataByteSize()
: eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
: 1;
-
elf::elf_xword log2align =
(header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
+
+ uint64_t addr = header.sh_addr;
+
+ if ((header.sh_flags & SHF_ALLOC) && synthaddrs) {
+ nextaddr =
+ (nextaddr + header.sh_addralign - 1) & ~(header.sh_addralign - 1);
+ addr = nextaddr;
+ nextaddr += vm_size;
+ }
+
SectionSP section_sp(new Section(
GetModule(), // Module to which this section belongs.
this, // ObjectFile to which this section belongs and should read
@@ -1997,7 +2017,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
SectionIndex(I), // Section ID.
name, // Section name.
sect_type, // Section type.
- header.sh_addr, // VM address.
+ addr, // VM address.
vm_size, // VM size in bytes of this section.
header.sh_offset, // Offset of this section in the file.
file_size, // Size of the section as found in the file.
@@ -2015,13 +2035,14 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
if (m_sections_ap.get()) {
if (GetType() == eTypeDebugInfo) {
static const SectionType g_sections[] = {
- eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr,
- eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame,
- eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine,
- eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo,
- eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes,
- eSectionTypeDWARFDebugRanges, eSectionTypeDWARFDebugStr,
- eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable,
+ eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr,
+ eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex,
+ eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo,
+ eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc,
+ eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames,
+ eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges,
+ eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets,
+ eSectionTypeELFSymbolTable,
};
SectionList *elf_section_list = m_sections_ap.get();
for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]);
@@ -2714,7 +2735,7 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table, user_id_t start_id,
rel_data, symtab_data, strtab_data);
}
-unsigned ObjectFileELF::RelocateSection(
+unsigned ObjectFileELF::ApplyRelocations(
Symtab *symtab, const ELFHeader *hdr, const ELFSectionHeader *rel_hdr,
const ELFSectionHeader *symtab_hdr, const ELFSectionHeader *debug_hdr,
DataExtractor &rel_data, DataExtractor &symtab_data,
@@ -2745,6 +2766,14 @@ unsigned ObjectFileELF::RelocateSection(
case R_386_32:
case R_386_PC32:
default:
+ // FIXME: This asserts with this input:
+ //
+ // foo.cpp
+ // int main(int argc, char **argv) { return 0; }
+ //
+ // clang++.exe --target=i686-unknown-linux-gnu -g -c foo.cpp -o foo.o
+ //
+ // and running this on the foo.o module.
assert(false && "unexpected relocation type");
}
} else {
@@ -2791,7 +2820,8 @@ unsigned ObjectFileELF::RelocateSection(
}
unsigned ObjectFileELF::RelocateDebugSections(const ELFSectionHeader *rel_hdr,
- user_id_t rel_id) {
+ user_id_t rel_id,
+ lldb_private::Symtab *thetab) {
assert(rel_hdr->sh_type == SHT_RELA || rel_hdr->sh_type == SHT_REL);
// Parse in the section list if needed.
@@ -2827,10 +2857,11 @@ unsigned ObjectFileELF::RelocateDebugSections(const ELFSectionHeader *rel_hdr,
DataExtractor symtab_data;
DataExtractor debug_data;
- if (ReadSectionData(rel, rel_data) && ReadSectionData(symtab, symtab_data) &&
- ReadSectionData(debug, debug_data)) {
- RelocateSection(m_symtab_ap.get(), &m_header, rel_hdr, symtab_hdr,
- debug_hdr, rel_data, symtab_data, debug_data, debug);
+ if (GetData(rel->GetFileOffset(), rel->GetFileSize(), rel_data) &&
+ GetData(symtab->GetFileOffset(), symtab->GetFileSize(), symtab_data) &&
+ GetData(debug->GetFileOffset(), debug->GetFileSize(), debug_data)) {
+ ApplyRelocations(thetab, &m_header, rel_hdr, symtab_hdr, debug_hdr,
+ rel_data, symtab_data, debug_data, debug);
}
return 0;
@@ -2924,21 +2955,48 @@ Symtab *ObjectFileELF::GetSymtab() {
m_symtab_ap->CalculateSymbolSizes();
}
+ return m_symtab_ap.get();
+}
+
+void ObjectFileELF::RelocateSection(lldb_private::Section *section)
+{
+ static const char *debug_prefix = ".debug";
+
+ // Set relocated bit so we stop getting called, regardless of
+ // whether we actually relocate.
+ section->SetIsRelocated(true);
+
+ // We only relocate in ELF relocatable files
+ if (CalculateType() != eTypeObjectFile)
+ return;
+
+ const char *section_name = section->GetName().GetCString();
+ // Can't relocate that which can't be named
+ if (section_name == nullptr)
+ return;
+
+ // We don't relocate non-debug sections at the moment
+ if (strncmp(section_name, debug_prefix, strlen(debug_prefix)))
+ return;
+
+ // Relocation section names to look for
+ std::string needle = std::string(".rel") + section_name;
+ std::string needlea = std::string(".rela") + section_name;
+
for (SectionHeaderCollIter I = m_section_headers.begin();
I != m_section_headers.end(); ++I) {
if (I->sh_type == SHT_RELA || I->sh_type == SHT_REL) {
- if (CalculateType() == eTypeObjectFile) {
- const char *section_name = I->section_name.AsCString("");
- if (strstr(section_name, ".rela.debug") ||
- strstr(section_name, ".rel.debug")) {
- const ELFSectionHeader &reloc_header = *I;
- user_id_t reloc_id = SectionIndex(I);
- RelocateDebugSections(&reloc_header, reloc_id);
- }
+ const char *hay_name = I->section_name.GetCString();
+ if (hay_name == nullptr)
+ continue;
+ if (needle == hay_name || needlea == hay_name) {
+ const ELFSectionHeader &reloc_header = *I;
+ user_id_t reloc_id = SectionIndex(I);
+ RelocateDebugSections(&reloc_header, reloc_id, GetSymtab());
+ break;
}
}
}
- return m_symtab_ap.get();
}
void ObjectFileELF::ParseUnwindSymbols(Symtab *symbol_table,
@@ -3404,3 +3462,56 @@ ObjectFile::Strata ObjectFileELF::CalculateStrata() {
}
return eStrataUnknown;
}
+
+size_t ObjectFileELF::ReadSectionData(Section *section,
+ lldb::offset_t section_offset, void *dst,
+ size_t dst_len) {
+ // If some other objectfile owns this data, pass this to them.
+ if (section->GetObjectFile() != this)
+ return section->GetObjectFile()->ReadSectionData(section, section_offset,
+ dst, dst_len);
+
+ if (!section->Test(SHF_COMPRESSED))
+ return ObjectFile::ReadSectionData(section, section_offset, dst, dst_len);
+
+ // For compressed sections we need to read to full data to be able to
+ // decompress.
+ DataExtractor data;
+ ReadSectionData(section, data);
+ return data.CopyData(section_offset, dst_len, dst);
+}
+
+size_t ObjectFileELF::ReadSectionData(Section *section,
+ DataExtractor &section_data) {
+ // If some other objectfile owns this data, pass this to them.
+ if (section->GetObjectFile() != this)
+ return section->GetObjectFile()->ReadSectionData(section, section_data);
+
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
+
+ size_t result = ObjectFile::ReadSectionData(section, section_data);
+ if (result == 0 || !section->Test(SHF_COMPRESSED))
+ return result;
+
+ auto Decompressor = llvm::object::Decompressor::create(
+ section->GetName().GetStringRef(),
+ {reinterpret_cast<const char *>(section_data.GetDataStart()),
+ size_t(section_data.GetByteSize())},
+ GetByteOrder() == eByteOrderLittle, GetAddressByteSize() == 8);
+ if (!Decompressor) {
+ LLDB_LOG(log, "Unable to initialize decompressor for section {0}: {1}",
+ section->GetName(), llvm::toString(Decompressor.takeError()));
+ return result;
+ }
+ auto buffer_sp =
+ std::make_shared<DataBufferHeap>(Decompressor->getDecompressedSize(), 0);
+ if (auto Error = Decompressor->decompress(
+ {reinterpret_cast<char *>(buffer_sp->GetBytes()),
+ size_t(buffer_sp->GetByteSize())})) {
+ LLDB_LOG(log, "Decompression of section {0} failed: {1}",
+ section->GetName(), llvm::toString(std::move(Error)));
+ return result;
+ }
+ section_data.SetData(buffer_sp);
+ return buffer_sp->GetByteSize();
+}
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index 6d8717b0ef25..2909f4e52e4a 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -16,10 +16,8 @@
// C++ Includes
#include <vector>
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/UUID.h"
#include "lldb/lldb-private.h"
@@ -142,6 +140,13 @@ public:
ObjectFile::Strata CalculateStrata() override;
+ size_t ReadSectionData(lldb_private::Section *section,
+ lldb::offset_t section_offset, void *dst,
+ size_t dst_len) override;
+
+ size_t ReadSectionData(lldb_private::Section *section,
+ lldb_private::DataExtractor &section_data) override;
+
// Returns number of program headers found in the ELF file.
size_t GetProgramHeaderCount();
@@ -154,6 +159,8 @@ public:
llvm::StringRef
StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const override;
+ void RelocateSection(lldb_private::Section *section) override;
+
private:
ObjectFileELF(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
@@ -296,17 +303,18 @@ private:
/// Relocates debug sections
unsigned RelocateDebugSections(const elf::ELFSectionHeader *rel_hdr,
- lldb::user_id_t rel_id);
-
- unsigned RelocateSection(lldb_private::Symtab *symtab,
- const elf::ELFHeader *hdr,
- const elf::ELFSectionHeader *rel_hdr,
- const elf::ELFSectionHeader *symtab_hdr,
- const elf::ELFSectionHeader *debug_hdr,
- lldb_private::DataExtractor &rel_data,
- lldb_private::DataExtractor &symtab_data,
- lldb_private::DataExtractor &debug_data,
- lldb_private::Section *rel_section);
+ lldb::user_id_t rel_id,
+ lldb_private::Symtab *thetab);
+
+ unsigned ApplyRelocations(lldb_private::Symtab *symtab,
+ const elf::ELFHeader *hdr,
+ const elf::ELFSectionHeader *rel_hdr,
+ const elf::ELFSectionHeader *symtab_hdr,
+ const elf::ELFSectionHeader *debug_hdr,
+ lldb_private::DataExtractor &rel_data,
+ lldb_private::DataExtractor &symtab_data,
+ lldb_private::DataExtractor &debug_data,
+ lldb_private::Section *rel_section);
/// Loads the section name string table into m_shstr_data. Returns the
/// number of bytes constituting the table.
diff --git a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index 06406c6f1655..a9ab366fbf53 100644
--- a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -10,8 +10,6 @@
#include "llvm/ADT/StringRef.h"
#include "ObjectFileJIT.h"
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
@@ -26,6 +24,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/FileSpec.h"
@@ -230,9 +229,9 @@ bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value,
return num_loaded_sections > 0;
}
-size_t ObjectFileJIT::ReadSectionData(const lldb_private::Section *section,
+size_t ObjectFileJIT::ReadSectionData(lldb_private::Section *section,
lldb::offset_t section_offset, void *dst,
- size_t dst_len) const {
+ size_t dst_len) {
lldb::offset_t file_size = section->GetFileSize();
if (section_offset < file_size) {
size_t src_len = file_size - section_offset;
@@ -248,8 +247,8 @@ size_t ObjectFileJIT::ReadSectionData(const lldb_private::Section *section,
}
size_t ObjectFileJIT::ReadSectionData(
- const lldb_private::Section *section,
- lldb_private::DataExtractor &section_data) const {
+ lldb_private::Section *section,
+ lldb_private::DataExtractor &section_data) {
if (section->GetFileSize()) {
const void *src = (void *)(uintptr_t)section->GetFileOffset();
diff --git a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
index a211645d5d8b..c964906a5e8e 100644
--- a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
+++ b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
@@ -83,13 +83,13 @@ public:
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
- size_t ReadSectionData(const lldb_private::Section *section,
+ size_t ReadSectionData(lldb_private::Section *section,
lldb::offset_t section_offset, void *dst,
- size_t dst_len) const override;
+ size_t dst_len) override;
size_t
- ReadSectionData(const lldb_private::Section *section,
- lldb_private::DataExtractor &section_data) const override;
+ ReadSectionData(lldb_private::Section *section,
+ lldb_private::DataExtractor &section_data) override;
lldb_private::Address GetEntryPointAddress() override;
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 9bc171e454c9..df334f88ee3b 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -17,7 +17,6 @@
#include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
#include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
@@ -38,6 +37,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
@@ -686,7 +686,7 @@ public:
case FPURegSet: {
uint8_t *fpu_reg_buf = (uint8_t *)&fpu.v[0];
const int fpu_reg_buf_size = sizeof(fpu);
- if (fpu_reg_buf_size == count &&
+ if (fpu_reg_buf_size == count * sizeof(uint32_t) &&
data.ExtractBytes(offset, fpu_reg_buf_size, eByteOrderLittle,
fpu_reg_buf) == fpu_reg_buf_size) {
SetError(FPURegSet, Read, 0);
@@ -1200,6 +1200,7 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) {
case eSectionTypeDWARFDebugAbbrev:
case eSectionTypeDWARFDebugAddr:
case eSectionTypeDWARFDebugAranges:
+ case eSectionTypeDWARFDebugCuIndex:
case eSectionTypeDWARFDebugFrame:
case eSectionTypeDWARFDebugInfo:
case eSectionTypeDWARFDebugLine:
diff --git a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 5607a71ad5aa..72b1b15f08f8 100644
--- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -10,9 +10,6 @@
#include "ObjectFilePECOFF.h"
#include "WindowsMiniDump.h"
-#include "llvm/BinaryFormat/COFF.h"
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -23,12 +20,14 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -136,6 +135,11 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
spec.SetTriple("i686-pc-windows");
specs.Append(ModuleSpec(file, spec));
}
+ else if (coff_header.machine == MachineArmNt)
+ {
+ spec.SetTriple("arm-pc-windows");
+ specs.Append(ModuleSpec(file, spec));
+ }
}
}
}
@@ -537,7 +541,8 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
// First 4 bytes should be zeroed after strtab_size has been read,
// because it is used as offset 0 to encode a NULL string.
- uint32_t *strtab_data_start = (uint32_t *)strtab_data.GetDataStart();
+ uint32_t *strtab_data_start = const_cast<uint32_t *>(
+ reinterpret_cast<const uint32_t *>(strtab_data.GetDataStart()));
strtab_data_start[0] = 0;
offset = 0;
diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 588f3f7aec64..b71f3cf04c33 100644
--- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -17,7 +17,6 @@
#include "Plugins/Process/Utility/RegisterContextDummy.h"
#include "Plugins/Process/Utility/RegisterContextMemory.h"
#include "Plugins/Process/Utility/ThreadMemory.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
diff --git a/source/Plugins/Platform/Android/AdbClient.cpp b/source/Plugins/Platform/Android/AdbClient.cpp
index d3bcee6f487d..6e15eb2b1dcb 100644
--- a/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/source/Plugins/Platform/Android/AdbClient.cpp
@@ -46,7 +46,7 @@ using namespace std::chrono;
namespace {
-const seconds kReadTimeout(12);
+const seconds kReadTimeout(20);
const char *kOKAY = "OKAY";
const char *kFAIL = "FAIL";
const char *kDATA = "DATA";
diff --git a/source/Plugins/Platform/Android/PlatformAndroid.cpp b/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 0f37da60d5d6..5b85bcdf7fdd 100644
--- a/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -21,6 +21,7 @@
#include "AdbClient.h"
#include "PlatformAndroid.h"
#include "PlatformAndroidRemoteGDBServer.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -366,9 +367,22 @@ bool PlatformAndroid::GetRemoteOSVersion() {
return m_major_os_version != 0;
}
-llvm::StringRef PlatformAndroid::GetLibdlFunctionDeclarations() {
+llvm::StringRef
+PlatformAndroid::GetLibdlFunctionDeclarations(lldb_private::Process *process) {
+ SymbolContextList matching_symbols;
+ std::vector<const char *> dl_open_names = { "__dl_dlopen", "dlopen" };
+ const char *dl_open_name = nullptr;
+ Target &target = process->GetTarget();
+ for (auto name: dl_open_names) {
+ if (target.GetImages().FindFunctionSymbols(ConstString(name),
+ eFunctionNameTypeFull,
+ matching_symbols)) {
+ dl_open_name = name;
+ break;
+ }
+ }
// Older platform versions have the dl function symbols mangled
- if (GetSdkVersion() < 26)
+ if (dl_open_name == dl_open_names[0])
return R"(
extern "C" void* dlopen(const char*, int) asm("__dl_dlopen");
extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym");
@@ -376,7 +390,7 @@ llvm::StringRef PlatformAndroid::GetLibdlFunctionDeclarations() {
extern "C" char* dlerror(void) asm("__dl_dlerror");
)";
- return PlatformPOSIX::GetLibdlFunctionDeclarations();
+ return PlatformPOSIX::GetLibdlFunctionDeclarations(process);
}
AdbClient::SyncService *PlatformAndroid::GetSyncService(Status &error) {
diff --git a/source/Plugins/Platform/Android/PlatformAndroid.h b/source/Plugins/Platform/Android/PlatformAndroid.h
index 638dba973369..4c12eb8c016d 100644
--- a/source/Plugins/Platform/Android/PlatformAndroid.h
+++ b/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -76,7 +76,8 @@ protected:
Status DownloadSymbolFile(const lldb::ModuleSP &module_sp,
const FileSpec &dst_file_spec) override;
- llvm::StringRef GetLibdlFunctionDeclarations() override;
+ llvm::StringRef
+ GetLibdlFunctionDeclarations(lldb_private::Process *process) override;
private:
AdbClient::SyncService *GetSyncService(Status &error);
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index 53cec45f986e..73c7d21f0a06 100644
--- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -314,13 +314,19 @@ void PlatformFreeBSD::CalculateTrapHandlerSymbolNames() {
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformFreeBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformFreeBSD::GetMmapArgumentList(const ArchSpec &arch,
+ addr_t addr, addr_t length,
+ unsigned prot, unsigned flags,
+ addr_t fd, addr_t offset) {
uint64_t flags_platform = 0;
if (flags & eMmapFlagsPrivate)
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= MAP_ANON;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ if (arch.GetTriple().getArch() == llvm::Triple::x86)
+ args.push_back(0);
+ return args;
}
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
index 4bde2148a4d4..274304834290 100644
--- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -61,8 +61,10 @@ public:
void CalculateTrapHandlerSymbolNames() override;
- uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) override;
+ MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
+ lldb::addr_t length, unsigned prot,
+ unsigned flags, lldb::addr_t fd,
+ lldb::addr_t offset) override;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformFreeBSD);
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.cpp b/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 0bf00ea30798..8186eae0e8c4 100644
--- a/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -372,7 +372,7 @@ PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// Hook up process PTY if we have one (which we should for local debugging
// with llgs).
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
- if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+ if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
LLDB_LOG(log, "hooked up STDIO pty to process");
} else
@@ -390,8 +390,10 @@ void PlatformLinux::CalculateTrapHandlerSymbolNames() {
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformLinux::GetMmapArgumentList(const ArchSpec &arch,
+ addr_t addr, addr_t length,
+ unsigned prot, unsigned flags,
+ addr_t fd, addr_t offset) {
uint64_t flags_platform = 0;
uint64_t map_anon = MAP_ANON;
@@ -406,6 +408,8 @@ uint64_t PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= map_anon;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ return args;
}
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.h b/source/Plugins/Platform/Linux/PlatformLinux.h
index bc7b723427f8..50d721f7c072 100644
--- a/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -59,8 +59,10 @@ public:
void CalculateTrapHandlerSymbolNames() override;
- uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) override;
+ MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
+ lldb::addr_t length, unsigned prot,
+ unsigned flags, lldb::addr_t fd,
+ lldb::addr_t offset) override;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformLinux);
diff --git a/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
index 0197d27e76ef..a216e3839dd9 100644
--- a/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -206,7 +206,7 @@ lldb::ProcessSP PlatformAppleSimulator::DebugProcess(
// open for stdin/out/err after we have already opened the master
// so we can read/write stdin/out/err.
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
- if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+ if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
}
}
diff --git a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
index 52188eefb366..e0558f8b200e 100644
--- a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
@@ -14,7 +14,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -23,6 +22,7 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
index b9f493294a03..9b2608f68625 100644
--- a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
@@ -14,7 +14,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -23,6 +22,7 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index f87852ed7f44..b39aa103f1db 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1132,28 +1132,33 @@ bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx,
return false;
}
+// Return a directory path like /Applications/Xcode.app/Contents/Developer
const char *PlatformDarwin::GetDeveloperDirectory() {
std::lock_guard<std::mutex> guard(m_mutex);
if (m_developer_directory.empty()) {
bool developer_dir_path_valid = false;
char developer_dir_path[PATH_MAX];
FileSpec temp_file_spec;
+
+ // Get the lldb framework's file path, and if it exists, truncate some
+ // components to only the developer directory path.
if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, temp_file_spec)) {
if (temp_file_spec.GetPath(developer_dir_path,
sizeof(developer_dir_path))) {
+ // e.g. /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework
char *shared_frameworks =
strstr(developer_dir_path, "/SharedFrameworks/LLDB.framework");
if (shared_frameworks) {
- ::snprintf(shared_frameworks,
- sizeof(developer_dir_path) -
- (shared_frameworks - developer_dir_path),
- "/Developer");
+ shared_frameworks[0] = '\0'; // truncate developer_dir_path at this point
+ strncat (developer_dir_path, "/Developer", sizeof (developer_dir_path) - 1); // add /Developer on
developer_dir_path_valid = true;
} else {
- char *lib_priv_frameworks = strstr(
- developer_dir_path, "/Library/PrivateFrameworks/LLDB.framework");
- if (lib_priv_frameworks) {
- *lib_priv_frameworks = '\0';
+ // e.g. /Applications/Xcode.app/Contents/Developer/Toolchains/iOS11.2.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework
+ char *developer_toolchains =
+ strstr(developer_dir_path, "/Contents/Developer/Toolchains/");
+ if (developer_toolchains) {
+ developer_toolchains += sizeof ("/Contents/Developer") - 1;
+ developer_toolchains[0] = '\0'; // truncate developer_dir_path at this point
developer_dir_path_valid = true;
}
}
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index f168fb6fda5e..e5d27fc28949 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -18,7 +18,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -31,6 +30,7 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
@@ -694,7 +694,16 @@ Status PlatformDarwinKernel::GetSharedModule(
}
}
- // Second look through the kext binarys without dSYMs
+ // Give the generic methods, including possibly calling into
+ // DebugSymbols framework on macOS systems, a chance.
+ error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
+ module_search_paths_ptr,
+ old_module_sp_ptr, did_create_ptr);
+ if (error.Success() && module_sp.get()) {
+ return error;
+ }
+
+ // Lastly, look through the kext binarys without dSYMs
if (m_name_to_kext_path_map_without_dsyms.count(kext_bundle_cs) > 0) {
for (BundleIDToKextIterator it =
m_name_to_kext_path_map_without_dsyms.begin();
@@ -739,7 +748,17 @@ Status PlatformDarwinKernel::GetSharedModule(
}
}
}
- // Second try all kernel binaries that don't have a dSYM
+
+ // Give the generic methods, including possibly calling into
+ // DebugSymbols framework on macOS systems, a chance.
+ error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
+ module_search_paths_ptr,
+ old_module_sp_ptr, did_create_ptr);
+ if (error.Success() && module_sp.get()) {
+ return error;
+ }
+
+ // Next try all kernel binaries that don't have a dSYM
for (auto possible_kernel : m_kernel_binaries_without_dsyms) {
if (possible_kernel.Exists()) {
ModuleSpec kern_spec(possible_kernel);
@@ -767,11 +786,7 @@ Status PlatformDarwinKernel::GetSharedModule(
}
}
- // Else fall back to treating the file's path as an actual file path - defer
- // to PlatformDarwin's GetSharedModule.
- return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
- module_search_paths_ptr,
- old_module_sp_ptr, did_create_ptr);
+ return error;
}
Status PlatformDarwinKernel::ExamineKextForMatchingUUID(
diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 38facc4aa124..1eef643d3904 100644
--- a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -17,7 +17,6 @@
#include "PlatformRemoteAppleTV.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -25,6 +24,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index bbd8f1698937..17ae67bc28de 100644
--- a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -17,7 +17,6 @@
#include "PlatformRemoteAppleWatch.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -25,6 +24,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index ea44714a916e..cb064aad6155 100644
--- a/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -14,7 +14,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index c52b636c8496..5bff792525bc 100644
--- a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -14,7 +14,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -22,6 +21,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
index 3037dd854be7..ee1f90311e7e 100644
--- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -15,7 +15,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -24,6 +23,7 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm b/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm
index 6a49b645c1e1..7bd37683d2fd 100644
--- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm
+++ b/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm
@@ -22,7 +22,6 @@
#include "llvm/ADT/StringRef.h"
using namespace lldb_private;
-using namespace lldb_utility;
// CoreSimulator lives as part of Xcode, which means we can't really link
// against it, so we dlopen()
// it at runtime, and error out nicely if that fails
diff --git a/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index 9df5b9fac380..38bdf60c1ced 100644
--- a/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -393,7 +393,7 @@ lldb::ProcessSP PlatformNetBSD::DebugProcess(
// Hook up process PTY if we have one (which we should for local debugging
// with llgs).
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
- if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+ if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
if (log)
log->Printf("PlatformNetBSD::%s pid %" PRIu64
@@ -420,13 +420,17 @@ void PlatformNetBSD::CalculateTrapHandlerSymbolNames() {
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformNetBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformNetBSD::GetMmapArgumentList(const ArchSpec &arch,
+ addr_t addr, addr_t length,
+ unsigned prot, unsigned flags,
+ addr_t fd, addr_t offset) {
uint64_t flags_platform = 0;
if (flags & eMmapFlagsPrivate)
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= MAP_ANON;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ return args;
}
diff --git a/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
index b1aaa4ab5f59..28a5d6713dd9 100644
--- a/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ b/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -59,8 +59,10 @@ public:
void CalculateTrapHandlerSymbolNames() override;
- uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) override;
+ MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
+ lldb::addr_t length, unsigned prot,
+ unsigned flags, lldb::addr_t fd,
+ lldb::addr_t offset) override;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD);
diff --git a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
index edb8ec951d37..050639aba7cc 100644
--- a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -133,7 +133,7 @@ PlatformOpenBSD::PlatformOpenBSD(bool is_host)
PlatformOpenBSD::~PlatformOpenBSD() = default;
bool PlatformOpenBSD::GetSupportedArchitectureAtIndex(uint32_t idx,
- ArchSpec &arch) {
+ ArchSpec &arch) {
if (IsHost()) {
ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
if (hostArch.GetTriple().isOSOpenBSD()) {
@@ -211,13 +211,17 @@ void PlatformOpenBSD::CalculateTrapHandlerSymbolNames() {
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformOpenBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformOpenBSD::GetMmapArgumentList(const ArchSpec &arch,
+ addr_t addr, addr_t length,
+ unsigned prot, unsigned flags,
+ addr_t fd, addr_t offset) {
uint64_t flags_platform = 0;
if (flags & eMmapFlagsPrivate)
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= MAP_ANON;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ return args;
}
diff --git a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
index 55f6451e236e..cb5e9bfe6392 100644
--- a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -53,8 +53,10 @@ public:
void CalculateTrapHandlerSymbolNames() override;
- uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) override;
+ MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
+ lldb::addr_t length, unsigned prot,
+ unsigned flags, lldb::addr_t fd,
+ lldb::addr_t offset) override;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformOpenBSD);
diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 013c33def13b..d45a54ee2499 100644
--- a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -944,7 +944,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
the_result;
)",
path);
- llvm::StringRef prefix = GetLibdlFunctionDeclarations();
+ llvm::StringRef prefix = GetLibdlFunctionDeclarations(process);
lldb::ValueObjectSP result_valobj_sp;
error = EvaluateLibdlExpression(process, expr.GetData(), prefix,
result_valobj_sp);
@@ -992,7 +992,7 @@ Status PlatformPOSIX::UnloadImage(lldb_private::Process *process,
StreamString expr;
expr.Printf("dlclose((void *)0x%" PRIx64 ")", image_addr);
- llvm::StringRef prefix = GetLibdlFunctionDeclarations();
+ llvm::StringRef prefix = GetLibdlFunctionDeclarations(process);
lldb::ValueObjectSP result_valobj_sp;
Status error = EvaluateLibdlExpression(process, expr.GetData(), prefix,
result_valobj_sp);
@@ -1024,7 +1024,8 @@ lldb::ProcessSP PlatformPOSIX::ConnectProcess(llvm::StringRef connect_url,
error);
}
-llvm::StringRef PlatformPOSIX::GetLibdlFunctionDeclarations() {
+llvm::StringRef
+PlatformPOSIX::GetLibdlFunctionDeclarations(lldb_private::Process *process) {
return R"(
extern "C" void* dlopen(const char*, int);
extern "C" void* dlsym(void*, const char*);
diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/source/Plugins/Platform/POSIX/PlatformPOSIX.h
index ebc36c2461db..93bebeb332ca 100644
--- a/source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -201,7 +201,8 @@ protected:
llvm::StringRef expr_prefix,
lldb::ValueObjectSP &result_valobj_sp);
- virtual llvm::StringRef GetLibdlFunctionDeclarations();
+ virtual
+ llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process);
private:
DISALLOW_COPY_AND_ASSIGN(PlatformPOSIX);
diff --git a/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp b/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
index c6daf6ccea6e..6b3d5f6c117f 100644
--- a/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
+++ b/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
@@ -144,7 +144,7 @@ static Status ForkChildForPTraceDebugging(const char *path, char const *argv[],
// Use a fork that ties the child process's stdin/out/err to a pseudo
// terminal so we can read it in our MachProcess::STDIOThread
// as unbuffered io.
- lldb_utility::PseudoTerminal pty;
+ PseudoTerminal pty;
char fork_error[256];
memset(fork_error, 0, sizeof(fork_error));
*pid = static_cast<::pid_t>(pty.Fork(fork_error, sizeof(fork_error)));
diff --git a/source/Plugins/Process/Darwin/MachException.cpp b/source/Plugins/Process/Darwin/MachException.cpp
index 7d956dfc6506..9f5920753d68 100644
--- a/source/Plugins/Process/Darwin/MachException.cpp
+++ b/source/Plugins/Process/Darwin/MachException.cpp
@@ -57,11 +57,6 @@ extern "C" kern_return_t catch_mach_exception_raise_state_identity(
extern "C" boolean_t mach_exc_server(mach_msg_header_t *InHeadP,
mach_msg_header_t *OutHeadP);
-// Any access to the g_message variable should be done by locking the
-// g_message_mutex first, using the g_message variable, then unlocking
-// the g_message_mutex. See MachException::Message::CatchExceptionRaise()
-// for sample code.
-
static MachException::Data *g_message = NULL;
extern "C" kern_return_t catch_mach_exception_raise_state(
@@ -131,33 +126,6 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port,
return KERN_FAILURE;
}
-#if 0
-void
-MachException::Message::Dump(Stream &stream) const
-{
- stream.Printf("exc_msg { bits = 0x%8.8x size = 0x%8.8x remote-port = "
- "0x%8.8x local-port = 0x%8.8x reserved = 0x%8.8x "
- "id = 0x%8.8x }\n",
- exc_msg.hdr.msgh_bits,
- exc_msg.hdr.msgh_size,
- exc_msg.hdr.msgh_remote_port,
- exc_msg.hdr.msgh_local_port,
- exc_msg.hdr.msgh_reserved,
- exc_msg.hdr.msgh_id);
-
- stream.Printf("reply_msg { bits = 0x%8.8x size = 0x%8.8x remote-port "
- "= 0x%8.8x local-port = 0x%8.8x reserved = 0x%8.8x "
- "id = 0x%8.8x }",
- reply_msg.hdr.msgh_bits,
- reply_msg.hdr.msgh_size,
- reply_msg.hdr.msgh_remote_port,
- reply_msg.hdr.msgh_local_port,
- reply_msg.hdr.msgh_reserved,
- reply_msg.hdr.msgh_id);
- stream.Flush();
-}
-#endif
-
bool MachException::Data::GetStopInfo(struct ThreadStopInfo *stop_info,
const UnixSignals &signals,
Stream &stream) const {
@@ -279,9 +247,6 @@ void MachException::Message::Dump(Stream &stream) const {
bool MachException::Message::CatchExceptionRaise(task_t task) {
bool success = false;
- // locker will keep a mutex locked until it goes out of scope
- // PThreadMutex::Locker locker(&g_message_mutex);
- // DNBLogThreaded("calling mach_exc_server");
state.task_port = task;
g_message = &state;
// The exc_server function is the MIG generated server handling function
diff --git a/source/Plugins/Process/Darwin/NativeProcessDarwin.h b/source/Plugins/Process/Darwin/NativeProcessDarwin.h
index 2214bbc52ca4..649280c17a8f 100644
--- a/source/Plugins/Process/Darwin/NativeProcessDarwin.h
+++ b/source/Plugins/Process/Darwin/NativeProcessDarwin.h
@@ -22,12 +22,12 @@
#include <unordered_set>
// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/Debug.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
@@ -197,20 +197,6 @@ private:
// waitpid reader callback handle.
MainLoop::ReadHandleUP m_waitpid_reader_handle;
-#if 0
- ArchSpec m_arch;
-
- LazyBool m_supports_mem_region;
- std::vector<MemoryRegionInfo> m_mem_region_cache;
-
- lldb::tid_t m_pending_notification_tid;
-
- // List of thread ids stepping with a breakpoint with the address of
- // the relevan breakpoint
- std::map<lldb::tid_t, lldb::addr_t>
- m_threads_stepping_with_breakpoint;
-#endif
-
// -----------------------------------------------------------------
// Private Instance Methods
// -----------------------------------------------------------------
@@ -322,20 +308,6 @@ private:
Status SetupSoftwareSingleStepping(NativeThreadDarwin &thread);
-#if 0
- static ::ProcessMessage::CrashReason
- GetCrashReasonForSIGSEGV(const siginfo_t *info);
-
- static ::ProcessMessage::CrashReason
- GetCrashReasonForSIGILL(const siginfo_t *info);
-
- static ::ProcessMessage::CrashReason
- GetCrashReasonForSIGFPE(const siginfo_t *info);
-
- static ::ProcessMessage::CrashReason
- GetCrashReasonForSIGBUS(const siginfo_t *info);
-#endif
-
bool HasThreadNoLock(lldb::tid_t thread_id);
bool StopTrackingThread(lldb::tid_t thread_id);
diff --git a/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp b/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
index bd8e5abe2255..e6557c2d58e0 100644
--- a/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
+++ b/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
@@ -375,6 +375,7 @@ void FreeBSDThread::Notify(const ProcessMessage &message) {
LimboNotify(message);
break;
+ case ProcessMessage::eCrashMessage:
case ProcessMessage::eSignalMessage:
SignalNotify(message);
break;
@@ -395,10 +396,6 @@ void FreeBSDThread::Notify(const ProcessMessage &message) {
WatchNotify(message);
break;
- case ProcessMessage::eCrashMessage:
- CrashNotify(message);
- break;
-
case ProcessMessage::eExecMessage:
ExecNotify(message);
break;
@@ -577,7 +574,14 @@ void FreeBSDThread::LimboNotify(const ProcessMessage &message) {
void FreeBSDThread::SignalNotify(const ProcessMessage &message) {
int signo = message.GetSignal();
- SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
+ if (message.GetKind() == ProcessMessage::eCrashMessage) {
+ std::string stop_description = GetCrashReasonString(
+ message.GetCrashReason(), message.GetFaultAddress());
+ SetStopInfo(StopInfo::CreateStopReasonWithSignal(
+ *this, signo, stop_description.c_str()));
+ } else {
+ SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
+ }
}
void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) {
@@ -585,21 +589,6 @@ void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) {
SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
}
-void FreeBSDThread::CrashNotify(const ProcessMessage &message) {
- // FIXME: Update stop reason as per bugzilla 14598
- int signo = message.GetSignal();
-
- assert(message.GetKind() == ProcessMessage::eCrashMessage);
-
- Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
- if (log)
- log->Printf("FreeBSDThread::%s () signo = %i, reason = '%s'", __FUNCTION__,
- signo, message.PrintCrashReason());
-
- SetStopInfo(lldb::StopInfoSP(new POSIXCrashStopInfo(
- *this, signo, message.GetCrashReason(), message.GetFaultAddress())));
-}
-
unsigned FreeBSDThread::GetRegisterIndexFromOffset(unsigned offset) {
unsigned reg = LLDB_INVALID_REGNUM;
ArchSpec arch = HostInfo::GetArchitecture();
diff --git a/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp b/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
index dfbd695899ff..9c75c26e379b 100644
--- a/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
+++ b/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
@@ -28,22 +28,6 @@ bool POSIXLimboStopInfo::ShouldStop(Event *event_ptr) { return false; }
bool POSIXLimboStopInfo::ShouldNotify(Event *event_ptr) { return false; }
//===----------------------------------------------------------------------===//
-// POSIXCrashStopInfo
-
-POSIXCrashStopInfo::POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status,
- CrashReason reason,
- lldb::addr_t fault_addr)
- : POSIXStopInfo(thread, status) {
- m_description = ::GetCrashReasonString(reason, fault_addr);
-}
-
-POSIXCrashStopInfo::~POSIXCrashStopInfo() {}
-
-lldb::StopReason POSIXCrashStopInfo::GetStopReason() const {
- return lldb::eStopReasonException;
-}
-
-//===----------------------------------------------------------------------===//
// POSIXNewThreadStopInfo
POSIXNewThreadStopInfo::~POSIXNewThreadStopInfo() {}
diff --git a/source/Plugins/Process/FreeBSD/POSIXStopInfo.h b/source/Plugins/Process/FreeBSD/POSIXStopInfo.h
index e51fc08d74cc..96861852b38e 100644
--- a/source/Plugins/Process/FreeBSD/POSIXStopInfo.h
+++ b/source/Plugins/Process/FreeBSD/POSIXStopInfo.h
@@ -45,19 +45,6 @@ public:
};
//===----------------------------------------------------------------------===//
-/// @class POSIXCrashStopInfo
-/// @brief Represents the stop state of process that is ready to crash.
-///
-class POSIXCrashStopInfo : public POSIXStopInfo {
-public:
- POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, CrashReason reason,
- lldb::addr_t fault_addr);
- ~POSIXCrashStopInfo();
-
- lldb::StopReason GetStopReason() const;
-};
-
-//===----------------------------------------------------------------------===//
/// @class POSIXNewThreadStopInfo
/// @brief Represents the stop state of process when a new thread is spawned.
///
diff --git a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
index 3046150e3246..7a937db49be0 100644
--- a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -825,32 +825,6 @@ uint32_t ProcessFreeBSD::UpdateThreadListIfNeeded() {
return m_thread_list.GetSize(false);
}
-#if 0
-bool
-ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
-{
- Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
- if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
- log->Printf ("ProcessFreeBSD::%s() (pid = %" PRIi64 ")", __FUNCTION__, GetID());
-
- bool has_updated = false;
- // Update the process thread list with this new thread.
- // FIXME: We should be using tid, not pid.
- assert(m_monitor);
- ThreadSP thread_sp (old_thread_list.FindThreadByID (GetID(), false));
- if (!thread_sp) {
- thread_sp.reset(CreateNewFreeBSDThread(*this, GetID()));
- has_updated = true;
- }
-
- if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
- log->Printf ("ProcessFreeBSD::%s() updated pid = %" PRIi64, __FUNCTION__, GetID());
- new_thread_list.AddThread(thread_sp);
-
- return has_updated; // the list has been updated
-}
-#endif
-
ByteOrder ProcessFreeBSD::GetByteOrder() const {
// FIXME: We should be able to extract this value directly. See comment in
// ProcessFreeBSD().
diff --git a/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
index a4f5f02dde62..bd06fa25f0a0 100644
--- a/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ b/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -843,7 +843,7 @@ bool ProcessMonitor::Launch(LaunchArgs *args) {
const FileSpec &stderr_file_spec = args->m_stderr_file_spec;
const FileSpec &working_dir = args->m_working_dir;
- lldb_utility::PseudoTerminal terminal;
+ PseudoTerminal terminal;
const size_t err_len = 1024;
char err_str[err_len];
::pid_t pid;
@@ -1192,7 +1192,9 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMonitor *monitor,
case SIGBUS:
lldb::addr_t fault_addr = reinterpret_cast<lldb::addr_t>(info->si_addr);
const auto reason = GetCrashReason(*info);
- return ProcessMessage::Crash(tid, reason, signo, fault_addr);
+ if (reason != CrashReason::eInvalidCrashReason) {
+ return ProcessMessage::Crash(tid, reason, signo, fault_addr);
+ } // else; Use atleast si_signo info for other si_code
}
// Everything else is "normal" and does not require any special action on
diff --git a/source/Plugins/Process/FreeBSD/RegisterContextPOSIX.h b/source/Plugins/Process/FreeBSD/RegisterContextPOSIX.h
index c0b9b2f4a2d3..4ff5121bac13 100644
--- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIX.h
+++ b/source/Plugins/Process/FreeBSD/RegisterContextPOSIX.h
@@ -14,8 +14,8 @@
// C++ Includes
// Other libraries and framework includes
#include "RegisterInfoInterface.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Utility/ArchSpec.h"
//------------------------------------------------------------------------------
/// @class POSIXBreakpointProtocol
diff --git a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
index 1cd8f1aafa6e..4608520dba40 100644
--- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
+++ b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp
@@ -58,6 +58,9 @@ RegisterContextPOSIXProcessMonitor_x86_64::
// Store byte offset of fctrl (i.e. first register of FPR) wrt 'UserArea'
const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
+
+ m_iovec.iov_base = &m_fpr.xsave;
+ m_iovec.iov_len = sizeof(m_fpr.xsave);
}
ProcessMonitor &RegisterContextPOSIXProcessMonitor_x86_64::GetMonitor() {
@@ -74,12 +77,12 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadGPR() {
bool RegisterContextPOSIXProcessMonitor_x86_64::ReadFPR() {
ProcessMonitor &monitor = GetMonitor();
if (GetFPRType() == eFXSAVE)
- return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave,
- sizeof(m_fpr.xstate.fxsave));
+ return monitor.ReadFPR(m_thread.GetID(), &m_fpr.fxsave,
+ sizeof(m_fpr.fxsave));
if (GetFPRType() == eXSAVE)
return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec,
- sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
+ sizeof(m_fpr.xsave), NT_X86_XSTATE);
return false;
}
@@ -91,12 +94,12 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteGPR() {
bool RegisterContextPOSIXProcessMonitor_x86_64::WriteFPR() {
ProcessMonitor &monitor = GetMonitor();
if (GetFPRType() == eFXSAVE)
- return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave,
- sizeof(m_fpr.xstate.fxsave));
+ return monitor.WriteFPR(m_thread.GetID(), &m_fpr.fxsave,
+ sizeof(m_fpr.fxsave));
if (GetFPRType() == eXSAVE)
return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec,
- sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
+ sizeof(m_fpr.xsave), NT_X86_XSTATE);
return false;
}
@@ -209,17 +212,14 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister(
if (byte_order != ByteOrder::eByteOrderInvalid) {
if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
- value.SetBytes(
- m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes,
- reg_info->byte_size, byte_order);
+ value.SetBytes(m_fpr.fxsave.stmm[reg - m_reg_info.first_st].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
- value.SetBytes(
- m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
- reg_info->byte_size, byte_order);
+ value.SetBytes(m_fpr.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
- value.SetBytes(
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
- reg_info->byte_size, byte_order);
+ value.SetBytes(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) {
// Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes
if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
@@ -233,7 +233,7 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister(
return false;
}
- // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
+ // Get pointer to m_fpr.fxsave variable and set the data from it.
// Byte offsets of all registers are calculated wrt 'UserArea' structure.
// However, ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)}
// and stores them in 'm_fpr' (of type FPR structure). To extract values of
@@ -276,15 +276,15 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister(
if (IsFPR(reg, GetFPRType())) {
if (reg_info->encoding == eEncodingVector) {
if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
- ::memcpy(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes,
+ ::memcpy(m_fpr.fxsave.stmm[reg - m_reg_info.first_st].bytes,
value.GetBytes(), value.GetByteSize());
if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
- ::memcpy(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
+ ::memcpy(m_fpr.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
value.GetBytes(), value.GetByteSize());
if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
+ ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
value.GetBytes(), value.GetByteSize());
if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) {
@@ -299,7 +299,7 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister(
return false;
}
} else {
- // Get pointer to m_fpr.xstate.fxsave variable and set the data to it.
+ // Get pointer to m_fpr.fxsave variable and set the data to it.
// Byte offsets of all registers are calculated wrt 'UserArea' structure.
// However, WriteFPR() takes m_fpr (of type FPR structure) and writes only
// fpu
@@ -353,7 +353,7 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadAllRegisterValues(
::memcpy(dst, &m_gpr_x86_64, GetGPRSize());
dst += GetGPRSize();
if (GetFPRType() == eFXSAVE)
- ::memcpy(dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
+ ::memcpy(dst, &m_fpr.fxsave, sizeof(m_fpr.fxsave));
}
if (GetFPRType() == eXSAVE) {
@@ -385,9 +385,9 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteAllRegisterValues(
if (WriteGPR()) {
src += GetGPRSize();
if (GetFPRType() == eFXSAVE)
- ::memcpy(&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));
+ ::memcpy(&m_fpr.fxsave, src, sizeof(m_fpr.fxsave));
if (GetFPRType() == eXSAVE)
- ::memcpy(&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));
+ ::memcpy(&m_fpr.xsave, src, sizeof(m_fpr.xsave));
success = WriteFPR();
if (success) {
diff --git a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
index 57e2d00e668f..8c654f97dcd9 100644
--- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
+++ b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.h
@@ -12,6 +12,7 @@
#include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
#include "RegisterContextPOSIX.h"
+#include <sys/uio.h>
class RegisterContextPOSIXProcessMonitor_x86_64
: public RegisterContextPOSIX_x86,
@@ -75,6 +76,7 @@ private:
ProcessMonitor &GetMonitor();
uint32_t
m_fctrl_offset_in_userarea; // Offset of 'fctrl' in 'UserArea' Structure
+ struct iovec m_iovec;
};
#endif
diff --git a/source/Plugins/Process/Linux/CMakeLists.txt b/source/Plugins/Process/Linux/CMakeLists.txt
index 8330cac160e6..390dbd9ff8bf 100644
--- a/source/Plugins/Process/Linux/CMakeLists.txt
+++ b/source/Plugins/Process/Linux/CMakeLists.txt
@@ -7,9 +7,10 @@ add_lldb_library(lldbPluginProcessLinux PLUGIN
NativeRegisterContextLinux.cpp
NativeRegisterContextLinux_arm.cpp
NativeRegisterContextLinux_arm64.cpp
- NativeRegisterContextLinux_x86_64.cpp
NativeRegisterContextLinux_mips64.cpp
+ NativeRegisterContextLinux_ppc64le.cpp
NativeRegisterContextLinux_s390x.cpp
+ NativeRegisterContextLinux_x86_64.cpp
NativeThreadLinux.cpp
ProcessorTrace.cpp
SingleStepCheck.cpp
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 170d3b100064..136af361af29 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -177,7 +177,7 @@ void PtraceDisplayBytes(int &req, void *data, size_t data_size) {
break;
}
case PTRACE_SETREGSET: {
- // Extract iov_base from data, which is a pointer to the struct IOVEC
+ // Extract iov_base from data, which is a pointer to the struct iovec
DisplayBytes(buf, *(void **)data, data_size);
LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
break;
@@ -305,10 +305,9 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, int terminal_fd,
assert(m_sigchld_handle && status.Success());
for (const auto &tid : tids) {
- NativeThreadLinuxSP thread_sp = AddThread(tid);
- assert(thread_sp && "AddThread() returned a nullptr thread");
- thread_sp->SetStoppedBySignal(SIGSTOP);
- ThreadWasCreated(*thread_sp);
+ NativeThreadLinux &thread = AddThread(tid);
+ thread.SetStoppedBySignal(SIGSTOP);
+ ThreadWasCreated(thread);
}
// Let our process instance know the thread has stopped.
@@ -413,46 +412,20 @@ void NativeProcessLinux::MonitorCallback(lldb::pid_t pid, bool exited,
// Handle when the thread exits.
if (exited) {
- LLDB_LOG(log, "got exit signal({0}) , tid = {1} ({2} main thread)", signal,
- pid, is_main_thread ? "is" : "is not");
+ LLDB_LOG(log,
+ "got exit signal({0}) , tid = {1} ({2} main thread), process "
+ "state = {3}",
+ signal, pid, is_main_thread ? "is" : "is not", GetState());
// This is a thread that exited. Ensure we're not tracking it anymore.
- const bool thread_found = StopTrackingThread(pid);
+ StopTrackingThread(pid);
if (is_main_thread) {
- // We only set the exit status and notify the delegate if we haven't
- // already set the process
- // state to an exited state. We normally should have received a SIGTRAP |
- // (PTRACE_EVENT_EXIT << 8)
- // for the main thread.
- const bool already_notified = (GetState() == StateType::eStateExited) ||
- (GetState() == StateType::eStateCrashed);
- if (!already_notified) {
- LLDB_LOG(
- log,
- "tid = {0} handling main thread exit ({1}), expected exit state "
- "already set but state was {2} instead, setting exit state now",
- pid,
- thread_found ? "stopped tracking thread metadata"
- : "thread metadata not found",
- GetState());
- // The main thread exited. We're done monitoring. Report to delegate.
- SetExitStatus(status, true);
+ // The main thread exited. We're done monitoring. Report to delegate.
+ SetExitStatus(status, true);
- // Notify delegate that our process has exited.
- SetState(StateType::eStateExited, true);
- } else
- LLDB_LOG(log, "tid = {0} main thread now exited (%s)", pid,
- thread_found ? "stopped tracking thread metadata"
- : "thread metadata not found");
- } else {
- // Do we want to report to the delegate in this case? I think not. If
- // this was an orderly thread exit, we would already have received the
- // SIGTRAP | (PTRACE_EVENT_EXIT << 8) signal, and we would have done an
- // all-stop then.
- LLDB_LOG(log, "tid = {0} handling non-main thread exit (%s)", pid,
- thread_found ? "stopped tracking thread metadata"
- : "thread metadata not found");
+ // Notify delegate that our process has exited.
+ SetState(StateType::eStateExited, true);
}
return;
}
@@ -478,11 +451,11 @@ void NativeProcessLinux::MonitorCallback(lldb::pid_t pid, bool exited,
LLDB_LOG(log, "tid {0}, si_code: {1}, si_pid: {2}", pid, info.si_code,
info.si_pid);
- auto thread_sp = AddThread(pid);
+ NativeThreadLinux &thread = AddThread(pid);
// Resume the newly created thread.
- ResumeThread(*thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
- ThreadWasCreated(*thread_sp);
+ ResumeThread(thread, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
+ ThreadWasCreated(thread);
return;
}
@@ -549,12 +522,9 @@ void NativeProcessLinux::MonitorCallback(lldb::pid_t pid, bool exited,
void NativeProcessLinux::WaitForNewThread(::pid_t tid) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
- NativeThreadLinuxSP new_thread_sp = GetThreadByID(tid);
-
- if (new_thread_sp) {
+ if (GetThreadByID(tid)) {
// We are already tracking the thread - we got the event on the new thread
- // (see
- // MonitorSignal) before this one. We are done.
+ // (see MonitorSignal) before this one. We are done.
return;
}
@@ -587,10 +557,10 @@ void NativeProcessLinux::WaitForNewThread(::pid_t tid) {
}
LLDB_LOG(log, "pid = {0}: tracking new thread tid {1}", GetID(), tid);
- new_thread_sp = AddThread(tid);
+ NativeThreadLinux &new_thread = AddThread(tid);
- ResumeThread(*new_thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
- ThreadWasCreated(*new_thread_sp);
+ ResumeThread(new_thread, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
+ ThreadWasCreated(new_thread);
}
void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
@@ -630,7 +600,6 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
}
case (SIGTRAP | (PTRACE_EVENT_EXEC << 8)): {
- NativeThreadLinuxSP main_thread_sp;
LLDB_LOG(log, "received exec event, code = {0}", info.si_code ^ SIGTRAP);
// Exec clears any pending notifications.
@@ -640,44 +609,26 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
// which only copies the main thread.
LLDB_LOG(log, "exec received, stop tracking all but main thread");
- for (auto thread_sp : m_threads) {
- const bool is_main_thread = thread_sp && thread_sp->GetID() == GetID();
- if (is_main_thread) {
- main_thread_sp = std::static_pointer_cast<NativeThreadLinux>(thread_sp);
- LLDB_LOG(log, "found main thread with tid {0}, keeping",
- main_thread_sp->GetID());
- } else {
- LLDB_LOG(log, "discarding non-main-thread tid {0} due to exec",
- thread_sp->GetID());
- }
+ for (auto i = m_threads.begin(); i != m_threads.end();) {
+ if ((*i)->GetID() == GetID())
+ i = m_threads.erase(i);
+ else
+ ++i;
}
+ assert(m_threads.size() == 1);
+ auto *main_thread = static_cast<NativeThreadLinux *>(m_threads[0].get());
- m_threads.clear();
-
- if (main_thread_sp) {
- m_threads.push_back(main_thread_sp);
- SetCurrentThreadID(main_thread_sp->GetID());
- main_thread_sp->SetStoppedByExec();
- } else {
- SetCurrentThreadID(LLDB_INVALID_THREAD_ID);
- LLDB_LOG(log,
- "pid {0} no main thread found, discarded all threads, "
- "we're in a no-thread state!",
- GetID());
- }
+ SetCurrentThreadID(main_thread->GetID());
+ main_thread->SetStoppedByExec();
// Tell coordinator about about the "new" (since exec) stopped main thread.
- ThreadWasCreated(*main_thread_sp);
+ ThreadWasCreated(*main_thread);
// Let our delegate know we have just exec'd.
NotifyDidExec();
- // If we have a main thread, indicate we are stopped.
- assert(main_thread_sp && "exec called during ptraced process but no main "
- "thread metadata tracked");
-
// Let the process know we're stopped.
- StopRunningThreads(main_thread_sp->GetID());
+ StopRunningThreads(main_thread->GetID());
break;
}
@@ -685,10 +636,8 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
case (SIGTRAP | (PTRACE_EVENT_EXIT << 8)): {
// The inferior process or one of its threads is about to exit.
// We don't want to do anything with the thread so we just resume it. In
- // case we
- // want to implement "break on thread exit" functionality, we would need to
- // stop
- // here.
+ // case we want to implement "break on thread exit" functionality, we would
+ // need to stop here.
unsigned long data = 0;
if (GetEventMessage(thread.GetID(), &data).Fail())
@@ -700,18 +649,14 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
data, WIFEXITED(data), WIFSIGNALED(data), thread.GetID(),
is_main_thread);
- if (is_main_thread)
- SetExitStatus(WaitStatus::Decode(data), true);
StateType state = thread.GetState();
if (!StateIsRunningState(state)) {
// Due to a kernel bug, we may sometimes get this stop after the inferior
- // gets a
- // SIGKILL. This confuses our state tracking logic in ResumeThread(),
- // since normally,
- // we should not be receiving any ptrace events while the inferior is
- // stopped. This
- // makes sure that the inferior is resumed and exits normally.
+ // gets a SIGKILL. This confuses our state tracking logic in
+ // ResumeThread(), since normally, we should not be receiving any ptrace
+ // events while the inferior is stopped. This makes sure that the inferior
+ // is resumed and exits normally.
state = eStateRunning;
}
ResumeThread(thread, state, LLDB_INVALID_SIGNAL_NUMBER);
@@ -725,7 +670,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
{
// If a watchpoint was hit, report it
uint32_t wp_index;
- Status error = thread.GetRegisterContext()->GetWatchpointHitIndex(
+ Status error = thread.GetRegisterContext().GetWatchpointHitIndex(
wp_index, (uintptr_t)info.si_addr);
if (error.Fail())
LLDB_LOG(log,
@@ -739,7 +684,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
// If a breakpoint was hit, report it
uint32_t bp_index;
- error = thread.GetRegisterContext()->GetHardwareBreakHitIndex(
+ error = thread.GetRegisterContext().GetHardwareBreakHitIndex(
bp_index, (uintptr_t)info.si_addr);
if (error.Fail())
LLDB_LOG(log, "received error while checking for hardware "
@@ -762,7 +707,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info,
{
// If a watchpoint was hit, report it
uint32_t wp_index;
- Status error = thread.GetRegisterContext()->GetWatchpointHitIndex(
+ Status error = thread.GetRegisterContext().GetWatchpointHitIndex(
wp_index, LLDB_INVALID_ADDRESS);
if (error.Fail())
LLDB_LOG(log,
@@ -933,13 +878,13 @@ void NativeProcessLinux::MonitorSignal(const siginfo_t &info,
namespace {
struct EmulatorBaton {
- NativeProcessLinux *m_process;
- NativeRegisterContext *m_reg_context;
+ NativeProcessLinux &m_process;
+ NativeRegisterContext &m_reg_context;
// eRegisterKindDWARF -> RegsiterValue
std::unordered_map<uint32_t, RegisterValue> m_register_values;
- EmulatorBaton(NativeProcessLinux *process, NativeRegisterContext *reg_context)
+ EmulatorBaton(NativeProcessLinux &process, NativeRegisterContext &reg_context)
: m_process(process), m_reg_context(reg_context) {}
};
@@ -951,7 +896,7 @@ static size_t ReadMemoryCallback(EmulateInstruction *instruction, void *baton,
EmulatorBaton *emulator_baton = static_cast<EmulatorBaton *>(baton);
size_t bytes_read;
- emulator_baton->m_process->ReadMemory(addr, dst, length, bytes_read);
+ emulator_baton->m_process.ReadMemory(addr, dst, length, bytes_read);
return bytes_read;
}
@@ -971,11 +916,11 @@ static bool ReadRegisterCallback(EmulateInstruction *instruction, void *baton,
// the generic register numbers). Get the full register info from the
// register context based on the dwarf register numbers.
const RegisterInfo *full_reg_info =
- emulator_baton->m_reg_context->GetRegisterInfo(
+ emulator_baton->m_reg_context.GetRegisterInfo(
eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]);
Status error =
- emulator_baton->m_reg_context->ReadRegister(full_reg_info, reg_value);
+ emulator_baton->m_reg_context.ReadRegister(full_reg_info, reg_value);
if (error.Success())
return true;
@@ -999,17 +944,17 @@ static size_t WriteMemoryCallback(EmulateInstruction *instruction, void *baton,
return length;
}
-static lldb::addr_t ReadFlags(NativeRegisterContext *regsiter_context) {
- const RegisterInfo *flags_info = regsiter_context->GetRegisterInfo(
+static lldb::addr_t ReadFlags(NativeRegisterContext &regsiter_context) {
+ const RegisterInfo *flags_info = regsiter_context.GetRegisterInfo(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
- return regsiter_context->ReadRegisterAsUnsigned(flags_info,
- LLDB_INVALID_ADDRESS);
+ return regsiter_context.ReadRegisterAsUnsigned(flags_info,
+ LLDB_INVALID_ADDRESS);
}
Status
NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
Status error;
- NativeRegisterContextSP register_context_sp = thread.GetRegisterContext();
+ NativeRegisterContext& register_context = thread.GetRegisterContext();
std::unique_ptr<EmulateInstruction> emulator_ap(
EmulateInstruction::FindPlugin(m_arch, eInstructionTypePCModifying,
@@ -1018,7 +963,7 @@ NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
if (emulator_ap == nullptr)
return Status("Instruction emulator not found!");
- EmulatorBaton baton(this, register_context_sp.get());
+ EmulatorBaton baton(*this, register_context);
emulator_ap->SetBaton(&baton);
emulator_ap->SetReadMemCallback(&ReadMemoryCallback);
emulator_ap->SetReadRegCallback(&ReadRegisterCallback);
@@ -1031,9 +976,9 @@ NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
bool emulation_result =
emulator_ap->EvaluateInstruction(eEmulateInstructionOptionAutoAdvancePC);
- const RegisterInfo *reg_info_pc = register_context_sp->GetRegisterInfo(
+ const RegisterInfo *reg_info_pc = register_context.GetRegisterInfo(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
- const RegisterInfo *reg_info_flags = register_context_sp->GetRegisterInfo(
+ const RegisterInfo *reg_info_flags = register_context.GetRegisterInfo(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
auto pc_it =
@@ -1051,15 +996,14 @@ NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
if (flags_it != baton.m_register_values.end())
next_flags = flags_it->second.GetAsUInt64();
else
- next_flags = ReadFlags(register_context_sp.get());
+ next_flags = ReadFlags(register_context);
} else if (pc_it == baton.m_register_values.end()) {
// Emulate instruction failed and it haven't changed PC. Advance PC
// with the size of the current opcode because the emulation of all
// PC modifying instruction should be successful. The failure most
// likely caused by a not supported instruction which don't modify PC.
- next_pc =
- register_context_sp->GetPC() + emulator_ap->GetOpcode().GetByteSize();
- next_flags = ReadFlags(register_context_sp.get());
+ next_pc = register_context.GetPC() + emulator_ap->GetOpcode().GetByteSize();
+ next_flags = ReadFlags(register_context);
} else {
// The instruction emulation failed after it modified the PC. It is an
// unknown error where we can't continue because the next instruction is
@@ -1078,7 +1022,8 @@ NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
} else if (m_arch.GetMachine() == llvm::Triple::mips64 ||
m_arch.GetMachine() == llvm::Triple::mips64el ||
m_arch.GetMachine() == llvm::Triple::mips ||
- m_arch.GetMachine() == llvm::Triple::mipsel)
+ m_arch.GetMachine() == llvm::Triple::mipsel ||
+ m_arch.GetMachine() == llvm::Triple::ppc64le)
error = SetSoftwareBreakpoint(next_pc, 4);
else {
// No size hint is given for the next breakpoint
@@ -1114,44 +1059,44 @@ Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) {
bool software_single_step = !SupportHardwareSingleStepping();
if (software_single_step) {
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not contain NULL threads");
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not contain NULL threads");
const ResumeAction *const action =
- resume_actions.GetActionForThread(thread_sp->GetID(), true);
+ resume_actions.GetActionForThread(thread->GetID(), true);
if (action == nullptr)
continue;
if (action->state == eStateStepping) {
Status error = SetupSoftwareSingleStepping(
- static_cast<NativeThreadLinux &>(*thread_sp));
+ static_cast<NativeThreadLinux &>(*thread));
if (error.Fail())
return error;
}
}
}
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not contain NULL threads");
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not contain NULL threads");
const ResumeAction *const action =
- resume_actions.GetActionForThread(thread_sp->GetID(), true);
+ resume_actions.GetActionForThread(thread->GetID(), true);
if (action == nullptr) {
LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
- thread_sp->GetID());
+ thread->GetID());
continue;
}
LLDB_LOG(log, "processing resume action state {0} for pid {1} tid {2}",
- action->state, GetID(), thread_sp->GetID());
+ action->state, GetID(), thread->GetID());
switch (action->state) {
case eStateRunning:
case eStateStepping: {
// Run the thread, possibly feeding it the signal.
const int signo = action->signal;
- ResumeThread(static_cast<NativeThreadLinux &>(*thread_sp), action->state,
+ ResumeThread(static_cast<NativeThreadLinux &>(*thread), action->state,
signo);
break;
}
@@ -1164,7 +1109,7 @@ Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) {
return Status("NativeProcessLinux::%s (): unexpected state %s specified "
"for pid %" PRIu64 ", tid %" PRIu64,
__FUNCTION__, StateAsCString(action->state), GetID(),
- thread_sp->GetID());
+ thread->GetID());
}
}
@@ -1190,8 +1135,8 @@ Status NativeProcessLinux::Detach() {
if (GetID() == LLDB_INVALID_PROCESS_ID)
return error;
- for (auto thread_sp : m_threads) {
- Status e = Detach(thread_sp->GetID());
+ for (const auto &thread : m_threads) {
+ Status e = Detach(thread->GetID());
if (e.Fail())
error =
e; // Save the error, but still attempt to detach from other threads.
@@ -1221,29 +1166,25 @@ Status NativeProcessLinux::Interrupt() {
// the chosen thread that will be the stop-reason thread.
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
- NativeThreadProtocolSP running_thread_sp;
- NativeThreadProtocolSP stopped_thread_sp;
+ NativeThreadProtocol *running_thread = nullptr;
+ NativeThreadProtocol *stopped_thread = nullptr;
LLDB_LOG(log, "selecting running thread for interrupt target");
- for (auto thread_sp : m_threads) {
- // The thread shouldn't be null but lets just cover that here.
- if (!thread_sp)
- continue;
-
+ for (const auto &thread : m_threads) {
// If we have a running or stepping thread, we'll call that the
// target of the interrupt.
- const auto thread_state = thread_sp->GetState();
+ const auto thread_state = thread->GetState();
if (thread_state == eStateRunning || thread_state == eStateStepping) {
- running_thread_sp = thread_sp;
+ running_thread = thread.get();
break;
- } else if (!stopped_thread_sp && StateIsStoppedState(thread_state, true)) {
+ } else if (!stopped_thread && StateIsStoppedState(thread_state, true)) {
// Remember the first non-dead stopped thread. We'll use that as a backup
// if there are no running threads.
- stopped_thread_sp = thread_sp;
+ stopped_thread = thread.get();
}
}
- if (!running_thread_sp && !stopped_thread_sp) {
+ if (!running_thread && !stopped_thread) {
Status error("found no running/stepping or live stopped threads as target "
"for interrupt");
LLDB_LOG(log, "skipping due to error: {0}", error);
@@ -1251,14 +1192,14 @@ Status NativeProcessLinux::Interrupt() {
return error;
}
- NativeThreadProtocolSP deferred_signal_thread_sp =
- running_thread_sp ? running_thread_sp : stopped_thread_sp;
+ NativeThreadProtocol *deferred_signal_thread =
+ running_thread ? running_thread : stopped_thread;
LLDB_LOG(log, "pid {0} {1} tid {2} chosen for interrupt target", GetID(),
- running_thread_sp ? "running" : "stopped",
- deferred_signal_thread_sp->GetID());
+ running_thread ? "running" : "stopped",
+ deferred_signal_thread->GetID());
- StopRunningThreads(deferred_signal_thread_sp->GetID());
+ StopRunningThreads(deferred_signal_thread->GetID());
return Status();
}
@@ -1568,17 +1509,13 @@ size_t NativeProcessLinux::UpdateThreads() {
return m_threads.size();
}
-bool NativeProcessLinux::GetArchitecture(ArchSpec &arch) const {
- arch = m_arch;
- return true;
-}
-
Status NativeProcessLinux::GetSoftwareBreakpointPCOffset(
uint32_t &actual_opcode_size) {
// FIXME put this behind a breakpoint protocol class that can be
// set per architecture. Need ARM, MIPS support here.
static const uint8_t g_i386_opcode[] = {0xCC};
static const uint8_t g_s390x_opcode[] = {0x00, 0x01};
+ static const uint8_t g_ppc64le_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
switch (m_arch.GetMachine()) {
case llvm::Triple::x86:
@@ -1590,6 +1527,10 @@ Status NativeProcessLinux::GetSoftwareBreakpointPCOffset(
actual_opcode_size = static_cast<uint32_t>(sizeof(g_s390x_opcode));
return Status();
+ case llvm::Triple::ppc64le:
+ actual_opcode_size = static_cast<uint32_t>(sizeof(g_ppc64le_opcode));
+ return Status();
+
case llvm::Triple::arm:
case llvm::Triple::aarch64:
case llvm::Triple::mips64:
@@ -1635,6 +1576,7 @@ Status NativeProcessLinux::GetSoftwareBreakpointTrapOpcode(
static const uint8_t g_mips64el_opcode[] = {0x0d, 0x00, 0x00, 0x00};
static const uint8_t g_s390x_opcode[] = {0x00, 0x01};
static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde};
+ static const uint8_t g_ppc64le_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
switch (m_arch.GetMachine()) {
case llvm::Triple::aarch64:
@@ -1680,6 +1622,11 @@ Status NativeProcessLinux::GetSoftwareBreakpointTrapOpcode(
actual_opcode_size = sizeof(g_s390x_opcode);
return Status();
+ case llvm::Triple::ppc64le:
+ trap_opcode_bytes = g_ppc64le_opcode;
+ actual_opcode_size = sizeof(g_ppc64le_opcode);
+ return Status();
+
default:
assert(false && "CPU type not supported!");
return Status("CPU type not supported");
@@ -1963,9 +1910,9 @@ Status NativeProcessLinux::Detach(lldb::tid_t tid) {
}
bool NativeProcessLinux::HasThreadNoLock(lldb::tid_t thread_id) {
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not contain NULL threads");
- if (thread_sp->GetID() == thread_id) {
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not contain NULL threads");
+ if (thread->GetID() == thread_id) {
// We have this thread.
return true;
}
@@ -1994,7 +1941,7 @@ bool NativeProcessLinux::StopTrackingThread(lldb::tid_t thread_id) {
return found;
}
-NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb::tid_t thread_id) {
+NativeThreadLinux &NativeProcessLinux::AddThread(lldb::tid_t thread_id) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id);
@@ -2005,8 +1952,7 @@ NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb::tid_t thread_id) {
if (m_threads.empty())
SetCurrentThreadID(thread_id);
- auto thread_sp = std::make_shared<NativeThreadLinux>(*this, thread_id);
- m_threads.push_back(thread_sp);
+ m_threads.push_back(llvm::make_unique<NativeThreadLinux>(*this, thread_id));
if (m_pt_proces_trace_id != LLDB_INVALID_UID) {
auto traceMonitor = ProcessorTraceMonitor::Create(
@@ -2022,7 +1968,7 @@ NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb::tid_t thread_id) {
}
}
- return thread_sp;
+ return static_cast<NativeThreadLinux &>(*m_threads.back());
}
Status
@@ -2033,12 +1979,7 @@ NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) {
// Find out the size of a breakpoint (might depend on where we are in the
// code).
- NativeRegisterContextSP context_sp = thread.GetRegisterContext();
- if (!context_sp) {
- error.SetErrorString("cannot get a NativeRegisterContext for the thread");
- LLDB_LOG(log, "failed: {0}", error);
- return error;
- }
+ NativeRegisterContext &context = thread.GetRegisterContext();
uint32_t breakpoint_size = 0;
error = GetSoftwareBreakpointPCOffset(breakpoint_size);
@@ -2050,8 +1991,7 @@ NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) {
// First try probing for a breakpoint at a software breakpoint location: PC -
// breakpoint size.
- const lldb::addr_t initial_pc_addr =
- context_sp->GetPCfromBreakpointLocation();
+ const lldb::addr_t initial_pc_addr = context.GetPCfromBreakpointLocation();
lldb::addr_t breakpoint_addr = initial_pc_addr;
if (breakpoint_size > 0) {
// Do not allow breakpoint probe to wrap around.
@@ -2098,7 +2038,7 @@ NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) {
LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
thread.GetID(), initial_pc_addr, breakpoint_addr);
- error = context_sp->SetPC(breakpoint_addr);
+ error = context.SetPC(breakpoint_addr);
if (error.Fail()) {
LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
thread.GetID(), error);
@@ -2144,8 +2084,8 @@ Status NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name,
return Status("No load address found for specified file.");
}
-NativeThreadLinuxSP NativeProcessLinux::GetThreadByID(lldb::tid_t tid) {
- return std::static_pointer_cast<NativeThreadLinux>(
+NativeThreadLinux *NativeProcessLinux::GetThreadByID(lldb::tid_t tid) {
+ return static_cast<NativeThreadLinux *>(
NativeProcessProtocol::GetThreadByID(tid));
}
@@ -2200,9 +2140,9 @@ void NativeProcessLinux::StopRunningThreads(const lldb::tid_t triggering_tid) {
// Request a stop for all the thread stops that need to be stopped
// and are not already known to be stopped.
- for (const auto &thread_sp : m_threads) {
- if (StateIsRunningState(thread_sp->GetState()))
- static_pointer_cast<NativeThreadLinux>(thread_sp)->RequestStop();
+ for (const auto &thread : m_threads) {
+ if (StateIsRunningState(thread->GetState()))
+ static_cast<NativeThreadLinux *>(thread.get())->RequestStop();
}
SignalIfAllThreadsStopped();
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.h b/source/Plugins/Process/Linux/NativeProcessLinux.h
index c9ec002760f8..f078c1ac30e2 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -13,12 +13,11 @@
#include <csignal>
#include <unordered_set>
-// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/Debug.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/linux/Support.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
@@ -87,7 +86,7 @@ public:
size_t UpdateThreads() override;
- bool GetArchitecture(ArchSpec &arch) const override;
+ const ArchSpec &GetArchitecture() const override { return m_arch; }
Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
bool hardware) override;
@@ -102,7 +101,7 @@ public:
Status GetFileLoadAddress(const llvm::StringRef &file_name,
lldb::addr_t &load_addr) override;
- NativeThreadLinuxSP GetThreadByID(lldb::tid_t id);
+ NativeThreadLinux *GetThreadByID(lldb::tid_t id);
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
GetAuxvData() const override {
@@ -203,7 +202,7 @@ private:
bool StopTrackingThread(lldb::tid_t thread_id);
- NativeThreadLinuxSP AddThread(lldb::tid_t thread_id);
+ NativeThreadLinux &AddThread(lldb::tid_t thread_id);
Status GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size);
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
index 30f09f0c3a3f..c8a8355f9cb9 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
@@ -14,27 +14,19 @@
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/Host/linux/Ptrace.h"
+#include "Plugins/Process/Linux/NativeProcessLinux.h"
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
using namespace lldb_private;
using namespace lldb_private::process_linux;
NativeRegisterContextLinux::NativeRegisterContextLinux(
- NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx,
+ NativeThreadProtocol &native_thread,
RegisterInfoInterface *reg_info_interface_p)
- : NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx,
- reg_info_interface_p) {}
+ : NativeRegisterContextRegisterInfo(native_thread, reg_info_interface_p) {}
lldb::ByteOrder NativeRegisterContextLinux::GetByteOrder() const {
- // Get the target process whose privileged thread was used for the register
- // read.
- lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
-
- if (!m_thread.GetProcess().GetByteOrder(byte_order)) {
- // FIXME log here
- }
-
- return byte_order;
+ return m_thread.GetProcess().GetByteOrder();
}
Status NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index,
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
index 26074a6ce0e3..2cea497b53bc 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
@@ -10,10 +10,8 @@
#ifndef lldb_NativeRegisterContextLinux_h
#define lldb_NativeRegisterContextLinux_h
-#include "lldb/Host/common/NativeThreadProtocol.h"
-
-#include "Plugins/Process/Linux/NativeProcessLinux.h"
#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
+#include "lldb/Host/common/NativeThreadProtocol.h"
namespace lldb_private {
namespace process_linux {
@@ -21,20 +19,15 @@ namespace process_linux {
class NativeRegisterContextLinux : public NativeRegisterContextRegisterInfo {
public:
NativeRegisterContextLinux(NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx,
RegisterInfoInterface *reg_info_interface_p);
// This function is implemented in the NativeRegisterContextLinux_* subclasses
- // to create a new
- // instance of the host specific NativeRegisterContextLinux. The
- // implementations can't collide
- // as only one NativeRegisterContextLinux_* variant should be compiled into
- // the final
- // executable.
- static NativeRegisterContextLinux *
+ // to create a new instance of the host specific NativeRegisterContextLinux.
+ // The implementations can't collide as only one NativeRegisterContextLinux_*
+ // variant should be compiled into the final executable.
+ static std::unique_ptr<NativeRegisterContextLinux>
CreateHostNativeRegisterContextLinux(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
protected:
lldb::ByteOrder GetByteOrder() const;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index 22b7d10869fe..cb05416cb6c3 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -11,15 +11,15 @@
#include "NativeRegisterContextLinux_arm.h"
+#include "Plugins/Process/Linux/NativeProcessLinux.h"
+#include "Plugins/Process/Linux/Procfs.h"
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
-#include "Plugins/Process/Linux/Procfs.h"
-#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
-
#include <elf.h>
#include <sys/socket.h>
@@ -95,20 +95,18 @@ static const RegisterSet g_reg_sets_arm[k_num_register_sets] = {
#if defined(__arm__)
-NativeRegisterContextLinux *
+std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
- return new NativeRegisterContextLinux_arm(target_arch, native_thread,
- concrete_frame_idx);
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return llvm::make_unique<NativeRegisterContextLinux_arm>(target_arch,
+ native_thread);
}
#endif // defined(__arm__)
NativeRegisterContextLinux_arm::NativeRegisterContextLinux_arm(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextLinux(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
new RegisterInfoPOSIX_arm(target_arch)) {
switch (target_arch.GetMachine()) {
case llvm::Triple::arm:
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h
index ec99c05e1644..40e3b80eda74 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h
@@ -23,8 +23,7 @@ class NativeProcessLinux;
class NativeRegisterContextLinux_arm : public NativeRegisterContextLinux {
public:
NativeRegisterContextLinux_arm(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 7aad062e3f93..c483260a5b2c 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -112,26 +112,24 @@ static const RegisterSet g_reg_sets_arm64[k_num_register_sets] = {
{"Floating Point Registers", "fpu", k_num_fpr_registers_arm64,
g_fpu_regnums_arm64}};
-NativeRegisterContextLinux *
+std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
switch (target_arch.GetMachine()) {
case llvm::Triple::arm:
- return new NativeRegisterContextLinux_arm(target_arch, native_thread,
- concrete_frame_idx);
+ return llvm::make_unique<NativeRegisterContextLinux_arm>(target_arch,
+ native_thread);
case llvm::Triple::aarch64:
- return new NativeRegisterContextLinux_arm64(target_arch, native_thread,
- concrete_frame_idx);
+ return llvm::make_unique<NativeRegisterContextLinux_arm64>(target_arch,
+ native_thread);
default:
llvm_unreachable("have no register context for architecture");
}
}
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextLinux(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
new RegisterInfoPOSIX_arm64(target_arch)) {
switch (target_arch.GetMachine()) {
case llvm::Triple::aarch64:
@@ -872,12 +870,8 @@ Status NativeRegisterContextLinux_arm64::DoReadRegisterValue(
error = NativeProcessLinux::PtraceWrapper(
PTRACE_GETREGSET, m_thread.GetID(), &regset, &ioVec, sizeof regs);
if (error.Success()) {
- ArchSpec arch;
- if (m_thread.GetProcess().GetArchitecture(arch))
- value.SetBytes((void *)(((unsigned char *)(&regs)) + offset), 16,
- arch.GetByteOrder());
- else
- error.SetErrorString("failed to get architecture");
+ value.SetBytes((void *)(((unsigned char *)(&regs)) + offset), 16,
+ m_thread.GetProcess().GetByteOrder());
}
} else {
elf_gregset_t regs;
@@ -889,12 +883,8 @@ Status NativeRegisterContextLinux_arm64::DoReadRegisterValue(
error = NativeProcessLinux::PtraceWrapper(
PTRACE_GETREGSET, m_thread.GetID(), &regset, &ioVec, sizeof regs);
if (error.Success()) {
- ArchSpec arch;
- if (m_thread.GetProcess().GetArchitecture(arch))
- value.SetBytes((void *)(((unsigned char *)(regs)) + offset), 8,
- arch.GetByteOrder());
- else
- error.SetErrorString("failed to get architecture");
+ value.SetBytes((void *)(((unsigned char *)(regs)) + offset), 8,
+ m_thread.GetProcess().GetByteOrder());
}
}
return error;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
index 9877dec37c48..ab3c881ead59 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -23,8 +23,7 @@ class NativeProcessLinux;
class NativeRegisterContextLinux_arm64 : public NativeRegisterContextLinux {
public:
NativeRegisterContextLinux_arm64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
index f35ff2be0d94..32c04a4374e6 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
@@ -80,12 +80,11 @@ struct pt_watch_regs default_watch_regs;
using namespace lldb_private;
using namespace lldb_private::process_linux;
-NativeRegisterContextLinux *
+std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
- return new NativeRegisterContextLinux_mips64(target_arch, native_thread,
- concrete_frame_idx);
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return llvm::make_unique<NativeRegisterContextLinux_mips64>(target_arch,
+ native_thread);
}
#define REG_CONTEXT_SIZE \
@@ -110,9 +109,8 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
NativeRegisterContextLinux_mips64::NativeRegisterContextLinux_mips64(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextLinux(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
CreateRegisterInfoInterface(target_arch)) {
switch (target_arch.GetMachine()) {
case llvm::Triple::mips:
@@ -1033,13 +1031,11 @@ Status NativeRegisterContextLinux_mips64::Read_SR_Config(uint32_t offset,
Status error = NativeProcessLinux::PtraceWrapper(
PTRACE_GETREGS, m_thread.GetID(), NULL, &regs, sizeof regs);
if (error.Success()) {
- lldb_private::ArchSpec arch;
- if (m_thread.GetProcess().GetArchitecture(arch)) {
- void *target_address = ((uint8_t *)&regs) + offset +
- 4 * (arch.GetMachine() == llvm::Triple::mips);
- value.SetUInt(*(uint32_t *)target_address, size);
- } else
- error.SetErrorString("failed to get architecture");
+ const lldb_private::ArchSpec &arch =
+ m_thread.GetProcess().GetArchitecture();
+ void *target_address = ((uint8_t *)&regs) + offset +
+ 4 * (arch.GetMachine() == llvm::Triple::mips);
+ value.SetUInt(*(uint32_t *)target_address, size);
}
return error;
}
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
index 3e14da5a2725..c4e984a545bc 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
@@ -15,6 +15,7 @@
#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
#include "Plugins/Process/Utility/RegisterContext_mips.h"
#include "Plugins/Process/Utility/lldb-mips-linux-register-enums.h"
+#include <sys/uio.h>
#define MAX_NUM_WP 8
@@ -26,8 +27,7 @@ class NativeProcessLinux;
class NativeRegisterContextLinux_mips64 : public NativeRegisterContextLinux {
public:
NativeRegisterContextLinux_mips64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
@@ -129,7 +129,7 @@ private:
lldb::addr_t hw_addr_map[MAX_NUM_WP];
- IOVEC_mips m_iovec;
+ struct iovec m_iovec;
};
} // namespace process_linux
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
new file mode 100644
index 000000000000..ea854dfa1dc6
--- /dev/null
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
@@ -0,0 +1,801 @@
+//===-- NativeRegisterContextLinux_ppc64le.cpp ------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This implementation is related to the OpenPOWER ABI for Power Architecture
+// 64-bit ELF V2 ABI
+
+#if defined(__powerpc64__)
+
+#include "NativeRegisterContextLinux_ppc64le.h"
+
+#include "lldb/Core/RegisterValue.h"
+#include "lldb/Host/common/NativeProcessProtocol.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+
+#include "Plugins/Process/Linux/NativeProcessLinux.h"
+#include "Plugins/Process/Linux/Procfs.h"
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
+
+// System includes - They have to be included after framework includes because
+// they define some
+// macros which collide with variable names in other modules
+#include <sys/socket.h>
+#include <elf.h>
+#include <asm/ptrace.h>
+
+#define REG_CONTEXT_SIZE \
+ (GetGPRSize() + GetFPRSize() + sizeof(m_vmx_ppc64le) + sizeof(m_vsx_ppc64le))
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_linux;
+
+static const uint32_t g_gpr_regnums_ppc64le[] = {
+ gpr_r0_ppc64le, gpr_r1_ppc64le, gpr_r2_ppc64le, gpr_r3_ppc64le,
+ gpr_r4_ppc64le, gpr_r5_ppc64le, gpr_r6_ppc64le, gpr_r7_ppc64le,
+ gpr_r8_ppc64le, gpr_r9_ppc64le, gpr_r10_ppc64le, gpr_r11_ppc64le,
+ gpr_r12_ppc64le, gpr_r13_ppc64le, gpr_r14_ppc64le, gpr_r15_ppc64le,
+ gpr_r16_ppc64le, gpr_r17_ppc64le, gpr_r18_ppc64le, gpr_r19_ppc64le,
+ gpr_r20_ppc64le, gpr_r21_ppc64le, gpr_r22_ppc64le, gpr_r23_ppc64le,
+ gpr_r24_ppc64le, gpr_r25_ppc64le, gpr_r26_ppc64le, gpr_r27_ppc64le,
+ gpr_r28_ppc64le, gpr_r29_ppc64le, gpr_r30_ppc64le, gpr_r31_ppc64le,
+ gpr_pc_ppc64le, gpr_msr_ppc64le, gpr_origr3_ppc64le, gpr_ctr_ppc64le,
+ gpr_lr_ppc64le, gpr_xer_ppc64le, gpr_cr_ppc64le, gpr_softe_ppc64le,
+ gpr_trap_ppc64le,
+};
+
+static const uint32_t g_fpr_regnums_ppc64le[] = {
+ fpr_f0_ppc64le, fpr_f1_ppc64le, fpr_f2_ppc64le, fpr_f3_ppc64le,
+ fpr_f4_ppc64le, fpr_f5_ppc64le, fpr_f6_ppc64le, fpr_f7_ppc64le,
+ fpr_f8_ppc64le, fpr_f9_ppc64le, fpr_f10_ppc64le, fpr_f11_ppc64le,
+ fpr_f12_ppc64le, fpr_f13_ppc64le, fpr_f14_ppc64le, fpr_f15_ppc64le,
+ fpr_f16_ppc64le, fpr_f17_ppc64le, fpr_f18_ppc64le, fpr_f19_ppc64le,
+ fpr_f20_ppc64le, fpr_f21_ppc64le, fpr_f22_ppc64le, fpr_f23_ppc64le,
+ fpr_f24_ppc64le, fpr_f25_ppc64le, fpr_f26_ppc64le, fpr_f27_ppc64le,
+ fpr_f28_ppc64le, fpr_f29_ppc64le, fpr_f30_ppc64le, fpr_f31_ppc64le,
+ fpr_fpscr_ppc64le,
+};
+
+static const uint32_t g_vmx_regnums_ppc64le[] = {
+ vmx_vr0_ppc64le, vmx_vr1_ppc64le, vmx_vr2_ppc64le, vmx_vr3_ppc64le,
+ vmx_vr4_ppc64le, vmx_vr5_ppc64le, vmx_vr6_ppc64le, vmx_vr7_ppc64le,
+ vmx_vr8_ppc64le, vmx_vr9_ppc64le, vmx_vr10_ppc64le, vmx_vr11_ppc64le,
+ vmx_vr12_ppc64le, vmx_vr13_ppc64le, vmx_vr14_ppc64le, vmx_vr15_ppc64le,
+ vmx_vr16_ppc64le, vmx_vr17_ppc64le, vmx_vr18_ppc64le, vmx_vr19_ppc64le,
+ vmx_vr20_ppc64le, vmx_vr21_ppc64le, vmx_vr22_ppc64le, vmx_vr23_ppc64le,
+ vmx_vr24_ppc64le, vmx_vr25_ppc64le, vmx_vr26_ppc64le, vmx_vr27_ppc64le,
+ vmx_vr28_ppc64le, vmx_vr29_ppc64le, vmx_vr30_ppc64le, vmx_vr31_ppc64le,
+ vmx_vscr_ppc64le, vmx_vrsave_ppc64le,
+};
+
+static const uint32_t g_vsx_regnums_ppc64le[] = {
+ vsx_vs0_ppc64le, vsx_vs1_ppc64le, vsx_vs2_ppc64le, vsx_vs3_ppc64le,
+ vsx_vs4_ppc64le, vsx_vs5_ppc64le, vsx_vs6_ppc64le, vsx_vs7_ppc64le,
+ vsx_vs8_ppc64le, vsx_vs9_ppc64le, vsx_vs10_ppc64le, vsx_vs11_ppc64le,
+ vsx_vs12_ppc64le, vsx_vs13_ppc64le, vsx_vs14_ppc64le, vsx_vs15_ppc64le,
+ vsx_vs16_ppc64le, vsx_vs17_ppc64le, vsx_vs18_ppc64le, vsx_vs19_ppc64le,
+ vsx_vs20_ppc64le, vsx_vs21_ppc64le, vsx_vs22_ppc64le, vsx_vs23_ppc64le,
+ vsx_vs24_ppc64le, vsx_vs25_ppc64le, vsx_vs26_ppc64le, vsx_vs27_ppc64le,
+ vsx_vs28_ppc64le, vsx_vs29_ppc64le, vsx_vs30_ppc64le, vsx_vs31_ppc64le,
+ vsx_vs32_ppc64le, vsx_vs33_ppc64le, vsx_vs34_ppc64le, vsx_vs35_ppc64le,
+ vsx_vs36_ppc64le, vsx_vs37_ppc64le, vsx_vs38_ppc64le, vsx_vs39_ppc64le,
+ vsx_vs40_ppc64le, vsx_vs41_ppc64le, vsx_vs42_ppc64le, vsx_vs43_ppc64le,
+ vsx_vs44_ppc64le, vsx_vs45_ppc64le, vsx_vs46_ppc64le, vsx_vs47_ppc64le,
+ vsx_vs48_ppc64le, vsx_vs49_ppc64le, vsx_vs50_ppc64le, vsx_vs51_ppc64le,
+ vsx_vs52_ppc64le, vsx_vs53_ppc64le, vsx_vs54_ppc64le, vsx_vs55_ppc64le,
+ vsx_vs56_ppc64le, vsx_vs57_ppc64le, vsx_vs58_ppc64le, vsx_vs59_ppc64le,
+ vsx_vs60_ppc64le, vsx_vs61_ppc64le, vsx_vs62_ppc64le, vsx_vs63_ppc64le,
+};
+
+namespace {
+// Number of register sets provided by this context.
+enum { k_num_register_sets = 4 };
+}
+
+static const RegisterSet g_reg_sets_ppc64le[k_num_register_sets] = {
+ {"General Purpose Registers", "gpr", k_num_gpr_registers_ppc64le,
+ g_gpr_regnums_ppc64le},
+ {"Floating Point Registers", "fpr", k_num_fpr_registers_ppc64le,
+ g_fpr_regnums_ppc64le},
+ {"AltiVec/VMX Registers", "vmx", k_num_vmx_registers_ppc64le,
+ g_vmx_regnums_ppc64le},
+ {"VSX Registers", "vsx", k_num_vsx_registers_ppc64le,
+ g_vsx_regnums_ppc64le},
+};
+
+std::unique_ptr<NativeRegisterContextLinux>
+NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ switch (target_arch.GetMachine()) {
+ case llvm::Triple::ppc64le:
+ return llvm::make_unique<NativeRegisterContextLinux_ppc64le>(target_arch,
+ native_thread);
+ default:
+ llvm_unreachable("have no register context for architecture");
+ }
+}
+
+NativeRegisterContextLinux_ppc64le::NativeRegisterContextLinux_ppc64le(
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
+ new RegisterInfoPOSIX_ppc64le(target_arch)) {
+ if (target_arch.GetMachine() != llvm::Triple::ppc64le) {
+ llvm_unreachable("Unhandled target architecture.");
+ }
+
+ ::memset(&m_gpr_ppc64le, 0, sizeof(m_gpr_ppc64le));
+ ::memset(&m_fpr_ppc64le, 0, sizeof(m_fpr_ppc64le));
+ ::memset(&m_vmx_ppc64le, 0, sizeof(m_vmx_ppc64le));
+ ::memset(&m_vsx_ppc64le, 0, sizeof(m_vsx_ppc64le));
+ ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::GetRegisterSetCount() const {
+ return k_num_register_sets;
+}
+
+const RegisterSet *
+NativeRegisterContextLinux_ppc64le::GetRegisterSet(uint32_t set_index) const {
+ if (set_index < k_num_register_sets)
+ return &g_reg_sets_ppc64le[set_index];
+
+ return nullptr;
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::GetUserRegisterCount() const {
+ uint32_t count = 0;
+ for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index)
+ count += g_reg_sets_ppc64le[set_index].num_registers;
+ return count;
+}
+
+Status NativeRegisterContextLinux_ppc64le::ReadRegister(
+ const RegisterInfo *reg_info, RegisterValue &reg_value) {
+ Status error;
+
+ if (!reg_info) {
+ error.SetErrorString("reg_info NULL");
+ return error;
+ }
+
+ const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
+
+ if (IsFPR(reg)) {
+ error = ReadFPR();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_fpr_ppc64le variable and set the data from it.
+ uint32_t fpr_offset = CalculateFprOffset(reg_info);
+ assert(fpr_offset < sizeof m_fpr_ppc64le);
+ uint8_t *src = (uint8_t *)&m_fpr_ppc64le + fpr_offset;
+ reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size,
+ eByteOrderLittle, error);
+ } else if (IsVSX(reg)) {
+ uint32_t vsx_offset = CalculateVsxOffset(reg_info);
+ assert(vsx_offset < sizeof(m_vsx_ppc64le));
+
+ if (vsx_offset < sizeof(m_vsx_ppc64le) / 2) {
+ error = ReadVSX();
+ if (error.Fail())
+ return error;
+
+ error = ReadFPR();
+ if (error.Fail())
+ return error;
+
+ uint64_t value[2];
+ uint8_t *dst, *src;
+ dst = (uint8_t *)&value;
+ src = (uint8_t *)&m_vsx_ppc64le + vsx_offset / 2;
+ ::memcpy(dst, src, 8);
+ dst += 8;
+ src = (uint8_t *)&m_fpr_ppc64le + vsx_offset / 2;
+ ::memcpy(dst, src, 8);
+ reg_value.SetFromMemoryData(reg_info, &value, reg_info->byte_size,
+ eByteOrderLittle, error);
+ } else {
+ error = ReadVMX();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_vmx_ppc64le variable and set the data from it.
+ uint32_t vmx_offset = vsx_offset - sizeof(m_vsx_ppc64le) / 2;
+ uint8_t *src = (uint8_t *)&m_vmx_ppc64le + vmx_offset;
+ reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size,
+ eByteOrderLittle, error);
+ }
+ } else if (IsVMX(reg)) {
+ error = ReadVMX();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_vmx_ppc64le variable and set the data from it.
+ uint32_t vmx_offset = CalculateVmxOffset(reg_info);
+ assert(vmx_offset < sizeof m_vmx_ppc64le);
+ uint8_t *src = (uint8_t *)&m_vmx_ppc64le + vmx_offset;
+ reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size,
+ eByteOrderLittle, error);
+ } else if (IsGPR(reg)) {
+ error = ReadGPR();
+ if (error.Fail())
+ return error;
+
+ uint8_t *src = (uint8_t *) &m_gpr_ppc64le + reg_info->byte_offset;
+ reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size,
+ eByteOrderLittle, error);
+ } else {
+ return Status("failed - register wasn't recognized to be a GPR, FPR, VSX "
+ "or VMX, read strategy unknown");
+ }
+
+ return error;
+}
+
+Status NativeRegisterContextLinux_ppc64le::WriteRegister(
+ const RegisterInfo *reg_info, const RegisterValue &reg_value) {
+ Status error;
+ if (!reg_info)
+ return Status("reg_info NULL");
+
+ const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB];
+ if (reg_index == LLDB_INVALID_REGNUM)
+ return Status("no lldb regnum for %s", reg_info && reg_info->name
+ ? reg_info->name
+ : "<unknown register>");
+
+ if (IsGPR(reg_index)) {
+ error = ReadGPR();
+ if (error.Fail())
+ return error;
+
+ uint8_t *dst = (uint8_t *)&m_gpr_ppc64le + reg_info->byte_offset;
+ ::memcpy(dst, reg_value.GetBytes(), reg_value.GetByteSize());
+
+ error = WriteGPR();
+ if (error.Fail())
+ return error;
+
+ return Status();
+ }
+
+ if (IsFPR(reg_index)) {
+ error = ReadFPR();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_fpr_ppc64le variable and set the data to it.
+ uint32_t fpr_offset = CalculateFprOffset(reg_info);
+ assert(fpr_offset < GetFPRSize());
+ uint8_t *dst = (uint8_t *)&m_fpr_ppc64le + fpr_offset;
+ ::memcpy(dst, reg_value.GetBytes(), reg_value.GetByteSize());
+
+ error = WriteFPR();
+ if (error.Fail())
+ return error;
+
+ return Status();
+ }
+
+ if (IsVMX(reg_index)) {
+ error = ReadVMX();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_vmx_ppc64le variable and set the data to it.
+ uint32_t vmx_offset = CalculateVmxOffset(reg_info);
+ assert(vmx_offset < sizeof(m_vmx_ppc64le));
+ uint8_t *dst = (uint8_t *)&m_vmx_ppc64le + vmx_offset;
+ ::memcpy(dst, reg_value.GetBytes(), reg_value.GetByteSize());
+
+ error = WriteVMX();
+ if (error.Fail())
+ return error;
+
+ return Status();
+ }
+
+ if (IsVSX(reg_index)) {
+ uint32_t vsx_offset = CalculateVsxOffset(reg_info);
+ assert(vsx_offset < sizeof(m_vsx_ppc64le));
+
+ if (vsx_offset < sizeof(m_vsx_ppc64le) / 2) {
+ error = ReadVSX();
+ if (error.Fail())
+ return error;
+
+ error = ReadFPR();
+ if (error.Fail())
+ return error;
+
+ uint64_t value[2];
+ ::memcpy(value, reg_value.GetBytes(), 16);
+ uint8_t *dst, *src;
+ src = (uint8_t *)value;
+ dst = (uint8_t *)&m_vsx_ppc64le + vsx_offset / 2;
+ ::memcpy(dst, src, 8);
+ src += 8;
+ dst = (uint8_t *)&m_fpr_ppc64le + vsx_offset / 2;
+ ::memcpy(dst, src, 8);
+
+ WriteVSX();
+ WriteFPR();
+ } else {
+ error = ReadVMX();
+ if (error.Fail())
+ return error;
+
+ // Get pointer to m_vmx_ppc64le variable and set the data from it.
+ uint32_t vmx_offset = vsx_offset - sizeof(m_vsx_ppc64le) / 2;
+ uint8_t *dst = (uint8_t *)&m_vmx_ppc64le + vmx_offset;
+ ::memcpy(dst, reg_value.GetBytes(), reg_value.GetByteSize());
+ WriteVMX();
+ }
+
+ return Status();
+ }
+
+ return Status("failed - register wasn't recognized to be a GPR, FPR, VSX "
+ "or VMX, write strategy unknown");
+}
+
+Status NativeRegisterContextLinux_ppc64le::ReadAllRegisterValues(
+ lldb::DataBufferSP &data_sp) {
+ Status error;
+
+ data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
+ if (!data_sp)
+ return Status("failed to allocate DataBufferHeap instance of size %" PRIu64,
+ REG_CONTEXT_SIZE);
+
+ error = ReadGPR();
+ if (error.Fail())
+ return error;
+
+ error = ReadFPR();
+ if (error.Fail())
+ return error;
+
+ error = ReadVMX();
+ if (error.Fail())
+ return error;
+
+ error = ReadVSX();
+ if (error.Fail())
+ return error;
+
+ uint8_t *dst = data_sp->GetBytes();
+ if (dst == nullptr) {
+ error.SetErrorStringWithFormat("DataBufferHeap instance of size %" PRIu64
+ " returned a null pointer",
+ REG_CONTEXT_SIZE);
+ return error;
+ }
+
+ ::memcpy(dst, &m_gpr_ppc64le, GetGPRSize());
+ dst += GetGPRSize();
+ ::memcpy(dst, &m_fpr_ppc64le, GetFPRSize());
+ dst += GetFPRSize();
+ ::memcpy(dst, &m_vmx_ppc64le, sizeof(m_vmx_ppc64le));
+ dst += sizeof(m_vmx_ppc64le);
+ ::memcpy(dst, &m_vsx_ppc64le, sizeof(m_vsx_ppc64le));
+
+ return error;
+}
+
+Status NativeRegisterContextLinux_ppc64le::WriteAllRegisterValues(
+ const lldb::DataBufferSP &data_sp) {
+ Status error;
+
+ if (!data_sp) {
+ error.SetErrorStringWithFormat(
+ "NativeRegisterContextLinux_ppc64le::%s invalid data_sp provided",
+ __FUNCTION__);
+ return error;
+ }
+
+ if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) {
+ error.SetErrorStringWithFormat(
+ "NativeRegisterContextLinux_ppc64le::%s data_sp contained mismatched "
+ "data size, expected %" PRIu64 ", actual %" PRIu64,
+ __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize());
+ return error;
+ }
+
+ uint8_t *src = data_sp->GetBytes();
+ if (src == nullptr) {
+ error.SetErrorStringWithFormat("NativeRegisterContextLinux_ppc64le::%s "
+ "DataBuffer::GetBytes() returned a null "
+ "pointer",
+ __FUNCTION__);
+ return error;
+ }
+
+ ::memcpy(&m_gpr_ppc64le, src, GetGPRSize());
+ error = WriteGPR();
+
+ if (error.Fail())
+ return error;
+
+ src += GetGPRSize();
+ ::memcpy(&m_fpr_ppc64le, src, GetFPRSize());
+
+ error = WriteFPR();
+ if (error.Fail())
+ return error;
+
+ src += GetFPRSize();
+ ::memcpy(&m_vmx_ppc64le, src, sizeof(m_vmx_ppc64le));
+
+ error = WriteVMX();
+ if (error.Fail())
+ return error;
+
+ src += sizeof(m_vmx_ppc64le);
+ ::memcpy(&m_vsx_ppc64le, src, sizeof(m_vsx_ppc64le));
+ error = WriteVSX();
+
+ return error;
+}
+
+bool NativeRegisterContextLinux_ppc64le::IsGPR(unsigned reg) const {
+ return reg <= k_last_gpr_ppc64le; // GPR's come first.
+}
+
+bool NativeRegisterContextLinux_ppc64le::IsFPR(unsigned reg) const {
+ return (k_first_fpr_ppc64le <= reg && reg <= k_last_fpr_ppc64le);
+}
+
+Status NativeRegisterContextLinux_ppc64le::DoReadGPR(
+ void *buf, size_t buf_size) {
+ int regset = NT_PRSTATUS;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(),
+ &regset, buf, buf_size);
+}
+
+Status NativeRegisterContextLinux_ppc64le::DoWriteGPR(
+ void *buf, size_t buf_size) {
+ int regset = NT_PRSTATUS;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(),
+ &regset, buf, buf_size);
+}
+
+Status NativeRegisterContextLinux_ppc64le::DoReadFPR(void *buf,
+ size_t buf_size) {
+ int regset = NT_FPREGSET;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_GETFPREGS, m_thread.GetID(),
+ &regset, buf, buf_size);
+}
+
+Status NativeRegisterContextLinux_ppc64le::DoWriteFPR(void *buf,
+ size_t buf_size) {
+ int regset = NT_FPREGSET;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_SETFPREGS, m_thread.GetID(),
+ &regset, buf, buf_size);
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::CalculateFprOffset(
+ const RegisterInfo *reg_info) const {
+ return reg_info->byte_offset -
+ GetRegisterInfoAtIndex(k_first_fpr_ppc64le)->byte_offset;
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::CalculateVmxOffset(
+ const RegisterInfo *reg_info) const {
+ return reg_info->byte_offset -
+ GetRegisterInfoAtIndex(k_first_vmx_ppc64le)->byte_offset;
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::CalculateVsxOffset(
+ const RegisterInfo *reg_info) const {
+ return reg_info->byte_offset -
+ GetRegisterInfoAtIndex(k_first_vsx_ppc64le)->byte_offset;
+}
+
+Status NativeRegisterContextLinux_ppc64le::ReadVMX() {
+ int regset = NT_PPC_VMX;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_GETVRREGS, m_thread.GetID(),
+ &regset, &m_vmx_ppc64le,
+ sizeof(m_vmx_ppc64le));
+}
+
+Status NativeRegisterContextLinux_ppc64le::WriteVMX() {
+ int regset = NT_PPC_VMX;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_SETVRREGS, m_thread.GetID(),
+ &regset, &m_vmx_ppc64le,
+ sizeof(m_vmx_ppc64le));
+}
+
+Status NativeRegisterContextLinux_ppc64le::ReadVSX() {
+ int regset = NT_PPC_VSX;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_GETVSRREGS, m_thread.GetID(),
+ &regset, &m_vsx_ppc64le,
+ sizeof(m_vsx_ppc64le));
+}
+
+Status NativeRegisterContextLinux_ppc64le::WriteVSX() {
+ int regset = NT_PPC_VSX;
+ return NativeProcessLinux::PtraceWrapper(PTRACE_SETVSRREGS, m_thread.GetID(),
+ &regset, &m_vsx_ppc64le,
+ sizeof(m_vsx_ppc64le));
+}
+
+bool NativeRegisterContextLinux_ppc64le::IsVMX(unsigned reg) {
+ return (reg >= k_first_vmx_ppc64le) && (reg <= k_last_vmx_ppc64le);
+}
+
+bool NativeRegisterContextLinux_ppc64le::IsVSX(unsigned reg) {
+ return (reg >= k_first_vsx_ppc64le) && (reg <= k_last_vsx_ppc64le);
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::NumSupportedHardwareWatchpoints() {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+
+ // Read hardware breakpoint and watchpoint information.
+ Status error = ReadHardwareDebugInfo();
+
+ if (error.Fail())
+ return 0;
+
+ LLDB_LOG(log, "{0}", m_max_hwp_supported);
+ return m_max_hwp_supported;
+}
+
+uint32_t NativeRegisterContextLinux_ppc64le::SetHardwareWatchpoint(
+ lldb::addr_t addr, size_t size, uint32_t watch_flags) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size,
+ watch_flags);
+
+ // Read hardware breakpoint and watchpoint information.
+ Status error = ReadHardwareDebugInfo();
+
+ if (error.Fail())
+ return LLDB_INVALID_INDEX32;
+
+ uint32_t control_value = 0, wp_index = 0;
+ lldb::addr_t real_addr = addr;
+ uint32_t rw_mode = 0;
+
+ // Check if we are setting watchpoint other than read/write/access
+ // Update watchpoint flag to match ppc64le write-read bit configuration.
+ switch (watch_flags) {
+ case eWatchpointKindWrite:
+ rw_mode = PPC_BREAKPOINT_TRIGGER_WRITE;
+ watch_flags = 2;
+ break;
+ case eWatchpointKindRead:
+ rw_mode = PPC_BREAKPOINT_TRIGGER_READ;
+ watch_flags = 1;
+ break;
+ case (eWatchpointKindRead | eWatchpointKindWrite):
+ rw_mode = PPC_BREAKPOINT_TRIGGER_RW;
+ break;
+ default:
+ return LLDB_INVALID_INDEX32;
+ }
+
+ // Check if size has a valid hardware watchpoint length.
+ if (size != 1 && size != 2 && size != 4 && size != 8)
+ return LLDB_INVALID_INDEX32;
+
+ // Check 8-byte alignment for hardware watchpoint target address.
+ // Below is a hack to recalculate address and size in order to
+ // make sure we can watch non 8-byte alligned addresses as well.
+ if (addr & 0x07) {
+
+ addr_t begin = llvm::alignDown(addr, 8);
+ addr_t end = llvm::alignTo(addr + size, 8);
+ size = llvm::PowerOf2Ceil(end - begin);
+
+ addr = addr & (~0x07);
+ }
+
+ // Setup control value
+ control_value = watch_flags << 3;
+ control_value |= ((1 << size) - 1) << 5;
+ control_value |= (2 << 1) | 1;
+
+ // Iterate over stored watchpoints and find a free wp_index
+ wp_index = LLDB_INVALID_INDEX32;
+ for (uint32_t i = 0; i < m_max_hwp_supported; i++) {
+ if ((m_hwp_regs[i].control & 1) == 0) {
+ wp_index = i; // Mark last free slot
+ } else if (m_hwp_regs[i].address == addr) {
+ return LLDB_INVALID_INDEX32; // We do not support duplicate watchpoints.
+ }
+ }
+
+ if (wp_index == LLDB_INVALID_INDEX32)
+ return LLDB_INVALID_INDEX32;
+
+ // Update watchpoint in local cache
+ m_hwp_regs[wp_index].real_addr = real_addr;
+ m_hwp_regs[wp_index].address = addr;
+ m_hwp_regs[wp_index].control = control_value;
+ m_hwp_regs[wp_index].mode = rw_mode;
+
+ // PTRACE call to set corresponding watchpoint register.
+ error = WriteHardwareDebugRegs();
+
+ if (error.Fail()) {
+ m_hwp_regs[wp_index].address = 0;
+ m_hwp_regs[wp_index].control &= llvm::maskTrailingZeros<uint32_t>(1);
+
+ return LLDB_INVALID_INDEX32;
+ }
+
+ return wp_index;
+}
+
+bool NativeRegisterContextLinux_ppc64le::ClearHardwareWatchpoint(
+ uint32_t wp_index) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}", wp_index);
+
+ // Read hardware breakpoint and watchpoint information.
+ Status error = ReadHardwareDebugInfo();
+
+ if (error.Fail())
+ return false;
+
+ if (wp_index >= m_max_hwp_supported)
+ return false;
+
+ // Create a backup we can revert to in case of failure.
+ lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
+ uint32_t tempControl = m_hwp_regs[wp_index].control;
+ long *tempSlot = reinterpret_cast<long *>(m_hwp_regs[wp_index].slot);
+
+ // Update watchpoint in local cache
+ m_hwp_regs[wp_index].control &= llvm::maskTrailingZeros<uint32_t>(1);
+ m_hwp_regs[wp_index].address = 0;
+ m_hwp_regs[wp_index].slot = 0;
+ m_hwp_regs[wp_index].mode = 0;
+
+ // Ptrace call to update hardware debug registers
+ error = NativeProcessLinux::PtraceWrapper(PPC_PTRACE_DELHWDEBUG,
+ m_thread.GetID(), 0, tempSlot);
+
+ if (error.Fail()) {
+ m_hwp_regs[wp_index].control = tempControl;
+ m_hwp_regs[wp_index].address = tempAddr;
+ m_hwp_regs[wp_index].slot = reinterpret_cast<long>(tempSlot);
+
+ return false;
+ }
+
+ return true;
+}
+
+uint32_t
+NativeRegisterContextLinux_ppc64le::GetWatchpointSize(uint32_t wp_index) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}", wp_index);
+
+ unsigned control = (m_hwp_regs[wp_index].control >> 5) & 0xff;
+ if (llvm::isPowerOf2_32(control + 1)) {
+ return llvm::countPopulation(control);
+ }
+
+ return 0;
+}
+
+bool NativeRegisterContextLinux_ppc64le::WatchpointIsEnabled(
+ uint32_t wp_index) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}", wp_index);
+
+ return !!((m_hwp_regs[wp_index].control & 0x1) == 0x1);
+}
+
+Status NativeRegisterContextLinux_ppc64le::GetWatchpointHitIndex(
+ uint32_t &wp_index, lldb::addr_t trap_addr) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr);
+
+ uint32_t watch_size;
+ lldb::addr_t watch_addr;
+
+ for (wp_index = 0; wp_index < m_max_hwp_supported; ++wp_index) {
+ watch_size = GetWatchpointSize(wp_index);
+ watch_addr = m_hwp_regs[wp_index].address;
+
+ if (WatchpointIsEnabled(wp_index) && trap_addr >= watch_addr &&
+ trap_addr <= watch_addr + watch_size) {
+ m_hwp_regs[wp_index].hit_addr = trap_addr;
+ return Status();
+ }
+ }
+
+ wp_index = LLDB_INVALID_INDEX32;
+ return Status();
+}
+
+lldb::addr_t
+NativeRegisterContextLinux_ppc64le::GetWatchpointAddress(uint32_t wp_index) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}", wp_index);
+
+ if (wp_index >= m_max_hwp_supported)
+ return LLDB_INVALID_ADDRESS;
+
+ if (WatchpointIsEnabled(wp_index))
+ return m_hwp_regs[wp_index].real_addr;
+ else
+ return LLDB_INVALID_ADDRESS;
+}
+
+lldb::addr_t
+NativeRegisterContextLinux_ppc64le::GetWatchpointHitAddress(uint32_t wp_index) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
+ LLDB_LOG(log, "wp_index: {0}", wp_index);
+
+ if (wp_index >= m_max_hwp_supported)
+ return LLDB_INVALID_ADDRESS;
+
+ if (WatchpointIsEnabled(wp_index))
+ return m_hwp_regs[wp_index].hit_addr;
+
+ return LLDB_INVALID_ADDRESS;
+}
+
+Status NativeRegisterContextLinux_ppc64le::ReadHardwareDebugInfo() {
+ if (!m_refresh_hwdebug_info) {
+ return Status();
+ }
+
+ ::pid_t tid = m_thread.GetID();
+
+ struct ppc_debug_info hwdebug_info;
+ Status error;
+
+ error = NativeProcessLinux::PtraceWrapper(
+ PPC_PTRACE_GETHWDBGINFO, tid, 0, &hwdebug_info, sizeof(hwdebug_info));
+
+ if (error.Fail())
+ return error;
+
+ m_max_hwp_supported = hwdebug_info.num_data_bps;
+ m_max_hbp_supported = hwdebug_info.num_instruction_bps;
+ m_refresh_hwdebug_info = false;
+
+ return error;
+}
+
+Status NativeRegisterContextLinux_ppc64le::WriteHardwareDebugRegs() {
+ struct ppc_hw_breakpoint reg_state;
+ Status error;
+ long ret;
+
+ for (uint32_t i = 0; i < m_max_hwp_supported; i++) {
+ reg_state.addr = m_hwp_regs[i].address;
+ reg_state.trigger_type = m_hwp_regs[i].mode;
+ reg_state.version = 1;
+ reg_state.addr_mode = PPC_BREAKPOINT_MODE_EXACT;
+ reg_state.condition_mode = PPC_BREAKPOINT_CONDITION_NONE;
+ reg_state.addr2 = 0;
+ reg_state.condition_value = 0;
+
+ error = NativeProcessLinux::PtraceWrapper(PPC_PTRACE_SETHWDEBUG,
+ m_thread.GetID(), 0, &reg_state,
+ sizeof(reg_state), &ret);
+
+ if (error.Fail())
+ return error;
+
+ m_hwp_regs[i].slot = ret;
+ }
+
+ return error;
+}
+
+#endif // defined(__powerpc64__)
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
new file mode 100644
index 000000000000..bb25af80d02c
--- /dev/null
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
@@ -0,0 +1,149 @@
+//===-- NativeRegisterContextLinux_ppc64le.h --------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This implementation is related to the OpenPOWER ABI for Power Architecture
+// 64-bit ELF V2 ABI
+
+#if defined(__powerpc64__)
+
+#ifndef lldb_NativeRegisterContextLinux_ppc64le_h
+#define lldb_NativeRegisterContextLinux_ppc64le_h
+
+#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
+#include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h"
+
+#define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+#include "RegisterInfos_ppc64le.h"
+#undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+
+namespace lldb_private {
+namespace process_linux {
+
+class NativeProcessLinux;
+
+class NativeRegisterContextLinux_ppc64le : public NativeRegisterContextLinux {
+public:
+ NativeRegisterContextLinux_ppc64le(const ArchSpec &target_arch,
+ NativeThreadProtocol &native_thread);
+
+ uint32_t GetRegisterSetCount() const override;
+
+ uint32_t GetUserRegisterCount() const override;
+
+ const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
+
+ Status ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &reg_value) override;
+
+ Status WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &reg_value) override;
+
+ Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
+
+ Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
+
+ //------------------------------------------------------------------
+ // Hardware watchpoint mangement functions
+ //------------------------------------------------------------------
+
+ uint32_t NumSupportedHardwareWatchpoints() override;
+
+ uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
+ uint32_t watch_flags) override;
+
+ bool ClearHardwareWatchpoint(uint32_t hw_index) override;
+
+ Status GetWatchpointHitIndex(uint32_t &wp_index,
+ lldb::addr_t trap_addr) override;
+
+ lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index) override;
+
+ lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override;
+
+ uint32_t GetWatchpointSize(uint32_t wp_index);
+
+ bool WatchpointIsEnabled(uint32_t wp_index);
+
+protected:
+ Status DoReadGPR(void *buf, size_t buf_size) override;
+
+ Status DoWriteGPR(void *buf, size_t buf_size) override;
+
+ Status DoReadFPR(void *buf, size_t buf_size) override;
+
+ Status DoWriteFPR(void *buf, size_t buf_size) override;
+
+ bool IsVMX(unsigned reg);
+
+ bool IsVSX(unsigned reg);
+
+ Status ReadVMX();
+
+ Status WriteVMX();
+
+ Status ReadVSX();
+
+ Status WriteVSX();
+
+ void *GetGPRBuffer() override { return &m_gpr_ppc64le; }
+
+ void *GetFPRBuffer() override { return &m_fpr_ppc64le; }
+
+ size_t GetFPRSize() override { return sizeof(m_fpr_ppc64le); }
+
+private:
+ GPR m_gpr_ppc64le; // 64-bit general purpose registers.
+ FPR m_fpr_ppc64le; // floating-point registers including extended register.
+ VMX m_vmx_ppc64le; // VMX registers.
+ VSX m_vsx_ppc64le; // Last lower bytes from first VSX registers.
+
+ bool IsGPR(unsigned reg) const;
+
+ bool IsFPR(unsigned reg) const;
+
+ bool IsVMX(unsigned reg) const;
+
+ bool IsVSX(unsigned reg) const;
+
+ uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
+
+ uint32_t CalculateVmxOffset(const RegisterInfo *reg_info) const;
+
+ uint32_t CalculateVsxOffset(const RegisterInfo *reg_info) const;
+
+ Status ReadHardwareDebugInfo();
+
+ Status WriteHardwareDebugRegs();
+
+ // Debug register info for hardware watchpoints management.
+ struct DREG {
+ lldb::addr_t address; // Breakpoint/watchpoint address value.
+ lldb::addr_t hit_addr; // Address at which last watchpoint trigger
+ // exception occurred.
+ lldb::addr_t real_addr; // Address value that should cause target to stop.
+ uint32_t control; // Breakpoint/watchpoint control value.
+ uint32_t refcount; // Serves as enable/disable and reference counter.
+ long slot; // Saves the value returned from PTRACE_SETHWDEBUG.
+ int mode; // Defines if watchpoint is read/write/access.
+ };
+
+ std::array<DREG, 4> m_hwp_regs;
+
+ // 16 is just a maximum value, query hardware for actual watchpoint count
+ uint32_t m_max_hwp_supported = 16;
+ uint32_t m_max_hbp_supported = 16;
+ bool m_refresh_hwdebug_info = true;
+};
+
+} // namespace process_linux
+} // namespace lldb_private
+
+#endif // #ifndef lldb_NativeRegisterContextLinux_ppc64le_h
+
+#endif // defined(__powerpc64__)
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
index c2a696e08bf9..021394ab154b 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
@@ -97,12 +97,11 @@ static const RegisterSet g_reg_sets_s390x[k_num_register_sets] = {
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
-NativeRegisterContextLinux *
+std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
- return new NativeRegisterContextLinux_s390x(target_arch, native_thread,
- concrete_frame_idx);
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return llvm::make_unique<NativeRegisterContextLinux_s390x>(target_arch,
+ native_thread);
}
// ----------------------------------------------------------------------------
@@ -117,9 +116,8 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
NativeRegisterContextLinux_s390x::NativeRegisterContextLinux_s390x(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextLinux(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
CreateRegisterInfoInterface(target_arch)) {
// Set up data about ranges of valid registers.
switch (target_arch.GetMachine()) {
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
index 3ffbaeeb0bba..57b1a0481512 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
@@ -24,8 +24,7 @@ class NativeProcessLinux;
class NativeRegisterContextLinux_s390x : public NativeRegisterContextLinux {
public:
NativeRegisterContextLinux_s390x(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index e44e03b46b5c..84ffe9b6e420 100755
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -243,12 +243,11 @@ static inline unsigned int fxsr_regset(const ArchSpec &arch) {
#define mask_XSTATE_BNDCFG (1ULL << 4)
#define mask_XSTATE_MPX (mask_XSTATE_BNDREGS | mask_XSTATE_BNDCFG)
-NativeRegisterContextLinux *
+std::unique_ptr<NativeRegisterContextLinux>
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
- return new NativeRegisterContextLinux_x86_64(target_arch, native_thread,
- concrete_frame_idx);
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return std::unique_ptr<NativeRegisterContextLinux>(
+ new NativeRegisterContextLinux_x86_64(target_arch, native_thread));
}
// ----------------------------------------------------------------------------
@@ -270,9 +269,8 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextLinux(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextLinux(native_thread,
CreateRegisterInfoInterface(target_arch)),
m_xstate_type(XStateType::Invalid), m_fpr(), m_iovec(), m_ymm_set(),
m_mpx_set(), m_reg_info(), m_gpr_x86_64() {
@@ -334,11 +332,11 @@ NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
// Initialize m_iovec to point to the buffer and buffer size
// using the conventions of Berkeley style UIO structures, as required
// by PTRACE extensions.
- m_iovec.iov_base = &m_fpr.xstate.xsave;
- m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
+ m_iovec.iov_base = &m_fpr;
+ m_iovec.iov_len = sizeof(m_fpr);
// Clear out the FPR state.
- ::memset(&m_fpr, 0, sizeof(FPR));
+ ::memset(&m_fpr, 0, sizeof(m_fpr));
// Store byte offset of fctrl (i.e. first register of FPR)
const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
@@ -441,17 +439,14 @@ NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
if (byte_order != lldb::eByteOrderInvalid) {
if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
- reg_value.SetBytes(
- m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes,
- reg_info->byte_size, byte_order);
+ reg_value.SetBytes(m_fpr.fxsave.stmm[reg - m_reg_info.first_st].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
- reg_value.SetBytes(
- m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
- reg_info->byte_size, byte_order);
+ reg_value.SetBytes(m_fpr.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
- reg_value.SetBytes(
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
- reg_info->byte_size, byte_order);
+ reg_value.SetBytes(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
+ reg_info->byte_size, byte_order);
if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) {
// Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes
if (CopyXSTATEtoYMM(reg, byte_order))
@@ -492,7 +487,7 @@ NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}
- // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
+ // Get pointer to m_fpr.fxsave variable and set the data from it.
// Byte offsets of all registers are calculated wrt 'UserArea' structure.
// However, ReadFPR() reads fpu registers {using ptrace(PTRACE_GETFPREGS,..)}
@@ -530,6 +525,22 @@ NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}
+void NativeRegisterContextLinux_x86_64::UpdateXSTATEforWrite(
+ uint32_t reg_index) {
+ XSAVE_HDR::XFeature &xstate_bv = m_fpr.xsave.header.xstate_bv;
+ if (IsFPR(reg_index)) {
+ // IsFPR considers both %st and %xmm registers as floating point, but these
+ // map to two features. Set both flags, just in case.
+ xstate_bv |= XSAVE_HDR::XFeature::FP | XSAVE_HDR::XFeature::SSE;
+ } else if (IsAVX(reg_index)) {
+ // Lower bytes of some %ymm registers are shared with %xmm registers.
+ xstate_bv |= XSAVE_HDR::XFeature::YMM | XSAVE_HDR::XFeature::SSE;
+ } else if (IsMPX(reg_index)) {
+ // MPX registers map to two XSAVE features.
+ xstate_bv |= XSAVE_HDR::XFeature::BNDREGS | XSAVE_HDR::XFeature::BNDCSR;
+ }
+}
+
Status NativeRegisterContextLinux_x86_64::WriteRegister(
const RegisterInfo *reg_info, const RegisterValue &reg_value) {
assert(reg_info && "reg_info is null");
@@ -540,25 +551,24 @@ Status NativeRegisterContextLinux_x86_64::WriteRegister(
? reg_info->name
: "<unknown register>");
+ UpdateXSTATEforWrite(reg_index);
+
if (IsGPR(reg_index))
return WriteRegisterRaw(reg_index, reg_value);
if (IsFPR(reg_index) || IsAVX(reg_index) || IsMPX(reg_index)) {
if (reg_info->encoding == lldb::eEncodingVector) {
if (reg_index >= m_reg_info.first_st && reg_index <= m_reg_info.last_st)
- ::memcpy(
- m_fpr.xstate.fxsave.stmm[reg_index - m_reg_info.first_st].bytes,
- reg_value.GetBytes(), reg_value.GetByteSize());
+ ::memcpy(m_fpr.fxsave.stmm[reg_index - m_reg_info.first_st].bytes,
+ reg_value.GetBytes(), reg_value.GetByteSize());
if (reg_index >= m_reg_info.first_mm && reg_index <= m_reg_info.last_mm)
- ::memcpy(
- m_fpr.xstate.fxsave.stmm[reg_index - m_reg_info.first_mm].bytes,
- reg_value.GetBytes(), reg_value.GetByteSize());
+ ::memcpy(m_fpr.fxsave.stmm[reg_index - m_reg_info.first_mm].bytes,
+ reg_value.GetBytes(), reg_value.GetByteSize());
if (reg_index >= m_reg_info.first_xmm && reg_index <= m_reg_info.last_xmm)
- ::memcpy(
- m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_xmm].bytes,
- reg_value.GetBytes(), reg_value.GetByteSize());
+ ::memcpy(m_fpr.fxsave.xmm[reg_index - m_reg_info.first_xmm].bytes,
+ reg_value.GetBytes(), reg_value.GetByteSize());
if (reg_index >= m_reg_info.first_ymm &&
reg_index <= m_reg_info.last_ymm) {
@@ -586,7 +596,7 @@ Status NativeRegisterContextLinux_x86_64::WriteRegister(
return Status("CopyMPXtoXSTATE() failed");
}
} else {
- // Get pointer to m_fpr.xstate.fxsave variable and set the data to it.
+ // Get pointer to m_fpr.fxsave variable and set the data to it.
// Byte offsets of all registers are calculated wrt 'UserArea' structure.
// However, WriteFPR() takes m_fpr (of type FPR structure) and writes only
@@ -658,7 +668,7 @@ Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues(
::memcpy(dst, &m_gpr_x86_64, GetRegisterInfoInterface().GetGPRSize());
dst += GetRegisterInfoInterface().GetGPRSize();
if (m_xstate_type == XStateType::FXSAVE)
- ::memcpy(dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
+ ::memcpy(dst, &m_fpr.fxsave, sizeof(m_fpr.fxsave));
else if (m_xstate_type == XStateType::XSAVE) {
lldb::ByteOrder byte_order = GetByteOrder();
@@ -749,9 +759,9 @@ Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues(
src += GetRegisterInfoInterface().GetGPRSize();
if (m_xstate_type == XStateType::FXSAVE)
- ::memcpy(&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));
+ ::memcpy(&m_fpr.fxsave, src, sizeof(m_fpr.fxsave));
else if (m_xstate_type == XStateType::XSAVE)
- ::memcpy(&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));
+ ::memcpy(&m_fpr.xsave, src, sizeof(m_fpr.xsave));
error = WriteFPR();
if (error.Fail())
@@ -805,12 +815,12 @@ bool NativeRegisterContextLinux_x86_64::IsCPUFeatureAvailable(
return true;
case RegSet::avx: // Check if CPU has AVX and if there is kernel support, by
// reading in the XCR0 area of XSAVE.
- if ((m_fpr.xstate.xsave.i387.xcr0 & mask_XSTATE_AVX) == mask_XSTATE_AVX)
+ if ((m_fpr.xsave.i387.xcr0 & mask_XSTATE_AVX) == mask_XSTATE_AVX)
return true;
break;
case RegSet::mpx: // Check if CPU has MPX and if there is kernel support, by
// reading in the XCR0 area of XSAVE.
- if ((m_fpr.xstate.xsave.i387.xcr0 & mask_XSTATE_MPX) == mask_XSTATE_MPX)
+ if ((m_fpr.xsave.i387.xcr0 & mask_XSTATE_MPX) == mask_XSTATE_MPX)
return true;
break;
}
@@ -847,11 +857,10 @@ Status NativeRegisterContextLinux_x86_64::WriteFPR() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
return WriteRegisterSet(
- &m_iovec, sizeof(m_fpr.xstate.xsave),
+ &m_iovec, sizeof(m_fpr.fxsave),
fxsr_regset(GetRegisterInfoInterface().GetTargetArchitecture()));
case XStateType::XSAVE:
- return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave),
- NT_X86_XSTATE);
+ return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xsave), NT_X86_XSTATE);
default:
return Status("Unrecognized FPR type.");
}
@@ -871,11 +880,11 @@ bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoYMM(
if (byte_order == lldb::eByteOrderLittle) {
::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,
+ m_fpr.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,
sizeof(XMMReg));
::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes +
sizeof(XMMReg),
- m_fpr.xstate.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,
+ m_fpr.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,
sizeof(YMMHReg));
return true;
}
@@ -883,10 +892,10 @@ bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoYMM(
if (byte_order == lldb::eByteOrderBig) {
::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes +
sizeof(XMMReg),
- m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,
+ m_fpr.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,
sizeof(XMMReg));
::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,
+ m_fpr.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,
sizeof(YMMHReg));
return true;
}
@@ -899,19 +908,19 @@ bool NativeRegisterContextLinux_x86_64::CopyYMMtoXSTATE(
return false;
if (byte_order == lldb::eByteOrderLittle) {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
sizeof(YMMHReg));
return true;
}
if (byte_order == lldb::eByteOrderBig) {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(YMMHReg));
return true;
}
@@ -921,7 +930,7 @@ bool NativeRegisterContextLinux_x86_64::CopyYMMtoXSTATE(
void *NativeRegisterContextLinux_x86_64::GetFPRBuffer() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
- return &m_fpr.xstate.fxsave;
+ return &m_fpr.fxsave;
case XStateType::XSAVE:
return &m_iovec;
default:
@@ -932,7 +941,7 @@ void *NativeRegisterContextLinux_x86_64::GetFPRBuffer() {
size_t NativeRegisterContextLinux_x86_64::GetFPRSize() {
switch (m_xstate_type) {
case XStateType::FXSAVE:
- return sizeof(m_fpr.xstate.fxsave);
+ return sizeof(m_fpr.fxsave);
case XStateType::XSAVE:
return sizeof(m_iovec);
default:
@@ -945,15 +954,14 @@ Status NativeRegisterContextLinux_x86_64::ReadFPR() {
// Probe XSAVE and if it is not supported fall back to FXSAVE.
if (m_xstate_type != XStateType::FXSAVE) {
- error =
- ReadRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
+ error = ReadRegisterSet(&m_iovec, sizeof(m_fpr.xsave), NT_X86_XSTATE);
if (!error.Fail()) {
m_xstate_type = XStateType::XSAVE;
return error;
}
}
error = ReadRegisterSet(
- &m_iovec, sizeof(m_fpr.xstate.xsave),
+ &m_iovec, sizeof(m_fpr.xsave),
fxsr_regset(GetRegisterInfoInterface().GetTargetArchitecture()));
if (!error.Fail()) {
m_xstate_type = XStateType::FXSAVE;
@@ -975,11 +983,11 @@ bool NativeRegisterContextLinux_x86_64::CopyXSTATEtoMPX(uint32_t reg) {
if (reg >= m_reg_info.first_mpxr && reg <= m_reg_info.last_mpxr) {
::memcpy(m_mpx_set.mpxr[reg - m_reg_info.first_mpxr].bytes,
- m_fpr.xstate.xsave.mpxr[reg - m_reg_info.first_mpxr].bytes,
+ m_fpr.xsave.mpxr[reg - m_reg_info.first_mpxr].bytes,
sizeof(MPXReg));
} else {
::memcpy(m_mpx_set.mpxc[reg - m_reg_info.first_mpxc].bytes,
- m_fpr.xstate.xsave.mpxc[reg - m_reg_info.first_mpxc].bytes,
+ m_fpr.xsave.mpxc[reg - m_reg_info.first_mpxc].bytes,
sizeof(MPXCsr));
}
return true;
@@ -990,10 +998,10 @@ bool NativeRegisterContextLinux_x86_64::CopyMPXtoXSTATE(uint32_t reg) {
return false;
if (reg >= m_reg_info.first_mpxr && reg <= m_reg_info.last_mpxr) {
- ::memcpy(m_fpr.xstate.xsave.mpxr[reg - m_reg_info.first_mpxr].bytes,
+ ::memcpy(m_fpr.xsave.mpxr[reg - m_reg_info.first_mpxr].bytes,
m_mpx_set.mpxr[reg - m_reg_info.first_mpxr].bytes, sizeof(MPXReg));
} else {
- ::memcpy(m_fpr.xstate.xsave.mpxc[reg - m_reg_info.first_mpxc].bytes,
+ ::memcpy(m_fpr.xsave.mpxc[reg - m_reg_info.first_mpxc].bytes,
m_mpx_set.mpxc[reg - m_reg_info.first_mpxc].bytes, sizeof(MPXCsr));
}
return true;
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
index abb0dba4d91c..9dcf82f50a45 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
@@ -15,6 +15,7 @@
#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
#include "Plugins/Process/Utility/RegisterContext_x86.h"
#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
+#include <sys/uio.h>
namespace lldb_private {
namespace process_linux {
@@ -24,8 +25,7 @@ class NativeProcessLinux;
class NativeRegisterContextLinux_x86_64 : public NativeRegisterContextLinux {
public:
NativeRegisterContextLinux_x86_64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
@@ -110,7 +110,7 @@ private:
// Private member variables.
mutable XStateType m_xstate_type;
FPR m_fpr; // Extended States Area, named FPR for historical reasons.
- IOVEC m_iovec;
+ struct iovec m_iovec;
YMM m_ymm_set;
MPX m_mpx_set;
RegInfo m_reg_info;
@@ -137,6 +137,8 @@ private:
bool CopyMPXtoXSTATE(uint32_t reg);
bool IsMPX(uint32_t reg_index) const;
+
+ void UpdateXSTATEforWrite(uint32_t reg_index);
};
} // namespace process_linux
diff --git a/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 5cd40941dcf8..0db3bd56b8e4 100644
--- a/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -88,7 +88,11 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
NativeThreadLinux::NativeThreadLinux(NativeProcessLinux &process,
lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
- m_stop_info(), m_reg_context_sp(), m_stop_description() {}
+ m_stop_info(),
+ m_reg_context_up(
+ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
+ process.GetArchitecture(), *this)),
+ m_stop_description() {}
std::string NativeThreadLinux::GetName() {
NativeProcessLinux &process = GetProcess();
@@ -139,23 +143,6 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info,
llvm_unreachable("unhandled StateType!");
}
-NativeRegisterContextSP NativeThreadLinux::GetRegisterContext() {
- // Return the register context if we already created it.
- if (m_reg_context_sp)
- return m_reg_context_sp;
-
- ArchSpec target_arch;
- if (!m_process.GetArchitecture(target_arch))
- return NativeRegisterContextSP();
-
- const uint32_t concrete_frame_idx = 0;
- m_reg_context_sp.reset(
- NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
- target_arch, *this, concrete_frame_idx));
-
- return m_reg_context_sp;
-}
-
Status NativeThreadLinux::SetWatchpoint(lldb::addr_t addr, size_t size,
uint32_t watch_flags, bool hardware) {
if (!hardware)
@@ -165,8 +152,8 @@ Status NativeThreadLinux::SetWatchpoint(lldb::addr_t addr, size_t size,
Status error = RemoveWatchpoint(addr);
if (error.Fail())
return error;
- NativeRegisterContextSP reg_ctx = GetRegisterContext();
- uint32_t wp_index = reg_ctx->SetHardwareWatchpoint(addr, size, watch_flags);
+ uint32_t wp_index =
+ m_reg_context_up->SetHardwareWatchpoint(addr, size, watch_flags);
if (wp_index == LLDB_INVALID_INDEX32)
return Status("Setting hardware watchpoint failed.");
m_watchpoint_index_map.insert({addr, wp_index});
@@ -179,7 +166,7 @@ Status NativeThreadLinux::RemoveWatchpoint(lldb::addr_t addr) {
return Status();
uint32_t wp_index = wp->second;
m_watchpoint_index_map.erase(wp);
- if (GetRegisterContext()->ClearHardwareWatchpoint(wp_index))
+ if (m_reg_context_up->ClearHardwareWatchpoint(wp_index))
return Status();
return Status("Clearing hardware watchpoint failed.");
}
@@ -193,8 +180,7 @@ Status NativeThreadLinux::SetHardwareBreakpoint(lldb::addr_t addr,
if (error.Fail())
return error;
- NativeRegisterContextSP reg_ctx = GetRegisterContext();
- uint32_t bp_index = reg_ctx->SetHardwareBreakpoint(addr, size);
+ uint32_t bp_index = m_reg_context_up->SetHardwareBreakpoint(addr, size);
if (bp_index == LLDB_INVALID_INDEX32)
return Status("Setting hardware breakpoint failed.");
@@ -209,7 +195,7 @@ Status NativeThreadLinux::RemoveHardwareBreakpoint(lldb::addr_t addr) {
return Status();
uint32_t bp_index = bp->second;
- if (GetRegisterContext()->ClearHardwareBreakpoint(bp_index)) {
+ if (m_reg_context_up->ClearHardwareBreakpoint(bp_index)) {
m_hw_break_index_map.erase(bp);
return Status();
}
@@ -231,7 +217,7 @@ Status NativeThreadLinux::Resume(uint32_t signo) {
NativeProcessLinux &process = GetProcess();
const auto &watchpoint_map = process.GetWatchpointMap();
- GetRegisterContext()->ClearAllHardwareWatchpoints();
+ m_reg_context_up->ClearAllHardwareWatchpoints();
for (const auto &pair : watchpoint_map) {
const auto &wp = pair.second;
SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags, wp.m_hardware);
@@ -243,7 +229,7 @@ Status NativeThreadLinux::Resume(uint32_t signo) {
NativeProcessLinux &process = GetProcess();
const auto &hw_breakpoint_map = process.GetHardwareBreakpointMap();
- GetRegisterContext()->ClearAllHardwareBreakpoints();
+ m_reg_context_up->ClearAllHardwareBreakpoints();
for (const auto &pair : hw_breakpoint_map) {
const auto &bp = pair.second;
SetHardwareBreakpoint(bp.m_addr, bp.m_size);
@@ -365,7 +351,7 @@ void NativeThreadLinux::SetStoppedByWatchpoint(uint32_t wp_index) {
lldbassert(wp_index != LLDB_INVALID_INDEX32 && "wp_index cannot be invalid");
std::ostringstream ostr;
- ostr << GetRegisterContext()->GetWatchpointAddress(wp_index) << " ";
+ ostr << m_reg_context_up->GetWatchpointAddress(wp_index) << " ";
ostr << wp_index;
/*
@@ -379,7 +365,7 @@ void NativeThreadLinux::SetStoppedByWatchpoint(uint32_t wp_index) {
* stop-info
* packet.
*/
- ostr << " " << GetRegisterContext()->GetWatchpointHitAddress(wp_index);
+ ostr << " " << m_reg_context_up->GetWatchpointHitAddress(wp_index);
m_stop_description = ostr.str();
diff --git a/source/Plugins/Process/Linux/NativeThreadLinux.h b/source/Plugins/Process/Linux/NativeThreadLinux.h
index 6ae87feffcda..a7c4e982012d 100644
--- a/source/Plugins/Process/Linux/NativeThreadLinux.h
+++ b/source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -10,7 +10,8 @@
#ifndef liblldb_NativeThreadLinux_H_
#define liblldb_NativeThreadLinux_H_
-#include "SingleStepCheck.h"
+#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
+#include "Plugins/Process/Linux/SingleStepCheck.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/lldb-private-forward.h"
@@ -40,7 +41,9 @@ public:
bool GetStopReason(ThreadStopInfo &stop_info,
std::string &description) override;
- NativeRegisterContextSP GetRegisterContext() override;
+ NativeRegisterContextLinux &GetRegisterContext() override {
+ return *m_reg_context_up;
+ }
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
bool hardware) override;
@@ -103,15 +106,13 @@ private:
// ---------------------------------------------------------------------
lldb::StateType m_state;
ThreadStopInfo m_stop_info;
- NativeRegisterContextSP m_reg_context_sp;
+ std::unique_ptr<NativeRegisterContextLinux> m_reg_context_up;
std::string m_stop_description;
using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
WatchpointIndexMap m_watchpoint_index_map;
WatchpointIndexMap m_hw_break_index_map;
std::unique_ptr<SingleStepWorkaround> m_step_workaround;
};
-
-typedef std::shared_ptr<NativeThreadLinux> NativeThreadLinuxSP;
} // namespace process_linux
} // namespace lldb_private
diff --git a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
index 52b9441e0e79..b4eae58af83c 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
+++ b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
@@ -17,12 +17,12 @@
#include <vector>
// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
diff --git a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index ae2f11f38006..1902cc492ff4 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -12,13 +12,13 @@
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Unwind.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/StreamString.h"
diff --git a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
index 388989a21f76..387f04afa5b4 100644
--- a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -109,10 +109,8 @@ NativeProcessNetBSD::Factory::Launch(ProcessLaunchInfo &launch_info,
if (status.Fail())
return status.ToError();
- for (const auto &thread_sp : process_up->m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
- SIGSTOP);
- }
+ for (const auto &thread : process_up->m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedBySignal(SIGSTOP);
process_up->SetState(StateType::eStateStopped);
return std::move(process_up);
@@ -198,9 +196,9 @@ void NativeProcessNetBSD::MonitorSIGSTOP(lldb::pid_t pid) {
// Handle SIGSTOP from LLGS (LLDB GDB Server)
if (info.psi_siginfo.si_code == SI_USER &&
info.psi_siginfo.si_pid == ::getpid()) {
- /* Stop Tracking All Threads attached to Process */
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
+ /* Stop Tracking all Threads attached to Process */
+ for (const auto &thread : m_threads) {
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedBySignal(
SIGSTOP, &info.psi_siginfo);
}
}
@@ -221,18 +219,15 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) {
switch (info.psi_siginfo.si_code) {
case TRAP_BRKPT:
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)
- ->SetStoppedByBreakpoint();
- FixupBreakpointPCAsNeeded(
- *static_pointer_cast<NativeThreadNetBSD>(thread_sp));
+ for (const auto &thread : m_threads) {
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedByBreakpoint();
+ FixupBreakpointPCAsNeeded(static_cast<NativeThreadNetBSD &>(*thread));
}
SetState(StateType::eStateStopped, true);
break;
case TRAP_TRACE:
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByTrace();
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedByTrace();
SetState(StateType::eStateStopped, true);
break;
case TRAP_EXEC: {
@@ -245,38 +240,35 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) {
// Let our delegate know we have just exec'd.
NotifyDidExec();
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByExec();
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedByExec();
SetState(StateType::eStateStopped, true);
} break;
case TRAP_DBREG: {
// If a watchpoint was hit, report it
uint32_t wp_index;
- Status error =
- static_pointer_cast<NativeThreadNetBSD>(m_threads[info.psi_lwpid])
- ->GetRegisterContext()
- ->GetWatchpointHitIndex(wp_index,
- (uintptr_t)info.psi_siginfo.si_addr);
+ Status error = static_cast<NativeThreadNetBSD &>(*m_threads[info.psi_lwpid])
+ .GetRegisterContext()
+ .GetWatchpointHitIndex(
+ wp_index, (uintptr_t)info.psi_siginfo.si_addr);
if (error.Fail())
LLDB_LOG(log,
"received error while checking for watchpoint hits, pid = "
"{0}, LWP = {1}, error = {2}",
GetID(), info.psi_lwpid, error);
if (wp_index != LLDB_INVALID_INDEX32) {
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)
- ->SetStoppedByWatchpoint(wp_index);
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedByWatchpoint(
+ wp_index);
SetState(StateType::eStateStopped, true);
break;
}
// If a breakpoint was hit, report it
uint32_t bp_index;
- error = static_pointer_cast<NativeThreadNetBSD>(m_threads[info.psi_lwpid])
- ->GetRegisterContext()
- ->GetHardwareBreakHitIndex(bp_index,
+ error = static_cast<NativeThreadNetBSD &>(*m_threads[info.psi_lwpid])
+ .GetRegisterContext()
+ .GetHardwareBreakHitIndex(bp_index,
(uintptr_t)info.psi_siginfo.si_addr);
if (error.Fail())
LLDB_LOG(log,
@@ -284,10 +276,8 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) {
"breakpoint hits, pid = {0}, LWP = {1}, error = {2}",
GetID(), info.psi_lwpid, error);
if (bp_index != LLDB_INVALID_INDEX32) {
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)
- ->SetStoppedByBreakpoint();
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedByBreakpoint();
SetState(StateType::eStateStopped, true);
break;
}
@@ -300,8 +290,8 @@ void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) {
const auto siginfo_err =
PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
+ for (const auto &thread : m_threads) {
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedBySignal(
info.psi_siginfo.si_signo, &info.psi_siginfo);
}
SetState(StateType::eStateStopped, true);
@@ -351,12 +341,7 @@ NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) {
Status error;
// Find out the size of a breakpoint (might depend on where we are in the
// code).
- NativeRegisterContextSP context_sp = thread.GetRegisterContext();
- if (!context_sp) {
- error.SetErrorString("cannot get a NativeRegisterContext for the thread");
- LLDB_LOG(log, "failed: {0}", error);
- return error;
- }
+ NativeRegisterContext& context = thread.GetRegisterContext();
uint32_t breakpoint_size = 0;
error = GetSoftwareBreakpointPCOffset(breakpoint_size);
if (error.Fail()) {
@@ -367,7 +352,7 @@ NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) {
// First try probing for a breakpoint at a software breakpoint location: PC
// - breakpoint size.
const lldb::addr_t initial_pc_addr =
- context_sp->GetPCfromBreakpointLocation();
+ context.GetPCfromBreakpointLocation();
lldb::addr_t breakpoint_addr = initial_pc_addr;
if (breakpoint_size > 0) {
// Do not allow breakpoint probe to wrap around.
@@ -420,7 +405,7 @@ NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) {
// Change the program counter.
LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
thread.GetID(), initial_pc_addr, breakpoint_addr);
- error = context_sp->SetPC(breakpoint_addr);
+ error = context.SetPC(breakpoint_addr);
if (error.Fail()) {
LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
thread.GetID(), error);
@@ -433,13 +418,13 @@ Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "pid {0}", GetID());
- const auto &thread_sp = m_threads[0];
+ const auto &thread = m_threads[0];
const ResumeAction *const action =
- resume_actions.GetActionForThread(thread_sp->GetID(), true);
+ resume_actions.GetActionForThread(thread->GetID(), true);
if (action == nullptr) {
LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
- thread_sp->GetID());
+ thread->GetID());
return Status();
}
@@ -452,9 +437,8 @@ Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
action->signal);
if (!error.Success())
return error;
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetRunning();
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetRunning();
SetState(eStateRunning, true);
break;
}
@@ -464,9 +448,8 @@ Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
action->signal);
if (!error.Success())
return error;
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStepping();
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStepping();
SetState(eStateStepping, true);
break;
@@ -478,7 +461,7 @@ Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
return Status("NativeProcessNetBSD::%s (): unexpected state %s specified "
"for pid %" PRIu64 ", tid %" PRIu64,
__FUNCTION__, StateAsCString(action->state), GetID(),
- thread_sp->GetID());
+ thread->GetID());
}
return Status();
@@ -690,11 +673,6 @@ lldb::addr_t NativeProcessNetBSD::GetSharedLibraryInfoAddress() {
size_t NativeProcessNetBSD::UpdateThreads() { return m_threads.size(); }
-bool NativeProcessNetBSD::GetArchitecture(ArchSpec &arch) const {
- arch = m_arch;
- return true;
-}
-
Status NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size,
bool hardware) {
if (hardware)
@@ -764,9 +742,9 @@ void NativeProcessNetBSD::SigchldHandler() {
}
bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
- for (auto thread_sp : m_threads) {
- assert(thread_sp && "thread list should not contain NULL threads");
- if (thread_sp->GetID() == thread_id) {
+ for (const auto &thread : m_threads) {
+ assert(thread && "thread list should not contain NULL threads");
+ if (thread->GetID() == thread_id) {
// We have this thread.
return true;
}
@@ -776,7 +754,7 @@ bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
return false;
}
-NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
+NativeThreadNetBSD &NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id);
@@ -788,9 +766,8 @@ NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
if (m_threads.empty())
SetCurrentThreadID(thread_id);
- auto thread_sp = std::make_shared<NativeThreadNetBSD>(*this, thread_id);
- m_threads.push_back(thread_sp);
- return thread_sp;
+ m_threads.push_back(llvm::make_unique<NativeThreadNetBSD>(*this, thread_id));
+ return static_cast<NativeThreadNetBSD &>(*m_threads.back());
}
Status NativeProcessNetBSD::Attach() {
@@ -811,10 +788,8 @@ Status NativeProcessNetBSD::Attach() {
if (status.Fail())
return status;
- for (const auto &thread_sp : m_threads) {
- static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
- SIGSTOP);
- }
+ for (const auto &thread : m_threads)
+ static_cast<NativeThreadNetBSD &>(*thread).SetStoppedBySignal(SIGSTOP);
// Let our process instance know the thread has stopped.
SetState(StateType::eStateStopped);
@@ -928,7 +903,7 @@ Status NativeProcessNetBSD::ReinitializeThreads() {
}
// Reinitialize from scratch threads and register them in process
while (info.pl_lwpid != 0) {
- NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
+ AddThread(info.pl_lwpid);
error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
if (error.Fail()) {
return error;
diff --git a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
index 2cbd5e30ab23..7090fce34fc9 100644
--- a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -10,12 +10,8 @@
#ifndef liblldb_NativeProcessNetBSD_H_
#define liblldb_NativeProcessNetBSD_H_
-// C++ Includes
-
-// Other libraries and framework includes
-
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "NativeThreadNetBSD.h"
@@ -77,7 +73,7 @@ public:
size_t UpdateThreads() override;
- bool GetArchitecture(ArchSpec &arch) const override;
+ const ArchSpec &GetArchitecture() const override { return m_arch; }
Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
bool hardware) override;
@@ -121,7 +117,7 @@ private:
bool HasThreadNoLock(lldb::tid_t thread_id);
- NativeThreadNetBSDSP AddThread(lldb::tid_t thread_id);
+ NativeThreadNetBSD &AddThread(lldb::tid_t thread_id);
void MonitorCallback(lldb::pid_t pid, int signal);
void MonitorExited(lldb::pid_t pid, WaitStatus status);
diff --git a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
index dde86880c41a..d4fef6342439 100644
--- a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
@@ -20,9 +20,9 @@ using namespace lldb_private::process_netbsd;
// clang-format on
NativeRegisterContextNetBSD::NativeRegisterContextNetBSD(
- NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx,
+ NativeThreadProtocol &native_thread,
RegisterInfoInterface *reg_info_interface_p)
- : NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx,
+ : NativeRegisterContextRegisterInfo(native_thread,
reg_info_interface_p) {}
Status NativeRegisterContextNetBSD::ReadGPR() {
diff --git a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
index d96b7aea0048..b81430e7f5ac 100644
--- a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
+++ b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
@@ -21,7 +21,6 @@ namespace process_netbsd {
class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
public:
NativeRegisterContextNetBSD(NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx,
RegisterInfoInterface *reg_info_interface_p);
// This function is implemented in the NativeRegisterContextNetBSD_*
@@ -31,8 +30,7 @@ public:
// executable.
static NativeRegisterContextNetBSD *
CreateHostNativeRegisterContextNetBSD(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
protected:
virtual Status ReadGPR();
diff --git a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
index 9690da0e1374..347c15ae5b23 100644
--- a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -149,10 +149,8 @@ const int fpu_save = []() -> int {
NativeRegisterContextNetBSD *
NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx) {
- return new NativeRegisterContextNetBSD_x86_64(target_arch, native_thread,
- concrete_frame_idx);
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return new NativeRegisterContextNetBSD_x86_64(target_arch, native_thread);
}
// ----------------------------------------------------------------------------
@@ -169,9 +167,8 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
}
NativeRegisterContextNetBSD_x86_64::NativeRegisterContextNetBSD_x86_64(
- const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx)
- : NativeRegisterContextNetBSD(native_thread, concrete_frame_idx,
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
+ : NativeRegisterContextNetBSD(native_thread,
CreateRegisterInfoInterface(target_arch)),
m_gpr_x86_64(), m_fpr_x86_64(), m_dbr_x86_64() {}
diff --git a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
index 5f5a6a0792e4..c55ddfec6615 100644
--- a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
+++ b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
@@ -30,8 +30,7 @@ class NativeProcessNetBSD;
class NativeRegisterContextNetBSD_x86_64 : public NativeRegisterContextNetBSD {
public:
NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
diff --git a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
index 1fd7400bf800..83f1da78d01d 100644
--- a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -27,7 +27,9 @@ using namespace lldb_private::process_netbsd;
NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD &process,
lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
- m_stop_info(), m_reg_context_sp(), m_stop_description() {}
+ m_stop_info(), m_reg_context_up(
+NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(process.GetArchitecture(), *this)
+), m_stop_description() {}
void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
const siginfo_t *info) {
@@ -77,10 +79,10 @@ void NativeThreadNetBSD::SetStoppedByWatchpoint(uint32_t wp_index) {
lldbassert(wp_index != LLDB_INVALID_INDEX32 && "wp_index cannot be invalid");
std::ostringstream ostr;
- ostr << GetRegisterContext()->GetWatchpointAddress(wp_index) << " ";
+ ostr << GetRegisterContext().GetWatchpointAddress(wp_index) << " ";
ostr << wp_index;
- ostr << " " << GetRegisterContext()->GetWatchpointHitAddress(wp_index);
+ ostr << " " << GetRegisterContext().GetWatchpointHitAddress(wp_index);
m_stop_description = ostr.str();
@@ -139,21 +141,9 @@ bool NativeThreadNetBSD::GetStopReason(ThreadStopInfo &stop_info,
llvm_unreachable("unhandled StateType!");
}
-NativeRegisterContextSP NativeThreadNetBSD::GetRegisterContext() {
- // Return the register context if we already created it.
- if (m_reg_context_sp)
- return m_reg_context_sp;
-
- ArchSpec target_arch;
- if (!m_process.GetArchitecture(target_arch))
- return NativeRegisterContextSP();
-
- const uint32_t concrete_frame_idx = 0;
- m_reg_context_sp.reset(
- NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(
- target_arch, *this, concrete_frame_idx));
-
- return m_reg_context_sp;
+NativeRegisterContext& NativeThreadNetBSD::GetRegisterContext() {
+ assert(m_reg_context_up);
+return *m_reg_context_up;
}
Status NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size,
@@ -165,8 +155,7 @@ Status NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size,
Status error = RemoveWatchpoint(addr);
if (error.Fail())
return error;
- NativeRegisterContextSP reg_ctx = GetRegisterContext();
- uint32_t wp_index = reg_ctx->SetHardwareWatchpoint(addr, size, watch_flags);
+ uint32_t wp_index = GetRegisterContext().SetHardwareWatchpoint(addr, size, watch_flags);
if (wp_index == LLDB_INVALID_INDEX32)
return Status("Setting hardware watchpoint failed.");
m_watchpoint_index_map.insert({addr, wp_index});
@@ -179,7 +168,7 @@ Status NativeThreadNetBSD::RemoveWatchpoint(lldb::addr_t addr) {
return Status();
uint32_t wp_index = wp->second;
m_watchpoint_index_map.erase(wp);
- if (GetRegisterContext()->ClearHardwareWatchpoint(wp_index))
+ if (GetRegisterContext().ClearHardwareWatchpoint(wp_index))
return Status();
return Status("Clearing hardware watchpoint failed.");
}
@@ -193,8 +182,7 @@ Status NativeThreadNetBSD::SetHardwareBreakpoint(lldb::addr_t addr,
if (error.Fail())
return error;
- NativeRegisterContextSP reg_ctx = GetRegisterContext();
- uint32_t bp_index = reg_ctx->SetHardwareBreakpoint(addr, size);
+ uint32_t bp_index = GetRegisterContext().SetHardwareBreakpoint(addr, size);
if (bp_index == LLDB_INVALID_INDEX32)
return Status("Setting hardware breakpoint failed.");
@@ -209,7 +197,7 @@ Status NativeThreadNetBSD::RemoveHardwareBreakpoint(lldb::addr_t addr) {
return Status();
uint32_t bp_index = bp->second;
- if (GetRegisterContext()->ClearHardwareBreakpoint(bp_index)) {
+ if (GetRegisterContext().ClearHardwareBreakpoint(bp_index)) {
m_hw_break_index_map.erase(bp);
return Status();
}
diff --git a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
index 1e3f587be5f5..72426244c112 100644
--- a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -37,7 +37,7 @@ public:
bool GetStopReason(ThreadStopInfo &stop_info,
std::string &description) override;
- NativeRegisterContextSP GetRegisterContext() override;
+ NativeRegisterContext& GetRegisterContext() override;
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
bool hardware) override;
@@ -67,7 +67,7 @@ private:
// ---------------------------------------------------------------------
lldb::StateType m_state;
ThreadStopInfo m_stop_info;
- NativeRegisterContextSP m_reg_context_sp;
+ std::unique_ptr<NativeRegisterContext> m_reg_context_up;
std::string m_stop_description;
using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
WatchpointIndexMap m_watchpoint_index_map;
diff --git a/source/Plugins/Process/Utility/CMakeLists.txt b/source/Plugins/Process/Utility/CMakeLists.txt
index bda0ad626f6f..3780fb5e4c18 100644
--- a/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/source/Plugins/Process/Utility/CMakeLists.txt
@@ -39,11 +39,13 @@ add_lldb_library(lldbPluginProcessUtility PLUGIN
RegisterContextPOSIX_arm64.cpp
RegisterContextPOSIX_mips64.cpp
RegisterContextPOSIX_powerpc.cpp
+ RegisterContextPOSIX_ppc64le.cpp
RegisterContextPOSIX_s390x.cpp
RegisterContextPOSIX_x86.cpp
RegisterContextThreadMemory.cpp
RegisterInfoPOSIX_arm.cpp
RegisterInfoPOSIX_arm64.cpp
+ RegisterInfoPOSIX_ppc64le.cpp
StopInfoMachException.cpp
ThreadMemory.cpp
UnwindLLDB.cpp
diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 1a4511a82230..61e5bf4481d6 100644
--- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -9,14 +9,10 @@
#include "DynamicRegisterInfo.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StringExtractor.h"
#include "lldb/Utility/StructuredData.h"
diff --git a/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
index 4e1f10c6ae18..5c51a035ec66 100644
--- a/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ b/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -64,7 +64,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
options.SetTimeout(std::chrono::milliseconds(500));
options.SetTrapExceptions(false);
- addr_t prot_arg, flags_arg = 0;
+ addr_t prot_arg;
if (prot == eMmapProtNone)
prot_arg = PROT_NONE;
else {
@@ -77,11 +77,6 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
prot_arg |= PROT_WRITE;
}
- const ArchSpec arch = process->GetTarget().GetArchitecture();
- flags_arg =
- process->GetTarget().GetPlatform()->ConvertMmapFlagsToPlatform(arch,
- flags);
-
AddressRange mmap_range;
if (sc.GetAddressRange(range_scope, 0, use_inline_block_range,
mmap_range)) {
@@ -89,7 +84,10 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
process->GetTarget().GetScratchClangASTContext();
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
- lldb::addr_t args[] = {addr, length, prot_arg, flags_arg, fd, offset};
+ const ArchSpec arch = process->GetTarget().GetArchitecture();
+ MmapArgList args =
+ process->GetTarget().GetPlatform()->GetMmapArgumentList(
+ arch, addr, length, prot_arg, flags, fd, offset);
lldb::ThreadPlanSP call_plan_sp(
new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
clang_void_ptr_type, args, options));
diff --git a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
index 0b1814362425..3a9d497711c0 100644
--- a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
+++ b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
@@ -14,9 +14,9 @@
using namespace lldb_private;
NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo(
- NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
+ NativeThreadProtocol &thread,
RegisterInfoInterface *register_info_interface)
- : NativeRegisterContext(thread, concrete_frame_idx),
+ : NativeRegisterContext(thread),
m_register_info_interface_up(register_info_interface) {
assert(register_info_interface && "null register_info_interface");
}
diff --git a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
index c1b597462b60..8f2e4409105f 100644
--- a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
+++ b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
@@ -23,7 +23,7 @@ public:
/// of the register_info_interface pointer.
///
NativeRegisterContextRegisterInfo(
- NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
+ NativeThreadProtocol &thread,
RegisterInfoInterface *register_info_interface);
uint32_t GetRegisterCount() const override;
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
index 0c36f1a8346c..344c08965fad 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -426,7 +426,7 @@ bool RegisterContextDarwin_arm64::ReadRegister(const RegisterInfo *reg_info,
case fpu_v29:
case fpu_v30:
case fpu_v31:
- value.SetBytes(fpu.v[reg].bytes, reg_info->byte_size,
+ value.SetBytes(fpu.v[reg].bytes.buffer, reg_info->byte_size,
endian::InlHostByteOrder());
break;
@@ -618,7 +618,7 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info,
case fpu_v29:
case fpu_v30:
case fpu_v31:
- ::memcpy(fpu.v[reg].bytes, value.GetBytes(), value.GetByteSize());
+ ::memcpy(fpu.v[reg].bytes.buffer, value.GetBytes(), value.GetByteSize());
break;
case fpu_fpsr:
diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
index 2d1fe0555b58..4a0e50947ee7 100644
--- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
+++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
@@ -78,7 +78,7 @@ public:
};
struct VReg {
- uint8_t bytes[16];
+ llvm::AlignedCharArray<16, 16> bytes;
};
// mirrors <mach/arm/thread_status.h> arm_neon_state64_t
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index bd73a29e0871..5435a02433ab 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -1517,8 +1517,8 @@ RegisterContextLLDB::SavedLocationForRegister(
dwarfexpr.SetRegisterKind(unwindplan_registerkind);
Value result;
Status error;
- if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr,
- nullptr, result, &error)) {
+ if (dwarfexpr.Evaluate(&exe_ctx, this, 0, nullptr, nullptr, result,
+ &error)) {
addr_t val;
val = result.GetScalar().ULongLong();
if (unwindplan_regloc.IsDWARFExpression()) {
@@ -1827,8 +1827,8 @@ bool RegisterContextLLDB::ReadCFAValueForRow(
dwarfexpr.SetRegisterKind(row_register_kind);
Value result;
Status error;
- if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr,
- nullptr, result, &error)) {
+ if (dwarfexpr.Evaluate(&exe_ctx, this, 0, nullptr, nullptr, result,
+ &error)) {
cfa_value = result.GetScalar().ULongLong();
UnwindLogMsg("CFA value set by DWARF expression is 0x%" PRIx64,
diff --git a/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp b/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
index a4cf07710194..71d35bbd3938 100644
--- a/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
@@ -50,22 +50,30 @@ int RegisterContextMach_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) {
int RegisterContextMach_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
const GPR &gpr) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+ GPRWordCount);
}
int RegisterContextMach_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
const FPU &fpu) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+ FPUWordCount);
}
int RegisterContextMach_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
const EXC &exc) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+ EXCWordCount);
}
int RegisterContextMach_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
const DBG &dbg) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&dbg, DBGWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<DBG *>(&dbg)),
+ DBGWordCount);
}
#endif
diff --git a/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp b/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
index 959149edbc3e..5a260d5de1d5 100644
--- a/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
@@ -43,17 +43,23 @@ int RegisterContextMach_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
const GPR &gpr) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+ GPRWordCount);
}
int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
const FPU &fpu) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+ FPUWordCount);
}
int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
const EXC &exc) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+ EXCWordCount);
}
#endif
diff --git a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
index 522b73a2888e..0180879d51ee 100644
--- a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
@@ -46,17 +46,23 @@ int RegisterContextMach_x86_64::DoReadEXC(lldb::tid_t tid, int flavor,
int RegisterContextMach_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor,
const GPR &gpr) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+ GPRWordCount);
}
int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor,
const FPU &fpu) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+ FPUWordCount);
}
int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor,
const EXC &exc) {
- return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+ return ::thread_set_state(
+ tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+ EXCWordCount);
}
#endif
diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp
new file mode 100644
index 000000000000..de410f063b53
--- /dev/null
+++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp
@@ -0,0 +1,216 @@
+//===-- RegisterContextPOSIX_ppc64le.cpp -------------------------*- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstring>
+#include <errno.h>
+#include <stdint.h>
+
+#include "lldb/Core/RegisterValue.h"
+#include "lldb/Core/Scalar.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Endian.h"
+#include "llvm/Support/Compiler.h"
+
+#include "Plugins/Process/elf-core/ProcessElfCore.h"
+#include "RegisterContextPOSIX_ppc64le.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+static const uint32_t g_gpr_regnums[] = {
+ gpr_r0_ppc64le, gpr_r1_ppc64le, gpr_r2_ppc64le, gpr_r3_ppc64le,
+ gpr_r4_ppc64le, gpr_r5_ppc64le, gpr_r6_ppc64le, gpr_r7_ppc64le,
+ gpr_r8_ppc64le, gpr_r9_ppc64le, gpr_r10_ppc64le, gpr_r11_ppc64le,
+ gpr_r12_ppc64le, gpr_r13_ppc64le, gpr_r14_ppc64le, gpr_r15_ppc64le,
+ gpr_r16_ppc64le, gpr_r17_ppc64le, gpr_r18_ppc64le, gpr_r19_ppc64le,
+ gpr_r20_ppc64le, gpr_r21_ppc64le, gpr_r22_ppc64le, gpr_r23_ppc64le,
+ gpr_r24_ppc64le, gpr_r25_ppc64le, gpr_r26_ppc64le, gpr_r27_ppc64le,
+ gpr_r28_ppc64le, gpr_r29_ppc64le, gpr_r30_ppc64le, gpr_r31_ppc64le,
+ gpr_pc_ppc64le, gpr_msr_ppc64le, gpr_origr3_ppc64le, gpr_ctr_ppc64le,
+ gpr_lr_ppc64le, gpr_xer_ppc64le, gpr_cr_ppc64le, gpr_softe_ppc64le,
+ gpr_trap_ppc64le,
+};
+
+static const uint32_t g_fpr_regnums[] = {
+ fpr_f0_ppc64le, fpr_f1_ppc64le, fpr_f2_ppc64le, fpr_f3_ppc64le,
+ fpr_f4_ppc64le, fpr_f5_ppc64le, fpr_f6_ppc64le, fpr_f7_ppc64le,
+ fpr_f8_ppc64le, fpr_f9_ppc64le, fpr_f10_ppc64le, fpr_f11_ppc64le,
+ fpr_f12_ppc64le, fpr_f13_ppc64le, fpr_f14_ppc64le, fpr_f15_ppc64le,
+ fpr_f16_ppc64le, fpr_f17_ppc64le, fpr_f18_ppc64le, fpr_f19_ppc64le,
+ fpr_f20_ppc64le, fpr_f21_ppc64le, fpr_f22_ppc64le, fpr_f23_ppc64le,
+ fpr_f24_ppc64le, fpr_f25_ppc64le, fpr_f26_ppc64le, fpr_f27_ppc64le,
+ fpr_f28_ppc64le, fpr_f29_ppc64le, fpr_f30_ppc64le, fpr_f31_ppc64le,
+ fpr_fpscr_ppc64le,
+};
+
+static const uint32_t g_vmx_regnums[] = {
+ vmx_vr0_ppc64le, vmx_vr1_ppc64le, vmx_vr2_ppc64le, vmx_vr3_ppc64le,
+ vmx_vr4_ppc64le, vmx_vr5_ppc64le, vmx_vr6_ppc64le, vmx_vr7_ppc64le,
+ vmx_vr8_ppc64le, vmx_vr9_ppc64le, vmx_vr10_ppc64le, vmx_vr11_ppc64le,
+ vmx_vr12_ppc64le, vmx_vr13_ppc64le, vmx_vr14_ppc64le, vmx_vr15_ppc64le,
+ vmx_vr16_ppc64le, vmx_vr17_ppc64le, vmx_vr18_ppc64le, vmx_vr19_ppc64le,
+ vmx_vr20_ppc64le, vmx_vr21_ppc64le, vmx_vr22_ppc64le, vmx_vr23_ppc64le,
+ vmx_vr24_ppc64le, vmx_vr25_ppc64le, vmx_vr26_ppc64le, vmx_vr27_ppc64le,
+ vmx_vr28_ppc64le, vmx_vr29_ppc64le, vmx_vr30_ppc64le, vmx_vr31_ppc64le,
+ vmx_vscr_ppc64le, vmx_vrsave_ppc64le,
+};
+
+static const uint32_t g_vsx_regnums[] = {
+ vsx_vs0_ppc64le, vsx_vs1_ppc64le, vsx_vs2_ppc64le, vsx_vs3_ppc64le,
+ vsx_vs4_ppc64le, vsx_vs5_ppc64le, vsx_vs6_ppc64le, vsx_vs7_ppc64le,
+ vsx_vs8_ppc64le, vsx_vs9_ppc64le, vsx_vs10_ppc64le, vsx_vs11_ppc64le,
+ vsx_vs12_ppc64le, vsx_vs13_ppc64le, vsx_vs14_ppc64le, vsx_vs15_ppc64le,
+ vsx_vs16_ppc64le, vsx_vs17_ppc64le, vsx_vs18_ppc64le, vsx_vs19_ppc64le,
+ vsx_vs20_ppc64le, vsx_vs21_ppc64le, vsx_vs22_ppc64le, vsx_vs23_ppc64le,
+ vsx_vs24_ppc64le, vsx_vs25_ppc64le, vsx_vs26_ppc64le, vsx_vs27_ppc64le,
+ vsx_vs28_ppc64le, vsx_vs29_ppc64le, vsx_vs30_ppc64le, vsx_vs31_ppc64le,
+ vsx_vs32_ppc64le, vsx_vs33_ppc64le, vsx_vs34_ppc64le, vsx_vs35_ppc64le,
+ vsx_vs36_ppc64le, vsx_vs37_ppc64le, vsx_vs38_ppc64le, vsx_vs39_ppc64le,
+ vsx_vs40_ppc64le, vsx_vs41_ppc64le, vsx_vs42_ppc64le, vsx_vs43_ppc64le,
+ vsx_vs44_ppc64le, vsx_vs45_ppc64le, vsx_vs46_ppc64le, vsx_vs47_ppc64le,
+ vsx_vs48_ppc64le, vsx_vs49_ppc64le, vsx_vs50_ppc64le, vsx_vs51_ppc64le,
+ vsx_vs52_ppc64le, vsx_vs53_ppc64le, vsx_vs54_ppc64le, vsx_vs55_ppc64le,
+ vsx_vs56_ppc64le, vsx_vs57_ppc64le, vsx_vs58_ppc64le, vsx_vs59_ppc64le,
+ vsx_vs60_ppc64le, vsx_vs61_ppc64le, vsx_vs62_ppc64le, vsx_vs63_ppc64le,
+};
+
+// Number of register sets provided by this context.
+enum { k_num_register_sets = 4 };
+
+static const RegisterSet g_reg_sets_ppc64le[k_num_register_sets] = {
+ {"General Purpose Registers", "gpr", k_num_gpr_registers_ppc64le,
+ g_gpr_regnums},
+ {"Floating Point Registers", "fpr", k_num_fpr_registers_ppc64le,
+ g_fpr_regnums},
+ {"Altivec/VMX Registers", "vmx", k_num_vmx_registers_ppc64le,
+ g_vmx_regnums},
+ {"VSX Registers", "vsx", k_num_vsx_registers_ppc64le, g_vsx_regnums},
+};
+
+bool RegisterContextPOSIX_ppc64le::IsGPR(unsigned reg) {
+ return (reg <= k_last_gpr_ppc64le); // GPR's come first.
+}
+
+bool RegisterContextPOSIX_ppc64le::IsFPR(unsigned reg) {
+ return (reg >= k_first_fpr_ppc64le) && (reg <= k_last_fpr_ppc64le);
+}
+
+bool RegisterContextPOSIX_ppc64le::IsVMX(unsigned reg) {
+ return (reg >= k_first_vmx_ppc64le) && (reg <= k_last_vmx_ppc64le);
+}
+
+bool RegisterContextPOSIX_ppc64le::IsVSX(unsigned reg) {
+ return (reg >= k_first_vsx_ppc64le) && (reg <= k_last_vsx_ppc64le);
+}
+
+RegisterContextPOSIX_ppc64le::RegisterContextPOSIX_ppc64le(
+ Thread &thread, uint32_t concrete_frame_idx,
+ RegisterInfoInterface *register_info)
+ : RegisterContext(thread, concrete_frame_idx) {
+ m_register_info_ap.reset(register_info);
+
+ ProcessSP base = CalculateProcess();
+ if (base.get()->GetPluginName() == ProcessElfCore::GetPluginNameStatic())
+ return;
+}
+
+void RegisterContextPOSIX_ppc64le::InvalidateAllRegisters() {}
+
+unsigned RegisterContextPOSIX_ppc64le::GetRegisterOffset(unsigned reg) {
+ assert(reg < k_num_registers_ppc64le && "Invalid register number.");
+ return GetRegisterInfo()[reg].byte_offset;
+}
+
+unsigned RegisterContextPOSIX_ppc64le::GetRegisterSize(unsigned reg) {
+ assert(reg < k_num_registers_ppc64le && "Invalid register number.");
+ return GetRegisterInfo()[reg].byte_size;
+}
+
+size_t RegisterContextPOSIX_ppc64le::GetRegisterCount() {
+ size_t num_registers = k_num_registers_ppc64le;
+ return num_registers;
+}
+
+size_t RegisterContextPOSIX_ppc64le::GetGPRSize() {
+ return m_register_info_ap->GetGPRSize();
+}
+
+const RegisterInfo *RegisterContextPOSIX_ppc64le::GetRegisterInfo() {
+ // Commonly, this method is overridden and g_register_infos is copied and
+ // specialized.
+ // So, use GetRegisterInfo() rather than g_register_infos in this scope.
+ return m_register_info_ap->GetRegisterInfo();
+}
+
+const RegisterInfo *
+RegisterContextPOSIX_ppc64le::GetRegisterInfoAtIndex(size_t reg) {
+ if (reg < k_num_registers_ppc64le)
+ return &GetRegisterInfo()[reg];
+ else
+ return NULL;
+}
+
+size_t RegisterContextPOSIX_ppc64le::GetRegisterSetCount() {
+ size_t sets = 0;
+ for (size_t set = 0; set < k_num_register_sets; ++set) {
+ if (IsRegisterSetAvailable(set))
+ ++sets;
+ }
+
+ return sets;
+}
+
+const RegisterSet *RegisterContextPOSIX_ppc64le::GetRegisterSet(size_t set) {
+ if (IsRegisterSetAvailable(set))
+ return &g_reg_sets_ppc64le[set];
+ else
+ return NULL;
+}
+
+const char *RegisterContextPOSIX_ppc64le::GetRegisterName(unsigned reg) {
+ assert(reg < k_num_registers_ppc64le && "Invalid register offset.");
+ return GetRegisterInfo()[reg].name;
+}
+
+lldb::ByteOrder RegisterContextPOSIX_ppc64le::GetByteOrder() {
+ // Get the target process whose privileged thread was used for the register
+ // read.
+ lldb::ByteOrder byte_order = eByteOrderInvalid;
+ Process *process = CalculateProcess().get();
+
+ if (process)
+ byte_order = process->GetByteOrder();
+ return byte_order;
+}
+
+bool RegisterContextPOSIX_ppc64le::IsRegisterSetAvailable(size_t set_index) {
+ size_t num_sets = k_num_register_sets;
+
+ return (set_index < num_sets);
+}
+
+// Used when parsing DWARF and EH frame information and any other
+// object file sections that contain register numbers in them.
+uint32_t RegisterContextPOSIX_ppc64le::ConvertRegisterKindToRegisterNumber(
+ lldb::RegisterKind kind, uint32_t num) {
+ const uint32_t num_regs = GetRegisterCount();
+
+ assert(kind < kNumRegisterKinds);
+ for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
+ const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx);
+
+ if (reg_info->kinds[kind] == num)
+ return reg_idx;
+ }
+
+ return LLDB_INVALID_REGNUM;
+}
diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h
new file mode 100644
index 000000000000..1070b4dea405
--- /dev/null
+++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h
@@ -0,0 +1,82 @@
+//===-- RegisterContextPOSIX_ppc64le.h --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContextPOSIX_ppc64le_h_
+#define liblldb_RegisterContextPOSIX_ppc64le_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h"
+#include "RegisterInfoInterface.h"
+#include "Utility/PPC64LE_DWARF_Registers.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Utility/Log.h"
+
+class RegisterContextPOSIX_ppc64le : public lldb_private::RegisterContext {
+public:
+ RegisterContextPOSIX_ppc64le(
+ lldb_private::Thread &thread, uint32_t concrete_frame_idx,
+ lldb_private::RegisterInfoInterface *register_info);
+
+ void InvalidateAllRegisters() override;
+
+ size_t GetRegisterCount() override;
+
+ virtual size_t GetGPRSize();
+
+ virtual unsigned GetRegisterSize(unsigned reg);
+
+ virtual unsigned GetRegisterOffset(unsigned reg);
+
+ const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
+
+ size_t GetRegisterSetCount() override;
+
+ const lldb_private::RegisterSet *GetRegisterSet(size_t set) override;
+
+ const char *GetRegisterName(unsigned reg);
+
+ uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
+ uint32_t num) override;
+
+protected:
+ // 64-bit general purpose registers.
+ uint64_t m_gpr_ppc64le[k_num_gpr_registers_ppc64le];
+
+ // floating-point registers including extended register.
+ uint64_t m_fpr_ppc64le[k_num_fpr_registers_ppc64le];
+
+ // VMX registers.
+ uint64_t m_vmx_ppc64le[k_num_vmx_registers_ppc64le * 2];
+
+ // VSX registers.
+ uint64_t m_vsx_ppc64le[k_num_vsx_registers_ppc64le * 2];
+
+ std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap;
+
+ // Determines if an extended register set is supported on the processor
+ // running the inferior process.
+ virtual bool IsRegisterSetAvailable(size_t set_index);
+
+ virtual const lldb_private::RegisterInfo *GetRegisterInfo();
+
+ bool IsGPR(unsigned reg);
+
+ bool IsFPR(unsigned reg);
+
+ bool IsVMX(unsigned reg);
+
+ bool IsVSX(unsigned reg);
+
+ lldb::ByteOrder GetByteOrder();
+};
+
+#endif // liblldb_RegisterContextPOSIX_ppc64le_h_
diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
index 5e1bf35356b8..41cec8add987 100644
--- a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
@@ -365,12 +365,6 @@ RegisterContextPOSIX_x86::RegisterContextPOSIX_x86(
break;
}
- // Initialize m_iovec to point to the buffer and buffer size
- // using the conventions of Berkeley style UIO structures, as required
- // by PTRACE extensions.
- m_iovec.iov_base = &m_fpr.xstate.xsave;
- m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
-
::memset(&m_fpr, 0, sizeof(FPR));
m_fpr_type = eNotValid;
@@ -481,19 +475,19 @@ bool RegisterContextPOSIX_x86::CopyYMMtoXSTATE(uint32_t reg,
return false;
if (byte_order == eByteOrderLittle) {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
sizeof(YMMHReg));
return true;
}
if (byte_order == eByteOrderBig) {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(YMMHReg));
return true;
}
@@ -508,20 +502,20 @@ bool RegisterContextPOSIX_x86::CopyXSTATEtoYMM(uint32_t reg,
if (byte_order == eByteOrderLittle) {
::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
sizeof(XMMReg));
::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
sizeof(YMMHReg));
return true;
}
if (byte_order == eByteOrderBig) {
::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
+ m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
sizeof(XMMReg));
::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
+ m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
sizeof(YMMHReg));
return true;
}
diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
index aa689273f218..ca71a6f272f8 100644
--- a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
+++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
@@ -149,9 +149,9 @@ protected:
RegInfo m_reg_info;
FPRType
m_fpr_type; // determines the type of data stored by union FPR, if any.
- FPR m_fpr; // floating-point registers including extended register sets.
- IOVEC m_iovec; // wrapper for xsave.
- YMM m_ymm_set; // copy of ymmh and xmm register halves.
+ lldb_private::FPR m_fpr; // floating-point registers including extended
+ // register sets.
+ lldb_private::YMM m_ymm_set; // copy of ymmh and xmm register halves.
std::unique_ptr<lldb_private::RegisterInfoInterface>
m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
diff --git a/source/Plugins/Process/Utility/RegisterContext_mips.h b/source/Plugins/Process/Utility/RegisterContext_mips.h
index 565747cb4bd7..da470bd82732 100644
--- a/source/Plugins/Process/Utility/RegisterContext_mips.h
+++ b/source/Plugins/Process/Utility/RegisterContext_mips.h
@@ -241,11 +241,6 @@ enum {
dwarf_config5_mips64,
};
-struct IOVEC_mips {
- void *iov_base;
- size_t iov_len;
-};
-
// GP registers
struct GPR_linux_mips {
uint64_t zero;
diff --git a/source/Plugins/Process/Utility/RegisterContext_x86.h b/source/Plugins/Process/Utility/RegisterContext_x86.h
index 5f6fc295a15c..6146dcaf7e5a 100644
--- a/source/Plugins/Process/Utility/RegisterContext_x86.h
+++ b/source/Plugins/Process/Utility/RegisterContext_x86.h
@@ -13,8 +13,10 @@
#include <cstddef>
#include <cstdint>
+#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/Support/Compiler.h"
+namespace lldb_private {
//---------------------------------------------------------------------------
// i386 ehframe, dwarf regnums
//---------------------------------------------------------------------------
@@ -313,13 +315,28 @@ struct MPX {
LLVM_PACKED_START
struct XSAVE_HDR {
- uint64_t xstate_bv; // OS enabled xstate mask to determine the extended states
+ enum class XFeature : uint64_t {
+ FP = 1,
+ SSE = FP << 1,
+ YMM = SSE << 1,
+ BNDREGS = YMM << 1,
+ BNDCSR = BNDREGS << 1,
+ OPMASK = BNDCSR << 1,
+ ZMM_Hi256 = OPMASK << 1,
+ Hi16_ZMM = ZMM_Hi256 << 1,
+ PT = Hi16_ZMM << 1,
+ PKRU = PT << 1,
+ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue*/ PKRU)
+ };
+
+ XFeature xstate_bv; // OS enabled xstate mask to determine the extended states
// supported by the processor
- uint64_t xcomp_bv; // Mask to indicate the format of the XSAVE area and of
+ XFeature xcomp_bv; // Mask to indicate the format of the XSAVE area and of
// the XRSTOR instruction
uint64_t reserved1[1];
uint64_t reserved2[5];
};
+static_assert(sizeof(XSAVE_HDR) == 64, "XSAVE_HDR layout incorrect");
LLVM_PACKED_END
// x86 extensions to FXSAVE (i.e. for AVX and MPX processors)
@@ -338,21 +355,13 @@ struct LLVM_ALIGNAS(64) XSAVE {
LLVM_PACKED_END
// Floating-point registers
-struct FPR {
- // Thread state for the floating-point unit of the processor read by ptrace.
- union XSTATE {
- FXSAVE fxsave; // Generic floating-point registers.
- XSAVE xsave; // x86 extended processor state.
- } xstate;
+union FPR {
+ FXSAVE fxsave; // Generic floating-point registers.
+ XSAVE xsave; // x86 extended processor state.
};
-//---------------------------------------------------------------------------
-// ptrace PTRACE_GETREGSET, PTRACE_SETREGSET structure
-//---------------------------------------------------------------------------
+LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
-struct IOVEC {
- void *iov_base; // pointer to XSAVE
- size_t iov_len; // sizeof(XSAVE)
-};
+} // namespace lldb_private
#endif
diff --git a/source/Plugins/Process/Utility/RegisterInfoInterface.h b/source/Plugins/Process/Utility/RegisterInfoInterface.h
index 74d5d6e50208..1894b5368122 100644
--- a/source/Plugins/Process/Utility/RegisterInfoInterface.h
+++ b/source/Plugins/Process/Utility/RegisterInfoInterface.h
@@ -10,10 +10,9 @@
#ifndef lldb_RegisterInfoInterface_h
#define lldb_RegisterInfoInterface_h
-#include <vector>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/lldb-private-types.h"
+#include <vector>
namespace lldb_private {
diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
new file mode 100644
index 000000000000..e5e7350fe68a
--- /dev/null
+++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
@@ -0,0 +1,66 @@
+//===-- RegisterInfoPOSIX_ppc64le.cpp --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------===//
+
+#include <cassert>
+#include <stddef.h>
+#include <vector>
+
+#include "lldb/lldb-defines.h"
+#include "llvm/Support/Compiler.h"
+
+#include "RegisterInfoPOSIX_ppc64le.h"
+
+//-----------------------------------------------------------------------------
+// Include RegisterInfoPOSIX_ppc64le to declare our g_register_infos_ppc64le
+//-----------------------------------------------------------------------------
+#define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+#include "RegisterInfos_ppc64le.h"
+#undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+
+static const lldb_private::RegisterInfo *
+GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
+ switch (target_arch.GetMachine()) {
+ case llvm::Triple::ppc64le:
+ return g_register_infos_ppc64le;
+ default:
+ assert(false && "Unhandled target architecture.");
+ return NULL;
+ }
+}
+
+static uint32_t
+GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
+ switch (target_arch.GetMachine()) {
+ case llvm::Triple::ppc64le:
+ return static_cast<uint32_t>(sizeof(g_register_infos_ppc64le) /
+ sizeof(g_register_infos_ppc64le[0]));
+ default:
+ assert(false && "Unhandled target architecture.");
+ return 0;
+ }
+}
+
+RegisterInfoPOSIX_ppc64le::RegisterInfoPOSIX_ppc64le(
+ const lldb_private::ArchSpec &target_arch)
+ : lldb_private::RegisterInfoInterface(target_arch),
+ m_register_info_p(GetRegisterInfoPtr(target_arch)),
+ m_register_info_count(GetRegisterInfoCount(target_arch)) {}
+
+size_t RegisterInfoPOSIX_ppc64le::GetGPRSize() const {
+ return sizeof(GPR);
+}
+
+const lldb_private::RegisterInfo *
+RegisterInfoPOSIX_ppc64le::GetRegisterInfo() const {
+ return m_register_info_p;
+}
+
+uint32_t RegisterInfoPOSIX_ppc64le::GetRegisterCount() const {
+ return m_register_info_count;
+}
diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h
new file mode 100644
index 000000000000..411ab05c2b13
--- /dev/null
+++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h
@@ -0,0 +1,32 @@
+//===-- RegisterInfoPOSIX_ppc64le.h -----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContextLinux_ppc64le_H_
+#define liblldb_RegisterContextLinux_ppc64le_H_
+
+#include "RegisterInfoInterface.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/lldb-private.h"
+
+class RegisterInfoPOSIX_ppc64le : public lldb_private::RegisterInfoInterface {
+public:
+ RegisterInfoPOSIX_ppc64le(const lldb_private::ArchSpec &target_arch);
+
+ size_t GetGPRSize() const override;
+
+ const lldb_private::RegisterInfo *GetRegisterInfo() const override;
+
+ uint32_t GetRegisterCount() const override;
+
+private:
+ const lldb_private::RegisterInfo *m_register_info_p;
+ uint32_t m_register_info_count;
+};
+
+#endif
diff --git a/source/Plugins/Process/Utility/RegisterInfos_i386.h b/source/Plugins/Process/Utility/RegisterInfos_i386.h
index 8597d0c39dc4..ffdc4d0d116b 100644
--- a/source/Plugins/Process/Utility/RegisterInfos_i386.h
+++ b/source/Plugins/Process/Utility/RegisterInfos_i386.h
@@ -27,19 +27,19 @@
// Based on DNBArchImplI386.cpp from debugserver
#define YMM_OFFSET(reg_index) \
(LLVM_EXTENSION offsetof(UserArea, i387) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
+ LLVM_EXTENSION offsetof(FPR, fxsave) + \
LLVM_EXTENSION offsetof(FXSAVE, xmm[7]) + sizeof(XMMReg) + \
(32 * reg_index))
-#define BNDR_OFFSET(reg_index) \
- (LLVM_EXTENSION offsetof(UserArea, i387) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
+#define BNDR_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(UserArea, i387) + \
+ LLVM_EXTENSION offsetof(FPR, xsave) + \
+ LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
-#define BNDC_OFFSET(reg_index) \
- (LLVM_EXTENSION offsetof(UserArea, i387) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
+#define BNDC_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(UserArea, i387) + \
+ LLVM_EXTENSION offsetof(FPR, xsave) + \
+ LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
// Number of bytes needed to represent a FPR.
#if !defined(FPR_SIZE)
diff --git a/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h b/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h
new file mode 100644
index 000000000000..bffa7a1d8b63
--- /dev/null
+++ b/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h
@@ -0,0 +1,476 @@
+//===-- RegisterInfos_ppc64le.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
+
+// C Includes
+#include <stddef.h>
+
+// Computes the offset of the given GPR in the user data area.
+#define GPR_OFFSET(regname) (offsetof(GPR, regname))
+#define FPR_OFFSET(regname) (offsetof(FPR, regname) + sizeof(GPR))
+#define VMX_OFFSET(regname) (offsetof(VMX, regname) + sizeof(GPR) + sizeof(FPR))
+#define VSX_OFFSET(regname) \
+ (offsetof(VSX, regname) + sizeof(GPR) + sizeof(FPR) + sizeof(VMX))
+#define GPR_SIZE(regname) (sizeof(((GPR *)NULL)->regname))
+
+#include "Utility/PPC64LE_DWARF_Registers.h"
+#include "lldb-ppc64le-register-enums.h"
+
+// Note that the size and offset will be updated by platform-specific classes.
+#define DEFINE_GPR(reg, alt, lldb_kind) \
+ { \
+ #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), lldb::eEncodingUint, \
+ lldb::eFormatHex, \
+ {ppc64le_dwarf::dwarf_##reg##_ppc64le,\
+ ppc64le_dwarf::dwarf_##reg##_ppc64le,\
+ lldb_kind, \
+ LLDB_INVALID_REGNUM, \
+ gpr_##reg##_ppc64le }, \
+ NULL, NULL, NULL, 0 \
+ }
+#define DEFINE_FPR(reg, alt, lldb_kind) \
+ { \
+#reg, alt, 8, FPR_OFFSET(reg), lldb::eEncodingIEEE754, lldb::eFormatFloat, \
+ {ppc64le_dwarf::dwarf_##reg##_ppc64le, \
+ ppc64le_dwarf::dwarf_##reg##_ppc64le, lldb_kind, LLDB_INVALID_REGNUM, \
+ fpr_##reg##_ppc64le }, \
+ NULL, NULL, NULL, 0 \
+ }
+#define DEFINE_VMX(reg, lldb_kind) \
+ { \
+#reg, NULL, 16, VMX_OFFSET(reg), lldb::eEncodingVector, \
+ lldb::eFormatVectorOfUInt32, \
+ {ppc64le_dwarf::dwarf_##reg##_ppc64le, \
+ ppc64le_dwarf::dwarf_##reg##_ppc64le, lldb_kind, LLDB_INVALID_REGNUM, \
+ vmx_##reg##_ppc64le }, \
+ NULL, NULL, NULL, 0 \
+ }
+#define DEFINE_VSX(reg, lldb_kind) \
+ { \
+#reg, NULL, 16, VSX_OFFSET(reg), lldb::eEncodingVector, \
+ lldb::eFormatVectorOfUInt32, \
+ {ppc64le_dwarf::dwarf_##reg##_ppc64le, \
+ ppc64le_dwarf::dwarf_##reg##_ppc64le, lldb_kind, LLDB_INVALID_REGNUM, \
+ vsx_##reg##_ppc64le }, \
+ NULL, NULL, NULL, 0 \
+ }
+
+// General purpose registers.
+// EH_Frame, Generic, Process Plugin
+#define POWERPC_REGS \
+ DEFINE_GPR(r0, NULL, LLDB_INVALID_REGNUM) \
+ , DEFINE_GPR(r1, "sp", LLDB_REGNUM_GENERIC_SP), \
+ DEFINE_GPR(r2, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r3, "arg1", LLDB_REGNUM_GENERIC_ARG1), \
+ DEFINE_GPR(r4, "arg2", LLDB_REGNUM_GENERIC_ARG2), \
+ DEFINE_GPR(r5, "arg3", LLDB_REGNUM_GENERIC_ARG3), \
+ DEFINE_GPR(r6, "arg4", LLDB_REGNUM_GENERIC_ARG4), \
+ DEFINE_GPR(r7, "arg5", LLDB_REGNUM_GENERIC_ARG5), \
+ DEFINE_GPR(r8, "arg6", LLDB_REGNUM_GENERIC_ARG6), \
+ DEFINE_GPR(r9, "arg7", LLDB_REGNUM_GENERIC_ARG7), \
+ DEFINE_GPR(r10, "arg8", LLDB_REGNUM_GENERIC_ARG8), \
+ DEFINE_GPR(r11, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r12, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r13, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r14, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r15, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r16, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r17, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r18, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r19, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r20, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r21, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r22, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r23, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r24, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r25, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r26, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r27, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r28, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r29, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r30, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(r31, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(pc, "pc", LLDB_REGNUM_GENERIC_PC), \
+ DEFINE_GPR(msr, "msr", LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(origr3, "orig_r3", LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(ctr, "ctr", LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(lr, "lr", LLDB_REGNUM_GENERIC_RA), \
+ DEFINE_GPR(xer, "xer", LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(cr, "cr", LLDB_REGNUM_GENERIC_FLAGS), \
+ DEFINE_GPR(softe, "softe", LLDB_INVALID_REGNUM), \
+ DEFINE_GPR(trap, "trap", LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f0, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f1, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f2, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f3, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f4, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f5, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f6, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f7, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f8, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f9, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f10, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f11, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f12, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f13, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f14, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f15, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f16, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f17, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f18, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f19, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f20, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f21, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f22, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f23, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f24, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f25, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f26, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f27, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f28, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f29, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f30, NULL, LLDB_INVALID_REGNUM), \
+ DEFINE_FPR(f31, NULL, LLDB_INVALID_REGNUM), \
+ {"fpscr", \
+ NULL, \
+ 8, \
+ FPR_OFFSET(fpscr), \
+ lldb::eEncodingUint, \
+ lldb::eFormatHex, \
+ {ppc64le_dwarf::dwarf_fpscr_ppc64le, \
+ ppc64le_dwarf::dwarf_fpscr_ppc64le, LLDB_INVALID_REGNUM, \
+ LLDB_INVALID_REGNUM, fpr_fpscr_ppc64le}, \
+ NULL, \
+ NULL, \
+ NULL, \
+ 0}, \
+ DEFINE_VMX(vr0, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr1, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr2, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr3, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr4, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr5, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr6, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr7, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr8, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr9, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr10, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr11, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr12, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr13, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr14, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr15, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr16, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr17, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr18, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr19, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr20, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr21, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr22, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr23, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr24, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr25, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr26, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr27, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr28, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr29, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr30, LLDB_INVALID_REGNUM), \
+ DEFINE_VMX(vr31, LLDB_INVALID_REGNUM), \
+ {"vscr", \
+ NULL, \
+ 4, \
+ VMX_OFFSET(vscr), \
+ lldb::eEncodingUint, \
+ lldb::eFormatHex, \
+ {ppc64le_dwarf::dwarf_vscr_ppc64le, ppc64le_dwarf::dwarf_vscr_ppc64le, \
+ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, vmx_vscr_ppc64le}, \
+ NULL, \
+ NULL, \
+ NULL, \
+ 0}, \
+ {"vrsave", \
+ NULL, \
+ 4, \
+ VMX_OFFSET(vrsave), \
+ lldb::eEncodingUint, \
+ lldb::eFormatHex, \
+ {ppc64le_dwarf::dwarf_vrsave_ppc64le, \
+ ppc64le_dwarf::dwarf_vrsave_ppc64le, LLDB_INVALID_REGNUM, \
+ LLDB_INVALID_REGNUM, vmx_vrsave_ppc64le}, \
+ NULL, \
+ NULL, \
+ NULL, \
+ 0}, \
+ DEFINE_VSX(vs0, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs1, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs2, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs3, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs4, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs5, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs6, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs7, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs8, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs9, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs10, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs11, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs12, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs13, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs14, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs15, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs16, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs17, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs18, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs19, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs20, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs21, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs22, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs23, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs24, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs25, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs26, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs27, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs28, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs29, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs30, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs31, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs32, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs33, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs34, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs35, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs36, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs37, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs38, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs39, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs40, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs41, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs42, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs43, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs44, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs45, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs46, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs47, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs48, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs49, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs50, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs51, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs52, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs53, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs54, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs55, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs56, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs57, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs58, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs59, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs50, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs61, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs62, LLDB_INVALID_REGNUM), \
+ DEFINE_VSX(vs63, LLDB_INVALID_REGNUM), /* */
+
+typedef struct _GPR {
+ uint64_t r0;
+ uint64_t r1;
+ uint64_t r2;
+ uint64_t r3;
+ uint64_t r4;
+ uint64_t r5;
+ uint64_t r6;
+ uint64_t r7;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t r10;
+ uint64_t r11;
+ uint64_t r12;
+ uint64_t r13;
+ uint64_t r14;
+ uint64_t r15;
+ uint64_t r16;
+ uint64_t r17;
+ uint64_t r18;
+ uint64_t r19;
+ uint64_t r20;
+ uint64_t r21;
+ uint64_t r22;
+ uint64_t r23;
+ uint64_t r24;
+ uint64_t r25;
+ uint64_t r26;
+ uint64_t r27;
+ uint64_t r28;
+ uint64_t r29;
+ uint64_t r30;
+ uint64_t r31;
+ uint64_t pc;
+ uint64_t msr;
+ uint64_t origr3;
+ uint64_t ctr;
+ uint64_t lr;
+ uint64_t xer;
+ uint64_t cr;
+ uint64_t softe;
+ uint64_t trap;
+ uint64_t pad[3];
+} GPR;
+
+typedef struct _FPR {
+ uint64_t f0;
+ uint64_t f1;
+ uint64_t f2;
+ uint64_t f3;
+ uint64_t f4;
+ uint64_t f5;
+ uint64_t f6;
+ uint64_t f7;
+ uint64_t f8;
+ uint64_t f9;
+ uint64_t f10;
+ uint64_t f11;
+ uint64_t f12;
+ uint64_t f13;
+ uint64_t f14;
+ uint64_t f15;
+ uint64_t f16;
+ uint64_t f17;
+ uint64_t f18;
+ uint64_t f19;
+ uint64_t f20;
+ uint64_t f21;
+ uint64_t f22;
+ uint64_t f23;
+ uint64_t f24;
+ uint64_t f25;
+ uint64_t f26;
+ uint64_t f27;
+ uint64_t f28;
+ uint64_t f29;
+ uint64_t f30;
+ uint64_t f31;
+ uint64_t fpscr;
+} FPR;
+
+typedef struct _VMX {
+ uint32_t vr0[4];
+ uint32_t vr1[4];
+ uint32_t vr2[4];
+ uint32_t vr3[4];
+ uint32_t vr4[4];
+ uint32_t vr5[4];
+ uint32_t vr6[4];
+ uint32_t vr7[4];
+ uint32_t vr8[4];
+ uint32_t vr9[4];
+ uint32_t vr10[4];
+ uint32_t vr11[4];
+ uint32_t vr12[4];
+ uint32_t vr13[4];
+ uint32_t vr14[4];
+ uint32_t vr15[4];
+ uint32_t vr16[4];
+ uint32_t vr17[4];
+ uint32_t vr18[4];
+ uint32_t vr19[4];
+ uint32_t vr20[4];
+ uint32_t vr21[4];
+ uint32_t vr22[4];
+ uint32_t vr23[4];
+ uint32_t vr24[4];
+ uint32_t vr25[4];
+ uint32_t vr26[4];
+ uint32_t vr27[4];
+ uint32_t vr28[4];
+ uint32_t vr29[4];
+ uint32_t vr30[4];
+ uint32_t vr31[4];
+ uint32_t pad[2];
+ uint32_t vscr[2];
+ uint32_t vrsave;
+} VMX;
+
+typedef struct _VSX {
+ uint32_t vs0[4];
+ uint32_t vs1[4];
+ uint32_t vs2[4];
+ uint32_t vs3[4];
+ uint32_t vs4[4];
+ uint32_t vs5[4];
+ uint32_t vs6[4];
+ uint32_t vs7[4];
+ uint32_t vs8[4];
+ uint32_t vs9[4];
+ uint32_t vs10[4];
+ uint32_t vs11[4];
+ uint32_t vs12[4];
+ uint32_t vs13[4];
+ uint32_t vs14[4];
+ uint32_t vs15[4];
+ uint32_t vs16[4];
+ uint32_t vs17[4];
+ uint32_t vs18[4];
+ uint32_t vs19[4];
+ uint32_t vs20[4];
+ uint32_t vs21[4];
+ uint32_t vs22[4];
+ uint32_t vs23[4];
+ uint32_t vs24[4];
+ uint32_t vs25[4];
+ uint32_t vs26[4];
+ uint32_t vs27[4];
+ uint32_t vs28[4];
+ uint32_t vs29[4];
+ uint32_t vs30[4];
+ uint32_t vs31[4];
+ uint32_t vs32[4];
+ uint32_t vs33[4];
+ uint32_t vs34[4];
+ uint32_t vs35[4];
+ uint32_t vs36[4];
+ uint32_t vs37[4];
+ uint32_t vs38[4];
+ uint32_t vs39[4];
+ uint32_t vs40[4];
+ uint32_t vs41[4];
+ uint32_t vs42[4];
+ uint32_t vs43[4];
+ uint32_t vs44[4];
+ uint32_t vs45[4];
+ uint32_t vs46[4];
+ uint32_t vs47[4];
+ uint32_t vs48[4];
+ uint32_t vs49[4];
+ uint32_t vs50[4];
+ uint32_t vs51[4];
+ uint32_t vs52[4];
+ uint32_t vs53[4];
+ uint32_t vs54[4];
+ uint32_t vs55[4];
+ uint32_t vs56[4];
+ uint32_t vs57[4];
+ uint32_t vs58[4];
+ uint32_t vs59[4];
+ uint32_t vs60[4];
+ uint32_t vs61[4];
+ uint32_t vs62[4];
+ uint32_t vs63[4];
+} VSX;
+
+static lldb_private::RegisterInfo g_register_infos_ppc64le[] = {
+ POWERPC_REGS
+};
+
+static_assert((sizeof(g_register_infos_ppc64le) /
+ sizeof(g_register_infos_ppc64le[0])) ==
+ k_num_registers_ppc64le,
+ "g_register_infos_powerpc64 has wrong number of register infos");
+
+#undef DEFINE_FPR
+#undef DEFINE_GPR
+#undef DEFINE_VMX
+#undef DEFINE_VSX
+
+#endif // DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
diff --git a/source/Plugins/Process/Utility/RegisterInfos_x86_64.h b/source/Plugins/Process/Utility/RegisterInfos_x86_64.h
index 8861ecd66806..651536cb6045 100644
--- a/source/Plugins/Process/Utility/RegisterInfos_x86_64.h
+++ b/source/Plugins/Process/Utility/RegisterInfos_x86_64.h
@@ -7,11 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/Compiler.h"
-#include <cstddef>
-#include <cstdint>
-
-// Project includes
+// This file is meant to be textually included. Do not #include modular
+// headers here.
// Computes the offset of the given GPR in the user data area.
#define GPR_OFFSET(regname) (LLVM_EXTENSION offsetof(GPR, regname))
@@ -19,25 +16,25 @@
// Computes the offset of the given FPR in the extended data area.
#define FPR_OFFSET(regname) \
(LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
+ LLVM_EXTENSION offsetof(FPR, fxsave) + \
LLVM_EXTENSION offsetof(FXSAVE, regname))
// Computes the offset of the YMM register assembled from register halves.
// Based on DNBArchImplX86_64.cpp from debugserver
#define YMM_OFFSET(reg_index) \
(LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
+ LLVM_EXTENSION offsetof(FPR, xsave) + \
LLVM_EXTENSION offsetof(XSAVE, ymmh[0]) + (32 * reg_index))
-#define BNDR_OFFSET(reg_index) \
- (LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
+#define BNDR_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(UserArea, fpr) + \
+ LLVM_EXTENSION offsetof(FPR, xsave) + \
+ LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
-#define BNDC_OFFSET(reg_index) \
- (LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
+#define BNDC_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(UserArea, fpr) + \
+ LLVM_EXTENSION offsetof(FPR, xsave) + \
+ LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
#ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT
diff --git a/source/Plugins/Process/Utility/StopInfoMachException.cpp b/source/Plugins/Process/Utility/StopInfoMachException.cpp
index 435f3d18c062..3e860874183c 100644
--- a/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ b/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -14,7 +14,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/ExecutionContext.h"
diff --git a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
index f907735d8f58..d831011cb661 100644
--- a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
+++ b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
@@ -7,11 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
@@ -19,6 +14,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
#include "RegisterContextMacOSXFrameBackchain.h"
@@ -85,8 +81,6 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386(
if (process == NULL)
return 0;
- std::pair<lldb::addr_t, lldb::addr_t> fp_pc_pair;
-
struct Frame_i386 {
uint32_t fp;
uint32_t pc;
@@ -179,8 +173,6 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64(
StackFrame *first_frame = exe_ctx.GetFramePtr();
- std::pair<lldb::addr_t, lldb::addr_t> fp_pc_pair;
-
struct Frame_x86_64 {
uint64_t fp;
uint64_t pc;
diff --git a/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h b/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h
new file mode 100644
index 000000000000..675804d13268
--- /dev/null
+++ b/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h
@@ -0,0 +1,210 @@
+//===-- lldb-ppc64le-register-enums.h ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_ppc64le_register_enums_h
+#define lldb_ppc64le_register_enums_h
+
+// LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB)
+
+// ---------------------------------------------------------------------------
+// Internal codes for all ppc64le registers.
+// ---------------------------------------------------------------------------
+enum {
+ k_first_gpr_ppc64le,
+ gpr_r0_ppc64le = k_first_gpr_ppc64le,
+ gpr_r1_ppc64le,
+ gpr_r2_ppc64le,
+ gpr_r3_ppc64le,
+ gpr_r4_ppc64le,
+ gpr_r5_ppc64le,
+ gpr_r6_ppc64le,
+ gpr_r7_ppc64le,
+ gpr_r8_ppc64le,
+ gpr_r9_ppc64le,
+ gpr_r10_ppc64le,
+ gpr_r11_ppc64le,
+ gpr_r12_ppc64le,
+ gpr_r13_ppc64le,
+ gpr_r14_ppc64le,
+ gpr_r15_ppc64le,
+ gpr_r16_ppc64le,
+ gpr_r17_ppc64le,
+ gpr_r18_ppc64le,
+ gpr_r19_ppc64le,
+ gpr_r20_ppc64le,
+ gpr_r21_ppc64le,
+ gpr_r22_ppc64le,
+ gpr_r23_ppc64le,
+ gpr_r24_ppc64le,
+ gpr_r25_ppc64le,
+ gpr_r26_ppc64le,
+ gpr_r27_ppc64le,
+ gpr_r28_ppc64le,
+ gpr_r29_ppc64le,
+ gpr_r30_ppc64le,
+ gpr_r31_ppc64le,
+ gpr_pc_ppc64le,
+ gpr_msr_ppc64le,
+ gpr_origr3_ppc64le,
+ gpr_ctr_ppc64le,
+ gpr_lr_ppc64le,
+ gpr_xer_ppc64le,
+ gpr_cr_ppc64le,
+ gpr_softe_ppc64le,
+ gpr_trap_ppc64le,
+ k_last_gpr_ppc64le = gpr_trap_ppc64le,
+
+ k_first_fpr_ppc64le,
+ fpr_f0_ppc64le = k_first_fpr_ppc64le,
+ fpr_f1_ppc64le,
+ fpr_f2_ppc64le,
+ fpr_f3_ppc64le,
+ fpr_f4_ppc64le,
+ fpr_f5_ppc64le,
+ fpr_f6_ppc64le,
+ fpr_f7_ppc64le,
+ fpr_f8_ppc64le,
+ fpr_f9_ppc64le,
+ fpr_f10_ppc64le,
+ fpr_f11_ppc64le,
+ fpr_f12_ppc64le,
+ fpr_f13_ppc64le,
+ fpr_f14_ppc64le,
+ fpr_f15_ppc64le,
+ fpr_f16_ppc64le,
+ fpr_f17_ppc64le,
+ fpr_f18_ppc64le,
+ fpr_f19_ppc64le,
+ fpr_f20_ppc64le,
+ fpr_f21_ppc64le,
+ fpr_f22_ppc64le,
+ fpr_f23_ppc64le,
+ fpr_f24_ppc64le,
+ fpr_f25_ppc64le,
+ fpr_f26_ppc64le,
+ fpr_f27_ppc64le,
+ fpr_f28_ppc64le,
+ fpr_f29_ppc64le,
+ fpr_f30_ppc64le,
+ fpr_f31_ppc64le,
+ fpr_fpscr_ppc64le,
+ k_last_fpr_ppc64le = fpr_fpscr_ppc64le,
+
+ k_first_vmx_ppc64le,
+ vmx_vr0_ppc64le = k_first_vmx_ppc64le,
+ vmx_vr1_ppc64le,
+ vmx_vr2_ppc64le,
+ vmx_vr3_ppc64le,
+ vmx_vr4_ppc64le,
+ vmx_vr5_ppc64le,
+ vmx_vr6_ppc64le,
+ vmx_vr7_ppc64le,
+ vmx_vr8_ppc64le,
+ vmx_vr9_ppc64le,
+ vmx_vr10_ppc64le,
+ vmx_vr11_ppc64le,
+ vmx_vr12_ppc64le,
+ vmx_vr13_ppc64le,
+ vmx_vr14_ppc64le,
+ vmx_vr15_ppc64le,
+ vmx_vr16_ppc64le,
+ vmx_vr17_ppc64le,
+ vmx_vr18_ppc64le,
+ vmx_vr19_ppc64le,
+ vmx_vr20_ppc64le,
+ vmx_vr21_ppc64le,
+ vmx_vr22_ppc64le,
+ vmx_vr23_ppc64le,
+ vmx_vr24_ppc64le,
+ vmx_vr25_ppc64le,
+ vmx_vr26_ppc64le,
+ vmx_vr27_ppc64le,
+ vmx_vr28_ppc64le,
+ vmx_vr29_ppc64le,
+ vmx_vr30_ppc64le,
+ vmx_vr31_ppc64le,
+ vmx_vscr_ppc64le,
+ vmx_vrsave_ppc64le,
+ k_last_vmx_ppc64le = vmx_vrsave_ppc64le,
+
+ k_first_vsx_ppc64le,
+ vsx_vs0_ppc64le = k_first_vsx_ppc64le,
+ vsx_vs1_ppc64le,
+ vsx_vs2_ppc64le,
+ vsx_vs3_ppc64le,
+ vsx_vs4_ppc64le,
+ vsx_vs5_ppc64le,
+ vsx_vs6_ppc64le,
+ vsx_vs7_ppc64le,
+ vsx_vs8_ppc64le,
+ vsx_vs9_ppc64le,
+ vsx_vs10_ppc64le,
+ vsx_vs11_ppc64le,
+ vsx_vs12_ppc64le,
+ vsx_vs13_ppc64le,
+ vsx_vs14_ppc64le,
+ vsx_vs15_ppc64le,
+ vsx_vs16_ppc64le,
+ vsx_vs17_ppc64le,
+ vsx_vs18_ppc64le,
+ vsx_vs19_ppc64le,
+ vsx_vs20_ppc64le,
+ vsx_vs21_ppc64le,
+ vsx_vs22_ppc64le,
+ vsx_vs23_ppc64le,
+ vsx_vs24_ppc64le,
+ vsx_vs25_ppc64le,
+ vsx_vs26_ppc64le,
+ vsx_vs27_ppc64le,
+ vsx_vs28_ppc64le,
+ vsx_vs29_ppc64le,
+ vsx_vs30_ppc64le,
+ vsx_vs31_ppc64le,
+ vsx_vs32_ppc64le,
+ vsx_vs33_ppc64le,
+ vsx_vs34_ppc64le,
+ vsx_vs35_ppc64le,
+ vsx_vs36_ppc64le,
+ vsx_vs37_ppc64le,
+ vsx_vs38_ppc64le,
+ vsx_vs39_ppc64le,
+ vsx_vs40_ppc64le,
+ vsx_vs41_ppc64le,
+ vsx_vs42_ppc64le,
+ vsx_vs43_ppc64le,
+ vsx_vs44_ppc64le,
+ vsx_vs45_ppc64le,
+ vsx_vs46_ppc64le,
+ vsx_vs47_ppc64le,
+ vsx_vs48_ppc64le,
+ vsx_vs49_ppc64le,
+ vsx_vs50_ppc64le,
+ vsx_vs51_ppc64le,
+ vsx_vs52_ppc64le,
+ vsx_vs53_ppc64le,
+ vsx_vs54_ppc64le,
+ vsx_vs55_ppc64le,
+ vsx_vs56_ppc64le,
+ vsx_vs57_ppc64le,
+ vsx_vs58_ppc64le,
+ vsx_vs59_ppc64le,
+ vsx_vs60_ppc64le,
+ vsx_vs61_ppc64le,
+ vsx_vs62_ppc64le,
+ vsx_vs63_ppc64le,
+ k_last_vsx_ppc64le = vsx_vs63_ppc64le,
+
+ k_num_registers_ppc64le,
+ k_num_gpr_registers_ppc64le = k_last_gpr_ppc64le - k_first_gpr_ppc64le + 1,
+ k_num_fpr_registers_ppc64le = k_last_fpr_ppc64le - k_first_fpr_ppc64le + 1,
+ k_num_vmx_registers_ppc64le = k_last_vmx_ppc64le - k_first_vmx_ppc64le + 1,
+ k_num_vsx_registers_ppc64le = k_last_vsx_ppc64le - k_first_vsx_ppc64le + 1,
+};
+
+#endif // #ifndef lldb_ppc64le_register_enums_h
diff --git a/source/Plugins/Process/elf-core/CMakeLists.txt b/source/Plugins/Process/elf-core/CMakeLists.txt
index c7ffae695320..3082c73f6dda 100644
--- a/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -7,8 +7,10 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
RegisterContextPOSIXCore_arm64.cpp
RegisterContextPOSIXCore_mips64.cpp
RegisterContextPOSIXCore_powerpc.cpp
+ RegisterContextPOSIXCore_ppc64le.cpp
RegisterContextPOSIXCore_s390x.cpp
RegisterContextPOSIXCore_x86_64.cpp
+ RegisterUtilities.cpp
LINK_LIBS
lldbCore
diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 71eb6437ceed..7d6a0c9ad2df 100644
--- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -32,8 +32,7 @@
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
-
-// Project includes
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "ProcessElfCore.h"
#include "ThreadElfCore.h"
@@ -101,10 +100,7 @@ bool ProcessElfCore::CanDebug(lldb::TargetSP target_sp,
ProcessElfCore::ProcessElfCore(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
const FileSpec &core_file)
- : Process(target_sp, listener_sp), m_core_module_sp(),
- m_core_file(core_file), m_dyld_plugin_name(),
- m_os(llvm::Triple::UnknownOS), m_thread_data_valid(false),
- m_thread_data(), m_core_aranges() {}
+ : Process(target_sp, listener_sp), m_core_file(core_file) {}
//----------------------------------------------------------------------
// Destructor
@@ -193,9 +189,8 @@ Status ProcessElfCore::DoLoadCore() {
// Parse thread contexts and auxv structure
if (header->p_type == llvm::ELF::PT_NOTE) {
- error = ParseThreadContextsFromNoteSegment(header, data);
- if (error.Fail())
- return error;
+ if (llvm::Error error = ParseThreadContextsFromNoteSegment(header, data))
+ return Status(std::move(error));
}
// PT_LOAD segments contains address map
if (header->p_type == llvm::ELF::PT_LOAD) {
@@ -404,7 +399,6 @@ size_t ProcessElfCore::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
void ProcessElfCore::Clear() {
m_thread_list.Clear();
- m_os = llvm::Triple::UnknownOS;
SetUnixSignals(std::make_shared<UnixSignals>());
}
@@ -427,43 +421,10 @@ lldb::addr_t ProcessElfCore::GetImageInfoAddress() {
return LLDB_INVALID_ADDRESS;
}
-/// Core files PT_NOTE segment descriptor types
-enum {
- NT_PRSTATUS = 1,
- NT_FPREGSET,
- NT_PRPSINFO,
- NT_TASKSTRUCT,
- NT_PLATFORM,
- NT_AUXV,
- NT_FILE = 0x46494c45,
- NT_PRXFPREG = 0x46e62b7f,
- NT_SIGINFO = 0x53494749,
- NT_OPENBSD_PROCINFO = 10,
- NT_OPENBSD_AUXV = 11,
- NT_OPENBSD_REGS = 20,
- NT_OPENBSD_FPREGS = 21,
-};
-
-namespace FREEBSD {
-
-enum {
- NT_PRSTATUS = 1,
- NT_FPREGSET,
- NT_PRPSINFO,
- NT_THRMISC = 7,
- NT_PROCSTAT_AUXV = 16,
- NT_PPC_VMX = 0x100
-};
-}
-
-namespace NETBSD {
-
-enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35 };
-}
-
// Parse a FreeBSD NT_PRSTATUS note - see FreeBSD sys/procfs.h for details.
-static void ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data,
- ArchSpec &arch) {
+static void ParseFreeBSDPrStatus(ThreadData &thread_data,
+ const DataExtractor &data,
+ const ArchSpec &arch) {
lldb::offset_t offset = 0;
bool lp64 = (arch.GetMachine() == llvm::Triple::aarch64 ||
arch.GetMachine() == llvm::Triple::mips64 ||
@@ -492,12 +453,8 @@ static void ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data,
thread_data.gpregset = DataExtractor(data, offset, len);
}
-static void ParseFreeBSDThrMisc(ThreadData &thread_data, DataExtractor &data) {
- lldb::offset_t offset = 0;
- thread_data.name = data.GetCStr(&offset, 20);
-}
-
-static void ParseNetBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
+static void ParseNetBSDProcInfo(ThreadData &thread_data,
+ const DataExtractor &data) {
lldb::offset_t offset = 0;
int version = data.GetU32(&offset);
@@ -508,7 +465,8 @@ static void ParseNetBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
thread_data.signo = data.GetU32(&offset);
}
-static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
+static void ParseOpenBSDProcInfo(ThreadData &thread_data,
+ const DataExtractor &data) {
lldb::offset_t offset = 0;
int version = data.GetU32(&offset);
@@ -519,202 +477,263 @@ static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
thread_data.signo = data.GetU32(&offset);
}
-/// Parse Thread context from PT_NOTE segment and store it in the thread list
-/// Notes:
-/// 1) A PT_NOTE segment is composed of one or more NOTE entries.
-/// 2) NOTE Entry contains a standard header followed by variable size data.
-/// (see ELFNote structure)
-/// 3) A Thread Context in a core file usually described by 3 NOTE entries.
-/// a) NT_PRSTATUS - Register context
-/// b) NT_PRPSINFO - Process info(pid..)
-/// c) NT_FPREGSET - Floating point registers
-/// 4) The NOTE entries can be in any order
-/// 5) If a core file contains multiple thread contexts then there is two data
-/// forms
-/// a) Each thread context(2 or more NOTE entries) contained in its own
-/// segment (PT_NOTE)
-/// b) All thread context is stored in a single segment(PT_NOTE).
-/// This case is little tricker since while parsing we have to find where
-/// the
-/// new thread starts. The current implementation marks beginning of
-/// new thread when it finds NT_PRSTATUS or NT_PRPSINFO NOTE entry.
-/// For case (b) there may be either one NT_PRPSINFO per thread, or a single
-/// one that applies to all threads (depending on the platform type).
-Status ProcessElfCore::ParseThreadContextsFromNoteSegment(
- const elf::ELFProgramHeader *segment_header, DataExtractor segment_data) {
- assert(segment_header && segment_header->p_type == llvm::ELF::PT_NOTE);
-
+llvm::Expected<std::vector<CoreNote>>
+ProcessElfCore::parseSegment(const DataExtractor &segment) {
lldb::offset_t offset = 0;
- std::unique_ptr<ThreadData> thread_data(new ThreadData);
+ std::vector<CoreNote> result;
+
+ while (offset < segment.GetByteSize()) {
+ ELFNote note = ELFNote();
+ if (!note.Parse(segment, &offset))
+ return llvm::make_error<llvm::StringError>(
+ "Unable to parse note segment", llvm::inconvertibleErrorCode());
+
+ size_t note_start = offset;
+ size_t note_size = llvm::alignTo(note.n_descsz, 4);
+ DataExtractor note_data(segment, note_start, note_size);
+
+ result.push_back({note, note_data});
+ offset += note_size;
+ }
+
+ return std::move(result);
+}
+
+llvm::Error ProcessElfCore::parseFreeBSDNotes(llvm::ArrayRef<CoreNote> notes) {
bool have_prstatus = false;
bool have_prpsinfo = false;
+ ThreadData thread_data;
+ for (const auto &note : notes) {
+ if (note.info.n_name != "FreeBSD")
+ continue;
+
+ if ((note.info.n_type == FREEBSD::NT_PRSTATUS && have_prstatus) ||
+ (note.info.n_type == FREEBSD::NT_PRPSINFO && have_prpsinfo)) {
+ assert(thread_data.gpregset.GetByteSize() > 0);
+ // Add the new thread to thread list
+ m_thread_data.push_back(thread_data);
+ thread_data = ThreadData();
+ have_prstatus = false;
+ have_prpsinfo = false;
+ }
- ArchSpec arch = GetArchitecture();
- ELFLinuxPrPsInfo prpsinfo;
- ELFLinuxPrStatus prstatus;
- ELFLinuxSigInfo siginfo;
- size_t header_size;
- size_t len;
- Status error;
+ switch (note.info.n_type) {
+ case FREEBSD::NT_PRSTATUS:
+ have_prstatus = true;
+ ParseFreeBSDPrStatus(thread_data, note.data, GetArchitecture());
+ break;
+ case FREEBSD::NT_PRPSINFO:
+ have_prpsinfo = true;
+ break;
+ case FREEBSD::NT_THRMISC: {
+ lldb::offset_t offset = 0;
+ thread_data.name = note.data.GetCStr(&offset, 20);
+ break;
+ }
+ case FREEBSD::NT_PROCSTAT_AUXV:
+ // FIXME: FreeBSD sticks an int at the beginning of the note
+ m_auxv = DataExtractor(note.data, 4, note.data.GetByteSize() - 4);
+ break;
+ default:
+ thread_data.notes.push_back(note);
+ break;
+ }
+ }
+ if (!have_prstatus) {
+ return llvm::make_error<llvm::StringError>(
+ "Could not find NT_PRSTATUS note in core file.",
+ llvm::inconvertibleErrorCode());
+ }
+ m_thread_data.push_back(thread_data);
+ return llvm::Error::success();
+}
- // Loop through the NOTE entires in the segment
- while (offset < segment_header->p_filesz) {
- ELFNote note = ELFNote();
- note.Parse(segment_data, &offset);
+llvm::Error ProcessElfCore::parseNetBSDNotes(llvm::ArrayRef<CoreNote> notes) {
+ ThreadData thread_data;
+ for (const auto &note : notes) {
+ // NetBSD per-thread information is stored in notes named
+ // "NetBSD-CORE@nnn" so match on the initial part of the string.
+ if (!llvm::StringRef(note.info.n_name).startswith("NetBSD-CORE"))
+ continue;
+
+ switch (note.info.n_type) {
+ case NETBSD::NT_PROCINFO:
+ ParseNetBSDProcInfo(thread_data, note.data);
+ break;
+ case NETBSD::NT_AUXV:
+ m_auxv = note.data;
+ break;
+
+ case NETBSD::NT_AMD64_REGS:
+ if (GetArchitecture().GetMachine() == llvm::Triple::x86_64)
+ thread_data.gpregset = note.data;
+ break;
+ default:
+ thread_data.notes.push_back(note);
+ break;
+ }
+ }
+ if (thread_data.gpregset.GetByteSize() == 0) {
+ return llvm::make_error<llvm::StringError>(
+ "Could not find general purpose registers note in core file.",
+ llvm::inconvertibleErrorCode());
+ }
+ m_thread_data.push_back(thread_data);
+ return llvm::Error::success();
+}
+
+llvm::Error ProcessElfCore::parseOpenBSDNotes(llvm::ArrayRef<CoreNote> notes) {
+ ThreadData thread_data;
+ for (const auto &note : notes) {
+ // OpenBSD per-thread information is stored in notes named
+ // "OpenBSD@nnn" so match on the initial part of the string.
+ if (!llvm::StringRef(note.info.n_name).startswith("OpenBSD"))
+ continue;
+
+ switch (note.info.n_type) {
+ case OPENBSD::NT_PROCINFO:
+ ParseOpenBSDProcInfo(thread_data, note.data);
+ break;
+ case OPENBSD::NT_AUXV:
+ m_auxv = note.data;
+ break;
+ case OPENBSD::NT_REGS:
+ thread_data.gpregset = note.data;
+ break;
+ default:
+ thread_data.notes.push_back(note);
+ break;
+ }
+ }
+ if (thread_data.gpregset.GetByteSize() == 0) {
+ return llvm::make_error<llvm::StringError>(
+ "Could not find general purpose registers note in core file.",
+ llvm::inconvertibleErrorCode());
+ }
+ m_thread_data.push_back(thread_data);
+ return llvm::Error::success();
+}
- // Beginning of new thread
- if ((note.n_type == NT_PRSTATUS && have_prstatus) ||
- (note.n_type == NT_PRPSINFO && have_prpsinfo)) {
- assert(thread_data->gpregset.GetByteSize() > 0);
+/// A description of a linux process usually contains the following NOTE
+/// entries:
+/// - NT_PRPSINFO - General process information like pid, uid, name, ...
+/// - NT_SIGINFO - Information about the signal that terminated the process
+/// - NT_AUXV - Process auxiliary vector
+/// - NT_FILE - Files mapped into memory
+///
+/// Additionally, for each thread in the process the core file will contain at
+/// least the NT_PRSTATUS note, containing the thread id and general purpose
+/// registers. It may include additional notes for other register sets (floating
+/// point and vector registers, ...). The tricky part here is that some of these
+/// notes have "CORE" in their owner fields, while other set it to "LINUX".
+llvm::Error ProcessElfCore::parseLinuxNotes(llvm::ArrayRef<CoreNote> notes) {
+ const ArchSpec &arch = GetArchitecture();
+ bool have_prstatus = false;
+ bool have_prpsinfo = false;
+ ThreadData thread_data;
+ for (const auto &note : notes) {
+ if (note.info.n_name != "CORE" && note.info.n_name != "LINUX")
+ continue;
+
+ if ((note.info.n_type == LINUX::NT_PRSTATUS && have_prstatus) ||
+ (note.info.n_type == LINUX::NT_PRPSINFO && have_prpsinfo)) {
+ assert(thread_data.gpregset.GetByteSize() > 0);
// Add the new thread to thread list
- m_thread_data.push_back(*thread_data);
- *thread_data = ThreadData();
+ m_thread_data.push_back(thread_data);
+ thread_data = ThreadData();
have_prstatus = false;
have_prpsinfo = false;
}
- size_t note_start, note_size;
- note_start = offset;
- note_size = llvm::alignTo(note.n_descsz, 4);
-
- // Store the NOTE information in the current thread
- DataExtractor note_data(segment_data, note_start, note_size);
- note_data.SetAddressByteSize(
- m_core_module_sp->GetArchitecture().GetAddressByteSize());
- if (note.n_name == "FreeBSD") {
- m_os = llvm::Triple::FreeBSD;
- switch (note.n_type) {
- case FREEBSD::NT_PRSTATUS:
- have_prstatus = true;
- ParseFreeBSDPrStatus(*thread_data, note_data, arch);
- break;
- case FREEBSD::NT_FPREGSET:
- thread_data->fpregset = note_data;
- break;
- case FREEBSD::NT_PRPSINFO:
- have_prpsinfo = true;
- break;
- case FREEBSD::NT_THRMISC:
- ParseFreeBSDThrMisc(*thread_data, note_data);
- break;
- case FREEBSD::NT_PROCSTAT_AUXV:
- // FIXME: FreeBSD sticks an int at the beginning of the note
- m_auxv = DataExtractor(segment_data, note_start + 4, note_size - 4);
- break;
- case FREEBSD::NT_PPC_VMX:
- thread_data->vregset = note_data;
- break;
- default:
- break;
- }
- } else if (note.n_name.substr(0, 11) == "NetBSD-CORE") {
- // NetBSD per-thread information is stored in notes named
- // "NetBSD-CORE@nnn" so match on the initial part of the string.
- m_os = llvm::Triple::NetBSD;
- if (note.n_type == NETBSD::NT_PROCINFO) {
- ParseNetBSDProcInfo(*thread_data, note_data);
- } else if (note.n_type == NETBSD::NT_AUXV) {
- m_auxv = DataExtractor(note_data);
- } else if (arch.GetMachine() == llvm::Triple::x86_64 &&
- note.n_type == NETBSD::NT_AMD64_REGS) {
- thread_data->gpregset = note_data;
- } else if (arch.GetMachine() == llvm::Triple::x86_64 &&
- note.n_type == NETBSD::NT_AMD64_FPREGS) {
- thread_data->fpregset = note_data;
- }
- } else if (note.n_name.substr(0, 7) == "OpenBSD") {
- // OpenBSD per-thread information is stored in notes named
- // "OpenBSD@nnn" so match on the initial part of the string.
- m_os = llvm::Triple::OpenBSD;
- switch (note.n_type) {
- case NT_OPENBSD_PROCINFO:
- ParseOpenBSDProcInfo(*thread_data, note_data);
- break;
- case NT_OPENBSD_AUXV:
- m_auxv = DataExtractor(note_data);
- break;
- case NT_OPENBSD_REGS:
- thread_data->gpregset = note_data;
- break;
- case NT_OPENBSD_FPREGS:
- thread_data->fpregset = note_data;
- break;
- }
- } else if (note.n_name == "CORE") {
- switch (note.n_type) {
- case NT_PRSTATUS:
- have_prstatus = true;
- error = prstatus.Parse(note_data, arch);
- if (error.Fail())
- return error;
- thread_data->prstatus_sig = prstatus.pr_cursig;
- thread_data->tid = prstatus.pr_pid;
- header_size = ELFLinuxPrStatus::GetSize(arch);
- len = note_data.GetByteSize() - header_size;
- thread_data->gpregset = DataExtractor(note_data, header_size, len);
- break;
- case NT_FPREGSET:
- // In a i386 core file NT_FPREGSET is present, but it's not the result
- // of the FXSAVE instruction like in 64 bit files.
- // The result from FXSAVE is in NT_PRXFPREG for i386 core files
- if (arch.GetCore() == ArchSpec::eCore_x86_64_x86_64)
- thread_data->fpregset = note_data;
- else if(arch.IsMIPS())
- thread_data->fpregset = note_data;
- break;
- case NT_PRPSINFO:
- have_prpsinfo = true;
- error = prpsinfo.Parse(note_data, arch);
- if (error.Fail())
- return error;
- thread_data->name = prpsinfo.pr_fname;
- SetID(prpsinfo.pr_pid);
- break;
- case NT_AUXV:
- m_auxv = DataExtractor(note_data);
- break;
- case NT_FILE: {
- m_nt_file_entries.clear();
- lldb::offset_t offset = 0;
- const uint64_t count = note_data.GetAddress(&offset);
- note_data.GetAddress(&offset); // Skip page size
- for (uint64_t i = 0; i < count; ++i) {
- NT_FILE_Entry entry;
- entry.start = note_data.GetAddress(&offset);
- entry.end = note_data.GetAddress(&offset);
- entry.file_ofs = note_data.GetAddress(&offset);
- m_nt_file_entries.push_back(entry);
- }
- for (uint64_t i = 0; i < count; ++i) {
- const char *path = note_data.GetCStr(&offset);
- if (path && path[0])
- m_nt_file_entries[i].path.SetCString(path);
- }
- } break;
- case NT_SIGINFO: {
- error = siginfo.Parse(note_data, arch);
- if (error.Fail())
- return error;
- thread_data->signo = siginfo.si_signo;
- } break;
- default:
- break;
+ switch (note.info.n_type) {
+ case LINUX::NT_PRSTATUS: {
+ have_prstatus = true;
+ ELFLinuxPrStatus prstatus;
+ Status status = prstatus.Parse(note.data, arch);
+ if (status.Fail())
+ return status.ToError();
+ thread_data.prstatus_sig = prstatus.pr_cursig;
+ thread_data.tid = prstatus.pr_pid;
+ uint32_t header_size = ELFLinuxPrStatus::GetSize(arch);
+ size_t len = note.data.GetByteSize() - header_size;
+ thread_data.gpregset = DataExtractor(note.data, header_size, len);
+ break;
+ }
+ case LINUX::NT_PRPSINFO: {
+ have_prpsinfo = true;
+ ELFLinuxPrPsInfo prpsinfo;
+ Status status = prpsinfo.Parse(note.data, arch);
+ if (status.Fail())
+ return status.ToError();
+ thread_data.name = prpsinfo.pr_fname;
+ SetID(prpsinfo.pr_pid);
+ break;
+ }
+ case LINUX::NT_SIGINFO: {
+ ELFLinuxSigInfo siginfo;
+ Status status = siginfo.Parse(note.data, arch);
+ if (status.Fail())
+ return status.ToError();
+ thread_data.signo = siginfo.si_signo;
+ break;
+ }
+ case LINUX::NT_FILE: {
+ m_nt_file_entries.clear();
+ lldb::offset_t offset = 0;
+ const uint64_t count = note.data.GetAddress(&offset);
+ note.data.GetAddress(&offset); // Skip page size
+ for (uint64_t i = 0; i < count; ++i) {
+ NT_FILE_Entry entry;
+ entry.start = note.data.GetAddress(&offset);
+ entry.end = note.data.GetAddress(&offset);
+ entry.file_ofs = note.data.GetAddress(&offset);
+ m_nt_file_entries.push_back(entry);
}
- } else if (note.n_name == "LINUX") {
- switch (note.n_type) {
- case NT_PRXFPREG:
- thread_data->fpregset = note_data;
+ for (uint64_t i = 0; i < count; ++i) {
+ const char *path = note.data.GetCStr(&offset);
+ if (path && path[0])
+ m_nt_file_entries[i].path.SetCString(path);
}
+ break;
+ }
+ case LINUX::NT_AUXV:
+ m_auxv = note.data;
+ break;
+ default:
+ thread_data.notes.push_back(note);
+ break;
}
-
- offset += note_size;
}
// Add last entry in the note section
- if (thread_data && thread_data->gpregset.GetByteSize() > 0) {
- m_thread_data.push_back(*thread_data);
- }
+ if (have_prstatus)
+ m_thread_data.push_back(thread_data);
+ return llvm::Error::success();
+}
- return error;
+/// Parse Thread context from PT_NOTE segment and store it in the thread list
+/// A note segment consists of one or more NOTE entries, but their types and
+/// meaning differ depending on the OS.
+llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment(
+ const elf::ELFProgramHeader *segment_header, DataExtractor segment_data) {
+ assert(segment_header && segment_header->p_type == llvm::ELF::PT_NOTE);
+
+ auto notes_or_error = parseSegment(segment_data);
+ if(!notes_or_error)
+ return notes_or_error.takeError();
+ switch (GetArchitecture().GetTriple().getOS()) {
+ case llvm::Triple::FreeBSD:
+ return parseFreeBSDNotes(*notes_or_error);
+ case llvm::Triple::Linux:
+ return parseLinuxNotes(*notes_or_error);
+ case llvm::Triple::NetBSD:
+ return parseNetBSDNotes(*notes_or_error);
+ case llvm::Triple::OpenBSD:
+ return parseOpenBSDNotes(*notes_or_error);
+ default:
+ return llvm::make_error<llvm::StringError>(
+ "Don't know how to parse core file. Unsupported OS.",
+ llvm::inconvertibleErrorCode());
+ }
}
uint32_t ProcessElfCore::GetNumThreadContexts() {
@@ -724,15 +743,18 @@ uint32_t ProcessElfCore::GetNumThreadContexts() {
}
ArchSpec ProcessElfCore::GetArchitecture() {
- ObjectFileELF *core_file =
- (ObjectFileELF *)(m_core_module_sp->GetObjectFile());
ArchSpec arch;
- core_file->GetArchitecture(arch);
+ m_core_module_sp->GetObjectFile()->GetArchitecture(arch);
ArchSpec target_arch = GetTarget().GetArchitecture();
-
- if (target_arch.IsMIPS())
+ arch.MergeFrom(target_arch);
+
+ // On MIPS there is no way to differentiate betwenn 32bit and 64bit core files
+ // and this information can't be merged in from the target arch so we fail
+ // back to unconditionally returning the target arch in this config.
+ if (target_arch.IsMIPS()) {
return target_arch;
+ }
return arch;
}
diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.h b/source/Plugins/Process/elf-core/ProcessElfCore.h
index dbf7f926f855..325c0152e028 100644
--- a/source/Plugins/Process/elf-core/ProcessElfCore.h
+++ b/source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -29,6 +29,7 @@
#include "lldb/Utility/Status.h"
#include "Plugins/ObjectFile/ELF/ELFHeader.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
struct ThreadData;
@@ -84,11 +85,21 @@ public:
void RefreshStateAfterStop() override;
+ lldb_private::Status WillResume() override {
+ lldb_private::Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support resuming processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
//------------------------------------------------------------------
// Process Queries
//------------------------------------------------------------------
bool IsAlive() override;
+ bool WarnBeforeDetach() const override { return false; }
+
//------------------------------------------------------------------
// Process Memory
//------------------------------------------------------------------
@@ -139,10 +150,8 @@ private:
std::string m_dyld_plugin_name;
DISALLOW_COPY_AND_ASSIGN(ProcessElfCore);
- llvm::Triple::OSType m_os;
-
// True if m_thread_contexts contains valid entries
- bool m_thread_data_valid;
+ bool m_thread_data_valid = false;
// Contain thread data read from NOTE segments
std::vector<ThreadData> m_thread_data;
@@ -160,7 +169,7 @@ private:
std::vector<NT_FILE_Entry> m_nt_file_entries;
// Parse thread(s) data structures(prstatus, prpsinfo) from given NOTE segment
- lldb_private::Status ParseThreadContextsFromNoteSegment(
+ llvm::Error ParseThreadContextsFromNoteSegment(
const elf::ELFProgramHeader *segment_header,
lldb_private::DataExtractor segment_data);
@@ -170,6 +179,13 @@ private:
// Parse a contiguous address range of the process from LOAD segment
lldb::addr_t
AddAddressRangeFromLoadSegment(const elf::ELFProgramHeader *header);
+
+ llvm::Expected<std::vector<lldb_private::CoreNote>>
+ parseSegment(const lldb_private::DataExtractor &segment);
+ llvm::Error parseFreeBSDNotes(llvm::ArrayRef<lldb_private::CoreNote> notes);
+ llvm::Error parseNetBSDNotes(llvm::ArrayRef<lldb_private::CoreNote> notes);
+ llvm::Error parseOpenBSDNotes(llvm::ArrayRef<lldb_private::CoreNote> notes);
+ llvm::Error parseLinuxNotes(llvm::ArrayRef<lldb_private::CoreNote> notes);
};
#endif // liblldb_ProcessElfCore_h_
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
index 81d88e69b97f..0d683153d9ed 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
@@ -16,7 +16,7 @@ using namespace lldb_private;
RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_arm(thread, 0, register_info) {
m_gpr_buffer.reset(
new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
index e095eac5eaf8..a98d64caee17 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_arm_h_
#define liblldb_RegisterContextCorePOSIX_arm_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_arm.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
@@ -24,7 +21,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
~RegisterContextCorePOSIX_arm() override;
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index 41c02bf94c37..919f8901d39a 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "RegisterContextPOSIXCore_arm64.h"
-
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Target/Thread.h"
@@ -16,7 +16,7 @@ using namespace lldb_private;
RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_arm64(thread, 0, register_info) {
m_gpr_buffer.reset(
new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
index 3a2bbdb0a2eb..c519b1557189 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_arm64_h_
#define liblldb_RegisterContextCorePOSIX_arm64_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_arm64.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
@@ -24,7 +21,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
~RegisterContextCorePOSIX_arm64() override;
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
index 7549cf074be7..e252b5a35e9c 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
@@ -16,12 +16,15 @@ using namespace lldb_private;
RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_mips64(thread, 0, register_info) {
m_gpr_buffer.reset(
new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+ DataExtractor fpregset = getRegset(
+ notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
m_fpr_buffer.reset(
new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
m_fpr.SetData(m_fpr_buffer);
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
index 2cb527a8de7c..cf1d8a5bc2d1 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_mips64_h_
#define liblldb_RegisterContextCorePOSIX_mips64_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
@@ -24,7 +21,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
~RegisterContextCorePOSIX_mips64() override;
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
index 62f6413722f7..8670e341a277 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
@@ -17,17 +17,21 @@ using namespace lldb_private;
RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset,
- const DataExtractor &vregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_powerpc(thread, 0, register_info) {
m_gpr_buffer.reset(
new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+ ArchSpec arch = register_info->GetTargetArchitecture();
+ DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
m_fpr_buffer.reset(
new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
m_fpr.SetData(m_fpr_buffer);
m_fpr.SetByteOrder(fpregset.GetByteOrder());
+
+ DataExtractor vregset = getRegset(notes, arch.GetTriple(), PPC_VMX_Desc);
m_vec_buffer.reset(
new DataBufferHeap(vregset.GetDataStart(), vregset.GetByteSize()));
m_vec.SetData(m_vec_buffer);
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
index aaa95e5d2397..c352ab5912ff 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_powerpc_h_
#define liblldb_RegisterContextCorePOSIX_powerpc_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Utility/DataExtractor.h"
class RegisterContextCorePOSIX_powerpc : public RegisterContextPOSIX_powerpc {
@@ -23,8 +20,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset,
- const lldb_private::DataExtractor &vregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
~RegisterContextCorePOSIX_powerpc() override;
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
new file mode 100644
index 000000000000..2237e72353ac
--- /dev/null
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
@@ -0,0 +1,132 @@
+//===-- RegisterContextPOSIXCore_ppc64le.cpp --------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "RegisterContextPOSIXCore_ppc64le.h"
+
+#include "lldb/Core/RegisterValue.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/DataBufferHeap.h"
+
+#include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
+
+using namespace lldb_private;
+
+RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(
+ Thread &thread, RegisterInfoInterface *register_info,
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
+ : RegisterContextPOSIX_ppc64le(thread, 0, register_info) {
+ m_gpr_buffer.reset(
+ new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr.SetData(m_gpr_buffer);
+ m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+ ArchSpec arch = register_info->GetTargetArchitecture();
+ DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+ m_fpr_buffer.reset(
+ new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
+ m_fpr.SetData(m_fpr_buffer);
+ m_fpr.SetByteOrder(fpregset.GetByteOrder());
+
+ DataExtractor vmxregset = getRegset(notes, arch.GetTriple(), PPC_VMX_Desc);
+ m_vmx_buffer.reset(
+ new DataBufferHeap(vmxregset.GetDataStart(), vmxregset.GetByteSize()));
+ m_vmx.SetData(m_vmx_buffer);
+ m_vmx.SetByteOrder(vmxregset.GetByteOrder());
+
+ DataExtractor vsxregset = getRegset(notes, arch.GetTriple(), PPC_VSX_Desc);
+ m_vsx_buffer.reset(
+ new DataBufferHeap(vsxregset.GetDataStart(), vsxregset.GetByteSize()));
+ m_vsx.SetData(m_vsx_buffer);
+ m_vsx.SetByteOrder(vsxregset.GetByteOrder());
+}
+
+size_t RegisterContextCorePOSIX_ppc64le::GetFPRSize() const {
+ return k_num_fpr_registers_ppc64le * sizeof(uint64_t);
+}
+
+size_t RegisterContextCorePOSIX_ppc64le::GetVMXSize() const {
+ return (k_num_vmx_registers_ppc64le - 1) * sizeof(uint64_t) * 2 +
+ sizeof(uint32_t);
+}
+
+size_t RegisterContextCorePOSIX_ppc64le::GetVSXSize() const {
+ return k_num_vsx_registers_ppc64le * sizeof(uint64_t) * 2;
+}
+
+bool RegisterContextCorePOSIX_ppc64le::ReadRegister(
+ const RegisterInfo *reg_info, RegisterValue &value) {
+ lldb::offset_t offset = reg_info->byte_offset;
+
+ if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+ uint64_t v;
+ offset -= GetGPRSize();
+ offset = m_fpr.CopyData(offset, reg_info->byte_size, &v);
+
+ if (offset == reg_info->byte_size) {
+ value.SetBytes(&v, reg_info->byte_size, m_fpr.GetByteOrder());
+ return true;
+ }
+ } else if (IsVMX(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+ uint32_t v[4];
+ offset -= GetGPRSize() + GetFPRSize();
+ offset = m_vmx.CopyData(offset, reg_info->byte_size, &v);
+
+ if (offset == reg_info->byte_size) {
+ value.SetBytes(v, reg_info->byte_size, m_vmx.GetByteOrder());
+ return true;
+ }
+ } else if (IsVSX(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+ uint32_t v[4];
+ lldb::offset_t tmp_offset;
+ offset -= GetGPRSize() + GetFPRSize() + GetVMXSize();
+
+ if (offset < GetVSXSize() / 2) {
+ tmp_offset = m_vsx.CopyData(offset / 2, reg_info->byte_size / 2, &v);
+
+ if (tmp_offset != reg_info->byte_size / 2) {
+ return false;
+ }
+
+ uint8_t *dst = (uint8_t *)&v + sizeof(uint64_t);
+ tmp_offset = m_fpr.CopyData(offset / 2, reg_info->byte_size / 2, dst);
+
+ if (tmp_offset != reg_info->byte_size / 2) {
+ return false;
+ }
+
+ value.SetBytes(&v, reg_info->byte_size, m_vsx.GetByteOrder());
+ return true;
+ } else {
+ offset =
+ m_vmx.CopyData(offset - GetVSXSize() / 2, reg_info->byte_size, &v);
+ if (offset == reg_info->byte_size) {
+ value.SetBytes(v, reg_info->byte_size, m_vmx.GetByteOrder());
+ return true;
+ }
+ }
+ } else {
+ uint64_t v = m_gpr.GetMaxU64(&offset, reg_info->byte_size);
+
+ if (offset == reg_info->byte_offset + reg_info->byte_size) {
+ if (reg_info->byte_size < sizeof(v))
+ value = (uint32_t)v;
+ else
+ value = v;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool RegisterContextCorePOSIX_ppc64le::WriteRegister(
+ const RegisterInfo *reg_info, const RegisterValue &value) {
+ return false;
+}
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h
new file mode 100644
index 000000000000..c860781d60be
--- /dev/null
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h
@@ -0,0 +1,49 @@
+//===-- RegisterContextPOSIXCore_ppc64le.h ----------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContextCorePOSIX_ppc64le_h_
+#define liblldb_RegisterContextCorePOSIX_ppc64le_h_
+
+#include "Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
+#include "lldb/Utility/DataExtractor.h"
+
+class RegisterContextCorePOSIX_ppc64le : public RegisterContextPOSIX_ppc64le {
+public:
+ RegisterContextCorePOSIX_ppc64le(
+ lldb_private::Thread &thread,
+ lldb_private::RegisterInfoInterface *register_info,
+ const lldb_private::DataExtractor &gpregset,
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
+
+ bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
+ lldb_private::RegisterValue &value) override;
+
+ bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
+ const lldb_private::RegisterValue &value) override;
+
+protected:
+ size_t GetFPRSize() const;
+
+ size_t GetVMXSize() const;
+
+ size_t GetVSXSize() const;
+
+private:
+ lldb::DataBufferSP m_gpr_buffer;
+ lldb::DataBufferSP m_fpr_buffer;
+ lldb::DataBufferSP m_vmx_buffer;
+ lldb::DataBufferSP m_vsx_buffer;
+ lldb_private::DataExtractor m_gpr;
+ lldb_private::DataExtractor m_fpr;
+ lldb_private::DataExtractor m_vmx;
+ lldb_private::DataExtractor m_vsx;
+};
+
+#endif // liblldb_RegisterContextCorePOSIX_ppc64le_h_
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
index b3530a8d6a42..f0edbf1ea854 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
@@ -17,13 +17,15 @@ using namespace lldb_private;
RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_s390x(thread, 0, register_info) {
m_gpr_buffer.reset(
new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
m_gpr.SetData(m_gpr_buffer);
m_gpr.SetByteOrder(gpregset.GetByteOrder());
+ DataExtractor fpregset = getRegset(
+ notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
m_fpr_buffer.reset(
new DataBufferHeap(fpregset.GetDataStart(), fpregset.GetByteSize()));
m_fpr.SetData(m_fpr_buffer);
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
index 2b4ae10a87bd..0df136372bdd 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_s390x_h_
#define liblldb_RegisterContextCorePOSIX_s390x_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_s390x.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Utility/DataExtractor.h"
class RegisterContextCorePOSIX_s390x : public RegisterContextPOSIX_s390x {
@@ -23,7 +20,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
~RegisterContextCorePOSIX_s390x() override;
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
index 5766923186d1..a5c7ffda1da5 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
@@ -16,7 +16,7 @@ using namespace lldb_private;
RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
Thread &thread, RegisterInfoInterface *register_info,
- const DataExtractor &gpregset, const DataExtractor &fpregset)
+ const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
: RegisterContextPOSIX_x86(thread, 0, register_info) {
size_t size, len;
@@ -27,6 +27,8 @@ RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
if (len != size)
m_gpregset.reset();
+ DataExtractor fpregset = getRegset(
+ notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
size = sizeof(FXSAVE);
m_fpregset.reset(new uint8_t[size]);
len =
diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
index 8340368f8c3c..509624174a89 100644
--- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
+++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
@@ -10,11 +10,8 @@
#ifndef liblldb_RegisterContextCorePOSIX_x86_64_h_
#define liblldb_RegisterContextCorePOSIX_x86_64_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
class RegisterContextCorePOSIX_x86_64 : public RegisterContextPOSIX_x86 {
public:
@@ -22,7 +19,7 @@ public:
lldb_private::Thread &thread,
lldb_private::RegisterInfoInterface *register_info,
const lldb_private::DataExtractor &gpregset,
- const lldb_private::DataExtractor &fpregset);
+ llvm::ArrayRef<lldb_private::CoreNote> notes);
bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
lldb_private::RegisterValue &value) override;
diff --git a/source/Plugins/Process/elf-core/RegisterUtilities.cpp b/source/Plugins/Process/elf-core/RegisterUtilities.cpp
new file mode 100644
index 000000000000..3837abadd0f6
--- /dev/null
+++ b/source/Plugins/Process/elf-core/RegisterUtilities.cpp
@@ -0,0 +1,39 @@
+//===-- RegisterUtilities.cpp -----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
+#include "llvm/ADT/STLExtras.h"
+
+using namespace lldb_private;
+
+static llvm::Optional<uint32_t>
+getNoteType(const llvm::Triple &Triple,
+ llvm::ArrayRef<RegsetDesc> RegsetDescs) {
+ for (const auto &Entry : RegsetDescs) {
+ if (Entry.OS != Triple.getOS())
+ continue;
+ if (Entry.Arch != llvm::Triple::UnknownArch &&
+ Entry.Arch != Triple.getArch())
+ continue;
+ return Entry.Note;
+ }
+ return llvm::None;
+}
+
+DataExtractor lldb_private::getRegset(llvm::ArrayRef<CoreNote> Notes,
+ const llvm::Triple &Triple,
+ llvm::ArrayRef<RegsetDesc> RegsetDescs) {
+ auto TypeOr = getNoteType(Triple, RegsetDescs);
+ if (!TypeOr)
+ return DataExtractor();
+ uint32_t Type = *TypeOr;
+ auto Iter = llvm::find_if(
+ Notes, [Type](const CoreNote &Note) { return Note.info.n_type == Type; });
+ return Iter == Notes.end() ? DataExtractor() : Iter->data;
+}
diff --git a/source/Plugins/Process/elf-core/RegisterUtilities.h b/source/Plugins/Process/elf-core/RegisterUtilities.h
new file mode 100644
index 000000000000..9170d94c04b6
--- /dev/null
+++ b/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -0,0 +1,110 @@
+//===-- RegisterUtilities.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_REGISTERUTILITIES_H
+#define LLDB_REGISTERUTILITIES_H
+
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "lldb/Utility/DataExtractor.h"
+
+namespace lldb_private {
+/// Core files PT_NOTE segment descriptor types
+
+namespace FREEBSD {
+enum {
+ NT_PRSTATUS = 1,
+ NT_FPREGSET,
+ NT_PRPSINFO,
+ NT_THRMISC = 7,
+ NT_PROCSTAT_AUXV = 16,
+ NT_PPC_VMX = 0x100
+};
+}
+
+namespace NETBSD {
+enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35 };
+}
+
+namespace OPENBSD {
+enum {
+ NT_PROCINFO = 10,
+ NT_AUXV = 11,
+ NT_REGS = 20,
+ NT_FPREGS = 21,
+};
+}
+
+namespace LINUX {
+enum {
+ NT_PRSTATUS = 1,
+ NT_FPREGSET,
+ NT_PRPSINFO,
+ NT_TASKSTRUCT,
+ NT_PLATFORM,
+ NT_AUXV,
+ NT_FILE = 0x46494c45,
+ NT_SIGINFO = 0x53494749,
+ NT_PPC_VMX = 0x100,
+ NT_PPC_VSX = 0x102,
+ NT_PRXFPREG = 0x46e62b7f,
+};
+}
+
+struct CoreNote {
+ ELFNote info;
+ DataExtractor data;
+};
+
+// A structure describing how to find a register set in a core file from a given
+// OS.
+struct RegsetDesc {
+ // OS to which this entry applies to. Must not be UnknownOS.
+ llvm::Triple::OSType OS;
+
+ // Architecture to which this entry applies to. Can be UnknownArch, in which
+ // case it applies to all architectures of a given OS.
+ llvm::Triple::ArchType Arch;
+
+ // The note type under which the register set can be found.
+ uint32_t Note;
+};
+
+// Returns the register set in Notes which corresponds to the specified Triple
+// according to the list of register set descriptions in RegsetDescs. The list
+// is scanned linearly, so you can use a more specific entry (e.g. linux-i386)
+// to override a more general entry (e.g. general linux), as long as you place
+// it earlier in the list. If a register set is not found, it returns an empty
+// DataExtractor.
+DataExtractor getRegset(llvm::ArrayRef<CoreNote> Notes,
+ const llvm::Triple &Triple,
+ llvm::ArrayRef<RegsetDesc> RegsetDescs);
+
+constexpr RegsetDesc FPR_Desc[] = {
+ {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, FREEBSD::NT_FPREGSET},
+ // In a i386 core file NT_FPREGSET is present, but it's not the result
+ // of the FXSAVE instruction like in 64 bit files.
+ // The result from FXSAVE is in NT_PRXFPREG for i386 core files
+ {llvm::Triple::Linux, llvm::Triple::x86, LINUX::NT_PRXFPREG},
+ {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_FPREGSET},
+ {llvm::Triple::NetBSD, llvm::Triple::x86_64, NETBSD::NT_AMD64_FPREGS},
+ {llvm::Triple::OpenBSD, llvm::Triple::UnknownArch, OPENBSD::NT_FPREGS},
+};
+
+constexpr RegsetDesc PPC_VMX_Desc[] = {
+ {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, FREEBSD::NT_PPC_VMX},
+ {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_PPC_VMX},
+};
+
+constexpr RegsetDesc PPC_VSX_Desc[] = {
+ {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_PPC_VSX},
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_REGISTERUTILITIES_H
diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index 096c20363c78..10c1ed288b2c 100644
--- a/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -18,9 +18,9 @@
#include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
#include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h"
#include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
-#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h"
-#include "Plugins/Process/Utility/RegisterContextLinux_mips.h"
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
+#include "Plugins/Process/Utility/RegisterContextLinux_mips.h"
+#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h"
#include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
@@ -28,11 +28,13 @@
#include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h"
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
#include "ProcessElfCore.h"
#include "RegisterContextPOSIXCore_arm.h"
#include "RegisterContextPOSIXCore_arm64.h"
#include "RegisterContextPOSIXCore_mips64.h"
#include "RegisterContextPOSIXCore_powerpc.h"
+#include "RegisterContextPOSIXCore_ppc64le.h"
#include "RegisterContextPOSIXCore_s390x.h"
#include "RegisterContextPOSIXCore_x86_64.h"
#include "ThreadElfCore.h"
@@ -45,8 +47,7 @@ using namespace lldb_private;
//----------------------------------------------------------------------
ThreadElfCore::ThreadElfCore(Process &process, const ThreadData &td)
: Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
- m_signo(td.signo), m_gpregset_data(td.gpregset),
- m_fpregset_data(td.fpregset), m_vregset_data(td.vregset) {}
+ m_signo(td.signo), m_gpregset_data(td.gpregset), m_notes(td.notes) {}
ThreadElfCore::~ThreadElfCore() { DestroyThread(); }
@@ -142,6 +143,9 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
case llvm::Triple::mips64:
reg_interface = new RegisterContextLinux_mips64(arch);
break;
+ case llvm::Triple::ppc64le:
+ reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
+ break;
case llvm::Triple::systemz:
reg_interface = new RegisterContextLinux_s390x(arch);
break;
@@ -191,36 +195,39 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
switch (arch.GetMachine()) {
case llvm::Triple::aarch64:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_arm64(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::arm:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_arm(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::mipsel:
case llvm::Triple::mips:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_mips64(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_mips64(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::ppc:
case llvm::Triple::ppc64:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_powerpc(
- *this, reg_interface, m_gpregset_data, m_fpregset_data,
- m_vregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
+ break;
+ case llvm::Triple::ppc64le:
+ m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_ppc64le(
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::systemz:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_s390x(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, m_gpregset_data, m_fpregset_data));
+ *this, reg_interface, m_gpregset_data, m_notes));
break;
default:
break;
@@ -249,7 +256,7 @@ ELFLinuxPrStatus::ELFLinuxPrStatus() {
memset(this, 0, sizeof(ELFLinuxPrStatus));
}
-size_t ELFLinuxPrStatus::GetSize(lldb_private::ArchSpec &arch) {
+size_t ELFLinuxPrStatus::GetSize(const lldb_private::ArchSpec &arch) {
constexpr size_t mips_linux_pr_status_size_o32 = 96;
constexpr size_t mips_linux_pr_status_size_n32 = 72;
if (arch.IsMIPS()) {
@@ -265,6 +272,7 @@ size_t ELFLinuxPrStatus::GetSize(lldb_private::ArchSpec &arch) {
switch (arch.GetCore()) {
case lldb_private::ArchSpec::eCore_s390x_generic:
case lldb_private::ArchSpec::eCore_x86_64_x86_64:
+ case lldb_private::ArchSpec::eCore_ppc64le_generic:
return sizeof(ELFLinuxPrStatus);
case lldb_private::ArchSpec::eCore_x86_32_i386:
case lldb_private::ArchSpec::eCore_x86_32_i486:
@@ -274,7 +282,8 @@ size_t ELFLinuxPrStatus::GetSize(lldb_private::ArchSpec &arch) {
}
}
-Status ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) {
+Status ELFLinuxPrStatus::Parse(const DataExtractor &data,
+ const ArchSpec &arch) {
Status error;
if (GetSize(arch) > data.GetByteSize()) {
error.SetErrorStringWithFormat(
@@ -323,7 +332,7 @@ ELFLinuxPrPsInfo::ELFLinuxPrPsInfo() {
memset(this, 0, sizeof(ELFLinuxPrPsInfo));
}
-size_t ELFLinuxPrPsInfo::GetSize(lldb_private::ArchSpec &arch) {
+size_t ELFLinuxPrPsInfo::GetSize(const lldb_private::ArchSpec &arch) {
constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128;
if (arch.IsMIPS()) {
uint8_t address_byte_size = arch.GetAddressByteSize();
@@ -344,7 +353,8 @@ size_t ELFLinuxPrPsInfo::GetSize(lldb_private::ArchSpec &arch) {
}
}
-Status ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) {
+Status ELFLinuxPrPsInfo::Parse(const DataExtractor &data,
+ const ArchSpec &arch) {
Status error;
ByteOrder byteorder = data.GetByteOrder();
if (GetSize(arch) > data.GetByteSize()) {
@@ -413,7 +423,7 @@ size_t ELFLinuxSigInfo::GetSize(const lldb_private::ArchSpec &arch) {
}
}
-Status ELFLinuxSigInfo::Parse(DataExtractor &data, const ArchSpec &arch) {
+Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) {
Status error;
if (GetSize(arch) > data.GetByteSize()) {
error.SetErrorStringWithFormat(
diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.h b/source/Plugins/Process/elf-core/ThreadElfCore.h
index 521875413715..335f698dbb24 100644
--- a/source/Plugins/Process/elf-core/ThreadElfCore.h
+++ b/source/Plugins/Process/elf-core/ThreadElfCore.h
@@ -10,14 +10,11 @@
#ifndef liblldb_ThreadElfCore_h_
#define liblldb_ThreadElfCore_h_
-// C Includes
-// C++ Includes
-#include <string>
-
-// Other libraries and framework includes
-// Project includes
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataExtractor.h"
+#include "llvm/ADT/DenseMap.h"
+#include <string>
struct compat_timeval {
alignas(8) uint64_t tv_sec;
@@ -57,15 +54,15 @@ struct ELFLinuxPrStatus {
ELFLinuxPrStatus();
- lldb_private::Status Parse(lldb_private::DataExtractor &data,
- lldb_private::ArchSpec &arch);
+ lldb_private::Status Parse(const lldb_private::DataExtractor &data,
+ const lldb_private::ArchSpec &arch);
// Return the bytesize of the structure
// 64 bit - just sizeof
// 32 bit - hardcoded because we are reusing the struct, but some of the
// members are smaller -
// so the layout is not the same
- static size_t GetSize(lldb_private::ArchSpec &arch);
+ static size_t GetSize(const lldb_private::ArchSpec &arch);
};
static_assert(sizeof(ELFLinuxPrStatus) == 112,
@@ -78,7 +75,7 @@ struct ELFLinuxSigInfo {
ELFLinuxSigInfo();
- lldb_private::Status Parse(lldb_private::DataExtractor &data,
+ lldb_private::Status Parse(const lldb_private::DataExtractor &data,
const lldb_private::ArchSpec &arch);
// Return the bytesize of the structure
@@ -113,15 +110,15 @@ struct ELFLinuxPrPsInfo {
ELFLinuxPrPsInfo();
- lldb_private::Status Parse(lldb_private::DataExtractor &data,
- lldb_private::ArchSpec &arch);
+ lldb_private::Status Parse(const lldb_private::DataExtractor &data,
+ const lldb_private::ArchSpec &arch);
// Return the bytesize of the structure
// 64 bit - just sizeof
// 32 bit - hardcoded because we are reusing the struct, but some of the
// members are smaller -
// so the layout is not the same
- static size_t GetSize(lldb_private::ArchSpec &arch);
+ static size_t GetSize(const lldb_private::ArchSpec &arch);
};
static_assert(sizeof(ELFLinuxPrPsInfo) == 136,
@@ -129,8 +126,7 @@ static_assert(sizeof(ELFLinuxPrPsInfo) == 136,
struct ThreadData {
lldb_private::DataExtractor gpregset;
- lldb_private::DataExtractor fpregset;
- lldb_private::DataExtractor vregset;
+ std::vector<lldb_private::CoreNote> notes;
lldb::tid_t tid;
int signo = 0;
int prstatus_sig = 0;
@@ -177,8 +173,7 @@ protected:
int m_signo;
lldb_private::DataExtractor m_gpregset_data;
- lldb_private::DataExtractor m_fpregset_data;
- lldb_private::DataExtractor m_vregset_data;
+ std::vector<lldb_private::CoreNote> m_notes;
bool CalculateStopInfo() override;
};
diff --git a/source/Plugins/Process/gdb-remote/CMakeLists.txt b/source/Plugins/Process/gdb-remote/CMakeLists.txt
index 5e51feef1d3f..7ae25f83c5f8 100644
--- a/source/Plugins/Process/gdb-remote/CMakeLists.txt
+++ b/source/Plugins/Process/gdb-remote/CMakeLists.txt
@@ -7,6 +7,10 @@ set(LLDB_PLUGINS
lldbPluginPlatformMacOSX
)
+if(HAVE_LIBCOMPRESSION)
+ set(LIBCOMPRESSION compression)
+endif()
+
add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
GDBRemoteClientBase.cpp
GDBRemoteCommunication.cpp
@@ -30,6 +34,7 @@ add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
lldbTarget
lldbUtility
${LLDB_PLUGINS}
+ ${LIBCOMPRESSION}
LINK_COMPONENTS
Support
)
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 0c4df7e3f306..949cf19db658 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -600,10 +600,9 @@ bool GDBRemoteCommunication::DecompressPacket() {
#if defined(HAVE_LIBCOMPRESSION)
// libcompression is weak linked so check that compression_decode_buffer() is
// available
- if (compression_decode_buffer != NULL &&
- (m_compression_type == CompressionType::ZlibDeflate ||
- m_compression_type == CompressionType::LZFSE ||
- m_compression_type == CompressionType::LZ4)) {
+ if (m_compression_type == CompressionType::ZlibDeflate ||
+ m_compression_type == CompressionType::LZFSE ||
+ m_compression_type == CompressionType::LZ4) {
compression_algorithm compression_type;
if (m_compression_type == CompressionType::LZFSE)
compression_type = COMPRESSION_LZFSE;
@@ -815,7 +814,8 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len,
// checksum
if (m_bytes[0] == '$' && total_length > 4) {
for (size_t i = 0; !binary && i < total_length; ++i) {
- if (isprint(m_bytes[i]) == 0 && isspace(m_bytes[i]) == 0) {
+ unsigned char c = m_bytes[i];
+ if (isprint(c) == 0 && isspace(c) == 0) {
binary = true;
}
}
@@ -1375,3 +1375,39 @@ void GDBRemoteCommunication::AppendBytesToCache(const uint8_t *bytes,
}
}
}
+
+void llvm::format_provider<GDBRemoteCommunication::PacketResult>::format(
+ const GDBRemoteCommunication::PacketResult &result, raw_ostream &Stream,
+ StringRef Style) {
+ using PacketResult = GDBRemoteCommunication::PacketResult;
+
+ switch (result) {
+ case PacketResult::Success:
+ Stream << "Success";
+ break;
+ case PacketResult::ErrorSendFailed:
+ Stream << "ErrorSendFailed";
+ break;
+ case PacketResult::ErrorSendAck:
+ Stream << "ErrorSendAck";
+ break;
+ case PacketResult::ErrorReplyFailed:
+ Stream << "ErrorReplyFailed";
+ break;
+ case PacketResult::ErrorReplyTimeout:
+ Stream << "ErrorReplyTimeout";
+ break;
+ case PacketResult::ErrorReplyInvalid:
+ Stream << "ErrorReplyInvalid";
+ break;
+ case PacketResult::ErrorReplyAck:
+ Stream << "ErrorReplyAck";
+ break;
+ case PacketResult::ErrorDisconnected:
+ Stream << "ErrorDisconnected";
+ break;
+ case PacketResult::ErrorNoSequenceLock:
+ Stream << "ErrorNoSequenceLock";
+ break;
+ }
+}
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
index ce90de3e8470..ecc9386e49c7 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -290,4 +290,14 @@ private:
} // namespace process_gdb_remote
} // namespace lldb_private
+namespace llvm {
+template <>
+struct format_provider<
+ lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult> {
+ static void format(const lldb_private::process_gdb_remote::
+ GDBRemoteCommunication::PacketResult &state,
+ raw_ostream &Stream, StringRef Style);
+};
+} // namespace llvm
+
#endif // liblldb_GDBRemoteCommunication_h_
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index e6fd386b903b..867f57c475ce 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1022,10 +1022,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
std::string avail_name;
#if defined(HAVE_LIBCOMPRESSION)
- // libcompression is weak linked so test if compression_decode_buffer() is
- // available
- if (compression_decode_buffer != NULL &&
- avail_type == CompressionType::None) {
+ if (avail_type == CompressionType::None) {
for (auto compression : supported_compressions) {
if (compression == "lzfse") {
avail_type = CompressionType::LZFSE;
@@ -1037,10 +1034,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
#endif
#if defined(HAVE_LIBCOMPRESSION)
- // libcompression is weak linked so test if compression_decode_buffer() is
- // available
- if (compression_decode_buffer != NULL &&
- avail_type == CompressionType::None) {
+ if (avail_type == CompressionType::None) {
for (auto compression : supported_compressions) {
if (compression == "zlib-deflate") {
avail_type = CompressionType::ZlibDeflate;
@@ -1064,10 +1058,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
#endif
#if defined(HAVE_LIBCOMPRESSION)
- // libcompression is weak linked so test if compression_decode_buffer() is
- // available
- if (compression_decode_buffer != NULL &&
- avail_type == CompressionType::None) {
+ if (avail_type == CompressionType::None) {
for (auto compression : supported_compressions) {
if (compression == "lz4") {
avail_type = CompressionType::LZ4;
@@ -1079,10 +1070,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
#endif
#if defined(HAVE_LIBCOMPRESSION)
- // libcompression is weak linked so test if compression_decode_buffer() is
- // available
- if (compression_decode_buffer != NULL &&
- avail_type == CompressionType::None) {
+ if (avail_type == CompressionType::None) {
for (auto compression : supported_compressions) {
if (compression == "lzma") {
avail_type = CompressionType::LZMA;
@@ -1601,21 +1589,24 @@ GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction(
// and we only want to override this behavior if we have explicitly
// received a qHostInfo telling us otherwise
if (m_qHostInfo_is_valid != eLazyBoolYes) {
- // On targets like MIPS, watchpoint exceptions are always generated
- // before the instruction is executed. The connected target may not
- // support qHostInfo or qWatchpointSupportInfo packets.
+ // On targets like MIPS and ppc64le, watchpoint exceptions are always
+ // generated before the instruction is executed. The connected target
+ // may not support qHostInfo or qWatchpointSupportInfo packets.
if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel ||
- atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el)
+ atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el ||
+ atype == llvm::Triple::ppc64le)
after = false;
else
after = true;
} else {
- // For MIPS, set m_watchpoints_trigger_after_instruction to eLazyBoolNo
- // if it is not calculated before.
- if (m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
- (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel ||
- atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el))
+ // For MIPS and ppc64le, set m_watchpoints_trigger_after_instruction to
+ // eLazyBoolNo if it is not calculated before.
+ if ((m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
+ (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel ||
+ atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el)) ||
+ atype == llvm::Triple::ppc64le) {
m_watchpoints_trigger_after_instruction = eLazyBoolNo;
+ }
after = (m_watchpoints_trigger_after_instruction != eLazyBoolNo);
}
@@ -2624,8 +2615,8 @@ size_t GDBRemoteCommunicationClient::GetCurrentThreadIDs(
* tid.
* Assume pid=tid=1 in such cases.
*/
- if (response.IsUnsupportedResponse() && thread_ids.size() == 0 &&
- IsConnected()) {
+ if ((response.IsUnsupportedResponse() || response.IsNormalResponse()) &&
+ thread_ids.size() == 0 && IsConnected()) {
thread_ids.push_back(1);
}
} else {
@@ -3451,7 +3442,9 @@ ParseModuleSpec(StructuredData::Dictionary *dict) {
if (!dict->GetValueForKeyAsString("uuid", string))
return llvm::None;
- result.GetUUID().SetFromStringRef(string, string.size());
+ if (result.GetUUID().SetFromStringRef(string, string.size() / 2) !=
+ string.size())
+ return llvm::None;
if (!dict->GetValueForKeyAsInteger("file_offset", integer))
return llvm::None;
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index 712d85eed082..ba67b8246398 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -20,10 +20,8 @@
#include <string>
#include <vector>
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/StreamGDBRemote.h"
#include "lldb/Utility/StructuredData.h"
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index f53db502be93..3cf6b8ac07b2 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -403,8 +403,8 @@ GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo(
match_info.SetMatchAllUsers(
Args::StringToBoolean(value, false, &success));
} else if (key.equals("triple")) {
- match_info.GetProcessInfo().GetArchitecture().SetTriple(
- value.str().c_str(), NULL);
+ match_info.GetProcessInfo().GetArchitecture() =
+ HostInfo::GetAugmentedArchSpec(value);
} else {
success = false;
}
@@ -973,8 +973,7 @@ GDBRemoteCommunicationServerCommon::Handle_QLaunchArch(
const uint32_t bytes_left = packet.GetBytesLeft();
if (bytes_left > 0) {
const char *arch_triple = packet.Peek();
- ArchSpec arch_spec(arch_triple, NULL);
- m_process_launch_info.SetArchitecture(arch_spec);
+ m_process_launch_info.SetArchitecture(HostInfo::GetAugmentedArchSpec(arch_triple));
return SendOKResponse();
}
return SendErrorResponse(13);
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 9294359dbef1..32741c2404e2 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -204,21 +204,8 @@ void GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() {
});
}
-Status
-GDBRemoteCommunicationServerLLGS::SetLaunchArguments(const char *const args[],
- int argc) {
- if ((argc < 1) || !args || !args[0] || !args[0][0])
- return Status("%s: no process command line specified to launch",
- __FUNCTION__);
-
- m_process_launch_info.SetArguments(const_cast<const char **>(args), true);
- return Status();
-}
-
-Status
-GDBRemoteCommunicationServerLLGS::SetLaunchFlags(unsigned int launch_flags) {
- m_process_launch_info.GetFlags().Set(launch_flags);
- return Status();
+void GDBRemoteCommunicationServerLLGS::SetLaunchInfo(const ProcessLaunchInfo &info) {
+ m_process_launch_info = info;
}
Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
@@ -244,13 +231,8 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
"process but one already exists");
auto process_or =
m_process_factory.Launch(m_process_launch_info, *this, m_mainloop);
- if (!process_or) {
- Status status(process_or.takeError());
- llvm::errs() << llvm::formatv(
- "failed to launch executable `{0}`: {1}",
- m_process_launch_info.GetArguments().GetArgumentAtIndex(0), status);
- return status;
- }
+ if (!process_or)
+ return Status(process_or.takeError());
m_debugged_process_up = std::move(*process_or);
}
@@ -396,12 +378,12 @@ static void AppendHexValue(StreamString &response, const uint8_t *buf,
}
static void WriteRegisterValueInHexFixedWidth(
- StreamString &response, NativeRegisterContextSP &reg_ctx_sp,
+ StreamString &response, NativeRegisterContext &reg_ctx,
const RegisterInfo &reg_info, const RegisterValue *reg_value_p,
lldb::ByteOrder byte_order) {
RegisterValue reg_value;
if (!reg_value_p) {
- Status error = reg_ctx_sp->ReadRegister(&reg_info, reg_value);
+ Status error = reg_ctx.ReadRegister(&reg_info, reg_value);
if (error.Success())
reg_value_p = &reg_value;
// else log.
@@ -423,9 +405,7 @@ static void WriteRegisterValueInHexFixedWidth(
static JSONObject::SP GetRegistersAsJSON(NativeThreadProtocol &thread) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
- NativeRegisterContextSP reg_ctx_sp = thread.GetRegisterContext();
- if (!reg_ctx_sp)
- return nullptr;
+ NativeRegisterContext& reg_ctx = thread.GetRegisterContext();
JSONObject::SP register_object_sp = std::make_shared<JSONObject>();
@@ -448,14 +428,14 @@ static JSONObject::SP GetRegistersAsJSON(NativeThreadProtocol &thread) {
for (const uint32_t *generic_reg_p = k_expedited_registers;
*generic_reg_p != LLDB_INVALID_REGNUM; ++generic_reg_p) {
- uint32_t reg_num = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(
+ uint32_t reg_num = reg_ctx.ConvertRegisterKindToRegisterNumber(
eRegisterKindGeneric, *generic_reg_p);
if (reg_num == LLDB_INVALID_REGNUM)
continue; // Target does not support the given register.
#endif
const RegisterInfo *const reg_info_p =
- reg_ctx_sp->GetRegisterInfoAtIndex(reg_num);
+ reg_ctx.GetRegisterInfoAtIndex(reg_num);
if (reg_info_p == nullptr) {
if (log)
log->Printf(
@@ -469,7 +449,7 @@ static JSONObject::SP GetRegistersAsJSON(NativeThreadProtocol &thread) {
// registers.
RegisterValue reg_value;
- Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value);
+ Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
if (error.Fail()) {
if (log)
log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s",
@@ -480,7 +460,7 @@ static JSONObject::SP GetRegistersAsJSON(NativeThreadProtocol &thread) {
}
StreamString stream;
- WriteRegisterValueInHexFixedWidth(stream, reg_ctx_sp, *reg_info_p,
+ WriteRegisterValueInHexFixedWidth(stream, reg_ctx, *reg_info_p,
&reg_value, lldb::eByteOrderBig);
register_object_sp->SetObject(
@@ -523,16 +503,16 @@ static JSONArray::SP GetJSONThreadsInfo(NativeProcessProtocol &process,
// Ensure we can get info on the given thread.
uint32_t thread_idx = 0;
- for (NativeThreadProtocolSP thread_sp;
- (thread_sp = process.GetThreadAtIndex(thread_idx)) != nullptr;
+ for (NativeThreadProtocol *thread;
+ (thread = process.GetThreadAtIndex(thread_idx)) != nullptr;
++thread_idx) {
- lldb::tid_t tid = thread_sp->GetID();
+ lldb::tid_t tid = thread->GetID();
// Grab the reason this thread stopped.
struct ThreadStopInfo tid_stop_info;
std::string description;
- if (!thread_sp->GetStopReason(tid_stop_info, description))
+ if (!thread->GetStopReason(tid_stop_info, description))
return nullptr;
const int signum = tid_stop_info.details.signal.signo;
@@ -548,7 +528,7 @@ static JSONArray::SP GetJSONThreadsInfo(NativeProcessProtocol &process,
threads_array_sp->AppendObject(thread_obj_sp);
if (!abridged) {
- if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread_sp))
+ if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread))
thread_obj_sp->SetObject("registers", registers_sp);
}
@@ -556,7 +536,7 @@ static JSONArray::SP GetJSONThreadsInfo(NativeProcessProtocol &process,
if (signum != 0)
thread_obj_sp->SetObject("signal", std::make_shared<JSONNumber>(signum));
- const std::string thread_name = thread_sp->GetName();
+ const std::string thread_name = thread->GetName();
if (!thread_name.empty())
thread_obj_sp->SetObject("name",
std::make_shared<JSONString>(thread_name));
@@ -604,14 +584,14 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
m_debugged_process_up->GetID(), tid);
// Ensure we can get info on the given thread.
- NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadByID(tid));
- if (!thread_sp)
+ NativeThreadProtocol *thread = m_debugged_process_up->GetThreadByID(tid);
+ if (!thread)
return SendErrorResponse(51);
// Grab the reason this thread stopped.
struct ThreadStopInfo tid_stop_info;
std::string description;
- if (!thread_sp->GetStopReason(tid_stop_info, description))
+ if (!thread->GetStopReason(tid_stop_info, description))
return SendErrorResponse(52);
// FIXME implement register handling for exec'd inferiors.
@@ -638,7 +618,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
response.Printf("thread:%" PRIx64 ";", tid);
// Include the thread name if there is one.
- const std::string thread_name = thread_sp->GetName();
+ const std::string thread_name = thread->GetName();
if (!thread_name.empty()) {
size_t thread_name_len = thread_name.length();
@@ -665,15 +645,13 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
response.PutCString("threads:");
uint32_t thread_index = 0;
- NativeThreadProtocolSP listed_thread_sp;
- for (listed_thread_sp =
- m_debugged_process_up->GetThreadAtIndex(thread_index);
- listed_thread_sp; ++thread_index,
- listed_thread_sp = m_debugged_process_up->GetThreadAtIndex(
- thread_index)) {
+ NativeThreadProtocol *listed_thread;
+ for (listed_thread = m_debugged_process_up->GetThreadAtIndex(thread_index);
+ listed_thread; ++thread_index,
+ listed_thread = m_debugged_process_up->GetThreadAtIndex(thread_index)) {
if (thread_index > 0)
response.PutChar(',');
- response.Printf("%" PRIx64, listed_thread_sp->GetID());
+ response.Printf("%" PRIx64, listed_thread->GetID());
}
response.PutChar(';');
@@ -701,20 +679,18 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
uint32_t i = 0;
response.PutCString("thread-pcs");
char delimiter = ':';
- for (NativeThreadProtocolSP thread_sp;
- (thread_sp = m_debugged_process_up->GetThreadAtIndex(i)) != nullptr;
+ for (NativeThreadProtocol *thread;
+ (thread = m_debugged_process_up->GetThreadAtIndex(i)) != nullptr;
++i) {
- NativeRegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext();
- if (!reg_ctx_sp)
- continue;
+ NativeRegisterContext& reg_ctx = thread->GetRegisterContext();
- uint32_t reg_to_read = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(
+ uint32_t reg_to_read = reg_ctx.ConvertRegisterKindToRegisterNumber(
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
const RegisterInfo *const reg_info_p =
- reg_ctx_sp->GetRegisterInfoAtIndex(reg_to_read);
+ reg_ctx.GetRegisterInfoAtIndex(reg_to_read);
RegisterValue reg_value;
- Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value);
+ Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
if (error.Fail()) {
if (log)
log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s",
@@ -727,7 +703,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
response.PutChar(delimiter);
delimiter = ',';
- WriteRegisterValueInHexFixedWidth(response, reg_ctx_sp, *reg_info_p,
+ WriteRegisterValueInHexFixedWidth(response, reg_ctx, *reg_info_p,
&reg_value, endian::InlHostByteOrder());
}
@@ -739,49 +715,48 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
//
// Grab the register context.
- NativeRegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext();
- if (reg_ctx_sp) {
- // Expedite all registers in the first register set (i.e. should be GPRs)
- // that are not contained in other registers.
- const RegisterSet *reg_set_p;
- if (reg_ctx_sp->GetRegisterSetCount() > 0 &&
- ((reg_set_p = reg_ctx_sp->GetRegisterSet(0)) != nullptr)) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s expediting registers "
- "from set '%s' (registers set count: %zu)",
- __FUNCTION__,
- reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
- reg_set_p->num_registers);
-
- for (const uint32_t *reg_num_p = reg_set_p->registers;
- *reg_num_p != LLDB_INVALID_REGNUM; ++reg_num_p) {
- const RegisterInfo *const reg_info_p =
- reg_ctx_sp->GetRegisterInfoAtIndex(*reg_num_p);
- if (reg_info_p == nullptr) {
+ NativeRegisterContext& reg_ctx = thread->GetRegisterContext();
+ // Expedite all registers in the first register set (i.e. should be GPRs)
+ // that are not contained in other registers.
+ const RegisterSet *reg_set_p;
+ if (reg_ctx.GetRegisterSetCount() > 0 &&
+ ((reg_set_p = reg_ctx.GetRegisterSet(0)) != nullptr)) {
+ if (log)
+ log->Printf("GDBRemoteCommunicationServerLLGS::%s expediting registers "
+ "from set '%s' (registers set count: %zu)",
+ __FUNCTION__,
+ reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
+ reg_set_p->num_registers);
+
+ for (const uint32_t *reg_num_p = reg_set_p->registers;
+ *reg_num_p != LLDB_INVALID_REGNUM; ++reg_num_p) {
+ const RegisterInfo *const reg_info_p =
+ reg_ctx.GetRegisterInfoAtIndex(*reg_num_p);
+ if (reg_info_p == nullptr) {
+ if (log)
+ log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to get "
+ "register info for register set '%s', register index "
+ "%" PRIu32,
+ __FUNCTION__,
+ reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
+ *reg_num_p);
+ } else if (reg_info_p->value_regs == nullptr) {
+ // Only expediate registers that are not contained in other registers.
+ RegisterValue reg_value;
+ Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
+ if (error.Success()) {
+ response.Printf("%.02x:", *reg_num_p);
+ WriteRegisterValueInHexFixedWidth(response, reg_ctx, *reg_info_p,
+ &reg_value, lldb::eByteOrderBig);
+ response.PutChar(';');
+ } else {
if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to get "
- "register info for register set '%s', register index "
- "%" PRIu32,
+ log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to read "
+ "register '%s' index %" PRIu32 ": %s",
__FUNCTION__,
- reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
- *reg_num_p);
- } else if (reg_info_p->value_regs == nullptr) {
- // Only expediate registers that are not contained in other registers.
- RegisterValue reg_value;
- Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value);
- if (error.Success()) {
- response.Printf("%.02x:", *reg_num_p);
- WriteRegisterValueInHexFixedWidth(response, reg_ctx_sp, *reg_info_p,
- &reg_value, lldb::eByteOrderBig);
- response.PutChar(';');
- } else {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to read "
- "register '%s' index %" PRIu32 ": %s",
- __FUNCTION__, reg_info_p->name ? reg_info_p->name
- : "<unnamed-register>",
- *reg_num_p, error.AsCString());
- }
+ reg_info_p->name ? reg_info_p->name
+ : "<unnamed-register>",
+ *reg_num_p, error.AsCString());
}
}
}
@@ -837,6 +812,7 @@ void GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited(
// We are ready to exit the debug monitor.
m_exit_now = true;
+ m_mainloop.RequestTermination();
}
void GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped(
@@ -1316,12 +1292,12 @@ GDBRemoteCommunicationServerLLGS::Handle_qC(StringExtractorGDBRemote &packet) {
lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID();
SetCurrentThreadID(tid);
- NativeThreadProtocolSP thread_sp = m_debugged_process_up->GetCurrentThread();
- if (!thread_sp)
+ NativeThreadProtocol *thread = m_debugged_process_up->GetCurrentThread();
+ if (!thread)
return SendErrorResponse(69);
StreamString response;
- response.Printf("QC%" PRIx64, thread_sp->GetID());
+ response.Printf("QC%" PRIx64, thread->GetID());
return SendPacketNoLock(response.GetString());
}
@@ -1692,14 +1668,12 @@ GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(
return SendErrorResponse(68);
// Ensure we have a thread.
- NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadAtIndex(0));
- if (!thread_sp)
+ NativeThreadProtocol *thread = m_debugged_process_up->GetThreadAtIndex(0);
+ if (!thread)
return SendErrorResponse(69);
// Get the register context for the first thread.
- NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
- if (!reg_context_sp)
- return SendErrorResponse(69);
+ NativeRegisterContext &reg_context = thread->GetRegisterContext();
// Parse out the register number from the request.
packet.SetFilePos(strlen("qRegisterInfo"));
@@ -1710,11 +1684,10 @@ GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(
// Return the end of registers response if we've iterated one past the end of
// the register set.
- if (reg_index >= reg_context_sp->GetUserRegisterCount())
+ if (reg_index >= reg_context.GetUserRegisterCount())
return SendErrorResponse(69);
- const RegisterInfo *reg_info =
- reg_context_sp->GetRegisterInfoAtIndex(reg_index);
+ const RegisterInfo *reg_info = reg_context.GetRegisterInfoAtIndex(reg_index);
if (!reg_info)
return SendErrorResponse(69);
@@ -1796,7 +1769,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(
};
const char *const register_set_name =
- reg_context_sp->GetRegisterSetNameForRegisterAtIndex(reg_index);
+ reg_context.GetRegisterSetNameForRegisterAtIndex(reg_index);
if (register_set_name) {
response.PutCString("set:");
response.PutCString(register_set_name);
@@ -1908,18 +1881,17 @@ GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo(
response.PutChar('m');
LLDB_LOG(log, "starting thread iteration");
- NativeThreadProtocolSP thread_sp;
+ NativeThreadProtocol *thread;
uint32_t thread_index;
for (thread_index = 0,
- thread_sp = m_debugged_process_up->GetThreadAtIndex(thread_index);
- thread_sp; ++thread_index,
- thread_sp = m_debugged_process_up->GetThreadAtIndex(thread_index)) {
- LLDB_LOG(log, "iterated thread {0}({1}, tid={2})", thread_index,
- thread_sp ? "is not null" : "null",
- thread_sp ? thread_sp->GetID() : LLDB_INVALID_THREAD_ID);
+ thread = m_debugged_process_up->GetThreadAtIndex(thread_index);
+ thread; ++thread_index,
+ thread = m_debugged_process_up->GetThreadAtIndex(thread_index)) {
+ LLDB_LOG(log, "iterated thread {0}(tid={2})", thread_index,
+ thread->GetID());
if (thread_index > 0)
response.PutChar(',');
- response.Printf("%" PRIx64, thread_sp->GetID());
+ response.Printf("%" PRIx64, thread->GetID());
}
LLDB_LOG(log, "finished thread iteration");
@@ -1951,38 +1923,27 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
}
// Get the thread to use.
- NativeThreadProtocolSP thread_sp = GetThreadFromSuffix(packet);
- if (!thread_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s failed, no thread available",
- __FUNCTION__);
+ NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
+ if (!thread) {
+ LLDB_LOG(log, "failed, no thread available");
return SendErrorResponse(0x15);
}
// Get the thread's register context.
- NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
- if (!reg_context_sp) {
- LLDB_LOG(
- log,
- "pid {0} tid {1} failed, no register context available for the thread",
- m_debugged_process_up->GetID(), thread_sp->GetID());
- return SendErrorResponse(0x15);
- }
+ NativeRegisterContext &reg_context = thread->GetRegisterContext();
// Return the end of registers response if we've iterated one past the end of
// the register set.
- if (reg_index >= reg_context_sp->GetUserRegisterCount()) {
+ if (reg_index >= reg_context.GetUserRegisterCount()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
"register %" PRIu32 " beyond register count %" PRIu32,
__FUNCTION__, reg_index,
- reg_context_sp->GetUserRegisterCount());
+ reg_context.GetUserRegisterCount());
return SendErrorResponse(0x15);
}
- const RegisterInfo *reg_info =
- reg_context_sp->GetRegisterInfoAtIndex(reg_index);
+ const RegisterInfo *reg_info = reg_context.GetRegisterInfoAtIndex(reg_index);
if (!reg_info) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
@@ -1996,7 +1957,7 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
// Retrieve the value
RegisterValue reg_value;
- Status error = reg_context_sp->ReadRegister(reg_info, reg_value);
+ Status error = reg_context.ReadRegister(reg_info, reg_value);
if (error.Fail()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, read of "
@@ -2047,24 +2008,13 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
return SendIllFormedResponse(
packet, "P packet missing '=' char after register number");
- // Get process architecture.
- ArchSpec process_arch;
- if (!m_debugged_process_up ||
- !m_debugged_process_up->GetArchitecture(process_arch)) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to retrieve "
- "inferior architecture",
- __FUNCTION__);
- return SendErrorResponse(0x49);
- }
-
// Parse out the value.
uint8_t reg_bytes[32]; // big enough to support up to 256 bit ymmN register
size_t reg_size = packet.GetHexBytesAvail(reg_bytes);
// Get the thread to use.
- NativeThreadProtocolSP thread_sp = GetThreadFromSuffix(packet);
- if (!thread_sp) {
+ NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
+ if (!thread) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, no thread "
"available (thread index 0)",
@@ -2073,18 +2023,8 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
}
// Get the thread's register context.
- NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
- if (!reg_context_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 " tid %" PRIu64
- " failed, no register context available for the thread",
- __FUNCTION__, m_debugged_process_up->GetID(), thread_sp->GetID());
- return SendErrorResponse(0x15);
- }
-
- const RegisterInfo *reg_info =
- reg_context_sp->GetRegisterInfoAtIndex(reg_index);
+ NativeRegisterContext &reg_context = thread->GetRegisterContext();
+ const RegisterInfo *reg_info = reg_context.GetRegisterInfoAtIndex(reg_index);
if (!reg_info) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
@@ -2095,12 +2035,11 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
// Return the end of registers response if we've iterated one past the end of
// the register set.
- if (reg_index >= reg_context_sp->GetUserRegisterCount()) {
+ if (reg_index >= reg_context.GetUserRegisterCount()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
"register %" PRIu32 " beyond register count %" PRIu32,
- __FUNCTION__, reg_index,
- reg_context_sp->GetUserRegisterCount());
+ __FUNCTION__, reg_index, reg_context.GetUserRegisterCount());
return SendErrorResponse(0x47);
}
@@ -2115,8 +2054,10 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
// Build the reginfos response.
StreamGDBRemote response;
- RegisterValue reg_value(reg_bytes, reg_size, process_arch.GetByteOrder());
- Status error = reg_context_sp->WriteRegister(reg_info, reg_value);
+ RegisterValue reg_value(
+ reg_bytes, reg_size,
+ m_debugged_process_up->GetArchitecture().GetByteOrder());
+ Status error = reg_context.WriteRegister(reg_info, reg_value);
if (error.Fail()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, write of "
@@ -2177,8 +2118,8 @@ GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) {
// Ensure we have the given thread when not specifying -1 (all threads) or 0
// (any thread).
if (tid != LLDB_INVALID_THREAD_ID && tid != 0) {
- NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadByID(tid));
- if (!thread_sp) {
+ NativeThreadProtocol *thread = m_debugged_process_up->GetThreadByID(tid);
+ if (!thread) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, tid %" PRIu64
" not found",
@@ -2739,8 +2680,8 @@ GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) {
// Double check that we have such a thread.
// TODO investigate: on MacOSX we might need to do an UpdateThreads () here.
- NativeThreadProtocolSP thread_sp = m_debugged_process_up->GetThreadByID(tid);
- if (!thread_sp || thread_sp->GetID() != tid)
+ NativeThreadProtocol *thread = m_debugged_process_up->GetThreadByID(tid);
+ if (!thread)
return SendErrorResponse(0x33);
// Create the step action for the given thread.
@@ -2865,8 +2806,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(
packet.SetFilePos(strlen("QSaveRegisterState"));
// Get the thread to use.
- NativeThreadProtocolSP thread_sp = GetThreadFromSuffix(packet);
- if (!thread_sp) {
+ NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
+ if (!thread) {
if (m_thread_suffix_supported)
return SendIllFormedResponse(
packet, "No thread specified in QSaveRegisterState packet");
@@ -2876,18 +2817,11 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(
}
// Grab the register context for the thread.
- NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
- if (!reg_context_sp) {
- LLDB_LOG(
- log,
- "pid {0} tid {1} failed, no register context available for the thread",
- m_debugged_process_up->GetID(), thread_sp->GetID());
- return SendErrorResponse(0x15);
- }
+ NativeRegisterContext& reg_context = thread->GetRegisterContext();
// Save registers to a buffer.
DataBufferSP register_data_sp;
- Status error = reg_context_sp->ReadAllRegisterValues(register_data_sp);
+ Status error = reg_context.ReadAllRegisterValues(register_data_sp);
if (error.Fail()) {
LLDB_LOG(log, "pid {0} failed to save all register values: {1}",
m_debugged_process_up->GetID(), error);
@@ -2930,8 +2864,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
}
// Get the thread to use.
- NativeThreadProtocolSP thread_sp = GetThreadFromSuffix(packet);
- if (!thread_sp) {
+ NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
+ if (!thread) {
if (m_thread_suffix_supported)
return SendIllFormedResponse(
packet, "No thread specified in QRestoreRegisterState packet");
@@ -2941,14 +2875,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
}
// Grab the register context for the thread.
- NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
- if (!reg_context_sp) {
- LLDB_LOG(
- log,
- "pid {0} tid {1} failed, no register context available for the thread",
- m_debugged_process_up->GetID(), thread_sp->GetID());
- return SendErrorResponse(0x15);
- }
+ NativeRegisterContext &reg_context = thread->GetRegisterContext();
// Retrieve register state buffer, then remove from the list.
DataBufferSP register_data_sp;
@@ -2969,7 +2896,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
m_saved_registers_map.erase(it);
}
- Status error = reg_context_sp->WriteAllRegisterValues(register_data_sp);
+ Status error = reg_context.WriteAllRegisterValues(register_data_sp);
if (error.Fail()) {
LLDB_LOG(log, "pid {0} failed to restore all register values: {1}",
m_debugged_process_up->GetID(), error);
@@ -3219,14 +3146,12 @@ void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() {
}
}
-NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
+NativeThreadProtocol *GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
StringExtractorGDBRemote &packet) {
- NativeThreadProtocolSP thread_sp;
-
// We have no thread if we don't have a process.
if (!m_debugged_process_up ||
m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)
- return thread_sp;
+ return nullptr;
// If the client hasn't asked for thread suffix support, there will not be a
// thread suffix.
@@ -3234,7 +3159,7 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
if (!m_thread_suffix_supported) {
const lldb::tid_t current_tid = GetCurrentThreadID();
if (current_tid == LLDB_INVALID_THREAD_ID)
- return thread_sp;
+ return nullptr;
else if (current_tid == 0) {
// Pick a thread.
return m_debugged_process_up->GetThreadAtIndex(0);
@@ -3251,11 +3176,11 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
"error: expected ';' prior to start of thread suffix: packet "
"contents = '%s'",
__FUNCTION__, packet.GetStringRef().c_str());
- return thread_sp;
+ return nullptr;
}
if (!packet.GetBytesLeft())
- return thread_sp;
+ return nullptr;
// Parse out thread: portion.
if (strncmp(packet.Peek(), "thread:", strlen("thread:")) != 0) {
@@ -3264,14 +3189,14 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
"error: expected 'thread:' but not found, packet contents = "
"'%s'",
__FUNCTION__, packet.GetStringRef().c_str());
- return thread_sp;
+ return nullptr;
}
packet.SetFilePos(packet.GetFilePos() + strlen("thread:"));
const lldb::tid_t tid = packet.GetHexMaxU64(false, 0);
if (tid != 0)
return m_debugged_process_up->GetThreadByID(tid);
- return thread_sp;
+ return nullptr;
}
lldb::tid_t GDBRemoteCommunicationServerLLGS::GetCurrentThreadID() const {
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
index 71199473bb8e..5a74d1acaa23 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -43,32 +43,7 @@ public:
MainLoop &mainloop,
const NativeProcessProtocol::Factory &process_factory);
- //------------------------------------------------------------------
- /// Specify the program to launch and its arguments.
- ///
- /// @param[in] args
- /// The command line to launch.
- ///
- /// @param[in] argc
- /// The number of elements in the args array of cstring pointers.
- ///
- /// @return
- /// An Status object indicating the success or failure of making
- /// the setting.
- //------------------------------------------------------------------
- Status SetLaunchArguments(const char *const args[], int argc);
-
- //------------------------------------------------------------------
- /// Specify the launch flags for the process.
- ///
- /// @param[in] launch_flags
- /// The launch flags to use when launching this process.
- ///
- /// @return
- /// An Status object indicating the success or failure of making
- /// the setting.
- //------------------------------------------------------------------
- Status SetLaunchFlags(unsigned int launch_flags);
+ void SetLaunchInfo(const ProcessLaunchInfo &info);
//------------------------------------------------------------------
/// Launch a process with the current launch settings.
@@ -234,7 +209,7 @@ private:
void HandleInferiorState_Stopped(NativeProcessProtocol *process);
- NativeThreadProtocolSP GetThreadFromSuffix(StringExtractorGDBRemote &packet);
+ NativeThreadProtocol *GetThreadFromSuffix(StringExtractorGDBRemote &packet);
uint32_t GetNextSavedRegistersID();
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 977c34c2a69b..04ed9d704e13 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -128,8 +128,9 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
llvm::StringRef platform_ip;
int platform_port;
llvm::StringRef platform_path;
- bool ok = UriParser::Parse(GetConnection()->GetURI(), platform_scheme,
- platform_ip, platform_port, platform_path);
+ std::string platform_uri = GetConnection()->GetURI();
+ bool ok = UriParser::Parse(platform_uri, platform_scheme, platform_ip,
+ platform_port, platform_path);
UNUSED_IF_ASSERT_DISABLED(ok);
assert(ok);
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 612c7144451e..e418deee01f3 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -178,7 +178,7 @@ bool GDBRemoteRegisterContext::GetPrimordialRegister(
const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) {
const uint32_t lldb_reg = reg_info->kinds[eRegisterKindLLDB];
const uint32_t remote_reg = reg_info->kinds[eRegisterKindProcessPlugin];
- StringExtractorGDBRemote response;
+
if (DataBufferSP buffer_sp =
gdb_comm.ReadRegister(m_thread.GetProtocolID(), remote_reg))
return PrivateSetRegisterValue(
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index be11dd9bc7ec..35d02c15ab85 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -29,7 +29,6 @@
#include <sstream>
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -244,7 +243,7 @@ bool ProcessGDBRemote::CanDebug(lldb::TargetSP target_sp,
//----------------------------------------------------------------------
ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp,
ListenerSP listener_sp)
- : Process(target_sp, listener_sp), m_flags(0), m_gdb_comm(),
+ : Process(target_sp, listener_sp),
m_debugserver_pid(LLDB_INVALID_PROCESS_ID), m_last_stop_packet_mutex(),
m_register_info(),
m_async_broadcaster(NULL, "lldb.process.gdb-remote.async-broadcaster"),
@@ -818,7 +817,7 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_module,
if (object_file) {
error = EstablishConnectionIfNeeded(launch_info);
if (error.Success()) {
- lldb_utility::PseudoTerminal pty;
+ PseudoTerminal pty;
const bool disable_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0;
PlatformSP platform_sp(GetTarget().GetPlatform());
@@ -947,8 +946,7 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_module,
SetPrivateState(SetThreadStopInfo(response));
if (!disable_stdio) {
- if (pty.GetMasterFileDescriptor() !=
- lldb_utility::PseudoTerminal::invalid_fd)
+ if (pty.GetMasterFileDescriptor() != PseudoTerminal::invalid_fd)
SetSTDIOFileDescriptor(pty.ReleaseMasterFileDescriptor());
}
}
@@ -3255,7 +3253,6 @@ Status ProcessGDBRemote::DisableWatchpoint(Watchpoint *wp, bool notify) {
}
void ProcessGDBRemote::Clear() {
- m_flags = 0;
m_thread_list_real.Clear();
m_thread_list.Clear();
}
@@ -3289,7 +3286,7 @@ ProcessGDBRemote::EstablishConnectionIfNeeded(const ProcessInfo &process_info) {
}
return error;
}
-#if defined(__APPLE__)
+#if !defined(_WIN32)
#define USE_SOCKETPAIR_FOR_LOCAL_CONNECTION 1
#endif
@@ -3333,8 +3330,8 @@ Status ProcessGDBRemote::LaunchAndConnectToDebugserver(
lldb_utility::CleanUp<int, int> our_socket(-1, -1, close);
lldb_utility::CleanUp<int, int> gdb_socket(-1, -1, close);
- // Use a socketpair on Apple for now until other platforms can verify it
- // works and is fast enough
+ // Use a socketpair on non-Windows systems for security and performance
+ // reasons.
{
int sockets[2]; /* the pair of socket descriptors */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) == -1) {
@@ -4168,7 +4165,6 @@ struct GdbServerTargetInfo {
std::string osabi;
stringVec includes;
RegisterSetMap reg_set_map;
- XMLNode feature_node;
};
bool ParseRegisters(XMLNode feature_node, GdbServerTargetInfo &target_info,
@@ -4374,8 +4370,8 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
XMLNode target_node = xml_document.GetRootElement("target");
if (target_node) {
- XMLNode feature_node;
- target_node.ForEachChildElement([&target_info, &feature_node](
+ std::vector<XMLNode> feature_nodes;
+ target_node.ForEachChildElement([&target_info, &feature_nodes](
const XMLNode &node) -> bool {
llvm::StringRef name = node.GetName();
if (name == "architecture") {
@@ -4387,7 +4383,7 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
if (!href.empty())
target_info.includes.push_back(href.str());
} else if (name == "feature") {
- feature_node = node;
+ feature_nodes.push_back(node);
} else if (name == "groups") {
node.ForEachChildElementWithName(
"group", [&target_info](const XMLNode &node) -> bool {
@@ -4423,7 +4419,7 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
// set the Target's architecture yet, so the ABI is also potentially
// incorrect.
ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), arch_to_use);
- if (feature_node) {
+ for (auto &feature_node : feature_nodes) {
ParseRegisters(feature_node, target_info, this->m_register_info,
abi_to_use_sp, cur_reg_num, reg_offset);
}
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 54a472d7332e..42d1c4ecd666 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -18,9 +18,6 @@
#include <string>
#include <vector>
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/LoadedModuleInfoList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -28,6 +25,7 @@
#include "lldb/Host/HostThread.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamGDBRemote.h"
@@ -263,7 +261,6 @@ protected:
eBroadcastBitAsyncThreadDidExit = (1 << 2)
};
- Flags m_flags; // Process specific flags (see eFlags enums)
GDBRemoteCommunicationClient m_gdb_comm;
std::atomic<lldb::pid_t> m_debugserver_pid;
std::vector<StringExtractorGDBRemote> m_stop_packet_stack; // The stop packet
@@ -324,10 +321,6 @@ protected:
void Clear();
- Flags &GetFlags() { return m_flags; }
-
- const Flags &GetFlags() const { return m_flags; }
-
bool UpdateThreadList(ThreadList &old_thread_list,
ThreadList &new_thread_list) override;
diff --git a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 5197e8f9adfc..27dd03bfc7bc 100644
--- a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -10,7 +10,6 @@
#include "ThreadGDBRemote.h"
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
diff --git a/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index a6178500dfc5..d21651b77ee0 100644
--- a/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -468,7 +468,7 @@ Status ProcessMachCore::DoLoadCore() {
// it to match the core file which is always single arch.
ArchSpec arch(m_core_module_sp->GetArchitecture());
if (arch.GetCore() == ArchSpec::eCore_x86_32_i486) {
- arch.SetTriple("i386", GetTarget().GetPlatform().get());
+ arch = Platform::GetAugmentedArchSpec(GetTarget().GetPlatform().get(), "i386");
}
if (arch.IsValid())
GetTarget().SetArchitecture(arch);
diff --git a/source/Plugins/Process/mach-core/ThreadMachCore.cpp b/source/Plugins/Process/mach-core/ThreadMachCore.cpp
index 3917b99bd63d..2b44105c13b1 100644
--- a/source/Plugins/Process/mach-core/ThreadMachCore.cpp
+++ b/source/Plugins/Process/mach-core/ThreadMachCore.cpp
@@ -12,7 +12,6 @@
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
@@ -20,6 +19,7 @@
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Unwind.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/StreamString.h"
diff --git a/source/Plugins/Process/minidump/MinidumpParser.h b/source/Plugins/Process/minidump/MinidumpParser.h
index df6deb482afd..b7329ffc0028 100644
--- a/source/Plugins/Process/minidump/MinidumpParser.h
+++ b/source/Plugins/Process/minidump/MinidumpParser.h
@@ -14,8 +14,7 @@
// Project includes
#include "MinidumpTypes.h"
-// Other libraries and framework includes
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/Status.h"
diff --git a/source/Plugins/Process/minidump/ProcessMinidump.h b/source/Plugins/Process/minidump/ProcessMinidump.h
index d5c46be97352..4b91d1ba396a 100644
--- a/source/Plugins/Process/minidump/ProcessMinidump.h
+++ b/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -82,6 +82,14 @@ public:
bool GetProcessInfo(ProcessInstanceInfo &info) override;
+ Status WillResume() override {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support resuming processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
MinidumpParser m_minidump_parser;
protected:
diff --git a/source/Plugins/Process/minidump/ThreadMinidump.cpp b/source/Plugins/Process/minidump/ThreadMinidump.cpp
index 9c21cc92376f..3fafb6134e7f 100644
--- a/source/Plugins/Process/minidump/ThreadMinidump.cpp
+++ b/source/Plugins/Process/minidump/ThreadMinidump.cpp
@@ -17,8 +17,8 @@
// Other libraries and framework includes
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
-
#include "Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h"
+#include "Plugins/Process/elf-core/RegisterUtilities.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
@@ -43,8 +43,6 @@ ThreadMinidump::~ThreadMinidump() {}
void ThreadMinidump::RefreshStateAfterStop() {}
-void ThreadMinidump::ClearStackFrames() {}
-
RegisterContextSP ThreadMinidump::GetRegisterContext() {
if (!m_reg_context_sp) {
m_reg_context_sp = CreateRegisterContextForFrame(nullptr);
@@ -76,20 +74,18 @@ ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) {
reg_interface = new RegisterContextLinux_i386(arch);
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_32(m_gpregset_data, reg_interface);
- DataExtractor gpregs(buf, lldb::eByteOrderLittle, 4);
- DataExtractor fpregs;
+ DataExtractor gpregset(buf, lldb::eByteOrderLittle, 4);
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, gpregs, fpregs));
+ *this, reg_interface, gpregset, {}));
break;
}
case llvm::Triple::x86_64: {
reg_interface = new RegisterContextLinux_x86_64(arch);
lldb::DataBufferSP buf =
ConvertMinidumpContext_x86_64(m_gpregset_data, reg_interface);
- DataExtractor gpregs(buf, lldb::eByteOrderLittle, 8);
- DataExtractor fpregs;
+ DataExtractor gpregset(buf, lldb::eByteOrderLittle, 8);
m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64(
- *this, reg_interface, gpregs, fpregs));
+ *this, reg_interface, gpregset, {}));
break;
}
default:
diff --git a/source/Plugins/Process/minidump/ThreadMinidump.h b/source/Plugins/Process/minidump/ThreadMinidump.h
index 97db452edfff..74ac44f74dcf 100644
--- a/source/Plugins/Process/minidump/ThreadMinidump.h
+++ b/source/Plugins/Process/minidump/ThreadMinidump.h
@@ -37,8 +37,6 @@ public:
lldb::RegisterContextSP
CreateRegisterContextForFrame(StackFrame *frame) override;
- void ClearStackFrames() override;
-
protected:
lldb::RegisterContextSP m_thread_reg_ctx_sp;
llvm::ArrayRef<uint8_t> m_gpregset_data;
diff --git a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index f1450c31b36b..8424b55ee69c 100644
--- a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -857,36 +857,6 @@ protected:
*static_cast<StructuredDataDarwinLog *>(plugin_sp.get());
if (m_enable) {
-// To do this next part right, we need to track whether we
-// added the proper environment variable at launch time.
-// It is incorrect to assume that we're enabling after launch,
-// and that therefore if we needed the env var set to properly
-// handle the options, that it is set incorrectly. The env var
-// could have been added if this is a re-enable using different
-// arguments. This is a bit tricky as the point where we
-// have to set the env var, we don't yet have a process or the
-// associated darwin-log plugin instance, and thus don't have a
-// great place to stick this knowledge.
-#if 0
- // Check if we're attempting to disable debug-level or
- // info-level content but we haven't launched with the magic
- // env var that suppresses the "always add" of those. In
- // that scenario, the user is asking *not* to see debug or
- // info level messages, but will see them anyway. Warn and
- // show how to correct it.
- if (!m_options_sp->GetIncludeDebugLevel() &&
- !GetGlobalProperties()->GetUseStrictSources())
- {
- AppendStrictSourcesWarning(result, "debug-level");
- }
-
- if (!m_options_sp->GetIncludeInfoLevel() &&
- !GetGlobalProperties()->GetUseStrictSources())
- {
- AppendStrictSourcesWarning(result, "info-level");
- }
-#endif
-
// Hook up the breakpoint for the process that detects when
// libtrace has been sufficiently initialized to really start
// the os_log stream. This is insurance to assure us that
@@ -1823,34 +1793,10 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream,
if (header_count > 0)
stream.PutChar(',');
-// Switch over to the #if 0 branch once we figure out
-// how we want to present settings for the tri-state of
-// no-activity, activity (most derived only), or activity-chain.
-#if 1
// Display the activity chain, from parent-most to child-most
// activity, separated by a colon (:).
stream.PutCString("activity-chain=");
stream.PutCString(activity_chain);
-#else
- if (GetGlobalProperties()->GetDisplayActivityChain()) {
- // Display the activity chain, from parent-most to child-most
- // activity, separated by a colon (:).
- stream.PutCString("activity-chain=");
- stream.PutCString(activity_chain.c_str());
- } else {
- // We're only displaying the child-most activity.
- stream.PutCString("activity=");
- auto pos = activity_chain.find_last_of(':');
- if (pos == std::string::npos) {
- // The activity chain only has one level, use the whole
- // thing.
- stream.PutCString(activity_chain.c_str());
- } else {
- // Display everything after the final ':'.
- stream.PutCString(activity_chain.substr(pos + 1).c_str());
- }
- }
-#endif
++header_count;
}
}
diff --git a/source/Plugins/SymbolFile/DWARF/CMakeLists.txt b/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index fb468440f9e0..05d9e6642868 100644
--- a/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -30,6 +30,8 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
NameToDIE.cpp
SymbolFileDWARF.cpp
SymbolFileDWARFDwo.cpp
+ SymbolFileDWARFDwoDwp.cpp
+ SymbolFileDWARFDwp.cpp
SymbolFileDWARFDebugMap.cpp
UniqueDWARFASTType.cpp
@@ -47,5 +49,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
lldbPluginCPlusPlusLanguage
lldbPluginExpressionParserClang
LINK_COMPONENTS
+ DebugInfoDWARF
Support
)
diff --git a/source/Plugins/SymbolFile/DWARF/DIERef.cpp b/source/Plugins/SymbolFile/DWARF/DIERef.cpp
index 5ed9c6ab7282..c05444c031e6 100644
--- a/source/Plugins/SymbolFile/DWARF/DIERef.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DIERef.cpp
@@ -65,7 +65,7 @@ lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const {
//
// SymbolFileDWARFDwo sets the ID to the compile unit offset.
//----------------------------------------------------------------------
- if (dwarf)
+ if (dwarf && die_offset != DW_INVALID_OFFSET)
return dwarf->GetID() | die_offset;
else
return LLDB_INVALID_UID;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index f5418763d67b..6ae2b225d869 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -786,7 +786,17 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
m_ast.ParseClassTemplateDecl(decl_ctx, accessibility,
type_name_cstr, tag_decl_kind,
template_param_infos);
-
+ if (!class_template_decl) {
+ if (log) {
+ dwarf->GetObjectFile()->GetModule()->LogMessage(
+ log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" "
+ "clang::ClassTemplateDecl failed to return a decl.",
+ static_cast<void *>(this), die.GetOffset(),
+ DW_TAG_value_to_name(tag), type_name_cstr);
+ }
+ return TypeSP();
+ }
+
clang::ClassTemplateSpecializationDecl
*class_specialization_decl =
m_ast.CreateClassTemplateSpecializationDecl(
@@ -927,6 +937,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
// Set a bit that lets us know that we are currently parsing this
dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED;
+ bool is_scoped = false;
DWARFFormValue encoding_form;
const size_t num_attributes = die.GetAttributes(attributes);
@@ -963,6 +974,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
case DW_AT_declaration:
is_forward_declaration = form_value.Boolean();
break;
+ case DW_AT_enum_class:
+ is_scoped = form_value.Boolean();
+ break;
case DW_AT_allocated:
case DW_AT_associated:
case DW_AT_bit_stride:
@@ -1052,7 +1066,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
clang_type = m_ast.CreateEnumerationType(
type_name_cstr, GetClangDeclContextContainingDIE(die, nullptr),
- decl, enumerator_clang_type);
+ decl, enumerator_clang_type, is_scoped);
} else {
enumerator_clang_type =
m_ast.GetEnumerationIntegerType(clang_type.GetOpaqueQualType());
@@ -2741,8 +2755,6 @@ bool DWARFASTParserClang::ParseChildMembers(
form_value.BlockData() - debug_info_data.GetDataStart();
if (DWARFExpression::Evaluate(
nullptr, // ExecutionContext *
- nullptr, // ClangExpressionVariableList *
- nullptr, // ClangExpressionDeclMap *
nullptr, // RegisterContext *
module_sp, debug_info_data, die.GetCU(), block_offset,
block_length, eRegisterKindDWARF, &initialValue,
@@ -3214,11 +3226,11 @@ bool DWARFASTParserClang::ParseChildMembers(
uint32_t block_length = form_value.Unsigned();
uint32_t block_offset =
form_value.BlockData() - debug_info_data.GetDataStart();
- if (DWARFExpression::Evaluate(
- nullptr, nullptr, nullptr, nullptr, module_sp,
- debug_info_data, die.GetCU(), block_offset,
- block_length, eRegisterKindDWARF, &initialValue,
- nullptr, memberOffset, nullptr)) {
+ if (DWARFExpression::Evaluate(nullptr, nullptr, module_sp,
+ debug_info_data, die.GetCU(),
+ block_offset, block_length,
+ eRegisterKindDWARF, &initialValue,
+ nullptr, memberOffset, nullptr)) {
member_byte_offset = memberOffset.ResolveValue(NULL).UInt();
}
} else {
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
index 2507465750c7..e04dc76d1dbe 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
@@ -662,8 +662,6 @@ size_t DWARFASTParserGo::ParseChildMembers(const SymbolContext &sc,
form_value.BlockData() - debug_info_data.GetDataStart();
if (DWARFExpression::Evaluate(
NULL, // ExecutionContext *
- NULL, // ClangExpressionVariableList *
- NULL, // ClangExpressionDeclMap *
NULL, // RegisterContext *
module_sp, debug_info_data, die.GetCU(), block_offset,
block_length, eRegisterKindDWARF, &initialValue, NULL,
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 79b2acc4b4f3..5d7b12067263 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -39,68 +39,48 @@ using namespace std;
extern int g_verbose;
DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
- : m_dwarf2Data(dwarf2Data), m_abbrevs(NULL), m_user_data(NULL),
- m_die_array(), m_func_aranges_ap(), m_base_addr(0),
- m_offset(DW_INVALID_OFFSET), m_length(0), m_version(0),
- m_addr_size(DWARFCompileUnit::GetDefaultAddressSize()),
- m_producer(eProducerInvalid), m_producer_version_major(0),
- m_producer_version_minor(0), m_producer_version_update(0),
- m_language_type(eLanguageTypeUnknown), m_is_dwarf64(false),
- m_is_optimized(eLazyBoolCalculate), m_addr_base(0),
- m_ranges_base(0), m_base_obj_offset(DW_INVALID_OFFSET) {}
+ : m_dwarf2Data(dwarf2Data) {}
DWARFCompileUnit::~DWARFCompileUnit() {}
-void DWARFCompileUnit::Clear() {
- m_offset = DW_INVALID_OFFSET;
- m_length = 0;
- m_version = 0;
- m_abbrevs = NULL;
- m_addr_size = DWARFCompileUnit::GetDefaultAddressSize();
- m_base_addr = 0;
- m_die_array.clear();
- m_func_aranges_ap.reset();
- m_user_data = NULL;
- m_producer = eProducerInvalid;
- m_language_type = eLanguageTypeUnknown;
- m_is_dwarf64 = false;
- m_is_optimized = eLazyBoolCalculate;
- m_addr_base = 0;
- m_base_obj_offset = DW_INVALID_OFFSET;
-}
+DWARFCompileUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
+ lldb::offset_t *offset_ptr) {
+ DWARFCompileUnitSP cu_sp(new DWARFCompileUnit(dwarf2Data));
+ // Out of memory?
+ if (cu_sp.get() == NULL)
+ return nullptr;
-bool DWARFCompileUnit::Extract(const DWARFDataExtractor &debug_info,
- lldb::offset_t *offset_ptr) {
- Clear();
+ const DWARFDataExtractor &debug_info = dwarf2Data->get_debug_info_data();
- m_offset = *offset_ptr;
+ cu_sp->m_offset = *offset_ptr;
if (debug_info.ValidOffset(*offset_ptr)) {
dw_offset_t abbr_offset;
- const DWARFDebugAbbrev *abbr = m_dwarf2Data->DebugAbbrev();
- m_length = debug_info.GetDWARFInitialLength(offset_ptr);
- m_is_dwarf64 = debug_info.IsDWARF64();
- m_version = debug_info.GetU16(offset_ptr);
+ const DWARFDebugAbbrev *abbr = dwarf2Data->DebugAbbrev();
+ cu_sp->m_length = debug_info.GetDWARFInitialLength(offset_ptr);
+ cu_sp->m_is_dwarf64 = debug_info.IsDWARF64();
+ cu_sp->m_version = debug_info.GetU16(offset_ptr);
abbr_offset = debug_info.GetDWARFOffset(offset_ptr);
- m_addr_size = debug_info.GetU8(offset_ptr);
+ cu_sp->m_addr_size = debug_info.GetU8(offset_ptr);
- bool length_OK = debug_info.ValidOffset(GetNextCompileUnitOffset() - 1);
- bool version_OK = SymbolFileDWARF::SupportedVersion(m_version);
+ bool length_OK =
+ debug_info.ValidOffset(cu_sp->GetNextCompileUnitOffset() - 1);
+ bool version_OK = SymbolFileDWARF::SupportedVersion(cu_sp->m_version);
bool abbr_offset_OK =
- m_dwarf2Data->get_debug_abbrev_data().ValidOffset(abbr_offset);
- bool addr_size_OK = ((m_addr_size == 4) || (m_addr_size == 8));
+ dwarf2Data->get_debug_abbrev_data().ValidOffset(abbr_offset);
+ bool addr_size_OK = (cu_sp->m_addr_size == 4) || (cu_sp->m_addr_size == 8);
if (length_OK && version_OK && addr_size_OK && abbr_offset_OK &&
abbr != NULL) {
- m_abbrevs = abbr->GetAbbreviationDeclarationSet(abbr_offset);
- return true;
+ cu_sp->m_abbrevs = abbr->GetAbbreviationDeclarationSet(abbr_offset);
+ return cu_sp;
}
// reset the offset to where we tried to parse from if anything went wrong
- *offset_ptr = m_offset;
+ *offset_ptr = cu_sp->m_offset;
}
- return false;
+ return nullptr;
}
void DWARFCompileUnit::ClearDIEs(bool keep_compile_unit_die) {
@@ -620,6 +600,10 @@ void DWARFCompileUnit::Index(NameToDIE &func_basenames,
NameToDIE &objc_class_selectors,
NameToDIE &globals, NameToDIE &types,
NameToDIE &namespaces) {
+ assert(!m_dwarf2Data->GetBaseCompileUnit() &&
+ "DWARFCompileUnit associated with .dwo or .dwp "
+ "should not be indexed directly");
+
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
if (log) {
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index 430251337575..8ea0d6465adf 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -18,6 +18,8 @@ class NameToDIE;
class SymbolFileDWARF;
class SymbolFileDWARFDwo;
+typedef std::shared_ptr<DWARFCompileUnit> DWARFCompileUnitSP;
+
class DWARFCompileUnit {
public:
enum Producer {
@@ -28,39 +30,35 @@ public:
eProcucerOther
};
- DWARFCompileUnit(SymbolFileDWARF *dwarf2Data);
+ static DWARFCompileUnitSP Extract(SymbolFileDWARF *dwarf2Data,
+ lldb::offset_t *offset_ptr);
~DWARFCompileUnit();
- bool Extract(const lldb_private::DWARFDataExtractor &debug_info,
- lldb::offset_t *offset_ptr);
size_t ExtractDIEsIfNeeded(bool cu_die_only);
DWARFDIE LookupAddress(const dw_addr_t address);
size_t AppendDIEsWithTag(const dw_tag_t tag,
DWARFDIECollection &matching_dies,
uint32_t depth = UINT32_MAX) const;
- void Clear();
bool Verify(lldb_private::Stream *s) const;
void Dump(lldb_private::Stream *s) const;
+ // Offset of the initial length field.
dw_offset_t GetOffset() const { return m_offset; }
lldb::user_id_t GetID() const;
- uint32_t Size() const {
- return m_is_dwarf64 ? 23
- : 11; /* Size in bytes of the compile unit header */
- }
+ // Size in bytes of the initial length + compile unit header.
+ uint32_t Size() const { return m_is_dwarf64 ? 23 : 11; }
bool ContainsDIEOffset(dw_offset_t die_offset) const {
return die_offset >= GetFirstDIEOffset() &&
die_offset < GetNextCompileUnitOffset();
}
dw_offset_t GetFirstDIEOffset() const { return m_offset + Size(); }
dw_offset_t GetNextCompileUnitOffset() const {
- return m_offset + m_length + (m_is_dwarf64 ? 12 : 4);
+ return m_offset + (m_is_dwarf64 ? 12 : 4) + m_length;
}
+ // Size of the CU data (without initial length and without header).
size_t GetDebugInfoSize() const {
- return m_length + (m_is_dwarf64 ? 12 : 4) - Size(); /* Size in bytes of the
- .debug_info data
- associated with this
- compile unit. */
+ return (m_is_dwarf64 ? 12 : 4) + m_length - Size();
}
+ // Size of the CU data incl. header but without initial length.
uint32_t GetLength() const { return m_length; }
uint16_t GetVersion() const { return m_version; }
const DWARFAbbreviationDeclarationSet *GetAbbreviations() const {
@@ -165,7 +163,7 @@ protected:
SymbolFileDWARF *m_dwarf2Data;
std::unique_ptr<SymbolFileDWARFDwo> m_dwo_symbol_file;
const DWARFAbbreviationDeclarationSet *m_abbrevs;
- void *m_user_data;
+ void *m_user_data = nullptr;
DWARFDebugInfoEntry::collection
m_die_array; // The compile unit debug information entry item
std::unique_ptr<DWARFDebugAranges> m_func_aranges_ap; // A table similar to
@@ -174,23 +172,24 @@ protected:
// points to the exact
// DW_TAG_subprogram
// DIEs
- dw_addr_t m_base_addr;
+ dw_addr_t m_base_addr = 0;
+ // Offset of the initial length field.
dw_offset_t m_offset;
dw_offset_t m_length;
uint16_t m_version;
uint8_t m_addr_size;
- Producer m_producer;
- uint32_t m_producer_version_major;
- uint32_t m_producer_version_minor;
- uint32_t m_producer_version_update;
- lldb::LanguageType m_language_type;
+ Producer m_producer = eProducerInvalid;
+ uint32_t m_producer_version_major = 0;
+ uint32_t m_producer_version_minor = 0;
+ uint32_t m_producer_version_update = 0;
+ lldb::LanguageType m_language_type = lldb::eLanguageTypeUnknown;
bool m_is_dwarf64;
- lldb_private::LazyBool m_is_optimized;
- dw_addr_t m_addr_base; // Value of DW_AT_addr_base
- dw_addr_t m_ranges_base; // Value of DW_AT_ranges_base
- dw_offset_t m_base_obj_offset; // If this is a dwo compile unit this is the
- // offset of the base compile unit in the main
- // object file
+ lldb_private::LazyBool m_is_optimized = lldb_private::eLazyBoolCalculate;
+ dw_addr_t m_addr_base = 0; // Value of DW_AT_addr_base
+ dw_addr_t m_ranges_base = 0; // Value of DW_AT_ranges_base
+ // If this is a dwo compile unit this is the offset of the base compile unit
+ // in the main object file
+ dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET;
void ParseProducerInfo();
@@ -203,6 +202,8 @@ protected:
NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces);
private:
+ DWARFCompileUnit(SymbolFileDWARF *dwarf2Data);
+
const DWARFDebugInfoEntry *GetCompileUnitDIEPtrOnly() {
ExtractDIEsIfNeeded(true);
if (m_die_array.empty())
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 5222419d3233..4ef2e772ea5d 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -392,17 +392,11 @@ lldb::ModuleSP DWARFDIE::GetContainingDWOModule() const {
}
bool DWARFDIE::HasChildren() const {
- if (m_die)
- return m_die->HasChildren();
- else
- return false;
+ return m_die && m_die->HasChildren();
}
bool DWARFDIE::Supports_DW_AT_APPLE_objc_complete_type() const {
- if (IsValid())
- return GetDWARF()->Supports_DW_AT_APPLE_objc_complete_type(m_cu);
- else
- return false;
+ return IsValid() && GetDWARF()->Supports_DW_AT_APPLE_objc_complete_type(m_cu);
}
size_t DWARFDIE::GetAttributes(DWARFAttributes &attributes,
@@ -464,5 +458,5 @@ bool operator==(const DWARFDIE &lhs, const DWARFDIE &rhs) {
}
bool operator!=(const DWARFDIE &lhs, const DWARFDIE &rhs) {
- return lhs.GetDIE() != rhs.GetDIE() || lhs.GetCU() != rhs.GetCU();
+ return !(lhs == rhs);
}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
index d681925daeac..1cf0e7eeeb60 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
@@ -98,6 +98,21 @@ dw_uleb128_t DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential(
}
//----------------------------------------------------------------------
+// DWARFAbbreviationDeclarationSet::GetUnsupportedForms()
+//----------------------------------------------------------------------
+void DWARFAbbreviationDeclarationSet::GetUnsupportedForms(
+ std::set<dw_form_t> &invalid_forms) const {
+ for (const auto &abbr_decl : m_decls) {
+ const size_t num_attrs = abbr_decl.NumAttributes();
+ for (size_t i=0; i<num_attrs; ++i) {
+ dw_form_t form = abbr_decl.GetFormByIndex(i);
+ if (!DWARFFormValue::FormIsSupported(form))
+ invalid_forms.insert(form);
+ }
+ }
+}
+
+//----------------------------------------------------------------------
// Encode
//
// Encode the abbreviation table onto the end of the buffer provided
@@ -175,3 +190,12 @@ DWARFDebugAbbrev::GetAbbreviationDeclarationSet(
return &(pos->second);
return NULL;
}
+
+//----------------------------------------------------------------------
+// DWARFDebugAbbrev::GetUnsupportedForms()
+//----------------------------------------------------------------------
+void DWARFDebugAbbrev::GetUnsupportedForms(
+ std::set<dw_form_t> &invalid_forms) const {
+ for (const auto &pair : m_abbrevCollMap)
+ pair.second.GetUnsupportedForms(invalid_forms);
+}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
index 137c81780513..2bacb6349b6f 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
@@ -41,6 +41,7 @@ public:
// void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
dw_uleb128_t
AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl);
+ void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
const DWARFAbbreviationDeclaration *
GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const;
@@ -65,6 +66,7 @@ public:
GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const;
void Dump(lldb_private::Stream *s) const;
void Parse(const lldb_private::DWARFDataExtractor &data);
+ void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
protected:
DWARFAbbreviationDeclarationCollMap m_abbrevCollMap;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index eff9850d435d..9c0f1d3c8905 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -97,17 +97,8 @@ void DWARFDebugInfo::ParseCompileUnitHeadersIfNeeded() {
if (m_compile_units.empty()) {
if (m_dwarf2Data != NULL) {
lldb::offset_t offset = 0;
- const DWARFDataExtractor &debug_info_data =
- m_dwarf2Data->get_debug_info_data();
- while (debug_info_data.ValidOffset(offset)) {
- DWARFCompileUnitSP cu_sp(new DWARFCompileUnit(m_dwarf2Data));
- // Out of memory?
- if (cu_sp.get() == NULL)
- break;
-
- if (cu_sp->Extract(debug_info_data, &offset) == false)
- break;
-
+ DWARFCompileUnitSP cu_sp;
+ while ((cu_sp = DWARFCompileUnit::Extract(m_dwarf2Data, &offset))) {
m_compile_units.push_back(cu_sp);
offset = cu_sp->GetNextCompileUnitOffset();
@@ -248,12 +239,10 @@ void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback,
if (dwarf2Data) {
lldb::offset_t offset = 0;
uint32_t depth = 0;
- DWARFCompileUnitSP cu(new DWARFCompileUnit(dwarf2Data));
- if (cu.get() == NULL)
- return;
DWARFDebugInfoEntry die;
- while (cu->Extract(dwarf2Data->get_debug_info_data(), &offset)) {
+ DWARFCompileUnitSP cu;
+ while ((cu = DWARFCompileUnit::Extract(dwarf2Data, &offset))) {
const dw_offset_t next_cu_offset = cu->GetNextCompileUnitOffset();
depth = 0;
@@ -288,12 +277,6 @@ void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback,
if (!dwarf2Data->get_debug_info_data().ValidOffset(offset))
break;
- // See if during the callback anyone retained a copy of the compile
- // unit other than ourselves and if so, let whomever did own the object
- // and create a new one for our own use!
- if (!cu.unique())
- cu.reset(new DWARFCompileUnit(dwarf2Data));
-
// Make sure we start on a proper
offset = next_cu_offset;
}
@@ -507,80 +490,3 @@ void DWARFDebugInfo::Dump(Stream *s, const uint32_t die_offset,
die.Dump(s, recurse_depth);
}
}
-
-//----------------------------------------------------------------------
-// FindCallbackString
-//
-// A callback function for the static DWARFDebugInfo::Parse() function
-// that gets called each time a compile unit header or debug information
-// entry is successfully parsed.
-//
-// This function will find the die_offset of any items whose DW_AT_name
-// matches the given string
-//----------------------------------------------------------------------
-typedef struct FindCallbackStringInfoTag {
- const char *name;
- bool ignore_case;
- RegularExpression *regex;
- vector<dw_offset_t> &die_offsets;
-} FindCallbackStringInfo;
-
-static dw_offset_t
-FindCallbackString(SymbolFileDWARF *dwarf2Data, DWARFCompileUnit *cu,
- DWARFDebugInfoEntry *die, const dw_offset_t next_offset,
- const uint32_t curr_depth, void *userData) {
- FindCallbackStringInfo *info = (FindCallbackStringInfo *)userData;
-
- if (!die)
- return next_offset;
-
- const char *die_name = die->GetName(dwarf2Data, cu);
- if (!die_name)
- return next_offset;
-
- if (info->regex) {
- if (info->regex->Execute(llvm::StringRef(die_name)))
- info->die_offsets.push_back(die->GetOffset());
- } else {
- if ((info->ignore_case ? strcasecmp(die_name, info->name)
- : strcmp(die_name, info->name)) == 0)
- info->die_offsets.push_back(die->GetOffset());
- }
-
- // Just return the current offset to parse the next CU or DIE entry
- return next_offset;
-}
-
-//----------------------------------------------------------------------
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the entire name
-// and case sensitive searches are an option.
-//----------------------------------------------------------------------
-bool DWARFDebugInfo::Find(const char *name, bool ignore_case,
- vector<dw_offset_t> &die_offsets) const {
- die_offsets.clear();
- if (name && name[0]) {
- FindCallbackStringInfo info = {name, ignore_case, NULL, die_offsets};
- DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
- }
- return !die_offsets.empty();
-}
-
-//----------------------------------------------------------------------
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the supplied regular
-// expression.
-//----------------------------------------------------------------------
-bool DWARFDebugInfo::Find(RegularExpression &re,
- vector<dw_offset_t> &die_offsets) const {
- die_offsets.clear();
- FindCallbackStringInfo info = {NULL, false, &re, die_offsets};
- DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
- return !die_offsets.empty();
-}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index be4e18b12be0..14c7d767d05b 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -50,10 +50,6 @@ public:
static void Verify(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data);
static void Dump(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data,
const uint32_t die_offset, const uint32_t recurse_depth);
- bool Find(const char *name, bool ignore_case,
- std::vector<dw_offset_t> &die_offsets) const;
- bool Find(lldb_private::RegularExpression &re,
- std::vector<dw_offset_t> &die_offsets) const;
enum {
eDumpFlag_Verbose = (1 << 0), // Verbose dumping
@@ -65,8 +61,6 @@ public:
DWARFDebugAranges &GetCompileUnitAranges();
protected:
- typedef std::shared_ptr<DWARFCompileUnit> DWARFCompileUnitSP;
-
static bool OffsetLessThanCompileUnitOffset(dw_offset_t offset,
const DWARFCompileUnitSP &cu_sp);
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 8d87c201eceb..f595bd83d846 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -161,9 +161,9 @@ bool DWARFDebugInfoEntry::FastExtract(
case DW_FORM_strp:
case DW_FORM_sec_offset:
if (cu->IsDWARF64())
- debug_info_data.GetU64(offset_ptr);
+ debug_info_data.GetU64(&offset);
else
- debug_info_data.GetU32(offset_ptr);
+ debug_info_data.GetU32(&offset);
break;
default:
@@ -325,9 +325,9 @@ bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data,
case DW_FORM_strp:
case DW_FORM_sec_offset:
if (cu->IsDWARF64())
- debug_info_data.GetU64(offset_ptr);
+ debug_info_data.GetU64(&offset);
else
- debug_info_data.GetU32(offset_ptr);
+ debug_info_data.GetU32(&offset);
break;
default:
@@ -1314,19 +1314,6 @@ bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data,
return false;
}
-bool DWARFDebugInfoEntry::Contains(const DWARFDebugInfoEntry *die) const {
- if (die) {
- const dw_offset_t die_offset = die->GetOffset();
- if (die_offset > GetOffset()) {
- const DWARFDebugInfoEntry *sibling = GetSibling();
- assert(sibling); // TODO: take this out
- if (sibling)
- return die_offset < sibling->GetOffset();
- }
- }
- return false;
-}
-
//----------------------------------------------------------------------
// BuildAddressRangeTable
//----------------------------------------------------------------------
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 15abac77a475..89450d327adf 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -60,18 +60,6 @@ public:
m_empty_children(false), m_abbr_idx(0), m_has_children(false),
m_tag(0) {}
- void Clear() {
- m_offset = DW_INVALID_OFFSET;
- m_parent_idx = 0;
- m_sibling_idx = 0;
- m_empty_children = false;
- m_abbr_idx = 0;
- m_has_children = false;
- m_tag = 0;
- }
-
- bool Contains(const DWARFDebugInfoEntry *die) const;
-
void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
const DWARFCompileUnit *cu,
DWARFDebugAranges *debug_aranges) const;
@@ -211,8 +199,6 @@ public:
dw_offset_t GetOffset() const { return m_offset; }
- void SetOffset(dw_offset_t offset) { m_offset = offset; }
-
bool HasChildren() const { return m_has_children; }
void SetHasChildren(bool b) { m_has_children = b; }
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
index 515c083fedb0..a8c48b7f2f84 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -15,6 +15,18 @@
using namespace lldb_private;
using namespace std;
+static dw_addr_t GetBaseAddressMarker(uint32_t addr_size) {
+ switch(addr_size) {
+ case 2:
+ return 0xffff;
+ case 4:
+ return 0xffffffff;
+ case 8:
+ return 0xffffffffffffffff;
+ }
+ llvm_unreachable("GetBaseAddressMarker unsupported address size.");
+}
+
DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
DWARFDebugRanges::~DWARFDebugRanges() {}
@@ -39,38 +51,27 @@ bool DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data,
const DWARFDataExtractor &debug_ranges_data =
dwarf2Data->get_debug_ranges_data();
uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
+ dw_addr_t base_addr = 0;
+ dw_addr_t base_addr_marker = GetBaseAddressMarker(addr_size);
while (
debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
+
if (!begin && !end) {
// End of range list
break;
}
- // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits
- // of ones
- switch (addr_size) {
- case 2:
- if (begin == 0xFFFFull)
- begin = LLDB_INVALID_ADDRESS;
- break;
-
- case 4:
- if (begin == 0xFFFFFFFFull)
- begin = LLDB_INVALID_ADDRESS;
- break;
- case 8:
- break;
-
- default:
- llvm_unreachable("DWARFRangeList::Extract() unsupported address size.");
+ if (begin == base_addr_marker) {
+ base_addr = end;
+ continue;
}
// Filter out empty ranges
if (begin < end)
- range_list.Append(DWARFRangeList::Entry(begin, end - begin));
+ range_list.Append(DWARFRangeList::Entry(begin + base_addr, end - begin));
}
// Make sure we consumed at least something
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 0853671ee874..a21e313c2f81 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -725,3 +725,39 @@ int DWARFFormValue::Compare(const DWARFFormValue &a_value,
}
return -1;
}
+
+bool DWARFFormValue::FormIsSupported(dw_form_t form) {
+ switch (form) {
+ case DW_FORM_addr:
+ case DW_FORM_block2:
+ case DW_FORM_block4:
+ case DW_FORM_data2:
+ case DW_FORM_data4:
+ case DW_FORM_data8:
+ case DW_FORM_string:
+ case DW_FORM_block:
+ case DW_FORM_block1:
+ case DW_FORM_data1:
+ case DW_FORM_flag:
+ case DW_FORM_sdata:
+ case DW_FORM_strp:
+ case DW_FORM_udata:
+ case DW_FORM_ref_addr:
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
+ case DW_FORM_indirect:
+ case DW_FORM_sec_offset:
+ case DW_FORM_exprloc:
+ case DW_FORM_flag_present:
+ case DW_FORM_ref_sig8:
+ case DW_FORM_GNU_str_index:
+ case DW_FORM_GNU_addr_index:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
index 8d6af3d65b33..2aa7460c4910 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -86,6 +86,7 @@ public:
bool is_dwarf64);
static int Compare(const DWARFFormValue &a, const DWARFFormValue &b);
void Clear();
+ static bool FormIsSupported(dw_form_t form);
protected:
const DWARFCompileUnit *m_cu; // Compile unit for this form
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index ef18c2b5d3ba..f149ec354f08 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -13,7 +13,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/Threading.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
@@ -22,6 +21,7 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
@@ -30,6 +30,7 @@
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/Symbols.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
@@ -53,7 +54,7 @@
#include "lldb/Target/Language.h"
-#include "lldb/Utility/TaskPool.h"
+#include "lldb/Host/TaskPool.h"
#include "DWARFASTParser.h"
#include "DWARFASTParserClang.h"
@@ -71,6 +72,7 @@
#include "LogChannelDWARF.h"
#include "SymbolFileDWARFDebugMap.h"
#include "SymbolFileDWARFDwo.h"
+#include "SymbolFileDWARFDwp.h"
#include "llvm/Support/FileSystem.h"
@@ -207,6 +209,10 @@ static const char *resolveCompDir(const char *path_from_dwarf) {
return nullptr;
}
+DWARFCompileUnit *SymbolFileDWARF::GetBaseCompileUnit() {
+ return nullptr;
+}
+
void SymbolFileDWARF::Initialize() {
LogChannelDWARF::Initialize();
PluginManager::RegisterPlugin(GetPluginNameStatic(),
@@ -435,13 +441,11 @@ void SymbolFileDWARF::InitializeObject() {
ModuleSP module_sp(m_obj_file->GetModule());
if (module_sp) {
const SectionList *section_list = module_sp->GetSectionList();
- const Section *section =
+ Section *section =
section_list->FindSectionByName(GetDWARFMachOSegmentName()).get();
- // Memory map the DWARF mach-o segment so we have everything mmap'ed
- // to keep our heap memory usage down.
if (section)
- m_obj_file->MemoryMapSectionData(section, m_dwarf_data);
+ m_obj_file->ReadSectionData(section, m_dwarf_data);
}
get_apple_names_data();
@@ -497,6 +501,21 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
if (section_list == NULL)
return 0;
+ // On non Apple platforms we might have .debug_types debug info that
+ // is created by using "-fdebug-types-section". LLDB currently will try
+ // to load this debug info, but it causes crashes during debugging when
+ // types are missing since it doesn't know how to parse the info in
+ // the .debug_types type units. This causes all complex debug info
+ // types to be unresolved. Because this causes LLDB to crash and since
+ // it really doesn't provide a solid debuggiung experience, we should
+ // disable trying to debug this kind of DWARF until support gets
+ // added or deprecated.
+ if (section_list->FindSectionByName(ConstString(".debug_types"))) {
+ m_obj_file->GetModule()->ReportWarning(
+ "lldb doesn’t support .debug_types debug info");
+ return 0;
+ }
+
uint64_t debug_abbrev_file_size = 0;
uint64_t debug_info_file_size = 0;
uint64_t debug_line_file_size = 0;
@@ -517,6 +536,20 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
if (section)
debug_abbrev_file_size = section->GetFileSize();
+ DWARFDebugAbbrev *abbrev = DebugAbbrev();
+ if (abbrev) {
+ std::set<dw_form_t> invalid_forms;
+ abbrev->GetUnsupportedForms(invalid_forms);
+ if (!invalid_forms.empty()) {
+ StreamString error;
+ error.Printf("unsupported DW_FORM value%s:", invalid_forms.size() > 1 ? "s" : "");
+ for (auto form : invalid_forms)
+ error.Printf(" %#x", form);
+ m_obj_file->GetModule()->ReportWarning("%s", error.GetString().str().c_str());
+ return 0;
+ }
+ }
+
section =
section_list->FindSectionByType(eSectionTypeDWARFDebugLine, true)
.get();
@@ -1539,6 +1572,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
if (!dwo_name)
return nullptr;
+ SymbolFileDWARFDwp *dwp_symfile = GetDwpSymbolFile();
+ if (dwp_symfile) {
+ uint64_t dwo_id = cu_die.GetAttributeValueAsUnsigned(this, &dwarf_cu,
+ DW_AT_GNU_dwo_id, 0);
+ std::unique_ptr<SymbolFileDWARFDwo> dwo_symfile =
+ dwp_symfile->GetSymbolFileForDwoId(&dwarf_cu, dwo_id);
+ if (dwo_symfile)
+ return dwo_symfile;
+ }
+
FileSpec dwo_file(dwo_name, true);
if (dwo_file.IsRelative()) {
const char *comp_dir = cu_die.GetAttributeValueAsString(
@@ -1600,7 +1643,29 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
}
dwo_module_spec.GetArchitecture() =
m_obj_file->GetModule()->GetArchitecture();
- // printf ("Loading dwo = '%s'\n", dwo_path);
+
+ // When LLDB loads "external" modules it looks at the
+ // presence of DW_AT_GNU_dwo_name.
+ // However, when the already created module
+ // (corresponding to .dwo itself) is being processed,
+ // it will see the presence of DW_AT_GNU_dwo_name
+ // (which contains the name of dwo file) and
+ // will try to call ModuleList::GetSharedModule again.
+ // In some cases (i.e. for empty files) Clang 4.0
+ // generates a *.dwo file which has DW_AT_GNU_dwo_name,
+ // but no DW_AT_comp_dir. In this case the method
+ // ModuleList::GetSharedModule will fail and
+ // the warning will be printed. However, as one can notice
+ // in this case we don't actually need to try to load the already
+ // loaded module (corresponding to .dwo) so we simply skip it.
+ if (m_obj_file->GetFileSpec()
+ .GetFileNameExtension()
+ .GetStringRef() == "dwo" &&
+ llvm::StringRef(m_obj_file->GetFileSpec().GetPath())
+ .endswith(dwo_module_spec.GetFileSpec().GetPath())) {
+ continue;
+ }
+
Status error = ModuleList::GetSharedModule(
dwo_module_spec, module_sp, NULL, NULL, NULL);
if (!module_sp) {
@@ -1640,9 +1705,8 @@ SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() {
const DWARFExpression &location = var_sp->LocationExpression();
Value location_result;
Status error;
- if (location.Evaluate(nullptr, nullptr, nullptr,
- LLDB_INVALID_ADDRESS, nullptr, nullptr,
- location_result, &error)) {
+ if (location.Evaluate(nullptr, LLDB_INVALID_ADDRESS, nullptr,
+ nullptr, location_result, &error)) {
if (location_result.GetValueType() ==
Value::eValueTypeFileAddress) {
lldb::addr_t file_addr =
@@ -4288,3 +4352,18 @@ DWARFExpression::LocationListFormat
SymbolFileDWARF::GetLocationListFormat() const {
return DWARFExpression::RegularLocationList;
}
+
+SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() {
+ llvm::call_once(m_dwp_symfile_once_flag, [this]() {
+ ModuleSpec module_spec;
+ module_spec.GetFileSpec() = m_obj_file->GetFileSpec();
+ module_spec.GetSymbolFileSpec() =
+ FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false);
+ FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec);
+ if (dwp_filespec.Exists()) {
+ m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(),
+ dwp_filespec);
+ }
+ });
+ return m_dwp_symfile.get();
+}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 9b1eb1d76fea..6902dc0333d2 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -61,6 +61,7 @@ class DWARFDIECollection;
class DWARFFormValue;
class SymbolFileDWARFDebugMap;
class SymbolFileDWARFDwo;
+class SymbolFileDWARFDwp;
#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
@@ -275,8 +276,8 @@ public:
GetCompUnitForDWARFCompUnit(DWARFCompileUnit *dwarf_cu,
uint32_t cu_idx = UINT32_MAX);
- size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
- DIEArray &method_die_offsets);
+ virtual size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
+ DIEArray &method_die_offsets);
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFCompileUnit *cu);
@@ -298,6 +299,11 @@ public:
GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu,
const DWARFDebugInfoEntry &cu_die);
+ // For regular SymbolFileDWARF instances the method returns nullptr,
+ // for the instances of the subclass SymbolFileDWARFDwo
+ // the method returns a pointer to the base compile unit.
+ virtual DWARFCompileUnit *GetBaseCompileUnit();
+
protected:
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *>
DIEToTypePtr;
@@ -391,14 +397,10 @@ protected:
virtual lldb::TypeSP
FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx);
- lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
+ virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
const DWARFDIE &die, const lldb_private::ConstString &type_name,
bool must_be_implementation);
- lldb::TypeSP
- FindCompleteObjCDefinitionType(const lldb_private::ConstString &type_name,
- bool header_definition_ok);
-
lldb_private::Symbol *
GetObjCClassSymbol(const lldb_private::ConstString &objc_class_name);
@@ -464,8 +466,14 @@ protected:
return m_forward_decl_clang_type_to_die;
}
+ SymbolFileDWARFDwp *GetDwpSymbolFile();
+
lldb::ModuleWP m_debug_map_module_wp;
SymbolFileDWARFDebugMap *m_debug_map_symfile;
+
+ llvm::once_flag m_dwp_symfile_once_flag;
+ std::unique_ptr<SymbolFileDWARFDwp> m_dwp_symfile;
+
lldb_private::DWARFDataExtractor m_dwarf_data;
DWARFDataSegment m_data_debug_abbrev;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index c14ebd1628be..17c188a41a77 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -61,6 +61,14 @@ SymbolFileDWARFDwo::ParseCompileUnit(DWARFCompileUnit *dwarf_cu,
}
DWARFCompileUnit *SymbolFileDWARFDwo::GetCompileUnit() {
+ // A clang module is found via a skeleton CU, but is not a proper DWO.
+ // Clang modules have a .debug_info section instead of the *_dwo variant.
+ if (auto *section_list = m_obj_file->GetSectionList(false))
+ if (auto section_sp =
+ section_list->FindSectionByType(eSectionTypeDWARFDebugInfo, true))
+ if (!section_sp->GetName().GetStringRef().endswith("dwo"))
+ return nullptr;
+
// Only dwo files with 1 compile unit is supported
if (GetNumCompileUnits() == 1)
return DebugInfo()->GetCompileUnitAtIndex(0);
@@ -91,6 +99,12 @@ SymbolFileDWARFDwo::GetForwardDeclClangTypeToDie() {
return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie();
}
+size_t SymbolFileDWARFDwo::GetObjCMethodDIEOffsets(
+ lldb_private::ConstString class_name, DIEArray &method_die_offsets) {
+ return GetBaseSymbolFile()->GetObjCMethodDIEOffsets(
+ class_name, method_die_offsets);
+}
+
UniqueDWARFASTTypeMap &SymbolFileDWARFDwo::GetUniqueDWARFASTTypeMap() {
return GetBaseSymbolFile()->GetUniqueDWARFASTTypeMap();
}
@@ -101,6 +115,17 @@ lldb::TypeSP SymbolFileDWARFDwo::FindDefinitionTypeForDWARFDeclContext(
die_decl_ctx);
}
+lldb::TypeSP SymbolFileDWARFDwo::FindCompleteObjCDefinitionTypeForDIE(
+ const DWARFDIE &die, const lldb_private::ConstString &type_name,
+ bool must_be_implementation) {
+ return GetBaseSymbolFile()->FindCompleteObjCDefinitionTypeForDIE(
+ die, type_name, must_be_implementation);
+}
+
+DWARFCompileUnit *SymbolFileDWARFDwo::GetBaseCompileUnit() {
+ return m_base_dwarf_cu;
+}
+
SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() {
return m_base_dwarf_cu->GetSymbolFileDWARF();
}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 8cd67a2b2424..b67967aafab2 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -33,6 +33,9 @@ public:
lldb_private::DWARFExpression::LocationListFormat
GetLocationListFormat() const override;
+ size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
+ DIEArray &method_die_offsets) override;
+
lldb_private::TypeSystem *
GetTypeSystemForLanguage(lldb::LanguageType language) override;
@@ -45,6 +48,8 @@ public:
return nullptr;
}
+ DWARFCompileUnit *GetBaseCompileUnit() override;
+
protected:
void LoadSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data) override;
@@ -62,6 +67,10 @@ protected:
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(
const DWARFDeclContext &die_decl_ctx) override;
+ lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
+ const DWARFDIE &die, const lldb_private::ConstString &type_name,
+ bool must_be_implementation) override;
+
SymbolFileDWARF *GetBaseSymbolFile();
lldb::ObjectFileSP m_obj_file_sp;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
new file mode 100644
index 000000000000..f6de1818eae0
--- /dev/null
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
@@ -0,0 +1,36 @@
+//===-- SymbolFileDWARFDwoDwp.cpp -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "SymbolFileDWARFDwoDwp.h"
+
+#include "lldb/Core/Section.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/LLDBAssert.h"
+
+#include "DWARFCompileUnit.h"
+#include "DWARFDebugInfo.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SymbolFileDWARFDwoDwp::SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile,
+ ObjectFileSP objfile,
+ DWARFCompileUnit *dwarf_cu,
+ uint64_t dwo_id)
+ : SymbolFileDWARFDwo(objfile, dwarf_cu), m_dwp_symfile(dwp_symfile),
+ m_dwo_id(dwo_id) {}
+
+void SymbolFileDWARFDwoDwp::LoadSectionData(lldb::SectionType sect_type,
+ DWARFDataExtractor &data) {
+ if (m_dwp_symfile->LoadSectionData(m_dwo_id, sect_type, data))
+ return;
+
+ SymbolFileDWARF::LoadSectionData(sect_type, data);
+}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
new file mode 100644
index 000000000000..00ad7aafd96b
--- /dev/null
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
@@ -0,0 +1,34 @@
+//===-- SymbolFileDWARFDwoDwp.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_
+#define SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "SymbolFileDWARFDwo.h"
+#include "SymbolFileDWARFDwp.h"
+
+class SymbolFileDWARFDwoDwp : public SymbolFileDWARFDwo {
+public:
+ SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile,
+ lldb::ObjectFileSP objfile, DWARFCompileUnit *dwarf_cu,
+ uint64_t dwo_id);
+
+protected:
+ void LoadSectionData(lldb::SectionType sect_type,
+ lldb_private::DWARFDataExtractor &data) override;
+
+ SymbolFileDWARFDwp *m_dwp_symfile;
+ uint64_t m_dwo_id;
+};
+
+#endif // SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
new file mode 100644
index 000000000000..1dc1dab34a5c
--- /dev/null
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
@@ -0,0 +1,142 @@
+//===-- SymbolFileDWARFDwp.cpp ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "SymbolFileDWARFDwp.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Section.h"
+#include "lldb/Symbol/ObjectFile.h"
+
+#include "SymbolFileDWARFDwoDwp.h"
+
+static llvm::DWARFSectionKind
+lldbSectTypeToLlvmSectionKind(lldb::SectionType type) {
+ switch (type) {
+ case lldb::eSectionTypeDWARFDebugInfo:
+ return llvm::DW_SECT_INFO;
+ // case lldb::eSectionTypeDWARFDebugTypes:
+ // return llvm::DW_SECT_TYPES;
+ case lldb::eSectionTypeDWARFDebugAbbrev:
+ return llvm::DW_SECT_ABBREV;
+ case lldb::eSectionTypeDWARFDebugLine:
+ return llvm::DW_SECT_LINE;
+ case lldb::eSectionTypeDWARFDebugLoc:
+ return llvm::DW_SECT_LOC;
+ case lldb::eSectionTypeDWARFDebugStrOffsets:
+ return llvm::DW_SECT_STR_OFFSETS;
+ // case lldb::eSectionTypeDWARFDebugMacinfo:
+ // return llvm::DW_SECT_MACINFO;
+ case lldb::eSectionTypeDWARFDebugMacro:
+ return llvm::DW_SECT_MACRO;
+ default:
+ // Note: 0 is an invalid dwarf section kind.
+ return llvm::DWARFSectionKind(0);
+ }
+}
+
+std::unique_ptr<SymbolFileDWARFDwp>
+SymbolFileDWARFDwp::Create(lldb::ModuleSP module_sp,
+ const lldb_private::FileSpec &file_spec) {
+ const lldb::offset_t file_offset = 0;
+ lldb::DataBufferSP file_data_sp;
+ lldb::offset_t file_data_offset = 0;
+ lldb::ObjectFileSP obj_file = lldb_private::ObjectFile::FindPlugin(
+ module_sp, &file_spec, file_offset, file_spec.GetByteSize(), file_data_sp,
+ file_data_offset);
+ if (obj_file == nullptr)
+ return nullptr;
+
+ std::unique_ptr<SymbolFileDWARFDwp> dwp_symfile(
+ new SymbolFileDWARFDwp(module_sp, obj_file));
+
+ lldb_private::DWARFDataExtractor debug_cu_index;
+ if (!dwp_symfile->LoadRawSectionData(lldb::eSectionTypeDWARFDebugCuIndex,
+ debug_cu_index))
+ return nullptr;
+
+ llvm::DataExtractor llvm_debug_cu_index(
+ llvm::StringRef(debug_cu_index.PeekCStr(0), debug_cu_index.GetByteSize()),
+ debug_cu_index.GetByteOrder() == lldb::eByteOrderLittle,
+ debug_cu_index.GetAddressByteSize());
+ if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index))
+ return nullptr;
+ dwp_symfile->InitDebugCUIndexMap();
+ return dwp_symfile;
+}
+
+void SymbolFileDWARFDwp::InitDebugCUIndexMap() {
+ m_debug_cu_index_map.clear();
+ for (const auto &entry : m_debug_cu_index.getRows())
+ m_debug_cu_index_map.emplace(entry.getSignature(), &entry);
+}
+
+SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp,
+ lldb::ObjectFileSP obj_file)
+ : m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO)
+{}
+
+std::unique_ptr<SymbolFileDWARFDwo>
+SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu,
+ uint64_t dwo_id) {
+ return std::unique_ptr<SymbolFileDWARFDwo>(
+ new SymbolFileDWARFDwoDwp(this, m_obj_file, dwarf_cu, dwo_id));
+}
+
+bool SymbolFileDWARFDwp::LoadSectionData(
+ uint64_t dwo_id, lldb::SectionType sect_type,
+ lldb_private::DWARFDataExtractor &data) {
+ lldb_private::DWARFDataExtractor section_data;
+ if (!LoadRawSectionData(sect_type, section_data))
+ return false;
+
+ auto it = m_debug_cu_index_map.find(dwo_id);
+ if (it == m_debug_cu_index_map.end())
+ return false;
+
+ auto *offsets =
+ it->second->getOffset(lldbSectTypeToLlvmSectionKind(sect_type));
+ if (offsets) {
+ data.SetData(section_data, offsets->Offset, offsets->Length);
+ } else {
+ data.SetData(section_data, 0, section_data.GetByteSize());
+ }
+ return true;
+}
+
+bool SymbolFileDWARFDwp::LoadRawSectionData(
+ lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) {
+ std::lock_guard<std::mutex> lock(m_sections_mutex);
+
+ auto it = m_sections.find(sect_type);
+ if (it != m_sections.end()) {
+ if (it->second.GetByteSize() == 0)
+ return false;
+
+ data = it->second;
+ return true;
+ }
+
+ const lldb_private::SectionList *section_list =
+ m_obj_file->GetSectionList(false /* update_module_section_list */);
+ if (section_list) {
+ lldb::SectionSP section_sp(
+ section_list->FindSectionByType(sect_type, true));
+ if (section_sp) {
+ if (m_obj_file->ReadSectionData(section_sp.get(), data) != 0) {
+ m_sections[sect_type] = data;
+ return true;
+ }
+ }
+ }
+ m_sections[sect_type].Clear();
+ return false;
+}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
new file mode 100644
index 000000000000..a7372b9358b1
--- /dev/null
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
@@ -0,0 +1,55 @@
+//===-- SymbolFileDWARFDwp.h ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_
+#define SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_
+
+// C Includes
+// C++ Includes
+#include <memory>
+
+// Other libraries and framework includes
+#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
+
+// Project includes
+#include "lldb/Core/Module.h"
+
+#include "DWARFDataExtractor.h"
+#include "SymbolFileDWARFDwo.h"
+
+class SymbolFileDWARFDwp {
+public:
+ static std::unique_ptr<SymbolFileDWARFDwp>
+ Create(lldb::ModuleSP module_sp, const lldb_private::FileSpec &file_spec);
+
+ std::unique_ptr<SymbolFileDWARFDwo>
+ GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id);
+
+ bool LoadSectionData(uint64_t dwo_id, lldb::SectionType sect_type,
+ lldb_private::DWARFDataExtractor &data);
+
+private:
+ explicit SymbolFileDWARFDwp(lldb::ModuleSP module_sp,
+ lldb::ObjectFileSP obj_file);
+
+ bool LoadRawSectionData(lldb::SectionType sect_type,
+ lldb_private::DWARFDataExtractor &data);
+
+ void InitDebugCUIndexMap();
+
+ lldb::ObjectFileSP m_obj_file;
+
+ std::mutex m_sections_mutex;
+ std::map<lldb::SectionType, lldb_private::DWARFDataExtractor> m_sections;
+
+ llvm::DWARFUnitIndex m_debug_cu_index;
+ std::map<uint64_t, const llvm::DWARFUnitIndex::Entry *> m_debug_cu_index_map;
+};
+
+#endif // SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_
diff --git a/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index b48de2e591e3..9b98ebe112a2 100644
--- a/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -95,11 +95,11 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
- return std::make_shared<Type>(type.getSymIndexId(), m_ast.GetSymbolFile(),
- ConstString(udt->getName()), udt->getLength(),
- nullptr, LLDB_INVALID_UID,
- Type::eEncodingIsUID, decl, clang_type,
- Type::eResolveStateForward);
+ return std::make_shared<lldb_private::Type>(
+ type.getSymIndexId(), m_ast.GetSymbolFile(),
+ ConstString(udt->getName()), udt->getLength(), nullptr,
+ LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, clang_type,
+ lldb_private::Type::eResolveStateForward);
} else if (auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(&type)) {
std::string name = enum_type->getName();
lldb::Encoding encoding =
@@ -109,7 +109,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
m_ast.GetBuiltinTypeForEncodingAndBitSize(encoding, bytes * 8);
CompilerType ast_enum = m_ast.CreateEnumerationType(
- name.c_str(), tu_decl_ctx, decl, builtin_type);
+ name.c_str(), tu_decl_ctx, decl, builtin_type, false);
auto enum_values = enum_type->findAllChildren<PDBSymbolData>();
while (auto enum_value = enum_values->getNext()) {
if (enum_value->getDataKind() != PDB_DataKind::Constant)
@@ -117,12 +117,12 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
AddEnumValue(ast_enum, *enum_value);
}
- return std::make_shared<Type>(type.getSymIndexId(), m_ast.GetSymbolFile(),
- ConstString(name), bytes, nullptr,
- LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
- ast_enum, Type::eResolveStateFull);
+ return std::make_shared<lldb_private::Type>(
+ type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes,
+ nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
+ ast_enum, lldb_private::Type::eResolveStateFull);
} else if (auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type)) {
- Type *target_type =
+ lldb_private::Type *target_type =
m_ast.GetSymbolFile()->ResolveTypeUID(type_def->getTypeId());
std::string name = type_def->getName();
uint64_t bytes = type_def->getLength();
@@ -133,16 +133,17 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
m_ast.GetSymbolFile()->GetDeclContextForUID(target_type->GetID());
CompilerType ast_typedef =
m_ast.CreateTypedefType(target_ast_type, name.c_str(), target_decl_ctx);
- return std::make_shared<Type>(
+ return std::make_shared<lldb_private::Type>(
type_def->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
- bytes, nullptr, target_type->GetID(), Type::eEncodingIsTypedefUID, decl,
- ast_typedef, Type::eResolveStateFull);
+ bytes, nullptr, target_type->GetID(),
+ lldb_private::Type::eEncodingIsTypedefUID, decl, ast_typedef,
+ lldb_private::Type::eResolveStateFull);
} else if (auto func_sig = llvm::dyn_cast<PDBSymbolTypeFunctionSig>(&type)) {
auto arg_enum = func_sig->getArguments();
uint32_t num_args = arg_enum->getChildCount();
std::vector<CompilerType> arg_list(num_args);
while (auto arg = arg_enum->getNext()) {
- Type *arg_type =
+ lldb_private::Type *arg_type =
m_ast.GetSymbolFile()->ResolveTypeUID(arg->getSymIndexId());
// If there's some error looking up one of the dependent types of this
// function signature, bail.
@@ -152,7 +153,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
arg_list.push_back(arg_ast_type);
}
auto pdb_return_type = func_sig->getReturnType();
- Type *return_type =
+ lldb_private::Type *return_type =
m_ast.GetSymbolFile()->ResolveTypeUID(pdb_return_type->getSymIndexId());
// If there's some error looking up one of the dependent types of this
// function signature, bail.
@@ -167,23 +168,24 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
CompilerType func_sig_ast_type = m_ast.CreateFunctionType(
return_ast_type, &arg_list[0], num_args, false, type_quals);
- return std::make_shared<Type>(
+ return std::make_shared<lldb_private::Type>(
func_sig->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(), 0,
- nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
- func_sig_ast_type, Type::eResolveStateFull);
+ nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
+ func_sig_ast_type, lldb_private::Type::eResolveStateFull);
} else if (auto array_type = llvm::dyn_cast<PDBSymbolTypeArray>(&type)) {
uint32_t num_elements = array_type->getCount();
uint32_t element_uid = array_type->getElementType()->getSymIndexId();
uint32_t bytes = array_type->getLength();
- Type *element_type = m_ast.GetSymbolFile()->ResolveTypeUID(element_uid);
+ lldb_private::Type *element_type =
+ m_ast.GetSymbolFile()->ResolveTypeUID(element_uid);
CompilerType element_ast_type = element_type->GetFullCompilerType();
CompilerType array_ast_type =
m_ast.CreateArrayType(element_ast_type, num_elements, false);
- return std::make_shared<Type>(
+ return std::make_shared<lldb_private::Type>(
array_type->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(),
- bytes, nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
- array_ast_type, Type::eResolveStateFull);
+ bytes, nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID,
+ decl, array_ast_type, lldb_private::Type::eResolveStateFull);
}
return nullptr;
}
diff --git a/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index f952696ab21d..a25119684c28 100644
--- a/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -127,13 +127,14 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
SectionList *objfile_section_list = dsym_objfile_sp->GetSectionList();
static const SectionType g_sections[] = {
- eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr,
- eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame,
- eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine,
- eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo,
- eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes,
- eSectionTypeDWARFDebugRanges, eSectionTypeDWARFDebugStr,
- eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable,
+ eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr,
+ eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex,
+ eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo,
+ eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc,
+ eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames,
+ eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges,
+ eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets,
+ eSectionTypeELFSymbolTable,
};
for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]);
++idx) {
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 6d6abd62dad2..b3fb05e652d9 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -220,6 +220,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
// the original
// gloal DBGSourcePath string.
bool new_style_source_remapping_dictionary = false;
+ bool do_truncate_remapping_names = false;
std::string original_DBGSourcePath_value =
DBGSourcePath;
if (plist_sp->GetAsDictionary()->HasKey("DBGVersion")) {
@@ -233,6 +234,9 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
if (version_number > 1) {
new_style_source_remapping_dictionary = true;
}
+ if (version_number == 2) {
+ do_truncate_remapping_names = true;
+ }
}
}
@@ -242,7 +246,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
->GetAsDictionary();
remappings_dict->ForEach(
[&module_sp, new_style_source_remapping_dictionary,
- original_DBGSourcePath_value](
+ original_DBGSourcePath_value, do_truncate_remapping_names](
ConstString key,
StructuredData::Object *object) -> bool {
if (object && object->GetAsString()) {
@@ -264,6 +268,21 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
}
module_sp->GetSourceMappingList().Append(
key, ConstString(DBGSourcePath), true);
+ // With version 2 of DBGSourcePathRemapping, we can chop off the
+ // last two filename parts from the source remapping and get a
+ // more general source remapping that still works. Add this as
+ // another option in addition to the full source path remap.
+ if (do_truncate_remapping_names) {
+ FileSpec build_path(key.AsCString(), false);
+ FileSpec source_path(DBGSourcePath.c_str(), false);
+ build_path.RemoveLastPathComponent();
+ build_path.RemoveLastPathComponent();
+ source_path.RemoveLastPathComponent();
+ source_path.RemoveLastPathComponent();
+ module_sp->GetSourceMappingList().Append(
+ ConstString(build_path.GetPath().c_str()),
+ ConstString(source_path.GetPath().c_str()), true);
+ }
}
return true;
});
diff --git a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index 3976f40dd8d1..f8aca4d1283b 100644
--- a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -10,7 +10,6 @@
#include "UnwindAssemblyInstEmulation.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/FormatEntity.h"
@@ -19,6 +18,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
diff --git a/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
index c171f0f4d2a0..b8dcd99a53e7 100644
--- a/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
+++ b/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
@@ -15,7 +15,6 @@
#include "llvm/Support/TargetSelect.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/ABI.h"
@@ -26,6 +25,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/UnwindAssembly.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Status.h"
using namespace lldb;
diff --git a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
index 97441d362973..cec9803c8a49 100644
--- a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
+++ b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
@@ -12,13 +12,12 @@
#include "llvm-c/Disassembler.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
-#include "lldb/Core/ArchSpec.h"
-#include "lldb/Utility/ConstString.h"
-
#include <map>
#include <vector>
diff --git a/source/Symbol/ArmUnwindInfo.cpp b/source/Symbol/ArmUnwindInfo.cpp
index 742c057e10e3..4da307bf0c32 100644
--- a/source/Symbol/ArmUnwindInfo.cpp
+++ b/source/Symbol/ArmUnwindInfo.cpp
@@ -46,7 +46,7 @@ bool ArmUnwindInfo::ArmExidxEntry::operator<(const ArmExidxEntry &other) const {
return address < other.address;
}
-ArmUnwindInfo::ArmUnwindInfo(const ObjectFile &objfile, SectionSP &arm_exidx,
+ArmUnwindInfo::ArmUnwindInfo(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) {
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index c8738e6e5502..673124cc0de5 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -70,7 +70,7 @@
#include "Plugins/ExpressionParser/Clang/ClangFunctionCaller.h"
#include "Plugins/ExpressionParser/Clang/ClangUserExpression.h"
#include "Plugins/ExpressionParser/Clang/ClangUtilityFunction.h"
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Core/DumpDataExtractor.h"
@@ -435,75 +435,12 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
// OpenCL and C++ both have bool, true, false keywords.
Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
- // if (Opts.CPlusPlus)
- // Opts.CXXOperatorNames = !Args.hasArg(OPT_fno_operator_names);
- //
- // if (Args.hasArg(OPT_fobjc_gc_only))
- // Opts.setGCMode(LangOptions::GCOnly);
- // else if (Args.hasArg(OPT_fobjc_gc))
- // Opts.setGCMode(LangOptions::HybridGC);
- //
- // if (Args.hasArg(OPT_print_ivar_layout))
- // Opts.ObjCGCBitmapPrint = 1;
- //
- // if (Args.hasArg(OPT_faltivec))
- // Opts.AltiVec = 1;
- //
- // if (Args.hasArg(OPT_pthread))
- // Opts.POSIXThreads = 1;
- //
- // llvm::StringRef Vis = getLastArgValue(Args, OPT_fvisibility,
- // "default");
- // if (Vis == "default")
Opts.setValueVisibilityMode(DefaultVisibility);
- // else if (Vis == "hidden")
- // Opts.setVisibilityMode(LangOptions::Hidden);
- // else if (Vis == "protected")
- // Opts.setVisibilityMode(LangOptions::Protected);
- // else
- // Diags.Report(diag::err_drv_invalid_value)
- // << Args.getLastArg(OPT_fvisibility)->getAsString(Args) << Vis;
-
- // Opts.OverflowChecking = Args.hasArg(OPT_ftrapv);
// Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
// is specified, or -std is set to a conforming mode.
Opts.Trigraphs = !Opts.GNUMode;
- // if (Args.hasArg(OPT_trigraphs))
- // Opts.Trigraphs = 1;
- //
- // Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
- // OPT_fno_dollars_in_identifiers,
- // !Opts.AsmPreprocessor);
- // Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
- // Opts.Microsoft = Args.hasArg(OPT_fms_extensions);
- // Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
- // if (Args.hasArg(OPT_fno_lax_vector_conversions))
- // Opts.LaxVectorConversions = 0;
- // Opts.Exceptions = Args.hasArg(OPT_fexceptions);
- // Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
- // Opts.Blocks = Args.hasArg(OPT_fblocks);
Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault();
- // Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar);
- // Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
- // Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
- // Opts.AssumeSaneOperatorNew =
- // !Args.hasArg(OPT_fno_assume_sane_operator_new);
- // Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
- // Opts.AccessControl = Args.hasArg(OPT_faccess_control);
- // Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
- // Opts.MathErrno = !Args.hasArg(OPT_fno_math_errno);
- // Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth,
- // 99,
- // Diags);
- // Opts.NeXTRuntime = !Args.hasArg(OPT_fgnu_runtime);
- // Opts.ObjCConstantStringClass = getLastArgValue(Args,
- // OPT_fconstant_string_class);
- // Opts.ObjCNonFragileABI = Args.hasArg(OPT_fobjc_nonfragile_abi);
- // Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
- // Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
- // Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
- // Opts.Static = Args.hasArg(OPT_static_define);
Opts.OptimizeSize = 0;
// FIXME: Eliminate this dependency.
@@ -518,18 +455,6 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
//
// FIXME: This is affected by other options (-fno-inline).
Opts.NoInlineDefine = !Opt;
-
- // unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
- // switch (SSP) {
- // default:
- // Diags.Report(diag::err_drv_invalid_value)
- // << Args.getLastArg(OPT_stack_protector)->getAsString(Args) <<
- // SSP;
- // break;
- // case 0: Opts.setStackProtectorMode(LangOptions::SSPOff); break;
- // case 1: Opts.setStackProtectorMode(LangOptions::SSPOn); break;
- // case 2: Opts.setStackProtectorMode(LangOptions::SSPReq); break;
- // }
}
ClangASTContext::ClangASTContext(const char *target_triple)
@@ -596,8 +521,9 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
ast_sp->SetArchitecture(fixed_arch);
ast_sp->m_scratch_ast_source_ap.reset(
new ClangASTSource(target->shared_from_this()));
+ lldbassert(ast_sp->getFileManager());
ast_sp->m_scratch_ast_source_ap->InstallASTContext(
- ast_sp->getASTContext());
+ *ast_sp->getASTContext(), *ast_sp->getFileManager(), true);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source(
ast_sp->m_scratch_ast_source_ap->CreateProxy());
ast_sp->SetExternalSource(proxy_ast_source);
@@ -1430,7 +1356,7 @@ static TemplateParameterList *CreateTemplateParameterList(
is_typename, parameter_pack));
}
}
-
+
if (template_param_infos.packed_args &&
template_param_infos.packed_args->args.size()) {
IdentifierInfo *identifier_info = nullptr;
@@ -2168,21 +2094,21 @@ CompilerType ClangASTContext::GetOrCreateStructForIdentifier(
CompilerType
ClangASTContext::CreateEnumerationType(const char *name, DeclContext *decl_ctx,
const Declaration &decl,
- const CompilerType &integer_clang_type) {
+ const CompilerType &integer_clang_type,
+ bool is_scoped) {
// TODO: Do something intelligent with the Declaration object passed in
// like maybe filling in the SourceLocation with it...
ASTContext *ast = getASTContext();
// TODO: ask about these...
- // const bool IsScoped = false;
// const bool IsFixed = false;
EnumDecl *enum_decl = EnumDecl::Create(
*ast, decl_ctx, SourceLocation(), SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : nullptr, nullptr,
- false, // IsScoped
- false, // IsScopedUsingClassTag
- false); // IsFixed
+ is_scoped, // IsScoped
+ is_scoped, // IsScopedUsingClassTag
+ false); // IsFixed
if (enum_decl) {
// TODO: check if we should be setting the promotion type too?
@@ -4350,6 +4276,9 @@ ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
// We don't know hot to display this type...
return lldb::eTypeClassOther;
@@ -5009,6 +4938,7 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::BuiltinType::Half:
case clang::BuiltinType::Float:
+ case clang::BuiltinType::Float16:
case clang::BuiltinType::Float128:
case clang::BuiltinType::Double:
case clang::BuiltinType::LongDouble:
@@ -5159,6 +5089,9 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
count = 0;
return lldb::eEncodingInvalid;
@@ -5309,6 +5242,9 @@ lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
// We don't know hot to display this type...
return lldb::eFormatBytes;
@@ -7538,99 +7474,122 @@ ClangASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) {
return 0;
}
-CompilerType
-ClangASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t arg_idx,
- lldb::TemplateArgumentKind &kind) {
+const clang::ClassTemplateSpecializationDecl *
+ClangASTContext::GetAsTemplateSpecialization(
+ lldb::opaque_compiler_type_t type) {
if (!type)
- return CompilerType();
+ return nullptr;
clang::QualType qual_type(GetCanonicalQualType(type));
const clang::Type::TypeClass type_class = qual_type->getTypeClass();
switch (type_class) {
- case clang::Type::Record:
- if (GetCompleteType(type)) {
- const clang::CXXRecordDecl *cxx_record_decl =
- qual_type->getAsCXXRecordDecl();
- if (cxx_record_decl) {
- const clang::ClassTemplateSpecializationDecl *template_decl =
- llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
- cxx_record_decl);
- if (template_decl &&
- arg_idx < template_decl->getTemplateArgs().size()) {
- const clang::TemplateArgument &template_arg =
- template_decl->getTemplateArgs()[arg_idx];
- switch (template_arg.getKind()) {
- case clang::TemplateArgument::Null:
- kind = eTemplateArgumentKindNull;
- return CompilerType();
-
- case clang::TemplateArgument::Type:
- kind = eTemplateArgumentKindType;
- return CompilerType(getASTContext(), template_arg.getAsType());
-
- case clang::TemplateArgument::Declaration:
- kind = eTemplateArgumentKindDeclaration;
- return CompilerType();
-
- case clang::TemplateArgument::Integral:
- kind = eTemplateArgumentKindIntegral;
- return CompilerType(getASTContext(),
- template_arg.getIntegralType());
-
- case clang::TemplateArgument::Template:
- kind = eTemplateArgumentKindTemplate;
- return CompilerType();
-
- case clang::TemplateArgument::TemplateExpansion:
- kind = eTemplateArgumentKindTemplateExpansion;
- return CompilerType();
-
- case clang::TemplateArgument::Expression:
- kind = eTemplateArgumentKindExpression;
- return CompilerType();
-
- case clang::TemplateArgument::Pack:
- kind = eTemplateArgumentKindPack;
- return CompilerType();
-
- default:
- llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
- }
- }
- }
- }
- break;
+ case clang::Type::Record: {
+ if (! GetCompleteType(type))
+ return nullptr;
+ const clang::CXXRecordDecl *cxx_record_decl =
+ qual_type->getAsCXXRecordDecl();
+ if (!cxx_record_decl)
+ return nullptr;
+ return llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
+ cxx_record_decl);
+ }
case clang::Type::Typedef:
- return (CompilerType(getASTContext(),
- llvm::cast<clang::TypedefType>(qual_type)
- ->getDecl()
- ->getUnderlyingType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(llvm::cast<clang::TypedefType>(qual_type)
+ ->getDecl()
+ ->getUnderlyingType()
+ .getAsOpaquePtr());
case clang::Type::Auto:
- return (CompilerType(
- getASTContext(),
- llvm::cast<clang::AutoType>(qual_type)->getDeducedType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(llvm::cast<clang::AutoType>(qual_type)
+ ->getDeducedType()
+ .getAsOpaquePtr());
case clang::Type::Elaborated:
- return (CompilerType(
- getASTContext(),
- llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(
+ llvm::cast<clang::ElaboratedType>(qual_type)
+ ->getNamedType()
+ .getAsOpaquePtr());
case clang::Type::Paren:
- return (CompilerType(getASTContext(),
- llvm::cast<clang::ParenType>(qual_type)->desugar()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(
+ llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
default:
- break;
+ return nullptr;
}
- kind = eTemplateArgumentKindNull;
- return CompilerType();
+}
+
+lldb::TemplateArgumentKind
+ClangASTContext::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
+ size_t arg_idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (! template_decl || arg_idx >= template_decl->getTemplateArgs().size())
+ return eTemplateArgumentKindNull;
+
+ switch (template_decl->getTemplateArgs()[arg_idx].getKind()) {
+ case clang::TemplateArgument::Null:
+ return eTemplateArgumentKindNull;
+
+ case clang::TemplateArgument::NullPtr:
+ return eTemplateArgumentKindNullPtr;
+
+ case clang::TemplateArgument::Type:
+ return eTemplateArgumentKindType;
+
+ case clang::TemplateArgument::Declaration:
+ return eTemplateArgumentKindDeclaration;
+
+ case clang::TemplateArgument::Integral:
+ return eTemplateArgumentKindIntegral;
+
+ case clang::TemplateArgument::Template:
+ return eTemplateArgumentKindTemplate;
+
+ case clang::TemplateArgument::TemplateExpansion:
+ return eTemplateArgumentKindTemplateExpansion;
+
+ case clang::TemplateArgument::Expression:
+ return eTemplateArgumentKindExpression;
+
+ case clang::TemplateArgument::Pack:
+ return eTemplateArgumentKindPack;
+ }
+ llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
+}
+
+CompilerType
+ClangASTContext::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (!template_decl || idx >= template_decl->getTemplateArgs().size())
+ return CompilerType();
+
+ const clang::TemplateArgument &template_arg =
+ template_decl->getTemplateArgs()[idx];
+ if (template_arg.getKind() != clang::TemplateArgument::Type)
+ return CompilerType();
+
+ return CompilerType(getASTContext(), template_arg.getAsType());
+}
+
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+ClangASTContext::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (! template_decl || idx >= template_decl->getTemplateArgs().size())
+ return llvm::None;
+
+ const clang::TemplateArgument &template_arg =
+ template_decl->getTemplateArgs()[idx];
+ if (template_arg.getKind() != clang::TemplateArgument::Integral)
+ return llvm::None;
+
+ return {{template_arg.getAsIntegral(),
+ CompilerType(getASTContext(), template_arg.getIntegralType())}};
}
CompilerType ClangASTContext::GetTypeForFormatters(void *type) {
@@ -10121,3 +10080,10 @@ PersistentExpressionState *
ClangASTContextForExpressions::GetPersistentExpressionState() {
return m_persistent_variables.get();
}
+
+clang::ExternalASTMerger &
+ClangASTContextForExpressions::GetMergerUnchecked() {
+ lldbassert(m_scratch_ast_source_ap != nullptr);
+ return m_scratch_ast_source_ap->GetMergerUnchecked();
+}
+
diff --git a/source/Symbol/ClangExternalASTSourceCommon.cpp b/source/Symbol/ClangExternalASTSourceCommon.cpp
index 7a1a0f23a7ce..992a76352d92 100644
--- a/source/Symbol/ClangExternalASTSourceCommon.cpp
+++ b/source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -10,6 +10,8 @@
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Utility/Stream.h"
+#include <mutex>
+
using namespace lldb_private;
uint64_t g_TotalSizeOfMetadata = 0;
@@ -18,15 +20,19 @@ typedef llvm::DenseMap<clang::ExternalASTSource *,
ClangExternalASTSourceCommon *>
ASTSourceMap;
-static ASTSourceMap &GetSourceMap() {
+static ASTSourceMap &GetSourceMap(std::unique_lock<std::mutex> &guard) {
// Intentionally leaked to avoid problems with global destructors.
static ASTSourceMap *s_source_map = new ASTSourceMap;
+ static std::mutex s_mutex;
+ std::unique_lock<std::mutex> locked_guard(s_mutex);
+ guard.swap(locked_guard);
return *s_source_map;
}
ClangExternalASTSourceCommon *
ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
- ASTSourceMap &source_map = GetSourceMap();
+ std::unique_lock<std::mutex> guard;
+ ASTSourceMap &source_map = GetSourceMap(guard);
ASTSourceMap::iterator iter = source_map.find(source);
@@ -40,11 +46,13 @@ ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
ClangExternalASTSourceCommon::ClangExternalASTSourceCommon()
: clang::ExternalASTSource() {
g_TotalSizeOfMetadata += m_metadata.size();
- GetSourceMap()[this] = this;
+ std::unique_lock<std::mutex> guard;
+ GetSourceMap(guard)[this] = this;
}
ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() {
- GetSourceMap().erase(this);
+ std::unique_lock<std::mutex> guard;
+ GetSourceMap(guard).erase(this);
g_TotalSizeOfMetadata -= m_metadata.size();
}
diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp
index bc367496003e..df71b17c09d0 100644
--- a/source/Symbol/CompactUnwindInfo.cpp
+++ b/source/Symbol/CompactUnwindInfo.cpp
@@ -7,22 +7,18 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-#include <algorithm>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/CompactUnwindInfo.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Section.h"
-#include "lldb/Symbol/CompactUnwindInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include <algorithm>
#include "llvm/Support/MathExtras.h"
diff --git a/source/Symbol/CompilerType.cpp b/source/Symbol/CompilerType.cpp
index e3880af27f22..5d845361b03c 100644
--- a/source/Symbol/CompilerType.cpp
+++ b/source/Symbol/CompilerType.cpp
@@ -690,15 +690,26 @@ size_t CompilerType::GetNumTemplateArguments() const {
return 0;
}
-CompilerType
-CompilerType::GetTemplateArgument(size_t idx,
- lldb::TemplateArgumentKind &kind) const {
+TemplateArgumentKind CompilerType::GetTemplateArgumentKind(size_t idx) const {
+ if (IsValid())
+ return m_type_system->GetTemplateArgumentKind(m_type, idx);
+ return eTemplateArgumentKindNull;
+}
+
+CompilerType CompilerType::GetTypeTemplateArgument(size_t idx) const {
if (IsValid()) {
- return m_type_system->GetTemplateArgument(m_type, idx, kind);
+ return m_type_system->GetTypeTemplateArgument(m_type, idx);
}
return CompilerType();
}
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+CompilerType::GetIntegralTemplateArgument(size_t idx) const {
+ if (IsValid())
+ return m_type_system->GetIntegralTemplateArgument(m_type, idx);
+ return llvm::None;
+}
+
CompilerType CompilerType::GetTypeForFormatters() const {
if (IsValid())
return m_type_system->GetTypeForFormatters(m_type);
@@ -997,7 +1008,7 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx,
if (addr == 0)
return false;
// The address is an address in this process, so just copy it
- memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+ memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
return true;
} else {
Process *process = nullptr;
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index 9b1f8c694ccf..572648d05f09 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -7,22 +7,19 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-#include <list>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Host/Host.h"
-#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Timer.h"
+#include <list>
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/JavaASTContext.cpp b/source/Symbol/JavaASTContext.cpp
index ae4e9d5134b5..ff317eb19e97 100644
--- a/source/Symbol/JavaASTContext.cpp
+++ b/source/Symbol/JavaASTContext.cpp
@@ -7,9 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include <sstream>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
@@ -17,11 +15,12 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Stream.h"
+#include <sstream>
#include "Plugins/SymbolFile/DWARF/DWARFASTParserJava.h"
@@ -134,9 +133,9 @@ public:
obj_load_address.SetValueType(Value::eValueTypeLoadAddress);
Value result;
- if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(),
- nullptr, nullptr, 0, &obj_load_address,
- nullptr, result, nullptr)) {
+ if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(), 0,
+ &obj_load_address, nullptr, result,
+ nullptr)) {
Status error;
lldb::addr_t type_id_addr = result.GetScalar().UInt();
@@ -315,9 +314,8 @@ public:
ExecutionContextScope *exec_ctx_scope = value_obj->GetExecutionContextRef()
.Lock(true)
.GetBestExecutionContextScope();
- if (m_length_expression.Evaluate(exec_ctx_scope, nullptr, nullptr, 0,
- nullptr, &obj_load_address, result,
- nullptr))
+ if (m_length_expression.Evaluate(exec_ctx_scope, 0, nullptr,
+ &obj_load_address, result, nullptr))
return result.GetScalar().UInt();
return UINT32_MAX;
@@ -885,13 +883,6 @@ JavaASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) {
return 0;
}
-CompilerType
-JavaASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) {
- return CompilerType();
-}
-
uint32_t JavaASTContext::GetNumFields(lldb::opaque_compiler_type_t type) {
if (JavaObjectType *obj =
llvm::dyn_cast<JavaObjectType>(static_cast<JavaType *>(type))) {
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index fd4180862c15..7d73cb19d508 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -348,6 +348,7 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) {
case eSectionTypeDWARFDebugAbbrev:
case eSectionTypeDWARFDebugAddr:
case eSectionTypeDWARFDebugAranges:
+ case eSectionTypeDWARFDebugCuIndex:
case eSectionTypeDWARFDebugFrame:
case eSectionTypeDWARFDebugInfo:
case eSectionTypeDWARFDebugLine:
@@ -482,9 +483,9 @@ size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
return m_data.CopyData(offset, length, dst);
}
-size_t ObjectFile::ReadSectionData(const Section *section,
+size_t ObjectFile::ReadSectionData(Section *section,
lldb::offset_t section_offset, void *dst,
- size_t dst_len) const {
+ size_t dst_len) {
assert(section);
section_offset *= section->GetTargetByteSize();
@@ -504,6 +505,9 @@ size_t ObjectFile::ReadSectionData(const Section *section,
dst_len, error);
}
} else {
+ if (!section->IsRelocated())
+ RelocateSection(section);
+
const lldb::offset_t section_file_size = section->GetFileSize();
if (section_offset < section_file_size) {
const size_t section_bytes_left = section_file_size - section_offset;
@@ -530,8 +534,8 @@ size_t ObjectFile::ReadSectionData(const Section *section,
//----------------------------------------------------------------------
// Get the section data the file on disk
//----------------------------------------------------------------------
-size_t ObjectFile::ReadSectionData(const Section *section,
- DataExtractor &section_data) const {
+size_t ObjectFile::ReadSectionData(Section *section,
+ DataExtractor &section_data) {
// If some other objectfile owns this data, pass this to them.
if (section->GetObjectFile() != this)
return section->GetObjectFile()->ReadSectionData(section, section_data);
@@ -557,22 +561,9 @@ size_t ObjectFile::ReadSectionData(const Section *section,
} else {
// The object file now contains a full mmap'ed copy of the object file data,
// so just use this
- return MemoryMapSectionData(section, section_data);
- }
-}
-
-size_t ObjectFile::MemoryMapSectionData(const Section *section,
- DataExtractor &section_data) const {
- // If some other objectfile owns this data, pass this to them.
- if (section->GetObjectFile() != this)
- return section->GetObjectFile()->MemoryMapSectionData(section,
- section_data);
+ if (!section->IsRelocated())
+ RelocateSection(section);
- if (IsInMemory()) {
- return ReadSectionData(section, section_data);
- } else {
- // The object file now contains a full mmap'ed copy of the object file data,
- // so just use this
return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
}
@@ -693,3 +684,7 @@ Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
}
return error;
}
+
+void ObjectFile::RelocateSection(lldb_private::Section *section)
+{
+}
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 3e2c965509d3..4ac30649110f 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -399,29 +399,6 @@ void Symtab::InitNameIndexes() {
m_basename_to_index.SizeToFit();
m_method_to_index.Sort();
m_method_to_index.SizeToFit();
-
- // static StreamFile a ("/tmp/a.txt");
- //
- // count = m_basename_to_index.GetSize();
- // if (count)
- // {
- // for (size_t i=0; i<count; ++i)
- // {
- // if (m_basename_to_index.GetValueAtIndex(i, entry.value))
- // a.Printf ("%s BASENAME\n",
- // m_symbols[entry.value].GetMangled().GetName().GetCString());
- // }
- // }
- // count = m_method_to_index.GetSize();
- // if (count)
- // {
- // for (size_t i=0; i<count; ++i)
- // {
- // if (m_method_to_index.GetValueAtIndex(i, entry.value))
- // a.Printf ("%s METHOD\n",
- // m_symbols[entry.value].GetMangled().GetName().GetCString());
- // }
- // }
}
}
@@ -616,8 +593,10 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
std::stable_sort(indexes.begin(), indexes.end(), comparator);
// Remove any duplicates if requested
- if (remove_duplicates)
- std::unique(indexes.begin(), indexes.end());
+ if (remove_duplicates) {
+ auto last = std::unique(indexes.begin(), indexes.end());
+ indexes.erase(last, indexes.end());
+ }
}
uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 53d9c5cc96a9..53bf3e850055 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -404,7 +404,7 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
// The address is an address in this process, so just copy it
if (addr == 0)
return false;
- memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+ memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
return true;
} else {
if (exe_ctx) {
diff --git a/source/Symbol/TypeSystem.cpp b/source/Symbol/TypeSystem.cpp
index fa5e0bc7da6e..b99f21e1e347 100644
--- a/source/Symbol/TypeSystem.cpp
+++ b/source/Symbol/TypeSystem.cpp
@@ -23,19 +23,20 @@
#include "lldb/Symbol/CompilerType.h"
using namespace lldb_private;
+using namespace lldb;
TypeSystem::TypeSystem(LLVMCastKind kind) : m_kind(kind), m_sym_file(nullptr) {}
TypeSystem::~TypeSystem() {}
-lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Module *module) {
+static lldb::TypeSystemSP CreateInstanceHelper(lldb::LanguageType language,
+ Module *module, Target *target) {
uint32_t i = 0;
TypeSystemCreateInstance create_callback;
while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
i++)) != nullptr) {
lldb::TypeSystemSP type_system_sp =
- create_callback(language, module, nullptr);
+ create_callback(language, module, target);
if (type_system_sp)
return type_system_sp;
}
@@ -44,18 +45,13 @@ lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
}
lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Target *target) {
- uint32_t i = 0;
- TypeSystemCreateInstance create_callback;
- while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
- i++)) != nullptr) {
- lldb::TypeSystemSP type_system_sp =
- create_callback(language, nullptr, target);
- if (type_system_sp)
- return type_system_sp;
- }
+ Module *module) {
+ return CreateInstanceHelper(language, module, nullptr);
+}
- return lldb::TypeSystemSP();
+lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
+ Target *target) {
+ return CreateInstanceHelper(language, nullptr, target);
}
bool TypeSystem::IsAnonymousType(lldb::opaque_compiler_type_t type) {
@@ -105,6 +101,22 @@ CompilerType TypeSystem::GetTypeForFormatters(void *type) {
return CompilerType(this, type);
}
+TemplateArgumentKind
+TypeSystem::GetTemplateArgumentKind(opaque_compiler_type_t type, size_t idx) {
+ return eTemplateArgumentKindNull;
+}
+
+CompilerType TypeSystem::GetTypeTemplateArgument(opaque_compiler_type_t type,
+ size_t idx) {
+ return CompilerType();
+}
+
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type,
+ size_t idx) {
+ return llvm::None;
+}
+
LazyBool TypeSystem::ShouldPrintAsOneLiner(void *type, ValueObject *valobj) {
return eLazyBoolCalculate;
}
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index ff32aa731465..1957bcef1f3a 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -425,14 +425,8 @@ Status Variable::GetValuesForVariableExpressionPath(
llvm::StringRef variable_sub_expr_path =
variable_expr_path.drop_front(variable_name.size());
if (!variable_sub_expr_path.empty()) {
- ValueObject::ExpressionPathScanEndReason reason_to_stop;
- ValueObject::ExpressionPathEndResultType final_value_type;
- ValueObject::GetValueForExpressionPathOptions options;
- ValueObject::ExpressionPathAftermath final_task_on_target;
-
valobj_sp = variable_valobj_sp->GetValueForExpressionPath(
- variable_sub_expr_path, &reason_to_stop, &final_value_type, options,
- &final_task_on_target);
+ variable_sub_expr_path);
if (!valobj_sp) {
error.SetErrorStringWithFormat(
"invalid expression path '%s' for variable '%s'",
diff --git a/source/Target/PathMappingList.cpp b/source/Target/PathMappingList.cpp
index b834a3600d0b..782c6e49623c 100644
--- a/source/Target/PathMappingList.cpp
+++ b/source/Target/PathMappingList.cpp
@@ -85,7 +85,6 @@ void PathMappingList::Insert(const ConstString &path,
bool PathMappingList::Replace(const ConstString &path,
const ConstString &replacement, uint32_t index,
bool notify) {
- iterator insert_iter;
if (index >= m_pairs.size())
return false;
++m_mod_id;
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index 498facf8e0d0..5d60bb791555 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -356,6 +356,12 @@ PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr,
return platform_sp;
}
+ArchSpec Platform::GetAugmentedArchSpec(Platform *platform, llvm::StringRef triple) {
+ if (platform)
+ return platform->GetAugmentedArchSpec(triple);
+ return HostInfo::GetAugmentedArchSpec(triple);
+}
+
//------------------------------------------------------------------
/// Default Constructor
//------------------------------------------------------------------
@@ -963,6 +969,34 @@ const ArchSpec &Platform::GetSystemArchitecture() {
return m_system_arch;
}
+ArchSpec Platform::GetAugmentedArchSpec(llvm::StringRef triple) {
+ if (triple.empty())
+ return ArchSpec();
+ llvm::Triple normalized_triple(llvm::Triple::normalize(triple));
+ if (!ArchSpec::ContainsOnlyArch(normalized_triple))
+ return ArchSpec(triple);
+
+ if (auto kind = HostInfo::ParseArchitectureKind(triple))
+ return HostInfo::GetArchitecture(*kind);
+
+ ArchSpec compatible_arch;
+ ArchSpec raw_arch(triple);
+ if (!IsCompatibleArchitecture(raw_arch, false, &compatible_arch))
+ return raw_arch;
+
+ if (!compatible_arch.IsValid())
+ return ArchSpec(normalized_triple);
+
+ const llvm::Triple &compatible_triple = compatible_arch.GetTriple();
+ if (normalized_triple.getVendorName().empty())
+ normalized_triple.setVendor(compatible_triple.getVendor());
+ if (normalized_triple.getOSName().empty())
+ normalized_triple.setOS(compatible_triple.getOS());
+ if (normalized_triple.getEnvironmentName().empty())
+ normalized_triple.setEnvironment(compatible_triple.getEnvironment());
+ return ArchSpec(normalized_triple);
+}
+
Status Platform::ConnectRemote(Args &args) {
Status error;
if (IsHost())
@@ -1162,7 +1196,7 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// open for stdin/out/err after we have already opened the master
// so we can read/write stdin/out/err.
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
- if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+ if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
}
} else {
@@ -1316,14 +1350,18 @@ Status Platform::Unlink(const FileSpec &path) {
return error;
}
-uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr,
+ addr_t length, unsigned prot,
+ unsigned flags, addr_t fd,
+ addr_t offset) {
uint64_t flags_platform = 0;
if (flags & eMmapFlagsPrivate)
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= MAP_ANON;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ return args;
}
lldb_private::Status Platform::RunShellCommand(
@@ -1874,6 +1912,12 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
trap_opcode_size = sizeof(g_ppc_opcode);
} break;
+ case llvm::Triple::ppc64le: {
+ static const uint8_t g_ppc64le_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
+ trap_opcode = g_ppc64le_opcode;
+ trap_opcode_size = sizeof(g_ppc64le_opcode);
+ } break;
+
case llvm::Triple::x86:
case llvm::Triple::x86_64: {
static const uint8_t g_i386_opcode[] = {0xCC};
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index 6cbe289ef26b..8fb149fab063 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -144,6 +144,9 @@ static PropertyDefinition g_properties[] = {
{"optimization-warnings", OptionValue::eTypeBoolean, false, true, nullptr,
nullptr, "If true, warn when stopped in code that is optimized where "
"stepping and variable availability may not behave as expected."},
+ {"stop-on-exec", OptionValue::eTypeBoolean, true, true,
+ nullptr, nullptr,
+ "If true, stop when a shared library is loaded or unloaded."},
{nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, nullptr, nullptr}};
enum {
@@ -155,7 +158,8 @@ enum {
ePropertyStopOnSharedLibraryEvents,
ePropertyDetachKeepsStopped,
ePropertyMemCacheLineSize,
- ePropertyWarningOptimization
+ ePropertyWarningOptimization,
+ ePropertyStopOnExec
};
ProcessProperties::ProcessProperties(lldb_private::Process *process)
@@ -272,6 +276,12 @@ bool ProcessProperties::GetWarningsOptimization() const {
nullptr, idx, g_properties[idx].default_uint_value != 0);
}
+bool ProcessProperties::GetStopOnExec() const {
+ const uint32_t idx = ePropertyStopOnExec;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(
+ nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
void ProcessInstanceInfo::Dump(Stream &s, Platform *platform) const {
const char *cstr;
if (m_pid != LLDB_INVALID_PROCESS_ID)
@@ -480,8 +490,8 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
execution_context ? execution_context->GetTargetSP() : TargetSP();
PlatformSP platform_sp =
target_sp ? target_sp->GetPlatform() : PlatformSP();
- if (!launch_info.GetArchitecture().SetTriple(option_arg, platform_sp.get()))
- launch_info.GetArchitecture().SetTriple(option_arg);
+ launch_info.GetArchitecture() =
+ Platform::GetAugmentedArchSpec(platform_sp.get(), option_arg);
} break;
case 'A': // Disable ASLR.
@@ -743,8 +753,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp,
m_profile_data_comm_mutex(), m_profile_data(), m_iohandler_sync(0),
m_memory_cache(*this), m_allocated_memory_cache(*this),
m_should_detach(false), m_next_event_action_ap(), m_public_run_lock(),
- m_private_run_lock(), m_stop_info_override_callback(nullptr),
- m_finalizing(false), m_finalize_called(false),
+ m_private_run_lock(), m_finalizing(false), m_finalize_called(false),
m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false),
m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false),
m_can_interpret_function_calls(false), m_warnings_issued(),
@@ -871,7 +880,6 @@ void Process::Finalize() {
m_language_runtimes.clear();
m_instrumentation_runtimes.clear();
m_next_event_action_ap.reset();
- m_stop_info_override_callback = nullptr;
// Clear the last natural stop ID since it has a strong
// reference to this process
m_mod_id.SetStopEventForLastNaturalStopID(EventSP());
@@ -1562,7 +1570,6 @@ uint32_t Process::AssignIndexIDToThread(uint64_t thread_id) {
}
StateType Process::GetState() {
- // If any other threads access this we will need a mutex for it
return m_public_state.GetValue();
}
@@ -1621,7 +1628,12 @@ Status Process::Resume() {
log->Printf("Process::Resume: -- TrySetRunning failed, not resuming.");
return error;
}
- return PrivateResume();
+ Status error = PrivateResume();
+ if (!error.Success()) {
+ // Undo running state change
+ m_public_run_lock.SetStopped();
+ }
+ return error;
}
Status Process::ResumeSynchronous(Stream *stream) {
@@ -1650,6 +1662,9 @@ Status Process::ResumeSynchronous(Stream *stream) {
error.SetErrorStringWithFormat(
"process not in stopped state after synchronous resume: %s",
StateAsCString(state));
+ } else {
+ // Undo running state change
+ m_public_run_lock.SetStopped();
}
// Undo the hijacking of process events...
@@ -2712,7 +2727,6 @@ Status Process::Launch(ProcessLaunchInfo &launch_info) {
m_system_runtime_ap.reset();
m_os_ap.reset();
m_process_input_reader.reset();
- m_stop_info_override_callback = nullptr;
Module *exe_module = GetTarget().GetExecutableModulePointer();
if (exe_module) {
@@ -2800,9 +2814,6 @@ Status Process::Launch(ProcessLaunchInfo &launch_info) {
else
StartPrivateStateThread();
- m_stop_info_override_callback =
- GetTarget().GetArchitecture().GetStopInfoOverrideCallback();
-
// Target was stopped at entry as was intended. Need to notify the
// listeners
// about it.
@@ -2986,7 +2997,6 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
m_jit_loaders_ap.reset();
m_system_runtime_ap.reset();
m_os_ap.reset();
- m_stop_info_override_callback = nullptr;
lldb::pid_t attach_pid = attach_info.GetProcessID();
Status error;
@@ -3219,8 +3229,6 @@ void Process::CompleteAttach() {
: "<none>");
}
}
-
- m_stop_info_override_callback = process_arch.GetStopInfoOverrideCallback();
}
Status Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) {
@@ -5849,7 +5857,6 @@ void Process::DidExec() {
m_instrumentation_runtimes.clear();
m_thread_list.DiscardThreadPlans();
m_memory_cache.Clear(true);
- m_stop_info_override_callback = nullptr;
DoDidExec();
CompleteAttach();
// Flush the process (threads and all stack frames) after running
diff --git a/source/Target/ProcessLaunchInfo.cpp b/source/Target/ProcessLaunchInfo.cpp
index 3fa40dcc5cab..284df9fd8b58 100644
--- a/source/Target/ProcessLaunchInfo.cpp
+++ b/source/Target/ProcessLaunchInfo.cpp
@@ -39,10 +39,9 @@ using namespace lldb_private;
ProcessLaunchInfo::ProcessLaunchInfo()
: ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(0),
- m_file_actions(), m_pty(new lldb_utility::PseudoTerminal),
- m_resume_count(0), m_monitor_callback(nullptr),
- m_monitor_callback_baton(nullptr), m_monitor_signals(false),
- m_listener_sp(), m_hijack_listener_sp() {}
+ m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0),
+ m_monitor_callback(nullptr), m_monitor_callback_baton(nullptr),
+ m_monitor_signals(false), m_listener_sp(), m_hijack_listener_sp() {}
ProcessLaunchInfo::ProcessLaunchInfo(const FileSpec &stdin_file_spec,
const FileSpec &stdout_file_spec,
@@ -50,10 +49,9 @@ ProcessLaunchInfo::ProcessLaunchInfo(const FileSpec &stdin_file_spec,
const FileSpec &working_directory,
uint32_t launch_flags)
: ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(launch_flags),
- m_file_actions(), m_pty(new lldb_utility::PseudoTerminal),
- m_resume_count(0), m_monitor_callback(nullptr),
- m_monitor_callback_baton(nullptr), m_monitor_signals(false),
- m_listener_sp(), m_hijack_listener_sp() {
+ m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0),
+ m_monitor_callback(nullptr), m_monitor_callback_baton(nullptr),
+ m_monitor_signals(false), m_listener_sp(), m_hijack_listener_sp() {
if (stdin_file_spec) {
FileAction file_action;
const bool read = true;
diff --git a/source/Target/RegisterContext.cpp b/source/Target/RegisterContext.cpp
index 66164c175e41..28beb7bcb5e8 100644
--- a/source/Target/RegisterContext.cpp
+++ b/source/Target/RegisterContext.cpp
@@ -93,10 +93,9 @@ RegisterContext::UpdateDynamicRegisterSize(const lldb_private::ArchSpec &arch,
Value result;
Status error;
const lldb::offset_t offset = 0;
- if (dwarf_expr.Evaluate(&exe_ctx, nullptr, nullptr, this, opcode_ctx,
- dwarf_data, nullptr, offset, dwarf_opcode_len,
- eRegisterKindDWARF, nullptr, nullptr, result,
- &error)) {
+ if (dwarf_expr.Evaluate(&exe_ctx, this, opcode_ctx, dwarf_data, nullptr,
+ offset, dwarf_opcode_len, eRegisterKindDWARF, nullptr,
+ nullptr, result, &error)) {
expr_result = result.GetScalar().SInt(-1);
switch (expr_result) {
case 0:
@@ -457,132 +456,3 @@ bool RegisterContext::ConvertBetweenRegisterKinds(lldb::RegisterKind source_rk,
}
return false;
}
-
-// bool
-// RegisterContext::ReadRegisterValue (uint32_t reg, Scalar &value)
-//{
-// DataExtractor data;
-// if (!ReadRegisterBytes (reg, data))
-// return false;
-//
-// const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg);
-// uint32_t offset = 0;
-// switch (reg_info->encoding)
-// {
-// case eEncodingInvalid:
-// case eEncodingVector:
-// break;
-//
-// case eEncodingUint:
-// switch (reg_info->byte_size)
-// {
-// case 1:
-// {
-// value = data.GetU8 (&offset);
-// return true;
-// }
-// case 2:
-// {
-// value = data.GetU16 (&offset);
-// return true;
-// }
-// case 4:
-// {
-// value = data.GetU32 (&offset);
-// return true;
-// }
-// case 8:
-// {
-// value = data.GetU64 (&offset);
-// return true;
-// }
-// }
-// break;
-// case eEncodingSint:
-// switch (reg_info->byte_size)
-// {
-// case 1:
-// {
-// int8_t v;
-// if (data.ExtractBytes (0, sizeof (int8_t),
-// endian::InlHostByteOrder(), &v) != sizeof (int8_t))
-// return false;
-// value = v;
-// return true;
-// }
-// case 2:
-// {
-// int16_t v;
-// if (data.ExtractBytes (0, sizeof (int16_t),
-// endian::InlHostByteOrder(), &v) != sizeof (int16_t))
-// return false;
-// value = v;
-// return true;
-// }
-// case 4:
-// {
-// int32_t v;
-// if (data.ExtractBytes (0, sizeof (int32_t),
-// endian::InlHostByteOrder(), &v) != sizeof (int32_t))
-// return false;
-// value = v;
-// return true;
-// }
-// case 8:
-// {
-// int64_t v;
-// if (data.ExtractBytes (0, sizeof (int64_t),
-// endian::InlHostByteOrder(), &v) != sizeof (int64_t))
-// return false;
-// value = v;
-// return true;
-// }
-// }
-// break;
-// case eEncodingIEEE754:
-// switch (reg_info->byte_size)
-// {
-// case sizeof (float):
-// {
-// float v;
-// if (data.ExtractBytes (0, sizeof (float),
-// endian::InlHostByteOrder(), &v) != sizeof (float))
-// return false;
-// value = v;
-// return true;
-// }
-// case sizeof (double):
-// {
-// double v;
-// if (data.ExtractBytes (0, sizeof (double),
-// endian::InlHostByteOrder(), &v) != sizeof (double))
-// return false;
-// value = v;
-// return true;
-// }
-// case sizeof (long double):
-// {
-// double v;
-// if (data.ExtractBytes (0, sizeof (long double),
-// endian::InlHostByteOrder(), &v) != sizeof (long double))
-// return false;
-// value = v;
-// return true;
-// }
-// }
-// break;
-// }
-// return false;
-//}
-//
-// bool
-// RegisterContext::WriteRegisterValue (uint32_t reg, const Scalar &value)
-//{
-// DataExtractor data;
-// if (!value.IsValid())
-// return false;
-// if (!value.GetData (data))
-// return false;
-//
-// return WriteRegisterBytes (reg, data);
-//}
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index 30fceb11c11f..dd44eac8e50c 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -1089,8 +1089,8 @@ bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Status *error_ptr) {
exe_ctx.GetTargetPtr());
if (m_sc.function->GetFrameBaseExpression().Evaluate(
- &exe_ctx, nullptr, nullptr, nullptr, loclist_base_addr, nullptr,
- nullptr, expr_value, &m_frame_base_error) == false) {
+ &exe_ctx, nullptr, loclist_base_addr, nullptr, nullptr,
+ expr_value, &m_frame_base_error) == false) {
// We should really have an error if evaluate returns, but in case
// we don't, lets set the error to something at least.
if (m_frame_base_error.Success())
diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp
index 6af5ce1b2ebf..652ad8a05445 100644
--- a/source/Target/StopInfo.cpp
+++ b/source/Target/StopInfo.cpp
@@ -393,7 +393,10 @@ protected:
for (size_t j = 0; j < num_owners; j++) {
lldb::BreakpointLocationSP bp_loc_sp = site_locations.GetByIndex(j);
-
+ StreamString loc_desc;
+ if (log) {
+ bp_loc_sp->GetDescription(&loc_desc, eDescriptionLevelBrief);
+ }
// If another action disabled this breakpoint or its location, then
// don't run the actions.
if (!bp_loc_sp->IsEnabled() ||
@@ -405,16 +408,16 @@ protected:
// this thread. Skip the ones that aren't:
if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) {
if (log) {
- StreamString s;
- bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
log->Printf("Breakpoint %s hit on thread 0x%llx but it was not "
"for this thread, continuing.",
- s.GetData(), static_cast<unsigned long long>(
+ loc_desc.GetData(), static_cast<unsigned long long>(
thread_sp->GetID()));
}
continue;
}
+ internal_breakpoint = bp_loc_sp->GetBreakpoint().IsInternal();
+
// First run the precondition, but since the precondition is per
// breakpoint, only run it once
// per breakpoint.
@@ -458,11 +461,10 @@ protected:
error_sp->Flush();
} else {
if (log) {
- StreamString s;
- bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
log->Printf("Condition evaluated for breakpoint %s on thread "
"0x%llx conditon_says_stop: %i.",
- s.GetData(), static_cast<unsigned long long>(
+ loc_desc.GetData(),
+ static_cast<unsigned long long>(
thread_sp->GetID()),
condition_says_stop);
}
@@ -477,7 +479,26 @@ protected:
}
}
- bool callback_says_stop;
+ // Check the auto-continue bit on the location, do this before the
+ // callback since it may change this, but that would be for the
+ // NEXT hit. Note, you might think you could check auto-continue
+ // before the condition, and not evaluate the condition if it says
+ // to continue. But failing the condition means the breakpoint was
+ // effectively NOT HIT. So these two states are different.
+ bool auto_continue_says_stop = true;
+ if (bp_loc_sp->IsAutoContinue())
+ {
+ if (log)
+ log->Printf("Continuing breakpoint %s as AutoContinue was set.",
+ loc_desc.GetData());
+ // We want this stop reported, so you will know we auto-continued
+ // but only for external breakpoints:
+ if (!internal_breakpoint)
+ thread_sp->SetShouldReportStop(eVoteYes);
+ auto_continue_says_stop = false;
+ }
+
+ bool callback_says_stop = true;
// FIXME: For now the callbacks have to run in async mode - the
// first time we restart we need
@@ -493,11 +514,8 @@ protected:
debugger.SetAsyncExecution(old_async);
- if (callback_says_stop)
+ if (callback_says_stop && auto_continue_says_stop)
m_should_stop = true;
-
- if (m_should_stop && !bp_loc_sp->GetBreakpoint().IsInternal())
- internal_breakpoint = false;
// If we are going to stop for this breakpoint, then remove the
// breakpoint.
@@ -506,7 +524,6 @@ protected:
thread_sp->GetProcess()->GetTarget().RemoveBreakpointByID(
bp_loc_sp->GetBreakpoint().GetID());
}
-
// Also make sure that the callback hasn't continued the target.
// If it did, when we'll set m_should_start to false and get out of
// here.
@@ -1071,6 +1088,10 @@ private:
ExpressionVariableSP m_expression_variable_sp;
};
+//----------------------------------------------------------------------
+// StopInfoExec
+//----------------------------------------------------------------------
+
class StopInfoExec : public StopInfo {
public:
StopInfoExec(Thread &thread)
@@ -1078,6 +1099,13 @@ public:
~StopInfoExec() override = default;
+ bool ShouldStop(Event *event_ptr) override {
+ ThreadSP thread_sp(m_thread_wp.lock());
+ if (thread_sp)
+ return thread_sp->GetProcess()->GetStopOnExec();
+ return false;
+ }
+
StopReason GetStopReason() const override { return eStopReasonExec; }
const char *GetDescription() override { return "exec"; }
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index d97f651ca08b..903f50887fec 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -26,6 +26,7 @@
#include "lldb/Core/Event.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/State.h"
@@ -65,6 +66,16 @@ using namespace lldb_private;
constexpr std::chrono::milliseconds EvaluateExpressionOptions::default_timeout;
+Target::Arch::Arch(const ArchSpec &spec)
+ : m_spec(spec),
+ m_plugin_up(PluginManager::CreateArchitectureInstance(spec)) {}
+
+const Target::Arch& Target::Arch::operator=(const ArchSpec &spec) {
+ m_spec = spec;
+ m_plugin_up = PluginManager::CreateArchitectureInstance(spec);
+ return *this;
+}
+
ConstString &Target::GetStaticBroadcasterClass() {
static ConstString class_name("lldb.target");
return class_name;
@@ -76,12 +87,12 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch,
Broadcaster(debugger.GetBroadcasterManager(),
Target::GetStaticBroadcasterClass().AsCString()),
ExecutionContextScope(), m_debugger(debugger), m_platform_sp(platform_sp),
- m_mutex(), m_arch(target_arch), m_images(this), m_section_load_history(),
- m_breakpoint_list(false), m_internal_breakpoint_list(true),
- m_watchpoint_list(), m_process_sp(), m_search_filter_sp(),
- m_image_search_paths(ImageSearchPathsChanged, this), m_ast_importer_sp(),
- m_source_manager_ap(), m_stop_hooks(), m_stop_hook_next_id(0),
- m_valid(true), m_suppress_stop_hooks(false),
+ m_mutex(), m_arch(target_arch),
+ m_images(this), m_section_load_history(), m_breakpoint_list(false),
+ m_internal_breakpoint_list(true), m_watchpoint_list(), m_process_sp(),
+ m_search_filter_sp(), m_image_search_paths(ImageSearchPathsChanged, this),
+ m_ast_importer_sp(), m_source_manager_ap(), m_stop_hooks(),
+ m_stop_hook_next_id(0), m_valid(true), m_suppress_stop_hooks(false),
m_is_dummy_target(is_dummy_target)
{
@@ -96,10 +107,11 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch,
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
if (log)
log->Printf("%p Target::Target()", static_cast<void *>(this));
- if (m_arch.IsValid()) {
- LogIfAnyCategoriesSet(
- LIBLLDB_LOG_TARGET, "Target::Target created with architecture %s (%s)",
- m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
+ if (target_arch.IsValid()) {
+ LogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET,
+ "Target::Target created with architecture %s (%s)",
+ target_arch.GetArchitectureName(),
+ target_arch.GetTriple().getTriple().c_str());
}
}
@@ -123,6 +135,13 @@ void Target::PrimeFromDummyTarget(Target *target) {
BreakpointSP new_bp(new Breakpoint(*this, *breakpoint_sp.get()));
AddBreakpoint(new_bp, false);
}
+
+ for (auto bp_name_entry : target->m_breakpoint_names)
+ {
+
+ BreakpointName *new_bp_name = new BreakpointName(*bp_name_entry.second);
+ AddBreakpointName(new_bp_name);
+ }
}
void Target::Dump(Stream *s, lldb::DescriptionLevel description_level) {
@@ -243,7 +262,7 @@ void Target::Destroy() {
m_valid = false;
DeleteCurrentProcess();
m_platform_sp.reset();
- m_arch.Clear();
+ m_arch = ArchSpec();
ClearModules(true);
m_section_load_history.Clear();
const bool notify = false;
@@ -601,6 +620,112 @@ void Target::AddBreakpoint(lldb::BreakpointSP bp_sp, bool internal) {
}
}
+void Target::AddNameToBreakpoint(BreakpointID &id,
+ const char *name,
+ Status &error)
+ {
+ BreakpointSP bp_sp
+ = m_breakpoint_list.FindBreakpointByID(id.GetBreakpointID());
+ if (!bp_sp)
+ {
+ StreamString s;
+ id.GetDescription(&s, eDescriptionLevelBrief);
+ error.SetErrorStringWithFormat("Could not find breakpoint %s",
+ s.GetData());
+ return;
+ }
+ AddNameToBreakpoint(bp_sp, name, error);
+ }
+
+void Target::AddNameToBreakpoint(BreakpointSP &bp_sp,
+ const char *name,
+ Status &error)
+ {
+ if (!bp_sp)
+ return;
+
+ BreakpointName *bp_name = FindBreakpointName(ConstString(name), true, error);
+ if (!bp_name)
+ return;
+
+ bp_name->ConfigureBreakpoint(bp_sp);
+ bp_sp->AddName(name);
+ }
+
+void Target::AddBreakpointName(BreakpointName *bp_name) {
+ m_breakpoint_names.insert(std::make_pair(bp_name->GetName(), bp_name));
+}
+
+BreakpointName *Target::FindBreakpointName(const ConstString &name,
+ bool can_create,
+ Status &error)
+{
+ BreakpointID::StringIsBreakpointName(name.GetStringRef(), error);
+ if (!error.Success())
+ return nullptr;
+
+ BreakpointNameList::iterator iter = m_breakpoint_names.find(name);
+ if (iter == m_breakpoint_names.end()) {
+ if (!can_create)
+ {
+ error.SetErrorStringWithFormat("Breakpoint name \"%s\" doesn't exist and "
+ "can_create is false.", name.AsCString());
+ return nullptr;
+ }
+
+ iter = m_breakpoint_names.insert(std::make_pair(name,
+ new BreakpointName(name)))
+ .first;
+ }
+ return (iter->second);
+}
+
+void
+Target::DeleteBreakpointName(const ConstString &name)
+{
+ BreakpointNameList::iterator iter = m_breakpoint_names.find(name);
+
+ if (iter != m_breakpoint_names.end()) {
+ const char *name_cstr = name.AsCString();
+ m_breakpoint_names.erase(iter);
+ for (auto bp_sp : m_breakpoint_list.Breakpoints())
+ bp_sp->RemoveName(name_cstr);
+ }
+}
+
+void Target::RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
+ const ConstString &name)
+{
+ bp_sp->RemoveName(name.AsCString());
+}
+
+void Target::ConfigureBreakpointName(BreakpointName &bp_name,
+ const BreakpointOptions &new_options,
+ const BreakpointName::Permissions &new_permissions)
+{
+ bp_name.GetOptions().CopyOverSetOptions(new_options);
+ bp_name.GetPermissions().MergeInto(new_permissions);
+ ApplyNameToBreakpoints(bp_name);
+}
+
+void Target::ApplyNameToBreakpoints(BreakpointName &bp_name) {
+ BreakpointList bkpts_with_name(false);
+ m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString(),
+ bkpts_with_name);
+
+ for (auto bp_sp : bkpts_with_name.Breakpoints())
+ bp_name.ConfigureBreakpoint(bp_sp);
+}
+
+void Target::GetBreakpointNames(std::vector<std::string> &names)
+{
+ names.clear();
+ for (auto bp_name : m_breakpoint_names) {
+ names.push_back(bp_name.first.AsCString());
+ }
+ std::sort(names.begin(), names.end());
+}
+
bool Target::ProcessIsValid() {
return (m_process_sp && m_process_sp->IsAlive());
}
@@ -703,6 +828,17 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
return wp_sp;
}
+void Target::RemoveAllowedBreakpoints ()
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ if (log)
+ log->Printf("Target::%s \n", __FUNCTION__);
+
+ m_breakpoint_list.RemoveAllowed(true);
+
+ m_last_created_breakpoint.reset();
+}
+
void Target::RemoveAllBreakpoints(bool internal_also) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
if (log)
@@ -727,6 +863,14 @@ void Target::DisableAllBreakpoints(bool internal_also) {
m_internal_breakpoint_list.SetEnabledAll(false);
}
+void Target::DisableAllowedBreakpoints() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ if (log)
+ log->Printf("Target::%s", __FUNCTION__);
+
+ m_breakpoint_list.SetEnabledAllowed(false);
+}
+
void Target::EnableAllBreakpoints(bool internal_also) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
if (log)
@@ -738,6 +882,14 @@ void Target::EnableAllBreakpoints(bool internal_also) {
m_internal_breakpoint_list.SetEnabledAll(true);
}
+void Target::EnableAllowedBreakpoints() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ if (log)
+ log->Printf("Target::%s", __FUNCTION__);
+
+ m_breakpoint_list.SetEnabledAllowed(true);
+}
+
bool Target::RemoveBreakpointByID(break_id_t break_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
if (log)
@@ -1226,8 +1378,8 @@ void Target::ClearModules(bool delete_locations) {
void Target::DidExec() {
// When a process exec's we need to know about it so we can do some cleanup.
- m_breakpoint_list.RemoveInvalidLocations(m_arch);
- m_internal_breakpoint_list.RemoveInvalidLocations(m_arch);
+ m_breakpoint_list.RemoveInvalidLocations(m_arch.GetSpec());
+ m_internal_breakpoint_list.RemoveInvalidLocations(m_arch.GetSpec());
}
void Target::SetExecutableModule(ModuleSP &executable_sp,
@@ -1245,13 +1397,12 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
// If we haven't set an architecture yet, reset our architecture based on
// what we found in the executable module.
- if (!m_arch.IsValid()) {
+ if (!m_arch.GetSpec().IsValid()) {
m_arch = executable_sp->GetArchitecture();
- if (log)
- log->Printf("Target::SetExecutableModule setting architecture to %s "
- "(%s) based on executable file",
- m_arch.GetArchitectureName(),
- m_arch.GetTriple().getTriple().c_str());
+ LLDB_LOG(log,
+ "setting architecture to {0} ({1}) based on executable file",
+ m_arch.GetSpec().GetArchitectureName(),
+ m_arch.GetSpec().GetTriple().getTriple());
}
FileSpecList dependent_files;
@@ -1269,7 +1420,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
else
platform_dependent_file_spec = dependent_file_spec;
- ModuleSpec module_spec(platform_dependent_file_spec, m_arch);
+ ModuleSpec module_spec(platform_dependent_file_spec, m_arch.GetSpec());
ModuleSP image_module_sp(GetSharedModule(module_spec));
if (image_module_sp) {
ObjectFile *objfile = image_module_sp->GetObjectFile();
@@ -1283,21 +1434,21 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
bool Target::SetArchitecture(const ArchSpec &arch_spec) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET));
- bool missing_local_arch = !m_arch.IsValid();
+ bool missing_local_arch = !m_arch.GetSpec().IsValid();
bool replace_local_arch = true;
bool compatible_local_arch = false;
ArchSpec other(arch_spec);
if (!missing_local_arch) {
- if (m_arch.IsCompatibleMatch(arch_spec)) {
- other.MergeFrom(m_arch);
+ if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
+ other.MergeFrom(m_arch.GetSpec());
- if (m_arch.IsCompatibleMatch(other)) {
+ if (m_arch.GetSpec().IsCompatibleMatch(other)) {
compatible_local_arch = true;
bool arch_changed, vendor_changed, os_changed, os_ver_changed,
env_changed;
- m_arch.PiecewiseTripleCompare(other, arch_changed, vendor_changed,
+ m_arch.GetSpec().PiecewiseTripleCompare(other, arch_changed, vendor_changed,
os_changed, os_ver_changed, env_changed);
if (!arch_changed && !vendor_changed && !os_changed && !env_changed)
@@ -1311,10 +1462,9 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec) {
// update the architecture, unless the one we already have is more specified
if (replace_local_arch)
m_arch = other;
- if (log)
- log->Printf("Target::SetArchitecture set architecture to %s (%s)",
- m_arch.GetArchitectureName(),
- m_arch.GetTriple().getTriple().c_str());
+ LLDB_LOG(log, "set architecture to {0} ({1})",
+ m_arch.GetSpec().GetArchitectureName(),
+ m_arch.GetSpec().GetTriple().getTriple());
return true;
}
@@ -1351,12 +1501,12 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec) {
bool Target::MergeArchitecture(const ArchSpec &arch_spec) {
if (arch_spec.IsValid()) {
- if (m_arch.IsCompatibleMatch(arch_spec)) {
+ if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
// The current target arch is compatible with "arch_spec", see if we
// can improve our current architecture using bits from "arch_spec"
// Merge bits from arch_spec into "merged_arch" and set our architecture
- ArchSpec merged_arch(m_arch);
+ ArchSpec merged_arch(m_arch.GetSpec());
merged_arch.MergeFrom(arch_spec);
return SetArchitecture(merged_arch);
} else {
@@ -1684,8 +1834,8 @@ size_t Target::ReadScalarIntegerFromMemory(const Address &addr,
size_t bytes_read =
ReadMemory(addr, prefer_file_cache, &uval, byte_size, error);
if (bytes_read == byte_size) {
- DataExtractor data(&uval, sizeof(uval), m_arch.GetByteOrder(),
- m_arch.GetAddressByteSize());
+ DataExtractor data(&uval, sizeof(uval), m_arch.GetSpec().GetByteOrder(),
+ m_arch.GetSpec().GetAddressByteSize());
lldb::offset_t offset = 0;
if (byte_size <= 4)
scalar = data.GetMaxU32(&offset, byte_size);
@@ -1719,7 +1869,7 @@ bool Target::ReadPointerFromMemory(const Address &addr, bool prefer_file_cache,
Status &error, Address &pointer_addr) {
Scalar scalar;
if (ReadScalarIntegerFromMemory(addr, prefer_file_cache,
- m_arch.GetAddressByteSize(), false, scalar,
+ m_arch.GetSpec().GetAddressByteSize(), false, scalar,
error)) {
addr_t pointer_vm_addr = scalar.ULongLong(LLDB_INVALID_ADDRESS);
if (pointer_vm_addr != LLDB_INVALID_ADDRESS) {
@@ -2212,7 +2362,7 @@ lldb::addr_t Target::GetPersistentSymbol(const ConstString &name) {
lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,
AddressClass addr_class) const {
addr_t code_addr = load_addr;
- switch (m_arch.GetMachine()) {
+ switch (m_arch.GetSpec().GetMachine()) {
case llvm::Triple::mips:
case llvm::Triple::mipsel:
case llvm::Triple::mips64:
@@ -2271,7 +2421,7 @@ lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,
lldb::addr_t Target::GetOpcodeLoadAddress(lldb::addr_t load_addr,
AddressClass addr_class) const {
addr_t opcode_addr = load_addr;
- switch (m_arch.GetMachine()) {
+ switch (m_arch.GetSpec().GetMachine()) {
case llvm::Triple::mips:
case llvm::Triple::mipsel:
case llvm::Triple::mips64:
@@ -2303,7 +2453,7 @@ lldb::addr_t Target::GetBreakableLoadAddress(lldb::addr_t addr) {
addr_t breakable_addr = addr;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- switch (m_arch.GetMachine()) {
+ switch (m_arch.GetSpec().GetMachine()) {
default:
break;
case llvm::Triple::mips:
@@ -2314,7 +2464,7 @@ lldb::addr_t Target::GetBreakableLoadAddress(lldb::addr_t addr) {
addr_t current_offset = 0;
uint32_t loop_count = 0;
Address resolved_addr;
- uint32_t arch_flags = m_arch.GetFlags();
+ uint32_t arch_flags = m_arch.GetSpec().GetFlags();
bool IsMips16 = arch_flags & ArchSpec::eMIPSAse_mips16;
bool IsMicromips = arch_flags & ArchSpec::eMIPSAse_micromips;
SectionLoadList &section_load_list = GetSectionLoadList();
@@ -2367,7 +2517,7 @@ lldb::addr_t Target::GetBreakableLoadAddress(lldb::addr_t addr) {
// Create Disassembler Instance
lldb::DisassemblerSP disasm_sp(
- Disassembler::FindPlugin(m_arch, nullptr, nullptr));
+ Disassembler::FindPlugin(m_arch.GetSpec(), nullptr, nullptr));
ExecutionContext exe_ctx;
CalculateExecutionContext(exe_ctx);
@@ -2529,6 +2679,10 @@ void Target::RunStopHooks() {
if (!m_process_sp)
return;
+
+ // Somebody might have restarted the process:
+ if (m_process_sp->GetState() != eStateStopped)
+ return;
// <rdar://problem/12027563> make sure we check that we are not stopped
// because of us running a user expression
@@ -2634,9 +2788,12 @@ void Target::RunStopHooks() {
// running the stop hooks.
if ((result.GetStatus() == eReturnStatusSuccessContinuingNoResult) ||
(result.GetStatus() == eReturnStatusSuccessContinuingResult)) {
- result.AppendMessageWithFormat("Aborting stop hooks, hook %" PRIu64
- " set the program running.",
- cur_hook_sp->GetID());
+ // But only complain if there were more stop hooks to do:
+ StopHookCollection::iterator tmp = pos;
+ if (++tmp != end)
+ result.AppendMessageWithFormat("\nAborting stop hooks, hook %" PRIu64
+ " set the program running.\n",
+ cur_hook_sp->GetID());
keep_going = false;
}
}
@@ -3505,9 +3662,11 @@ static PropertyDefinition g_experimental_properties[]{
"This will fix symbol resolution when there are name collisions between "
"ivars and local variables. "
"But it can make expressions run much more slowly."},
+ {"use-modern-type-lookup", OptionValue::eTypeBoolean, true, false, nullptr,
+ nullptr, "If true, use Clang's modern type lookup infrastructure."},
{nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, nullptr, nullptr}};
-enum { ePropertyInjectLocalVars = 0 };
+enum { ePropertyInjectLocalVars = 0, ePropertyUseModernTypeLookup };
class TargetExperimentalOptionValueProperties : public OptionValueProperties {
public:
@@ -3618,6 +3777,18 @@ void TargetProperties::SetInjectLocalVariables(ExecutionContext *exe_ctx,
true);
}
+bool TargetProperties::GetUseModernTypeLookup() const {
+ const Property *exp_property = m_collection_sp->GetPropertyAtIndex(
+ nullptr, false, ePropertyExperimental);
+ OptionValueProperties *exp_values =
+ exp_property->GetValue()->GetAsProperties();
+ if (exp_values)
+ return exp_values->GetPropertyAtIndexAsBoolean(
+ nullptr, ePropertyUseModernTypeLookup, true);
+ else
+ return true;
+}
+
ArchSpec TargetProperties::GetDefaultArchitecture() const {
OptionValueArch *value = m_collection_sp->GetPropertyAtIndexAsOptionValueArch(
nullptr, ePropertyDefaultArch);
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 505d14012d65..217cbccedf6e 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -442,10 +442,9 @@ lldb::StopInfoSP Thread::GetPrivateStopInfo() {
if (m_stop_info_override_stop_id != process_stop_id) {
m_stop_info_override_stop_id = process_stop_id;
if (m_stop_info_sp) {
- ArchSpec::StopInfoOverrideCallbackType callback =
- GetProcess()->GetStopInfoOverrideCallback();
- if (callback)
- callback(*this);
+ if (Architecture *arch =
+ process_sp->GetTarget().GetArchitecturePlugin())
+ arch->OverrideStopInfo(*this);
}
}
}
@@ -2075,6 +2074,7 @@ Unwind *Thread::GetUnwinder() {
case llvm::Triple::mips64el:
case llvm::Triple::ppc:
case llvm::Triple::ppc64:
+ case llvm::Triple::ppc64le:
case llvm::Triple::systemz:
case llvm::Triple::hexagon:
m_unwinder_ap.reset(new UnwindLLDB(*this));
diff --git a/source/Target/ThreadPlanStepInRange.cpp b/source/Target/ThreadPlanStepInRange.cpp
index caaaffea8e8a..6c5a9954f23f 100644
--- a/source/Target/ThreadPlanStepInRange.cpp
+++ b/source/Target/ThreadPlanStepInRange.cpp
@@ -191,8 +191,12 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
if (!m_sub_plan_sp) {
// Otherwise check the ShouldStopHere for step out:
m_sub_plan_sp = CheckShouldStopHereAndQueueStepOut(frame_order);
- if (log)
- log->Printf("ShouldStopHere says we should step out of this frame.");
+ if (log) {
+ if (m_sub_plan_sp)
+ log->Printf("ShouldStopHere found plan to step out of this frame.");
+ else
+ log->Printf("ShouldStopHere no plan to step out of this frame.");
+ }
} else if (log) {
log->Printf(
"Thought I stepped out, but in fact arrived at a trampoline.");
diff --git a/source/Target/ThreadPlanTracer.cpp b/source/Target/ThreadPlanTracer.cpp
index 014c7fd27975..5057ca0a711b 100644
--- a/source/Target/ThreadPlanTracer.cpp
+++ b/source/Target/ThreadPlanTracer.cpp
@@ -11,9 +11,6 @@
// C++ Includes
#include <cstring>
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
diff --git a/source/Target/UnixSignals.cpp b/source/Target/UnixSignals.cpp
index a4ec32bd0075..150c6619859f 100644
--- a/source/Target/UnixSignals.cpp
+++ b/source/Target/UnixSignals.cpp
@@ -16,8 +16,8 @@
#include "Plugins/Process/Utility/LinuxSignals.h"
#include "Plugins/Process/Utility/MipsLinuxSignals.h"
#include "Plugins/Process/Utility/NetBSDSignals.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/ArchSpec.h"
using namespace lldb_private;
diff --git a/source/Core/ArchSpec.cpp b/source/Utility/ArchSpec.cpp
index bfe9750f70f0..a10fe78260bb 100644
--- a/source/Core/ArchSpec.cpp
+++ b/source/Utility/ArchSpec.cpp
@@ -7,21 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Utility/ArchSpec.h"
-#include "lldb/Host/HostInfo.h"
-#include "lldb/Target/Platform.h"
-#include "lldb/Target/RegisterContext.h"
-#include "lldb/Target/Thread.h"
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-defines.h" // for LLDB_INVALID_C...
-#include "lldb/lldb-forward.h" // for RegisterContextSP
-
-#include "Plugins/Process/Utility/ARMDefines.h"
-#include "Plugins/Process/Utility/InstructionUtils.h"
-
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Twine.h" // for Twine
#include "llvm/BinaryFormat/COFF.h"
@@ -30,10 +21,6 @@
#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH
#include "llvm/Support/Host.h"
-#include <memory> // for shared_ptr
-#include <string>
-#include <tuple> // for tie, tuple
-
using namespace lldb;
using namespace lldb_private;
@@ -188,6 +175,8 @@ static const CoreDefinition g_core_definitions[] = {
{eByteOrderBig, 4, 4, 4, llvm::Triple::ppc, ArchSpec::eCore_ppc_ppc970,
"ppc970"},
+ {eByteOrderLittle, 8, 4, 4, llvm::Triple::ppc64le,
+ ArchSpec::eCore_ppc64le_generic, "powerpc64le"},
{eByteOrderBig, 8, 4, 4, llvm::Triple::ppc64, ArchSpec::eCore_ppc64_generic,
"powerpc64"},
{eByteOrderBig, 8, 4, 4, llvm::Triple::ppc64,
@@ -372,6 +361,8 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = {
SUBTYPE_MASK},
{ArchSpec::eCore_ppc64_generic, llvm::MachO::CPU_TYPE_POWERPC64, 0,
UINT32_MAX, SUBTYPE_MASK},
+ {ArchSpec::eCore_ppc64le_generic, llvm::MachO::CPU_TYPE_POWERPC64, CPU_ANY,
+ UINT32_MAX, SUBTYPE_MASK},
{ArchSpec::eCore_ppc64_ppc970_64, llvm::MachO::CPU_TYPE_POWERPC64, 100,
UINT32_MAX, SUBTYPE_MASK},
{ArchSpec::eCore_x86_32_i386, llvm::MachO::CPU_TYPE_I386, 3, UINT32_MAX,
@@ -414,6 +405,8 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
0xFFFFFFFFu, 0xFFFFFFFFu}, // Intel MCU // FIXME: is this correct?
{ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
0xFFFFFFFFu, 0xFFFFFFFFu}, // PowerPC
+ {ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
+ 0xFFFFFFFFu, 0xFFFFFFFFu}, // PowerPC64le
{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
0xFFFFFFFFu, 0xFFFFFFFFu}, // PowerPC64
{ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
@@ -461,7 +454,9 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
};
static const ArchDefinition g_elf_arch_def = {
- eArchTypeELF, llvm::array_lengthof(g_elf_arch_entries), g_elf_arch_entries,
+ eArchTypeELF,
+ llvm::array_lengthof(g_elf_arch_entries),
+ g_elf_arch_entries,
"elf",
};
@@ -483,8 +478,10 @@ static const ArchDefinitionEntry g_coff_arch_entries[] = {
};
static const ArchDefinition g_coff_arch_def = {
- eArchTypeCOFF, llvm::array_lengthof(g_coff_arch_entries),
- g_coff_arch_entries, "pe-coff",
+ eArchTypeCOFF,
+ llvm::array_lengthof(g_coff_arch_entries),
+ g_coff_arch_entries,
+ "pe-coff",
};
//===----------------------------------------------------------------------===//
@@ -518,7 +515,7 @@ static const CoreDefinition *FindCoreDefinition(llvm::StringRef name) {
}
static inline const CoreDefinition *FindCoreDefinition(ArchSpec::Core core) {
- if (core >= 0 && core < llvm::array_lengthof(g_core_definitions))
+ if (core < llvm::array_lengthof(g_core_definitions))
return &g_core_definitions[core];
return nullptr;
}
@@ -556,15 +553,6 @@ FindArchDefinitionEntry(const ArchDefinition *def, ArchSpec::Core core) {
ArchSpec::ArchSpec() {}
-ArchSpec::ArchSpec(const char *triple_cstr, Platform *platform) {
- if (triple_cstr)
- SetTriple(triple_cstr, platform);
-}
-
-ArchSpec::ArchSpec(llvm::StringRef triple_str, Platform *platform) {
- SetTriple(triple_str, platform);
-}
-
ArchSpec::ArchSpec(const char *triple_cstr) {
if (triple_cstr)
SetTriple(triple_cstr);
@@ -874,16 +862,6 @@ bool lldb_private::ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str,
return true;
}
-bool ArchSpec::SetTriple(const char *triple_cstr) {
- llvm::StringRef str(triple_cstr ? triple_cstr : "");
- return SetTriple(str);
-}
-
-bool ArchSpec::SetTriple(const char *triple_cstr, Platform *platform) {
- llvm::StringRef str(triple_cstr ? triple_cstr : "");
- return SetTriple(str, platform);
-}
-
bool ArchSpec::SetTriple(llvm::StringRef triple) {
if (triple.empty()) {
Clear();
@@ -893,87 +871,15 @@ bool ArchSpec::SetTriple(llvm::StringRef triple) {
if (ParseMachCPUDashSubtypeTriple(triple, *this))
return true;
- if (triple.startswith(LLDB_ARCH_DEFAULT)) {
- // Special case for the current host default architectures...
- if (triple.equals(LLDB_ARCH_DEFAULT_32BIT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKind32);
- else if (triple.equals(LLDB_ARCH_DEFAULT_64BIT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKind64);
- else if (triple.equals(LLDB_ARCH_DEFAULT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- } else {
- SetTriple(llvm::Triple(llvm::Triple::normalize(triple)));
- }
+ SetTriple(llvm::Triple(llvm::Triple::normalize(triple)));
return IsValid();
}
-bool ArchSpec::SetTriple(llvm::StringRef triple, Platform *platform) {
- if (triple.empty()) {
- Clear();
- return false;
- }
- if (ParseMachCPUDashSubtypeTriple(triple, *this))
- return true;
-
- if (triple.startswith(LLDB_ARCH_DEFAULT)) {
- // Special case for the current host default architectures...
- if (triple.equals(LLDB_ARCH_DEFAULT_32BIT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKind32);
- else if (triple.equals(LLDB_ARCH_DEFAULT_64BIT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKind64);
- else if (triple.equals(LLDB_ARCH_DEFAULT))
- *this = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- return IsValid();
- }
-
- ArchSpec raw_arch(triple);
-
- llvm::Triple normalized_triple(llvm::Triple::normalize(triple));
-
- const bool os_specified = !normalized_triple.getOSName().empty();
- const bool vendor_specified = !normalized_triple.getVendorName().empty();
- const bool env_specified = !normalized_triple.getEnvironmentName().empty();
-
- if (os_specified || vendor_specified || env_specified) {
- SetTriple(normalized_triple);
- return IsValid();
- }
-
- // We got an arch only. If there is no platform, fallback to the host system
- // for defaults.
- if (!platform) {
- llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple());
- if (!vendor_specified)
- normalized_triple.setVendor(host_triple.getVendor());
- if (!vendor_specified)
- normalized_triple.setOS(host_triple.getOS());
- if (!env_specified && host_triple.getEnvironmentName().size())
- normalized_triple.setEnvironment(host_triple.getEnvironment());
- SetTriple(normalized_triple);
- return IsValid();
- }
-
- // If we were given a platform, use the platform's system architecture. If
- // this is not available (might not be connected) use the first supported
- // architecture.
- ArchSpec compatible_arch;
- if (!platform->IsCompatibleArchitecture(raw_arch, false, &compatible_arch)) {
- *this = raw_arch;
- return IsValid();
- }
-
- if (compatible_arch.IsValid()) {
- const llvm::Triple &compatible_triple = compatible_arch.GetTriple();
- if (!vendor_specified)
- normalized_triple.setVendor(compatible_triple.getVendor());
- if (!os_specified)
- normalized_triple.setOS(compatible_triple.getOS());
- if (!env_specified && compatible_triple.hasEnvironment())
- normalized_triple.setEnvironment(compatible_triple.getEnvironment());
- }
-
- SetTriple(normalized_triple);
- return IsValid();
+bool ArchSpec::ContainsOnlyArch(const llvm::Triple &normalized_triple) {
+ return !normalized_triple.getArchName().empty() &&
+ normalized_triple.getOSName().empty() &&
+ normalized_triple.getVendorName().empty() &&
+ normalized_triple.getEnvironmentName().empty();
}
void ArchSpec::MergeFrom(const ArchSpec &other) {
@@ -1002,6 +908,9 @@ void ArchSpec::MergeFrom(const ArchSpec &other) {
m_core = other.GetCore();
CoreUpdated(true);
}
+ if (GetFlags() == 0) {
+ SetFlags(other.GetFlags());
+ }
}
bool ArchSpec::SetArchitecture(ArchitectureType arch_type, uint32_t cpu,
@@ -1502,102 +1411,6 @@ bool lldb_private::operator<(const ArchSpec &lhs, const ArchSpec &rhs) {
return lhs_core < rhs_core;
}
-static void StopInfoOverrideCallbackTypeARM(lldb_private::Thread &thread) {
- // We need to check if we are stopped in Thumb mode in a IT instruction
- // and detect if the condition doesn't pass. If this is the case it means
- // we won't actually execute this instruction. If this happens we need to
- // clear the stop reason to no thread plans think we are stopped for a
- // reason and the plans should keep going.
- //
- // We do this because when single stepping many ARM processes, debuggers
- // often use the BVR/BCR registers that says "stop when the PC is not
- // equal to its current value". This method of stepping means we can end
- // up stopping on instructions inside an if/then block that wouldn't get
- // executed. By fixing this we can stop the debugger from seeming like
- // you stepped through both the "if" _and_ the "else" clause when source
- // level stepping because the debugger stops regardless due to the BVR/BCR
- // triggering a stop.
- //
- // It also means we can set breakpoints on instructions inside an an
- // if/then block and correctly skip them if we use the BKPT instruction.
- // The ARM and Thumb BKPT instructions are unconditional even when executed
- // in a Thumb IT block.
- //
- // If your debugger inserts software traps in ARM/Thumb code, it will
- // need to use 16 and 32 bit instruction for 16 and 32 bit thumb
- // instructions respectively. If your debugger inserts a 16 bit thumb
- // trap on top of a 32 bit thumb instruction for an opcode that is inside
- // an if/then, it will change the it/then to conditionally execute your
- // 16 bit trap and then cause your program to crash if it executes the
- // trailing 16 bits (the second half of the 32 bit thumb instruction you
- // partially overwrote).
-
- RegisterContextSP reg_ctx_sp(thread.GetRegisterContext());
- if (reg_ctx_sp) {
- const uint32_t cpsr = reg_ctx_sp->GetFlags(0);
- if (cpsr != 0) {
- // Read the J and T bits to get the ISETSTATE
- const uint32_t J = Bit32(cpsr, 24);
- const uint32_t T = Bit32(cpsr, 5);
- const uint32_t ISETSTATE = J << 1 | T;
- if (ISETSTATE == 0) {
-// NOTE: I am pretty sure we want to enable the code below
-// that detects when we stop on an instruction in ARM mode
-// that is conditional and the condition doesn't pass. This
-// can happen if you set a breakpoint on an instruction that
-// is conditional. We currently will _always_ stop on the
-// instruction which is bad. You can also run into this while
-// single stepping and you could appear to run code in the "if"
-// and in the "else" clause because it would stop at all of the
-// conditional instructions in both.
-// In such cases, we really don't want to stop at this location.
-// I will check with the lldb-dev list first before I enable this.
-#if 0
- // ARM mode: check for condition on intsruction
- const addr_t pc = reg_ctx_sp->GetPC();
- Status error;
- // If we fail to read the opcode we will get UINT64_MAX as the
- // result in "opcode" which we can use to detect if we read a
- // valid opcode.
- const uint64_t opcode = thread.GetProcess()->ReadUnsignedIntegerFromMemory(pc, 4, UINT64_MAX, error);
- if (opcode <= UINT32_MAX)
- {
- const uint32_t condition = Bits32((uint32_t)opcode, 31, 28);
- if (!ARMConditionPassed(condition, cpsr))
- {
- // We ARE stopped on an ARM instruction whose condition doesn't
- // pass so this instruction won't get executed.
- // Regardless of why it stopped, we need to clear the stop info
- thread.SetStopInfo (StopInfoSP());
- }
- }
-#endif
- } else if (ISETSTATE == 1) {
- // Thumb mode
- const uint32_t ITSTATE =
- Bits32(cpsr, 15, 10) << 2 | Bits32(cpsr, 26, 25);
- if (ITSTATE != 0) {
- const uint32_t condition = Bits32(ITSTATE, 7, 4);
- if (!ARMConditionPassed(condition, cpsr)) {
- // We ARE stopped in a Thumb IT instruction on an instruction whose
- // condition doesn't pass so this instruction won't get executed.
- // Regardless of why it stopped, we need to clear the stop info
- thread.SetStopInfo(StopInfoSP());
- }
- }
- }
- }
- }
-}
-
-ArchSpec::StopInfoOverrideCallbackType
-ArchSpec::GetStopInfoOverrideCallback() const {
- const llvm::Triple::ArchType machine = GetMachine();
- if (machine == llvm::Triple::arm)
- return StopInfoOverrideCallbackTypeARM;
- return nullptr;
-}
-
bool ArchSpec::IsFullySpecifiedTriple() const {
const auto &user_specified_triple = GetTriple();
@@ -1619,7 +1432,7 @@ bool ArchSpec::IsFullySpecifiedTriple() const {
void ArchSpec::PiecewiseTripleCompare(
const ArchSpec &other, bool &arch_different, bool &vendor_different,
- bool &os_different, bool &os_version_different, bool &env_different) {
+ bool &os_different, bool &os_version_different, bool &env_different) const {
const llvm::Triple &me(GetTriple());
const llvm::Triple &them(other.GetTriple());
diff --git a/source/Utility/CMakeLists.txt b/source/Utility/CMakeLists.txt
index 78598562692b..1a0fb6f86c57 100644
--- a/source/Utility/CMakeLists.txt
+++ b/source/Utility/CMakeLists.txt
@@ -1,4 +1,46 @@
+set(LLDB_SYSTEM_LIBS)
+
+# Windows-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+ list(APPEND LLDB_SYSTEM_LIBS
+ ws2_32
+ rpcrt4
+ )
+endif ()
+
+if (NOT LLDB_DISABLE_LIBEDIT)
+ list(APPEND LLDB_SYSTEM_LIBS edit)
+endif()
+if (NOT LLDB_DISABLE_CURSES)
+ list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
+ if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+ list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
+ endif()
+endif()
+
+if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
+ list(APPEND LLDB_SYSTEM_LIBS atomic)
+endif()
+
+list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
+
+if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
+ list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
+endif()
+
+list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
+
+if (LLVM_BUILD_STATIC)
+ if (NOT LLDB_DISABLE_PYTHON)
+ list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
+ endif()
+ if (NOT LLDB_DISABLE_CURSES)
+ list(APPEND LLDB_SYSTEM_LIBS gpm)
+ endif()
+endif()
+
add_lldb_library(lldbUtility
+ ArchSpec.cpp
Baton.cpp
Connection.cpp
ConstString.cpp
@@ -29,7 +71,6 @@ add_lldb_library(lldbUtility
StringLexer.cpp
StringList.cpp
StructuredData.cpp
- TaskPool.cpp
TildeExpressionResolver.cpp
Timer.cpp
UserID.cpp
@@ -39,7 +80,8 @@ add_lldb_library(lldbUtility
VMRange.cpp
LINK_LIBS
- # lldbUtility cannot have any dependencies
+ ${LLDB_SYSTEM_LIBS}
+ # lldbUtility does not depend on other LLDB libraries
LINK_COMPONENTS
BinaryFormat
diff --git a/source/Utility/DataEncoder.cpp b/source/Utility/DataEncoder.cpp
index f7ce46889d2f..433a15bc9523 100644
--- a/source/Utility/DataEncoder.cpp
+++ b/source/Utility/DataEncoder.cpp
@@ -12,6 +12,7 @@
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/Endian.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h" // for llvm_unreachable
#include "llvm/Support/MathExtras.h"
@@ -22,36 +23,7 @@
using namespace lldb;
using namespace lldb_private;
-
-static inline void WriteInt16(unsigned char *ptr, unsigned offset,
- uint16_t value) {
- *(uint16_t *)(ptr + offset) = value;
-}
-
-static inline void WriteInt32(unsigned char *ptr, unsigned offset,
- uint32_t value) {
- *(uint32_t *)(ptr + offset) = value;
-}
-
-static inline void WriteInt64(unsigned char *ptr, unsigned offset,
- uint64_t value) {
- *(uint64_t *)(ptr + offset) = value;
-}
-
-static inline void WriteSwappedInt16(unsigned char *ptr, unsigned offset,
- uint16_t value) {
- *(uint16_t *)(ptr + offset) = llvm::ByteSwap_16(value);
-}
-
-static inline void WriteSwappedInt32(unsigned char *ptr, unsigned offset,
- uint32_t value) {
- *(uint32_t *)(ptr + offset) = llvm::ByteSwap_32(value);
-}
-
-static inline void WriteSwappedInt64(unsigned char *ptr, unsigned offset,
- uint64_t value) {
- *(uint64_t *)(ptr + offset) = llvm::ByteSwap_64(value);
-}
+using namespace llvm::support::endian;
//----------------------------------------------------------------------
// Default constructor.
@@ -202,9 +174,9 @@ uint32_t DataEncoder::PutU8(uint32_t offset, uint8_t value) {
uint32_t DataEncoder::PutU16(uint32_t offset, uint16_t value) {
if (ValidOffsetForDataOfSize(offset, sizeof(value))) {
if (m_byte_order != endian::InlHostByteOrder())
- WriteSwappedInt16(m_start, offset, value);
+ write16be(m_start + offset, value);
else
- WriteInt16(m_start, offset, value);
+ write16le(m_start + offset, value);
return offset + sizeof(value);
}
@@ -214,9 +186,9 @@ uint32_t DataEncoder::PutU16(uint32_t offset, uint16_t value) {
uint32_t DataEncoder::PutU32(uint32_t offset, uint32_t value) {
if (ValidOffsetForDataOfSize(offset, sizeof(value))) {
if (m_byte_order != endian::InlHostByteOrder())
- WriteSwappedInt32(m_start, offset, value);
+ write32be(m_start + offset, value);
else
- WriteInt32(m_start, offset, value);
+ write32le(m_start + offset, value);
return offset + sizeof(value);
}
@@ -226,9 +198,9 @@ uint32_t DataEncoder::PutU32(uint32_t offset, uint32_t value) {
uint32_t DataEncoder::PutU64(uint32_t offset, uint64_t value) {
if (ValidOffsetForDataOfSize(offset, sizeof(value))) {
if (m_byte_order != endian::InlHostByteOrder())
- WriteSwappedInt64(m_start, offset, value);
+ write64be(m_start + offset, value);
else
- WriteInt64(m_start, offset, value);
+ write64le(m_start + offset, value);
return offset + sizeof(value);
}
diff --git a/source/Utility/DataExtractor.cpp b/source/Utility/DataExtractor.cpp
index 008aff220945..84c5f8191521 100644
--- a/source/Utility/DataExtractor.cpp
+++ b/source/Utility/DataExtractor.cpp
@@ -17,6 +17,7 @@
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
@@ -105,6 +106,20 @@ static inline uint64_t ReadSwapInt64(const void *ptr) {
return llvm::ByteSwap_64(value);
}
+static inline uint64_t ReadMaxInt64(const uint8_t *data, size_t byte_size,
+ ByteOrder byte_order) {
+ uint64_t res = 0;
+ if (byte_order == eByteOrderBig)
+ for (size_t i = 0; i < byte_size; ++i)
+ res = (res << 8) | data[i];
+ else {
+ assert(byte_order == eByteOrderLittle);
+ for (size_t i = 0; i < byte_size; ++i)
+ res = (res << 8) | data[byte_size - 1 - i];
+ }
+ return res;
+}
+
DataExtractor::DataExtractor()
: m_start(nullptr), m_end(nullptr),
m_byte_order(endian::InlHostByteOrder()), m_addr_size(sizeof(void *)),
@@ -551,107 +566,59 @@ void *DataExtractor::GetU64(offset_t *offset_ptr, void *void_dst,
return nullptr;
}
-//----------------------------------------------------------------------
-// Extract a single integer value from the data and update the offset
-// pointed to by "offset_ptr". The size of the extracted integer
-// is specified by the "byte_size" argument. "byte_size" should have
-// a value between 1 and 4 since the return value is only 32 bits
-// wide. Any "byte_size" values less than 1 or greater than 4 will
-// result in nothing being extracted, and zero being returned.
-//
-// RETURNS the integer value that was extracted, or zero on failure.
-//----------------------------------------------------------------------
uint32_t DataExtractor::GetMaxU32(offset_t *offset_ptr,
size_t byte_size) const {
- switch (byte_size) {
- case 1:
- return GetU8(offset_ptr);
- break;
- case 2:
- return GetU16(offset_ptr);
- break;
- case 4:
- return GetU32(offset_ptr);
- break;
- default:
- assert(false && "GetMaxU32 unhandled case!");
- break;
- }
- return 0;
+ lldbassert(byte_size > 0 && byte_size <= 4 && "GetMaxU32 invalid byte_size!");
+ return GetMaxU64(offset_ptr, byte_size);
}
-//----------------------------------------------------------------------
-// Extract a single integer value from the data and update the offset
-// pointed to by "offset_ptr". The size of the extracted integer
-// is specified by the "byte_size" argument. "byte_size" should have
-// a value >= 1 and <= 8 since the return value is only 64 bits
-// wide. Any "byte_size" values less than 1 or greater than 8 will
-// result in nothing being extracted, and zero being returned.
-//
-// RETURNS the integer value that was extracted, or zero on failure.
-//----------------------------------------------------------------------
-uint64_t DataExtractor::GetMaxU64(offset_t *offset_ptr, size_t size) const {
- switch (size) {
+uint64_t DataExtractor::GetMaxU64(offset_t *offset_ptr,
+ size_t byte_size) const {
+ lldbassert(byte_size > 0 && byte_size <= 8 && "GetMaxU64 invalid byte_size!");
+ switch (byte_size) {
case 1:
return GetU8(offset_ptr);
- break;
case 2:
return GetU16(offset_ptr);
- break;
case 4:
return GetU32(offset_ptr);
- break;
case 8:
return GetU64(offset_ptr);
- break;
- default:
- assert(false && "GetMax64 unhandled case!");
- break;
+ default: {
+ // General case.
+ const uint8_t *data =
+ static_cast<const uint8_t *>(GetData(offset_ptr, byte_size));
+ if (data == nullptr)
+ return 0;
+ return ReadMaxInt64(data, byte_size, m_byte_order);
+ }
}
return 0;
}
uint64_t DataExtractor::GetMaxU64_unchecked(offset_t *offset_ptr,
- size_t size) const {
- switch (size) {
+ size_t byte_size) const {
+ switch (byte_size) {
case 1:
return GetU8_unchecked(offset_ptr);
- break;
case 2:
return GetU16_unchecked(offset_ptr);
- break;
case 4:
return GetU32_unchecked(offset_ptr);
- break;
case 8:
return GetU64_unchecked(offset_ptr);
- break;
- default:
- assert(false && "GetMax64 unhandled case!");
- break;
+ default: {
+ uint64_t res = ReadMaxInt64(&m_start[*offset_ptr], byte_size, m_byte_order);
+ *offset_ptr += byte_size;
+ return res;
+ }
}
return 0;
}
-int64_t DataExtractor::GetMaxS64(offset_t *offset_ptr, size_t size) const {
- switch (size) {
- case 1:
- return (int8_t)GetU8(offset_ptr);
- break;
- case 2:
- return (int16_t)GetU16(offset_ptr);
- break;
- case 4:
- return (int32_t)GetU32(offset_ptr);
- break;
- case 8:
- return (int64_t)GetU64(offset_ptr);
- break;
- default:
- assert(false && "GetMax64 unhandled case!");
- break;
- }
- return 0;
+int64_t DataExtractor::GetMaxS64(offset_t *offset_ptr, size_t byte_size) const {
+ uint64_t u64 = GetMaxU64(offset_ptr, byte_size);
+ return llvm::SignExtend64(u64, 8 * byte_size);
}
uint64_t DataExtractor::GetMaxU64Bitfield(offset_t *offset_ptr, size_t size,
diff --git a/source/Utility/FileSpec.cpp b/source/Utility/FileSpec.cpp
index 3c4e3407ddf6..72f86917b813 100644
--- a/source/Utility/FileSpec.cpp
+++ b/source/Utility/FileSpec.cpp
@@ -700,18 +700,18 @@ void FileSpec::EnumerateDirectory(llvm::StringRef dir_path,
fs::recursive_directory_iterator End;
for (; Iter != End && !EC; Iter.increment(EC)) {
const auto &Item = *Iter;
- fs::file_status Status;
- if ((EC = Item.status(Status)))
+ llvm::ErrorOr<fs::basic_file_status> Status = Item.status();
+ if (!Status)
break;
- if (!find_files && fs::is_regular_file(Status))
+ if (!find_files && fs::is_regular_file(*Status))
continue;
- if (!find_directories && fs::is_directory(Status))
+ if (!find_directories && fs::is_directory(*Status))
continue;
- if (!find_other && fs::is_other(Status))
+ if (!find_other && fs::is_other(*Status))
continue;
FileSpec Spec(Item.path(), false);
- auto Result = callback(callback_baton, Status.type(), Spec);
+ auto Result = callback(callback_baton, Status->type(), Spec);
if (Result == eEnumerateDirectoryResultQuit)
return;
if (Result == eEnumerateDirectoryResultNext) {
diff --git a/source/Utility/JSON.cpp b/source/Utility/JSON.cpp
index 1520bc7c47ec..9049f596ab9a 100644
--- a/source/Utility/JSON.cpp
+++ b/source/Utility/JSON.cpp
@@ -22,7 +22,7 @@
using namespace lldb_private;
std::string JSONString::json_string_quote_metachars(const std::string &s) {
- if (s.find('"') == std::string::npos)
+ if (s.find_first_of("\\\n\"") == std::string::npos)
return s;
std::string output;
@@ -30,8 +30,9 @@ std::string JSONString::json_string_quote_metachars(const std::string &s) {
const char *s_chars = s.c_str();
for (size_t i = 0; i < s_size; i++) {
unsigned char ch = *(s_chars + i);
- if (ch == '"') {
+ if (ch == '"' || ch == '\\' || ch == '\n') {
output.push_back('\\');
+ if (ch == '\n') ch = 'n';
}
output.push_back(ch);
}
diff --git a/source/Utility/Log.cpp b/source/Utility/Log.cpp
index a80b106838bc..f247124f8d63 100644
--- a/source/Utility/Log.cpp
+++ b/source/Utility/Log.cpp
@@ -32,6 +32,7 @@
#include <process.h> // for getpid
#else
#include <unistd.h>
+#include <pthread.h>
#endif
using namespace lldb_private;
@@ -181,6 +182,13 @@ void Log::Warning(const char *format, ...) {
Printf("warning: %s", Content.c_str());
}
+void Log::Initialize() {
+#ifdef LLVM_ON_UNIX
+ pthread_atfork(nullptr, nullptr, &Log::DisableLoggingChild);
+#endif
+ InitializeLldbChannel();
+}
+
void Log::Register(llvm::StringRef name, Channel &channel) {
auto iter = g_channel_map->try_emplace(name, channel);
assert(iter.second == true);
@@ -279,8 +287,7 @@ void Log::WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file,
if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
llvm::SmallString<32> thread_name;
llvm::get_thread_name(thread_name);
- if (!thread_name.empty())
- OS << thread_name;
+ OS << llvm::formatv("{0,-16} ", thread_name);
}
if (options.Test(LLDB_LOG_OPTION_BACKTRACE))
@@ -321,3 +328,11 @@ void Log::Format(llvm::StringRef file, llvm::StringRef function,
message << payload << "\n";
WriteMessage(message.str());
}
+
+void Log::DisableLoggingChild() {
+ // Disable logging by clearing out the atomic variable after forking -- if we
+ // forked while another thread held the channel mutex, we would deadlock when
+ // trying to write to the log.
+ for (auto &c: *g_channel_map)
+ c.second.m_channel.log_ptr.store(nullptr, std::memory_order_relaxed);
+}
diff --git a/source/Utility/Logging.cpp b/source/Utility/Logging.cpp
index 0bd6d6692e37..c9a6ef1bd1ea 100644
--- a/source/Utility/Logging.cpp
+++ b/source/Utility/Logging.cpp
@@ -51,7 +51,7 @@ static constexpr Log::Category g_categories[] = {
static Log::Channel g_log_channel(g_categories, LIBLLDB_LOG_DEFAULT);
-void lldb_private::InitializeLog() {
+void lldb_private::InitializeLldbChannel() {
Log::Register("lldb", g_log_channel);
}
diff --git a/source/Utility/PPC64LE_DWARF_Registers.h b/source/Utility/PPC64LE_DWARF_Registers.h
new file mode 100644
index 000000000000..1a7503790e5d
--- /dev/null
+++ b/source/Utility/PPC64LE_DWARF_Registers.h
@@ -0,0 +1,194 @@
+//===-- PPC64LE_DWARF_Registers.h -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_PPC64LE_DWARF_Registers_h_
+#define utility_PPC64LE_DWARF_Registers_h_
+
+#include "lldb/lldb-private.h"
+
+namespace ppc64le_dwarf {
+
+enum {
+ dwarf_r0_ppc64le = 0,
+ dwarf_r1_ppc64le,
+ dwarf_r2_ppc64le,
+ dwarf_r3_ppc64le,
+ dwarf_r4_ppc64le,
+ dwarf_r5_ppc64le,
+ dwarf_r6_ppc64le,
+ dwarf_r7_ppc64le,
+ dwarf_r8_ppc64le,
+ dwarf_r9_ppc64le,
+ dwarf_r10_ppc64le,
+ dwarf_r11_ppc64le,
+ dwarf_r12_ppc64le,
+ dwarf_r13_ppc64le,
+ dwarf_r14_ppc64le,
+ dwarf_r15_ppc64le,
+ dwarf_r16_ppc64le,
+ dwarf_r17_ppc64le,
+ dwarf_r18_ppc64le,
+ dwarf_r19_ppc64le,
+ dwarf_r20_ppc64le,
+ dwarf_r21_ppc64le,
+ dwarf_r22_ppc64le,
+ dwarf_r23_ppc64le,
+ dwarf_r24_ppc64le,
+ dwarf_r25_ppc64le,
+ dwarf_r26_ppc64le,
+ dwarf_r27_ppc64le,
+ dwarf_r28_ppc64le,
+ dwarf_r29_ppc64le,
+ dwarf_r30_ppc64le,
+ dwarf_r31_ppc64le,
+ dwarf_f0_ppc64le,
+ dwarf_f1_ppc64le,
+ dwarf_f2_ppc64le,
+ dwarf_f3_ppc64le,
+ dwarf_f4_ppc64le,
+ dwarf_f5_ppc64le,
+ dwarf_f6_ppc64le,
+ dwarf_f7_ppc64le,
+ dwarf_f8_ppc64le,
+ dwarf_f9_ppc64le,
+ dwarf_f10_ppc64le,
+ dwarf_f11_ppc64le,
+ dwarf_f12_ppc64le,
+ dwarf_f13_ppc64le,
+ dwarf_f14_ppc64le,
+ dwarf_f15_ppc64le,
+ dwarf_f16_ppc64le,
+ dwarf_f17_ppc64le,
+ dwarf_f18_ppc64le,
+ dwarf_f19_ppc64le,
+ dwarf_f20_ppc64le,
+ dwarf_f21_ppc64le,
+ dwarf_f22_ppc64le,
+ dwarf_f23_ppc64le,
+ dwarf_f24_ppc64le,
+ dwarf_f25_ppc64le,
+ dwarf_f26_ppc64le,
+ dwarf_f27_ppc64le,
+ dwarf_f28_ppc64le,
+ dwarf_f29_ppc64le,
+ dwarf_f30_ppc64le,
+ dwarf_f31_ppc64le,
+ dwarf_lr_ppc64le = 65,
+ dwarf_ctr_ppc64le,
+ dwarf_cr_ppc64le = 68,
+ dwarf_xer_ppc64le = 76,
+ dwarf_vr0_ppc64le,
+ dwarf_vr1_ppc64le,
+ dwarf_vr2_ppc64le,
+ dwarf_vr3_ppc64le,
+ dwarf_vr4_ppc64le,
+ dwarf_vr5_ppc64le,
+ dwarf_vr6_ppc64le,
+ dwarf_vr7_ppc64le,
+ dwarf_vr8_ppc64le,
+ dwarf_vr9_ppc64le,
+ dwarf_vr10_ppc64le,
+ dwarf_vr11_ppc64le,
+ dwarf_vr12_ppc64le,
+ dwarf_vr13_ppc64le,
+ dwarf_vr14_ppc64le,
+ dwarf_vr15_ppc64le,
+ dwarf_vr16_ppc64le,
+ dwarf_vr17_ppc64le,
+ dwarf_vr18_ppc64le,
+ dwarf_vr19_ppc64le,
+ dwarf_vr20_ppc64le,
+ dwarf_vr21_ppc64le,
+ dwarf_vr22_ppc64le,
+ dwarf_vr23_ppc64le,
+ dwarf_vr24_ppc64le,
+ dwarf_vr25_ppc64le,
+ dwarf_vr26_ppc64le,
+ dwarf_vr27_ppc64le,
+ dwarf_vr28_ppc64le,
+ dwarf_vr29_ppc64le,
+ dwarf_vr30_ppc64le,
+ dwarf_vr31_ppc64le,
+ dwarf_vscr_ppc64le = 110,
+ dwarf_vrsave_ppc64le = 117,
+ dwarf_pc_ppc64le,
+ dwarf_softe_ppc64le,
+ dwarf_trap_ppc64le,
+ dwarf_origr3_ppc64le,
+ dwarf_fpscr_ppc64le,
+ dwarf_msr_ppc64le,
+ dwarf_vs0_ppc64le,
+ dwarf_vs1_ppc64le,
+ dwarf_vs2_ppc64le,
+ dwarf_vs3_ppc64le,
+ dwarf_vs4_ppc64le,
+ dwarf_vs5_ppc64le,
+ dwarf_vs6_ppc64le,
+ dwarf_vs7_ppc64le,
+ dwarf_vs8_ppc64le,
+ dwarf_vs9_ppc64le,
+ dwarf_vs10_ppc64le,
+ dwarf_vs11_ppc64le,
+ dwarf_vs12_ppc64le,
+ dwarf_vs13_ppc64le,
+ dwarf_vs14_ppc64le,
+ dwarf_vs15_ppc64le,
+ dwarf_vs16_ppc64le,
+ dwarf_vs17_ppc64le,
+ dwarf_vs18_ppc64le,
+ dwarf_vs19_ppc64le,
+ dwarf_vs20_ppc64le,
+ dwarf_vs21_ppc64le,
+ dwarf_vs22_ppc64le,
+ dwarf_vs23_ppc64le,
+ dwarf_vs24_ppc64le,
+ dwarf_vs25_ppc64le,
+ dwarf_vs26_ppc64le,
+ dwarf_vs27_ppc64le,
+ dwarf_vs28_ppc64le,
+ dwarf_vs29_ppc64le,
+ dwarf_vs30_ppc64le,
+ dwarf_vs31_ppc64le,
+ dwarf_vs32_ppc64le,
+ dwarf_vs33_ppc64le,
+ dwarf_vs34_ppc64le,
+ dwarf_vs35_ppc64le,
+ dwarf_vs36_ppc64le,
+ dwarf_vs37_ppc64le,
+ dwarf_vs38_ppc64le,
+ dwarf_vs39_ppc64le,
+ dwarf_vs40_ppc64le,
+ dwarf_vs41_ppc64le,
+ dwarf_vs42_ppc64le,
+ dwarf_vs43_ppc64le,
+ dwarf_vs44_ppc64le,
+ dwarf_vs45_ppc64le,
+ dwarf_vs46_ppc64le,
+ dwarf_vs47_ppc64le,
+ dwarf_vs48_ppc64le,
+ dwarf_vs49_ppc64le,
+ dwarf_vs50_ppc64le,
+ dwarf_vs51_ppc64le,
+ dwarf_vs52_ppc64le,
+ dwarf_vs53_ppc64le,
+ dwarf_vs54_ppc64le,
+ dwarf_vs55_ppc64le,
+ dwarf_vs56_ppc64le,
+ dwarf_vs57_ppc64le,
+ dwarf_vs58_ppc64le,
+ dwarf_vs59_ppc64le,
+ dwarf_vs60_ppc64le,
+ dwarf_vs61_ppc64le,
+ dwarf_vs62_ppc64le,
+ dwarf_vs63_ppc64le,
+};
+
+} // namespace ppc64le_dwarf
+
+#endif // utility_PPC64LE_DWARF_Registers_h_
diff --git a/source/Utility/PPC64LE_ehframe_Registers.h b/source/Utility/PPC64LE_ehframe_Registers.h
new file mode 100644
index 000000000000..c5763b304711
--- /dev/null
+++ b/source/Utility/PPC64LE_ehframe_Registers.h
@@ -0,0 +1,194 @@
+//===-- PPC64LE_ehframe_Registers.h -----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_PPC64LE_ehframe_Registers_h_
+#define utility_PPC64LE_ehframe_Registers_h_
+
+// The register numbers used in the eh_frame unwind information.
+// Should be the same as DWARF register numbers.
+
+namespace ppc64le_ehframe {
+
+enum {
+ r0 = 0,
+ r1,
+ r2,
+ r3,
+ r4,
+ r5,
+ r6,
+ r7,
+ r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ r14,
+ r15,
+ r16,
+ r17,
+ r18,
+ r19,
+ r20,
+ r21,
+ r22,
+ r23,
+ r24,
+ r25,
+ r26,
+ r27,
+ r28,
+ r29,
+ r30,
+ r31,
+ f0,
+ f1,
+ f2,
+ f3,
+ f4,
+ f5,
+ f6,
+ f7,
+ f8,
+ f9,
+ f10,
+ f11,
+ f12,
+ f13,
+ f14,
+ f15,
+ f16,
+ f17,
+ f18,
+ f19,
+ f20,
+ f21,
+ f22,
+ f23,
+ f24,
+ f25,
+ f26,
+ f27,
+ f28,
+ f29,
+ f30,
+ f31,
+ lr = 65,
+ ctr,
+ cr = 68,
+ xer = 76,
+ vr0,
+ vr1,
+ vr2,
+ vr3,
+ vr4,
+ vr5,
+ vr6,
+ vr7,
+ vr8,
+ vr9,
+ vr10,
+ vr11,
+ vr12,
+ vr13,
+ vr14,
+ vr15,
+ vr16,
+ vr17,
+ vr18,
+ vr19,
+ vr20,
+ vr21,
+ vr22,
+ vr23,
+ vr24,
+ vr25,
+ vr26,
+ vr27,
+ vr28,
+ vr29,
+ vr30,
+ vr31,
+ vscr = 110,
+ vrsave = 117,
+ pc,
+ softe,
+ trap,
+ origr3,
+ fpscr,
+ msr,
+ vs0,
+ vs1,
+ vs2,
+ vs3,
+ vs4,
+ vs5,
+ vs6,
+ vs7,
+ vs8,
+ vs9,
+ vs10,
+ vs11,
+ vs12,
+ vs13,
+ vs14,
+ vs15,
+ vs16,
+ vs17,
+ vs18,
+ vs19,
+ vs20,
+ vs21,
+ vs22,
+ vs23,
+ vs24,
+ vs25,
+ vs26,
+ vs27,
+ vs28,
+ vs29,
+ vs30,
+ vs31,
+ vs32,
+ vs33,
+ vs34,
+ vs35,
+ vs36,
+ vs37,
+ vs38,
+ vs39,
+ vs40,
+ vs41,
+ vs42,
+ vs43,
+ vs44,
+ vs45,
+ vs46,
+ vs47,
+ vs48,
+ vs49,
+ vs50,
+ vs51,
+ vs52,
+ vs53,
+ vs54,
+ vs55,
+ vs56,
+ vs57,
+ vs58,
+ vs59,
+ vs60,
+ vs61,
+ vs62,
+ vs63,
+};
+}
+
+#endif // utility_PPC64LE_ehframe_Registers_h_
diff --git a/source/Utility/SelectHelper.cpp b/source/Utility/SelectHelper.cpp
index a46213f8bfcb..200b2ae42759 100644
--- a/source/Utility/SelectHelper.cpp
+++ b/source/Utility/SelectHelper.cpp
@@ -32,6 +32,7 @@
#define NOMINMAX
#include <winsock2.h>
#else
+#include <sys/time.h>
#include <sys/select.h>
#endif
diff --git a/source/Utility/Status.cpp b/source/Utility/Status.cpp
index b11a3db64e6d..a6a889a71e54 100644
--- a/source/Utility/Status.cpp
+++ b/source/Utility/Status.cpp
@@ -104,16 +104,6 @@ const Status &Status::operator=(const Status &rhs) {
return *this;
}
-//----------------------------------------------------------------------
-// Assignment operator
-//----------------------------------------------------------------------
-const Status &Status::operator=(uint32_t err) {
- m_code = err;
- m_type = eErrorTypeMachKernel;
- m_string.clear();
- return *this;
-}
-
Status::~Status() = default;
//----------------------------------------------------------------------
diff --git a/source/Utility/StringExtractorGDBRemote.cpp b/source/Utility/StringExtractorGDBRemote.cpp
index 8e50c0106a48..818347a42a2c 100644
--- a/source/Utility/StringExtractorGDBRemote.cpp
+++ b/source/Utility/StringExtractorGDBRemote.cpp
@@ -103,6 +103,7 @@ StringExtractorGDBRemote::GetServerPacketType() const {
case 'P':
if (PACKET_STARTS_WITH("QPassSignals:"))
return eServerPacketType_QPassSignals;
+ break;
case 'S':
if (PACKET_MATCHES("QStartNoAckMode"))
diff --git a/source/Utility/StructuredData.cpp b/source/Utility/StructuredData.cpp
index 9fc05354cfd3..492fc585ad07 100644
--- a/source/Utility/StructuredData.cpp
+++ b/source/Utility/StructuredData.cpp
@@ -15,6 +15,7 @@
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/STLExtras.h" // for make_unique
+#include "llvm/Support/MemoryBuffer.h"
#include <cerrno>
#include <cstdlib>
#include <inttypes.h>
diff --git a/source/Utility/UUID.cpp b/source/Utility/UUID.cpp
index b47f8b52f1c2..98d4c30cc7f1 100644
--- a/source/Utility/UUID.cpp
+++ b/source/Utility/UUID.cpp
@@ -21,11 +21,10 @@
namespace lldb_private {
-UUID::UUID() : m_num_uuid_bytes(16) { ::memset(m_uuid, 0, sizeof(m_uuid)); }
+UUID::UUID() { Clear(); }
UUID::UUID(const UUID &rhs) {
- m_num_uuid_bytes = rhs.m_num_uuid_bytes;
- ::memcpy(m_uuid, rhs.m_uuid, sizeof(m_uuid));
+ SetBytes(rhs.m_uuid, rhs.m_num_uuid_bytes);
}
UUID::UUID(const void *uuid_bytes, uint32_t num_uuid_bytes) {
@@ -74,14 +73,7 @@ std::string UUID::GetAsString(const char *separator) const {
}
void UUID::Dump(Stream *s) const {
- const uint8_t *u = (const uint8_t *)GetBytes();
- s->Printf("%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%"
- "2.2X%2.2X%2.2X%2.2X",
- u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], u[8], u[9], u[10],
- u[11], u[12], u[13], u[14], u[15]);
- if (m_num_uuid_bytes == 20) {
- s->Printf("-%2.2X%2.2X%2.2X%2.2X", u[16], u[17], u[18], u[19]);
- }
+ s->PutCString(GetAsString().c_str());
}
bool UUID::SetBytes(const void *uuid_bytes, uint32_t num_uuid_bytes) {
@@ -109,7 +101,7 @@ bool UUID::SetBytes(const void *uuid_bytes, uint32_t num_uuid_bytes) {
return false;
}
-size_t UUID::GetByteSize() { return m_num_uuid_bytes; }
+size_t UUID::GetByteSize() const { return m_num_uuid_bytes; }
bool UUID::IsValid() const {
return m_uuid[0] || m_uuid[1] || m_uuid[2] || m_uuid[3] || m_uuid[4] ||
@@ -198,8 +190,7 @@ bool lldb_private::operator==(const lldb_private::UUID &lhs,
bool lldb_private::operator!=(const lldb_private::UUID &lhs,
const lldb_private::UUID &rhs) {
- return ::memcmp(lhs.GetBytes(), rhs.GetBytes(),
- sizeof(lldb_private::UUID::ValueType)) != 0;
+ return !(lhs == rhs);
}
bool lldb_private::operator<(const lldb_private::UUID &lhs,
@@ -210,18 +201,15 @@ bool lldb_private::operator<(const lldb_private::UUID &lhs,
bool lldb_private::operator<=(const lldb_private::UUID &lhs,
const lldb_private::UUID &rhs) {
- return ::memcmp(lhs.GetBytes(), rhs.GetBytes(),
- sizeof(lldb_private::UUID::ValueType)) <= 0;
+ return !(lhs > rhs);
}
bool lldb_private::operator>(const lldb_private::UUID &lhs,
const lldb_private::UUID &rhs) {
- return ::memcmp(lhs.GetBytes(), rhs.GetBytes(),
- sizeof(lldb_private::UUID::ValueType)) > 0;
+ return rhs < lhs;
}
bool lldb_private::operator>=(const lldb_private::UUID &lhs,
const lldb_private::UUID &rhs) {
- return ::memcmp(lhs.GetBytes(), rhs.GetBytes(),
- sizeof(lldb_private::UUID::ValueType)) >= 0;
+ return !(lhs < rhs);
}
diff --git a/source/Utility/UriParser.cpp b/source/Utility/UriParser.cpp
index bb57211af468..a6d81e7a2c8b 100644
--- a/source/Utility/UriParser.cpp
+++ b/source/Utility/UriParser.cpp
@@ -22,7 +22,7 @@ using namespace lldb_private;
bool UriParser::Parse(llvm::StringRef uri, llvm::StringRef &scheme,
llvm::StringRef &hostname, int &port,
llvm::StringRef &path) {
- llvm::StringRef tmp_scheme, tmp_hostname, tmp_port, tmp_path;
+ llvm::StringRef tmp_scheme, tmp_hostname, tmp_path;
const llvm::StringRef kSchemeSep("://");
auto pos = uri.find(kSchemeSep);
@@ -43,7 +43,7 @@ bool UriParser::Parse(llvm::StringRef uri, llvm::StringRef &scheme,
((path_pos != std::string::npos) ? path_pos : uri.size()) - host_pos);
// Extract hostname
- if (host_port[0] == '[') {
+ if (!host_port.empty() && host_port[0] == '[') {
// hostname is enclosed with square brackets.
pos = host_port.find(']');
if (pos == std::string::npos)
diff --git a/source/lldb.cpp b/source/lldb.cpp
index efdcef8f0527..1be046197770 100644
--- a/source/lldb.cpp
+++ b/source/lldb.cpp
@@ -15,11 +15,11 @@ using namespace lldb_private;
#include "clang/Basic/Version.h"
#ifdef HAVE_SVN_VERSION_INC
-# include "SVNVersion.inc"
+#include "SVNVersion.inc"
#endif
#ifdef HAVE_APPLE_VERSION_INC
-# include "AppleVersion.inc"
+#include "AppleVersion.inc"
#endif
static const char *GetLLDBRevision() {
@@ -38,7 +38,6 @@ static const char *GetLLDBRepository() {
#endif
}
-
#define QUOTE(str) #str
#define EXPAND_AND_QUOTE(str) QUOTE(str)
@@ -47,13 +46,9 @@ const char *lldb_private::GetVersion() {
// as the clang tool.
static std::string g_version_str;
if (g_version_str.empty()) {
-
-#ifdef LLDB_VERSION_STRING
- g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
-#else
g_version_str += "lldb version ";
g_version_str += CLANG_VERSION_STRING;
-#endif
+
const char *lldb_repo = GetLLDBRepository();
const char *lldb_rev = GetLLDBRevision();
if (lldb_repo || lldb_rev) {
@@ -77,7 +72,6 @@ const char *lldb_private::GetVersion() {
g_version_str += "\n llvm revision ";
g_version_str += llvm_rev;
}
-
}
return g_version_str.c_str();
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 824dff51865d..9826de38c3c7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,6 +15,11 @@ endfunction()
set(LLDB_TEST_DEPS lldb)
+# darwin-debug is an hard dependency for the testsuite.
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ list(APPEND LLDB_TEST_DEPS darwin-debug)
+endif()
+
if(TARGET lldb-server)
list(APPEND LLDB_TEST_DEPS lldb-server)
endif()
@@ -27,10 +32,6 @@ if(TARGET lldb-mi)
list(APPEND LLDB_TEST_DEPS lldb-mi)
endif()
-if ("${LLDB_TEST_COMPILER}" STREQUAL "")
- string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
-endif()
-
# The default architecture with which to compile test executables is the default LLVM target
# architecture, which itself defaults to the host architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH)
@@ -43,10 +44,6 @@ set(LLDB_TEST_ARCH
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64")
-if(LLDB_TEST_CLANG)
- set(LLDB_TEST_COMPILER $<TARGET_FILE:clang>)
-endif()
-
# Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
set(LLDB_TEST_USER_ARGS
""
@@ -60,7 +57,7 @@ set(LLDB_TEST_COMMON_ARGS
-S nm
-u CXXFLAGS
-u CFLAGS
- -C ${LLDB_TEST_COMPILER}
+ -C ${LLDB_TEST_C_COMPILER}
)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
@@ -117,6 +114,21 @@ add_python_test_target(check-lldb
"Testing LLDB (parallel execution, with a separate subprocess per test)"
)
+# If we're building with an in-tree clang, then list clang as a dependency
+# to run tests.
+if (TARGET clang)
+ add_dependencies(check-lldb clang)
+endif()
+
+# LLD is required to link test executables on Windows.
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ if (TARGET lld)
+ add_dependencies(check-lldb lld)
+ else ()
+ message(WARNING "lld required to test LLDB on Windows")
+ endif ()
+endif ()
+
add_custom_target(lldb-test-depends DEPENDS ${LLDB_TEST_DEPENDS})
# This will add LLDB's test dependencies to the depenednecies for check-all and
# include them in the test-depends target.
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 7b26f5907a86..75c9c15c487d 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -8,4 +8,5 @@ add_subdirectory(lldb-mi)
if (LLDB_CAN_USE_LLDB_SERVER)
add_subdirectory(lldb-server)
endif()
-add_subdirectory(intel-mpx)
+add_subdirectory(intel-features)
+add_subdirectory(lldb-test)
diff --git a/tools/argdumper/CMakeLists.txt b/tools/argdumper/CMakeLists.txt
index 42f1dd51582a..9b22103bc8af 100644
--- a/tools/argdumper/CMakeLists.txt
+++ b/tools/argdumper/CMakeLists.txt
@@ -1,10 +1,6 @@
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
add_lldb_tool(lldb-argdumper INCLUDE_IN_FRAMEWORK
argdumper.cpp
LINK_LIBS
- lldbCore
lldbUtility
)
-
diff --git a/tools/debugserver/source/CMakeLists.txt b/tools/debugserver/source/CMakeLists.txt
index bdca1602f4a8..d99880cd97f3 100644
--- a/tools/debugserver/source/CMakeLists.txt
+++ b/tools/debugserver/source/CMakeLists.txt
@@ -1,4 +1,5 @@
include(CheckCXXCompilerFlag)
+include(CheckLibraryExists)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${LLDB_SOURCE_DIR}/source)
include_directories(MacOSX/DarwinLog)
@@ -26,6 +27,8 @@ if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
endif ()
+check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
+
add_subdirectory(MacOSX)
set(generated_mach_interfaces
@@ -94,32 +97,108 @@ add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
if (APPLE)
if(IOS)
- find_library(COCOA_LIBRARY UIKit)
- target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY})
+ find_library(BACKBOARD_LIBRARY BackBoardServices
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
+ find_library(FRONTBOARD_LIBRARY FrontBoardServices
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
+ find_library(SPRINGBOARD_LIBRARY SpringBoardServices
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
+ find_library(MOBILESERVICES_LIBRARY MobileCoreServices
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
+ find_library(LOCKDOWN_LIBRARY lockdown)
+
+ if(NOT BACKBOARD_LIBRARY)
+ set(SKIP_DEBUGSERVER True)
+ endif()
else()
find_library(COCOA_LIBRARY Cocoa)
- target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY})
endif()
endif()
-target_link_libraries(lldbDebugserverCommon
+if(HAVE_LIBCOMPRESSION)
+ set(LIBCOMPRESSION compression)
+endif()
+
+if(NOT SKIP_DEBUGSERVER)
+ target_link_libraries(lldbDebugserverCommon
+ INTERFACE ${COCOA_LIBRARY}
+ ${CORE_FOUNDATION_LIBRARY}
+ ${FOUNDATION_LIBRARY}
+ ${BACKBOARD_LIBRARY}
+ ${FRONTBOARD_LIBRARY}
+ ${SPRINGBOARD_LIBRARY}
+ ${MOBILESERVICES_LIBRARY}
+ ${LOCKDOWN_LIBRARY}
+ lldbDebugserverArchSupport
+ lldbDebugserverDarwin_DarwinLog
+ ${LIBCOMPRESSION})
+ if(HAVE_LIBCOMPRESSION)
+ set_property(TARGET lldbDebugserverCommon APPEND PROPERTY
+ COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
+ endif()
+ set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
+ add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
+ debugserver.cpp
+
+ LINK_LIBS
+ lldbDebugserverCommon
+ )
+ if(IOS)
+ set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
+ WITH_LOCKDOWN
+ WITH_FBS
+ WITH_BKS
+ )
+ set_property(TARGET debugserver APPEND PROPERTY COMPILE_DEFINITIONS
+ WITH_LOCKDOWN
+ WITH_FBS
+ WITH_BKS
+ )
+ set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_FLAGS
+ -F${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
+ )
+ endif()
+endif()
+
+if(IOS)
+ add_library(lldbDebugserverCommon_NonUI ${lldbDebugserverCommonSources})
+ target_link_libraries(lldbDebugserverCommon_NonUI
INTERFACE ${COCOA_LIBRARY}
${CORE_FOUNDATION_LIBRARY}
${FOUNDATION_LIBRARY}
lldbDebugserverArchSupport
- lldbDebugserverDarwin_DarwinLog)
+ lldbDebugserverDarwin_DarwinLog
+ ${LIBCOMPRESSION})
+ if(HAVE_LIBCOMPRESSION)
+ set_property(TARGET lldbDebugserverCommon_NonUI APPEND PROPERTY
+ COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
+ endif()
-set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
-add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
- debugserver.cpp
+ add_lldb_tool(debugserver-nonui
+ debugserver.cpp
- LINK_LIBS
- lldbDebugserverCommon
- )
+ LINK_LIBS
+ lldbDebugserverCommon_NonUI
+ )
+endif()
+
+set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-macosx-entitlements.plist)
+if(IOS)
+ set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
+endif()
set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.")
+set(LLDB_USE_ENTITLEMENTS_Default On)
+if("${LLDB_CODESIGN_IDENTITY}" STREQUAL "lldb_codesign")
+ set(LLDB_USE_ENTITLEMENTS_Default Off)
+endif()
+option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off when using lldb_codesign identity, otherwise On)" ${LLDB_USE_ENTITLEMENTS_Default})
+
if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
+ if(LLDB_USE_ENTITLEMENTS)
+ set(entitlements_flags --entitlements ${entitlements_xml})
+ endif()
execute_process(
COMMAND xcrun -f codesign_allocate
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -129,9 +208,20 @@ if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE}
codesign --force --sign ${LLDB_CODESIGN_IDENTITY}
+ ${entitlements_flags}
$<TARGET_FILE:debugserver>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
+ if(IOS)
+ add_custom_command(TARGET debugserver-nonui
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE}
+ codesign --force --sign ${LLDB_CODESIGN_IDENTITY}
+ ${entitlements_flags}
+ $<TARGET_FILE:debugserver>
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+ )
+ endif()
endif()
diff --git a/tools/debugserver/source/DNB.cpp b/tools/debugserver/source/DNB.cpp
index 9c6c44d18df1..1168f1fc0a1e 100644
--- a/tools/debugserver/source/DNB.cpp
+++ b/tools/debugserver/source/DNB.cpp
@@ -368,7 +368,7 @@ nub_process_t DNBProcessLaunch(
if (launch_err.Fail()) {
const char *launch_err_str = launch_err.AsString();
if (launch_err_str) {
- strncpy(err_str, launch_err_str, err_len - 1);
+ strlcpy(err_str, launch_err_str, err_len - 1);
err_str[err_len - 1] =
'\0'; // Make sure the error string is terminated
}
@@ -1698,7 +1698,7 @@ nub_bool_t DNBResolveExecutablePath(const char *path, char *resolved_path,
if (realpath(path, max_path)) {
// Found the path relatively...
- ::strncpy(resolved_path, max_path, resolved_path_size);
+ ::strlcpy(resolved_path, max_path, resolved_path_size);
return strlen(resolved_path) + 1 < resolved_path_size;
} else {
// Not a relative path, check the PATH environment variable if the
@@ -1722,7 +1722,7 @@ nub_bool_t DNBResolveExecutablePath(const char *path, char *resolved_path,
result += path;
struct stat s;
if (stat(result.c_str(), &s) == 0) {
- ::strncpy(resolved_path, result.c_str(), resolved_path_size);
+ ::strlcpy(resolved_path, result.c_str(), resolved_path_size);
return result.size() + 1 < resolved_path_size;
}
}
diff --git a/tools/debugserver/source/DNBDataRef.cpp b/tools/debugserver/source/DNBDataRef.cpp
index d7dce1ab7338..8c12b0afac69 100644
--- a/tools/debugserver/source/DNBDataRef.cpp
+++ b/tools/debugserver/source/DNBDataRef.cpp
@@ -60,7 +60,7 @@ uint16_t DNBDataRef::Get16(offset_t *offset_ptr) const {
uint16_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
const uint8_t *p = m_start + *offset_ptr;
- val = *(uint16_t *)p;
+ memcpy(&val, p, sizeof(uint16_t));
if (m_swap)
val = OSSwapInt16(val);
@@ -78,7 +78,7 @@ uint32_t DNBDataRef::Get32(offset_t *offset_ptr) const {
uint32_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
const uint8_t *p = m_start + *offset_ptr;
- val = *(uint32_t *)p;
+ memcpy(&val, p, sizeof(uint32_t));
if (m_swap)
val = OSSwapInt32(val);
@@ -95,7 +95,7 @@ uint64_t DNBDataRef::Get64(offset_t *offset_ptr) const {
uint64_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
const uint8_t *p = m_start + *offset_ptr;
- val = *(uint64_t *)p;
+ memcpy(&val, p, sizeof(uint64_t));
if (m_swap)
val = OSSwapInt64(val);
@@ -123,7 +123,7 @@ uint32_t DNBDataRef::GetMax32(offset_t *offset_ptr, uint32_t byte_size) const {
return Get32(offset_ptr);
break;
default:
- assert(!"GetMax32 unhandled case!");
+ assert(false && "GetMax32 unhandled case!");
break;
}
return 0;
@@ -150,7 +150,7 @@ uint64_t DNBDataRef::GetMax64(offset_t *offset_ptr, uint32_t size) const {
return Get64(offset_ptr);
break;
default:
- assert(!"GetMax64 unhandled case!");
+ assert(false && "GetMax64 unhandled case!");
break;
}
return 0;
@@ -174,7 +174,7 @@ const char *DNBDataRef::GetCStr(offset_t *offset_ptr,
uint32_t fixed_length) const {
const char *s = NULL;
if (m_start < m_end) {
- s = (char *)m_start + *offset_ptr;
+ s = (const char *)m_start + *offset_ptr;
// Advance the offset
if (fixed_length)
diff --git a/tools/debugserver/source/DNBRegisterInfo.cpp b/tools/debugserver/source/DNBRegisterInfo.cpp
index fadcc5ddb06e..b85b39378183 100644
--- a/tools/debugserver/source/DNBRegisterInfo.cpp
+++ b/tools/debugserver/source/DNBRegisterInfo.cpp
@@ -35,7 +35,7 @@ bool DNBRegisterValueClass::IsValid() const {
do { \
if (pos < end) { \
if (i > 0) { \
- strncpy(pos, ", ", end - pos); \
+ strlcpy(pos, ", ", end - pos); \
pos += 2; \
} \
} \
@@ -69,7 +69,7 @@ void DNBRegisterValueClass::Dump(const char *pre, const char *post) const {
value.v_uint64[1]);
break;
default:
- strncpy(str, "0x", 3);
+ strlcpy(str, "0x", 3);
pos = str + 2;
for (uint32_t i = 0; i < info.size; ++i) {
if (pos < end)
diff --git a/tools/debugserver/source/JSON.cpp b/tools/debugserver/source/JSON.cpp
index c914f2498f09..439918b6fcc4 100644
--- a/tools/debugserver/source/JSON.cpp
+++ b/tools/debugserver/source/JSON.cpp
@@ -58,7 +58,6 @@ uint64_t JSONNumber::GetAsUnsigned() const {
case DataType::Double:
return (uint64_t)m_data.m_double;
}
- assert("Unhandled data type");
}
int64_t JSONNumber::GetAsSigned() const {
@@ -70,7 +69,6 @@ int64_t JSONNumber::GetAsSigned() const {
case DataType::Double:
return (int64_t)m_data.m_double;
}
- assert("Unhandled data type");
}
double JSONNumber::GetAsDouble() const {
@@ -82,7 +80,6 @@ double JSONNumber::GetAsDouble() const {
case DataType::Double:
return m_data.m_double;
}
- assert("Unhandled data type");
}
void JSONNumber::Write(std::ostream &s) {
diff --git a/tools/debugserver/source/MacOSX/MachException.cpp b/tools/debugserver/source/MacOSX/MachException.cpp
index 5f085867db2c..cc309e47d86b 100644
--- a/tools/debugserver/source/MacOSX/MachException.cpp
+++ b/tools/debugserver/source/MacOSX/MachException.cpp
@@ -47,13 +47,13 @@ extern "C" kern_return_t catch_mach_exception_raise_state_identity(
extern "C" boolean_t mach_exc_server(mach_msg_header_t *InHeadP,
mach_msg_header_t *OutHeadP);
-// Any access to the g_message variable should be done by locking the
-// g_message_mutex first, using the g_message variable, then unlocking
-// the g_message_mutex. See MachException::Message::CatchExceptionRaise()
-// for sample code.
-
+// Note: g_message points to the storage allocated to catch the data from
+// catching the current exception raise. It's populated when we catch a raised
+// exception which can't immediately be replied to.
+//
+// If it becomes possible to catch exceptions from multiple threads
+// simultaneously, accesses to g_message would need to be mutually exclusive.
static MachException::Data *g_message = NULL;
-// static pthread_mutex_t g_message_mutex = PTHREAD_MUTEX_INITIALIZER;
extern "C" kern_return_t catch_mach_exception_raise_state(
mach_port_t exc_port, exception_type_t exc_type,
@@ -113,8 +113,7 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port,
g_message->task_port = task_port;
g_message->thread_port = thread_port;
g_message->exc_type = exc_type;
- for (mach_msg_type_number_t i=0; i<exc_data_count; ++i)
- g_message->exc_data.push_back(exc_data[i]);
+ g_message->AppendExceptionData(exc_data, exc_data_count);
return KERN_SUCCESS;
} else if (!MachTask::IsValid(g_message->task_port)) {
// Our original exception port isn't valid anymore check for a SIGTRAP
@@ -126,8 +125,7 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port,
g_message->task_port = task_port;
g_message->thread_port = thread_port;
g_message->exc_type = exc_type;
- for (mach_msg_type_number_t i=0; i<exc_data_count; ++i)
- g_message->exc_data.push_back(exc_data[i]);
+ g_message->AppendExceptionData(exc_data, exc_data_count);
return KERN_SUCCESS;
}
}
@@ -272,9 +270,6 @@ kern_return_t MachException::Message::Receive(mach_port_t port,
bool MachException::Message::CatchExceptionRaise(task_t task) {
bool success = false;
- // locker will keep a mutex locked until it goes out of scope
- // PThreadMutex::Locker locker(&g_message_mutex);
- // DNBLogThreaded("calling mach_exc_server");
state.task_port = task;
g_message = &state;
// The exc_server function is the MIG generated server handling function
diff --git a/tools/debugserver/source/MacOSX/MachException.h b/tools/debugserver/source/MacOSX/MachException.h
index a45a41e01f42..e1af12def10a 100644
--- a/tools/debugserver/source/MacOSX/MachException.h
+++ b/tools/debugserver/source/MacOSX/MachException.h
@@ -71,6 +71,15 @@ public:
return (exc_type == EXC_BREAKPOINT ||
((exc_type == EXC_SOFTWARE) && exc_data[0] == 1));
}
+ void AppendExceptionData(mach_exception_data_t Data,
+ mach_msg_type_number_t Count) {
+ mach_exception_data_type_t Buf;
+ for (mach_msg_type_number_t i = 0; i < Count; ++i) {
+ // Perform an unaligned copy.
+ memcpy(&Buf, Data + i, sizeof(mach_exception_data_type_t));
+ exc_data.push_back(Buf);
+ }
+ }
void Dump() const;
void DumpStopReason() const;
bool GetStopInfo(struct DNBThreadStopInfo *stop_info) const;
diff --git a/tools/debugserver/source/MacOSX/MachProcess.mm b/tools/debugserver/source/MacOSX/MachProcess.mm
index a93f724849b8..d4dff223bde0 100644
--- a/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -112,7 +112,9 @@ static bool CallBoardSystemServiceOpenApplication(NSString *bundleIDNSStr,
if (!cstr)
cstr = "<Unknown Bundle ID>";
- DNBLog("About to launch process for bundle ID: %s", cstr);
+ NSString *description = [options description];
+ DNBLog("About to launch process for bundle ID: %s - options:\n%s", cstr,
+ [description UTF8String]);
[system_service
openApplication:bundleIDNSStr
options:options
@@ -188,6 +190,28 @@ static bool CallBoardSystemServiceOpenApplication(NSString *bundleIDNSStr,
}
#endif
+#if defined(WITH_BKS) || defined(WITH_FBS)
+static void SplitEventData(const char *data, std::vector<std::string> &elements)
+{
+ elements.clear();
+ if (!data)
+ return;
+
+ const char *start = data;
+
+ while (*start != '\0') {
+ const char *token = strchr(start, ':');
+ if (!token) {
+ elements.push_back(std::string(start));
+ return;
+ }
+ if (token != start)
+ elements.push_back(std::string(start, token - start));
+ start = ++token;
+ }
+}
+#endif
+
#ifdef WITH_BKS
#import <Foundation/Foundation.h>
extern "C" {
@@ -222,21 +246,31 @@ static void SetBKSError(NSInteger error_code, DNBError &error) {
static bool BKSAddEventDataToOptions(NSMutableDictionary *options,
const char *event_data,
DNBError &option_error) {
- if (strcmp(event_data, "BackgroundContentFetching") == 0) {
- DNBLog("Setting ActivateForEvent key in options dictionary.");
- NSDictionary *event_details = [NSDictionary dictionary];
- NSDictionary *event_dictionary = [NSDictionary
- dictionaryWithObject:event_details
- forKey:
- BKSActivateForEventOptionTypeBackgroundContentFetching];
- [options setObject:event_dictionary
- forKey:BKSOpenApplicationOptionKeyActivateForEvent];
- return true;
- } else {
- DNBLogError("Unrecognized event type: %s. Ignoring.", event_data);
- option_error.SetErrorString("Unrecognized event data.");
- return false;
+ std::vector<std::string> values;
+ SplitEventData(event_data, values);
+ bool found_one = false;
+ for (std::string value : values)
+ {
+ if (value.compare("BackgroundContentFetching") == 0) {
+ DNBLog("Setting ActivateForEvent key in options dictionary.");
+ NSDictionary *event_details = [NSDictionary dictionary];
+ NSDictionary *event_dictionary = [NSDictionary
+ dictionaryWithObject:event_details
+ forKey:
+ BKSActivateForEventOptionTypeBackgroundContentFetching];
+ [options setObject:event_dictionary
+ forKey:BKSOpenApplicationOptionKeyActivateForEvent];
+ found_one = true;
+ } else if (value.compare("ActivateSuspended") == 0) {
+ DNBLog("Setting ActivateSuspended key in options dictionary.");
+ [options setObject:@YES forKey: BKSOpenApplicationOptionKeyActivateSuspended];
+ found_one = true;
+ } else {
+ DNBLogError("Unrecognized event type: %s. Ignoring.", value.c_str());
+ option_error.SetErrorString("Unrecognized event data");
+ }
}
+ return found_one;
}
static NSMutableDictionary *BKSCreateOptionsDictionary(
@@ -322,21 +356,31 @@ static void SetFBSError(NSInteger error_code, DNBError &error) {
static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
const char *event_data,
DNBError &option_error) {
- if (strcmp(event_data, "BackgroundContentFetching") == 0) {
- DNBLog("Setting ActivateForEvent key in options dictionary.");
- NSDictionary *event_details = [NSDictionary dictionary];
- NSDictionary *event_dictionary = [NSDictionary
- dictionaryWithObject:event_details
- forKey:
- FBSActivateForEventOptionTypeBackgroundContentFetching];
- [options setObject:event_dictionary
- forKey:FBSOpenApplicationOptionKeyActivateForEvent];
- return true;
- } else {
- DNBLogError("Unrecognized event type: %s. Ignoring.", event_data);
- option_error.SetErrorString("Unrecognized event data.");
- return false;
+ std::vector<std::string> values;
+ SplitEventData(event_data, values);
+ bool found_one = false;
+ for (std::string value : values)
+ {
+ if (value.compare("BackgroundContentFetching") == 0) {
+ DNBLog("Setting ActivateForEvent key in options dictionary.");
+ NSDictionary *event_details = [NSDictionary dictionary];
+ NSDictionary *event_dictionary = [NSDictionary
+ dictionaryWithObject:event_details
+ forKey:
+ FBSActivateForEventOptionTypeBackgroundContentFetching];
+ [options setObject:event_dictionary
+ forKey:FBSOpenApplicationOptionKeyActivateForEvent];
+ found_one = true;
+ } else if (value.compare("ActivateSuspended") == 0) {
+ DNBLog("Setting ActivateSuspended key in options dictionary.");
+ [options setObject:@YES forKey: FBSOpenApplicationOptionKeyActivateSuspended];
+ found_one = true;
+ } else {
+ DNBLogError("Unrecognized event type: %s. Ignoring.", value.c_str());
+ option_error.SetErrorString("Unrecognized event data.");
+ }
}
+ return found_one;
}
static NSMutableDictionary *
@@ -3105,7 +3149,8 @@ pid_t MachProcess::PosixSpawnChildForPTraceDebugging(
::chdir(working_directory);
err.SetError(::posix_spawnp(&pid, path, &file_actions, &attr,
- (char *const *)argv, (char *const *)envp),
+ const_cast<char *const *>(argv),
+ const_cast<char *const *>(envp)),
DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
err.LogThreaded("::posix_spawnp ( pid => %i, path = '%s', file_actions = "
@@ -3117,8 +3162,9 @@ pid_t MachProcess::PosixSpawnChildForPTraceDebugging(
if (working_directory)
::chdir(working_directory);
- err.SetError(::posix_spawnp(&pid, path, NULL, &attr, (char *const *)argv,
- (char *const *)envp),
+ err.SetError(::posix_spawnp(&pid, path, NULL, &attr,
+ const_cast<char *const *>(argv),
+ const_cast<char *const *>(envp)),
DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
err.LogThreaded("::posix_spawnp ( pid => %i, path = '%s', file_actions = "
@@ -3215,7 +3261,7 @@ pid_t MachProcess::ForkChildForPTraceDebugging(const char *path,
::sleep(1);
// Turn this process into
- ::execv(path, (char *const *)argv);
+ ::execv(path, const_cast<char *const *>(argv));
}
// Exit with error code. Child process should have taken
// over in above exec call and if the exec fails it will
diff --git a/tools/debugserver/source/MacOSX/MachTask.mm b/tools/debugserver/source/MacOSX/MachTask.mm
index bd7047ecdff7..1d177bd53cb7 100644
--- a/tools/debugserver/source/MacOSX/MachTask.mm
+++ b/tools/debugserver/source/MacOSX/MachTask.mm
@@ -188,7 +188,7 @@ nub_size_t MachTask::WriteMemory(nub_addr_t addr, nub_size_t size,
(uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) ||
(DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8)) {
- DNBDataRef data((uint8_t *)buf, n, false);
+ DNBDataRef data((const uint8_t *)buf, n, false);
data.Dump(0, static_cast<DNBDataRef::offset_t>(n), addr,
DNBDataRef::TypeUInt8, 16);
}
diff --git a/tools/debugserver/source/MacOSX/MachThread.cpp b/tools/debugserver/source/MacOSX/MachThread.cpp
index 5686e42e4a49..fc97825786a0 100644
--- a/tools/debugserver/source/MacOSX/MachThread.cpp
+++ b/tools/debugserver/source/MacOSX/MachThread.cpp
@@ -164,15 +164,15 @@ const char *MachThread::GetBasicInfoAsString() const {
// size_t run_state_str_size = sizeof(run_state_str);
// switch (basicInfo.run_state)
// {
- // case TH_STATE_RUNNING: strncpy(run_state_str, "running",
+ // case TH_STATE_RUNNING: strlcpy(run_state_str, "running",
// run_state_str_size); break;
- // case TH_STATE_STOPPED: strncpy(run_state_str, "stopped",
+ // case TH_STATE_STOPPED: strlcpy(run_state_str, "stopped",
// run_state_str_size); break;
- // case TH_STATE_WAITING: strncpy(run_state_str, "waiting",
+ // case TH_STATE_WAITING: strlcpy(run_state_str, "waiting",
// run_state_str_size); break;
- // case TH_STATE_UNINTERRUPTIBLE: strncpy(run_state_str,
+ // case TH_STATE_UNINTERRUPTIBLE: strlcpy(run_state_str,
// "uninterruptible", run_state_str_size); break;
- // case TH_STATE_HALTED: strncpy(run_state_str, "halted",
+ // case TH_STATE_HALTED: strlcpy(run_state_str, "halted",
// run_state_str_size); break;
// default: snprintf(run_state_str,
// run_state_str_size, "%d", basicInfo.run_state); break; // ???
diff --git a/tools/debugserver/source/MacOSX/OsLogger.cpp b/tools/debugserver/source/MacOSX/OsLogger.cpp
index 6cc04a8a7c83..40aeec73f0aa 100644
--- a/tools/debugserver/source/MacOSX/OsLogger.cpp
+++ b/tools/debugserver/source/MacOSX/OsLogger.cpp
@@ -56,9 +56,7 @@ void DarwinLogCallback(void *baton, uint32_t flags, const char *format,
}
}
-DNBCallbackLog OsLogger::GetLogFunction() {
- return _os_log_impl ? DarwinLogCallback : nullptr;
-}
+DNBCallbackLog OsLogger::GetLogFunction() { return DarwinLogCallback; }
#else
diff --git a/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
index 6cc5ae6c36c4..e0e8e27a1c2d 100644
--- a/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
+++ b/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
@@ -1086,7 +1086,7 @@ const DNBRegisterInfo DNBArchImplI386::g_fpu_registers_no_avx[] = {
{e_regSetFPU, fpu_fsw, "fstat", NULL, Uint, Hex, FPU_SIZE_UINT(fsw),
FPU_OFFSET(fsw), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL},
- {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, FPU_SIZE_UINT(ftw),
+ {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, 2 /* sizeof __fpu_ftw + sizeof __fpu_rsrv1 */,
FPU_OFFSET(ftw), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL},
{e_regSetFPU, fpu_fop, "fop", NULL, Uint, Hex, FPU_SIZE_UINT(fop),
@@ -1177,7 +1177,7 @@ const DNBRegisterInfo DNBArchImplI386::g_fpu_registers_avx[] = {
{e_regSetFPU, fpu_fsw, "fstat", NULL, Uint, Hex, FPU_SIZE_UINT(fsw),
AVX_OFFSET(fsw), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL},
- {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, FPU_SIZE_UINT(ftw),
+ {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, 2 /* sizeof __fpu_ftw + sizeof __fpu_rsrv1 */,
AVX_OFFSET(ftw), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL},
{e_regSetFPU, fpu_fop, "fop", NULL, Uint, Hex, FPU_SIZE_UINT(fop),
@@ -1414,7 +1414,7 @@ bool DNBArchImplI386::GetRegisterValue(uint32_t set, uint32_t reg,
*((uint16_t *)(&m_state.context.fpu.no_avx.__fpu_fsw));
return true;
case fpu_ftw:
- value->value.uint8 = m_state.context.fpu.no_avx.__fpu_ftw;
+ memcpy (&value->value.uint16, &m_state.context.fpu.no_avx.__fpu_ftw, 2);
return true;
case fpu_fop:
value->value.uint16 = m_state.context.fpu.no_avx.__fpu_fop;
@@ -1607,7 +1607,7 @@ bool DNBArchImplI386::SetRegisterValue(uint32_t set, uint32_t reg,
success = true;
break;
case fpu_ftw:
- m_state.context.fpu.no_avx.__fpu_ftw = value->value.uint8;
+ memcpy (&m_state.context.fpu.no_avx.__fpu_ftw, &value->value.uint16, 2);
success = true;
break;
case fpu_fop:
@@ -1886,7 +1886,7 @@ nub_size_t DNBArchImplI386::SetRegisterContext(const void *buf,
if (size > buf_len)
size = buf_len;
- uint8_t *p = (uint8_t *)buf;
+ const uint8_t *p = (const uint8_t *)buf;
// Copy the GPR registers
memcpy(&m_state.context.gpr, p, sizeof(GPR));
p += sizeof(GPR);
@@ -1927,7 +1927,7 @@ nub_size_t DNBArchImplI386::SetRegisterContext(const void *buf,
p += sizeof(EXC);
// make sure we end up with exactly what we think we should have
- size_t bytes_written = p - (uint8_t *)buf;
+ size_t bytes_written = p - (const uint8_t *)buf;
UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert(bytes_written == size);
kern_return_t kret;
diff --git a/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
index 416b21f29958..86843fd97c06 100644
--- a/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ b/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -1380,7 +1380,7 @@ const DNBRegisterInfo DNBArchImplX86_64::g_fpu_registers_no_avx[] = {
FPU_OFFSET(fcw), -1U, -1U, -1U, -1U, NULL, NULL},
{e_regSetFPU, fpu_fsw, "fstat", NULL, Uint, Hex, FPU_SIZE_UINT(fsw),
FPU_OFFSET(fsw), -1U, -1U, -1U, -1U, NULL, NULL},
- {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, FPU_SIZE_UINT(ftw),
+ {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, 2 /* sizeof __fpu_ftw + sizeof __fpu_rsrv1 */,
FPU_OFFSET(ftw), -1U, -1U, -1U, -1U, NULL, NULL},
{e_regSetFPU, fpu_fop, "fop", NULL, Uint, Hex, FPU_SIZE_UINT(fop),
FPU_OFFSET(fop), -1U, -1U, -1U, -1U, NULL, NULL},
@@ -1495,7 +1495,7 @@ const DNBRegisterInfo DNBArchImplX86_64::g_fpu_registers_avx[] = {
AVX_OFFSET(fcw), -1U, -1U, -1U, -1U, NULL, NULL},
{e_regSetFPU, fpu_fsw, "fstat", NULL, Uint, Hex, FPU_SIZE_UINT(fsw),
AVX_OFFSET(fsw), -1U, -1U, -1U, -1U, NULL, NULL},
- {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, FPU_SIZE_UINT(ftw),
+ {e_regSetFPU, fpu_ftw, "ftag", NULL, Uint, Hex, 2 /* sizeof __fpu_ftw + sizeof __fpu_rsrv1 */,
AVX_OFFSET(ftw), -1U, -1U, -1U, -1U, NULL, NULL},
{e_regSetFPU, fpu_fop, "fop", NULL, Uint, Hex, FPU_SIZE_UINT(fop),
AVX_OFFSET(fop), -1U, -1U, -1U, -1U, NULL, NULL},
@@ -1776,7 +1776,7 @@ bool DNBArchImplX86_64::GetRegisterValue(uint32_t set, uint32_t reg,
*((uint16_t *)(&m_state.context.fpu.no_avx.__fpu_fsw));
return true;
case fpu_ftw:
- value->value.uint8 = m_state.context.fpu.no_avx.__fpu_ftw;
+ memcpy (&value->value.uint16, &m_state.context.fpu.no_avx.__fpu_ftw, 2);
return true;
case fpu_fop:
value->value.uint16 = m_state.context.fpu.no_avx.__fpu_fop;
@@ -1932,7 +1932,7 @@ bool DNBArchImplX86_64::SetRegisterValue(uint32_t set, uint32_t reg,
success = true;
break;
case fpu_ftw:
- m_state.context.fpu.no_avx.__fpu_ftw = value->value.uint8;
+ memcpy (&m_state.context.fpu.no_avx.__fpu_ftw, &value->value.uint8, 2);
success = true;
break;
case fpu_fop:
@@ -2164,7 +2164,7 @@ nub_size_t DNBArchImplX86_64::SetRegisterContext(const void *buf,
if (size > buf_len)
size = static_cast<uint32_t>(buf_len);
- uint8_t *p = (uint8_t *)buf;
+ const uint8_t *p = (const uint8_t *)buf;
// Copy the GPR registers
memcpy(&m_state.context.gpr, p, sizeof(GPR));
p += sizeof(GPR);
@@ -2205,7 +2205,7 @@ nub_size_t DNBArchImplX86_64::SetRegisterContext(const void *buf,
p += sizeof(EXC);
// make sure we end up with exactly what we think we should have
- size_t bytes_written = p - (uint8_t *)buf;
+ size_t bytes_written = p - (const uint8_t *)buf;
UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert(bytes_written == size);
diff --git a/tools/debugserver/source/RNBRemote.cpp b/tools/debugserver/source/RNBRemote.cpp
index cf6b4b626914..0a2eef3feacd 100644
--- a/tools/debugserver/source/RNBRemote.cpp
+++ b/tools/debugserver/source/RNBRemote.cpp
@@ -710,29 +710,29 @@ std::string RNBRemote::CompressString(const std::string &orig) {
size_t compressed_size = 0;
#if defined(HAVE_LIBCOMPRESSION)
- if (compression_decode_buffer &&
- compression_type == compression_types::lz4) {
+ if (compression_type == compression_types::lz4) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZ4_RAW);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZ4_RAW);
}
- if (compression_decode_buffer &&
- compression_type == compression_types::zlib_deflate) {
+ if (compression_type == compression_types::zlib_deflate) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_ZLIB);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_ZLIB);
}
- if (compression_decode_buffer &&
- compression_type == compression_types::lzma) {
+ if (compression_type == compression_types::lzma) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZMA);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZMA);
}
- if (compression_decode_buffer &&
- compression_type == compression_types::lzfse) {
+ if (compression_type == compression_types::lzfse) {
compressed_size = compression_encode_buffer(
- encoded_data.data(), encoded_data_buf_size, (uint8_t *)orig.c_str(),
- orig.size(), nullptr, COMPRESSION_LZFSE);
+ encoded_data.data(), encoded_data_buf_size,
+ (const uint8_t *)orig.c_str(), orig.size(), nullptr,
+ COMPRESSION_LZFSE);
}
#endif
@@ -2247,7 +2247,7 @@ rnb_err_t set_logging(const char *p) {
continue;
}
char *fn = (char *) alloca (c - p + 1);
- strncpy (fn, p, c - p);
+ strlcpy (fn, p, c - p);
fn[c - p] = '\0';
// A file name of "asl" is special and is another way to indicate
@@ -2862,7 +2862,7 @@ rnb_err_t RNBRemote::SendStopReplyPacketForThread(nub_thread_t tid) {
else {
// the thread name contains special chars, send as hex bytes
ostrm << std::hex << "hexname:";
- uint8_t *u_thread_name = (uint8_t *)thread_name;
+ const uint8_t *u_thread_name = (const uint8_t *)thread_name;
for (size_t i = 0; i < thread_name_len; i++)
ostrm << RAWHEX8(u_thread_name[i]);
ostrm << ';';
@@ -3049,7 +3049,7 @@ rnb_err_t RNBRemote::HandlePacket_last_signal(const char *unused) {
// If we have an empty exit packet, lets fill one in to be safe.
if (!pid_exited_packet[0]) {
- strncpy(pid_exited_packet, "W00", sizeof(pid_exited_packet) - 1);
+ strlcpy(pid_exited_packet, "W00", sizeof(pid_exited_packet) - 1);
pid_exited_packet[sizeof(pid_exited_packet) - 1] = '\0';
}
@@ -3621,7 +3621,7 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) {
#if defined(HAVE_LIBCOMPRESSION)
// libcompression is weak linked so test if compression_decode_buffer() is
// available
- if (enable_compression && compression_decode_buffer != NULL) {
+ if (enable_compression) {
strcat(buf, ";SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;"
"DefaultCompressionMinSize=");
char numbuf[16];
@@ -3667,7 +3667,7 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
return RNBRemote::HandlePacket_s("s");
} else if (strstr(p, "vCont") == p) {
DNBThreadResumeActions thread_actions;
- char *c = (char *)(p += strlen("vCont"));
+ char *c = const_cast<char *>(p += strlen("vCont"));
char *c_end = c + strlen(c);
if (*c == '?')
return SendPacket("vCont;c;C;s;S");
@@ -4307,24 +4307,22 @@ rnb_err_t RNBRemote::HandlePacket_QEnableCompression(const char *p) {
}
#if defined(HAVE_LIBCOMPRESSION)
- if (compression_decode_buffer != NULL) {
- if (strstr(p, "type:zlib-deflate;") != nullptr) {
- EnableCompressionNextSendPacket(compression_types::zlib_deflate);
- m_compression_minsize = new_compression_minsize;
- return SendPacket("OK");
- } else if (strstr(p, "type:lz4;") != nullptr) {
- EnableCompressionNextSendPacket(compression_types::lz4);
- m_compression_minsize = new_compression_minsize;
- return SendPacket("OK");
- } else if (strstr(p, "type:lzma;") != nullptr) {
- EnableCompressionNextSendPacket(compression_types::lzma);
- m_compression_minsize = new_compression_minsize;
- return SendPacket("OK");
- } else if (strstr(p, "type:lzfse;") != nullptr) {
- EnableCompressionNextSendPacket(compression_types::lzfse);
- m_compression_minsize = new_compression_minsize;
- return SendPacket("OK");
- }
+ if (strstr(p, "type:zlib-deflate;") != nullptr) {
+ EnableCompressionNextSendPacket(compression_types::zlib_deflate);
+ m_compression_minsize = new_compression_minsize;
+ return SendPacket("OK");
+ } else if (strstr(p, "type:lz4;") != nullptr) {
+ EnableCompressionNextSendPacket(compression_types::lz4);
+ m_compression_minsize = new_compression_minsize;
+ return SendPacket("OK");
+ } else if (strstr(p, "type:lzma;") != nullptr) {
+ EnableCompressionNextSendPacket(compression_types::lzma);
+ m_compression_minsize = new_compression_minsize;
+ return SendPacket("OK");
+ } else if (strstr(p, "type:lzfse;") != nullptr) {
+ EnableCompressionNextSendPacket(compression_types::lzfse);
+ m_compression_minsize = new_compression_minsize;
+ return SendPacket("OK");
}
#endif
diff --git a/tools/debugserver/source/RNBServices.cpp b/tools/debugserver/source/RNBServices.cpp
index d0b7e099d238..9f90f349f3af 100644
--- a/tools/debugserver/source/RNBServices.cpp
+++ b/tools/debugserver/source/RNBServices.cpp
@@ -220,7 +220,7 @@ int ListApplications(std::string &plist, bool opt_runningApps,
CFIndex size = ::CFDataGetLength(plistData.get());
const UInt8 *bytes = ::CFDataGetBytePtr(plistData.get());
if (bytes != NULL && size > 0) {
- plist.assign((char *)bytes, size);
+ plist.assign((const char *)bytes, size);
return 0; // Success
} else {
DNBLogError("empty application property list.");
diff --git a/tools/debugserver/source/RNBSocket.cpp b/tools/debugserver/source/RNBSocket.cpp
index f1db5e419ff2..88136c210acc 100644
--- a/tools/debugserver/source/RNBSocket.cpp
+++ b/tools/debugserver/source/RNBSocket.cpp
@@ -373,9 +373,10 @@ rnb_err_t RNBSocket::Write(const void *buffer, size_t length) {
DNBLogThreadedIf(
LOG_RNB_PACKETS, "putpkt: %*s", (int)length,
- (char *)
+ (const char *)
buffer); // All data is string based in debugserver, so this is safe
- DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length, (char *)buffer);
+ DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length,
+ (const char *)buffer);
return rnb_success;
}
diff --git a/tools/debugserver/source/debugserver.cpp b/tools/debugserver/source/debugserver.cpp
index 318e72e971a5..8291f8d32b51 100644
--- a/tools/debugserver/source/debugserver.cpp
+++ b/tools/debugserver/source/debugserver.cpp
@@ -232,7 +232,7 @@ RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,
// were given and hope for the best
if (!DNBResolveExecutablePath(inferior_argv[0], resolved_path,
sizeof(resolved_path)))
- ::strncpy(resolved_path, inferior_argv[0], sizeof(resolved_path));
+ ::strlcpy(resolved_path, inferior_argv[0], sizeof(resolved_path));
char launch_err_str[PATH_MAX];
launch_err_str[0] = '\0';
@@ -676,7 +676,7 @@ static void PortWasBoundCallbackUnixSocket(const void *baton, in_port_t port) {
}
saddr_un.sun_family = AF_UNIX;
- ::strncpy(saddr_un.sun_path, unix_socket_name,
+ ::strlcpy(saddr_un.sun_path, unix_socket_name,
sizeof(saddr_un.sun_path) - 1);
saddr_un.sun_path[sizeof(saddr_un.sun_path) - 1] = '\0';
saddr_un.sun_len = SUN_LEN(&saddr_un);
@@ -1366,7 +1366,7 @@ int main(int argc, char *argv[]) {
DNBLogDebug("host = '%s' port = %i", host.c_str(), port);
} else if (argv[0][0] == '/') {
port = INT32_MAX;
- strncpy(str, argv[0], sizeof(str));
+ strlcpy(str, argv[0], sizeof(str));
} else {
show_usage_and_exit(2);
}
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 6384d5a92c2c..1fac2e5d1687 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -1,5 +1,3 @@
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR
(CMAKE_SYSTEM_NAME MATCHES "NetBSD" ))
# These targets do not have getopt support, so they rely on the one provided by
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 102ba775da91..7e1dec7a34fa 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -9,6 +9,7 @@
#include "Driver.h"
+#include <atomic>
#include <csignal>
#include <fcntl.h>
#include <limits.h>
@@ -1177,17 +1178,16 @@ void sigwinch_handler(int signo) {
}
void sigint_handler(int signo) {
- static bool g_interrupt_sent = false;
+ static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
if (g_driver) {
- if (!g_interrupt_sent) {
- g_interrupt_sent = true;
+ if (!g_interrupt_sent.test_and_set()) {
g_driver->GetDebugger().DispatchInputInterrupt();
- g_interrupt_sent = false;
+ g_interrupt_sent.clear();
return;
}
}
- exit(signo);
+ _exit(signo);
}
void sigtstp_handler(int signo) {
diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
new file mode 100644
index 000000000000..b5316540fdf3
--- /dev/null
+++ b/tools/intel-features/CMakeLists.txt
@@ -0,0 +1,67 @@
+# Flags to control each individual feature
+option(LLDB_BUILD_INTEL_MPX "Enable Building of Intel(R) Memory Protection Extensions" ON)
+option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF)
+
+# Return if all features are OFF
+if (NOT LLDB_BUILD_INTEL_MPX AND NOT LLDB_BUILD_INTEL_PT)
+ return()
+endif()
+
+LIST (APPEND FEATURE_LIBS "")
+
+# Add feature specific subdirectories based on flags
+if (LLDB_BUILD_INTEL_MPX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+ add_subdirectory(intel-mpx)
+ LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelMPX)
+ SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_MPX")
+endif()
+
+if (LLDB_BUILD_INTEL_PT)
+ add_subdirectory(intel-pt)
+ LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelPT)
+ SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_PT")
+endif()
+
+# Add python wrapper if python not disabled
+if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ set(LLDB_INTEL_FEATURES_PYTHON_WRAP
+ ${LLDB_BINARY_DIR}/tools/intel-features/scripts/IntelFeaturesPythonWrap.cpp)
+ set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
+ PROPERTIES GENERATED 1)
+
+ if (CLANG_CL)
+ set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
+ PROPERTIES COMPILE_FLAGS -Wno-unused-function)
+ endif()
+
+ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+ NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+ set_property(SOURCE ${LLDB_INTEL_FEATURES_PYTHON_WRAP}
+ APPEND_STRING PROPERTY COMPILE_FLAGS
+ " -Wno-sequence-point -Wno-cast-qual")
+ endif ()
+ add_subdirectory(scripts)
+endif()
+
+if (NOT CLI_WRAPPER_PREPROCESSORS)
+ return()
+endif()
+
+set_source_files_properties(cli-wrapper.cpp PROPERTIES
+ COMPILE_FLAGS ${CLI_WRAPPER_PREPROCESSORS})
+
+add_lldb_library(lldbIntelFeatures SHARED
+ cli-wrapper.cpp
+ ${LLDB_INTEL_FEATURES_PYTHON_WRAP}
+
+ LINK_LIBS
+ ${FEATURE_LIBS}
+ )
+
+# Add link dependencies for python wrapper
+if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ add_dependencies(lldbIntelFeatures intel-features-swig_wrapper)
+endif()
+
+install(TARGETS lldbIntelFeatures
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
diff --git a/tools/intel-features/README.txt b/tools/intel-features/README.txt
new file mode 100644
index 000000000000..d46bf1392dcf
--- /dev/null
+++ b/tools/intel-features/README.txt
@@ -0,0 +1,73 @@
+****************************************************************************
+* README *
+* *
+* This file provides all the information regarding new CLI commands that *
+* enable using various hardware features of Intel(R) architecture based *
+* processors from LLDB's CLI. *
+****************************************************************************
+
+
+============
+Introduction
+============
+A shared library has been developed to use various hardware features of
+Intel(R) architecture based processors through LLDB's command line. The library
+currently comprises of hardware features namely Intel(R) Processor Trace and
+Intel(R) Memory Protection Extensions.
+
+
+============
+Details
+============
+A C++ based cli wrapper (cli-wrapper.cpp) has been developed here that
+agglomerates all cli commands for various hardware features. This wrapper is
+build to generate a shared library (lldbIntelFeatures) to provide all these
+commands.
+
+For each hardware feature, separate cli commands have been developed that are
+provided by wrappers (cli-wrapper-pt.cpp and cli-wrapper-mpxtable.cpp) residing
+in feature specific folders ("intel-pt" and "intel-mpx" respectively).
+
+For details regarding cli commands of each feature, please refer to these
+feature specific wrappers.
+
+
+
+============
+How to Build
+============
+The shared library (lldbIntelFeatures) has a cmake based build and can be built
+while building LLDB with cmake. "cli-wrapper.cpp" file is compiled along with all
+the feature specific source files (residing in feature specific folders).
+
+Furthermore, flexibility is provided to the user to include/exclude a particular
+feature while building lldbIntelFeatures library. This is done by flags described
+below:
+
+ - LLDB_BUILD_INTEL_PT - The flag enables building of Intel(R) Processor Trace
+ feature (inside intel-pt folder). This flag defaults to "OFF" meaning the
+ feature is excluded while building lldbIntelFeatures library. Set it to "ON"
+ in order to include it.
+
+ - LLDB_BUILD_INTEL_MPX - Enables building Intel(R) Memory Protection Extensions
+ feature (inside intel-mpx folder). This flag defaults to "ON" meaning
+ the feature is excluded while building lldbIntelFeatures library.
+
+Please refer to README files in feature specific folders to know about additional
+flags that need to be set in order to build that feature successfully.
+
+
+============
+How to Use
+============
+All CLI commands provided by this shared library can be used through the LLDB's
+CLI by executing "plugin load <shared_lib_name>" on LLDB CLI. shared_lib_name here
+is lldbIntelFeatures
+
+
+
+============
+Description
+============
+Please refer to README_CLI file of each feature to know about details of CLI
+commands.
diff --git a/tools/intel-features/cli-wrapper.cpp b/tools/intel-features/cli-wrapper.cpp
new file mode 100644
index 000000000000..8b1471509663
--- /dev/null
+++ b/tools/intel-features/cli-wrapper.cpp
@@ -0,0 +1,43 @@
+//===-- cli-wrapper.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// CLI Wrapper for hardware features of Intel(R) architecture based processors
+// to enable them to be used through LLDB's CLI. For details, please refer to
+// cli wrappers of each individual feature, residing in their respective
+// folders.
+//
+// Compile this into a shared lib and load by placing at appropriate locations
+// on disk or by using "plugin load" command at the LLDB command line.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef BUILD_INTEL_MPX
+#include "intel-mpx/cli-wrapper-mpxtable.h"
+#endif
+
+#ifdef BUILD_INTEL_PT
+#include "intel-pt/cli-wrapper-pt.h"
+#endif
+
+#include "lldb/API/SBDebugger.h"
+
+namespace lldb {
+bool PluginInitialize(lldb::SBDebugger debugger);
+}
+
+bool lldb::PluginInitialize(lldb::SBDebugger debugger) {
+
+#ifdef BUILD_INTEL_PT
+ PTPluginInitialize(debugger);
+#endif
+
+#ifdef BUILD_INTEL_MPX
+ MPXPluginInitialize(debugger);
+#endif
+
+ return true;
+}
diff --git a/tools/intel-features/intel-mpx/CMakeLists.txt b/tools/intel-features/intel-mpx/CMakeLists.txt
new file mode 100644
index 000000000000..319f712b82bd
--- /dev/null
+++ b/tools/intel-features/intel-mpx/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_lldb_library(lldbIntelMPX
+ cli-wrapper-mpxtable.cpp
+
+ LINK_LIBS
+ liblldb
+
+ LINK_COMPONENTS
+ Support
+ )
diff --git a/tools/intel-mpx/IntelMPXTablePlugin.cpp b/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
index 0f86ce661def..e654f076fb3a 100644
--- a/tools/intel-mpx/IntelMPXTablePlugin.cpp
+++ b/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
@@ -1,4 +1,5 @@
-//===-- IntelMPXTablePlugin.cpp----------------------------------*- C++ -*-===//
+//===-- cli-wrapper-mpxtable.cpp----------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +13,7 @@
#include <string>
// Project includes
+#include "cli-wrapper-mpxtable.h"
#include "lldb/API/SBCommandInterpreter.h"
#include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBMemoryRegionInfo.h"
@@ -21,10 +23,6 @@
#include "llvm/ADT/Triple.h"
-namespace lldb {
-bool PluginInitialize(lldb::SBDebugger debugger);
-}
-
static bool GetPtr(char *cptr, uint64_t &ptr, lldb::SBFrame &frame,
lldb::SBCommandReturnObject &result) {
if (!cptr) {
@@ -285,8 +283,8 @@ static bool GetInitInfo(lldb::SBDebugger debugger, lldb::SBTarget &target,
lldb::SBValue bndcfgu_val = frame.FindRegister("bndcfgu");
if (!bndcfgu_val.IsValid()) {
- result.SetError(
- "Cannot access register BNDCFGU. Does the target support MPX?");
+ result.SetError("Cannot access register BNDCFGU. Does the target support "
+ "Intel(R) Memory Protection Extensions (Intel(R) MPX)?");
result.SetStatus(lldb::eReturnStatusFailed);
return false;
}
@@ -409,17 +407,17 @@ public:
}
};
-bool lldb::PluginInitialize(lldb::SBDebugger debugger) {
+bool MPXPluginInitialize(lldb::SBDebugger &debugger) {
lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter();
lldb::SBCommand mpxTable = interpreter.AddMultiwordCommand(
- "mpx-table", "A utility to access the MPX table entries.");
+ "mpx-table", "A utility to access the Intel(R) MPX table entries.");
- const char *mpx_show_help = "Show the MPX table entry of a pointer.\n"
- "mpx-table show <pointer>";
+ const char *mpx_show_help = "Show the Intel(R) MPX table entry of a pointer."
+ "\nmpx-table show <pointer>";
mpxTable.AddCommand("show", new MPXTableShow(), mpx_show_help);
const char *mpx_set_help =
- "Set the MPX table entry of a pointer.\n"
+ "Set the Intel(R) MPX table entry of a pointer.\n"
"mpx-table set <pointer> <lower bound> <upper bound>";
mpxTable.AddCommand("set", new MPXTableSet(), mpx_set_help);
diff --git a/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h b/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h
new file mode 100644
index 000000000000..00028a93fb43
--- /dev/null
+++ b/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h
@@ -0,0 +1,12 @@
+//===-- cli-wrapper-mpxtable.h----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBDebugger.h"
+
+bool MPXPluginInitialize(lldb::SBDebugger &debugger);
diff --git a/tools/intel-mpx/test/Makefile b/tools/intel-features/intel-mpx/test/Makefile
index b18044407a70..b18044407a70 100644
--- a/tools/intel-mpx/test/Makefile
+++ b/tools/intel-features/intel-mpx/test/Makefile
diff --git a/tools/intel-mpx/test/README.txt b/tools/intel-features/intel-mpx/test/README.txt
index 314e78d3e0eb..6797eff30a79 100644
--- a/tools/intel-mpx/test/README.txt
+++ b/tools/intel-features/intel-mpx/test/README.txt
@@ -2,5 +2,5 @@ In order to run this test, create the following directory:
packages/Python/lldbsuite/test/functionalities/plugins/commands/mpxtablecmd
-and copy into it the contents of this direcotry.
+and copy into it the contents of this directory.
diff --git a/tools/intel-mpx/test/TestMPXTable.py b/tools/intel-features/intel-mpx/test/TestMPXTable.py
index f2468abd59a1..f571252e26f7 100644
--- a/tools/intel-mpx/test/TestMPXTable.py
+++ b/tools/intel-features/intel-mpx/test/TestMPXTable.py
@@ -24,16 +24,17 @@ class TestMPXTable(TestBase):
@skipIf(compiler="clang")
@skipIf(oslist=no_match(['linux']))
@skipIf(archs=no_match(['i386', 'x86_64']))
- @skipIf(compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
+ @skipIf(compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports
+ #Intel(R) Memory Protection Extensions (Intel(R) MPX).
def test_show_command(self):
"""Test 'mpx-table show' command"""
self.build()
lldb_exec_dir = os.environ["LLDB_IMPLIB_DIR"]
lldb_lib_dir = os.path.join(lldb_exec_dir, os.pardir, "lib")
- plugin_file = os.path.join(lldb_lib_dir, "liblldb-intel-mpxtable.so")
+ plugin_file = os.path.join(lldb_lib_dir, "liblldbIntelFeatures.so")
if not os.path.isfile(plugin_file):
- self.skipTest("Intel(R) mpx-table plugin missing.")
+ self.skipTest("features plugin missing.")
plugin_command = " "
seq = ("plugin", "load", plugin_file)
plugin_command = plugin_command.join(seq)
@@ -123,9 +124,9 @@ class TestMPXTable(TestBase):
lldb_exec_dir = os.environ["LLDB_IMPLIB_DIR"]
lldb_lib_dir = os.path.join(lldb_exec_dir, os.pardir, "lib")
- plugin_file = os.path.join(lldb_lib_dir, "liblldb-intel-mpxtable.so")
+ plugin_file = os.path.join(lldb_lib_dir, "liblldbIntelFeatures.so")
if not os.path.isfile(plugin_file):
- self.skipTest("Intel(R) mpx-table plugin missing.")
+ self.skipTest("features plugin missing.")
plugin_command = " "
seq = ("plugin", "load", plugin_file)
plugin_command = plugin_command.join(seq)
diff --git a/tools/intel-mpx/test/main.cpp b/tools/intel-features/intel-mpx/test/main.cpp
index 214332338d87..110befb1e250 100644
--- a/tools/intel-mpx/test/main.cpp
+++ b/tools/intel-features/intel-mpx/test/main.cpp
@@ -32,7 +32,8 @@ void func(int *ptr) {
int
main(int argc, char const *argv[])
{
- // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
+ // This call returns 0 only if the CPU and the kernel support
+ // Intel(R) Memory Protection Extensions (Intel(R) MPX).
if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
return -1;
diff --git a/tools/intel-features/intel-pt/CMakeLists.txt b/tools/intel-features/intel-pt/CMakeLists.txt
new file mode 100644
index 000000000000..9750ed83ce2d
--- /dev/null
+++ b/tools/intel-features/intel-pt/CMakeLists.txt
@@ -0,0 +1,31 @@
+if (NOT LIBIPT_INCLUDE_PATH)
+ message (FATAL_ERROR "libipt include path not provided")
+endif()
+
+if (NOT EXISTS "${LIBIPT_INCLUDE_PATH}")
+ message (FATAL_ERROR "invalid libipt include path provided")
+endif()
+include_directories(${LIBIPT_INCLUDE_PATH})
+
+if (NOT LIBIPT_LIBRARY_PATH)
+ find_library(LIBIPT_LIBRARY ipt)
+else()
+ if (NOT EXISTS "${LIBIPT_LIBRARY_PATH}")
+ message (FATAL_ERROR "invalid libipt library path provided")
+ endif()
+ find_library(LIBIPT_LIBRARY ipt PATHS ${LIBIPT_LIBRARY_PATH})
+endif()
+
+if (NOT LIBIPT_LIBRARY)
+ message (FATAL_ERROR "libipt library not found")
+endif()
+
+add_lldb_library(lldbIntelPT
+ PTDecoder.cpp
+ Decoder.cpp
+ cli-wrapper-pt.cpp
+
+ LINK_LIBS
+ ${LIBIPT_LIBRARY}
+ liblldb
+ )
diff --git a/tools/intel-features/intel-pt/Decoder.cpp b/tools/intel-features/intel-pt/Decoder.cpp
new file mode 100644
index 000000000000..0c385adc811c
--- /dev/null
+++ b/tools/intel-features/intel-pt/Decoder.cpp
@@ -0,0 +1,904 @@
+//===-- Decoder.cpp ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Project includes
+#include "Decoder.h"
+
+// C/C++ Includes
+#include <cinttypes>
+#include <cstring>
+
+// Other libraries and framework includes
+#include "lldb/API/SBModule.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBThread.h"
+
+using namespace ptdecoder_private;
+
+// This function removes entries of all the processes/threads which were once
+// registered in the class but are not alive anymore because they died or
+// finished executing.
+void Decoder::RemoveDeadProcessesAndThreads(lldb::SBProcess &sbprocess) {
+ lldb::SBTarget sbtarget = sbprocess.GetTarget();
+ lldb::SBDebugger sbdebugger = sbtarget.GetDebugger();
+ uint32_t num_targets = sbdebugger.GetNumTargets();
+
+ auto itr_process = m_mapProcessUID_mapThreadID_TraceInfo.begin();
+ while (itr_process != m_mapProcessUID_mapThreadID_TraceInfo.end()) {
+ bool process_found = false;
+ lldb::SBTarget target;
+ lldb::SBProcess process;
+ for (uint32_t i = 0; i < num_targets; i++) {
+ target = sbdebugger.GetTargetAtIndex(i);
+ process = target.GetProcess();
+ if (process.GetUniqueID() == itr_process->first) {
+ process_found = true;
+ break;
+ }
+ }
+
+ // Remove the process's entry if it was not found in SBDebugger
+ if (!process_found) {
+ itr_process = m_mapProcessUID_mapThreadID_TraceInfo.erase(itr_process);
+ continue;
+ }
+
+ // If the state of the process is exited or detached then remove process's
+ // entry. If not then remove entry for all those registered threads of this
+ // process that are not alive anymore.
+ lldb::StateType state = process.GetState();
+ if ((state == lldb::StateType::eStateDetached) ||
+ (state == lldb::StateType::eStateExited))
+ itr_process = m_mapProcessUID_mapThreadID_TraceInfo.erase(itr_process);
+ else {
+ auto itr_thread = itr_process->second.begin();
+ while (itr_thread != itr_process->second.end()) {
+ if (itr_thread->first == LLDB_INVALID_THREAD_ID) {
+ ++itr_thread;
+ continue;
+ }
+
+ lldb::SBThread thread = process.GetThreadByID(itr_thread->first);
+ if (!thread.IsValid())
+ itr_thread = itr_process->second.erase(itr_thread);
+ else
+ ++itr_thread;
+ }
+ ++itr_process;
+ }
+ }
+}
+
+void Decoder::StartProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBTraceOptions &sbtraceoptions,
+ lldb::SBError &sberror) {
+ sberror.Clear();
+ CheckDebuggerID(sbprocess, sberror);
+ if (!sberror.Success())
+ return;
+
+ std::lock_guard<std::mutex> guard(
+ m_mapProcessUID_mapThreadID_TraceInfo_mutex);
+ RemoveDeadProcessesAndThreads(sbprocess);
+
+ if (sbtraceoptions.getType() != lldb::TraceType::eTraceTypeProcessorTrace) {
+ sberror.SetErrorStringWithFormat("SBTraceOptions::TraceType not set to "
+ "eTraceTypeProcessorTrace; ProcessID = "
+ "%" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+ lldb::SBStructuredData sbstructdata = sbtraceoptions.getTraceParams(sberror);
+ if (!sberror.Success())
+ return;
+
+ const char *trace_tech_key = "trace-tech";
+ std::string trace_tech_value("intel-pt");
+ lldb::SBStructuredData value = sbstructdata.GetValueForKey(trace_tech_key);
+ if (!value.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "key \"%s\" not set in custom trace parameters", trace_tech_key);
+ return;
+ }
+
+ char string_value[9];
+ size_t bytes_written = value.GetStringValue(
+ string_value, sizeof(string_value) / sizeof(*string_value));
+ if (!bytes_written ||
+ (bytes_written > (sizeof(string_value) / sizeof(*string_value)))) {
+ sberror.SetErrorStringWithFormat(
+ "key \"%s\" not set in custom trace parameters", trace_tech_key);
+ return;
+ }
+
+ std::size_t pos =
+ trace_tech_value.find((const char *)string_value, 0, bytes_written);
+ if ((pos == std::string::npos)) {
+ sberror.SetErrorStringWithFormat(
+ "key \"%s\" not set to \"%s\" in custom trace parameters",
+ trace_tech_key, trace_tech_value.c_str());
+ return;
+ }
+
+ // Start Tracing
+ lldb::SBError error;
+ uint32_t unique_id = sbprocess.GetUniqueID();
+ lldb::tid_t tid = sbtraceoptions.getThreadID();
+ lldb::SBTrace trace = sbprocess.StartTrace(sbtraceoptions, error);
+ if (!error.Success()) {
+ if (tid == LLDB_INVALID_THREAD_ID)
+ sberror.SetErrorStringWithFormat("%s; ProcessID = %" PRIu64,
+ error.GetCString(),
+ sbprocess.GetProcessID());
+ else
+ sberror.SetErrorStringWithFormat(
+ "%s; thread_id = %" PRIu64 ", ProcessID = %" PRIu64,
+ error.GetCString(), tid, sbprocess.GetProcessID());
+ return;
+ }
+
+ MapThreadID_TraceInfo &mapThreadID_TraceInfo =
+ m_mapProcessUID_mapThreadID_TraceInfo[unique_id];
+ ThreadTraceInfo &trace_info = mapThreadID_TraceInfo[tid];
+ trace_info.SetUniqueTraceInstance(trace);
+ trace_info.SetStopID(sbprocess.GetStopID());
+}
+
+void Decoder::StopProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBError &sberror, lldb::tid_t tid) {
+ sberror.Clear();
+ CheckDebuggerID(sbprocess, sberror);
+ if (!sberror.Success()) {
+ return;
+ }
+
+ std::lock_guard<std::mutex> guard(
+ m_mapProcessUID_mapThreadID_TraceInfo_mutex);
+ RemoveDeadProcessesAndThreads(sbprocess);
+
+ uint32_t unique_id = sbprocess.GetUniqueID();
+ auto itr_process = m_mapProcessUID_mapThreadID_TraceInfo.find(unique_id);
+ if (itr_process == m_mapProcessUID_mapThreadID_TraceInfo.end()) {
+ sberror.SetErrorStringWithFormat(
+ "tracing not active for this process; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+
+ lldb::SBError error;
+ if (tid == LLDB_INVALID_THREAD_ID) {
+ // This implies to stop tracing on the whole process
+ lldb::user_id_t id_to_be_ignored = LLDB_INVALID_UID;
+ auto itr_thread = itr_process->second.begin();
+ while (itr_thread != itr_process->second.end()) {
+ // In the case when user started trace on the entire process and then
+ // registered newly spawned threads of this process in the class later,
+ // these newly spawned threads will have same trace id. If we stopped
+ // trace on the entire process then tracing stops automatically for these
+ // newly spawned registered threads. Stopping trace on them again will
+ // return error and therefore we need to skip stopping trace on them
+ // again.
+ lldb::SBTrace &trace = itr_thread->second.GetUniqueTraceInstance();
+ lldb::user_id_t lldb_pt_user_id = trace.GetTraceUID();
+ if (lldb_pt_user_id != id_to_be_ignored) {
+ trace.StopTrace(error, itr_thread->first);
+ if (!error.Success()) {
+ std::string error_string(error.GetCString());
+ if ((error_string.find("tracing not active for this process") ==
+ std::string::npos) &&
+ (error_string.find("tracing not active for this thread") ==
+ std::string::npos)) {
+ sberror.SetErrorStringWithFormat(
+ "%s; thread id=%" PRIu64 ", ProcessID = %" PRIu64,
+ error_string.c_str(), itr_thread->first,
+ sbprocess.GetProcessID());
+ return;
+ }
+ }
+
+ if (itr_thread->first == LLDB_INVALID_THREAD_ID)
+ id_to_be_ignored = lldb_pt_user_id;
+ }
+ itr_thread = itr_process->second.erase(itr_thread);
+ }
+ m_mapProcessUID_mapThreadID_TraceInfo.erase(itr_process);
+ } else {
+ // This implies to stop tracing on a single thread.
+ // if 'tid' is registered in the class then get the trace id and stop trace
+ // on it. If it is not then check if tracing was ever started on the entire
+ // process (because there is a possibility that trace is still running for
+ // 'tid' but it was not registered in the class because user had started
+ // trace on the whole process and 'tid' spawned later). In that case, get
+ // the trace id of the process trace instance and stop trace on this thread.
+ // If tracing was never started on the entire process then return error
+ // because there is no way tracing is active on 'tid'.
+ MapThreadID_TraceInfo &mapThreadID_TraceInfo = itr_process->second;
+ lldb::SBTrace trace;
+ auto itr = mapThreadID_TraceInfo.find(tid);
+ if (itr != mapThreadID_TraceInfo.end()) {
+ trace = itr->second.GetUniqueTraceInstance();
+ } else {
+ auto itr = mapThreadID_TraceInfo.find(LLDB_INVALID_THREAD_ID);
+ if (itr != mapThreadID_TraceInfo.end()) {
+ trace = itr->second.GetUniqueTraceInstance();
+ } else {
+ sberror.SetErrorStringWithFormat(
+ "tracing not active for this thread; thread id=%" PRIu64
+ ", ProcessID = %" PRIu64,
+ tid, sbprocess.GetProcessID());
+ return;
+ }
+ }
+
+ // Stop Tracing
+ trace.StopTrace(error, tid);
+ if (!error.Success()) {
+ std::string error_string(error.GetCString());
+ sberror.SetErrorStringWithFormat(
+ "%s; thread id=%" PRIu64 ", ProcessID = %" PRIu64,
+ error_string.c_str(), tid, sbprocess.GetProcessID());
+ if (error_string.find("tracing not active") == std::string::npos)
+ return;
+ }
+ // Delete the entry of 'tid' from this class (if any)
+ mapThreadID_TraceInfo.erase(tid);
+ }
+}
+
+void Decoder::ReadTraceDataAndImageInfo(lldb::SBProcess &sbprocess,
+ lldb::tid_t tid, lldb::SBError &sberror,
+ ThreadTraceInfo &threadTraceInfo) {
+ // Allocate trace data buffer and parse cpu info for 'tid' if it is registered
+ // for the first time in class
+ lldb::SBTrace &trace = threadTraceInfo.GetUniqueTraceInstance();
+ Buffer &pt_buffer = threadTraceInfo.GetPTBuffer();
+ lldb::SBError error;
+ if (pt_buffer.size() == 0) {
+ lldb::SBTraceOptions traceoptions;
+ traceoptions.setThreadID(tid);
+ trace.GetTraceConfig(traceoptions, error);
+ if (!error.Success()) {
+ sberror.SetErrorStringWithFormat("%s; ProcessID = %" PRIu64,
+ error.GetCString(),
+ sbprocess.GetProcessID());
+ return;
+ }
+ if (traceoptions.getType() != lldb::TraceType::eTraceTypeProcessorTrace) {
+ sberror.SetErrorStringWithFormat("invalid TraceType received from LLDB "
+ "for this thread; thread id=%" PRIu64
+ ", ProcessID = %" PRIu64,
+ tid, sbprocess.GetProcessID());
+ return;
+ }
+
+ threadTraceInfo.AllocatePTBuffer(traceoptions.getTraceBufferSize());
+ lldb::SBStructuredData sbstructdata = traceoptions.getTraceParams(sberror);
+ if (!sberror.Success())
+ return;
+ CPUInfo &pt_cpu = threadTraceInfo.GetCPUInfo();
+ ParseCPUInfo(pt_cpu, sbstructdata, sberror);
+ if (!sberror.Success())
+ return;
+ }
+
+ // Call LLDB API to get raw trace data for this thread
+ size_t bytes_written = trace.GetTraceData(error, (void *)pt_buffer.data(),
+ pt_buffer.size(), 0, tid);
+ if (!error.Success()) {
+ sberror.SetErrorStringWithFormat(
+ "%s; thread_id = %" PRIu64 ", ProcessID = %" PRIu64,
+ error.GetCString(), tid, sbprocess.GetProcessID());
+ return;
+ }
+ std::fill(pt_buffer.begin() + bytes_written, pt_buffer.end(), 0);
+
+ // Get information of all the modules of the inferior
+ lldb::SBTarget sbtarget = sbprocess.GetTarget();
+ ReadExecuteSectionInfos &readExecuteSectionInfos =
+ threadTraceInfo.GetReadExecuteSectionInfos();
+ GetTargetModulesInfo(sbtarget, readExecuteSectionInfos, sberror);
+ if (!sberror.Success())
+ return;
+}
+
+void Decoder::DecodeProcessorTrace(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ lldb::SBError &sberror,
+ ThreadTraceInfo &threadTraceInfo) {
+ // Initialize instruction decoder
+ struct pt_insn_decoder *decoder = nullptr;
+ struct pt_config config;
+ Buffer &pt_buffer = threadTraceInfo.GetPTBuffer();
+ CPUInfo &pt_cpu = threadTraceInfo.GetCPUInfo();
+ ReadExecuteSectionInfos &readExecuteSectionInfos =
+ threadTraceInfo.GetReadExecuteSectionInfos();
+
+ InitializePTInstDecoder(&decoder, &config, pt_cpu, pt_buffer,
+ readExecuteSectionInfos, sberror);
+ if (!sberror.Success())
+ return;
+
+ // Start raw trace decoding
+ Instructions &instruction_list = threadTraceInfo.GetInstructionLog();
+ instruction_list.clear();
+ DecodeTrace(decoder, instruction_list, sberror);
+}
+
+// Raw trace decoding requires information of Read & Execute sections of each
+// module of the inferior. This function updates internal state of the class to
+// store this information.
+void Decoder::GetTargetModulesInfo(
+ lldb::SBTarget &sbtarget, ReadExecuteSectionInfos &readExecuteSectionInfos,
+ lldb::SBError &sberror) {
+ if (!sbtarget.IsValid()) {
+ sberror.SetErrorStringWithFormat("Can't get target's modules info from "
+ "LLDB; process has an invalid target");
+ return;
+ }
+
+ lldb::SBFileSpec target_file_spec = sbtarget.GetExecutable();
+ if (!target_file_spec.IsValid()) {
+ sberror.SetErrorStringWithFormat("Target has an invalid file spec");
+ return;
+ }
+
+ uint32_t num_modules = sbtarget.GetNumModules();
+ readExecuteSectionInfos.clear();
+
+ // Store information of all RX sections of each module of inferior
+ for (uint32_t i = 0; i < num_modules; i++) {
+ lldb::SBModule module = sbtarget.GetModuleAtIndex(i);
+ if (!module.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "Can't get module info [ %" PRIu32
+ " ] of target \"%s\" from LLDB, invalid module",
+ i, target_file_spec.GetFilename());
+ return;
+ }
+
+ lldb::SBFileSpec module_file_spec = module.GetPlatformFileSpec();
+ if (!module_file_spec.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "Can't get module info [ %" PRIu32
+ " ] of target \"%s\" from LLDB, invalid file spec",
+ i, target_file_spec.GetFilename());
+ return;
+ }
+
+ const char *image(module_file_spec.GetFilename());
+ lldb::SBError error;
+ char image_complete_path[1024];
+ uint32_t path_length = module_file_spec.GetPath(
+ image_complete_path, sizeof(image_complete_path));
+ size_t num_sections = module.GetNumSections();
+
+ // Store information of only RX sections
+ for (size_t idx = 0; idx < num_sections; idx++) {
+ lldb::SBSection section = module.GetSectionAtIndex(idx);
+ uint32_t section_permission = section.GetPermissions();
+ if ((section_permission & lldb::Permissions::ePermissionsReadable) &&
+ (section_permission & lldb::Permissions::ePermissionsExecutable)) {
+ lldb::SBData section_data = section.GetSectionData();
+ if (!section_data.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "Can't get module info [ %" PRIu32 " ] \"%s\" of target "
+ "\"%s\" from LLDB, invalid "
+ "data in \"%s\" section",
+ i, image, target_file_spec.GetFilename(), section.GetName());
+ return;
+ }
+
+ // In case section has no data, skip it.
+ if (section_data.GetByteSize() == 0)
+ continue;
+
+ if (!path_length) {
+ sberror.SetErrorStringWithFormat(
+ "Can't get module info [ %" PRIu32 " ] \"%s\" of target "
+ "\"%s\" from LLDB, module "
+ "has an invalid path length",
+ i, image, target_file_spec.GetFilename());
+ return;
+ }
+
+ std::string image_path(image_complete_path, path_length);
+ readExecuteSectionInfos.emplace_back(
+ section.GetLoadAddress(sbtarget), section.GetFileOffset(),
+ section_data.GetByteSize(), image_path);
+ }
+ }
+ }
+}
+
+// Raw trace decoding requires information of the target cpu on which inferior
+// is running. This function gets the Trace Configuration from LLDB, parses it
+// for cpu model, family, stepping and vendor id info and updates the internal
+// state of the class to store this information.
+void Decoder::ParseCPUInfo(CPUInfo &pt_cpu, lldb::SBStructuredData &s,
+ lldb::SBError &sberror) {
+ lldb::SBStructuredData custom_trace_params = s.GetValueForKey("intel-pt");
+ if (!custom_trace_params.IsValid()) {
+ sberror.SetErrorStringWithFormat("lldb couldn't provide cpuinfo");
+ return;
+ }
+
+ uint64_t family = 0, model = 0, stepping = 0;
+ char vendor[32];
+ const char *key_family = "cpu_family";
+ const char *key_model = "cpu_model";
+ const char *key_stepping = "cpu_stepping";
+ const char *key_vendor = "cpu_vendor";
+
+ // parse family
+ lldb::SBStructuredData struct_family =
+ custom_trace_params.GetValueForKey(key_family);
+ if (!struct_family.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "%s info missing in custom trace parameters", key_family);
+ return;
+ }
+ family = struct_family.GetIntegerValue(0x10000);
+ if (family > UINT16_MAX) {
+ sberror.SetErrorStringWithFormat(
+ "invalid CPU family value extracted from custom trace parameters");
+ return;
+ }
+ pt_cpu.family = (uint16_t)family;
+
+ // parse model
+ lldb::SBStructuredData struct_model =
+ custom_trace_params.GetValueForKey(key_model);
+ if (!struct_model.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "%s info missing in custom trace parameters; family=%" PRIu16,
+ key_model, pt_cpu.family);
+ return;
+ }
+ model = struct_model.GetIntegerValue(0x100);
+ if (model > UINT8_MAX) {
+ sberror.SetErrorStringWithFormat("invalid CPU model value extracted from "
+ "custom trace parameters; family=%" PRIu16,
+ pt_cpu.family);
+ return;
+ }
+ pt_cpu.model = (uint8_t)model;
+
+ // parse stepping
+ lldb::SBStructuredData struct_stepping =
+ custom_trace_params.GetValueForKey(key_stepping);
+ if (!struct_stepping.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "%s info missing in custom trace parameters; family=%" PRIu16
+ ", model=%" PRIu8,
+ key_stepping, pt_cpu.family, pt_cpu.model);
+ return;
+ }
+ stepping = struct_stepping.GetIntegerValue(0x100);
+ if (stepping > UINT8_MAX) {
+ sberror.SetErrorStringWithFormat("invalid CPU stepping value extracted "
+ "from custom trace parameters; "
+ "family=%" PRIu16 ", model=%" PRIu8,
+ pt_cpu.family, pt_cpu.model);
+ return;
+ }
+ pt_cpu.stepping = (uint8_t)stepping;
+
+ // parse vendor info
+ pt_cpu.vendor = pcv_unknown;
+ lldb::SBStructuredData struct_vendor =
+ custom_trace_params.GetValueForKey(key_vendor);
+ if (!struct_vendor.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "%s info missing in custom trace parameters; family=%" PRIu16
+ ", model=%" PRIu8 ", stepping=%" PRIu8,
+ key_vendor, pt_cpu.family, pt_cpu.model, pt_cpu.stepping);
+ return;
+ }
+ auto length = struct_vendor.GetStringValue(vendor, sizeof(vendor));
+ if (length && strstr(vendor, "GenuineIntel"))
+ pt_cpu.vendor = pcv_intel;
+}
+
+// Initialize trace decoder with pt_config structure and populate its image
+// structure with inferior's memory image information. pt_config structure is
+// initialized with trace buffer and cpu info of the inferior before storing it
+// in trace decoder.
+void Decoder::InitializePTInstDecoder(
+ struct pt_insn_decoder **decoder, struct pt_config *config,
+ const CPUInfo &pt_cpu, Buffer &pt_buffer,
+ const ReadExecuteSectionInfos &readExecuteSectionInfos,
+ lldb::SBError &sberror) const {
+ if (!decoder || !config) {
+ sberror.SetErrorStringWithFormat("internal error");
+ return;
+ }
+
+ // Load cpu info of inferior's target in pt_config struct
+ pt_config_init(config);
+ config->cpu = pt_cpu;
+ int errcode = pt_cpu_errata(&(config->errata), &(config->cpu));
+ if (errcode < 0) {
+ sberror.SetErrorStringWithFormat("processor trace decoding library: "
+ "pt_cpu_errata() failed with error: "
+ "\"%s\"",
+ pt_errstr(pt_errcode(errcode)));
+ return;
+ }
+
+ // Load trace buffer's starting and end address in pt_config struct
+ config->begin = pt_buffer.data();
+ config->end = pt_buffer.data() + pt_buffer.size();
+
+ // Fill trace decoder with pt_config struct
+ *decoder = pt_insn_alloc_decoder(config);
+ if (*decoder == nullptr) {
+ sberror.SetErrorStringWithFormat("processor trace decoding library: "
+ "pt_insn_alloc_decoder() returned null "
+ "pointer");
+ return;
+ }
+
+ // Fill trace decoder's image with inferior's memory image information
+ struct pt_image *image = pt_insn_get_image(*decoder);
+ if (!image) {
+ sberror.SetErrorStringWithFormat("processor trace decoding library: "
+ "pt_insn_get_image() returned null "
+ "pointer");
+ pt_insn_free_decoder(*decoder);
+ return;
+ }
+
+ for (auto &itr : readExecuteSectionInfos) {
+ errcode = pt_image_add_file(image, itr.image_path.c_str(), itr.file_offset,
+ itr.size, nullptr, itr.load_address);
+ if (errcode < 0) {
+ sberror.SetErrorStringWithFormat("processor trace decoding library: "
+ "pt_image_add_file() failed with error: "
+ "\"%s\"",
+ pt_errstr(pt_errcode(errcode)));
+ pt_insn_free_decoder(*decoder);
+ return;
+ }
+ }
+}
+
+// Start actual decoding of raw trace
+void Decoder::DecodeTrace(struct pt_insn_decoder *decoder,
+ Instructions &instruction_list,
+ lldb::SBError &sberror) {
+ uint64_t decoder_offset = 0;
+
+ while (1) {
+ struct pt_insn insn;
+
+ // Try to sync the decoder. If it fails then get the decoder_offset and try
+ // to sync again. If the new_decoder_offset is same as decoder_offset then
+ // we will not succeed in syncing for any number of pt_insn_sync_forward()
+ // operations. Return in that case. Else keep resyncing until either end of
+ // trace stream is reached or pt_insn_sync_forward() passes.
+ int errcode = pt_insn_sync_forward(decoder);
+ if (errcode < 0) {
+ if (errcode == -pte_eos)
+ return;
+
+ int errcode_off = pt_insn_get_offset(decoder, &decoder_offset);
+ if (errcode_off < 0) {
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\"",
+ pt_errstr(pt_errcode(errcode)));
+ instruction_list.emplace_back(sberror.GetCString());
+ return;
+ }
+
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\" [decoder_offset] => "
+ "[0x%" PRIu64 "]",
+ pt_errstr(pt_errcode(errcode)), decoder_offset);
+ instruction_list.emplace_back(sberror.GetCString());
+ while (1) {
+ errcode = pt_insn_sync_forward(decoder);
+ if (errcode >= 0)
+ break;
+
+ if (errcode == -pte_eos)
+ return;
+
+ uint64_t new_decoder_offset = 0;
+ errcode_off = pt_insn_get_offset(decoder, &new_decoder_offset);
+ if (errcode_off < 0) {
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\"",
+ pt_errstr(pt_errcode(errcode)));
+ instruction_list.emplace_back(sberror.GetCString());
+ return;
+ } else if (new_decoder_offset <= decoder_offset) {
+ // We tried resyncing the decoder and decoder didn't make any
+ // progress because the offset didn't change. We will not make any
+ // progress further. Hence, returning in this situation.
+ return;
+ }
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\" [decoder_offset] => "
+ "[0x%" PRIu64 "]",
+ pt_errstr(pt_errcode(errcode)), new_decoder_offset);
+ instruction_list.emplace_back(sberror.GetCString());
+ decoder_offset = new_decoder_offset;
+ }
+ }
+
+ while (1) {
+ errcode = pt_insn_next(decoder, &insn, sizeof(insn));
+ if (errcode < 0) {
+ if (insn.iclass == ptic_error)
+ break;
+
+ instruction_list.emplace_back(insn);
+
+ if (errcode == -pte_eos)
+ return;
+
+ Diagnose(decoder, errcode, sberror, &insn);
+ instruction_list.emplace_back(sberror.GetCString());
+ break;
+ }
+ instruction_list.emplace_back(insn);
+ if (errcode & pts_eos)
+ return;
+ }
+ }
+}
+
+// Function to diagnose and indicate errors during raw trace decoding
+void Decoder::Diagnose(struct pt_insn_decoder *decoder, int decode_error,
+ lldb::SBError &sberror, const struct pt_insn *insn) {
+ int errcode;
+ uint64_t offset;
+
+ errcode = pt_insn_get_offset(decoder, &offset);
+ if (insn) {
+ if (errcode < 0)
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\" [decoder_offset, "
+ "last_successful_decoded_ip] => [?, 0x%" PRIu64 "]",
+ pt_errstr(pt_errcode(decode_error)), insn->ip);
+ else
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\" [decoder_offset, "
+ "last_successful_decoded_ip] => [0x%" PRIu64 ", 0x%" PRIu64 "]",
+ pt_errstr(pt_errcode(decode_error)), offset, insn->ip);
+ } else {
+ if (errcode < 0)
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\"",
+ pt_errstr(pt_errcode(decode_error)));
+ else
+ sberror.SetErrorStringWithFormat(
+ "processor trace decoding library: \"%s\" [decoder_offset] => "
+ "[0x%" PRIu64 "]",
+ pt_errstr(pt_errcode(decode_error)), offset);
+ }
+}
+
+void Decoder::GetInstructionLogAtOffset(lldb::SBProcess &sbprocess,
+ lldb::tid_t tid, uint32_t offset,
+ uint32_t count,
+ InstructionList &result_list,
+ lldb::SBError &sberror) {
+ sberror.Clear();
+ CheckDebuggerID(sbprocess, sberror);
+ if (!sberror.Success()) {
+ return;
+ }
+
+ std::lock_guard<std::mutex> guard(
+ m_mapProcessUID_mapThreadID_TraceInfo_mutex);
+ RemoveDeadProcessesAndThreads(sbprocess);
+
+ ThreadTraceInfo *threadTraceInfo = nullptr;
+ FetchAndDecode(sbprocess, tid, sberror, &threadTraceInfo);
+ if (!sberror.Success()) {
+ return;
+ }
+ if (threadTraceInfo == nullptr) {
+ sberror.SetErrorStringWithFormat("internal error");
+ return;
+ }
+
+ // Return instruction log by populating 'result_list'
+ Instructions &insn_list = threadTraceInfo->GetInstructionLog();
+ uint64_t sum = (uint64_t)offset + 1;
+ if (((insn_list.size() <= offset) && (count <= sum) &&
+ ((sum - count) >= insn_list.size())) ||
+ (count < 1)) {
+ sberror.SetErrorStringWithFormat(
+ "Instruction Log not available for offset=%" PRIu32
+ " and count=%" PRIu32 ", ProcessID = %" PRIu64,
+ offset, count, sbprocess.GetProcessID());
+ return;
+ }
+
+ Instructions::iterator itr_first =
+ (insn_list.size() <= offset) ? insn_list.begin()
+ : insn_list.begin() + insn_list.size() - sum;
+ Instructions::iterator itr_last =
+ (count <= sum) ? insn_list.begin() + insn_list.size() - (sum - count)
+ : insn_list.end();
+ Instructions::iterator itr = itr_first;
+ while (itr != itr_last) {
+ result_list.AppendInstruction(*itr);
+ ++itr;
+ }
+}
+
+void Decoder::GetProcessorTraceInfo(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ TraceOptions &options,
+ lldb::SBError &sberror) {
+ sberror.Clear();
+ CheckDebuggerID(sbprocess, sberror);
+ if (!sberror.Success()) {
+ return;
+ }
+
+ std::lock_guard<std::mutex> guard(
+ m_mapProcessUID_mapThreadID_TraceInfo_mutex);
+ RemoveDeadProcessesAndThreads(sbprocess);
+
+ ThreadTraceInfo *threadTraceInfo = nullptr;
+ FetchAndDecode(sbprocess, tid, sberror, &threadTraceInfo);
+ if (!sberror.Success()) {
+ return;
+ }
+ if (threadTraceInfo == nullptr) {
+ sberror.SetErrorStringWithFormat("internal error");
+ return;
+ }
+
+ // Get SBTraceOptions from LLDB for 'tid', populate 'traceoptions' with it
+ lldb::SBTrace &trace = threadTraceInfo->GetUniqueTraceInstance();
+ lldb::SBTraceOptions traceoptions;
+ lldb::SBError error;
+ traceoptions.setThreadID(tid);
+ trace.GetTraceConfig(traceoptions, error);
+ if (!error.Success()) {
+ std::string error_string(error.GetCString());
+ if (error_string.find("tracing not active") != std::string::npos) {
+ uint32_t unique_id = sbprocess.GetUniqueID();
+ auto itr_process = m_mapProcessUID_mapThreadID_TraceInfo.find(unique_id);
+ if (itr_process == m_mapProcessUID_mapThreadID_TraceInfo.end())
+ return;
+ itr_process->second.erase(tid);
+ }
+ sberror.SetErrorStringWithFormat("%s; ProcessID = %" PRIu64,
+ error_string.c_str(),
+ sbprocess.GetProcessID());
+ return;
+ }
+ if (traceoptions.getType() != lldb::TraceType::eTraceTypeProcessorTrace) {
+ sberror.SetErrorStringWithFormat("invalid TraceType received from LLDB "
+ "for this thread; thread id=%" PRIu64
+ ", ProcessID = %" PRIu64,
+ tid, sbprocess.GetProcessID());
+ return;
+ }
+ options.setType(traceoptions.getType());
+ options.setTraceBufferSize(traceoptions.getTraceBufferSize());
+ options.setMetaDataBufferSize(traceoptions.getMetaDataBufferSize());
+ lldb::SBStructuredData sbstructdata = traceoptions.getTraceParams(sberror);
+ if (!sberror.Success())
+ return;
+ options.setTraceParams(sbstructdata);
+ options.setInstructionLogSize(threadTraceInfo->GetInstructionLog().size());
+}
+
+void Decoder::FetchAndDecode(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ lldb::SBError &sberror,
+ ThreadTraceInfo **threadTraceInfo) {
+ // Return with error if 'sbprocess' is not registered in the class
+ uint32_t unique_id = sbprocess.GetUniqueID();
+ auto itr_process = m_mapProcessUID_mapThreadID_TraceInfo.find(unique_id);
+ if (itr_process == m_mapProcessUID_mapThreadID_TraceInfo.end()) {
+ sberror.SetErrorStringWithFormat(
+ "tracing not active for this process; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+
+ if (tid == LLDB_INVALID_THREAD_ID) {
+ sberror.SetErrorStringWithFormat(
+ "invalid thread id provided; thread_id = %" PRIu64
+ ", ProcessID = %" PRIu64,
+ tid, sbprocess.GetProcessID());
+ return;
+ }
+
+ // Check whether 'tid' thread is registered in the class. If it is then in
+ // case StopID didn't change then return without doing anything (no need to
+ // read and decode trace data then). Otherwise, save new StopID and proceed
+ // with reading and decoding trace.
+ if (threadTraceInfo == nullptr) {
+ sberror.SetErrorStringWithFormat("internal error");
+ return;
+ }
+
+ MapThreadID_TraceInfo &mapThreadID_TraceInfo = itr_process->second;
+ auto itr_thread = mapThreadID_TraceInfo.find(tid);
+ if (itr_thread != mapThreadID_TraceInfo.end()) {
+ if (itr_thread->second.GetStopID() == sbprocess.GetStopID()) {
+ *threadTraceInfo = &(itr_thread->second);
+ return;
+ }
+ itr_thread->second.SetStopID(sbprocess.GetStopID());
+ } else {
+ // Implies 'tid' is not registered in the class. If tracing was never
+ // started on the entire process then return an error. Else try to register
+ // this thread and proceed with reading and decoding trace.
+ lldb::SBError error;
+ itr_thread = mapThreadID_TraceInfo.find(LLDB_INVALID_THREAD_ID);
+ if (itr_thread == mapThreadID_TraceInfo.end()) {
+ sberror.SetErrorStringWithFormat(
+ "tracing not active for this thread; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+
+ lldb::SBTrace &trace = itr_thread->second.GetUniqueTraceInstance();
+ ThreadTraceInfo &trace_info = mapThreadID_TraceInfo[tid];
+ trace_info.SetUniqueTraceInstance(trace);
+ trace_info.SetStopID(sbprocess.GetStopID());
+ itr_thread = mapThreadID_TraceInfo.find(tid);
+ }
+
+ // Get raw trace data and inferior image from LLDB for the registered thread
+ ReadTraceDataAndImageInfo(sbprocess, tid, sberror, itr_thread->second);
+ if (!sberror.Success()) {
+ std::string error_string(sberror.GetCString());
+ if (error_string.find("tracing not active") != std::string::npos)
+ mapThreadID_TraceInfo.erase(itr_thread);
+ return;
+ }
+ // Decode raw trace data
+ DecodeProcessorTrace(sbprocess, tid, sberror, itr_thread->second);
+ if (!sberror.Success()) {
+ return;
+ }
+ *threadTraceInfo = &(itr_thread->second);
+}
+
+// This function checks whether the provided SBProcess instance belongs to same
+// SBDebugger with which this tool instance is associated.
+void Decoder::CheckDebuggerID(lldb::SBProcess &sbprocess,
+ lldb::SBError &sberror) {
+ if (!sbprocess.IsValid()) {
+ sberror.SetErrorStringWithFormat("invalid process instance");
+ return;
+ }
+
+ lldb::SBTarget sbtarget = sbprocess.GetTarget();
+ if (!sbtarget.IsValid()) {
+ sberror.SetErrorStringWithFormat(
+ "process contains an invalid target; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+
+ lldb::SBDebugger sbdebugger = sbtarget.GetDebugger();
+ if (!sbdebugger.IsValid()) {
+ sberror.SetErrorStringWithFormat("process's target contains an invalid "
+ "debugger instance; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+
+ if (sbdebugger.GetID() != m_debugger_user_id) {
+ sberror.SetErrorStringWithFormat(
+ "process belongs to a different SBDebugger instance than the one for "
+ "which the tool is instantiated; ProcessID = %" PRIu64,
+ sbprocess.GetProcessID());
+ return;
+ }
+}
diff --git a/tools/intel-features/intel-pt/Decoder.h b/tools/intel-features/intel-pt/Decoder.h
new file mode 100644
index 000000000000..dc2794ac3bc3
--- /dev/null
+++ b/tools/intel-features/intel-pt/Decoder.h
@@ -0,0 +1,327 @@
+//===-- Decoder.h -----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef Decoder_h_
+#define Decoder_h_
+
+// C/C++ Includes
+#include <map>
+#include <mutex>
+#include <string>
+#include <vector>
+
+// Project includes, Other libraries and framework includes
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/API/SBTrace.h"
+#include "lldb/API/SBTraceOptions.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include "intel-pt.h"
+
+namespace ptdecoder_private {
+//----------------------------------------------------------------------
+/// @class Instruction
+/// @brief Represents an assembly instruction containing raw
+/// instruction bytes, instruction address along with information
+/// regarding execution flow context and Intel(R) Processor Trace
+/// context.
+//----------------------------------------------------------------------
+class Instruction {
+public:
+ Instruction() : ip(0), data(), error(), iclass(ptic_error), speculative(0) {}
+
+ Instruction(const Instruction &insn) = default;
+
+ Instruction(const struct pt_insn &insn)
+ : ip(insn.ip), data(), error(insn.size == 0 ? "invalid instruction" : ""),
+ iclass(insn.iclass), speculative(insn.speculative) {
+ if (insn.size != 0)
+ data.assign(insn.raw, insn.raw + insn.size);
+ }
+
+ Instruction(const char *err)
+ : ip(0), data(), error(err ? err : "unknown error"), iclass(ptic_error),
+ speculative(0) {}
+
+ ~Instruction() {}
+
+ uint64_t GetInsnAddress() const { return ip; }
+
+ size_t GetRawBytes(void *buf, size_t size) const {
+ if ((buf == nullptr) || (size == 0))
+ return data.size();
+
+ size_t bytes_to_read = ((size <= data.size()) ? size : data.size());
+ ::memcpy(buf, data.data(), bytes_to_read);
+ return bytes_to_read;
+ }
+
+ const std::string &GetError() const { return error; }
+
+ bool GetSpeculative() const { return speculative; }
+
+private:
+ uint64_t ip; // instruction address in inferior's memory image
+ std::vector<uint8_t> data; // raw bytes
+ std::string error; // Error string if instruction is invalid
+ enum pt_insn_class iclass; // classification of the instruction
+ // A collection of flags giving additional information about instruction
+ uint32_t speculative : 1; // Instruction was executed speculatively or not
+};
+
+//---------------------------------------------------------------------------
+/// @class InstructionList
+/// @brief Represents a list of assembly instructions. Each instruction is of
+/// type Instruction.
+//---------------------------------------------------------------------------
+class InstructionList {
+public:
+ InstructionList() : m_insn_vec() {}
+
+ InstructionList(const InstructionList &insn_list)
+ : m_insn_vec(insn_list.m_insn_vec) {}
+
+ ~InstructionList() {}
+
+ // Get number of instructions in the list
+ size_t GetSize() const { return m_insn_vec.size(); }
+
+ // Get instruction at index
+ Instruction GetInstructionAtIndex(uint32_t idx) {
+ return (idx < m_insn_vec.size() ? m_insn_vec[idx]
+ : Instruction("invalid instruction"));
+ }
+
+ // Append intruction at the end of the list
+ void AppendInstruction(Instruction inst) { m_insn_vec.push_back(inst); }
+
+private:
+ std::vector<Instruction> m_insn_vec;
+};
+
+//----------------------------------------------------------------------
+/// @class TraceOptions
+/// @brief Provides Intel(R) Processor Trace specific configuration options and
+/// other information obtained by decoding and post-processing the trace
+/// data. Currently, this information comprises of the total number of
+/// assembly instructions executed for an inferior.
+//----------------------------------------------------------------------
+class TraceOptions : public lldb::SBTraceOptions {
+public:
+ TraceOptions() : lldb::SBTraceOptions(), m_insn_log_size(0) {}
+
+ ~TraceOptions() {}
+
+ //------------------------------------------------------------------
+ /// Get total number of assembly instructions obtained after decoding the
+ /// complete Intel(R) Processor Trace data obtained from LLDB.
+ ///
+ /// @return
+ /// Total number of instructions.
+ //------------------------------------------------------------------
+ uint32_t getInstructionLogSize() const { return m_insn_log_size; }
+
+ //------------------------------------------------------------------
+ /// Set total number of assembly instructions.
+ ///
+ /// @param[in] size
+ /// Value to be set.
+ //------------------------------------------------------------------
+ void setInstructionLogSize(uint32_t size) { m_insn_log_size = size; }
+
+private:
+ uint32_t m_insn_log_size;
+};
+
+//----------------------------------------------------------------------
+/// @class Decoder
+/// @brief This class makes use of Intel(R) Processor Trace hardware feature
+/// (implememted inside LLDB) to gather trace data for an inferior (being
+/// debugged with LLDB) to provide meaningful information out of it.
+///
+/// Currently the meaningful information comprises of the execution flow
+/// of the inferior (in terms of assembly instructions executed). The class
+/// enables user to:
+/// - start the trace with configuration options for a thread/process,
+/// - stop the trace for a thread/process,
+/// - get the execution flow (assembly instructions) for a thread and
+/// - get trace specific information for a thread
+//----------------------------------------------------------------------
+class Decoder {
+public:
+ typedef std::vector<Instruction> Instructions;
+
+ Decoder(lldb::SBDebugger &sbdebugger)
+ : m_mapProcessUID_mapThreadID_TraceInfo_mutex(),
+ m_mapProcessUID_mapThreadID_TraceInfo(),
+ m_debugger_user_id(sbdebugger.GetID()) {}
+
+ ~Decoder() {}
+
+ void StartProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBTraceOptions &sbtraceoptions,
+ lldb::SBError &sberror);
+
+ void StopProcessorTrace(lldb::SBProcess &sbprocess, lldb::SBError &sberror,
+ lldb::tid_t tid = LLDB_INVALID_THREAD_ID);
+
+ void GetInstructionLogAtOffset(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ uint32_t offset, uint32_t count,
+ InstructionList &result_list,
+ lldb::SBError &sberror);
+
+ void GetProcessorTraceInfo(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ TraceOptions &traceinfo, lldb::SBError &sberror);
+
+private:
+ class ThreadTraceInfo;
+ typedef std::vector<uint8_t> Buffer;
+
+ // internal class to manage inferior's read-execute section information
+ class ReadExecuteSectionInfo {
+ public:
+ uint64_t load_address;
+ uint64_t file_offset;
+ uint64_t size;
+ std::string image_path;
+
+ ReadExecuteSectionInfo(const uint64_t addr, const uint64_t offset,
+ const uint64_t sz, const std::string &path)
+ : load_address(addr), file_offset(offset), size(sz), image_path(path) {}
+
+ ReadExecuteSectionInfo(const ReadExecuteSectionInfo &rxsection) = default;
+ };
+
+ typedef struct pt_cpu CPUInfo;
+ typedef std::vector<ReadExecuteSectionInfo> ReadExecuteSectionInfos;
+
+ // Check whether the provided SBProcess belongs to the same SBDebugger with
+ // which Decoder class instance was constructed.
+ void CheckDebuggerID(lldb::SBProcess &sbprocess, lldb::SBError &sberror);
+
+ // Function to remove entries of finished processes/threads in the class
+ void RemoveDeadProcessesAndThreads(lldb::SBProcess &sbprocess);
+
+ // Parse cpu information from trace configuration received from LLDB
+ void ParseCPUInfo(CPUInfo &pt_cpu, lldb::SBStructuredData &s,
+ lldb::SBError &sberror);
+
+ ///------------------------------------------------------------------------
+ /// Function performs following tasks for a given process and thread:
+ /// - Checks if the given thread is registered in the class or not. If not
+ /// then tries to register it if trace was ever started on the entire
+ /// process. Else returns error.
+ /// - fetches trace and other necessary information from LLDB (using
+ /// ReadTraceDataAndImageInfo()) and decodes the trace (using
+ /// DecodeProcessorTrace())
+ ///------------------------------------------------------------------------
+ void FetchAndDecode(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ lldb::SBError &sberror,
+ ThreadTraceInfo **threadTraceInfo);
+
+ // Helper function of FetchAndDecode() to get raw trace data and memory image
+ // info of inferior from LLDB
+ void ReadTraceDataAndImageInfo(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ lldb::SBError &sberror,
+ ThreadTraceInfo &threadTraceInfo);
+
+ // Helper function of FetchAndDecode() to initialize raw trace decoder and
+ // start trace decoding
+ void DecodeProcessorTrace(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ lldb::SBError &sberror,
+ ThreadTraceInfo &threadTraceInfo);
+
+ // Helper function of ReadTraceDataAndImageInfo() function for gathering
+ // inferior's memory image info along with all dynamic libraries linked with
+ // it
+ void GetTargetModulesInfo(lldb::SBTarget &sbtarget,
+ ReadExecuteSectionInfos &readExecuteSectionInfos,
+ lldb::SBError &sberror);
+
+ ///------------------------------------------------------------------------
+ /// Helper functions of DecodeProcessorTrace() function for:
+ /// - initializing raw trace decoder (provided by Intel(R) Processor Trace
+ /// Decoding library)
+ /// - start trace decoding
+ ///------------------------------------------------------------------------
+ void InitializePTInstDecoder(
+ struct pt_insn_decoder **decoder, struct pt_config *config,
+ const CPUInfo &pt_cpu, Buffer &pt_buffer,
+ const ReadExecuteSectionInfos &readExecuteSectionInfos,
+ lldb::SBError &sberror) const;
+ void DecodeTrace(struct pt_insn_decoder *decoder,
+ Instructions &instruction_list, lldb::SBError &sberror);
+
+ // Function to diagnose and indicate errors during raw trace decoding
+ void Diagnose(struct pt_insn_decoder *decoder, int errcode,
+ lldb::SBError &sberror, const struct pt_insn *insn = nullptr);
+
+ class ThreadTraceInfo {
+ public:
+ ThreadTraceInfo()
+ : m_pt_buffer(), m_readExecuteSectionInfos(), m_thread_stop_id(0),
+ m_trace(), m_pt_cpu(), m_instruction_log() {}
+
+ ThreadTraceInfo(const ThreadTraceInfo &trace_info) = default;
+
+ ~ThreadTraceInfo() {}
+
+ Buffer &GetPTBuffer() { return m_pt_buffer; }
+
+ void AllocatePTBuffer(uint64_t size) { m_pt_buffer.assign(size, 0); }
+
+ ReadExecuteSectionInfos &GetReadExecuteSectionInfos() {
+ return m_readExecuteSectionInfos;
+ }
+
+ CPUInfo &GetCPUInfo() { return m_pt_cpu; }
+
+ Instructions &GetInstructionLog() { return m_instruction_log; }
+
+ uint32_t GetStopID() const { return m_thread_stop_id; }
+
+ void SetStopID(uint32_t stop_id) { m_thread_stop_id = stop_id; }
+
+ lldb::SBTrace &GetUniqueTraceInstance() { return m_trace; }
+
+ void SetUniqueTraceInstance(lldb::SBTrace &trace) { m_trace = trace; }
+
+ friend class Decoder;
+
+ private:
+ Buffer m_pt_buffer; // raw trace buffer
+ ReadExecuteSectionInfos
+ m_readExecuteSectionInfos; // inferior's memory image info
+ uint32_t m_thread_stop_id; // stop id for thread
+ lldb::SBTrace m_trace; // unique tracing instance of a thread/process
+ CPUInfo m_pt_cpu; // cpu info of the target on which inferior is running
+ Instructions m_instruction_log; // complete instruction log
+ };
+
+ typedef std::map<lldb::user_id_t, ThreadTraceInfo> MapThreadID_TraceInfo;
+ typedef std::map<uint32_t, MapThreadID_TraceInfo>
+ MapProcessUID_MapThreadID_TraceInfo;
+
+ std::mutex m_mapProcessUID_mapThreadID_TraceInfo_mutex;
+ MapProcessUID_MapThreadID_TraceInfo
+ m_mapProcessUID_mapThreadID_TraceInfo; // to store trace information for
+ // each process and its associated
+ // threads
+ lldb::user_id_t m_debugger_user_id; // SBDebugger instance which is associated
+ // to this Decoder instance
+};
+
+} // namespace ptdecoder_private
+#endif // Decoder_h_
diff --git a/tools/intel-features/intel-pt/PTDecoder.cpp b/tools/intel-features/intel-pt/PTDecoder.cpp
new file mode 100644
index 000000000000..4f3554e84d3c
--- /dev/null
+++ b/tools/intel-features/intel-pt/PTDecoder.cpp
@@ -0,0 +1,175 @@
+//===-- PTDecoder.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Project includes
+#include "PTDecoder.h"
+#include "Decoder.h"
+
+using namespace ptdecoder;
+using namespace ptdecoder_private;
+
+// PTInstruction class member functions definitions
+PTInstruction::PTInstruction() : m_opaque_sp() {}
+
+PTInstruction::PTInstruction(const PTInstruction &insn)
+ : m_opaque_sp(insn.m_opaque_sp) {}
+
+PTInstruction::PTInstruction(
+ const std::shared_ptr<ptdecoder_private::Instruction> &ptr)
+ : m_opaque_sp(ptr) {}
+
+PTInstruction::~PTInstruction() {}
+
+uint64_t PTInstruction::GetInsnAddress() const {
+ return (m_opaque_sp ? m_opaque_sp->GetInsnAddress() : 0);
+}
+
+size_t PTInstruction::GetRawBytes(void *buf, size_t size) const {
+ return (m_opaque_sp ? m_opaque_sp->GetRawBytes(buf, size) : 0);
+}
+
+std::string PTInstruction::GetError() const {
+ return (m_opaque_sp ? m_opaque_sp->GetError() : "null pointer");
+}
+
+bool PTInstruction::GetSpeculative() const {
+ return (m_opaque_sp ? m_opaque_sp->GetSpeculative() : 0);
+}
+
+// PTInstructionList class member functions definitions
+PTInstructionList::PTInstructionList() : m_opaque_sp() {}
+
+PTInstructionList::PTInstructionList(const PTInstructionList &insn_list)
+ : m_opaque_sp(insn_list.m_opaque_sp) {}
+
+PTInstructionList::~PTInstructionList() {}
+
+size_t PTInstructionList::GetSize() const {
+ return (m_opaque_sp ? m_opaque_sp->GetSize() : 0);
+}
+
+PTInstruction PTInstructionList::GetInstructionAtIndex(uint32_t idx) {
+ if (m_opaque_sp)
+ return PTInstruction(std::shared_ptr<ptdecoder_private::Instruction>(
+ new Instruction(m_opaque_sp->GetInstructionAtIndex(idx))));
+
+ return PTInstruction(std::shared_ptr<ptdecoder_private::Instruction>(
+ new Instruction("invalid instruction")));
+}
+
+void PTInstructionList::SetSP(
+ const std::shared_ptr<ptdecoder_private::InstructionList> &ptr) {
+ m_opaque_sp = ptr;
+}
+void PTInstructionList::Clear() {
+ if (!m_opaque_sp)
+ return;
+ m_opaque_sp.reset();
+}
+
+// PTTraceOptions class member functions definitions
+PTTraceOptions::PTTraceOptions() : m_opaque_sp() {}
+
+PTTraceOptions::PTTraceOptions(const PTTraceOptions &options)
+ : m_opaque_sp(options.m_opaque_sp) {}
+
+PTTraceOptions::~PTTraceOptions() {}
+
+lldb::TraceType PTTraceOptions::GetType() const {
+ return (m_opaque_sp ? m_opaque_sp->getType()
+ : lldb::TraceType::eTraceTypeNone);
+}
+
+uint64_t PTTraceOptions::GetTraceBufferSize() const {
+ return (m_opaque_sp ? m_opaque_sp->getTraceBufferSize() : 0);
+}
+
+uint64_t PTTraceOptions::GetMetaDataBufferSize() const {
+ return (m_opaque_sp ? m_opaque_sp->getMetaDataBufferSize() : 0);
+}
+
+lldb::SBStructuredData PTTraceOptions::GetTraceParams(lldb::SBError &error) {
+ if (!m_opaque_sp)
+ error.SetErrorString("null pointer");
+ return (m_opaque_sp ? m_opaque_sp->getTraceParams(error)
+ : lldb::SBStructuredData());
+}
+
+void PTTraceOptions::SetSP(
+ const std::shared_ptr<ptdecoder_private::TraceOptions> &ptr) {
+ m_opaque_sp = ptr;
+}
+
+// PTDecoder class member functions definitions
+PTDecoder::PTDecoder(lldb::SBDebugger &sbdebugger)
+ : m_opaque_sp(new ptdecoder_private::Decoder(sbdebugger)) {}
+
+PTDecoder::PTDecoder(const PTDecoder &ptdecoder)
+ : m_opaque_sp(ptdecoder.m_opaque_sp) {}
+
+PTDecoder::~PTDecoder() {}
+
+void PTDecoder::StartProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBTraceOptions &sbtraceoptions,
+ lldb::SBError &sberror) {
+ if (m_opaque_sp == nullptr) {
+ sberror.SetErrorStringWithFormat("invalid PTDecoder instance");
+ return;
+ }
+
+ m_opaque_sp->StartProcessorTrace(sbprocess, sbtraceoptions, sberror);
+}
+
+void PTDecoder::StopProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBError &sberror, lldb::tid_t tid) {
+ if (m_opaque_sp == nullptr) {
+ sberror.SetErrorStringWithFormat("invalid PTDecoder instance");
+ return;
+ }
+
+ m_opaque_sp->StopProcessorTrace(sbprocess, sberror, tid);
+}
+
+void PTDecoder::GetInstructionLogAtOffset(lldb::SBProcess &sbprocess,
+ lldb::tid_t tid, uint32_t offset,
+ uint32_t count,
+ PTInstructionList &result_list,
+ lldb::SBError &sberror) {
+ if (m_opaque_sp == nullptr) {
+ sberror.SetErrorStringWithFormat("invalid PTDecoder instance");
+ return;
+ }
+
+ std::shared_ptr<ptdecoder_private::InstructionList> insn_list_ptr(
+ new InstructionList());
+ m_opaque_sp->GetInstructionLogAtOffset(sbprocess, tid, offset, count,
+ *insn_list_ptr, sberror);
+ if (!sberror.Success())
+ return;
+
+ result_list.SetSP(insn_list_ptr);
+}
+
+void PTDecoder::GetProcessorTraceInfo(lldb::SBProcess &sbprocess,
+ lldb::tid_t tid, PTTraceOptions &options,
+ lldb::SBError &sberror) {
+ if (m_opaque_sp == nullptr) {
+ sberror.SetErrorStringWithFormat("invalid PTDecoder instance");
+ return;
+ }
+
+ std::shared_ptr<ptdecoder_private::TraceOptions> trace_options_ptr(
+ new TraceOptions());
+ m_opaque_sp->GetProcessorTraceInfo(sbprocess, tid, *trace_options_ptr,
+ sberror);
+ if (!sberror.Success())
+ return;
+
+ options.SetSP(trace_options_ptr);
+}
diff --git a/tools/intel-features/intel-pt/PTDecoder.h b/tools/intel-features/intel-pt/PTDecoder.h
new file mode 100644
index 000000000000..9eb92745a863
--- /dev/null
+++ b/tools/intel-features/intel-pt/PTDecoder.h
@@ -0,0 +1,310 @@
+//===-- PTDecoder.h ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef PTDecoder_h_
+#define PTDecoder_h_
+
+// C/C++ Includes
+#include <vector>
+
+// Project includes, Other libraries and framework includes
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBTraceOptions.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+
+namespace ptdecoder_private {
+class Instruction;
+class InstructionList;
+class TraceOptions;
+class Decoder;
+} // namespace ptdecoder_private
+
+namespace ptdecoder {
+
+//----------------------------------------------------------------------
+/// @class PTInstruction
+/// @brief Represents an assembly instruction containing raw
+/// instruction bytes, instruction address along with information
+/// regarding execution flow context and Intel(R) Processor Trace
+/// context.
+//----------------------------------------------------------------------
+class PTInstruction {
+public:
+ PTInstruction();
+
+ PTInstruction(const PTInstruction &insn);
+
+ PTInstruction(const std::shared_ptr<ptdecoder_private::Instruction> &ptr);
+
+ ~PTInstruction();
+
+ // Get instruction address in inferior's memory image
+ uint64_t GetInsnAddress() const;
+
+ //------------------------------------------------------------------
+ /// Get raw bytes of the instruction in the buffer.
+ ///
+ /// @param[out] buf
+ /// The buffer where the raw bytes will be written. This buffer should be
+ /// allocated by the caller of this API. Providing an unallocated buffer
+ /// is an error. In case of errors, the content of the buffer is not
+ /// valid.
+ ///
+ /// @param[in] size
+ /// Number of raw bytes to be written to @buf. Atleast @size bytes of
+ /// memory should be allocated to @buf otherwise the behaviour of the API
+ /// is undefined. Providing 0 for this argument is an error.
+ ///
+ /// @return
+ /// Number of bytes of the instruction actually written to @buf if API
+ /// succeeds. In case of errors, total number of raw bytes of the
+ /// instruction is returned.
+ //------------------------------------------------------------------
+ size_t GetRawBytes(void *buf, size_t size) const;
+
+ // Get error string if it represents an invalid instruction. For a valid
+ // instruction, an empty string is returned
+ std::string GetError() const;
+
+ // Instruction was executed speculatively or not
+ bool GetSpeculative() const;
+
+private:
+ std::shared_ptr<ptdecoder_private::Instruction> m_opaque_sp;
+};
+
+//---------------------------------------------------------------------------
+/// @class PTInstructionList
+/// @brief Represents a list of assembly instructions. Each instruction is of
+/// type PTInstruction.
+//---------------------------------------------------------------------------
+class PTInstructionList {
+public:
+ PTInstructionList();
+
+ PTInstructionList(const PTInstructionList &insn_list);
+
+ ~PTInstructionList();
+
+ // Get number of instructions in the list
+ size_t GetSize() const;
+
+ // Get instruction at index
+ PTInstruction GetInstructionAtIndex(uint32_t idx);
+
+ void Clear();
+
+private:
+ friend class PTDecoder;
+
+ void SetSP(const std::shared_ptr<ptdecoder_private::InstructionList> &ptr);
+
+ std::shared_ptr<ptdecoder_private::InstructionList> m_opaque_sp;
+};
+
+//----------------------------------------------------------------------
+/// @class PTTraceOptions
+/// @brief Provides configuration options like trace type, trace buffer size,
+/// meta data buffer size along with other Intel(R) Processor Trace
+/// specific options.
+//----------------------------------------------------------------------
+class PTTraceOptions {
+public:
+ PTTraceOptions();
+
+ PTTraceOptions(const PTTraceOptions &options);
+
+ ~PTTraceOptions();
+
+ lldb::TraceType GetType() const;
+
+ uint64_t GetTraceBufferSize() const;
+
+ uint64_t GetMetaDataBufferSize() const;
+
+ //------------------------------------------------------------------
+ /// Get Intel(R) Processor Trace specific configuration options (apart from
+ /// trace buffer size, meta data buffer size and TraceType) formatted as json
+ /// text i.e. {"Name":Value,"Name":Value} pairs, where "Value" is a 64-bit
+ /// unsigned integer in hex format. For "Name", please refer to
+ /// SBProcess::StartTrace API description for setting SBTraceOptions.
+ ///
+ /// @return
+ /// A string formatted as json text {"Name":Value,"Name":Value}
+ //------------------------------------------------------------------
+ lldb::SBStructuredData GetTraceParams(lldb::SBError &error);
+
+private:
+ friend class PTDecoder;
+
+ void SetSP(const std::shared_ptr<ptdecoder_private::TraceOptions> &ptr);
+
+ std::shared_ptr<ptdecoder_private::TraceOptions> m_opaque_sp;
+};
+
+//----------------------------------------------------------------------
+/// @class PTDecoder
+/// @brief This class makes use of Intel(R) Processor Trace hardware feature
+/// (implememted inside LLDB) to gather trace data for an inferior (being
+/// debugged with LLDB) to provide meaningful information out of it.
+///
+/// Currently the meaningful information comprises of the execution flow
+/// of the inferior (in terms of assembly instructions executed). The class
+/// enables user to:
+/// - start the trace with configuration options for a thread/process,
+/// - stop the trace for a thread/process,
+/// - get the execution flow (assembly instructions) for a thread and
+/// - get trace specific information for a thread
+//----------------------------------------------------------------------
+class PTDecoder {
+public:
+ PTDecoder(lldb::SBDebugger &sbdebugger);
+
+ PTDecoder(const PTDecoder &ptdecoder);
+
+ ~PTDecoder();
+
+ //------------------------------------------------------------------
+ /// Start Intel(R) Processor Trace on a thread or complete process with
+ /// Intel(R) Processor Trace specific configuration options
+ ///
+ /// @param[in] sbprocess
+ /// A valid process on which this operation will be performed. An error is
+ /// returned in case of an invalid process.
+ ///
+ /// @param[in] sbtraceoptions
+ /// Contains thread id information and configuration options:
+ ///
+ /// For tracing a single thread, provide a valid thread id. If sbprocess
+ /// doesn't contain this thread id, error will be returned. For tracing
+ /// complete process, set it to lldb::LLDB_INVALID_THREAD_ID
+ /// Configuration options comprises of:
+ /// a) trace buffer size, meta data buffer size, TraceType and
+ /// b) All other possible Intel(R) Processor Trace specific configuration
+ /// options (hereafter collectively referred as CUSTOM_OPTIONS), formatted
+ /// as json text i.e. {"Name":Value,"Name":Value,..} inside
+ /// sbtraceoptions, where "Value" should be a 64-bit unsigned integer in
+ /// hex format. For information regarding what all configuration options
+ /// are currently supported by LLDB and detailed information about
+ /// CUSTOM_OPTIONS usage, please refer to SBProcess::StartTrace() API
+ /// description. To know about all possible configuration options of
+ /// Intel(R) Processor Trace, please refer to Intel(R) 64 and IA-32
+ /// Architectures Software Developer's Manual.
+ ///
+ /// TraceType should be set to lldb::TraceType::eTraceTypeProcessorTrace,
+ /// else error is returned. To find out any other requirement to start
+ /// tracing successfully, please refer to SBProcess::StartTrace() API
+ /// description. LLDB's current implementation of Intel(R) Processor Trace
+ /// feature may round off invalid values for configuration options.
+ /// Therefore, the configuration options with which the trace was actually
+ /// started, might be different to the ones with which trace was asked to
+ /// be started by user. The actual used configuration options can be
+ /// obtained from GetProcessorTraceInfo() API.
+ ///
+ /// @param[out] sberror
+ /// An error with the failure reason if API fails. Else success.
+ //------------------------------------------------------------------
+ void StartProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBTraceOptions &sbtraceoptions,
+ lldb::SBError &sberror);
+
+ //------------------------------------------------------------------
+ /// Stop Intel(R) Processor Trace on a thread or complete process.
+ ///
+ /// @param[in] sbprocess
+ /// A valid process on which this operation will be performed. An error is
+ /// returned in case of an invalid process.
+ ///
+ /// @param[in] tid
+ /// Case 1: To stop tracing a single thread, provide a valid thread id. If
+ /// sbprocess doesn't contain the thread tid, error will be returned.
+ /// Case 2: To stop tracing complete process, use
+ /// lldb::LLDB_INVALID_THREAD_ID.
+ ///
+ /// @param[out] sberror
+ /// An error with the failure reason if API fails. Else success.
+ //------------------------------------------------------------------
+ void StopProcessorTrace(lldb::SBProcess &sbprocess, lldb::SBError &sberror,
+ lldb::tid_t tid = LLDB_INVALID_THREAD_ID);
+
+ //------------------------------------------------------------------
+ /// Get instruction log containing the execution flow for a thread of a
+ /// process in terms of assembly instructions executed.
+ ///
+ /// @param[in] sbprocess
+ /// A valid process on which this operation will be performed. An error is
+ /// returned in case of an invalid process.
+ ///
+ /// @param[in] tid
+ /// A valid thread id of the thread for which instruction log is desired.
+ /// If sbprocess doesn't contain the thread tid, error will be returned.
+ ///
+ /// @param[in] count
+ /// The number of instructions requested by the user to be returned from
+ /// the complete instruction log. Complete instruction log refers to all
+ /// the assembly instructions obtained after decoding the complete raw
+ /// trace data obtained from LLDB. The length of the complete instruction
+ /// log is dependent on the trace buffer size with which processor tracing
+ /// was started for this thread.
+ /// The number of instructions actually returned are dependent on 'count'
+ /// and 'offset' parameters of this API.
+ ///
+ /// @param[in] offset
+ /// The offset in the complete instruction log from where 'count' number
+ /// of instructions are requested by the user. offset is counted from the
+ /// end of of this complete instruction log (which means the last executed
+ /// instruction is at offset 0 (zero)).
+ ///
+ /// @param[out] result_list
+ /// Depending upon 'count' and 'offset' values, list will be overwritten
+ /// with the new instructions.
+ ///
+ /// @param[out] sberror
+ /// An error with the failure reason if API fails. Else success.
+ //------------------------------------------------------------------
+ void GetInstructionLogAtOffset(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ uint32_t offset, uint32_t count,
+ PTInstructionList &result_list,
+ lldb::SBError &sberror);
+
+ //------------------------------------------------------------------
+ /// Get Intel(R) Processor Trace specific information for a thread of a
+ /// process. The information contains the actual configuration options with
+ /// which the trace was started for this thread.
+ ///
+ /// @param[in] sbprocess
+ /// A valid process on which this operation will be performed. An error is
+ /// returned in case of an invalid process.
+ ///
+ /// @param[in] tid
+ /// A valid thread id of the thread for which the trace specific
+ /// information is required. If sbprocess doesn't contain the thread tid,
+ /// an error will be returned.
+ ///
+ /// @param[out] options
+ /// Contains actual configuration options (they may be different to the
+ /// ones with which tracing was asked to be started for this thread during
+ /// StartProcessorTrace() API call).
+ ///
+ /// @param[out] sberror
+ /// An error with the failure reason if API fails. Else success.
+ //------------------------------------------------------------------
+ void GetProcessorTraceInfo(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ PTTraceOptions &options, lldb::SBError &sberror);
+
+private:
+ std::shared_ptr<ptdecoder_private::Decoder> m_opaque_sp;
+};
+
+} // namespace ptdecoder
+#endif // PTDecoder_h_
diff --git a/tools/intel-features/intel-pt/README_CLI.txt b/tools/intel-features/intel-pt/README_CLI.txt
new file mode 100644
index 000000000000..2a497c4b3ef1
--- /dev/null
+++ b/tools/intel-features/intel-pt/README_CLI.txt
@@ -0,0 +1,123 @@
+****************************************************************************
+* README *
+* *
+* This file provides all the information regarding 4 new CLI commands that *
+* enable using Intel(R) Processor Trace Tool from LLDB's CLI. *
+****************************************************************************
+
+
+============
+Introduction
+============
+A C++ based cli wrapper has been developed to use Intel(R) Processor Trace Tool
+through LLDB's command line. This also provides an idea to all developers on how
+to integrate the Tool into various IDEs providing LLDB as a debugger.
+
+
+
+============
+How to Build
+============
+The wrapper cli-wrapper-pt.cpp needs to be compiled and linked with the shared
+library of the Intel(R) Processor Trace Tool in order to be used through LLDB's
+CLI. The procedure to build shared library of the Intel(R) Processor Trace Tool
+is given in README_TOOL.txt file.
+
+
+
+============
+How to Use
+============
+All these commands are available via shared library (lldbIntelFeatures)
+obtained after building intel-features folder from top. Please refer to
+cli-wrapper.cpp and README files of "intel-features" folder for this purpose.
+
+
+
+============
+Description
+============
+4 CLI commands have been designed keeping the LLDB's existing CLI command syntax
+in mind.
+
+ 1) processor-trace start [-b <buffer-size>] [<thread-index>]
+
+ Start Intel(R) Processor Trace on a specific thread or on the whole process
+
+ Syntax: processor-trace start <cmd-options>
+
+ cmd-options Usage:
+ processor-trace start [-b <buffer-size>] [<thread-index>]
+
+ -b <buffer-size>
+ size of the trace buffer to store the trace data. If not specified
+ then a default value (=4KB) will be taken
+
+ <thread-index>
+ thread index of the thread. If no threads are specified, currently
+ selected thread is taken. Use the thread-index 'all' to start
+ tracing the whole process
+
+
+
+ 2) processor-trace stop [<thread-index>]
+
+ Stop Intel(R) Processor Trace on a specific thread or on the whole process
+
+ Syntax: processor-trace stop <cmd-options>
+
+ cmd-options Usage:
+ processor-trace stop [<thread-index>]
+
+ <thread-index>
+ thread index of the thread. If no threads are specified, currently
+ selected thread is taken. Use the thread-index 'all' to stop
+ tracing the whole process
+
+
+
+ 3) processor-trace show-trace-options [<thread-index>]
+
+ Display all the information regarding Intel(R) Processor Trace for a specific
+ thread or for the whole process. The information contains trace buffer
+ size and configuration options of Intel(R) Processor Trace.
+
+ Syntax: processor-trace show-trace-options <cmd-options>
+
+ cmd-options Usage:
+ processor-trace show-trace-options [<thread-index>]
+
+ <thread-index>
+ thread index of the thread. If no threads are specified, currently
+ selected thread is taken. Use the thread-index 'all' to display
+ information for all threads of the process
+
+
+
+ 4) processor-trace show-instr-log [-o <offset>] [-c <count>] [<thread-index>]
+
+ Display a log of assembly instructions executed for a specific thread or
+ for the whole process. The length of the log to be displayed and the
+ offset in the whole instruction log from where the log needs to be
+ displayed can also be provided. The offset is counted from the end of this
+ whole instruction log which means the last executed instruction is at
+ offset 0 (zero).
+
+ Syntax: processor-trace show-instr-log <cmd-options>
+
+ cmd-options Usage:
+ processor-trace show-instr-log [-o <offset>] [-c <count>] [<thread-index>]
+
+ -c <count>
+ number of instructions to be displayed. If not specified then a
+ default value (=10) will be taken
+
+ -o <offset>
+ offset in the whole instruction log from where the log will be
+ displayed. If not specified then default value is calculated as
+ offset = count -1
+
+ <thread-index>
+ thread index of the thread. If no threads are specified, currently
+ selected thread is taken. Use the thread-index 'all' to show
+ instruction log for all the threads of the process
diff --git a/tools/intel-features/intel-pt/README_TOOL.txt b/tools/intel-features/intel-pt/README_TOOL.txt
new file mode 100644
index 000000000000..d1ec1caf73ca
--- /dev/null
+++ b/tools/intel-features/intel-pt/README_TOOL.txt
@@ -0,0 +1,311 @@
+*******************************************************************************
+* README *
+* *
+* This file provides all the information regarding Intel(R) Processor Trace *
+* Tool. It consists explanation about how Tool internally works, its hardware *
+* and software dependencies, build procedure and usage of the API. *
+*******************************************************************************
+
+
+
+============
+Introduction
+============
+The Intel(R) Processor Trace Tool is developed on top of LLDB and provides its
+its users execution trace of the debugged applications. Tool makes use of
+Intel(R) Processor Trace hardware feature implementation inside LLDB for this
+purpose. This hardware feature generates a set of trace packets that
+encapsulates program flow information. These trace packets along with the binary
+of the application can be decoded with the help of a software decoder to
+construct the execution trace of the application.
+
+More information about Intel(R) Processor Trace feature can be obtained from
+website: https://software.intel.com/en-us/blogs/2013/09/18/processor-tracing
+
+
+
+
+=========
+Details
+=========
+The functionality of the Tool consists three parts:
+
+1. Raw Trace Collection from LLDB
+ With the help of API of this Tool (given below), Intel(R) Processor Trace
+ can be started on the application being debugged with LLDB. The generated
+ trace of the application is gathered inside LLDB and is collected by the
+ Tool from LLDB through LLDB's public API.
+
+2. Raw Trace Decoding
+ For decoding the raw trace data, the Tool makes use of "libipt", an
+ Intel(R) Processor Trace Decoder Library. The library needs binary of
+ the application and information about the cpu on which the application is
+ running in order to decode the raw trace. The Tool gathers this
+ information from LLDB public API and provide it to "libipt". More
+ information about "libipt" can be found at:
+ https://software.intel.com/en-us/blogs/2013/09/18/processor-tracing and
+ https://github.com/01org/processor-trace
+
+3. Decoded Trace Post-processing
+ The decoded trace is post-processed to reconstruct the execution flow of
+ the application. The execution flow contains the list of assembly
+ instructions (called instruction log hereafter).
+
+
+
+
+=============
+Dependencies
+=============
+The Tool has following hardware and software dependencies:
+
+ - Hardware dependency: The Tool makes use of this hardware feature to capture
+ raw trace of an application from LLDB. This hardware feature may not be
+ present in all processors. The hardware feature is supported on Broadwell
+ and other succeeding CPUs such as Skylake etc. In order for Tool to provide
+ something meaningful, the target machine on which the application is running
+ should have this feature.
+
+ - Software dependency: The Tool has an indirect dependency on the Operating
+ System level software support for Intel(R) Processor Trace on the target
+ machine where the application is running and being debugged by LLDB. This
+ support is required to enable raw trace generation on the target machine.
+ Currently, the Tool works for applications running on Linux OS as till now
+ the Operating System level support for the feature is present only in Linux
+ (more specifically starting from the 4.1 kernel). In Linux, this feature is
+ implemented in perf_events subsystem and is usable through perf_event_open
+ system call. In the User space level, the Tool has a direct dependency on
+ "libipt" to decode the captured raw trace. This library might be
+ pre-installed on host systems. If not then the library can be built from
+ its sources (available at): https://github.com/01org/processor-trace
+
+
+
+
+============
+How to Build
+============
+The Tool has a cmake based build and can be built by specifying some extra flags
+while building LLDB with cmake. The following cmake flags need to be provided to
+build the Tool:
+
+ - LIBIPT_INCLUDE_PATH - The flag specifies the directory where the header
+ file of "libipt" resides. If the library is not pre-installed on the host
+ system and is built directly from "libipt" project sources then this file
+ may either come as a part of the sources itself or will be generated in
+ build folder while building library.
+
+ - LIBIPT_LIBRARY_PATH - The flag points to the location of "libipt" shared
+ library.
+
+The Tool currently works successfully with following versions of this library:
+ - v1.4, v1.5, v1.6
+
+
+
+============
+How to Use
+============
+The Tool's API are exposed as a C++ object oriented interface (file PTDecoder.h)
+in a shared library. The main class that implements the whole functionality is
+PTDecoder. This class makes use of 3 other classes,
+ - PTInstruction to represent an assembly instruction
+ - PTInstructionList to return instruction log
+ - PTTraceOptions to return trace specific information
+The users can use these API to develop their own products. All API are also
+available as python functions through a script bridging interface, allowing
+them to be used directly from python either interactively or to build python
+apps.
+
+Currently, cli wrapper has been developed on top of the Tool to use it through
+LLDB's command line. Please refer to README_CLI.txt file for command line usage.
+
+
+A brief introduction about the classes and their API are given below.
+
+ class PTDecoder
+ ===============
+ This class makes use of Intel(R) Processor Trace hardware feature
+ (implemented inside LLDB) to gather trace data for an inferior (being
+ debugged with LLDB) to provide meaningful information out of it. Currently
+ the meaningful information comprises of the execution flow of the inferior
+ (in terms of assembly instructions executed). The class enables user to:
+
+ - start the trace with configuration options for a thread/process,
+ - stop the trace for a thread/process,
+ - get the execution flow (assembly instructions) for a thread and
+ - get trace specific information for a thread
+
+ Corresponding API are explained below:
+ a) void StartProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBTraceOptions &sbtraceoptions,
+ lldb::SBError &sberror)
+ ------------------------------------------------------------------------
+ This API allows the user to start trace on a particular thread or on
+ the whole process with Intel(R) Processor Trace specific
+ configuration options.
+
+ @param[in] sbprocess : A valid process on which this operation
+ will be performed. An error is returned in case of an invalid
+ process.
+
+ @param[out] sberror : An error with the failure reason if API
+ fails. Else success.
+
+ @param[in] sbtraceoptions : Contains thread id information and
+ configuration options:
+ For tracing a single thread, provide a valid thread id. If
+ sbprocess doesn't contain this thread id, error will be returned.
+ For tracing complete process, set to lldb::LLDB_INVALID_THREAD_ID
+ Configuration options comprises of:
+ - trace buffer size, meta data buffer size, TraceType and
+ - All other possible Intel(R) Processor Trace specific
+ configuration options (hereafter collectively referred as
+ CUSTOM_OPTIONS)
+
+ Trace buffer, meant to store the trace data read from target
+ machine, inside LLDB is configured as a cyclic buffer. Hence,
+ depending upon the trace buffer size provided here, buffer
+ overwrites may happen while LLDB writes trace data into it.
+ CUSTOM_OPTIONS are formatted as json text i.e. {"Name":Value,
+ "Name":Value,...} inside sbtraceoptions, where "Value" should be
+ a 64-bit unsigned integer in hex format. For information
+ regarding what all configuration options are currently supported
+ by LLDB and detailed information about CUSTOM_OPTIONS usage,
+ please refer to SBProcess::StartTrace() API description. An
+ overview of some of the various CUSTOM_OPTIONS are briefly given
+ below. Please refer to "Intel(R) 64 and IA-32 Architectures
+ Software Developer's Manual" for more details about them.
+ - CYCEn Enable/Disable Cycle Count Packet (CYC) Packet
+ - OS Packet generation enabled/disabled if
+ Current Privilege Level (CPL)=0
+ - User Packet generation enabled/disabled if CPL>0
+ - CR3Filter Enable/Disable CR3 Filtering
+ - MTCEn Enable/disable MTC packets
+ - TSCEn Enable/disable TSC packets
+ - DisRETC Enable/disable RET Compression
+ - BranchEn Enable/disable COFI-based packets
+ - MTCFreq Defines MTC Packet Frequency
+ - CycThresh CYC Packet threshold
+ - PSBFreq Frequency of PSB Packets
+
+ TraceType should be set to
+ lldb::TraceType::eTraceTypeProcessorTrace, else error is
+ returned. To find out any other requirement to start tracing
+ successfully, refer to SBProcess::StartTrace() API description.
+ LLDB's current implementation of Intel(R) Processor Trace
+ feature may round off invalid values for configuration options.
+ Therefore, the configuration options with which the trace was
+ actually started, might be different to the ones with which
+ trace was asked to be started by user. The actual used
+ configuration options can be obtained from
+ GetProcessorTraceInfo() API.
+
+
+
+ b) void StopProcessorTrace(lldb::SBProcess &sbprocess,
+ lldb::SBError &sberror,
+ lldb::tid_t tid = LLDB_INVALID_THREAD_ID)
+ ------------------------------------------------------------------------
+ This API allows the user to Stop trace on a particular thread or on
+ the whole process.
+
+ @param[in] sbprocess : A valid process on which this operation will
+ be performed. An error is returned in case of an invalid process.
+
+ @param[in] tid : To stop tracing a single thread, provide a
+ valid thread id. If sbprocess doesn't contain the thread tid,
+ error will be returned. To stop tracing complete process, use
+ lldb::LLDB_INVALID_THREAD_ID
+
+ @param[out] sberror : An error with the failure reason if API fails.
+ Else success
+
+
+
+ c) void GetInstructionLogAtOffset(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ uint32_t offset, uint32_t count,
+ PTInstructionList &result_list,
+ lldb::SBError &sberror)
+ ------------------------------------------------------------------------
+ This API provides instruction log that contains the execution flow
+ for a thread of a process in terms of assembly instruction executed.
+ The API works on only 1 thread at a time. To gather this information
+ for whole process, this API needs to be called for each thread.
+
+ @param[in] sbprocess : A valid process on which this operation
+ will be performed. An error is returned in case of an invalid
+ process.
+
+ @param[in] tid : A valid thread id of the thread for which
+ instruction log is desired. If sbprocess doesn't contain the
+ thread tid, error will be returned.
+
+ @param[in] count : Number of instructions requested by the
+ user to be returned from the complete instruction log. Complete
+ instruction log refers to all the assembly instructions obtained
+ after decoding the complete raw trace data obtained from LLDB.
+ The length of the complete instruction log is dependent on the
+ trace buffer size with which processor tracing was started for
+ this thread.
+ The number of instructions actually returned are dependent on
+ 'count' and 'offset' parameters of this API.
+
+ @param[in] offset : The offset in the complete instruction log
+ from where 'count' number of instructions are requested by the
+ user. offset is counted from the end of of this complete
+ instruction log (which means the last executed instruction
+ is at offset 0 (zero)).
+
+ @param[out] result_list : Depending upon 'count' and 'offset' values,
+ list will be overwritten with the instructions.
+
+ @param[out] sberror : An error with the failure reason if API
+ fails. Else success
+
+
+
+ d) void GetProcessorTraceInfo(lldb::SBProcess &sbprocess, lldb::tid_t tid,
+ PTTraceOptions &options, lldb::SBError &sberror)
+ ------------------------------------------------------------------------
+ This API provides Intel(R) Processor Trace specific information for
+ a thread of a process. The API works on only 1 thread at a time. To
+ gather this information for whole process, this API needs to be
+ called for each thread. The information contains the actual
+ configuration options with which the trace was started for this
+ thread.
+
+ @param[in] sbprocess : The valid process on which this operation
+ will be performed. An error is returned in case of an invalid
+ process.
+
+ @param[in] tid : A valid thread id of the thread for which the
+ trace specific information is required. If sbprocess doesn't
+ contain the thread tid, an error will be returned.
+
+ @param[out] options : Contains actual configuration options (they
+ may be different to the ones with which tracing was asked to be
+ started for this thread during StartProcessorTrace() API call).
+
+ @param[out] sberror : An error with the failure reason if API
+ fails. Else success
+
+
+ class PTInstruction
+ ===================
+ This class represents an assembly instruction containing raw instruction
+ bytes, instruction address along with execution flow context and
+ Intel(R) Processor Trace context. For more details, please refer to
+ PTDecoder.h file.
+
+ class PTInstructionList
+ =======================
+ This class represents a list of assembly instructions. Each assembly
+ instruction is of type PTInstruction.
+
+ class PTTraceOptions
+ ====================
+ This class provides Intel(R) Processor Trace specific configuration
+ options like trace type, trace buffer size, meta data buffer size along
+ with other trace specific options. For more details, please refer to
+ PTDecoder.h file.
diff --git a/tools/intel-features/intel-pt/cli-wrapper-pt.cpp b/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
new file mode 100644
index 000000000000..1fa236cb0bc7
--- /dev/null
+++ b/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
@@ -0,0 +1,583 @@
+//===-- cli-wrapper-pt.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// CLI Wrapper of PTDecoder Tool to enable it to be used through LLDB's CLI. The
+// wrapper provides a new command called processor-trace with 4 child
+// subcommands as follows:
+// processor-trace start
+// processor-trace stop
+// processor-trace show-trace-options
+// processor-trace show-instr-log
+//
+//===----------------------------------------------------------------------===//
+
+#include <cerrno>
+#include <cinttypes>
+#include <cstring>
+#include <string>
+#include <vector>
+
+#include "PTDecoder.h"
+#include "cli-wrapper-pt.h"
+#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/API/SBThread.h"
+
+static bool GetProcess(lldb::SBDebugger &debugger,
+ lldb::SBCommandReturnObject &result,
+ lldb::SBProcess &process) {
+ if (!debugger.IsValid()) {
+ result.Printf("error: invalid debugger\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+
+ lldb::SBTarget target = debugger.GetSelectedTarget();
+ if (!target.IsValid()) {
+ result.Printf("error: invalid target inside debugger\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+
+ process = target.GetProcess();
+ if (!process.IsValid() ||
+ (process.GetState() == lldb::StateType::eStateDetached) ||
+ (process.GetState() == lldb::StateType::eStateExited) ||
+ (process.GetState() == lldb::StateType::eStateInvalid)) {
+ result.Printf("error: invalid process inside debugger's target\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+
+ return true;
+}
+
+static bool ParseCommandOption(char **command,
+ lldb::SBCommandReturnObject &result,
+ uint32_t &index, const std::string &arg,
+ uint32_t &parsed_result) {
+ char *endptr;
+ if (!command[++index]) {
+ result.Printf("error: option \"%s\" requires an argument\n", arg.c_str());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+
+ errno = 0;
+ unsigned long output = strtoul(command[index], &endptr, 0);
+ if ((errno != 0) || (*endptr != '\0')) {
+ result.Printf("error: invalid value \"%s\" provided for option \"%s\"\n",
+ command[index], arg.c_str());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ if (output > UINT32_MAX) {
+ result.Printf("error: value \"%s\" for option \"%s\" exceeds UINT32_MAX\n",
+ command[index], arg.c_str());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ parsed_result = (uint32_t)output;
+ return true;
+}
+
+static bool ParseCommandArgThread(char **command,
+ lldb::SBCommandReturnObject &result,
+ lldb::SBProcess &process, uint32_t &index,
+ lldb::tid_t &thread_id) {
+ char *endptr;
+ if (!strcmp(command[index], "all"))
+ thread_id = LLDB_INVALID_THREAD_ID;
+ else {
+ uint32_t thread_index_id;
+ errno = 0;
+ unsigned long output = strtoul(command[index], &endptr, 0);
+ if ((errno != 0) || (*endptr != '\0') || (output > UINT32_MAX)) {
+ result.Printf("error: invalid thread specification: \"%s\"\n",
+ command[index]);
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_index_id = (uint32_t)output;
+
+ lldb::SBThread thread = process.GetThreadByIndexID(thread_index_id);
+ if (!thread.IsValid()) {
+ result.Printf(
+ "error: process has no thread with thread specification: \"%s\"\n",
+ command[index]);
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_id = thread.GetThreadID();
+ }
+ return true;
+}
+
+class ProcessorTraceStart : public lldb::SBCommandPluginInterface {
+public:
+ ProcessorTraceStart(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+ : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
+
+ ~ProcessorTraceStart() {}
+
+ virtual bool DoExecute(lldb::SBDebugger debugger, char **command,
+ lldb::SBCommandReturnObject &result) {
+ lldb::SBProcess process;
+ lldb::SBThread thread;
+ if (!GetProcess(debugger, result, process))
+ return false;
+
+ // Default initialize API's arguments
+ lldb::SBTraceOptions lldb_SBTraceOptions;
+ uint32_t trace_buffer_size = m_default_trace_buff_size;
+ lldb::tid_t thread_id;
+
+ // Parse Command line options
+ bool thread_argument_provided = false;
+ if (command) {
+ for (uint32_t i = 0; command[i]; i++) {
+ if (!strcmp(command[i], "-b")) {
+ if (!ParseCommandOption(command, result, i, "-b", trace_buffer_size))
+ return false;
+ } else {
+ thread_argument_provided = true;
+ if (!ParseCommandArgThread(command, result, process, i, thread_id))
+ return false;
+ }
+ }
+ }
+
+ if (!thread_argument_provided) {
+ thread = process.GetSelectedThread();
+ if (!thread.IsValid()) {
+ result.Printf("error: invalid current selected thread\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_id = thread.GetThreadID();
+ }
+
+ if (trace_buffer_size > m_max_trace_buff_size)
+ trace_buffer_size = m_max_trace_buff_size;
+
+ // Set API's arguments with parsed values
+ lldb_SBTraceOptions.setType(lldb::TraceType::eTraceTypeProcessorTrace);
+ lldb_SBTraceOptions.setTraceBufferSize(trace_buffer_size);
+ lldb_SBTraceOptions.setMetaDataBufferSize(0);
+ lldb_SBTraceOptions.setThreadID(thread_id);
+ lldb::SBStream sb_stream;
+ sb_stream.Printf("{\"trace-tech\":\"intel-pt\"}");
+ lldb::SBStructuredData custom_params;
+ lldb::SBError error = custom_params.SetFromJSON(sb_stream);
+ if (!error.Success()) {
+ result.Printf("error: %s\n", error.GetCString());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ lldb_SBTraceOptions.setTraceParams(custom_params);
+
+ // Start trace
+ pt_decoder_sp->StartProcessorTrace(process, lldb_SBTraceOptions, error);
+ if (!error.Success()) {
+ result.Printf("error: %s\n", error.GetCString());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ return true;
+ }
+
+private:
+ std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+ const uint32_t m_max_trace_buff_size = 0x3fff;
+ const uint32_t m_default_trace_buff_size = 4096;
+};
+
+class ProcessorTraceInfo : public lldb::SBCommandPluginInterface {
+public:
+ ProcessorTraceInfo(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+ : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
+
+ ~ProcessorTraceInfo() {}
+
+ virtual bool DoExecute(lldb::SBDebugger debugger, char **command,
+ lldb::SBCommandReturnObject &result) {
+ lldb::SBProcess process;
+ lldb::SBThread thread;
+ if (!GetProcess(debugger, result, process))
+ return false;
+
+ lldb::tid_t thread_id;
+
+ // Parse command line options
+ bool thread_argument_provided = false;
+ if (command) {
+ for (uint32_t i = 0; command[i]; i++) {
+ thread_argument_provided = true;
+ if (!ParseCommandArgThread(command, result, process, i, thread_id))
+ return false;
+ }
+ }
+
+ if (!thread_argument_provided) {
+ thread = process.GetSelectedThread();
+ if (!thread.IsValid()) {
+ result.Printf("error: invalid current selected thread\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_id = thread.GetThreadID();
+ }
+
+ size_t loop_count = 1;
+ bool entire_process_tracing = false;
+ if (thread_id == LLDB_INVALID_THREAD_ID) {
+ entire_process_tracing = true;
+ loop_count = process.GetNumThreads();
+ }
+
+ // Get trace information
+ lldb::SBError error;
+ lldb::SBCommandReturnObject res;
+ for (size_t i = 0; i < loop_count; i++) {
+ error.Clear();
+ res.Clear();
+
+ if (entire_process_tracing)
+ thread = process.GetThreadAtIndex(i);
+ else
+ thread = process.GetThreadByID(thread_id);
+ thread_id = thread.GetThreadID();
+
+ ptdecoder::PTTraceOptions options;
+ pt_decoder_sp->GetProcessorTraceInfo(process, thread_id, options, error);
+ if (!error.Success()) {
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
+ thread.GetIndexID(), thread_id, error.GetCString());
+ result.AppendMessage(res.GetOutput());
+ continue;
+ }
+
+ lldb::SBStructuredData data = options.GetTraceParams(error);
+ if (!error.Success()) {
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
+ thread.GetIndexID(), thread_id, error.GetCString());
+ result.AppendMessage(res.GetOutput());
+ continue;
+ }
+
+ lldb::SBStream s;
+ error = data.GetAsJSON(s);
+ if (!error.Success()) {
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
+ thread.GetIndexID(), thread_id, error.GetCString());
+ result.AppendMessage(res.GetOutput());
+ continue;
+ }
+
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64
+ ", trace buffer size=%" PRIu64 ", meta buffer size=%" PRIu64
+ ", trace type=%" PRIu32 ", custom trace params=%s",
+ thread.GetIndexID(), thread_id, options.GetTraceBufferSize(),
+ options.GetMetaDataBufferSize(), options.GetType(),
+ s.GetData());
+ result.AppendMessage(res.GetOutput());
+ }
+ return true;
+ }
+
+private:
+ std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+};
+
+class ProcessorTraceShowInstrLog : public lldb::SBCommandPluginInterface {
+public:
+ ProcessorTraceShowInstrLog(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+ : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
+
+ ~ProcessorTraceShowInstrLog() {}
+
+ virtual bool DoExecute(lldb::SBDebugger debugger, char **command,
+ lldb::SBCommandReturnObject &result) {
+ lldb::SBProcess process;
+ lldb::SBThread thread;
+ if (!GetProcess(debugger, result, process))
+ return false;
+
+ // Default initialize API's arguments
+ uint32_t offset;
+ bool offset_provided = false;
+ uint32_t count = m_default_count;
+ lldb::tid_t thread_id;
+
+ // Parse command line options
+ bool thread_argument_provided = false;
+ if (command) {
+ for (uint32_t i = 0; command[i]; i++) {
+ if (!strcmp(command[i], "-o")) {
+ if (!ParseCommandOption(command, result, i, "-o", offset))
+ return false;
+ offset_provided = true;
+ } else if (!strcmp(command[i], "-c")) {
+ if (!ParseCommandOption(command, result, i, "-c", count))
+ return false;
+ } else {
+ thread_argument_provided = true;
+ if (!ParseCommandArgThread(command, result, process, i, thread_id))
+ return false;
+ }
+ }
+ }
+
+ if (!thread_argument_provided) {
+ thread = process.GetSelectedThread();
+ if (!thread.IsValid()) {
+ result.Printf("error: invalid current selected thread\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_id = thread.GetThreadID();
+ }
+
+ size_t loop_count = 1;
+ bool entire_process_tracing = false;
+ if (thread_id == LLDB_INVALID_THREAD_ID) {
+ entire_process_tracing = true;
+ loop_count = process.GetNumThreads();
+ }
+
+ // Get instruction log and disassemble it
+ lldb::SBError error;
+ lldb::SBCommandReturnObject res;
+ for (size_t i = 0; i < loop_count; i++) {
+ error.Clear();
+ res.Clear();
+
+ if (entire_process_tracing)
+ thread = process.GetThreadAtIndex(i);
+ else
+ thread = process.GetThreadByID(thread_id);
+ thread_id = thread.GetThreadID();
+
+ // If offset is not provided then calculate a default offset (to display
+ // last 'count' number of instructions)
+ if (!offset_provided)
+ offset = count - 1;
+
+ // Get the instruction log
+ ptdecoder::PTInstructionList insn_list;
+ pt_decoder_sp->GetInstructionLogAtOffset(process, thread_id, offset,
+ count, insn_list, error);
+ if (!error.Success()) {
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
+ thread.GetIndexID(), thread_id, error.GetCString());
+ result.AppendMessage(res.GetOutput());
+ continue;
+ }
+
+ // Disassemble the instruction log
+ std::string disassembler_command("dis -c 1 -s ");
+ res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 "\n", thread.GetIndexID(),
+ thread_id);
+ lldb::SBCommandInterpreter sb_cmnd_interpreter(
+ debugger.GetCommandInterpreter());
+ lldb::SBCommandReturnObject result_obj;
+ for (size_t i = 0; i < insn_list.GetSize(); i++) {
+ ptdecoder::PTInstruction insn = insn_list.GetInstructionAtIndex(i);
+ uint64_t addr = insn.GetInsnAddress();
+ std::string error = insn.GetError();
+ if (!error.empty()) {
+ res.AppendMessage(error.c_str());
+ continue;
+ }
+
+ result_obj.Clear();
+ std::string complete_disassembler_command =
+ disassembler_command + std::to_string(addr);
+ sb_cmnd_interpreter.HandleCommand(complete_disassembler_command.c_str(),
+ result_obj, false);
+ std::string result_str(result_obj.GetOutput());
+ if (result_str.empty()) {
+ lldb::SBCommandReturnObject output;
+ output.Printf(" Disassembly not found for address: %" PRIu64, addr);
+ res.AppendMessage(output.GetOutput());
+ continue;
+ }
+
+ // LLDB's disassemble command displays assembly instructions along with
+ // the names of the functions they belong to. Parse this result to
+ // display only the assembly instructions and not the function names
+ // in an instruction log
+ std::size_t first_new_line_index = result_str.find_first_of('\n');
+ std::size_t last_new_line_index = result_str.find_last_of('\n');
+ if (first_new_line_index != last_new_line_index)
+ res.AppendMessage((result_str.substr(first_new_line_index + 1,
+ last_new_line_index -
+ first_new_line_index - 1))
+ .c_str());
+ else
+ res.AppendMessage(
+ (result_str.substr(0, result_str.length() - 1)).c_str());
+ }
+ result.AppendMessage(res.GetOutput());
+ }
+ return true;
+ }
+
+private:
+ std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+ const uint32_t m_default_count = 10;
+};
+
+class ProcessorTraceStop : public lldb::SBCommandPluginInterface {
+public:
+ ProcessorTraceStop(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+ : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
+
+ ~ProcessorTraceStop() {}
+
+ virtual bool DoExecute(lldb::SBDebugger debugger, char **command,
+ lldb::SBCommandReturnObject &result) {
+ lldb::SBProcess process;
+ lldb::SBThread thread;
+ if (!GetProcess(debugger, result, process))
+ return false;
+
+ lldb::tid_t thread_id;
+
+ // Parse command line options
+ bool thread_argument_provided = false;
+ if (command) {
+ for (uint32_t i = 0; command[i]; i++) {
+ thread_argument_provided = true;
+ if (!ParseCommandArgThread(command, result, process, i, thread_id))
+ return false;
+ }
+ }
+
+ if (!thread_argument_provided) {
+ thread = process.GetSelectedThread();
+ if (!thread.IsValid()) {
+ result.Printf("error: invalid current selected thread\n");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ thread_id = thread.GetThreadID();
+ }
+
+ // Stop trace
+ lldb::SBError error;
+ pt_decoder_sp->StopProcessorTrace(process, error, thread_id);
+ if (!error.Success()) {
+ result.Printf("error: %s\n", error.GetCString());
+ result.SetStatus(lldb::eReturnStatusFailed);
+ return false;
+ }
+ return true;
+ }
+
+private:
+ std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+};
+
+bool PTPluginInitialize(lldb::SBDebugger &debugger) {
+ lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter();
+ lldb::SBCommand proc_trace = interpreter.AddMultiwordCommand(
+ "processor-trace", "Intel(R) Processor Trace for thread/process");
+
+ std::shared_ptr<ptdecoder::PTDecoder> PTDecoderSP(
+ new ptdecoder::PTDecoder(debugger));
+
+ lldb::SBCommandPluginInterface *proc_trace_start =
+ new ProcessorTraceStart(PTDecoderSP);
+ const char *help_proc_trace_start = "start Intel(R) Processor Trace on a "
+ "specific thread or on the whole process";
+ const char *syntax_proc_trace_start =
+ "processor-trace start <cmd-options>\n\n"
+ "\rcmd-options Usage:\n"
+ "\r processor-trace start [-b <buffer-size>] [<thread-index>]\n\n"
+ "\t\b-b <buffer-size>\n"
+ "\t size of the trace buffer to store the trace data. If not "
+ "specified then a default value will be taken\n\n"
+ "\t\b<thread-index>\n"
+ "\t thread index of the thread. If no threads are specified, "
+ "currently selected thread is taken.\n"
+ "\t Use the thread-index 'all' to start tracing the whole process\n";
+ proc_trace.AddCommand("start", proc_trace_start, help_proc_trace_start,
+ syntax_proc_trace_start);
+
+ lldb::SBCommandPluginInterface *proc_trace_stop =
+ new ProcessorTraceStop(PTDecoderSP);
+ const char *help_proc_trace_stop =
+ "stop Intel(R) Processor Trace on a specific thread or on whole process";
+ const char *syntax_proc_trace_stop =
+ "processor-trace stop <cmd-options>\n\n"
+ "\rcmd-options Usage:\n"
+ "\r processor-trace stop [<thread-index>]\n\n"
+ "\t\b<thread-index>\n"
+ "\t thread index of the thread. If no threads are specified, "
+ "currently selected thread is taken.\n"
+ "\t Use the thread-index 'all' to stop tracing the whole process\n";
+ proc_trace.AddCommand("stop", proc_trace_stop, help_proc_trace_stop,
+ syntax_proc_trace_stop);
+
+ lldb::SBCommandPluginInterface *proc_trace_show_instr_log =
+ new ProcessorTraceShowInstrLog(PTDecoderSP);
+ const char *help_proc_trace_show_instr_log =
+ "display a log of assembly instructions executed for a specific thread "
+ "or for the whole process.\n"
+ "The length of the log to be displayed and the offset in the whole "
+ "instruction log from where the log needs to be displayed can also be "
+ "provided. The offset is counted from the end of this whole "
+ "instruction log which means the last executed instruction is at offset "
+ "0 (zero)";
+ const char *syntax_proc_trace_show_instr_log =
+ "processor-trace show-instr-log <cmd-options>\n\n"
+ "\rcmd-options Usage:\n"
+ "\r processor-trace show-instr-log [-o <offset>] [-c <count>] "
+ "[<thread-index>]\n\n"
+ "\t\b-o <offset>\n"
+ "\t offset in the whole instruction log from where the log will be "
+ "displayed. If not specified then a default value will be taken\n\n"
+ "\t\b-c <count>\n"
+ "\t number of instructions to be displayed. If not specified then a "
+ "default value will be taken\n\n"
+ "\t\b<thread-index>\n"
+ "\t thread index of the thread. If no threads are specified, "
+ "currently selected thread is taken.\n"
+ "\t Use the thread-index 'all' to show instruction log for all the "
+ "threads of the process\n";
+ proc_trace.AddCommand("show-instr-log", proc_trace_show_instr_log,
+ help_proc_trace_show_instr_log,
+ syntax_proc_trace_show_instr_log);
+
+ lldb::SBCommandPluginInterface *proc_trace_options =
+ new ProcessorTraceInfo(PTDecoderSP);
+ const char *help_proc_trace_show_options =
+ "display all the information regarding Intel(R) Processor Trace for a "
+ "specific thread or for the whole process.\n"
+ "The information contains trace buffer size and configuration options"
+ " of Intel(R) Processor Trace.";
+ const char *syntax_proc_trace_show_options =
+ "processor-trace show-options <cmd-options>\n\n"
+ "\rcmd-options Usage:\n"
+ "\r processor-trace show-options [<thread-index>]\n\n"
+ "\t\b<thread-index>\n"
+ "\t thread index of the thread. If no threads are specified, "
+ "currently selected thread is taken.\n"
+ "\t Use the thread-index 'all' to display information for all threads "
+ "of the process\n";
+ proc_trace.AddCommand("show-trace-options", proc_trace_options,
+ help_proc_trace_show_options,
+ syntax_proc_trace_show_options);
+
+ return true;
+}
diff --git a/tools/intel-features/intel-pt/cli-wrapper-pt.h b/tools/intel-features/intel-pt/cli-wrapper-pt.h
new file mode 100644
index 000000000000..e2a0ee47b579
--- /dev/null
+++ b/tools/intel-features/intel-pt/cli-wrapper-pt.h
@@ -0,0 +1,13 @@
+//===-- cli-wrapper-pt.h----------------------------------*- C++ -*-==========//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// CLI Wrapper of PTDecoder Tool to enable it to be used through LLDB's CLI.
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBDebugger.h"
+
+bool PTPluginInitialize(lldb::SBDebugger &debugger);
diff --git a/tools/intel-features/intel-pt/interface/PTDecoder.i b/tools/intel-features/intel-pt/interface/PTDecoder.i
new file mode 100644
index 000000000000..f662b8ff3599
--- /dev/null
+++ b/tools/intel-features/intel-pt/interface/PTDecoder.i
@@ -0,0 +1,10 @@
+%include "stdint.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"
+%include "lldb/lldb-forward.h"
+%include "lldb/lldb-types.h"
+
+%include "lldb/API/SBDefines.h"
+
+%include "../PTDecoder.h"
diff --git a/tools/intel-features/scripts/CMakeLists.txt b/tools/intel-features/scripts/CMakeLists.txt
new file mode 100644
index 000000000000..6df97a4b006d
--- /dev/null
+++ b/tools/intel-features/scripts/CMakeLists.txt
@@ -0,0 +1,37 @@
+file(GLOB_RECURSE SWIG_SOURCES *.swig)
+
+set(FLAGS
+ -c++
+ -shadow
+ -python
+ -D__STDC_LIMIT_MACROS
+ -D__STDC_CONSTANT_MACROS
+ )
+
+set(INCLUDES
+ -I${LLDB_SOURCE_DIR}/include
+ -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt
+ )
+
+set(OUTPUT_PYTHON_WRAPPER
+ ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+ )
+
+set(OUTPUT_PYTHON_SCRIPT_DIR
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+
+find_package(SWIG REQUIRED)
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py
+ DEPENDS ${SWIG_SOURCES}
+ COMMAND ${SWIG_EXECUTABLE} ${FLAGS} ${INCLUDES} -o ${OUTPUT_PYTHON_WRAPPER} -outdir ${OUTPUT_PYTHON_SCRIPT_DIR} ${SWIG_SOURCES}
+ COMMENT "Generating python wrapper for features library")
+
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp PROPERTIES GENERATED 1)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py PROPERTIES GENERATED 1)
+
+add_custom_target(intel-features-swig_wrapper ALL
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+ )
diff --git a/tools/intel-features/scripts/lldb-intel-features.swig b/tools/intel-features/scripts/lldb-intel-features.swig
new file mode 100644
index 000000000000..c035fb6132dd
--- /dev/null
+++ b/tools/intel-features/scripts/lldb-intel-features.swig
@@ -0,0 +1,16 @@
+%module lldbIntelFeatures
+
+%{
+#include "lldb/lldb-public.h"
+#include "intel-pt/PTDecoder.h"
+using namespace ptdecoder;
+%}
+
+/* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
+#define __extension__
+
+/* Combined python typemap for all features */
+%include "python-typemaps.txt"
+
+/* Feature specific python interface files*/
+%include "../intel-pt/interface/PTDecoder.i"
diff --git a/tools/intel-features/scripts/python-typemaps.txt b/tools/intel-features/scripts/python-typemaps.txt
new file mode 100644
index 000000000000..888d5321393f
--- /dev/null
+++ b/tools/intel-features/scripts/python-typemaps.txt
@@ -0,0 +1,31 @@
+/* Typemap definitions to allow SWIG to properly handle some data types */
+
+// typemap for an incoming buffer
+%typemap(in) (void *buf, size_t size) {
+ if (PyInt_Check($input)) {
+ $2 = PyInt_AsLong($input);
+ } else if (PyLong_Check($input)) {
+ $2 = PyLong_AsLong($input);
+ } else {
+ PyErr_SetString(PyExc_ValueError, "Expecting an integer or long object");
+ return NULL;
+ }
+ if ($2 <= 0) {
+ PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+ return NULL;
+ }
+ $1 = (void *) malloc($2);
+}
+
+// Return the buffer. Discarding any previous return result
+%typemap(argout) (void *buf, size_t size) {
+ Py_XDECREF($result); /* Blow away any previous result */
+ if (result == 0) {
+ $result = Py_None;
+ Py_INCREF($result);
+ } else {
+ PyObject *py_bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char*>($1), result);
+ $result = py_bytes;
+ }
+ free($1);
+}
diff --git a/tools/intel-mpx/CMakeLists.txt b/tools/intel-mpx/CMakeLists.txt
deleted file mode 100644
index 29ba9a1cacec..000000000000
--- a/tools/intel-mpx/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
- return ()
-endif ()
-
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
-add_library(lldb-intel-mpxtable SHARED
- IntelMPXTablePlugin.cpp
- )
-
-target_link_libraries(lldb-intel-mpxtable
- PUBLIC liblldb LLVMSupport)
-
-install(TARGETS lldb-intel-mpxtable
- LIBRARY DESTINATION bin)
diff --git a/tools/lldb-mi/MICmdCmdVar.cpp b/tools/lldb-mi/MICmdCmdVar.cpp
index 66b392be6bed..85f14ec29b93 100644
--- a/tools/lldb-mi/MICmdCmdVar.cpp
+++ b/tools/lldb-mi/MICmdCmdVar.cpp
@@ -509,19 +509,19 @@ bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue,
return MIstatus::success;
}
- lldb::SBType valueType = vrwValue.GetType();
-
const MIuint nChildren = vrwValue.GetNumChildren();
for (MIuint i = 0; i < nChildren; ++i) {
lldb::SBValue member = vrwValue.GetChildAtIndex(i);
if (!member.IsValid())
continue;
- if (member.GetValueDidChange()) {
- vrwbChanged = true;
- return MIstatus::success;
- } else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
- // Handle composite types (i.e. struct or arrays)
+ // skip pointers and references to avoid infinite loop
+ if (member.GetType().GetTypeFlags() &
+ (lldb::eTypeIsPointer | lldb::eTypeIsReference))
+ continue;
+
+ // Handle composite types (i.e. struct or arrays)
+ if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
return MIstatus::success;
}
vrwbChanged = false;
diff --git a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
index a61244f92fc2..561fa91a0ee3 100644
--- a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -262,6 +262,10 @@ bool CMICmnLLDBDebuggerHandleEvents::HandleEventSBBreakPoint(
pEventType = "eBreakpointEventTypeIgnoreChanged";
bOk = HandleEventSBBreakpointCmn(vEvent);
break;
+ case lldb::eBreakpointEventTypeAutoContinueChanged:
+ pEventType = "eBreakpointEventTypeAutoContinueChanged";
+ bOk = HandleEventSBBreakpointCmn(vEvent);
+ break;
}
m_pLog->WriteLog(CMIUtilString::Format(
"##### An SB Breakpoint event occurred: %s", pEventType));
diff --git a/tools/lldb-mi/MIDriverMain.cpp b/tools/lldb-mi/MIDriverMain.cpp
index be01f1d97790..eda67782ad67 100644
--- a/tools/lldb-mi/MIDriverMain.cpp
+++ b/tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
// Third party headers:
#include "lldb/API/SBHostOS.h"
+#include <atomic>
#include <csignal>
#include <stdio.h>
@@ -72,14 +73,13 @@ void sigint_handler(int vSigno) {
#ifdef _WIN32 // Restore handler as it is not persistent on Windows
signal(SIGINT, sigint_handler);
#endif
- static bool g_interrupt_sent = false;
+ static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
if (pDebugger != nullptr) {
- if (!g_interrupt_sent) {
- g_interrupt_sent = true;
+ if (!g_interrupt_sent.test_and_set()) {
pDebugger->DispatchInputInterrupt();
- g_interrupt_sent = false;
+ g_interrupt_sent.clear();
}
}
diff --git a/tools/lldb-server/CMakeLists.txt b/tools/lldb-server/CMakeLists.txt
index f8c57cb9488f..b226adb2b570 100644
--- a/tools/lldb-server/CMakeLists.txt
+++ b/tools/lldb-server/CMakeLists.txt
@@ -24,41 +24,6 @@ endif ()
include_directories(../../source)
-set(LLDB_SYSTEM_LIBS)
-if (NOT LLDB_DISABLE_LIBEDIT)
- list(APPEND LLDB_SYSTEM_LIBS edit)
-endif()
-if (NOT LLDB_DISABLE_CURSES)
- list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
- if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
- list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
- endif()
-endif()
-
-if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
- list(APPEND LLDB_SYSTEM_LIBS atomic)
-endif()
-
-# On FreeBSD/NetBSD backtrace() is provided by libexecinfo, not libc.
-if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- list(APPEND LLDB_SYSTEM_LIBS execinfo)
-endif()
-
-if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
- list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
-endif()
-
-list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
-
-if (LLVM_BUILD_STATIC)
- if (NOT LLDB_DISABLE_PYTHON)
- list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
- endif()
- if (NOT LLDB_DISABLE_CURSES)
- list(APPEND LLDB_SYSTEM_LIBS gpm)
- endif()
-endif()
-
set(LLDB_PLUGINS)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
@@ -89,4 +54,4 @@ add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
Support
)
-target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
+target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
diff --git a/tools/lldb-server/lldb-gdbserver.cpp b/tools/lldb-server/lldb-gdbserver.cpp
index f1a9b113c8ee..810cb92e4ffc 100644
--- a/tools/lldb-server/lldb-gdbserver.cpp
+++ b/tools/lldb-server/lldb-gdbserver.cpp
@@ -106,6 +106,7 @@ static struct option g_long_options[] = {
// than llgs listening for a connection from address on port.
{"setsid", no_argument, NULL,
'S'}, // Call setsid() to make llgs run in its own session.
+ {"fd", required_argument, NULL, 'F'},
{NULL, 0, NULL, 0}};
//----------------------------------------------------------------------
@@ -132,13 +133,13 @@ static void display_usage(const char *progname, const char *subcommand) {
"[--log-file log-file-name] "
"[--log-channels log-channel-list] "
"[--setsid] "
+ "[--fd file-descriptor]"
"[--named-pipe named-pipe-path] "
"[--native-regs] "
"[--attach pid] "
"[[HOST]:PORT] "
"[-- PROGRAM ARG1 ARG2 ...]\n",
progname, subcommand);
- exit(0);
}
void handle_attach_to_pid(GDBRemoteCommunicationServerLLGS &gdb_server,
@@ -176,27 +177,28 @@ void handle_attach(GDBRemoteCommunicationServerLLGS &gdb_server,
void handle_launch(GDBRemoteCommunicationServerLLGS &gdb_server, int argc,
const char *const argv[]) {
- Status error;
- error = gdb_server.SetLaunchArguments(argv, argc);
- if (error.Fail()) {
- fprintf(stderr, "error: failed to set launch args for '%s': %s\n", argv[0],
- error.AsCString());
+ ProcessLaunchInfo info;
+ info.GetFlags().Set(eLaunchFlagStopAtEntry | eLaunchFlagDebug |
+ eLaunchFlagDisableASLR);
+ info.SetArguments(const_cast<const char **>(argv), true);
+
+ llvm::SmallString<64> cwd;
+ if (std::error_code ec = llvm::sys::fs::current_path(cwd)) {
+ llvm::errs() << "Error getting current directory: " << ec.message() << "\n";
exit(1);
}
+ info.SetWorkingDirectory(FileSpec(cwd, true));
- unsigned int launch_flags = eLaunchFlagStopAtEntry | eLaunchFlagDebug;
+ StringList env;
+ Host::GetEnvironment(env);
+ info.GetEnvironmentEntries() = Args(env);
- error = gdb_server.SetLaunchFlags(launch_flags);
- if (error.Fail()) {
- fprintf(stderr, "error: failed to set launch flags for '%s': %s\n", argv[0],
- error.AsCString());
- exit(1);
- }
+ gdb_server.SetLaunchInfo(info);
- error = gdb_server.LaunchProcess();
+ Status error = gdb_server.LaunchProcess();
if (error.Fail()) {
- fprintf(stderr, "error: failed to launch '%s': %s\n", argv[0],
- error.AsCString());
+ llvm::errs() << llvm::formatv("error: failed to launch '{0}': {1}\n",
+ argv[0], error);
exit(1);
}
}
@@ -232,10 +234,34 @@ void ConnectToRemote(MainLoop &mainloop,
GDBRemoteCommunicationServerLLGS &gdb_server,
bool reverse_connect, const char *const host_and_port,
const char *const progname, const char *const subcommand,
- const char *const named_pipe_path, int unnamed_pipe_fd) {
+ const char *const named_pipe_path, int unnamed_pipe_fd,
+ int connection_fd) {
Status error;
- if (host_and_port && host_and_port[0]) {
+ std::unique_ptr<Connection> connection_up;
+ if (connection_fd != -1) {
+ // Build the connection string.
+ char connection_url[512];
+ snprintf(connection_url, sizeof(connection_url), "fd://%d", connection_fd);
+
+ // Create the connection.
+#if !defined LLDB_DISABLE_POSIX && !defined _WIN32
+ ::fcntl(connection_fd, F_SETFD, FD_CLOEXEC);
+#endif
+ connection_up.reset(new ConnectionFileDescriptor);
+ auto connection_result = connection_up->Connect(connection_url, &error);
+ if (connection_result != eConnectionStatusSuccess) {
+ fprintf(stderr, "error: failed to connect to client at '%s' "
+ "(connection status: %d)\n",
+ connection_url, static_cast<int>(connection_result));
+ exit(-1);
+ }
+ if (error.Fail()) {
+ fprintf(stderr, "error: failed to connect to client at '%s': %s\n",
+ connection_url, error.AsCString());
+ exit(-1);
+ }
+ } else if (host_and_port && host_and_port[0]) {
// Parse out host and port.
std::string final_host_and_port;
std::string connection_host;
@@ -255,7 +281,6 @@ void ConnectToRemote(MainLoop &mainloop,
connection_portno = StringConvert::ToUInt32(connection_port.c_str(), 0);
}
- std::unique_ptr<Connection> connection_up;
if (reverse_connect) {
// llgs will connect to the gdb-remote client.
@@ -263,7 +288,7 @@ void ConnectToRemote(MainLoop &mainloop,
// Ensure we have a port number for the connection.
if (connection_portno == 0) {
fprintf(stderr, "error: port number must be specified on when using "
- "reverse connect");
+ "reverse connect\n");
exit(1);
}
@@ -277,12 +302,12 @@ void ConnectToRemote(MainLoop &mainloop,
auto connection_result = connection_up->Connect(connection_url, &error);
if (connection_result != eConnectionStatusSuccess) {
fprintf(stderr, "error: failed to connect to client at '%s' "
- "(connection status: %d)",
+ "(connection status: %d)\n",
connection_url, static_cast<int>(connection_result));
exit(-1);
}
if (error.Fail()) {
- fprintf(stderr, "error: failed to connect to client at '%s': %s",
+ fprintf(stderr, "error: failed to connect to client at '%s': %s\n",
connection_url, error.AsCString());
exit(-1);
}
@@ -290,7 +315,7 @@ void ConnectToRemote(MainLoop &mainloop,
std::unique_ptr<Acceptor> acceptor_up(
Acceptor::Create(final_host_and_port, false, error));
if (error.Fail()) {
- fprintf(stderr, "failed to create acceptor: %s", error.AsCString());
+ fprintf(stderr, "failed to create acceptor: %s\n", error.AsCString());
exit(1);
}
error = acceptor_up->Listen(1);
@@ -304,7 +329,7 @@ void ConnectToRemote(MainLoop &mainloop,
if (named_pipe_path && named_pipe_path[0]) {
error = writeSocketIdToPipe(named_pipe_path, socket_id);
if (error.Fail())
- fprintf(stderr, "failed to write to the named pipe \'%s\': %s",
+ fprintf(stderr, "failed to write to the named pipe \'%s\': %s\n",
named_pipe_path, error.AsCString());
}
// If we have an unnamed pipe to write the socket id back to, do that
@@ -312,7 +337,7 @@ void ConnectToRemote(MainLoop &mainloop,
else if (unnamed_pipe_fd >= 0) {
error = writeSocketIdToPipe(unnamed_pipe_fd, socket_id);
if (error.Fail())
- fprintf(stderr, "failed to write to the unnamed pipe: %s",
+ fprintf(stderr, "failed to write to the unnamed pipe: %s\n",
error.AsCString());
}
} else {
@@ -328,14 +353,14 @@ void ConnectToRemote(MainLoop &mainloop,
}
connection_up.reset(conn);
}
- error = gdb_server.InitializeConnection(std::move(connection_up));
- if (error.Fail()) {
- fprintf(stderr, "Failed to initialize connection: %s\n",
- error.AsCString());
- exit(-1);
- }
- printf("Connection established.\n");
}
+ error = gdb_server.InitializeConnection(std::move(connection_up));
+ if (error.Fail()) {
+ fprintf(stderr, "Failed to initialize connection: %s\n",
+ error.AsCString());
+ exit(-1);
+ }
+ printf("Connection established.\n");
}
//----------------------------------------------------------------------
@@ -364,6 +389,7 @@ int main_gdbserver(int argc, char *argv[]) {
log_channels; // e.g. "lldb process threads:gdb-remote default:linux all"
int unnamed_pipe_fd = -1;
bool reverse_connect = false;
+ int connection_fd = -1;
// ProcessLaunchInfo launch_info;
ProcessAttachInfo attach_info;
@@ -413,6 +439,10 @@ int main_gdbserver(int argc, char *argv[]) {
reverse_connect = true;
break;
+ case 'F':
+ connection_fd = StringConvert::ToUInt32(optarg, -1);
+ break;
+
#ifndef _WIN32
case 'S':
// Put llgs into a new session. Terminals group processes
@@ -472,7 +502,8 @@ int main_gdbserver(int argc, char *argv[]) {
argc -= optind;
argv += optind;
- if (argc == 0) {
+ if (argc == 0 && connection_fd == -1) {
+ fputs("No arguments\n", stderr);
display_usage(progname, subcommand);
exit(255);
}
@@ -501,7 +532,7 @@ int main_gdbserver(int argc, char *argv[]) {
ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port,
progname, subcommand, named_pipe_path.c_str(),
- unnamed_pipe_fd);
+ unnamed_pipe_fd, connection_fd);
if (!gdb_server.IsConnected()) {
fprintf(stderr, "no connection information provided, unable to run\n");
diff --git a/tools/lldb-test/CMakeLists.txt b/tools/lldb-test/CMakeLists.txt
new file mode 100644
index 000000000000..2ab1ceacdcd1
--- /dev/null
+++ b/tools/lldb-test/CMakeLists.txt
@@ -0,0 +1,27 @@
+get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
+
+add_lldb_tool(lldb-test
+ FormatUtil.cpp
+ lldb-test.cpp
+ SystemInitializerTest.cpp
+
+ LINK_LIBS
+ lldbBase
+ lldbBreakpoint
+ lldbCore
+ lldbDataFormatters
+ lldbExpression
+ lldbHost
+ lldbInitialization
+ lldbInterpreter
+ lldbSymbol
+ lldbTarget
+ lldbUtility
+ ${LLDB_ALL_PLUGINS}
+ ${host_lib}
+
+ LINK_COMPONENTS
+ Support
+ )
+
+include_directories(${LLDB_SOURCE_DIR}/source)
diff --git a/tools/lldb-test/FormatUtil.cpp b/tools/lldb-test/FormatUtil.cpp
new file mode 100644
index 000000000000..381cbd6e25b8
--- /dev/null
+++ b/tools/lldb-test/FormatUtil.cpp
@@ -0,0 +1,69 @@
+//===- FormatUtil.cpp ----------------------------------------- *- C++ --*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "FormatUtil.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace lldb_private;
+using namespace llvm;
+
+LinePrinter::LinePrinter(int Indent, llvm::raw_ostream &Stream)
+ : OS(Stream), IndentSpaces(Indent), CurrentIndent(0) {}
+
+void LinePrinter::Indent(uint32_t Amount) {
+ if (Amount == 0)
+ Amount = IndentSpaces;
+ CurrentIndent += Amount;
+}
+
+void LinePrinter::Unindent(uint32_t Amount) {
+ if (Amount == 0)
+ Amount = IndentSpaces;
+ CurrentIndent = std::max<int>(0, CurrentIndent - Amount);
+}
+
+void LinePrinter::NewLine() {
+ OS << "\n";
+ OS.indent(CurrentIndent);
+}
+
+void LinePrinter::print(const Twine &T) { OS << T; }
+
+void LinePrinter::printLine(const Twine &T) {
+ NewLine();
+ OS << T;
+}
+
+void LinePrinter::formatBinary(StringRef Label, ArrayRef<uint8_t> Data,
+ uint32_t StartOffset) {
+ NewLine();
+ OS << Label << " (";
+ if (!Data.empty()) {
+ OS << "\n";
+ OS << format_bytes_with_ascii(Data, StartOffset, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ NewLine();
+ }
+ OS << ")";
+}
+
+void LinePrinter::formatBinary(StringRef Label, ArrayRef<uint8_t> Data,
+ uint64_t Base, uint32_t StartOffset) {
+ NewLine();
+ OS << Label << " (";
+ if (!Data.empty()) {
+ OS << "\n";
+ Base += StartOffset;
+ OS << format_bytes_with_ascii(Data, Base, 32, 4,
+ CurrentIndent + IndentSpaces, true);
+ NewLine();
+ }
+ OS << ")";
+}
diff --git a/tools/lldb-test/FormatUtil.h b/tools/lldb-test/FormatUtil.h
new file mode 100644
index 000000000000..f22ee41662ee
--- /dev/null
+++ b/tools/lldb-test/FormatUtil.h
@@ -0,0 +1,75 @@
+//===- FormatUtil.h ------------------------------------------- *- C++ --*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLDBTEST_FORMATUTIL_H
+#define LLVM_TOOLS_LLDBTEST_FORMATUTIL_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <list>
+
+namespace lldb_private {
+
+class LinePrinter {
+ llvm::raw_ostream &OS;
+ int IndentSpaces;
+ int CurrentIndent;
+
+public:
+ LinePrinter(int Indent, llvm::raw_ostream &Stream);
+
+ void Indent(uint32_t Amount = 0);
+ void Unindent(uint32_t Amount = 0);
+ void NewLine();
+
+ void printLine(const llvm::Twine &T);
+ void print(const llvm::Twine &T);
+ template <typename... Ts> void formatLine(const char *Fmt, Ts &&... Items) {
+ printLine(llvm::formatv(Fmt, std::forward<Ts>(Items)...));
+ }
+ template <typename... Ts> void format(const char *Fmt, Ts &&... Items) {
+ print(llvm::formatv(Fmt, std::forward<Ts>(Items)...));
+ }
+
+ void formatBinary(llvm::StringRef Label, llvm::ArrayRef<uint8_t> Data,
+ uint32_t StartOffset);
+ void formatBinary(llvm::StringRef Label, llvm::ArrayRef<uint8_t> Data,
+ uint64_t BaseAddr, uint32_t StartOffset);
+
+ llvm::raw_ostream &getStream() { return OS; }
+ int getIndentLevel() const { return CurrentIndent; }
+};
+
+struct AutoIndent {
+ explicit AutoIndent(LinePrinter &L, uint32_t Amount = 0)
+ : L(&L), Amount(Amount) {
+ L.Indent(Amount);
+ }
+ ~AutoIndent() {
+ if (L)
+ L->Unindent(Amount);
+ }
+
+ LinePrinter *L = nullptr;
+ uint32_t Amount = 0;
+};
+
+template <class T>
+inline llvm::raw_ostream &operator<<(LinePrinter &Printer, const T &Item) {
+ Printer.getStream() << Item;
+ return Printer.getStream();
+}
+
+} // namespace lldb_private
+
+#endif
diff --git a/tools/lldb-test/SystemInitializerTest.cpp b/tools/lldb-test/SystemInitializerTest.cpp
new file mode 100644
index 000000000000..cae395e133ee
--- /dev/null
+++ b/tools/lldb-test/SystemInitializerTest.cpp
@@ -0,0 +1,345 @@
+//===-- SystemInitializerTest.cpp -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "SystemInitializerTest.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Initialization/SystemInitializerCommon.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/GoASTContext.h"
+#include "lldb/Symbol/JavaASTContext.h"
+#include "lldb/Symbol/OCamlASTContext.h"
+#include "lldb/Utility/Timer.h"
+
+#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
+#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
+#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
+#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
+#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
+#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
+#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
+#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
+#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
+#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
+#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
+#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
+#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
+#include "Plugins/Architecture/Arm/ArchitectureArm.h"
+#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
+#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
+#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
+#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
+#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
+#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
+#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
+#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
+#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
+#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/Language/Go/GoLanguage.h"
+#include "Plugins/Language/Java/JavaLanguage.h"
+#include "Plugins/Language/OCaml/OCamlLanguage.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
+#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
+#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
+#include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h"
+#include "Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h"
+#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
+#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
+#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
+#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
+#include "Plugins/OperatingSystem/Go/OperatingSystemGo.h"
+#include "Plugins/Platform/Android/PlatformAndroid.h"
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
+#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
+#include "Plugins/Platform/Windows/PlatformWindows.h"
+#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
+#include "Plugins/Process/elf-core/ProcessElfCore.h"
+#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include "Plugins/Process/minidump/ProcessMinidump.h"
+#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
+#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
+#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
+#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
+#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
+#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
+
+#if defined(__APPLE__)
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
+#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
+#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
+#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
+#include "Plugins/Process/mach-core/ProcessMachCore.h"
+#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
+#endif
+#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
+
+#if defined(__FreeBSD__)
+#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
+#endif
+
+#if defined(_WIN32)
+#include "Plugins/Process/Windows/Common/ProcessWindows.h"
+#include "lldb/Host/windows/windows.h"
+#endif
+
+#include "llvm/Support/TargetSelect.h"
+
+#include <string>
+
+using namespace lldb_private;
+
+SystemInitializerTest::SystemInitializerTest() {}
+
+SystemInitializerTest::~SystemInitializerTest() {}
+
+void SystemInitializerTest::Initialize() {
+ SystemInitializerCommon::Initialize();
+ ScriptInterpreterNone::Initialize();
+
+ OperatingSystemGo::Initialize();
+
+ platform_freebsd::PlatformFreeBSD::Initialize();
+ platform_linux::PlatformLinux::Initialize();
+ platform_netbsd::PlatformNetBSD::Initialize();
+ platform_openbsd::PlatformOpenBSD::Initialize();
+ PlatformWindows::Initialize();
+ PlatformKalimba::Initialize();
+ platform_android::PlatformAndroid::Initialize();
+ PlatformRemoteiOS::Initialize();
+ PlatformMacOSX::Initialize();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Initialize();
+ PlatformDarwinKernel::Initialize();
+#endif
+
+ // Initialize LLVM and Clang
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllDisassemblers();
+
+ ClangASTContext::Initialize();
+ GoASTContext::Initialize();
+ JavaASTContext::Initialize();
+ OCamlASTContext::Initialize();
+
+ ABIMacOSX_i386::Initialize();
+ ABIMacOSX_arm::Initialize();
+ ABIMacOSX_arm64::Initialize();
+ ABISysV_arm::Initialize();
+ ABISysV_arm64::Initialize();
+ ABISysV_hexagon::Initialize();
+ ABISysV_i386::Initialize();
+ ABISysV_x86_64::Initialize();
+ ABISysV_ppc::Initialize();
+ ABISysV_ppc64::Initialize();
+ ABISysV_mips::Initialize();
+ ABISysV_mips64::Initialize();
+ ABISysV_s390x::Initialize();
+
+ ArchitectureArm::Initialize();
+
+ DisassemblerLLVMC::Initialize();
+
+ JITLoaderGDB::Initialize();
+ ProcessElfCore::Initialize();
+ minidump::ProcessMinidump::Initialize();
+ MemoryHistoryASan::Initialize();
+ AddressSanitizerRuntime::Initialize();
+ ThreadSanitizerRuntime::Initialize();
+ UndefinedBehaviorSanitizerRuntime::Initialize();
+ MainThreadCheckerRuntime::Initialize();
+
+ SymbolVendorELF::Initialize();
+ SymbolFileDWARF::Initialize();
+ SymbolFilePDB::Initialize();
+ SymbolFileSymtab::Initialize();
+ UnwindAssemblyInstEmulation::Initialize();
+ UnwindAssembly_x86::Initialize();
+ EmulateInstructionARM64::Initialize();
+ SymbolFileDWARFDebugMap::Initialize();
+ ItaniumABILanguageRuntime::Initialize();
+ AppleObjCRuntimeV2::Initialize();
+ AppleObjCRuntimeV1::Initialize();
+ SystemRuntimeMacOSX::Initialize();
+ RenderScriptRuntime::Initialize();
+ GoLanguageRuntime::Initialize();
+ JavaLanguageRuntime::Initialize();
+
+ CPlusPlusLanguage::Initialize();
+ GoLanguage::Initialize();
+ JavaLanguage::Initialize();
+ ObjCLanguage::Initialize();
+ ObjCPlusPlusLanguage::Initialize();
+ OCamlLanguage::Initialize();
+
+#if defined(_WIN32)
+ ProcessWindows::Initialize();
+#endif
+#if defined(__FreeBSD__)
+ ProcessFreeBSD::Initialize();
+#endif
+#if defined(__APPLE__)
+ SymbolVendorMacOSX::Initialize();
+ ProcessKDP::Initialize();
+ ProcessMachCore::Initialize();
+ PlatformAppleTVSimulator::Initialize();
+ PlatformAppleWatchSimulator::Initialize();
+ PlatformRemoteAppleTV::Initialize();
+ PlatformRemoteAppleWatch::Initialize();
+ DynamicLoaderDarwinKernel::Initialize();
+#endif
+
+ // This plugin is valid on any host that talks to a Darwin remote.
+ // It shouldn't be limited to __APPLE__.
+ StructuredDataDarwinLog::Initialize();
+
+ //----------------------------------------------------------------------
+ // Platform agnostic plugins
+ //----------------------------------------------------------------------
+ platform_gdb_server::PlatformRemoteGDBServer::Initialize();
+
+ process_gdb_remote::ProcessGDBRemote::Initialize();
+ DynamicLoaderMacOSXDYLD::Initialize();
+ DynamicLoaderMacOS::Initialize();
+ DynamicLoaderPOSIXDYLD::Initialize();
+ DynamicLoaderStatic::Initialize();
+ DynamicLoaderWindowsDYLD::Initialize();
+
+ // Scan for any system or user LLDB plug-ins
+ PluginManager::Initialize();
+
+ // The process settings need to know about installed plug-ins, so the Settings
+ // must be initialized
+ // AFTER PluginManager::Initialize is called.
+
+ Debugger::SettingsInitialize();
+}
+
+void SystemInitializerTest::Terminate() {
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
+
+ Debugger::SettingsTerminate();
+
+ // Terminate and unload and loaded system or user LLDB plug-ins
+ PluginManager::Terminate();
+
+ ClangASTContext::Terminate();
+ GoASTContext::Terminate();
+ JavaASTContext::Terminate();
+ OCamlASTContext::Terminate();
+
+ ABIMacOSX_i386::Terminate();
+ ABIMacOSX_arm::Terminate();
+ ABIMacOSX_arm64::Terminate();
+ ABISysV_arm::Terminate();
+ ABISysV_arm64::Terminate();
+ ABISysV_hexagon::Terminate();
+ ABISysV_i386::Terminate();
+ ABISysV_x86_64::Terminate();
+ ABISysV_ppc::Terminate();
+ ABISysV_ppc64::Terminate();
+ ABISysV_mips::Terminate();
+ ABISysV_mips64::Terminate();
+ ABISysV_s390x::Terminate();
+ DisassemblerLLVMC::Terminate();
+
+ JITLoaderGDB::Terminate();
+ ProcessElfCore::Terminate();
+ minidump::ProcessMinidump::Terminate();
+ MemoryHistoryASan::Terminate();
+ AddressSanitizerRuntime::Terminate();
+ ThreadSanitizerRuntime::Terminate();
+ UndefinedBehaviorSanitizerRuntime::Terminate();
+ MainThreadCheckerRuntime::Terminate();
+ SymbolVendorELF::Terminate();
+ SymbolFileDWARF::Terminate();
+ SymbolFilePDB::Terminate();
+ SymbolFileSymtab::Terminate();
+ UnwindAssembly_x86::Terminate();
+ UnwindAssemblyInstEmulation::Terminate();
+ EmulateInstructionARM64::Terminate();
+ SymbolFileDWARFDebugMap::Terminate();
+ ItaniumABILanguageRuntime::Terminate();
+ AppleObjCRuntimeV2::Terminate();
+ AppleObjCRuntimeV1::Terminate();
+ SystemRuntimeMacOSX::Terminate();
+ RenderScriptRuntime::Terminate();
+ JavaLanguageRuntime::Terminate();
+
+ CPlusPlusLanguage::Terminate();
+ GoLanguage::Terminate();
+ JavaLanguage::Terminate();
+ ObjCLanguage::Terminate();
+ ObjCPlusPlusLanguage::Terminate();
+ OCamlLanguage::Terminate();
+
+#if defined(__APPLE__)
+ DynamicLoaderDarwinKernel::Terminate();
+ ProcessMachCore::Terminate();
+ ProcessKDP::Terminate();
+ SymbolVendorMacOSX::Terminate();
+ PlatformAppleTVSimulator::Terminate();
+ PlatformAppleWatchSimulator::Terminate();
+ PlatformRemoteAppleTV::Terminate();
+ PlatformRemoteAppleWatch::Terminate();
+#endif
+
+#if defined(__FreeBSD__)
+ ProcessFreeBSD::Terminate();
+#endif
+ Debugger::SettingsTerminate();
+
+ platform_gdb_server::PlatformRemoteGDBServer::Terminate();
+ process_gdb_remote::ProcessGDBRemote::Terminate();
+ StructuredDataDarwinLog::Terminate();
+
+ DynamicLoaderMacOSXDYLD::Terminate();
+ DynamicLoaderMacOS::Terminate();
+ DynamicLoaderPOSIXDYLD::Terminate();
+ DynamicLoaderStatic::Terminate();
+ DynamicLoaderWindowsDYLD::Terminate();
+
+ OperatingSystemGo::Terminate();
+
+ platform_freebsd::PlatformFreeBSD::Terminate();
+ platform_linux::PlatformLinux::Terminate();
+ platform_netbsd::PlatformNetBSD::Terminate();
+ platform_openbsd::PlatformOpenBSD::Terminate();
+ PlatformWindows::Terminate();
+ PlatformKalimba::Terminate();
+ platform_android::PlatformAndroid::Terminate();
+ PlatformMacOSX::Terminate();
+ PlatformRemoteiOS::Terminate();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Terminate();
+ PlatformDarwinKernel::Terminate();
+#endif
+
+ // Now shutdown the common parts, in reverse order.
+ SystemInitializerCommon::Terminate();
+}
diff --git a/tools/lldb-test/SystemInitializerTest.h b/tools/lldb-test/SystemInitializerTest.h
new file mode 100644
index 000000000000..887d6243765d
--- /dev/null
+++ b/tools/lldb-test/SystemInitializerTest.h
@@ -0,0 +1,35 @@
+//===-- SystemInitializerTest.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SYSTEM_INITIALIZER_TEST_H
+#define LLDB_API_SYSTEM_INITIALIZER_TEST_H
+
+#include "lldb/Initialization/SystemInitializerCommon.h"
+
+namespace lldb_private {
+//------------------------------------------------------------------
+/// Initializes lldb.
+///
+/// This class is responsible for initializing all of lldb system
+/// services needed to use the full LLDB application. This class is
+/// not intended to be used externally, but is instead used
+/// internally by SBDebugger to initialize the system.
+//------------------------------------------------------------------
+class SystemInitializerTest : public SystemInitializerCommon {
+public:
+ SystemInitializerTest();
+ ~SystemInitializerTest() override;
+
+ void Initialize() override;
+ void Terminate() override;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_API_SYSTEM_INITIALIZER_FULL_H
diff --git a/tools/lldb-test/lldb-test.cpp b/tools/lldb-test/lldb-test.cpp
new file mode 100644
index 000000000000..1fe2f5b63859
--- /dev/null
+++ b/tools/lldb-test/lldb-test.cpp
@@ -0,0 +1,126 @@
+//===- lldb-test.cpp ------------------------------------------ *- C++ --*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "FormatUtil.h"
+#include "SystemInitializerTest.h"
+
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Initialization/SystemLifetimeManager.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangASTImporter.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/StreamString.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include <thread>
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace llvm;
+
+namespace opts {
+cl::SubCommand ModuleSubcommand("module-sections",
+ "Display LLDB Module Information");
+cl::SubCommand SymbolsSubcommand("symbols", "Dump symbols for an object file");
+
+namespace module {
+cl::opt<bool> SectionContents("contents",
+ cl::desc("Dump each section's contents"),
+ cl::sub(ModuleSubcommand));
+cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input files>"),
+ cl::OneOrMore, cl::sub(ModuleSubcommand));
+} // namespace module
+
+namespace symbols {
+cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input files>"),
+ cl::OneOrMore, cl::sub(SymbolsSubcommand));
+}
+} // namespace opts
+
+static llvm::ManagedStatic<SystemLifetimeManager> DebuggerLifetime;
+
+static void dumpSymbols(Debugger &Dbg) {
+ for (const auto &File : opts::symbols::InputFilenames) {
+ ModuleSpec Spec{FileSpec(File, false)};
+ Spec.GetSymbolFileSpec().SetFile(File, false);
+
+ auto ModulePtr = std::make_shared<lldb_private::Module>(Spec);
+
+ StreamString Stream;
+ ModulePtr->ParseAllDebugSymbols();
+ ModulePtr->Dump(&Stream);
+ llvm::outs() << Stream.GetData() << "\n";
+ llvm::outs().flush();
+ }
+}
+
+static void dumpModules(Debugger &Dbg) {
+ LinePrinter Printer(4, llvm::outs());
+
+ for (const auto &File : opts::module::InputFilenames) {
+ ModuleSpec Spec{FileSpec(File, false)};
+ Spec.GetSymbolFileSpec().SetFile(File, false);
+
+ auto ModulePtr = std::make_shared<lldb_private::Module>(Spec);
+ SectionList *Sections = ModulePtr->GetSectionList();
+ if (!Sections) {
+ llvm::errs() << "Could not load sections for module " << File << "\n";
+ continue;
+ }
+
+ size_t Count = Sections->GetNumSections(0);
+ Printer.formatLine("Showing {0} sections", Count);
+ for (size_t I = 0; I < Count; ++I) {
+ AutoIndent Indent(Printer, 2);
+ auto S = Sections->GetSectionAtIndex(I);
+ assert(S);
+ Printer.formatLine("Index: {0}", I);
+ Printer.formatLine("Name: {0}", S->GetName().GetStringRef());
+ Printer.formatLine("VM size: {0}", S->GetByteSize());
+ Printer.formatLine("File size: {0}", S->GetFileSize());
+
+ if (opts::module::SectionContents) {
+ DataExtractor Data;
+ S->GetSectionData(Data);
+ ArrayRef<uint8_t> Bytes = {Data.GetDataStart(), Data.GetDataEnd()};
+ Printer.formatBinary("Data: ", Bytes, 0);
+ }
+ Printer.NewLine();
+ }
+ }
+}
+
+int main(int argc, const char *argv[]) {
+ StringRef ToolName = argv[0];
+ sys::PrintStackTraceOnErrorSignal(ToolName);
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y;
+
+ cl::ParseCommandLineOptions(argc, argv, "LLDB Testing Utility\n");
+
+ DebuggerLifetime->Initialize(llvm::make_unique<SystemInitializerTest>(),
+ nullptr);
+
+ auto Dbg = lldb_private::Debugger::CreateInstance();
+
+ if (opts::ModuleSubcommand)
+ dumpModules(*Dbg);
+ else if (opts::SymbolsSubcommand)
+ dumpSymbols(*Dbg);
+
+ DebuggerLifetime->Terminate();
+ return 0;
+}
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
index f7b611802fbf..7b8bc678e554 100644
--- a/unittests/CMakeLists.txt
+++ b/unittests/CMakeLists.txt
@@ -2,7 +2,7 @@ add_custom_target(LLDBUnitTests)
set_target_properties(LLDBUnitTests PROPERTIES FOLDER "LLDB tests")
include_directories(${LLDB_SOURCE_ROOT})
-include_directories(${LLDB_PROJECT_ROOT})
+include_directories(${LLDB_PROJECT_ROOT}/unittests)
set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h)
if (MSVC)
@@ -11,8 +11,6 @@ else ()
list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
endif ()
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
if (LLDB_BUILT_STANDALONE)
# Build the gtest library needed for unittests, if we have LLVM sources
# handy.
@@ -46,7 +44,7 @@ function(add_lldb_unittest test_name)
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs)
- target_link_libraries(${test_name} ${ARG_LINK_LIBS} ${LLDB_SYSTEM_LIBS})
+ target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})
endfunction()
function(add_unittest_inputs test_name inputs)
@@ -59,6 +57,7 @@ function(add_unittest_inputs test_name inputs)
endforeach()
endfunction()
+add_subdirectory(TestingSupport)
add_subdirectory(Breakpoint)
add_subdirectory(Core)
add_subdirectory(Editline)
diff --git a/unittests/Core/CMakeLists.txt b/unittests/Core/CMakeLists.txt
index 426009661b12..41ace5bcaece 100644
--- a/unittests/Core/CMakeLists.txt
+++ b/unittests/Core/CMakeLists.txt
@@ -1,5 +1,4 @@
add_lldb_unittest(LLDBCoreTests
- ArchSpecTest.cpp
BroadcasterTest.cpp
DataExtractorTest.cpp
ListenerTest.cpp
diff --git a/unittests/Core/DataExtractorTest.cpp b/unittests/Core/DataExtractorTest.cpp
index 213d5a7b43fd..0267f6d14056 100644
--- a/unittests/Core/DataExtractorTest.cpp
+++ b/unittests/Core/DataExtractorTest.cpp
@@ -49,3 +49,120 @@ TEST(DataExtractorTest, PeekData) {
EXPECT_EQ(buffer + 4, E.PeekData(4, 0));
EXPECT_EQ(nullptr, E.PeekData(4, 1));
}
+
+TEST(DataExtractorTest, GetMaxU64) {
+ uint8_t buffer[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
+ DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
+ sizeof(void *));
+ DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
+
+ lldb::offset_t offset;
+
+ // Check with the minimum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x01U, LE.GetMaxU64(&offset, 1));
+ EXPECT_EQ(1U, offset);
+ offset = 0;
+ EXPECT_EQ(0x01U, BE.GetMaxU64(&offset, 1));
+ EXPECT_EQ(1U, offset);
+
+ // Check with a non-zero offset.
+ offset = 1;
+ EXPECT_EQ(0x0302U, LE.GetMaxU64(&offset, 2));
+ EXPECT_EQ(3U, offset);
+ offset = 1;
+ EXPECT_EQ(0x0203U, BE.GetMaxU64(&offset, 2));
+ EXPECT_EQ(3U, offset);
+
+ // Check with the byte size not being a multiple of 2.
+ offset = 0;
+ EXPECT_EQ(0x07060504030201U, LE.GetMaxU64(&offset, 7));
+ EXPECT_EQ(7U, offset);
+ offset = 0;
+ EXPECT_EQ(0x01020304050607U, BE.GetMaxU64(&offset, 7));
+ EXPECT_EQ(7U, offset);
+
+ // Check with the maximum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x0807060504030201U, LE.GetMaxU64(&offset, 8));
+ EXPECT_EQ(8U, offset);
+ offset = 0;
+ EXPECT_EQ(0x0102030405060708U, BE.GetMaxU64(&offset, 8));
+ EXPECT_EQ(8U, offset);
+}
+
+TEST(DataExtractorTest, GetMaxS64) {
+ uint8_t buffer[] = {0x01, 0x02, 0x83, 0x04, 0x05, 0x06, 0x07, 0x08};
+ DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
+ sizeof(void *));
+ DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
+
+ lldb::offset_t offset;
+
+ // Check with the minimum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x01, LE.GetMaxS64(&offset, 1));
+ EXPECT_EQ(1U, offset);
+ offset = 0;
+ EXPECT_EQ(0x01, BE.GetMaxS64(&offset, 1));
+ EXPECT_EQ(1U, offset);
+
+ // Check that sign extension works correctly.
+ offset = 0;
+ int64_t value = LE.GetMaxS64(&offset, 3);
+ EXPECT_EQ(0xffffffffff830201U, *reinterpret_cast<uint64_t *>(&value));
+ EXPECT_EQ(3U, offset);
+ offset = 2;
+ value = BE.GetMaxS64(&offset, 3);
+ EXPECT_EQ(0xffffffffff830405U, *reinterpret_cast<uint64_t *>(&value));
+ EXPECT_EQ(5U, offset);
+
+ // Check with the maximum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x0807060504830201, LE.GetMaxS64(&offset, 8));
+ EXPECT_EQ(8U, offset);
+ offset = 0;
+ EXPECT_EQ(0x0102830405060708, BE.GetMaxS64(&offset, 8));
+ EXPECT_EQ(8U, offset);
+}
+
+TEST(DataExtractorTest, GetMaxU64_unchecked) {
+ uint8_t buffer[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
+ DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
+ sizeof(void *));
+ DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
+
+ lldb::offset_t offset;
+
+ // Check with the minimum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x01U, LE.GetMaxU64_unchecked(&offset, 1));
+ EXPECT_EQ(1U, offset);
+ offset = 0;
+ EXPECT_EQ(0x01U, BE.GetMaxU64_unchecked(&offset, 1));
+ EXPECT_EQ(1U, offset);
+
+ // Check with a non-zero offset.
+ offset = 1;
+ EXPECT_EQ(0x0302U, LE.GetMaxU64_unchecked(&offset, 2));
+ EXPECT_EQ(3U, offset);
+ offset = 1;
+ EXPECT_EQ(0x0203U, BE.GetMaxU64_unchecked(&offset, 2));
+ EXPECT_EQ(3U, offset);
+
+ // Check with the byte size not being a multiple of 2.
+ offset = 0;
+ EXPECT_EQ(0x07060504030201U, LE.GetMaxU64_unchecked(&offset, 7));
+ EXPECT_EQ(7U, offset);
+ offset = 0;
+ EXPECT_EQ(0x01020304050607U, BE.GetMaxU64_unchecked(&offset, 7));
+ EXPECT_EQ(7U, offset);
+
+ // Check with the maximum allowed byte size.
+ offset = 0;
+ EXPECT_EQ(0x0807060504030201U, LE.GetMaxU64_unchecked(&offset, 8));
+ EXPECT_EQ(8U, offset);
+ offset = 0;
+ EXPECT_EQ(0x0102030405060708U, BE.GetMaxU64_unchecked(&offset, 8));
+ EXPECT_EQ(8U, offset);
+}
diff --git a/unittests/Editline/EditlineTest.cpp b/unittests/Editline/EditlineTest.cpp
index 668d1f542128..963d9043e994 100644
--- a/unittests/Editline/EditlineTest.cpp
+++ b/unittests/Editline/EditlineTest.cpp
@@ -25,6 +25,8 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StringList.h"
+using namespace lldb_private;
+
namespace {
const size_t TIMEOUT_MILLIS = 5000;
}
@@ -81,7 +83,7 @@ private:
std::unique_ptr<lldb_private::Editline> _editline_sp;
- lldb_utility::PseudoTerminal _pty;
+ PseudoTerminal _pty;
int _pty_master_fd;
int _pty_slave_fd;
diff --git a/unittests/Host/CMakeLists.txt b/unittests/Host/CMakeLists.txt
index 0c42eb533fa0..238026b64c4d 100644
--- a/unittests/Host/CMakeLists.txt
+++ b/unittests/Host/CMakeLists.txt
@@ -1,11 +1,13 @@
set (FILES
FileSpecTest.cpp
FileSystemTest.cpp
+ HostInfoTest.cpp
HostTest.cpp
MainLoopTest.cpp
SocketAddressTest.cpp
SocketTest.cpp
SymbolsTest.cpp
+ TaskPoolTest.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
diff --git a/unittests/Host/HostInfoTest.cpp b/unittests/Host/HostInfoTest.cpp
new file mode 100644
index 000000000000..75b8c770bbeb
--- /dev/null
+++ b/unittests/Host/HostInfoTest.cpp
@@ -0,0 +1,45 @@
+//===-- HostInfoTest.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/HostInfo.h"
+#include "lldb/lldb-defines.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace llvm;
+
+namespace {
+class HostInfoTest: public ::testing::Test {
+ public:
+ void SetUp() override { HostInfo::Initialize(); }
+ void TearDown() override { HostInfo::Terminate(); }
+};
+}
+
+TEST_F(HostInfoTest, GetAugmentedArchSpec) {
+ // Fully specified triple should not be changed.
+ ArchSpec spec = HostInfo::GetAugmentedArchSpec("x86_64-pc-linux-gnu");
+ EXPECT_EQ(spec.GetTriple().getTriple(), "x86_64-pc-linux-gnu");
+
+ // Same goes if we specify at least one of (os, vendor, env).
+ spec = HostInfo::GetAugmentedArchSpec("x86_64-pc");
+ EXPECT_EQ(spec.GetTriple().getTriple(), "x86_64-pc");
+
+ // But if we specify only an arch, we should fill in the rest from the host.
+ spec = HostInfo::GetAugmentedArchSpec("x86_64");
+ Triple triple(sys::getDefaultTargetTriple());
+ EXPECT_EQ(spec.GetTriple().getArch(), Triple::x86_64);
+ EXPECT_EQ(spec.GetTriple().getOS(), triple.getOS());
+ EXPECT_EQ(spec.GetTriple().getVendor(), triple.getVendor());
+ EXPECT_EQ(spec.GetTriple().getEnvironment(), triple.getEnvironment());
+
+ // Test LLDB_ARCH_DEFAULT
+ EXPECT_EQ(HostInfo::GetAugmentedArchSpec(LLDB_ARCH_DEFAULT).GetTriple(),
+ HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple());
+}
diff --git a/unittests/Host/MainLoopTest.cpp b/unittests/Host/MainLoopTest.cpp
index 3a39ea1c9ac7..8f2c55c2416d 100644
--- a/unittests/Host/MainLoopTest.cpp
+++ b/unittests/Host/MainLoopTest.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/MainLoop.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Host/common/TCPSocket.h"
#include "gtest/gtest.h"
#include <future>
@@ -107,6 +109,24 @@ TEST_F(MainLoopTest, TerminatesImmediately) {
}
#ifdef LLVM_ON_UNIX
+TEST_F(MainLoopTest, DetectsEOF) {
+ PseudoTerminal term;
+ ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
+ ASSERT_TRUE(term.OpenSlave(O_RDWR | O_NOCTTY, nullptr, 0));
+ auto conn = llvm::make_unique<ConnectionFileDescriptor>(
+ term.ReleaseMasterFileDescriptor(), true);
+
+ Status error;
+ MainLoop loop;
+ auto handle =
+ loop.RegisterReadObject(conn->GetReadObject(), make_callback(), error);
+ ASSERT_TRUE(error.Success());
+ term.CloseSlaveFileDescriptor();
+
+ ASSERT_TRUE(loop.Run().Success());
+ ASSERT_EQ(1u, callback_count);
+}
+
TEST_F(MainLoopTest, Signal) {
MainLoop loop;
Status error;
diff --git a/unittests/Utility/TaskPoolTest.cpp b/unittests/Host/TaskPoolTest.cpp
index e340a81b27db..fea544267957 100644
--- a/unittests/Utility/TaskPoolTest.cpp
+++ b/unittests/Host/TaskPoolTest.cpp
@@ -1,6 +1,8 @@
#include "gtest/gtest.h"
-#include "lldb/Utility/TaskPool.h"
+#include "lldb/Host/TaskPool.h"
+
+using namespace lldb_private;
TEST(TaskPoolTest, AddTask) {
auto fn = [](int x) { return x * x + 1; };
diff --git a/unittests/Interpreter/CMakeLists.txt b/unittests/Interpreter/CMakeLists.txt
index 7be092b24b5e..40fc45d4d640 100644
--- a/unittests/Interpreter/CMakeLists.txt
+++ b/unittests/Interpreter/CMakeLists.txt
@@ -8,5 +8,6 @@ add_lldb_unittest(InterpreterTests
)
target_link_libraries(InterpreterTests
+ PRIVATE
${PYTHON_LIBRARY}
)
diff --git a/unittests/Interpreter/TestArgs.cpp b/unittests/Interpreter/TestArgs.cpp
index 2aeed0f542b1..2aaaab84e211 100644
--- a/unittests/Interpreter/TestArgs.cpp
+++ b/unittests/Interpreter/TestArgs.cpp
@@ -10,6 +10,7 @@
#include "gtest/gtest.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/StringList.h"
#include <limits>
#include <sstream>
@@ -117,6 +118,16 @@ TEST(ArgsTest, TestArgv) {
EXPECT_EQ(nullptr, args.GetArgumentVector()[5]);
}
+TEST(ArgsTest, StringListConstructor) {
+ StringList list;
+ list << "foo" << "bar" << "baz";
+ Args args(list);
+ ASSERT_EQ(3u, args.GetArgumentCount());
+ EXPECT_EQ("foo", args[0].ref);
+ EXPECT_EQ("bar", args[1].ref);
+ EXPECT_EQ("baz", args[2].ref);
+}
+
TEST(ArgsTest, GetQuotedCommandString) {
Args args;
const char *str = "process launch -o stdout.txt -- \"a b c\"";
diff --git a/unittests/Interpreter/TestCompletion.cpp b/unittests/Interpreter/TestCompletion.cpp
index 0baf61fdaf34..5db7f83db0f9 100644
--- a/unittests/Interpreter/TestCompletion.cpp
+++ b/unittests/Interpreter/TestCompletion.cpp
@@ -12,7 +12,7 @@
#include "lldb/Utility/StringList.h"
#include "lldb/Utility/TildeExpressionResolver.h"
-#include "unittests/Utility/Helpers/MockTildeExpressionResolver.h"
+#include "TestingSupport/MockTildeExpressionResolver.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
diff --git a/unittests/ObjectFile/ELF/TestObjectFileELF.cpp b/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
index e9b3e9fcf237..056799ee9191 100644
--- a/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ b/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -10,11 +10,13 @@
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/HostInfo.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/Compression.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
@@ -61,7 +63,8 @@ TEST_F(ObjectFileELFTest, SectionsResolveConsistently) {
llvm::FileRemover remover(obj);
const char *args[] = {YAML2OBJ, yaml.c_str(), nullptr};
llvm::StringRef obj_ref = obj;
- const llvm::StringRef *redirects[] = {nullptr, &obj_ref, nullptr};
+ const llvm::Optional<llvm::StringRef> redirects[] = {llvm::None, obj_ref,
+ llvm::None};
ASSERT_EQ(0, llvm::sys::ExecuteAndWait(YAML2OBJ, args, nullptr, redirects));
uint64_t size;
ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size));
diff --git a/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 90a9c7ea7a0f..1d7632a67a30 100644
--- a/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -197,27 +197,53 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) {
EXPECT_EQ(1234u, result.getValue()[0].GetObjectSize());
}
+TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) {
+ llvm::Triple triple("i386-pc-linux");
+
+ FileSpec file_spec("/foo/bar.so", false, FileSpec::ePathSyntaxPosix);
+ std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
+ std::async(std::launch::async,
+ [&] { return client.GetModulesInfo(file_spec, triple); });
+ HandlePacket(
+ server,
+ "jModulesInfo:["
+ R"({"file":"/foo/bar.so","triple":"i386-pc-linux"}])",
+ R"([{"uuid":"404142434445464748494a4b4c4d4e4f50515253","triple":"i386-pc-linux",)"
+ R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])");
+
+ auto result = async_result.get();
+ ASSERT_TRUE(result.hasValue());
+ ASSERT_EQ(1u, result->size());
+ EXPECT_EQ("/foo/bar.so", result.getValue()[0].GetFileSpec().GetPath());
+ EXPECT_EQ(triple, result.getValue()[0].GetArchitecture().GetTriple());
+ EXPECT_EQ(UUID("@ABCDEFGHIJKLMNOPQRS", 20), result.getValue()[0].GetUUID());
+ EXPECT_EQ(0u, result.getValue()[0].GetObjectOffset());
+ EXPECT_EQ(1234u, result.getValue()[0].GetObjectSize());
+}
+
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) {
llvm::Triple triple("i386-pc-linux");
FileSpec file_spec("/foo/bar.so", false, FileSpec::ePathSyntaxPosix);
const char *invalid_responses[] = {
- "OK", "E47", "[]",
// no UUID
R"([{"triple":"i386-pc-linux",)"
- R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}])",
+ R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])",
+ // invalid UUID
+ R"([{"uuid":"XXXXXX","triple":"i386-pc-linux",)"
+ R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])",
// no triple
R"([{"uuid":"404142434445464748494a4b4c4d4e4f",)"
- R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}])",
+ R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])",
// no file_path
R"([{"uuid":"404142434445464748494a4b4c4d4e4f","triple":"i386-pc-linux",)"
- R"("file_offset":0,"file_size":1234}])",
+ R"("file_offset":0,"file_size":1234}]])",
// no file_offset
R"([{"uuid":"404142434445464748494a4b4c4d4e4f","triple":"i386-pc-linux",)"
- R"("file_path":"/foo/bar.so","file_size":1234}])",
+ R"("file_path":"/foo/bar.so","file_size":1234}]])",
// no file_size
R"([{"uuid":"404142434445464748494a4b4c4d4e4f","triple":"i386-pc-linux",)"
- R"("file_path":"/foo/bar.so","file_offset":0}])",
+ R"("file_path":"/foo/bar.so","file_offset":0}]])",
};
for (const char *response : invalid_responses) {
@@ -229,7 +255,9 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) {
R"(jModulesInfo:[{"file":"/foo/bar.so","triple":"i386-pc-linux"}])",
response);
- ASSERT_FALSE(async_result.get().hasValue()) << "response was: " << response;
+ auto result = async_result.get();
+ ASSERT_TRUE(result);
+ ASSERT_EQ(0u, result->size()) << "response was: " << response;
}
}
diff --git a/unittests/Process/minidump/MinidumpParserTest.cpp b/unittests/Process/minidump/MinidumpParserTest.cpp
index a029466fc59e..7aceb0e16dcf 100644
--- a/unittests/Process/minidump/MinidumpParserTest.cpp
+++ b/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -15,20 +15,18 @@
#include "Plugins/Process/minidump/RegisterContextMinidump_x86_32.h"
#include "Plugins/Process/minidump/RegisterContextMinidump_x86_64.h"
-// Other libraries and framework includes
-#include "gtest/gtest.h"
-
-#include "lldb/Core/ArchSpec.h"
+#include "TestingSupport/TestUtilities.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/FileSpec.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
+#include "gtest/gtest.h"
// C includes
diff --git a/unittests/Symbol/TestClangASTContext.cpp b/unittests/Symbol/TestClangASTContext.cpp
index ed49c2657c7a..9fe804708378 100644
--- a/unittests/Symbol/TestClangASTContext.cpp
+++ b/unittests/Symbol/TestClangASTContext.cpp
@@ -376,3 +376,59 @@ TEST_F(TestClangASTContext, TestRecordHasFields) {
EXPECT_TRUE(
ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
}
+
+TEST_F(TestClangASTContext, TemplateArguments) {
+ ClangASTContext::TemplateParameterInfos infos;
+ infos.names.push_back("T");
+ infos.args.push_back(TemplateArgument(m_ast->getASTContext()->IntTy));
+ infos.names.push_back("I");
+ llvm::APSInt arg(llvm::APInt(8, 47));
+ infos.args.push_back(TemplateArgument(*m_ast->getASTContext(), arg,
+ m_ast->getASTContext()->IntTy));
+
+ // template<typename T, int I> struct foo;
+ ClassTemplateDecl *decl = m_ast->CreateClassTemplateDecl(
+ m_ast->GetTranslationUnitDecl(), eAccessPublic, "foo", TTK_Struct, infos);
+ ASSERT_NE(decl, nullptr);
+
+ // foo<int, 47>
+ ClassTemplateSpecializationDecl *spec_decl =
+ m_ast->CreateClassTemplateSpecializationDecl(
+ m_ast->GetTranslationUnitDecl(), decl, TTK_Struct, infos);
+ ASSERT_NE(spec_decl, nullptr);
+ CompilerType type = m_ast->CreateClassTemplateSpecializationType(spec_decl);
+ ASSERT_TRUE(type);
+ m_ast->StartTagDeclarationDefinition(type);
+ m_ast->CompleteTagDeclarationDefinition(type);
+
+ // typedef foo<int, 47> foo_def;
+ CompilerType typedef_type = m_ast->CreateTypedefType(
+ type, "foo_def",
+ CompilerDeclContext(m_ast.get(), m_ast->GetTranslationUnitDecl()));
+
+ CompilerType auto_type(m_ast->getASTContext(),
+ m_ast->getASTContext()->getAutoType(
+ ClangUtil::GetCanonicalQualType(typedef_type),
+ clang::AutoTypeKeyword::Auto, false));
+
+ CompilerType int_type(m_ast->getASTContext(), m_ast->getASTContext()->IntTy);
+ for(CompilerType t: { type, typedef_type, auto_type }) {
+ SCOPED_TRACE(t.GetTypeName().AsCString());
+
+ EXPECT_EQ(m_ast->GetTemplateArgumentKind(t.GetOpaqueQualType(), 0),
+ eTemplateArgumentKindType);
+ EXPECT_EQ(m_ast->GetTypeTemplateArgument(t.GetOpaqueQualType(), 0),
+ int_type);
+ EXPECT_EQ(llvm::None,
+ m_ast->GetIntegralTemplateArgument(t.GetOpaqueQualType(), 0));
+
+ EXPECT_EQ(m_ast->GetTemplateArgumentKind(t.GetOpaqueQualType(), 1),
+ eTemplateArgumentKindIntegral);
+ EXPECT_EQ(m_ast->GetTypeTemplateArgument(t.GetOpaqueQualType(), 1),
+ CompilerType());
+ auto result = m_ast->GetIntegralTemplateArgument(t.GetOpaqueQualType(), 1);
+ ASSERT_NE(llvm::None, result);
+ EXPECT_EQ(arg, result->value);
+ EXPECT_EQ(int_type, result->type);
+ }
+}
diff --git a/unittests/Symbol/TestDWARFCallFrameInfo.cpp b/unittests/Symbol/TestDWARFCallFrameInfo.cpp
index 40e3aac5fb37..85cb4a72b95c 100644
--- a/unittests/Symbol/TestDWARFCallFrameInfo.cpp
+++ b/unittests/Symbol/TestDWARFCallFrameInfo.cpp
@@ -16,7 +16,7 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Utility/StreamString.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
+#include "TestingSupport/TestUtilities.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
@@ -98,7 +98,8 @@ void DWARFCallFrameInfoTest::TestBasic(DWARFCallFrameInfo::Type type,
const char *args[] = {YAML2OBJ, yaml.c_str(), nullptr};
llvm::StringRef obj_ref = obj;
- const llvm::StringRef *redirects[] = {nullptr, &obj_ref, nullptr};
+ const llvm::Optional<llvm::StringRef> redirects[] = {llvm::None, obj_ref,
+ llvm::None};
ASSERT_EQ(0, llvm::sys::ExecuteAndWait(YAML2OBJ, args, nullptr, redirects));
uint64_t size;
diff --git a/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp b/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
index 298bed10f3f8..743b91a28791 100644
--- a/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ b/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -18,8 +18,8 @@
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
+#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/HostInfo.h"
@@ -27,8 +27,8 @@
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
using namespace lldb_private;
diff --git a/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 0e63a4104234..1e9cf1700642 100644
--- a/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -18,8 +18,8 @@
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
+#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/HostInfo.h"
@@ -27,8 +27,8 @@
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
#if defined(_MSC_VER)
#include "lldb/Host/windows/windows.h"
diff --git a/unittests/Target/ModuleCacheTest.cpp b/unittests/Target/ModuleCacheTest.cpp
index 122d789daf57..de07648ae00b 100644
--- a/unittests/Target/ModuleCacheTest.cpp
+++ b/unittests/Target/ModuleCacheTest.cpp
@@ -10,7 +10,7 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ModuleCache.h"
-#include "unittests/Utility/Helpers/TestUtilities.h"
+#include "TestingSupport/TestUtilities.h"
using namespace lldb_private;
using namespace lldb;
diff --git a/unittests/Utility/Helpers/CMakeLists.txt b/unittests/TestingSupport/CMakeLists.txt
index 36c774cb6826..36c774cb6826 100644
--- a/unittests/Utility/Helpers/CMakeLists.txt
+++ b/unittests/TestingSupport/CMakeLists.txt
diff --git a/unittests/Utility/Helpers/MockTildeExpressionResolver.cpp b/unittests/TestingSupport/MockTildeExpressionResolver.cpp
index 832836682b50..832836682b50 100644
--- a/unittests/Utility/Helpers/MockTildeExpressionResolver.cpp
+++ b/unittests/TestingSupport/MockTildeExpressionResolver.cpp
diff --git a/unittests/Utility/Helpers/MockTildeExpressionResolver.h b/unittests/TestingSupport/MockTildeExpressionResolver.h
index 18be1102e1fd..18be1102e1fd 100644
--- a/unittests/Utility/Helpers/MockTildeExpressionResolver.h
+++ b/unittests/TestingSupport/MockTildeExpressionResolver.h
diff --git a/unittests/Utility/Helpers/TestUtilities.cpp b/unittests/TestingSupport/TestUtilities.cpp
index eacf87661420..eacf87661420 100644
--- a/unittests/Utility/Helpers/TestUtilities.cpp
+++ b/unittests/TestingSupport/TestUtilities.cpp
diff --git a/unittests/Utility/Helpers/TestUtilities.h b/unittests/TestingSupport/TestUtilities.h
index 8d848797b7b2..8d848797b7b2 100644
--- a/unittests/Utility/Helpers/TestUtilities.h
+++ b/unittests/TestingSupport/TestUtilities.h
diff --git a/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp b/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
index d7caf4281d5d..ab28cb637d8d 100644
--- a/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
+++ b/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
@@ -17,9 +17,9 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/UnwindAssembly.h"
+#include "lldb/Utility/ArchSpec.h"
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
@@ -55,7 +55,7 @@ void TestArm64InstEmulation::TearDownTestCase() {
}
TEST_F(TestArm64InstEmulation, TestSimpleDarwinFunction) {
- ArchSpec arch("arm64-apple-ios10", nullptr);
+ ArchSpec arch("arm64-apple-ios10");
UnwindAssemblyInstEmulation *engine =
static_cast<UnwindAssemblyInstEmulation *>(
UnwindAssemblyInstEmulation::CreateInstance(arch));
@@ -151,7 +151,7 @@ TEST_F(TestArm64InstEmulation, TestSimpleDarwinFunction) {
}
TEST_F(TestArm64InstEmulation, TestMediumDarwinFunction) {
- ArchSpec arch("arm64-apple-ios10", nullptr);
+ ArchSpec arch("arm64-apple-ios10");
UnwindAssemblyInstEmulation *engine =
static_cast<UnwindAssemblyInstEmulation *>(
UnwindAssemblyInstEmulation::CreateInstance(arch));
@@ -313,7 +313,7 @@ TEST_F(TestArm64InstEmulation, TestMediumDarwinFunction) {
}
TEST_F(TestArm64InstEmulation, TestFramelessThreeEpilogueFunction) {
- ArchSpec arch("arm64-apple-ios10", nullptr);
+ ArchSpec arch("arm64-apple-ios10");
UnwindAssemblyInstEmulation *engine =
static_cast<UnwindAssemblyInstEmulation *>(
UnwindAssemblyInstEmulation::CreateInstance(arch));
@@ -408,7 +408,7 @@ TEST_F(TestArm64InstEmulation, TestFramelessThreeEpilogueFunction) {
}
TEST_F(TestArm64InstEmulation, TestRegisterSavedTwice) {
- ArchSpec arch("arm64-apple-ios10", nullptr);
+ ArchSpec arch("arm64-apple-ios10");
UnwindAssemblyInstEmulation *engine =
static_cast<UnwindAssemblyInstEmulation *>(
UnwindAssemblyInstEmulation::CreateInstance(arch));
@@ -510,7 +510,7 @@ TEST_F(TestArm64InstEmulation, TestRegisterSavedTwice) {
}
TEST_F(TestArm64InstEmulation, TestRegisterDoubleSpills) {
- ArchSpec arch("arm64-apple-ios10", nullptr);
+ ArchSpec arch("arm64-apple-ios10");
UnwindAssemblyInstEmulation *engine =
static_cast<UnwindAssemblyInstEmulation *>(
UnwindAssemblyInstEmulation::CreateInstance(arch));
diff --git a/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp b/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
index c3591b2d73e1..f0c9cefeb7b0 100644
--- a/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
+++ b/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
@@ -16,8 +16,8 @@
#include "Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/Support/TargetSelect.h"
@@ -95,7 +95,7 @@ enum i386_regs {
std::unique_ptr<x86AssemblyInspectionEngine> Getx86_64Inspector() {
- ArchSpec arch("x86_64-apple-macosx", nullptr);
+ ArchSpec arch("x86_64-apple-macosx");
std::unique_ptr<x86AssemblyInspectionEngine> engine(
new x86AssemblyInspectionEngine(arch));
@@ -114,7 +114,7 @@ std::unique_ptr<x86AssemblyInspectionEngine> Getx86_64Inspector() {
std::unique_ptr<x86AssemblyInspectionEngine> Geti386Inspector() {
- ArchSpec arch("i386-apple-macosx", nullptr);
+ ArchSpec arch("i386-apple-macosx");
std::unique_ptr<x86AssemblyInspectionEngine> engine(
new x86AssemblyInspectionEngine(arch));
diff --git a/unittests/Core/ArchSpecTest.cpp b/unittests/Utility/ArchSpecTest.cpp
index 98b77e1826b1..a45e28e658b8 100644
--- a/unittests/Core/ArchSpecTest.cpp
+++ b/unittests/Utility/ArchSpecTest.cpp
@@ -9,8 +9,7 @@
#include "gtest/gtest.h"
-#include "lldb/Core/ArchSpec.h"
-
+#include "lldb/Utility/ArchSpec.h"
#include "llvm/BinaryFormat/MachO.h"
using namespace lldb;
diff --git a/unittests/Utility/CMakeLists.txt b/unittests/Utility/CMakeLists.txt
index 91cdbbda3ec3..13f840af2bb9 100644
--- a/unittests/Utility/CMakeLists.txt
+++ b/unittests/Utility/CMakeLists.txt
@@ -1,13 +1,12 @@
-add_subdirectory(Helpers)
-
add_lldb_unittest(UtilityTests
+ ArchSpecTest.cpp
ConstStringTest.cpp
+ JSONTest.cpp
LogTest.cpp
NameMatchesTest.cpp
StatusTest.cpp
StringExtractorTest.cpp
StructuredDataTest.cpp
- TaskPoolTest.cpp
TildeExpressionResolverTest.cpp
TimeoutTest.cpp
TimerTest.cpp
diff --git a/unittests/Utility/JSONTest.cpp b/unittests/Utility/JSONTest.cpp
new file mode 100644
index 000000000000..0c23350517ce
--- /dev/null
+++ b/unittests/Utility/JSONTest.cpp
@@ -0,0 +1,26 @@
+#include "gtest/gtest.h"
+
+#include "lldb/Utility/JSON.h"
+#include "lldb/Utility/StreamString.h"
+
+using namespace lldb_private;
+
+TEST(JSONTest, Dictionary) {
+ JSONObject o;
+ o.SetObject("key", std::make_shared<JSONString>("value"));
+
+ StreamString stream;
+ o.Write(stream);
+
+ ASSERT_EQ(stream.GetString(), R"({"key":"value"})");
+}
+
+TEST(JSONTest, Newlines) {
+ JSONObject o;
+ o.SetObject("key", std::make_shared<JSONString>("hello\nworld"));
+
+ StreamString stream;
+ o.Write(stream);
+
+ ASSERT_EQ(stream.GetString(), R"({"key":"hello\nworld"})");
+}
diff --git a/unittests/Utility/StructuredDataTest.cpp b/unittests/Utility/StructuredDataTest.cpp
index f346dd9e8322..15a2ca6bf70a 100644
--- a/unittests/Utility/StructuredDataTest.cpp
+++ b/unittests/Utility/StructuredDataTest.cpp
@@ -9,7 +9,7 @@
#include "gtest/gtest.h"
-#include "Helpers/TestUtilities.h"
+#include "TestingSupport/TestUtilities.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StructuredData.h"
diff --git a/unittests/Utility/TildeExpressionResolverTest.cpp b/unittests/Utility/TildeExpressionResolverTest.cpp
index a24e998cb81d..bc1ca7a44811 100644
--- a/unittests/Utility/TildeExpressionResolverTest.cpp
+++ b/unittests/Utility/TildeExpressionResolverTest.cpp
@@ -1,6 +1,6 @@
#include "gtest/gtest.h"
-#include "Helpers/MockTildeExpressionResolver.h"
+#include "TestingSupport/MockTildeExpressionResolver.h"
#include "lldb/Utility/TildeExpressionResolver.h"
#include "llvm/ADT/SmallString.h"
diff --git a/unittests/Utility/VASprintfTest.cpp b/unittests/Utility/VASprintfTest.cpp
index 0b440942eb5a..cb5b2533688e 100644
--- a/unittests/Utility/VASprintfTest.cpp
+++ b/unittests/Utility/VASprintfTest.cpp
@@ -14,6 +14,12 @@
#include <locale.h>
+#if defined (_WIN32)
+#define TEST_ENCODING ".932" // On Windows, test codepage 932
+#else
+#define TEST_ENCODING "C" // ...otherwise, any widely available uni-byte LC
+#endif
+
using namespace lldb_private;
using namespace llvm;
@@ -46,7 +52,8 @@ TEST(VASprintfTest, EncodingError) {
// Save the current locale first.
std::string Current(::setlocale(LC_ALL, nullptr));
- setlocale(LC_ALL, ".932");
+ // Ensure tested locale is successfully set
+ ASSERT_TRUE(setlocale(LC_ALL, TEST_ENCODING));
wchar_t Invalid[2];
Invalid[0] = 0x100;
@@ -55,5 +62,6 @@ TEST(VASprintfTest, EncodingError) {
EXPECT_FALSE(Sprintf(Buffer, "%ls", Invalid));
EXPECT_EQ("<Encoding error>", Buffer);
- setlocale(LC_ALL, Current.c_str());
+ // Ensure we've restored the original locale once tested
+ ASSERT_TRUE(setlocale(LC_ALL, Current.c_str()));
}
diff --git a/unittests/debugserver/CMakeLists.txt b/unittests/debugserver/CMakeLists.txt
index cfb520a0dc76..adb8fb00ddac 100644
--- a/unittests/debugserver/CMakeLists.txt
+++ b/unittests/debugserver/CMakeLists.txt
@@ -17,3 +17,22 @@ add_lldb_unittest(debugserverTests
LINK_COMPONENTS
Support
)
+
+if(IOS)
+ set_property(TARGET debugserverTests APPEND PROPERTY COMPILE_DEFINITIONS
+ WITH_LOCKDOWN
+ WITH_FBS
+ WITH_BKS
+ )
+
+ add_lldb_unittest(debugserverNonUITests
+ RNBSocketTest.cpp
+ debugserver_LogCallback.cpp
+
+ LINK_LIBS
+ lldbDebugserverCommon_NonUI
+ lldbHost
+ LINK_COMPONENTS
+ Support
+ )
+endif()
diff --git a/unittests/tools/CMakeLists.txt b/unittests/tools/CMakeLists.txt
index 2d41864d98f4..e3816217bb4b 100644
--- a/unittests/tools/CMakeLists.txt
+++ b/unittests/tools/CMakeLists.txt
@@ -1,3 +1,3 @@
-if(CMAKE_SYSTEM_NAME MATCHES "Android|Linux|NetBSD")
+if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
add_subdirectory(lldb-server)
endif()
diff --git a/unittests/tools/lldb-server/CMakeLists.txt b/unittests/tools/lldb-server/CMakeLists.txt
index b7113c3d260c..8641e8ddb5c9 100644
--- a/unittests/tools/lldb-server/CMakeLists.txt
+++ b/unittests/tools/lldb-server/CMakeLists.txt
@@ -1,13 +1,25 @@
+set(ALL_LLDB_TEST_EXECUTABLES)
+
function(add_lldb_test_executable test_name)
set(EXCLUDE_FROM_ALL ON)
add_llvm_executable(${test_name} NO_INSTALL_RPATH ${ARGN})
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
+ list(APPEND ALL_LLDB_TEST_EXECUTABLES ${test_name})
+ set(ALL_LLDB_TEST_EXECUTABLES ${ALL_LLDB_TEST_EXECUTABLES} PARENT_SCOPE)
endfunction()
add_lldb_test_executable(thread_inferior inferior/thread_inferior.cpp)
+add_lldb_test_executable(environment_check inferior/environment_check.cpp)
+
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ add_definitions(-DLLDB_SERVER="$<TARGET_FILE:debugserver>")
+else()
+ add_definitions(-DLLDB_SERVER="$<TARGET_FILE:lldb-server>")
+endif()
-add_definitions(-DLLDB_SERVER="$<TARGET_FILE:lldb-server>")
-add_definitions(-DTHREAD_INFERIOR="${CMAKE_CURRENT_BINARY_DIR}/thread_inferior")
+add_definitions(
+ -DLLDB_TEST_INFERIOR_PATH="${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
+ -DLLDB_TEST_INFERIOR_SUFFIX="${CMAKE_EXECUTABLE_SUFFIX}"
+ )
add_subdirectory(tests)
-add_dependencies(LLDBServerTests thread_inferior)
diff --git a/unittests/tools/lldb-server/inferior/environment_check.cpp b/unittests/tools/lldb-server/inferior/environment_check.cpp
new file mode 100644
index 000000000000..d2a5ede0cabf
--- /dev/null
+++ b/unittests/tools/lldb-server/inferior/environment_check.cpp
@@ -0,0 +1,20 @@
+//===-- thread_inferior.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <string>
+#include <cstdlib>
+
+int main() {
+ const char *value = std::getenv("LLDB_TEST_MAGIC_VARIABLE");
+ if (!value)
+ return 1;
+ if (std::string(value) != "LLDB_TEST_MAGIC_VALUE")
+ return 2;
+ return 0;
+}
diff --git a/unittests/tools/lldb-server/tests/CMakeLists.txt b/unittests/tools/lldb-server/tests/CMakeLists.txt
index 4ef4165b27fe..ed5eb88ba527 100644
--- a/unittests/tools/lldb-server/tests/CMakeLists.txt
+++ b/unittests/tools/lldb-server/tests/CMakeLists.txt
@@ -1,6 +1,8 @@
add_lldb_unittest(LLDBServerTests
- TestClient.cpp
+ LLGSTest.cpp
MessageObjects.cpp
+ TestBase.cpp
+ TestClient.cpp
ThreadIdsInJstopinfoTest.cpp
LINK_LIBS
@@ -10,6 +12,10 @@ add_lldb_unittest(LLDBServerTests
lldbTarget
lldbPluginPlatformLinux
lldbPluginProcessGDBRemote
+
+ LLVMTestingSupport
LINK_COMPONENTS
Support
)
+
+add_dependencies(LLDBServerTests lldb-server ${ALL_LLDB_TEST_EXECUTABLES})
diff --git a/unittests/tools/lldb-server/tests/LLGSTest.cpp b/unittests/tools/lldb-server/tests/LLGSTest.cpp
new file mode 100644
index 000000000000..75d964ed26f4
--- /dev/null
+++ b/unittests/tools/lldb-server/tests/LLGSTest.cpp
@@ -0,0 +1,36 @@
+//===-- LLGSTest.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "TestBase.h"
+#include "lldb/Host/Host.h"
+#include "llvm/Testing/Support/Error.h"
+
+using namespace llgs_tests;
+using namespace lldb_private;
+using namespace llvm;
+
+TEST_F(TestBase, LaunchModePreservesEnvironment) {
+ if (TestClient::IsDebugServer()) {
+ GTEST_LOG_(WARNING) << "Test fails with debugserver: llvm.org/pr35671";
+ return;
+ }
+
+ putenv(const_cast<char *>("LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE"));
+
+ auto ClientOr = TestClient::launch(getLogFileName(),
+ {getInferiorPath("environment_check")});
+ ASSERT_THAT_EXPECTED(ClientOr, Succeeded());
+ auto &Client = **ClientOr;
+
+ ASSERT_THAT_ERROR(Client.ContinueAll(), Succeeded());
+ ASSERT_THAT_EXPECTED(
+ Client.GetLatestStopReplyAs<StopReplyExit>(),
+ HasValue(testing::Property(&StopReply::getKind,
+ WaitStatus{WaitStatus::Exit, 0})));
+}
diff --git a/unittests/tools/lldb-server/tests/MessageObjects.cpp b/unittests/tools/lldb-server/tests/MessageObjects.cpp
index 6ac067bce062..e5927d037f98 100644
--- a/unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ b/unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -19,7 +19,7 @@ namespace llgs_tests {
Expected<ProcessInfo> ProcessInfo::Create(StringRef response) {
ProcessInfo process_info;
- auto elements_or_error = SplitPairList("ProcessInfo", response);
+ auto elements_or_error = SplitUniquePairList("ProcessInfo", response);
if (!elements_or_error)
return elements_or_error.takeError();
@@ -65,19 +65,16 @@ StringRef ThreadInfo::ReadRegister(unsigned int register_id) const {
return m_registers.lookup(register_id);
}
-bool ThreadInfo::ReadRegisterAsUint64(unsigned int register_id,
- uint64_t &value) const {
+Expected<uint64_t>
+ThreadInfo::ReadRegisterAsUint64(unsigned int register_id) const {
+ uint64_t value;
std::string value_str(m_registers.lookup(register_id));
- if (!llvm::to_integer(value_str, value, 16)) {
- GTEST_LOG_(ERROR)
- << formatv("ThreadInfo: Unable to parse register value at {0}.",
- register_id)
- .str();
- return false;
- }
+ if (!llvm::to_integer(value_str, value, 16))
+ return make_parsing_error("ThreadInfo value for register {0}: {1}",
+ register_id, value_str);
sys::swapByteOrder(value);
- return true;
+ return value;
}
//====== JThreadsInfo ==========================================================
@@ -136,60 +133,96 @@ const ThreadInfoMap &JThreadsInfo::GetThreadInfos() const {
}
//====== StopReply =============================================================
-const U64Map &StopReply::GetThreadPcs() const { return m_thread_pcs; }
+Expected<std::unique_ptr<StopReply>>
+StopReply::create(StringRef Response, llvm::support::endianness Endian) {
+ if (Response.size() < 3)
+ return make_parsing_error("StopReply: Invalid packet");
+ if (Response.consume_front("T"))
+ return StopReplyStop::create(Response, Endian);
+ if (Response.consume_front("W"))
+ return StopReplyExit::create(Response);
+ return make_parsing_error("StopReply: Invalid packet");
+}
-Expected<StopReply> StopReply::Create(StringRef response,
- llvm::support::endianness endian) {
- StopReply stop_reply;
+Expected<std::unique_ptr<StopReplyStop>>
+StopReplyStop::create(StringRef Response, llvm::support::endianness Endian) {
+ unsigned int Signal;
+ StringRef SignalStr = Response.take_front(2);
+ Response = Response.drop_front(2);
+ if (!to_integer(SignalStr, Signal, 16))
+ return make_parsing_error("StopReply: stop signal");
+
+ auto Elements = SplitPairList(Response);
+ for (StringRef Field :
+ {"name", "reason", "thread", "threads", "thread-pcs"}) {
+ // This will insert an empty field if there is none. In the future, we
+ // should probably differentiate between these fields not being present and
+ // them being empty, but right now no tests depends on this.
+ if (Elements.insert({Field, {""}}).first->second.size() != 1)
+ return make_parsing_error(
+ "StopReply: got multiple responses for the {0} field", Field);
+ }
+ StringRef Name = Elements["name"][0];
+ StringRef Reason = Elements["reason"][0];
+
+ lldb::tid_t Thread;
+ if (!to_integer(Elements["thread"][0], Thread, 16))
+ return make_parsing_error("StopReply: thread");
+
+ SmallVector<StringRef, 20> Threads;
+ SmallVector<StringRef, 20> Pcs;
+ Elements["threads"][0].split(Threads, ',');
+ Elements["thread-pcs"][0].split(Pcs, ',');
+ if (Threads.size() != Pcs.size())
+ return make_parsing_error("StopReply: thread/PC count mismatch");
- auto elements_or_error = SplitPairList("StopReply", response);
- if (auto split_error = elements_or_error.takeError()) {
- return std::move(split_error);
+ U64Map ThreadPcs;
+ for (auto ThreadPc : zip(Threads, Pcs)) {
+ lldb::tid_t Id;
+ uint64_t Pc;
+ if (!to_integer(std::get<0>(ThreadPc), Id, 16))
+ return make_parsing_error("StopReply: Thread id '{0}'",
+ std::get<0>(ThreadPc));
+ if (!to_integer(std::get<1>(ThreadPc), Pc, 16))
+ return make_parsing_error("StopReply Thread Pc '{0}'",
+ std::get<1>(ThreadPc));
+
+ ThreadPcs[Id] = Pc;
}
- auto elements = *elements_or_error;
- stop_reply.m_name = elements["name"];
- stop_reply.m_reason = elements["reason"];
+ RegisterMap Registers;
+ for (const auto &E : Elements) {
+ StringRef Key = E.getKey();
+ const auto &Val = E.getValue();
+ if (Key.size() != 2)
+ continue;
- SmallVector<StringRef, 20> threads;
- SmallVector<StringRef, 20> pcs;
- elements["threads"].split(threads, ',');
- elements["thread-pcs"].split(pcs, ',');
- if (threads.size() != pcs.size())
- return make_parsing_error("StopReply: thread/PC count mismatch");
+ unsigned int Reg;
+ if (!to_integer(Key, Reg, 16))
+ continue;
- for (size_t i = 0; i < threads.size(); i++) {
- lldb::tid_t thread_id;
- uint64_t pc;
- if (threads[i].getAsInteger(16, thread_id))
- return make_parsing_error("StopReply: thread ID at [{0}].", i);
- if (pcs[i].getAsInteger(16, pc))
- return make_parsing_error("StopReply: thread PC at [{0}].", i);
+ if (Val.size() != 1)
+ return make_parsing_error(
+ "StopReply: multiple entries for register field [{0:x}]", Reg);
- stop_reply.m_thread_pcs[thread_id] = pc;
+ Registers[Reg] = Val[0].str();
}
- for (auto i = elements.begin(); i != elements.end(); i++) {
- StringRef key = i->getKey();
- StringRef val = i->getValue();
- if (key.size() >= 9 && key[0] == 'T' && key.substr(3, 6) == "thread") {
- if (val.getAsInteger(16, stop_reply.m_thread))
- return make_parsing_error("StopReply: thread id");
- if (key.substr(1, 2).getAsInteger(16, stop_reply.m_signal))
- return make_parsing_error("StopReply: stop signal");
- } else if (key.size() == 2) {
- unsigned int reg;
- if (!key.getAsInteger(16, reg)) {
- stop_reply.m_registers[reg] = val.str();
- }
- }
- }
+ return llvm::make_unique<StopReplyStop>(Signal, Thread, Name, ThreadPcs,
+ Registers, Reason);
+}
- return stop_reply;
+Expected<std::unique_ptr<StopReplyExit>>
+StopReplyExit::create(StringRef Response) {
+ uint8_t Status;
+ if (!to_integer(Response, Status, 16))
+ return make_parsing_error("StopReply: exit status");
+ return llvm::make_unique<StopReplyExit>(Status);
}
//====== Globals ===============================================================
-Expected<StringMap<StringRef>> SplitPairList(StringRef caller, StringRef str) {
+Expected<StringMap<StringRef>> SplitUniquePairList(StringRef caller,
+ StringRef str) {
SmallVector<StringRef, 20> elements;
str.split(elements, ';');
@@ -199,7 +232,20 @@ Expected<StringMap<StringRef>> SplitPairList(StringRef caller, StringRef str) {
if (pairs.count(pair.first))
return make_parsing_error("{0}: Duplicate Key: {1}", caller, pair.first);
- pairs.insert(s.split(':'));
+ pairs.insert(pair);
+ }
+
+ return pairs;
+}
+
+StringMap<SmallVector<StringRef, 2>> SplitPairList(StringRef str) {
+ SmallVector<StringRef, 20> elements;
+ str.split(elements, ';');
+
+ StringMap<SmallVector<StringRef, 2>> pairs;
+ for (StringRef s : elements) {
+ std::pair<StringRef, StringRef> pair = s.split(':');
+ pairs[pair.first].push_back(pair.second);
}
return pairs;
diff --git a/unittests/tools/lldb-server/tests/MessageObjects.h b/unittests/tools/lldb-server/tests/MessageObjects.h
index 82551e2bb549..bbb7f75bafd5 100644
--- a/unittests/tools/lldb-server/tests/MessageObjects.h
+++ b/unittests/tools/lldb-server/tests/MessageObjects.h
@@ -7,6 +7,10 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLDB_SERVER_TESTS_MESSAGEOBJECTS_H
+#define LLDB_SERVER_TESTS_MESSAGEOBJECTS_H
+
+#include "lldb/Host/Host.h"
#include "lldb/lldb-types.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
@@ -48,7 +52,7 @@ public:
const RegisterMap &registers, unsigned int signal);
llvm::StringRef ReadRegister(unsigned int register_id) const;
- bool ReadRegisterAsUint64(unsigned int register_id, uint64_t &value) const;
+ llvm::Expected<uint64_t> ReadRegisterAsUint64(unsigned int register_id) const;
private:
std::string m_name;
@@ -71,25 +75,75 @@ private:
class StopReply {
public:
- static llvm::Expected<StopReply> Create(llvm::StringRef response,
- llvm::support::endianness endian);
- const U64Map &GetThreadPcs() const;
+ StopReply() = default;
+ virtual ~StopReply() = default;
+
+ static llvm::Expected<std::unique_ptr<StopReply>>
+ create(llvm::StringRef response, llvm::support::endianness endian);
+
+ // for llvm::cast<>
+ virtual lldb_private::WaitStatus getKind() const = 0;
+
+ StopReply(const StopReply &) = delete;
+ void operator=(const StopReply &) = delete;
+};
+
+class StopReplyStop : public StopReply {
+public:
+ StopReplyStop(uint8_t Signal, lldb::tid_t ThreadId, llvm::StringRef Name,
+ U64Map ThreadPcs, RegisterMap Registers, llvm::StringRef Reason)
+ : Signal(Signal), ThreadId(ThreadId), Name(Name),
+ ThreadPcs(std::move(ThreadPcs)), Registers(std::move(Registers)),
+ Reason(Reason) {}
+
+ static llvm::Expected<std::unique_ptr<StopReplyStop>>
+ create(llvm::StringRef response, llvm::support::endianness endian);
+
+ const U64Map &getThreadPcs() const { return ThreadPcs; }
+ lldb::tid_t getThreadId() const { return ThreadId; }
+
+ // for llvm::cast<>
+ lldb_private::WaitStatus getKind() const override {
+ return lldb_private::WaitStatus{lldb_private::WaitStatus::Stop, Signal};
+ }
+ static bool classof(const StopReply *R) {
+ return R->getKind().type == lldb_private::WaitStatus::Stop;
+ }
private:
- StopReply() = default;
- void ParseResponse(llvm::StringRef response,
- llvm::support::endianness endian);
- unsigned int m_signal;
- lldb::tid_t m_thread;
- std::string m_name;
- U64Map m_thread_pcs;
- RegisterMap m_registers;
- std::string m_reason;
+ uint8_t Signal;
+ lldb::tid_t ThreadId;
+ std::string Name;
+ U64Map ThreadPcs;
+ RegisterMap Registers;
+ std::string Reason;
+};
+
+class StopReplyExit : public StopReply {
+public:
+ explicit StopReplyExit(uint8_t Status) : Status(Status) {}
+
+ static llvm::Expected<std::unique_ptr<StopReplyExit>>
+ create(llvm::StringRef response);
+
+ // for llvm::cast<>
+ lldb_private::WaitStatus getKind() const override {
+ return lldb_private::WaitStatus{lldb_private::WaitStatus::Exit, Status};
+ }
+ static bool classof(const StopReply *R) {
+ return R->getKind().type == lldb_private::WaitStatus::Exit;
+ }
+
+private:
+ uint8_t Status;
};
// Common functions for parsing packet data.
llvm::Expected<llvm::StringMap<llvm::StringRef>>
-SplitPairList(llvm::StringRef caller, llvm::StringRef s);
+SplitUniquePairList(llvm::StringRef caller, llvm::StringRef s);
+
+llvm::StringMap<llvm::SmallVector<llvm::StringRef, 2>>
+SplitPairList(llvm::StringRef s);
template <typename... Args>
llvm::Error make_parsing_error(llvm::StringRef format, Args &&... args) {
@@ -99,4 +153,7 @@ llvm::Error make_parsing_error(llvm::StringRef format, Args &&... args) {
return llvm::make_error<llvm::StringError>(error,
llvm::inconvertibleErrorCode());
}
+
} // namespace llgs_tests
+
+#endif // LLDB_SERVER_TESTS_MESSAGEOBJECTS_H
diff --git a/unittests/tools/lldb-server/tests/TestBase.cpp b/unittests/tools/lldb-server/tests/TestBase.cpp
new file mode 100644
index 000000000000..b901249dbf4c
--- /dev/null
+++ b/unittests/tools/lldb-server/tests/TestBase.cpp
@@ -0,0 +1,36 @@
+//===-- TestBase.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "TestBase.h"
+#include <cstdlib>
+
+using namespace llgs_tests;
+using namespace llvm;
+
+std::string TestBase::getLogFileName() {
+ const auto *test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+ assert(test_info);
+
+ const char *Dir = getenv("LOG_FILE_DIRECTORY");
+ if (!Dir)
+ return "";
+
+ if (!llvm::sys::fs::is_directory(Dir)) {
+ GTEST_LOG_(WARNING) << "Cannot access log directory: " << Dir;
+ return "";
+ }
+
+ SmallString<64> DirStr(Dir);
+ sys::path::append(DirStr, std::string("server-") +
+ test_info->test_case_name() + "-" +
+ test_info->name() + ".log");
+ return DirStr.str();
+}
+
diff --git a/unittests/tools/lldb-server/tests/TestBase.h b/unittests/tools/lldb-server/tests/TestBase.h
new file mode 100644
index 000000000000..8956490e945c
--- /dev/null
+++ b/unittests/tools/lldb-server/tests/TestBase.h
@@ -0,0 +1,48 @@
+//===-- TestBase.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SERVER_TESTS_TESTBASE_H
+#define LLDB_SERVER_TESTS_TESTBASE_H
+
+#include "TestClient.h"
+#include "lldb/Host/HostInfo.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+
+namespace llgs_tests {
+
+class TestBase: public ::testing::Test {
+public:
+ static void SetUpTestCase() { lldb_private::HostInfo::Initialize(); }
+
+ static std::string getInferiorPath(llvm::StringRef Name) {
+ llvm::SmallString<64> Path(LLDB_TEST_INFERIOR_PATH);
+ llvm::sys::path::append(Path, Name + LLDB_TEST_INFERIOR_SUFFIX);
+ return Path.str();
+ }
+
+ static std::string getLogFileName();
+};
+
+class StandardStartupTest: public TestBase {
+public:
+ void SetUp() override {
+ auto ClientOr = TestClient::launch(getLogFileName());
+ ASSERT_THAT_EXPECTED(ClientOr, llvm::Succeeded());
+ Client = std::move(*ClientOr);
+ }
+
+protected:
+ std::unique_ptr<TestClient> Client;
+};
+
+} // namespace llgs_tests
+
+#endif // LLDB_SERVER_TESTS_TESTBASE_H
diff --git a/unittests/tools/lldb-server/tests/TestClient.cpp b/unittests/tools/lldb-server/tests/TestClient.cpp
index 9553ddd65fac..773466abe855 100644
--- a/unittests/tools/lldb-server/tests/TestClient.cpp
+++ b/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -8,13 +8,14 @@
//===----------------------------------------------------------------------===//
#include "TestClient.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
#include <cstdlib>
#include <future>
@@ -26,67 +27,100 @@ using namespace lldb_private;
using namespace llvm;
namespace llgs_tests {
-void TestClient::Initialize() { HostInfo::Initialize(); }
+bool TestClient::IsDebugServer() {
+ return sys::path::filename(LLDB_SERVER).contains("debugserver");
+}
+
+bool TestClient::IsLldbServer() { return !IsDebugServer(); }
+
+TestClient::TestClient(std::unique_ptr<Connection> Conn) {
+ SetConnection(Conn.release());
+
+ SendAck(); // Send this as a handshake.
+}
-TestClient::TestClient(const std::string &test_name,
- const std::string &test_case_name)
- : m_test_name(test_name), m_test_case_name(test_case_name),
- m_pc_register(UINT_MAX) {}
+TestClient::~TestClient() {
+ if (!IsConnected())
+ return;
-TestClient::~TestClient() {}
+ std::string response;
+ // Debugserver (non-conformingly?) sends a reply to the k packet instead of
+ // simply closing the connection.
+ PacketResult result =
+ IsDebugServer() ? PacketResult::Success : PacketResult::ErrorDisconnected;
+ EXPECT_THAT_ERROR(SendMessage("k", response, result), Succeeded());
+}
+
+Expected<std::unique_ptr<TestClient>> TestClient::launch(StringRef Log) {
+ return launch(Log, {});
+}
-bool TestClient::StartDebugger() {
+Expected<std::unique_ptr<TestClient>> TestClient::launch(StringRef Log, ArrayRef<StringRef> InferiorArgs) {
const ArchSpec &arch_spec = HostInfo::GetArchitecture();
Args args;
args.AppendArgument(LLDB_SERVER);
- args.AppendArgument("gdbserver");
- args.AppendArgument("--log-channels=gdb-remote packets");
+ if (IsLldbServer())
+ args.AppendArgument("gdbserver");
args.AppendArgument("--reverse-connect");
- std::string log_file_name = GenerateLogFileName(arch_spec);
- if (log_file_name.size()) {
- args.AppendArgument("--log-file=" + log_file_name);
+
+ if (!Log.empty()) {
+ args.AppendArgument(("--log-file=" + Log).str());
+ if (IsLldbServer())
+ args.AppendArgument("--log-channels=gdb-remote packets");
+ else
+ args.AppendArgument("--log-flags=0x800000");
}
- Status error;
+ Status status;
TCPSocket listen_socket(true, false);
- error = listen_socket.Listen("127.0.0.1:0", 5);
- if (error.Fail()) {
- GTEST_LOG_(ERROR) << "Unable to open listen socket.";
- return false;
+ status = listen_socket.Listen("127.0.0.1:0", 5);
+ if (status.Fail())
+ return status.ToError();
+
+ args.AppendArgument(
+ ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str());
+
+ if (!InferiorArgs.empty()) {
+ args.AppendArgument("--");
+ for (StringRef arg : InferiorArgs)
+ args.AppendArgument(arg);
}
- char connect_remote_address[64];
- snprintf(connect_remote_address, sizeof(connect_remote_address),
- "localhost:%u", listen_socket.GetLocalPortNumber());
+ ProcessLaunchInfo Info;
+ Info.SetArchitecture(arch_spec);
+ Info.SetArguments(args, true);
- args.AppendArgument(connect_remote_address);
+ StringList Env;
+ Host::GetEnvironment(Env);
+ Info.GetEnvironmentEntries() = Args(Env);
- m_server_process_info.SetArchitecture(arch_spec);
- m_server_process_info.SetArguments(args, true);
- Status status = Host::LaunchProcess(m_server_process_info);
- if (status.Fail()) {
- GTEST_LOG_(ERROR)
- << formatv("Failure to launch lldb server: {0}.", status).str();
- return false;
- }
+ status = Host::LaunchProcess(Info);
+ if (status.Fail())
+ return status.ToError();
- char connect_remote_uri[64];
- snprintf(connect_remote_uri, sizeof(connect_remote_uri), "connect://%s",
- connect_remote_address);
Socket *accept_socket;
listen_socket.Accept(accept_socket);
- SetConnection(new ConnectionFileDescriptor(accept_socket));
+ auto Conn = llvm::make_unique<ConnectionFileDescriptor>(accept_socket);
+ auto Client = std::unique_ptr<TestClient>(new TestClient(std::move(Conn)));
- SendAck(); // Send this as a handshake.
- return true;
-}
+ if (!InferiorArgs.empty()) {
+ if (Error E = Client->QueryProcessInfo())
+ return std::move(E);
+ }
-bool TestClient::StopDebugger() {
- std::string response;
- return SendMessage("k", response, PacketResult::ErrorDisconnected);
+ return std::move(Client);
}
-bool TestClient::SetInferior(llvm::ArrayRef<std::string> inferior_args) {
+Error TestClient::SetInferior(llvm::ArrayRef<std::string> inferior_args) {
+ StringList env;
+ Host::GetEnvironment(env);
+ for (size_t i = 0; i < env.GetSize(); ++i) {
+ if (SendEnvironmentPacket(env[i].c_str()) != 0) {
+ return make_error<StringError>(
+ formatv("Failed to set environment variable: {0}", env[i]).str(),
+ inconvertibleErrorCode());
+ }
+ }
std::stringstream command;
command << "A";
for (size_t i = 0; i < inferior_args.size(); i++) {
@@ -96,36 +130,26 @@ bool TestClient::SetInferior(llvm::ArrayRef<std::string> inferior_args) {
command << hex_encoded.size() << ',' << i << ',' << hex_encoded;
}
- if (!SendMessage(command.str()))
- return false;
- if (!SendMessage("qLaunchSuccess"))
- return false;
- std::string response;
- if (!SendMessage("qProcessInfo", response))
- return false;
- auto create_or_error = ProcessInfo::Create(response);
- if (auto create_error = create_or_error.takeError()) {
- GTEST_LOG_(ERROR) << toString(std::move(create_error));
- return false;
- }
-
- m_process_info = *create_or_error;
- return true;
+ if (Error E = SendMessage(command.str()))
+ return E;
+ if (Error E = SendMessage("qLaunchSuccess"))
+ return E;
+ if (Error E = QueryProcessInfo())
+ return E;
+ return Error::success();
}
-bool TestClient::ListThreadsInStopReply() {
+Error TestClient::ListThreadsInStopReply() {
return SendMessage("QListThreadsInStopReply");
}
-bool TestClient::SetBreakpoint(unsigned long address) {
- std::stringstream command;
- command << "Z0," << std::hex << address << ",1";
- return SendMessage(command.str());
+Error TestClient::SetBreakpoint(unsigned long address) {
+ return SendMessage(formatv("Z0,{0:x-},1", address).str());
}
-bool TestClient::ContinueAll() { return Continue("vCont;c"); }
+Error TestClient::ContinueAll() { return Continue("vCont;c"); }
-bool TestClient::ContinueThread(unsigned long thread_id) {
+Error TestClient::ContinueThread(unsigned long thread_id) {
return Continue(formatv("vCont;c:{0:x-}", thread_id).str());
}
@@ -133,7 +157,7 @@ const ProcessInfo &TestClient::GetProcessInfo() { return *m_process_info; }
Optional<JThreadsInfo> TestClient::GetJThreadsInfo() {
std::string response;
- if (!SendMessage("jThreadsInfo", response))
+ if (SendMessage("jThreadsInfo", response))
return llvm::None;
auto creation = JThreadsInfo::Create(response, m_process_info->GetEndian());
if (auto create_error = creation.takeError()) {
@@ -145,39 +169,41 @@ Optional<JThreadsInfo> TestClient::GetJThreadsInfo() {
}
const StopReply &TestClient::GetLatestStopReply() {
- return m_stop_reply.getValue();
+ assert(m_stop_reply);
+ return *m_stop_reply;
}
-bool TestClient::SendMessage(StringRef message) {
+Error TestClient::SendMessage(StringRef message) {
std::string dummy_string;
return SendMessage(message, dummy_string);
}
-bool TestClient::SendMessage(StringRef message, std::string &response_string) {
- if (!SendMessage(message, response_string, PacketResult::Success))
- return false;
- else if (response_string[0] == 'E') {
- GTEST_LOG_(ERROR) << "Error " << response_string
- << " while sending message: " << message.str();
- return false;
+Error TestClient::SendMessage(StringRef message, std::string &response_string) {
+ if (Error E = SendMessage(message, response_string, PacketResult::Success))
+ return E;
+ if (response_string[0] == 'E') {
+ return make_error<StringError>(
+ formatv("Error `{0}` while sending message: {1}", response_string,
+ message)
+ .str(),
+ inconvertibleErrorCode());
}
-
- return true;
+ return Error::success();
}
-bool TestClient::SendMessage(StringRef message, std::string &response_string,
- PacketResult expected_result) {
+Error TestClient::SendMessage(StringRef message, std::string &response_string,
+ PacketResult expected_result) {
StringExtractorGDBRemote response;
GTEST_LOG_(INFO) << "Send Packet: " << message.str();
PacketResult result = SendPacketAndWaitForResponse(message, response, false);
response.GetEscapedBinaryData(response_string);
GTEST_LOG_(INFO) << "Read Packet: " << response_string;
- if (result != expected_result) {
- GTEST_LOG_(ERROR) << FormatFailedResult(message, result);
- return false;
- }
+ if (result != expected_result)
+ return make_error<StringError>(
+ formatv("Error sending message `{0}`: {1}", message, result).str(),
+ inconvertibleErrorCode());
- return true;
+ return Error::success();
}
unsigned int TestClient::GetPcRegisterId() {
@@ -187,12 +213,12 @@ unsigned int TestClient::GetPcRegisterId() {
for (unsigned int register_id = 0;; register_id++) {
std::string message = formatv("qRegisterInfo{0:x-}", register_id).str();
std::string response;
- if (!SendMessage(message, response)) {
+ if (SendMessage(message, response)) {
GTEST_LOG_(ERROR) << "Unable to query register ID for PC register.";
return UINT_MAX;
}
- auto elements_or_error = SplitPairList("GetPcRegisterId", response);
+ auto elements_or_error = SplitUniquePairList("GetPcRegisterId", response);
if (auto split_error = elements_or_error.takeError()) {
GTEST_LOG_(ERROR) << "GetPcRegisterId: Error splitting response: "
<< response;
@@ -209,78 +235,41 @@ unsigned int TestClient::GetPcRegisterId() {
return m_pc_register;
}
-bool TestClient::Continue(StringRef message) {
- if (!m_process_info.hasValue()) {
- GTEST_LOG_(ERROR) << "Continue() called before m_process_info initialized.";
- return false;
- }
-
+llvm::Error TestClient::QueryProcessInfo() {
std::string response;
- if (!SendMessage(message, response))
- return false;
- auto creation = StopReply::Create(response, m_process_info->GetEndian());
- if (auto create_error = creation.takeError()) {
- GTEST_LOG_(ERROR) << toString(std::move(create_error));
- return false;
- }
-
- m_stop_reply = std::move(*creation);
- return true;
+ if (Error E = SendMessage("qProcessInfo", response))
+ return E;
+ auto create_or_error = ProcessInfo::Create(response);
+ if (!create_or_error)
+ return create_or_error.takeError();
+ m_process_info = *create_or_error;
+ return Error::success();
}
-std::string TestClient::GenerateLogFileName(const ArchSpec &arch) const {
- char *log_directory = getenv("LOG_FILE_DIRECTORY");
- if (!log_directory)
- return "";
+Error TestClient::Continue(StringRef message) {
+ assert(m_process_info.hasValue());
- if (!llvm::sys::fs::is_directory(log_directory)) {
- GTEST_LOG_(WARNING) << "Cannot access log directory: " << log_directory;
- return "";
- }
-
- std::string log_file_name;
- raw_string_ostream log_file(log_file_name);
- log_file << log_directory << "/lldb-" << m_test_case_name << '-'
- << m_test_name << '-' << arch.GetArchitectureName() << ".log";
- return log_file.str();
-}
+ std::string response;
+ if (Error E = SendMessage(message, response))
+ return E;
+ auto creation = StopReply::create(response, m_process_info->GetEndian());
+ if (Error E = creation.takeError())
+ return E;
-std::string TestClient::FormatFailedResult(const std::string &message,
- PacketResult result) {
- std::string formatted_error;
- raw_string_ostream error_stream(formatted_error);
- error_stream << "Failure sending message: " << message << " Result: ";
-
- switch (result) {
- case PacketResult::ErrorSendFailed:
- error_stream << "ErrorSendFailed";
- break;
- case PacketResult::ErrorSendAck:
- error_stream << "ErrorSendAck";
- break;
- case PacketResult::ErrorReplyFailed:
- error_stream << "ErrorReplyFailed";
- break;
- case PacketResult::ErrorReplyTimeout:
- error_stream << "ErrorReplyTimeout";
- break;
- case PacketResult::ErrorReplyInvalid:
- error_stream << "ErrorReplyInvalid";
- break;
- case PacketResult::ErrorReplyAck:
- error_stream << "ErrorReplyAck";
- break;
- case PacketResult::ErrorDisconnected:
- error_stream << "ErrorDisconnected";
- break;
- case PacketResult::ErrorNoSequenceLock:
- error_stream << "ErrorNoSequenceLock";
- break;
- default:
- error_stream << "Unknown Error";
+ m_stop_reply = std::move(*creation);
+ if (!isa<StopReplyStop>(m_stop_reply)) {
+ StringExtractorGDBRemote R;
+ PacketResult result = ReadPacket(R, GetPacketTimeout(), false);
+ if (result != PacketResult::ErrorDisconnected) {
+ return make_error<StringError>(
+ formatv("Expected connection close after receiving {0}. Got {1}/{2} "
+ "instead.",
+ response, result, R.GetStringRef())
+ .str(),
+ inconvertibleErrorCode());
+ }
}
-
- error_stream.str();
- return formatted_error;
+ return Error::success();
}
+
} // namespace llgs_tests
diff --git a/unittests/tools/lldb-server/tests/TestClient.h b/unittests/tools/lldb-server/tests/TestClient.h
index ae620cc97207..4fa1bbb8ac93 100644
--- a/unittests/tools/lldb-server/tests/TestClient.h
+++ b/unittests/tools/lldb-server/tests/TestClient.h
@@ -7,55 +7,75 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLDB_SERVER_TESTS_TESTCLIENT_H
+#define LLDB_SERVER_TESTS_TESTCLIENT_H
+
#include "MessageObjects.h"
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Target/ProcessLaunchInfo.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Connection.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/FormatVariadic.h"
#include <memory>
#include <string>
namespace llgs_tests {
-// TODO: Make the test client an abstract base class, with different children
-// for different types of connections: llgs v. debugserver
class TestClient
: public lldb_private::process_gdb_remote::GDBRemoteCommunicationClient {
public:
- static void Initialize();
- TestClient(const std::string &test_name, const std::string &test_case_name);
- virtual ~TestClient();
- LLVM_NODISCARD bool StartDebugger();
- LLVM_NODISCARD bool StopDebugger();
- LLVM_NODISCARD bool SetInferior(llvm::ArrayRef<std::string> inferior_args);
- LLVM_NODISCARD bool ListThreadsInStopReply();
- LLVM_NODISCARD bool SetBreakpoint(unsigned long address);
- LLVM_NODISCARD bool ContinueAll();
- LLVM_NODISCARD bool ContinueThread(unsigned long thread_id);
+ static bool IsDebugServer();
+ static bool IsLldbServer();
+
+ /// Launches the server, connects it to the client and returns the client. If
+ /// Log is non-empty, the server will write it's log to this file.
+ static llvm::Expected<std::unique_ptr<TestClient>> launch(llvm::StringRef Log);
+
+ /// Launches the server, while specifying the inferior on its command line.
+ /// When the client connects, it already has a process ready.
+ static llvm::Expected<std::unique_ptr<TestClient>>
+ launch(llvm::StringRef Log, llvm::ArrayRef<llvm::StringRef> InferiorArgs);
+
+ ~TestClient() override;
+ llvm::Error SetInferior(llvm::ArrayRef<std::string> inferior_args);
+ llvm::Error ListThreadsInStopReply();
+ llvm::Error SetBreakpoint(unsigned long address);
+ llvm::Error ContinueAll();
+ llvm::Error ContinueThread(unsigned long thread_id);
const ProcessInfo &GetProcessInfo();
llvm::Optional<JThreadsInfo> GetJThreadsInfo();
const StopReply &GetLatestStopReply();
- LLVM_NODISCARD bool SendMessage(llvm::StringRef message);
- LLVM_NODISCARD bool SendMessage(llvm::StringRef message,
- std::string &response_string);
- LLVM_NODISCARD bool SendMessage(llvm::StringRef message,
- std::string &response_string,
- PacketResult expected_result);
+ template <typename T> llvm::Expected<const T &> GetLatestStopReplyAs() {
+ assert(m_stop_reply);
+ if (const auto *Reply = llvm::dyn_cast<T>(m_stop_reply.get()))
+ return *Reply;
+ return llvm::make_error<llvm::StringError>(
+ llvm::formatv("Unexpected Stop Reply {0}", m_stop_reply->getKind()),
+ llvm::inconvertibleErrorCode());
+ }
+ llvm::Error SendMessage(llvm::StringRef message);
+ llvm::Error SendMessage(llvm::StringRef message,
+ std::string &response_string);
+ llvm::Error SendMessage(llvm::StringRef message, std::string &response_string,
+ PacketResult expected_result);
unsigned int GetPcRegisterId();
private:
- LLVM_NODISCARD bool Continue(llvm::StringRef message);
- LLVM_NODISCARD bool GenerateConnectionAddress(std::string &address);
- std::string GenerateLogFileName(const lldb_private::ArchSpec &arch) const;
+ TestClient(std::unique_ptr<lldb_private::Connection> Conn);
+
+ llvm::Error QueryProcessInfo();
+ llvm::Error Continue(llvm::StringRef message);
std::string FormatFailedResult(
const std::string &message,
lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult
result);
llvm::Optional<ProcessInfo> m_process_info;
- llvm::Optional<StopReply> m_stop_reply;
- lldb_private::ProcessLaunchInfo m_server_process_info;
- std::string m_test_name;
- std::string m_test_case_name;
- unsigned int m_pc_register;
+ std::unique_ptr<StopReply> m_stop_reply;
+ unsigned int m_pc_register = UINT_MAX;
};
+
} // namespace llgs_tests
+
+#endif // LLDB_SERVER_TESTS_TESTCLIENT_H
diff --git a/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp b/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
index 961b0a3b3167..6ff777bd17ab 100644
--- a/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
+++ b/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
@@ -7,38 +7,33 @@
//
//===----------------------------------------------------------------------===//
+#include "TestBase.h"
#include "TestClient.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
#include <string>
using namespace llgs_tests;
+using namespace llvm;
-class ThreadsInJstopinfoTest : public ::testing::Test {
-protected:
- virtual void SetUp() { TestClient::Initialize(); }
-};
+TEST_F(StandardStartupTest, TestStopReplyContainsThreadPcs) {
+ // This inferior spawns 4 threads, then forces a break.
+ ASSERT_THAT_ERROR(
+ Client->SetInferior({getInferiorPath("thread_inferior"), "4"}),
+ Succeeded());
-TEST_F(ThreadsInJstopinfoTest, TestStopReplyContainsThreadPcsLlgs) {
- std::vector<std::string> inferior_args;
- // This inferior spawns N threads, then forces a break.
- inferior_args.push_back(THREAD_INFERIOR);
- inferior_args.push_back("4");
-
- auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
-
- TestClient client(test_info->name(), test_info->test_case_name());
- ASSERT_TRUE(client.StartDebugger());
- ASSERT_TRUE(client.SetInferior(inferior_args));
- ASSERT_TRUE(client.ListThreadsInStopReply());
- ASSERT_TRUE(client.ContinueAll());
- unsigned int pc_reg = client.GetPcRegisterId();
+ ASSERT_THAT_ERROR(Client->ListThreadsInStopReply(), Succeeded());
+ ASSERT_THAT_ERROR(Client->ContinueAll(), Succeeded());
+ unsigned int pc_reg = Client->GetPcRegisterId();
ASSERT_NE(pc_reg, UINT_MAX);
- auto jthreads_info = client.GetJThreadsInfo();
+ auto jthreads_info = Client->GetJThreadsInfo();
ASSERT_TRUE(jthreads_info);
- auto stop_reply = client.GetLatestStopReply();
- auto stop_reply_pcs = stop_reply.GetThreadPcs();
+ auto stop_reply = Client->GetLatestStopReplyAs<StopReplyStop>();
+ ASSERT_THAT_EXPECTED(stop_reply, Succeeded());
+ auto stop_reply_pcs = stop_reply->getThreadPcs();
auto thread_infos = jthreads_info->GetThreadInfos();
ASSERT_EQ(stop_reply_pcs.size(), thread_infos.size())
<< "Thread count mismatch.";
@@ -47,12 +42,9 @@ TEST_F(ThreadsInJstopinfoTest, TestStopReplyContainsThreadPcsLlgs) {
unsigned long tid = stop_reply_pc.first;
ASSERT_TRUE(thread_infos.find(tid) != thread_infos.end())
<< "Thread ID: " << tid << " not in JThreadsInfo.";
- uint64_t pc_value;
- ASSERT_TRUE(thread_infos[tid].ReadRegisterAsUint64(pc_reg, pc_value))
- << "Failure reading ThreadInfo register " << pc_reg;
- ASSERT_EQ(stop_reply_pcs[tid], pc_value)
+ auto pc_value = thread_infos[tid].ReadRegisterAsUint64(pc_reg);
+ ASSERT_THAT_EXPECTED(pc_value, Succeeded());
+ ASSERT_EQ(stop_reply_pcs[tid], *pc_value)
<< "Mismatched PC for thread: " << tid;
}
-
- ASSERT_TRUE(client.StopDebugger());
}
diff --git a/www/build.html b/www/build.html
index fbb35ae554ed..c5d050c4d4e1 100755
--- a/www/build.html
+++ b/www/build.html
@@ -123,20 +123,20 @@
</li>
</ul>
Sample command line:<br/>
- <code>cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm</code>
- <h2>Working with both Ninja and MSVC</h2>
- <p>
- Compiling with <code>ninja</code> is both faster and simpler than compiling with MSVC, but chances are you still want
- to debug LLDB with MSVC (at least until we can debug LLDB on Windows with LLDB!). One solution to this is to run
- <code>cmake</code> twice and generate the output into two different folders. One for compiling (the <code>ninja</code>
- folder), and one for editing / browsing / debugging (the MSVC folder).
- </p>
- <p>
- To do this, simply run <code>`cmake -G Ninja &lt;arguments&gt;`</code> from one folder, and
- <code>`cmake -G "Visual Studio 14 2015" &lt;arguments&gt;`</code> in another folder. Then you can open the .sln file
- in Visual Studio, set <code>lldb</code> as the startup project, and use F5 to run it. You need only edit the project
- settings to set the executable and the working directory to point to binaries inside of the <code>ninja</code> tree.
- </p>
+ <code>cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm</code>
+ <h2>Working with both Ninja and MSVC</h2>
+ <p>
+ Compiling with <code>ninja</code> is both faster and simpler than compiling with MSVC, but chances are you still want
+ to debug LLDB with MSVC (at least until we can debug LLDB on Windows with LLDB!). One solution to this is to run
+ <code>cmake</code> twice and generate the output into two different folders. One for compiling (the <code>ninja</code>
+ folder), and one for editing / browsing / debugging (the MSVC folder).
+ </p>
+ <p>
+ To do this, simply run <code>`cmake -G Ninja &lt;arguments&gt;`</code> from one folder, and
+ <code>`cmake -G "Visual Studio 14 2015" &lt;arguments&gt;`</code> in another folder. Then you can open the .sln file
+ in Visual Studio, set <code>lldb</code> as the startup project, and use F5 to run it. You need only edit the project
+ settings to set the executable and the working directory to point to binaries inside of the <code>ninja</code> tree.
+ </p>
</div>
</div>
<div class="post" id="BuildingLldbOnMacOSX">
diff --git a/www/remote.html b/www/remote.html
index e5fc2d2b6a63..1d0dc7b4b0f0 100644
--- a/www/remote.html
+++ b/www/remote.html
@@ -86,7 +86,9 @@
Once the binaries are in place, you just need to run the <code>lldb-server</code>
in platform mode and specify the port it should listen on. For example, the command
</p>
- <code>lldb-server platform --listen *:1234</code>
+ <code>
+ remote% <b>lldb-server platform --listen "*:1234" --server</b>
+ </code>
<p>
will start the LLDB platform and wait for incoming connections from any address to
port 1234. Specifying an address instead of <code>*</code> will only allow
@@ -104,14 +106,35 @@
your remote system. A list of available plug-ins can be obtained through
<code>platform list</code>.
</p>
-
+ <code>
+ local% <b>lldb</b>
+ <br>(lldb) <b>platform list</b>
+ <br>Available platforms:
+ <br>host: Local Mac OS X user platform plug-in.
+ <br>remote-freebsd: Remote FreeBSD user platform plug-in.
+ <br>remote-linux: Remote Linux user platform plug-in.
+ <br>remote-netbsd: Remote NetBSD user platform plug-in.
+ <br>remote-windows: Remote Windows user platform plug-in.
+ <br>remote-android: Remote Android user platform plug-in.
+ <br>remote-ios: Remote iOS platform plug-in.
+ <br>remote-macosx: Remote Mac OS X user platform plug-in.
+ <br>ios-simulator: iOS simulator platform plug-in.
+ <br>darwin-kernel: Darwin Kernel platform plug-in.
+ <br>tvos-simulator: Apple TV simulator platform plug-in.
+ <br>watchos-simulator: Apple Watch simulator platform plug-in.
+ <br>remote-tvos: Remote Apple TV platform plug-in.
+ <br>remote-watchos: Remote Apple Watch platform plug-in.
+ <br>remote-gdb-server: A platform that uses the GDB remote protocol as the communication transport.
+ </code>
<p>
The default platform is the platform <code>host</code> which is used for local
debugging. Apart from this, the list should contain a number of plug-ins, for
debugging different kinds of systems. The remote plug-ins are prefixed with
- "<code>remote-</code>". For example, to debug a remote Linux application, you should
- run <code>platform select remote-linux</code>.
- </p>
+ "<code>remote-</code>". For example, to debug a remote Linux application:
+ <br>
+ <code>
+ <br>(lldb) <b>patform select remote-linux</b>
+ </code>
<p>
After selecting the platform plug-in, you should receive a prompt which confirms
@@ -121,9 +144,19 @@
command takes a number of arguments (as always, use the <code>help</code> command
to find out more), but normally you only need to specify the address to connect to,
e.g.:
- </p>
- <code>platform connect connect://host:port</code>
-
+ <br>
+ <code>
+ <br>(lldb) <b>platform connect connect://remote:1234</b>
+ <br>&nbsp;&nbsp;Platform: remote-linux
+ <br>&nbsp;&nbsp;&nbsp;&nbsp;Triple: x86_64-gnu-linux
+ <br>&nbsp;&nbsp;Hostname: remote
+ <br>&nbsp;Connected: yes
+ <br>WorkingDir: /tmp
+ </code>
+ <p>
+ Note that the platform has a working directory of <code>/tmp</code>. This directory
+ will be used as the directory that executables will be uploaded to by default when
+ launching a process from <em>local</em>.
<p>
After this, you should be able to debug normally. You can use the
<code>process attach</code> to attach to an existing remote process or
@@ -134,7 +167,98 @@
<code>put-file</code>, <code>mkdir</code>, etc. The environment can be prepared
further using the <code>platform shell</code> command.
</p>
+ <h3>Launching a locally built process on the remote machine</h3>
+ <h4>Install and run in the platform working directory</h4>
+ <p>
+ To launch a locally built process on the remote system in the
+ platform working directory:
+ <br>
+ <code>
+ <br>(lldb) <b>file a.out</b>
+ <br>(lldb) <b>run</b>
+ </code>
+ <p>
+ This will cause LLDB to create a target with the "a.out"
+ executable that you cross built. The "run" command will cause
+ LLDB to upload "a.out" to the platform's current working
+ directory only if the file has changed.
+ The platform connection allows us to transfer files, but also
+ allows us to get the MD5 checksum of the file on the other end
+ and only upload the file if it has changed. LLDB will automatically
+ launch a lldb-server in gdbremote mode to allow you to debug this
+ executable, connect to it and start your debug session for you.
+ </p>
+ <h4>Changing the platform working directory</h4>
+ <p>
+ You can change the platform working directory while connected to
+ the platform with:
+ <br>
+ <code>
+ <br>(lldb) <b>platform settings -w /usr/local/bin</b>
+ </code>
+ <p>
+ And you can verify it worked using "platform status":
+ <br>
+ <code>
+ <br>(lldb) <b>platform status</b>
+ <br>&nbsp;&nbsp;Platform: remote-linux
+ <br>&nbsp;&nbsp;&nbsp;&nbsp;Triple: x86_64-gnu-linux
+ <br>&nbsp;&nbsp;Hostname: remote
+ <br>&nbsp;Connected: yes
+ <br>WorkingDir: /usr/local/bin
+ </code>
+ <p>
+ If we run again, the program will be installed into /usr/local/bin.
+ </p>
+
+ <h4>Install and run by specifying a remote install path</h4>
+ <p>
+ If you want the "a.out" executable to be installed into
+ "/bin/a.out" instead of the platorm's current working directory,
+ we can set the platform file specification using python:
+ <br>
+ <code>
+ <br>(lldb) <b>file a.out</b>
+ <br>(lldb) <b>script lldb.target.module['a.out'].SetPlatformFileSpec("/bin/a.out")</b>
+ <br>(lldb) <b>run</b>
+ </code>
+ <p>
+ Now when you run your program, the program will be uploaded to
+ "/bin/a.out" instead of the the platform current working directory.
+ Only the main executable is uploaded to the remote system by
+ default when launching the application. If you have shared
+ libraries that should also be uploaded, then you can add the
+ locally build shared library to the current target and set its
+ platform file specification:
+ </p>
+ <code>
+ <br>(lldb) <b>file a.out</b>
+ <br>(lldb) <b>target module add /local/build/libfoo.so</b>
+ <br>(lldb) <b>target module add /local/build/libbar.so</b>
+ <br>(lldb) <b>script lldb.target.module['libfoo.so'].SetPlatformFileSpec("/usr/lib/libfoo.so")</b>
+ <br>(lldb) <b>script lldb.target.module['libbar.so'].SetPlatformFileSpec("/usr/local/lib/libbar.so")</b>
+ <br>(lldb) <b>run</b>
+ </code>
+ <h4>Attaching to a remote process</h4>
+ <p>
+ If you want to attach to a remote process, you can first list the
+ processes on the remote system:
+ </p>
+ <code>
+ <br>(lldb) <b>platform process list</b>
+ <br>223 matching processes were found on "remote-linux"
+ <br>PID&nbsp;&nbsp;&nbsp;&nbsp;PARENT&nbsp;USER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRIPLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NAME
+ <br>======&nbsp;======&nbsp;==========&nbsp;========================&nbsp;============================
+ <br>68639&nbsp;&nbsp;90652&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x86_64-apple-macosx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lldb
+ <br>...
+ </code>
+ <p>
+ Then attaching is as simple as specifying the remote process ID:
+ </p>
+ <code>
+ <br>(lldb) <b>attach 68639</b>
+ </code>
</div>
<div class="postfooter"></div>
</div>
diff --git a/www/test.html b/www/test.html
index 5ffa82fd184b..8208f1f223b8 100644
--- a/www/test.html
+++ b/www/test.html
@@ -27,13 +27,13 @@
both the LLDB command line interface and the scripting API.
</p>
</div>
- <h1 class="postheader">Running tests</h1>
+ <h1 class="postheader">Running tests</h1>
<div class="postcontent">
<h2>Running the full test suite</h2>
<p>
- <strong>Windows Note</strong>: In the examples that follow, any invocations of <code>python</code>
- should be replaced with <code>python_d</code>, the debug interpreter, when running the test
- suite against a debug version of LLDB.
+ <strong>Windows Note</strong>: In the examples that follow, any invocations of <code>python</code>
+ should be replaced with <code>python_d</code>, the debug interpreter, when running the test
+ suite against a debug version of LLDB.
</p>
<p>
The easiest way to run the LLDB test suite is to use the <tt>check-lldb</tt> build
@@ -134,93 +134,93 @@
<h1 class="postheader">Debugging test failures</h1>
<div class="postcontent">
<h2>Non-Windows platforms</h2>
- <p>
- On non-Windows platforms, you can use the <code>-d</code> option to <code>dotest.py</code> which will cause the script to wait
+ <p>
+ On non-Windows platforms, you can use the <code>-d</code> option to <code>dotest.py</code> which will cause the script to wait
for a while until a debugger is attached.
</p>
- <h2>Windows</h2>
+ <h2>Windows</h2>
<p>
- On Windows, it is strongly recommended to use <a href="https://github.com/Microsoft/PTVS/releases">Python Tools for Visual Studio</a>
- for debugging test failures. It can seamlessly step between native and managed code, which is very helpful when you need to step
- through the test itself, and then into the LLDB code that backs the operations the test is performing. A quick guide to getting
- started with PTVS is as follows:
- <ul>
- <li>Install PTVS</li>
- <li>
- Create a Visual Studio Project for the Python code.
- <ul>
- <li>Go to File -> New -> Project -> Python -> From Existing Python Code.</li>
- <li>Choose <code>llvm/tools/lldb</code> as the directory containing the Python code.</li>
- <li>
- When asked where to save the <code>.pyproj</code> file, choose the folder <code>llvm/tools/lldb/pyproj</code>.
- This is a special folder that is ignored by the <code>.gitignore</code> file, since it is not checked in.
- </li>
- </ul>
- </li>
- <li>Set <code>test/dotest.py</code> as the startup file</li>
- <li>
- Make sure there is a Python Environment installed for your distribution. For example, if you installed Python to
- <code>C:\Python35</code>, PTVS needs to know that this is the interpreter you want to use for running the test suite.
- <ul>
- <li>Go to Tools -> Options -> Python Tools -> Environment Options</li>
- <li>Click Add Environment, and enter <code>Python 3.5 Debug</code> for the name. Fill out the values correctly.</li>
- </ul>
- </li>
- <li>
- Configure the project to use this debug interpreter.
- <ul>
- <li>Right click the Project node in Solution Explorer</li>
- <li>In the <code>General</code> tab, Make sure <code>Python 3.5 Debug</code> is the selected Interpreter.</li>
- <li>In <code>Debug/Search Paths</code>, enter the path to your <code>ninja/lib/site-packages</code> directory.</li>
- <li>
- In <code>Debug/Environment Variables</code>, enter<br/>
- <code>VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\</code>
- </li>
- <li>
- If you want to enabled mixed mode debugging, check <code>Enable native code debugging</code> (this slows down debugging,
- so enable it only on an as-needed basis.)
- </li>
- </ul>
- </li>
- <li>
- Set the command line for the test suite to run.
- <ul>
- <li>Right click the project in solution explorer and choose the <code>Debug</code> tab.</li>
- <li>Enter the arguments to <code>dotest.py</code>. Note you must add <code>--no-multiprocess</code></li>
- <li>
- Example command options:
- <code>
- <br/># quiet mode
- <br/>-q
- <br />--arch=i686
- <br /># Path to debug lldb.exe
- <br />--executable D:/src/llvmbuild/ninja/bin/lldb.exe
- <br /># Directory to store log files
- <br />-s D:/src/llvmbuild/ninja/lldb-test-traces
- <br />-u CXXFLAGS -u CFLAGS
- <br /># If a test crashes, show JIT debugging dialog.
- <br />--enable-crash-dialog
- <br /># Path to release clang.exe
- <br />-C d:\src\llvmbuild\ninja_release\bin\clang.exe
- <br /># Path to the particular test you want to debug.
- <br />-p TestPaths.py
- <br /># Root of test tree
- <br />D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test
- <br /># Required in order to be able to debug the test.
- <br />--no-multiprocess
- </code>
- </li>
- <li>
- As copy-pastable command line:<br/>
- <code>
- -q --arch=i686 --executable D:/src/llvmbuild/ninja/bin/lldb.exe -s D:/src/llvmbuild/ninja/lldb-test-traces
- -u CXXFLAGS -u CFLAGS --enable-crash-dialog -C d:\src\llvmbuild\ninja_release\bin\clang.exe
- -p TestPaths.py D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test --no-multiprocess
- </code>
- </li>
- </ul>
- </li>
- </ul>
+ On Windows, it is strongly recommended to use <a href="https://github.com/Microsoft/PTVS/releases">Python Tools for Visual Studio</a>
+ for debugging test failures. It can seamlessly step between native and managed code, which is very helpful when you need to step
+ through the test itself, and then into the LLDB code that backs the operations the test is performing. A quick guide to getting
+ started with PTVS is as follows:
+ <ul>
+ <li>Install PTVS</li>
+ <li>
+ Create a Visual Studio Project for the Python code.
+ <ul>
+ <li>Go to File -> New -> Project -> Python -> From Existing Python Code.</li>
+ <li>Choose <code>llvm/tools/lldb</code> as the directory containing the Python code.</li>
+ <li>
+ When asked where to save the <code>.pyproj</code> file, choose the folder <code>llvm/tools/lldb/pyproj</code>.
+ This is a special folder that is ignored by the <code>.gitignore</code> file, since it is not checked in.
+ </li>
+ </ul>
+ </li>
+ <li>Set <code>test/dotest.py</code> as the startup file</li>
+ <li>
+ Make sure there is a Python Environment installed for your distribution. For example, if you installed Python to
+ <code>C:\Python35</code>, PTVS needs to know that this is the interpreter you want to use for running the test suite.
+ <ul>
+ <li>Go to Tools -> Options -> Python Tools -> Environment Options</li>
+ <li>Click Add Environment, and enter <code>Python 3.5 Debug</code> for the name. Fill out the values correctly.</li>
+ </ul>
+ </li>
+ <li>
+ Configure the project to use this debug interpreter.
+ <ul>
+ <li>Right click the Project node in Solution Explorer</li>
+ <li>In the <code>General</code> tab, Make sure <code>Python 3.5 Debug</code> is the selected Interpreter.</li>
+ <li>In <code>Debug/Search Paths</code>, enter the path to your <code>ninja/lib/site-packages</code> directory.</li>
+ <li>
+ In <code>Debug/Environment Variables</code>, enter<br/>
+ <code>VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\</code>
+ </li>
+ <li>
+ If you want to enabled mixed mode debugging, check <code>Enable native code debugging</code> (this slows down debugging,
+ so enable it only on an as-needed basis.)
+ </li>
+ </ul>
+ </li>
+ <li>
+ Set the command line for the test suite to run.
+ <ul>
+ <li>Right click the project in solution explorer and choose the <code>Debug</code> tab.</li>
+ <li>Enter the arguments to <code>dotest.py</code>. Note you must add <code>--no-multiprocess</code></li>
+ <li>
+ Example command options:
+ <code>
+ <br/># quiet mode
+ <br/>-q
+ <br />--arch=i686
+ <br /># Path to debug lldb.exe
+ <br />--executable D:/src/llvmbuild/ninja/bin/lldb.exe
+ <br /># Directory to store log files
+ <br />-s D:/src/llvmbuild/ninja/lldb-test-traces
+ <br />-u CXXFLAGS -u CFLAGS
+ <br /># If a test crashes, show JIT debugging dialog.
+ <br />--enable-crash-dialog
+ <br /># Path to release clang.exe
+ <br />-C d:\src\llvmbuild\ninja_release\bin\clang.exe
+ <br /># Path to the particular test you want to debug.
+ <br />-p TestPaths.py
+ <br /># Root of test tree
+ <br />D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test
+ <br /># Required in order to be able to debug the test.
+ <br />--no-multiprocess
+ </code>
+ </li>
+ <li>
+ As copy-pastable command line:<br/>
+ <code>
+ -q --arch=i686 --executable D:/src/llvmbuild/ninja/bin/lldb.exe -s D:/src/llvmbuild/ninja/lldb-test-traces
+ -u CXXFLAGS -u CFLAGS --enable-crash-dialog -C d:\src\llvmbuild\ninja_release\bin\clang.exe
+ -p TestPaths.py D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test --no-multiprocess
+ </code>
+ </li>
+ </ul>
+ </li>
+ </ul>
</p>
</div>
<div class="postfooter"></div>
diff --git a/www/troubleshooting.html b/www/troubleshooting.html
index 7d03faf7ae25..f12c8aa79ac6 100755
--- a/www/troubleshooting.html
+++ b/www/troubleshooting.html
@@ -79,6 +79,22 @@
0
</tt></pre></code>
<p> Above we can see that "/tmp/a.out" does have a compile unit, and "/usr/lib/dyld" does not.
+ <p> We can also list the full paths to all compile units for a module using python:
+<code><pre><tt>
+(lldb) <b>script</b>
+Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
+>>> <b>m = lldb.target.module['a.out']</b>
+>>> <b>for i in range(m.GetNumCompileUnits()):</b>
+... <b>cu = m.GetCompileUnitAtIndex(i).file.fullpath</b>
+/tmp/main.c
+/tmp/foo.c
+/tmp/bar.c
+>>>
+</tt></pre></code>
+ <p> This can help to show the actual full path to the source files. Sometimes IDEs will set breakpoints by full paths where the path doesn't match the full path in the debug info and this can cause LLDB to not resolve breakpoints. You can use the breakpoint list command with the --verbose option to see the full paths for any source file and line breakpoints that the IDE set using:
+<code><pre><tt>
+(lldb) <b>breakpoint list --verbose</b>
+</tt></pre></code>
</div>
<div class="postfooter"></div>
</div>
diff --git a/www/tutorial.html b/www/tutorial.html
index d3b7ec89a5ad..217ea17aac63 100755
--- a/www/tutorial.html
+++ b/www/tutorial.html
@@ -248,9 +248,9 @@
</div>
<div class="postfooter"></div>
- <div class="post">
- <h1 class ="postheader">Setting breakpoints</h1>
- <div class="postcontent">
+ <div class="post">
+ <h1 class ="postheader">Setting breakpoints</h1>
+ <div class="postcontent">
<p>We've discussed how to set breakpoints above. You can use <code>help breakpoint set</code>
to see all the options for breakpoint setting. For instance, we might do:</p>
@@ -350,6 +350,67 @@ Current breakpoints:
</div>
<div class="postfooter"></div>
+
+ <div class="post">
+ <h1 class ="postheader">Breakpoint Names</h1>
+ <div class="postcontent">
+
+ <p>Breakpoints carry two orthognal sets of information: one specifies where to
+ set the breakpoint, and the other how to react when the breakpoint is hit.
+ The latter set of information (e.g. commands, conditions, hit-count, auto-continue...)
+ we call breakpoint options.</p>
+ <p>It is fairly common to want to apply one set of options to a number of breakpoints.
+ For instance, you might want to check that <code>self == nil</code> and if it is,
+ print a backtrace and continue, on a number of methods.
+ One convenient way to do that would be to make all
+ the breakpoints, then configure the options with:</p>
+
+ <code>
+ (lldb) breakpoint modify -c "self == nil" -C bt --auto-continue 1 2 3
+ </code>
+
+ <p>That's not too bad, but you have to repeat this for every new breakpoint you
+ make, and if you wanted to change the options, you have to remember all the ones you
+ are using this way.</p>
+
+ <p> Breakpoint names provide a convenient solution to this problem. The simple solution would
+ be to use the name to gather the breakpoints you want to affect this way into a group. So
+ when you make the breakpoint you would do:</p>
+
+ <code>
+ (lldb) breakpoint set <SPECIFICATION> -N SelfNil
+ </code>
+
+ <p>Then when you've made all your breakpoints, you can set up or modify the options using
+ the name to collect all the relevant breakpoints.</p>
+
+ <code>
+ (lldb) breakpoint modify -c "self == nil" -C bt --auto-continue SelfNil
+ </code>
+
+ <p> That is better, but suffers from the problem that when new breakpoints get added, they
+ don't pick up these modifications, and the options only exist in the context of actual
+ breakpoints, so they are hard to store & reuse. </p>
+ <p>A even better solution is to make a
+ fully configured breakpoint name:</p>
+ <code>
+ (lldb) breakpoint name configure -c "self == nil" -C bt --auto-continue SelfNil
+ </code>
+ <p>Then you can apply the name to your breakpoints, and they will all pick up these
+ options. The connection from name to breakpoints remains live, so when you change the
+ options configured on the name, all the breakpoints pick up those changes. This makes
+ it easy to use configured names to experiment with your options.</p>
+ <p>You can make breakpoint names in your .lldbinit file, so you can use them to
+ can behaviors that you have found useful and reapply them in future sessions.</p>
+
+ <p>You can also make a breakpoint name from the options set on a breakpoint:</p>
+ <code>
+ (lldb) breakpoint name configure -B 1 SelfNil
+ </code>
+ <p>which makes it easy to copy behavior from one breakpoint to a set of others.</p>
+
+ <div class="postfooter"></div>
+
<div class="post">
<h1 class ="postheader">Setting watchpoints</h1>
<div class="postcontent">