aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
committerEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
commit0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (patch)
treec94307da318be46e5aeea1a325c1e91749506e4f /source
parent03b99097822ca3ac69252d9afae716a584ed56c4 (diff)
downloadsrc-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.tar.gz
src-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.zip
Import LLDB as of upstream SVN r216948 (git 50f7fe44)vendor/lldb/lldb-r216948
This corresponds with the branchpoint for the 3.5 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=275072 svn path=/vendor/lldb/lldb-r216948/; revision=275074; tag=vendor/lldb/lldb-r216948
Diffstat (limited to 'source')
-rw-r--r--source/API/SBAddress.cpp8
-rw-r--r--source/API/SBBreakpoint.cpp117
-rw-r--r--source/API/SBBreakpointLocation.cpp57
-rw-r--r--source/API/SBBroadcaster.cpp18
-rw-r--r--source/API/SBCommandInterpreter.cpp58
-rw-r--r--source/API/SBCommandReturnObject.cpp14
-rw-r--r--source/API/SBCommunication.cpp52
-rw-r--r--source/API/SBCompileUnit.cpp31
-rw-r--r--source/API/SBData.cpp182
-rw-r--r--source/API/SBDebugger.cpp153
-rw-r--r--source/API/SBDeclaration.cpp21
-rw-r--r--source/API/SBError.cpp12
-rw-r--r--source/API/SBEvent.cpp19
-rw-r--r--source/API/SBExpressionOptions.cpp61
-rw-r--r--source/API/SBFileSpec.cpp30
-rw-r--r--source/API/SBFileSpecList.cpp3
-rw-r--r--source/API/SBFrame.cpp169
-rw-r--r--source/API/SBFunction.cpp12
-rw-r--r--source/API/SBHostOS.cpp26
-rw-r--r--source/API/SBLineEntry.cpp20
-rw-r--r--source/API/SBListener.cpp38
-rw-r--r--source/API/SBModule.cpp49
-rw-r--r--source/API/SBProcess.cpp348
-rw-r--r--source/API/SBQueue.cpp136
-rw-r--r--source/API/SBQueueItem.cpp60
-rw-r--r--source/API/SBStream.cpp2
-rw-r--r--source/API/SBSymbol.cpp6
-rw-r--r--source/API/SBSymbolContext.cpp28
-rw-r--r--source/API/SBTarget.cpp453
-rw-r--r--source/API/SBThread.cpp374
-rw-r--r--source/API/SBType.cpp32
-rw-r--r--source/API/SBTypeEnumMember.cpp192
-rw-r--r--source/API/SBUnixSignals.cpp199
-rw-r--r--source/API/SBValue.cpp406
-rw-r--r--source/API/SBValueList.cpp16
-rw-r--r--source/API/SBWatchpoint.cpp13
-rw-r--r--source/Breakpoint/Breakpoint.cpp2
-rw-r--r--source/Breakpoint/BreakpointID.cpp2
-rw-r--r--source/Breakpoint/BreakpointList.cpp2
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp19
-rw-r--r--source/Breakpoint/BreakpointLocationList.cpp2
-rw-r--r--source/Breakpoint/BreakpointOptions.cpp2
-rw-r--r--source/Breakpoint/BreakpointResolverName.cpp4
-rw-r--r--source/Breakpoint/BreakpointSite.cpp11
-rw-r--r--source/Breakpoint/BreakpointSiteList.cpp2
-rw-r--r--source/Breakpoint/WatchpointList.cpp2
-rw-r--r--source/Commands/CommandCompletions.cpp31
-rw-r--r--source/Commands/CommandObjectArgs.cpp14
-rw-r--r--source/Commands/CommandObjectBreakpoint.cpp95
-rw-r--r--source/Commands/CommandObjectBreakpointCommand.cpp151
-rw-r--r--source/Commands/CommandObjectCommands.cpp41
-rw-r--r--source/Commands/CommandObjectDisassemble.cpp197
-rw-r--r--source/Commands/CommandObjectExpression.cpp94
-rw-r--r--source/Commands/CommandObjectExpression.h3
-rw-r--r--source/Commands/CommandObjectFrame.cpp10
-rw-r--r--source/Commands/CommandObjectHelp.cpp6
-rw-r--r--source/Commands/CommandObjectLog.cpp20
-rw-r--r--source/Commands/CommandObjectMemory.cpp38
-rw-r--r--source/Commands/CommandObjectPlatform.cpp89
-rw-r--r--source/Commands/CommandObjectProcess.cpp144
-rw-r--r--source/Commands/CommandObjectQuit.cpp2
-rw-r--r--source/Commands/CommandObjectRegister.cpp11
-rw-r--r--source/Commands/CommandObjectSettings.cpp9
-rw-r--r--source/Commands/CommandObjectSource.cpp30
-rw-r--r--source/Commands/CommandObjectTarget.cpp749
-rw-r--r--source/Commands/CommandObjectThread.cpp303
-rw-r--r--source/Commands/CommandObjectType.cpp190
-rw-r--r--source/Commands/CommandObjectWatchpoint.cpp46
-rw-r--r--source/Commands/CommandObjectWatchpointCommand.cpp10
-rw-r--r--source/Core/Address.cpp2
-rw-r--r--source/Core/AddressRange.cpp5
-rw-r--r--source/Core/AddressResolverName.cpp2
-rw-r--r--source/Core/ArchSpec.cpp190
-rw-r--r--source/Core/Broadcaster.cpp32
-rw-r--r--source/Core/Communication.cpp16
-rw-r--r--source/Core/ConnectionFileDescriptor.cpp1449
-rw-r--r--source/Core/ConnectionMachPort.cpp4
-rw-r--r--source/Core/ConnectionSharedMemory.cpp12
-rw-r--r--source/Core/ConstString.cpp5
-rw-r--r--source/Core/DataBufferHeap.cpp6
-rw-r--r--source/Core/DataBufferMemoryMap.cpp94
-rw-r--r--source/Core/DataExtractor.cpp55
-rw-r--r--source/Core/Debugger.cpp469
-rw-r--r--source/Core/EmulateInstruction.cpp16
-rw-r--r--source/Core/Error.cpp31
-rw-r--r--source/Core/Event.cpp17
-rw-r--r--source/Core/FastDemangle.cpp2203
-rw-r--r--source/Core/IOHandler.cpp576
-rw-r--r--source/Core/Language.cpp4
-rw-r--r--source/Core/Listener.cpp68
-rw-r--r--source/Core/Log.cpp2
-rw-r--r--source/Core/Mangled.cpp29
-rw-r--r--source/Core/Module.cpp199
-rw-r--r--source/Core/ModuleList.cpp59
-rw-r--r--source/Core/Opcode.cpp2
-rw-r--r--source/Core/PluginManager.cpp198
-rw-r--r--source/Core/RegularExpression.cpp8
-rw-r--r--source/Core/Scalar.cpp22
-rw-r--r--source/Core/SearchFilter.cpp2
-rw-r--r--source/Core/Section.cpp36
-rw-r--r--source/Core/SourceManager.cpp2
-rw-r--r--source/Core/Stream.cpp4
-rw-r--r--source/Core/StructuredData.cpp429
-rw-r--r--source/Core/Value.cpp98
-rw-r--r--source/Core/ValueObject.cpp145
-rw-r--r--source/Core/ValueObjectChild.cpp52
-rw-r--r--source/Core/ValueObjectConstResult.cpp6
-rw-r--r--source/Core/ValueObjectConstResultImpl.cpp6
-rw-r--r--source/Core/ValueObjectDynamicValue.cpp64
-rw-r--r--source/Core/ValueObjectMemory.cpp8
-rw-r--r--source/Core/ValueObjectRegister.cpp6
-rw-r--r--source/Core/ValueObjectSyntheticFilter.cpp6
-rw-r--r--source/Core/ValueObjectVariable.cpp9
-rw-r--r--source/DataFormatters/CF.cpp6
-rw-r--r--source/DataFormatters/CXXFormatterFunctions.cpp116
-rw-r--r--source/DataFormatters/Cocoa.cpp6
-rw-r--r--source/DataFormatters/FormatManager.cpp149
-rw-r--r--source/DataFormatters/LibCxx.cpp10
-rw-r--r--source/DataFormatters/LibCxxList.cpp56
-rw-r--r--source/DataFormatters/LibCxxMap.cpp10
-rw-r--r--source/DataFormatters/LibCxxUnorderedMap.cpp7
-rw-r--r--source/DataFormatters/LibStdcpp.cpp2
-rw-r--r--source/DataFormatters/NSArray.cpp384
-rw-r--r--source/DataFormatters/NSDictionary.cpp12
-rw-r--r--source/DataFormatters/NSSet.cpp6
-rw-r--r--source/DataFormatters/TypeFormat.cpp28
-rw-r--r--source/DataFormatters/TypeSummary.cpp23
-rw-r--r--source/DataFormatters/TypeSynthetic.cpp4
-rw-r--r--source/DataFormatters/ValueObjectPrinter.cpp10
-rw-r--r--source/Expression/ASTResultSynthesizer.cpp218
-rw-r--r--source/Expression/ASTStructExtractor.cpp64
-rw-r--r--source/Expression/ClangASTSource.cpp1010
-rw-r--r--source/Expression/ClangExpressionDeclMap.cpp866
-rw-r--r--source/Expression/ClangExpressionParser.cpp390
-rw-r--r--source/Expression/ClangExpressionVariable.cpp19
-rw-r--r--source/Expression/ClangFunction.cpp88
-rw-r--r--source/Expression/ClangUserExpression.cpp541
-rw-r--r--source/Expression/ClangUtilityFunction.cpp37
-rw-r--r--source/Expression/DWARFExpression.cpp243
-rw-r--r--source/Expression/ExpressionSourceCode.cpp55
-rw-r--r--source/Expression/IRDynamicChecks.cpp213
-rw-r--r--source/Expression/IRExecutionUnit.cpp497
-rw-r--r--source/Expression/IRForTarget.cpp1437
-rw-r--r--source/Expression/IRInterpreter.cpp519
-rw-r--r--source/Expression/IRMemoryMap.cpp274
-rw-r--r--source/Expression/Materializer.cpp96
-rw-r--r--source/Host/common/Condition.cpp5
-rw-r--r--source/Host/common/DynamicLibrary.cpp33
-rw-r--r--source/Host/common/Editline.cpp418
-rw-r--r--source/Host/common/File.cpp39
-rw-r--r--source/Host/common/FileCache.cpp127
-rw-r--r--source/Host/common/FileSpec.cpp381
-rw-r--r--source/Host/common/Host.cpp1282
-rw-r--r--source/Host/common/HostInfoBase.cpp318
-rw-r--r--source/Host/common/IOObject.cpp14
-rw-r--r--source/Host/common/Mutex.cpp4
-rw-r--r--source/Host/common/NativeBreakpoint.cpp116
-rw-r--r--source/Host/common/NativeBreakpoint.h66
-rw-r--r--source/Host/common/NativeBreakpointList.cpp199
-rw-r--r--source/Host/common/NativeBreakpointList.h53
-rw-r--r--source/Host/common/NativeProcessProtocol.cpp412
-rw-r--r--source/Host/common/NativeProcessProtocol.h333
-rw-r--r--source/Host/common/NativeThreadProtocol.cpp97
-rw-r--r--source/Host/common/NativeThreadProtocol.h85
-rw-r--r--source/Host/common/OptionParser.cpp21
-rw-r--r--source/Host/common/Pipe.cpp171
-rw-r--r--source/Host/common/Socket.cpp662
-rw-r--r--source/Host/common/SocketAddress.cpp3
-rw-r--r--source/Host/common/SoftwareBreakpoint.cpp296
-rw-r--r--source/Host/common/SoftwareBreakpoint.h51
-rw-r--r--source/Host/common/Terminal.cpp5
-rw-r--r--source/Host/freebsd/Host.cpp102
-rw-r--r--source/Host/freebsd/HostInfoFreeBSD.cpp85
-rw-r--r--source/Host/posix/FileSystem.cpp201
-rw-r--r--source/Host/posix/HostInfoPosix.cpp193
-rw-r--r--source/Host/posix/HostProcessPosix.cpp103
-rw-r--r--source/Interpreter/Args.cpp125
-rw-r--r--source/Interpreter/CommandHistory.cpp20
-rw-r--r--source/Interpreter/CommandInterpreter.cpp195
-rw-r--r--source/Interpreter/CommandObject.cpp213
-rw-r--r--source/Interpreter/CommandObjectRegexCommand.cpp6
-rw-r--r--source/Interpreter/CommandObjectScript.cpp4
-rw-r--r--source/Interpreter/CommandOptionValidators.cpp39
-rw-r--r--source/Interpreter/CommandReturnObject.cpp20
-rw-r--r--source/Interpreter/OptionGroupArchitecture.cpp2
-rw-r--r--source/Interpreter/OptionGroupBoolean.cpp3
-rw-r--r--source/Interpreter/OptionGroupFile.cpp6
-rw-r--r--source/Interpreter/OptionGroupFormat.cpp10
-rw-r--r--source/Interpreter/OptionGroupOutputFile.cpp10
-rw-r--r--source/Interpreter/OptionGroupPlatform.cpp8
-rw-r--r--source/Interpreter/OptionGroupString.cpp3
-rw-r--r--source/Interpreter/OptionGroupUInt64.cpp3
-rw-r--r--source/Interpreter/OptionGroupUUID.cpp2
-rw-r--r--source/Interpreter/OptionGroupValueObjectDisplay.cpp26
-rw-r--r--source/Interpreter/OptionGroupVariable.cpp16
-rw-r--r--source/Interpreter/OptionGroupWatchpoint.cpp8
-rw-r--r--source/Interpreter/OptionValue.cpp68
-rw-r--r--source/Interpreter/OptionValueArch.cpp2
-rw-r--r--source/Interpreter/OptionValueArray.cpp7
-rw-r--r--source/Interpreter/OptionValueBoolean.cpp5
-rw-r--r--source/Interpreter/OptionValueDictionary.cpp14
-rw-r--r--source/Interpreter/OptionValueEnumeration.cpp2
-rw-r--r--source/Interpreter/OptionValueFileSpec.cpp3
-rw-r--r--source/Interpreter/OptionValueFormat.cpp2
-rw-r--r--source/Interpreter/OptionValueProperties.cpp37
-rw-r--r--source/Interpreter/OptionValueUUID.cpp2
-rw-r--r--source/Interpreter/Options.cpp77
-rw-r--r--source/Interpreter/Property.cpp4
-rw-r--r--source/Interpreter/PythonDataObjects.cpp24
-rw-r--r--source/Interpreter/ScriptInterpreter.cpp35
-rw-r--r--source/Interpreter/ScriptInterpreterPython.cpp378
-rw-r--r--source/Interpreter/embedded_interpreter.py4
-rw-r--r--source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp13
-rw-r--r--source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp1103
-rw-r--r--source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h145
-rw-r--r--source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp10
-rw-r--r--source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp554
-rw-r--r--source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h148
-rw-r--r--source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp29
-rw-r--r--source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp140
-rw-r--r--source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h46
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp727
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h182
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp403
-rw-r--r--source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h279
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp9
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp60
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp2
-rw-r--r--source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h1
-rw-r--r--source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp31
-rw-r--r--source/Plugins/Instruction/ARM/EmulateInstructionARM.h2
-rw-r--r--source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp719
-rw-r--r--source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h297
-rw-r--r--source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp430
-rw-r--r--source/Plugins/JITLoader/GDB/JITLoaderGDB.h104
-rw-r--r--source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp6
-rw-r--r--source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp35
-rw-r--r--source/Plugins/ObjectFile/ELF/ELFHeader.cpp6
-rw-r--r--source/Plugins/ObjectFile/ELF/ELFHeader.h8
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp838
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.h55
-rw-r--r--source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp363
-rw-r--r--source/Plugins/ObjectFile/JIT/ObjectFileJIT.h142
-rw-r--r--source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp66
-rw-r--r--source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h2
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.cpp216
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.h41
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp33
-rw-r--r--source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp27
-rw-r--r--source/Plugins/Process/FreeBSD/ProcessMonitor.cpp17
-rw-r--r--source/Plugins/Process/FreeBSD/ProcessMonitor.h7
-rw-r--r--source/Plugins/Process/POSIX/POSIXThread.cpp120
-rw-r--r--source/Plugins/Process/POSIX/ProcessPOSIX.cpp66
-rw-r--r--source/Plugins/Process/POSIX/ProcessPOSIX.h19
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_arm64.cpp318
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_arm64.h95
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp3
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h4
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp12
-rw-r--r--source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h4
-rw-r--r--source/Plugins/Process/Utility/ARMDefines.h2
-rw-r--r--source/Plugins/Process/Utility/ARMUtils.h2
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.cpp18
-rw-r--r--source/Plugins/Process/Utility/FreeBSDSignals.cpp31
-rw-r--r--source/Plugins/Process/Utility/FreeBSDSignals.h28
-rw-r--r--source/Plugins/Process/Utility/HistoryThread.cpp14
-rw-r--r--source/Plugins/Process/Utility/HistoryUnwind.cpp6
-rw-r--r--source/Plugins/Process/Utility/InferiorCallPOSIX.cpp12
-rw-r--r--source/Plugins/Process/Utility/InstructionUtils.h2
-rw-r--r--source/Plugins/Process/Utility/LinuxSignals.cpp62
-rw-r--r--source/Plugins/Process/Utility/LinuxSignals.h35
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp16
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp944
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h296
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp13
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_i386.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp14
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDummy.cpp2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextDummy.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.cpp)20
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.h)10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_mips64.cpp)15
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_mips64.h)10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp)69
-rw-r--r--source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h (renamed from source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h)14
-rw-r--r--source/Plugins/Process/Utility/RegisterContextHistory.cpp2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextHistory.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp49
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.h4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_arm64.cpp89
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_arm64.h81
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp)57
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_i386.h (renamed from source/Plugins/Process/POSIX/RegisterContextLinux_i386.h)10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp)70
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h (renamed from source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h)14
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp4
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMemory.cpp2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMemory.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX.h (renamed from source/Plugins/Process/POSIX/RegisterContextPOSIX.h)21
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp299
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h272
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextPOSIX_mips64.cpp)3
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h (renamed from source/Plugins/Process/POSIX/RegisterContextPOSIX_mips64.h)6
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp (renamed from source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.cpp)49
-rw-r--r--source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h (renamed from source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h)6
-rw-r--r--source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextThreadMemory.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContext_mips64.h (renamed from source/Plugins/Process/POSIX/RegisterContext_mips64.h)0
-rw-r--r--source/Plugins/Process/Utility/RegisterContext_x86.h (renamed from source/Plugins/Process/POSIX/RegisterContext_x86.h)14
-rw-r--r--source/Plugins/Process/Utility/RegisterInfoInterface.h49
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_arm64.h347
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_i386.h (renamed from source/Plugins/Process/POSIX/RegisterInfos_i386.h)14
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_mips64.h (renamed from source/Plugins/Process/POSIX/RegisterInfos_mips64.h)4
-rw-r--r--source/Plugins/Process/Utility/RegisterInfos_x86_64.h (renamed from source/Plugins/Process/POSIX/RegisterInfos_x86_64.h)20
-rw-r--r--source/Plugins/Process/Utility/StopInfoMachException.cpp68
-rw-r--r--source/Plugins/Process/Utility/UnwindLLDB.cpp2
-rw-r--r--source/Plugins/Process/Utility/lldb-x86-register-enums.h292
-rw-r--r--source/Plugins/Process/elf-core/ProcessElfCore.cpp71
-rw-r--r--source/Plugins/Process/elf-core/ProcessElfCore.h48
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp22
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h8
-rw-r--r--source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h4
-rw-r--r--source/Plugins/Process/elf-core/ThreadElfCore.cpp6
-rw-r--r--source/Plugins/Process/elf-core/ThreadElfCore.h2
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp175
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h2
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp386
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h53
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp2993
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h210
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp328
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h2
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp397
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.h25
-rw-r--r--source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp52
-rw-r--r--source/Plugins/Process/gdb-remote/ThreadGDBRemote.h10
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp94
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h9
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp53
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h3
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp94
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp5
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp55
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp34
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h10
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp16
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp5
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h16
-rw-r--r--source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp528
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h9
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp41
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h4
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp16
-rw-r--r--source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp17
-rw-r--r--source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h5
-rw-r--r--source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp475
-rw-r--r--source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h5
-rw-r--r--source/Symbol/Block.cpp46
-rw-r--r--source/Symbol/ClangASTContext.cpp438
-rw-r--r--source/Symbol/ClangASTImporter.cpp178
-rw-r--r--source/Symbol/ClangASTType.cpp2158
-rw-r--r--source/Symbol/ClangExternalASTSourceCallbacks.cpp2
-rw-r--r--source/Symbol/ClangExternalASTSourceCommon.cpp2
-rw-r--r--source/Symbol/CompileUnit.cpp16
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp62
-rw-r--r--source/Symbol/FuncUnwinders.cpp61
-rw-r--r--source/Symbol/Function.cpp46
-rw-r--r--source/Symbol/LineTable.cpp30
-rw-r--r--source/Symbol/ObjectFile.cpp115
-rw-r--r--source/Symbol/Symbol.cpp144
-rw-r--r--source/Symbol/SymbolContext.cpp108
-rw-r--r--source/Symbol/SymbolFile.cpp6
-rw-r--r--source/Symbol/SymbolVendor.cpp33
-rw-r--r--source/Symbol/Symtab.cpp80
-rw-r--r--source/Symbol/Type.cpp313
-rw-r--r--source/Symbol/TypeList.cpp43
-rw-r--r--source/Symbol/UnwindPlan.cpp25
-rw-r--r--source/Symbol/UnwindTable.cpp34
-rw-r--r--source/Symbol/Variable.cpp26
-rw-r--r--source/Target/ABI.cpp34
-rw-r--r--source/Target/FileAction.cpp95
-rw-r--r--source/Target/JITLoader.cpp38
-rw-r--r--source/Target/JITLoaderList.cpp77
-rw-r--r--source/Target/LanguageRuntime.cpp12
-rw-r--r--source/Target/Memory.cpp36
-rw-r--r--source/Target/NativeRegisterContext.cpp470
-rw-r--r--source/Target/NativeRegisterContextRegisterInfo.cpp44
-rw-r--r--source/Target/ObjCLanguageRuntime.cpp23
-rw-r--r--source/Target/PathMappingList.cpp4
-rw-r--r--source/Target/Platform.cpp103
-rw-r--r--source/Target/Process.cpp1458
-rw-r--r--source/Target/ProcessInfo.cpp138
-rw-r--r--source/Target/ProcessLaunchInfo.cpp459
-rw-r--r--source/Target/Queue.cpp15
-rw-r--r--source/Target/QueueItem.cpp85
-rw-r--r--source/Target/RegisterContext.cpp4
-rw-r--r--source/Target/SectionLoadHistory.cpp19
-rw-r--r--source/Target/SectionLoadList.cpp31
-rw-r--r--source/Target/StackFrame.cpp15
-rw-r--r--source/Target/StackFrameList.cpp4
-rw-r--r--source/Target/StackID.cpp5
-rw-r--r--source/Target/StopInfo.cpp106
-rw-r--r--source/Target/Target.cpp127
-rw-r--r--source/Target/TargetList.cpp183
-rw-r--r--source/Target/Thread.cpp335
-rw-r--r--source/Target/ThreadList.cpp11
-rw-r--r--source/Target/ThreadPlan.cpp15
-rw-r--r--source/Target/ThreadPlanBase.cpp4
-rw-r--r--source/Target/ThreadPlanCallFunction.cpp97
-rw-r--r--source/Target/ThreadPlanCallUserExpression.cpp52
-rw-r--r--source/Target/ThreadPlanRunToAddress.cpp2
-rw-r--r--source/Target/ThreadPlanShouldStopHere.cpp142
-rw-r--r--source/Target/ThreadPlanStepInRange.cpp132
-rw-r--r--source/Target/ThreadPlanStepInstruction.cpp94
-rw-r--r--source/Target/ThreadPlanStepOut.cpp179
-rw-r--r--source/Target/ThreadPlanStepOverRange.cpp58
-rw-r--r--source/Target/ThreadPlanStepRange.cpp19
-rw-r--r--source/Target/ThreadPlanStepUntil.cpp2
-rw-r--r--source/Target/ThreadPlanTracer.cpp11
-rw-r--r--source/Utility/ARM64_DWARF_Registers.cpp148
-rw-r--r--source/Utility/ARM64_DWARF_Registers.h102
-rw-r--r--source/Utility/ARM64_GCC_Registers.h92
-rw-r--r--source/Utility/ARM_DWARF_Registers.cpp2
-rw-r--r--source/Utility/PseudoTerminal.cpp9
-rw-r--r--source/Utility/SharingPtr.cpp4
-rw-r--r--source/Utility/StringExtractor.cpp31
-rw-r--r--source/Utility/StringExtractor.h5
-rw-r--r--source/Utility/StringExtractorGDBRemote.cpp6
-rw-r--r--source/Utility/StringExtractorGDBRemote.h3
-rw-r--r--source/Utility/StringLexer.cpp101
-rw-r--r--source/Utility/TimeSpecTimeout.h2
-rw-r--r--source/lldb-log.cpp5
-rw-r--r--source/lldb.cpp75
440 files changed, 39994 insertions, 14079 deletions
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 799c90907634..6aec0722169f 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -127,13 +127,15 @@ SBAddress::GetLoadAddress (const SBTarget &target) const
addr = m_opaque_ap->GetLoadAddress (target_sp.get());
}
}
-
+
if (log)
{
if (addr == LLDB_INVALID_ADDRESS)
- log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target_sp.get());
+ log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS",
+ static_cast<void*>(target_sp.get()));
else
- log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, target_sp.get(), addr);
+ log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64,
+ static_cast<void*>(target_sp.get()), addr);
}
return addr;
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index fbdc0e32f498..a950ca934c68 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -19,9 +19,12 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
@@ -121,9 +124,11 @@ SBBreakpoint::GetID () const
if (log)
{
if (break_id == LLDB_INVALID_BREAK_ID)
- log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get());
+ log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id);
+ log->Printf ("SBBreakpoint(%p)::GetID () => %u",
+ static_cast<void*>(m_opaque_sp.get()), break_id);
}
return break_id;
@@ -133,7 +138,12 @@ SBBreakpoint::GetID () const
bool
SBBreakpoint::IsValid() const
{
- return (bool) m_opaque_sp;
+ if (!m_opaque_sp)
+ return false;
+ else if (m_opaque_sp->GetTarget().GetBreakpointByID(m_opaque_sp->GetID()))
+ return true;
+ else
+ return false;
}
void
@@ -222,7 +232,8 @@ SBBreakpoint::SetEnabled (bool enable)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable);
+ log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)",
+ static_cast<void*>(m_opaque_sp.get()), enable);
if (m_opaque_sp)
{
@@ -249,7 +260,8 @@ SBBreakpoint::SetOneShot (bool one_shot)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)", m_opaque_sp.get(), one_shot);
+ log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)",
+ static_cast<void*>(m_opaque_sp.get()), one_shot);
if (m_opaque_sp)
{
@@ -288,8 +300,9 @@ SBBreakpoint::SetIgnoreCount (uint32_t count)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count);
-
+ log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)",
+ static_cast<void*>(m_opaque_sp.get()), count);
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -330,7 +343,8 @@ SBBreakpoint::GetHitCount () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count);
+ log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u",
+ static_cast<void*>(m_opaque_sp.get()), count);
return count;
}
@@ -347,7 +361,8 @@ SBBreakpoint::GetIgnoreCount () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count);
+ log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u",
+ static_cast<void*>(m_opaque_sp.get()), count);
return count;
}
@@ -362,7 +377,8 @@ SBBreakpoint::SetThreadID (tid_t tid)
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")", m_opaque_sp.get(), tid);
+ log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")",
+ static_cast<void*>(m_opaque_sp.get()), tid);
}
@@ -378,7 +394,8 @@ SBBreakpoint::GetThreadID ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64, m_opaque_sp.get(), tid);
+ log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64,
+ static_cast<void*>(m_opaque_sp.get()), tid);
return tid;
}
@@ -387,7 +404,8 @@ SBBreakpoint::SetThreadIndex (uint32_t index)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index);
+ log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)",
+ static_cast<void*>(m_opaque_sp.get()), index);
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -408,18 +426,19 @@ SBBreakpoint::GetThreadIndex() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), thread_idx);
+ log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u",
+ static_cast<void*>(m_opaque_sp.get()), thread_idx);
return thread_idx;
}
-
void
SBBreakpoint::SetThreadName (const char *thread_name)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name);
+ log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)",
+ static_cast<void*>(m_opaque_sp.get()), thread_name);
if (m_opaque_sp)
{
@@ -441,7 +460,8 @@ SBBreakpoint::GetThreadName () const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name);
+ log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s",
+ static_cast<void*>(m_opaque_sp.get()), name);
return name;
}
@@ -451,7 +471,8 @@ SBBreakpoint::SetQueueName (const char *queue_name)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name);
+ log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)",
+ static_cast<void*>(m_opaque_sp.get()), queue_name);
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -472,7 +493,8 @@ SBBreakpoint::GetQueueName () const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name);
+ log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s",
+ static_cast<void*>(m_opaque_sp.get()), name);
return name;
}
@@ -488,7 +510,9 @@ SBBreakpoint::GetNumResolvedLocations() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved);
+ log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64,
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<uint64_t>(num_resolved));
return num_resolved;
}
@@ -503,7 +527,9 @@ SBBreakpoint::GetNumLocations() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_locs);
+ log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64,
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<uint64_t>(num_locs));
return num_locs;
}
@@ -567,9 +593,14 @@ void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
- log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton);
+ {
+ void *pointer = &callback;
+ log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ *static_cast<void**>(&pointer), static_cast<void*>(baton));
+ }
if (m_opaque_sp)
{
@@ -579,6 +610,48 @@ SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
}
}
+void
+SBBreakpoint::SetScriptCallbackFunction (const char *callback_function_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackFunction (callback=%s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ callback_function_name);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
+ m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
+ callback_function_name);
+ }
+}
+
+SBError
+SBBreakpoint::SetScriptCallbackBody (const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
+ static_cast<void*>(m_opaque_sp.get()), callback_body_text);
+
+ SBError sb_error;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
+ Error error = m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+ callback_body_text);
+ sb_error.SetError(error);
+ }
+ else
+ sb_error.SetErrorString("invalid breakpoint");
+
+ return sb_error;
+}
lldb_private::Breakpoint *
SBBreakpoint::operator->() const
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index 6fdf59f38b4a..4390e9ad737a 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -17,10 +17,13 @@
#include "lldb/lldb-defines.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Target/ThreadSpec.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
@@ -43,7 +46,9 @@ SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &br
SBStream sstr;
GetDescription (sstr, lldb::eDescriptionLevelBrief);
log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp"
- "=%p) => this.sp = %p (%s)", break_loc_sp.get(), m_opaque_sp.get(), sstr.GetData());
+ "=%p) => this.sp = %p (%s)",
+ static_cast<void*>(break_loc_sp.get()),
+ static_cast<void*>(m_opaque_sp.get()), sstr.GetData());
}
}
@@ -160,6 +165,49 @@ SBBreakpointLocation::GetCondition ()
}
void
+SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ callback_function_name);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
+ callback_function_name);
+ }
+}
+
+SBError
+SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
+ static_cast<void*>(m_opaque_sp.get()), callback_body_text);
+
+ SBError sb_error;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ Error error = m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+ callback_body_text);
+ sb_error.SetError(error);
+ }
+ else
+ sb_error.SetErrorString("invalid breakpoint");
+
+ return sb_error;
+}
+
+void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
if (m_opaque_sp)
@@ -312,8 +360,9 @@ SBBreakpointLocation::GetBreakpoint ()
{
SBStream sstr;
sb_bp.GetDescription (sstr);
- log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s",
- m_opaque_sp.get(), sb_bp.get(), sstr.GetData());
+ log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_bp.get()), sstr.GetData());
}
return sb_bp;
}
diff --git a/source/API/SBBroadcaster.cpp b/source/API/SBBroadcaster.cpp
index 7168305ac80b..73eac5183f8a 100644
--- a/source/API/SBBroadcaster.cpp
+++ b/source/API/SBBroadcaster.cpp
@@ -33,7 +33,7 @@ SBBroadcaster::SBBroadcaster (const char *name) :
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)",
- name, m_opaque_ptr);
+ name, static_cast<void*>(m_opaque_ptr));
}
SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) :
@@ -43,8 +43,9 @@ SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
- log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)",
- broadcaster, owns, m_opaque_ptr);
+ log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)",
+ static_cast<void*>(broadcaster), owns,
+ static_cast<void*>(m_opaque_ptr));
}
SBBroadcaster::SBBroadcaster (const SBBroadcaster &rhs) :
@@ -75,7 +76,8 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique);
+ log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)",
+ static_cast<void*>(m_opaque_ptr), event_type, unique);
if (m_opaque_ptr == NULL)
return;
@@ -92,7 +94,9 @@ SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique);
+ log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()), unique);
if (m_opaque_ptr == NULL)
return;
@@ -109,7 +113,9 @@ SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events);
+ log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(listener.get()), requested_events);
if (m_opaque_ptr)
m_opaque_ptr->AddInitialEventsToListener (listener.get(), requested_events);
}
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index f1faa13ba981..e1adea795b08 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -65,7 +65,9 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
if (log)
log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)"
- " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr);
+ " => SBCommandInterpreter(%p)",
+ static_cast<void*>(interpreter),
+ static_cast<void*>(m_opaque_ptr));
}
SBCommandInterpreter::SBCommandInterpreter(const SBCommandInterpreter &rhs) :
@@ -129,12 +131,14 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
- m_opaque_ptr, command_line, result.get(), add_to_history);
+ log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
+ static_cast<void*>(m_opaque_ptr), command_line,
+ static_cast<void*>(result.get()), add_to_history);
result.Clear();
if (command_line && m_opaque_ptr)
{
+ result.ref().SetInteractive(false);
m_opaque_ptr->HandleCommand (command_line, add_to_history ? eLazyBoolYes : eLazyBoolNo, result.ref());
}
else
@@ -150,7 +154,9 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
SBStream sstr;
result.GetDescription (sstr);
log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p): %s, add_to_history=%i) => %i",
- m_opaque_ptr, command_line, result.get(), sstr.GetData(), add_to_history, result.GetStatus());
+ static_cast<void*>(m_opaque_ptr), command_line,
+ static_cast<void*>(result.get()), sstr.GetData(),
+ add_to_history, result.GetStatus());
}
return result.GetStatus();
@@ -166,23 +172,27 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
int num_completions = 0;
-
+
// Sanity check the arguments that are passed in:
// cursor & last_char have to be within the current_line.
if (current_line == NULL || cursor == NULL || last_char == NULL)
return 0;
-
+
if (cursor < current_line || last_char < current_line)
return 0;
-
+
size_t current_line_size = strlen (current_line);
- if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+ if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
+ last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
return 0;
-
+
if (log)
log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %" PRId64 ", last char at: %" PRId64 ", match_start_point: %d, max_return_elements: %d)",
- m_opaque_ptr, current_line, (uint64_t) (cursor - current_line), (uint64_t) (last_char - current_line), match_start_point, max_return_elements);
-
+ static_cast<void*>(m_opaque_ptr), current_line,
+ static_cast<uint64_t>(cursor - current_line),
+ static_cast<uint64_t>(last_char - current_line),
+ match_start_point, max_return_elements);
+
if (m_opaque_ptr)
{
lldb_private::StringList lldb_matches;
@@ -193,8 +203,9 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
matches.AppendList (temp_list);
}
if (log)
- log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.", m_opaque_ptr, num_completions);
-
+ log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.",
+ static_cast<void*>(m_opaque_ptr), num_completions);
+
return num_completions;
}
@@ -253,9 +264,9 @@ SBCommandInterpreter::GetProcess ()
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)",
- m_opaque_ptr, process_sp.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(process_sp.get()));
-
return sb_process;
}
@@ -266,12 +277,12 @@ SBCommandInterpreter::GetDebugger ()
if (m_opaque_ptr)
sb_debugger.reset(m_opaque_ptr->GetDebugger().shared_from_this());
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetDebugger () => SBDebugger(%p)",
- m_opaque_ptr, sb_debugger.get());
-
-
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(sb_debugger.get()));
+
return sb_debugger;
}
@@ -315,8 +326,8 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))",
- m_opaque_ptr, result.get());
-
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(result.get()));
}
void
@@ -340,7 +351,8 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))",
- m_opaque_ptr, result.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(result.get()));
}
SBBroadcaster
@@ -352,7 +364,7 @@ SBCommandInterpreter::GetBroadcaster ()
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetBroadcaster() => SBBroadcaster(%p)",
- m_opaque_ptr, broadcaster.get());
+ static_cast<void*>(m_opaque_ptr), static_cast<void*>(broadcaster.get()));
return broadcaster;
}
diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp
index 83d65637d3f2..1ae2df76c979 100644
--- a/source/API/SBCommandReturnObject.cpp
+++ b/source/API/SBCommandReturnObject.cpp
@@ -75,14 +75,16 @@ SBCommandReturnObject::GetOutput ()
if (m_opaque_ap.get())
{
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", m_opaque_ap.get(),
+ log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()),
m_opaque_ap->GetOutputData());
return m_opaque_ap->GetOutputData();
}
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL", m_opaque_ap.get());
+ log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
return NULL;
}
@@ -95,14 +97,16 @@ SBCommandReturnObject::GetError ()
if (m_opaque_ap.get())
{
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", m_opaque_ap.get(),
+ log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()),
m_opaque_ap->GetErrorData());
return m_opaque_ap->GetErrorData();
}
-
+
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL", m_opaque_ap.get());
+ log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
return NULL;
}
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index 10feae5d4ebb..df0b864fad94 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -32,7 +32,8 @@ SBCommunication::SBCommunication(const char * broadcaster_name) :
if (log)
log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => "
- "SBCommunication(%p)", broadcaster_name, m_opaque);
+ "SBCommunication(%p)", broadcaster_name,
+ static_cast<void*>(m_opaque));
}
SBCommunication::~SBCommunication()
@@ -97,8 +98,9 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
}
if (log)
- log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s",
- m_opaque, fd, owns_fd, Communication::ConnectionStatusAsCString (status));
+ log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s",
+ static_cast<void*>(m_opaque), fd, owns_fd,
+ Communication::ConnectionStatusAsCString (status));
return status;
}
@@ -114,7 +116,8 @@ SBCommunication::Disconnect ()
status = m_opaque->Disconnect ();
if (log)
- log->Printf ("SBCommunication(%p)::Disconnect () => %s", m_opaque,
+ log->Printf ("SBCommunication(%p)::Disconnect () => %s",
+ static_cast<void*>(m_opaque),
Communication::ConnectionStatusAsCString (status));
return status;
@@ -129,7 +132,8 @@ SBCommunication::IsConnected () const
result = m_opaque->IsConnected ();
if (log)
- log->Printf ("SBCommunication(%p)::IsConnected () => %i", m_opaque, result);
+ log->Printf ("SBCommunication(%p)::IsConnected () => %i",
+ static_cast<void*>(m_opaque), result);
return false;
}
@@ -140,10 +144,8 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status)...",
- m_opaque,
- dst,
- (uint64_t)dst_len,
- timeout_usec);
+ static_cast<void*>(m_opaque), static_cast<void*>(dst),
+ static_cast<uint64_t>(dst_len), timeout_usec);
size_t bytes_read = 0;
if (m_opaque)
bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL);
@@ -152,12 +154,10 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status=%s) => %" PRIu64,
- m_opaque,
- dst,
- (uint64_t)dst_len,
- timeout_usec,
+ static_cast<void*>(m_opaque), static_cast<void*>(dst),
+ static_cast<uint64_t>(dst_len), timeout_usec,
Communication::ConnectionStatusAsCString (status),
- (uint64_t)bytes_read);
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -174,7 +174,10 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%" PRIu64 ", &status=%s) => %" PRIu64,
- m_opaque, src, (uint64_t)src_len, Communication::ConnectionStatusAsCString (status), (uint64_t)bytes_written);
+ static_cast<void*>(m_opaque), static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ Communication::ConnectionStatusAsCString (status),
+ static_cast<uint64_t>(bytes_written));
return 0;
}
@@ -189,7 +192,8 @@ SBCommunication::ReadThreadStart ()
success = m_opaque->StartReadThread ();
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success);
+ log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i",
+ static_cast<void*>(m_opaque), success);
return success;
}
@@ -200,14 +204,16 @@ SBCommunication::ReadThreadStop ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque);
+ log->Printf ("SBCommunication(%p)::ReadThreadStop ()...",
+ static_cast<void*>(m_opaque));
bool success = false;
if (m_opaque)
success = m_opaque->StopReadThread ();
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", m_opaque, success);
+ log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i",
+ static_cast<void*>(m_opaque), success);
return success;
}
@@ -220,7 +226,8 @@ SBCommunication::ReadThreadIsRunning ()
result = m_opaque->ReadThreadIsRunning ();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result);
+ log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i",
+ static_cast<void*>(m_opaque), result);
return result;
}
@@ -242,7 +249,9 @@ SBCommunication::SetReadThreadBytesReceivedCallback
if (log)
log->Printf ("SBCommunication(%p)::SetReadThreadBytesReceivedCallback (callback=%p, baton=%p) => %i",
- m_opaque, callback, callback_baton, result);
+ static_cast<void*>(m_opaque),
+ reinterpret_cast<void*>(reinterpret_cast<intptr_t>(callback)),
+ static_cast<void*>(callback_baton), result);
return result;
}
@@ -256,7 +265,8 @@ SBCommunication::GetBroadcaster ()
if (log)
log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)",
- m_opaque, broadcaster.get());
+ static_cast<void*>(m_opaque),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
diff --git a/source/API/SBCompileUnit.cpp b/source/API/SBCompileUnit.cpp
index 9f7487746a85..03c25710a9e4 100644
--- a/source/API/SBCompileUnit.cpp
+++ b/source/API/SBCompileUnit.cpp
@@ -87,13 +87,14 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
sb_line_entry.SetLineEntry(line_entry);
}
}
-
+
if (log)
{
SBStream sstr;
sb_line_entry.GetDescription (sstr);
- log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'",
- m_opaque_ptr, idx, sb_line_entry.get(), sstr.GetData());
+ log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'",
+ static_cast<void*>(m_opaque_ptr), idx,
+ static_cast<void*>(sb_line_entry.get()), sstr.GetData());
}
return sb_line_entry;
@@ -120,7 +121,6 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
else
file_spec = *m_opaque_ptr;
-
index = m_opaque_ptr->FindLineEntry (start_idx,
line,
inline_file_spec ? inline_file_spec->get() : NULL,
@@ -133,13 +133,20 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
SBStream sstr;
if (index == UINT32_MAX)
{
- log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND",
- m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL);
+ log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND",
+ static_cast<void*>(m_opaque_ptr), start_idx, line,
+ inline_file_spec
+ ? static_cast<const void*>(inline_file_spec->get())
+ : NULL);
}
else
{
- log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u",
- m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, index);
+ log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u",
+ static_cast<void*>(m_opaque_ptr), start_idx, line,
+ inline_file_spec
+ ? static_cast<const void*>(inline_file_spec->get())
+ : NULL,
+ index);
}
}
@@ -196,13 +203,15 @@ SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const
FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
sb_file_spec.SetFileSpec(file_spec);
}
-
+
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
- m_opaque_ptr, idx, sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
+ static_cast<void*>(m_opaque_ptr), idx,
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
return sb_file_spec;
diff --git a/source/API/SBData.cpp b/source/API/SBData.cpp
index 06dcfc12af41..a58585295a21 100644
--- a/source/API/SBData.cpp
+++ b/source/API/SBData.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include <inttypes.h> // PRIu64
+
#include "lldb/API/SBData.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
@@ -122,7 +124,7 @@ SBData::GetByteSize ()
value = m_opaque_sp->GetByteSize();
if (log)
log->Printf ("SBData::GetByteSize () => "
- "(%zu)", value);
+ "( %" PRIu64 " )", (uint64_t)value);
return value;
}
@@ -167,8 +169,8 @@ SBData::GetFloat (lldb::SBError& error, lldb::offset_t offset)
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => "
- "(%f)", error.get(), offset, value);
+ log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => (%f)",
+ static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -190,7 +192,7 @@ SBData::GetDouble (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetDouble (error=%p,offset=%" PRIu64 ") => "
- "(%f)", error.get(), offset, value);
+ "(%f)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -212,7 +214,7 @@ SBData::GetLongDouble (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetLongDouble (error=%p,offset=%" PRIu64 ") => "
- "(%Lf)", error.get(), offset, value);
+ "(%Lf)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -234,7 +236,8 @@ SBData::GetAddress (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetAddress (error=%p,offset=%" PRIu64 ") => "
- "(%p)", error.get(), offset, (void*)value);
+ "(%p)", static_cast<void*>(error.get()), offset,
+ reinterpret_cast<void*>(value));
return value;
}
@@ -256,7 +259,7 @@ SBData::GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt8 (error=%p,offset=%" PRIu64 ") => "
- "(%c)", error.get(), offset, value);
+ "(%c)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -278,7 +281,7 @@ SBData::GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt16 (error=%p,offset=%" PRIu64 ") => "
- "(%hd)", error.get(), offset, value);
+ "(%hd)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -300,7 +303,7 @@ SBData::GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt32 (error=%p,offset=%" PRIu64 ") => "
- "(%d)", error.get(), offset, value);
+ "(%d)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -322,7 +325,8 @@ SBData::GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt64 (error=%p,offset=%" PRIu64 ") => "
- "(%" PRId64 ")", error.get(), offset, value);
+ "(%" PRId64 ")", static_cast<void*>(error.get()), offset,
+ value);
return value;
}
@@ -344,7 +348,7 @@ SBData::GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt8 (error=%p,offset=%" PRIu64 ") => "
- "(%c)", error.get(), offset, value);
+ "(%c)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -366,7 +370,7 @@ SBData::GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt16 (error=%p,offset=%" PRIu64 ") => "
- "(%hd)", error.get(), offset, value);
+ "(%hd)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -388,7 +392,7 @@ SBData::GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt32 (error=%p,offset=%" PRIu64 ") => "
- "(%d)", error.get(), offset, value);
+ "(%d)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -410,7 +414,8 @@ SBData::GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt64 (error=%p,offset=%" PRIu64 ") => "
- "(%" PRId64 ")", error.get(), offset, value);
+ "(%" PRId64 ")", static_cast<void*>(error.get()), offset,
+ value);
return value;
}
@@ -431,8 +436,9 @@ SBData::GetString (lldb::SBError& error, lldb::offset_t offset)
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => "
- "(%p)", error.get(), offset, value);
+ log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => (%p)",
+ static_cast<void*>(error.get()), offset,
+ static_cast<const void*>(value));
return value;
}
@@ -479,8 +485,10 @@ SBData::ReadRawData (lldb::SBError& error,
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%zu) => "
- "(%p)", error.get(), offset, buf, size, ok);
+ log->Printf("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%" PRIu64 ") => "
+ "(%p)", static_cast<void*>(error.get()), offset,
+ static_cast<void*>(buf), static_cast<uint64_t>(size),
+ static_cast<void*>(ok));
return ok ? size : 0;
}
@@ -497,8 +505,10 @@ SBData::SetData (lldb::SBError& error,
else
m_opaque_sp->SetData(buf, size, endian);
if (log)
- log->Printf ("SBData::SetData (error=%p,buf=%p,size=%zu,endian=%d,addr_size=%c) => "
- "(%p)", error.get(), buf, size, endian, addr_size, m_opaque_sp.get());
+ log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRIu64 ",endian=%d,addr_size=%c) => "
+ "(%p)", static_cast<void*>(error.get()),
+ static_cast<const void*>(buf), static_cast<uint64_t>(size),
+ endian, addr_size, static_cast<void*>(m_opaque_sp.get()));
}
bool
@@ -509,8 +519,8 @@ SBData::Append (const SBData& rhs)
if (m_opaque_sp.get() && rhs.m_opaque_sp.get())
value = m_opaque_sp.get()->Append(*rhs.m_opaque_sp);
if (log)
- log->Printf ("SBData::Append (rhs=%p) => "
- "(%s)", rhs.get(), value ? "true" : "false");
+ log->Printf ("SBData::Append (rhs=%p) => (%s)",
+ static_cast<void*>(rhs.get()), value ? "true" : "false");
return value;
}
@@ -614,28 +624,28 @@ bool
SBData::SetDataFromCString (const char* data)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!data)
{
if (log)
- log->Printf ("SBData::SetDataFromCString (data=%p) => "
- "false", data);
+ log->Printf ("SBData::SetDataFromCString (data=%p) => false",
+ static_cast<const void*>(data));
return false;
}
-
+
size_t data_len = strlen(data);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(data, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromCString (data=%p) => "
- "true", data);
-
+ log->Printf ("SBData::SetDataFromCString (data=%p) => true",
+ static_cast<const void*>(data));
+
return true;
}
@@ -643,28 +653,30 @@ bool
SBData::SetDataFromUInt64Array (uint64_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromUInt64Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
size_t data_len = array_len * sizeof(uint64_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromUInt64Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -672,28 +684,30 @@ bool
SBData::SetDataFromUInt32Array (uint32_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromUInt32Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(uint32_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromUInt32Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -701,28 +715,30 @@ bool
SBData::SetDataFromSInt64Array (int64_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromSInt64Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(int64_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromSInt64Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -730,28 +746,30 @@ bool
SBData::SetDataFromSInt32Array (int32_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromSInt32Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(int32_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromSInt32Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -759,27 +777,29 @@ bool
SBData::SetDataFromDoubleArray (double* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromDoubleArray (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(double);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromDoubleArray (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 8d6887a6c280..dae567525a4a 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -38,13 +38,14 @@
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/DataFormatters/DataVisualization.h"
-#include "lldb/Host/DynamicLibrary.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/TargetList.h"
+#include "llvm/Support/DynamicLibrary.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -72,22 +73,22 @@ SBInputReader::IsActive() const
return false;
}
-static lldb::DynamicLibrarySP
+static llvm::sys::DynamicLibrary
LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& error)
{
- lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec));
- if (dynlib_sp && dynlib_sp->IsValid())
+ llvm::sys::DynamicLibrary dynlib = llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
+ if (dynlib.isValid())
{
typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
lldb::SBDebugger debugger_sb(debugger_sp);
// This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger) function.
// TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays
- LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
+ LLDBCommandPluginInit init_func = (LLDBCommandPluginInit)dynlib.getAddressOfSymbol("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
if (init_func)
{
if (init_func(debugger_sb))
- return dynlib_sp;
+ return dynlib;
else
error.SetErrorString("plug-in refused to load (lldb::PluginInitialize(lldb::SBDebugger) returned false)");
}
@@ -103,7 +104,7 @@ LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& er
else
error.SetErrorString("no such file");
}
- return lldb::DynamicLibrarySP();
+ return llvm::sys::DynamicLibrary();
}
void
@@ -131,8 +132,9 @@ SBDebugger::Clear ()
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get());
-
+ log->Printf ("SBDebugger(%p)::Clear ()",
+ static_cast<void*>(m_opaque_sp.get()));
+
if (m_opaque_sp)
m_opaque_sp->ClearIOHandlers ();
@@ -158,13 +160,24 @@ SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, voi
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBDebugger debugger;
+
+ // Currently we have issues if this function is called simultaneously on two different
+ // threads. The issues mainly revolve around the fact that the lldb_private::FormatManager
+ // uses global collections and having two threads parsing the .lldbinit files can cause
+ // mayhem. So to get around this for now we need to use a mutex to prevent bad things
+ // from happening.
+ static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+ Mutex::Locker locker(g_mutex);
+
debugger.reset(Debugger::CreateInstance(callback, baton));
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
- log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s",
+ static_cast<void*>(debugger.m_opaque_sp.get()),
+ sstr.GetData());
}
SBCommandInterpreter interp = debugger.GetCommandInterpreter();
@@ -187,16 +200,18 @@ void
SBDebugger::Destroy (SBDebugger &debugger)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
- log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s",
+ static_cast<void*>(debugger.m_opaque_sp.get()),
+ sstr.GetData());
}
-
+
Debugger::Destroy (debugger.m_opaque_sp);
-
+
if (debugger.m_opaque_sp.get() != NULL)
debugger.m_opaque_sp.reset();
}
@@ -293,8 +308,9 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
@@ -307,8 +323,9 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
if (log)
- log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
@@ -321,8 +338,9 @@ SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
if (log)
- log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
@@ -389,8 +407,9 @@ SBDebugger::GetCommandInterpreter ()
sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
if (log)
- log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)",
- m_opaque_sp.get(), sb_interpreter.get());
+ log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_interpreter.get()));
return sb_interpreter;
}
@@ -443,8 +462,9 @@ SBDebugger::GetListener ()
sb_listener.reset(&m_opaque_sp->GetListener(), false);
if (log)
- log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", m_opaque_sp.get(),
- sb_listener.get());
+ log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_listener.get()));
return sb_listener;
}
@@ -601,14 +621,14 @@ SBDebugger::CreateTarget (const char *filename,
sb_error.Clear();
OptionGroupPlatform platform_options (false);
platform_options.SetPlatformName (platform_name);
-
+
sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
filename,
target_triple,
add_dependent_modules,
&platform_options,
target_sp);
-
+
if (sb_error.Success())
sb_target.SetSP (target_sp);
}
@@ -616,20 +636,14 @@ SBDebugger::CreateTarget (const char *filename,
{
sb_error.SetErrorString("invalid target");
}
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)",
- m_opaque_sp.get(),
- filename,
- target_triple,
- platform_name,
- add_dependent_modules,
- sb_error.GetCString(),
- target_sp.get());
- }
-
+ log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ target_triple, platform_name, add_dependent_modules,
+ sb_error.GetCString(), static_cast<void*>(target_sp.get()));
+
return sb_target;
}
@@ -650,13 +664,12 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
target_sp));
sb_target.SetSP (target_sp);
}
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)",
- m_opaque_sp.get(), filename, target_triple, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ target_triple, static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -688,10 +701,9 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_
}
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)",
- m_opaque_sp.get(), filename, arch_cstr, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename, arch_cstr,
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -723,10 +735,9 @@ SBDebugger::CreateTarget (const char *filename)
}
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
- m_opaque_sp.get(), filename, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -750,9 +761,9 @@ SBDebugger::DeleteTarget (lldb::SBTarget &target)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", m_opaque_sp.get(), target.m_opaque_sp.get(), result);
- }
+ log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target.m_opaque_sp.get()), result);
return result;
}
@@ -850,8 +861,9 @@ SBDebugger::GetSelectedTarget ()
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
- log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(),
- target_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()), sstr.GetData());
}
return sb_target;
@@ -871,8 +883,9 @@ SBDebugger::SetSelectedTarget (SBTarget &sb_target)
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
- log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(),
- target_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()), sstr.GetData());
}
}
@@ -888,10 +901,10 @@ SBDebugger::GetSelectedPlatform()
sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
}
if (log)
- {
- log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s", m_opaque_sp.get(),
- sb_platform.GetSP().get(), sb_platform.GetName());
- }
+ log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_platform.GetSP().get()),
+ sb_platform.GetName());
return sb_platform;
}
@@ -899,17 +912,18 @@ void
SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
DebuggerSP debugger_sp(m_opaque_sp);
if (debugger_sp)
{
debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
}
+
if (log)
- {
- log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)", m_opaque_sp.get(),
- sb_platform.GetSP().get(), sb_platform.GetName());
- }
+ log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_platform.GetSP().get()),
+ sb_platform.GetName());
}
void
@@ -1077,9 +1091,10 @@ const char *
SBDebugger::GetPrompt() const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
- log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(),
+ log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"",
+ static_cast<void*>(m_opaque_sp.get()),
(m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
if (m_opaque_sp)
diff --git a/source/API/SBDeclaration.cpp b/source/API/SBDeclaration.cpp
index fc90156e75ad..8aea675afeba 100644
--- a/source/API/SBDeclaration.cpp
+++ b/source/API/SBDeclaration.cpp
@@ -74,19 +74,21 @@ SBFileSpec
SBDeclaration::GetFileSpec () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->GetFile())
sb_file_spec.SetFileSpec(m_opaque_ap->GetFile());
-
+
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(),
- sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
-
+
return sb_file_spec;
}
@@ -94,14 +96,15 @@ uint32_t
SBDeclaration::GetLine () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
uint32_t line = 0;
if (m_opaque_ap.get())
line = m_opaque_ap->GetLine();
-
+
if (log)
- log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line);
-
+ log->Printf ("SBLineEntry(%p)::GetLine () => %u",
+ static_cast<void*>(m_opaque_ap.get()), line);
+
return line;
}
diff --git a/source/API/SBError.cpp b/source/API/SBError.cpp
index bd6b54300f60..157997b2502f 100644
--- a/source/API/SBError.cpp
+++ b/source/API/SBError.cpp
@@ -77,7 +77,8 @@ SBError::Fail () const
ret_value = m_opaque_ap->Fail();
if (log)
- log->Printf ("SBError(%p)::Fail () => %i", m_opaque_ap.get(), ret_value);
+ log->Printf ("SBError(%p)::Fail () => %i",
+ static_cast<void*>(m_opaque_ap.get()), ret_value);
return ret_value;
}
@@ -91,7 +92,8 @@ SBError::Success () const
ret_value = m_opaque_ap->Success();
if (log)
- log->Printf ("SBError(%p)::Success () => %i", m_opaque_ap.get(), ret_value);
+ log->Printf ("SBError(%p)::Success () => %i",
+ static_cast<void*>(m_opaque_ap.get()), ret_value);
return ret_value;
}
@@ -106,7 +108,8 @@ SBError::GetError () const
err = m_opaque_ap->GetError();
if (log)
- log->Printf ("SBError(%p)::GetError () => 0x%8.8x", m_opaque_ap.get(), err);
+ log->Printf ("SBError(%p)::GetError () => 0x%8.8x",
+ static_cast<void*>(m_opaque_ap.get()), err);
return err;
@@ -121,7 +124,8 @@ SBError::GetType () const
err_type = m_opaque_ap->GetType();
if (log)
- log->Printf ("SBError(%p)::GetType () => %i", m_opaque_ap.get(), err_type);
+ log->Printf ("SBError(%p)::GetType () => %i",
+ static_cast<void*>(m_opaque_ap.get()), err_type);
return err_type;
}
diff --git a/source/API/SBEvent.cpp b/source/API/SBEvent.cpp
index d5d4a84bc1fd..57a699fd739d 100644
--- a/source/API/SBEvent.cpp
+++ b/source/API/SBEvent.cpp
@@ -92,9 +92,11 @@ SBEvent::GetType () const
{
StreamString sstr;
if (lldb_event && lldb_event->GetBroadcaster() && lldb_event->GetBroadcaster()->GetEventNames(sstr, event_type, true))
- log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)", get(), event_type, sstr.GetData());
+ log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)",
+ static_cast<void*>(get()), event_type, sstr.GetData());
else
- log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type);
+ log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x",
+ static_cast<void*>(get()), event_type);
}
@@ -141,11 +143,10 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
// For logging, this gets a little chatty so only enable this when verbose logging is on
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
- log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
- get(),
- broadcaster.get(),
- broadcaster.GetName(),
- success);
+ log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
+ static_cast<void*>(get()),
+ static_cast<void*>(broadcaster.get()),
+ broadcaster.GetName(), success);
return success;
}
@@ -206,8 +207,8 @@ SBEvent::GetCStringFromEvent (const SBEvent &event)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"",
- event.get(),
+ log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"",
+ static_cast<void*>(event.get()),
reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())));
return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()));
diff --git a/source/API/SBExpressionOptions.cpp b/source/API/SBExpressionOptions.cpp
index ae1c8f99df30..448ff4cf6dd6 100644
--- a/source/API/SBExpressionOptions.cpp
+++ b/source/API/SBExpressionOptions.cpp
@@ -101,6 +101,18 @@ SBExpressionOptions::SetTimeoutInMicroSeconds (uint32_t timeout)
m_opaque_ap->SetTimeoutUsec (timeout);
}
+uint32_t
+SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds () const
+{
+ return m_opaque_ap->GetOneThreadTimeoutUsec ();
+}
+
+void
+SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds (uint32_t timeout)
+{
+ m_opaque_ap->SetOneThreadTimeoutUsec (timeout);
+}
+
bool
SBExpressionOptions::GetTryAllThreads () const
{
@@ -114,6 +126,18 @@ SBExpressionOptions::SetTryAllThreads (bool run_others)
}
bool
+SBExpressionOptions::GetStopOthers () const
+{
+ return m_opaque_ap->GetStopOthers ();
+}
+
+void
+SBExpressionOptions::SetStopOthers (bool run_others)
+{
+ m_opaque_ap->SetStopOthers (run_others);
+}
+
+bool
SBExpressionOptions::GetTrapExceptions () const
{
return m_opaque_ap->GetTrapExceptions ();
@@ -125,6 +149,43 @@ SBExpressionOptions::SetTrapExceptions (bool trap_exceptions)
m_opaque_ap->SetTrapExceptions (trap_exceptions);
}
+void
+SBExpressionOptions::SetLanguage (lldb::LanguageType language)
+{
+ m_opaque_ap->SetLanguage(language);
+}
+
+void
+SBExpressionOptions::SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
+{
+ m_opaque_ap->SetCancelCallback (callback, baton);
+}
+
+bool
+SBExpressionOptions::GetGenerateDebugInfo ()
+{
+ return m_opaque_ap->GetGenerateDebugInfo();
+}
+
+void
+SBExpressionOptions::SetGenerateDebugInfo (bool b)
+{
+ return m_opaque_ap->SetGenerateDebugInfo(b);
+}
+
+bool
+SBExpressionOptions::GetSuppressPersistentResult ()
+{
+ return m_opaque_ap->GetResultIsInternal ();
+}
+
+void
+SBExpressionOptions::SetSuppressPersistentResult (bool b)
+{
+ return m_opaque_ap->SetResultIsInternal (b);
+}
+
+
EvaluateExpressionOptions *
SBExpressionOptions::get() const
{
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 4fd2866c9b05..8d63fc587d81 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include <inttypes.h> // PRIu64
#include <limits.h>
#include "lldb/API/SBFileSpec.h"
@@ -15,6 +16,8 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
+#include "llvm/ADT/SmallString.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -35,7 +38,7 @@ SBFileSpec::SBFileSpec (const lldb_private::FileSpec& fspec) :
{
}
-// Deprected!!!
+// Deprecated!!!
SBFileSpec::SBFileSpec (const char *path) :
m_opaque_ap(new FileSpec (path, true))
{
@@ -72,7 +75,9 @@ SBFileSpec::Exists () const
bool result = m_opaque_ap->Exists();
if (log)
- log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false"));
+ log->Printf ("SBFileSpec(%p)::Exists () => %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ (result ? "true" : "false"));
return result;
}
@@ -86,7 +91,11 @@ SBFileSpec::ResolveExecutableLocation ()
int
SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
{
- return lldb_private::FileSpec::Resolve (src_path, dst_path, dst_len);
+ llvm::SmallString<64> result(src_path);
+ lldb_private::FileSpec::Resolve (result);
+ size_t result_length = std::min(dst_len-1, result.size());
+ ::strncpy(dst_path, result.c_str(), result_length + 1);
+ return result_length;
}
const char *
@@ -98,9 +107,11 @@ SBFileSpec::GetFilename() const
if (log)
{
if (s)
- log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s);
+ log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()), s);
else
- log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get());
+ log->Printf ("SBFileSpec(%p)::GetFilename () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
}
return s;
@@ -114,9 +125,11 @@ SBFileSpec::GetDirectory() const
if (log)
{
if (s)
- log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s);
+ log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()), s);
else
- log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", m_opaque_ap.get());
+ log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
}
return s;
}
@@ -148,7 +161,8 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
if (log)
log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 ") => %u",
- m_opaque_ap.get(), result, dst_path, (uint64_t)dst_len, result);
+ static_cast<void*>(m_opaque_ap.get()), result, dst_path,
+ static_cast<uint64_t>(dst_len), result);
if (result == 0 && dst_path && dst_len > 0)
*dst_path = '\0';
diff --git a/source/API/SBFileSpecList.cpp b/source/API/SBFileSpecList.cpp
index 3ebf3cc80a2a..a457a754f0d0 100644
--- a/source/API/SBFileSpecList.cpp
+++ b/source/API/SBFileSpecList.cpp
@@ -38,7 +38,8 @@ SBFileSpecList::SBFileSpecList (const SBFileSpecList &rhs) :
if (log)
{
log->Printf ("SBFileSpecList::SBFileSpecList (const SBFileSpecList rhs.ap=%p) => SBFileSpecList(%p)",
- rhs.m_opaque_ap.get(), m_opaque_ap.get());
+ static_cast<void*>(rhs.m_opaque_ap.get()),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 44fc654c44b6..325f40fd5b56 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -63,9 +63,9 @@ SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) :
{
SBStream sstr;
GetDescription (sstr);
- log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
- lldb_object_sp.get(), lldb_object_sp.get(), sstr.GetData());
-
+ log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
+ static_cast<void*>(lldb_object_sp.get()),
+ static_cast<void*>(lldb_object_sp.get()), sstr.GetData());
}
}
@@ -141,8 +141,9 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
}
if (log)
- log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
- frame, resolve_scope, sb_sym_ctx.get());
+ log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
+ static_cast<void*>(frame), resolve_scope,
+ static_cast<void*>(sb_sym_ctx.get()));
return sb_sym_ctx;
}
@@ -184,8 +185,9 @@ SBFrame::GetModule () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
- frame, module_sp.get());
+ log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(module_sp.get()));
return sb_module;
}
@@ -224,8 +226,9 @@ SBFrame::GetCompileUnit () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
- frame, sb_comp_unit.get());
+ log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_comp_unit.get()));
return sb_comp_unit;
}
@@ -264,8 +267,9 @@ SBFrame::GetFunction () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
- frame, sb_function.get());
+ log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_function.get()));
return sb_function;
}
@@ -304,8 +308,9 @@ SBFrame::GetSymbol () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
- frame, sb_symbol.get());
+ log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_symbol.get()));
return sb_symbol;
}
@@ -339,12 +344,14 @@ SBFrame::GetBlock () const
else
{
if (log)
- log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", frame);
+ log->Printf ("SBFrame(%p)::GetBlock () => error: process is running",
+ static_cast<void*>(frame));
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
- frame, sb_block.GetPtr());
+ log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_block.GetPtr()));
return sb_block;
}
@@ -382,8 +389,9 @@ SBFrame::GetFrameBlock () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
- frame, sb_block.GetPtr());
+ log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_block.GetPtr()));
return sb_block;
}
@@ -421,8 +429,9 @@ SBFrame::GetLineEntry () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
- frame, sb_line_entry.get());
+ log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_line_entry.get()));
return sb_line_entry;
}
@@ -430,16 +439,16 @@ uint32_t
SBFrame::GetFrameID () const
{
uint32_t frame_idx = UINT32_MAX;
-
+
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
frame_idx = frame->GetFrameIndex ();
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBFrame(%p)::GetFrameID () => %u",
- frame, frame_idx);
+ log->Printf ("SBFrame(%p)::GetFrameID () => %u",
+ static_cast<void*>(frame), frame_idx);
return frame_idx;
}
@@ -478,7 +487,8 @@ SBFrame::GetPC () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -519,7 +529,7 @@ SBFrame::SetPC (addr_t new_pc)
if (log)
log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i",
- frame, new_pc, ret_val);
+ static_cast<void*>(frame), new_pc, ret_val);
return ret_val;
}
@@ -558,7 +568,8 @@ SBFrame::GetSP () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -599,7 +610,8 @@ SBFrame::GetFP () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -638,7 +650,9 @@ SBFrame::GetPCAddress () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", frame, sb_addr.get());
+ log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_addr.get()));
return sb_addr;
}
@@ -727,7 +741,6 @@ SBFrame::FindVariable (const char *name)
}
return value;
}
-
SBValue
SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
@@ -742,7 +755,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
log->Printf ("SBFrame::FindVariable called with empty name");
return sb_value;
}
-
+
ValueObjectSP value_sp;
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -766,7 +779,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
const bool can_create = true;
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
-
+
if (sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
@@ -794,10 +807,11 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
log->Printf ("SBFrame::FindVariable () => error: process is running");
}
}
-
+
if (log)
- log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
- frame, name, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
+ static_cast<void*>(frame), name,
+ static_cast<void*>(value_sp.get()));
return sb_value;
}
@@ -822,14 +836,14 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValue sb_value;
-
+
if (name == NULL || name[0] == '\0')
{
if (log)
log->Printf ("SBFrame::FindValue called with empty name.");
return sb_value;
}
-
+
ValueObjectSP value_sp;
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -846,7 +860,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
if (frame)
{
VariableList variable_list;
-
+
switch (value_type)
{
case eValueTypeVariableGlobal: // global variable
@@ -854,7 +868,6 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
case eValueTypeVariableArgument: // function argument variables
case eValueTypeVariableLocal: // function local variables
{
-
SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
const bool can_create = true;
@@ -957,12 +970,12 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
log->Printf ("SBFrame::FindValue () => error: process is running");
}
}
-
+
if (log)
- log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
- frame, name, value_type, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
+ static_cast<void*>(frame), name, value_type,
+ static_cast<void*>(value_sp.get()));
-
return sb_value;
}
@@ -999,10 +1012,9 @@ SBFrame::GetThread () const
{
SBStream sstr;
sb_thread.GetDescription (sstr);
- log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s",
- exe_ctx.GetFramePtr(),
- thread_sp.get(),
- sstr.GetData());
+ log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s",
+ static_cast<void*>(exe_ctx.GetFramePtr()),
+ static_cast<void*>(thread_sp.get()), sstr.GetData());
}
return sb_thread;
@@ -1039,11 +1051,12 @@ SBFrame::Disassemble () const
{
if (log)
log->Printf ("SBFrame::Disassemble () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::Disassemble () => %s", frame, disassembly);
+ log->Printf ("SBFrame(%p)::Disassemble () => %s",
+ static_cast<void*>(frame), disassembly);
return disassembly;
}
@@ -1084,12 +1097,9 @@ SBFrame::GetVariables (bool arguments,
Target *target = exe_ctx.GetTargetPtr();
if (log)
- log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
- arguments,
- locals,
- statics,
- in_scope_only);
-
+ log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
+ arguments, locals, statics, in_scope_only);
+
Process *process = exe_ctx.GetProcessPtr();
if (target && process)
{
@@ -1156,13 +1166,13 @@ SBFrame::GetVariables (bool arguments,
{
if (log)
log->Printf ("SBFrame::GetVariables () => error: process is running");
- }
+ }
}
if (log)
- {
- log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", frame, value_list.opaque_ptr());
- }
+ log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_list.opaque_ptr()));
return value_list;
}
@@ -1207,11 +1217,13 @@ SBFrame::GetRegisters ()
{
if (log)
log->Printf ("SBFrame::GetRegisters () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", frame, value_list.opaque_ptr());
+ log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_list.opaque_ptr()));
return value_list;
}
@@ -1265,11 +1277,13 @@ SBFrame::FindRegister (const char *name)
{
if (log)
log->Printf ("SBFrame::FindRegister () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)", frame, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_sp.get()));
return result;
}
@@ -1355,19 +1369,19 @@ lldb::SBValue
SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- ExecutionResults exe_results = eExecutionSetupError;
+ ExpressionResults exe_results = eExpressionSetupError;
SBValue expr_result;
-
+
if (expr == NULL || expr[0] == '\0')
{
if (log)
log->Printf ("SBFrame::EvaluateExpression called with an empty expression");
return expr_result;
}
-
+
ValueObjectSP expr_value_sp;
Mutex::Locker api_locker;
@@ -1379,7 +1393,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
StackFrame *frame = NULL;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
-
+
if (target && process)
{
Process::StopLocker stop_locker;
@@ -1395,7 +1409,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
}
-
+
exe_results = target->EvaluateExpression (expr,
frame,
expr_value_sp,
@@ -1415,21 +1429,18 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
{
if (log)
log->Printf ("SBFrame::EvaluateExpression () => error: process is running");
- }
+ }
}
#ifndef LLDB_DISABLE_PYTHON
if (expr_log)
- expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
- expr_result.GetValue(),
- expr_result.GetSummary());
-
+ expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
+ expr_result.GetValue(), expr_result.GetSummary());
+
if (log)
- log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
- frame,
- expr,
- expr_value_sp.get(),
- exe_results);
+ log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
+ static_cast<void*>(frame), expr,
+ static_cast<void*>(expr_value_sp.get()), exe_results);
#endif
return expr_result;
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index bb7ea2e9f202..3d185da17f26 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -66,9 +66,11 @@ SBFunction::GetName() const
if (log)
{
if (cstr)
- log->Printf ("SBFunction(%p)::GetName () => \"%s\"", m_opaque_ptr, cstr);
+ log->Printf ("SBFunction(%p)::GetName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), cstr);
else
- log->Printf ("SBFunction(%p)::GetName () => NULL", m_opaque_ptr);
+ log->Printf ("SBFunction(%p)::GetName () => NULL",
+ static_cast<void*>(m_opaque_ptr));
}
return cstr;
}
@@ -83,9 +85,11 @@ SBFunction::GetMangledName () const
if (log)
{
if (cstr)
- log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, cstr);
+ log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), cstr);
else
- log->Printf ("SBFunction(%p)::GetMangledName () => NULL", m_opaque_ptr);
+ log->Printf ("SBFunction(%p)::GetMangledName () => NULL",
+ static_cast<void*>(m_opaque_ptr));
}
return cstr;
}
diff --git a/source/API/SBHostOS.cpp b/source/API/SBHostOS.cpp
index 166403103ad5..ec1e2f2e9cba 100644
--- a/source/API/SBHostOS.cpp
+++ b/source/API/SBHostOS.cpp
@@ -12,6 +12,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
using namespace lldb;
using namespace lldb_private;
@@ -22,7 +23,7 @@ SBFileSpec
SBHostOS::GetProgramFileSpec ()
{
SBFileSpec sb_filespec;
- sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
+ sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());
return sb_filespec;
}
@@ -31,18 +32,29 @@ SBHostOS::GetLLDBPythonPath ()
{
SBFileSpec sb_lldb_python_filespec;
FileSpec lldb_python_spec;
- if (Host::GetLLDBPath (ePathTypePythonDir, lldb_python_spec))
+ if (HostInfo::GetLLDBPath(ePathTypePythonDir, lldb_python_spec))
{
sb_lldb_python_filespec.SetFileSpec (lldb_python_spec);
}
return sb_lldb_python_filespec;
}
+
+SBFileSpec
+SBHostOS::GetLLDBPath (lldb::PathType path_type)
+{
+ SBFileSpec sb_fspec;
+ FileSpec fspec;
+ if (HostInfo::GetLLDBPath(path_type, fspec))
+ sb_fspec.SetFileSpec (fspec);
+ return sb_fspec;
+}
+
lldb::thread_t
SBHostOS::ThreadCreate
(
const char *name,
- thread_func_t thread_function,
+ lldb::thread_func_t thread_function,
void *thread_arg,
SBError *error_ptr
)
@@ -50,8 +62,10 @@ SBHostOS::ThreadCreate
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name,
- thread_function, thread_arg, error_ptr);
+ log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)",
+ name, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(thread_function)),
+ static_cast<void*>(thread_arg),
+ static_cast<void*>(error_ptr));
// FIXME: You should log the return value?
@@ -77,7 +91,7 @@ SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr)
}
bool
-SBHostOS::ThreadJoin (lldb::thread_t thread, thread_result_t *result, SBError *error_ptr)
+SBHostOS::ThreadJoin (lldb::thread_t thread, lldb::thread_result_t *result, SBError *error_ptr)
{
return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL);
}
diff --git a/source/API/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index 0864a2e006c3..833eea3e35c4 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -66,7 +66,6 @@ SBLineEntry::~SBLineEntry ()
SBAddress
SBLineEntry::GetStartAddress () const
{
-
SBAddress sb_address;
if (m_opaque_ap.get())
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
@@ -78,8 +77,9 @@ SBLineEntry::GetStartAddress () const
const Address *addr = sb_address.get();
if (addr)
addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
- log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s",
- m_opaque_ap.get(), sb_address.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_address.get()), sstr.GetData());
}
return sb_address;
@@ -101,8 +101,9 @@ SBLineEntry::GetEndAddress () const
const Address *addr = sb_address.get();
if (addr)
addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
- log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s",
- m_opaque_ap.get(), sb_address.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_address.get()), sstr.GetData());
}
return sb_address;
}
@@ -127,8 +128,10 @@ SBLineEntry::GetFileSpec () const
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(),
- sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
return sb_file_spec;
@@ -144,7 +147,8 @@ SBLineEntry::GetLine () const
line = m_opaque_ap->line;
if (log)
- log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line);
+ log->Printf ("SBLineEntry(%p)::GetLine () => %u",
+ static_cast<void*>(m_opaque_ap.get()), line);
return line;
}
diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp
index 2e67b4c24e86..bad9ba82bc91 100644
--- a/source/API/SBListener.cpp
+++ b/source/API/SBListener.cpp
@@ -42,7 +42,7 @@ SBListener::SBListener (const char *name) :
if (log)
log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)",
- name, m_opaque_ptr);
+ name, static_cast<void*>(m_opaque_ptr));
}
@@ -110,7 +110,7 @@ SBListener::StartListeningForEventClass (SBDebugger &debugger,
else
return 0;
}
-
+
bool
SBListener::StopListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
@@ -127,7 +127,7 @@ SBListener::StopListeningForEventClass (SBDebugger &debugger,
else
return false;
}
-
+
uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
@@ -136,23 +136,23 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
{
acquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
}
-
+
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
StreamString sstr_requested;
StreamString sstr_acquired;
-
+
Broadcaster *lldb_broadcaster = broadcaster.get();
if (lldb_broadcaster)
{
const bool got_requested_names = lldb_broadcaster->GetEventNames (sstr_requested, event_mask, false);
const bool got_acquired_names = lldb_broadcaster->GetEventNames (sstr_acquired, acquired_event_mask, false);
log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p): %s, event_mask=0x%8.8x%s%s%s) => 0x%8.8x%s%s%s",
- m_opaque_ptr,
- lldb_broadcaster,
- lldb_broadcaster->GetBroadcasterName().GetCString(),
- event_mask,
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(lldb_broadcaster),
+ lldb_broadcaster->GetBroadcasterName().GetCString(),
+ event_mask,
got_requested_names ? " (" : "",
sstr_requested.GetData(),
got_requested_names ? ")" : "",
@@ -163,12 +163,10 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
}
else
{
- log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x",
- m_opaque_ptr,
- lldb_broadcaster,
- event_mask,
+ log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(lldb_broadcaster), event_mask,
acquired_event_mask);
-
}
}
@@ -194,12 +192,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p))...",
- m_opaque_ptr, event.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()));
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p))...",
- m_opaque_ptr, timeout_secs, event.get());
+ static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(event.get()));
}
}
bool success = false;
@@ -226,12 +226,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p)) => %i",
- m_opaque_ptr, event.get(), success);
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()), success);
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p)) => %i",
- m_opaque_ptr, timeout_secs, event.get(), success);
+ static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(event.get()), success);
}
}
if (!success)
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index c8543d4de298..0d7dda1aa1f7 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -110,10 +110,9 @@ SBModule::GetFileSpec () const
file_spec.SetFileSpec(module_sp->GetFileSpec());
if (log)
- {
- log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
- module_sp.get(), file_spec.get());
- }
+ log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(file_spec.get()));
return file_spec;
}
@@ -122,20 +121,18 @@ lldb::SBFileSpec
SBModule::GetPlatformFileSpec () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBFileSpec file_spec;
ModuleSP module_sp (GetSP ());
if (module_sp)
file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
-
+
if (log)
- {
- log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
- module_sp.get(), file_spec.get());
- }
-
+ log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(file_spec.get()));
+
return file_spec;
-
}
bool
@@ -143,22 +140,19 @@ SBModule::SetPlatformFileSpec (const lldb::SBFileSpec &platform_file)
{
bool result = false;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ModuleSP module_sp (GetSP ());
if (module_sp)
{
module_sp->SetPlatformFileSpec(*platform_file);
result = true;
}
-
+
if (log)
- {
- log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i",
- module_sp.get(),
- platform_file.get(),
- platform_file->GetPath().c_str(),
- result);
- }
+ log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(platform_file.get()),
+ platform_file->GetPath().c_str(), result);
return result;
}
@@ -201,10 +195,12 @@ SBModule::GetUUIDBytes () const
{
StreamString s;
module_sp->GetUUID().Dump (&s);
- log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", module_sp.get(), s.GetData());
+ log->Printf ("SBModule(%p)::GetUUIDBytes () => %s",
+ static_cast<void*>(module_sp.get()), s.GetData());
}
else
- log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", module_sp.get());
+ log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL",
+ static_cast<void*>(module_sp.get()));
}
return uuid_bytes;
}
@@ -225,6 +221,7 @@ SBModule::GetUUIDString () const
if (!uuid_string.empty())
{
strncpy (uuid_string_buffer, uuid_string.c_str(), sizeof (uuid_string_buffer));
+ uuid_string_buffer[sizeof (uuid_string_buffer) - 1] = '\0';
uuid_c_string = uuid_string_buffer;
}
@@ -234,10 +231,12 @@ SBModule::GetUUIDString () const
{
StreamString s;
module_sp->GetUUID().Dump (&s);
- log->Printf ("SBModule(%p)::GetUUIDString () => %s", module_sp.get(), s.GetData());
+ log->Printf ("SBModule(%p)::GetUUIDString () => %s",
+ static_cast<void*>(module_sp.get()), s.GetData());
}
else
- log->Printf ("SBModule(%p)::GetUUIDString () => NULL", module_sp.get());
+ log->Printf ("SBModule(%p)::GetUUIDString () => NULL",
+ static_cast<void*>(module_sp.get()));
}
return uuid_c_string;
}
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 235388b5f25c..41efd86177d6 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -40,6 +40,7 @@
#include "lldb/API/SBThread.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBUnixSignals.h"
using namespace lldb;
using namespace lldb_private;
@@ -148,20 +149,17 @@ SBProcess::RemoteLaunch (char const **argv,
lldb::SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- if (log) {
+ if (log)
log->Printf ("SBProcess(%p)::RemoteLaunch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...",
- m_opaque_wp.lock().get(),
- argv,
- envp,
- stdin_path ? stdin_path : "NULL",
- stdout_path ? stdout_path : "NULL",
- stderr_path ? stderr_path : "NULL",
+ static_cast<void*>(m_opaque_wp.lock().get()),
+ static_cast<void*>(argv), static_cast<void*>(envp),
+ stdin_path ? stdin_path : "NULL",
+ stdout_path ? stdout_path : "NULL",
+ stderr_path ? stderr_path : "NULL",
working_directory ? working_directory : "NULL",
- launch_flags,
- stop_at_entry,
- error.get());
- }
-
+ launch_flags, stop_at_entry,
+ static_cast<void*>(error.get()));
+
ProcessSP process_sp(GetSP());
if (process_sp)
{
@@ -170,7 +168,7 @@ SBProcess::RemoteLaunch (char const **argv,
{
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
- ProcessLaunchInfo launch_info (stdin_path,
+ ProcessLaunchInfo launch_info (stdin_path,
stdout_path,
stderr_path,
working_directory,
@@ -193,13 +191,15 @@ SBProcess::RemoteLaunch (char const **argv,
{
error.SetErrorString ("unable to attach pid");
}
-
+
if (log) {
SBStream sstr;
error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s", process_sp.get(), error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(error.get()), sstr.GetData());
}
-
+
return error.Success();
}
@@ -214,7 +214,7 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
{
ProcessAttachInfo attach_info;
attach_info.SetProcessID (pid);
- error.SetError (process_sp->Attach (attach_info));
+ error.SetError (process_sp->Attach (attach_info));
}
else
{
@@ -230,7 +230,9 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
if (log) {
SBStream sstr;
error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s", process_sp.get(), pid, error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()), pid,
+ static_cast<void*>(error.get()), sstr.GetData());
}
return error.Success();
@@ -247,14 +249,15 @@ SBProcess::GetNumThreads ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
+
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
num_threads = process_sp->GetThreadList().GetSize(can_update);
}
if (log)
- log->Printf ("SBProcess(%p)::GetNumThreads () => %d", process_sp.get(), num_threads);
+ log->Printf ("SBProcess(%p)::GetNumThreads () => %d",
+ static_cast<void*>(process_sp.get()), num_threads);
return num_threads;
}
@@ -275,9 +278,9 @@ SBProcess::GetSelectedThread () const
}
if (log)
- {
- log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", process_sp.get(), thread_sp.get());
- }
+ log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -286,7 +289,7 @@ SBThread
SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBThread sb_thread;
ThreadSP thread_sp;
ProcessSP process_sp(GetSP());
@@ -296,10 +299,12 @@ SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
thread_sp = process_sp->CreateOSPluginThread(tid, context);
sb_thread.SetThread (thread_sp);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)", process_sp.get(), tid, context, thread_sp.get());
-
+ log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)",
+ static_cast<void*>(process_sp.get()), tid, context,
+ static_cast<void*>(thread_sp.get()));
+
return sb_thread;
}
@@ -316,9 +321,11 @@ SBProcess::GetTarget() const
target_sp = process_sp->GetTarget().shared_from_this();
sb_target.SetSP (target_sp);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", process_sp.get(), target_sp.get());
+ log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -336,13 +343,12 @@ SBProcess::PutSTDIN (const char *src, size_t src_len)
Error error;
ret_val = process_sp->PutSTDIN (src, src_len, error);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%d) => %zu",
- process_sp.get(),
- src,
- (uint32_t) src_len,
- ret_val);
+ log->Printf("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%" PRIu64 ") => %" PRIu64,
+ static_cast<void*>(process_sp.get()), src,
+ static_cast<uint64_t>(src_len),
+ static_cast<uint64_t>(ret_val));
return ret_val;
}
@@ -357,15 +363,14 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
Error error;
bytes_read = process_sp->GetSTDOUT (dst, dst_len, error);
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -384,11 +389,10 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -403,16 +407,15 @@ SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const
Error error;
bytes_read = process_sp->GetAsyncProfileData (dst, dst_len, error);
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetProfileData (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
-
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
+
return bytes_read;
}
@@ -483,7 +486,8 @@ SBProcess::SetSelectedThreadByID (lldb::tid_t tid)
if (log)
log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4" PRIx64 ") => %s",
- process_sp.get(), tid, (ret_val ? "true" : "false"));
+ static_cast<void*>(process_sp.get()), tid,
+ (ret_val ? "true" : "false"));
return ret_val;
}
@@ -502,8 +506,9 @@ SBProcess::SetSelectedThreadByIndexID (uint32_t index_id)
}
if (log)
- log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s",
- process_sp.get(), index_id, (ret_val ? "true" : "false"));
+ log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s",
+ static_cast<void*>(process_sp.get()), index_id,
+ (ret_val ? "true" : "false"));
return ret_val;
}
@@ -526,10 +531,10 @@ SBProcess::GetThreadAtIndex (size_t index)
}
if (log)
- {
log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)",
- process_sp.get(), (uint32_t) index, thread_sp.get());
- }
+ static_cast<void*>(process_sp.get()),
+ static_cast<uint32_t>(index),
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -544,13 +549,14 @@ SBProcess::GetNumQueues ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
+
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
num_queues = process_sp->GetQueueList().GetSize();
}
if (log)
- log->Printf ("SBProcess(%p)::GetNumQueues () => %d", process_sp.get(), num_queues);
+ log->Printf ("SBProcess(%p)::GetNumQueues () => %d",
+ static_cast<void*>(process_sp.get()), num_queues);
return num_queues;
}
@@ -572,10 +578,10 @@ SBProcess::GetQueueAtIndex (size_t index)
}
if (log)
- {
log->Printf ("SBProcess(%p)::GetQueueAtIndex (index=%d) => SBQueue(%p)",
- process_sp.get(), (uint32_t) index, queue_sp.get());
- }
+ static_cast<void*>(process_sp.get()),
+ static_cast<uint32_t>(index),
+ static_cast<void*>(queue_sp.get()));
return sb_queue;
}
@@ -610,8 +616,8 @@ SBProcess::GetState ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetState () => %s",
- process_sp.get(),
+ log->Printf ("SBProcess(%p)::GetState () => %s",
+ static_cast<void*>(process_sp.get()),
lldb_private::StateAsCString (ret_val));
return ret_val;
@@ -630,8 +636,9 @@ SBProcess::GetExitStatus ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)",
- process_sp.get(), exit_status, exit_status);
+ log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)",
+ static_cast<void*>(process_sp.get()), exit_status,
+ exit_status);
return exit_status;
}
@@ -648,8 +655,8 @@ SBProcess::GetExitDescription ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetExitDescription () => %s",
- process_sp.get(), exit_desc);
+ log->Printf ("SBProcess(%p)::GetExitDescription () => %s",
+ static_cast<void*>(process_sp.get()), exit_desc);
return exit_desc;
}
@@ -663,7 +670,8 @@ SBProcess::GetProcessID ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64, process_sp.get(), ret_val);
+ log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64,
+ static_cast<void*>(process_sp.get()), ret_val);
return ret_val;
}
@@ -677,7 +685,8 @@ SBProcess::GetUniqueID()
ret_val = process_sp->GetUniqueID();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32, process_sp.get(), ret_val);
+ log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32,
+ static_cast<void*>(process_sp.get()), ret_val);
return ret_val;
}
@@ -688,10 +697,11 @@ SBProcess::GetByteOrder () const
ProcessSP process_sp(GetSP());
if (process_sp)
byteOrder = process_sp->GetTarget().GetArchitecture().GetByteOrder();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetByteOrder () => %d", process_sp.get(), byteOrder);
+ log->Printf ("SBProcess(%p)::GetByteOrder () => %d",
+ static_cast<void*>(process_sp.get()), byteOrder);
return byteOrder;
}
@@ -706,7 +716,8 @@ SBProcess::GetAddressByteSize () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", process_sp.get(), size);
+ log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d",
+ static_cast<void*>(process_sp.get()), size);
return size;
}
@@ -715,24 +726,26 @@ SBError
SBProcess::Continue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBError sb_error;
ProcessSP process_sp(GetSP());
if (log)
- log->Printf ("SBProcess(%p)::Continue ()...", process_sp.get());
+ log->Printf ("SBProcess(%p)::Continue ()...",
+ static_cast<void*>(process_sp.get()));
if (process_sp)
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
-
+
Error error (process_sp->Resume());
if (error.Success())
{
if (process_sp->GetTarget().GetDebugger().GetAsyncExecution () == false)
{
if (log)
- log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", process_sp.get());
+ log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...",
+ static_cast<void*>(process_sp.get()));
process_sp->WaitForProcessToStop (NULL);
}
}
@@ -745,7 +758,9 @@ SBProcess::Continue ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", process_sp.get(), sb_error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -770,10 +785,9 @@ SBProcess::Destroy ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -792,16 +806,15 @@ SBProcess::Stop ()
}
else
sb_error.SetErrorString ("SBProcess is invalid");
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -825,10 +838,9 @@ SBProcess::Kill ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -869,21 +881,32 @@ SBProcess::Signal (int signo)
sb_error.SetError (process_sp->Signal (signo));
}
else
- sb_error.SetErrorString ("SBProcess is invalid");
+ sb_error.SetErrorString ("SBProcess is invalid");
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s",
- process_sp.get(),
- signo,
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()), signo,
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
}
+SBUnixSignals
+SBProcess::GetUnixSignals()
+{
+ SBUnixSignals sb_unix_signals;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ sb_unix_signals.SetSP(process_sp);
+ }
+
+ return sb_unix_signals;
+}
+
void
SBProcess::SendAsyncInterrupt ()
{
@@ -911,12 +934,9 @@ SBProcess::GetThreadByID (tid_t tid)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4" PRIx64 ") => SBThread (%p)",
- process_sp.get(),
- tid,
- thread_sp.get());
- }
+ static_cast<void*>(process_sp.get()), tid,
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -938,12 +958,9 @@ SBProcess::GetThreadByIndexID (uint32_t index_id)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)",
- process_sp.get(),
- index_id,
- thread_sp.get());
- }
+ log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)",
+ static_cast<void*>(process_sp.get()), index_id,
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -954,9 +971,10 @@ SBProcess::GetStateFromEvent (const SBEvent &event)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
-
+
if (log)
- log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", event.get(),
+ log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s",
+ static_cast<void*>(event.get()),
lldb_private::StateAsCString (ret_val));
return ret_val;
@@ -1003,8 +1021,9 @@ SBProcess::GetBroadcaster () const
SBBroadcaster broadcaster(process_sp.get(), false);
if (log)
- log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", process_sp.get(),
- broadcaster.get());
+ log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
@@ -1025,15 +1044,11 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
ProcessSP process_sp(GetSP());
if (log)
- {
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p))...",
- process_sp.get(),
- addr,
- dst,
- (uint64_t)dst_len,
- sb_error.get());
- }
-
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<void*>(dst), static_cast<uint64_t>(dst_len),
+ static_cast<void*>(sb_error.get()));
+
if (process_sp)
{
Process::StopLocker stop_locker;
@@ -1045,7 +1060,8 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
else
{
if (log)
- log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1059,13 +1075,10 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
- process_sp.get(),
- addr,
- dst,
- (uint64_t)dst_len,
- sb_error.get(),
- sstr.GetData(),
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<void*>(dst), static_cast<uint64_t>(dst_len),
+ static_cast<void*>(sb_error.get()), sstr.GetData(),
+ static_cast<uint64_t>(bytes_read));
}
return bytes_read;
@@ -1088,7 +1101,8 @@ SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBE
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1116,7 +1130,8 @@ SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBErro
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1144,7 +1159,8 @@ SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &sb_error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1165,14 +1181,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
ProcessSP process_sp(GetSP());
if (log)
- {
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p))...",
- process_sp.get(),
- addr,
- src,
- (uint64_t)src_len,
- sb_error.get());
- }
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ static_cast<void*>(sb_error.get()));
if (process_sp)
{
@@ -1185,7 +1198,8 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
else
{
if (log)
- log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1195,13 +1209,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
- process_sp.get(),
- addr,
- src,
- (uint64_t)src_len,
- sb_error.get(),
- sstr.GetData(),
- (uint64_t)bytes_written);
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ static_cast<void*>(sb_error.get()), sstr.GetData(),
+ static_cast<uint64_t>(bytes_written));
}
return bytes_written;
@@ -1248,7 +1260,7 @@ SBProcess::GetNumSupportedHardwareWatchpoints (lldb::SBError &sb_error) const
sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
if (log)
log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
- process_sp.get(), num);
+ static_cast<void*>(process_sp.get()), num);
}
else
{
@@ -1273,13 +1285,14 @@ SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::LoadImage() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::LoadImage() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
return LLDB_INVALID_IMAGE_TOKEN;
}
-
+
lldb::SBError
SBProcess::UnloadImage (uint32_t image_token)
{
@@ -1297,7 +1310,35 @@ SBProcess::UnloadImage (uint32_t image_token)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running",
+ static_cast<void*>(process_sp.get()));
+ sb_error.SetErrorString("process is running");
+ }
+ }
+ else
+ sb_error.SetErrorString("invalid process");
+ return sb_error;
+}
+
+lldb::SBError
+SBProcess::SendEventData (const char *event_data)
+{
+ lldb::SBError sb_error;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ sb_error.SetError (process_sp->SendEventData (event_data));
+ }
+ else
+ {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBProcess(%p)::SendEventData() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1334,7 +1375,8 @@ SBProcess::GetExtendedBacktraceTypeAtIndex (uint32_t idx)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds", process_sp.get());
+ log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds",
+ static_cast<void*>(process_sp.get()));
}
}
return NULL;
diff --git a/source/API/SBQueue.cpp b/source/API/SBQueue.cpp
index 8d67a48d6b81..b19ed72543c2 100644
--- a/source/API/SBQueue.cpp
+++ b/source/API/SBQueue.cpp
@@ -9,10 +9,14 @@
#include "lldb/lldb-python.h"
+#include <inttypes.h>
+
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBQueueItem.h"
+
#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Queue.h"
@@ -96,7 +100,8 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64, this, result);
+ log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64,
+ static_cast<const void*>(this), result);
return result;
}
@@ -111,10 +116,11 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d", this, result);
+ log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d",
+ static_cast<const void*>(this), result);
return result;
}
-
+
const char *
GetName () const
{
@@ -124,14 +130,16 @@ namespace lldb_private
{
name = queue_sp->GetName();
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetName () => %s", this, name ? name : "NULL");
-
+ log->Printf ("SBQueueImpl(%p)::GetName () => %s",
+ static_cast<const void*>(this),
+ name ? name : "NULL");
+
return name;
}
-
+
void
FetchThreads ()
{
@@ -158,7 +166,7 @@ namespace lldb_private
}
}
}
-
+
void
FetchItems ()
{
@@ -185,12 +193,12 @@ namespace lldb_private
}
}
}
-
+
uint32_t
GetNumThreads ()
{
uint32_t result = 0;
-
+
FetchThreads();
if (m_thread_list_fetched)
{
@@ -198,12 +206,12 @@ namespace lldb_private
}
return result;
}
-
+
lldb::SBThread
GetThreadAtIndex (uint32_t idx)
{
FetchThreads();
-
+
SBThread sb_thread;
QueueSP queue_sp = m_queue_wp.lock();
if (queue_sp && idx < m_threads.size())
@@ -220,21 +228,24 @@ namespace lldb_private
}
return sb_thread;
}
-
-
+
uint32_t
GetNumPendingItems ()
{
uint32_t result = 0;
- FetchItems();
-
- if (m_pending_items_fetched)
+
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (m_pending_items_fetched == false && queue_sp)
+ {
+ result = queue_sp->GetNumPendingWorkItems();
+ }
+ else
{
result = m_pending_items.size();
}
return result;
}
-
+
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t idx)
{
@@ -246,7 +257,17 @@ namespace lldb_private
}
return result;
}
-
+
+ uint32_t
+ GetNumRunningItems ()
+ {
+ uint32_t result = 0;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ result = queue_sp->GetNumRunningWorkItems();
+ return result;
+ }
+
lldb::SBProcess
GetProcess ()
{
@@ -259,6 +280,17 @@ namespace lldb_private
return result;
}
+ lldb::QueueKind
+ GetKind ()
+ {
+ lldb::QueueKind kind = eQueueKindUnknown;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ kind = queue_sp->GetKind();
+
+ return kind;
+ }
+
private:
lldb::QueueWP m_queue_wp;
std::vector<lldb::ThreadWP> m_threads; // threads currently executing this queue's items
@@ -301,13 +333,21 @@ SBQueue::~SBQueue()
bool
SBQueue::IsValid() const
{
- return m_opaque_sp->IsValid();
+ bool is_valid = m_opaque_sp->IsValid ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::IsValid() == %s", m_opaque_sp->GetQueueID(),
+ is_valid ? "true" : "false");
+ return is_valid;
}
void
SBQueue::Clear ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::Clear()", m_opaque_sp->GetQueueID());
m_opaque_sp->Clear();
}
@@ -321,48 +361,92 @@ SBQueue::SetQueue (const QueueSP& queue_sp)
lldb::queue_id_t
SBQueue::GetQueueID () const
{
- return m_opaque_sp->GetQueueID ();
+ lldb::queue_id_t qid = m_opaque_sp->GetQueueID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetQueueID() == 0x%" PRIx64, m_opaque_sp->GetQueueID(), (uint64_t) qid);
+ return qid;
}
uint32_t
SBQueue::GetIndexID () const
{
- return m_opaque_sp->GetIndexID ();
+ uint32_t index_id = m_opaque_sp->GetIndexID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetIndexID() == 0x%" PRIx32, m_opaque_sp->GetQueueID(), index_id);
+ return index_id;
}
const char *
SBQueue::GetName () const
{
- return m_opaque_sp->GetName ();
+ const char *name = m_opaque_sp->GetName ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetName() == %s", m_opaque_sp->GetQueueID(),
+ name ? name : "");
+ return name;
}
uint32_t
SBQueue::GetNumThreads ()
{
- return m_opaque_sp->GetNumThreads ();
+ uint32_t numthreads = m_opaque_sp->GetNumThreads ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumThreads() == %d", m_opaque_sp->GetQueueID(), numthreads);
+ return numthreads;
}
SBThread
SBQueue::GetThreadAtIndex (uint32_t idx)
{
- return m_opaque_sp->GetThreadAtIndex (idx);
+ SBThread th = m_opaque_sp->GetThreadAtIndex (idx);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetThreadAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
+ return th;
}
uint32_t
SBQueue::GetNumPendingItems ()
{
- return m_opaque_sp->GetNumPendingItems ();
+ uint32_t pending_items = m_opaque_sp->GetNumPendingItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumPendingItems() == %d", m_opaque_sp->GetQueueID(), pending_items);
+ return pending_items;
}
SBQueueItem
SBQueue::GetPendingItemAtIndex (uint32_t idx)
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetPendingItemAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
return m_opaque_sp->GetPendingItemAtIndex (idx);
}
+uint32_t
+SBQueue::GetNumRunningItems ()
+{
+ uint32_t running_items = m_opaque_sp->GetNumRunningItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumRunningItems() == %d", m_opaque_sp->GetQueueID(), running_items);
+ return running_items;
+}
+
SBProcess
SBQueue::GetProcess ()
{
return m_opaque_sp->GetProcess();
}
+
+lldb::QueueKind
+SBQueue::GetKind ()
+{
+ return m_opaque_sp->GetKind();
+}
diff --git a/source/API/SBQueueItem.cpp b/source/API/SBQueueItem.cpp
index 481d51e55426..6a1aa7bec61a 100644
--- a/source/API/SBQueueItem.cpp
+++ b/source/API/SBQueueItem.cpp
@@ -14,6 +14,8 @@
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBThread.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/Thread.h"
@@ -44,13 +46,23 @@ SBQueueItem::~SBQueueItem()
bool
SBQueueItem::IsValid() const
{
- return m_queue_item_sp.get() != NULL;
+ bool is_valid = m_queue_item_sp.get() != NULL;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueueItem(%p)::IsValid() == %s",
+ static_cast<void*>(m_queue_item_sp.get()),
+ is_valid ? "true" : "false");
+ return is_valid;
}
void
SBQueueItem::Clear ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueueItem(%p)::Clear()",
+ static_cast<void*>(m_queue_item_sp.get()));
m_queue_item_sp.reset();
}
@@ -66,10 +78,15 @@ lldb::QueueItemKind
SBQueueItem::GetKind () const
{
QueueItemKind result = eQueueItemKindUnknown;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
result = m_queue_item_sp->GetKind ();
}
+ if (log)
+ log->Printf("SBQueueItem(%p)::GetKind() == %d",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<int>(result));
return result;
}
@@ -86,10 +103,21 @@ SBAddress
SBQueueItem::GetAddress () const
{
SBAddress result;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
result.SetAddress (&m_queue_item_sp->GetAddress());
}
+ if (log)
+ {
+ StreamString sstr;
+ const Address *addr = result.get();
+ if (addr)
+ addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
+ log->Printf ("SBQueueItem(%p)::GetAddress() == SBAddress(%p): %s",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<void*>(result.get()), sstr.GetData());
+ }
return result;
}
@@ -106,14 +134,34 @@ SBThread
SBQueueItem::GetExtendedBacktraceThread (const char *type)
{
SBThread result;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
- ThreadSP thread_sp;
- ConstString type_const (type);
- thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const);
- if (thread_sp)
+ ProcessSP process_sp = m_queue_item_sp->GetProcessSP();
+ Process::StopLocker stop_locker;
+ if (process_sp && stop_locker.TryLock(&process_sp->GetRunLock()))
{
- result.SetThread (thread_sp);
+ ThreadSP thread_sp;
+ ConstString type_const (type);
+ thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const);
+ if (thread_sp)
+ {
+ // Save this in the Process' ExtendedThreadList so a strong pointer retains the
+ // object
+ process_sp->GetExtendedThreadList().AddThread (thread_sp);
+ result.SetThread (thread_sp);
+ if (log)
+ {
+ const char *queue_name = thread_sp->GetQueueName();
+ if (queue_name == NULL)
+ queue_name = "";
+ log->Printf ("SBQueueItem(%p)::GetExtendedBacktraceThread() = new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<void*>(thread_sp.get()),
+ static_cast<uint64_t>(thread_sp->GetQueueID()),
+ queue_name);
+ }
+ }
}
}
return result;
diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp
index 531ab9f463ce..f5b5c08411c7 100644
--- a/source/API/SBStream.cpp
+++ b/source/API/SBStream.cpp
@@ -82,6 +82,8 @@ SBStream::RedirectToFile (const char *path, bool append)
uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
if (append)
open_options |= File::eOpenOptionAppend;
+ else
+ open_options |= File::eOpenOptionTruncate;
stream_file->GetFile().Open (path, open_options, lldb::eFilePermissionsFileDefault);
m_opaque_ap.reset (stream_file);
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index ef3d0764c963..12a3b317d501 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -67,7 +67,8 @@ SBSymbol::GetName() const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : "");
+ log->Printf ("SBSymbol(%p)::GetName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), name ? name : "");
return name;
}
@@ -79,7 +80,8 @@ SBSymbol::GetMangledName () const
name = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : "");
+ log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), name ? name : "");
return name;
}
diff --git a/source/API/SBSymbolContext.cpp b/source/API/SBSymbolContext.cpp
index 479b0f75bfe9..481fa1a1d1a2 100644
--- a/source/API/SBSymbolContext.cpp
+++ b/source/API/SBSymbolContext.cpp
@@ -101,8 +101,9 @@ SBSymbolContext::GetModule ()
{
SBStream sstr;
sb_module.GetDescription (sstr);
- log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s",
- m_opaque_ap.get(), module_sp.get(), sstr.GetData());
+ log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(module_sp.get()), sstr.GetData());
}
return sb_module;
@@ -120,15 +121,16 @@ SBSymbolContext::GetFunction ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Function *function = NULL;
-
+
if (m_opaque_ap.get())
function = m_opaque_ap->function;
SBFunction sb_function (function);
if (log)
- log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)",
- m_opaque_ap.get(), function);
+ log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(function));
return sb_function;
}
@@ -150,8 +152,9 @@ SBSymbolContext::GetLineEntry ()
if (log)
{
- log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)",
- m_opaque_ap.get(), sb_line_entry.get());
+ log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_line_entry.get()));
}
return sb_line_entry;
@@ -163,19 +166,18 @@ SBSymbolContext::GetSymbol ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Symbol *symbol = NULL;
-
+
if (m_opaque_ap.get())
symbol = m_opaque_ap->symbol;
SBSymbol sb_symbol (symbol);
if (log)
- {
- log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)",
- m_opaque_ap.get(), symbol);
- }
+ log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(symbol));
- return sb_symbol;
+ return sb_symbol;
}
void
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 224349c0bce6..3d5828c5fe00 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -120,6 +120,18 @@ SBLaunchInfo::SetGroupID (uint32_t gid)
m_opaque_sp->SetGroupID (gid);
}
+SBFileSpec
+SBLaunchInfo::GetExecutableFile ()
+{
+ return SBFileSpec (m_opaque_sp->GetExecutableFile());
+}
+
+void
+SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg)
+{
+ m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg);
+}
+
uint32_t
SBLaunchInfo::GetNumArguments ()
{
@@ -268,6 +280,29 @@ SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write)
return m_opaque_sp->AppendSuppressFileAction(fd, read, write);
}
+void
+SBLaunchInfo::SetLaunchEventData (const char *data)
+{
+ m_opaque_sp->SetLaunchEventData (data);
+}
+
+const char *
+SBLaunchInfo::GetLaunchEventData () const
+{
+ return m_opaque_sp->GetLaunchEventData ();
+}
+
+void
+SBLaunchInfo::SetDetachOnError (bool enable)
+{
+ m_opaque_sp->SetDetachOnError (enable);
+}
+
+bool
+SBLaunchInfo::GetDetachOnError () const
+{
+ return m_opaque_sp->GetDetachOnError ();
+}
SBAttachInfo::SBAttachInfo () :
m_opaque_sp (new ProcessAttachInfo())
@@ -541,10 +576,9 @@ SBTarget::GetProcess ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -641,19 +675,15 @@ SBTarget::Launch
TargetSP target_sp(GetSP());
if (log)
- {
log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...",
- target_sp.get(),
- argv,
- envp,
- stdin_path ? stdin_path : "NULL",
- stdout_path ? stdout_path : "NULL",
- stderr_path ? stderr_path : "NULL",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(argv), static_cast<void*>(envp),
+ stdin_path ? stdin_path : "NULL",
+ stdout_path ? stdout_path : "NULL",
+ stderr_path ? stderr_path : "NULL",
working_directory ? working_directory : "NULL",
- launch_flags,
- stop_at_entry,
- error.get());
- }
+ launch_flags, stop_at_entry,
+ static_cast<void*>(error.get()));
if (target_sp)
{
@@ -667,17 +697,17 @@ SBTarget::Launch
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
-
+
if (state == eStateConnected)
{
// If we are already connected, then we have already specified the
@@ -694,7 +724,7 @@ SBTarget::Launch
launch_flags |= eLaunchFlagDisableSTDIO;
ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags);
-
+
Module *exe_module = target_sp->GetExecutableModulePointer();
if (exe_module)
launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
@@ -717,10 +747,9 @@ SBTarget::Launch
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
- {
- log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
- target_sp.get(), sb_process.GetSP().get());
- }
+ log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(sb_process.GetSP().get()));
return sb_process;
}
@@ -729,46 +758,48 @@ SBProcess
SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", target_sp.get());
- }
-
+ log->Printf ("SBTarget(%p)::Launch (launch_info, error)...",
+ static_cast<void*>(target_sp.get()));
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
StateType state = eStateInvalid;
{
- ProcessSP process_sp = target_sp->GetProcessSP();
- if (process_sp)
- {
- state = process_sp->GetState();
-
- if (process_sp->IsAlive() && state != eStateConnected)
- {
- if (state == eStateAttaching)
- error.SetErrorString ("process attach is in progress");
- else
- error.SetErrorString ("a process is already being debugged");
- return sb_process;
- }
- }
+ ProcessSP process_sp = target_sp->GetProcessSP();
+ if (process_sp)
+ {
+ state = process_sp->GetState();
+
+ if (process_sp->IsAlive() && state != eStateConnected)
+ {
+ if (state == eStateAttaching)
+ error.SetErrorString ("process attach is in progress");
+ else
+ error.SetErrorString ("a process is already being debugged");
+ return sb_process;
+ }
+ }
}
lldb_private::ProcessLaunchInfo &launch_info = sb_launch_info.ref();
- Module *exe_module = target_sp->GetExecutableModulePointer();
- if (exe_module)
- launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
+ if (!launch_info.GetExecutableFile())
+ {
+ Module *exe_module = target_sp->GetExecutableModulePointer();
+ if (exe_module)
+ launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
+ }
const ArchSpec &arch_spec = target_sp->GetArchitecture();
if (arch_spec.IsValid())
launch_info.GetArchitecture () = arch_spec;
-
+
error.SetError (target_sp->Launch (target_sp->GetDebugger().GetListener(), launch_info));
sb_process.SetSP(target_sp->GetProcessSP());
}
@@ -776,14 +807,13 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
- {
log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
- target_sp.get(), sb_process.GetSP().get());
- }
-
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(sb_process.GetSP().get()));
+
return sb_process;
}
@@ -791,41 +821,39 @@ lldb::SBProcess
SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", target_sp.get());
- }
-
+ log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...",
+ static_cast<void*>(target_sp.get()));
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
StateType state = eStateInvalid;
process_sp = target_sp->GetProcessSP();
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
if (log)
- {
log->Printf ("SBTarget(%p)::Attach (...) => error %s",
- target_sp.get(), error.GetCString());
- }
+ static_cast<void*>(target_sp.get()),
+ error.GetCString());
return sb_process;
- }
+ }
}
-
+
if (state != eStateConnected)
process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL);
@@ -850,7 +878,7 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
if (log)
{
log->Printf ("SBTarget(%p)::Attach (...) => error %s",
- target_sp.get(), error.GetCString());
+ static_cast<void*>(target_sp.get()), error.GetCString());
}
return sb_process;
}
@@ -875,13 +903,12 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
-
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
+
return sb_process;
}
@@ -913,10 +940,9 @@ SBTarget::AttachToProcessWithID
TargetSP target_sp(GetSP());
if (log)
- {
- log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", target_sp.get(), pid);
- }
-
+ log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...",
+ static_cast<void*>(target_sp.get()), pid);
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -926,15 +952,15 @@ SBTarget::AttachToProcessWithID
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
if (state == eStateConnected)
@@ -958,10 +984,10 @@ SBTarget::AttachToProcessWithID
if (process_sp)
{
sb_process.SetSP (process_sp);
-
+
ProcessAttachInfo attach_info;
attach_info.SetProcessID (pid);
-
+
PlatformSP platform_sp = target_sp->GetPlatform();
ProcessInstanceInfo instance_info;
if (platform_sp->GetProcessInfo(pid, instance_info))
@@ -986,12 +1012,11 @@ SBTarget::AttachToProcessWithID
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1005,16 +1030,16 @@ SBTarget::AttachToProcessWithName
)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", target_sp.get(), name, wait_for ? "true" : "false");
- }
-
+ log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...",
+ static_cast<void*>(target_sp.get()), name,
+ wait_for ? "true" : "false");
+
if (name && target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1024,17 +1049,17 @@ SBTarget::AttachToProcessWithName
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
-
+
if (state == eStateConnected)
{
// If we are already connected, then we have already specified the
@@ -1078,12 +1103,11 @@ SBTarget::AttachToProcessWithName
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1101,12 +1125,11 @@ SBTarget::ConnectRemote
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", target_sp.get(), url, plugin_name);
- }
-
+ log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...",
+ static_cast<void*>(target_sp.get()), url, plugin_name);
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1114,8 +1137,7 @@ SBTarget::ConnectRemote
process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL);
else
process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL);
-
-
+
if (process_sp)
{
sb_process.SetSP (process_sp);
@@ -1130,12 +1152,11 @@ SBTarget::ConnectRemote
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::ConnectRemote (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1155,8 +1176,9 @@ SBTarget::GetExecutable ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",
- target_sp.get(), exe_file_spec.get());
+ log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<const void*>(exe_file_spec.get()));
}
return exe_file_spec;
@@ -1258,7 +1280,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
if (target_sp && line != 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
const LazyBool check_inlines = eLazyBoolCalculate;
const LazyBool skip_prologue = eLazyBoolCalculate;
const bool internal = false;
@@ -1272,12 +1294,9 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
sb_bp.GetDescription (sstr);
char path[PATH_MAX];
sb_file_spec->GetPath (path, sizeof(path));
- log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s",
- target_sp.get(),
- path,
- line,
- sb_bp.get(),
- sstr.GetData());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s",
+ static_cast<void*>(target_sp.get()), path, line,
+ static_cast<void*>(sb_bp.get()), sstr.GetData());
}
return sb_bp;
@@ -1294,7 +1313,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
if (target_sp.get())
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
@@ -1309,12 +1328,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
*sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware);
}
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name, module_name, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name,
+ module_name, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1352,12 +1370,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
internal,
hardware);
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)",
- target_sp.get(), symbol_name, name_type_mask, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name,
+ name_type_mask, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1388,10 +1405,11 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
internal,
hardware);
}
-
+
if (log)
{
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", target_sp.get());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={",
+ static_cast<void*>(target_sp.get()));
for (uint32_t i = 0 ; i < num_names; i++)
{
char sep;
@@ -1403,9 +1421,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
log->Printf ("\"%s\"%c ", symbol_names[i], sep);
else
log->Printf ("\"<NULL>\"%c ", sep);
-
}
- log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, sb_bp.get());
+ log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask,
+ static_cast<void*>(sb_bp.get()));
}
return sb_bp;
@@ -1426,12 +1444,12 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
-
+
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
-
+
*sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, skip_prologue, internal, hardware);
}
else
@@ -1441,10 +1459,9 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name_regex, module_name, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name_regex,
+ module_name, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1465,15 +1482,14 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
-
+
*sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, skip_prologue, internal, hardware);
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name_regex, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name_regex,
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1491,11 +1507,12 @@ SBTarget::BreakpointCreateByAddress (addr_t address)
const bool hardware = false;
*sb_bp = target_sp->CreateBreakpoint (address, false, hardware);
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint64_t>(address),
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1516,12 +1533,12 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
FileSpecList source_file_spec_list;
const bool hardware = false;
source_file_spec_list.Append (source_file.ref());
-
+
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
-
+
*sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware);
}
else
@@ -1534,8 +1551,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
{
char path[PATH_MAX];
source_file->GetPath (path, sizeof(path));
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), source_regex, path, module_name, sb_bp.get());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), source_regex, path,
+ module_name, static_cast<void*>(sb_bp.get()));
}
return sb_bp;
@@ -1559,10 +1577,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), source_regex, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), source_regex,
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1584,14 +1601,11 @@ SBTarget::BreakpointCreateForException (lldb::LanguageType language,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",
- target_sp.get(),
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
LanguageRuntime::GetNameForLanguageType(language),
- catch_bp ? "on" : "off",
- throw_bp ? "on" : "off",
- sb_bp.get());
- }
+ catch_bp ? "on" : "off", throw_bp ? "on" : "off",
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1635,9 +1649,9 @@ SBTarget::BreakpointDelete (break_id_t bp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", target_sp.get(), (uint32_t) bp_id, result);
- }
+ log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(bp_id), result);
return result;
}
@@ -1656,10 +1670,10 @@ SBTarget::FindBreakpointByID (break_id_t bp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",
- target_sp.get(), (uint32_t) bp_id, sb_breakpoint.get());
- }
+ log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(bp_id),
+ static_cast<void*>(sb_breakpoint.get()));
return sb_breakpoint;
}
@@ -1744,9 +1758,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", target_sp.get(), (uint32_t) wp_id, result);
- }
+ log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(wp_id), result);
return result;
}
@@ -1769,10 +1783,10 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
- target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get());
- }
+ log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(wp_id),
+ static_cast<void*>(watchpoint_sp.get()));
return sb_watchpoint;
}
@@ -1781,7 +1795,7 @@ lldb::SBWatchpoint
SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBWatchpoint sb_watchpoint;
lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
@@ -1798,7 +1812,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S
error.SetErrorString("Can't create a watchpoint that is neither read nor write.");
return sb_watchpoint;
}
-
+
// Target::CreateWatchpoint() is thread safe.
Error cw_error;
// This API doesn't take in a type, so we can't figure out what it is.
@@ -1807,13 +1821,13 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S
error.SetError(cw_error);
sb_watchpoint.SetSP (watchpoint_sp);
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%" PRIx64 ", 0x%u) => SBWatchpoint(%p)",
- target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
- }
-
+ static_cast<void*>(target_sp.get()), addr,
+ static_cast<uint32_t>(size),
+ static_cast<void*>(watchpoint_sp.get()));
+
return sb_watchpoint;
}
@@ -1860,7 +1874,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
if (pointer_ast_type)
{
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-
+
ExecutionContext exe_ctx (ExecutionContextRef(ExecutionContext(m_opaque_sp.get(),false)));
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
pointer_ast_type,
@@ -1868,7 +1882,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
buffer,
exe_ctx.GetByteOrder(),
exe_ctx.GetAddressByteSize()));
-
+
if (ptr_result_valobj_sp)
{
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
@@ -1884,9 +1898,12 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
if (log)
{
if (new_value_sp)
- log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", m_opaque_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"",
+ static_cast<void*>(m_opaque_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", m_opaque_sp.get());
+ log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
}
return sb_value;
}
@@ -1981,7 +1998,8 @@ SBTarget::GetNumModules () const
}
if (log)
- log->Printf ("SBTarget(%p)::GetNumModules () => %d", target_sp.get(), num);
+ log->Printf ("SBTarget(%p)::GetNumModules () => %d",
+ static_cast<void*>(target_sp.get()), num);
return num;
}
@@ -1992,7 +2010,8 @@ SBTarget::Clear ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get());
+ log->Printf ("SBTarget(%p)::Clear ()",
+ static_cast<void*>(m_opaque_sp.get()));
m_opaque_sp.reset();
}
@@ -2063,10 +2082,9 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)",
- target_sp.get(), idx, module_sp.get());
- }
+ log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)",
+ static_cast<void*>(target_sp.get()), idx,
+ static_cast<void*>(module_sp.get()));
return sb_module;
}
@@ -2088,10 +2106,11 @@ SBTarget::GetBroadcaster () const
TargetSP target_sp(GetSP());
SBBroadcaster broadcaster(target_sp.get(), false);
-
+
if (log)
- log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)",
- target_sp.get(), broadcaster.get());
+ log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
@@ -2432,10 +2451,6 @@ SBTarget::SetSectionLoadAddress (lldb::SBSection section,
else
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
-
if (target_sp->SetSectionLoadAddress (section_sp, section_base_addr))
{
// Flush info in the process (stack frames, etc)
@@ -2468,10 +2483,6 @@ SBTarget::ClearSectionLoadAddress (lldb::SBSection section)
else
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
-
if (target_sp->SetSectionUnloaded (section.GetSP()))
{
// Flush info in the process (stack frames, etc)
@@ -2547,9 +2558,6 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
if (section_list)
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
bool changed = false;
const size_t num_sections = section_list->GetSize();
@@ -2557,7 +2565,7 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
{
SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
if (section_sp)
- changed |= target_sp->SetSectionUnloaded (section_sp) > 0;
+ changed |= target_sp->SetSectionUnloaded (section_sp);
}
if (changed)
{
@@ -2619,7 +2627,7 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
SBValue expr_result;
- ExecutionResults exe_results = eExecutionSetupError;
+ ExpressionResults exe_results = eExpressionSetupError;
ValueObjectSP expr_value_sp;
TargetSP target_sp(GetSP());
StackFrame *frame = NULL;
@@ -2631,16 +2639,16 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
log->Printf ("SBTarget::EvaluateExpression called with an empty expression");
return expr_result;
}
-
+
Mutex::Locker api_locker (target_sp->GetAPIMutex());
ExecutionContext exe_ctx (m_opaque_sp.get());
-
+
if (log)
log->Printf ("SBTarget()::EvaluateExpression (expr=\"%s\")...", expr);
-
+
frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
-
+
if (target)
{
#ifdef LLDB_CONFIGURATION_DEBUG
@@ -2669,17 +2677,14 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
#ifndef LLDB_DISABLE_PYTHON
if (expr_log)
expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is %s, summary %s **",
- expr_result.GetValue(),
- expr_result.GetSummary());
-
+ expr_result.GetValue(), expr_result.GetSummary());
+
if (log)
log->Printf ("SBTarget(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
- frame,
- expr,
- expr_value_sp.get(),
- exe_results);
+ static_cast<void*>(frame), expr,
+ static_cast<void*>(expr_value_sp.get()), exe_results);
#endif
-
+
return expr_result;
}
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 4170d5b230bb..a0bfa4313535 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -19,10 +19,12 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Queue.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/StopInfo.h"
@@ -88,6 +90,42 @@ SBThread::~SBThread()
{
}
+lldb::SBQueue
+SBThread::GetQueue () const
+{
+ SBQueue sb_queue;
+ QueueSP queue_sp;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
+ if (queue_sp)
+ {
+ sb_queue.SetQueue (queue_sp);
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind () => SBQueue(%p)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), static_cast<void*>(queue_sp.get()));
+
+ return sb_queue;
+}
+
+
bool
SBThread::IsValid() const
{
@@ -120,12 +158,14 @@ SBThread::GetStopReason()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReason() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetStopReason () => %s", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::GetStopReason () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::StopReasonAsCString (reason));
return reason;
@@ -183,7 +223,8 @@ SBThread::GetStopReasonDataCount ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -226,7 +267,7 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
BreakpointLocationSP bp_loc_sp (bp_site_sp->GetOwnerAtIndex (bp_index));
if (bp_loc_sp)
{
- if (bp_index & 1)
+ if (idx & 1)
{
// Odd idx, return the breakpoint location ID
return bp_loc_sp->GetID();
@@ -257,7 +298,8 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -284,8 +326,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
if (stop_desc)
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
- exe_ctx.GetThreadPtr(), stop_desc);
+ log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ stop_desc);
if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc);
else
@@ -362,19 +405,20 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
default:
break;
}
-
+
if (stop_desc && stop_desc[0])
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
- exe_ctx.GetThreadPtr(), stop_desc);
+ log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ stop_desc);
if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte
if (stop_desc_len == 0)
stop_desc_len = ::strlen (stop_desc) + 1; // Include the NULL byte
-
+
return stop_desc_len;
}
}
@@ -384,7 +428,8 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (dst)
@@ -414,16 +459,18 @@ SBThread::GetStopReturnValue ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(),
- return_valobj_sp.get()
- ? return_valobj_sp->GetValueAsCString()
- : "<no return value>");
-
+ log->Printf ("SBThread(%p)::GetStopReturnValue () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ return_valobj_sp.get()
+ ? return_valobj_sp->GetValueAsCString()
+ : "<no return value>");
+
return SBValue (return_valobj_sp);
}
@@ -469,12 +516,15 @@ SBThread::GetName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -497,12 +547,15 @@ SBThread::GetQueueName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetQueueName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -525,16 +578,86 @@ SBThread::GetQueueID () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueID() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, exe_ctx.GetThreadPtr(), id);
+ log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64,
+ static_cast<void*>(exe_ctx.GetThreadPtr()), id);
return id;
}
+bool
+SBThread::GetInfoItemByPathAsString (const char *path, SBStream &strm)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ bool success = false;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
+ if (info_root_sp)
+ {
+ StructuredData::ObjectSP node = info_root_sp->GetObjectForDotSeparatedPath (path);
+ if (node)
+ {
+ if (node->GetType() == StructuredData::Type::eTypeString)
+ {
+ strm.Printf ("%s", node->GetAsString()->GetValue().c_str());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeInteger)
+ {
+ strm.Printf ("0x%" PRIx64, node->GetAsInteger()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeFloat)
+ {
+ strm.Printf ("0x%f", node->GetAsFloat()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeBoolean)
+ {
+ if (node->GetAsBoolean()->GetValue() == true)
+ strm.Printf ("true");
+ else
+ strm.Printf ("false");
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeNull)
+ {
+ strm.Printf ("null");
+ success = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetInfoItemByPathAsString() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetInfoItemByPathAsString () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ strm.GetData());
+
+ return success;
+}
+
+
SBError
SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
{
@@ -587,9 +710,10 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
if (log)
- log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
@@ -601,17 +725,19 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
{
if (frame_sp->HasDebugInformation ())
{
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepOverRange (abort_other_plans,
sc.line_entry.range,
sc,
- stop_other_threads);
+ stop_other_threads,
+ avoid_no_debug);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
}
@@ -636,10 +762,10 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (log)
log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
- exe_ctx.GetThreadPtr(),
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
target_name? target_name: "<NULL>",
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -650,22 +776,24 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (frame_sp && frame_sp->HasDebugInformation ())
{
- bool avoid_code_without_debug_info = true;
+ const LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate;
+ const LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepInRange (abort_other_plans,
sc.line_entry.range,
sc,
target_name,
stop_other_threads,
- avoid_code_without_debug_info);
+ step_in_avoids_code_without_debug_info,
+ step_out_avoids_code_without_debug_info);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (false,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -681,8 +809,9 @@ SBThread::StepOut ()
if (log)
- log->Printf ("SBThread(%p)::StepOut ()", exe_ctx.GetThreadPtr());
-
+ log->Printf ("SBThread(%p)::StepOut ()",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -690,14 +819,16 @@ SBThread::StepOut ()
Thread *thread = exe_ctx.GetThreadPtr();
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
- eVoteNoOpinion,
- 0));
-
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
+ eVoteNoOpinion,
+ 0,
+ avoid_no_debug));
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -716,7 +847,10 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
if (exe_ctx.HasThreadScope())
@@ -726,13 +860,13 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
eVoteNoOpinion,
frame_sp->GetFrameIndex()));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -749,13 +883,14 @@ SBThread::StepInstruction (bool step_over)
if (log)
- log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", exe_ctx.GetThreadPtr(), step_over);
-
+ log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), step_over);
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepSingleInstruction (step_over, true, true));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -771,8 +906,9 @@ SBThread::RunToAddress (lldb::addr_t addr)
if (log)
- log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr);
-
+ log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), addr);
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -783,7 +919,7 @@ SBThread::RunToAddress (lldb::addr_t addr)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -797,7 +933,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
SBError sb_error;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
char path[PATH_MAX];
-
+
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -808,11 +944,10 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
sb_file_spec->GetPath (path, sizeof(path));
- log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)",
- exe_ctx.GetThreadPtr(),
- frame_sp.get(),
- frame_desc_strm.GetData(),
- path, line);
+ log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData(), path, line);
}
if (exe_ctx.HasThreadScope())
@@ -825,14 +960,14 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
sb_error.SetErrorString("invalid line argument");
return sb_error;
}
-
+
if (!frame_sp)
{
frame_sp = thread->GetSelectedFrame ();
if (!frame_sp)
frame_sp = thread->GetStackFrameAtIndex (0);
}
-
+
SymbolContext frame_sc;
if (!frame_sp)
{
@@ -845,13 +980,13 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
eSymbolContextFunction |
eSymbolContextLineEntry |
eSymbolContextSymbol );
-
+
if (frame_sc.comp_unit == NULL)
{
sb_error.SetErrorStringWithFormat("frame %u doesn't have debug information", frame_sp->GetFrameIndex());
return sb_error;
}
-
+
FileSpec step_file_spec;
if (sb_file_spec.IsValid())
{
@@ -868,15 +1003,15 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
return sb_error;
}
}
-
+
// Grab the current function, then we will make sure the "until" address is
// within the function. We discard addresses that are out of the current
// function, and then if there are no addresses remaining, give an appropriate
// error message.
-
+
bool all_in_function = true;
AddressRange fun_range = frame_sc.function->GetAddressRange();
-
+
std::vector<addr_t> step_over_until_addrs;
const bool abort_other_plans = false;
const bool stop_other_threads = false;
@@ -908,7 +1043,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
}
}
}
-
+
if (step_over_until_addrs.empty())
{
if (all_in_function)
@@ -947,7 +1082,9 @@ SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
if (log)
- log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", exe_ctx.GetThreadPtr(), file_spec->GetPath().c_str(), line);
+ log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ file_spec->GetPath().c_str(), line);
if (!exe_ctx.HasThreadScope())
{
@@ -966,7 +1103,7 @@ SBError
SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
{
SBError sb_error;
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Mutex::Locker api_locker;
@@ -974,14 +1111,16 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
if (log)
- log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID());
-
+ log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ frame.GetFrameID());
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
}
-
+
return sb_error;
}
@@ -1003,11 +1142,13 @@ SBThread::Suspend()
else
{
if (log)
- log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Suspend() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Suspend() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1022,17 +1163,20 @@ SBThread::Resume ()
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
- exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
+ const bool override_suspend = true;
+ exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning, override_suspend);
result = true;
}
else
{
if (log)
- log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Resume() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Resume() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1070,8 +1214,10 @@ SBThread::GetProcess ()
{
SBStream frame_desc_strm;
sb_process.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", exe_ctx.GetThreadPtr(),
- sb_process.GetSP().get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(sb_process.GetSP().get()),
+ frame_desc_strm.GetData());
}
return sb_process;
@@ -1096,12 +1242,14 @@ SBThread::GetNumFrames ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames () => %u", exe_ctx.GetThreadPtr(), num_frames);
+ log->Printf ("SBThread(%p)::GetNumFrames () => %u",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), num_frames);
return num_frames;
}
@@ -1127,7 +1275,8 @@ SBThread::GetFrameAtIndex (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1135,8 +1284,10 @@ SBThread::GetFrameAtIndex (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), idx,
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
@@ -1163,7 +1314,8 @@ SBThread::GetSelectedFrame ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1171,8 +1323,10 @@ SBThread::GetSelectedFrame ()
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
@@ -1204,7 +1358,8 @@ SBThread::SetSelectedFrame (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1212,8 +1367,10 @@ SBThread::SetSelectedFrame (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), idx,
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
}
@@ -1316,7 +1473,11 @@ SBThread::GetExtendedBacktraceThread (const char *type)
const char *queue_name = new_thread_sp->GetQueueName();
if (queue_name == NULL)
queue_name = "";
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", exe_ctx.GetThreadPtr(), new_thread_sp.get(), new_thread_sp->GetQueueID(), queue_name);
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(new_thread_sp.get()),
+ new_thread_sp->GetQueueID(),
+ queue_name);
}
}
}
@@ -1326,10 +1487,14 @@ SBThread::GetExtendedBacktraceThread (const char *type)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
+ if (log && sb_origin_thread.IsValid() == false)
+ log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a Valid thread",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
return sb_origin_thread;
}
@@ -1341,3 +1506,12 @@ SBThread::GetExtendedBacktraceOriginatingIndexID ()
return thread_sp->GetExtendedBacktraceOriginatingIndexID();
return LLDB_INVALID_INDEX32;
}
+
+bool
+SBThread::SafeToCallFunctions ()
+{
+ ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
+ if (thread_sp)
+ return thread_sp->SafeToCallFunctions();
+ return true;
+}
diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp
index 5ca7ddf3d813..064fb32c953f 100644
--- a/source/API/SBType.cpp
+++ b/source/API/SBType.cpp
@@ -9,6 +9,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeEnumMember.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
@@ -17,6 +18,8 @@
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
+#include "clang/AST/Decl.h"
+
using namespace lldb;
using namespace lldb_private;
using namespace clang;
@@ -364,6 +367,27 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
return sb_type_member;
}
+SBTypeEnumMemberList
+SBType::GetEnumMembers ()
+{
+ SBTypeEnumMemberList sb_enum_member_list;
+ if (IsValid())
+ {
+ const clang::EnumDecl *enum_decl = m_opaque_sp->GetClangASTType(true).GetFullyUnqualifiedType().GetAsEnumDecl();
+ if (enum_decl)
+ {
+ clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
+ for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
+ {
+ SBTypeEnumMember enum_member;
+ enum_member.reset(new TypeEnumMemberImpl(*enum_pos, ClangASTType(m_opaque_sp->GetClangASTContext(true), enum_decl->getIntegerType())));
+ sb_enum_member_list.Append(enum_member);
+ }
+ }
+ }
+ return sb_enum_member_list;
+}
+
SBTypeMember
SBType::GetFieldAtIndex (uint32_t idx)
{
@@ -414,6 +438,14 @@ SBType::GetName()
return m_opaque_sp->GetName().GetCString();
}
+const char *
+SBType::GetDisplayTypeName ()
+{
+ if (!IsValid())
+ return "";
+ return m_opaque_sp->GetDisplayTypeName().GetCString();
+}
+
lldb::TypeClass
SBType::GetTypeClass ()
{
diff --git a/source/API/SBTypeEnumMember.cpp b/source/API/SBTypeEnumMember.cpp
new file mode 100644
index 000000000000..47c57dd213fb
--- /dev/null
+++ b/source/API/SBTypeEnumMember.cpp
@@ -0,0 +1,192 @@
+//===-- SBTypeEnumMember.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/SBDefines.h"
+#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeEnumMember.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/Core/Stream.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/Type.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace clang;
+
+SBTypeEnumMember::SBTypeEnumMember() :
+ m_opaque_sp()
+{
+}
+
+SBTypeEnumMember::~SBTypeEnumMember()
+{
+}
+SBTypeEnumMember::SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &enum_member_sp) :
+ m_opaque_sp(enum_member_sp)
+{
+}
+
+SBTypeEnumMember::SBTypeEnumMember (const SBTypeEnumMember& rhs) :
+ m_opaque_sp()
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ }
+}
+
+SBTypeEnumMember&
+SBTypeEnumMember::operator = (const SBTypeEnumMember& rhs)
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ }
+ return *this;
+}
+
+bool
+SBTypeEnumMember::IsValid() const
+{
+ return m_opaque_sp.get();
+}
+
+const char *
+SBTypeEnumMember::GetName ()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetName().GetCString();
+ return NULL;
+}
+
+int64_t
+SBTypeEnumMember::GetValueAsSigned()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetValueAsSigned();
+ return 0;
+}
+
+uint64_t
+SBTypeEnumMember::GetValueAsUnsigned()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetValueAsUnsigned();
+ return 0;
+}
+
+SBType
+SBTypeEnumMember::GetType ()
+{
+ SBType sb_type;
+ if (m_opaque_sp.get())
+ {
+ sb_type.SetSP(m_opaque_sp->GetIntegerType());
+ }
+ return sb_type;
+
+}
+
+void
+SBTypeEnumMember::reset(TypeEnumMemberImpl *type_member_impl)
+{
+ m_opaque_sp.reset(type_member_impl);
+}
+
+TypeEnumMemberImpl &
+SBTypeEnumMember::ref ()
+{
+ if (m_opaque_sp.get() == NULL)
+ m_opaque_sp.reset (new TypeEnumMemberImpl());
+ return *m_opaque_sp.get();
+}
+
+const TypeEnumMemberImpl &
+SBTypeEnumMember::ref () const
+{
+ return *m_opaque_sp.get();
+}
+
+
+SBTypeEnumMemberList::SBTypeEnumMemberList() :
+ m_opaque_ap(new TypeEnumMemberListImpl())
+{
+}
+
+SBTypeEnumMemberList::SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs) :
+ m_opaque_ap(new TypeEnumMemberListImpl())
+{
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));
+}
+
+bool
+SBTypeEnumMemberList::IsValid ()
+{
+ return (m_opaque_ap.get() != NULL);
+}
+
+SBTypeEnumMemberList&
+SBTypeEnumMemberList::operator = (const SBTypeEnumMemberList& rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_ap.reset (new TypeEnumMemberListImpl());
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));
+ }
+ return *this;
+}
+
+void
+SBTypeEnumMemberList::Append (SBTypeEnumMember enum_member)
+{
+ if (enum_member.IsValid())
+ m_opaque_ap->Append (enum_member.m_opaque_sp);
+}
+
+SBTypeEnumMember
+SBTypeEnumMemberList::GetTypeEnumMemberAtIndex(uint32_t index)
+{
+ if (m_opaque_ap.get())
+ return SBTypeEnumMember(m_opaque_ap->GetTypeEnumMemberAtIndex(index));
+ return SBTypeEnumMember();
+}
+
+uint32_t
+SBTypeEnumMemberList::GetSize()
+{
+ return m_opaque_ap->GetSize();
+}
+
+SBTypeEnumMemberList::~SBTypeEnumMemberList()
+{
+}
+
+bool
+SBTypeEnumMember::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_sp.get())
+ {
+ if( m_opaque_sp->GetIntegerType()->GetDescription(strm, description_level) )
+ {
+ strm.Printf(" %s", m_opaque_sp->GetName().GetCString());
+ }
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
diff --git a/source/API/SBUnixSignals.cpp b/source/API/SBUnixSignals.cpp
new file mode 100644
index 000000000000..ca321d82fd60
--- /dev/null
+++ b/source/API/SBUnixSignals.cpp
@@ -0,0 +1,199 @@
+//===-- SBUnixSignals.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/lldb-defines.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/UnixSignals.h"
+#include "lldb/Core/Log.h"
+
+#include "lldb/API/SBUnixSignals.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBUnixSignals::SBUnixSignals ()
+{}
+
+SBUnixSignals::SBUnixSignals (const SBUnixSignals &rhs) :
+ m_opaque_wp(rhs.m_opaque_wp)
+{
+}
+
+SBUnixSignals::SBUnixSignals (ProcessSP &process_sp) :
+ m_opaque_wp(process_sp)
+{
+}
+
+const SBUnixSignals&
+SBUnixSignals::operator = (const SBUnixSignals& rhs)
+{
+ if (this != &rhs)
+ m_opaque_wp = rhs.m_opaque_wp;
+ return *this;
+}
+
+SBUnixSignals::~SBUnixSignals()
+{
+}
+
+ProcessSP
+SBUnixSignals::GetSP() const
+{
+ return m_opaque_wp.lock();
+}
+
+void
+SBUnixSignals::SetSP (const ProcessSP &process_sp)
+{
+ m_opaque_wp = process_sp;
+}
+
+void
+SBUnixSignals::Clear ()
+{
+ m_opaque_wp.reset();
+}
+
+bool
+SBUnixSignals::IsValid() const
+{
+ return (bool) GetSP();
+}
+
+const char *
+SBUnixSignals::GetSignalAsCString (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetSignalAsCString(signo);
+ return NULL;
+}
+
+int32_t
+SBUnixSignals::GetSignalNumberFromName (const char *name) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetSignalNumberFromName(name);
+ return -1;
+}
+
+bool
+SBUnixSignals::GetShouldSuppress (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldSuppress(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldSuppress (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldSuppress (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldSuppress(signo, value);
+ return false;
+}
+
+bool
+SBUnixSignals::GetShouldStop (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldStop(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldStop (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldStop (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldStop(signo, value);
+ return false;
+}
+
+bool
+SBUnixSignals::GetShouldNotify (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldNotify(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldNotify (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldNotify (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldNotify(signo, value);
+ return false;
+}
+
+int32_t
+SBUnixSignals::GetNumSignals () const
+{
+ if (auto process_sp = GetSP())
+ {
+ // only valid while we hold process_sp
+ UnixSignals *unix_signals_ptr = &process_sp->GetUnixSignals();
+ int32_t num_signals = 0;
+ for (int32_t signo = unix_signals_ptr->GetFirstSignalNumber();
+ signo != LLDB_INVALID_SIGNAL_NUMBER;
+ signo = unix_signals_ptr->GetNextSignalNumber(signo))
+ {
+ num_signals++;
+ }
+ return num_signals;
+ }
+ return LLDB_INVALID_SIGNAL_NUMBER;
+}
+
+int32_t
+SBUnixSignals::GetSignalAtIndex (int32_t index) const
+{
+ if (auto process_sp = GetSP())
+ {
+ // only valid while we hold process_sp
+ UnixSignals *unix_signals_ptr = &process_sp->GetUnixSignals();
+ int32_t idx = 0;
+ for (int32_t signo = unix_signals_ptr->GetFirstSignalNumber();
+ signo != LLDB_INVALID_SIGNAL_NUMBER;
+ signo = unix_signals_ptr->GetNextSignalNumber(signo))
+ {
+ if (index == idx) return signo;
+ idx++;
+ }
+ }
+ return LLDB_INVALID_SIGNAL_NUMBER;
+}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 4bd018352ff2..3a9621b1e3bc 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -58,7 +58,7 @@ public:
ValueImpl ()
{
}
-
+
ValueImpl (lldb::ValueObjectSP in_valobj_sp,
lldb::DynamicValueType use_dynamic,
bool use_synthetic,
@@ -71,7 +71,7 @@ public:
if (!m_name.IsEmpty() && m_valobj_sp)
m_valobj_sp->SetName(m_name);
}
-
+
ValueImpl (const ValueImpl& rhs) :
m_valobj_sp(rhs.m_valobj_sp),
m_use_dynamic(rhs.m_use_dynamic),
@@ -79,7 +79,7 @@ public:
m_name (rhs.m_name)
{
}
-
+
ValueImpl &
operator = (const ValueImpl &rhs)
{
@@ -92,7 +92,7 @@ public:
}
return *this;
}
-
+
bool
IsValid ()
{
@@ -115,13 +115,13 @@ public:
return false;
}
}
-
+
lldb::ValueObjectSP
GetRootSP ()
{
return m_valobj_sp;
}
-
+
lldb::ValueObjectSP
GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error)
{
@@ -131,26 +131,27 @@ public:
error.SetErrorString("invalid value object");
return m_valobj_sp;
}
-
+
lldb::ValueObjectSP value_sp = m_valobj_sp;
-
+
Target *target = value_sp->GetTargetSP().get();
if (target)
api_locker.Lock(target->GetAPIMutex());
else
return ValueObjectSP();
-
+
ProcessSP process_sp(value_sp->GetProcessSP());
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
{
// We don't allow people to play around with ValueObject if the process is running.
// If you want to look at values, pause the process, then look.
if (log)
- log->Printf ("SBValue(%p)::GetSP() => error: process is running", value_sp.get());
+ log->Printf ("SBValue(%p)::GetSP() => error: process is running",
+ static_cast<void*>(value_sp.get()));
error.SetErrorString ("process must be stopped.");
return ValueObjectSP();
}
-
+
if (value_sp->GetDynamicValue(m_use_dynamic))
value_sp = value_sp->GetDynamicValue(m_use_dynamic);
if (value_sp->GetSyntheticValue(m_use_synthetic))
@@ -159,34 +160,34 @@ public:
error.SetErrorString("invalid value object");
if (!m_name.IsEmpty())
value_sp->SetName(m_name);
-
+
return value_sp;
}
-
+
void
SetUseDynamic (lldb::DynamicValueType use_dynamic)
{
m_use_dynamic = use_dynamic;
}
-
+
void
SetUseSynthetic (bool use_synthetic)
{
m_use_synthetic = use_synthetic;
}
-
+
lldb::DynamicValueType
GetUseDynamic ()
{
return m_use_dynamic;
}
-
+
bool
GetUseSynthetic ()
{
return m_use_synthetic;
}
-
+
// All the derived values that we would make from the m_valobj_sp will share
// the ExecutionContext with m_valobj_sp, so we don't need to do the calculations
// in GetSP to return the Target, Process, Thread or Frame. It is convenient to
@@ -199,7 +200,7 @@ public:
else
return TargetSP();
}
-
+
ProcessSP
GetProcessSP ()
{
@@ -208,7 +209,7 @@ public:
else
return ProcessSP();
}
-
+
ThreadSP
GetThreadSP ()
{
@@ -217,7 +218,7 @@ public:
else
return ThreadSP();
}
-
+
StackFrameSP
GetFrameSP ()
{
@@ -226,7 +227,7 @@ public:
else
return StackFrameSP();
}
-
+
private:
lldb::ValueObjectSP m_valobj_sp;
lldb::DynamicValueType m_use_dynamic;
@@ -337,16 +338,18 @@ SBValue::GetName()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
name = value_sp->GetName().GetCString();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetName () => \"%s\"", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetName () => NULL",
+ static_cast<void*>(value_sp.get()));
}
-
+
return name;
}
@@ -361,13 +364,40 @@ SBValue::GetTypeName ()
{
name = value_sp->GetQualifiedTypeName().GetCString();
}
+
+ if (log)
+ {
+ if (name)
+ log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
+ else
+ log->Printf ("SBValue(%p)::GetTypeName () => NULL",
+ static_cast<void*>(value_sp.get()));
+ }
+
+ return name;
+}
+
+const char *
+SBValue::GetDisplayTypeName ()
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ const char *name = NULL;
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp)
+ {
+ name = value_sp->GetDisplayTypeName().GetCString();
+ }
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetTypeName () => NULL",
+ static_cast<void*>(value_sp.get()));
}
return name;
@@ -378,17 +408,19 @@ SBValue::GetByteSize ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t result = 0;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->GetByteSize();
}
-
+
if (log)
- log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result);
-
+ log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64,
+ static_cast<void*>(value_sp.get()),
+ static_cast<uint64_t>(result));
+
return result;
}
@@ -396,18 +428,19 @@ bool
SBValue::IsInScope ()
{
bool result = false;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->IsInScope ();
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result);
-
+ log->Printf ("SBValue(%p)::IsInScope () => %i",
+ static_cast<void*>(value_sp.get()), result);
+
return result;
}
@@ -415,7 +448,7 @@ const char *
SBValue::GetValue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
const char *cstr = NULL;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
@@ -426,11 +459,13 @@ SBValue::GetValue ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetValue() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetValue() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetValue() => NULL",
+ static_cast<void*>(value_sp.get()));
}
-
+
return cstr;
}
@@ -442,20 +477,44 @@ SBValue::GetValueType ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
result = value_sp->GetValueType();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
switch (result)
{
- case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break;
- case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break;
- case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break;
- case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break;
- case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break;
- case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break;
- case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break;
- case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break;
+ case eValueTypeInvalid:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableGlobal:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableStatic:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableArgument:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableLocal:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeRegister:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeRegisterSet:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeConstResult:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult",
+ static_cast<void*>(value_sp.get()));
+ break;
}
}
return result;
@@ -475,9 +534,11 @@ SBValue::GetObjectDescription ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetObjectDescription() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -498,9 +559,12 @@ SBValue::GetType()
if (log)
{
if (type_sp)
- log->Printf ("SBValue(%p)::GetType => SBType(%p)", value_sp.get(), type_sp.get());
+ log->Printf ("SBValue(%p)::GetType => SBType(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(type_sp.get()));
else
- log->Printf ("SBValue(%p)::GetType => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetType => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_type;
}
@@ -517,8 +581,9 @@ SBValue::GetValueDidChange ()
result = value_sp->GetValueDidChange ();
}
if (log)
- log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result);
-
+ log->Printf ("SBValue(%p)::GetValueDidChange() => %i",
+ static_cast<void*>(value_sp.get()), result);
+
return result;
}
@@ -537,9 +602,11 @@ SBValue::GetSummary ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetSummary() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -559,9 +626,11 @@ SBValue::GetLocation ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetLocation() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetLocation() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetLocation() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -587,10 +656,11 @@ SBValue::SetValueFromCString (const char *value_str, lldb::SBError& error)
}
else
error.SetErrorStringWithFormat ("Could not get value: %s", locker.GetError().AsCString());
-
+
if (log)
- log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
-
+ log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i",
+ static_cast<void*>(value_sp.get()), value_str, success);
+
return success;
}
@@ -698,11 +768,11 @@ SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
{
if (new_value_sp)
log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"",
- value_sp.get(),
+ static_cast<void*>(value_sp.get()),
new_value_sp->GetName().AsCString());
else
log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL",
- value_sp.get());
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -757,15 +827,11 @@ SBValue::CreateValueFromExpression (const char *name, const char *expression, SB
{
if (new_value_sp)
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => SBValue (%p)",
- value_sp.get(),
- name,
- expression,
- new_value_sp.get());
+ static_cast<void*>(value_sp.get()), name, expression,
+ static_cast<void*>(new_value_sp.get()));
else
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => NULL",
- value_sp.get(),
- name,
- expression);
+ static_cast<void*>(value_sp.get()), name, expression);
}
return sb_value;
}
@@ -784,7 +850,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
if (pointer_ast_type)
{
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-
+
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
pointer_ast_type,
@@ -792,7 +858,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
buffer,
exe_ctx.GetByteOrder(),
exe_ctx.GetAddressByteSize()));
-
+
if (ptr_result_valobj_sp)
{
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
@@ -808,9 +874,12 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
if (log)
{
if (new_value_sp)
- log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"",
+ static_cast<void*>(value_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -825,7 +894,7 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
if (value_sp)
{
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
-
+
new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
type.m_opaque_sp->GetClangASTType(false),
ConstString(name),
@@ -838,9 +907,12 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
if (log)
{
if (new_value_sp)
- log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"",
+ static_cast<void*>(value_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::CreateValueFromData => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::CreateValueFromData => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -865,7 +937,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
{
lldb::ValueObjectSP child_sp;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
@@ -884,12 +956,14 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
}
}
}
-
+
SBValue sb_value;
sb_value.SetSP (child_sp, use_dynamic, GetPreferSyntheticValue());
if (log)
- log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), idx,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -907,9 +981,11 @@ SBValue::GetIndexOfChildWithName (const char *name)
if (log)
{
if (idx == UINT32_MAX)
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", value_sp.get(), name, idx);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u",
+ static_cast<void*>(value_sp.get()), name, idx);
}
return idx;
}
@@ -921,7 +997,7 @@ SBValue::GetChildMemberWithName (const char *name)
TargetSP target_sp;
if (m_opaque_sp)
target_sp = m_opaque_sp->GetTargetSP();
-
+
if (target_sp)
use_dynamic_value = target_sp->GetPreferDynamicValue();
return GetChildMemberWithName (name, use_dynamic_value);
@@ -932,22 +1008,24 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
{
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
child_sp = value_sp->GetChildMemberWithName (str_name, true);
}
-
+
SBValue sb_value;
sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
-
+
if (log)
- log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), name,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1049,13 +1127,15 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
// using default values for all the fancy options, just do it if you can
child_sp = value_sp->GetValueForExpressionPath(expr_path);
}
-
+
SBValue sb_value;
sb_value.SetSP(child_sp,GetPreferDynamicValue(),GetPreferSyntheticValue());
-
+
if (log)
- log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), expr_path,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1134,9 +1214,10 @@ SBValue::MightHaveChildren ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
has_children = value_sp->MightHaveChildren();
-
+
if (log)
- log->Printf ("SBValue(%p)::MightHaveChildren() => %i", value_sp.get(), has_children);
+ log->Printf ("SBValue(%p)::MightHaveChildren() => %i",
+ static_cast<void*>(value_sp.get()), has_children);
return has_children;
}
@@ -1144,16 +1225,17 @@ uint32_t
SBValue::GetNumChildren ()
{
uint32_t num_children = 0;
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
num_children = value_sp->GetNumChildren();
-
+
if (log)
- log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
-
+ log->Printf ("SBValue(%p)::GetNumChildren () => %u",
+ static_cast<void*>(value_sp.get()), num_children);
+
return num_children;
}
@@ -1171,8 +1253,10 @@ SBValue::Dereference ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get());
-
+ log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1180,17 +1264,17 @@ bool
SBValue::TypeIsPointerType ()
{
bool is_ptr_type = false;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
is_ptr_type = value_sp->IsPointerType();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type);
-
-
+ log->Printf ("SBValue(%p)::TypeIsPointerType () => %i",
+ static_cast<void*>(value_sp.get()), is_ptr_type);
+
return is_ptr_type;
}
@@ -1218,9 +1302,12 @@ SBValue::GetTarget()
if (log)
{
if (target_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), target_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()));
}
return sb_target;
}
@@ -1239,9 +1326,12 @@ SBValue::GetProcess()
if (log)
{
if (process_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), process_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(process_sp.get()));
}
return sb_process;
}
@@ -1260,9 +1350,12 @@ SBValue::GetThread()
if (log)
{
if (thread_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(thread_sp.get()));
}
return sb_thread;
}
@@ -1281,9 +1374,12 @@ SBValue::GetFrame()
if (log)
{
if (frame_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), frame_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(frame_sp.get()));
}
return sb_frame;
}
@@ -1450,8 +1546,10 @@ SBValue::AddressOf()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)", value_sp.get(), value_sp.get());
-
+ log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1487,8 +1585,9 @@ SBValue::GetLoadAddress()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value);
-
+ log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")",
+ static_cast<void*>(value_sp.get()), value);
+
return value;
}
@@ -1524,8 +1623,11 @@ SBValue::GetAddress()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(),
- (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"),
+ log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")",
+ static_cast<void*>(value_sp.get()),
+ (addr.GetSection()
+ ? addr.GetSection()->GetName().GetCString()
+ : "NULL"),
addr.GetOffset());
return SBAddress(new Address(addr));
}
@@ -1551,11 +1653,9 @@ SBValue::GetPointeeData (uint32_t item_idx,
}
if (log)
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
- value_sp.get(),
- item_idx,
- item_count,
- sb_data.get());
-
+ static_cast<void*>(value_sp.get()), item_idx, item_count,
+ static_cast<void*>(sb_data.get()));
+
return sb_data;
}
@@ -1569,15 +1669,16 @@ SBValue::GetData ()
if (value_sp)
{
DataExtractorSP data_sp(new DataExtractor());
- value_sp->GetData(*data_sp);
- if (data_sp->GetByteSize() > 0)
+ Error error;
+ value_sp->GetData(*data_sp, error);
+ if (error.Success())
*sb_data = data_sp;
}
if (log)
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
- value_sp.get(),
- sb_data.get());
-
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(sb_data.get()));
+
return sb_data;
}
@@ -1588,25 +1689,26 @@ SBValue::SetData (lldb::SBData &data, SBError &error)
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
bool ret = true;
-
+
if (value_sp)
{
DataExtractor *data_extractor = data.get();
-
+
if (!data_extractor)
{
if (log)
- log->Printf ("SBValue(%p)::SetData() => error: no data to set", value_sp.get());
-
+ log->Printf ("SBValue(%p)::SetData() => error: no data to set",
+ static_cast<void*>(value_sp.get()));
+
error.SetErrorString("No data to set");
ret = false;
}
else
{
Error set_error;
-
+
value_sp->SetData(*data_extractor, set_error);
-
+
if (!set_error.Success())
{
error.SetErrorStringWithFormat("Couldn't set data: %s", set_error.AsCString());
@@ -1619,12 +1721,11 @@ SBValue::SetData (lldb::SBData &data, SBError &error)
error.SetErrorStringWithFormat ("Couldn't set data: could not get SBValue: %s", locker.GetError().AsCString());
ret = false;
}
-
+
if (log)
log->Printf ("SBValue(%p)::SetData (%p) => %s",
- value_sp.get(),
- data.get(),
- ret ? "true" : "false");
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(data.get()), ret ? "true" : "false");
return ret;
}
@@ -1647,7 +1748,7 @@ lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
SBWatchpoint sb_watchpoint;
-
+
// If the SBValue is not valid, there's no point in even trying to watch it.
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
@@ -1657,29 +1758,29 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
// Read and Write cannot both be false.
if (!read && !write)
return sb_watchpoint;
-
+
// If the value is not in scope, don't try and watch and invalid value
if (!IsInScope())
return sb_watchpoint;
-
+
addr_t addr = GetLoadAddress();
if (addr == LLDB_INVALID_ADDRESS)
return sb_watchpoint;
size_t byte_size = GetByteSize();
if (byte_size == 0)
return sb_watchpoint;
-
+
uint32_t watch_type = 0;
if (read)
watch_type |= LLDB_WATCH_TYPE_READ;
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
-
+
Error rc;
ClangASTType type (value_sp->GetClangType());
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
error.SetError(rc);
-
+
if (watchpoint_sp)
{
sb_watchpoint.SetSP (watchpoint_sp);
@@ -1700,18 +1801,21 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", value_sp.get(), locker.GetError().AsCString());
-
+ log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s",
+ static_cast<void*>(value_sp.get()),
+ locker.GetError().AsCString());
+
error.SetErrorStringWithFormat("could not get SBValue: %s", locker.GetError().AsCString());
}
else
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", value_sp.get());
+ log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target",
+ static_cast<void*>(value_sp.get()));
error.SetErrorString("could not set watchpoint, a target is required");
}
-
+
return sb_watchpoint;
}
diff --git a/source/API/SBValueList.cpp b/source/API/SBValueList.cpp
index 46866eb37424..5069ed3f5624 100644
--- a/source/API/SBValueList.cpp
+++ b/source/API/SBValueList.cpp
@@ -99,8 +99,8 @@ SBValueList::SBValueList (const SBValueList &rhs) :
if (log)
{
log->Printf ("SBValueList::SBValueList (rhs.ap=%p) => this.ap = %p",
- (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL),
- m_opaque_ap.get());
+ static_cast<void*>(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
@@ -114,9 +114,9 @@ SBValueList::SBValueList (const ValueListImpl *lldb_object_ptr) :
if (log)
{
- log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p",
- lldb_object_ptr,
- m_opaque_ap.get());
+ log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p",
+ static_cast<const void*>(lldb_object_ptr),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
@@ -218,7 +218,8 @@ SBValueList::GetValueAtIndex (uint32_t idx) const
SBStream sstr;
sb_value.GetDescription (sstr);
log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')",
- m_opaque_ap.get(), idx, sb_value.GetSP().get(), sstr.GetData());
+ static_cast<void*>(m_opaque_ap.get()), idx,
+ static_cast<void*>(sb_value.GetSP().get()), sstr.GetData());
}
return sb_value;
@@ -237,7 +238,8 @@ SBValueList::GetSize () const
size = m_opaque_ap->GetSize();
if (log)
- log->Printf ("SBValueList::GetSize (this.ap=%p) => %d", m_opaque_ap.get(), size);
+ log->Printf ("SBValueList::GetSize (this.ap=%p) => %d",
+ static_cast<void*>(m_opaque_ap.get()), size);
return size;
}
diff --git a/source/API/SBWatchpoint.cpp b/source/API/SBWatchpoint.cpp
index 194695c31d5b..1a1a970aaa87 100644
--- a/source/API/SBWatchpoint.cpp
+++ b/source/API/SBWatchpoint.cpp
@@ -42,7 +42,9 @@ SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp) :
SBStream sstr;
GetDescription (sstr, lldb::eDescriptionLevelBrief);
log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp"
- "=%p) => this.sp = %p (%s)", wp_sp.get(), m_opaque_sp.get(), sstr.GetData());
+ "=%p) => this.sp = %p (%s)",
+ static_cast<void*>(wp_sp.get()),
+ static_cast<void*>(m_opaque_sp.get()), sstr.GetData());
}
}
@@ -77,9 +79,11 @@ SBWatchpoint::GetID ()
if (log)
{
if (watch_id == LLDB_INVALID_WATCH_ID)
- log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", watchpoint_sp.get());
+ log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID",
+ static_cast<void*>(watchpoint_sp.get()));
else
- log->Printf ("SBWatchpoint(%p)::GetID () => %u", watchpoint_sp.get(), watch_id);
+ log->Printf ("SBWatchpoint(%p)::GetID () => %u",
+ static_cast<void*>(watchpoint_sp.get()), watch_id);
}
return watch_id;
@@ -185,7 +189,8 @@ SBWatchpoint::GetHitCount ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", watchpoint_sp.get(), count);
+ log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u",
+ static_cast<void*>(watchpoint_sp.get()), count);
return count;
}
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index 5ce064fc41a0..7d08170e4aed 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -541,7 +541,7 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
if (!m_kind_description.empty())
{
- if (eDescriptionLevelBrief)
+ if (level == eDescriptionLevelBrief)
{
s->PutCString (GetBreakpointKind());
return;
diff --git a/source/Breakpoint/BreakpointID.cpp b/source/Breakpoint/BreakpointID.cpp
index 9a59e29d007d..9963ed68303a 100644
--- a/source/Breakpoint/BreakpointID.cpp
+++ b/source/Breakpoint/BreakpointID.cpp
@@ -71,7 +71,7 @@ void
BreakpointID::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
if (level == eDescriptionLevelVerbose)
- s->Printf("%p BreakpointID:", this);
+ s->Printf("%p BreakpointID:", static_cast<void*>(this));
if (m_break_id == LLDB_INVALID_BREAK_ID)
s->PutCString ("<invalid>");
diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp
index 147ad36b0407..650737761547 100644
--- a/source/Breakpoint/BreakpointList.cpp
+++ b/source/Breakpoint/BreakpointList.cpp
@@ -167,7 +167,7 @@ void
BreakpointList::Dump (Stream *s) const
{
Mutex::Locker locker(m_mutex);
- s->Printf("%p: ", this);
+ s->Printf("%p: ", static_cast<const void*>(this));
s->Indent();
s->Printf("BreakpointList with %u Breakpoints:\n", (uint32_t)m_breakpoints.size());
s->IndentMore();
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index 2c75a11e9788..e1ac043ae905 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -289,7 +289,8 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
if (!m_user_expression_sp->Parse(errors,
exe_ctx,
eExecutionPolicyOnlyWhenNeeded,
- true))
+ true,
+ false))
{
error.SetErrorStringWithFormat("Couldn't parse conditional expression:\n%s",
errors.GetData());
@@ -316,7 +317,7 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
ClangExpressionVariableSP result_variable_sp;
- ExecutionResults result_code =
+ ExpressionResults result_code =
m_user_expression_sp->Execute(execution_errors,
exe_ctx,
options,
@@ -325,11 +326,10 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
bool ret;
- if (result_code == eExecutionCompleted)
+ if (result_code == eExpressionCompleted)
{
if (!result_variable_sp)
{
- ret = false;
error.SetErrorString("Expression did not return a result");
return false;
}
@@ -522,8 +522,15 @@ BreakpointLocation::ClearBreakpointSite ()
{
if (m_bp_site_sp.get())
{
- m_owner.GetTarget().GetProcessSP()->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(),
+ ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
+ // If the process exists, get it to remove the owner, it will remove the physical implementation
+ // of the breakpoint as well if there are no more owners. Otherwise just remove this owner.
+ if (process_sp)
+ process_sp->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(),
GetID(), m_bp_site_sp);
+ else
+ m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
+
m_bp_site_sp.reset();
return true;
}
@@ -627,7 +634,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
if (exe_scope == NULL)
exe_scope = target;
- if (eDescriptionLevelInitial)
+ if (level == eDescriptionLevelInitial)
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
else
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
diff --git a/source/Breakpoint/BreakpointLocationList.cpp b/source/Breakpoint/BreakpointLocationList.cpp
index 917c776e75d2..ae7f863ad090 100644
--- a/source/Breakpoint/BreakpointLocationList.cpp
+++ b/source/Breakpoint/BreakpointLocationList.cpp
@@ -152,7 +152,7 @@ BreakpointLocationList::FindByAddress (const Address &addr) const
void
BreakpointLocationList::Dump (Stream *s) const
{
- s->Printf("%p: ", this);
+ s->Printf("%p: ", static_cast<const void*>(this));
//s->Indent();
Mutex::Locker locker (m_mutex);
s->Printf("BreakpointLocationList with %" PRIu64 " BreakpointLocations:\n", (uint64_t)m_locations.size());
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp
index 3a4a117695fc..ea8556d0930b 100644
--- a/source/Breakpoint/BreakpointOptions.cpp
+++ b/source/Breakpoint/BreakpointOptions.cpp
@@ -154,7 +154,7 @@ BreakpointOptions::InvokeCallback (StoppointCallbackContext *context,
}
bool
-BreakpointOptions::HasCallback ()
+BreakpointOptions::HasCallback () const
{
return m_callback != BreakpointOptions::NullCallback;
}
diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp
index cf5d89cb7a8b..3ac3ed06fc70 100644
--- a/source/Breakpoint/BreakpointResolverName.cpp
+++ b/source/Breakpoint/BreakpointResolverName.cpp
@@ -234,7 +234,7 @@ BreakpointResolverName::SearchCallback
if (context.module_sp)
{
context.module_sp->FindFunctions (m_regex,
- !filter_by_cu, // include symbols only if we aren't filterning by CU
+ !filter_by_cu, // include symbols only if we aren't filtering by CU
include_inlines,
append,
func_list);
@@ -264,7 +264,7 @@ BreakpointResolverName::SearchCallback
}
}
- // Remove any duplicates between the funcion list and the symbol list
+ // Remove any duplicates between the function list and the symbol list
SymbolContext sc;
if (func_list.GetSize())
{
diff --git a/source/Breakpoint/BreakpointSite.cpp b/source/Breakpoint/BreakpointSite.cpp
index fa5d8c1f9f81..3cf6d37af379 100644
--- a/source/Breakpoint/BreakpointSite.cpp
+++ b/source/Breakpoint/BreakpointSite.cpp
@@ -32,7 +32,8 @@ BreakpointSite::BreakpointSite
m_saved_opcode(),
m_trap_opcode(),
m_enabled(false), // Need to create it disabled, so the first enable turns it on.
- m_owners()
+ m_owners(),
+ m_owners_mutex(Mutex::eMutexTypeRecursive)
{
m_owners.Add(owner);
}
@@ -60,6 +61,7 @@ BreakpointSite::GetNextID()
bool
BreakpointSite::ShouldStop (StoppointCallbackContext *context)
{
+ Mutex::Locker locker(m_owners_mutex);
IncrementHitCount();
return m_owners.ShouldStop (context);
}
@@ -67,6 +69,7 @@ BreakpointSite::ShouldStop (StoppointCallbackContext *context)
bool
BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
{
+ Mutex::Locker locker(m_owners_mutex);
const size_t owner_count = m_owners.GetSize();
for (size_t i = 0; i < owner_count; i++)
{
@@ -93,6 +96,7 @@ BreakpointSite::Dump(Stream *s) const
void
BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
+ Mutex::Locker locker(m_owners_mutex);
if (level != lldb::eDescriptionLevelBrief)
s->Printf ("breakpoint site: %d at 0x%8.8" PRIx64, GetID(), GetLoadAddress());
m_owners.GetDescription (s, level);
@@ -162,12 +166,14 @@ BreakpointSite::SetEnabled (bool enabled)
void
BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
{
+ Mutex::Locker locker(m_owners_mutex);
m_owners.Add(owner);
}
size_t
BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
{
+ Mutex::Locker locker(m_owners_mutex);
m_owners.Remove(break_id, break_loc_id);
return m_owners.GetSize();
}
@@ -175,18 +181,21 @@ BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_l
size_t
BreakpointSite::GetNumberOfOwners ()
{
+ Mutex::Locker locker(m_owners_mutex);
return m_owners.GetSize();
}
BreakpointLocationSP
BreakpointSite::GetOwnerAtIndex (size_t index)
{
+ Mutex::Locker locker(m_owners_mutex);
return m_owners.GetByIndex (index);
}
bool
BreakpointSite::ValidForThisThread (Thread *thread)
{
+ Mutex::Locker locker(m_owners_mutex);
return m_owners.ValidForThisThread(thread);
}
diff --git a/source/Breakpoint/BreakpointSiteList.cpp b/source/Breakpoint/BreakpointSiteList.cpp
index 68c4af18ec5e..1eaadb62a384 100644
--- a/source/Breakpoint/BreakpointSiteList.cpp
+++ b/source/Breakpoint/BreakpointSiteList.cpp
@@ -186,7 +186,7 @@ BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_i
void
BreakpointSiteList::Dump (Stream *s) const
{
- s->Printf("%p: ", this);
+ s->Printf("%p: ", static_cast<const void*>(this));
//s->Indent();
s->Printf("BreakpointSiteList with %u BreakpointSites:\n", (uint32_t)m_bp_site_list.size());
s->IndentMore();
diff --git a/source/Breakpoint/WatchpointList.cpp b/source/Breakpoint/WatchpointList.cpp
index 6d62dffd22cc..472bae06b441 100644
--- a/source/Breakpoint/WatchpointList.cpp
+++ b/source/Breakpoint/WatchpointList.cpp
@@ -55,7 +55,7 @@ void
WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
{
Mutex::Locker locker (m_mutex);
- s->Printf("%p: ", this);
+ s->Printf("%p: ", static_cast<const void*>(this));
//s->Indent();
s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n",
(uint64_t)m_watchpoints.size());
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index 970aa692bd27..f0ad4a896739 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -30,6 +30,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/CleanUp.h"
+#include "llvm/ADT/SmallString.h"
+
using namespace lldb_private;
CommandCompletions::CommonCompletionElement
@@ -221,7 +223,7 @@ DiskFilesOrDirectories
end_ptr = strrchr(partial_name_copy, '/');
// This will store the resolved form of the containing directory
- char containing_part[PATH_MAX];
+ llvm::SmallString<64> containing_part;
if (end_ptr == NULL)
{
@@ -232,14 +234,11 @@ DiskFilesOrDirectories
// Nothing here but the user name. We could just put a slash on the end,
// but for completeness sake we'll resolve the user name and only put a slash
// on the end if it exists.
- char resolved_username[PATH_MAX];
- size_t resolved_username_len = FileSpec::ResolveUsername (partial_name_copy, resolved_username,
- sizeof (resolved_username));
+ llvm::SmallString<64> resolved_username(partial_name_copy);
+ FileSpec::ResolveUsername (resolved_username);
// Not sure how this would happen, a username longer than PATH_MAX? Still...
- if (resolved_username_len >= sizeof (resolved_username))
- return matches.GetSize();
- else if (resolved_username_len == 0)
+ if (resolved_username.size() == 0)
{
// The user name didn't resolve, let's look in the password database for matches.
// The user name database contains duplicates, and is not in alphabetical order, so
@@ -263,8 +262,7 @@ DiskFilesOrDirectories
else
{
// The containing part is the CWD, and the whole string is the remainder.
- containing_part[0] = '.';
- containing_part[1] = '\0';
+ containing_part = ".";
strcpy(remainder, partial_name_copy);
end_ptr = partial_name_copy;
}
@@ -274,14 +272,11 @@ DiskFilesOrDirectories
if (end_ptr == partial_name_copy)
{
// We're completing a file or directory in the root volume.
- containing_part[0] = '/';
- containing_part[1] = '\0';
+ containing_part = "/";
}
else
{
- size_t len = end_ptr - partial_name_copy;
- memcpy(containing_part, partial_name_copy, len);
- containing_part[len] = '\0';
+ containing_part.append(partial_name_copy, end_ptr);
}
// Push end_ptr past the final "/" and set remainder.
end_ptr++;
@@ -293,11 +288,9 @@ DiskFilesOrDirectories
if (*partial_name_copy == '~')
{
- size_t resolved_username_len = FileSpec::ResolveUsername(containing_part,
- containing_part,
- sizeof (containing_part));
+ FileSpec::ResolveUsername(containing_part);
// User name doesn't exist, we're not getting any further...
- if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part))
+ if (containing_part.empty())
return matches.GetSize();
}
@@ -314,7 +307,7 @@ DiskFilesOrDirectories
parameters.end_ptr = end_ptr;
parameters.baselen = baselen;
- FileSpec::EnumerateDirectory(containing_part, true, true, true, DiskFilesOrDirectoriesCallback, &parameters);
+ FileSpec::EnumerateDirectory(containing_part.c_str(), true, true, true, DiskFilesOrDirectoriesCallback, &parameters);
return matches.GetSize();
}
diff --git a/source/Commands/CommandObjectArgs.cpp b/source/Commands/CommandObjectArgs.cpp
index 3b919d11a566..b0fe42bc2446 100644
--- a/source/Commands/CommandObjectArgs.cpp
+++ b/source/Commands/CommandObjectArgs.cpp
@@ -57,13 +57,7 @@ CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const ch
Error error;
const int short_option = m_getopt_table[option_idx].val;
-
- switch (short_option)
- {
- default:
- error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
- break;
- }
+ error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
return error;
}
@@ -255,7 +249,7 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
for (arg_index = 0; arg_index < num_args; ++arg_index)
{
- result.GetOutputStream ().Printf ("%zu (%s): ", arg_index, args.GetArgumentAtIndex (arg_index));
+ result.GetOutputStream ().Printf ("%" PRIu64 " (%s): ", (uint64_t)arg_index, args.GetArgumentAtIndex (arg_index));
value_list.GetValueAtIndex (arg_index)->Dump (&result.GetOutputStream ());
result.GetOutputStream ().Printf("\n");
}
@@ -266,7 +260,7 @@ CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
OptionDefinition
CommandObjectArgs::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index c20da7f3ec5c..13bf1278c78c 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -154,9 +154,12 @@ public:
case eLanguageTypeC89:
case eLanguageTypeC:
case eLanguageTypeC99:
+ case eLanguageTypeC11:
m_language = eLanguageTypeC;
break;
case eLanguageTypeC_plus_plus:
+ case eLanguageTypeC_plus_plus_03:
+ case eLanguageTypeC_plus_plus_11:
m_language = eLanguageTypeC_plus_plus;
break;
case eLanguageTypeObjC:
@@ -623,41 +626,41 @@ private:
OptionDefinition
CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName,
+ { LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, 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, NULL, 0, eArgTypeCount,
+ { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount,
"Set the number of times this breakpoint is skipped before stopping." },
- { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"The breakpoint is deleted the first time it causes a stop." },
- { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeExpression,
+ { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeExpression,
"The breakpoint stops only if this condition expression evaluates to true."},
- { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadIndex,
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadIndex,
"The breakpoint stops only for the thread whose indeX matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadID,
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadID,
"The breakpoint stops only for the thread whose TID matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadName,
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadName,
"The breakpoint stops only for the thread whose thread name matches this argument."},
- { LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"Require the breakpoint to use hardware breakpoints."},
- { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, NULL, 0, eArgTypeQueueName,
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, NULL, NULL, 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, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
+ { LLDB_OPT_FILE, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, 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 #included, set target.inline-breakpoint-strategy"
" to \"always\"."},
- { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum,
+ { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
"Specifies the line number on which to set this breakpoint."},
// Comment out this option for the moment, as we don't actually use it, but will in the future.
@@ -665,48 +668,48 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
// { 0, false, "column", 'C', OptionParser::eRequiredArgument, NULL, "<column>",
// "Set the breakpoint by source location at this particular column."},
- { LLDB_OPT_SET_2, true, "address", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeAddressOrExpression,
+ { LLDB_OPT_SET_2, true, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression,
"Set the breakpoint by address, at the specified address."},
- { LLDB_OPT_SET_3, true, "name", 'n', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
+ { LLDB_OPT_SET_3, true, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
"Set the breakpoint by function name. Can be repeated multiple times to make one breakpoint for multiple names" },
- { LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFullName,
+ { LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFullName,
"Set the breakpoint by fully qualified function names. For C++ this means namespaces and all arguments, and "
"for Objective C this means a full function prototype with class and selector. "
"Can be repeated multiple times to make one breakpoint for multiple names." },
- { LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, NULL, 0, eArgTypeSelector,
+ { LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeSelector,
"Set the breakpoint by ObjC selector name. Can be repeated multiple times to make one breakpoint for multiple Selectors." },
- { LLDB_OPT_SET_6, true, "method", 'M', OptionParser::eRequiredArgument, NULL, 0, eArgTypeMethod,
+ { LLDB_OPT_SET_6, true, "method", 'M', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeMethod,
"Set the breakpoint by C++ method names. Can be repeated multiple times to make one breakpoint for multiple methods." },
- { LLDB_OPT_SET_7, true, "func-regex", 'r', OptionParser::eRequiredArgument, NULL, 0, eArgTypeRegularExpression,
+ { LLDB_OPT_SET_7, true, "func-regex", 'r', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeRegularExpression,
"Set the breakpoint by function name, evaluating a regular-expression to find the function name(s)." },
- { LLDB_OPT_SET_8, true, "basename", 'b', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
+ { LLDB_OPT_SET_8, true, "basename", 'b', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
"Set the breakpoint by function basename (C++ namespaces and arguments will be ignored). "
"Can be repeated multiple times to make one breakpoint for multiple symbols." },
- { LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypeRegularExpression,
+ { LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeRegularExpression,
"Set the breakpoint by specifying a regular expression which is matched against the source text in a source file or files "
"specified with the -f option. The -f option can be specified more than once. "
"If no source files are specified, uses the current \"default source file\"" },
- { LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLanguage,
+ { LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage,
"Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" },
- { LLDB_OPT_SET_10, false, "on-throw", 'w', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SET_10, false, "on-throw", 'w', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"Set the breakpoint on exception throW." },
- { LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"Set the breakpoint on exception catcH." },
- { LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, NULL, NULL, 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." },
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1012,16 +1015,16 @@ private:
OptionDefinition
CommandObjectBreakpointModify::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
-{ LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
-{ LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument."},
-{ LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument."},
-{ LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, 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, NULL, 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, NULL, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true."},
-{ LLDB_OPT_SET_1, false, "enable", 'e', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable the breakpoint."},
-{ LLDB_OPT_SET_2, false, "disable", 'd', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Disable the breakpoint."},
-{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
+{ LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
+{ LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument."},
+{ LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument."},
+{ LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, NULL, 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, NULL, NULL, 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, NULL, NULL, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true."},
+{ LLDB_OPT_SET_1, false, "enable", 'e', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable the breakpoint."},
+{ LLDB_OPT_SET_2, false, "disable", 'd', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Disable the breakpoint."},
+{ 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1078,7 +1081,7 @@ protected:
{
// No breakpoint selected; enable all currently set breakpoints.
target->EnableAllBreakpoints ();
- result.AppendMessageWithFormat ("All breakpoints enabled. (%zu breakpoints)\n", num_breakpoints);
+ result.AppendMessageWithFormat ("All breakpoints enabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@@ -1197,7 +1200,7 @@ protected:
{
// No breakpoint selected; disable all currently set breakpoints.
target->DisableAllBreakpoints ();
- result.AppendMessageWithFormat ("All breakpoints disabled. (%zu breakpoints)\n", num_breakpoints);
+ result.AppendMessageWithFormat ("All breakpoints disabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@@ -1421,21 +1424,21 @@ private:
OptionDefinition
CommandObjectBreakpointList::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "internal", 'i', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "internal", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"Show debugger internal breakpoints" },
- { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"Give a brief description of the breakpoint (no location info)."},
// FIXME: We need to add an "internal" command, and then add this sort of thing to it.
// But I need to see it for now, and don't want to wait.
- { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"Give a full description of the breakpoint and its locations."},
- { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
"Explain everything we know about the breakpoint (for debugging debugger bugs)." },
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1632,13 +1635,13 @@ private:
OptionDefinition
CommandObjectBreakpointClear::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
"Specify the breakpoint by source location in this particular file."},
- { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum,
+ { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
"Specify the breakpoint by source location at this particular line."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1699,7 +1702,7 @@ protected:
else
{
target->RemoveAllBreakpoints ();
- result.AppendMessageWithFormat ("All breakpoints removed. (%zu %s)\n", num_breakpoints, num_breakpoints > 1 ? "breakpoints" : "breakpoint");
+ result.AppendMessageWithFormat ("All breakpoints removed. (%" PRIu64 " breakpoint%s)\n", (uint64_t)num_breakpoints, num_breakpoints > 1 ? "s" : "");
}
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
@@ -1843,7 +1846,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
if (breakpoint != NULL)
{
const size_t num_locations = breakpoint->GetNumLocations();
- if (cur_bp_id.GetLocationID() > num_locations)
+ if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations)
{
StreamString id_str;
BreakpointID::GetCanonicalReference (&id_str,
diff --git a/source/Commands/CommandObjectBreakpointCommand.cpp b/source/Commands/CommandObjectBreakpointCommand.cpp
index 532d6cedc83e..fdb87d11900b 100644
--- a/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -44,9 +44,10 @@ public:
CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"add",
- "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit.",
+ "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit."
+ " If no breakpoint is specified, adds the commands to the last created breakpoint.",
NULL),
- IOHandlerDelegateMultiline ("DONE", IOHandlerDelegate::Completion::LLDBCommand),
+ IOHandlerDelegateMultiline ("DONE", IOHandlerDelegate::Completion::LLDBCommand),
m_options (interpreter)
{
SetHelpLong (
@@ -193,7 +194,7 @@ one command per line.\n" );
// Define the first (and only) variant of this arg.
bp_id_arg.arg_type = eArgTypeBreakpointID;
- bp_id_arg.arg_repetition = eArgRepeatPlain;
+ bp_id_arg.arg_repetition = eArgRepeatOptional;
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (bp_id_arg);
@@ -228,9 +229,12 @@ one command per line.\n" );
{
io_handler.SetIsDone(true);
- BreakpointOptions *bp_options = (BreakpointOptions *) io_handler.GetUserData();
- if (bp_options)
+ std::vector<BreakpointOptions *> *bp_options_vec = (std::vector<BreakpointOptions *> *)io_handler.GetUserData();
+ for (BreakpointOptions *bp_options : *bp_options_vec)
{
+ if (!bp_options)
+ continue;
+
std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
if (data_ap.get())
{
@@ -239,36 +243,37 @@ one command per line.\n" );
bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
}
}
-
}
void
- CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
CommandReturnObject &result)
{
m_interpreter.GetLLDBCommandsFromIOHandler ("> ", // Prompt
*this, // IOHandlerDelegate
true, // Run IOHandler in async mode
- bp_options); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
+ &bp_options_vec); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
}
/// Set a one-liner as the callback for the breakpoint.
void
- SetBreakpointCommandCallback (BreakpointOptions *bp_options,
+ SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
const char *oneliner)
{
- std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
-
- // It's necessary to set both user_source and script_source to the oneliner.
- // The former is used to generate callback description (as in breakpoint command list)
- // while the latter is used for Python to interpret during the actual callback.
- data_ap->user_source.AppendString (oneliner);
- data_ap->script_source.assign (oneliner);
- data_ap->stop_on_error = m_options.m_stop_on_error;
+ for (auto bp_options : bp_options_vec)
+ {
+ std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
- BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
- bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
+ // It's necessary to set both user_source and script_source to the oneliner.
+ // The former is used to generate callback description (as in breakpoint command list)
+ // while the latter is used for Python to interpret during the actual callback.
+ data_ap->user_source.AppendString (oneliner);
+ data_ap->script_source.assign (oneliner);
+ data_ap->stop_on_error = m_options.m_stop_on_error;
+ BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
+ bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
+ }
return;
}
@@ -459,15 +464,11 @@ protected:
BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (command, target, result, &valid_bp_ids);
+ m_bp_options_vec.clear();
+
if (result.Succeeded())
{
const size_t count = valid_bp_ids.GetSize();
- if (count > 1)
- {
- result.AppendError ("can only add commands to one breakpoint at a time.");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
for (size_t i = 0; i < count; ++i)
{
@@ -489,50 +490,45 @@ protected:
if (bp_loc_sp)
bp_options = bp_loc_sp->GetLocationOptions();
}
+ if (bp_options)
+ m_bp_options_vec.push_back (bp_options);
+ }
+ }
- // Skip this breakpoint if bp_options is not good.
- if (bp_options == NULL) continue;
-
- // If we are using script language, get the script interpreter
- // in order to set or collect command callback. Otherwise, call
- // the methods associated with this object.
- if (m_options.m_use_script_language)
- {
- // Special handling for one-liner specified inline.
- if (m_options.m_use_one_liner)
- {
- m_interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
- m_options.m_one_liner.c_str());
- }
- // Special handling for using a Python function by name
- // instead of extending the breakpoint callback data structures, we just automatize
- // what the user would do manually: make their breakpoint command be a function call
- else if (m_options.m_function_name.size())
- {
- std::string oneliner("return ");
- oneliner += m_options.m_function_name;
- oneliner += "(frame, bp_loc, internal_dict)";
- m_interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
- oneliner.c_str());
- }
- else
- {
- m_interpreter.GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp_options,
- result);
- }
- }
- else
- {
- // Special handling for one-liner specified inline.
- if (m_options.m_use_one_liner)
- SetBreakpointCommandCallback (bp_options,
- m_options.m_one_liner.c_str());
- else
- CollectDataForBreakpointCommandCallback (bp_options,
- result);
- }
+ // If we are using script language, get the script interpreter
+ // in order to set or collect command callback. Otherwise, call
+ // the methods associated with this object.
+ if (m_options.m_use_script_language)
+ {
+ ScriptInterpreter *script_interp = m_interpreter.GetScriptInterpreter();
+ // Special handling for one-liner specified inline.
+ if (m_options.m_use_one_liner)
+ {
+ script_interp->SetBreakpointCommandCallback (m_bp_options_vec,
+ m_options.m_one_liner.c_str());
+ }
+ else if (m_options.m_function_name.size())
+ {
+ script_interp->SetBreakpointCommandCallbackFunction (m_bp_options_vec,
+ m_options.m_function_name.c_str());
+ }
+ else
+ {
+ script_interp->CollectDataForBreakpointCommandCallback (m_bp_options_vec,
+ result);
}
}
+ else
+ {
+ // Special handling for one-liner specified inline.
+ if (m_options.m_use_one_liner)
+ SetBreakpointCommandCallback (m_bp_options_vec,
+ m_options.m_one_liner.c_str());
+ else
+ CollectDataForBreakpointCommandCallback (m_bp_options_vec,
+ result);
+ }
+
}
return result.Succeeded();
@@ -540,6 +536,17 @@ protected:
private:
CommandOptions m_options;
+ std::vector<BreakpointOptions *> m_bp_options_vec; // This stores the breakpoint options that we are currently
+ // collecting commands for. In the CollectData... calls we need
+ // to hand this off to the IOHandler, which may run asynchronously.
+ // So we have to have some way to keep it alive, and not leak it.
+ // Making it an ivar of the command object, which never goes away
+ // achieves this. Note that if we were able to run
+ // the same command concurrently in one interpreter we'd have to
+ // make this "per invocation". But there are many more reasons
+ // why it is not in general safe to do that in lldb at present,
+ // so it isn't worthwhile to come up with a more complex mechanism
+ // to address this particular weakness right now.
static const char *g_reader_instructions;
};
@@ -562,19 +569,19 @@ g_script_option_enumeration[4] =
OptionDefinition
CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOneLiner,
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"Specify whether breakpoint command execution should terminate on error." },
- { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, g_script_option_enumeration, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, NULL, g_script_option_enumeration, 0, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
- { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, NULL, 0, eArgTypePythonFunction,
+ { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -814,7 +821,7 @@ protected:
CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpreter &interpreter) :
CommandObjectMultiword (interpreter,
"command",
- "A set of commands for adding, removing and examining bits of code to be executed when the breakpoint is hit (breakpoint 'commmands').",
+ "A set of commands for adding, removing and examining bits of code to be executed when the breakpoint is hit (breakpoint 'commands').",
"command <sub-command> [<sub-command-options>] <breakpoint-id>")
{
CommandObjectSP add_command_object (new CommandObjectBreakpointCommandAdd (interpreter));
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index 7bfdec094d6c..7d9bb7dad8fd 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -226,11 +226,11 @@ protected:
OptionDefinition
CommandObjectCommandsHistory::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "How many history commands to print."},
-{ LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)."},
-{ LLDB_OPT_SET_1, false, "end-index", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."},
-{ LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, NULL, 0, eArgTypeBoolean, "Clears the current command history."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "How many history commands to print."},
+{ LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)."},
+{ LLDB_OPT_SET_1, false, "end-index", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."},
+{ LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeBoolean, "Clears the current command history."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -427,10 +427,10 @@ protected:
OptionDefinition
CommandObjectCommandsSource::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on error."},
-{ LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
-{ LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on error."},
+{ LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
+{ LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectCommandsAlias
@@ -889,7 +889,7 @@ public:
SetHelpLong(
"This command allows the user to create powerful regular expression commands\n"
"with substitutions. The regular expressions and substitutions are specified\n"
-"using the regular exression substitution format of:\n"
+"using the regular expression substitution format of:\n"
"\n"
" s/<regex>/<subst>/\n"
"\n"
@@ -1034,9 +1034,10 @@ protected:
Debugger &debugger = m_interpreter.GetDebugger();
const bool multiple_lines = true; // Get multiple lines
IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
- "lldb", // Name of input reader for history
- "\033[K> ", // Prompt and clear line
+ "lldb-regex", // Name of input reader for history
+ "\033[K> ", // Prompt and clear line
multiple_lines,
+ 0, // Don't show line numbers
*this));
if (io_handler_sp)
@@ -1273,9 +1274,9 @@ private:
OptionDefinition
CommandObjectCommandsAddRegex::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone, "The help text to display for this command."},
-{ LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."},
-{ 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone, "The help text to display for this command."},
+{ LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."},
+{ 0 , false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -1547,8 +1548,8 @@ protected:
OptionDefinition
CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -1795,9 +1796,9 @@ static OptionEnumValueElement g_script_synchro_type[] =
OptionDefinition
CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, NULL, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."},
- { LLDB_OPT_SET_1, false, "synchronicity", 's', OptionParser::eRequiredArgument, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."},
+ { LLDB_OPT_SET_1, false, "synchronicity", 's', OptionParser::eRequiredArgument, NULL, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp
index f9c683b364ce..8124ce1ef93b 100644
--- a/source/Commands/CommandObjectDisassemble.cpp
+++ b/source/Commands/CommandObjectDisassemble.cpp
@@ -232,29 +232,29 @@ CommandObjectDisassemble::CommandOptions::GetDefinitions ()
OptionDefinition
CommandObjectDisassemble::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "bytes" , 'b', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Show opcode bytes when disassembling."},
-{ LLDB_OPT_SET_ALL, false, "context" , 'C', OptionParser::eRequiredArgument , NULL, 0, eArgTypeNumLines, "Number of context lines of source to show."},
-{ LLDB_OPT_SET_ALL, false, "mixed" , 'm', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Enable mixed source and assembly display."},
-{ LLDB_OPT_SET_ALL, false, "raw" , 'r', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Print raw disassembly with no symbol information."},
-{ LLDB_OPT_SET_ALL, false, "plugin" , 'P', OptionParser::eRequiredArgument , NULL, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use."},
-{ LLDB_OPT_SET_ALL, false, "flavor" , 'F', OptionParser::eRequiredArgument , NULL, 0, eArgTypeDisassemblyFlavor, "Name of the disassembly flavor you want to use. "
- "Currently the only valid options are default, and for Intel"
- " architectures, att and intel."},
-{ LLDB_OPT_SET_ALL, false, "arch" , 'A', OptionParser::eRequiredArgument , NULL, 0, eArgTypeArchitecture,"Specify the architecture to use from cross disassembly."},
+{ LLDB_OPT_SET_ALL, false, "bytes" , 'b', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Show opcode bytes when disassembling."},
+{ LLDB_OPT_SET_ALL, false, "context" , 'C', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeNumLines, "Number of context lines of source to show."},
+{ LLDB_OPT_SET_ALL, false, "mixed" , 'm', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Enable mixed source and assembly display."},
+{ LLDB_OPT_SET_ALL, false, "raw" , 'r', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Print raw disassembly with no symbol information."},
+{ LLDB_OPT_SET_ALL, false, "plugin" , 'P', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use."},
+{ LLDB_OPT_SET_ALL, false, "flavor" , 'F', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeDisassemblyFlavor, "Name of the disassembly flavor you want to use. "
+ "Currently the only valid options are default, and for Intel"
+ " architectures, att and intel."},
+{ LLDB_OPT_SET_ALL, false, "arch" , 'A', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeArchitecture,"Specify the architecture to use from cross disassembly."},
{ LLDB_OPT_SET_1 |
- LLDB_OPT_SET_2 , true , "start-address", 's', OptionParser::eRequiredArgument , NULL, 0, eArgTypeAddressOrExpression,"Address at which to start disassembling."},
-{ LLDB_OPT_SET_1 , false, "end-address" , 'e', OptionParser::eRequiredArgument , NULL, 0, eArgTypeAddressOrExpression, "Address at which to end disassembling."},
+ LLDB_OPT_SET_2 , true , "start-address", 's', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeAddressOrExpression,"Address at which to start disassembling."},
+{ LLDB_OPT_SET_1 , false, "end-address" , 'e', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeAddressOrExpression, "Address at which to end disassembling."},
{ LLDB_OPT_SET_2 |
LLDB_OPT_SET_3 |
LLDB_OPT_SET_4 |
- LLDB_OPT_SET_5 , false, "count" , 'c', OptionParser::eRequiredArgument , NULL, 0, eArgTypeNumLines, "Number of instructions to display."},
-{ LLDB_OPT_SET_3 , false, "name" , 'n', OptionParser::eRequiredArgument , NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
- "Disassemble entire contents of the given function name."},
-{ LLDB_OPT_SET_4 , false, "frame" , 'f', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Disassemble from the start of the current frame's function."},
-{ LLDB_OPT_SET_5 , false, "pc" , 'p', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Disassemble around the current pc."},
-{ LLDB_OPT_SET_6 , false, "line" , 'l', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "Disassemble the current frame's current source line instructions if there is debug line table information, else disassemble around the pc."},
-{ LLDB_OPT_SET_7 , false, "address" , 'a', OptionParser::eRequiredArgument , NULL, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address."},
-{ 0 , false, NULL , 0, 0 , NULL, 0, eArgTypeNone, NULL }
+ LLDB_OPT_SET_5 , false, "count" , 'c', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeNumLines, "Number of instructions to display."},
+{ LLDB_OPT_SET_3 , false, "name" , 'n', OptionParser::eRequiredArgument , NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
+ "Disassemble entire contents of the given function name."},
+{ LLDB_OPT_SET_4 , false, "frame" , 'f', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Disassemble from the start of the current frame's function."},
+{ LLDB_OPT_SET_5 , false, "pc" , 'p', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Disassemble around the current pc."},
+{ LLDB_OPT_SET_6 , false, "line" , 'l', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Disassemble the current frame's current source line instructions if there is debug line table information, else disassemble around the pc."},
+{ LLDB_OPT_SET_7 , false, "address" , 'a', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address."},
+{ 0 , false, NULL , 0, 0 , NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -370,6 +370,7 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
}
else
{
+ std::vector<AddressRange> ranges;
AddressRange range;
StackFrame *frame = m_exe_ctx.GetFramePtr();
if (m_options.frame_line)
@@ -425,6 +426,7 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
// Disassembling at the PC always disassembles some number of instructions (not the whole function).
m_options.num_instructions = DEFAULT_DISASM_NUM_INS;
}
+ ranges.push_back(range);
}
else
{
@@ -441,49 +443,75 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
}
range.SetByteSize (m_options.end_addr - m_options.start_addr);
}
+ ranges.push_back(range);
}
else
{
if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS
- && target
- && !target->GetSectionLoadList().IsEmpty())
+ && target)
{
- bool failed = false;
- Address symbol_containing_address;
- if (target->GetSectionLoadList().ResolveLoadAddress (m_options.symbol_containing_addr, symbol_containing_address))
+ if (!target->GetSectionLoadList().IsEmpty())
{
- ModuleSP module_sp (symbol_containing_address.GetModule());
- SymbolContext sc;
- bool resolve_tail_call_address = true; // PC can be one past the address range of the function.
- module_sp->ResolveSymbolContextForAddress (symbol_containing_address, eSymbolContextEverything, sc,
- resolve_tail_call_address);
- if (sc.function || sc.symbol)
+ bool failed = false;
+ Address symbol_containing_address;
+ if (target->GetSectionLoadList().ResolveLoadAddress (m_options.symbol_containing_addr, symbol_containing_address))
{
- sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range);
+ ModuleSP module_sp (symbol_containing_address.GetModule());
+ SymbolContext sc;
+ bool resolve_tail_call_address = true; // PC can be one past the address range of the function.
+ module_sp->ResolveSymbolContextForAddress (symbol_containing_address, eSymbolContextEverything, sc,
+ resolve_tail_call_address);
+ if (sc.function || sc.symbol)
+ {
+ sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range);
+ }
+ else
+ {
+ failed = true;
+ }
}
else
{
failed = true;
}
+ if (failed)
+ {
+ result.AppendErrorWithFormat ("Could not find function bounds for address 0x%" PRIx64 "\n", m_options.symbol_containing_addr);
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ ranges.push_back(range);
}
else
{
- failed = true;
- }
- if (failed)
- {
- result.AppendErrorWithFormat ("Could not find function bounds for address 0x%" PRIx64 "\n", m_options.symbol_containing_addr);
- result.SetStatus (eReturnStatusFailed);
- return false;
+ for (lldb::ModuleSP module_sp : target->GetImages().Modules())
+ {
+ lldb::addr_t file_addr = m_options.symbol_containing_addr;
+ Address file_address;
+ if (module_sp->ResolveFileAddress(file_addr, file_address))
+ {
+ SymbolContext sc;
+ bool resolve_tail_call_address = true; // PC can be one past the address range of the function.
+ module_sp->ResolveSymbolContextForAddress (file_address, eSymbolContextEverything, sc, resolve_tail_call_address);
+ if (sc.function || sc.symbol)
+ {
+ sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range);
+ ranges.push_back(range);
+ }
+ }
+ }
+
}
}
}
}
}
+ else
+ ranges.push_back(range);
if (m_options.num_instructions != 0)
{
- if (!range.GetBaseAddress().IsValid())
+ if (ranges.size() == 0)
{
// The default action is to disassemble the current frame function.
if (frame)
@@ -504,29 +532,38 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
return false;
}
}
-
- if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
- m_options.arch,
- plugin_name,
- flavor_string,
- m_exe_ctx,
- range.GetBaseAddress(),
- m_options.num_instructions,
- m_options.show_mixed ? m_options.num_lines_context : 0,
- options,
- result.GetOutputStream()))
- {
- result.SetStatus (eReturnStatusSuccessFinishResult);
- }
- else
+
+ bool print_sc_header = ranges.size() > 1;
+ for (AddressRange cur_range : ranges)
{
- result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
- result.SetStatus (eReturnStatusFailed);
+ if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
+ m_options.arch,
+ plugin_name,
+ flavor_string,
+ m_exe_ctx,
+ cur_range.GetBaseAddress(),
+ m_options.num_instructions,
+ m_options.show_mixed ? m_options.num_lines_context : 0,
+ options,
+ result.GetOutputStream()))
+ {
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ if (m_options.start_addr != LLDB_INVALID_ADDRESS)
+ result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
+ else if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS)
+ result.AppendErrorWithFormat ("Failed to disassemble memory in function at 0x%8.8" PRIx64 ".\n", m_options.symbol_containing_addr);
+ result.SetStatus (eReturnStatusFailed);
+ }
}
+ if (print_sc_header)
+ result.AppendMessage("\n");
}
else
{
- if (!range.GetBaseAddress().IsValid())
+ if (ranges.size() == 0)
{
// The default action is to disassemble the current frame function.
if (frame)
@@ -548,27 +585,35 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
result.SetStatus (eReturnStatusFailed);
return false;
}
+ ranges.push_back(range);
}
- if (range.GetByteSize() == 0)
- range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
-
- if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
- m_options.arch,
- plugin_name,
- flavor_string,
- m_exe_ctx,
- range,
- m_options.num_instructions,
- m_options.show_mixed ? m_options.num_lines_context : 0,
- options,
- result.GetOutputStream()))
+
+ bool print_sc_header = ranges.size() > 1;
+ for (AddressRange cur_range : ranges)
{
- result.SetStatus (eReturnStatusSuccessFinishResult);
- }
- else
- {
- result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
- result.SetStatus (eReturnStatusFailed);
+ if (cur_range.GetByteSize() == 0)
+ cur_range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
+
+ if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
+ m_options.arch,
+ plugin_name,
+ flavor_string,
+ m_exe_ctx,
+ cur_range,
+ m_options.num_instructions,
+ m_options.show_mixed ? m_options.num_lines_context : 0,
+ options,
+ result.GetOutputStream()))
+ {
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
+ result.SetStatus (eReturnStatusFailed);
+ }
+ if (print_sc_header)
+ result.AppendMessage("\n");
}
}
}
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index c772a2e58912..079c62ddfdff 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -34,6 +34,7 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
using namespace lldb;
@@ -59,19 +60,19 @@ static OptionEnumValueElement g_description_verbosity_type[] =
OptionDefinition
CommandObjectExpression::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."},
- { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
- { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."},
- { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."},
- { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument , NULL, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."},
- { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."},
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."},
+ { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, NULL, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."},
};
uint32_t
CommandObjectExpression::CommandOptions::GetNumDefinitions ()
{
- return sizeof(g_option_table)/sizeof(OptionDefinition);
+ return llvm::array_lengthof(g_option_table);
}
Error
@@ -173,7 +174,7 @@ CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpret
}
else
{
- ignore_breakpoints = false;
+ ignore_breakpoints = true;
unwind_on_error = true;
}
@@ -205,7 +206,7 @@ CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interprete
{
SetHelpLong(
"Timeouts:\n\
- If the expression can be evaluated statically (without runnning code) then it will be.\n\
+ If the expression can be evaluated statically (without running code) then it will be.\n\
Otherwise, by default the expression will run on the current thread with a short timeout:\n\
currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted\n\
and resumed with all threads running. You can use the -a option to disable retrying on all\n\
@@ -217,6 +218,15 @@ User defined variables:\n\
your user defined variable is a $, then the variable's value will be available in future\n\
expressions, otherwise it will just be available in the current expression.\n\
\n\
+\n\
+Continuing evaluation after a breakpoint:\n\
+ If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once\n\
+ you are done with your investigation, you can either remove the expression execution frames\n\
+ from the stack with \"thread return -x\" or if you are still interested in the expression result\n\
+ you can issue the \"continue\" command and the expression evaluation will complete and the\n\
+ expression result will be available using the \"thread.completed-expression\" key in the thread\n\
+ format.\n\
+\n\
Examples: \n\
\n\
expr my_struct->a = my_array[3] \n\
@@ -277,8 +287,6 @@ CommandObjectExpression::EvaluateExpression
{
lldb::ValueObjectSP result_valobj_sp;
- ExecutionResults exe_results;
-
bool keep_in_memory = true;
EvaluateExpressionOptions options;
@@ -290,15 +298,19 @@ CommandObjectExpression::EvaluateExpression
options.SetTryAllThreads(m_command_options.try_all_threads);
options.SetDebug(m_command_options.debug);
+ // If there is any chance we are going to stop and want to see
+ // what went wrong with our expression, we should generate debug info
+ if (!m_command_options.ignore_breakpoints ||
+ !m_command_options.unwind_on_error)
+ options.SetGenerateDebugInfo(true);
+
if (m_command_options.timeout > 0)
options.SetTimeoutUsec(m_command_options.timeout);
else
options.SetTimeoutUsec(0);
-
- exe_results = target->EvaluateExpression (expr,
- exe_ctx.GetFramePtr(),
- result_valobj_sp,
- options);
+
+ target->EvaluateExpression(expr, exe_ctx.GetFramePtr(),
+ result_valobj_sp, options);
if (result_valobj_sp)
{
@@ -406,6 +418,30 @@ CommandObjectExpression::IOHandlerLinesUpdated (IOHandler &io_handler,
return LineStatus::Success;
}
+void
+CommandObjectExpression::GetMultilineExpression ()
+{
+ m_expr_lines.clear();
+ m_expr_line_count = 0;
+
+ Debugger &debugger = GetCommandInterpreter().GetDebugger();
+ const bool multiple_lines = true; // Get multiple lines
+ IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
+ "lldb-expr", // Name of input reader for history
+ NULL, // No prompt
+ multiple_lines,
+ 1, // Show line numbers starting at 1
+ *this));
+
+ StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile());
+ if (output_sp)
+ {
+ output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n");
+ output_sp->Flush();
+ }
+ debugger.PushIOHandler(io_handler_sp);
+}
+
bool
CommandObjectExpression::DoExecute
(
@@ -419,24 +455,7 @@ CommandObjectExpression::DoExecute
if (command[0] == '\0')
{
- m_expr_lines.clear();
- m_expr_line_count = 0;
-
- Debugger &debugger = GetCommandInterpreter().GetDebugger();
- const bool multiple_lines = true; // Get multiple lines
- IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
- "lldb-expr", // Name of input reader for history
- NULL, // No prompt
- multiple_lines,
- *this));
-
- StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile());
- if (output_sp)
- {
- output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n");
- output_sp->Flush();
- }
- debugger.PushIOHandler(io_handler_sp);
+ GetMultilineExpression ();
return result.Succeeded();
}
@@ -475,6 +494,13 @@ CommandObjectExpression::DoExecute
result.SetStatus (eReturnStatusFailed);
return false;
}
+
+ // No expression following options
+ if (expr == NULL || expr[0] == '\0')
+ {
+ GetMultilineExpression ();
+ return result.Succeeded();
+ }
}
}
diff --git a/source/Commands/CommandObjectExpression.h b/source/Commands/CommandObjectExpression.h
index c943f0e8023d..168140d7fe56 100644
--- a/source/Commands/CommandObjectExpression.h
+++ b/source/Commands/CommandObjectExpression.h
@@ -96,6 +96,9 @@ protected:
Stream *output_stream,
Stream *error_stream,
CommandReturnObject *result = NULL);
+
+ void
+ GetMultilineExpression ();
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 0ef973261508..ce540a5c3100 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -204,7 +204,7 @@ protected:
if (m_options.relative_frame_offset < 0)
{
- if (frame_idx >= -m_options.relative_frame_offset)
+ if (static_cast<int32_t>(frame_idx) >= -m_options.relative_frame_offset)
frame_idx += m_options.relative_frame_offset;
else
{
@@ -224,7 +224,7 @@ protected:
// I don't want "up 20" where "20" takes you past the top of the stack to produce
// an error, but rather to just go to the top. So I have to count the stack here...
const uint32_t num_frames = thread->GetStackFrameCount();
- if (num_frames - frame_idx > m_options.relative_frame_offset)
+ if (static_cast<int32_t>(num_frames - frame_idx) > m_options.relative_frame_offset)
frame_idx += m_options.relative_frame_offset;
else
{
@@ -291,8 +291,8 @@ protected:
OptionDefinition
CommandObjectFrameSelect::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectFrameVariable
@@ -471,7 +471,7 @@ protected:
if (regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
result.GetErrorStream().Printf ("error: %s\n", regex_error);
else
- result.GetErrorStream().Printf ("error: unkown regex error when compiling '%s'\n", name_cstr);
+ result.GetErrorStream().Printf ("error: unknown regex error when compiling '%s'\n", name_cstr);
}
}
else // No regex, either exact variable names or variable expressions.
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index bd0c3938c702..f73d9d23b574 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -54,9 +54,9 @@ CommandObjectHelp::~CommandObjectHelp()
OptionDefinition
CommandObjectHelp::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "show-aliases", 'a', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show aliases in the command list."},
- { LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Hide user-defined commands from the list."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, false, "show-aliases", 'a', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Show aliases in the command list."},
+ { LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Hide user-defined commands from the list."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
bool
diff --git a/source/Commands/CommandObjectLog.cpp b/source/Commands/CommandObjectLog.cpp
index 2d815846a607..7d32cc6d08a5 100644
--- a/source/Commands/CommandObjectLog.cpp
+++ b/source/Commands/CommandObjectLog.cpp
@@ -215,16 +215,16 @@ protected:
OptionDefinition
CommandObjectLogEnable::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename, "Set the destination file to log to."},
-{ LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
-{ LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable verbose logging." },
-{ LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable debug logging." },
-{ LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
-{ LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
-{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
-{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
-{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFilename, "Set the destination file to log to."},
+{ LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
+{ LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable verbose logging." },
+{ LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable debug logging." },
+{ LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
+{ LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
+{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
+{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
+{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
class CommandObjectLogDisable : public CommandObjectParsed
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index cb7398fb9554..bfbb296158a9 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -42,12 +42,12 @@ using namespace lldb_private;
static OptionDefinition
g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "num-per-line" ,'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNumberPerLine ,"The number of items per line to display."},
- { LLDB_OPT_SET_2, false, "binary" ,'b', OptionParser::eNoArgument , NULL, 0, eArgTypeNone ,"If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that uses the format, size, count and number per line settings."},
- { LLDB_OPT_SET_3, true , "type" ,'t', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone ,"The name of a type to view memory as."},
+ { LLDB_OPT_SET_1, false, "num-per-line" ,'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNumberPerLine ,"The number of items per line to display."},
+ { LLDB_OPT_SET_2, false, "binary" ,'b', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone ,"If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that uses the format, size, count and number per line settings."},
+ { LLDB_OPT_SET_3, true , "type" ,'t', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone ,"The name of a type to view memory as."},
{ LLDB_OPT_SET_1|
LLDB_OPT_SET_2|
- LLDB_OPT_SET_3, false, "force" ,'r', OptionParser::eNoArgument, NULL, 0, eArgTypeNone ,"Necessary if reading over target.max-memory-read-size bytes."},
+ LLDB_OPT_SET_3, false, "force" ,'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone ,"Necessary if reading over target.max-memory-read-size bytes."},
};
@@ -651,7 +651,7 @@ protected:
}
else if (m_format_options.GetCountValue().OptionWasSet())
{
- result.AppendErrorWithFormat("specify either the end address (0x%" PRIx64 ") or the count (--count %zu), not both.\n", end_addr, item_count);
+ result.AppendErrorWithFormat("specify either the end address (0x%" PRIx64 ") or the count (--count %" PRIu64 "), not both.\n", end_addr, (uint64_t)item_count);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -685,7 +685,7 @@ protected:
data_sp.reset (new DataBufferHeap (total_byte_size, '\0'));
if (data_sp->GetBytes() == NULL)
{
- result.AppendErrorWithFormat ("can't allocate 0x%zx bytes for the memory read buffer, specify a smaller size to read", total_byte_size);
+ result.AppendErrorWithFormat ("can't allocate 0x%" PRIx32 " bytes for the memory read buffer, specify a smaller size to read", (uint32_t)total_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -708,7 +708,7 @@ protected:
}
if (bytes_read < total_byte_size)
- result.AppendWarningWithFormat("Not all bytes (%zu/%zu) were able to be read from 0x%" PRIx64 ".\n", bytes_read, total_byte_size, addr);
+ result.AppendWarningWithFormat("Not all bytes (%" PRIu64 "/%" PRIu64 ") were able to be read from 0x%" PRIx64 ".\n", (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
}
else
{
@@ -878,7 +878,7 @@ protected:
// here we passed a count, and it was not 1
// so we have a byte_size and a count
// we could well multiply those, but instead let's just fail
- result.AppendErrorWithFormat("reading memory as characters of size %zu is not supported", item_byte_size);
+ result.AppendErrorWithFormat("reading memory as characters of size %" PRIu64 " is not supported", (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -917,10 +917,10 @@ protected:
OptionDefinition
g_memory_find_option_table[] =
{
- { LLDB_OPT_SET_1, false, "expression", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeExpression, "Evaluate an expression to obtain a byte pattern."},
- { LLDB_OPT_SET_2, false, "string", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeName, "Use text to find a byte pattern."},
- { LLDB_OPT_SET_1|LLDB_OPT_SET_2, false, "count", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "How many times to perform the search."},
- { LLDB_OPT_SET_1|LLDB_OPT_SET_2, false, "dump-offset", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOffset, "When dumping memory for a match, an offset from the match location to start dumping from."},
+ { LLDB_OPT_SET_1, false, "expression", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeExpression, "Evaluate an expression to obtain a byte pattern."},
+ { LLDB_OPT_SET_2, false, "string", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeName, "Use text to find a byte pattern."},
+ { LLDB_OPT_SET_1|LLDB_OPT_SET_2, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "How many times to perform the search."},
+ { LLDB_OPT_SET_1|LLDB_OPT_SET_2, false, "dump-offset", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOffset, "When dumping memory for a match, an offset from the match location to start dumping from."},
};
//----------------------------------------------------------------------
@@ -1223,8 +1223,8 @@ protected:
OptionDefinition
g_memory_write_option_table[] =
{
-{ LLDB_OPT_SET_1, true, "infile", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename, "Write memory using the contents of a file."},
-{ LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOffset, "Start writng bytes from an offset within the input file."},
+{ LLDB_OPT_SET_1, true, "infile", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFilename, "Write memory using the contents of a file."},
+{ LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOffset, "Start writing bytes from an offset within the input file."},
};
//----------------------------------------------------------------------
@@ -1536,7 +1536,7 @@ protected:
}
else if (!UIntValueIsValidForSize (uval64, item_byte_size))
{
- result.AppendErrorWithFormat ("Value 0x%" PRIx64 " is too large to fit in a %zu byte unsigned integer value.\n", uval64, item_byte_size);
+ result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -1564,7 +1564,7 @@ protected:
}
else if (!UIntValueIsValidForSize (uval64, item_byte_size))
{
- result.AppendErrorWithFormat ("Value 0x%" PRIx64 " is too large to fit in a %zu byte unsigned integer value.\n", uval64, item_byte_size);
+ result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -1604,7 +1604,7 @@ protected:
}
else if (!SIntValueIsValidForSize (sval64, item_byte_size))
{
- result.AppendErrorWithFormat ("Value %" PRIi64 " is too large or small to fit in a %zu byte signed integer value.\n", sval64, item_byte_size);
+ result.AppendErrorWithFormat ("Value %" PRIi64 " is too large or small to fit in a %" PRIu64 " byte signed integer value.\n", sval64, (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -1621,7 +1621,7 @@ protected:
}
else if (!UIntValueIsValidForSize (uval64, item_byte_size))
{
- result.AppendErrorWithFormat ("Value %" PRIu64 " is too large to fit in a %zu byte unsigned integer value.\n", uval64, item_byte_size);
+ result.AppendErrorWithFormat ("Value %" PRIu64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -1638,7 +1638,7 @@ protected:
}
else if (!UIntValueIsValidForSize (uval64, item_byte_size))
{
- result.AppendErrorWithFormat ("Value %" PRIo64 " is too large to fit in a %zu byte unsigned integer value.\n", uval64, item_byte_size);
+ result.AppendErrorWithFormat ("Value %" PRIo64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
result.SetStatus(eReturnStatusFailed);
return false;
}
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index 5e842bf848a3..9998dbdccdad 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandOptionValidators.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/OptionGroupFile.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
@@ -64,20 +65,19 @@ ParsePermissionString(const char* permissions)
static OptionDefinition
g_permissions_options[] =
{
- { LLDB_OPT_SET_ALL, false, "permissions-value", 'v', OptionParser::eRequiredArgument, NULL, 0, eArgTypePermissionsNumber , "Give out the numeric value for permissions (e.g. 757)" },
- { LLDB_OPT_SET_ALL, false, "permissions-string",'s', OptionParser::eRequiredArgument, NULL, 0, eArgTypePermissionsString , "Give out the string value for permissions (e.g. rwxr-xr--)." },
- { LLDB_OPT_SET_ALL, false, "user-read", 'r', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow user to read." },
- { LLDB_OPT_SET_ALL, false, "user-write", 'w', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow user to write." },
- { LLDB_OPT_SET_ALL, false, "user-exec", 'x', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow user to execute." },
-
- { LLDB_OPT_SET_ALL, false, "group-read", 'R', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow group to read." },
- { LLDB_OPT_SET_ALL, false, "group-write", 'W', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow group to write." },
- { LLDB_OPT_SET_ALL, false, "group-exec", 'X', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow group to execute." },
-
- { LLDB_OPT_SET_ALL, false, "world-read", 'd', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow world to read." },
- { LLDB_OPT_SET_ALL, false, "world-write", 't', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow world to write." },
- { LLDB_OPT_SET_ALL, false, "world-exec", 'e', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Allow world to execute." },
-
+ { LLDB_OPT_SET_ALL, false, "permissions-value", 'v', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePermissionsNumber , "Give out the numeric value for permissions (e.g. 757)" },
+ { LLDB_OPT_SET_ALL, false, "permissions-string", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePermissionsString , "Give out the string value for permissions (e.g. rwxr-xr--)." },
+ { LLDB_OPT_SET_ALL, false, "user-read", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow user to read." },
+ { LLDB_OPT_SET_ALL, false, "user-write", 'w', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow user to write." },
+ { LLDB_OPT_SET_ALL, false, "user-exec", 'x', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow user to execute." },
+
+ { LLDB_OPT_SET_ALL, false, "group-read", 'R', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow group to read." },
+ { LLDB_OPT_SET_ALL, false, "group-write", 'W', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow group to write." },
+ { LLDB_OPT_SET_ALL, false, "group-exec", 'X', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow group to execute." },
+
+ { LLDB_OPT_SET_ALL, false, "world-read", 'd', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow world to read." },
+ { LLDB_OPT_SET_ALL, false, "world-write", 't', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow world to write." },
+ { LLDB_OPT_SET_ALL, false, "world-exec", 'e', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone , "Allow world to execute." },
};
class OptionPermissions : public lldb_private::OptionGroup
@@ -894,9 +894,9 @@ protected:
OptionDefinition
CommandObjectPlatformFRead::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "offset" , 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },
- { LLDB_OPT_SET_1, false, "count" , 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount , "Number of bytes to read from the file." },
- { 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
+ { LLDB_OPT_SET_1, false, "offset" , 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },
+ { LLDB_OPT_SET_1, false, "count" , 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount , "Number of bytes to read from the file." },
+ { 0 , false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone , NULL }
};
@@ -1020,9 +1020,9 @@ protected:
OptionDefinition
CommandObjectPlatformFWrite::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "offset" , 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },
- { LLDB_OPT_SET_1, false, "data" , 'd', OptionParser::eRequiredArgument, NULL, 0, eArgTypeValue , "Text to write to the file." },
- { 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
+ { LLDB_OPT_SET_1, false, "offset" , 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },
+ { LLDB_OPT_SET_1, false, "data" , 'd', OptionParser::eRequiredArgument , NULL, NULL, 0, eArgTypeValue , "Text to write to the file." },
+ { 0 , false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone , NULL }
};
class CommandObjectPlatformFile : public CommandObjectMultiword
@@ -1645,24 +1645,29 @@ protected:
CommandOptions m_options;
};
+namespace
+{
+ PosixPlatformCommandOptionValidator g_posix_validator;
+}
+
OptionDefinition
CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1 , false, "pid" , 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePid , "List the process info for a specific process ID." },
-{ LLDB_OPT_SET_2 , true , "name" , 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that match a string." },
-{ LLDB_OPT_SET_3 , true , "ends-with" , 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that end with a string." },
-{ LLDB_OPT_SET_4 , true , "starts-with", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that start with a string." },
-{ LLDB_OPT_SET_5 , true , "contains" , 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that contain a string." },
-{ LLDB_OPT_SET_6 , true , "regex" , 'r', OptionParser::eRequiredArgument, NULL, 0, eArgTypeRegularExpression, "Find processes with executable basenames that match a regular expression." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "parent" , 'P', OptionParser::eRequiredArgument, NULL, 0, eArgTypePid , "Find processes that have a matching parent process ID." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "uid" , 'u', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching user ID." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "euid" , 'U', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching effective user ID." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "gid" , 'g', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching group ID." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "egid" , 'G', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching effective group ID." },
-{ LLDB_OPT_SET_FROM_TO(2, 6), false, "arch" , 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeArchitecture , "Find processes that have a matching architecture." },
-{ LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args" , 'A', OptionParser::eNoArgument , NULL, 0, eArgTypeNone , "Show process arguments instead of the process executable basename." },
-{ LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose" , 'v', OptionParser::eNoArgument , NULL, 0, eArgTypeNone , "Enable verbose output." },
-{ 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
+{ LLDB_OPT_SET_1 , false, "pid" , 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid , "List the process info for a specific process ID." },
+{ LLDB_OPT_SET_2 , true , "name" , 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that match a string." },
+{ LLDB_OPT_SET_3 , true , "ends-with" , 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that end with a string." },
+{ LLDB_OPT_SET_4 , true , "starts-with", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that start with a string." },
+{ LLDB_OPT_SET_5 , true , "contains" , 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName , "Find processes with executable basenames that contain a string." },
+{ LLDB_OPT_SET_6 , true , "regex" , 'r', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeRegularExpression, "Find processes with executable basenames that match a regular expression." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "parent" , 'P', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid , "Find processes that have a matching parent process ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "uid" , 'u', OptionParser::eRequiredArgument, &g_posix_validator, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching user ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "euid" , 'U', OptionParser::eRequiredArgument, &g_posix_validator, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching effective user ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "gid" , 'g', OptionParser::eRequiredArgument, &g_posix_validator, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching group ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "egid" , 'G', OptionParser::eRequiredArgument, &g_posix_validator, NULL, 0, eArgTypeUnsignedInteger , "Find processes that have a matching effective group ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "arch" , 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeArchitecture , "Find processes that have a matching architecture." },
+{ LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args" , 'A', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Show process arguments instead of the process executable basename." },
+{ LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose" , 'v', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Enable verbose output." },
+{ 0 , false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone , NULL }
};
//----------------------------------------------------------------------
@@ -1965,11 +1970,11 @@ protected:
OptionDefinition
CommandObjectPlatformProcessAttach::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- { LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
- { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
- { LLDB_OPT_SET_2, false, "waitfor",'w', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Wait for the the process with <process-name> to launch."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, false, "plugin", 'P' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+ { LLDB_OPT_SET_1, false, "pid", 'p' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
+ { LLDB_OPT_SET_2, false, "name", 'n' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
+ { LLDB_OPT_SET_2, false, "waitfor", 'w' , OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Wait for the the process with <process-name> to launch."},
+ { 0, false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -2192,8 +2197,8 @@ public:
OptionDefinition
CommandObjectPlatformShell::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeValue, "Seconds to wait for the remote host to finish running the command."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, false, "timeout", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeValue, "Seconds to wait for the remote host to finish running the command."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 49a392286c6a..6536c6ef1693 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -20,6 +20,7 @@
#include "lldb/Breakpoint/BreakpointSite.h"
#include "lldb/Core/State.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/Options.h"
@@ -204,8 +205,28 @@ protected:
const char *target_settings_argv0 = target->GetArg0();
- if (target->GetDisableASLR())
+ // Determine whether we will disable ASLR or leave it in the default state (i.e. enabled if the platform supports it).
+ // First check if the process launch options explicitly turn on/off disabling ASLR. If so, use that setting;
+ // otherwise, use the 'settings target.disable-aslr' setting.
+ bool disable_aslr = false;
+ if (m_options.disable_aslr != eLazyBoolCalculate)
+ {
+ // The user specified an explicit setting on the process launch line. Use it.
+ disable_aslr = (m_options.disable_aslr == eLazyBoolYes);
+ }
+ else
+ {
+ // The user did not explicitly specify whether to disable ASLR. Fall back to the target.disable-aslr setting.
+ disable_aslr = target->GetDisableASLR ();
+ }
+
+ if (disable_aslr)
m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
+ else
+ m_options.launch_info.GetFlags().Clear (eLaunchFlagDisableASLR);
+
+ if (target->GetDetachOnError())
+ m_options.launch_info.GetFlags().Set (eLaunchFlagDetachOnError);
if (target->GetDisableSTDIO())
m_options.launch_info.GetFlags().Set (eLaunchFlagDisableSTDIO);
@@ -532,6 +553,9 @@ protected:
if (error.Success())
{
+ // Update the execution context so the current target and process are now selected
+ // in case we interrupt
+ m_interpreter.UpdateExecutionContext(NULL);
ListenerSP listener_sp (new Listener("lldb.CommandObjectProcessAttach.DoExecute.attach.hijack"));
m_options.attach_info.SetHijackListener(listener_sp);
process->HijackProcessEvents(listener_sp.get());
@@ -553,7 +577,11 @@ protected:
}
else
{
- result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
+ const char *exit_desc = process->GetExitDescription();
+ if (exit_desc)
+ result.AppendErrorWithFormat ("attach failed: %s", exit_desc);
+ else
+ result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
process->Destroy();
result.SetStatus (eReturnStatusFailed);
}
@@ -617,13 +645,13 @@ protected:
OptionDefinition
CommandObjectProcessAttach::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."},
-{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
-{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
-{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
-{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
-{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."},
+{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
+{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
+{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
+{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -758,13 +786,20 @@ protected:
// Set the actions that the threads should each take when resuming
for (uint32_t idx=0; idx<num_threads; ++idx)
{
- process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
+ const bool override_suspend = false;
+ process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning, override_suspend);
}
}
-
+
Error error(process->Resume());
+
if (error.Success())
{
+ // 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 PrivateStateThread) has
+ // a chance to call PushProcessIOHandler().
+ process->SyncIOHandler(2000);
+
result.AppendMessageWithFormat ("Process %" PRIu64 " resuming\n", process->GetID());
if (synchronous_execution)
{
@@ -807,9 +842,9 @@ protected:
OptionDefinition
CommandObjectProcessContinue::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger,
+{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger,
"Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -911,7 +946,6 @@ protected:
DoExecute (Args& command, CommandReturnObject &result)
{
Process *process = m_exe_ctx.GetProcessPtr();
- result.AppendMessageWithFormat ("Detaching from process %" PRIu64 "\n", process->GetID());
// FIXME: This will be a Command Option:
bool keep_stopped;
if (m_options.m_keep_stopped == eLazyBoolCalculate)
@@ -947,8 +981,8 @@ protected:
OptionDefinition
CommandObjectProcessDetach::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1119,8 +1153,8 @@ protected:
OptionDefinition
CommandObjectProcessConnect::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- { 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+ { 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1483,6 +1517,71 @@ protected:
};
//-------------------------------------------------------------------------
+// CommandObjectProcessSaveCore
+//-------------------------------------------------------------------------
+#pragma mark CommandObjectProcessSaveCore
+
+class CommandObjectProcessSaveCore : public CommandObjectParsed
+{
+public:
+
+ CommandObjectProcessSaveCore (CommandInterpreter &interpreter) :
+ CommandObjectParsed (interpreter,
+ "process save-core",
+ "Save the current process as a core file using an appropriate file type.",
+ "process save-core FILE",
+ eFlagRequiresProcess |
+ eFlagTryTargetAPILock |
+ eFlagProcessMustBeLaunched)
+ {
+ }
+
+ ~CommandObjectProcessSaveCore ()
+ {
+ }
+
+protected:
+ bool
+ DoExecute (Args& command,
+ CommandReturnObject &result)
+ {
+ ProcessSP process_sp = m_exe_ctx.GetProcessSP();
+ if (process_sp)
+ {
+ if (command.GetArgumentCount() == 1)
+ {
+ FileSpec output_file(command.GetArgumentAtIndex(0), false);
+ Error error = PluginManager::SaveCore(process_sp, output_file);
+ if (error.Success())
+ {
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ result.AppendErrorWithFormat ("Failed to save core file for process: %s\n", error.AsCString());
+ result.SetStatus (eReturnStatusFailed);
+ }
+ }
+ else
+ {
+ result.AppendErrorWithFormat ("'%s' takes one arguments:\nUsage: %s\n",
+ m_cmd_name.c_str(),
+ m_cmd_syntax.c_str());
+ result.SetStatus (eReturnStatusFailed);
+ }
+ }
+ else
+ {
+ result.AppendError ("invalid process");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+
+ return result.Succeeded();
+ }
+};
+
+//-------------------------------------------------------------------------
// CommandObjectProcessStatus
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessStatus
@@ -1824,10 +1923,10 @@ protected:
OptionDefinition
CommandObjectProcessHandle::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
-{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
-{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." },
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
+{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
+{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." },
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
@@ -1853,6 +1952,7 @@ CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter
LoadSubCommand ("interrupt", CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
LoadSubCommand ("kill", CommandObjectSP (new CommandObjectProcessKill (interpreter)));
LoadSubCommand ("plugin", CommandObjectSP (new CommandObjectProcessPlugin (interpreter)));
+ LoadSubCommand ("save-core", CommandObjectSP (new CommandObjectProcessSaveCore (interpreter)));
}
CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()
diff --git a/source/Commands/CommandObjectQuit.cpp b/source/Commands/CommandObjectQuit.cpp
index ffe2a9240726..dd0efc61b2d0 100644
--- a/source/Commands/CommandObjectQuit.cpp
+++ b/source/Commands/CommandObjectQuit.cpp
@@ -53,7 +53,7 @@ CommandObjectQuit::ShouldAskForConfirmation (bool& is_a_detach)
continue;
const TargetList& target_list(debugger_sp->GetTargetList());
for (uint32_t target_idx = 0;
- target_idx < target_list.GetNumTargets();
+ target_idx < static_cast<uint32_t>(target_list.GetNumTargets());
target_idx++)
{
TargetSP target_sp(target_list.GetTargetAtIndex(target_idx));
diff --git a/source/Commands/CommandObjectRegister.cpp b/source/Commands/CommandObjectRegister.cpp
index deaf2ab3793e..81b79b8cd8b2 100644
--- a/source/Commands/CommandObjectRegister.cpp
+++ b/source/Commands/CommandObjectRegister.cpp
@@ -31,6 +31,7 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Thread.h"
+#include "llvm/ADT/STLExtras.h"
using namespace lldb;
using namespace lldb_private;
@@ -202,7 +203,7 @@ protected:
}
else
{
- result.AppendErrorWithFormat ("invalid register set index: %zu\n", set_idx);
+ result.AppendErrorWithFormat("invalid register set index: %" PRIu64 "\n", (uint64_t)set_idx);
result.SetStatus (eReturnStatusFailed);
break;
}
@@ -352,15 +353,15 @@ protected:
const OptionDefinition
CommandObjectRegisterRead::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument , NULL, 0, eArgTypeNone , "Display register names using the alternate register name if there is one."},
- { LLDB_OPT_SET_1 , false, "set" , 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeIndex , "Specify which register sets to dump by index."},
- { LLDB_OPT_SET_2 , false, "all" , 'a', OptionParser::eNoArgument , NULL, 0, eArgTypeNone , "Show all register sets."},
+ { LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Display register names using the alternate register name if there is one."},
+ { LLDB_OPT_SET_1 , false, "set" , 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeIndex , "Specify which register sets to dump by index."},
+ { LLDB_OPT_SET_2 , false, "all" , 'a', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Show all register sets."},
};
uint32_t
CommandObjectRegisterRead::CommandOptions::GetNumDefinitions ()
{
- return sizeof(g_option_table)/sizeof(OptionDefinition);
+ return llvm::array_lengthof(g_option_table);
}
diff --git a/source/Commands/CommandObjectSettings.cpp b/source/Commands/CommandObjectSettings.cpp
index 78a5ad6ca86a..ed677afabcb5 100644
--- a/source/Commands/CommandObjectSettings.cpp
+++ b/source/Commands/CommandObjectSettings.cpp
@@ -164,7 +164,8 @@ insert-before or insert-after.\n");
const size_t argc = input.GetArgumentCount();
const char *arg = NULL;
int setting_var_idx;
- for (setting_var_idx = 1; setting_var_idx < argc; ++setting_var_idx)
+ for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc);
+ ++setting_var_idx)
{
arg = input.GetArgumentAtIndex(setting_var_idx);
if (arg && arg[0] != '-')
@@ -288,8 +289,8 @@ private:
OptionDefinition
CommandObjectSettingsSet::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Apply the new value to the global default value." },
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Apply the new value to the global default value." },
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -1154,7 +1155,7 @@ protected:
if (argc != 1)
{
- result.AppendError ("'setttings clear' takes exactly one argument");
+ result.AppendError ("'settings clear' takes exactly one argument");
result.SetStatus (eReturnStatusFailed);
return false;
}
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index bf2a42e0bea0..6b1b6aacc857 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -138,9 +138,9 @@ protected:
OptionDefinition
CommandObjectSourceInfo::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."},
-{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."},
+{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectSourceList
@@ -804,7 +804,7 @@ protected:
result.SetStatus (eReturnStatusFailed);
return false;
}
-
+
if (num_matches > 1)
{
bool got_multiple = false;
@@ -820,7 +820,7 @@ protected:
{
if (test_cu_spec != static_cast<FileSpec *> (sc.comp_unit))
got_multiple = true;
- break;
+ break;
}
else
test_cu_spec = sc.comp_unit;
@@ -828,7 +828,7 @@ protected:
}
if (got_multiple)
{
- result.AppendErrorWithFormat("Multiple source files found matching: \"%s.\"\n",
+ result.AppendErrorWithFormat("Multiple source files found matching: \"%s.\"\n",
m_options.file_name.c_str());
result.SetStatus (eReturnStatusFailed);
return false;
@@ -891,16 +891,16 @@ protected:
OptionDefinition
CommandObjectSourceList::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "The number of source lines to display."},
+{ LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "The number of source lines to display."},
{ LLDB_OPT_SET_1 |
- LLDB_OPT_SET_2 , false, "shlib", 's', OptionParser::eRequiredArgument, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."},
-{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
-{ LLDB_OPT_SET_1 , false, "file", 'f', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
-{ LLDB_OPT_SET_1 , false, "line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."},
-{ LLDB_OPT_SET_2 , false, "name", 'n', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
-{ LLDB_OPT_SET_3 , false, "address",'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
-{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ LLDB_OPT_SET_2 , false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."},
+{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
+{ LLDB_OPT_SET_1 , false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
+{ LLDB_OPT_SET_1 , false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."},
+{ LLDB_OPT_SET_2 , false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
+{ LLDB_OPT_SET_3 , false, "address",'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
+{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectMultiwordSource
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 308b72f355d3..024f7b5a0415 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -63,18 +63,18 @@ static void
DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bool show_stopped_process_status, Stream &strm)
{
const ArchSpec &target_arch = target->GetArchitecture();
-
+
Module *exe_module = target->GetExecutableModulePointer();
char exe_path[PATH_MAX];
bool exe_valid = false;
if (exe_module)
exe_valid = exe_module->GetFileSpec().GetPath (exe_path, sizeof(exe_path));
-
+
if (!exe_valid)
::strcpy (exe_path, "<none>");
-
+
strm.Printf ("%starget #%u: %s", prefix_cstr ? prefix_cstr : "", target_idx, exe_path);
-
+
uint32_t properties = 0;
if (target_arch.IsValid())
{
@@ -84,7 +84,7 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo
PlatformSP platform_sp (target->GetPlatform());
if (platform_sp)
strm.Printf ("%splatform=%s", properties++ > 0 ? ", " : " ( ", platform_sp->GetName().GetCString());
-
+
ProcessSP process_sp (target->GetProcessSP());
bool show_process_status = false;
if (process_sp)
@@ -123,7 +123,7 @@ DumpTargetList (TargetList &target_list, bool show_stopped_process_status, Strea
{
const uint32_t num_targets = target_list.GetNumTargets();
if (num_targets)
- {
+ {
TargetSP selected_target_sp (target_list.GetSelectedTarget());
strm.PutCString ("Current targets:\n");
for (uint32_t i=0; i<num_targets; ++i)
@@ -167,17 +167,17 @@ public:
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
-
+
// Define the first (and only) variant of this arg.
file_arg.arg_type = eArgTypeFilename;
file_arg.arg_repetition = eArgRepeatPlain;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (file_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
-
+
m_option_group.Append (&m_arch_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
@@ -210,7 +210,7 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
-
+
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
@@ -230,12 +230,38 @@ protected:
FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue());
FileSpec remote_file (m_remote_file.GetOptionValue().GetCurrentValue());
+ if (core_file)
+ {
+ if (!core_file.Exists())
+ {
+ result.AppendErrorWithFormat("core file '%s' doesn't exist", core_file.GetPath().c_str());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+
+ }
+ if (!core_file.Readable())
+ {
+ result.AppendErrorWithFormat("core file '%s' is not readable", core_file.GetPath().c_str());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
+
if (argc == 1 || core_file || remote_file)
{
FileSpec symfile (m_symbol_file.GetOptionValue().GetCurrentValue());
if (symfile)
{
- if (!symfile.Exists())
+ if (symfile.Exists())
+ {
+ if (!symfile.Readable())
+ {
+ result.AppendErrorWithFormat("symbol file '%s' is not readable", core_file.GetPath().c_str());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
+ else
{
char symfile_path[PATH_MAX];
symfile.GetPath(symfile_path, sizeof(symfile_path));
@@ -248,12 +274,12 @@ protected:
const char *file_path = command.GetArgumentAtIndex(0);
Timer scoped_timer(__PRETTY_FUNCTION__, "(lldb) target create '%s'", file_path);
FileSpec file_spec;
-
+
if (file_path)
file_spec.SetFile (file_path, true);
-
+
bool must_set_platform_path = false;
-
+
Debugger &debugger = m_interpreter.GetDebugger();
PlatformSP platform_sp(debugger.GetPlatformList().GetSelectedPlatform ());
@@ -334,7 +360,7 @@ protected:
}
}
}
-
+
debugger.GetTargetList().SetSelectedTarget(target_sp.get());
if (must_set_platform_path)
{
@@ -352,7 +378,7 @@ protected:
FileSpec core_file_dir;
core_file_dir.GetDirectory() = core_file.GetDirectory();
target_sp->GetExecutableSearchPaths ().Append (core_file_dir);
-
+
ProcessSP process_sp (target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), NULL, &core_file));
if (process_sp)
@@ -360,7 +386,7 @@ protected:
// Seems wierd that we Launch a core file, but that is
// what we do!
error = process_sp->LoadCore();
-
+
if (error.Fail())
{
result.AppendError(error.AsCString("can't find plug-in for core file"));
@@ -403,7 +429,6 @@ protected:
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
-
}
private:
@@ -434,12 +459,12 @@ public:
0)
{
}
-
+
virtual
~CommandObjectTargetList ()
{
}
-
+
protected:
virtual bool
DoExecute (Args& args, CommandReturnObject &result)
@@ -447,7 +472,7 @@ protected:
if (args.GetArgumentCount() == 0)
{
Stream &strm = result.GetOutputStream();
-
+
bool show_stopped_process_status = false;
if (DumpTargetList (m_interpreter.GetDebugger().GetTargetList(), show_stopped_process_status, strm) == 0)
{
@@ -482,12 +507,12 @@ public:
0)
{
}
-
+
virtual
~CommandObjectTargetSelect ()
{
}
-
+
protected:
virtual bool
DoExecute (Args& args, CommandReturnObject &result)
@@ -520,9 +545,16 @@ protected:
}
else
{
- result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n",
- target_idx,
- num_targets - 1);
+ if (num_targets > 0)
+ {
+ result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n",
+ target_idx,
+ num_targets - 1);
+ } else
+ {
+ result.AppendErrorWithFormat ("index %u is out of range since there are no active targets\n",
+ target_idx);
+ }
result.SetStatus (eReturnStatusFailed);
}
}
@@ -562,12 +594,12 @@ public:
m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
-
+
virtual
~CommandObjectTargetDelete ()
{
}
-
+
Options *
GetOptions ()
{
@@ -600,7 +632,7 @@ protected:
if (success)
{
if (target_idx < num_targets)
- {
+ {
target_sp = target_list.GetTargetAtIndex (target_idx);
if (target_sp)
{
@@ -626,7 +658,6 @@ protected:
success = false;
}
}
-
}
else
{
@@ -661,10 +692,10 @@ protected:
result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete);
result.SetStatus(eReturnStatusSuccessFinishResult);
}
-
+
return result.Succeeded();
}
-
+
OptionGroupOptions m_option_group;
OptionGroupBoolean m_cleanup_option;
};
@@ -678,6 +709,9 @@ protected:
class CommandObjectTargetVariable : public CommandObjectParsed
{
+ static const uint32_t SHORT_OPTION_FILE = 0x66696c65; // 'file'
+ static const uint32_t SHORT_OPTION_SHLB = 0x73686c62; // 'shlb'
+
public:
CommandObjectTargetVariable (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@@ -688,23 +722,27 @@ public:
m_option_group (interpreter),
m_option_variable (false), // Don't include frame options
m_option_format (eFormatDefault),
- m_option_compile_units (LLDB_OPT_SET_1, false, "file", 'file', 0, eArgTypeFilename, "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
- m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",'shlb', 0, eArgTypeFilename, "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
+ m_option_compile_units (LLDB_OPT_SET_1, false, "file",
+ SHORT_OPTION_FILE, 0, eArgTypeFilename,
+ "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
+ m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",
+ SHORT_OPTION_SHLB, 0, eArgTypeFilename,
+ "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
m_varobj_options()
{
CommandArgumentEntry arg;
CommandArgumentData var_name_arg;
-
+
// Define the first (and only) variant of this arg.
var_name_arg.arg_type = eArgTypeVarName;
var_name_arg.arg_repetition = eArgRepeatPlus;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (var_name_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
-
+
m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_option_format, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_1);
@@ -712,7 +750,7 @@ public:
m_option_group.Append (&m_option_shared_libraries, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
-
+
virtual
~CommandObjectTargetVariable ()
{
@@ -722,33 +760,33 @@ public:
DumpValueObject (Stream &s, VariableSP &var_sp, ValueObjectSP &valobj_sp, const char *root_name)
{
DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions());
-
+
switch (var_sp->GetScope())
{
case eValueTypeVariableGlobal:
if (m_option_variable.show_scope)
s.PutCString("GLOBAL: ");
break;
-
+
case eValueTypeVariableStatic:
if (m_option_variable.show_scope)
s.PutCString("STATIC: ");
break;
-
+
case eValueTypeVariableArgument:
if (m_option_variable.show_scope)
s.PutCString(" ARG: ");
break;
-
+
case eValueTypeVariableLocal:
if (m_option_variable.show_scope)
s.PutCString(" LOCAL: ");
break;
-
+
default:
break;
}
-
+
if (m_option_variable.show_decl)
{
bool show_fullpaths = false;
@@ -756,17 +794,16 @@ public:
if (var_sp->DumpDeclaration(&s, show_fullpaths, show_module))
s.PutCString (": ");
}
-
+
const Format format = m_option_format.GetFormat();
if (format != eFormatDefault)
options.SetFormat(format);
options.SetRootValueObjectName(root_name);
-
+
valobj_sp->Dump(s,options);
}
-
-
+
static size_t GetVariableCallback (void *baton,
const char *name,
VariableList &variable_list)
@@ -781,17 +818,14 @@ public:
}
return 0;
}
-
-
Options *
GetOptions ()
{
return &m_option_group;
}
-
+
protected:
-
void
DumpGlobalVariableList(const ExecutionContext &exe_ctx, const SymbolContext &sc, const VariableList &variable_list, Stream &s)
{
@@ -817,14 +851,14 @@ protected:
s.Printf ("Global variables for %s\n",
sc.comp_unit->GetPath().c_str());
}
-
+
for (uint32_t i=0; i<count; ++i)
{
VariableSP var_sp (variable_list.GetVariableAtIndex(i));
if (var_sp)
{
ValueObjectSP valobj_sp (ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp));
-
+
if (valobj_sp)
DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString());
}
@@ -838,7 +872,7 @@ protected:
Target *target = m_exe_ctx.GetTargetPtr();
const size_t argc = args.GetArgumentCount();
Stream &s = result.GetOutputStream();
-
+
if (argc > 0)
{
@@ -875,7 +909,7 @@ protected:
valobj_list));
matches = variable_list.GetSize();
}
-
+
if (matches == 0)
{
result.GetErrorStream().Printf ("error: can't find global variable '%s'\n", arg);
@@ -892,7 +926,7 @@ protected:
ValueObjectSP valobj_sp (valobj_list.GetValueObjectAtIndex(global_idx));
if (!valobj_sp)
valobj_sp = ValueObjectVariable::Create (m_exe_ctx.GetBestExecutionContextScope(), var_sp);
-
+
if (valobj_sp)
DumpValueObject (s, var_sp, valobj_sp, use_var_name ? var_sp->GetName().GetCString() : arg);
}
@@ -939,7 +973,7 @@ protected:
comp_unit->GetPath().c_str());
else
result.AppendErrorWithFormat ("no debug information for frame %u\n", frame->GetFrameIndex());
- }
+ }
else
result.AppendError ("'target variable' takes one or more global variable names as arguments\n");
result.SetStatus (eReturnStatusFailed);
@@ -956,7 +990,7 @@ protected:
{
const FileSpec module_file(shlibs.GetFileSpecAtIndex(shlib_idx));
ModuleSpec module_spec (module_file);
-
+
ModuleSP module_sp (target->GetImages().FindFirstModule(module_spec));
if (module_sp)
{
@@ -986,7 +1020,7 @@ protected:
for (size_t cu_idx=0; cu_idx<num_compile_units; ++cu_idx)
target->GetImages().FindCompileUnits(compile_units.GetFileSpecAtIndex(cu_idx), append, sc_list);
}
-
+
const uint32_t num_scs = sc_list.GetSize();
if (num_scs > 0)
{
@@ -1022,10 +1056,10 @@ protected:
m_cmd_name.c_str());
m_interpreter.TruncationWarningGiven();
}
-
+
return result.Succeeded();
}
-
+
OptionGroupOptions m_option_group;
OptionGroupVariable m_option_variable;
OptionGroupFormat m_option_format;
@@ -1051,15 +1085,15 @@ public:
CommandArgumentEntry arg;
CommandArgumentData old_prefix_arg;
CommandArgumentData new_prefix_arg;
-
+
// Define the first variant of this arg pair.
old_prefix_arg.arg_type = eArgTypeOldPathPrefix;
old_prefix_arg.arg_repetition = eArgRepeatPairPlus;
-
+
// Define the first variant of this arg pair.
new_prefix_arg.arg_type = eArgTypeNewPathPrefix;
new_prefix_arg.arg_repetition = eArgRepeatPairPlus;
-
+
// There are two required arguments that must always occur together, i.e. an argument "pair". Because they
// must always occur together, they are treated as two variants of one argument rather than two independent
// arguments. Push them both into the first argument position for m_arguments...
@@ -1094,7 +1128,7 @@ protected:
{
const char *from = command.GetArgumentAtIndex(i);
const char *to = command.GetArgumentAtIndex(i+1);
-
+
if (from[0] && to[0])
{
bool last_pair = ((argc - i) == 2);
@@ -1179,7 +1213,7 @@ public:
CommandArgumentData index_arg;
CommandArgumentData old_prefix_arg;
CommandArgumentData new_prefix_arg;
-
+
// Define the first and only variant of this arg.
index_arg.arg_type = eArgTypeIndex;
index_arg.arg_repetition = eArgRepeatPlain;
@@ -1190,11 +1224,11 @@ public:
// Define the first variant of this arg pair.
old_prefix_arg.arg_type = eArgTypeOldPathPrefix;
old_prefix_arg.arg_repetition = eArgRepeatPairPlus;
-
+
// Define the first variant of this arg pair.
new_prefix_arg.arg_type = eArgTypeNewPathPrefix;
new_prefix_arg.arg_repetition = eArgRepeatPairPlus;
-
+
// There are two required arguments that must always occur together, i.e. an argument "pair". Because they
// must always occur together, they are treated as two variants of one argument rather than two independent
// arguments. Push them both into the same argument position for m_arguments...
@@ -1242,7 +1276,7 @@ protected:
{
const char *from = command.GetArgumentAtIndex(i);
const char *to = command.GetArgumentAtIndex(i+1);
-
+
if (from[0] && to[0])
{
bool last_pair = ((argc - i) == 2);
@@ -1341,14 +1375,14 @@ public:
{
CommandArgumentEntry arg;
CommandArgumentData path_arg;
-
+
// Define the first (and only) variant of this arg.
path_arg.arg_type = eArgTypeDirectoryName;
path_arg.arg_repetition = eArgRepeatPlain;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (path_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
@@ -1435,7 +1469,7 @@ DumpCompileUnitLineTable (CommandInterpreter &interpreter,
false,
eSymbolContextCompUnit,
sc_list);
-
+
for (uint32_t i=0; i<num_matches; ++i)
{
SymbolContext sc;
@@ -1443,7 +1477,7 @@ DumpCompileUnitLineTable (CommandInterpreter &interpreter,
{
if (i > 0)
strm << "\n\n";
-
+
strm << "Line table for " << *static_cast<FileSpec*> (sc.comp_unit) << " in `"
<< module->GetFileSpec().GetFilename() << "\n";
LineTable *line_table = sc.comp_unit->GetLineTable();
@@ -1612,7 +1646,7 @@ LookupAddressInModule (CommandInterpreter &interpreter,
if (!module->ResolveFileAddress (addr, so_addr))
return false;
}
-
+
ExecutionContextScope *exe_scope = interpreter.GetExecutionContext().GetBestExecutionContextScope();
DumpAddress (exe_scope, so_addr, verbose, strm);
// strm.IndentMore();
@@ -1635,7 +1669,7 @@ LookupAddressInModule (CommandInterpreter &interpreter,
// strm.IndentLess();
return true;
}
-
+
return false;
}
@@ -1645,7 +1679,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod
if (module)
{
SymbolContext sc;
-
+
SymbolVendor *sym_vendor = module->GetSymbolVendor ();
if (sym_vendor)
{
@@ -1667,8 +1701,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod
{
num_matches = symtab->AppendSymbolIndexesWithName (symbol_name, match_indexes);
}
-
-
+
if (num_matches > 0)
{
strm.Indent ();
@@ -1705,19 +1738,19 @@ DumpSymbolContextList (ExecutionContextScope *exe_scope, Stream &strm, SymbolCon
strm.IndentMore ();
uint32_t i;
const uint32_t num_matches = sc_list.GetSize();
-
+
for (i=0; i<num_matches; ++i)
{
SymbolContext sc;
if (sc_list.GetContextAtIndex(i, sc))
{
AddressRange range;
-
+
sc.GetAddressRange(eSymbolContextEverything,
0,
true,
range);
-
+
DumpAddress (exe_scope, range.GetBaseAddress(), verbose, strm);
}
}
@@ -1759,11 +1792,11 @@ LookupFunctionInModule (CommandInterpreter &interpreter,
append,
sc_list);
}
-
+
if (num_matches)
{
strm.Indent ();
- strm.Printf("%zu match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+ strm.Printf("%" PRIu64 " match%s found in ", (uint64_t)num_matches, num_matches > 1 ? "es" : "");
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
DumpSymbolContextList (interpreter.GetExecutionContext().GetBestExecutionContextScope(), strm, sc_list, verbose);
@@ -1790,11 +1823,11 @@ LookupTypeInModule (CommandInterpreter &interpreter,
ConstString name(name_cstr);
num_matches = module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, type_list);
-
+
if (num_matches)
{
strm.Indent ();
- strm.Printf("%zu match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+ strm.Printf("%" PRIu64 " match%s found in ", (uint64_t)num_matches, num_matches > 1 ? "es" : "");
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
for (TypeSP type_sp : type_list.Types())
@@ -1835,22 +1868,22 @@ LookupTypeHere (CommandInterpreter &interpreter,
{
if (!sym_ctx.module_sp)
return 0;
-
+
TypeList type_list;
const uint32_t max_num_matches = UINT32_MAX;
size_t num_matches = 1;
bool name_is_fully_qualified = false;
-
+
ConstString name(name_cstr);
num_matches = sym_ctx.module_sp->FindTypes(sym_ctx, name, name_is_fully_qualified, max_num_matches, type_list);
-
+
if (num_matches)
{
strm.Indent ();
strm.PutCString("Best match found in ");
DumpFullpath (strm, &sym_ctx.module_sp->GetFileSpec(), 0);
strm.PutCString(":\n");
-
+
TypeSP type_sp (type_list.GetTypeAtIndex(0));
if (type_sp)
{
@@ -1905,7 +1938,6 @@ LookupFileAndLineInModule (CommandInterpreter &interpreter,
}
}
return 0;
-
}
@@ -1918,7 +1950,7 @@ FindModulesByName (Target *target,
// Dump specified images (by basename or fullpath)
FileSpec module_file_spec(module_name, false);
ModuleSpec module_spec (module_file_spec);
-
+
const size_t initial_size = module_list.GetSize ();
if (check_global_list)
@@ -1930,7 +1962,7 @@ FindModulesByName (Target *target,
for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
Module *module = Module::GetAllocatedModuleAtIndex(image_idx);
-
+
if (module)
{
if (module->MatchesModuleSpec (module_spec))
@@ -1946,7 +1978,7 @@ FindModulesByName (Target *target,
if (target)
{
const size_t num_matches = target->GetImages().FindModules (module_spec, module_list);
-
+
// Not found in our module list for our target, check the main
// shared module list in case it is a extra file used somewhere
// else
@@ -1961,7 +1993,7 @@ FindModulesByName (Target *target,
ModuleList::FindSharedModules (module_spec,module_list);
}
}
-
+
return module_list.GetSize () - initial_size;
}
@@ -1975,7 +2007,6 @@ FindModulesByName (Target *target,
class CommandObjectTargetModulesModuleAutoComplete : public CommandObjectParsed
{
public:
-
CommandObjectTargetModulesModuleAutoComplete (CommandInterpreter &interpreter,
const char *name,
const char *help,
@@ -1984,23 +2015,23 @@ public:
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
-
+
// Define the first (and only) variant of this arg.
file_arg.arg_type = eArgTypeFilename;
file_arg.arg_repetition = eArgRepeatStar;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (file_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
-
+
virtual
~CommandObjectTargetModulesModuleAutoComplete ()
{
}
-
+
virtual int
HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -2014,7 +2045,7 @@ public:
// Arguments are the standard module completer.
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
-
+
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eModuleCompletion,
completion_str.c_str(),
@@ -2037,7 +2068,6 @@ public:
class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObjectParsed
{
public:
-
CommandObjectTargetModulesSourceFileAutoComplete (CommandInterpreter &interpreter,
const char *name,
const char *help,
@@ -2047,23 +2077,23 @@ public:
{
CommandArgumentEntry arg;
CommandArgumentData source_file_arg;
-
+
// Define the first (and only) variant of this arg.
source_file_arg.arg_type = eArgTypeSourceFile;
source_file_arg.arg_repetition = eArgRepeatPlus;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (source_file_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
-
+
virtual
~CommandObjectTargetModulesSourceFileAutoComplete ()
{
}
-
+
virtual int
HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -2077,7 +2107,7 @@ public:
// Arguments are the standard source file completer.
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
-
+
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eSourceFileCompletion,
completion_str.c_str(),
@@ -2105,39 +2135,38 @@ public:
m_options (interpreter)
{
}
-
+
virtual
~CommandObjectTargetModulesDumpSymtab ()
{
}
-
+
virtual Options *
GetOptions ()
{
return &m_options;
}
-
+
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
m_sort_order (eSortOrderNone)
{
}
-
+
virtual
~CommandOptions ()
{
}
-
+
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg)
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
-
+
switch (short_option)
{
case 's':
@@ -2146,33 +2175,33 @@ public:
eSortOrderNone,
error);
break;
-
+
default:
error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
break;
-
+
}
return error;
}
-
+
void
OptionParsingStarting ()
{
m_sort_order = eSortOrderNone;
}
-
+
const OptionDefinition*
GetDefinitions ()
{
return g_option_table;
}
-
+
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
-
+
SortOrder m_sort_order;
};
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -2188,11 +2217,11 @@ protected:
else
{
uint32_t num_dumped = 0;
-
+
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
-
+
if (command.GetArgumentCount() == 0)
{
// Dump all sections for all modules images
@@ -2200,7 +2229,7 @@ protected:
const size_t num_modules = target->GetImages().GetSize();
if (num_modules > 0)
{
- result.GetOutputStream().Printf("Dumping symbol table for %zu modules.\n", num_modules);
+ result.GetOutputStream().Printf("Dumping symbol table for %" PRIu64 " modules.\n", (uint64_t)num_modules);
for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
if (num_dumped > 0)
@@ -2251,7 +2280,7 @@ protected:
result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
}
}
-
+
if (num_dumped > 0)
result.SetStatus (eReturnStatusSuccessFinishResult);
else
@@ -2262,8 +2291,7 @@ protected:
}
return result.Succeeded();
}
-
-
+
CommandOptions m_options;
};
@@ -2280,8 +2308,8 @@ g_sort_option_enumeration[4] =
OptionDefinition
CommandObjectTargetModulesDumpSymtab::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "sort", 's', OptionParser::eRequiredArgument, g_sort_option_enumeration, 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "sort", 's', OptionParser::eRequiredArgument, NULL, g_sort_option_enumeration, 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectTargetModulesDumpSections
@@ -2301,12 +2329,12 @@ public:
NULL)
{
}
-
+
virtual
~CommandObjectTargetModulesDumpSections ()
{
}
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -2322,18 +2350,18 @@ protected:
else
{
uint32_t num_dumped = 0;
-
+
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
-
+
if (command.GetArgumentCount() == 0)
{
// Dump all sections for all modules images
const size_t num_modules = target->GetImages().GetSize();
if (num_modules > 0)
{
- result.GetOutputStream().Printf("Dumping sections for %zu modules.\n", num_modules);
+ result.GetOutputStream().Printf("Dumping sections for %" PRIu64 " modules.\n", (uint64_t)num_modules);
for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
num_dumped++;
@@ -2376,7 +2404,7 @@ protected:
}
}
}
-
+
if (num_dumped > 0)
result.SetStatus (eReturnStatusSuccessFinishResult);
else
@@ -2407,12 +2435,12 @@ public:
NULL)
{
}
-
+
virtual
~CommandObjectTargetModulesDumpSymfile ()
{
}
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -2428,11 +2456,11 @@ protected:
else
{
uint32_t num_dumped = 0;
-
+
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
-
+
if (command.GetArgumentCount() == 0)
{
// Dump all sections for all modules images
@@ -2441,7 +2469,7 @@ protected:
const size_t num_modules = target_modules.GetSize();
if (num_modules > 0)
{
- result.GetOutputStream().Printf("Dumping debug symbols for %zu modules.\n", num_modules);
+ result.GetOutputStream().Printf("Dumping debug symbols for %" PRIu64 " modules.\n", (uint64_t)num_modules);
for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
if (DumpModuleSymbolVendor (result.GetOutputStream(), target_modules.GetModulePointerAtIndexUnlocked(image_idx)))
@@ -2479,7 +2507,7 @@ protected:
result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
}
}
-
+
if (num_dumped > 0)
result.SetStatus (eReturnStatusSuccessFinishResult);
else
@@ -2510,12 +2538,12 @@ public:
eFlagRequiresTarget)
{
}
-
+
virtual
~CommandObjectTargetModulesDumpLineTable ()
{
}
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -2523,11 +2551,11 @@ protected:
{
Target *target = m_exe_ctx.GetTargetPtr();
uint32_t total_num_dumped = 0;
-
+
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
-
+
if (command.GetArgumentCount() == 0)
{
result.AppendErrorWithFormat ("\nSyntax: %s\n", m_cmd_syntax.c_str());
@@ -2540,7 +2568,7 @@ protected:
for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
{
FileSpec file_spec(arg_cstr, false);
-
+
const ModuleList &target_modules = target->GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
const size_t num_modules = target_modules.GetSize();
@@ -2563,7 +2591,7 @@ protected:
}
}
}
-
+
if (total_num_dumped > 0)
result.SetStatus (eReturnStatusSuccessFinishResult);
else
@@ -2585,7 +2613,6 @@ protected:
class CommandObjectTargetModulesDump : public CommandObjectMultiword
{
public:
-
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
@@ -2600,7 +2627,7 @@ public:
LoadSubCommand ("symfile", CommandObjectSP (new CommandObjectTargetModulesDumpSymfile (interpreter)));
LoadSubCommand ("line-table", CommandObjectSP (new CommandObjectTargetModulesDumpLineTable (interpreter)));
}
-
+
virtual
~CommandObjectTargetModulesDump()
{
@@ -2622,18 +2649,18 @@ public:
m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
-
+
virtual
~CommandObjectTargetModulesAdd ()
{
}
-
+
virtual Options *
GetOptions ()
{
return &m_option_group;
}
-
+
virtual int
HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -2646,7 +2673,7 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
-
+
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
@@ -2659,11 +2686,9 @@ public:
}
protected:
-
OptionGroupOptions m_option_group;
OptionGroupUUID m_uuid_option_group;
OptionGroupFile m_symbol_file;
-
virtual bool
DoExecute (Args& args,
@@ -2679,7 +2704,7 @@ protected:
else
{
bool flush = false;
-
+
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
@@ -2700,8 +2725,6 @@ protected:
}
else
{
- flush = true;
-
StreamString strm;
module_spec.GetUUID().Dump (&strm);
if (module_spec.GetFileSpec())
@@ -2798,7 +2821,7 @@ protected:
}
}
}
-
+
if (flush)
{
ProcessSP process = target->GetProcessSP();
@@ -2806,7 +2829,7 @@ protected:
process->Flush();
}
}
-
+
return result.Succeeded();
}
@@ -2829,18 +2852,18 @@ public:
m_option_group.Append (&m_slide_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
-
+
virtual
~CommandObjectTargetModulesLoad ()
{
}
-
+
virtual Options *
GetOptions ()
{
return &m_option_group;
}
-
+
protected:
virtual bool
DoExecute (Args& args,
@@ -2863,7 +2886,7 @@ protected:
search_using_module_spec = true;
module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue();
}
-
+
if (m_uuid_option_group.GetOptionValue().OptionWasSet())
{
search_using_module_spec = true;
@@ -2872,7 +2895,6 @@ protected:
if (search_using_module_spec)
{
-
ModuleList matching_modules;
const size_t num_matches = target->GetImages().FindModules (module_spec, matching_modules);
@@ -2965,7 +2987,7 @@ protected:
}
}
}
-
+
if (changed)
{
target->ModulesDidLoad (matching_modules);
@@ -3004,7 +3026,7 @@ protected:
else
{
std::string uuid_str;
-
+
if (module_spec.GetFileSpec())
module_spec.GetFileSpec().GetPath (path, sizeof(path));
else
@@ -3044,8 +3066,8 @@ protected:
}
}
return result.Succeeded();
- }
-
+ }
+
OptionGroupOptions m_option_group;
OptionGroupUUID m_uuid_option_group;
OptionGroupFile m_file_option;
@@ -3058,11 +3080,9 @@ protected:
class CommandObjectTargetModulesList : public CommandObjectParsed
{
public:
-
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
m_format_array(),
@@ -3070,12 +3090,12 @@ public:
m_module_addr (LLDB_INVALID_ADDRESS)
{
}
-
+
virtual
~CommandOptions ()
{
}
-
+
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg)
{
@@ -3100,7 +3120,7 @@ public:
}
return error;
}
-
+
void
OptionParsingStarting ()
{
@@ -3108,24 +3128,24 @@ public:
m_use_global_module_list = false;
m_module_addr = LLDB_INVALID_ADDRESS;
}
-
+
const OptionDefinition*
GetDefinitions ()
{
return g_option_table;
}
-
+
// Options table: Required for subclasses of Options.
-
+
static OptionDefinition g_option_table[];
-
+
// Instance variables to hold the values for command options.
typedef std::vector< std::pair<char, uint32_t> > FormatWidthCollection;
FormatWidthCollection m_format_array;
bool m_use_global_module_list;
lldb::addr_t m_module_addr;
};
-
+
CommandObjectTargetModulesList (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"target modules list",
@@ -3134,19 +3154,19 @@ public:
m_options (interpreter)
{
}
-
+
virtual
~CommandObjectTargetModulesList ()
{
}
-
+
virtual
Options *
GetOptions ()
{
return &m_options;
}
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -3174,7 +3194,7 @@ protected:
}
// Dump all sections for all modules images
Stream &strm = result.GetOutputStream();
-
+
if (m_options.m_module_addr != LLDB_INVALID_ADDRESS)
{
if (target)
@@ -3207,7 +3227,7 @@ protected:
}
return result.Succeeded();
}
-
+
size_t num_modules = 0;
Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-NULL.
// Otherwise it will lock the AllocationModuleCollectionMutex when accessing
@@ -3243,10 +3263,10 @@ protected:
}
}
}
-
+
module_list_ptr = &module_list;
}
-
+
if (module_list_ptr != NULL)
{
locker.Lock(module_list_ptr->GetMutex());
@@ -3254,7 +3274,7 @@ protected:
}
if (num_modules > 0)
- {
+ {
for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
ModuleSP module_sp;
@@ -3269,7 +3289,7 @@ protected:
module = Module::GetAllocatedModuleAtIndex(image_idx);
module_sp = module->shared_from_this();
}
-
+
const size_t indent = strm.Printf("[%3u] ", image_idx);
PrintModule (target, module, indent, strm);
@@ -3308,7 +3328,7 @@ protected:
strm.PutCString("Null module");
return;
}
-
+
bool dump_object_name = false;
if (m_options.m_format_array.empty())
{
@@ -3331,25 +3351,25 @@ protected:
case 'A':
DumpModuleArchitecture (strm, module, false, width);
break;
-
+
case 't':
DumpModuleArchitecture (strm, module, true, width);
break;
-
+
case 'f':
DumpFullpath (strm, &module->GetFileSpec(), width);
dump_object_name = true;
break;
-
+
case 'd':
DumpDirectory (strm, &module->GetFileSpec(), width);
break;
-
+
case 'b':
DumpBasename (strm, &module->GetFileSpec(), width);
dump_object_name = true;
break;
-
+
case 'h':
case 'o':
// Image header address
@@ -3402,9 +3422,9 @@ protected:
ref_count = module_sp.use_count() - 1;
}
if (width)
- strm.Printf("{%*zu}", width, ref_count);
+ strm.Printf("{%*" PRIu64 "}", width, (uint64_t)ref_count);
else
- strm.Printf("{%zu}", ref_count);
+ strm.Printf("{%" PRIu64 "}", (uint64_t)ref_count);
}
break;
@@ -3437,23 +3457,23 @@ protected:
strm.Printf("%.*s", width, "<NONE>");
}
break;
-
+
case 'm':
module->GetModificationTime().Dump(&strm, width);
break;
case 'p':
- strm.Printf("%p", module);
+ strm.Printf("%p", static_cast<void*>(module));
break;
case 'u':
DumpModuleUUID(strm, module);
break;
-
+
default:
break;
}
-
+
}
if (dump_object_name)
{
@@ -3463,29 +3483,29 @@ protected:
}
strm.EOL();
}
-
+
CommandOptions m_options;
};
OptionDefinition
CommandObjectTargetModulesList::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeAddressOrExpression, "Display the image at this address."},
- { LLDB_OPT_SET_1, false, "arch", 'A', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the architecture when listing images."},
- { LLDB_OPT_SET_1, false, "triple", 't', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the triple when listing images."},
- { LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Display the image header address as a load address if debugging, a file address otherwise."},
- { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Display the image header address offset from the header file address (the slide amount)."},
- { LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Display the UUID when listing images."},
- { LLDB_OPT_SET_1, false, "fullpath", 'f', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the fullpath to the image object file."},
- { LLDB_OPT_SET_1, false, "directory", 'd', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the directory with optional width for the image object file."},
- { LLDB_OPT_SET_1, false, "basename", 'b', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the basename with optional width for the image object file."},
- { LLDB_OPT_SET_1, false, "symfile", 's', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the fullpath to the image symbol file with optional width."},
- { LLDB_OPT_SET_1, false, "symfile-unique", 'S', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the symbol file with optional width only if it is different from the executable object file."},
- { LLDB_OPT_SET_1, false, "mod-time", 'm', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the modification time with optional width of the module."},
- { LLDB_OPT_SET_1, false, "ref-count", 'r', OptionParser::eOptionalArgument, NULL, 0, eArgTypeWidth, "Display the reference count if the module is still in the shared module cache."},
- { LLDB_OPT_SET_1, false, "pointer", 'p', OptionParser::eOptionalArgument, NULL, 0, eArgTypeNone, "Display the module pointer."},
- { LLDB_OPT_SET_1, false, "global", 'g', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Display the modules from the global module list, not just the current target."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Display the image at this address."},
+ { LLDB_OPT_SET_1, false, "arch", 'A', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the architecture when listing images."},
+ { LLDB_OPT_SET_1, false, "triple", 't', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the triple when listing images."},
+ { LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Display the image header address as a load address if debugging, a file address otherwise."},
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Display the image header address offset from the header file address (the slide amount)."},
+ { LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Display the UUID when listing images."},
+ { LLDB_OPT_SET_1, false, "fullpath", 'f', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the fullpath to the image object file."},
+ { LLDB_OPT_SET_1, false, "directory", 'd', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the directory with optional width for the image object file."},
+ { LLDB_OPT_SET_1, false, "basename", 'b', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the basename with optional width for the image object file."},
+ { LLDB_OPT_SET_1, false, "symfile", 's', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the fullpath to the image symbol file with optional width."},
+ { LLDB_OPT_SET_1, false, "symfile-unique", 'S', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the symbol file with optional width only if it is different from the executable object file."},
+ { LLDB_OPT_SET_1, false, "mod-time", 'm', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the modification time with optional width of the module."},
+ { LLDB_OPT_SET_1, false, "ref-count", 'r', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeWidth, "Display the reference count if the module is still in the shared module cache."},
+ { LLDB_OPT_SET_1, false, "pointer", 'p', OptionParser::eOptionalArgument, NULL, NULL, 0, eArgTypeNone, "Display the module pointer."},
+ { LLDB_OPT_SET_1, false, "global", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Display the modules from the global module list, not just the current target."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectTargetModulesShowUnwind
@@ -3584,7 +3604,7 @@ public:
std::string m_str; // Holds name lookup
lldb::addr_t m_addr; // Holds the address to lookup
};
-
+
CommandObjectTargetModulesShowUnwind (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"target modules show-unwind",
@@ -3597,12 +3617,12 @@ public:
m_options (interpreter)
{
}
-
+
virtual
~CommandObjectTargetModulesShowUnwind ()
{
}
-
+
virtual
Options *
GetOptions ()
@@ -3645,7 +3665,7 @@ protected:
}
SymbolContextList sc_list;
-
+
if (m_options.m_type == eLookupTypeFunctionOrSymbol)
{
ConstString function_name (m_options.m_str.c_str());
@@ -3711,7 +3731,7 @@ protected:
result.GetOutputStream().Printf ("\n");
}
- UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*thread.get());
+ UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread.get(), -1);
if (non_callsite_unwind_plan.get())
{
result.GetOutputStream().Printf("Asynchronous (not restricted to call-sites) UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
@@ -3755,9 +3775,9 @@ protected:
OptionDefinition
CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."},
- { LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."},
+ { LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
//----------------------------------------------------------------------
@@ -3766,7 +3786,6 @@ CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] =
class CommandObjectTargetModulesLookup : public CommandObjectParsed
{
public:
-
enum
{
eLookupTypeInvalid = -1,
@@ -3778,29 +3797,28 @@ public:
eLookupTypeType,
kNumLookupTypes
};
-
+
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
OptionParsingStarting();
}
-
+
virtual
~CommandOptions ()
{
}
-
+
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg)
{
Error error;
-
+
const int short_option = m_getopt_table[option_idx].val;
-
+
switch (short_option)
{
case 'a':
@@ -3810,27 +3828,27 @@ public:
m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
}
break;
-
+
case 'o':
m_offset = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS);
if (m_offset == LLDB_INVALID_ADDRESS)
error.SetErrorStringWithFormat ("invalid offset string '%s'", option_arg);
break;
-
+
case 's':
m_str = option_arg;
m_type = eLookupTypeSymbol;
break;
-
+
case 'f':
m_file.SetFile (option_arg, false);
m_type = eLookupTypeFileLine;
break;
-
+
case 'i':
m_include_inlines = false;
break;
-
+
case 'l':
m_line_number = Args::StringToUInt32(option_arg, UINT32_MAX);
if (m_line_number == UINT32_MAX)
@@ -3839,12 +3857,12 @@ public:
error.SetErrorString ("zero is an invalid line number");
m_type = eLookupTypeFileLine;
break;
-
+
case 'F':
m_str = option_arg;
m_type = eLookupTypeFunction;
break;
-
+
case 'n':
m_str = option_arg;
m_type = eLookupTypeFunctionOrSymbol;
@@ -3854,23 +3872,23 @@ public:
m_str = option_arg;
m_type = eLookupTypeType;
break;
-
+
case 'v':
m_verbose = 1;
break;
-
+
case 'A':
m_print_all = true;
break;
-
+
case 'r':
m_use_regex = true;
break;
}
-
+
return error;
}
-
+
void
OptionParsingStarting ()
{
@@ -3885,15 +3903,15 @@ public:
m_verbose = false;
m_print_all = false;
}
-
+
const OptionDefinition*
GetDefinitions ()
{
return g_option_table;
}
-
+
// Options table: Required for subclasses of Options.
-
+
static OptionDefinition g_option_table[];
int m_type; // Should be a eLookupTypeXXX enum after parsing options
std::string m_str; // Holds name lookup
@@ -3905,9 +3923,8 @@ public:
bool m_include_inlines;// Check for inline entries when looking up by file/line.
bool m_verbose; // Enable verbose lookup info
bool m_print_all; // Print all matches, even in cases where there's a best match.
-
};
-
+
CommandObjectTargetModulesLookup (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"target modules lookup",
@@ -3918,29 +3935,29 @@ public:
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
-
+
// Define the first (and only) variant of this arg.
file_arg.arg_type = eArgTypeFilename;
file_arg.arg_repetition = eArgRepeatStar;
-
+
// There is only one variant this argument could be; put it into the argument entry.
arg.push_back (file_arg);
-
+
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
-
+
virtual
~CommandObjectTargetModulesLookup ()
{
}
-
+
virtual Options *
GetOptions ()
{
return &m_options;
}
-
+
bool
LookupHere (CommandInterpreter &interpreter, CommandReturnObject &result, bool &syntax_error)
{
@@ -3956,17 +3973,17 @@ public:
case eLookupTypeType:
break;
}
-
+
StackFrameSP frame = m_exe_ctx.GetFrameSP();
-
+
if (!frame)
return false;
-
+
const SymbolContext &sym_ctx(frame->GetSymbolContext(eSymbolContextModule));
-
+
if (!sym_ctx.module_sp)
return false;
-
+
switch (m_options.m_type)
{
default:
@@ -3986,10 +4003,10 @@ public:
}
break;
}
-
+
return true;
}
-
+
bool
LookupInModule (CommandInterpreter &interpreter, Module *module, CommandReturnObject &result, bool &syntax_error)
{
@@ -4011,7 +4028,7 @@ public:
}
}
break;
-
+
case eLookupTypeSymbol:
if (!m_options.m_str.empty())
{
@@ -4027,11 +4044,10 @@ public:
}
}
break;
-
+
case eLookupTypeFileLine:
if (m_options.m_file)
{
-
if (LookupFileAndLineInModule (m_interpreter,
result.GetOutputStream(),
module,
@@ -4064,8 +4080,7 @@ public:
}
}
break;
-
-
+
case eLookupTypeType:
if (!m_options.m_str.empty())
{
@@ -4080,17 +4095,17 @@ public:
}
}
break;
-
+
default:
m_options.GenerateOptionUsage (result.GetErrorStream(), this);
syntax_error = true;
break;
}
-
+
result.SetStatus (eReturnStatusFailed);
return false;
}
-
+
protected:
virtual bool
DoExecute (Args& command,
@@ -4112,11 +4127,11 @@ protected:
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
// Dump all sections for all modules images
-
+
if (command.GetArgumentCount() == 0)
{
ModuleSP current_module;
-
+
// Where it is possible to look in the current symbol context
// first, try that. If this search was successful and --all
// was not passed, don't print anything else.
@@ -4130,9 +4145,9 @@ protected:
return result.Succeeded();
}
}
-
+
// Dump all sections for all other modules
-
+
const ModuleList &target_modules = target->GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
const size_t num_modules = target_modules.GetSize();
@@ -4141,7 +4156,7 @@ protected:
for (i = 0; i<num_modules && syntax_error == false; ++i)
{
Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i);
-
+
if (module_pointer != current_module.get() &&
LookupInModule (m_interpreter, target_modules.GetModulePointerAtIndexUnlocked(i), result, syntax_error))
{
@@ -4184,7 +4199,7 @@ protected:
result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
}
}
-
+
if (num_successful_lookups > 0)
result.SetStatus (eReturnStatusSuccessFinishResult);
else
@@ -4192,29 +4207,29 @@ protected:
}
return result.Succeeded();
}
-
+
CommandOptions m_options;
};
OptionDefinition
CommandObjectTargetModulesLookup::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, true, "address", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeAddressOrExpression, "Lookup an address in one or more target modules."},
- { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
+ { LLDB_OPT_SET_1, true, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Lookup an address in one or more target modules."},
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
{ LLDB_OPT_SET_2| LLDB_OPT_SET_4 | LLDB_OPT_SET_5
/* FIXME: re-enable this for types when the LookupTypeInModule actually uses the regex option: | LLDB_OPT_SET_6 */ ,
- false, "regex", 'r', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
- { LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."},
- { LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."},
- { LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
+ false, "regex", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
+ { LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."},
+ { LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."},
+ { LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
{ LLDB_OPT_SET_FROM_TO(3,5),
- false, "no-inlines", 'i', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."},
- { LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."},
- { LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."},
- { LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."},
- { LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Enable verbose lookup information."},
- { LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ false, "no-inlines", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."},
+ { LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."},
+ { LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."},
+ { LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."},
+ { LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable verbose lookup information."},
+ { LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."},
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -4227,7 +4242,6 @@ CommandObjectTargetModulesLookup::CommandOptions::g_option_table[] =
class CommandObjectTargetModulesImageSearchPaths : public CommandObjectMultiword
{
public:
-
CommandObjectTargetModulesImageSearchPaths (CommandInterpreter &interpreter) :
CommandObjectMultiword (interpreter,
"target modules search-paths",
@@ -4240,7 +4254,7 @@ public:
LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetModulesSearchPathsList (interpreter)));
LoadSubCommand ("query", CommandObjectSP (new CommandObjectTargetModulesSearchPathsQuery (interpreter)));
}
-
+
~CommandObjectTargetModulesImageSearchPaths()
{
}
@@ -4279,7 +4293,7 @@ public:
~CommandObjectTargetModules()
{
}
-
+
private:
//------------------------------------------------------------------
// For CommandObjectTargetModules only
@@ -4307,12 +4321,12 @@ public:
m_option_group.Append (&m_current_frame_option, LLDB_OPT_SET_2, LLDB_OPT_SET_2);
m_option_group.Finalize();
}
-
+
virtual
~CommandObjectTargetSymbolsAdd ()
{
}
-
+
virtual int
HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -4325,7 +4339,7 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
-
+
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
@@ -4336,16 +4350,14 @@ public:
matches);
return matches.GetSize();
}
-
+
virtual Options *
GetOptions ()
{
return &m_option_group;
}
-
protected:
-
bool
AddModuleSymbols (Target *target,
ModuleSpec &module_spec,
@@ -4357,7 +4369,7 @@ protected:
{
char symfile_path[PATH_MAX];
symbol_fspec.GetPath (symfile_path, sizeof(symfile_path));
-
+
if (!module_spec.GetUUID().IsValid())
{
if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
@@ -4368,7 +4380,7 @@ protected:
// current target, so we need to find that module in the
// target
ModuleList matching_module_list;
-
+
size_t num_matches = 0;
// First extract all module specs from the symbol file
lldb_private::ModuleSpecList symfile_module_specs;
@@ -4389,7 +4401,7 @@ protected:
num_matches = target->GetImages().FindModules (symfile_uuid_module_spec, matching_module_list);
}
}
-
+
if (num_matches == 0)
{
// No matches yet, iterate through the module specs to find a UUID value that
@@ -4405,7 +4417,7 @@ protected:
ModuleSpec symfile_uuid_module_spec;
symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID();
num_matches = target->GetImages().FindModules (symfile_uuid_module_spec, matching_module_list);
- }
+ }
}
}
}
@@ -4414,23 +4426,22 @@ protected:
// Just try to match up the file by basename if we have no matches at this point
if (num_matches == 0)
num_matches = target->GetImages().FindModules (module_spec, matching_module_list);
-
+
while (num_matches == 0)
{
ConstString filename_no_extension(module_spec.GetFileSpec().GetFileNameStrippingExtension());
// Empty string returned, lets bail
if (!filename_no_extension)
break;
-
+
// Check if there was no extension to strip and the basename is the same
if (filename_no_extension == module_spec.GetFileSpec().GetFilename())
break;
-
+
// Replace basename with one less extension
module_spec.GetFileSpec().GetFilename() = filename_no_extension;
-
+
num_matches = target->GetImages().FindModules (module_spec, matching_module_list);
-
}
if (num_matches > 1)
@@ -4440,21 +4451,21 @@ protected:
else if (num_matches == 1)
{
ModuleSP module_sp (matching_module_list.GetModuleAtIndex(0));
-
+
// The module has not yet created its symbol vendor, we can just
// give the existing target module the symfile path to use for
// when it decides to create it!
module_sp->SetSymbolFileFileSpec (symbol_fspec);
-
+
SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(true, &result.GetErrorStream());
if (symbol_vendor)
{
SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();
-
+
if (symbol_file)
{
ObjectFile *object_file = symbol_file->GetObjectFile();
-
+
if (object_file && object_file->GetFileSpec() == symbol_fspec)
{
// Provide feedback that the symfile has been successfully added.
@@ -4462,13 +4473,13 @@ protected:
result.AppendMessageWithFormat("symbol file '%s' has been added to '%s'\n",
symfile_path,
module_fs.GetPath().c_str());
-
+
// Let clients know something changed in the module
// if it is currently loaded
ModuleList module_list;
module_list.Append (module_sp);
target->SymbolsDidLoad (module_list);
-
+
// Make sure we load any scripting resources that may be embedded
// in the debug info files in case the platform supports that.
Error error;
@@ -4674,7 +4685,7 @@ protected:
if (platform_sp->ResolveSymbolFile(*target, module_spec, symfile_spec).Success())
module_spec.GetSymbolFileSpec() = symfile_spec;
}
-
+
ArchSpec arch;
bool symfile_exists = module_spec.GetSymbolFileSpec().Exists();
@@ -4710,13 +4721,11 @@ protected:
}
return result.Succeeded();
}
-
+
OptionGroupOptions m_option_group;
OptionGroupUUID m_uuid_option_group;
OptionGroupFile m_file_option;
OptionGroupBoolean m_current_frame_option;
-
-
};
@@ -4739,13 +4748,13 @@ public:
"target symbols <sub-command> ...")
{
LoadSubCommand ("add", CommandObjectSP (new CommandObjectTargetSymbolsAdd (interpreter)));
-
+
}
virtual
~CommandObjectTargetSymbols()
{
}
-
+
private:
//------------------------------------------------------------------
// For CommandObjectTargetModules only
@@ -4780,9 +4789,9 @@ public:
m_one_liner()
{
}
-
+
~CommandOptions () {}
-
+
const OptionDefinition*
GetDefinitions ()
{
@@ -4802,7 +4811,7 @@ public:
m_class_name = option_arg;
m_sym_ctx_specified = true;
break;
-
+
case 'e':
m_line_end = Args::StringToUInt32 (option_arg, UINT_MAX, 0, &success);
if (!success)
@@ -4812,7 +4821,7 @@ public:
}
m_sym_ctx_specified = true;
break;
-
+
case 'l':
m_line_start = Args::StringToUInt32 (option_arg, 0, 0, &success);
if (!success)
@@ -4822,17 +4831,17 @@ public:
}
m_sym_ctx_specified = true;
break;
-
+
case 'i':
m_no_inlines = true;
break;
-
+
case 'n':
m_function_name = option_arg;
m_func_name_type_mask |= eFunctionNameTypeAuto;
m_sym_ctx_specified = true;
break;
-
+
case 'f':
m_file_name = option_arg;
m_sym_ctx_specified = true;
@@ -4890,7 +4899,7 @@ public:
m_thread_index = UINT32_MAX;
m_thread_name.clear();
m_queue_name.clear();
-
+
m_no_inlines = false;
m_sym_ctx_specified = false;
m_thread_specified = false;
@@ -4899,9 +4908,9 @@ public:
m_one_liner.clear();
}
-
+
static OptionDefinition g_option_table[];
-
+
std::string m_class_name;
std::string m_function_name;
uint32_t m_line_start;
@@ -4942,7 +4951,6 @@ public:
}
protected:
-
virtual void
IOHandlerActivated (IOHandler &io_handler)
{
@@ -4953,8 +4961,7 @@ protected:
output_sp->Flush();
}
}
-
-
+
virtual void
IOHandlerInputComplete (IOHandler &io_handler, std::string &line)
{
@@ -4986,12 +4993,12 @@ protected:
}
io_handler.SetIsDone(true);
}
-
+
bool
DoExecute (Args& command, CommandReturnObject &result)
{
m_stop_hook_sp.reset();
-
+
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target)
{
@@ -5002,63 +5009,63 @@ protected:
if (m_options.m_sym_ctx_specified)
{
specifier_ap.reset(new SymbolContextSpecifier(m_interpreter.GetDebugger().GetSelectedTarget()));
-
+
if (!m_options.m_module_name.empty())
{
specifier_ap->AddSpecification (m_options.m_module_name.c_str(), SymbolContextSpecifier::eModuleSpecified);
}
-
+
if (!m_options.m_class_name.empty())
{
specifier_ap->AddSpecification (m_options.m_class_name.c_str(), SymbolContextSpecifier::eClassOrNamespaceSpecified);
}
-
+
if (!m_options.m_file_name.empty())
{
specifier_ap->AddSpecification (m_options.m_file_name.c_str(), SymbolContextSpecifier::eFileSpecified);
}
-
+
if (m_options.m_line_start != 0)
{
specifier_ap->AddLineSpecification (m_options.m_line_start, SymbolContextSpecifier::eLineStartSpecified);
}
-
+
if (m_options.m_line_end != UINT_MAX)
{
specifier_ap->AddLineSpecification (m_options.m_line_end, SymbolContextSpecifier::eLineEndSpecified);
}
-
+
if (!m_options.m_function_name.empty())
{
specifier_ap->AddSpecification (m_options.m_function_name.c_str(), SymbolContextSpecifier::eFunctionSpecified);
}
}
-
+
if (specifier_ap.get())
new_hook_sp->SetSpecifier (specifier_ap.release());
// Next see if any of the thread options have been entered:
-
+
if (m_options.m_thread_specified)
{
ThreadSpec *thread_spec = new ThreadSpec();
-
+
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
{
thread_spec->SetTID (m_options.m_thread_id);
}
-
+
if (m_options.m_thread_index != UINT32_MAX)
thread_spec->SetIndex (m_options.m_thread_index);
-
+
if (!m_options.m_thread_name.empty())
thread_spec->SetName (m_options.m_thread_name.c_str());
-
+
if (!m_options.m_queue_name.empty())
thread_spec->SetQueueName (m_options.m_queue_name.c_str());
-
+
new_hook_sp->SetThreadSpecifier (thread_spec);
-
+
}
if (m_options.m_use_one_liner)
{
@@ -5082,7 +5089,7 @@ protected:
result.AppendError ("invalid target\n");
result.SetStatus (eReturnStatusFailed);
}
-
+
return result.Succeeded();
}
private:
@@ -5093,29 +5100,29 @@ private:
OptionDefinition
CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeOneLiner,
+ { LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName,
+ { LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName,
"Set the module within which the stop-hook is to be run."},
- { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadIndex,
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadIndex,
"The stop hook is run only for the thread whose index matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadID,
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadID,
"The stop hook is run only for the thread whose TID matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, 0, eArgTypeThreadName,
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadName,
"The stop hook is run only for the thread whose thread name matches this argument."},
- { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, NULL, 0, eArgTypeQueueName,
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeQueueName,
"The stop hook is run only for threads in the queue whose name is given by this argument."},
- { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
"Specify the source file within which the stop-hook is to be run." },
- { LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum,
+ { LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
"Set the start of the line range for which the stop-hook is to be run."},
- { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeLineNum,
+ { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
"Set the end of the line range for which the stop-hook is to be run."},
- { LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeClassName,
+ { LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeClassName,
"Specify the class within which the stop-hook is to be run." },
- { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
+ { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
"Set the function name within which the stop hook will be run." },
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectTargetStopHookDelete
@@ -5189,7 +5196,7 @@ protected:
result.AppendError ("invalid target\n");
result.SetStatus (eReturnStatusFailed);
}
-
+
return result.Succeeded();
}
};
@@ -5226,7 +5233,7 @@ protected:
// FIXME: see if we can use the breakpoint id style parser?
size_t num_args = command.GetArgumentCount();
bool success;
-
+
if (num_args == 0)
{
target->SetAllStopHooksActiveState (m_enable);
@@ -5297,7 +5304,7 @@ protected:
result.SetStatus (eReturnStatusFailed);
return result.Succeeded();
}
-
+
size_t num_hooks = target->GetNumStopHooks ();
if (num_hooks == 0)
{
@@ -5367,7 +5374,7 @@ CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter &
"A set of commands for operating on debugger targets.",
"target <subcommand> [<subcommand-options>]")
{
-
+
LoadSubCommand ("create", CommandObjectSP (new CommandObjectTargetCreate (interpreter)));
LoadSubCommand ("delete", CommandObjectSP (new CommandObjectTargetDelete (interpreter)));
LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetList (interpreter)));
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 10d661882c92..e7a8652ac898 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -305,10 +305,10 @@ protected:
OptionDefinition
CommandObjectThreadBacktrace::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "How many frames to display (-1 for all)"},
-{ LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace"},
-{ LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Show the extended backtrace, if available"},
-{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "How many frames to display (-1 for all)"},
+{ LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace"},
+{ LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Show the extended backtrace, if available"},
+{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
enum StepScope
@@ -348,12 +348,37 @@ public:
case 'a':
{
bool success;
- m_avoid_no_debug = Args::StringToBoolean (option_arg, true, &success);
+ bool avoid_no_debug = Args::StringToBoolean (option_arg, true, &success);
if (!success)
error.SetErrorStringWithFormat("invalid boolean value for option '%c'", short_option);
+ else
+ {
+ m_step_in_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : eLazyBoolNo;
+ }
+ }
+ break;
+
+ case 'A':
+ {
+ bool success;
+ bool avoid_no_debug = Args::StringToBoolean (option_arg, true, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("invalid boolean value for option '%c'", short_option);
+ else
+ {
+ m_step_out_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : eLazyBoolNo;
+ }
}
break;
+ case 'c':
+ {
+ m_step_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
+ if (m_step_count == UINT32_MAX)
+ error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
+ break;
+ }
+ break;
case 'm':
{
OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values;
@@ -386,10 +411,12 @@ public:
void
OptionParsingStarting ()
{
- m_avoid_no_debug = true;
+ m_step_in_avoid_no_debug = eLazyBoolCalculate;
+ m_step_out_avoid_no_debug = eLazyBoolCalculate;
m_run_mode = eOnlyDuringStepping;
m_avoid_regexp.clear();
m_step_in_target.clear();
+ m_step_count = 1;
}
const OptionDefinition*
@@ -403,10 +430,12 @@ public:
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
- bool m_avoid_no_debug;
+ LazyBool m_step_in_avoid_no_debug;
+ LazyBool m_step_out_avoid_no_debug;
RunMode m_run_mode;
std::string m_avoid_regexp;
std::string m_step_in_target;
+ int32_t m_step_count;
};
CommandObjectThreadStepWithTypeAndScope (CommandInterpreter &interpreter,
@@ -522,7 +551,9 @@ protected:
frame->GetSymbolContext(eSymbolContextEverything),
m_options.m_step_in_target.c_str(),
stop_other_threads,
- m_options.m_avoid_no_debug);
+ m_options.m_step_in_avoid_no_debug,
+ m_options.m_step_out_avoid_no_debug);
+
if (new_plan_sp && !m_options.m_avoid_regexp.empty())
{
ThreadPlanStepInRange *step_in_range_plan = static_cast<ThreadPlanStepInRange *> (new_plan_sp.get());
@@ -541,7 +572,8 @@ protected:
new_plan_sp = thread->QueueThreadPlanForStepOverRange (abort_other_plans,
frame->GetSymbolContext(eSymbolContextEverything).line_entry.range,
frame->GetSymbolContext(eSymbolContextEverything),
- stop_other_threads);
+ stop_other_threads,
+ m_options.m_step_out_avoid_no_debug);
else
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true,
abort_other_plans,
@@ -564,7 +596,8 @@ protected:
bool_stop_other_threads,
eVoteYes,