summaryrefslogtreecommitdiff
path: root/include/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb')
-rw-r--r--include/lldb/API/LLDB.h20
-rw-r--r--include/lldb/API/SBAttachInfo.h75
-rw-r--r--include/lldb/API/SBCommandInterpreter.h30
-rw-r--r--include/lldb/API/SBCommandReturnObject.h20
-rw-r--r--include/lldb/API/SBDebugger.h36
-rw-r--r--include/lldb/API/SBDefines.h2
-rw-r--r--include/lldb/API/SBFunction.h6
-rw-r--r--include/lldb/API/SBProcess.h54
-rw-r--r--include/lldb/API/SBStream.h4
-rw-r--r--include/lldb/API/SBTarget.h70
-rw-r--r--include/lldb/API/SBType.h13
-rw-r--r--include/lldb/API/SBTypeCategory.h9
-rw-r--r--include/lldb/API/SBTypeSummary.h15
-rw-r--r--include/lldb/API/SBValue.h12
-rw-r--r--include/lldb/API/SystemInitializerFull.h8
-rw-r--r--include/lldb/Breakpoint/Breakpoint.h61
-rw-r--r--include/lldb/Breakpoint/BreakpointLocation.h28
-rw-r--r--include/lldb/Breakpoint/BreakpointLocationList.h23
-rw-r--r--include/lldb/Breakpoint/BreakpointOptions.h31
-rw-r--r--include/lldb/Breakpoint/BreakpointResolver.h9
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverAddress.h17
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverFileLine.h5
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverFileRegex.h5
-rw-r--r--include/lldb/Breakpoint/BreakpointResolverName.h11
-rw-r--r--include/lldb/Breakpoint/BreakpointSite.h25
-rw-r--r--include/lldb/Breakpoint/Watchpoint.h58
-rw-r--r--include/lldb/Breakpoint/WatchpointOptions.h27
-rw-r--r--include/lldb/Core/Address.h23
-rw-r--r--include/lldb/Core/AddressRange.h8
-rw-r--r--include/lldb/Core/AddressResolver.h9
-rw-r--r--include/lldb/Core/AddressResolverFileLine.h17
-rw-r--r--include/lldb/Core/AddressResolverName.h17
-rw-r--r--include/lldb/Core/ArchSpec.h44
-rw-r--r--include/lldb/Core/Broadcaster.h24
-rw-r--r--include/lldb/Core/ClangForward.h2
-rw-r--r--include/lldb/Core/Communication.h29
-rw-r--r--include/lldb/Core/Connection.h12
-rw-r--r--include/lldb/Core/ConnectionSharedMemory.h31
-rw-r--r--include/lldb/Core/ConstString.h46
-rw-r--r--include/lldb/Core/DataBufferHeap.h19
-rw-r--r--include/lldb/Core/DataBufferMemoryMap.h20
-rw-r--r--include/lldb/Core/DataEncoder.h2
-rw-r--r--include/lldb/Core/DataExtractor.h104
-rw-r--r--include/lldb/Core/Debugger.h111
-rw-r--r--include/lldb/Core/Disassembler.h36
-rw-r--r--include/lldb/Core/EmulateInstruction.h21
-rw-r--r--include/lldb/Core/Event.h24
-rw-r--r--include/lldb/Core/FileLineResolver.h17
-rw-r--r--include/lldb/Core/FormatEntity.h24
-rw-r--r--include/lldb/Core/History.h39
-rw-r--r--include/lldb/Core/IOHandler.h86
-rw-r--r--include/lldb/Core/Language.h117
-rw-r--r--include/lldb/Core/Listener.h39
-rw-r--r--include/lldb/Core/Log.h8
-rw-r--r--include/lldb/Core/Logging.h1
-rw-r--r--include/lldb/Core/MappedHash.h47
-rw-r--r--include/lldb/Core/Module.h96
-rw-r--r--include/lldb/Core/ModuleList.h32
-rw-r--r--include/lldb/Core/ModuleSpec.h64
-rw-r--r--include/lldb/Core/Opcode.h18
-rw-r--r--include/lldb/Core/PluginManager.h178
-rw-r--r--include/lldb/Core/RangeMap.h174
-rw-r--r--include/lldb/Core/RegisterValue.h131
-rw-r--r--include/lldb/Core/RegularExpression.h21
-rw-r--r--include/lldb/Core/STLUtils.h26
-rw-r--r--include/lldb/Core/Scalar.h123
-rw-r--r--include/lldb/Core/SearchFilter.h17
-rw-r--r--include/lldb/Core/Section.h43
-rw-r--r--include/lldb/Core/SourceManager.h66
-rw-r--r--include/lldb/Core/Stream.h28
-rw-r--r--include/lldb/Core/StreamAsynchronousIO.h14
-rw-r--r--include/lldb/Core/StreamCallback.h14
-rw-r--r--include/lldb/Core/StreamFile.h13
-rw-r--r--include/lldb/Core/StreamGDBRemote.h5
-rw-r--r--include/lldb/Core/StreamString.h15
-rw-r--r--include/lldb/Core/StreamTee.h15
-rw-r--r--include/lldb/Core/StringList.h15
-rw-r--r--include/lldb/Core/StructuredData.h228
-rw-r--r--include/lldb/Core/ThreadSafeDenseMap.h22
-rw-r--r--include/lldb/Core/ThreadSafeDenseSet.h7
-rw-r--r--include/lldb/Core/Timer.h43
-rw-r--r--include/lldb/Core/UUID.h5
-rw-r--r--include/lldb/Core/UniqueCStringMap.h30
-rw-r--r--include/lldb/Core/Value.h41
-rw-r--r--include/lldb/Core/ValueObject.h173
-rw-r--r--include/lldb/Core/ValueObjectCast.h66
-rw-r--r--include/lldb/Core/ValueObjectChild.h77
-rw-r--r--include/lldb/Core/ValueObjectConstResult.h103
-rw-r--r--include/lldb/Core/ValueObjectConstResultCast.h76
-rw-r--r--include/lldb/Core/ValueObjectConstResultChild.h39
-rw-r--r--include/lldb/Core/ValueObjectConstResultImpl.h29
-rw-r--r--include/lldb/Core/ValueObjectDynamicValue.h135
-rw-r--r--include/lldb/Core/ValueObjectList.h1
-rw-r--r--include/lldb/Core/ValueObjectMemory.h51
-rw-r--r--include/lldb/Core/ValueObjectRegister.h138
-rw-r--r--include/lldb/Core/ValueObjectSyntheticFilter.h170
-rw-r--r--include/lldb/Core/ValueObjectVariable.h75
-rw-r--r--include/lldb/Core/dwarf.h6
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h375
-rw-r--r--include/lldb/DataFormatters/CXXFunctionPointer.h23
-rw-r--r--include/lldb/DataFormatters/DataVisualization.h25
-rw-r--r--include/lldb/DataFormatters/DumpValueObjectOptions.h185
-rw-r--r--include/lldb/DataFormatters/FormatCache.h1
-rw-r--r--include/lldb/DataFormatters/FormatClasses.h84
-rw-r--r--include/lldb/DataFormatters/FormatManager.h165
-rw-r--r--include/lldb/DataFormatters/FormattersContainer.h70
-rw-r--r--include/lldb/DataFormatters/FormattersHelpers.h279
-rw-r--r--include/lldb/DataFormatters/LanguageCategory.h99
-rw-r--r--include/lldb/DataFormatters/StringPrinter.h765
-rw-r--r--include/lldb/DataFormatters/TypeCategory.h302
-rw-r--r--include/lldb/DataFormatters/TypeCategoryMap.h37
-rw-r--r--include/lldb/DataFormatters/TypeFormat.h43
-rw-r--r--include/lldb/DataFormatters/TypeSummary.h190
-rw-r--r--include/lldb/DataFormatters/TypeSynthetic.h199
-rw-r--r--include/lldb/DataFormatters/TypeValidator.h20
-rw-r--r--include/lldb/DataFormatters/ValueObjectPrinter.h282
-rw-r--r--include/lldb/DataFormatters/VectorIterator.h53
-rw-r--r--include/lldb/Expression/ASTDumper.h43
-rw-r--r--include/lldb/Expression/ASTResultSynthesizer.h184
-rw-r--r--include/lldb/Expression/ASTStructExtractor.h156
-rw-r--r--include/lldb/Expression/ClangASTSource.h525
-rw-r--r--include/lldb/Expression/ClangExpressionDeclMap.h705
-rw-r--r--include/lldb/Expression/ClangExpressionVariable.h456
-rw-r--r--include/lldb/Expression/ClangModulesDeclVendor.h129
-rw-r--r--include/lldb/Expression/ClangPersistentVariables.h91
-rw-r--r--include/lldb/Expression/DWARFExpression.h45
-rw-r--r--include/lldb/Expression/Expression.h (renamed from include/lldb/Expression/ClangExpression.h)64
-rw-r--r--include/lldb/Expression/ExpressionParser.h (renamed from include/lldb/Expression/ClangExpressionParser.h)89
-rw-r--r--include/lldb/Expression/ExpressionTypeSystemHelper.h54
-rw-r--r--include/lldb/Expression/ExpressionVariable.h320
-rw-r--r--include/lldb/Expression/FunctionCaller.h (renamed from include/lldb/Expression/ClangFunction.h)138
-rw-r--r--include/lldb/Expression/IRDynamicChecks.h20
-rw-r--r--include/lldb/Expression/IRExecutionUnit.h74
-rw-r--r--include/lldb/Expression/IRForTarget.h745
-rw-r--r--include/lldb/Expression/IRInterpreter.h1
-rw-r--r--include/lldb/Expression/IRMemoryMap.h9
-rw-r--r--include/lldb/Expression/IRToDWARF.h111
-rw-r--r--include/lldb/Expression/LLVMUserExpression.h118
-rw-r--r--include/lldb/Expression/Materializer.h73
-rw-r--r--include/lldb/Expression/REPL.h211
-rw-r--r--include/lldb/Expression/UserExpression.h (renamed from include/lldb/Expression/ClangUserExpression.h)220
-rw-r--r--include/lldb/Expression/UtilityFunction.h (renamed from include/lldb/Expression/ClangUtilityFunction.h)93
-rw-r--r--include/lldb/Host/Condition.h25
-rw-r--r--include/lldb/Host/Config.h6
-rw-r--r--include/lldb/Host/Debug.h16
-rw-r--r--include/lldb/Host/Endian.h4
-rw-r--r--include/lldb/Host/File.h82
-rw-r--r--include/lldb/Host/FileSpec.h41
-rw-r--r--include/lldb/Host/FileSystem.h5
-rw-r--r--include/lldb/Host/HostGetOpt.h4
-rw-r--r--include/lldb/Host/HostInfo.h3
-rw-r--r--include/lldb/Host/HostNativeThread.h2
-rw-r--r--include/lldb/Host/HostNativeThreadForward.h3
-rw-r--r--include/lldb/Host/MainLoopBase.h12
-rw-r--r--include/lldb/Host/MonitoringProcessLauncher.h11
-rw-r--r--include/lldb/Host/Mutex.h39
-rw-r--r--include/lldb/Host/OptionParser.h3
-rw-r--r--include/lldb/Host/Predicate.h45
-rw-r--r--include/lldb/Host/ProcessRunLock.h22
-rw-r--r--include/lldb/Host/Socket.h63
-rw-r--r--include/lldb/Host/Symbols.h2
-rw-r--r--include/lldb/Host/XML.h13
-rw-r--r--include/lldb/Host/common/GetOptInc.h65
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h17
-rw-r--r--include/lldb/Host/common/TCPSocket.h46
-rw-r--r--include/lldb/Host/common/UDPSocket.h35
-rw-r--r--include/lldb/Host/netbsd/Config.h28
-rw-r--r--include/lldb/Host/netbsd/HostInfoNetBSD.h30
-rw-r--r--include/lldb/Host/netbsd/HostThreadNetBSD.h32
-rw-r--r--include/lldb/Host/posix/ConnectionFileDescriptorPosix.h15
-rw-r--r--include/lldb/Host/posix/DomainSocket.h37
-rw-r--r--include/lldb/Host/posix/HostProcessPosix.h11
-rw-r--r--include/lldb/Host/posix/HostThreadPosix.h7
-rw-r--r--include/lldb/Host/posix/LockFilePosix.h6
-rw-r--r--include/lldb/Host/posix/MainLoopPosix.h2
-rw-r--r--include/lldb/Initialization/SystemInitializerCommon.h7
-rw-r--r--include/lldb/Interpreter/Args.h3
-rw-r--r--include/lldb/Interpreter/CommandCompletions.h76
-rw-r--r--include/lldb/Interpreter/CommandHistory.h1
-rw-r--r--include/lldb/Interpreter/CommandInterpreter.h82
-rw-r--r--include/lldb/Interpreter/CommandObject.h86
-rw-r--r--include/lldb/Interpreter/CommandObjectMultiword.h229
-rw-r--r--include/lldb/Interpreter/CommandObjectRegexCommand.h6
-rw-r--r--include/lldb/Interpreter/CommandOptionValidators.h13
-rw-r--r--include/lldb/Interpreter/CommandReturnObject.h8
-rw-r--r--include/lldb/Interpreter/OptionGroupArchitecture.h35
-rw-r--r--include/lldb/Interpreter/OptionGroupBoolean.h29
-rw-r--r--include/lldb/Interpreter/OptionGroupFile.h56
-rw-r--r--include/lldb/Interpreter/OptionGroupFormat.h30
-rw-r--r--include/lldb/Interpreter/OptionGroupOutputFile.h30
-rw-r--r--include/lldb/Interpreter/OptionGroupPlatform.h28
-rw-r--r--include/lldb/Interpreter/OptionGroupString.h32
-rw-r--r--include/lldb/Interpreter/OptionGroupUInt64.h33
-rw-r--r--include/lldb/Interpreter/OptionGroupUUID.h28
-rw-r--r--include/lldb/Interpreter/OptionGroupValueObjectDisplay.h47
-rw-r--r--include/lldb/Interpreter/OptionGroupVariable.h28
-rw-r--r--include/lldb/Interpreter/OptionGroupWatchpoint.h32
-rw-r--r--include/lldb/Interpreter/OptionValue.h18
-rw-r--r--include/lldb/Interpreter/OptionValueArch.h41
-rw-r--r--include/lldb/Interpreter/OptionValueArgs.h9
-rw-r--r--include/lldb/Interpreter/OptionValueArray.h41
-rw-r--r--include/lldb/Interpreter/OptionValueBoolean.h41
-rw-r--r--include/lldb/Interpreter/OptionValueChar.h28
-rw-r--r--include/lldb/Interpreter/OptionValueDictionary.h53
-rw-r--r--include/lldb/Interpreter/OptionValueEnumeration.h42
-rw-r--r--include/lldb/Interpreter/OptionValueFileSpec.h41
-rw-r--r--include/lldb/Interpreter/OptionValueFileSpecList.h32
-rw-r--r--include/lldb/Interpreter/OptionValueFormat.h27
-rw-r--r--include/lldb/Interpreter/OptionValueFormatEntity.h6
-rw-r--r--include/lldb/Interpreter/OptionValueLanguage.h5
-rw-r--r--include/lldb/Interpreter/OptionValuePathMappings.h31
-rw-r--r--include/lldb/Interpreter/OptionValueProperties.h83
-rw-r--r--include/lldb/Interpreter/OptionValueRegex.h39
-rw-r--r--include/lldb/Interpreter/OptionValueSInt64.h27
-rw-r--r--include/lldb/Interpreter/OptionValueString.h53
-rw-r--r--include/lldb/Interpreter/OptionValueUInt64.h27
-rw-r--r--include/lldb/Interpreter/OptionValueUUID.h41
-rw-r--r--include/lldb/Interpreter/Options.h63
-rw-r--r--include/lldb/Interpreter/PythonDataObjects.h280
-rw-r--r--include/lldb/Interpreter/ScriptInterpreter.h41
-rw-r--r--include/lldb/Interpreter/ScriptInterpreterNone.h35
-rw-r--r--include/lldb/Interpreter/ScriptInterpreterPython.h563
-rw-r--r--include/lldb/Symbol/ArmUnwindInfo.h77
-rw-r--r--include/lldb/Symbol/Block.h70
-rw-r--r--include/lldb/Symbol/ClangASTContext.h941
-rw-r--r--include/lldb/Symbol/ClangASTImporter.h53
-rw-r--r--include/lldb/Symbol/ClangExternalASTSourceCallbacks.h38
-rw-r--r--include/lldb/Symbol/ClangExternalASTSourceCommon.h21
-rw-r--r--include/lldb/Symbol/ClangNamespaceDecl.h105
-rw-r--r--include/lldb/Symbol/CompileUnit.h61
-rw-r--r--include/lldb/Symbol/CompilerDecl.h135
-rw-r--r--include/lldb/Symbol/CompilerDeclContext.h146
-rw-r--r--include/lldb/Symbol/CompilerType.h (renamed from include/lldb/Symbol/ClangASTType.h)477
-rw-r--r--include/lldb/Symbol/DebugMacros.h140
-rw-r--r--include/lldb/Symbol/FuncUnwinders.h5
-rw-r--r--include/lldb/Symbol/Function.h78
-rw-r--r--include/lldb/Symbol/GoASTContext.h402
-rw-r--r--include/lldb/Symbol/LineEntry.h26
-rw-r--r--include/lldb/Symbol/LineTable.h27
-rw-r--r--include/lldb/Symbol/ObjectContainer.h16
-rw-r--r--include/lldb/Symbol/ObjectFile.h18
-rw-r--r--include/lldb/Symbol/Symbol.h19
-rw-r--r--include/lldb/Symbol/SymbolContext.h73
-rw-r--r--include/lldb/Symbol/SymbolContextScope.h13
-rw-r--r--include/lldb/Symbol/SymbolFile.h49
-rw-r--r--include/lldb/Symbol/SymbolVendor.h35
-rw-r--r--include/lldb/Symbol/TaggedASTType.h18
-rw-r--r--include/lldb/Symbol/Type.h259
-rw-r--r--include/lldb/Symbol/TypeList.h13
-rw-r--r--include/lldb/Symbol/TypeMap.h98
-rw-r--r--include/lldb/Symbol/TypeSystem.h604
-rw-r--r--include/lldb/Symbol/UnwindPlan.h40
-rw-r--r--include/lldb/Symbol/UnwindTable.h10
-rw-r--r--include/lldb/Symbol/Variable.h26
-rw-r--r--include/lldb/Symbol/VariableList.h4
-rw-r--r--include/lldb/Target/ABI.h12
-rw-r--r--include/lldb/Target/CPPLanguageRuntime.h130
-rw-r--r--include/lldb/Target/DynamicLoader.h21
-rw-r--r--include/lldb/Target/ExecutionContext.h111
-rw-r--r--include/lldb/Target/InstrumentationRuntimeStopInfo.h19
-rw-r--r--include/lldb/Target/JITLoader.h3
-rw-r--r--include/lldb/Target/Language.h206
-rw-r--r--include/lldb/Target/LanguageRuntime.h50
-rw-r--r--include/lldb/Target/ObjCLanguageRuntime.h269
-rw-r--r--include/lldb/Target/OperatingSystem.h6
-rw-r--r--include/lldb/Target/Platform.h280
-rw-r--r--include/lldb/Target/Process.h550
-rw-r--r--include/lldb/Target/QueueItem.h20
-rw-r--r--include/lldb/Target/RegisterContext.h28
-rw-r--r--include/lldb/Target/SectionLoadList.h1
-rw-r--r--include/lldb/Target/StackFrame.h58
-rw-r--r--include/lldb/Target/StackFrameList.h22
-rw-r--r--include/lldb/Target/StackID.h20
-rw-r--r--include/lldb/Target/StopInfo.h4
-rw-r--r--include/lldb/Target/SystemRuntime.h6
-rw-r--r--include/lldb/Target/Target.h351
-rw-r--r--include/lldb/Target/TargetList.h28
-rw-r--r--include/lldb/Target/Thread.h164
-rw-r--r--include/lldb/Target/ThreadList.h10
-rw-r--r--include/lldb/Target/ThreadPlan.h54
-rw-r--r--include/lldb/Target/ThreadPlanBase.h32
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h77
-rw-r--r--include/lldb/Target/ThreadPlanCallFunctionUsingABI.h5
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h31
-rw-r--r--include/lldb/Target/ThreadPlanPython.h48
-rw-r--r--include/lldb/Target/ThreadPlanRunToAddress.h43
-rw-r--r--include/lldb/Target/ThreadPlanShouldStopHere.h16
-rw-r--r--include/lldb/Target/ThreadPlanStepInRange.h26
-rw-r--r--include/lldb/Target/ThreadPlanStepInstruction.h24
-rw-r--r--include/lldb/Target/ThreadPlanStepOut.h33
-rw-r--r--include/lldb/Target/ThreadPlanStepOverBreakpoint.h35
-rw-r--r--include/lldb/Target/ThreadPlanStepOverRange.h23
-rw-r--r--include/lldb/Target/ThreadPlanStepRange.h28
-rw-r--r--include/lldb/Target/ThreadPlanStepThrough.h26
-rw-r--r--include/lldb/Target/ThreadPlanStepUntil.h28
-rw-r--r--include/lldb/Target/ThreadPlanTracer.h23
-rw-r--r--include/lldb/Target/ThreadSpec.h14
-rw-r--r--include/lldb/Target/UnixSignals.h13
-rw-r--r--include/lldb/Target/UnwindAssembly.h7
-rw-r--r--include/lldb/Utility/AnsiTerminal.h9
-rw-r--r--include/lldb/Utility/Either.h154
-rw-r--r--include/lldb/Utility/Iterable.h25
-rw-r--r--include/lldb/Utility/JSON.h127
-rw-r--r--include/lldb/Utility/ProcessStructReader.h8
-rw-r--r--include/lldb/Utility/PseudoTerminal.h2
-rw-r--r--include/lldb/Utility/PythonPointer.h73
-rw-r--r--include/lldb/Utility/SharedCluster.h6
-rw-r--r--include/lldb/Utility/SharingPtr.h79
-rw-r--r--include/lldb/Utility/StringExtractor.h3
-rw-r--r--include/lldb/Utility/TaskPool.h221
-rw-r--r--include/lldb/lldb-defines.h2
-rw-r--r--include/lldb/lldb-enumerations.h41
-rw-r--r--include/lldb/lldb-forward.h50
-rw-r--r--include/lldb/lldb-private-enumerations.h28
-rw-r--r--include/lldb/lldb-private-interfaces.h10
-rw-r--r--include/lldb/lldb-private-types.h18
-rw-r--r--include/lldb/lldb-python.h31
-rw-r--r--include/lldb/lldb-types.h2
318 files changed, 12030 insertions, 11374 deletions
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h
index 66e095395f133..eed10d08c6cc4 100644
--- a/include/lldb/API/LLDB.h
+++ b/include/lldb/API/LLDB.h
@@ -16,6 +16,7 @@
// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBBreakpointLocation.h"
@@ -30,28 +31,47 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBExecutionContext.h"
+#include "lldb/API/SBExpressionOptions.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBInstructionList.h"
+#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBListener.h"
#include "lldb/API/SBModule.h"
+#include "lldb/API/SBModuleSpec.h"
+#include "lldb/API/SBPlatform.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBQueueItem.h"
+#include "lldb/API/SBSection.h"
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBSymbol.h"
#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBSymbolContextList.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBThreadCollection.h"
+#include "lldb/API/SBThreadPlan.h"
#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeCategory.h"
+#include "lldb/API/SBTypeEnumMember.h"
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeNameSpecifier.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
+#include "lldb/API/SBUnixSignals.h"
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBWatchpoint.h"
#endif // LLDB_LLDB_h_
diff --git a/include/lldb/API/SBAttachInfo.h b/include/lldb/API/SBAttachInfo.h
index 712150e128be5..a246d9919cfa0 100644
--- a/include/lldb/API/SBAttachInfo.h
+++ b/include/lldb/API/SBAttachInfo.h
@@ -23,8 +23,47 @@ public:
SBAttachInfo (lldb::pid_t pid);
+ //------------------------------------------------------------------
+ /// Attach to a process by name.
+ ///
+ /// This function implies that a future call to SBTarget::Attach(...)
+ /// will be synchronous.
+ ///
+ /// @param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ //------------------------------------------------------------------
SBAttachInfo (const char *path, bool wait_for);
+ //------------------------------------------------------------------
+ /// Attach to a process by name.
+ ///
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// @param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ ///
+ /// @param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ //------------------------------------------------------------------
+ SBAttachInfo (const char *path, bool wait_for, bool async);
+
SBAttachInfo (const SBAttachInfo &rhs);
~SBAttachInfo();
@@ -47,9 +86,45 @@ public:
bool
GetWaitForLaunch ();
+ //------------------------------------------------------------------
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// This function implies that a call to SBTarget::Attach(...) will
+ /// be synchronous.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ //------------------------------------------------------------------
void
SetWaitForLaunch (bool b);
+ //------------------------------------------------------------------
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ ///
+ /// @param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ //------------------------------------------------------------------
+ void
+ SetWaitForLaunch (bool b, bool async);
+
bool
GetIgnoreExisting ();
diff --git a/include/lldb/API/SBCommandInterpreter.h b/include/lldb/API/SBCommandInterpreter.h
index 235a2f3ea603f..a8e9bf7ed769e 100644
--- a/include/lldb/API/SBCommandInterpreter.h
+++ b/include/lldb/API/SBCommandInterpreter.h
@@ -10,6 +10,12 @@
#ifndef LLDB_SBCommandInterpreter_h_
#define LLDB_SBCommandInterpreter_h_
+// C Includes
+// C++ Includes
+#include <memory>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBDebugger.h"
@@ -59,6 +65,7 @@ public:
void
SetAddToHistory (bool);
+
private:
lldb_private::CommandInterpreterRunOptions *
get () const;
@@ -84,11 +91,11 @@ public:
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
+ ~SBCommandInterpreter ();
+
const lldb::SBCommandInterpreter &
operator = (const lldb::SBCommandInterpreter &rhs);
- ~SBCommandInterpreter ();
-
static const char *
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
@@ -187,7 +194,7 @@ public:
lldb::CommandOverrideCallback callback,
void *baton);
- SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter();
+ SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter();
//----------------------------------------------------------------------
/// Return true if the command interpreter is the active IO handler.
@@ -213,7 +220,7 @@ public:
///
/// @return
/// The string that should be written into the file handle that is
- /// feeding the input stream for the debugger, or NULL if there is
+ /// feeding the input stream for the debugger, or nullptr if there is
/// no string for this control key.
//----------------------------------------------------------------------
const char *
@@ -233,7 +240,6 @@ public:
ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:
-
lldb_private::CommandInterpreter &
ref ();
@@ -242,6 +248,7 @@ protected:
void
reset (lldb_private::CommandInterpreter *);
+
private:
friend class SBDebugger;
@@ -254,6 +261,9 @@ private:
class SBCommandPluginInterface
{
public:
+ virtual
+ ~SBCommandPluginInterface() = default;
+
virtual bool
DoExecute (lldb::SBDebugger /*debugger*/,
char** /*command*/,
@@ -261,16 +271,11 @@ public:
{
return false;
}
-
- virtual
- ~SBCommandPluginInterface ()
- {}
};
class SBCommand
{
public:
-
SBCommand ();
bool
@@ -298,13 +303,12 @@ public:
SetFlags (uint32_t flags);
lldb::SBCommand
- AddMultiwordCommand (const char* name, const char* help = NULL);
+ AddMultiwordCommand(const char* name, const char* help = nullptr);
lldb::SBCommand
- AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help = NULL);
+ AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help = nullptr);
private:
-
friend class SBDebugger;
friend class SBCommandInterpreter;
diff --git a/include/lldb/API/SBCommandReturnObject.h b/include/lldb/API/SBCommandReturnObject.h
index c51d6bc8d2d54..b45eb9c14c048 100644
--- a/include/lldb/API/SBCommandReturnObject.h
+++ b/include/lldb/API/SBCommandReturnObject.h
@@ -10,8 +10,14 @@
#ifndef LLDB_SBCommandReturnObject_h_
#define LLDB_SBCommandReturnObject_h_
+// C Includes
#include <stdio.h>
+// C++ Includes
+#include <memory>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/API/SBDefines.h"
namespace lldb {
@@ -19,22 +25,20 @@ namespace lldb {
class LLDB_API SBCommandReturnObject
{
public:
-
SBCommandReturnObject ();
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
+ ~SBCommandReturnObject ();
+
const lldb::SBCommandReturnObject &
operator = (const lldb::SBCommandReturnObject &rhs);
-
SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
lldb_private::CommandReturnObject *
Release ();
- ~SBCommandReturnObject ();
-
bool
IsValid() const;
@@ -99,8 +103,8 @@ public:
GetError (bool only_if_no_immediate);
void
- SetError (lldb::SBError &error,
- const char *fallback_error_cstr = NULL);
+ SetError(lldb::SBError &error,
+ const char *fallback_error_cstr = nullptr);
void
SetError (const char* error_cstr);
@@ -124,10 +128,10 @@ protected:
void
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
- private:
+private:
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
};
} // namespace lldb
-#endif // LLDB_SBCommandReturnObject_h_
+#endif // LLDB_SBCommandReturnObject_h_
diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h
index 4f2c1d7f8756d..7588cfc9ec42a 100644
--- a/include/lldb/API/SBDebugger.h
+++ b/include/lldb/API/SBDebugger.h
@@ -16,13 +16,13 @@
#include "lldb/API/SBPlatform.h"
namespace lldb {
-
class LLDB_API SBInputReader
{
public:
- SBInputReader();
- ~SBInputReader();
+ SBInputReader() = default;
+ ~SBInputReader() = default;
+
SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
void SetIsDone(bool);
bool IsActive() const;
@@ -31,6 +31,16 @@ public:
class LLDB_API SBDebugger
{
public:
+ SBDebugger();
+
+ SBDebugger(const lldb::SBDebugger &rhs);
+
+ SBDebugger(const lldb::DebuggerSP &debugger_sp);
+
+ ~SBDebugger();
+
+ lldb::SBDebugger &
+ operator = (const lldb::SBDebugger &rhs);
static void
Initialize();
@@ -54,17 +64,6 @@ public:
static void
MemoryPressureDetected ();
- SBDebugger();
-
- SBDebugger(const lldb::SBDebugger &rhs);
-
- SBDebugger(const lldb::DebuggerSP &debugger_sp);
-
- lldb::SBDebugger &
- operator = (const lldb::SBDebugger &rhs);
-
- ~SBDebugger();
-
bool
IsValid() const;
@@ -288,6 +287,9 @@ public:
GetCategory (const char* category_name);
SBTypeCategory
+ GetCategory (lldb::LanguageType lang_type);
+
+ SBTypeCategory
CreateCategory (const char* category_name);
bool
@@ -329,8 +331,11 @@ public:
int &num_errors,
bool &quit_requested,
bool &stopped_for_crash);
-private:
+
+ SBError
+ RunREPL (lldb::LanguageType language, const char *repl_options);
+private:
friend class SBCommandInterpreter;
friend class SBInputReader;
friend class SBListener;
@@ -357,7 +362,6 @@ private:
}; // class SBDebugger
-
} // namespace lldb
#endif // LLDB_SBDebugger_h_
diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h
index 09bea502dd01e..d81bba5a2e230 100644
--- a/include/lldb/API/SBDefines.h
+++ b/include/lldb/API/SBDefines.h
@@ -86,9 +86,7 @@ class LLDB_API SBTypeMemberFunction;
class LLDB_API SBTypeNameSpecifier;
class LLDB_API SBTypeSummary;
class LLDB_API SBTypeSummaryOptions;
-#ifndef LLDB_DISABLE_PYTHON
class LLDB_API SBTypeSynthetic;
-#endif
class LLDB_API SBTypeList;
class LLDB_API SBValue;
class LLDB_API SBValueList;
diff --git a/include/lldb/API/SBFunction.h b/include/lldb/API/SBFunction.h
index 86cfeb49bb588..f76c77c44e3f9 100644
--- a/include/lldb/API/SBFunction.h
+++ b/include/lldb/API/SBFunction.h
@@ -53,6 +53,9 @@ public:
lldb::SBAddress
GetEndAddress ();
+ const char *
+ GetArgumentName (uint32_t arg_idx);
+
uint32_t
GetPrologueByteSize ();
@@ -66,6 +69,9 @@ public:
GetLanguage ();
bool
+ GetIsOptimized ();
+
+ bool
operator == (const lldb::SBFunction &rhs) const;
bool
diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h
index 71bca4fc697ae..1a9cc8022880b 100644
--- a/include/lldb/API/SBProcess.h
+++ b/include/lldb/API/SBProcess.h
@@ -294,8 +294,56 @@ public:
uint32_t
GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// @param[in] remote_image_spec
+ /// The path for the shared library on the target what you want
+ /// to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
uint32_t
- LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
+ LoadImage (lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
+
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// @param[in] local_image_spec
+ /// The file spec that points to the shared library that you
+ /// want to load if the library is located on the host. The
+ /// library will be copied over to the location specified by
+ /// remote_image_spec or into the current working directory with
+ /// the same filename if the remote_image_spec isn't specified.
+ ///
+ /// @param[in] remote_image_spec
+ /// If local_image_spec is specified then the location where the
+ /// library should be copied over from the host. If
+ /// local_image_spec isn't specified, then the path for the
+ /// shared library on the target what you want to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
+ uint32_t
+ LoadImage (const lldb::SBFileSpec &local_image_spec,
+ const lldb::SBFileSpec &remote_image_spec,
+ lldb::SBError &error);
lldb::SBError
UnloadImage (uint32_t image_token);
@@ -341,6 +389,10 @@ public:
bool
IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
+ // Save the state of the process in a core file (or mini dump on Windows).
+ lldb::SBError
+ SaveCore(const char *file_name);
+
protected:
friend class SBAddress;
friend class SBBreakpoint;
diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h
index 2b25cd2c68f2e..e62723c2f37e1 100644
--- a/include/lldb/API/SBStream.h
+++ b/include/lldb/API/SBStream.h
@@ -21,7 +21,9 @@ class LLDB_API SBStream
public:
SBStream ();
-
+
+ SBStream (SBStream &&rhs);
+
~SBStream ();
bool
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index 2ca0b124ce0a4..723c433b521ae 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -10,6 +10,10 @@
#ifndef LLDB_SBTarget_h_
#define LLDB_SBTarget_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
@@ -50,14 +54,14 @@ public:
SBTarget (const lldb::TargetSP& target_sp);
- const lldb::SBTarget&
- operator = (const lldb::SBTarget& rhs);
-
//------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------
~SBTarget();
+ const lldb::SBTarget&
+ operator = (const lldb::SBTarget& rhs);
+
bool
IsValid() const;
@@ -135,17 +139,17 @@ public:
///
/// @param[in] stdin_path
/// The path to use when re-directing the STDIN of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] stdout_path
/// The path to use when re-directing the STDOUT of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] stderr_path
/// The path to use when re-directing the STDERR of the new
- /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] working_directory
@@ -175,8 +179,10 @@ public:
uint32_t launch_flags, // See LaunchFlags
bool stop_at_entry,
lldb::SBError& error);
-
-
+
+ SBProcess
+ LoadCore (const char *core_file);
+
//------------------------------------------------------------------
/// Launch a new process with sensible defaults.
///
@@ -212,9 +218,6 @@ public:
Launch (SBLaunchInfo &launch_info, SBError& error);
SBProcess
- LoadCore (const char *core_file);
-
- SBProcess
Attach (SBAttachInfo &attach_info, SBError& error);
//------------------------------------------------------------------
@@ -248,6 +251,7 @@ public:
::pid_t pid, // 32 bit int process ID
lldb::SBError& error); // DEPRECATED
#endif
+
//------------------------------------------------------------------
/// Attach to process with name.
///
@@ -288,7 +292,7 @@ public:
/// The url to connect to, e.g., 'connect://localhost:12345'.
///
/// @param[in] plugin_name
- /// The plugin name to be used; can be NULL.
+ /// The plugin name to be used; can be nullptr.
///
/// @param[out] error
/// An error explaining what went wrong if the connect fails.
@@ -421,7 +425,6 @@ public:
lldb::SBError
SetModuleLoadAddress (lldb::SBModule module,
int64_t sections_offset);
-
//------------------------------------------------------------------
/// Clear the section base load addresses for all sections in a module.
@@ -618,7 +621,7 @@ public:
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
lldb::SBBreakpoint
- BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
+ BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr);
// This version uses name_type_mask = eFunctionNameTypeAuto
lldb::SBBreakpoint
@@ -633,14 +636,29 @@ public:
const SBFileSpecList &comp_unit_list);
lldb::SBBreakpoint
+ BreakpointCreateByName (const char *symbol_name,
+ uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByNames (const char *symbol_name[],
+ uint32_t num_names,
+ uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint
BreakpointCreateByNames (const char *symbol_name[],
uint32_t num_names,
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
const SBFileSpecList &module_list,
const SBFileSpecList &comp_unit_list);
lldb::SBBreakpoint
- BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
+ BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = nullptr);
lldb::SBBreakpoint
BreakpointCreateByRegex (const char *symbol_name_regex,
@@ -648,9 +666,15 @@ public:
const SBFileSpecList &comp_unit_list);
lldb::SBBreakpoint
- BreakpointCreateBySourceRegex (const char *source_regex,
- const SBFileSpec &source_file,
- const char *module_name = NULL);
+ BreakpointCreateByRegex (const char *symbol_name_regex,
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint
+ BreakpointCreateBySourceRegex(const char *source_regex,
+ const SBFileSpec &source_file,
+ const char *module_name = nullptr);
lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
@@ -665,6 +689,9 @@ public:
lldb::SBBreakpoint
BreakpointCreateByAddress (addr_t address);
+ lldb::SBBreakpoint
+ BreakpointCreateBySBAddress (SBAddress &address);
+
uint32_t
GetNumBreakpoints () const;
@@ -808,15 +835,10 @@ protected:
void
SetSP (const lldb::TargetSP& target_sp);
-
private:
- //------------------------------------------------------------------
- // For Target only
- //------------------------------------------------------------------
-
lldb::TargetSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBTarget_h_
+#endif // LLDB_SBTarget_h_
diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h
index 01f0c6afc7954..ed3c2ff238632 100644
--- a/include/lldb/API/SBType.h
+++ b/include/lldb/API/SBType.h
@@ -85,7 +85,13 @@ public:
const char *
GetName ();
-
+
+ const char *
+ GetDemangledName ();
+
+ const char *
+ GetMangledName ();
+
lldb::SBType
GetType ();
@@ -158,6 +164,9 @@ public:
bool
IsTypedefType ();
+ bool
+ IsAnonymousType ();
+
lldb::SBType
GetPointerType();
@@ -290,7 +299,7 @@ protected:
friend class SBTypeList;
friend class SBValue;
- SBType (const lldb_private::ClangASTType &);
+ SBType (const lldb_private::CompilerType &);
SBType (const lldb::TypeSP &);
SBType (const lldb::TypeImplSP &);
diff --git a/include/lldb/API/SBTypeCategory.h b/include/lldb/API/SBTypeCategory.h
index 30c338b28a467..997b3fc2f98d5 100644
--- a/include/lldb/API/SBTypeCategory.h
+++ b/include/lldb/API/SBTypeCategory.h
@@ -36,6 +36,15 @@ namespace lldb {
const char*
GetName();
+ lldb::LanguageType
+ GetLanguageAtIndex (uint32_t idx);
+
+ uint32_t
+ GetNumLanguages ();
+
+ void
+ AddLanguage (lldb::LanguageType language);
+
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
diff --git a/include/lldb/API/SBTypeSummary.h b/include/lldb/API/SBTypeSummary.h
index 9b367ba5f982b..f4c6661800852 100644
--- a/include/lldb/API/SBTypeSummary.h
+++ b/include/lldb/API/SBTypeSummary.h
@@ -12,8 +12,6 @@
#include "lldb/API/SBDefines.h"
-#ifndef LLDB_DISABLE_PYTHON
-
namespace lldb {
class LLDB_API SBTypeSummaryOptions
{
@@ -71,6 +69,9 @@ namespace lldb {
public:
SBTypeSummary();
+
+ // Native function summary formatter callback
+ typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
static SBTypeSummary
CreateWithSummaryString (const char* data,
@@ -83,6 +84,11 @@ namespace lldb {
static SBTypeSummary
CreateWithScriptCode (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary
+ CreateWithCallback (FormatCallback cb,
+ uint32_t options = 0,
+ const char* description = nullptr);
SBTypeSummary (const lldb::SBTypeSummary &rhs);
@@ -126,6 +132,9 @@ namespace lldb {
operator = (const lldb::SBTypeSummary &rhs);
bool
+ DoesPrintValue (lldb::SBValue value);
+
+ bool
IsEqualTo (lldb::SBTypeSummary &rhs);
bool
@@ -160,6 +169,4 @@ namespace lldb {
} // namespace lldb
-#endif // LLDB_DISABLE_PYTHON
-
#endif // LLDB_SBTypeSummary_h_
diff --git a/include/lldb/API/SBValue.h b/include/lldb/API/SBValue.h
index a070b149f34f3..a7e015064f96a 100644
--- a/include/lldb/API/SBValue.h
+++ b/include/lldb/API/SBValue.h
@@ -139,10 +139,8 @@ public:
lldb::SBTypeFormat
GetTypeFormat ();
-#ifndef LLDB_DISABLE_PYTHON
lldb::SBTypeSummary
GetTypeSummary ();
-#endif
lldb::SBTypeFilter
GetTypeFilter ();
@@ -206,7 +204,11 @@ public:
/// pointer to a 'Point' type, then the child at index zero will be
/// the 'x' member, and the child at index 1 will be the 'y' member
/// (the child at index zero won't be a 'Point' instance).
- ///
+ ///
+ /// If you actually need an SBValue that represents the type pointed
+ /// to by a SBValue for which GetType().IsPointeeType() returns true,
+ /// regardless of the pointee type, you can do that with SBValue::Dereference.
+ ///
/// Arrays have a preset number of children that can be accessed by
/// index and will returns invalid child values for indexes that are
/// out of bounds unless the \a synthetic_allowed is \b true. In this
@@ -332,6 +334,9 @@ public:
uint32_t
GetNumChildren ();
+ uint32_t
+ GetNumChildren (uint32_t max);
+
void *
GetOpaqueType();
@@ -350,6 +355,7 @@ public:
lldb::SBValue
Dereference ();
+ // Deprecated - please use GetType().IsPointerType() instead.
bool
TypeIsPointerType ();
diff --git a/include/lldb/API/SystemInitializerFull.h b/include/lldb/API/SystemInitializerFull.h
index 6280fe8aef046..9e37611a65981 100644
--- a/include/lldb/API/SystemInitializerFull.h
+++ b/include/lldb/API/SystemInitializerFull.h
@@ -26,15 +26,15 @@ class SystemInitializerFull : public SystemInitializerCommon
{
public:
SystemInitializerFull();
- virtual ~SystemInitializerFull();
+ ~SystemInitializerFull() override;
void Initialize() override;
void Terminate() override;
private:
void InitializeSWIG();
- void TerminateSWIG();
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // LLDB_API_SYSTEM_INITIALIZER_FULL_H
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h
index a70c2787a1ef1..7fdf06da39368 100644
--- a/include/lldb/Breakpoint/Breakpoint.h
+++ b/include/lldb/Breakpoint/Breakpoint.h
@@ -12,7 +12,10 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
#include <unordered_set>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -81,11 +84,9 @@ class Breakpoint:
public Stoppoint
{
public:
-
static const ConstString &
GetEventIdentifier ();
-
//------------------------------------------------------------------
/// An enum specifying the match style for breakpoint settings. At
/// present only used for function name style breakpoints.
@@ -101,18 +102,16 @@ public:
public EventData
{
public:
+ BreakpointEventData (lldb::BreakpointEventType sub_type,
+ const lldb::BreakpointSP &new_breakpoint_sp);
+
+ ~BreakpointEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const;
-
- BreakpointEventData (lldb::BreakpointEventType sub_type,
- const lldb::BreakpointSP &new_breakpoint_sp);
-
- virtual
- ~BreakpointEventData();
+ const ConstString &
+ GetFlavor() const override;
lldb::BreakpointEventType
GetBreakpointEventType () const;
@@ -126,9 +125,8 @@ public:
return m_locations;
}
-
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static lldb::BreakpointEventType
GetBreakpointEventTypeFromEvent (const lldb::EventSP &event_sp);
@@ -146,7 +144,6 @@ public:
GetEventDataFromEvent (const Event *event_sp);
private:
-
lldb::BreakpointEventType m_breakpoint_event;
lldb::BreakpointSP m_new_breakpoint_sp;
BreakpointLocationCollection m_locations;
@@ -154,11 +151,10 @@ public:
DISALLOW_COPY_AND_ASSIGN (BreakpointEventData);
};
-
class BreakpointPrecondition
{
public:
- virtual ~BreakpointPrecondition() {}
+ virtual ~BreakpointPrecondition() = default;
virtual bool
EvaluatePrecondition(StoppointCallbackContext &context);
@@ -167,7 +163,7 @@ public:
ConfigurePrecondition(Args &options);
virtual void
- DescribePrecondition(Stream &stream, lldb::DescriptionLevel level);
+ GetDescription(Stream &stream, lldb::DescriptionLevel level);
};
typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP;
@@ -179,7 +175,7 @@ public:
/// breakpoints. The varieties of breakpoints are specified instead by
/// providing different resolvers & filters.
//------------------------------------------------------------------
- ~Breakpoint();
+ ~Breakpoint() override;
//------------------------------------------------------------------
// Methods
@@ -197,14 +193,13 @@ public:
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void
- Dump (Stream *s);
+ Dump(Stream *s) override;
//------------------------------------------------------------------
// The next set of methods provide ways to tell the breakpoint to update
// it's location list - usually done when modules appear or disappear.
//------------------------------------------------------------------
-
//------------------------------------------------------------------
/// Tell this breakpoint to clear all its breakpoint sites. Done
/// when the process holding the breakpoint sites is destroyed.
@@ -262,7 +257,6 @@ public:
bool load_event,
bool delete_locations = false);
-
//------------------------------------------------------------------
/// Tells the breakpoint the old module \a old_module_sp has been
/// replaced by new_module_sp (usually because the underlying file has been
@@ -294,8 +288,8 @@ public:
/// Returns a pointer to the new location.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
- AddLocation (const Address &addr,
- bool *new_location = NULL);
+ AddLocation(const Address &addr,
+ bool *new_location = nullptr);
//------------------------------------------------------------------
/// Find a breakpoint location by Address.
@@ -304,7 +298,7 @@ public:
/// The Address specifying the location.
/// @return
/// Returns a shared pointer to the location at \a addr. The pointer
- /// in the shared pointer will be NULL if there is no location at that address.
+ /// in the shared pointer will be nullptr if there is no location at that address.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindLocationByAddress (const Address &addr);
@@ -328,7 +322,7 @@ public:
/// The ID specifying the location.
/// @return
/// Returns a shared pointer to the location with ID \a bp_loc_id. The pointer
- /// in the shared pointer will be NULL if there is no location with that ID.
+ /// in the shared pointer will be nullptr if there is no location with that ID.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindLocationByID (lldb::break_id_t bp_loc_id);
@@ -341,7 +335,7 @@ public:
///
/// @return
/// Returns a shared pointer to the location with index \a
- /// index. The shared pointer might contain NULL if \a index is
+ /// index. The shared pointer might contain nullptr if \a index is
/// greater than then number of actual locations.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -373,7 +367,7 @@ public:
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void
- SetEnabled (bool enable);
+ SetEnabled(bool enable) override;
//------------------------------------------------------------------
/// Check the Enable/Disable state.
@@ -381,7 +375,7 @@ public:
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool
- IsEnabled ();
+ IsEnabled() override;
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
@@ -407,7 +401,6 @@ public:
uint32_t
GetHitCount () const;
-
//------------------------------------------------------------------
/// If \a one_shot is \b true, breakpoint will be deleted on first hit.
//------------------------------------------------------------------
@@ -490,7 +483,7 @@ public:
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
- /// Pass in NULL to clear the condition.
+ /// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition (const char *condition);
@@ -498,7 +491,7 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText () const;
@@ -560,7 +553,7 @@ public:
/// Return the "kind" description for a breakpoint.
///
/// @return
- /// The breakpoint kind, or NULL if none is set.
+ /// The breakpoint kind, or nullptr if none is set.
//------------------------------------------------------------------
const char *GetBreakpointKind () const
{
@@ -619,7 +612,6 @@ public:
BreakpointOptions *
GetOptions ();
-
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
@@ -713,7 +705,6 @@ protected:
// Protected Methods
//------------------------------------------------------------------
-
//------------------------------------------------------------------
/// Constructors and Destructors
/// Only the Target can make a breakpoint, and it owns the breakpoint lifespans.
@@ -807,4 +798,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Breakpoint_h_
+#endif // liblldb_Breakpoint_h_
diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h
index c3e620d085c63..58d144cfb6680 100644
--- a/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/include/lldb/Breakpoint/BreakpointLocation.h
@@ -11,12 +11,10 @@
#define liblldb_BreakpointLocation_h_
// C Includes
-
// C++ Includes
-#include <list>
+#include <memory>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/StoppointLocation.h"
@@ -49,7 +47,7 @@ class BreakpointLocation :
public StoppointLocation
{
public:
- ~BreakpointLocation ();
+ ~BreakpointLocation() override;
//------------------------------------------------------------------
/// Gets the load address for this breakpoint location
@@ -58,7 +56,7 @@ public:
/// LLDB_INVALID_ADDRESS if not yet set.
//------------------------------------------------------------------
lldb::addr_t
- GetLoadAddress () const;
+ GetLoadAddress() const override;
//------------------------------------------------------------------
/// Gets the Address for this breakpoint location
@@ -74,6 +72,9 @@ public:
//------------------------------------------------------------------
Breakpoint &
GetBreakpoint ();
+
+ Target &
+ GetTarget();
//------------------------------------------------------------------
/// Determines whether we should stop due to a hit at this
@@ -88,7 +89,7 @@ public:
/// \b false otherwise.
//------------------------------------------------------------------
bool
- ShouldStop (StoppointCallbackContext *context);
+ ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
@@ -169,16 +170,15 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *
- GetConditionText (size_t *hash = NULL) const;
+ GetConditionText(size_t *hash = nullptr) const;
bool
ConditionSaysStop (ExecutionContext &exe_ctx, Error &error);
-
//------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
///
@@ -270,7 +270,7 @@ public:
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void
- Dump (Stream *s) const;
+ Dump(Stream *s) const override;
//------------------------------------------------------------------
/// Use this to set location specific breakpoint options.
@@ -299,7 +299,6 @@ public:
bool
ValidForThisThread (Thread *thread);
-
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
@@ -418,7 +417,6 @@ private:
void
UndoBumpHitCount();
-
//------------------------------------------------------------------
// Constructors and Destructors
//
@@ -459,9 +457,9 @@ private:
bool m_is_indirect;
Address m_address; ///< The address defining this location.
Breakpoint &m_owner; ///< The breakpoint that produced this object.
- std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
+ std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, nullptr if we're using our breakpoint's options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
- lldb::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
+ lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code changed.
@@ -479,4 +477,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointLocation_h_
+#endif // liblldb_BreakpointLocation_h_
diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h
index f67ef89ad705d..81526089b427a 100644
--- a/include/lldb/Breakpoint/BreakpointLocationList.h
+++ b/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -12,8 +12,9 @@
// C Includes
// C++ Includes
-#include <vector>
#include <map>
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -56,7 +57,7 @@ public:
/// The address to look for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
@@ -70,7 +71,7 @@ public:
/// The breakpoint location ID to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -116,7 +117,7 @@ public:
/// The breakpoint location index to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
@@ -130,7 +131,7 @@ public:
/// The breakpoint location index to seek for.
///
/// @result
- /// A shared pointer to the breakpoint. May contain a NULL
+ /// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
@@ -216,7 +217,6 @@ public:
lldb::DescriptionLevel level);
protected:
-
//------------------------------------------------------------------
/// This is the standard constructor.
///
@@ -246,9 +246,9 @@ protected:
StopRecordingNewLocations();
lldb::BreakpointLocationSP
- AddLocation (const Address &addr,
- bool resolve_indirect_symbols,
- bool *new_location = NULL);
+ AddLocation(const Address &addr,
+ bool resolve_indirect_symbols,
+ bool *new_location = nullptr);
void
SwapLocation (lldb::BreakpointLocationSP to_location_sp, lldb::BreakpointLocationSP from_location_sp);
@@ -273,16 +273,17 @@ protected:
mutable Mutex m_mutex;
lldb::break_id_t m_next_id;
BreakpointLocationCollection *m_new_location_recorder;
+
public:
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationIterable;
+
BreakpointLocationIterable
BreakpointLocations()
{
return BreakpointLocationIterable(m_locations);
}
-
};
} // namespace lldb_private
-#endif // liblldb_BreakpointLocationList_h_
+#endif // liblldb_BreakpointLocationList_h_
diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h
index bf10fc096d753..e7882147a4dab 100644
--- a/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/include/lldb/Breakpoint/BreakpointOptions.h
@@ -12,6 +12,9 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -115,7 +118,6 @@ public:
//------------------------------------------------------------------
void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
-
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
@@ -184,10 +186,10 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
- const char *GetConditionText (size_t *hash = NULL) const;
+ const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// Enabled/Ignore Count
@@ -257,10 +259,10 @@ public:
}
//------------------------------------------------------------------
- /// Return the current thread spec for this option. This will return NULL if the no thread
+ /// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
- /// The thread specification pointer for this option, or NULL if none has
+ /// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
@@ -298,7 +300,6 @@ public:
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
-
struct CommandData
{
CommandData () :
@@ -308,10 +309,8 @@ public:
{
}
- ~CommandData ()
- {
- }
-
+ ~CommandData() = default;
+
StringList user_source;
std::string script_source;
bool stop_on_error;
@@ -325,16 +324,14 @@ public:
{
}
- virtual
- ~CommandBaton ()
+ ~CommandBaton() override
{
delete ((CommandData *)m_data);
- m_data = NULL;
+ m_data = nullptr;
}
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-
+ void
+ GetDescription (Stream *s, lldb::DescriptionLevel level) const override;
};
protected:
@@ -359,4 +356,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointOptions_h_
+#endif // liblldb_BreakpointOptions_h_
diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h
index 6ba53ea92f362..198abed841b22 100644
--- a/include/lldb/Breakpoint/BreakpointResolver.h
+++ b/include/lldb/Breakpoint/BreakpointResolver.h
@@ -66,8 +66,7 @@ public:
/// The Destructor is virtual, all significant breakpoint resolvers derive
/// from this class.
//------------------------------------------------------------------
- virtual
- ~BreakpointResolver ();
+ ~BreakpointResolver() override;
//------------------------------------------------------------------
/// This sets the breakpoint for this resolver.
@@ -105,8 +104,8 @@ public:
/// @param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
- virtual void
- GetDescription (Stream *s) = 0;
+ void
+ GetDescription(Stream *s) override = 0;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
@@ -157,4 +156,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointResolver_h_
+#endif // liblldb_BreakpointResolver_h_
diff --git a/include/lldb/Breakpoint/BreakpointResolverAddress.h b/include/lldb/Breakpoint/BreakpointResolverAddress.h
index c8f034d7345b5..8ec1e39e52ab9 100644
--- a/include/lldb/Breakpoint/BreakpointResolverAddress.h
+++ b/include/lldb/Breakpoint/BreakpointResolverAddress.h
@@ -15,6 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/ModuleSpec.h"
namespace lldb_private {
@@ -31,8 +32,11 @@ public:
BreakpointResolverAddress (Breakpoint *bkpt,
const Address &addr);
- virtual
- ~BreakpointResolverAddress ();
+ BreakpointResolverAddress (Breakpoint *bkpt,
+ const Address &addr,
+ const FileSpec &module_spec);
+
+ ~BreakpointResolverAddress() override;
void
ResolveBreakpoint (SearchFilter &filter) override;
@@ -66,12 +70,15 @@ public:
CopyForBreakpoint (Breakpoint &breakpoint) override;
protected:
- Address m_addr;
-
+ Address m_addr; // The address - may be Section Offset or may be just an offset
+ lldb::addr_t m_resolved_addr; // The current value of the resolved load address for this breakpoint,
+ FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an offset, then it will be converted
+ // to a Section+Offset address in this module, whenever that module gets around to
+ // being loaded.
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverAddress_h_
+#endif // liblldb_BreakpointResolverAddress_h_
diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index 2403d24515a7a..2dde1546f1261 100644
--- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -35,8 +35,7 @@ public:
bool skip_prologue,
bool exact_match);
- virtual
- ~BreakpointResolverFileLine ();
+ ~BreakpointResolverFileLine() override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
@@ -76,4 +75,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverFileLine_h_
+#endif // liblldb_BreakpointResolverFileLine_h_
diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
index 8e18fff16447c..a8d7a50b5d936 100644
--- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
+++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
@@ -32,8 +32,7 @@ public:
RegularExpression &regex,
bool exact_match);
- virtual
- ~BreakpointResolverFileRegex ();
+ ~BreakpointResolverFileRegex() override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
@@ -70,4 +69,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverFileRegex_h_
+#endif // liblldb_BreakpointResolverFileRegex_h_
diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h
index c2a5b180f289c..aaae9c1a12cfe 100644
--- a/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -14,6 +14,7 @@
// C++ Includes
#include <vector>
#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointResolver.h"
@@ -34,6 +35,7 @@ public:
BreakpointResolverName (Breakpoint *bkpt,
const char *name,
uint32_t name_type_mask,
+ lldb::LanguageType language,
Breakpoint::MatchType type,
bool skip_prologue);
@@ -42,17 +44,20 @@ public:
const char *names[],
size_t num_names,
uint32_t name_type_mask,
+ lldb::LanguageType language,
bool skip_prologue);
// This one takes a C++ array of names. It is always MatchType = Exact.
BreakpointResolverName (Breakpoint *bkpt,
std::vector<std::string> names,
uint32_t name_type_mask,
+ lldb::LanguageType language,
bool skip_prologue);
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
BreakpointResolverName (Breakpoint *bkpt,
RegularExpression &func_regex,
+ lldb::LanguageType language,
bool skip_prologue);
BreakpointResolverName (Breakpoint *bkpt,
@@ -61,8 +66,7 @@ public:
Breakpoint::MatchType type,
bool skip_prologue);
- virtual
- ~BreakpointResolverName ();
+ ~BreakpointResolverName() override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
@@ -114,6 +118,7 @@ protected:
ConstString m_class_name;
RegularExpression m_regex;
Breakpoint::MatchType m_match_type;
+ lldb::LanguageType m_language;
bool m_skip_prologue;
void
@@ -122,4 +127,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverName_h_
+#endif // liblldb_BreakpointResolverName_h_
diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h
index d67fc8bb57f1f..6cebcab8e2db6 100644
--- a/include/lldb/Breakpoint/BreakpointSite.h
+++ b/include/lldb/Breakpoint/BreakpointSite.h
@@ -55,7 +55,7 @@ public:
// display any breakpoint opcodes.
};
- virtual ~BreakpointSite ();
+ ~BreakpointSite() override;
//----------------------------------------------------------------------
// This section manages the breakpoint traps
@@ -139,8 +139,8 @@ public:
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
- virtual bool
- ShouldStop (StoppointCallbackContext *context);
+ bool
+ ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
/// Standard Dump method
@@ -149,7 +149,7 @@ public:
/// The stream to dump this output.
//------------------------------------------------------------------
void
- Dump (Stream *s) const;
+ Dump(Stream *s) const override;
//------------------------------------------------------------------
/// The "Owners" are the breakpoint locations that share this
@@ -187,6 +187,20 @@ public:
GetOwnerAtIndex (size_t idx);
//------------------------------------------------------------------
+ /// This method copies the breakpoint site's owners into a new collection.
+ /// It does this while the owners mutex is locked.
+ ///
+ /// @param[out] out_collection
+ /// The BreakpointLocationCollection into which to put the owners
+ /// of this breakpoint site.
+ ///
+ /// @return
+ /// The number of elements copied into out_collection.
+ //------------------------------------------------------------------
+ size_t
+ CopyOwnersList (BreakpointLocationCollection &out_collection);
+
+ //------------------------------------------------------------------
/// Check whether the owners of this breakpoint site have any
/// thread specifiers, and if yes, is \a thread contained in any
/// of these specifiers.
@@ -201,7 +215,6 @@ public:
bool
ValidForThisThread (Thread *thread);
-
//------------------------------------------------------------------
/// Print a description of this breakpoint site to the stream \a s.
/// GetDescription tells you about the breakpoint site's owners.
@@ -301,4 +314,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_BreakpointSite_h_
+#endif // liblldb_BreakpointSite_h_
diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h
index 926e0b506f31c..34df24a92c067 100644
--- a/include/lldb/Breakpoint/Watchpoint.h
+++ b/include/lldb/Breakpoint/Watchpoint.h
@@ -11,19 +11,17 @@
#define liblldb_Watchpoint_h_
// C Includes
-
// C++ Includes
-#include <list>
+#include <memory>
#include <string>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/UserID.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Target.h"
namespace lldb_private {
@@ -33,23 +31,20 @@ class Watchpoint :
public StoppointLocation
{
public:
-
class WatchpointEventData :
public EventData
{
public:
+ WatchpointEventData (lldb::WatchpointEventType sub_type,
+ const lldb::WatchpointSP &new_watchpoint_sp);
+
+ ~WatchpointEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const;
-
- WatchpointEventData (lldb::WatchpointEventType sub_type,
- const lldb::WatchpointSP &new_watchpoint_sp);
-
- virtual
- ~WatchpointEventData();
+ const ConstString &
+ GetFlavor() const override;
lldb::WatchpointEventType
GetWatchpointEventType () const;
@@ -57,8 +52,8 @@ public:
lldb::WatchpointSP &
GetWatchpoint ();
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static lldb::WatchpointEventType
GetWatchpointEventTypeFromEvent (const lldb::EventSP &event_sp);
@@ -70,15 +65,15 @@ public:
GetEventDataFromEvent (const Event *event_sp);
private:
-
lldb::WatchpointEventType m_watchpoint_event;
lldb::WatchpointSP m_new_watchpoint_sp;
DISALLOW_COPY_AND_ASSIGN (WatchpointEventData);
};
- Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const ClangASTType *type, bool hardware = true);
- ~Watchpoint ();
+ Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const CompilerType *type, bool hardware = true);
+
+ ~Watchpoint() override;
void
IncrementFalseAlarmsAndReviseHitCount();
@@ -89,11 +84,11 @@ public:
void
SetEnabled (bool enabled, bool notify = true);
- virtual bool
- IsHardware () const;
+ bool
+ IsHardware() const override;
- virtual bool
- ShouldStop (StoppointCallbackContext *context);
+ bool
+ ShouldStop(StoppointCallbackContext *context) override;
bool WatchpointRead () const;
bool WatchpointWrite () const;
@@ -110,8 +105,8 @@ public:
bool CaptureWatchedValue (const ExecutionContext &exe_ctx);
void GetDescription (Stream *s, lldb::DescriptionLevel level);
- void Dump (Stream *s) const;
- void DumpSnapshots (Stream *s, const char * prefix = NULL) const;
+ void Dump (Stream *s) const override;
+ void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
Target &GetTarget() { return m_target; }
const Error &GetError() { return m_error; }
@@ -173,7 +168,7 @@ public:
///
/// @param[in] condition
/// The condition expression to evaluate when the watchpoint is hit.
- /// Pass in NULL to clear the condition.
+ /// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition (const char *condition);
@@ -181,7 +176,7 @@ public:
/// Return a pointer to the text of the condition expression.
///
/// @return
- /// A pointer to the condition expression text, or NULL if no
+ /// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText () const;
@@ -195,13 +190,12 @@ public:
bool
IsDisabledDuringEphemeralMode();
- const ClangASTType &
- GetClangASTType()
+ const CompilerType &
+ GetCompilerType()
{
return m_type;
}
-
private:
friend class Target;
friend class WatchpointList;
@@ -240,13 +234,13 @@ private:
std::string m_watch_spec_str; // Spec for the watchpoint.
lldb::ValueObjectSP m_old_value_sp;
lldb::ValueObjectSP m_new_value_sp;
- ClangASTType m_type;
+ CompilerType m_type;
Error m_error; // An error object describing errors associated with this watchpoint.
WatchpointOptions m_options; // Settable watchpoint options, which is a delegate to handle
// the callback machinery.
bool m_being_created;
- std::unique_ptr<ClangUserExpression> m_condition_ap; // The condition to test.
+ std::unique_ptr<UserExpression> m_condition_ap; // The condition to test.
void SetID(lldb::watch_id_t id) { m_loc_id = id; }
@@ -261,4 +255,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Watchpoint_h_
+#endif // liblldb_Watchpoint_h_
diff --git a/include/lldb/Breakpoint/WatchpointOptions.h b/include/lldb/Breakpoint/WatchpointOptions.h
index 64c65f92b44f3..eb08bb32e6ce4 100644
--- a/include/lldb/Breakpoint/WatchpointOptions.h
+++ b/include/lldb/Breakpoint/WatchpointOptions.h
@@ -12,6 +12,9 @@
// C Includes
// C++ Includes
+#include <memory>
+#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -99,7 +102,6 @@ public:
//------------------------------------------------------------------
void SetCallback (WatchpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
-
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
@@ -150,10 +152,10 @@ public:
const Baton *GetBaton () const;
//------------------------------------------------------------------
- /// Return the current thread spec for this option. This will return NULL if the no thread
+ /// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
- /// The thread specification pointer for this option, or NULL if none has
+ /// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
@@ -196,7 +198,6 @@ public:
StoppointCallbackContext *context,
lldb::user_id_t watch_id);
-
struct CommandData
{
CommandData () :
@@ -206,10 +207,8 @@ public:
{
}
- ~CommandData ()
- {
- }
-
+ ~CommandData() = default;
+
StringList user_source;
std::string script_source;
bool stop_on_error;
@@ -223,16 +222,14 @@ public:
{
}
- virtual
- ~CommandBaton ()
+ ~CommandBaton() override
{
delete ((CommandData *)m_data);
- m_data = NULL;
+ m_data = nullptr;
}
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
};
protected:
@@ -252,4 +249,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_WatchpointOptions_h_
+#endif // liblldb_WatchpointOptions_h_
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h
index cfa16c30bedb9..0afe55b12be3c 100644
--- a/include/lldb/Core/Address.h
+++ b/include/lldb/Core/Address.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <atomic>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -108,7 +109,6 @@ public:
{
}
-
//------------------------------------------------------------------
/// Copy constructor
///
@@ -176,6 +176,7 @@ public:
const Address&
operator= (const Address& rhs);
#endif
+
//------------------------------------------------------------------
/// Clear the object's state.
///
@@ -216,7 +217,7 @@ public:
class ModulePointerAndOffsetLessThanFunctionObject
{
public:
- ModulePointerAndOffsetLessThanFunctionObject () {}
+ ModulePointerAndOffsetLessThanFunctionObject() = default;
bool
operator() (const Address& a, const Address& b) const
@@ -326,7 +327,8 @@ public:
/// not loaded.
//------------------------------------------------------------------
lldb::addr_t
- GetOpcodeLoadAddress (Target *target) const;
+ GetOpcodeLoadAddress (Target *target,
+ lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
//------------------------------------------------------------------
/// Get the section relative offset value.
@@ -354,7 +356,7 @@ public:
bool
IsSectionOffset() const
{
- return IsValid() && (GetSection().get() != NULL);
+ return IsValid() && (GetSection().get() != nullptr);
}
//------------------------------------------------------------------
@@ -374,7 +376,6 @@ public:
return m_offset != LLDB_INVALID_ADDRESS;
}
-
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
@@ -425,7 +426,9 @@ public:
SetLoadAddress (lldb::addr_t load_addr, Target *target);
bool
- SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);
+ SetOpcodeLoadAddress (lldb::addr_t load_addr,
+ Target *target,
+ lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
bool
SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);
@@ -505,6 +508,7 @@ public:
{
m_section_wp.reset();
}
+
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
@@ -564,10 +568,8 @@ protected:
//------------------------------------------------------------------
bool
SectionWasDeletedPrivate() const;
-
};
-
//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two
@@ -584,12 +586,9 @@ protected:
//----------------------------------------------------------------------
bool operator< (const Address& lhs, const Address& rhs);
bool operator> (const Address& lhs, const Address& rhs);
-
-
-
bool operator== (const Address& lhs, const Address& rhs);
bool operator!= (const Address& lhs, const Address& rhs);
} // namespace lldb_private
-#endif // liblldb_Address_h_
+#endif // liblldb_Address_h_
diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h
index 9d781f3e85ae9..31e3286cb1108 100644
--- a/include/lldb/Core/AddressRange.h
+++ b/include/lldb/Core/AddressRange.h
@@ -10,6 +10,10 @@
#ifndef liblldb_AddressRange_h_
#define liblldb_AddressRange_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/Address.h"
namespace lldb_private {
@@ -62,7 +66,7 @@ public:
/// @param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
//------------------------------------------------------------------
- AddressRange (lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list = NULL);
+ AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list = nullptr);
//------------------------------------------------------------------
/// Construct with a Address object address and byte size.
@@ -281,4 +285,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_AddressRange_h_
+#endif // liblldb_AddressRange_h_
diff --git a/include/lldb/Core/AddressResolver.h b/include/lldb/Core/AddressResolver.h
index e5fe276e3fb1e..711cc57c14a40 100644
--- a/include/lldb/Core/AddressResolver.h
+++ b/include/lldb/Core/AddressResolver.h
@@ -54,8 +54,7 @@ public:
AddressResolver ();
- virtual
- ~AddressResolver ();
+ ~AddressResolver () override;
virtual void
ResolveAddress (SearchFilter &filter);
@@ -64,8 +63,8 @@ public:
ResolveAddressInModules (SearchFilter &filter,
ModuleList &modules);
- virtual void
- GetDescription (Stream *s) = 0;
+ void
+ GetDescription (Stream *s) override = 0;
std::vector<AddressRange> &
GetAddressRanges ();
@@ -86,4 +85,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_AddressResolver_h_
+#endif // liblldb_AddressResolver_h_
diff --git a/include/lldb/Core/AddressResolverFileLine.h b/include/lldb/Core/AddressResolverFileLine.h
index ddeb0e0301d2e..5b47379ed18e2 100644
--- a/include/lldb/Core/AddressResolverFileLine.h
+++ b/include/lldb/Core/AddressResolverFileLine.h
@@ -30,20 +30,19 @@ public:
uint32_t line_no,
bool check_inlines);
- virtual
- ~AddressResolverFileLine ();
+ ~AddressResolverFileLine () override;
- virtual Searcher::CallbackReturn
+ Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
- bool containing);
+ bool containing) override;
- virtual Searcher::Depth
- GetDepth ();
+ Searcher::Depth
+ GetDepth () override;
- virtual void
- GetDescription (Stream *s);
+ void
+ GetDescription (Stream *s) override;
protected:
FileSpec m_file_spec; // This is the file spec we are looking for.
@@ -56,4 +55,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_AddressResolverFileLine_h_
+#endif // liblldb_AddressResolverFileLine_h_
diff --git a/include/lldb/Core/AddressResolverName.h b/include/lldb/Core/AddressResolverName.h
index afde675a89bbc..cf792f5054e6f 100644
--- a/include/lldb/Core/AddressResolverName.h
+++ b/include/lldb/Core/AddressResolverName.h
@@ -38,20 +38,19 @@ public:
const char *method,
AddressResolver::MatchType type);
- virtual
- ~AddressResolverName ();
+ ~AddressResolverName () override;
- virtual Searcher::CallbackReturn
+ Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
- bool containing);
+ bool containing) override;
- virtual Searcher::Depth
- GetDepth ();
+ Searcher::Depth
+ GetDepth () override;
- virtual void
- GetDescription (Stream *s);
+ void
+ GetDescription (Stream *s) override;
protected:
ConstString m_func_name;
@@ -65,4 +64,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_AddressResolverName_h_
+#endif // liblldb_AddressResolverName_h_
diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h
index 0b818a0c71236..13ff436cf08f6 100644
--- a/include/lldb/Core/ArchSpec.h
+++ b/include/lldb/Core/ArchSpec.h
@@ -65,7 +65,11 @@ public:
eMIPSAse_mips16 = 0x00000400, // MIPS16 ASE
eMIPSAse_micromips = 0x00000800, // MICROMIPS ASE
eMIPSAse_xpa = 0x00001000, // XPA ASE
- eMIPSAse_mask = 0x00001fff
+ eMIPSAse_mask = 0x00001fff,
+ eMIPSABI_O32 = 0x00002000,
+ eMIPSABI_N32 = 0x00004000,
+ eMIPSABI_N64 = 0x00008000,
+ eMIPSABI_mask = 0x000ff000
};
enum Core
@@ -208,7 +212,11 @@ public:
kCore_mips64_last = eCore_mips64r6,
kCore_mips64el_first = eCore_mips64el,
- kCore_mips64el_last = eCore_mips64r6el
+ kCore_mips64el_last = eCore_mips64r6el,
+
+ kCore_mips_first = eCore_mips32,
+ kCore_mips_last = eCore_mips64r6el
+
};
typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread &thread);
@@ -337,10 +345,28 @@ public:
}
bool
+ TripleVendorIsUnspecifiedUnknown() const
+ {
+ return m_triple.getVendor() == llvm::Triple::UnknownVendor && m_triple.getVendorName().empty();
+ }
+
+ bool
TripleOSWasSpecified() const
{
return !m_triple.getOSName().empty();
}
+
+ bool
+ TripleEnvironmentWasSpecified () const
+ {
+ return !m_triple.getEnvironmentName().empty();
+ }
+
+ bool
+ TripleOSIsUnspecifiedUnknown() const
+ {
+ return m_triple.getOS() == llvm::Triple::UnknownOS && m_triple.getOSName().empty();
+ }
//------------------------------------------------------------------
/// Merges fields from another ArchSpec into this ArchSpec.
@@ -480,6 +506,9 @@ public:
return m_triple;
}
+ void
+ DumpTriple(Stream &s) const;
+
//------------------------------------------------------------------
/// Architecture tripple setter.
///
@@ -564,7 +593,18 @@ public:
//------------------------------------------------------------------
StopInfoOverrideCallbackType
GetStopInfoOverrideCallback () const;
+
+ bool
+ IsFullySpecifiedTriple () const;
+ void
+ PiecewiseTripleCompare (const ArchSpec &other,
+ bool &arch_different,
+ bool &vendor_different,
+ bool &os_different,
+ bool &os_version_different,
+ bool &env_different);
+
uint32_t
GetFlags () const
{
diff --git a/include/lldb/Core/Broadcaster.h b/include/lldb/Core/Broadcaster.h
index 6d54b1b431339..8e59a41805ece 100644
--- a/include/lldb/Core/Broadcaster.h
+++ b/include/lldb/Core/Broadcaster.h
@@ -42,7 +42,7 @@ public:
BroadcastEventSpec (const BroadcastEventSpec &rhs);
- ~BroadcastEventSpec() {}
+ ~BroadcastEventSpec() = default;
const ConstString &GetBroadcasterClass() const
{
@@ -89,7 +89,7 @@ public:
BroadcasterManager ();
- ~BroadcasterManager () {}
+ ~BroadcasterManager() = default;
uint32_t
RegisterListenerForEvents (Listener &listener, BroadcastEventSpec event_spec);
@@ -128,7 +128,7 @@ private:
{
}
- ~BroadcasterClassMatches () {}
+ ~BroadcasterClassMatches() = default;
bool operator() (const event_listener_key input) const
{
@@ -147,7 +147,7 @@ private:
{
}
- ~BroadcastEventSpecMatches () {}
+ ~BroadcastEventSpecMatches() = default;
bool operator() (const event_listener_key input) const
{
@@ -168,7 +168,7 @@ private:
{
}
- ~ListenerMatchesAndSharedBits () {}
+ ~ListenerMatchesAndSharedBits() = default;
bool operator() (const event_listener_key input) const
{
@@ -190,7 +190,7 @@ private:
{
}
- ~ListenerMatches() {}
+ ~ListenerMatches() = default;
bool operator () (const event_listener_key input) const
{
@@ -204,7 +204,6 @@ private:
const Listener *m_listener;
};
-
};
//----------------------------------------------------------------------
@@ -286,10 +285,10 @@ public:
BroadcastEventIfUnique (lldb::EventSP &event_sp);
void
- BroadcastEvent (uint32_t event_type, EventData *event_data = NULL);
+ BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr);
void
- BroadcastEventIfUnique (uint32_t event_type, EventData *event_data = NULL);
+ BroadcastEventIfUnique(uint32_t event_type, EventData *event_data = nullptr);
void
Clear();
@@ -332,7 +331,6 @@ public:
const ConstString &
GetBroadcasterName ();
-
//------------------------------------------------------------------
/// Get the event name(s) for one or more event bits.
///
@@ -364,10 +362,10 @@ public:
const char *
GetEventName (uint32_t event_mask) const
{
- event_names_map::const_iterator pos = m_event_names.find (event_mask);
+ const auto pos = m_event_names.find (event_mask);
if (pos != m_event_names.end())
return pos->second.c_str();
- return NULL;
+ return nullptr;
}
bool
@@ -437,8 +435,6 @@ public:
BroadcasterManager *GetManager();
protected:
-
-
void
PrivateBroadcastEvent (lldb::EventSP &event_sp, bool unique);
diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h
index 6c627c2ad3b7e..80abc15f671c1 100644
--- a/include/lldb/Core/ClangForward.h
+++ b/include/lldb/Core/ClangForward.h
@@ -132,6 +132,8 @@ namespace clang
namespace llvm
{
+ class APInt;
+ class APSInt;
class LLVMContext;
class ExecutionEngine;
}
diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h
index 7924ed293d3cf..d29aaca9c2ea9 100644
--- a/include/lldb/Core/Communication.h
+++ b/include/lldb/Core/Communication.h
@@ -100,7 +100,6 @@ public:
typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
-
//------------------------------------------------------------------
/// Construct the Communication object with the specified name for
/// the Broadcaster that this object inherits from.
@@ -118,8 +117,7 @@ public:
///
/// The destructor is virtual since this class gets subclassed.
//------------------------------------------------------------------
- virtual
- ~Communication();
+ ~Communication() override;
void
Clear ();
@@ -157,7 +155,7 @@ public:
/// @see bool Connection::Disconnect ();
//------------------------------------------------------------------
lldb::ConnectionStatus
- Disconnect (Error *error_ptr = NULL);
+ Disconnect(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Check if the connection is valid.
@@ -177,6 +175,7 @@ public:
{
return m_connection_sp.get();
}
+
//------------------------------------------------------------------
/// Read bytes from the current connection.
///
@@ -278,7 +277,7 @@ public:
/// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
//------------------------------------------------------------------
virtual bool
- StartReadThread (Error *error_ptr = NULL);
+ StartReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Stops the read thread by cancelling it.
@@ -288,10 +287,10 @@ public:
/// false otherwise.
//------------------------------------------------------------------
virtual bool
- StopReadThread (Error *error_ptr = NULL);
+ StopReadThread(Error *error_ptr = nullptr);
virtual bool
- JoinReadThread (Error *error_ptr = NULL);
+ JoinReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
@@ -323,7 +322,6 @@ public:
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
-
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
@@ -350,18 +348,11 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
-private:
- //------------------------------------------------------------------
- // For Communication only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (Communication);
-
-
protected:
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
@@ -381,6 +372,7 @@ protected:
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
Error *error_ptr);
+
//------------------------------------------------------------------
/// Append new bytes that get read from the read thread into the
/// internal object byte cache. This will cause a \b
@@ -424,8 +416,11 @@ protected:
//------------------------------------------------------------------
size_t
GetCachedBytes (void *dst, size_t dst_len);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN (Communication);
};
} // namespace lldb_private
-#endif // liblldb_Communication_h_
+#endif // liblldb_Communication_h_
diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h
index 121395c0b23c6..4b3024ebdc576 100644
--- a/include/lldb/Core/Connection.h
+++ b/include/lldb/Core/Connection.h
@@ -58,7 +58,7 @@ public:
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
- /// approriate error value if this method returns false. This
+ /// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
@@ -77,7 +77,7 @@ public:
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
- /// approriate error value if this method returns false. This
+ /// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
@@ -115,12 +115,12 @@ public:
/// The number of microseconds to wait for the data.
///
/// @param[out] status
- /// On return, indicates whether the call was sucessful or terminated
+ /// On return, indicates whether the call was successful or terminated
/// due to some error condition.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
- /// approriate error value if this method returns zero. This
+ /// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
@@ -151,7 +151,7 @@ public:
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
- /// approriate error value if this method returns zero. This
+ /// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
@@ -182,7 +182,7 @@ public:
/// operation).
///
/// @return
- /// Returns true is the interrupt request was sucessful.
+ /// Returns true is the interrupt request was successful.
//------------------------------------------------------------------
virtual bool
InterruptRead() = 0;
diff --git a/include/lldb/Core/ConnectionSharedMemory.h b/include/lldb/Core/ConnectionSharedMemory.h
index 48e62142954e5..d0553699e14ef 100644
--- a/include/lldb/Core/ConnectionSharedMemory.h
+++ b/include/lldb/Core/ConnectionSharedMemory.h
@@ -28,33 +28,32 @@ public:
ConnectionSharedMemory ();
- virtual
- ~ConnectionSharedMemory ();
+ ~ConnectionSharedMemory () override;
- virtual bool
- IsConnected () const;
+ bool
+ IsConnected () const override;
virtual lldb::ConnectionStatus
BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
- virtual lldb::ConnectionStatus
- Connect (const char *s, Error *error_ptr);
+ lldb::ConnectionStatus
+ Connect (const char *s, Error *error_ptr) override;
- virtual lldb::ConnectionStatus
- Disconnect (Error *error_ptr);
+ lldb::ConnectionStatus
+ Disconnect (Error *error_ptr) override;
- virtual size_t
+ size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
- Error *error_ptr);
+ Error *error_ptr) override;
- virtual size_t
- Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
+ size_t
+ Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
- virtual std::string
- GetURI();
+ std::string
+ GetURI() override;
lldb::ConnectionStatus
Open (bool create, const char *name, size_t size, Error *error_ptr);
@@ -64,10 +63,12 @@ protected:
std::string m_name;
int m_fd; // One buffer that contains all we need
DataBufferMemoryMap m_mmap;
+
private:
+
DISALLOW_COPY_AND_ASSIGN (ConnectionSharedMemory);
};
} // namespace lldb_private
-#endif // liblldb_ConnectionSharedMemory_h_
+#endif // liblldb_ConnectionSharedMemory_h_
diff --git a/include/lldb/Core/ConstString.h b/include/lldb/Core/ConstString.h
index cfe8ea2db0e12..6e234da0a5957 100644
--- a/include/lldb/Core/ConstString.h
+++ b/include/lldb/Core/ConstString.h
@@ -9,13 +9,14 @@
#ifndef liblldb_ConstString_h_
#define liblldb_ConstString_h_
-#if defined(__cplusplus)
-#include <assert.h>
-
-#include "lldb/lldb-private.h"
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
+// Project includes
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -41,12 +42,11 @@ public:
///
/// Initializes the string to an empty string.
//------------------------------------------------------------------
- ConstString ():
- m_string (NULL)
+ ConstString():
+ m_string(nullptr)
{
}
-
//------------------------------------------------------------------
/// Copy constructor
///
@@ -105,10 +105,7 @@ public:
/// Since constant string values are currently not reference counted,
/// there isn't much to do here.
//------------------------------------------------------------------
- ~ConstString ()
- {
- }
-
+ ~ConstString() = default;
//----------------------------------------------------------------------
/// C string equality binary predicate function object for ConstString
@@ -224,18 +221,16 @@ public:
/// Get the value of the contained string as a NULL terminated C
/// string value.
///
- /// If \a value_if_empty is NULL, then NULL will be returned.
+ /// If \a value_if_empty is nullptr, then nullptr will be returned.
///
/// @return
/// Returns \a value_if_empty if the string is empty, otherwise
/// the C string value contained in this object.
//------------------------------------------------------------------
const char *
- AsCString(const char *value_if_empty = NULL) const
+ AsCString(const char *value_if_empty = nullptr) const
{
- if (IsEmpty())
- return value_if_empty;
- return m_string;
+ return (IsEmpty() ? value_if_empty : m_string);
}
//------------------------------------------------------------------
@@ -256,12 +251,12 @@ public:
///
/// Get the value of the contained string as a NULL terminated C
/// string value. Similar to the ConstString::AsCString() function,
- /// yet this function will always return NULL if the string is not
+ /// yet this function will always return nullptr if the string is not
/// valid. So this function is a direct accessor to the string
/// pointer value.
///
/// @return
- /// Returns NULL the string is invalid, otherwise the C string
+ /// Returns nullptr the string is invalid, otherwise the C string
/// value contained in this object.
//------------------------------------------------------------------
const char *
@@ -270,7 +265,6 @@ public:
return m_string;
}
-
//------------------------------------------------------------------
/// Get the length in bytes of string value.
///
@@ -293,7 +287,7 @@ public:
void
Clear ()
{
- m_string = NULL;
+ m_string = nullptr;
}
//------------------------------------------------------------------
@@ -326,18 +320,18 @@ public:
///
/// Dump the string value to the stream \a s. If the contained string
/// is empty, print \a value_if_empty to the stream instead. If
- /// \a value_if_empty is NULL, then nothing will be dumped to the
+ /// \a value_if_empty is nullptr, then nothing will be dumped to the
/// stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
///
/// @param[in] value_if_empty
- /// The value to dump if the string is empty. If NULL, nothing
+ /// The value to dump if the string is empty. If nullptr, nothing
/// will be output to the stream.
//------------------------------------------------------------------
void
- Dump (Stream *s, const char *value_if_empty = NULL) const;
+ Dump(Stream *s, const char *value_if_empty = nullptr) const;
//------------------------------------------------------------------
/// Dump the object debug description to a stream.
@@ -358,7 +352,7 @@ public:
bool
IsEmpty () const
{
- return m_string == NULL || m_string[0] == '\0';
+ return m_string == nullptr || m_string[0] == '\0';
}
//------------------------------------------------------------------
@@ -473,7 +467,6 @@ public:
{
return sizeof(ConstString);
}
-
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
@@ -503,5 +496,4 @@ Stream& operator << (Stream& s, const ConstString& str);
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_ConstString_h_
+#endif // liblldb_ConstString_h_
diff --git a/include/lldb/Core/DataBufferHeap.h b/include/lldb/Core/DataBufferHeap.h
index ad73fabe5f1ef..d379c4cf4e866 100644
--- a/include/lldb/Core/DataBufferHeap.h
+++ b/include/lldb/Core/DataBufferHeap.h
@@ -9,7 +9,6 @@
#ifndef liblldb_DataBufferHeap_h_
#define liblldb_DataBufferHeap_h_
-#if defined(__cplusplus)
#include <vector>
@@ -69,26 +68,25 @@ public:
/// Virtual destructor since this class inherits from a pure virtual
/// base class #DataBuffer.
//------------------------------------------------------------------
- virtual
- ~DataBufferHeap();
+ ~DataBufferHeap() override;
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetBytes()
//------------------------------------------------------------------
- virtual uint8_t *
- GetBytes ();
+ uint8_t *
+ GetBytes () override;
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetBytes() const
//------------------------------------------------------------------
- virtual const uint8_t *
- GetBytes () const;
+ const uint8_t *
+ GetBytes () const override;
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetByteSize() const
//------------------------------------------------------------------
- virtual lldb::offset_t
- GetByteSize () const;
+ lldb::offset_t
+ GetByteSize () const override;
//------------------------------------------------------------------
/// Set the number of bytes in the data buffer.
@@ -138,5 +136,4 @@ private:
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_DataBufferHeap_h_
+#endif // liblldb_DataBufferHeap_h_
diff --git a/include/lldb/Core/DataBufferMemoryMap.h b/include/lldb/Core/DataBufferMemoryMap.h
index 944b975a318a9..9479d4e1a4559 100644
--- a/include/lldb/Core/DataBufferMemoryMap.h
+++ b/include/lldb/Core/DataBufferMemoryMap.h
@@ -9,8 +9,6 @@
#ifndef liblldb_DataBufferMemoryMap_h_
#define liblldb_DataBufferMemoryMap_h_
-#if defined(__cplusplus)
-
#include "lldb/lldb-private.h"
#include "lldb/Core/DataBuffer.h"
@@ -45,8 +43,7 @@ public:
/// Virtual destructor since this class inherits from a pure virtual
/// base class #DataBuffer.
//------------------------------------------------------------------
- virtual
- ~DataBufferMemoryMap ();
+ ~DataBufferMemoryMap () override;
//------------------------------------------------------------------
/// Reverts this object to an empty state by unmapping any memory
@@ -58,20 +55,20 @@ public:
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetBytes()
//------------------------------------------------------------------
- virtual uint8_t *
- GetBytes ();
+ uint8_t *
+ GetBytes () override;
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetBytes() const
//------------------------------------------------------------------
- virtual const uint8_t *
- GetBytes () const;
+ const uint8_t *
+ GetBytes () const override;
//------------------------------------------------------------------
/// @copydoc DataBuffer::GetByteSize() const
//------------------------------------------------------------------
- virtual lldb::offset_t
- GetByteSize () const;
+ lldb::offset_t
+ GetByteSize () const override;
//------------------------------------------------------------------
/// Error get accessor.
@@ -161,5 +158,4 @@ private:
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_DataBufferMemoryMap_h_
+#endif // liblldb_DataBufferMemoryMap_h_
diff --git a/include/lldb/Core/DataEncoder.h b/include/lldb/Core/DataEncoder.h
index 7889f4191e507..8b4727eb2de2c 100644
--- a/include/lldb/Core/DataEncoder.h
+++ b/include/lldb/Core/DataEncoder.h
@@ -252,7 +252,7 @@ public:
/// The offset in bytes into the contained data at which to
/// start encoding.
///
- /// @param[int] src
+ /// @param[in] src
/// The buffer that contains the bytes to encode.
///
/// @param[in] src_len
diff --git a/include/lldb/Core/DataExtractor.h b/include/lldb/Core/DataExtractor.h
index e61189b981034..d5cb5e8ba4bc3 100644
--- a/include/lldb/Core/DataExtractor.h
+++ b/include/lldb/Core/DataExtractor.h
@@ -9,17 +9,18 @@
#ifndef liblldb_DataExtractor_h_
#define liblldb_DataExtractor_h_
-#if defined (__cplusplus)
-
-
-#include "lldb/lldb-private.h"
-
-#include "llvm/ADT/SmallVector.h"
+// C Includes
#include <limits.h>
#include <stdint.h>
#include <string.h>
-#include <vector>
+
+// C++ Includes
+// Other libraries and framework includes
+#include "llvm/ADT/SmallVector.h"
+
+// Project includes
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -64,6 +65,7 @@ public:
size_t src_len,
uint32_t bytes_per_line,
lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS to not show address at start of line
+
//------------------------------------------------------------------
/// Default constructor.
///
@@ -146,6 +148,7 @@ public:
DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size = 1);
DataExtractor (const DataExtractor& rhs);
+
//------------------------------------------------------------------
/// Assignment operator.
///
@@ -183,14 +186,14 @@ public:
//------------------------------------------------------------------
/// Dumps the binary data as \a type objects to stream \a s (or to
- /// Log() if \a s is NULL) starting \a offset bytes into the data
+ /// Log() if \a s is nullptr) starting \a offset bytes into the data
/// and stopping after dumping \a length bytes. The offset into the
/// data is displayed at the beginning of each line and can be
/// offset by base address \a base_addr. \a num_per_line objects
/// will be displayed on each line.
///
/// @param[in] s
- /// The stream to dump the output to. If NULL the output will
+ /// The stream to dump the output to. If nullptr the output will
/// be dumped to Log().
///
/// @param[in] offset
@@ -212,19 +215,19 @@ public:
///
/// @param[in] type_format
/// The optional format to use for the \a type objects. If this
- /// is NULL, the default format for the \a type will be used.
+ /// is nullptr, the default format for the \a type will be used.
///
/// @return
/// The offset at which dumping ended.
//------------------------------------------------------------------
lldb::offset_t
- PutToLog (Log *log,
- lldb::offset_t offset,
- lldb::offset_t length,
- uint64_t base_addr,
- uint32_t num_per_line,
- Type type,
- const char *type_format = NULL) const;
+ PutToLog(Log *log,
+ lldb::offset_t offset,
+ lldb::offset_t length,
+ uint64_t base_addr,
+ uint32_t num_per_line,
+ Type type,
+ const char *type_format = nullptr) const;
//------------------------------------------------------------------
/// Dumps \a item_count objects into the stream \a s.
@@ -241,7 +244,7 @@ public:
/// item_bit_size and \a item_bit_offset values.
///
/// @param[in] s
- /// The stream to dump the output to. This value can not be NULL.
+ /// The stream to dump the output to. This value can not be nullptr.
///
/// @param[in] offset
/// The offset into the data at which to start dumping.
@@ -287,25 +290,25 @@ public:
/// The offset at which dumping ended.
//------------------------------------------------------------------
lldb::offset_t
- Dump (Stream *s,
- lldb::offset_t offset,
- lldb::Format item_format,
- size_t item_byte_size,
- size_t item_count,
- size_t num_per_line,
- uint64_t base_addr,
- uint32_t item_bit_size,
- uint32_t item_bit_offset,
- ExecutionContextScope *exe_scope = NULL) const;
+ Dump(Stream *s,
+ lldb::offset_t offset,
+ lldb::Format item_format,
+ size_t item_byte_size,
+ size_t item_count,
+ size_t num_per_line,
+ uint64_t base_addr,
+ uint32_t item_bit_size,
+ uint32_t item_bit_offset,
+ ExecutionContextScope *exe_scope = nullptr) const;
//------------------------------------------------------------------
/// Dump a UUID value at \a offset.
///
/// Dump a UUID starting at \a offset bytes into this object's data.
- /// If the stream \a s is NULL, the output will be sent to Log().
+ /// If the stream \a s is nullptr, the output will be sent to Log().
///
/// @param[in] s
- /// The stream to dump the output to. If NULL the output will
+ /// The stream to dump the output to. If nullptr the output will
/// be dumped to Log().
///
/// @param[in] offset
@@ -418,7 +421,7 @@ public:
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the C string is out of bounds,
- /// NULL will be returned.
+ /// nullptr will be returned.
//------------------------------------------------------------------
const char *
GetCStr (lldb::offset_t *offset_ptr) const;
@@ -443,7 +446,7 @@ public:
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the field is out of bounds, or if
- /// the field does not contain a NULL terminator byte, NULL will
+ /// the field does not contain a NULL terminator byte, nullptr will
/// be returned.
const char *
GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const;
@@ -454,7 +457,7 @@ public:
/// Returns a pointer to a bytes in this object's data at the offset
/// pointed to by \a offset_ptr. If \a length is zero or too large,
/// then the offset pointed to by \a offset_ptr will not be updated
- /// and NULL will be returned.
+ /// and nullptr will be returned.
///
/// @param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -469,7 +472,7 @@ public:
///
/// @return
/// A pointer to the bytes in this object's data if the offset
- /// and length are valid, or NULL otherwise.
+ /// and length are valid, or nullptr otherwise.
//------------------------------------------------------------------
const void*
GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const
@@ -552,7 +555,7 @@ public:
///
/// @return
/// Returns a pointer to the next byte contained in this
- /// object's data, or NULL of there is no data in this object.
+ /// object's data, or nullptr of there is no data in this object.
//------------------------------------------------------------------
const uint8_t *
GetDataEnd () const
@@ -578,7 +581,7 @@ public:
///
/// @return
/// Returns a pointer to the first byte contained in this
- /// object's data, or NULL of there is no data in this object.
+ /// object's data, or nullptr of there is no data in this object.
//------------------------------------------------------------------
const uint8_t *
GetDataStart () const
@@ -586,7 +589,6 @@ public:
return m_start;
}
-
//------------------------------------------------------------------
/// Extract a float from \a *offset_ptr.
///
@@ -908,7 +910,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -955,7 +957,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1002,7 +1004,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1049,7 +1051,7 @@ public:
///
/// @return
/// \a dst if all values were properly extracted and copied,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
void *
GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@@ -1113,8 +1115,8 @@ public:
/// An offset into the data.
///
/// @return
- /// A non-NULL C string pointer if \a offset is a valid offset,
- /// NULL otherwise.
+ /// A non-nullptr C string pointer if \a offset is a valid offset,
+ /// nullptr otherwise.
//------------------------------------------------------------------
const char *
PeekCStr (lldb::offset_t offset) const;
@@ -1126,8 +1128,8 @@ public:
/// there are \a length bytes available starting at \a offset.
///
/// @return
- /// A non-NULL data pointer if \a offset is a valid offset and
- /// there are \a length bytes available at that offset, NULL
+ /// A non-nullptr data pointer if \a offset is a valid offset and
+ /// there are \a length bytes available at that offset, nullptr
/// otherwise.
//------------------------------------------------------------------
const uint8_t*
@@ -1135,7 +1137,7 @@ public:
{
if (length > 0 && ValidOffsetForDataOfSize(offset, length))
return m_start + offset;
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1150,6 +1152,9 @@ public:
void
SetAddressByteSize (uint32_t addr_size)
{
+#ifdef LLDB_CONFIGURATION_DEBUG
+ assert (addr_size == 4 || addr_size == 8);
+#endif
m_addr_size = addr_size;
}
@@ -1159,7 +1164,7 @@ public:
/// Use data that is owned by the caller when extracting values.
/// The data must stay around as long as this object, or any object
/// that copies a subset of this object's data, is valid. If \a
- /// bytes is NULL, or \a length is zero, this object will contain
+ /// bytes is nullptr, or \a length is zero, this object will contain
/// no data.
///
/// @param[in] bytes
@@ -1317,10 +1322,8 @@ public:
void
Checksum (llvm::SmallVectorImpl<uint8_t> &dest,
uint64_t max_data = 0);
-
protected:
-
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
@@ -1334,5 +1337,4 @@ protected:
} // namespace lldb_private
-#endif // #if defined (__cplusplus)
-#endif // #ifndef liblldb_DataExtractor_h_
+#endif // liblldb_DataExtractor_h_
diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h
index 0d9b90c8919d4..4ca648ca296eb 100644
--- a/include/lldb/Core/Debugger.h
+++ b/include/lldb/Core/Debugger.h
@@ -9,11 +9,17 @@
#ifndef liblldb_Debugger_h_
#define liblldb_Debugger_h_
-#if defined(__cplusplus)
-
+// C Includes
#include <stdint.h>
+// C++ Includes
+#include <memory>
+#include <map>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/FormatEntity.h"
@@ -32,8 +38,8 @@ namespace llvm
namespace sys
{
class DynamicLibrary;
-}
-}
+} // namespace sys
+} // namespace llvm
namespace lldb_private {
@@ -44,7 +50,6 @@ namespace lldb_private {
/// Provides a global root objects for the debugger core.
//----------------------------------------------------------------------
-
class Debugger :
public std::enable_shared_from_this<Debugger>,
public UserID,
@@ -54,9 +59,10 @@ class Debugger :
friend class SourceManager; // For GetSourceFileCache.
public:
+ ~Debugger() override;
static lldb::DebuggerSP
- CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
+ CreateInstance(lldb::LogOutputCallback log_callback = nullptr, void *baton = nullptr);
static lldb::TargetSP
FindTargetWithProcessID (lldb::pid_t pid);
@@ -79,9 +85,26 @@ public:
static void
Destroy (lldb::DebuggerSP &debugger_sp);
- virtual
- ~Debugger ();
+ static lldb::DebuggerSP
+ FindDebuggerWithID(lldb::user_id_t id);
+ static lldb::DebuggerSP
+ FindDebuggerWithInstanceName(const ConstString &instance_name);
+
+ static size_t
+ GetNumDebuggers();
+
+ static lldb::DebuggerSP
+ GetDebuggerAtIndex(size_t index);
+
+ static bool
+ FormatDisassemblerAddress(const FormatEntity::Entry *format,
+ const SymbolContext *sc,
+ const SymbolContext *prev_sc,
+ const ExecutionContext *exe_ctx,
+ const Address *addr,
+ Stream &s);
+
void Clear();
bool
@@ -108,8 +131,6 @@ public:
return m_error_file_sp;
}
-
-
void
SetInputFileHandle (FILE *fh, bool tranfer_ownership);
@@ -209,6 +230,10 @@ public:
bool
IsTopIOHandler (const lldb::IOHandlerSP& reader_sp);
+
+ bool
+ CheckTopIOHandlerTypes (IOHandler::Type top_type,
+ IOHandler::Type second_top_type);
void
PrintAsync (const char *s, size_t len, bool is_stdout);
@@ -222,26 +247,6 @@ public:
const char *
GetIOHandlerHelpPrologue();
- static lldb::DebuggerSP
- FindDebuggerWithID (lldb::user_id_t id);
-
- static lldb::DebuggerSP
- FindDebuggerWithInstanceName (const ConstString &instance_name);
-
- static size_t
- GetNumDebuggers();
-
- static lldb::DebuggerSP
- GetDebuggerAtIndex (size_t index);
-
- static bool
- FormatDisassemblerAddress (const FormatEntity::Entry *format,
- const SymbolContext *sc,
- const SymbolContext *prev_sc,
- const ExecutionContext *exe_ctx,
- const Address *addr,
- Stream &s);
-
void
ClearIOHandlers ();
@@ -257,22 +262,22 @@ public:
void
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
-
//----------------------------------------------------------------------
// Properties Functions
//----------------------------------------------------------------------
enum StopDisassemblyType
{
eStopDisassemblyTypeNever = 0,
+ eStopDisassemblyTypeNoDebugInfo,
eStopDisassemblyTypeNoSource,
eStopDisassemblyTypeAlways
};
- virtual Error
- SetPropertyValue (const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *property_path,
- const char *value);
+ Error
+ SetPropertyValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op,
+ const char *property_path,
+ const char *value) override;
bool
GetAutoConfirm () const;
@@ -329,6 +334,24 @@ public:
GetAutoOneLineSummaries () const;
bool
+ GetAutoIndent () const;
+
+ bool
+ SetAutoIndent (bool b);
+
+ bool
+ GetPrintDecls () const;
+
+ bool
+ SetPrintDecls (bool b);
+
+ uint32_t
+ GetTabSize () const;
+
+ bool
+ SetTabSize (uint32_t tab_size);
+
+ bool
GetEscapeNonPrintables () const;
bool
@@ -360,6 +383,9 @@ public:
{
return m_event_handler_thread.IsJoinable();
}
+
+ Error
+ RunREPL (lldb::LanguageType language, const char *repl_options);
// This is for use in the command interpreter, when you either want the selected target, or if no target
// is present you want to prime the dummy target with entities that will be copied over to new targets.
@@ -367,8 +393,8 @@ public:
Target *GetDummyTarget();
protected:
-
friend class CommandInterpreter;
+ friend class REPL;
bool
StartEventHandlerThread();
@@ -380,11 +406,17 @@ protected:
EventHandlerThread (lldb::thread_arg_t arg);
bool
+ HasIOHandlerThread();
+
+ bool
StartIOHandlerThread();
void
StopIOHandlerThread();
+ void
+ JoinIOHandlerThread();
+
static lldb::thread_result_t
IOHandlerThread (lldb::thread_arg_t arg);
@@ -450,16 +482,13 @@ protected:
};
private:
-
// Use Debugger::CreateInstance() to get a shared pointer to a new
// debugger object
Debugger (lldb::LogOutputCallback m_log_callback, void *baton);
DISALLOW_COPY_AND_ASSIGN (Debugger);
-
};
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_Debugger_h_
+#endif // liblldb_Debugger_h_
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h
index e08e2def4c188..bfa99de81ea4a 100644
--- a/include/lldb/Core/Disassembler.h
+++ b/include/lldb/Core/Disassembler.h
@@ -48,6 +48,7 @@ public:
CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx);
return m_opcode_name.c_str();
}
+
const char *
GetOperands (const ExecutionContext* exe_ctx)
{
@@ -127,7 +128,6 @@ public:
/// so this method can properly align the instruction opcodes.
/// May be 0 to indicate no indentation/alignment of the opcodes.
//------------------------------------------------------------------
-
virtual void
Dump (Stream *s,
uint32_t max_opcode_byte_size,
@@ -142,6 +142,9 @@ public:
virtual bool
DoesBranch () = 0;
+ virtual bool
+ HasDelaySlot ();
+
virtual size_t
Decode (const Disassembler &disassembler,
const DataExtractor& data,
@@ -208,7 +211,6 @@ protected:
}
};
-
class InstructionList
{
public:
@@ -260,30 +262,32 @@ public:
PseudoInstruction ();
- virtual
- ~PseudoInstruction ();
+ ~PseudoInstruction() override;
- virtual bool
- DoesBranch ();
+ bool
+ DoesBranch() override;
- virtual void
- CalculateMnemonicOperandsAndComment (const ExecutionContext* exe_ctx)
+ bool
+ HasDelaySlot() override;
+
+ void
+ CalculateMnemonicOperandsAndComment(const ExecutionContext* exe_ctx) override
{
// TODO: fill this in and put opcode name into Instruction::m_opcode_name,
// mnemonic into Instruction::m_mnemonics, and any comment into
// Instruction::m_comment
}
- virtual size_t
- Decode (const Disassembler &disassembler,
- const DataExtractor &data,
- lldb::offset_t data_offset);
+ size_t
+ Decode(const Disassembler &disassembler,
+ const DataExtractor &data,
+ lldb::offset_t data_offset) override;
void
SetOpcode (size_t opcode_size, void *opcode_data);
- virtual void
- SetDescription (const char *description);
+ void
+ SetDescription(const char *description) override;
protected:
std::string m_description;
@@ -405,7 +409,7 @@ public:
// Constructors and Destructors
//------------------------------------------------------------------
Disassembler(const ArchSpec &arch, const char *flavor);
- virtual ~Disassembler();
+ ~Disassembler() override;
typedef const char * (*SummaryCallback)(const Instruction& inst, ExecutionContext *exe_context, void *user_data);
@@ -478,4 +482,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Disassembler_h_
+#endif // liblldb_Disassembler_h_
diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h
index 774d80968ff92..c5e60022fc963 100644
--- a/include/lldb/Core/EmulateInstruction.h
+++ b/include/lldb/Core/EmulateInstruction.h
@@ -19,6 +19,8 @@
#include "lldb/Core/Opcode.h"
#include "lldb/Core/RegisterValue.h"
+namespace lldb_private {
+
//----------------------------------------------------------------------
/// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h"
/// @brief A class that allows emulation of CPU opcodes.
@@ -79,8 +81,6 @@
/// and emulating the instruction is just a bonus.
//----------------------------------------------------------------------
-namespace lldb_private {
-
class EmulateInstruction :
public PluginInterface
{
@@ -233,7 +233,6 @@ public:
} ISAAndImmediateSigned;
uint32_t isa;
-
} info;
Context () :
@@ -387,9 +386,8 @@ public:
EmulateInstruction (const ArchSpec &arch);
- virtual ~EmulateInstruction()
- {
- }
+ ~EmulateInstruction() override = default;
+
//----------------------------------------------------------------------
// Mandatory overrides
//----------------------------------------------------------------------
@@ -404,7 +402,10 @@ public:
virtual bool
EvaluateInstruction (uint32_t evaluate_options) = 0;
-
+
+ virtual bool
+ IsInstructionConditional() { return false; }
+
virtual bool
TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0;
@@ -527,7 +528,6 @@ public:
return m_arch;
}
-
static size_t
ReadMemoryFrame (EmulateInstruction *instruction,
void *baton,
@@ -628,7 +628,6 @@ protected:
lldb::addr_t m_addr;
Opcode m_opcode;
-
private:
//------------------------------------------------------------------
// For EmulateInstruction only
@@ -636,6 +635,6 @@ private:
DISALLOW_COPY_AND_ASSIGN (EmulateInstruction);
};
-} // namespace lldb_private
+} // namespace lldb_private
-#endif // lldb_EmulateInstruction_h_
+#endif // lldb_EmulateInstruction_h_
diff --git a/include/lldb/Core/Event.h b/include/lldb/Core/Event.h
index 1c3eec0359c3e..e8867c0e7e772 100644
--- a/include/lldb/Core/Event.h
+++ b/include/lldb/Core/Event.h
@@ -12,7 +12,7 @@
// C Includes
// C++ Includes
-#include <list>
+#include <memory>
#include <string>
// Other libraries and framework includes
@@ -49,7 +49,6 @@ private:
}
DISALLOW_COPY_AND_ASSIGN (EventData);
-
};
//----------------------------------------------------------------------
@@ -67,17 +66,16 @@ public:
EventDataBytes (const void *src, size_t src_len);
- virtual
- ~EventDataBytes();
+ ~EventDataBytes() override;
//------------------------------------------------------------------
// Member functions
//------------------------------------------------------------------
- virtual const ConstString &
- GetFlavor () const;
+ const ConstString &
+ GetFlavor () const override;
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump (Stream *s) const override;
const void *
GetBytes() const;
@@ -113,7 +111,6 @@ private:
std::string m_bytes;
DISALLOW_COPY_AND_ASSIGN (EventDataBytes);
-
};
//----------------------------------------------------------------------
@@ -126,10 +123,9 @@ class Event
friend class EventData;
public:
+ Event(Broadcaster *broadcaster, uint32_t event_type, EventData *data = nullptr);
- Event (Broadcaster *broadcaster, uint32_t event_type, EventData *data = NULL);
-
- Event (uint32_t event_type, EventData *data = NULL);
+ Event(uint32_t event_type, EventData *data = nullptr);
~Event ();
@@ -184,7 +180,6 @@ public:
m_data_ap.reset();
}
-
private:
// This is only called by Listener when it pops an event off the queue for
// the listener. It calls the Event Data's DoOnRemoval() method, which is
@@ -202,7 +197,6 @@ private:
m_broadcaster = broadcaster;
}
-
Broadcaster * m_broadcaster; // The broadcaster that sent this event
uint32_t m_type; // The bit describing this event
std::unique_ptr<EventData> m_data_ap; // User specific data for this event
@@ -214,4 +208,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Event_h_
+#endif // liblldb_Event_h_
diff --git a/include/lldb/Core/FileLineResolver.h b/include/lldb/Core/FileLineResolver.h
index e1928f1b063d6..f0f7fbdf756f4 100644
--- a/include/lldb/Core/FileLineResolver.h
+++ b/include/lldb/Core/FileLineResolver.h
@@ -38,20 +38,19 @@ public:
uint32_t line_no,
bool check_inlines);
- virtual
- ~FileLineResolver ();
+ ~FileLineResolver () override;
- virtual Searcher::CallbackReturn
+ Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
- bool containing);
+ bool containing) override;
- virtual Searcher::Depth
- GetDepth ();
+ Searcher::Depth
+ GetDepth () override;
- virtual void
- GetDescription (Stream *s);
+ void
+ GetDescription (Stream *s) override;
const SymbolContextList &
GetFileLineMatches()
@@ -78,4 +77,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_FileLineResolver_h_
+#endif // liblldb_FileLineResolver_h_
diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h
index db4f59132832e..659b696e61fd4 100644
--- a/include/lldb/Core/FormatEntity.h
+++ b/include/lldb/Core/FormatEntity.h
@@ -9,18 +9,21 @@
#ifndef liblldb_FormatEntity_h_
#define liblldb_FormatEntity_h_
-#if defined(__cplusplus)
+// C Includes
+// C++ Includes
#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Error.h"
namespace llvm
{
class StringRef;
-}
+} // namespace llvm
namespace lldb_private
{
@@ -81,6 +84,7 @@ namespace lldb_private
FunctionPCOffset,
FunctionInitial,
FunctionChanged,
+ FunctionIsOptimized,
LineEntryFile,
LineEntryLineNumber,
LineEntryStartAddress,
@@ -108,13 +112,13 @@ namespace lldb_private
bool keep_separator;
};
- Entry (Type t = Type::Invalid,
- const char *s = NULL,
- const char *f = NULL) :
+ Entry(Type t = Type::Invalid,
+ const char *s = nullptr,
+ const char *f = nullptr) :
string (s ? s : ""),
printf_format (f ? f : ""),
children (),
- definition (NULL),
+ definition (nullptr),
type (t),
fmt (lldb::eFormatDefault),
number (0),
@@ -146,7 +150,7 @@ namespace lldb_private
string.clear();
printf_format.clear();
children.clear();
- definition = NULL;
+ definition = nullptr;
type = Type::Invalid;
fmt = lldb::eFormatDefault;
number = 0;
@@ -252,12 +256,10 @@ namespace lldb_private
static bool
FormatFileSpec (const FileSpec &file, Stream &s, llvm::StringRef elements, llvm::StringRef element_format);
protected:
-
static Error
ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint32_t depth);
};
+} // namespace lldb_private
-}
-#endif // #if defined(__cplusplus)
-#endif // liblldb_FormatEntity_h_
+#endif // liblldb_FormatEntity_h_
diff --git a/include/lldb/Core/History.h b/include/lldb/Core/History.h
index b3626882f8432..fbb7bd8b0c1a7 100644
--- a/include/lldb/Core/History.h
+++ b/include/lldb/Core/History.h
@@ -82,7 +82,6 @@ private:
collection m_events;
DISALLOW_COPY_AND_ASSIGN (HistorySource);
-
};
//----------------------------------------------------------------------
@@ -103,8 +102,7 @@ class HistorySourceUInt : public HistorySource
{
}
- virtual
- ~HistorySourceUInt()
+ ~HistorySourceUInt() override
{
}
@@ -112,44 +110,44 @@ class HistorySourceUInt : public HistorySource
// in the subclass of this class to produce a history event and push it
// onto the end of the history stack.
- virtual HistoryEvent
- CreateHistoryEvent ()
+ HistoryEvent
+ CreateHistoryEvent () override
{
++m_curr_id;
return (HistoryEvent)m_curr_id;
}
- virtual void
- DeleteHistoryEvent (HistoryEvent event)
+ void
+ DeleteHistoryEvent (HistoryEvent event) override
{
// Nothing to delete, the event contains the integer
}
- virtual void
- DumpHistoryEvent (Stream &strm, HistoryEvent event);
+ void
+ DumpHistoryEvent (Stream &strm, HistoryEvent event) override;
- virtual size_t
- GetHistoryEventCount()
+ size_t
+ GetHistoryEventCount() override
{
return m_curr_id;
}
- virtual HistoryEvent
- GetHistoryEventAtIndex (uint32_t idx)
+ HistoryEvent
+ GetHistoryEventAtIndex (uint32_t idx) override
{
return (HistoryEvent)((uintptr_t)idx);
}
- virtual HistoryEvent
- GetCurrentHistoryEvent ()
+ HistoryEvent
+ GetCurrentHistoryEvent () override
{
return (HistoryEvent)m_curr_id;
}
// Return 0 when lhs == rhs, 1 if lhs > rhs, or -1 if lhs < rhs.
- virtual int
+ int
CompareHistoryEvents (const HistoryEvent lhs,
- const HistoryEvent rhs)
+ const HistoryEvent rhs) override
{
uintptr_t lhs_uint = (uintptr_t)lhs;
uintptr_t rhs_uint = (uintptr_t)rhs;
@@ -160,8 +158,8 @@ class HistorySourceUInt : public HistorySource
return 0;
}
- virtual bool
- IsCurrentHistoryEvent (const HistoryEvent event)
+ bool
+ IsCurrentHistoryEvent (const HistoryEvent event) override
{
return (uintptr_t)event == m_curr_id;
}
@@ -171,7 +169,6 @@ protected:
uintptr_t m_curr_id; // The current value of the history unsigned unteger
};
-
} // namespace lldb_private
-#endif // lldb_History_h_
+#endif // lldb_History_h_
diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h
index b617d8e75f583..3eba1c3cc9d83 100644
--- a/include/lldb/Core/IOHandler.h
+++ b/include/lldb/Core/IOHandler.h
@@ -10,10 +10,16 @@
#ifndef liblldb_IOHandler_h_
#define liblldb_IOHandler_h_
+// C Includes
#include <string.h>
-#include <stack>
+// C++ Includes
+#include <memory>
+#include <string>
+#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ConstString.h"
@@ -29,7 +35,7 @@ namespace curses
{
class Application;
typedef std::unique_ptr<Application> ApplicationAP;
-}
+} // namespace curses
namespace lldb_private {
@@ -42,6 +48,7 @@ namespace lldb_private {
Confirm,
Curses,
Expression,
+ REPL,
ProcessIO,
PythonInterpreter,
PythonCode,
@@ -123,7 +130,7 @@ namespace lldb_private {
GetPrompt ()
{
// Prompt support isn't mandatory
- return NULL;
+ return nullptr;
}
virtual bool
@@ -142,13 +149,13 @@ namespace lldb_private {
virtual const char *
GetCommandPrefix ()
{
- return NULL;
+ return nullptr;
}
virtual const char *
GetHelpPrologue()
{
- return NULL;
+ return nullptr;
}
int
@@ -257,7 +264,6 @@ namespace lldb_private {
private:
DISALLOW_COPY_AND_ASSIGN (IOHandler);
};
-
//------------------------------------------------------------------
/// A delegate class for use with IOHandler subclasses.
@@ -283,9 +289,7 @@ namespace lldb_private {
}
virtual
- ~IOHandlerDelegate()
- {
- }
+ ~IOHandlerDelegate() = default;
virtual void
IOHandlerActivated (IOHandler &io_handler)
@@ -309,7 +313,7 @@ namespace lldb_private {
virtual const char *
IOHandlerGetFixIndentationCharacters ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -395,13 +399,13 @@ namespace lldb_private {
virtual const char *
IOHandlerGetCommandPrefix ()
{
- return NULL;
+ return nullptr;
}
virtual const char *
IOHandlerGetHelpPrologue ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -415,6 +419,7 @@ namespace lldb_private {
{
return false;
}
+
protected:
Completion m_completion; // Support for common builtin completions
bool m_io_handler_done;
@@ -438,10 +443,7 @@ namespace lldb_private {
{
}
- virtual
- ~IOHandlerDelegateMultiline ()
- {
- }
+ ~IOHandlerDelegateMultiline() override = default;
ConstString
IOHandlerGetControlSequence (char ch) override
@@ -467,11 +469,11 @@ namespace lldb_private {
}
return false;
}
+
protected:
const std::string m_end_line;
};
-
class IOHandlerEditline : public IOHandler
{
public:
@@ -499,8 +501,7 @@ namespace lldb_private {
uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start'
IOHandlerDelegate &delegate);
- virtual
- ~IOHandlerEditline ();
+ ~IOHandlerEditline() override;
void
Run () override;
@@ -632,8 +633,7 @@ namespace lldb_private {
const char *prompt,
bool default_response);
- virtual
- ~IOHandlerConfirm ();
+ ~IOHandlerConfirm() override;
bool
GetResponse () const
@@ -694,14 +694,14 @@ namespace lldb_private {
public:
IOHandlerCursesValueObjectList (Debugger &debugger, ValueObjectList &valobj_list);
- virtual
- ~IOHandlerCursesValueObjectList ();
+ ~IOHandlerCursesValueObjectList() override;
void
Run () override;
void
GotEOF() override;
+
protected:
ValueObjectList m_valobj_list;
};
@@ -709,17 +709,14 @@ namespace lldb_private {
class IOHandlerStack
{
public:
-
IOHandlerStack () :
m_stack(),
m_mutex(Mutex::eMutexTypeRecursive),
- m_top (NULL)
+ m_top (nullptr)
{
}
- ~IOHandlerStack ()
- {
- }
+ ~IOHandlerStack() = default;
size_t
GetSize () const
@@ -771,10 +768,8 @@ namespace lldb_private {
sp->SetPopped (true);
}
// Set m_top the non-locking IsTop() call
- if (m_stack.empty())
- m_top = NULL;
- else
- m_top = m_stack.back().get();
+
+ m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
}
Mutex &
@@ -794,53 +789,42 @@ namespace lldb_private {
{
Mutex::Locker locker (m_mutex);
const size_t num_io_handlers = m_stack.size();
- if (num_io_handlers >= 2 &&
- m_stack[num_io_handlers-1]->GetType() == top_type &&
- m_stack[num_io_handlers-2]->GetType() == second_top_type)
- {
- return true;
- }
- return false;
+ return (num_io_handlers >= 2 &&
+ m_stack[num_io_handlers-1]->GetType() == top_type &&
+ m_stack[num_io_handlers-2]->GetType() == second_top_type);
}
+
ConstString
GetTopIOHandlerControlSequence (char ch)
{
- if (m_top)
- return m_top->GetControlSequence(ch);
- return ConstString();
+ return ((m_top != nullptr) ? m_top->GetControlSequence(ch) : ConstString());
}
const char *
GetTopIOHandlerCommandPrefix()
{
- if (m_top)
- return m_top->GetCommandPrefix();
- return NULL;
+ return ((m_top != nullptr) ? m_top->GetCommandPrefix() : nullptr);
}
const char *
GetTopIOHandlerHelpPrologue()
{
- if (m_top)
- return m_top->GetHelpPrologue();
- return NULL;
+ return ((m_top != nullptr) ? m_top->GetHelpPrologue() : nullptr);
}
void
PrintAsync (Stream *stream, const char *s, size_t len);
protected:
-
typedef std::vector<lldb::IOHandlerSP> collection;
collection m_stack;
mutable Mutex m_mutex;
IOHandler *m_top;
private:
-
DISALLOW_COPY_AND_ASSIGN (IOHandlerStack);
};
} // namespace lldb_private
-#endif // #ifndef liblldb_IOHandler_h_
+#endif // liblldb_IOHandler_h_
diff --git a/include/lldb/Core/Language.h b/include/lldb/Core/Language.h
deleted file mode 100644
index 670c6aa695e1d..0000000000000
--- a/include/lldb/Core/Language.h
+++ /dev/null
@@ -1,117 +0,0 @@
-//===-- Language.h ----------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Language_h_
-#define liblldb_Language_h_
-
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class Language Language.h "lldb/Core/Language.h"
-/// @brief Encapsulates the programming language for an lldb object.
-///
-/// Languages are represented by an enumeration value.
-///
-/// The enumeration values used when describing the programming language
-/// are the same values as the latest DWARF specification.
-//----------------------------------------------------------------------
-class Language
-{
-public:
- //------------------------------------------------------------------
- /// Construct with optional language enumeration.
- //------------------------------------------------------------------
- Language(lldb::LanguageType language = lldb::eLanguageTypeUnknown);
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual in case this class is subclassed.
- //------------------------------------------------------------------
- virtual
- ~Language();
-
- //------------------------------------------------------------------
- /// Get the language value as a NULL termianted C string.
- ///
- /// @return
- /// The C string representation of the language. The returned
- /// string does not need to be freed as it comes from constant
- /// strings. NULL can be returned when the language is set to
- /// a value that doesn't match of of the lldb::LanguageType
- /// enumerations.
- //------------------------------------------------------------------
- const char *
- AsCString (lldb::DescriptionLevel level = lldb::eDescriptionLevelBrief) const;
-
- void
- Clear();
-
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-
- //------------------------------------------------------------------
- /// Dump the language value to the stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the language description.
- //------------------------------------------------------------------
- void
- Dump(Stream *s) const;
-
- //------------------------------------------------------------------
- /// Get accessor for the language.
- ///
- /// @return
- /// The enumeration value that describes the programming
- /// language that an object is associated with.
- //------------------------------------------------------------------
- virtual lldb::LanguageType
- GetLanguage() const;
-
- //------------------------------------------------------------------
- /// Set accessor for the language.
- ///
- /// @param[in] language
- /// The new enumeration value that describes the programming
- /// language that an object is associated with.
- //------------------------------------------------------------------
- void
- SetLanguage(lldb::LanguageType language);
-
- //------------------------------------------------------------------
- /// Set accessor for the language.
- ///
- /// @param[in] language_cstr
- /// The language name as a C string.
- //------------------------------------------------------------------
- bool
- SetLanguageFromCString(const char *language_cstr);
-
-
-protected:
- //------------------------------------------------------------------
- // Member variables
- //------------------------------------------------------------------
- lldb::LanguageType m_language; ///< The programming language enumeration value.
- ///< The enumeration values are the same as the
- ///< latest DWARF specification.
-};
-
-//--------------------------------------------------------------
-/// Stream the language enumeration as a string object to a
-/// Stream.
-//--------------------------------------------------------------
-Stream& operator << (Stream& s, const Language& language);
-
-} // namespace lldb_private
-
-#endif // liblldb_Language_h_
diff --git a/include/lldb/Core/Listener.h b/include/lldb/Core/Listener.h
index 2dbd2eb436ce8..b11c1644507b0 100644
--- a/include/lldb/Core/Listener.h
+++ b/include/lldb/Core/Listener.h
@@ -14,11 +14,9 @@
// C++ Includes
#include <list>
#include <map>
-#include <set>
#include <string>
#include <vector>
-
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -118,13 +116,12 @@ public:
HandleBroadcastEvent (lldb::EventSP &event_sp);
private:
-
//------------------------------------------------------------------
// Classes that inherit from Listener can see and modify these
//------------------------------------------------------------------
struct BroadcasterInfo
{
- BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = NULL, void *ud = NULL) :
+ BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = nullptr, void *ud = nullptr) :
event_mask (mask),
callback (cb),
callback_user_data (ud)
@@ -141,28 +138,28 @@ private:
typedef std::vector<BroadcasterManager *> broadcaster_manager_collection;
bool
- FindNextEventInternal (Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
- uint32_t num_sources,
- uint32_t event_type_mask,
- lldb::EventSP &event_sp,
- bool remove);
+ FindNextEventInternal(Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources,
+ uint32_t event_type_mask,
+ lldb::EventSP &event_sp,
+ bool remove);
+
+ bool
+ GetNextEventInternal(Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources,
+ uint32_t event_type_mask,
+ lldb::EventSP &event_sp);
bool
- GetNextEventInternal (Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
+ WaitForEventsInternal(const TimeValue *timeout,
+ Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
uint32_t num_sources,
uint32_t event_type_mask,
lldb::EventSP &event_sp);
- bool
- WaitForEventsInternal (const TimeValue *timeout,
- Broadcaster *broadcaster, // NULL for any broadcaster
- const ConstString *sources, // NULL for any event
- uint32_t num_sources,
- uint32_t event_type_mask,
- lldb::EventSP &event_sp);
-
std::string m_name;
broadcaster_collection m_broadcasters;
Mutex m_broadcasters_mutex; // Protects m_broadcasters
@@ -191,4 +188,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Select_h_
+#endif // liblldb_Select_h_
diff --git a/include/lldb/Core/Log.h b/include/lldb/Core/Log.h
index 3aa4b4d48e17b..674fdfdfc0b2f 100644
--- a/include/lldb/Core/Log.h
+++ b/include/lldb/Core/Log.h
@@ -182,17 +182,16 @@ private:
DISALLOW_COPY_AND_ASSIGN(Log);
};
-
class LogChannel : public PluginInterface
{
public:
LogChannel();
- virtual ~LogChannel();
+ ~LogChannel() override;
static lldb::LogChannelSP FindPlugin(const char *plugin_name);
- // categories is a an array of chars that ends with a NULL element.
+ // categories is an array of chars that ends with a NULL element.
virtual void Disable(const char **categories, Stream *feedback_strm) = 0;
virtual bool Enable(
@@ -209,7 +208,6 @@ private:
DISALLOW_COPY_AND_ASSIGN(LogChannel);
};
-
} // namespace lldb_private
-#endif // liblldb_Log_H_
+#endif // liblldb_Log_h_
diff --git a/include/lldb/Core/Logging.h b/include/lldb/Core/Logging.h
index a4dd76f112377..ca04c84b21a63 100644
--- a/include/lldb/Core/Logging.h
+++ b/include/lldb/Core/Logging.h
@@ -48,6 +48,7 @@
#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26)
#define LIBLLDB_LOG_JIT_LOADER (1u << 27)
#define LIBLLDB_LOG_LANGUAGE (1u << 28)
+#define LIBLLDB_LOG_DATAFORMATTERS (1u << 29)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h
index 4b77ff1ab8fc1..5a52ab2b8b2d5 100644
--- a/include/lldb/Core/MappedHash.h
+++ b/include/lldb/Core/MappedHash.h
@@ -1,29 +1,38 @@
+//===-- MappedHash.h --------------------------------------------*- C++ -*-===//
//
-// MappedHash.h
+// The LLVM Compiler Infrastructure
//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
#ifndef liblldb_MappedHash_h_
#define liblldb_MappedHash_h_
+// C Includes
#include <assert.h>
#include <stdint.h>
+// C++ Includes
+#include <algorithm>
+#include <functional>
#include <map>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Stream.h"
class MappedHash
{
public:
-
enum HashFunctionType
{
eHashFunctionDJB = 0u // Daniel J Bernstein hash function that is also used by the ELF GNU_HASH sections
};
-
static uint32_t
HashStringUsingDJB (const char *s)
{
@@ -50,7 +59,6 @@ public:
return 0;
}
-
static const uint32_t HASH_MAGIC = 0x48415348u;
static const uint32_t HASH_CIGAM = 0x48534148u;
@@ -77,11 +85,9 @@ public:
header_data ()
{
}
-
+
virtual
- ~Header()
- {
- }
+ ~Header() = default;
size_t
GetByteSize() const
@@ -254,8 +260,7 @@ public:
header.bucket_count = num_unique_hashes;
if (header.bucket_count == 0)
header.bucket_count = 1;
-
-
+
std::vector<HashToHashData> hash_buckets;
std::vector<uint32_t> hash_indexes (header.bucket_count, 0);
std::vector<uint32_t> hash_values;
@@ -345,10 +350,12 @@ public:
}
}
}
+
protected:
typedef std::vector<Entry> collection;
collection m_entries;
};
+
// A class for reading and using a saved hash table from a block of data
// in memory
template <typename __KeyType, class __HeaderType, class __HashData>
@@ -375,9 +382,9 @@ public:
MemoryTable (lldb_private::DataExtractor &data) :
m_header (),
- m_hash_indexes (NULL),
- m_hash_values (NULL),
- m_hash_offsets (NULL)
+ m_hash_indexes (nullptr),
+ m_hash_values (nullptr),
+ m_hash_offsets (nullptr)
{
lldb::offset_t offset = m_header.Read (data, 0);
if (offset != LLDB_INVALID_OFFSET && IsValid ())
@@ -387,12 +394,10 @@ public:
m_hash_offsets = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
}
}
-
+
virtual
- ~MemoryTable ()
- {
- }
-
+ ~MemoryTable() = default;
+
bool
IsValid () const
{
@@ -483,7 +488,6 @@ public:
// subclass and return a valie "const char *" given a "key". The value
// could also be a C string pointer, in which case just returning "key"
// will suffice.
-
virtual const char *
GetStringForKeyType (KeyType key) const = 0;
@@ -506,7 +510,6 @@ public:
// should be returned. If anything else goes wrong during parsing,
// return "eResultError" and the corresponding "Find()" function will
// be canceled and return false.
-
virtual Result
GetHashDataForName (const char *name,
lldb::offset_t* hash_data_offset_ptr,
@@ -518,7 +521,6 @@ public:
return m_header;
}
-
void
ForEach (std::function <bool(const HashData &hash_data)> const &callback) const
{
@@ -546,7 +548,6 @@ public:
const uint32_t *m_hash_values;
const uint32_t *m_hash_offsets;
};
-
};
-#endif // #ifndef liblldb_MappedHash_h_
+#endif // liblldb_MappedHash_h_
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 127ddaeb9fd41..35b182aa9801f 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -10,6 +10,14 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_
+// C Includes
+// C++ Includes
+#include <atomic>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UUID.h"
@@ -17,6 +25,7 @@
#include "lldb/Host/Mutex.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/PathMappingList.h"
namespace lldb_private {
@@ -85,11 +94,11 @@ public:
/// module within a module (.a files and modules that contain
/// multiple architectures).
//------------------------------------------------------------------
- Module (const FileSpec& file_spec,
- const ArchSpec& arch,
- const ConstString *object_name = NULL,
- lldb::offset_t object_offset = 0,
- const TimeValue *object_mod_time_ptr = NULL);
+ Module(const FileSpec& file_spec,
+ const ArchSpec& arch,
+ const ConstString *object_name = nullptr,
+ lldb::offset_t object_offset = 0,
+ const TimeValue *object_mod_time_ptr = nullptr);
Module (const ModuleSpec &module_spec);
@@ -99,8 +108,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
- virtual
- ~Module ();
+ ~Module() override;
bool
MatchesModuleSpec (const ModuleSpec &module_ref);
@@ -154,11 +162,11 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- CalculateSymbolContext (SymbolContext* sc);
+ void
+ CalculateSymbolContext(SymbolContext* sc) override;
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ();
+ lldb::ModuleSP
+ CalculateSymbolContextModule() override;
void
GetDescription (Stream *s,
@@ -207,10 +215,9 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- DumpSymbolContext (Stream *s);
+ void
+ DumpSymbolContext(Stream *s) override;
-
//------------------------------------------------------------------
/// Find a symbol in the object file's symbol table.
///
@@ -225,7 +232,7 @@ public:
///
/// @return
/// Returns a valid symbol pointer if a symbol was found,
- /// NULL otherwise.
+ /// nullptr otherwise.
//------------------------------------------------------------------
const Symbol *
FindFirstSymbolWithNameAndType (const ConstString &name,
@@ -288,7 +295,6 @@ public:
FindCompileUnits (const FileSpec &path,
bool append,
SymbolContextList &sc_list);
-
//------------------------------------------------------------------
/// Find functions by name.
@@ -323,7 +329,7 @@ public:
//------------------------------------------------------------------
size_t
FindFunctions (const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
uint32_t name_type_mask,
bool symbols_ok,
bool inlines_ok,
@@ -392,8 +398,8 @@ public:
/// The name of the global or static variable we are looking
/// for.
///
- /// @param[in] namespace_decl
- /// If valid, a namespace to search in.
+ /// @param[in] parent_decl_ctx
+ /// If valid, a decl context that results must exist within
///
/// @param[in] append
/// If \b true, any matches will be appended to \a
@@ -413,7 +419,7 @@ public:
//------------------------------------------------------------------
size_t
FindGlobalVariables (const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
bool append,
size_t max_matches,
VariableList& variable_list);
@@ -524,7 +530,7 @@ public:
size_t
FindTypesInNamespace (const SymbolContext& sc,
const ConstString &type_name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
size_t max_matches,
TypeList& type_list);
@@ -646,10 +652,10 @@ public:
IsLoadedInTarget (Target *target);
bool
- LoadScriptingResourceInTarget (Target *target,
- Error& error,
- Stream* feedback_stream = NULL);
-
+ LoadScriptingResourceInTarget(Target *target,
+ Error& error,
+ Stream* feedback_stream = nullptr);
+
//------------------------------------------------------------------
/// Get the number of compile units for this module.
///
@@ -682,7 +688,7 @@ public:
/// @return
/// If Module::m_file does not exist, or no plug-in was found
/// that can parse the file, or the object file doesn't contain
- /// the current architecture in Module::m_arch, NULL will be
+ /// the current architecture in Module::m_arch, nullptr will be
/// returned, else a valid object file interface will be
/// returned. The returned pointer is owned by this object and
/// remains valid as long as the object is around.
@@ -730,7 +736,7 @@ public:
/// process.
///
/// @return
- /// The object file loaded from memory or NULL, if the operation
+ /// The object file loaded from memory or nullptr, if the operation
/// failed (see the `error` for more information in that case).
//------------------------------------------------------------------
ObjectFile *
@@ -747,20 +753,20 @@ public:
///
/// @return
/// If this module does not have a valid object file, or no
- /// plug-in can be found that can use the object file, NULL will
+ /// plug-in can be found that can use the object file, nullptr will
/// be returned, else a valid symbol vendor plug-in interface
/// will be returned. The returned pointer is owned by this
/// object and remains valid as long as the object is around.
//------------------------------------------------------------------
virtual SymbolVendor*
GetSymbolVendor(bool can_create = true,
- lldb_private::Stream *feedback_strm = NULL);
+ lldb_private::Stream *feedback_strm = nullptr);
//------------------------------------------------------------------
/// Get accessor the type list for this module.
///
/// @return
- /// A valid type list pointer, or NULL if there is no valid
+ /// A valid type list pointer, or nullptr if there is no valid
/// symbol vendor for this module.
//------------------------------------------------------------------
TypeList*
@@ -935,7 +941,6 @@ public:
uint32_t
ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list);
-
void
SetFileSpecAndObjectName (const FileSpec &file,
const ConstString &object_name);
@@ -943,8 +948,8 @@ public:
bool
GetIsDynamicLinkEditor ();
- ClangASTContext &
- GetClangASTContext ();
+ TypeSystem *
+ GetTypeSystemForLanguage (lldb::LanguageType language);
// Special error functions that can do printf style formatting that will prepend the message with
// something appropriate for this module (like the architecture, path and object name (if any)).
@@ -1041,7 +1046,6 @@ public:
bool
RemapSourceFile (const char *path, std::string &new_path) const;
-
//------------------------------------------------------------------
/// Prepare to do a function name lookup.
///
@@ -1067,6 +1071,10 @@ public:
/// The mask of bits from lldb::FunctionNameType enumerations
/// that tell us what kind of name we are looking for.
///
+ /// @param[out] language
+ /// If known, the language to use for determining the
+ /// lookup_name_type_mask.
+ ///
/// @param[out] lookup_name
/// The actual name that will be used when calling
/// SymbolVendor::FindFunctions() or Symtab::FindFunctionSymbols()
@@ -1087,6 +1095,7 @@ public:
static void
PrepareForFunctionNameLookup (const ConstString &name,
uint32_t name_type_mask,
+ lldb::LanguageType language,
ConstString &lookup_name,
uint32_t &lookup_name_type_mask,
bool &match_name_after_lookup);
@@ -1110,17 +1119,16 @@ protected:
lldb::SymbolVendorUP m_symfile_ap; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,
///< we need to keep all old symbol files around in case anyone has type references to them
- lldb::ClangASTContextUP m_ast; ///< The AST context for this module.
+ TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
- bool m_did_load_objfile:1,
- m_did_load_symbol_vendor:1,
- m_did_parse_uuid:1,
- m_did_init_ast:1;
+ std::atomic<bool> m_did_load_objfile;
+ std::atomic<bool> m_did_load_symbol_vendor;
+ std::atomic<bool> m_did_parse_uuid;
mutable bool m_file_has_changed:1,
m_first_file_changed_log:1; /// See if the module was modified after it was initially opened.
-
+
//------------------------------------------------------------------
/// Resolve a file or load virtual address.
///
@@ -1178,21 +1186,19 @@ protected:
friend class SymbolFile;
private:
-
Module (); // Only used internally by CreateJITModule ()
size_t
FindTypes_Impl (const SymbolContext& sc,
const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
bool append,
size_t max_matches,
- TypeList& types);
+ TypeMap& types);
-
DISALLOW_COPY_AND_ASSIGN (Module);
};
} // namespace lldb_private
-#endif // liblldb_Module_h_
+#endif // liblldb_Module_h_
diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h
index f4c12cf168ac7..a0dd43263a2c5 100644
--- a/include/lldb/Core/ModuleList.h
+++ b/include/lldb/Core/ModuleList.h
@@ -10,10 +10,14 @@
#ifndef liblldb_ModuleList_h_
#define liblldb_ModuleList_h_
-#include <vector>
-#include <list>
+// C Includes
+// C++ Includes
#include <functional>
+#include <list>
+#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Utility/Iterable.h"
@@ -30,10 +34,12 @@ namespace lldb_private {
class ModuleList
{
public:
-
class Notifier
{
public:
+ virtual
+ ~Notifier() = default;
+
virtual void
ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0;
virtual void
@@ -43,10 +49,6 @@ public:
const lldb::ModuleSP& new_module_sp) = 0;
virtual void
WillClearList (const ModuleList& module_list) = 0;
-
- virtual
- ~Notifier ()
- {}
};
//------------------------------------------------------------------
@@ -144,6 +146,7 @@ public:
//------------------------------------------------------------------
void
Destroy();
+
//------------------------------------------------------------------
/// Dump the description of each module contained in this list.
///
@@ -209,7 +212,7 @@ public:
/// An index into this module collection.
///
/// @return
- /// A pointer to a Module which can by NULL if \a idx is out
+ /// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
/// @see ModuleList::GetSize()
@@ -226,7 +229,7 @@ public:
/// An index into this module collection.
///
/// @return
- /// A pointer to a Module which can by NULL if \a idx is out
+ /// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
/// @see ModuleList::GetSize()
@@ -534,10 +537,10 @@ public:
GetSize () const;
bool
- LoadScriptingResourcesInTarget (Target *target,
- std::list<Error>& errors,
- Stream* feedback_stream = NULL,
- bool continue_on_error = true);
+ LoadScriptingResourcesInTarget(Target *target,
+ std::list<Error>& errors,
+ Stream* feedback_stream = nullptr,
+ bool continue_on_error = true);
static bool
ModuleIsInCache (const Module *module_ptr);
@@ -606,9 +609,8 @@ public:
{
return ModuleIterableNoLocking(m_modules);
}
-
};
} // namespace lldb_private
-#endif // liblldb_ModuleList_h_
+#endif // liblldb_ModuleList_h_
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h
index be7041981a0a7..95de7f375736a 100644
--- a/include/lldb/Core/ModuleSpec.h
+++ b/include/lldb/Core/ModuleSpec.h
@@ -10,6 +10,12 @@
#ifndef liblldb_ModuleSpec_h_
#define liblldb_ModuleSpec_h_
+// C Includes
+// C++ Includes
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/UUID.h"
@@ -100,17 +106,13 @@ public:
FileSpec *
GetFileSpecPtr ()
{
- if (m_file)
- return &m_file;
- return NULL;
+ return (m_file ? &m_file : nullptr);
}
const FileSpec *
GetFileSpecPtr () const
{
- if (m_file)
- return &m_file;
- return NULL;
+ return (m_file ? &m_file : nullptr);
}
FileSpec &
@@ -118,6 +120,7 @@ public:
{
return m_file;
}
+
const FileSpec &
GetFileSpec () const
{
@@ -127,17 +130,13 @@ public:
FileSpec *
GetPlatformFileSpecPtr ()
{
- if (m_platform_file)
- return &m_platform_file;
- return NULL;
+ return (m_platform_file ? &m_platform_file : nullptr);
}
const FileSpec *
GetPlatformFileSpecPtr () const
{
- if (m_platform_file)
- return &m_platform_file;
- return NULL;
+ return (m_platform_file ? &m_platform_file : nullptr);
}
FileSpec &
@@ -155,17 +154,13 @@ public:
FileSpec *
GetSymbolFileSpecPtr ()
{
- if (m_symbol_file)
- return &m_symbol_file;
- return NULL;
+ return (m_symbol_file ? &m_symbol_file : nullptr);
}
const FileSpec *
GetSymbolFileSpecPtr () const
{
- if (m_symbol_file)
- return &m_symbol_file;
- return NULL;
+ return (m_symbol_file ? &m_symbol_file : nullptr);
}
FileSpec &
@@ -180,21 +175,16 @@ public:
return m_symbol_file;
}
-
ArchSpec *
GetArchitecturePtr ()
{
- if (m_arch.IsValid())
- return &m_arch;
- return NULL;
+ return (m_arch.IsValid() ? &m_arch : nullptr);
}
const ArchSpec *
GetArchitecturePtr () const
{
- if (m_arch.IsValid())
- return &m_arch;
- return NULL;
+ return (m_arch.IsValid() ? &m_arch : nullptr);
}
ArchSpec &
@@ -212,17 +202,13 @@ public:
UUID *
GetUUIDPtr ()
{
- if (m_uuid.IsValid())
- return &m_uuid;
- return NULL;
+ return (m_uuid.IsValid() ? &m_uuid : nullptr);
}
const UUID *
GetUUIDPtr () const
{
- if (m_uuid.IsValid())
- return &m_uuid;
- return NULL;
+ return (m_uuid.IsValid() ? &m_uuid : nullptr);
}
UUID &
@@ -306,7 +292,6 @@ public:
m_object_mod_time.Clear();
}
-
explicit operator bool () const
{
if (m_file)
@@ -329,7 +314,7 @@ public:
}
void
- Dump (Stream &strm)
+ Dump (Stream &strm) const
{
bool dumped_something = false;
if (m_file)
@@ -361,7 +346,8 @@ public:
{
if (dumped_something)
strm.PutCString(", ");
- strm.Printf("arch = %s", m_arch.GetTriple().str().c_str());
+ strm.Printf("arch = ");
+ m_arch.DumpTriple(strm);
dumped_something = true;
}
if (m_uuid.IsValid())
@@ -476,9 +462,7 @@ public:
m_specs = rhs.m_specs;
}
- ~ModuleSpecList ()
- {
- }
+ ~ModuleSpecList() = default;
ModuleSpecList &
operator = (const ModuleSpecList &rhs)
@@ -528,6 +512,7 @@ public:
{
return m_specs[i];
}
+
bool
GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
{
@@ -540,8 +525,7 @@ public:
module_spec.Clear();
return false;
}
-
-
+
bool
FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
{
@@ -620,4 +604,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_ModuleSpec_h_
+#endif // liblldb_ModuleSpec_h_
diff --git a/include/lldb/Core/Opcode.h b/include/lldb/Core/Opcode.h
index 57b8077477ced..eac0746baba17 100644
--- a/include/lldb/Core/Opcode.h
+++ b/include/lldb/Core/Opcode.h
@@ -16,6 +16,7 @@
// C++ Includes
// Other libraries and framework includes
#include "llvm/Support/MathExtras.h"
+
// Project includes
#include "lldb/Host/Endian.h"
#include "lldb/lldb-public.h"
@@ -23,7 +24,7 @@
namespace lldb
{
class SBInstruction;
-}
+} // namespace lldb
namespace lldb_private {
@@ -76,6 +77,7 @@ namespace lldb_private {
m_byte_order = lldb::eByteOrderInvalid;
m_type = Opcode::eTypeInvalid;
}
+
Opcode::Type
GetType () const
{
@@ -189,7 +191,7 @@ namespace lldb_private {
void
SetOpcodeBytes (const void *bytes, size_t length)
{
- if (bytes && length > 0)
+ if (bytes != nullptr && length > 0)
{
m_type = eTypeBytes;
m_data.inst.length = length;
@@ -210,9 +212,7 @@ namespace lldb_private {
const void *
GetOpcodeBytes () const
{
- if (m_type == Opcode::eTypeBytes)
- return m_data.inst.bytes;
- return NULL;
+ return ((m_type == Opcode::eTypeBytes) ? m_data.inst.bytes : nullptr);
}
uint32_t
@@ -252,7 +252,7 @@ namespace lldb_private {
case Opcode::eType64: return &m_data.inst64;
case Opcode::eTypeBytes: return m_data.inst.bytes;
}
- return NULL;
+ return nullptr;
}
lldb::ByteOrder
@@ -261,8 +261,8 @@ namespace lldb_private {
bool
GetEndianSwap() const
{
- return (m_byte_order == lldb::eByteOrderBig && lldb::endian::InlHostByteOrder() == lldb::eByteOrderLittle) ||
- (m_byte_order == lldb::eByteOrderLittle && lldb::endian::InlHostByteOrder() == lldb::eByteOrderBig);
+ return (m_byte_order == lldb::eByteOrderBig && endian::InlHostByteOrder() == lldb::eByteOrderLittle) ||
+ (m_byte_order == lldb::eByteOrderLittle && endian::InlHostByteOrder() == lldb::eByteOrderBig);
}
lldb::ByteOrder m_byte_order;
@@ -284,4 +284,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // lldb_Opcode_h
+#endif // lldb_Opcode_h
diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h
index af940d788ab03..6f8001fbfd2b1 100644
--- a/include/lldb/Core/PluginManager.h
+++ b/include/lldb/Core/PluginManager.h
@@ -7,10 +7,13 @@
//
//===----------------------------------------------------------------------===//
-
#ifndef liblldb_PluginManager_h_
#define liblldb_PluginManager_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/FileSpec.h"
@@ -42,7 +45,6 @@ public:
static ABICreateInstance
GetABICreateCallbackForPluginName (const ConstString &name);
-
//------------------------------------------------------------------
// Disassembler
//------------------------------------------------------------------
@@ -60,15 +62,14 @@ public:
static DisassemblerCreateInstance
GetDisassemblerCreateCallbackForPluginName (const ConstString &name);
-
//------------------------------------------------------------------
// DynamicLoader
//------------------------------------------------------------------
static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- DynamicLoaderCreateInstance create_callback,
- DebuggerInitializeCallback debugger_init_callback = NULL);
+ RegisterPlugin(const ConstString &name,
+ const char *description,
+ DynamicLoaderCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
static bool
UnregisterPlugin (DynamicLoaderCreateInstance create_callback);
@@ -83,10 +84,10 @@ public:
// JITLoader
//------------------------------------------------------------------
static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- JITLoaderCreateInstance create_callback,
- DebuggerInitializeCallback debugger_init_callback = NULL);
+ RegisterPlugin(const ConstString &name,
+ const char *description,
+ JITLoaderCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
static bool
UnregisterPlugin (JITLoaderCreateInstance create_callback);
@@ -117,11 +118,10 @@ public:
//------------------------------------------------------------------
// OperatingSystem
//------------------------------------------------------------------
- static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- OperatingSystemCreateInstance create_callback);
-
+ static bool RegisterPlugin(const ConstString &name, const char *description,
+ OperatingSystemCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback);
+
static bool
UnregisterPlugin (OperatingSystemCreateInstance create_callback);
@@ -132,6 +132,23 @@ public:
GetOperatingSystemCreateCallbackForPluginName (const ConstString &name);
//------------------------------------------------------------------
+ // Language
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ LanguageCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin (LanguageCreateInstance create_callback);
+
+ static LanguageCreateInstance
+ GetLanguageCreateCallbackAtIndex (uint32_t idx);
+
+ static LanguageCreateInstance
+ GetLanguageCreateCallbackForPluginName (const ConstString &name);
+
+ //------------------------------------------------------------------
// LanguageRuntime
//------------------------------------------------------------------
static bool
@@ -152,7 +169,6 @@ public:
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);
-
//------------------------------------------------------------------
// SystemRuntime
//------------------------------------------------------------------
@@ -170,17 +186,16 @@ public:
static SystemRuntimeCreateInstance
GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name);
-
//------------------------------------------------------------------
// ObjectFile
//------------------------------------------------------------------
static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- ObjectFileCreateInstance create_callback,
- ObjectFileCreateMemoryInstance create_memory_callback,
- ObjectFileGetModuleSpecifications get_module_specifications,
- ObjectFileSaveCore save_core = NULL);
+ RegisterPlugin(const ConstString &name,
+ const char *description,
+ ObjectFileCreateInstance create_callback,
+ ObjectFileCreateMemoryInstance create_memory_callback,
+ ObjectFileGetModuleSpecifications get_module_specifications,
+ ObjectFileSaveCore save_core = nullptr);
static bool
UnregisterPlugin (ObjectFileCreateInstance create_callback);
@@ -248,10 +263,10 @@ public:
// Platform
//------------------------------------------------------------------
static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- PlatformCreateInstance create_callback,
- DebuggerInitializeCallback debugger_init_callback = NULL);
+ RegisterPlugin(const ConstString &name,
+ const char *description,
+ PlatformCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
static bool
UnregisterPlugin (PlatformCreateInstance create_callback);
@@ -275,10 +290,10 @@ public:
// Process
//------------------------------------------------------------------
static bool
- RegisterPlugin (const ConstString &name,
- const char *description,
- ProcessCreateInstance create_callback,
- DebuggerInitializeCallback debugger_init_callback = NULL);
+ RegisterPlugin(const ConstString &name,
+ const char *description,
+ ProcessCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
static bool
UnregisterPlugin (ProcessCreateInstance create_callback);
@@ -296,12 +311,30 @@ public:
GetProcessPluginDescriptionAtIndex (uint32_t idx);
//------------------------------------------------------------------
+ // ScriptInterpreter
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin(const ConstString &name, const char *description, lldb::ScriptLanguage script_lang,
+ ScriptInterpreterCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin(ScriptInterpreterCreateInstance create_callback);
+
+ static ScriptInterpreterCreateInstance
+ GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx);
+
+ static lldb::ScriptInterpreterSP
+ GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
+ CommandInterpreter &interpreter);
+
+ //------------------------------------------------------------------
// SymbolFile
//------------------------------------------------------------------
static bool
RegisterPlugin (const ConstString &name,
const char *description,
- SymbolFileCreateInstance create_callback);
+ SymbolFileCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
static bool
UnregisterPlugin (SymbolFileCreateInstance create_callback);
@@ -312,7 +345,6 @@ public:
static SymbolFileCreateInstance
GetSymbolFileCreateCallbackForPluginName (const ConstString &name);
-
//------------------------------------------------------------------
// SymbolVendor
//------------------------------------------------------------------
@@ -385,6 +417,53 @@ public:
static InstrumentationRuntimeCreateInstance
GetInstrumentationRuntimeCreateCallbackForPluginName (const ConstString &name);
+ //------------------------------------------------------------------
+ // TypeSystem
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ TypeSystemCreateInstance create_callback,
+ TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+
+ static bool
+ UnregisterPlugin (TypeSystemCreateInstance create_callback);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackAtIndex (uint32_t idx);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackForPluginName (const ConstString &name);
+
+ static TypeSystemEnumerateSupportedLanguages
+ GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
+
+ static TypeSystemEnumerateSupportedLanguages
+ GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
+
+ //------------------------------------------------------------------
+ // REPL
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ REPLCreateInstance create_callback,
+ REPLEnumerateSupportedLanguages enumerate_languages_callback);
+
+ static bool
+ UnregisterPlugin (REPLCreateInstance create_callback);
+
+ static REPLCreateInstance
+ GetREPLCreateCallbackAtIndex (uint32_t idx);
+
+ static REPLCreateInstance
+ GetREPLCreateCallbackForPluginName (const ConstString &name);
+
+ static REPLEnumerateSupportedLanguages
+ GetREPLEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
+
+ static REPLEnumerateSupportedLanguages
+ GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
//------------------------------------------------------------------
// Some plug-ins might register a DebuggerInitializeCallback
@@ -419,16 +498,41 @@ public:
static lldb::OptionValuePropertiesSP
GetSettingForProcessPlugin (Debugger &debugger,
const ConstString &setting_name);
-
+
static bool
CreateSettingForProcessPlugin (Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
const ConstString &description,
bool is_global_property);
-};
+ static lldb::OptionValuePropertiesSP
+ GetSettingForSymbolFilePlugin (Debugger &debugger,
+ const ConstString &setting_name);
+
+ static bool
+ CreateSettingForSymbolFilePlugin (Debugger &debugger,
+ const lldb::OptionValuePropertiesSP &properties_sp,
+ const ConstString &description,
+ bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForJITLoaderPlugin (Debugger &debugger,
+ const ConstString &setting_name);
+ static bool
+ CreateSettingForJITLoaderPlugin (Debugger &debugger,
+ const lldb::OptionValuePropertiesSP &properties_sp,
+ const ConstString &description,
+ bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger,
+ const ConstString &setting_name);
+
+ static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger,
+ const lldb::OptionValuePropertiesSP &properties_sp,
+ const ConstString &description, bool is_global_property);
+};
} // namespace lldb_private
-#endif // liblldb_PluginManager_h_
+#endif // liblldb_PluginManager_h_
diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h
index d2c43a5d794d4..b2e3f06f08a9e 100644
--- a/include/lldb/Core/RangeMap.h
+++ b/include/lldb/Core/RangeMap.h
@@ -10,16 +10,21 @@
#ifndef liblldb_RangeMap_h_
#define liblldb_RangeMap_h_
+// C Includes
+// C++ Includes
+#include <algorithm>
#include <vector>
-#include "lldb/lldb-private.h"
+// Other libraries and framework includes
#include "llvm/ADT/SmallVector.h"
+// Project includes
+#include "lldb/lldb-private.h"
+
// Uncomment to make sure all Range objects are sorted when needed
//#define ASSERT_RANGEMAP_ARE_SORTED
namespace lldb_private {
-
//----------------------------------------------------------------------
// Templatized classes for dealing with generic ranges and also
@@ -187,16 +192,11 @@ namespace lldb_private {
typedef S SizeType;
typedef Range<B,S> Entry;
typedef llvm::SmallVector<Entry, N> Collection;
-
- RangeArray () :
- m_entries ()
- {
- }
-
- ~RangeArray()
- {
- }
-
+
+ RangeArray() = default;
+
+ ~RangeArray() = default;
+
void
Append (const Entry &entry)
{
@@ -236,6 +236,7 @@ namespace lldb_private {
return true;
}
#endif
+
void
CombineConsecutiveRanges ()
{
@@ -281,7 +282,6 @@ namespace lldb_private {
}
}
-
BaseType
GetMinRangeBase (BaseType fail_value) const
{
@@ -337,9 +337,7 @@ namespace lldb_private {
const Entry *
GetEntryAtIndex (size_t i) const
{
- if (i<m_entries.size())
- return &m_entries[i];
- return NULL;
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
}
// Clients must ensure that "i" is a valid index prior to calling this function
@@ -352,17 +350,13 @@ namespace lldb_private {
Entry *
Back()
{
- if (m_entries.empty())
- return NULL;
- return &m_entries.back();
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
const Entry *
Back() const
{
- if (m_entries.empty())
- return NULL;
- return &m_entries.back();
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
static bool
@@ -424,7 +418,7 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
const Entry *
@@ -452,7 +446,7 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
protected:
@@ -467,16 +461,11 @@ namespace lldb_private {
typedef S SizeType;
typedef Range<B,S> Entry;
typedef std::vector<Entry> Collection;
-
- RangeVector () :
- m_entries ()
- {
- }
-
- ~RangeVector()
- {
- }
-
+
+ RangeVector() = default;
+
+ ~RangeVector() = default;
+
void
Append (const Entry &entry)
{
@@ -516,6 +505,7 @@ namespace lldb_private {
return true;
}
#endif
+
void
CombineConsecutiveRanges ()
{
@@ -560,8 +550,7 @@ namespace lldb_private {
}
}
}
-
-
+
BaseType
GetMinRangeBase (BaseType fail_value) const
{
@@ -623,9 +612,7 @@ namespace lldb_private {
const Entry *
GetEntryAtIndex (size_t i) const
{
- if (i<m_entries.size())
- return &m_entries[i];
- return NULL;
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
}
// Clients must ensure that "i" is a valid index prior to calling this function
@@ -638,17 +625,13 @@ namespace lldb_private {
Entry *
Back()
{
- if (m_entries.empty())
- return NULL;
- return &m_entries.back();
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
const Entry *
Back() const
{
- if (m_entries.empty())
- return NULL;
- return &m_entries.back();
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
static bool
@@ -710,7 +693,7 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
const Entry *
@@ -738,7 +721,7 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
protected:
@@ -812,15 +795,10 @@ namespace lldb_private {
typedef RangeData<B,S,T> Entry;
typedef llvm::SmallVector<Entry, N> Collection;
+ RangeDataArray() = default;
+
+ ~RangeDataArray() = default;
- RangeDataArray ()
- {
- }
-
- ~RangeDataArray()
- {
- }
-
void
Append (const Entry &entry)
{
@@ -911,9 +889,7 @@ namespace lldb_private {
const Entry *
GetEntryAtIndex (size_t i) const
{
- if (i<m_entries.size())
- return &m_entries[i];
- return NULL;
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
}
// Clients must ensure that "i" is a valid index prior to calling this function
@@ -984,8 +960,9 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
+
const Entry *
FindEntryThatContains (B addr) const
{
@@ -1014,7 +991,7 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
const Entry *
@@ -1042,23 +1019,19 @@ namespace lldb_private {
}
}
}
- return NULL;
+ return nullptr;
}
Entry *
Back()
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
const Entry *
Back() const
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
protected:
@@ -1073,15 +1046,11 @@ namespace lldb_private {
public:
typedef RangeData<B,S,T> Entry;
typedef std::vector<Entry> Collection;
-
- RangeDataVector ()
- {
- }
-
- ~RangeDataVector()
- {
- }
-
+
+ RangeDataVector() = default;
+
+ ~RangeDataVector() = default;
+
void
Append (const Entry &entry)
{
@@ -1181,7 +1150,6 @@ namespace lldb_private {
}
}
}
-
}
void
@@ -1211,9 +1179,7 @@ namespace lldb_private {
const Entry *
GetEntryAtIndex (size_t i) const
{
- if (i<m_entries.size())
- return &m_entries[i];
- return NULL;
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
}
// Clients must ensure that "i" is a valid index prior to calling this function
@@ -1272,8 +1238,9 @@ namespace lldb_private {
if (pos != end && pos->Contains(addr))
return &(*pos);
}
- return NULL;
+ return nullptr;
}
+
const Entry *
FindEntryThatContains (B addr) const
{
@@ -1295,7 +1262,7 @@ namespace lldb_private {
if (pos != end && pos->Contains(addr))
return &(*pos);
}
- return NULL;
+ return nullptr;
}
const Entry *
@@ -1316,30 +1283,25 @@ namespace lldb_private {
if (pos != end && pos->Contains(range))
return &(*pos);
}
- return NULL;
+ return nullptr;
}
Entry *
Back()
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
const Entry *
Back() const
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
protected:
Collection m_entries;
};
-
-
+
//----------------------------------------------------------------------
// A simple range with data class where you get to define the type of
// the range base "B", the type used for the range byte size "S", and
@@ -1389,7 +1351,6 @@ namespace lldb_private {
}
};
-
template <typename B, typename T, unsigned N>
class AddressDataArray
{
@@ -1397,15 +1358,10 @@ namespace lldb_private {
typedef AddressData<B,T> Entry;
typedef llvm::SmallVector<Entry, N> Collection;
+ AddressDataArray() = default;
+
+ ~AddressDataArray() = default;
- AddressDataArray ()
- {
- }
-
- ~AddressDataArray()
- {
- }
-
void
Append (const Entry &entry)
{
@@ -1456,9 +1412,7 @@ namespace lldb_private {
const Entry *
GetEntryAtIndex (size_t i) const
{
- if (i<m_entries.size())
- return &m_entries[i];
- return NULL;
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
}
// Clients must ensure that "i" is a valid index prior to calling this function
@@ -1497,7 +1451,7 @@ namespace lldb_private {
return &(*pos);
}
}
- return NULL;
+ return nullptr;
}
const Entry *
@@ -1505,23 +1459,19 @@ namespace lldb_private {
{
if (entry >= &*m_entries.begin() && entry + 1 < &*m_entries.end())
return entry + 1;
- return NULL;
+ return nullptr;
}
Entry *
Back()
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
const Entry *
Back() const
{
- if (!m_entries.empty())
- return &m_entries.back();
- return NULL;
+ return (m_entries.empty() ? nullptr : &m_entries.back());
}
protected:
@@ -1530,4 +1480,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // liblldb_RangeMap_h_
+#endif // liblldb_RangeMap_h_
diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h
index 1b1a71a11c5ac..030b849212c49 100644
--- a/include/lldb/Core/RegisterValue.h
+++ b/include/lldb/Core/RegisterValue.h
@@ -1,4 +1,4 @@
-//===-- RegisterValue.h ------------------------------------------*- C++ -*-===//
+//===-- RegisterValue.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,12 +15,14 @@
// C++ Includes
// Other libraries and framework includes
+#include "llvm/ADT/APInt.h"
+
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-private.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Core/Scalar.h"
-//#define ENABLE_128_BIT_SUPPORT 1
namespace lldb_private {
class RegisterValue
@@ -30,6 +32,7 @@ namespace lldb_private {
{
kMaxRegisterByteSize = 32u
};
+
enum Type
{
eTypeInvalid,
@@ -37,9 +40,7 @@ namespace lldb_private {
eTypeUInt16,
eTypeUInt32,
eTypeUInt64,
-#if defined (ENABLE_128_BIT_SUPPORT)
eTypeUInt128,
-#endif
eTypeFloat,
eTypeDouble,
eTypeLongDouble,
@@ -47,7 +48,8 @@ namespace lldb_private {
};
RegisterValue () :
- m_type (eTypeInvalid)
+ m_type (eTypeInvalid),
+ m_scalar ((unsigned long)0)
{
}
@@ -55,57 +57,56 @@ namespace lldb_private {
RegisterValue (uint8_t inst) :
m_type (eTypeUInt8)
{
- m_data.uint8 = inst;
+ m_scalar = inst;
}
explicit
RegisterValue (uint16_t inst) :
m_type (eTypeUInt16)
{
- m_data.uint16 = inst;
+ m_scalar = inst;
}
explicit
RegisterValue (uint32_t inst) :
m_type (eTypeUInt32)
{
- m_data.uint32 = inst;
+ m_scalar = inst;
}
explicit
RegisterValue (uint64_t inst) :
m_type (eTypeUInt64)
{
- m_data.uint64 = inst;
+ m_scalar = inst;
}
-#if defined (ENABLE_128_BIT_SUPPORT)
explicit
- RegisterValue (__uint128_t inst) :
+ RegisterValue (llvm::APInt inst) :
m_type (eTypeUInt128)
{
- m_data.uint128 = inst;
+ m_scalar = llvm::APInt(inst);
}
-#endif
+
explicit
RegisterValue (float value) :
m_type (eTypeFloat)
{
- m_data.ieee_float = value;
+ m_scalar = value;
}
explicit
RegisterValue (double value) :
m_type (eTypeDouble)
{
- m_data.ieee_double = value;
+ m_scalar = value;
}
explicit
RegisterValue (long double value) :
m_type (eTypeLongDouble)
{
- m_data.ieee_long_double = value;
+ m_scalar = value;
}
explicit
@@ -161,13 +162,13 @@ namespace lldb_private {
GetScalarValue (Scalar &scalar) const;
uint8_t
- GetAsUInt8 (uint8_t fail_value = UINT8_MAX, bool *success_ptr = NULL) const
+ GetAsUInt8(uint8_t fail_value = UINT8_MAX, bool *success_ptr = nullptr) const
{
if (m_type == eTypeUInt8)
{
if (success_ptr)
*success_ptr = true;
- return m_data.uint8;
+ return m_scalar.UChar(fail_value);
}
if (success_ptr)
*success_ptr = true;
@@ -175,27 +176,25 @@ namespace lldb_private {
}
uint16_t
- GetAsUInt16 (uint16_t fail_value = UINT16_MAX, bool *success_ptr = NULL) const;
+ GetAsUInt16(uint16_t fail_value = UINT16_MAX, bool *success_ptr = nullptr) const;
uint32_t
- GetAsUInt32 (uint32_t fail_value = UINT32_MAX, bool *success_ptr = NULL) const;
+ GetAsUInt32(uint32_t fail_value = UINT32_MAX, bool *success_ptr = nullptr) const;
uint64_t
- GetAsUInt64 (uint64_t fail_value = UINT64_MAX, bool *success_ptr = NULL) const;
+ GetAsUInt64(uint64_t fail_value = UINT64_MAX, bool *success_ptr = nullptr) const;
-#if defined (ENABLE_128_BIT_SUPPORT)
- __uint128_t
- GetAsUInt128 (__uint128_t fail_value = ~((__uint128_t)0), bool *success_ptr = NULL) const;
-#endif
+ llvm::APInt
+ GetAsUInt128(const llvm::APInt& fail_value, bool *success_ptr = nullptr) const;
float
- GetAsFloat (float fail_value = 0.0f, bool *success_ptr = NULL) const;
+ GetAsFloat(float fail_value = 0.0f, bool *success_ptr = nullptr) const;
double
- GetAsDouble (double fail_value = 0.0, bool *success_ptr = NULL) const;
+ GetAsDouble(double fail_value = 0.0, bool *success_ptr = nullptr) const;
long double
- GetAsLongDouble (long double fail_value = 0.0, bool *success_ptr = NULL) const;
+ GetAsLongDouble(long double fail_value = 0.0, bool *success_ptr = nullptr) const;
void
SetValueToInvalid ()
@@ -219,95 +218,93 @@ namespace lldb_private {
operator = (uint8_t uint)
{
m_type = eTypeUInt8;
- m_data.uint8 = uint;
+ m_scalar = uint;
}
void
operator = (uint16_t uint)
{
m_type = eTypeUInt16;
- m_data.uint16 = uint;
+ m_scalar = uint;
}
void
operator = (uint32_t uint)
{
m_type = eTypeUInt32;
- m_data.uint32 = uint;
+ m_scalar = uint;
}
void
operator = (uint64_t uint)
{
m_type = eTypeUInt64;
- m_data.uint64 = uint;
+ m_scalar = uint;
}
-#if defined (ENABLE_128_BIT_SUPPORT)
void
- operator = (__uint128_t uint)
+ operator = (llvm::APInt uint)
{
m_type = eTypeUInt128;
- m_data.uint128 = uint;
+ m_scalar = llvm::APInt(uint);
}
-#endif
+
void
operator = (float f)
{
m_type = eTypeFloat;
- m_data.ieee_float = f;
+ m_scalar = f;
}
void
operator = (double f)
{
m_type = eTypeDouble;
- m_data.ieee_double = f;
+ m_scalar = f;
}
void
operator = (long double f)
{
m_type = eTypeLongDouble;
- m_data.ieee_long_double = f;
+ m_scalar = f;
}
void
SetUInt8 (uint8_t uint)
{
m_type = eTypeUInt8;
- m_data.uint8 = uint;
+ m_scalar = uint;
}
void
SetUInt16 (uint16_t uint)
{
m_type = eTypeUInt16;
- m_data.uint16 = uint;
+ m_scalar = uint;
}
void
SetUInt32 (uint32_t uint, Type t = eTypeUInt32)
{
m_type = t;
- m_data.uint32 = uint;
+ m_scalar = uint;
}
void
SetUInt64 (uint64_t uint, Type t = eTypeUInt64)
{
m_type = t;
- m_data.uint64 = uint;
+ m_scalar = uint;
}
-#if defined (ENABLE_128_BIT_SUPPORT)
void
- SetUInt128 (__uint128_t uint)
+ SetUInt128 (llvm::APInt uint)
{
m_type = eTypeUInt128;
- m_data.uint128 = uint;
+ m_scalar = uint;
}
-#endif
+
bool
SetUInt (uint64_t uint, uint32_t byte_size);
@@ -315,21 +312,21 @@ namespace lldb_private {
SetFloat (float f)
{
m_type = eTypeFloat;
- m_data.ieee_float = f;
+ m_scalar = f;
}
void
SetDouble (double f)
{
m_type = eTypeDouble;
- m_data.ieee_double = f;
+ m_scalar = f;
}
void
SetLongDouble (long double f)
{
m_type = eTypeLongDouble;
- m_data.ieee_long_double = f;
+ m_scalar = f;
}
void
@@ -367,8 +364,8 @@ namespace lldb_private {
GetByteOrder () const
{
if (m_type == eTypeBytes)
- return m_data.buffer.byte_order;
- return lldb::endian::InlHostByteOrder();
+ return buffer.byte_order;
+ return endian::InlHostByteOrder();
}
uint32_t
@@ -384,29 +381,17 @@ namespace lldb_private {
Clear();
protected:
-
RegisterValue::Type m_type;
- union
- {
- uint8_t uint8;
- uint16_t uint16;
- uint32_t uint32;
- uint64_t uint64;
-#if defined (ENABLE_128_BIT_SUPPORT)
- __uint128_t uint128;
-#endif
- float ieee_float;
- double ieee_double;
- long double ieee_long_double;
- struct
- {
- uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any register for any supported target.
- uint8_t length;
- lldb::ByteOrder byte_order;
- } buffer;
- } m_data;
+ Scalar m_scalar;
+
+ struct
+ {
+ uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any register for any supported target.
+ uint8_t length;
+ lldb::ByteOrder byte_order;
+ } buffer;
};
} // namespace lldb_private
-#endif // lldb_RegisterValue_h
+#endif // lldb_RegisterValue_h
diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Core/RegularExpression.h
index a58d17b4a794d..b0ece5154ce1d 100644
--- a/include/lldb/Core/RegularExpression.h
+++ b/include/lldb/Core/RegularExpression.h
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DBRegex_h_
-#define liblldb_DBRegex_h_
-#if defined(__cplusplus)
+#ifndef liblldb_RegularExpression_h_
+#define liblldb_RegularExpression_h_
#ifdef _WIN32
#include "../lib/Support/regex_impl.h"
@@ -37,7 +36,6 @@ inline void regfree(llvm_regex_t * a)
{
llvm_regfree(a);
}
-
#else
#if __ANDROID_NDK__
#include <regex>
@@ -52,7 +50,7 @@ inline void regfree(llvm_regex_t * a)
namespace llvm
{
class StringRef;
-}
+} // namespace llvm
namespace lldb_private {
@@ -95,9 +93,7 @@ public:
regmatch_t *
GetData ()
{
- if (m_matches.empty())
- return NULL;
- return m_matches.data();
+ return (m_matches.empty() ? nullptr : m_matches.data());
}
bool
@@ -110,9 +106,9 @@ public:
GetMatchSpanningIndices (const char* s, uint32_t idx1, uint32_t idx2, llvm::StringRef& match_str) const;
protected:
-
std::vector<regmatch_t> m_matches; ///< Where parenthesized subexpressions results are stored
};
+
//------------------------------------------------------------------
/// Default constructor.
///
@@ -172,14 +168,14 @@ public:
/// @param[in] match
/// A pointer to a RegularExpression::Match structure that was
/// properly initialized with the desired number of maximum
- /// matches, or NULL if no parenthesized matching is needed.
+ /// matches, or nullptr if no parenthesized matching is needed.
///
/// @return
/// \b true if \a string matches the compiled regular
/// expression, \b false otherwise.
//------------------------------------------------------------------
bool
- Execute (const char* string, Match *match = NULL) const;
+ Execute(const char* string, Match *match = nullptr) const;
size_t
GetErrorAsCString (char *err_str, size_t err_str_max_len) const;
@@ -246,5 +242,4 @@ private:
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_DBRegex_h_
+#endif // liblldb_RegularExpression_h_
diff --git a/include/lldb/Core/STLUtils.h b/include/lldb/Core/STLUtils.h
index 9321e057a397f..b3c2124f447de 100644
--- a/include/lldb/Core/STLUtils.h
+++ b/include/lldb/Core/STLUtils.h
@@ -9,14 +9,18 @@
#ifndef liblldb_STLUtils_h_
#define liblldb_STLUtils_h_
-#if defined(__cplusplus)
+// C Includes
#include <string.h>
+// C++ Includes
#include <map>
#include <ostream>
#include <vector>
+// Other libraries and framework includes
+// Project includes
+
//----------------------------------------------------------------------
// C string less than compare function object
//----------------------------------------------------------------------
@@ -28,7 +32,6 @@ struct CStringCompareFunctionObject
}
};
-
//----------------------------------------------------------------------
// C string equality function object (binary predicate).
//----------------------------------------------------------------------
@@ -40,7 +43,6 @@ struct CStringEqualBinaryPredicate
}
};
-
//----------------------------------------------------------------------
// Templated type for finding an entry in a std::map<F,S> whose value
// is equal to something
@@ -48,21 +50,26 @@ struct CStringEqualBinaryPredicate
template <class F, class S>
class ValueEquals
{
-private:
- S second_value;
-
public:
ValueEquals (const S& val) : second_value(val)
{}
+
// Compare the second item
bool operator() (std::pair<const F, S> elem)
{
return elem.second == second_value;
}
+
+private:
+ S second_value;
};
template <class T>
-inline void PrintAllCollectionElements (std::ostream &s, const T& coll, const char* header_cstr=NULL, const char* separator_cstr=" ")
+inline void
+PrintAllCollectionElements(std::ostream &s,
+ const T& coll,
+ const char* header_cstr = nullptr,
+ const char* separator_cstr = " ")
{
typename T::const_iterator pos;
@@ -88,7 +95,4 @@ struct for_each_cplusplus_delete
typedef std::vector<std::string> STLStringArray;
typedef std::vector<const char *> CStringArray;
-
-
-#endif // #if defined(__cplusplus)
-#endif // liblldb_STLUtils_h_
+#endif // liblldb_STLUtils_h_
diff --git a/include/lldb/Core/Scalar.h b/include/lldb/Core/Scalar.h
index 821a0fb1ae219..a476cd3bd8676 100644
--- a/include/lldb/Core/Scalar.h
+++ b/include/lldb/Core/Scalar.h
@@ -11,6 +11,11 @@
#define liblldb_Scalar_h_
#include "lldb/lldb-private.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/APFloat.h"
+
+#define NUM_OF_WORDS_INT128 2
+#define BITWIDTH_INT128 128
namespace lldb_private {
@@ -34,22 +39,60 @@ public:
e_ulonglong,
e_float,
e_double,
- e_long_double
+ e_long_double,
+ e_uint128,
+ e_sint128
};
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
Scalar();
- Scalar(int v) : m_type(e_sint), m_data() { m_data.sint = v; }
- Scalar(unsigned int v) : m_type(e_uint), m_data() { m_data.uint = v; }
- Scalar(long v) : m_type(e_slong), m_data() { m_data.slong = v; }
- Scalar(unsigned long v) : m_type(e_ulong), m_data() { m_data.ulong = v; }
- Scalar(long long v) : m_type(e_slonglong), m_data() { m_data.slonglong = v; }
- Scalar(unsigned long long v): m_type(e_ulonglong), m_data() { m_data.ulonglong = v; }
- Scalar(float v) : m_type(e_float), m_data() { m_data.flt = v; }
- Scalar(double v) : m_type(e_double), m_data() { m_data.dbl = v; }
- Scalar(long double v) : m_type(e_long_double), m_data() { m_data.ldbl = v; }
+ Scalar(int v) : m_type(e_sint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v, true);}
+ Scalar(unsigned int v) : m_type(e_uint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v);}
+ Scalar(long v) : m_type(e_slong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v, true);}
+ Scalar(unsigned long v) : m_type(e_ulong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v);}
+ Scalar(long long v) : m_type(e_slonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v, true);}
+ Scalar(unsigned long long v): m_type(e_ulonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v);}
+ Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); }
+ Scalar(double v) : m_type(e_double), m_float(v) { m_float = llvm::APFloat(v); }
+ Scalar(long double v, bool ieee_quad)
+ : m_type(e_long_double), m_float((float)0), m_ieee_quad(ieee_quad)
+ {
+ if(ieee_quad)
+ m_float = llvm::APFloat(llvm::APFloat::IEEEquad, llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)&v)->x));
+ else
+ m_float = llvm::APFloat(llvm::APFloat::x87DoubleExtended, llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)&v)->x));
+ }
+ Scalar(llvm::APInt v) :
+ m_type(),
+ m_float((float)0)
+ {
+ m_integer = llvm::APInt(v);
+ switch(m_integer.getBitWidth())
+ {
+ case 8:
+ case 16:
+ case 32:
+ if(m_integer.isSignedIntN(sizeof(sint_t) * 8))
+ m_type = e_sint;
+ else
+ m_type = e_uint;
+ break;
+ case 64:
+ if(m_integer.isSignedIntN(sizeof(slonglong_t) * 8))
+ m_type = e_slonglong;
+ else
+ m_type = e_ulonglong;
+ break;
+ case 128:
+ if(m_integer.isSignedIntN(BITWIDTH_INT128))
+ m_type = e_sint128;
+ else
+ m_type = e_uint128;
+ break;
+ }
+ }
Scalar(const Scalar& rhs);
//Scalar(const RegisterValue& reg_value);
virtual ~Scalar();
@@ -61,15 +104,18 @@ public:
ExtractBitfield (uint32_t bit_size,
uint32_t bit_offset);
+ bool
+ SetBit(uint32_t bit);
+
+ bool
+ ClearBit(uint32_t bit);
+
+ void *
+ GetBytes() const;
+
size_t
GetByteSize() const;
- static size_t
- GetMaxByteSize()
- {
- return sizeof(ValueData);
- }
-
bool
GetData (DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const;
@@ -83,7 +129,7 @@ public:
IsZero() const;
void
- Clear() { m_type = e_void; m_data.ulonglong = 0; }
+ Clear() { m_type = e_void; m_integer.clearAllBits(); }
const char *
GetTypeAsCString() const;
@@ -133,6 +179,7 @@ public:
Scalar& operator= (float v);
Scalar& operator= (double v);
Scalar& operator= (long double v);
+ Scalar& operator= (llvm::APInt v);
Scalar& operator= (const Scalar& rhs); // Assignment operator
Scalar& operator+= (const Scalar& rhs);
Scalar& operator<<= (const Scalar& rhs); // Shift left
@@ -174,6 +221,9 @@ public:
Scalar::Type
GetType() const { return m_type; }
+ void
+ SetType(const RegisterInfo*);
+
//----------------------------------------------------------------------
// Returns a casted value of the current contained data without
// modifying the current value. FAIL_VALUE will be returned if the type
@@ -194,6 +244,18 @@ public:
unsigned long long
RawULongLong () const;
+ unsigned char
+ UChar(unsigned char fail_value = 0) const;
+
+ char
+ SChar(char fail_value = 0) const;
+
+ unsigned short
+ UShort(unsigned short fail_value = 0) const;
+
+ short
+ SShort(short fail_value = 0) const;
+
unsigned int
UInt(unsigned int fail_value = 0) const;
@@ -209,6 +271,12 @@ public:
unsigned long long
ULongLong(unsigned long long fail_value = 0) const;
+ llvm::APInt
+ SInt128(llvm::APInt& fail_value) const;
+
+ llvm::APInt
+ UInt128(const llvm::APInt& fail_value) const;
+
float
Float(float fail_value = 0.0f) const;
@@ -255,6 +323,10 @@ public:
}
protected:
+ typedef char schar_t;
+ typedef unsigned char uchar_t;
+ typedef short sshort_t;
+ typedef unsigned short ushort_t;
typedef int sint_t;
typedef unsigned int uint_t;
typedef long slong_t;
@@ -265,24 +337,13 @@ protected:
typedef double double_t;
typedef long double long_double_t;
- union ValueData
- {
- int sint;
- unsigned int uint;
- long slong;
- unsigned long ulong;
- long long slonglong;
- unsigned long long ulonglong;
- float flt;
- double dbl;
- long double ldbl;
- };
-
//------------------------------------------------------------------
// Classes that inherit from Scalar can see and modify these
//------------------------------------------------------------------
Scalar::Type m_type;
- ValueData m_data;
+ llvm::APInt m_integer;
+ llvm::APFloat m_float;
+ bool m_ieee_quad = false;
private:
friend const Scalar operator+ (const Scalar& lhs, const Scalar& rhs);
diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h
index bbb7509cedb22..3d5e1fb39b439 100644
--- a/include/lldb/Core/SearchFilter.h
+++ b/include/lldb/Core/SearchFilter.h
@@ -272,7 +272,7 @@ class SearchFilterForUnconstrainedSearches :
{
public:
SearchFilterForUnconstrainedSearches (const lldb::TargetSP &target_sp) : SearchFilter(target_sp) {}
- ~SearchFilterForUnconstrainedSearches () {}
+ ~SearchFilterForUnconstrainedSearches() override = default;
bool
ModulePasses (const FileSpec &module_spec) override;
@@ -283,7 +283,6 @@ public:
protected:
lldb::SearchFilterSP
DoCopyForBreakpoint (Breakpoint &breakpoint) override;
-
};
//----------------------------------------------------------------------
@@ -311,8 +310,7 @@ public:
SearchFilterByModule (const SearchFilterByModule& rhs);
- virtual
- ~SearchFilterByModule ();
+ ~SearchFilterByModule() override;
const SearchFilterByModule&
operator=(const SearchFilterByModule& rhs);
@@ -372,8 +370,7 @@ public:
SearchFilterByModuleList (const SearchFilterByModuleList& rhs);
- virtual
- ~SearchFilterByModuleList ();
+ ~SearchFilterByModuleList() override;
const SearchFilterByModuleList&
operator=(const SearchFilterByModuleList& rhs);
@@ -409,7 +406,7 @@ protected:
lldb::SearchFilterSP
DoCopyForBreakpoint (Breakpoint &breakpoint) override;
-private:
+protected:
FileSpecList m_module_spec_list;
};
@@ -434,8 +431,7 @@ public:
SearchFilterByModuleListAndCU (const SearchFilterByModuleListAndCU& rhs);
- virtual
- ~SearchFilterByModuleListAndCU ();
+ ~SearchFilterByModuleListAndCU() override;
const SearchFilterByModuleListAndCU&
operator=(const SearchFilterByModuleListAndCU& rhs);
@@ -466,10 +462,9 @@ protected:
DoCopyForBreakpoint (Breakpoint &breakpoint) override;
private:
- FileSpecList m_module_spec_list;
FileSpecList m_cu_spec_list;
};
} // namespace lldb_private
-#endif // liblldb_SearchFilter_h_
+#endif // liblldb_SearchFilter_h_
diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h
index 65d408e298673..8c92f1ba667ef 100644
--- a/include/lldb/Core/Section.h
+++ b/include/lldb/Core/Section.h
@@ -64,9 +64,6 @@ public:
lldb::SectionSP
FindSectionContainingFileAddress (lldb::addr_t addr, uint32_t depth = UINT32_MAX) const;
- bool
- GetSectionData (const DataExtractor& module_data, DataExtractor& section_data) const;
-
// Get the number of sections in this list only
size_t
GetSize () const
@@ -288,6 +285,46 @@ public:
return m_obj_file;
}
+ //------------------------------------------------------------------
+ /// Read the section data from the object file that the section
+ /// resides in.
+ ///
+ /// @param[in] dst
+ /// Where to place the data
+ ///
+ /// @param[in] dst_len
+ /// How many bytes of section data to read
+ ///
+ /// @param[in] offset
+ /// The offset in bytes within this section's data at which to
+ /// start copying data from.
+ ///
+ /// @return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ //------------------------------------------------------------------
+ lldb::offset_t
+ GetSectionData (void *dst, lldb::offset_t dst_len, lldb::offset_t offset = 0);
+
+ //------------------------------------------------------------------
+ /// Get the shared reference to the section data from the object
+ /// file that the section resides in. No copies of the data will be
+ /// make unless the object file has been read from memory. If the
+ /// object file is on disk, it will shared the mmap data for the
+ /// entire object file.
+ ///
+ /// @param[in] data
+ /// Where to place the data, address byte size, and byte order
+ ///
+ /// @return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ //------------------------------------------------------------------
+ lldb::offset_t
+ GetSectionData (DataExtractor& data) const;
+
uint32_t GetLog2Align()
{
return m_log2align;
diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h
index 0f65be1bee4b7..5504bafd6b7ef 100644
--- a/include/lldb/Core/SourceManager.h
+++ b/include/lldb/Core/SourceManager.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <map>
+#include <memory>
#include <vector>
// Other libraries and framework includes
@@ -26,15 +27,17 @@ class SourceManager
{
public:
#ifndef SWIG
-
class File
{
- friend bool operator== (const SourceManager::File &lhs, const SourceManager::File &rhs);
+ friend bool operator== (const SourceManager::File &lhs, const SourceManager::File &rhs);
+
public:
-
File (const FileSpec &file_spec, Target *target);
~File();
+ void
+ UpdateIfNeeded ();
+
size_t
DisplaySourceLines (uint32_t line,
uint32_t context_before,
@@ -80,7 +83,6 @@ public:
GetNumLines ();
protected:
-
bool
CalculateLineOffsets (uint32_t line = UINT32_MAX);
@@ -92,20 +94,18 @@ public:
typedef std::vector<uint32_t> LineOffsets;
LineOffsets m_offsets;
};
-
#endif // SWIG
typedef std::shared_ptr<File> FileSP;
#ifndef SWIG
-
// The SourceFileCache class separates the source manager from the cache of source files, so the
// cache can be stored in the Debugger, but the source managers can be per target.
class SourceFileCache
{
public:
- SourceFileCache () {}
- ~SourceFileCache() {}
+ SourceFileCache() = default;
+ ~SourceFileCache() = default;
void AddSourceFile (const FileSP &file_sp);
FileSP FindSourceFile (const FileSpec &file_spec) const;
@@ -114,8 +114,7 @@ public:
typedef std::map <FileSpec, FileSP> FileCache;
FileCache m_file_cache;
};
-#endif
-
+#endif // SWIG
//------------------------------------------------------------------
// Constructors and Destructors
@@ -127,7 +126,6 @@ public:
~SourceManager();
-
FileSP
GetLastFile ()
{
@@ -135,28 +133,28 @@ public:
}
size_t
- DisplaySourceLinesWithLineNumbers (const FileSpec &file,
- uint32_t line,
- uint32_t context_before,
- uint32_t context_after,
- const char* current_line_cstr,
- Stream *s,
- const SymbolContextList *bp_locs = NULL);
+ DisplaySourceLinesWithLineNumbers(const FileSpec &file,
+ uint32_t line,
+ uint32_t context_before,
+ uint32_t context_after,
+ const char* current_line_cstr,
+ Stream *s,
+ const SymbolContextList *bp_locs = nullptr);
// This variant uses the last file we visited.
size_t
- DisplaySourceLinesWithLineNumbersUsingLastFile (uint32_t start_line,
- uint32_t count,
- uint32_t curr_line,
- const char* current_line_cstr,
- Stream *s,
- const SymbolContextList *bp_locs = NULL);
+ DisplaySourceLinesWithLineNumbersUsingLastFile(uint32_t start_line,
+ uint32_t count,
+ uint32_t curr_line,
+ const char* current_line_cstr,
+ Stream *s,
+ const SymbolContextList *bp_locs = nullptr);
size_t
- DisplayMoreWithLineNumbers (Stream *s,
- uint32_t count,
- bool reverse,
- const SymbolContextList *bp_locs = NULL);
+ DisplayMoreWithLineNumbers(Stream *s,
+ uint32_t count,
+ bool reverse,
+ const SymbolContextList *bp_locs = nullptr);
bool
SetDefaultFileAndLine (const FileSpec &file_spec, uint32_t line);
@@ -167,7 +165,7 @@ public:
bool
DefaultFileAndLineSet ()
{
- return (m_last_file_sp.get() != NULL);
+ return (m_last_file_sp.get() != nullptr);
}
void
@@ -181,10 +179,6 @@ public:
GetFile (const FileSpec &file_spec);
protected:
-
- //------------------------------------------------------------------
- // Classes that inherit from SourceManager can see and modify these
- //------------------------------------------------------------------
FileSP m_last_file_sp;
uint32_t m_last_line;
uint32_t m_last_count;
@@ -193,13 +187,11 @@ protected:
lldb::DebuggerWP m_debugger_wp;
private:
- //------------------------------------------------------------------
- // For SourceManager only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (SourceManager);
};
bool operator== (const SourceManager::File &lhs, const SourceManager::File &rhs);
+
} // namespace lldb_private
-#endif // liblldb_SourceManager_h_
+#endif // liblldb_SourceManager_h_
diff --git a/include/lldb/Core/Stream.h b/include/lldb/Core/Stream.h
index 11780aa6ff0fa..f784069894ec6 100644
--- a/include/lldb/Core/Stream.h
+++ b/include/lldb/Core/Stream.h
@@ -9,11 +9,15 @@
#ifndef liblldb_Stream_h_
#define liblldb_Stream_h_
-#if defined(__cplusplus)
+// C Includes
+#include <stdarg.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Flags.h"
-#include <stdarg.h>
namespace lldb_private {
@@ -221,7 +225,7 @@ public:
/// in one statement.
//------------------------------------------------------------------
Stream&
- operator<< (void *p);
+ operator<< (const void *p);
//------------------------------------------------------------------
/// Output a character \a ch to the stream \a s.
@@ -353,13 +357,13 @@ public:
/// Size in bytes of the address, used for formatting.
///
/// @param[in] prefix
- /// A prefix C string. If NULL, no prefix will be output.
+ /// A prefix C string. If nullptr, no prefix will be output.
///
/// @param[in] suffix
- /// A suffix C string. If NULL, no suffix will be output.
+ /// A suffix C string. If nullptr, no suffix will be output.
//------------------------------------------------------------------
void
- Address (uint64_t addr, uint32_t addr_size, const char *prefix = NULL, const char *suffix = NULL);
+ Address(uint64_t addr, uint32_t addr_size, const char *prefix = nullptr, const char *suffix = nullptr);
//------------------------------------------------------------------
/// Output an address range to this stream.
@@ -377,13 +381,13 @@ public:
/// Size in bytes of the address, used for formatting.
///
/// @param[in] prefix
- /// A prefix C string. If NULL, no prefix will be output.
+ /// A prefix C string. If nullptr, no prefix will be output.
///
/// @param[in] suffix
- /// A suffix C string. If NULL, no suffix will be output.
+ /// A suffix C string. If nullptr, no suffix will be output.
//------------------------------------------------------------------
void
- AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix = NULL, const char *suffix = NULL);
+ AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix = nullptr, const char *suffix = nullptr);
//------------------------------------------------------------------
/// Output a C string to the stream.
@@ -475,11 +479,11 @@ public:
/// print an optional string following the indentation spaces.
///
/// @param[in] s
- /// A C string to print following the indentation. If NULL, just
+ /// A C string to print following the indentation. If nullptr, just
/// output the indentation characters.
//------------------------------------------------------------------
size_t
- Indent(const char *s = NULL);
+ Indent(const char *s = nullptr);
//------------------------------------------------------------------
/// Decrement the current indentation level.
@@ -607,6 +611,4 @@ protected:
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
#endif // liblldb_Stream_h_
-
diff --git a/include/lldb/Core/StreamAsynchronousIO.h b/include/lldb/Core/StreamAsynchronousIO.h
index d3b054463fa70..b069cfd496e1e 100644
--- a/include/lldb/Core/StreamAsynchronousIO.h
+++ b/include/lldb/Core/StreamAsynchronousIO.h
@@ -22,14 +22,13 @@ class StreamAsynchronousIO :
public:
StreamAsynchronousIO (Debugger &debugger, bool for_stdout);
- virtual ~StreamAsynchronousIO ();
+ ~StreamAsynchronousIO () override;
- virtual void
- Flush ();
-
- virtual size_t
- Write (const void *src, size_t src_len);
+ void
+ Flush () override;
+ size_t
+ Write (const void *src, size_t src_len) override;
private:
Debugger &m_debugger;
@@ -38,4 +37,5 @@ private:
};
} // namespace lldb_private
-#endif // #ifndef liblldb_StreamAsynchronousIO_h
+
+#endif // liblldb_StreamAsynchronousIO_h
diff --git a/include/lldb/Core/StreamCallback.h b/include/lldb/Core/StreamCallback.h
index b5fb91c6ce075..e5a9da7512bb8 100644
--- a/include/lldb/Core/StreamCallback.h
+++ b/include/lldb/Core/StreamCallback.h
@@ -24,14 +24,13 @@ class StreamCallback :
public:
StreamCallback (lldb::LogOutputCallback callback, void *baton);
- virtual ~StreamCallback ();
+ ~StreamCallback () override;
- virtual void
- Flush ();
-
- virtual size_t
- Write (const void *src, size_t src_len);
+ void
+ Flush () override;
+ size_t
+ Write (const void *src, size_t src_len) override;
private:
typedef std::map<lldb::tid_t, StreamString> collection;
@@ -44,4 +43,5 @@ private:
};
} // namespace lldb_private
-#endif // #ifndef liblldb_StreamCallback_h
+
+#endif // liblldb_StreamCallback_h
diff --git a/include/lldb/Core/StreamFile.h b/include/lldb/Core/StreamFile.h
index 55bb361780a5d..781f0a5994937 100644
--- a/include/lldb/Core/StreamFile.h
+++ b/include/lldb/Core/StreamFile.h
@@ -43,8 +43,7 @@ public:
StreamFile (FILE *fh, bool transfer_ownership);
- virtual
- ~StreamFile();
+ ~StreamFile() override;
File &
GetFile ()
@@ -58,11 +57,11 @@ public:
return m_file;
}
- virtual void
- Flush ();
+ void
+ Flush () override;
- virtual size_t
- Write (const void *s, size_t length);
+ size_t
+ Write (const void *s, size_t length) override;
protected:
//------------------------------------------------------------------
@@ -76,4 +75,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_StreamFile_h_
+#endif // liblldb_StreamFile_h_
diff --git a/include/lldb/Core/StreamGDBRemote.h b/include/lldb/Core/StreamGDBRemote.h
index 3fdb6f6e7012f..834f412d0a033 100644
--- a/include/lldb/Core/StreamGDBRemote.h
+++ b/include/lldb/Core/StreamGDBRemote.h
@@ -29,8 +29,7 @@ namespace lldb_private {
uint32_t addr_size,
lldb::ByteOrder byte_order);
- virtual
- ~StreamGDBRemote ();
+ ~StreamGDBRemote() override;
//------------------------------------------------------------------
/// Output a block of data to the stream performing GDB-remote escaping.
@@ -51,4 +50,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // liblldb_StreamGDBRemote_h_
+#endif // liblldb_StreamGDBRemote_h_
diff --git a/include/lldb/Core/StreamString.h b/include/lldb/Core/StreamString.h
index 1aa46dd80a686..5b6bde7a13c23 100644
--- a/include/lldb/Core/StreamString.h
+++ b/include/lldb/Core/StreamString.h
@@ -25,14 +25,13 @@ public:
uint32_t addr_size,
lldb::ByteOrder byte_order);
- virtual
- ~StreamString ();
+ ~StreamString () override;
- virtual void
- Flush ();
+ void
+ Flush () override;
- virtual size_t
- Write (const void *s, size_t length);
+ size_t
+ Write (const void *s, size_t length) override;
void
Clear();
@@ -60,8 +59,8 @@ public:
protected:
std::string m_packet;
-
};
} // namespace lldb_private
-#endif // #ifndef liblldb_StreamString_h_
+
+#endif // liblldb_StreamString_h_
diff --git a/include/lldb/Core/StreamTee.h b/include/lldb/Core/StreamTee.h
index e2a29a3745534..7ab619b3bb79e 100644
--- a/include/lldb/Core/StreamTee.h
+++ b/include/lldb/Core/StreamTee.h
@@ -59,8 +59,7 @@ public:
m_streams = rhs.m_streams;
}
- virtual
- ~StreamTee ()
+ ~StreamTee () override
{
}
@@ -76,8 +75,8 @@ public:
return *this;
}
- virtual void
- Flush ()
+ void
+ Flush () override
{
Mutex::Locker locker (m_streams_mutex);
collection::iterator pos, end;
@@ -93,8 +92,8 @@ public:
}
}
- virtual size_t
- Write (const void *s, size_t length)
+ size_t
+ Write (const void *s, size_t length) override
{
Mutex::Locker locker (m_streams_mutex);
if (m_streams.empty())
@@ -164,7 +163,6 @@ public:
m_streams[idx] = stream_sp;
}
-
protected:
typedef std::vector<lldb::StreamSP> collection;
mutable Mutex m_streams_mutex;
@@ -172,4 +170,5 @@ protected:
};
} // namespace lldb_private
-#endif // #ifndef liblldb_StreamTee_h_
+
+#endif // liblldb_StreamTee_h_
diff --git a/include/lldb/Core/StringList.h b/include/lldb/Core/StringList.h
index c69ed872c30d7..3e341b9940750 100644
--- a/include/lldb/Core/StringList.h
+++ b/include/lldb/Core/StringList.h
@@ -10,18 +10,24 @@
#ifndef liblldb_StringList_h_
#define liblldb_StringList_h_
+// C Includes
#include <stdint.h>
-#include "lldb/Core/STLUtils.h"
-#include "lldb/lldb-forward.h"
+// C++ Includes
+#include <string>
+
+// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
+// Project includes
+#include "lldb/lldb-forward.h"
+#include "lldb/Core/STLUtils.h"
+
namespace lldb_private {
class StringList
{
public:
-
StringList ();
StringList (const char *str);
@@ -120,7 +126,7 @@ public:
SplitIntoLines (const char *lines, size_t len);
std::string
- CopyList(const char* item_preamble = NULL,
+ CopyList(const char* item_preamble = nullptr,
const char* items_sep = "\n") const;
StringList&
@@ -142,7 +148,6 @@ public:
size_t &exact_matches_idx) const;
private:
-
STLStringArray m_strings;
};
diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h
index 7da29e48299d7..52f34521ef0eb 100644
--- a/include/lldb/Core/StructuredData.h
+++ b/include/lldb/Core/StructuredData.h
@@ -12,16 +12,16 @@
// C Includes
// C++ Includes
-
#include <functional>
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
+// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
-// Other libraries and framework includes
// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
@@ -47,7 +47,6 @@ namespace lldb_private {
class StructuredData
{
public:
-
class Object;
class Array;
class Integer;
@@ -89,9 +88,7 @@ public:
{
}
- virtual ~Object ()
- {
- }
+ virtual ~Object() = default;
virtual bool
IsValid() const
@@ -120,80 +117,62 @@ public:
Array *
GetAsArray ()
{
- if (m_type == Type::eTypeArray)
- return (Array *)this;
- return NULL;
+ return ((m_type == Type::eTypeArray) ? static_cast<Array *>(this) : nullptr);
}
Dictionary *
GetAsDictionary ()
{
- if (m_type == Type::eTypeDictionary)
- return (Dictionary *)this;
- return NULL;
+ return ((m_type == Type::eTypeDictionary) ? static_cast<Dictionary *>(this) : nullptr);
}
Integer *
GetAsInteger ()
{
- if (m_type == Type::eTypeInteger)
- return (Integer *)this;
- return NULL;
+ return ((m_type == Type::eTypeInteger) ? static_cast<Integer *>(this) : nullptr);
}
uint64_t
GetIntegerValue (uint64_t fail_value = 0)
{
Integer *integer = GetAsInteger ();
- if (integer)
- return integer->GetValue();
- return fail_value;
+ return ((integer != nullptr) ? integer->GetValue() : fail_value);
}
Float *
GetAsFloat ()
{
- if (m_type == Type::eTypeFloat)
- return (Float *)this;
- return NULL;
+ return ((m_type == Type::eTypeFloat) ? static_cast<Float *>(this) : nullptr);
}
double
GetFloatValue (double fail_value = 0.0)
{
Float *f = GetAsFloat ();
- if (f)
- return f->GetValue();
- return fail_value;
+ return ((f != nullptr) ? f->GetValue() : fail_value);
}
Boolean *
GetAsBoolean ()
{
- if (m_type == Type::eTypeBoolean)
- return (Boolean *)this;
- return NULL;
+ return ((m_type == Type::eTypeBoolean) ? static_cast<Boolean *>(this) : nullptr);
}
bool
GetBooleanValue (bool fail_value = false)
{
Boolean *b = GetAsBoolean ();
- if (b)
- return b->GetValue();
- return fail_value;
+ return ((b != nullptr) ? b->GetValue() : fail_value);
}
String *
GetAsString ()
{
- if (m_type == Type::eTypeString)
- return (String *)this;
- return NULL;
+ return ((m_type == Type::eTypeString) ? static_cast<String *>(this) : nullptr);
}
std::string
- GetStringValue(const char *fail_value = NULL)
+ GetStringValue(const char *fail_value = nullptr)
{
String *s = GetAsString ();
if (s)
@@ -208,9 +187,7 @@ public:
Generic *
GetAsGeneric()
{
- if (m_type == Type::eTypeGeneric)
- return (Generic *)this;
- return NULL;
+ return ((m_type == Type::eTypeGeneric) ? static_cast<Generic *>(this) : nullptr);
}
ObjectSP
@@ -233,10 +210,7 @@ public:
{
}
- virtual
- ~Array()
- {
- }
+ ~Array() override = default;
bool
ForEach (std::function <bool(Object* object)> const &foreach_callback) const
@@ -249,7 +223,6 @@ public:
return true;
}
-
size_t
GetSize() const
{
@@ -277,11 +250,14 @@ public:
bool
GetItemAtIndexAsInteger(size_t idx, IntType &result) const
{
- ObjectSP value = GetItemAtIndex(idx);
- if (auto int_value = value->GetAsInteger())
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get())
{
- result = static_cast<IntType>(int_value->GetValue());
- return true;
+ if (auto int_value = value_sp->GetAsInteger())
+ {
+ result = static_cast<IntType>(int_value->GetValue());
+ return true;
+ }
}
return false;
}
@@ -299,11 +275,14 @@ public:
bool
GetItemAtIndexAsString(size_t idx, std::string &result) const
{
- ObjectSP value = GetItemAtIndex(idx);
- if (auto string_value = value->GetAsString())
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get())
{
- result = string_value->GetValue();
- return true;
+ if (auto string_value = value_sp->GetAsString())
+ {
+ result = string_value->GetValue();
+ return true;
+ }
}
return false;
}
@@ -320,13 +299,13 @@ public:
bool
GetItemAtIndexAsString(size_t idx, ConstString &result) const
{
- ObjectSP value = GetItemAtIndex(idx);
- if (!value)
- return false;
- if (auto string_value = value->GetAsString())
- {
- result = ConstString(string_value->GetValue());
- return true;
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get()) {
+ if (auto string_value = value_sp->GetAsString())
+ {
+ result = ConstString(string_value->GetValue());
+ return true;
+ }
}
return false;
}
@@ -343,17 +322,27 @@ public:
bool
GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const
{
- ObjectSP value = GetItemAtIndex(idx);
- result = value->GetAsDictionary();
- return (result != nullptr);
+ result = nullptr;
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get())
+ {
+ result = value_sp->GetAsDictionary();
+ return (result != nullptr);
+ }
+ return false;
}
bool
GetItemAtIndexAsArray(size_t idx, Array *&result) const
{
- ObjectSP value = GetItemAtIndex(idx);
- result = value->GetAsArray();
- return (result != nullptr);
+ result = nullptr;
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get())
+ {
+ result = value_sp->GetAsArray();
+ return (result != nullptr);
+ }
+ return false;
}
void
@@ -375,8 +364,7 @@ public:
collection m_items;
};
-
- class Integer : public Object
+ class Integer : public Object
{
public:
Integer (uint64_t i = 0) :
@@ -385,9 +373,7 @@ public:
{
}
- virtual ~Integer()
- {
- }
+ ~Integer() override = default;
void
SetValue (uint64_t value)
@@ -407,7 +393,7 @@ public:
uint64_t m_value;
};
- class Float : public Object
+ class Float : public Object
{
public:
Float (double d = 0.0) :
@@ -416,9 +402,7 @@ public:
{
}
- virtual ~Float()
- {
- }
+ ~Float() override = default;
void
SetValue (double value)
@@ -438,7 +422,7 @@ public:
double m_value;
};
- class Boolean : public Object
+ class Boolean : public Object
{
public:
Boolean (bool b = false) :
@@ -447,9 +431,7 @@ public:
{
}
- virtual ~Boolean()
- {
- }
+ ~Boolean() override = default;
void
SetValue (bool value)
@@ -469,12 +451,10 @@ public:
bool m_value;
};
-
-
- class String : public Object
+ class String : public Object
{
public:
- String (const char *cstr = NULL) :
+ String(const char *cstr = nullptr) :
Object (Type::eTypeString),
m_value ()
{
@@ -522,9 +502,7 @@ public:
{
}
- virtual ~Dictionary()
- {
- }
+ ~Dictionary() override = default;
size_t
GetSize() const
@@ -580,13 +558,13 @@ public:
bool
GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
{
- ObjectSP value = GetValueForKey(key);
- if (!value)
- return false;
- if (auto int_value = value->GetAsInteger())
- {
- result = static_cast<IntType>(int_value->GetValue());
- return true;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp) {
+ if (auto int_value = value_sp->GetAsInteger())
+ {
+ result = static_cast<IntType>(int_value->GetValue());
+ return true;
+ }
}
return false;
}
@@ -604,13 +582,14 @@ public:
bool
GetValueForKeyAsString(llvm::StringRef key, std::string &result) const
{
- ObjectSP value = GetValueForKey(key);
- if (!value)
- return false;
- if (auto string_value = value->GetAsString())
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get())
{
- result = string_value->GetValue();
- return true;
+ if (auto string_value = value_sp->GetAsString())
+ {
+ result = string_value->GetValue();
+ return true;
+ }
}
return false;
}
@@ -632,13 +611,14 @@ public:
bool
GetValueForKeyAsString(llvm::StringRef key, ConstString &result) const
{
- ObjectSP value = GetValueForKey(key);
- if (!value)
- return false;
- if (auto string_value = value->GetAsString())
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get())
{
- result = ConstString(string_value->GetValue());
- return true;
+ if (auto string_value = value_sp->GetAsString())
+ {
+ result = ConstString(string_value->GetValue());
+ return true;
+ }
}
return false;
}
@@ -656,22 +636,26 @@ public:
GetValueForKeyAsDictionary(llvm::StringRef key, Dictionary *&result) const
{
result = nullptr;
- ObjectSP value = GetValueForKey(key);
- if (!value)
- return false;
- result = value->GetAsDictionary();
- return true;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get())
+ {
+ result = value_sp->GetAsDictionary();
+ return (result != nullptr);
+ }
+ return false;
}
bool
GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
{
result = nullptr;
- ObjectSP value = GetValueForKey(key);
- if (!value)
- return false;
- result = value->GetAsArray();
- return true;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get())
+ {
+ result = value_sp->GetAsArray();
+ return (result != nullptr);
+ }
+ return false;
}
bool
@@ -683,10 +667,10 @@ public:
}
void
- AddItem (llvm::StringRef key, ObjectSP value)
+ AddItem (llvm::StringRef key, ObjectSP value_sp)
{
ConstString key_cs(key);
- m_dict[key_cs] = value;
+ m_dict[key_cs] = value_sp;
}
void
@@ -728,9 +712,7 @@ public:
{
}
- virtual ~Null()
- {
- }
+ ~Null() override = default;
bool
IsValid() const override
@@ -739,13 +721,11 @@ public:
}
void Dump(Stream &s) const override;
-
- protected:
};
class Generic : public Object
{
- public:
+ public:
explicit Generic(void *object = nullptr) :
Object (Type::eTypeGeneric),
m_object (object)
@@ -772,16 +752,14 @@ public:
void Dump(Stream &s) const override;
- private:
+ private:
void *m_object;
};
static ObjectSP
ParseJSON (std::string json_text);
-
-}; // class StructuredData
-
+};
} // namespace lldb_private
-#endif // liblldb_StructuredData_h_
+#endif // liblldb_StructuredData_h_
diff --git a/include/lldb/Core/ThreadSafeDenseMap.h b/include/lldb/Core/ThreadSafeDenseMap.h
index f5a7ccfb2ffa3..6b2b59b7617c5 100644
--- a/include/lldb/Core/ThreadSafeDenseMap.h
+++ b/include/lldb/Core/ThreadSafeDenseMap.h
@@ -54,7 +54,27 @@ public:
Mutex::Locker locker(m_mutex);
return m_map.lookup(k);
}
-
+
+ bool
+ Lookup (_KeyType k,
+ _ValueType& v)
+ {
+ Mutex::Locker locker(m_mutex);
+ auto iter = m_map.find(k),
+ end = m_map.end();
+ if (iter == end)
+ return false;
+ v = iter->second;
+ return true;
+ }
+
+ void
+ Clear ()
+ {
+ Mutex::Locker locker(m_mutex);
+ m_map.clear();
+ }
+
protected:
LLVMMapType m_map;
Mutex m_mutex;
diff --git a/include/lldb/Core/ThreadSafeDenseSet.h b/include/lldb/Core/ThreadSafeDenseSet.h
index 19c67b65e8c18..e019c70ed5e5b 100644
--- a/include/lldb/Core/ThreadSafeDenseSet.h
+++ b/include/lldb/Core/ThreadSafeDenseSet.h
@@ -55,6 +55,13 @@ namespace lldb_private {
return (m_set.count(e) > 0);
}
+ void
+ Clear ()
+ {
+ Mutex::Locker locker(m_mutex);
+ m_set.clear();
+ }
+
protected:
LLVMSetType m_set;
Mutex m_mutex;
diff --git a/include/lldb/Core/Timer.h b/include/lldb/Core/Timer.h
index e354d91be4428..ffaeba6fce9b7 100644
--- a/include/lldb/Core/Timer.h
+++ b/include/lldb/Core/Timer.h
@@ -9,11 +9,17 @@
#ifndef liblldb_Timer_h_
#define liblldb_Timer_h_
-#if defined(__cplusplus)
+// C Includes
#include <stdarg.h>
#include <stdio.h>
-#include <string>
+
+// C++ Includes
+#include <atomic>
+#include <mutex>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/TimeValue.h"
@@ -34,19 +40,19 @@ namespace lldb_private {
class Timer
{
public:
- static void
- Initialize ();
-
//--------------------------------------------------------------
/// Default constructor.
//--------------------------------------------------------------
Timer(const char *category, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
//--------------------------------------------------------------
- /// Desstructor
+ /// Destructor
//--------------------------------------------------------------
~Timer();
+ static void
+ Initialize ();
+
void
Dump ();
@@ -63,7 +69,6 @@ public:
ResetCategoryTimes ();
protected:
-
void
ChildStarted (const TimeValue& time);
@@ -76,17 +81,17 @@ protected:
uint64_t
GetTimerElapsedNanoSeconds();
- //--------------------------------------------------------------
- /// Member variables
- //--------------------------------------------------------------
const char *m_category;
TimeValue m_total_start;
TimeValue m_timer_start;
uint64_t m_total_ticks; // Total running time for this timer including when other timers below this are running
uint64_t m_timer_ticks; // Ticks for this timer that do not include when other timers below this one are running
- static uint32_t g_depth;
- static uint32_t g_display_depth;
- static FILE * g_file;
+
+ static std::atomic<bool> g_quiet;
+ static std::atomic<unsigned> g_display_depth;
+ static std::mutex g_file_mutex;
+ static FILE* g_file;
+
private:
Timer();
DISALLOW_COPY_AND_ASSIGN (Timer);
@@ -99,10 +104,8 @@ public:
m_start (TimeValue::Now())
{
}
-
- ~IntervalTimer()
- {
- }
+
+ ~IntervalTimer() = default;
uint64_t
GetElapsedNanoSeconds() const
@@ -121,7 +124,7 @@ public:
{
TimeValue now (TimeValue::Now());
const uint64_t elapsed_nsec = now - m_start;
- const char *unit = NULL;
+ const char *unit = nullptr;
float elapsed_value;
if (elapsed_nsec < 1000)
{
@@ -150,11 +153,11 @@ public:
va_end (args);
return result;
}
+
protected:
TimeValue m_start;
};
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // #ifndef liblldb_Timer_h_
+#endif // liblldb_Timer_h_
diff --git a/include/lldb/Core/UUID.h b/include/lldb/Core/UUID.h
index 3bb14421b1e99..88426cfb6c75d 100644
--- a/include/lldb/Core/UUID.h
+++ b/include/lldb/Core/UUID.h
@@ -16,7 +16,6 @@
// Other libraries and framework includes
// Project includes
-
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -58,7 +57,7 @@ public:
SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
std::string
- GetAsString (const char *separator = NULL) const;
+ GetAsString(const char *separator = nullptr) const;
size_t
SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16);
@@ -80,7 +79,7 @@ public:
/// decoded UUID.
///
/// @param[out] end
- /// If \a end is not NULL, it will be filled in with the a
+ /// If \a end is not nullptr, it will be filled in with the a
/// pointer to the character after the last successfully decoded
/// byte.
///
diff --git a/include/lldb/Core/UniqueCStringMap.h b/include/lldb/Core/UniqueCStringMap.h
index 972c0d53ea99e..1e50f747f2a8d 100644
--- a/include/lldb/Core/UniqueCStringMap.h
+++ b/include/lldb/Core/UniqueCStringMap.h
@@ -9,18 +9,18 @@
#ifndef liblldb_UniqueCStringMap_h_
#define liblldb_UniqueCStringMap_h_
-#if defined(__cplusplus)
-#include <assert.h>
+// C Includes
+// C++ Includes
#include <algorithm>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/Core/RegularExpression.h"
namespace lldb_private {
-
-
//----------------------------------------------------------------------
// Templatized uniqued string map.
//
@@ -37,7 +37,7 @@ public:
struct Entry
{
Entry () :
- cstring(NULL),
+ cstring(nullptr),
value()
{
}
@@ -146,9 +146,7 @@ public:
const char *
GetCStringAtIndex (uint32_t idx) const
{
- if (idx < m_map.size())
- return m_map[idx].cstring;
- return NULL;
+ return ((idx < m_map.size()) ? m_map[idx].cstring : nullptr);
}
//------------------------------------------------------------------
@@ -172,8 +170,9 @@ public:
}
return fail_value;
}
+
//------------------------------------------------------------------
- // Get a pointer to the first entry that matches "name". NULL will
+ // Get a pointer to the first entry that matches "name". nullptr will
// be returned if there is no entry that matches "name".
//
// The caller is responsible for ensuring that the collection does
@@ -191,12 +190,12 @@ public:
if (pos_cstr == unique_cstr)
return &(*pos);
}
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
// Get a pointer to the next entry that matches "name" from a
- // previously returned Entry pointer. NULL will be returned if there
+ // previously returned Entry pointer. nullptr will be returned if there
// is no subsequent entry that matches "name".
//
// The caller is responsible for ensuring that the collection does
@@ -216,7 +215,7 @@ public:
return next_entry;
}
}
- return NULL;
+ return nullptr;
}
size_t
@@ -261,7 +260,6 @@ public:
return m_map.size();
}
-
//------------------------------------------------------------------
// Returns true if this map is empty.
//------------------------------------------------------------------
@@ -346,6 +344,7 @@ public:
}
return num_removed;
}
+
protected:
typedef std::vector<Entry> collection;
typedef typename collection::iterator iterator;
@@ -353,9 +352,6 @@ protected:
collection m_map;
};
-
-
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_UniqueCStringMap_h_
+#endif // liblldb_UniqueCStringMap_h_
diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h
index 957cedeb0dcc6..a6d934afd294e 100644
--- a/include/lldb/Core/Value.h
+++ b/include/lldb/Core/Value.h
@@ -12,23 +12,21 @@
// C Includes
// C++ Includes
-#include <string>
#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Scalar.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
namespace lldb_private {
class Value
{
public:
-
// Values Less than zero are an error, greater than or equal to zero
// returns what the Scalar result is.
enum ValueType
@@ -101,6 +99,7 @@ public:
// Casts a vector, if valid, to an unsigned int of matching or largest supported size.
// Truncates to the beginning of the vector if required.
// Returns a default constructed Scalar if the Vector data is internally inconsistent.
+ llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)bytes)->x);
Scalar
GetAsScalar() const
{
@@ -111,11 +110,7 @@ public:
else if (length == 2) scalar = *(const uint16_t *)bytes;
else if (length == 4) scalar = *(const uint32_t *)bytes;
else if (length == 8) scalar = *(const uint64_t *)bytes;
-#if defined (ENABLE_128_BIT_SUPPORT)
- else if (length >= 16) scalar = *(const __uint128_t *)bytes;
-#else
- else if (length >= 16) scalar = *(const uint64_t *)bytes;
-#endif
+ else if (length >= 16) scalar = rhs;
}
return scalar;
}
@@ -136,11 +131,11 @@ public:
Value &
operator=(const Value &rhs);
- const ClangASTType &
- GetClangType();
+ const CompilerType &
+ GetCompilerType();
void
- SetClangType (const ClangASTType &clang_type);
+ SetCompilerType (const CompilerType &compiler_type);
ValueType
GetValueType() const;
@@ -163,7 +158,7 @@ public:
void
ClearContext ()
{
- m_context = NULL;
+ m_context = nullptr;
m_context_type = eContextTypeInvalid;
}
@@ -269,13 +264,13 @@ public:
GetValueDefaultFormat ();
uint64_t
- GetValueByteSize (Error *error_ptr);
+ GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx);
Error
- GetValueAsData (ExecutionContext *exe_ctx,
- DataExtractor &data,
- uint32_t data_offset,
- Module *module); // Can be NULL
+ GetValueAsData(ExecutionContext *exe_ctx,
+ DataExtractor &data,
+ uint32_t data_offset,
+ Module *module); // Can be nullptr
static const char *
GetValueTypeAsCString (ValueType context_type);
@@ -292,7 +287,7 @@ public:
protected:
Scalar m_value;
Vector m_vector;
- ClangASTType m_clang_type;
+ CompilerType m_compiler_type;
void * m_context;
ValueType m_value_type;
ContextType m_context_type;
@@ -309,9 +304,7 @@ public:
ValueList (const ValueList &rhs);
- ~ValueList ()
- {
- }
+ ~ValueList() = default;
const ValueList & operator= (const ValueList &rhs);
@@ -322,8 +315,6 @@ public:
Value *GetValueAtIndex(size_t idx);
void Clear();
-protected:
-
private:
typedef std::vector<Value> collection;
@@ -332,4 +323,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Value_h_
+#endif // liblldb_Value_h_
diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h
index cdc507093b289..c066cc7d3661d 100644
--- a/include/lldb/Core/ValueObject.h
+++ b/include/lldb/Core/ValueObject.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <functional>
+#include <initializer_list>
#include <map>
#include <vector>
@@ -27,7 +29,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/Value.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/Process.h"
@@ -69,7 +71,6 @@ namespace lldb_private {
class ValueObject : public UserID
{
public:
-
enum GetExpressionPathFormat
{
eGetExpressionPathFormatDereferencePointers = 1,
@@ -221,13 +222,11 @@ public:
return g_default_options;
}
-
};
class EvaluationPoint
{
public:
-
EvaluationPoint ();
EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected = false);
@@ -326,6 +325,8 @@ public:
bool m_needs_update;
};
+ virtual ~ValueObject();
+
const EvaluationPoint &
GetUpdatePoint () const
{
@@ -371,10 +372,8 @@ public:
void
SetNeedsUpdate ();
- virtual ~ValueObject();
-
- ClangASTType
- GetClangType ();
+ CompilerType
+ GetCompilerType ();
// this vends a TypeImpl that is useful at the SB API layer
virtual TypeImpl
@@ -408,7 +407,7 @@ public:
GetObjectRuntimeLanguage();
virtual uint32_t
- GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL);
+ GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr);
virtual bool
IsPointerType ();
@@ -425,8 +424,11 @@ public:
virtual bool
IsPossibleDynamicType ();
- virtual bool
- IsObjCNil ();
+ bool
+ IsNilReference ();
+
+ bool
+ IsUninitializedReference ();
virtual bool
IsBaseClass ()
@@ -454,20 +456,20 @@ public:
lldb::ValueObjectSP
GetValueForExpressionPath(const char* expression,
- const char** first_unparsed = NULL,
- ExpressionPathScanEndReason* reason_to_stop = NULL,
- ExpressionPathEndResultType* final_value_type = NULL,
+ const char** first_unparsed = nullptr,
+ ExpressionPathScanEndReason* reason_to_stop = nullptr,
+ ExpressionPathEndResultType* final_value_type = nullptr,
const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
- ExpressionPathAftermath* final_task_on_target = NULL);
+ ExpressionPathAftermath* final_task_on_target = nullptr);
int
GetValuesForExpressionPath(const char* expression,
lldb::ValueObjectListSP& list,
- const char** first_unparsed = NULL,
- ExpressionPathScanEndReason* reason_to_stop = NULL,
- ExpressionPathEndResultType* final_value_type = NULL,
+ const char** first_unparsed = nullptr,
+ ExpressionPathScanEndReason* reason_to_stop = nullptr,
+ ExpressionPathEndResultType* final_value_type = nullptr,
const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
- ExpressionPathAftermath* final_task_on_target = NULL);
+ ExpressionPathAftermath* final_task_on_target = nullptr);
virtual bool
IsInScope ()
@@ -517,10 +519,10 @@ public:
std::string& destination);
virtual uint64_t
- GetValueAsUnsigned (uint64_t fail_value, bool *success = NULL);
+ GetValueAsUnsigned(uint64_t fail_value, bool *success = nullptr);
virtual int64_t
- GetValueAsSigned (int64_t fail_value, bool *success = NULL);
+ GetValueAsSigned(int64_t fail_value, bool *success = nullptr);
virtual bool
SetValueFromCString (const char *value_str, Error& error);
@@ -556,37 +558,37 @@ public:
// this will always create the children if necessary
lldb::ValueObjectSP
- GetChildAtIndexPath (const std::initializer_list<size_t> &idxs,
- size_t* index_of_error = NULL);
+ GetChildAtIndexPath(const std::initializer_list<size_t> &idxs,
+ size_t* index_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtIndexPath (const std::vector<size_t> &idxs,
- size_t* index_of_error = NULL);
+ GetChildAtIndexPath(const std::vector<size_t> &idxs,
+ size_t* index_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtIndexPath (const std::initializer_list< std::pair<size_t, bool> > &idxs,
- size_t* index_of_error = NULL);
+ GetChildAtIndexPath(const std::initializer_list< std::pair<size_t, bool> > &idxs,
+ size_t* index_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtIndexPath (const std::vector< std::pair<size_t, bool> > &idxs,
- size_t* index_of_error = NULL);
+ GetChildAtIndexPath(const std::vector< std::pair<size_t, bool> > &idxs,
+ size_t* index_of_error = nullptr);
// this will always create the children if necessary
lldb::ValueObjectSP
- GetChildAtNamePath (const std::initializer_list<ConstString> &names,
- ConstString* name_of_error = NULL);
+ GetChildAtNamePath(const std::initializer_list<ConstString> &names,
+ ConstString* name_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtNamePath (const std::vector<ConstString> &names,
- ConstString* name_of_error = NULL);
+ GetChildAtNamePath(const std::vector<ConstString> &names,
+ ConstString* name_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtNamePath (const std::initializer_list< std::pair<ConstString, bool> > &names,
- ConstString* name_of_error = NULL);
+ GetChildAtNamePath(const std::initializer_list< std::pair<ConstString, bool> > &names,
+ ConstString* name_of_error = nullptr);
lldb::ValueObjectSP
- GetChildAtNamePath (const std::vector< std::pair<ConstString, bool> > &names,
- ConstString* name_of_error = NULL);
+ GetChildAtNamePath(const std::vector< std::pair<ConstString, bool> > &names,
+ ConstString* name_of_error = nullptr);
virtual lldb::ValueObjectSP
GetChildMemberWithName (const ConstString &name, bool can_create);
@@ -595,7 +597,7 @@ public:
GetIndexOfChildWithName (const ConstString &name);
size_t
- GetNumChildren ();
+ GetNumChildren (uint32_t max=UINT32_MAX);
const Value &
GetValue() const;
@@ -606,15 +608,22 @@ public:
virtual bool
ResolveValue (Scalar &scalar);
+ // return 'false' whenever you set the error, otherwise
+ // callers may assume true means everything is OK - this will
+ // break breakpoint conditions among potentially a few others
+ virtual bool
+ IsLogicalTrue (Error& error);
+
virtual const char *
GetLocationAsCString ();
const char *
- GetSummaryAsCString ();
+ GetSummaryAsCString (lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
bool
GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
- std::string& destination);
+ std::string& destination,
+ lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
bool
GetSummaryAsCString (std::string& destination,
@@ -671,11 +680,11 @@ public:
SetName (const ConstString &name);
virtual lldb::addr_t
- GetAddressOf (bool scalar_is_load_address = true,
- AddressType *address_type = NULL);
+ GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr);
lldb::addr_t
- GetPointerValue (AddressType *address_type = NULL);
+ GetPointerValue(AddressType *address_type = nullptr);
lldb::ValueObjectSP
GetSyntheticChild (const ConstString &key) const;
@@ -690,10 +699,10 @@ public:
GetSyntheticExpressionPathChild(const char* expression, bool can_create);
virtual lldb::ValueObjectSP
- GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
+ GetSyntheticChildAtOffset(uint32_t offset, const CompilerType& type, bool can_create);
virtual lldb::ValueObjectSP
- GetSyntheticBase (uint32_t offset, const ClangASTType& type, bool can_create);
+ GetSyntheticBase (uint32_t offset, const CompilerType& type, bool can_create);
virtual lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
@@ -746,11 +755,11 @@ public:
GetCPPVTableAddress(AddressType &address_type);
virtual lldb::ValueObjectSP
- Cast (const ClangASTType &clang_ast_type);
+ Cast (const CompilerType &compiler_type);
virtual lldb::ValueObjectSP
CastPointerType (const char *name,
- ClangASTType &ast_type);
+ CompilerType &ast_type);
virtual lldb::ValueObjectSP
CastPointerType (const char *name,
@@ -809,13 +818,13 @@ public:
CreateValueObjectFromAddress (const char* name,
uint64_t address,
const ExecutionContext& exe_ctx,
- ClangASTType type);
+ CompilerType type);
static lldb::ValueObjectSP
CreateValueObjectFromData (const char* name,
const DataExtractor& data,
const ExecutionContext& exe_ctx,
- ClangASTType type);
+ CompilerType type);
void
LogValueObject (Log *log);
@@ -834,7 +843,7 @@ public:
bool
IsCStringContainer (bool check_pointer = false);
- size_t
+ std::pair<size_t,bool>
ReadPointedString (lldb::DataBufferSP& buffer_sp,
Error& error,
uint32_t max_length = 0,
@@ -861,7 +870,7 @@ public:
bool
NeedsUpdating ()
{
- const bool accept_invalid_exe_ctx = CanUpdateWithInvalidExecutionContext();
+ const bool accept_invalid_exe_ctx = (CanUpdateWithInvalidExecutionContext() == eLazyBoolYes);
return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
}
@@ -881,8 +890,7 @@ public:
ClearUserVisibleData(eClearUserVisibleDataItemsValue);
m_format = format;
}
-
-
+
virtual lldb::LanguageType
GetPreferredDisplayLanguage ();
@@ -999,8 +1007,20 @@ public:
virtual bool
MightHaveChildren();
+ virtual lldb::VariableSP
+ GetVariable ()
+ {
+ return nullptr;
+ }
+
virtual bool
IsRuntimeSupportValue ();
+
+ virtual uint64_t
+ GetLanguageFlags ();
+
+ virtual void
+ SetLanguageFlags (uint64_t flags);
protected:
typedef ClusterManager<ValueObject> ValueObjectManager;
@@ -1018,21 +1038,15 @@ protected:
HasChildAtIndex (size_t idx)
{
Mutex::Locker locker(m_mutex);
- ChildrenIterator iter = m_children.find(idx);
- ChildrenIterator end = m_children.end();
- return (iter != end);
+ return (m_children.find(idx) != m_children.end());
}
ValueObject*
GetChildAtIndex (size_t idx)
{
Mutex::Locker locker(m_mutex);
- ChildrenIterator iter = m_children.find(idx);
- ChildrenIterator end = m_children.end();
- if (iter == end)
- return NULL;
- else
- return iter->second;
+ const auto iter = m_children.find(idx);
+ return ((iter == m_children.end()) ? nullptr : iter->second);
}
void
@@ -1075,8 +1089,8 @@ protected:
//------------------------------------------------------------------
// Classes that inherit from ValueObject can see and modify these
//------------------------------------------------------------------
- ValueObject * m_parent; // The parent value object, or NULL if this has no parent
- ValueObject * m_root; // The root of the hierarchy for this ValueObject (or NULL if never calculated)
+ ValueObject * m_parent; // The parent value object, or nullptr if this has no parent
+ ValueObject * m_root; // The root of the hierarchy for this ValueObject (or nullptr if never calculated)
EvaluationPoint m_update_point; // Stores both the stop id and the full context at which this value was last
// updated. When we are asked to update the value object, we check whether
// the context & stop id are the same before updating.
@@ -1093,7 +1107,7 @@ protected:
llvm::Optional<std::pair<TypeValidatorResult, std::string>> m_validation_result;
- ClangASTType m_override_type;// If the type of the value object should be overridden, the type to impose.
+ CompilerType m_override_type;// If the type of the value object should be overridden, the type to impose.
ValueObjectManager *m_manager; // This object is managed by the root object (any ValueObject that gets created
// without a parent.) The manager gets passed through all the generations of
@@ -1125,6 +1139,8 @@ protected:
lldb::LanguageType m_preferred_display_language;
+ uint64_t m_language_flags;
+
bool m_value_is_valid:1,
m_value_did_change:1,
m_children_count_valid:1,
@@ -1139,7 +1155,7 @@ protected:
friend class ValueObjectChild;
friend class ClangExpressionDeclMap; // For GetValue
- friend class ClangExpressionVariable; // For SetName
+ friend class ExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ValueObjectConstResultImpl;
friend class ValueObjectSynthetic; // For ClearUserVisibleData
@@ -1172,10 +1188,10 @@ protected:
virtual bool
UpdateValue () = 0;
- virtual bool
+ virtual LazyBool
CanUpdateWithInvalidExecutionContext ()
{
- return false;
+ return eLazyBoolCalculate;
}
virtual void
@@ -1203,7 +1219,7 @@ protected:
// Should only be called by ValueObject::GetNumChildren()
virtual size_t
- CalculateNumChildren() = 0;
+ CalculateNumChildren(uint32_t max=UINT32_MAX) = 0;
void
SetNumChildren (size_t num_children);
@@ -1231,8 +1247,8 @@ protected:
// Subclasses must implement the functions below.
//------------------------------------------------------------------
- virtual ClangASTType
- GetClangTypeImpl () = 0;
+ virtual CompilerType
+ GetCompilerTypeImpl () = 0;
const char *
GetLocationAsCStringImpl (const Value& value,
@@ -1241,12 +1257,11 @@ protected:
bool
IsChecksumEmpty ();
-private:
- //------------------------------------------------------------------
- // For ValueObject only
- //------------------------------------------------------------------
+ void
+ SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType);
- virtual ClangASTType
+private:
+ virtual CompilerType
MaybeCalculateCompleteType ();
lldb::ValueObjectSP
@@ -1270,12 +1285,10 @@ private:
ExpressionPathEndResultType* final_value_type,
const GetValueForExpressionPathOptions& options,
ExpressionPathAftermath* final_task_on_target);
-
-
- DISALLOW_COPY_AND_ASSIGN (ValueObject);
+ DISALLOW_COPY_AND_ASSIGN (ValueObject);
};
} // namespace lldb_private
-#endif // liblldb_ValueObject_h_
+#endif // liblldb_ValueObject_h_
diff --git a/include/lldb/Core/ValueObjectCast.h b/include/lldb/Core/ValueObjectCast.h
index 1538d7a556399..8c7ffe5ec5e26 100644
--- a/include/lldb/Core/ValueObjectCast.h
+++ b/include/lldb/Core/ValueObjectCast.h
@@ -1,4 +1,4 @@
-//===-- ValueObjectDynamicValue.h -----------------------------------*- C++ -*-===//
+//===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -24,64 +24,54 @@ namespace lldb_private {
class ValueObjectCast : public ValueObject
{
public:
+ ~ValueObjectCast() override;
+
static lldb::ValueObjectSP
Create (ValueObject &parent,
const ConstString &name,
- const ClangASTType &cast_type);
+ const CompilerType &cast_type);
- virtual
- ~ValueObjectCast();
-
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual ValueObject *
- GetParent()
+ ValueObject *
+ GetParent() override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
- virtual const ValueObject *
- GetParent() const
+ const ValueObject *
+ GetParent() const override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
protected:
- virtual bool
- UpdateValue ();
+ ValueObjectCast(ValueObject &parent,
+ const ConstString &name,
+ const CompilerType &cast_type);
+
+ bool
+ UpdateValue () override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl () override;
- ClangASTType m_cast_type;
+ CompilerType m_cast_type;
private:
- ValueObjectCast (ValueObject &parent,
- const ConstString &name,
- const ClangASTType &cast_type);
-
- //------------------------------------------------------------------
- // For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (ValueObjectCast);
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectCast_h_
+#endif // liblldb_ValueObjectCast_h_
diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h
index bf8707ea3b05e..13e26c6ab0c10 100644
--- a/include/lldb/Core/ValueObjectChild.h
+++ b/include/lldb/Core/ValueObjectChild.h
@@ -16,6 +16,8 @@
// Project includes
#include "lldb/Core/ValueObject.h"
+#include "llvm/ADT/Optional.h"
+
namespace lldb_private {
//----------------------------------------------------------------------
@@ -24,76 +26,76 @@ namespace lldb_private {
class ValueObjectChild : public ValueObject
{
public:
- virtual ~ValueObjectChild();
+ ~ValueObjectChild() override;
- virtual uint64_t
- GetByteSize()
+ uint64_t
+ GetByteSize() override
{
return m_byte_size;
}
- virtual lldb::offset_t
- GetByteOffset()
+ lldb::offset_t
+ GetByteOffset() override
{
return m_byte_offset;
}
- virtual uint32_t
- GetBitfieldBitSize()
+ uint32_t
+ GetBitfieldBitSize() override
{
return m_bitfield_bit_size;
}
- virtual uint32_t
- GetBitfieldBitOffset()
+ uint32_t
+ GetBitfieldBitOffset() override
{
return m_bitfield_bit_offset;
}
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual bool
- IsBaseClass ()
+ bool
+ IsBaseClass() override
{
return m_is_base_class;
}
- virtual bool
- IsDereferenceOfParent ()
+ bool
+ IsDereferenceOfParent() override
{
return m_is_deref_of_parent;
}
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual bool
- CanUpdateWithInvalidExecutionContext ();
+ LazyBool
+ CanUpdateWithInvalidExecutionContext() override;
- virtual ClangASTType
- GetClangTypeImpl ()
+ CompilerType
+ GetCompilerTypeImpl() override
{
- return m_clang_type;
+ return m_compiler_type;
}
- ClangASTType m_clang_type;
+ CompilerType m_compiler_type;
ConstString m_type_name;
uint64_t m_byte_size;
int32_t m_byte_offset;
@@ -101,6 +103,7 @@ protected:
uint8_t m_bitfield_bit_offset;
bool m_is_base_class;
bool m_is_deref_of_parent;
+ llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
//
// void
@@ -110,8 +113,9 @@ protected:
friend class ValueObject;
friend class ValueObjectConstResult;
friend class ValueObjectConstResultImpl;
+
ValueObjectChild (ValueObject &parent,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
uint64_t byte_size,
int32_t byte_offset,
@@ -119,11 +123,12 @@ protected:
uint32_t bitfield_bit_offset,
bool is_base_class,
bool is_deref_of_parent,
- AddressType child_ptr_or_ref_addr_type);
+ AddressType child_ptr_or_ref_addr_type,
+ uint64_t language_flags);
DISALLOW_COPY_AND_ASSIGN (ValueObjectChild);
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectChild_h_
+#endif // liblldb_ValueObjectChild_h_
diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h
index 4e05d50132ec8..f63ee83284df7 100644
--- a/include/lldb/Core/ValueObjectConstResult.h
+++ b/include/lldb/Core/ValueObjectConstResult.h
@@ -26,6 +26,8 @@ namespace lldb_private {
class ValueObjectConstResult : public ValueObject
{
public:
+ ~ValueObjectConstResult() override;
+
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope,
lldb::ByteOrder byte_order,
@@ -34,14 +36,14 @@ public:
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
const DataExtractor &data,
lldb::addr_t address = LLDB_INVALID_ADDRESS);
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
const lldb::DataBufferSP &result_data_sp,
lldb::ByteOrder byte_order,
@@ -50,7 +52,7 @@ public:
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
lldb::addr_t address,
AddressType address_type,
@@ -67,76 +69,76 @@ public:
Create (ExecutionContextScope *exe_scope,
const Error& error);
- virtual ~ValueObjectConstResult();
-
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
void
SetByteSize (size_t size);
- virtual lldb::ValueObjectSP
- Dereference (Error &error);
+ lldb::ValueObjectSP
+ Dereference(Error &error) override;
- virtual ValueObject *
- CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
+ ValueObject *
+ CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override;
- virtual lldb::ValueObjectSP
- GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
+ lldb::ValueObjectSP
+ GetSyntheticChildAtOffset(uint32_t offset, const CompilerType& type, bool can_create) override;
- virtual lldb::ValueObjectSP
- AddressOf (Error &error);
+ lldb::ValueObjectSP
+ AddressOf(Error &error) override;
- virtual lldb::addr_t
- GetAddressOf (bool scalar_is_load_address = true,
- AddressType *address_type = NULL);
+ lldb::addr_t
+ GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr) override;
- virtual size_t
- GetPointeeData (DataExtractor& data,
- uint32_t item_idx = 0,
- uint32_t item_count = 1);
+ size_t
+ GetPointeeData(DataExtractor& data,
+ uint32_t item_idx = 0,
+ uint32_t item_count = 1) override;
- virtual lldb::addr_t
- GetLiveAddress()
+ lldb::addr_t
+ GetLiveAddress() override
{
return m_impl.GetLiveAddress();
}
- virtual void
+ void
SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
- AddressType address_type = eAddressTypeLoad)
+ AddressType address_type = eAddressTypeLoad) override
{
- m_impl.SetLiveAddress(addr,
- address_type);
+ m_impl.SetLiveAddress(addr, address_type);
}
- virtual lldb::ValueObjectSP
- GetDynamicValue (lldb::DynamicValueType valueType);
+ lldb::ValueObjectSP
+ GetDynamicValue(lldb::DynamicValueType valueType) override;
- virtual lldb::LanguageType
- GetPreferredDisplayLanguage ();
+ lldb::LanguageType
+ GetPreferredDisplayLanguage() override;
+
+ lldb::ValueObjectSP
+ Cast(const CompilerType &compiler_type) override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
ConstString m_type_name;
uint64_t m_byte_size;
@@ -145,19 +147,20 @@ protected:
private:
friend class ValueObjectConstResultImpl;
+
ValueObjectConstResult (ExecutionContextScope *exe_scope,
lldb::ByteOrder byte_order,
uint32_t addr_byte_size,
lldb::addr_t address);
ValueObjectConstResult (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
const DataExtractor &data,
lldb::addr_t address);
ValueObjectConstResult (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
const lldb::DataBufferSP &result_data_sp,
lldb::ByteOrder byte_order,
@@ -165,7 +168,7 @@ private:
lldb::addr_t address);
ValueObjectConstResult (ExecutionContextScope *exe_scope,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
lldb::addr_t address,
AddressType address_type,
@@ -184,4 +187,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResult_h_
+#endif // liblldb_ValueObjectConstResult_h_
diff --git a/include/lldb/Core/ValueObjectConstResultCast.h b/include/lldb/Core/ValueObjectConstResultCast.h
new file mode 100644
index 0000000000000..395820dad6c7a
--- /dev/null
+++ b/include/lldb/Core/ValueObjectConstResultCast.h
@@ -0,0 +1,76 @@
+//===-- ValueObjectConstResultCast.h ----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectConstResultCast_h_
+#define liblldb_ValueObjectConstResultCast_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/ValueObjectCast.h"
+#include "lldb/Core/ValueObjectConstResultImpl.h"
+
+namespace lldb_private {
+
+class ValueObjectConstResultCast : public ValueObjectCast
+{
+public:
+ ValueObjectConstResultCast (
+ ValueObject &parent,
+ const ConstString &name,
+ const CompilerType &cast_type,
+ lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
+
+ ~ValueObjectConstResultCast() override;
+
+ lldb::ValueObjectSP
+ Dereference(Error &error) override;
+
+ ValueObject *
+ CreateChildAtIndex(size_t idx,
+ bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+ virtual CompilerType
+ GetCompilerType ()
+ {
+ return ValueObjectCast::GetCompilerType();
+ }
+
+ lldb::ValueObjectSP
+ GetSyntheticChildAtOffset(uint32_t offset,
+ const CompilerType& type,
+ bool can_create) override;
+
+ lldb::ValueObjectSP
+ AddressOf (Error &error) override;
+
+ size_t
+ GetPointeeData (DataExtractor& data,
+ uint32_t item_idx = 0,
+ uint32_t item_count = 1) override;
+
+ lldb::ValueObjectSP
+ Cast (const CompilerType &compiler_type) override;
+
+protected:
+ ValueObjectConstResultImpl m_impl;
+
+private:
+ friend class ValueObject;
+ friend class ValueObjectConstResult;
+ friend class ValueObjectConstResultImpl;
+
+ DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResultCast);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectConstResultCast_h_
diff --git a/include/lldb/Core/ValueObjectConstResultChild.h b/include/lldb/Core/ValueObjectConstResultChild.h
index 9063276b0198e..356d175a64aeb 100644
--- a/include/lldb/Core/ValueObjectConstResultChild.h
+++ b/include/lldb/Core/ValueObjectConstResultChild.h
@@ -27,39 +27,44 @@ class ValueObjectConstResultChild : public ValueObjectChild
public:
ValueObjectConstResultChild (ValueObject &parent,
- const ClangASTType &clang_type,
+ const CompilerType &compiler_type,
const ConstString &name,
uint32_t byte_size,
int32_t byte_offset,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset,
bool is_base_class,
- bool is_deref_of_parent);
+ bool is_deref_of_parent,
+ lldb::addr_t live_address,
+ uint64_t language_flags);
- virtual ~ValueObjectConstResultChild();
+ ~ValueObjectConstResultChild() override;
- virtual lldb::ValueObjectSP
- Dereference (Error &error);
+ lldb::ValueObjectSP
+ Dereference(Error &error) override;
- virtual ValueObject *
- CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
+ ValueObject *
+ CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override;
- virtual ClangASTType
- GetClangType ()
+ virtual CompilerType
+ GetCompilerType ()
{
- return ValueObjectChild::GetClangType();
+ return ValueObjectChild::GetCompilerType();
}
- virtual lldb::ValueObjectSP
- GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
+ lldb::ValueObjectSP
+ GetSyntheticChildAtOffset(uint32_t offset, const CompilerType& type, bool can_create) override;
- virtual lldb::ValueObjectSP
- AddressOf (Error &error);
+ lldb::ValueObjectSP
+ AddressOf (Error &error) override;
- virtual size_t
+ size_t
GetPointeeData (DataExtractor& data,
uint32_t item_idx = 0,
- uint32_t item_count = 1);
+ uint32_t item_count = 1) override;
+
+ lldb::ValueObjectSP
+ Cast (const CompilerType &compiler_type) override;
protected:
ValueObjectConstResultImpl m_impl;
@@ -74,4 +79,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResultChild_h_
+#endif // liblldb_ValueObjectConstResultChild_h_
diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h
index e3574e8a4d4e5..36b82f00a2408 100644
--- a/include/lldb/Core/ValueObjectConstResultImpl.h
+++ b/include/lldb/Core/ValueObjectConstResultImpl.h
@@ -1,4 +1,4 @@
-//===-- ValueObjectConstResultImpl.h -----------------------------*- C++ -*-===//
+//===-- ValueObjectConstResultImpl.h ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -26,15 +26,12 @@ namespace lldb_private {
class ValueObjectConstResultImpl
{
public:
-
ValueObjectConstResultImpl (ValueObject* valobj,
lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
-
+
virtual
- ~ValueObjectConstResultImpl()
- {
- }
-
+ ~ValueObjectConstResultImpl() = default;
+
lldb::ValueObjectSP
Dereference (Error &error);
@@ -42,7 +39,7 @@ public:
CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
lldb::ValueObjectSP
- GetSyntheticChildAtOffset (uint32_t offset, const ClangASTType& type, bool can_create);
+ GetSyntheticChildAtOffset (uint32_t offset, const CompilerType& type, bool can_create);
lldb::ValueObjectSP
AddressOf (Error &error);
@@ -52,6 +49,9 @@ public:
{
return m_live_address;
}
+
+ lldb::ValueObjectSP
+ Cast (const CompilerType &compiler_type);
void
SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
@@ -62,16 +62,15 @@ public:
}
virtual lldb::addr_t
- GetAddressOf (bool scalar_is_load_address = true,
- AddressType *address_type = NULL);
+ GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr);
virtual size_t
- GetPointeeData (DataExtractor& data,
- uint32_t item_idx = 0,
- uint32_t item_count = 1);
+ GetPointeeData(DataExtractor& data,
+ uint32_t item_idx = 0,
+ uint32_t item_count = 1);
private:
-
ValueObject *m_impl_backend;
lldb::addr_t m_live_address;
AddressType m_live_address_type;
@@ -83,4 +82,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResultImpl_h_
+#endif // liblldb_ValueObjectConstResultImpl_h_
diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h
index 8d42706be1668..80f37f1047654 100644
--- a/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/include/lldb/Core/ValueObjectDynamicValue.h
@@ -1,4 +1,4 @@
-//===-- ValueObjectDynamicValue.h -----------------------------------*- C++ -*-===//
+//===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -26,109 +26,131 @@ namespace lldb_private {
class ValueObjectDynamicValue : public ValueObject
{
public:
- virtual
- ~ValueObjectDynamicValue();
+ ~ValueObjectDynamicValue() override;
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual bool
- IsDynamic ()
+ bool
+ IsDynamic() override
{
return true;
}
- virtual bool
- GetIsConstant () const
+ bool
+ IsBaseClass () override
{
+ if (m_parent)
+ return m_parent->IsBaseClass();
return false;
}
- virtual ValueObject *
- GetParent()
+ bool
+ GetIsConstant() const override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return false;
+ }
+
+ ValueObject *
+ GetParent() override
+ {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
- virtual const ValueObject *
- GetParent() const
+ const ValueObject *
+ GetParent() const override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
- virtual lldb::ValueObjectSP
- GetStaticValue ()
+ lldb::ValueObjectSP
+ GetStaticValue() override
{
return m_parent->GetSP();
}
-
+
void
SetOwningSP (lldb::ValueObjectSP &owning_sp)
{
if (m_owning_valobj_sp == owning_sp)
return;
- assert (m_owning_valobj_sp.get() == NULL);
+ assert (m_owning_valobj_sp.get() == nullptr);
m_owning_valobj_sp = owning_sp;
}
- virtual bool
- SetValueFromCString (const char *value_str, Error& error);
+ bool
+ SetValueFromCString(const char *value_str, Error& error) override;
+
+ bool
+ SetData(DataExtractor &data, Error &error) override;
+
+ TypeImpl
+ GetTypeImpl() override;
+
+ lldb::VariableSP
+ GetVariable () override
+ {
+ return m_parent ? m_parent->GetVariable() : nullptr;
+ }
+
+ lldb::LanguageType
+ GetPreferredDisplayLanguage() override;
- virtual bool
- SetData (DataExtractor &data, Error &error);
+ void
+ SetPreferredDisplayLanguage (lldb::LanguageType);
+
+ bool
+ GetDeclaration(Declaration &decl) override;
- virtual TypeImpl
- GetTypeImpl ();
+ uint64_t
+ GetLanguageFlags () override;
+ void
+ SetLanguageFlags (uint64_t flags) override;
+
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual bool
- CanUpdateWithInvalidExecutionContext ()
+ LazyBool
+ CanUpdateWithInvalidExecutionContext() override
{
- return true;
+ return eLazyBoolYes;
}
- virtual lldb::DynamicValueType
- GetDynamicValueTypeImpl ()
+ lldb::DynamicValueType
+ GetDynamicValueTypeImpl() override
{
return m_use_dynamic;
}
- virtual bool
- HasDynamicValueTypeInfo ()
+ bool
+ HasDynamicValueTypeInfo() override
{
return true;
}
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
Address m_address; ///< The variable that this value object is based upon
TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
@@ -141,12 +163,9 @@ private:
friend class ValueObjectConstResult;
ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic);
- //------------------------------------------------------------------
- // For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue);
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectDynamicValue_h_
+#endif // liblldb_ValueObjectDynamicValue_h_
diff --git a/include/lldb/Core/ValueObjectList.h b/include/lldb/Core/ValueObjectList.h
index 6565367cc61ce..4f5e7b246fbd5 100644
--- a/include/lldb/Core/ValueObjectList.h
+++ b/include/lldb/Core/ValueObjectList.h
@@ -17,7 +17,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/UserID.h"
#include "lldb/Target/ExecutionContextScope.h"
diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h
index 41b43188a46a0..0e12fc7e3f287 100644
--- a/include/lldb/Core/ValueObjectMemory.h
+++ b/include/lldb/Core/ValueObjectMemory.h
@@ -15,7 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
namespace lldb_private {
@@ -26,6 +26,8 @@ namespace lldb_private {
class ValueObjectMemory : public ValueObject
{
public:
+ ~ValueObjectMemory() override;
+
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope,
const char *name,
@@ -36,42 +38,39 @@ public:
Create (ExecutionContextScope *exe_scope,
const char *name,
const Address &address,
- const ClangASTType &ast_type);
-
- virtual
- ~ValueObjectMemory();
+ const CompilerType &ast_type);
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual lldb::ModuleSP
- GetModule();
+ lldb::ModuleSP
+ GetModule() override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
Address m_address; ///< The variable that this value object is based upon
lldb::TypeSP m_type_sp;
- ClangASTType m_clang_type;
+ CompilerType m_compiler_type;
private:
ValueObjectMemory (ExecutionContextScope *exe_scope,
@@ -82,7 +81,7 @@ private:
ValueObjectMemory (ExecutionContextScope *exe_scope,
const char *name,
const Address &address,
- const ClangASTType &ast_type);
+ const CompilerType &ast_type);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
@@ -91,4 +90,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectMemory_h_
+#endif // liblldb_ValueObjectMemory_h_
diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h
index f7c7683d60bc8..ac76f9e4280bd 100644
--- a/include/lldb/Core/ValueObjectRegister.h
+++ b/include/lldb/Core/ValueObjectRegister.h
@@ -27,40 +27,38 @@ namespace lldb_private {
class ValueObjectRegisterContext : public ValueObject
{
public:
+ ~ValueObjectRegisterContext() override;
- virtual
- ~ValueObjectRegisterContext();
+ uint64_t
+ GetByteSize() override;
- virtual uint64_t
- GetByteSize();
-
- virtual lldb::ValueType
- GetValueType () const
+ lldb::ValueType
+ GetValueType() const override
{
return lldb::eValueTypeRegisterSet;
}
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual ValueObject *
- CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
+ ValueObject *
+ CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
lldb::RegisterContextSP m_reg_ctx_sp;
@@ -75,46 +73,44 @@ private:
class ValueObjectRegisterSet : public ValueObject
{
public:
+ ~ValueObjectRegisterSet() override;
+
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
- virtual
- ~ValueObjectRegisterSet();
-
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual lldb::ValueType
- GetValueType () const
+ lldb::ValueType
+ GetValueType() const override
{
return lldb::eValueTypeRegisterSet;
}
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual ValueObject *
- CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
+ ValueObject *
+ CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override;
- virtual lldb::ValueObjectSP
- GetChildMemberWithName (const ConstString &name, bool can_create);
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
+ lldb::ValueObjectSP
+ GetChildMemberWithName(const ConstString &name, bool can_create) override;
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
lldb::RegisterContextSP m_reg_ctx_sp;
const RegisterSet *m_reg_set;
@@ -122,6 +118,7 @@ protected:
private:
friend class ValueObjectRegisterContext;
+
ValueObjectRegisterSet (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
//------------------------------------------------------------------
@@ -133,57 +130,58 @@ private:
class ValueObjectRegister : public ValueObject
{
public:
+ ~ValueObjectRegister() override;
+
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
- virtual
- ~ValueObjectRegister();
-
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual lldb::ValueType
- GetValueType () const
+ lldb::ValueType
+ GetValueType() const override
{
return lldb::eValueTypeRegister;
}
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual bool
- SetValueFromCString (const char *value_str, Error& error);
+ bool
+ SetValueFromCString(const char *value_str, Error& error) override;
- virtual bool
- SetData (DataExtractor &data, Error &error);
+ bool
+ SetData(DataExtractor &data, Error &error) override;
- virtual bool
- ResolveValue (Scalar &scalar);
+ bool
+ ResolveValue(Scalar &scalar) override;
- virtual void
- GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat = eGetExpressionPathFormatDereferencePointers);
+ void
+ GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
+ GetExpressionPathFormat epformat = eGetExpressionPathFormatDereferencePointers) override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
lldb::RegisterContextSP m_reg_ctx_sp;
RegisterInfo m_reg_info;
RegisterValue m_reg_value;
ConstString m_type_name;
- ClangASTType m_clang_type;
+ CompilerType m_compiler_type;
private:
void
ConstructObject (uint32_t reg_num);
friend class ValueObjectRegisterSet;
+
ValueObjectRegister (ValueObject &parent, lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
ValueObjectRegister (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
@@ -195,4 +193,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectRegister_h_
+#endif // liblldb_ValueObjectRegister_h_
diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h
index 88824ef4fa546..05bc3781a3cc6 100644
--- a/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -1,4 +1,4 @@
-//===-- ValueObjectSyntheticFilter.h -------------------------------*- C++ -*-===//
+//===-- ValueObjectSyntheticFilter.h ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,7 +12,8 @@
// C Includes
// C++ Includes
-#include <vector>
+#include <memory>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ThreadSafeSTLMap.h"
@@ -30,140 +31,142 @@ namespace lldb_private {
class ValueObjectSynthetic : public ValueObject
{
public:
- virtual
- ~ValueObjectSynthetic();
+ ~ValueObjectSynthetic() override;
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual bool
- MightHaveChildren();
+ bool
+ MightHaveChildren() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx, bool can_create);
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx, bool can_create) override;
- virtual lldb::ValueObjectSP
- GetChildMemberWithName (const ConstString &name, bool can_create);
+ lldb::ValueObjectSP
+ GetChildMemberWithName(const ConstString &name, bool can_create) override;
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override;
- virtual lldb::ValueObjectSP
- GetDynamicValue (lldb::DynamicValueType valueType);
+ lldb::ValueObjectSP
+ GetDynamicValue(lldb::DynamicValueType valueType) override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual bool
- HasSyntheticValue()
+ bool
+ HasSyntheticValue() override
{
return false;
}
- virtual bool
- IsSynthetic() { return true; }
+ bool
+ IsSynthetic() override
+ {
+ return true;
+ }
- virtual void
- CalculateSyntheticValue (bool use_synthetic)
+ void
+ CalculateSyntheticValue(bool use_synthetic) override
{
}
- virtual bool
- IsDynamic ()
+ bool
+ IsDynamic() override
{
- if (m_parent)
- return m_parent->IsDynamic();
- else
- return false;
+ return ((m_parent != nullptr) ? m_parent->IsDynamic() : false);
}
- virtual lldb::ValueObjectSP
- GetStaticValue ()
+ lldb::ValueObjectSP
+ GetStaticValue() override
{
- if (m_parent)
- return m_parent->GetStaticValue();
- else
- return GetSP();
+ return ((m_parent != nullptr) ? m_parent->GetStaticValue() : GetSP());
}
virtual lldb::DynamicValueType
GetDynamicValueType ()
{
- if (m_parent)
- return m_parent->GetDynamicValueType();
- else
- return lldb::eNoDynamicValues;
+ return ((m_parent != nullptr) ? m_parent->GetDynamicValueType() : lldb::eNoDynamicValues);
}
- virtual ValueObject *
- GetParent()
+ ValueObject *
+ GetParent() override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
- virtual const ValueObject *
- GetParent() const
+ const ValueObject *
+ GetParent() const override
{
- if (m_parent)
- return m_parent->GetParent();
- else
- return NULL;
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
}
- virtual lldb::ValueObjectSP
- GetNonSyntheticValue ();
+ lldb::ValueObjectSP
+ GetNonSyntheticValue() override;
- virtual bool
- CanProvideValue ();
+ bool
+ CanProvideValue() override;
- virtual bool
- DoesProvideSyntheticValue ()
+ bool
+ DoesProvideSyntheticValue() override
{
return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes);
}
- virtual bool
- GetIsConstant () const
+ bool
+ GetIsConstant() const override
{
return false;
}
- virtual bool
- SetValueFromCString (const char *value_str, Error& error);
+ bool
+ SetValueFromCString(const char *value_str, Error& error) override;
- virtual void
- SetFormat (lldb::Format format);
+ void
+ SetFormat(lldb::Format format) override;
+
+ lldb::LanguageType
+ GetPreferredDisplayLanguage() override;
+
+ void
+ SetPreferredDisplayLanguage (lldb::LanguageType);
+
+ bool
+ GetDeclaration(Declaration &decl) override;
+
+ uint64_t
+ GetLanguageFlags () override;
+
+ void
+ SetLanguageFlags (uint64_t flags) override;
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual bool
- CanUpdateWithInvalidExecutionContext ()
+ LazyBool
+ CanUpdateWithInvalidExecutionContext() override
{
- return true;
+ return eLazyBoolYes;
}
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
virtual void
CreateSynthFilter ();
@@ -195,12 +198,9 @@ private:
void
CopyValueData (ValueObject *source);
- //------------------------------------------------------------------
- // For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (ValueObjectSynthetic);
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectSyntheticFilter_h_
+#endif // liblldb_ValueObjectSyntheticFilter_h_
diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h
index 0e32d09057dc8..4adb6bad0ada7 100644
--- a/include/lldb/Core/ValueObjectVariable.h
+++ b/include/lldb/Core/ValueObjectVariable.h
@@ -25,61 +25,66 @@ namespace lldb_private {
class ValueObjectVariable : public ValueObject
{
public:
+ ~ValueObjectVariable() override;
+
static lldb::ValueObjectSP
Create (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp);
- virtual
- ~ValueObjectVariable();
-
- virtual uint64_t
- GetByteSize();
+ uint64_t
+ GetByteSize() override;
- virtual ConstString
- GetTypeName();
+ ConstString
+ GetTypeName() override;
- virtual ConstString
- GetQualifiedTypeName();
+ ConstString
+ GetQualifiedTypeName() override;
- virtual ConstString
- GetDisplayTypeName();
+ ConstString
+ GetDisplayTypeName() override;
- virtual size_t
- CalculateNumChildren();
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual lldb::ValueType
- GetValueType() const;
+ lldb::ValueType
+ GetValueType() const override;
- virtual bool
- IsInScope ();
+ bool
+ IsInScope() override;
- virtual lldb::ModuleSP
- GetModule();
+ lldb::ModuleSP
+ GetModule() override;
- virtual SymbolContextScope *
- GetSymbolContextScope();
+ SymbolContextScope *
+ GetSymbolContextScope() override;
- virtual bool
- GetDeclaration (Declaration &decl);
+ bool
+ GetDeclaration(Declaration &decl) override;
- virtual const char *
- GetLocationAsCString ();
+ const char *
+ GetLocationAsCString() override;
- virtual bool
- SetValueFromCString (const char *value_str, Error& error);
+ bool
+ SetValueFromCString(const char *value_str, Error& error) override;
- virtual bool
- SetData (DataExtractor &data, Error &error);
+ bool
+ SetData(DataExtractor &data, Error &error) override;
+
+ virtual lldb::VariableSP
+ GetVariable () override
+ {
+ return m_variable_sp;
+ }
protected:
- virtual bool
- UpdateValue ();
+ bool
+ UpdateValue() override;
- virtual ClangASTType
- GetClangTypeImpl ();
+ CompilerType
+ GetCompilerTypeImpl() override;
lldb::VariableSP m_variable_sp; ///< The variable that this value object is based upon
Value m_resolved_value; ///< The value that DWARFExpression resolves this variable to before we patch it up
-
+
private:
ValueObjectVariable (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp);
//------------------------------------------------------------------
@@ -90,4 +95,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ValueObjectVariable_h_
+#endif // liblldb_ValueObjectVariable_h_
diff --git a/include/lldb/Core/dwarf.h b/include/lldb/Core/dwarf.h
index 9fa8816229a96..649a93154b3fe 100644
--- a/include/lldb/Core/dwarf.h
+++ b/include/lldb/Core/dwarf.h
@@ -14,13 +14,16 @@
// Get the DWARF constant definitions from llvm
#include "llvm/Support/Dwarf.h"
+
+#include "lldb/Core/RangeMap.h"
+
// and stuff them in our default namespace
using namespace llvm::dwarf;
typedef uint32_t dw_uleb128_t;
typedef int32_t dw_sleb128_t;
typedef uint16_t dw_attr_t;
-typedef uint8_t dw_form_t;
+typedef uint16_t dw_form_t;
typedef uint16_t dw_tag_t;
typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for any addresses in the compile units that get parsed
@@ -59,5 +62,6 @@ typedef uint32_t dw_offset_t; // Dwarf Debug Information Entry offset for
//#define DW_OP_APPLE_clear 0xFE // clears the entire expression stack, ok if the stack is empty
//#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and returns an error (no args)
+typedef lldb_private::RangeArray<dw_addr_t, dw_addr_t, 2> DWARFRangeList;
#endif // DebugBase_dwarf_h_
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
deleted file mode 100644
index a175e1a4d1641..0000000000000
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ /dev/null
@@ -1,375 +0,0 @@
-//===-- CXXFormatterFunctions.h------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CXXFormatterFunctions_h_
-#define liblldb_CXXFormatterFunctions_h_
-
-#include <stdint.h>
-#include <time.h>
-
-#include "lldb/lldb-forward.h"
-
-#include "lldb/Core/ConstString.h"
-#include "lldb/DataFormatters/FormatClasses.h"
-#include "lldb/DataFormatters/TypeSynthetic.h"
-#include "lldb/DataFormatters/VectorType.h"
-#include "lldb/Target/ExecutionContext.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Target/Target.h"
-
-#include "clang/AST/ASTContext.h"
-
-namespace lldb_private {
- namespace formatters
- {
- StackFrame*
- GetViableFrame (ExecutionContext exe_ctx);
-
- bool
- ExtractValueFromObjCExpression (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- uint64_t &value);
-
- bool
- ExtractSummaryFromObjCExpression (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- Stream &stream);
-
- lldb::ValueObjectSP
- CallSelectorOnObject (ValueObject &valobj,
- const char* return_type,
- const char* selector,
- uint64_t index);
-
- lldb::ValueObjectSP
- CallSelectorOnObject (ValueObject &valobj,
- const char* return_type,
- const char* selector,
- const char* key);
-
- size_t
- ExtractIndexFromString (const char* item_name);
-
- time_t
- GetOSXEpoch ();
-
- bool
- FunctionPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // C++ function pointer
-
- bool
- Char16StringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // char16_t* and unichar*
-
- bool
- Char32StringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // char32_t*
-
- bool
- WCharStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // wchar_t*
-
- bool
- Char16SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // char16_t and unichar
-
- bool
- Char32SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // char32_t
-
- bool
- WCharSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // wchar_t
-
- bool
- LibcxxStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // libc++ std::string
-
- bool
- LibcxxWStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // libc++ std::wstring
-
- bool
- LibcxxSmartPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options); // libc++ std::shared_ptr<> and std::weak_ptr<>
-
- bool
- ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- SyntheticChildrenFrontEnd* ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- template<bool name_entries>
- bool
- NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSIndexSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSArraySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- template<bool cf_style>
- bool
- NSSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- template<bool needs_at>
- bool
- NSDataSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSNumberSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSNotificationSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSTimeZoneSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSMachPortSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- CFBagSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- CFBinaryHeapSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- CFBitVectorSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSDateSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- CFAbsoluteTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSBundleSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSTaggedString_SummaryProvider (ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream);
-
- bool
- NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- NSURLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- template <bool is_sel_ptr>
- bool
- ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- bool
- RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- extern template bool
- NSDictionarySummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-
- extern template bool
- NSDictionarySummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-
- extern template bool
- NSDataSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-
- extern template bool
- NSDataSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-
- extern template bool
- ObjCSELSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&);
-
- extern template bool
- ObjCSELSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
-
- bool
- CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* NSSetSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* NSIndexPathSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- LibcxxVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~LibcxxVectorBoolSyntheticFrontEnd ();
- private:
- ClangASTType m_bool_type;
- ExecutionContextRef m_exe_ctx_ref;
- uint64_t m_count;
- lldb::addr_t m_base_data_address;
- std::map<size_t,lldb::ValueObjectSP> m_children;
- };
-
- SyntheticChildrenFrontEnd* LibcxxVectorBoolSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- bool
- LibcxxContainerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
- class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~LibstdcppMapIteratorSyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- lldb::addr_t m_pair_address;
- ClangASTType m_pair_type;
- EvaluateExpressionOptions m_options;
- lldb::ValueObjectSP m_pair_sp;
- };
-
- SyntheticChildrenFrontEnd* LibstdcppMapIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- LibCxxMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~LibCxxMapIteratorSyntheticFrontEnd ();
- private:
- ValueObject *m_pair_ptr;
- };
-
- SyntheticChildrenFrontEnd* LibCxxMapIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- VectorIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp,
- ConstString item_name);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~VectorIteratorSyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- ConstString m_item_name;
- lldb::ValueObjectSP m_item_sp;
- };
-
- SyntheticChildrenFrontEnd* LibCxxVectorIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibStdcppVectorIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- LibcxxSharedPtrSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~LibcxxSharedPtrSyntheticFrontEnd ();
- private:
- ValueObject* m_cntrl;
- lldb::ValueObjectSP m_count_sp;
- lldb::ValueObjectSP m_weak_count_sp;
- uint8_t m_ptr_size;
- lldb::ByteOrder m_byte_order;
- };
-
- SyntheticChildrenFrontEnd* LibcxxSharedPtrSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibcxxStdVectorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibcxxStdListSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibcxxStdMapSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibcxxStdUnorderedMapSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* LibcxxInitializerListSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-
- SyntheticChildrenFrontEnd* VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
- } // namespace formatters
-} // namespace lldb_private
-
-#endif // liblldb_CXXFormatterFunctions_h_
diff --git a/include/lldb/DataFormatters/CXXFunctionPointer.h b/include/lldb/DataFormatters/CXXFunctionPointer.h
new file mode 100644
index 0000000000000..eaa39582eaaaa
--- /dev/null
+++ b/include/lldb/DataFormatters/CXXFunctionPointer.h
@@ -0,0 +1,23 @@
+//===-- CXXFunctionPointer.h ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CXXFunctionPointer_h_
+#define liblldb_CXXFunctionPointer_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+ namespace formatters
+ {
+ bool
+ CXXFunctionPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
+ } // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CXXFunctionPointer_h_
diff --git a/include/lldb/DataFormatters/DataVisualization.h b/include/lldb/DataFormatters/DataVisualization.h
index a0b2e58bba288..856156670c96f 100644
--- a/include/lldb/DataFormatters/DataVisualization.h
+++ b/include/lldb/DataFormatters/DataVisualization.h
@@ -1,4 +1,4 @@
-//===-- DataVisualization.h ----------------------------------------*- C++ -*-===//
+//===-- DataVisualization.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -28,7 +28,6 @@ namespace lldb_private {
class DataVisualization
{
public:
-
// use this call to force the FM to consider itself updated even when there is no apparent reason for that
static void
ForceUpdate();
@@ -83,8 +82,8 @@ public:
AnyMatches(ConstString type_name,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
class NamedSummaryFormats
{
@@ -102,7 +101,7 @@ public:
Clear ();
static void
- LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton);
+ ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback);
static uint32_t
GetCount ();
@@ -111,12 +110,15 @@ public:
class Categories
{
public:
-
static bool
GetCategory (const ConstString &category,
lldb::TypeCategoryImplSP &entry,
bool allow_create = true);
+ static bool
+ GetCategory (lldb::LanguageType language,
+ lldb::TypeCategoryImplSP &entry);
+
static void
Add (const ConstString &category);
@@ -134,7 +136,13 @@ public:
TypeCategoryMap::Position = TypeCategoryMap::Default);
static void
+ Enable (lldb::LanguageType lang_type);
+
+ static void
Disable (const ConstString& category);
+
+ static void
+ Disable (lldb::LanguageType lang_type);
static void
Enable (const lldb::TypeCategoryImplSP& category,
@@ -150,7 +158,7 @@ public:
DisableStar ();
static void
- LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
+ ForEach (TypeCategoryMap::ForEachCallback callback);
static uint32_t
GetCount ();
@@ -160,7 +168,6 @@ public:
};
};
-
} // namespace lldb_private
-#endif // lldb_DataVisualization_h_
+#endif// lldb_DataVisualization_h_
diff --git a/include/lldb/DataFormatters/DumpValueObjectOptions.h b/include/lldb/DataFormatters/DumpValueObjectOptions.h
new file mode 100644
index 0000000000000..f65ee7b958452
--- /dev/null
+++ b/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -0,0 +1,185 @@
+//===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DumpValueObjectOptions_h_
+#define lldb_DumpValueObjectOptions_h_
+
+// C Includes
+// C++ Includes
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include <functional>
+#include <string>
+
+namespace lldb_private {
+
+class DumpValueObjectOptions
+{
+public:
+ struct PointerDepth
+ {
+ enum class Mode
+ {
+ Always,
+ Formatters,
+ Default,
+ Never
+ } m_mode;
+ uint32_t m_count;
+
+ PointerDepth
+ operator --() const
+ {
+ if (m_count > 0)
+ return PointerDepth {m_mode,m_count-1};
+ return PointerDepth {m_mode,m_count};
+ }
+
+ bool
+ CanAllowExpansion () const;
+
+ bool
+ CanAllowExpansion (bool is_root,
+ TypeSummaryImpl* entry,
+ ValueObject *valobj,
+ const std::string& summary);
+ };
+
+ typedef std::function<bool(ConstString,
+ ConstString,
+ const DumpValueObjectOptions &,
+ Stream&)> DeclPrintingHelper;
+
+ static const DumpValueObjectOptions
+ DefaultOptions()
+ {
+ static DumpValueObjectOptions g_default_options;
+
+ return g_default_options;
+ }
+
+ DumpValueObjectOptions();
+
+ DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default;
+
+ DumpValueObjectOptions (ValueObject& valobj);
+
+ DumpValueObjectOptions&
+ SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never,0});
+
+ DumpValueObjectOptions&
+ SetMaximumDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions&
+ SetDeclPrintingHelper(DeclPrintingHelper helper);
+
+ DumpValueObjectOptions&
+ SetShowTypes(bool show = false);
+
+ DumpValueObjectOptions&
+ SetShowLocation(bool show = false);
+
+ DumpValueObjectOptions&
+ SetUseObjectiveC(bool use = false);
+
+ DumpValueObjectOptions&
+ SetShowSummary(bool show = true);
+
+ DumpValueObjectOptions&
+ SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
+
+ DumpValueObjectOptions&
+ SetUseSyntheticValue(bool use_synthetic = true);
+
+ DumpValueObjectOptions&
+ SetScopeChecked(bool check = true);
+
+ DumpValueObjectOptions&
+ SetFlatOutput(bool flat = false);
+
+ DumpValueObjectOptions&
+ SetOmitSummaryDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions&
+ SetIgnoreCap(bool ignore = false);
+
+ DumpValueObjectOptions&
+ SetRawDisplay();
+
+ DumpValueObjectOptions&
+ SetFormat (lldb::Format format = lldb::eFormatDefault);
+
+ DumpValueObjectOptions&
+ SetSummary (lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
+
+ DumpValueObjectOptions&
+ SetRootValueObjectName(const char* name = nullptr);
+
+ DumpValueObjectOptions&
+ SetHideRootType (bool hide_root_type = false);
+
+ DumpValueObjectOptions&
+ SetHideName (bool hide_name = false);
+
+ DumpValueObjectOptions&
+ SetHideValue (bool hide_value = false);
+
+ DumpValueObjectOptions&
+ SetHidePointerValue (bool hide = false);
+
+ DumpValueObjectOptions&
+ SetVariableFormatDisplayLanguage (lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
+
+ DumpValueObjectOptions&
+ SetRunValidator (bool run = true);
+
+ DumpValueObjectOptions&
+ SetUseTypeDisplayName (bool dis = false);
+
+ DumpValueObjectOptions&
+ SetAllowOnelinerMode (bool oneliner = false);
+
+ DumpValueObjectOptions&
+ SetRevealEmptyAggregates (bool reveal = true);
+
+public:
+ uint32_t m_max_depth = UINT32_MAX;
+ lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
+ uint32_t m_omit_summary_depth = 0;
+ lldb::Format m_format = lldb::eFormatDefault;
+ lldb::TypeSummaryImplSP m_summary_sp;
+ std::string m_root_valobj_name;
+ lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
+ PointerDepth m_max_ptr_depth;
+ DeclPrintingHelper m_decl_printing_helper;
+ bool m_use_synthetic : 1;
+ bool m_scope_already_checked : 1;
+ bool m_flat_output : 1;
+ bool m_ignore_cap : 1;
+ bool m_show_types : 1;
+ bool m_show_location : 1;
+ bool m_use_objc : 1;
+ bool m_hide_root_type : 1;
+ bool m_hide_name : 1;
+ bool m_hide_value : 1;
+ bool m_run_validator : 1;
+ bool m_use_type_display_name : 1;
+ bool m_allow_oneliner_mode : 1;
+ bool m_hide_pointer_value : 1;
+ bool m_reveal_empty_aggregates : 1;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_DumpValueObjectOptions_h_
diff --git a/include/lldb/DataFormatters/FormatCache.h b/include/lldb/DataFormatters/FormatCache.h
index fa46306e54042..9f1e078f71990 100644
--- a/include/lldb/DataFormatters/FormatCache.h
+++ b/include/lldb/DataFormatters/FormatCache.h
@@ -19,7 +19,6 @@
#include "lldb/lldb-public.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Host/Mutex.h"
-#include "lldb/DataFormatters/FormatClasses.h"
namespace lldb_private {
class FormatCache
diff --git a/include/lldb/DataFormatters/FormatClasses.h b/include/lldb/DataFormatters/FormatClasses.h
index 651160371c69b..b5ac41c2bd6e7 100644
--- a/include/lldb/DataFormatters/FormatClasses.h
+++ b/include/lldb/DataFormatters/FormatClasses.h
@@ -10,25 +10,45 @@
#ifndef lldb_FormatClasses_h_
#define lldb_FormatClasses_h_
+// C Includes
// C++ Includes
+#include <functional>
+#include <memory>
#include <string>
#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
-
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/DataFormatters/TypeValidator.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
namespace lldb_private {
+class HardcodedFormatters {
+public:
+ template <typename FormatterType>
+ using HardcodedFormatterFinder = std::function<typename FormatterType::SharedPointer (lldb_private::ValueObject&,
+ lldb::DynamicValueType,
+ FormatManager&)>;
+
+ template <typename FormatterType>
+ using HardcodedFormatterFinders = std::vector<HardcodedFormatterFinder<FormatterType>>;
+
+ typedef HardcodedFormatterFinders<TypeFormatImpl> HardcodedFormatFinder;
+ typedef HardcodedFormatterFinders<TypeSummaryImpl> HardcodedSummaryFinder;
+ typedef HardcodedFormatterFinders<SyntheticChildren> HardcodedSyntheticFinder;
+ typedef HardcodedFormatterFinders<TypeValidatorImpl> HardcodedValidatorFinder;
+};
+
class FormattersMatchCandidate
{
public:
-
FormattersMatchCandidate (ConstString name,
uint32_t reason,
bool strip_ptr,
@@ -41,10 +61,9 @@ public:
m_stripped_typedef(strip_tydef)
{
}
-
- ~FormattersMatchCandidate ()
- {}
-
+
+ ~FormattersMatchCandidate() = default;
+
ConstString
GetTypeName () const
{
@@ -99,6 +118,36 @@ private:
};
typedef std::vector<FormattersMatchCandidate> FormattersMatchVector;
+typedef std::vector<lldb::LanguageType> CandidateLanguagesVector;
+
+class FormattersMatchData
+{
+public:
+ FormattersMatchData (ValueObject&,
+ lldb::DynamicValueType);
+
+ FormattersMatchVector
+ GetMatchesVector ();
+
+ ConstString
+ GetTypeForCache ();
+
+ CandidateLanguagesVector
+ GetCandidateLanguages ();
+
+ ValueObject&
+ GetValueObject ();
+
+ lldb::DynamicValueType
+ GetDynamicValueType ();
+
+private:
+ ValueObject& m_valobj;
+ lldb::DynamicValueType m_dynamic_value_type;
+ std::pair<FormattersMatchVector,bool> m_formatters_match_vector;
+ ConstString m_type_for_cache;
+ CandidateLanguagesVector m_candidate_languages;
+};
class TypeNameSpecifierImpl
{
@@ -130,7 +179,7 @@ public:
}
}
- TypeNameSpecifierImpl (ClangASTType type) :
+ TypeNameSpecifierImpl (CompilerType type) :
m_is_regex(false),
m_type()
{
@@ -146,7 +195,7 @@ public:
{
if (m_type.m_type_name.size())
return m_type.m_type_name.c_str();
- return NULL;
+ return nullptr;
}
lldb::TypeSP
@@ -157,12 +206,12 @@ public:
return lldb::TypeSP();
}
- ClangASTType
- GetClangASTType ()
+ CompilerType
+ GetCompilerType ()
{
if (m_type.m_type_pair.IsValid())
- return m_type.m_type_pair.GetClangASTType();
- return ClangASTType();
+ return m_type.m_type_pair.GetCompilerType();
+ return CompilerType();
}
bool
@@ -174,19 +223,18 @@ public:
private:
bool m_is_regex;
// this works better than TypeAndOrName because the latter only wraps a TypeSP
- // whereas TypePair can also be backed by a ClangASTType
+ // whereas TypePair can also be backed by a CompilerType
struct TypeOrName
{
std::string m_type_name;
TypePair m_type_pair;
};
TypeOrName m_type;
-
-
+
private:
DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
};
} // namespace lldb_private
-#endif // lldb_FormatClasses_h_
+#endif // lldb_FormatClasses_h_
diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h
index a1f4b59fb3448..24ba5a7f0aa55 100644
--- a/include/lldb/DataFormatters/FormatManager.h
+++ b/include/lldb/DataFormatters/FormatManager.h
@@ -1,4 +1,4 @@
-//===-- FormatManager.h -------------------------------------------*- C++ -*-===//
+//===-- FormatManager.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,10 @@
// C Includes
// C++ Includes
+#include <atomic>
+#include <initializer_list>
+#include <map>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -21,12 +25,10 @@
#include "lldb/DataFormatters/FormatCache.h"
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/FormattersContainer.h"
+#include "lldb/DataFormatters/LanguageCategory.h"
#include "lldb/DataFormatters/TypeCategory.h"
#include "lldb/DataFormatters/TypeCategoryMap.h"
-#include <atomic>
-#include <functional>
-
namespace lldb_private {
// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
@@ -39,19 +41,12 @@ class FormatManager : public IFormatChangeListener
typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
public:
+ typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer> LanguageCategories;
- template <typename FormatterType>
- using HardcodedFormatterFinder = std::function<typename FormatterType::SharedPointer (lldb_private::ValueObject&,
- lldb::DynamicValueType,
- FormatManager&)>;
-
- template <typename FormatterType>
- using HardcodedFormatterFinders = std::vector<HardcodedFormatterFinder<FormatterType>>;
-
- typedef TypeCategoryMap::CallbackType CategoryCallback;
-
- FormatManager ();
+ FormatManager();
+ ~FormatManager() override = default;
+
NamedSummariesMap&
GetNamedSummaryContainer ()
{
@@ -62,8 +57,34 @@ public:
EnableCategory (const ConstString& category_name,
TypeCategoryMap::Position pos = TypeCategoryMap::Default)
{
- m_categories_map.Enable(category_name,
- pos);
+ EnableCategory(category_name,
+ pos,
+ std::initializer_list<lldb::LanguageType>());
+ }
+
+ void
+ EnableCategory (const ConstString& category_name,
+ TypeCategoryMap::Position pos,
+ lldb::LanguageType lang)
+ {
+ std::initializer_list<lldb::LanguageType> langs = {lang};
+ EnableCategory(category_name,
+ pos,
+ langs);
+ }
+
+ void
+ EnableCategory (const ConstString& category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default,
+ std::initializer_list<lldb::LanguageType> langs = {})
+ {
+ TypeCategoryMap::ValueSP category_sp;
+ if (m_categories_map.Get(category_name, category_sp) && category_sp)
+ {
+ m_categories_map.Enable(category_sp, pos);
+ for (const lldb::LanguageType lang : langs)
+ category_sp->AddLanguage(lang);
+ }
}
void
@@ -87,16 +108,10 @@ public:
}
void
- EnableAllCategories ()
- {
- m_categories_map.EnableAllCategories ();
- }
+ EnableAllCategories ();
void
- DisableAllCategories ()
- {
- m_categories_map.DisableAllCategories ();
- }
+ DisableAllCategories ();
bool
DeleteCategory (const ConstString& category_name)
@@ -123,14 +138,11 @@ public:
}
void
- LoopThroughCategories (CategoryCallback callback, void* param)
- {
- m_categories_map.LoopThrough(callback, param);
- }
+ ForEachCategory (TypeCategoryMap::ForEachCallback callback);
lldb::TypeCategoryImplSP
- GetCategory (const char* category_name = NULL,
- bool can_create = true)
+ GetCategory(const char* category_name = nullptr,
+ bool can_create = true)
{
if (!category_name)
return GetCategory(m_default_category_name);
@@ -182,11 +194,11 @@ public:
lldb::DynamicValueType use_dynamic);
bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr)
{
return m_categories_map.AnyMatches(type_name,
items,
@@ -226,29 +238,21 @@ public:
ShouldPrintAsOneLiner (ValueObject& valobj);
void
- Changed ()
- {
- ++m_last_revision;
- m_format_cache.Clear ();
- }
+ Changed () override;
uint32_t
- GetCurrentRevision ()
+ GetCurrentRevision () override
{
return m_last_revision;
}
-
- ~FormatManager ()
- {
- }
-
+
static FormattersMatchVector
GetPossibleMatches (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
FormattersMatchVector matches;
GetPossibleMatches (valobj,
- valobj.GetClangType(),
+ valobj.GetCompilerType(),
lldb_private::eFormatterChoiceCriterionDirectChoice,
use_dynamic,
matches,
@@ -258,12 +262,23 @@ public:
true);
return matches;
}
+
+ static ConstString
+ GetTypeForCache (ValueObject&, lldb::DynamicValueType);
+
+ LanguageCategory*
+ GetCategoryForLanguage (lldb::LanguageType lang_type);
+
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages (lldb::LanguageType lang_type);
private:
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages (ValueObject& valobj);
static void
GetPossibleMatches (ValueObject& valobj,
- ClangASTType clang_type,
+ CompilerType compiler_type,
uint32_t reason,
lldb::DynamicValueType use_dynamic,
FormattersMatchVector& entries,
@@ -271,40 +286,29 @@ private:
bool did_strip_ref,
bool did_strip_typedef,
bool root_level = false);
-
+
+ std::atomic<uint32_t> m_last_revision;
FormatCache m_format_cache;
+ Mutex m_language_categories_mutex;
+ LanguageCategories m_language_categories_map;
NamedSummariesMap m_named_summaries_map;
- std::atomic<uint32_t> m_last_revision;
TypeCategoryMap m_categories_map;
ConstString m_default_category_name;
ConstString m_system_category_name;
- ConstString m_gnu_cpp_category_name;
- ConstString m_libcxx_category_name;
- ConstString m_objc_category_name;
- ConstString m_corefoundation_category_name;
- ConstString m_coregraphics_category_name;
- ConstString m_coreservices_category_name;
ConstString m_vectortypes_category_name;
- ConstString m_appkit_category_name;
- ConstString m_coremedia_category_name;
-
- HardcodedFormatterFinders<TypeFormatImpl> m_hardcoded_formats;
- HardcodedFormatterFinders<TypeSummaryImpl> m_hardcoded_summaries;
- HardcodedFormatterFinders<SyntheticChildren> m_hardcoded_synthetics;
- HardcodedFormatterFinders<TypeValidatorImpl> m_hardcoded_validators;
lldb::TypeFormatImplSP
- GetHardcodedFormat (ValueObject&,lldb::DynamicValueType);
+ GetHardcodedFormat (FormattersMatchData&);
lldb::TypeSummaryImplSP
- GetHardcodedSummaryFormat (ValueObject&,lldb::DynamicValueType);
+ GetHardcodedSummaryFormat (FormattersMatchData&);
lldb::SyntheticChildrenSP
- GetHardcodedSyntheticChildren (ValueObject&,lldb::DynamicValueType);
+ GetHardcodedSyntheticChildren (FormattersMatchData&);
lldb::TypeValidatorImplSP
- GetHardcodedValidator (ValueObject&,lldb::DynamicValueType);
+ GetHardcodedValidator (FormattersMatchData&);
TypeCategoryMap&
GetCategories ()
@@ -312,29 +316,20 @@ private:
return m_categories_map;
}
- // WARNING: these are temporary functions that setup formatters
- // while a few of these actually should be globally available and setup by LLDB itself
- // most would actually belong to the users' lldbinit file or to some other form of configurable
- // storage
- void
- LoadLibStdcppFormatters ();
-
- void
- LoadLibcxxFormatters ();
-
+ // These functions are meant to initialize formatters that are very low-level/global in nature
+ // and do not naturally belong in any language. The intent is that most formatters go in
+ // language-specific categories. Eventually, the runtimes should also be allowed to vend their
+ // own formatters, and then one could put formatters that depend on specific library load events
+ // in the language runtimes, on an as-needed basis
void
LoadSystemFormatters ();
void
- LoadObjCFormatters ();
-
- void
- LoadCoreMediaFormatters ();
+ LoadVectorFormatters ();
- void
- LoadHardcodedFormatters ();
+ friend class FormattersMatchData;
};
} // namespace lldb_private
-#endif // lldb_FormatManager_h_
+#endif // lldb_FormatManager_h_
diff --git a/include/lldb/DataFormatters/FormattersContainer.h b/include/lldb/DataFormatters/FormattersContainer.h
index daf2f24ae3e55..dcd08211f19b8 100644
--- a/include/lldb/DataFormatters/FormattersContainer.h
+++ b/include/lldb/DataFormatters/FormattersContainer.h
@@ -1,4 +1,4 @@
-//===-- FormattersContainer.h ----------------------------------------*- C++ -*-===//
+//===-- FormattersContainer.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,53 +12,38 @@
// C Includes
// C++ Includes
+#include <functional>
+#include <map>
+#include <memory>
+#include <string>
// Other libraries and framework includes
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/Type.h"
-#include "clang/AST/DeclObjC.h"
-
// Project includes
#include "lldb/lldb-public.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/ValueObject.h"
-
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/DataFormatters/TypeValidator.h"
-
-#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/ClangASTType.h"
-
-#include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/StackFrame.h"
-#include "lldb/Target/TargetList.h"
-
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/StringLexer.h"
namespace lldb_private {
-// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
-// class DataVisualization is the high-level front-end of this feature
-// clients should refer to that class as the entry-point into the data formatters
-// unless they have a good reason to bypass it and prefer to use this file's objects directly
class IFormatChangeListener
{
public:
+ virtual
+ ~IFormatChangeListener() = default;
+
virtual void
Changed () = 0;
-
- virtual
- ~IFormatChangeListener () {}
-
+
virtual uint32_t
GetCurrentRevision () = 0;
-
};
// if the user tries to add formatters for, say, "struct Foo"
@@ -92,11 +77,10 @@ template<typename KeyType, typename ValueType>
class FormatMap
{
public:
-
typedef typename ValueType::SharedPointer ValueSP;
typedef std::map<KeyType, ValueSP> MapType;
typedef typename MapType::iterator MapIterator;
- typedef bool(*CallbackType)(void*, KeyType, const ValueSP&);
+ typedef std::function<bool(KeyType, const ValueSP&)> ForEachCallback;
FormatMap(IFormatChangeListener* lst) :
m_map(),
@@ -155,7 +139,7 @@ public:
}
void
- LoopThrough (CallbackType callback, void* param)
+ ForEach (ForEachCallback callback)
{
if (callback)
{
@@ -164,7 +148,7 @@ public:
for (pos = m_map.begin(); pos != end; pos++)
{
KeyType type = pos->first;
- if (!callback(param, type, pos->second))
+ if (!callback(type, pos->second))
break;
}
}
@@ -227,7 +211,6 @@ protected:
friend class FormattersContainer<KeyType, ValueType>;
friend class FormatManager;
-
};
template<typename KeyType, typename ValueType>
@@ -241,7 +224,7 @@ public:
typedef typename MapType::iterator MapIterator;
typedef typename MapType::key_type MapKeyType;
typedef typename MapType::mapped_type MapValueType;
- typedef typename BackEndType::CallbackType CallbackType;
+ typedef typename BackEndType::ForEachCallback ForEachCallback;
typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType> > SharedPointer;
friend class TypeCategoryImpl;
@@ -256,23 +239,23 @@ public:
void
Add (const MapKeyType &type, const MapValueType& entry)
{
- Add_Impl(type, entry, (KeyType*)NULL);
+ Add_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
bool
Delete (ConstString type)
{
- return Delete_Impl(type, (KeyType*)NULL);
+ return Delete_Impl(type, static_cast<KeyType*>(nullptr));
}
bool
Get(ValueObject& valobj,
MapValueType& entry,
lldb::DynamicValueType use_dynamic,
- uint32_t* why = NULL)
+ uint32_t* why = nullptr)
{
uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
- ClangASTType ast_type(valobj.GetClangType());
+ CompilerType ast_type(valobj.GetCompilerType());
bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
if (ret)
entry = MapValueType(entry);
@@ -286,13 +269,13 @@ public:
bool
Get (ConstString type, MapValueType& entry)
{
- return Get_Impl(type, entry, (KeyType*)NULL);
+ return Get_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
bool
GetExact (ConstString type, MapValueType& entry)
{
- return GetExact_Impl(type, entry, (KeyType*)NULL);
+ return GetExact_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
MapValueType
@@ -304,7 +287,7 @@ public:
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierAtIndex (size_t index)
{
- return GetTypeNameSpecifierAtIndex_Impl(index, (KeyType*)NULL);
+ return GetTypeNameSpecifierAtIndex_Impl(index, static_cast<KeyType*>(nullptr));
}
void
@@ -314,9 +297,9 @@ public:
}
void
- LoopThrough (CallbackType callback, void* param)
+ ForEach (ForEachCallback callback)
{
- m_format_map.LoopThrough(callback,param);
+ m_format_map.ForEach(callback);
}
uint32_t
@@ -377,7 +360,7 @@ protected:
bool
GetExact_Impl (ConstString type, MapValueType& entry, ConstString *dummy)
{
- return Get_Impl(type,entry, (KeyType*)0);
+ return Get_Impl(type, entry, static_cast<KeyType*>(nullptr));
}
lldb::TypeNameSpecifierImplSP
@@ -395,7 +378,7 @@ protected:
GetTypeNameSpecifierAtIndex_Impl (size_t index, lldb::RegularExpressionSP *dummy)
{
lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
- if (regex.get() == NULL)
+ if (regex.get() == nullptr)
return lldb::TypeNameSpecifierImplSP();
return lldb::TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(regex->GetText(),
true));
@@ -447,7 +430,6 @@ protected:
{
for (const FormattersMatchCandidate& candidate : candidates)
{
- // FIXME: could we do the IsMatch() check first?
if (Get(candidate.GetTypeName(),entry))
{
if (candidate.IsMatch(entry) == false)
@@ -469,4 +451,4 @@ protected:
} // namespace lldb_private
-#endif // lldb_FormattersContainer_h_
+#endif // lldb_FormattersContainer_h_
diff --git a/include/lldb/DataFormatters/FormattersHelpers.h b/include/lldb/DataFormatters/FormattersHelpers.h
new file mode 100644
index 0000000000000..4627a61e94f14
--- /dev/null
+++ b/include/lldb/DataFormatters/FormattersHelpers.h
@@ -0,0 +1,279 @@
+//===-- FormattersHelpers.h --------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormattersHelpers_h_
+#define lldb_FormattersHelpers_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+namespace lldb_private {
+ namespace formatters {
+ void
+ AddFormat (TypeCategoryImpl::SharedPointer category_sp,
+ lldb::Format format,
+ ConstString type_name,
+ TypeFormatImpl::Flags flags,
+ bool regex = false);
+
+ void
+ AddSummary(TypeCategoryImpl::SharedPointer category_sp,
+ lldb::TypeSummaryImplSP summary_sp,
+ ConstString type_name,
+ bool regex = false);
+
+ void
+ AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
+ const char* string,
+ ConstString type_name,
+ TypeSummaryImpl::Flags flags,
+ bool regex = false);
+
+ void
+ AddOneLineSummary (TypeCategoryImpl::SharedPointer category_sp,
+ ConstString type_name,
+ TypeSummaryImpl::Flags flags,
+ bool regex = false);
+
+#ifndef LLDB_DISABLE_PYTHON
+ void
+ AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
+ CXXFunctionSummaryFormat::Callback funct,
+ const char* description,
+ ConstString type_name,
+ TypeSummaryImpl::Flags flags,
+ bool regex = false);
+
+ void
+ AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
+ CXXSyntheticChildren::CreateFrontEndCallback generator,
+ const char* description,
+ ConstString type_name,
+ ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+
+ void
+ AddFilter (TypeCategoryImpl::SharedPointer category_sp,
+ std::vector<std::string> children,
+ const char* description,
+ ConstString type_name,
+ ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+#endif
+
+ StackFrame*
+ GetViableFrame (ExecutionContext exe_ctx);
+
+ bool
+ ExtractValueFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ uint64_t &value);
+
+ bool
+ ExtractSummaryFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ Stream &stream,
+ lldb::LanguageType lang_type);
+
+ lldb::ValueObjectSP
+ CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ uint64_t index);
+
+ lldb::ValueObjectSP
+ CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ const char* key);
+
+ size_t
+ ExtractIndexFromString (const char* item_name);
+
+ lldb::addr_t
+ GetArrayAddressOrPointerValue (ValueObject& valobj);
+
+ time_t
+ GetOSXEpoch ();
+
+ struct InferiorSizedWord {
+
+ InferiorSizedWord(const InferiorSizedWord& word) : ptr_size(word.ptr_size)
+ {
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ }
+
+ InferiorSizedWord
+ operator = (const InferiorSizedWord& word)
+ {
+ ptr_size = word.ptr_size;
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ return *this;
+ }
+
+ InferiorSizedWord(uint64_t val, Process& process) : ptr_size(process.GetAddressByteSize())
+ {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else if (ptr_size == 8)
+ sixty_four = val;
+ else
+ assert (false && "new pointer size is unknown");
+ }
+
+ bool
+ IsNegative () const
+ {
+ if (ptr_size == 4)
+ return ((int32_t)thirty_two) < 0;
+ else
+ return ((int64_t)sixty_four) < 0;
+ }
+
+ bool
+ IsZero () const
+ {
+ if (ptr_size == 4)
+ return thirty_two == 0;
+ else
+ return sixty_four == 0;
+ }
+
+ static InferiorSizedWord
+ GetMaximum (Process& process)
+ {
+ if (process.GetAddressByteSize() == 4)
+ return InferiorSizedWord(UINT32_MAX,4);
+ else
+ return InferiorSizedWord(UINT64_MAX,8);
+ }
+
+ InferiorSizedWord
+ operator >> (int rhs) const
+ {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two >> rhs,4);
+ return InferiorSizedWord(sixty_four>>rhs,8);
+ }
+
+ InferiorSizedWord
+ operator << (int rhs) const
+ {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two << rhs,4);
+ return InferiorSizedWord(sixty_four << rhs,8);
+ }
+
+ InferiorSizedWord
+ operator & (const InferiorSizedWord& word) const
+ {
+ if (ptr_size != word.ptr_size)
+ return InferiorSizedWord(0,ptr_size);
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & word.thirty_two,4);
+ return InferiorSizedWord(sixty_four & word.sixty_four,8);
+ }
+
+ InferiorSizedWord
+ operator & (int x) const
+ {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & x,4);
+ return InferiorSizedWord(sixty_four & x,8);
+ }
+
+ size_t
+ GetBitSize () const
+ {
+ return ptr_size << 3;
+ }
+
+ size_t
+ GetByteSize () const
+ {
+ return ptr_size;
+ }
+
+ uint64_t
+ GetValue () const
+ {
+ if (ptr_size == 4)
+ return (uint64_t)thirty_two;
+ return sixty_four;
+ }
+
+ InferiorSizedWord
+ SignExtend () const
+ {
+ if (ptr_size == 4)
+ return InferiorSizedWord ((int32_t)thirty_two,4);
+ return InferiorSizedWord((int64_t)sixty_four,8);
+ }
+
+ uint8_t*
+ CopyToBuffer (uint8_t* buffer) const
+ {
+ if (ptr_size == 4)
+ {
+ memcpy(buffer, &thirty_two, 4);
+ return buffer + 4;
+ }
+ else
+ {
+ memcpy(buffer, &sixty_four, 8);
+ return buffer + 8;
+ }
+ }
+
+ DataExtractor
+ GetAsData (lldb::ByteOrder byte_order = lldb::eByteOrderInvalid) const
+ {
+ if (ptr_size == 4)
+ return DataExtractor(&thirty_two, 4, byte_order, 4);
+ else
+ return DataExtractor(&sixty_four, 8, byte_order, 8);
+ }
+
+ private:
+
+ InferiorSizedWord(uint64_t val, size_t psz) : ptr_size(psz)
+ {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else
+ sixty_four = val;
+ }
+
+ size_t ptr_size;
+ union {
+ uint32_t thirty_two;
+ uint64_t sixty_four;
+ };
+ };
+ } // namespace formatters
+} // namespace lldb_private
+
+#endif // lldb_FormattersHelpers_h_
diff --git a/include/lldb/DataFormatters/LanguageCategory.h b/include/lldb/DataFormatters/LanguageCategory.h
new file mode 100644
index 0000000000000..a7040099f2137
--- /dev/null
+++ b/include/lldb/DataFormatters/LanguageCategory.h
@@ -0,0 +1,99 @@
+//===-- LanguageCategory.h----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_LanguageCategory_h_
+#define lldb_LanguageCategory_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+
+#include <memory>
+
+namespace lldb_private {
+
+class LanguageCategory
+{
+public:
+ typedef std::unique_ptr<LanguageCategory> UniquePointer;
+
+ LanguageCategory (lldb::LanguageType lang_type);
+
+ bool
+ Get (FormattersMatchData& match_data,
+ lldb::TypeFormatImplSP& format_sp);
+
+ bool
+ Get (FormattersMatchData& match_data,
+ lldb::TypeSummaryImplSP& format_sp);
+
+ bool
+ Get (FormattersMatchData& match_data,
+ lldb::SyntheticChildrenSP& format_sp);
+
+ bool
+ Get (FormattersMatchData& match_data,
+ lldb::TypeValidatorImplSP& format_sp);
+
+ bool
+ GetHardcoded (FormatManager& fmt_mgr,
+ FormattersMatchData& match_data,
+ lldb::TypeFormatImplSP& format_sp);
+
+ bool
+ GetHardcoded (FormatManager& fmt_mgr,
+ FormattersMatchData& match_data,
+ lldb::TypeSummaryImplSP& format_sp);
+
+ bool
+ GetHardcoded (FormatManager& fmt_mgr,
+ FormattersMatchData& match_data,
+ lldb::SyntheticChildrenSP& format_sp);
+
+ bool
+ GetHardcoded (FormatManager& fmt_mgr,
+ FormattersMatchData& match_data,
+ lldb::TypeValidatorImplSP& format_sp);
+
+ lldb::TypeCategoryImplSP
+ GetCategory () const;
+
+ FormatCache&
+ GetFormatCache ();
+
+ void
+ Enable ();
+
+ void
+ Disable ();
+
+ bool
+ IsEnabled ();
+
+private:
+ lldb::TypeCategoryImplSP m_category_sp;
+
+ HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
+ HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
+ HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
+ HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators;
+
+ lldb_private::FormatCache m_format_cache;
+
+ bool m_enabled;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_LanguageCategory_h_
diff --git a/include/lldb/DataFormatters/StringPrinter.h b/include/lldb/DataFormatters/StringPrinter.h
index 48e27ace5d920..a849c4e011094 100644
--- a/include/lldb/DataFormatters/StringPrinter.h
+++ b/include/lldb/DataFormatters/StringPrinter.h
@@ -10,6 +10,13 @@
#ifndef liblldb_StringPrinter_h_
#define liblldb_StringPrinter_h_
+// C Includes
+// C++ Includes
+#include <functional>
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/Core/DataExtractor.h"
@@ -17,273 +24,505 @@
namespace lldb_private {
namespace formatters
{
-
- enum class StringElementType {
- ASCII,
- UTF8,
- UTF16,
- UTF32
- };
-
- class ReadStringAndDumpToStreamOptions
+ class StringPrinter
{
public:
-
- ReadStringAndDumpToStreamOptions () :
- m_location(0),
- m_process_sp(),
- m_stream(NULL),
- m_prefix_token(0),
- m_quote('"'),
- m_source_size(0),
- m_needs_zero_termination(true),
- m_escape_non_printables(true),
- m_ignore_max_length(false)
- {
- }
-
- ReadStringAndDumpToStreamOptions (ValueObject& valobj);
-
- ReadStringAndDumpToStreamOptions&
- SetLocation (uint64_t l)
- {
- m_location = l;
- return *this;
- }
-
- uint64_t
- GetLocation () const
- {
- return m_location;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetProcessSP (lldb::ProcessSP p)
- {
- m_process_sp = p;
- return *this;
- }
-
- lldb::ProcessSP
- GetProcessSP () const
- {
- return m_process_sp;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetStream (Stream* s)
- {
- m_stream = s;
- return *this;
- }
-
- Stream*
- GetStream () const
- {
- return m_stream;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetPrefixToken (char p)
- {
- m_prefix_token = p;
- return *this;
- }
-
- char
- GetPrefixToken () const
- {
- return m_prefix_token;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetQuote (char q)
- {
- m_quote = q;
- return *this;
- }
-
- char
- GetQuote () const
- {
- return m_quote;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetSourceSize (uint32_t s)
- {
- m_source_size = s;
- return *this;
- }
-
- uint32_t
- GetSourceSize () const
- {
- return m_source_size;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetNeedsZeroTermination (bool z)
- {
- m_needs_zero_termination = z;
- return *this;
- }
-
- bool
- GetNeedsZeroTermination () const
- {
- return m_needs_zero_termination;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetEscapeNonPrintables (bool e)
- {
- m_escape_non_printables = e;
- return *this;
- }
-
- bool
- GetEscapeNonPrintables () const
- {
- return m_escape_non_printables;
- }
-
- ReadStringAndDumpToStreamOptions&
- SetIgnoreMaxLength (bool e)
- {
- m_ignore_max_length = e;
- return *this;
- }
-
- bool
- GetIgnoreMaxLength () const
- {
- return m_ignore_max_length;
- }
-
- private:
- uint64_t m_location;
- lldb::ProcessSP m_process_sp;
- Stream* m_stream;
- char m_prefix_token;
- char m_quote;
- uint32_t m_source_size;
- bool m_needs_zero_termination;
- bool m_escape_non_printables;
- bool m_ignore_max_length;
- };
-
- class ReadBufferAndDumpToStreamOptions
- {
- public:
-
- ReadBufferAndDumpToStreamOptions () :
- m_data(),
- m_stream(NULL),
- m_prefix_token(0),
- m_quote('"'),
- m_source_size(0),
- m_escape_non_printables(true)
- {
- }
-
- ReadBufferAndDumpToStreamOptions (ValueObject& valobj);
-
- ReadBufferAndDumpToStreamOptions&
- SetData (DataExtractor d)
- {
- m_data = d;
- return *this;
- }
-
- lldb_private::DataExtractor
- GetData () const
- {
- return m_data;
- }
-
- ReadBufferAndDumpToStreamOptions&
- SetStream (Stream* s)
- {
- m_stream = s;
- return *this;
- }
-
- Stream*
- GetStream () const
- {
- return m_stream;
- }
-
- ReadBufferAndDumpToStreamOptions&
- SetPrefixToken (char p)
- {
- m_prefix_token = p;
- return *this;
- }
-
- char
- GetPrefixToken () const
- {
- return m_prefix_token;
- }
-
- ReadBufferAndDumpToStreamOptions&
- SetQuote (char q)
- {
- m_quote = q;
- return *this;
- }
-
- char
- GetQuote () const
- {
- return m_quote;
- }
-
- ReadBufferAndDumpToStreamOptions&
- SetSourceSize (uint32_t s)
- {
- m_source_size = s;
- return *this;
- }
-
- uint32_t
- GetSourceSize () const
- {
- return m_source_size;
- }
-
- ReadBufferAndDumpToStreamOptions&
- SetEscapeNonPrintables (bool e)
- {
- m_escape_non_printables = e;
- return *this;
- }
-
- bool
- GetEscapeNonPrintables () const
- {
- return m_escape_non_printables;
- }
-
- private:
- DataExtractor m_data;
- Stream* m_stream;
- char m_prefix_token;
- char m_quote;
- uint32_t m_source_size;
- bool m_escape_non_printables;
+ enum class StringElementType
+ {
+ ASCII,
+ UTF8,
+ UTF16,
+ UTF32
+ };
+
+ enum class GetPrintableElementType
+ {
+ ASCII,
+ UTF8
+ };
+
+ class ReadStringAndDumpToStreamOptions
+ {
+ public:
+ ReadStringAndDumpToStreamOptions () :
+ m_location(0),
+ m_process_sp(),
+ m_stream(nullptr),
+ m_prefix_token(),
+ m_suffix_token(),
+ m_quote('"'),
+ m_source_size(0),
+ m_needs_zero_termination(true),
+ m_escape_non_printables(true),
+ m_ignore_max_length(false),
+ m_zero_is_terminator(true),
+ m_language_type(lldb::eLanguageTypeUnknown)
+ {
+ }
+
+ ReadStringAndDumpToStreamOptions (ValueObject& valobj);
+
+ ReadStringAndDumpToStreamOptions&
+ SetLocation (uint64_t l)
+ {
+ m_location = l;
+ return *this;
+ }
+
+ uint64_t
+ GetLocation () const
+ {
+ return m_location;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetProcessSP (lldb::ProcessSP p)
+ {
+ m_process_sp = p;
+ return *this;
+ }
+
+ lldb::ProcessSP
+ GetProcessSP () const
+ {
+ return m_process_sp;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetStream (Stream* s)
+ {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream*
+ GetStream () const
+ {
+ return m_stream;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetPrefixToken (const std::string& p)
+ {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetPrefixToken (std::nullptr_t)
+ {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char*
+ GetPrefixToken () const
+ {
+ return m_prefix_token.c_str();
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetSuffixToken (const std::string& p)
+ {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetSuffixToken (std::nullptr_t)
+ {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char*
+ GetSuffixToken () const
+ {
+ return m_suffix_token.c_str();
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetQuote (char q)
+ {
+ m_quote = q;
+ return *this;
+ }
+
+ char
+ GetQuote () const
+ {
+ return m_quote;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetSourceSize (uint32_t s)
+ {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t
+ GetSourceSize () const
+ {
+ return m_source_size;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetNeedsZeroTermination (bool z)
+ {
+ m_needs_zero_termination = z;
+ return *this;
+ }
+
+ bool
+ GetNeedsZeroTermination () const
+ {
+ return m_needs_zero_termination;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetBinaryZeroIsTerminator (bool e)
+ {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool
+ GetBinaryZeroIsTerminator () const
+ {
+ return m_zero_is_terminator;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetEscapeNonPrintables (bool e)
+ {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool
+ GetEscapeNonPrintables () const
+ {
+ return m_escape_non_printables;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetIgnoreMaxLength (bool e)
+ {
+ m_ignore_max_length = e;
+ return *this;
+ }
+
+ bool
+ GetIgnoreMaxLength () const
+ {
+ return m_ignore_max_length;
+ }
+
+ ReadStringAndDumpToStreamOptions&
+ SetLanguage (lldb::LanguageType l)
+ {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType
+ GetLanguage () const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ uint64_t m_location;
+ lldb::ProcessSP m_process_sp;
+ Stream* m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_needs_zero_termination;
+ bool m_escape_non_printables;
+ bool m_ignore_max_length;
+ bool m_zero_is_terminator;
+ lldb::LanguageType m_language_type;
+ };
+
+ class ReadBufferAndDumpToStreamOptions
+ {
+ public:
+ ReadBufferAndDumpToStreamOptions () :
+ m_data(),
+ m_stream(nullptr),
+ m_prefix_token(),
+ m_suffix_token(),
+ m_quote('"'),
+ m_source_size(0),
+ m_escape_non_printables(true),
+ m_zero_is_terminator(true),
+ m_is_truncated(false),
+ m_language_type(lldb::eLanguageTypeUnknown)
+ {
+ }
+
+ ReadBufferAndDumpToStreamOptions (ValueObject& valobj);
+
+ ReadBufferAndDumpToStreamOptions (const ReadStringAndDumpToStreamOptions& options);
+
+ ReadBufferAndDumpToStreamOptions&
+ SetData (DataExtractor d)
+ {
+ m_data = d;
+ return *this;
+ }
+
+ lldb_private::DataExtractor
+ GetData () const
+ {
+ return m_data;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetStream (Stream* s)
+ {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream*
+ GetStream () const
+ {
+ return m_stream;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetPrefixToken (const std::string& p)
+ {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetPrefixToken (std::nullptr_t)
+ {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char*
+ GetPrefixToken () const
+ {
+ return m_prefix_token.c_str();
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetSuffixToken (const std::string& p)
+ {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetSuffixToken (std::nullptr_t)
+ {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char*
+ GetSuffixToken () const
+ {
+ return m_suffix_token.c_str();
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetQuote (char q)
+ {
+ m_quote = q;
+ return *this;
+ }
+
+ char
+ GetQuote () const
+ {
+ return m_quote;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetSourceSize (uint32_t s)
+ {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t
+ GetSourceSize () const
+ {
+ return m_source_size;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetEscapeNonPrintables (bool e)
+ {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool
+ GetEscapeNonPrintables () const
+ {
+ return m_escape_non_printables;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetBinaryZeroIsTerminator (bool e)
+ {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool
+ GetBinaryZeroIsTerminator () const
+ {
+ return m_zero_is_terminator;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetIsTruncated (bool t)
+ {
+ m_is_truncated = t;
+ return *this;
+ }
+
+ bool
+ GetIsTruncated () const
+ {
+ return m_is_truncated;
+ }
+
+ ReadBufferAndDumpToStreamOptions&
+ SetLanguage (lldb::LanguageType l)
+ {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType
+ GetLanguage () const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ DataExtractor m_data;
+ Stream* m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_escape_non_printables;
+ bool m_zero_is_terminator;
+ bool m_is_truncated;
+ lldb::LanguageType m_language_type;
+ };
+
+ // I can't use a std::unique_ptr for this because the Deleter is a template argument there
+ // and I want the same type to represent both pointers I want to free and pointers I don't need
+ // to free - which is what this class essentially is
+ // It's very specialized to the needs of this file, and not suggested for general use
+ template <typename T = uint8_t, typename U = char, typename S = size_t>
+ struct StringPrinterBufferPointer
+ {
+ public:
+ typedef std::function<void(const T*)> Deleter;
+
+ StringPrinterBufferPointer (std::nullptr_t ptr) :
+ m_data(nullptr),
+ m_size(0),
+ m_deleter()
+ {}
+
+ StringPrinterBufferPointer(const T* bytes, S size, Deleter deleter = nullptr) :
+ m_data(bytes),
+ m_size(size),
+ m_deleter(deleter)
+ {}
+
+ StringPrinterBufferPointer(const U* bytes, S size, Deleter deleter = nullptr) :
+ m_data(reinterpret_cast<const T*>(bytes)),
+ m_size(size),
+ m_deleter(deleter)
+ {}
+
+ StringPrinterBufferPointer(StringPrinterBufferPointer&& rhs) :
+ m_data(rhs.m_data),
+ m_size(rhs.m_size),
+ m_deleter(rhs.m_deleter)
+ {
+ rhs.m_data = nullptr;
+ }
+
+ StringPrinterBufferPointer(const StringPrinterBufferPointer& rhs) :
+ m_data(rhs.m_data),
+ m_size(rhs.m_size),
+ m_deleter(rhs.m_deleter)
+ {
+ rhs.m_data = nullptr; // this is why m_data has to be mutable
+ }
+
+ ~StringPrinterBufferPointer()
+ {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = nullptr;
+ }
+
+ const T*
+ GetBytes () const
+ {
+ return m_data;
+ }
+
+ const S
+ GetSize () const
+ {
+ return m_size;
+ }
+
+ StringPrinterBufferPointer&
+ operator = (const StringPrinterBufferPointer& rhs)
+ {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = rhs.m_data;
+ m_size = rhs.m_size;
+ m_deleter = rhs.m_deleter;
+ rhs.m_data = nullptr;
+ return *this;
+ }
+
+ private:
+ mutable const T* m_data;
+ size_t m_size;
+ Deleter m_deleter;
+ };
+
+ typedef std::function<StringPrinter::StringPrinterBufferPointer<uint8_t,char,size_t>(uint8_t*, uint8_t*, uint8_t*&)> EscapingHelper;
+ typedef std::function<EscapingHelper(GetPrintableElementType)> EscapingHelperGenerator;
+
+ static EscapingHelper
+ GetDefaultEscapingHelper (GetPrintableElementType elem_type);
+
+ template <StringElementType element_type>
+ static bool
+ ReadStringAndDumpToStream (const ReadStringAndDumpToStreamOptions& options);
+
+ template <StringElementType element_type>
+ static bool
+ ReadBufferAndDumpToStream (const ReadBufferAndDumpToStreamOptions& options);
};
- template <StringElementType element_type>
- bool
- ReadStringAndDumpToStream (ReadStringAndDumpToStreamOptions options);
-
- template <StringElementType element_type>
- bool
- ReadBufferAndDumpToStream (ReadBufferAndDumpToStreamOptions options);
-
} // namespace formatters
} // namespace lldb_private
diff --git a/include/lldb/DataFormatters/TypeCategory.h b/include/lldb/DataFormatters/TypeCategory.h
index e32efa420a55a..075d31d1cf6f7 100644
--- a/include/lldb/DataFormatters/TypeCategory.h
+++ b/include/lldb/DataFormatters/TypeCategory.h
@@ -1,4 +1,4 @@
-//===-- TypeCategory.h -------------------------------------------*- C++ -*-===//
+//===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,10 @@
// C Includes
// C++ Includes
+#include <initializer_list>
+#include <memory>
+#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -38,6 +42,9 @@ namespace lldb_private {
typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
+ typedef typename ExactMatchContainer::ForEachCallback ExactMatchForEachCallback;
+ typedef typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
+
FormatterContainerPair (const char* exact_name,
const char* regex_name,
IFormatChangeListener* clist) :
@@ -60,6 +67,12 @@ namespace lldb_private {
return m_regex_sp;
}
+ uint32_t
+ GetCount ()
+ {
+ return GetExactMatch()->GetCount() + GetRegexMatch()->GetCount();
+ }
+
private:
ExactMatchContainerSP m_exact_sp;
RegexMatchContainerSP m_regex_sp;
@@ -74,11 +87,10 @@ namespace lldb_private {
typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
#ifndef LLDB_DISABLE_PYTHON
- typedef FormatterContainerPair<ScriptedSyntheticChildren> SynthContainer;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+ typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
+#endif // LLDB_DISABLE_PYTHON
public:
-
typedef uint16_t FormatCategoryItems;
static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
@@ -93,13 +105,195 @@ namespace lldb_private {
#ifndef LLDB_DISABLE_PYTHON
typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
+ template <typename T>
+ class ForEachCallbacks
+ {
+ public:
+ ForEachCallbacks () = default;
+ ~ForEachCallbacks () = default;
+
+ template<typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetExact (FormatContainer::ExactMatchForEachCallback callback)
+ {
+ m_format_exact = callback;
+ return *this;
+ }
+ template<typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetWithRegex (FormatContainer::RegexMatchForEachCallback callback)
+ {
+ m_format_regex = callback;
+ return *this;
+ }
+
+ template<typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetExact (SummaryContainer::ExactMatchForEachCallback callback)
+ {
+ m_summary_exact = callback;
+ return *this;
+ }
+ template<typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetWithRegex (SummaryContainer::RegexMatchForEachCallback callback)
+ {
+ m_summary_regex = callback;
+ return *this;
+ }
+
+ template<typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetExact (FilterContainer::ExactMatchForEachCallback callback)
+ {
+ m_filter_exact = callback;
+ return *this;
+ }
+ template<typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetWithRegex (FilterContainer::RegexMatchForEachCallback callback)
+ {
+ m_filter_regex = callback;
+ return *this;
+ }
+
+#ifndef LLDB_DISABLE_PYTHON
+ template<typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetExact (SynthContainer::ExactMatchForEachCallback callback)
+ {
+ m_synth_exact = callback;
+ return *this;
+ }
+ template<typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetWithRegex (SynthContainer::RegexMatchForEachCallback callback)
+ {
+ m_synth_regex = callback;
+ return *this;
+ }
+#endif // LLDB_DISABLE_PYTHON
+ template<typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetExact (ValidatorContainer::ExactMatchForEachCallback callback)
+ {
+ m_validator_exact = callback;
+ return *this;
+ }
+ template<typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
+ SetWithRegex (ValidatorContainer::RegexMatchForEachCallback callback)
+ {
+ m_validator_regex = callback;
+ return *this;
+ }
+
+ FormatContainer::ExactMatchForEachCallback
+ GetFormatExactCallback () const
+ {
+ return m_format_exact;
+ }
+ FormatContainer::RegexMatchForEachCallback
+ GetFormatRegexCallback () const
+ {
+ return m_format_regex;
+ }
+
+ SummaryContainer::ExactMatchForEachCallback
+ GetSummaryExactCallback () const
+ {
+ return m_summary_exact;
+ }
+ SummaryContainer::RegexMatchForEachCallback
+ GetSummaryRegexCallback () const
+ {
+ return m_summary_regex;
+ }
+
+ FilterContainer::ExactMatchForEachCallback
+ GetFilterExactCallback () const
+ {
+ return m_filter_exact;
+ }
+ FilterContainer::RegexMatchForEachCallback
+ GetFilterRegexCallback () const
+ {
+ return m_filter_regex;
+ }
+
+#ifndef LLDB_DISABLE_PYTHON
+ SynthContainer::ExactMatchForEachCallback
+ GetSynthExactCallback () const
+ {
+ return m_synth_exact;
+ }
+ SynthContainer::RegexMatchForEachCallback
+ GetSynthRegexCallback () const
+ {
+ return m_synth_regex;
+ }
+#endif // LLDB_DISABLE_PYTHON
+
+ ValidatorContainer::ExactMatchForEachCallback
+ GetValidatorExactCallback () const
+ {
+ return m_validator_exact;
+ }
+ ValidatorContainer::RegexMatchForEachCallback
+ GetValidatorRegexCallback () const
+ {
+ return m_validator_regex;
+ }
+
+ private:
+ FormatContainer::ExactMatchForEachCallback m_format_exact;
+ FormatContainer::RegexMatchForEachCallback m_format_regex;
+
+ SummaryContainer::ExactMatchForEachCallback m_summary_exact;
+ SummaryContainer::RegexMatchForEachCallback m_summary_regex;
+
+ FilterContainer::ExactMatchForEachCallback m_filter_exact;
+ FilterContainer::RegexMatchForEachCallback m_filter_regex;
+
+#ifndef LLDB_DISABLE_PYTHON
+ SynthContainer::ExactMatchForEachCallback m_synth_exact;
+ SynthContainer::RegexMatchForEachCallback m_synth_regex;
+#endif // LLDB_DISABLE_PYTHON
+
+ ValidatorContainer::ExactMatchForEachCallback m_validator_exact;
+ ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
+ };
+
TypeCategoryImpl (IFormatChangeListener* clist,
- ConstString name);
+ ConstString name,
+ std::initializer_list<lldb::LanguageType> langs = {});
+
+ template <typename T>
+ void
+ ForEach (const ForEachCallbacks<T> &foreach)
+ {
+ GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
+ GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
+
+ GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
+ GetRegexTypeSummariesContainer()->ForEach(foreach.GetSummaryRegexCallback());
+
+ GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
+ GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
+
+#ifndef LLDB_DISABLE_PYTHON
+ GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
+ GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
+#endif // LLDB_DISABLE_PYTHON
+
+ GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback());
+ GetRegexTypeValidatorsContainer()->ForEach(foreach.GetValidatorRegexCallback());
+ }
FormatContainerSP
GetTypeFormatsContainer ()
@@ -113,6 +307,12 @@ namespace lldb_private {
return m_format_cont.GetRegexMatch();
}
+ FormatContainer&
+ GetFormatContainer ()
+ {
+ return m_format_cont;
+ }
+
SummaryContainerSP
GetTypeSummariesContainer ()
{
@@ -125,6 +325,12 @@ namespace lldb_private {
return m_summary_cont.GetRegexMatch();
}
+ SummaryContainer&
+ GetSummaryContainer ()
+ {
+ return m_summary_cont;
+ }
+
FilterContainerSP
GetTypeFiltersContainer ()
{
@@ -136,6 +342,12 @@ namespace lldb_private {
{
return m_filter_cont.GetRegexMatch();
}
+
+ FilterContainer&
+ GetFilterContainer ()
+ {
+ return m_filter_cont;
+ }
FormatContainer::MapValueType
GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp);
@@ -185,12 +397,18 @@ namespace lldb_private {
return m_synth_cont.GetRegexMatch();
}
+ SynthContainer&
+ GetSyntheticsContainer ()
+ {
+ return m_synth_cont;
+ }
+
SynthContainer::MapValueType
GetSyntheticAtIndex (size_t index);
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForSyntheticAtIndex (size_t index);
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
ValidatorContainerSP
GetTypeValidatorsContainer ()
@@ -226,28 +444,28 @@ namespace lldb_private {
}
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeFormatImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeFormatImplSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeSummaryImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeSummaryImplSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::SyntheticChildrenSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::SyntheticChildrenSP& entry,
+ uint32_t* reason = nullptr);
bool
- Get (ValueObject& valobj,
- const FormattersMatchVector& candidates,
- lldb::TypeValidatorImplSP& entry,
- uint32_t* reason = NULL);
+ Get(ValueObject& valobj,
+ const FormattersMatchVector& candidates,
+ lldb::TypeValidatorImplSP& entry,
+ uint32_t* reason = nullptr);
void
Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
@@ -264,13 +482,28 @@ namespace lldb_private {
{
return m_name.GetCString();
}
+
+ size_t
+ GetNumLanguages ();
+
+ lldb::LanguageType
+ GetLanguageAtIndex (size_t idx);
+
+ void
+ AddLanguage (lldb::LanguageType lang);
bool
- AnyMatches (ConstString type_name,
- FormatCategoryItems items = ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- FormatCategoryItems* matching_type = NULL);
+ HasLanguage (lldb::LanguageType lang);
+
+ std::string
+ GetDescription ();
+
+ bool
+ AnyMatches(ConstString type_name,
+ FormatCategoryItems items = ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ FormatCategoryItems* matching_type = nullptr);
typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
@@ -280,7 +513,7 @@ namespace lldb_private {
FilterContainer m_filter_cont;
#ifndef LLDB_DISABLE_PYTHON
SynthContainer m_synth_cont;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
ValidatorContainer m_validator_cont;
bool m_enabled;
@@ -291,6 +524,8 @@ namespace lldb_private {
ConstString m_name;
+ std::vector<lldb::LanguageType> m_languages;
+
uint32_t m_enabled_position;
void
@@ -302,6 +537,9 @@ namespace lldb_private {
Enable(false, UINT32_MAX);
}
+ bool
+ IsApplicable (ValueObject& valobj);
+
uint32_t
GetLastEnabledPosition ()
{
@@ -314,6 +552,8 @@ namespace lldb_private {
m_enabled_position = p;
}
+ friend class FormatManager;
+ friend class LanguageCategory;
friend class TypeCategoryMap;
friend class FormattersContainer<ConstString, TypeFormatImpl>;
@@ -328,7 +568,7 @@ namespace lldb_private {
#ifndef LLDB_DISABLE_PYTHON
friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
friend class FormattersContainer<lldb::RegularExpressionSP, ScriptedSyntheticChildren>;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // LLDB_DISABLE_PYTHON
friend class FormattersContainer<ConstString, TypeValidatorImpl>;
friend class FormattersContainer<lldb::RegularExpressionSP, TypeValidatorImpl>;
@@ -336,4 +576,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // lldb_TypeCategory_h_
+#endif // lldb_TypeCategory_h_
diff --git a/include/lldb/DataFormatters/TypeCategoryMap.h b/include/lldb/DataFormatters/TypeCategoryMap.h
index 41b170d5335e4..8afeaf87cec5c 100644
--- a/include/lldb/DataFormatters/TypeCategoryMap.h
+++ b/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -1,4 +1,4 @@
-//===-- TypeCategoryMap.h ----------------------------------------*- C++ -*-===//
+//===-- TypeCategoryMap.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,9 @@
// C Includes
// C++ Includes
+#include <functional>
+#include <list>
+#include <map>
// Other libraries and framework includes
// Project includes
@@ -34,7 +37,8 @@ namespace lldb_private {
public:
typedef std::map<KeyType, ValueSP> MapType;
typedef MapType::iterator MapIterator;
- typedef bool(*CallbackType)(void*, const ValueSP&);
+ typedef std::function<bool(const ValueSP&)> ForEachCallback;
+
typedef uint32_t Position;
static const Position First = 0;
@@ -82,17 +86,17 @@ namespace lldb_private {
ValueSP& entry);
void
- LoopThrough (CallbackType callback, void* param);
+ ForEach (ForEachCallback callback);
lldb::TypeCategoryImplSP
GetAtIndex (uint32_t);
bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
uint32_t
GetCount ()
@@ -101,25 +105,20 @@ namespace lldb_private {
}
lldb::TypeFormatImplSP
- GetFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
+ GetFormat (FormattersMatchData& match_data);
lldb::TypeSummaryImplSP
- GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
+ GetSummaryFormat (FormattersMatchData& match_data);
#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
- GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
+ GetSyntheticChildren (FormattersMatchData& match_data);
#endif
- lldb::TypeValidatorImplSP
- GetValidator (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
+ lldb::TypeValidatorImplSP
+ GetValidator(FormattersMatchData& match_data);
private:
-
class delete_matching_categories
{
lldb::TypeCategoryImplSP ptr;
@@ -159,4 +158,4 @@ namespace lldb_private {
};
} // namespace lldb_private
-#endif // lldb_TypeCategoryMap_h_
+#endif // lldb_TypeCategoryMap_h_
diff --git a/include/lldb/DataFormatters/TypeFormat.h b/include/lldb/DataFormatters/TypeFormat.h
index 8aa7c60b49389..4ed28b6920617 100644
--- a/include/lldb/DataFormatters/TypeFormat.h
+++ b/include/lldb/DataFormatters/TypeFormat.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
+#include <functional>
#include <string>
#include <unordered_map>
@@ -150,7 +151,6 @@ namespace lldb_private {
TypeFormatImpl (const Flags& flags = Flags());
typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
virtual ~TypeFormatImpl ();
@@ -159,16 +159,19 @@ namespace lldb_private {
{
return m_flags.GetCascades();
}
+
bool
SkipsPointers () const
{
return m_flags.GetSkipPointers();
}
+
bool
SkipsReferences () const
{
return m_flags.GetSkipReferences();
}
+
bool
NonCacheable () const
{
@@ -255,9 +258,8 @@ namespace lldb_private {
const TypeFormatImpl::Flags& flags = Flags());
typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_Format::SharedPointer&);
- virtual ~TypeFormatImpl_Format ();
+ ~TypeFormatImpl_Format() override;
lldb::Format
GetFormat () const
@@ -271,18 +273,18 @@ namespace lldb_private {
m_format = fmt;
}
- virtual TypeFormatImpl::Type
- GetType ()
+ TypeFormatImpl::Type
+ GetType() override
{
return TypeFormatImpl::Type::eTypeFormat;
}
- virtual bool
- FormatObject (ValueObject *valobj,
- std::string& dest) const;
+ bool
+ FormatObject(ValueObject *valobj,
+ std::string& dest) const override;
- virtual std::string
- GetDescription();
+ std::string
+ GetDescription() override;
protected:
lldb::Format m_format;
@@ -298,9 +300,8 @@ namespace lldb_private {
const TypeFormatImpl::Flags& flags = Flags());
typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_EnumType::SharedPointer&);
- ~TypeFormatImpl_EnumType ();
+ ~TypeFormatImpl_EnumType() override;
ConstString
GetTypeName ()
@@ -314,26 +315,26 @@ namespace lldb_private {
m_enum_type = enum_type;
}
- virtual TypeFormatImpl::Type
- GetType ()
+ TypeFormatImpl::Type
+ GetType() override
{
return TypeFormatImpl::Type::eTypeEnum;
}
- virtual bool
- FormatObject (ValueObject *valobj,
- std::string& dest) const;
+ bool
+ FormatObject(ValueObject *valobj,
+ std::string& dest) const override;
- virtual std::string
- GetDescription();
+ std::string
+ GetDescription() override;
protected:
ConstString m_enum_type;
- mutable std::unordered_map<void*,ClangASTType> m_types;
+ mutable std::unordered_map<void*,CompilerType> m_types;
private:
DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
};
} // namespace lldb_private
-#endif // lldb_TypeFormat_h_
+#endif // lldb_TypeFormat_h_
diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h
index c2838eac27f17..e5bf4ecadfdfb 100644
--- a/include/lldb/DataFormatters/TypeSummary.h
+++ b/include/lldb/DataFormatters/TypeSummary.h
@@ -1,4 +1,4 @@
-//===-- TypeSummary.h --------------------------------------------*- C++ -*-===//
+//===-- TypeSummary.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,11 +14,11 @@
#include <stdint.h>
// C++ Includes
+#include <functional>
+#include <memory>
#include <string>
-#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
@@ -26,8 +26,6 @@
#include "lldb/Core/Error.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/StructuredData.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/Type.h"
namespace lldb_private {
class TypeSummaryOptions
@@ -36,6 +34,8 @@ namespace lldb_private {
TypeSummaryOptions ();
TypeSummaryOptions (const TypeSummaryOptions& rhs);
+ ~TypeSummaryOptions() = default;
+
TypeSummaryOptions&
operator = (const TypeSummaryOptions& rhs);
@@ -50,8 +50,7 @@ namespace lldb_private {
TypeSummaryOptions&
SetCapping (lldb::TypeSummaryCapping);
-
- ~TypeSummaryOptions() = default;
+
private:
lldb::LanguageType m_lang;
lldb::TypeSummaryCapping m_capping;
@@ -60,10 +59,26 @@ namespace lldb_private {
class TypeSummaryImpl
{
public:
+ enum class Kind
+ {
+ eSummaryString,
+ eScript,
+ eCallback,
+ eInternal
+ };
+
+ virtual
+ ~TypeSummaryImpl() = default;
+
+ Kind
+ GetKind () const
+ {
+ return m_kind;
+ }
+
class Flags
{
public:
-
Flags () :
m_flags (lldb::eTypeOptionCascade)
{}
@@ -162,6 +177,22 @@ namespace lldb_private {
m_flags &= ~lldb::eTypeOptionHideChildren;
return *this;
}
+
+ bool
+ GetHideEmptyAggregates () const
+ {
+ return (m_flags & lldb::eTypeOptionHideEmptyAggregates) == lldb::eTypeOptionHideEmptyAggregates;
+ }
+
+ Flags&
+ SetHideEmptyAggregates (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideEmptyAggregates;
+ else
+ m_flags &= ~lldb::eTypeOptionHideEmptyAggregates;
+ return *this;
+ }
bool
GetDontShowValue () const
@@ -243,31 +274,24 @@ namespace lldb_private {
uint32_t m_flags;
};
- typedef enum Type
- {
- eTypeUnknown,
- eTypeString,
- eTypeScript,
- eTypeCallback
- } Type;
-
- TypeSummaryImpl (const TypeSummaryImpl::Flags& flags);
-
bool
Cascades () const
{
return m_flags.GetCascades();
}
+
bool
SkipsPointers () const
{
return m_flags.GetSkipPointers();
}
+
bool
SkipsReferences () const
{
return m_flags.GetSkipReferences();
}
+
bool
NonCacheable () const
{
@@ -279,6 +303,12 @@ namespace lldb_private {
{
return !m_flags.GetDontShowChildren();
}
+
+ virtual bool
+ DoesPrintEmptyAggregates () const
+ {
+ return !m_flags.GetHideEmptyAggregates();
+ }
virtual bool
DoesPrintValue (ValueObject* valobj) const
@@ -358,11 +388,6 @@ namespace lldb_private {
m_flags.SetValue(value);
}
- virtual
- ~TypeSummaryImpl ()
- {
- }
-
// we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
// extended periods of time and we trust the ValueObject to stay around for as long as it is required
// for us to generate its summary
@@ -374,12 +399,6 @@ namespace lldb_private {
virtual std::string
GetDescription () = 0;
- virtual bool
- IsScripted () = 0;
-
- virtual Type
- GetType () = 0;
-
uint32_t&
GetRevision ()
{
@@ -387,14 +406,16 @@ namespace lldb_private {
}
typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
- typedef bool(*SummaryCallback)(void*, ConstString, const lldb::TypeSummaryImplSP&);
- typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::TypeSummaryImplSP&);
protected:
uint32_t m_my_revision;
Flags m_flags;
+ TypeSummaryImpl (Kind kind,
+ const TypeSummaryImpl::Flags& flags);
+
private:
+ Kind m_kind;
DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
};
@@ -407,11 +428,8 @@ namespace lldb_private {
StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char* f);
-
- virtual
- ~StringSummaryFormat()
- {
- }
+
+ ~StringSummaryFormat() override = default;
const char*
GetSummaryString () const
@@ -422,25 +440,17 @@ namespace lldb_private {
void
SetSummaryString (const char* f);
- virtual bool
+ bool
FormatObject(ValueObject *valobj,
std::string& dest,
- const TypeSummaryOptions& options);
-
- virtual std::string
- GetDescription();
-
- virtual bool
- IsScripted ()
- {
- return false;
- }
+ const TypeSummaryOptions& options) override;
+ std::string
+ GetDescription() override;
- virtual Type
- GetType ()
+ static bool classof(const TypeSummaryImpl* S)
{
- return TypeSummaryImpl::eTypeString;
+ return S->GetKind() == Kind::eSummaryString;
}
private:
@@ -452,9 +462,9 @@ namespace lldb_private {
{
// we should convert these to SBValue and SBStream if we ever cross
// the boundary towards the external world
- typedef bool (*Callback)(ValueObject&,
- Stream&,
- const TypeSummaryOptions&);
+ typedef std::function<bool(ValueObject&,
+ Stream&,
+ const TypeSummaryOptions&)> Callback;
Callback m_impl;
std::string m_description;
@@ -462,7 +472,9 @@ namespace lldb_private {
CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
Callback impl,
const char* description);
-
+
+ ~CXXFunctionSummaryFormat() override = default;
+
Callback
GetBackendFunction () const
{
@@ -489,30 +501,18 @@ namespace lldb_private {
else
m_description.clear();
}
+
+ bool
+ FormatObject(ValueObject *valobj,
+ std::string& dest,
+ const TypeSummaryOptions& options) override;
- virtual
- ~CXXFunctionSummaryFormat ()
- {
- }
-
- virtual bool
- FormatObject (ValueObject *valobj,
- std::string& dest,
- const TypeSummaryOptions& options);
-
- virtual std::string
- GetDescription ();
-
- virtual bool
- IsScripted ()
- {
- return false;
- }
+ std::string
+ GetDescription() override;
- virtual Type
- GetType ()
+ static bool classof(const TypeSummaryImpl* S)
{
- return TypeSummaryImpl::eTypeCallback;
+ return S->GetKind() == Kind::eCallback;
}
typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
@@ -521,8 +521,6 @@ namespace lldb_private {
DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
};
-#ifndef LLDB_DISABLE_PYTHON
-
// Python-based summaries, running script code to show data
struct ScriptSummaryFormat : public TypeSummaryImpl
{
@@ -532,8 +530,10 @@ namespace lldb_private {
ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char *function_name,
- const char* python_script = NULL);
-
+ const char* python_script = nullptr);
+
+ ~ScriptSummaryFormat() override = default;
+
const char*
GetFunctionName () const
{
@@ -565,38 +565,24 @@ namespace lldb_private {
m_python_script.clear();
}
- virtual
- ~ScriptSummaryFormat ()
- {
- }
-
- virtual bool
- FormatObject (ValueObject *valobj,
- std::string& dest,
- const TypeSummaryOptions& options);
-
- virtual std::string
- GetDescription ();
+ bool
+ FormatObject(ValueObject *valobj,
+ std::string& dest,
+ const TypeSummaryOptions& options) override;
- virtual bool
- IsScripted ()
- {
- return true;
- }
+ std::string
+ GetDescription() override;
- virtual Type
- GetType ()
+ static bool classof(const TypeSummaryImpl* S)
{
- return TypeSummaryImpl::eTypeScript;
+ return S->GetKind() == Kind::eScript;
}
typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
-
private:
DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
};
-#endif
} // namespace lldb_private
-#endif // lldb_TypeSummary_h_
+#endif // lldb_TypeSummary_h_
diff --git a/include/lldb/DataFormatters/TypeSynthetic.h b/include/lldb/DataFormatters/TypeSynthetic.h
index ff6691c9a1b8e..90e5730288c4e 100644
--- a/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/include/lldb/DataFormatters/TypeSynthetic.h
@@ -1,4 +1,4 @@
-//===-- TypeSynthetic.h -------------------------------------------*- C++ -*-===//
+//===-- TypeSynthetic.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,11 +14,13 @@
#include <stdint.h>
// C++ Includes
+#include <initializer_list>
+#include <functional>
+#include <memory>
#include <string>
#include <vector>
// Other libraries and framework includes
-
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
@@ -45,23 +47,27 @@ namespace lldb_private {
}
public:
-
SyntheticChildrenFrontEnd (ValueObject &backend) :
m_backend(backend),
m_valid(true)
{}
-
+
virtual
- ~SyntheticChildrenFrontEnd ()
- {
- }
-
+ ~SyntheticChildrenFrontEnd() = default;
+
virtual size_t
CalculateNumChildren () = 0;
+
+ virtual size_t
+ CalculateNumChildren (uint32_t max)
+ {
+ auto count = CalculateNumChildren ();
+ return count <= max ? count : max;
+ }
virtual lldb::ValueObjectSP
GetChildAtIndex (size_t idx) = 0;
-
+
virtual size_t
GetIndexOfChildWithName (const ConstString &name) = 0;
@@ -98,13 +104,13 @@ namespace lldb_private {
CreateValueObjectFromAddress (const char* name,
uint64_t address,
const ExecutionContext& exe_ctx,
- ClangASTType type);
+ CompilerType type);
lldb::ValueObjectSP
CreateValueObjectFromData (const char* name,
const DataExtractor& data,
const ExecutionContext& exe_ctx,
- ClangASTType type);
+ CompilerType type);
private:
bool m_valid;
@@ -117,29 +123,26 @@ namespace lldb_private {
SyntheticValueProviderFrontEnd (ValueObject &backend) :
SyntheticChildrenFrontEnd(backend)
{}
+
+ ~SyntheticValueProviderFrontEnd() override = default;
+
+ size_t
+ CalculateNumChildren() override { return 0; }
- virtual
- ~SyntheticValueProviderFrontEnd ()
- {
- }
-
- virtual size_t
- CalculateNumChildren () { return 0; }
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx) { return nullptr; }
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx) override { return nullptr; }
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name) { return UINT32_MAX; }
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override { return UINT32_MAX; }
- virtual bool
- Update () { return false; }
+ bool
+ Update() override { return false; }
- virtual bool
- MightHaveChildren () { return false; }
+ bool
+ MightHaveChildren () override { return false; }
- virtual lldb::ValueObjectSP
- GetSyntheticValue () = 0;
+ lldb::ValueObjectSP
+ GetSyntheticValue() override = 0;
private:
DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
@@ -148,7 +151,6 @@ namespace lldb_private {
class SyntheticChildren
{
public:
-
class Flags
{
public:
@@ -272,27 +274,28 @@ namespace lldb_private {
m_flags(flags)
{
}
-
+
virtual
- ~SyntheticChildren ()
- {
- }
-
+ ~SyntheticChildren() = default;
+
bool
Cascades () const
{
return m_flags.GetCascades();
}
+
bool
SkipsPointers () const
{
return m_flags.GetSkipPointers();
}
+
bool
SkipsReferences () const
{
return m_flags.GetSkipReferences();
}
+
bool
NonCacheable () const
{
@@ -345,7 +348,6 @@ namespace lldb_private {
GetFrontEnd (ValueObject &backend) = 0;
typedef std::shared_ptr<SyntheticChildren> SharedPointer;
- typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
uint32_t&
GetRevision ()
@@ -417,69 +419,67 @@ namespace lldb_private {
SetExpressionPathAtIndex (size_t i, const std::string& path);
bool
- IsScripted ()
+ IsScripted() override
{
return false;
}
std::string
- GetDescription ();
+ GetDescription() override;
class FrontEnd : public SyntheticChildrenFrontEnd
{
- private:
- TypeFilterImpl* filter;
public:
-
FrontEnd(TypeFilterImpl* flt,
ValueObject &backend) :
SyntheticChildrenFrontEnd(backend),
filter(flt)
{}
-
- virtual
- ~FrontEnd ()
- {
- }
-
- virtual size_t
- CalculateNumChildren ()
+
+ ~FrontEnd() override = default;
+
+ size_t
+ CalculateNumChildren() override
{
return filter->GetCount();
}
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx)
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx) override
{
if (idx >= filter->GetCount())
return lldb::ValueObjectSP();
return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), true);
}
+
+ bool
+ Update() override { return false; }
- virtual bool
- Update() { return false; }
-
- virtual bool
- MightHaveChildren ()
+ bool
+ MightHaveChildren() override
{
return filter->GetCount() > 0;
}
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override;
typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
private:
+ TypeFilterImpl* filter;
+
DISALLOW_COPY_AND_ASSIGN(FrontEnd);
};
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override
{
return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
}
+ typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
+
private:
DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
};
@@ -487,11 +487,7 @@ namespace lldb_private {
class CXXSyntheticChildren : public SyntheticChildren
{
public:
- typedef SyntheticChildrenFrontEnd* (*CreateFrontEndCallback) (CXXSyntheticChildren*, lldb::ValueObjectSP);
- protected:
- CreateFrontEndCallback m_create_callback;
- std::string m_description;
- public:
+ typedef std::function<SyntheticChildrenFrontEnd*(CXXSyntheticChildren*, lldb::ValueObjectSP)> CreateFrontEndCallback;
CXXSyntheticChildren (const SyntheticChildren::Flags& flags,
const char* description,
CreateFrontEndCallback callback) :
@@ -502,20 +498,24 @@ namespace lldb_private {
}
bool
- IsScripted ()
+ IsScripted() override
{
return false;
}
std::string
- GetDescription ();
+ GetDescription() override;
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd (ValueObject &backend)
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override
{
return SyntheticChildrenFrontEnd::AutoPointer(m_create_callback(this, backend.GetSP()));
}
+ protected:
+ CreateFrontEndCallback m_create_callback;
+ std::string m_description;
+
private:
DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
};
@@ -528,9 +528,9 @@ namespace lldb_private {
std::string m_python_code;
public:
- ScriptedSyntheticChildren (const SyntheticChildren::Flags& flags,
- const char* pclass,
- const char* pcode = NULL) :
+ ScriptedSyntheticChildren(const SyntheticChildren::Flags& flags,
+ const char* pclass,
+ const char* pcode = nullptr) :
SyntheticChildren(flags),
m_python_class(),
m_python_code()
@@ -567,62 +567,63 @@ namespace lldb_private {
}
std::string
- GetDescription ();
+ GetDescription() override;
bool
- IsScripted ()
+ IsScripted() override
{
return true;
}
class FrontEnd : public SyntheticChildrenFrontEnd
{
- private:
- std::string m_python_class;
- StructuredData::ObjectSP m_wrapper_sp;
- ScriptInterpreter *m_interpreter;
public:
-
FrontEnd (std::string pclass,
ValueObject &backend);
+ ~FrontEnd() override;
+
bool
IsValid ();
- virtual
- ~FrontEnd ();
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
+ size_t
+ CalculateNumChildren() override;
+
+ size_t
+ CalculateNumChildren(uint32_t max) override;
- virtual bool
- Update ();
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx) override;
+
+ bool
+ Update() override;
- virtual bool
- MightHaveChildren ();
+ bool
+ MightHaveChildren() override;
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override;
- virtual lldb::ValueObjectSP
- GetSyntheticValue ();
+ lldb::ValueObjectSP
+ GetSyntheticValue() override;
typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
private:
+ std::string m_python_class;
+ StructuredData::ObjectSP m_wrapper_sp;
+ ScriptInterpreter *m_interpreter;
+
DISALLOW_COPY_AND_ASSIGN(FrontEnd);
};
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override
{
auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(m_python_class, backend));
if (synth_ptr && ((FrontEnd*)synth_ptr.get())->IsValid())
return synth_ptr;
- return NULL;
+ return nullptr;
}
private:
@@ -631,4 +632,4 @@ namespace lldb_private {
#endif
} // namespace lldb_private
-#endif // lldb_TypeSynthetic_h_
+#endif // lldb_TypeSynthetic_h_
diff --git a/include/lldb/DataFormatters/TypeValidator.h b/include/lldb/DataFormatters/TypeValidator.h
index d06fac01f8246..f1f9a11049dbc 100644
--- a/include/lldb/DataFormatters/TypeValidator.h
+++ b/include/lldb/DataFormatters/TypeValidator.h
@@ -13,8 +13,8 @@
// C Includes
// C++ Includes
-#include <string>
#include <functional>
+#include <string>
// Other libraries and framework includes
@@ -150,7 +150,6 @@ public:
TypeValidatorImpl (const Flags& flags = Flags());
typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeValidatorImplSP&);
virtual ~TypeValidatorImpl ();
@@ -265,9 +264,8 @@ public:
TypeValidatorImpl_CXX (ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags& flags = Flags());
typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const TypeValidatorImpl_CXX::SharedPointer&);
- virtual ~TypeValidatorImpl_CXX ();
+ ~TypeValidatorImpl_CXX() override;
ValidatorFunction
GetValidatorFunction () const
@@ -281,17 +279,17 @@ public:
m_validator_function = f;
}
- virtual TypeValidatorImpl::Type
- GetType ()
+ TypeValidatorImpl::Type
+ GetType() override
{
return TypeValidatorImpl::Type::eTypeCXX;
}
- virtual ValidationResult
- FormatObject (ValueObject *valobj) const;
+ ValidationResult
+ FormatObject(ValueObject *valobj) const override;
- virtual std::string
- GetDescription();
+ std::string
+ GetDescription() override;
protected:
std::string m_description;
@@ -304,4 +302,4 @@ private:
} // namespace lldb_private
-#endif // lldb_TypeValidator_h_
+#endif // lldb_TypeValidator_h_
diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h
index dc05fd4826763..23d7ee2edf502 100644
--- a/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -18,232 +18,15 @@
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/Core/Flags.h"
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/Symbol/CompilerType.h"
-namespace lldb_private {
+//#include <functional>
+//#include <memory>
+//#include <set>
-struct DumpValueObjectOptions
-{
- uint32_t m_max_ptr_depth = 0;
- uint32_t m_max_depth = UINT32_MAX;
- lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
- uint32_t m_omit_summary_depth = 0;
- lldb::Format m_format = lldb::eFormatDefault;
- lldb::TypeSummaryImplSP m_summary_sp;
- std::string m_root_valobj_name;
- bool m_use_synthetic : 1;
- bool m_scope_already_checked : 1;
- bool m_flat_output : 1;
- bool m_ignore_cap : 1;
- bool m_show_types : 1;
- bool m_show_location : 1;
- bool m_use_objc : 1;
- bool m_hide_root_type : 1;
- bool m_hide_name : 1;
- bool m_hide_value : 1;
- bool m_run_validator : 1;
- bool m_use_type_display_name : 1;
- bool m_allow_oneliner_mode : 1;
-
- DumpValueObjectOptions() :
- m_summary_sp(),
- m_root_valobj_name(),
- m_use_synthetic(true),
- m_scope_already_checked(false),
- m_flat_output(false),
- m_ignore_cap(false),
- m_show_types(false),
- m_show_location(false),
- m_use_objc(false),
- m_hide_root_type(false),
- m_hide_name(false),
- m_hide_value(false),
- m_run_validator(false),
- m_use_type_display_name(true),
- m_allow_oneliner_mode(true)
- {}
-
- static const DumpValueObjectOptions
- DefaultOptions()
- {
- static DumpValueObjectOptions g_default_options;
-
- return g_default_options;
- }
-
- DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default;
-
- DumpValueObjectOptions (ValueObject& valobj);
-
- DumpValueObjectOptions&
- SetMaximumPointerDepth(uint32_t depth = 0)
- {
- m_max_ptr_depth = depth;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetMaximumDepth(uint32_t depth = 0)
- {
- m_max_depth = depth;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetShowTypes(bool show = false)
- {
- m_show_types = show;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetShowLocation(bool show = false)
- {
- m_show_location = show;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetUseObjectiveC(bool use = false)
- {
- m_use_objc = use;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetShowSummary(bool show = true)
- {
- if (show == false)
- SetOmitSummaryDepth(UINT32_MAX);
- else
- SetOmitSummaryDepth(0);
- return *this;
- }
-
- DumpValueObjectOptions&
- SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues)
- {
- m_use_dynamic = dyn;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetUseSyntheticValue(bool use_synthetic = true)
- {
- m_use_synthetic = use_synthetic;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetScopeChecked(bool check = true)
- {
- m_scope_already_checked = check;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetFlatOutput(bool flat = false)
- {
- m_flat_output = flat;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetOmitSummaryDepth(uint32_t depth = 0)
- {
- m_omit_summary_depth = depth;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetIgnoreCap(bool ignore = false)
- {
- m_ignore_cap = ignore;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetRawDisplay()
- {
- SetUseSyntheticValue(false);
- SetOmitSummaryDepth(UINT32_MAX);
- SetIgnoreCap(true);
- SetHideName(false);
- SetHideValue(false);
- SetUseTypeDisplayName(false);
- SetAllowOnelinerMode(false);
- return *this;
- }
-
- DumpValueObjectOptions&
- SetFormat (lldb::Format format = lldb::eFormatDefault)
- {
- m_format = format;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetSummary (lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP())
- {
- m_summary_sp = summary;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetRootValueObjectName (const char* name = NULL)
- {
- if (name)
- m_root_valobj_name.assign(name);
- else
- m_root_valobj_name.clear();
- return *this;
- }
-
- DumpValueObjectOptions&
- SetHideRootType (bool hide_root_type = false)
- {
- m_hide_root_type = hide_root_type;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetHideName (bool hide_name = false)
- {
- m_hide_name = hide_name;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetHideValue (bool hide_value = false)
- {
- m_hide_value = hide_value;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetRunValidator (bool run = true)
- {
- m_run_validator = run;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetUseTypeDisplayName (bool dis = false)
- {
- m_use_type_display_name = dis;
- return *this;
- }
-
- DumpValueObjectOptions&
- SetAllowOnelinerMode (bool oneliner = false)
- {
- m_allow_oneliner_mode = oneliner;
- return *this;
- }
-
-};
+namespace lldb_private {
class ValueObjectPrinter
{
@@ -262,14 +45,19 @@ public:
PrintValueObject ();
protected:
+ typedef std::set<uint64_t> InstancePointersSet;
+ typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
+ InstancePointersSetSP m_printed_instance_pointers;
+
// only this class (and subclasses, if any) should ever be concerned with
// the depth mechanism
ValueObjectPrinter (ValueObject* valobj,
Stream* s,
const DumpValueObjectOptions& options,
- uint32_t ptr_depth,
- uint32_t curr_depth);
+ const DumpValueObjectOptions::PointerDepth& ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
// we should actually be using delegating constructors here
// but some versions of GCC still have trouble with those
@@ -277,8 +65,9 @@ protected:
Init (ValueObject* valobj,
Stream* s,
const DumpValueObjectOptions& options,
- uint32_t ptr_depth,
- uint32_t curr_depth);
+ const DumpValueObjectOptions::PointerDepth& ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
bool
GetMostSpecializedValue ();
@@ -299,12 +88,18 @@ protected:
IsNil ();
bool
+ IsUninitialized ();
+
+ bool
IsPtr ();
bool
IsRef ();
bool
+ IsInstancePointer ();
+
+ bool
IsAggregate ();
bool
@@ -316,17 +111,18 @@ protected:
bool
PrintLocationIfNeeded ();
- bool
- PrintTypeIfNeeded ();
+ void
+ PrintDecl ();
bool
- PrintNameIfNeeded (bool show_type);
+ CheckScopeIfNeeded ();
bool
- CheckScopeIfNeeded ();
+ ShouldPrintEmptyBrackets (bool value_printed,
+ bool summary_printed);
TypeSummaryImpl*
- GetSummaryFormatter ();
+ GetSummaryFormatter (bool null_if_omitted = true);
void
GetValueSummaryError (std::string& value,
@@ -343,7 +139,10 @@ protected:
bool
ShouldPrintChildren (bool is_failed_description,
- uint32_t& curr_ptr_depth);
+ DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
+
+ bool
+ ShouldExpandEmptyAggregates ();
ValueObject*
GetValueObjectForChildrenGeneration ();
@@ -356,13 +155,15 @@ protected:
void
PrintChild (lldb::ValueObjectSP child_sp,
- uint32_t curr_ptr_depth);
+ const DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
uint32_t
GetMaxNumChildrenToPrint (bool& print_dotdotdot);
void
- PrintChildren (uint32_t curr_ptr_depth);
+ PrintChildren (bool value_printed,
+ bool summary_printed,
+ const DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
void
PrintChildrenIfNeeded (bool value_printed,
@@ -376,20 +177,23 @@ private:
ValueObject *m_orig_valobj;
ValueObject *m_valobj;
Stream *m_stream;
- DumpValueObjectOptions options;
+ DumpValueObjectOptions m_options;
Flags m_type_flags;
- ClangASTType m_clang_type;
- uint32_t m_ptr_depth;
+ CompilerType m_compiler_type;
+ DumpValueObjectOptions::PointerDepth m_ptr_depth;
uint32_t m_curr_depth;
LazyBool m_should_print;
LazyBool m_is_nil;
+ LazyBool m_is_uninit;
LazyBool m_is_ptr;
LazyBool m_is_ref;
LazyBool m_is_aggregate;
+ LazyBool m_is_instance_ptr;
std::pair<TypeSummaryImpl*,bool> m_summary_formatter;
std::string m_value;
std::string m_summary;
std::string m_error;
+ bool m_val_summary_ok;
std::pair<TypeValidatorResult,std::string> m_validation;
friend struct StringSummaryFormat;
diff --git a/include/lldb/DataFormatters/VectorIterator.h b/include/lldb/DataFormatters/VectorIterator.h
new file mode 100644
index 0000000000000..3d96ee4c093b9
--- /dev/null
+++ b/include/lldb/DataFormatters/VectorIterator.h
@@ -0,0 +1,53 @@
+//===-- VectorIterator.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorIterator_h_
+#define liblldb_VectorIterator_h_
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Target/ExecutionContext.h"
+
+namespace lldb_private {
+ namespace formatters
+ {
+ class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ public:
+ VectorIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp,
+ ConstString item_name);
+
+ size_t
+ CalculateNumChildren() override;
+
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx) override;
+
+ bool
+ Update() override;
+
+ bool
+ MightHaveChildren() override;
+
+ size_t
+ GetIndexOfChildWithName(const ConstString &name) override;
+
+ ~VectorIteratorSyntheticFrontEnd() override;
+
+ private:
+ ExecutionContextRef m_exe_ctx_ref;
+ ConstString m_item_name;
+ lldb::ValueObjectSP m_item_sp;
+ };
+
+ } // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CF_h_
diff --git a/include/lldb/Expression/ASTDumper.h b/include/lldb/Expression/ASTDumper.h
deleted file mode 100644
index 47f7ea460b877..0000000000000
--- a/include/lldb/Expression/ASTDumper.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//===-- ASTDumper.h ---------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ASTDumper_h_
-#define liblldb_ASTDumper_h_
-
-#include "clang/AST/DeclVisitor.h"
-#include "clang/AST/StmtVisitor.h"
-#include "clang/AST/TypeVisitor.h"
-
-#include "lldb/Core/Stream.h"
-#include "llvm/ADT/DenseSet.h"
-
-namespace lldb_private
-{
-
-class ASTDumper
-{
-public:
- ASTDumper (clang::Decl *decl);
- ASTDumper (clang::DeclContext *decl_ctx);
- ASTDumper (const clang::Type *type);
- ASTDumper (clang::QualType type);
- ASTDumper (lldb::clang_type_t type);
- ASTDumper (const ClangASTType &clang_type);
-
- const char *GetCString();
- void ToSTDERR();
- void ToLog(Log *log, const char *prefix);
- void ToStream(lldb::StreamSP &stream);
-private:
- std::string m_dump;
-};
-
-} // namespace lldb_private
-
-#endif
diff --git a/include/lldb/Expression/ASTResultSynthesizer.h b/include/lldb/Expression/ASTResultSynthesizer.h
deleted file mode 100644
index 410a862fc12a3..0000000000000
--- a/include/lldb/Expression/ASTResultSynthesizer.h
+++ /dev/null
@@ -1,184 +0,0 @@
-//===-- ASTResultSynthesizer.h ----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ASTResultSynthesizer_h_
-#define liblldb_ASTResultSynthesizer_h_
-
-#include "clang/Sema/SemaConsumer.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/TaggedASTType.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class ASTResultSynthesizer ASTResultSynthesizer.h "lldb/Expression/ASTResultSynthesizer.h"
-/// @brief Adds a result variable declaration to the ASTs for an expression.
-///
-/// Users expect the expression "i + 3" to return a result, even if a result
-/// variable wasn't specifically declared. To fulfil this requirement, LLDB adds
-/// a result variable to the expression, transforming it to
-/// "int $__lldb_expr_result = i + 3." The IR transformers ensure that the
-/// resulting variable is mapped to the right piece of memory.
-/// ASTResultSynthesizer's job is to add the variable and its initialization to
-/// the ASTs for the expression, and it does so by acting as a SemaConsumer for
-/// Clang.
-//----------------------------------------------------------------------
-class ASTResultSynthesizer : public clang::SemaConsumer
-{
-public:
- //----------------------------------------------------------------------
- /// Constructor
- ///
- /// @param[in] passthrough
- /// Since the ASTs must typically go through to the Clang code generator
- /// in order to produce LLVM IR, this SemaConsumer must allow them to
- /// pass to the next step in the chain after processing. Passthrough is
- /// the next ASTConsumer, or NULL if none is required.
- ///
- /// @param[in] target
- /// The target, which contains the persistent variable store and the
- /// AST importer.
- //----------------------------------------------------------------------
- ASTResultSynthesizer(clang::ASTConsumer *passthrough,
- Target &target);
-
- //----------------------------------------------------------------------
- /// Destructor
- //----------------------------------------------------------------------
- ~ASTResultSynthesizer();
-
- //----------------------------------------------------------------------
- /// Link this consumer with a particular AST context
- ///
- /// @param[in] Context
- /// This AST context will be used for types and identifiers, and also
- /// forwarded to the passthrough consumer, if one exists.
- //----------------------------------------------------------------------
- void Initialize(clang::ASTContext &Context);
-
- //----------------------------------------------------------------------
- /// Examine a list of Decls to find the function $__lldb_expr and
- /// transform its code
- ///
- /// @param[in] D
- /// The list of Decls to search. These may contain LinkageSpecDecls,
- /// which need to be searched recursively. That job falls to
- /// TransformTopLevelDecl.
- //----------------------------------------------------------------------
- bool HandleTopLevelDecl(clang::DeclGroupRef D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleTranslationUnit(clang::ASTContext &Ctx);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleTagDeclDefinition(clang::TagDecl *D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void CompleteTentativeDefinition(clang::VarDecl *D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleVTable(clang::CXXRecordDecl *RD);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void PrintStats();
-
- //----------------------------------------------------------------------
- /// Set the Sema object to use when performing transforms, and pass it on
- ///
- /// @param[in] S
- /// The Sema to use. Because Sema isn't externally visible, this class
- /// casts it to an Action for actual use.
- //----------------------------------------------------------------------
- void InitializeSema(clang::Sema &S);
-
- //----------------------------------------------------------------------
- /// Reset the Sema to NULL now that transformations are done
- //----------------------------------------------------------------------
- void ForgetSema();
-private:
- //----------------------------------------------------------------------
- /// Hunt the given Decl for FunctionDecls named $__lldb_expr, recursing
- /// as necessary through LinkageSpecDecls, and calling SynthesizeResult on
- /// anything that was found
- ///
- /// @param[in] D
- /// The Decl to hunt.
- //----------------------------------------------------------------------
- void TransformTopLevelDecl(clang::Decl *D);
-
- //----------------------------------------------------------------------
- /// Process an Objective-C method and produce the result variable and
- /// initialization
- ///
- /// @param[in] MethodDecl
- /// The method to process.
- //----------------------------------------------------------------------
- bool SynthesizeObjCMethodResult(clang::ObjCMethodDecl *MethodDecl);
-
- //----------------------------------------------------------------------
- /// Process a function and produce the result variable and initialization
- ///
- /// @param[in] FunDecl
- /// The function to process.
- //----------------------------------------------------------------------
- bool SynthesizeFunctionResult(clang::FunctionDecl *FunDecl);
-
- //----------------------------------------------------------------------
- /// Process a function body and produce the result variable and
- /// initialization
- ///
- /// @param[in] Body
- /// The body of the function.
- ///
- /// @param[in] DC
- /// The DeclContext of the function, into which the result variable
- /// is inserted.
- //----------------------------------------------------------------------
- bool SynthesizeBodyResult(clang::CompoundStmt *Body,
- clang::DeclContext *DC);
-
- //----------------------------------------------------------------------
- /// Given a DeclContext for a function or method, find all types
- /// declared in the context and record any persistent types found.
- ///
- /// @param[in] FunDeclCtx
- /// The context for the function to process.
- //----------------------------------------------------------------------
- void RecordPersistentTypes(clang::DeclContext *FunDeclCtx);
-
- //----------------------------------------------------------------------
- /// Given a TypeDecl, if it declares a type whose name starts with a
- /// dollar sign, register it as a pointer type in the target's scratch
- /// AST context.
- ///
- /// @param[in] Body
- /// The body of the function.
- //----------------------------------------------------------------------
- void MaybeRecordPersistentType(clang::TypeDecl *D);
-
- clang::ASTContext *m_ast_context; ///< The AST context to use for identifiers and types.
- clang::ASTConsumer *m_passthrough; ///< The ASTConsumer down the chain, for passthrough. NULL if it's a SemaConsumer.
- clang::SemaConsumer *m_passthrough_sema; ///< The SemaConsumer down the chain, for passthrough. NULL if it's an ASTConsumer.
- Target &m_target; ///< The target, which contains the persistent variable store and the
- clang::Sema *m_sema; ///< The Sema to use.
-};
-
-}
-
-#endif
diff --git a/include/lldb/Expression/ASTStructExtractor.h b/include/lldb/Expression/ASTStructExtractor.h
deleted file mode 100644
index 25193744c9e08..0000000000000
--- a/include/lldb/Expression/ASTStructExtractor.h
+++ /dev/null
@@ -1,156 +0,0 @@
-//===-- ASTStructExtractor.h ------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ASTStructExtractor_h_
-#define liblldb_ASTStructExtractor_h_
-
-#include "clang/Sema/SemaConsumer.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Expression/ClangExpressionVariable.h"
-#include "lldb/Expression/ClangFunction.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class ASTStructExtractor ASTStructExtractor.h "lldb/Expression/ASTStructExtractor.h"
-/// @brief Extracts and describes the argument structure for a wrapped function.
-///
-/// This pass integrates with ClangFunction, which calls functions with custom
-/// sets of arguments. To avoid having to implement the full calling convention
-/// for the target's architecture, ClangFunction writes a simple wrapper
-/// function that takes a pointer to an argument structure that contains room
-/// for the address of the function to be called, the values of all its
-/// arguments, and room for the function's return value.
-///
-/// The definition of this struct is itself in the body of the wrapper function,
-/// so Clang does the structure layout itself. ASTStructExtractor reads through
-/// the AST for the wrapper function and finds the struct.
-//----------------------------------------------------------------------
-class ASTStructExtractor : public clang::SemaConsumer
-{
-public:
- //----------------------------------------------------------------------
- /// Constructor
- ///
- /// @param[in] passthrough
- /// Since the ASTs must typically go through to the Clang code generator
- /// in order to produce LLVM IR, this SemaConsumer must allow them to
- /// pass to the next step in the chain after processing. Passthrough is
- /// the next ASTConsumer, or NULL if none is required.
- ///
- /// @param[in] struct_name
- /// The name of the structure to extract from the wrapper function.
- ///
- /// @param[in] function
- /// The caller object whose members should be populated with information
- /// about the argument struct. ClangFunction friends ASTStructExtractor
- /// for this purpose.
- //----------------------------------------------------------------------
- ASTStructExtractor(clang::ASTConsumer *passthrough,
- const char *struct_name,
- ClangFunction &function);
-
- //----------------------------------------------------------------------
- /// Destructor
- //----------------------------------------------------------------------
- virtual ~ASTStructExtractor();
-
- //----------------------------------------------------------------------
- /// Link this consumer with a particular AST context
- ///
- /// @param[in] Context
- /// This AST context will be used for types and identifiers, and also
- /// forwarded to the passthrough consumer, if one exists.
- //----------------------------------------------------------------------
- void Initialize(clang::ASTContext &Context);
-
- //----------------------------------------------------------------------
- /// Examine a list of Decls to find the function $__lldb_expr and
- /// transform its code
- ///
- /// @param[in] D
- /// The list of Decls to search. These may contain LinkageSpecDecls,
- /// which need to be searched recursively. That job falls to
- /// TransformTopLevelDecl.
- //----------------------------------------------------------------------
- bool HandleTopLevelDecl(clang::DeclGroupRef D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleTranslationUnit(clang::ASTContext &Ctx);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleTagDeclDefinition(clang::TagDecl *D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void CompleteTentativeDefinition(clang::VarDecl *D);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void HandleVTable(clang::CXXRecordDecl *RD);
-
- //----------------------------------------------------------------------
- /// Passthrough stub
- //----------------------------------------------------------------------
- void PrintStats();
-
- //----------------------------------------------------------------------
- /// Set the Sema object to use when performing transforms, and pass it on
- ///
- /// @param[in] S
- /// The Sema to use. Because Sema isn't externally visible, this class
- /// casts it to an Action for actual use.
- //----------------------------------------------------------------------
- void InitializeSema(clang::Sema &S);
-
- //----------------------------------------------------------------------
- /// Reset the Sema to NULL now that transformations are done
- //----------------------------------------------------------------------
- void ForgetSema();
-private:
- //----------------------------------------------------------------------
- /// Hunt the given FunctionDecl for the argument struct and place
- /// information about it into m_function
- ///
- /// @param[in] F
- /// The FunctionDecl to hunt.
- //----------------------------------------------------------------------
- void
- ExtractFromFunctionDecl(clang::FunctionDecl* F);
-
- //----------------------------------------------------------------------
- /// Hunt the given Decl for FunctionDecls named the same as the wrapper
- /// function name, recursing as necessary through LinkageSpecDecls, and
- /// calling ExtractFromFunctionDecl on anything that was found
- ///
- /// @param[in] D
- /// The Decl to hunt.
- //----------------------------------------------------------------------
- void
- ExtractFromTopLevelDecl(clang::Decl* D);
-
- clang::ASTContext *m_ast_context; ///< The AST context to use for identifiers and types.
- clang::ASTConsumer *m_passthrough; ///< The ASTConsumer down the chain, for passthrough. NULL if it's a SemaConsumer.
- clang::SemaConsumer *m_passthrough_sema; ///< The SemaConsumer down the chain, for passthrough. NULL if it's an ASTConsumer.
- clang::Sema *m_sema; ///< The Sema to use.
- clang::Action *m_action; ///< The Sema to use, cast to an Action so it's usable.
-
- ClangFunction &m_function; ///< The function to populate with information about the argument structure.
- std::string m_struct_name; ///< The name of the structure to extract.
-};
-
-}
-
-#endif
diff --git a/include/lldb/Expression/ClangASTSource.h b/include/lldb/Expression/ClangASTSource.h
deleted file mode 100644
index 46140d2f2e647..0000000000000
--- a/include/lldb/Expression/ClangASTSource.h
+++ /dev/null
@@ -1,525 +0,0 @@
-//===-- ClangASTSource.h ----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangASTSource_h_
-#define liblldb_ClangASTSource_h_
-
-#include <set>
-
-#include "clang/Basic/IdentifierTable.h"
-#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
-#include "lldb/Symbol/ClangASTImporter.h"
-#include "lldb/Symbol/ClangASTType.h"
-#include "lldb/Target/Target.h"
-
-#include "llvm/ADT/SmallSet.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class ClangASTSource ClangASTSource.h "lldb/Expression/ClangASTSource.h"
-/// @brief Provider for named objects defined in the debug info for Clang
-///
-/// As Clang parses an expression, it may encounter names that are not
-/// defined inside the expression, including variables, functions, and
-/// types. Clang knows the name it is looking for, but nothing else.
-/// The ExternalSemaSource class provides Decls (VarDecl, FunDecl, TypeDecl)
-/// to Clang for these names, consulting the ClangExpressionDeclMap to do
-/// the actual lookups.
-//----------------------------------------------------------------------
-class ClangASTSource :
- public ClangExternalASTSourceCommon,
- public ClangASTImporter::MapCompleter
-{
-public:
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// Initializes class variables.
- ///
- /// @param[in] declMap
- /// A reference to the LLDB object that handles entity lookup.
- //------------------------------------------------------------------
- ClangASTSource (const lldb::TargetSP &target) :
- m_import_in_progress (false),
- m_lookups_enabled (false),
- m_target (target),
- m_ast_context (NULL),
- m_active_lexical_decls (),
- m_active_lookups ()
- {
- m_ast_importer = m_target->GetClangASTImporter();
- }
-
- //------------------------------------------------------------------
- /// Destructor
- //------------------------------------------------------------------
- ~ClangASTSource();
-
- //------------------------------------------------------------------
- /// Interface stubs.
- //------------------------------------------------------------------
- clang::Decl *GetExternalDecl (uint32_t) override { return NULL; }
- clang::Stmt *GetExternalDeclStmt (uint64_t) override { return NULL; }
- clang::Selector GetExternalSelector (uint32_t) override { return clang::Selector(); }
- uint32_t GetNumExternalSelectors () override { return 0; }
- clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset) override
- { return NULL; }
- void MaterializeVisibleDecls (const clang::DeclContext *DC)
- { return; }
-
- void InstallASTContext (clang::ASTContext *ast_context)
- {
- m_ast_context = ast_context;
- m_ast_importer->InstallMapCompleter(ast_context, *this);
- }
-
- //
- // APIs for ExternalASTSource
- //
-
- //------------------------------------------------------------------
- /// Look up all Decls that match a particular name. Only handles
- /// Identifiers and DeclContexts that are either NamespaceDecls or
- /// TranslationUnitDecls. Calls SetExternalVisibleDeclsForName with
- /// the result.
- ///
- /// The work for this function is done by
- /// void FindExternalVisibleDecls (NameSearchContext &);
- ///
- /// @param[in] DC
- /// The DeclContext to register the found Decls in.
- ///
- /// @param[in] Name
- /// The name to find entries for.
- ///
- /// @return
- /// Whatever SetExternalVisibleDeclsForName returns.
- //------------------------------------------------------------------
- bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override;
-
- //------------------------------------------------------------------
- /// Enumerate all Decls in a given lexical context.
- ///
- /// @param[in] DC
- /// The DeclContext being searched.
- ///
- /// @param[in] isKindWeWant
- /// If non-NULL, a callback function that returns true given the
- /// DeclKinds of desired Decls, and false otherwise.
- ///
- /// @param[in] Decls
- /// A vector that is filled in with matching Decls.
- //------------------------------------------------------------------
- clang::ExternalLoadResult FindExternalLexicalDecls(const clang::DeclContext *DC,
- bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &Decls) override;
-
- //------------------------------------------------------------------
- /// Specify the layout of the contents of a RecordDecl.
- ///
- /// @param[in] Record
- /// The record (in the parser's AST context) that needs to be
- /// laid out.
- ///
- /// @param[out] Size
- /// The total size of the record in bits.
- ///
- /// @param[out] Alignment
- /// The alignment of the record in bits.
- ///
- /// @param[in] FieldOffsets
- /// A map that must be populated with pairs of the record's
- /// fields (in the parser's AST context) and their offsets
- /// (measured in bits).
- ///
- /// @param[in] BaseOffsets
- /// A map that must be populated with pairs of the record's
- /// C++ concrete base classes (in the parser's AST context,
- /// and only if the record is a CXXRecordDecl and has base
- /// classes) and their offsets (measured in bytes).
- ///
- /// @param[in] VirtualBaseOffsets
- /// A map that must be populated with pairs of the record's
- /// C++ virtual base classes (in the parser's AST context,
- /// and only if the record is a CXXRecordDecl and has base
- /// classes) and their offsets (measured in bytes).
- ///
- /// @return
- /// True <=> the layout is valid.
- //-----------------------------------------------------------------
- bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
-
- //------------------------------------------------------------------
- /// Complete a TagDecl.
- ///
- /// @param[in] Tag
- /// The Decl to be completed in place.
- //------------------------------------------------------------------
- void CompleteType(clang::TagDecl *Tag) override;
-
- //------------------------------------------------------------------
- /// Complete an ObjCInterfaceDecl.
- ///
- /// @param[in] Class
- /// The Decl to be completed in place.
- //------------------------------------------------------------------
- void CompleteType(clang::ObjCInterfaceDecl *Class) override;
-
- //------------------------------------------------------------------
- /// Called on entering a translation unit. Tells Clang by calling
- /// setHasExternalVisibleStorage() and setHasExternalLexicalStorage()
- /// that this object has something to say about undefined names.
- ///
- /// @param[in] ASTConsumer
- /// Unused.
- //------------------------------------------------------------------
- void StartTranslationUnit(clang::ASTConsumer *Consumer) override;
-
- //
- // APIs for NamespaceMapCompleter
- //
-
- //------------------------------------------------------------------
- /// Look up the modules containing a given namespace and put the
- /// appropriate entries in the namespace map.
- ///
- /// @param[in] namespace_map
- /// The map to be completed.
- ///
- /// @param[in] name
- /// The name of the namespace to be found.
- ///
- /// @param[in] parent_map
- /// The map for the namespace's parent namespace, if there is
- /// one.
- //------------------------------------------------------------------
- void CompleteNamespaceMap(ClangASTImporter::NamespaceMapSP &namespace_map, const ConstString &name,
- ClangASTImporter::NamespaceMapSP &parent_map) const override;
-
- //
- // Helper APIs
- //
-
- clang::NamespaceDecl *
- AddNamespace (NameSearchContext &context,
- ClangASTImporter::NamespaceMapSP &namespace_decls);
-
- //------------------------------------------------------------------
- /// The worker function for FindExternalVisibleDeclsByName.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when filing results.
- //------------------------------------------------------------------
- virtual void FindExternalVisibleDecls (NameSearchContext &context);
-
- void SetImportInProgress (bool import_in_progress) { m_import_in_progress = import_in_progress; }
- bool GetImportInProgress () { return m_import_in_progress; }
-
- void SetLookupsEnabled (bool lookups_enabled) { m_lookups_enabled = lookups_enabled; }
- bool GetLookupsEnabled () { return m_lookups_enabled; }
-
- //----------------------------------------------------------------------
- /// @class ClangASTSourceProxy ClangASTSource.h "lldb/Expression/ClangASTSource.h"
- /// @brief Proxy for ClangASTSource
- ///
- /// Clang AST contexts like to own their AST sources, so this is a
- /// state-free proxy object.
- //----------------------------------------------------------------------
- class ClangASTSourceProxy : public ClangExternalASTSourceCommon
- {
- public:
- ClangASTSourceProxy (ClangASTSource &original) :
- m_original(original)
- {
- }
-
- bool
- FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override
- {
- return m_original.FindExternalVisibleDeclsByName(DC, Name);
- }
-
- clang::ExternalLoadResult
- FindExternalLexicalDecls(const clang::DeclContext *DC, bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &Decls) override
- {
- return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls);
- }
-
- void
- CompleteType(clang::TagDecl *Tag) override
- {
- return m_original.CompleteType(Tag);
- }
-
- void
- CompleteType(clang::ObjCInterfaceDecl *Class) override
- {
- return m_original.CompleteType(Class);
- }
-
- bool
- layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override
- {
- return m_original.layoutRecordType(Record,
- Size,
- Alignment,
- FieldOffsets,
- BaseOffsets,
- VirtualBaseOffsets);
- }
-
- void
- StartTranslationUnit(clang::ASTConsumer *Consumer) override
- {
- return m_original.StartTranslationUnit(Consumer);
- }
-
- ClangASTMetadata *
- GetMetadata(const void * object)
- {
- return m_original.GetMetadata(object);
- }
-
- void
- SetMetadata(const void * object, ClangASTMetadata &metadata)
- {
- return m_original.SetMetadata(object, metadata);
- }
-
- bool
- HasMetadata(const void * object)
- {
- return m_original.HasMetadata(object);
- }
- private:
- ClangASTSource &m_original;
- };
-
- clang::ExternalASTSource *CreateProxy()
- {
- return new ClangASTSourceProxy(*this);
- }
-
-protected:
- //------------------------------------------------------------------
- /// Look for the complete version of an Objective-C interface, and
- /// return it if found.
- ///
- /// @param[in] interface_decl
- /// An ObjCInterfaceDecl that may not be the complete one.
- ///
- /// @return
- /// NULL if the complete interface couldn't be found;
- /// the complete interface otherwise.
- //------------------------------------------------------------------
- clang::ObjCInterfaceDecl *
- GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_decl);
-
- //------------------------------------------------------------------
- /// Find all entities matching a given name in a given module,
- /// using a NameSearchContext to make Decls for them.
- ///
- /// @param[in] context
- /// The NameSearchContext that can construct Decls for this name.
- ///
- /// @param[in] module
- /// If non-NULL, the module to query.
- ///
- /// @param[in] namespace_decl
- /// If valid and module is non-NULL, the parent namespace.
- ///
- /// @param[in] current_id
- /// The ID for the current FindExternalVisibleDecls invocation,
- /// for logging purposes.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- void
- FindExternalVisibleDecls (NameSearchContext &context,
- lldb::ModuleSP module,
- ClangNamespaceDecl &namespace_decl,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Find all Objective-C methods matching a given selector.
- ///
- /// @param[in] context
- /// The NameSearchContext that can construct Decls for this name.
- /// Its m_decl_name contains the selector and its m_decl_context
- /// is the containing object.
- //------------------------------------------------------------------
- void
- FindObjCMethodDecls (NameSearchContext &context);
-
- //------------------------------------------------------------------
- /// Find all Objective-C properties and ivars with a given name.
- ///
- /// @param[in] context
- /// The NameSearchContext that can construct Decls for this name.
- /// Its m_decl_name contains the name and its m_decl_context
- /// is the containing object.
- //------------------------------------------------------------------
- void
- FindObjCPropertyAndIvarDecls (NameSearchContext &context);
-
- //------------------------------------------------------------------
- /// A wrapper for ClangASTContext::CopyType that sets a flag that
- /// indicates that we should not respond to queries during import.
- ///
- /// @param[in] dest_context
- /// The target AST context, typically the parser's AST context.
- ///
- /// @param[in] source_context
- /// The source AST context, typically the AST context of whatever
- /// symbol file the type was found in.
- ///
- /// @param[in] clang_type
- /// The source type.
- ///
- /// @return
- /// The imported type.
- //------------------------------------------------------------------
- ClangASTType
- GuardedCopyType (const ClangASTType &src_type);
-
- friend struct NameSearchContext;
-
- bool m_import_in_progress;
- bool m_lookups_enabled;
-
- const lldb::TargetSP m_target; ///< The target to use in finding variables and types.
- clang::ASTContext *m_ast_context; ///< The AST context requests are coming in for.
- ClangASTImporter *m_ast_importer; ///< The target's AST importer.
- std::set<const clang::Decl *> m_active_lexical_decls;
- std::set<const char *> m_active_lookups;
-};
-
-//----------------------------------------------------------------------
-/// @class NameSearchContext ClangASTSource.h "lldb/Expression/ClangASTSource.h"
-/// @brief Container for all objects relevant to a single name lookup
-///
-/// LLDB needs to create Decls for entities it finds. This class communicates
-/// what name is being searched for and provides helper functions to construct
-/// Decls given appropriate type information.
-//----------------------------------------------------------------------
-struct NameSearchContext {
- ClangASTSource &m_ast_source; ///< The AST source making the request
- llvm::SmallVectorImpl<clang::NamedDecl*> &m_decls; ///< The list of declarations already constructed
- ClangASTImporter::NamespaceMapSP m_namespace_map; ///< The mapping of all namespaces found for this request back to their modules
- const clang::DeclarationName &m_decl_name; ///< The name being looked for
- const clang::DeclContext *m_decl_context; ///< The DeclContext to put declarations into
- llvm::SmallSet <ClangASTType, 5> m_function_types; ///< All the types of functions that have been reported, so we don't report conflicts
-
- struct {
- bool variable : 1;
- bool function_with_type_info : 1;
- bool function : 1;
- } m_found;
-
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// Initializes class variables.
- ///
- /// @param[in] astSource
- /// A reference to the AST source making a request.
- ///
- /// @param[in] decls
- /// A reference to a list into which new Decls will be placed. This
- /// list is typically empty when the function is called.
- ///
- /// @param[in] name
- /// The name being searched for (always an Identifier).
- ///
- /// @param[in] dc
- /// The DeclContext to register Decls in.
- //------------------------------------------------------------------
- NameSearchContext (ClangASTSource &astSource,
- llvm::SmallVectorImpl<clang::NamedDecl*> &decls,
- clang::DeclarationName &name,
- const clang::DeclContext *dc) :
- m_ast_source(astSource),
- m_decls(decls),
- m_decl_name(name),
- m_decl_context(dc)
- {
- memset(&m_found, 0, sizeof(m_found));
- }
-
- //------------------------------------------------------------------
- /// Create a VarDecl with the name being searched for and the provided
- /// type and register it in the right places.
- ///
- /// @param[in] type
- /// The opaque QualType for the VarDecl being registered.
- //------------------------------------------------------------------
- clang::NamedDecl *AddVarDecl(const ClangASTType &type);
-
- //------------------------------------------------------------------
- /// Create a FunDecl with the name being searched for and the provided
- /// type and register it in the right places.
- ///
- /// @param[in] type
- /// The opaque QualType for the FunDecl being registered.
- ///
- /// @param[in] extern_c
- /// If true, build an extern "C" linkage specification for this.
- //------------------------------------------------------------------
- clang::NamedDecl *AddFunDecl(const ClangASTType &type,
- bool extern_c = false);
-
- //------------------------------------------------------------------
- /// Create a FunDecl with the name being searched for and generic
- /// type (i.e. intptr_t NAME_GOES_HERE(...)) and register it in the
- /// right places.
- //------------------------------------------------------------------
- clang::NamedDecl *AddGenericFunDecl();
-
- //------------------------------------------------------------------
- /// Create a TypeDecl with the name being searched for and the provided
- /// type and register it in the right places.
- ///
- /// @param[in] type
- /// The opaque QualType for the TypeDecl being registered.
- //------------------------------------------------------------------
- clang::NamedDecl *AddTypeDecl(const ClangASTType &clang_type);
-
-
- //------------------------------------------------------------------
- /// Add Decls from the provided DeclContextLookupResult to the list
- /// of results.
- ///
- /// @param[in] result
- /// The DeclContextLookupResult, usually returned as the result
- /// of querying a DeclContext.
- //------------------------------------------------------------------
- void AddLookupResult (clang::DeclContextLookupResult result);
-
- //------------------------------------------------------------------
- /// Add a NamedDecl to the list of results.
- ///
- /// @param[in] decl
- /// The NamedDecl, usually returned as the result
- /// of querying a DeclContext.
- //------------------------------------------------------------------
- void AddNamedDecl (clang::NamedDecl *decl);
-};
-
-}
-
-#endif
diff --git a/include/lldb/Expression/ClangExpressionDeclMap.h b/include/lldb/Expression/ClangExpressionDeclMap.h
deleted file mode 100644
index f24500ab52375..0000000000000
--- a/include/lldb/Expression/ClangExpressionDeclMap.h
+++ /dev/null
@@ -1,705 +0,0 @@
-//===-- ClangExpressionDeclMap.h --------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangExpressionDeclMap_h_
-#define liblldb_ClangExpressionDeclMap_h_
-
-// C Includes
-#include <signal.h>
-#include <stdint.h>
-
-// C++ Includes
-#include <vector>
-
-// Other libraries and framework includes
-// Project includes
-#include "llvm/ADT/APInt.h"
-#include "llvm/ADT/DenseMap.h"
-#include "clang/AST/Decl.h"
-#include "lldb/lldb-public.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Core/Value.h"
-#include "lldb/Expression/ClangASTSource.h"
-#include "lldb/Expression/ClangExpressionVariable.h"
-#include "lldb/Expression/Materializer.h"
-#include "lldb/Symbol/TaggedASTType.h"
-#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/ExecutionContext.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class ClangExpressionDeclMap ClangExpressionDeclMap.h "lldb/Expression/ClangExpressionDeclMap.h"
-/// @brief Manages named entities that are defined in LLDB's debug information.
-///
-/// The Clang parser uses the ClangASTSource as an interface to request named
-/// entities from outside an expression. The ClangASTSource reports back, listing
-/// all possible objects corresponding to a particular name. But it in turn
-/// relies on ClangExpressionDeclMap, which performs several important functions.
-///
-/// First, it records what variables and functions were looked up and what Decls
-/// were returned for them.
-///
-/// Second, it constructs a struct on behalf of IRForTarget, recording which
-/// variables should be placed where and relaying this information back so that
-/// IRForTarget can generate context-independent code.
-///
-/// Third, it "materializes" this struct on behalf of the expression command,
-/// finding the current values of each variable and placing them into the
-/// struct so that it can be passed to the JITted version of the IR.
-///
-/// Fourth and finally, it "dematerializes" the struct after the JITted code has
-/// has executed, placing the new values back where it found the old ones.
-//----------------------------------------------------------------------
-class ClangExpressionDeclMap :
- public ClangASTSource
-{
-public:
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// Initializes class variables.
- ///
- /// @param[in] keep_result_in_memory
- /// If true, inhibits the normal deallocation of the memory for
- /// the result persistent variable, and instead marks the variable
- /// as persisting.
- ///
- /// @param[in] exe_ctx
- /// The execution context to use when parsing.
- //------------------------------------------------------------------
- ClangExpressionDeclMap (bool keep_result_in_memory,
- ExecutionContext &exe_ctx);
-
- //------------------------------------------------------------------
- /// Destructor
- //------------------------------------------------------------------
- ~ClangExpressionDeclMap ();
-
- //------------------------------------------------------------------
- /// Enable the state needed for parsing and IR transformation.
- ///
- /// @param[in] exe_ctx
- /// The execution context to use when finding types for variables.
- /// Also used to find a "scratch" AST context to store result types.
- ///
- /// @param[in] materializer
- /// If non-NULL, the materializer to populate with information about
- /// the variables to use
- ///
- /// @return
- /// True if parsing is possible; false if it is unsafe to continue.
- //------------------------------------------------------------------
- bool
- WillParse (ExecutionContext &exe_ctx,
- Materializer *materializer);
-
- void
- InstallCodeGenerator (clang::ASTConsumer *code_gen);
-
- //------------------------------------------------------------------
- /// [Used by ClangExpressionParser] For each variable that had an unknown
- /// type at the beginning of parsing, determine its final type now.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- ResolveUnknownTypes();
-
- //------------------------------------------------------------------
- /// Disable the state needed for parsing and IR transformation.
- //------------------------------------------------------------------
- void
- DidParse ();
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Add a variable to the list of persistent
- /// variables for the process.
- ///
- /// @param[in] decl
- /// The Clang declaration for the persistent variable, used for
- /// lookup during parsing.
- ///
- /// @param[in] name
- /// The name of the persistent variable, usually $something.
- ///
- /// @param[in] type
- /// The type of the variable, in the Clang parser's context.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- AddPersistentVariable (const clang::NamedDecl *decl,
- const ConstString &name,
- TypeFromParser type,
- bool is_result,
- bool is_lvalue);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Add a variable to the struct that needs to
- /// be materialized each time the expression runs.
- ///
- /// @param[in] decl
- /// The Clang declaration for the variable.
- ///
- /// @param[in] name
- /// The name of the variable.
- ///
- /// @param[in] value
- /// The LLVM IR value for this variable.
- ///
- /// @param[in] size
- /// The size of the variable in bytes.
- ///
- /// @param[in] alignment
- /// The required alignment of the variable in bytes.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- AddValueToStruct (const clang::NamedDecl *decl,
- const ConstString &name,
- llvm::Value *value,
- size_t size,
- lldb::offset_t alignment);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Finalize the struct, laying out the position
- /// of each object in it.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- DoStructLayout ();
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Get general information about the laid-out
- /// struct after DoStructLayout() has been called.
- ///
- /// @param[out] num_elements
- /// The number of elements in the struct.
- ///
- /// @param[out] size
- /// The size of the struct, in bytes.
- ///
- /// @param[out] alignment
- /// The alignment of the struct, in bytes.
- ///
- /// @return
- /// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
- bool
- GetStructInfo (uint32_t &num_elements,
- size_t &size,
- lldb::offset_t &alignment);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Get specific information about one field
- /// of the laid-out struct after DoStructLayout() has been called.
- ///
- /// @param[out] decl
- /// The parsed Decl for the field, as generated by ClangASTSource
- /// on ClangExpressionDeclMap's behalf. In the case of the result
- /// value, this will have the name $__lldb_result even if the
- /// result value ends up having the name $1. This is an
- /// implementation detail of IRForTarget.
- ///
- /// @param[out] value
- /// The IR value for the field (usually a GlobalVariable). In
- /// the case of the result value, this will have the correct
- /// name ($1, for instance). This is an implementation detail
- /// of IRForTarget.
- ///
- /// @param[out] offset
- /// The offset of the field from the beginning of the struct.
- /// As long as the struct is aligned according to its required
- /// alignment, this offset will align the field correctly.
- ///
- /// @param[out] name
- /// The name of the field as used in materialization.
- ///
- /// @param[in] index
- /// The index of the field about which information is requested.
- ///
- /// @return
- /// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
- bool
- GetStructElement (const clang::NamedDecl *&decl,
- llvm::Value *&value,
- lldb::offset_t &offset,
- ConstString &name,
- uint32_t index);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Get information about a function given its
- /// Decl.
- ///
- /// @param[in] decl
- /// The parsed Decl for the Function, as generated by ClangASTSource
- /// on ClangExpressionDeclMap's behalf.
- ///
- /// @param[out] ptr
- /// The absolute address of the function in the target.
- ///
- /// @return
- /// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
- bool
- GetFunctionInfo (const clang::NamedDecl *decl,
- uint64_t &ptr);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Get the address of a function given nothing
- /// but its name. Some functions are needed but didn't get Decls made
- /// during parsing -- specifically, sel_registerName is never called
- /// in the generated IR but we need to call it nonetheless.
- ///
- /// @param[in] name
- /// The name of the function.
- ///
- /// @param[out] ptr
- /// The absolute address of the function in the target.
- ///
- /// @return
- /// True if the address could be retrieved; false otherwise.
- //------------------------------------------------------------------
- bool
- GetFunctionAddress (const ConstString &name,
- uint64_t &ptr);
-
- //------------------------------------------------------------------
- /// [Used by IRForTarget] Get the address of a symbol given nothing
- /// but its name.
- ///
- /// @param[in] target
- /// The target to find the symbol in. If not provided,
- /// then the current parsing context's Target.
- ///
- /// @param[in] process
- /// The process to use. For Objective-C symbols, the process's
- /// Objective-C language runtime may be queried if the process
- /// is non-NULL.
- ///
- /// @param[in] name
- /// The name of the symbol.
- ///
- /// @param[in] module
- /// The module to limit the search to. This can be NULL
- ///
- /// @return
- /// Valid load address for the symbol
- //------------------------------------------------------------------
- lldb::addr_t
- GetSymbolAddress (Target &target,
- Process *process,
- const ConstString &name,
- lldb::SymbolType symbol_type,
- Module *module = NULL);
-
- lldb::addr_t
- GetSymbolAddress (const ConstString &name,
- lldb::SymbolType symbol_type);
-
- //------------------------------------------------------------------
- /// [Used by IRInterpreter] Get basic target information.
- ///
- /// @param[out] byte_order
- /// The byte order of the target.
- ///
- /// @param[out] address_byte_size
- /// The size of a pointer in bytes.
- ///
- /// @return
- /// True if the information could be determined; false
- /// otherwise.
- //------------------------------------------------------------------
- struct TargetInfo
- {
- lldb::ByteOrder byte_order;
- size_t address_byte_size;
-
- TargetInfo() :
- byte_order(lldb::eByteOrderInvalid),
- address_byte_size(0)
- {
- }
-
- bool IsValid()
- {
- return (byte_order != lldb::eByteOrderInvalid &&
- address_byte_size != 0);
- }
- };
- TargetInfo GetTargetInfo();
-
- //------------------------------------------------------------------
- /// [Used by ClangASTSource] Find all entities matching a given name,
- /// using a NameSearchContext to make Decls for them.
- ///
- /// @param[in] context
- /// The NameSearchContext that can construct Decls for this name.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- void
- FindExternalVisibleDecls (NameSearchContext &context);
-
- //------------------------------------------------------------------
- /// Find all entities matching a given name in a given module/namespace,
- /// using a NameSearchContext to make Decls for them.
- ///
- /// @param[in] context
- /// The NameSearchContext that can construct Decls for this name.
- ///
- /// @param[in] module
- /// If non-NULL, the module to query.
- ///
- /// @param[in] namespace_decl
- /// If valid and module is non-NULL, the parent namespace.
- ///
- /// @param[in] name
- /// The name as a plain C string. The NameSearchContext contains
- /// a DeclarationName for the name so at first the name may seem
- /// redundant, but ClangExpressionDeclMap operates in RTTI land so
- /// it can't access DeclarationName.
- ///
- /// @param[in] current_id
- /// The ID for the current FindExternalVisibleDecls invocation,
- /// for logging purposes.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- void
- FindExternalVisibleDecls (NameSearchContext &context,
- lldb::ModuleSP module,
- ClangNamespaceDecl &namespace_decl,
- unsigned int current_id);
-private:
- ClangExpressionVariableList m_found_entities; ///< All entities that were looked up for the parser.
- ClangExpressionVariableList m_struct_members; ///< All entities that need to be placed in the struct.
- bool m_keep_result_in_memory; ///< True if result persistent variables generated by this expression should stay in memory.
-
- //----------------------------------------------------------------------
- /// The following values should not live beyond parsing
- //----------------------------------------------------------------------
- class ParserVars
- {
- public:
- ParserVars(ClangExpressionDeclMap &decl_map) :
- m_decl_map(decl_map)
- {
- }
-
- Target *
- GetTarget()
- {
- if (m_exe_ctx.GetTargetPtr())
- return m_exe_ctx.GetTargetPtr();
- else if (m_sym_ctx.target_sp)
- m_sym_ctx.target_sp.get();
- return NULL;
- }
-
- ExecutionContext m_exe_ctx; ///< The execution context to use when parsing.
- SymbolContext m_sym_ctx; ///< The symbol context to use in finding variables and types.
- ClangPersistentVariables *m_persistent_vars = nullptr; ///< The persistent variables for the process.
- bool m_enable_lookups = false; ///< Set to true during parsing if we have found the first "$__lldb" name.
- TargetInfo m_target_info; ///< Basic information about the target.
- Materializer *m_materializer = nullptr; ///< If non-NULL, the materializer to use when reporting used variables.
- clang::ASTConsumer *m_code_gen = nullptr; ///< If non-NULL, a code generator that receives new top-level functions.
- private:
- ClangExpressionDeclMap &m_decl_map;
- DISALLOW_COPY_AND_ASSIGN (ParserVars);
- };
-
- std::unique_ptr<ParserVars> m_parser_vars;
-
- //----------------------------------------------------------------------
- /// Activate parser-specific variables
- //----------------------------------------------------------------------
- void
- EnableParserVars()
- {
- if (!m_parser_vars.get())
- m_parser_vars.reset(new ParserVars(*this));
- }
-
- //----------------------------------------------------------------------
- /// Deallocate parser-specific variables
- //----------------------------------------------------------------------
- void
- DisableParserVars()
- {
- m_parser_vars.reset();
- }
-
- //----------------------------------------------------------------------
- /// The following values contain layout information for the materialized
- /// struct, but are not specific to a single materialization
- //----------------------------------------------------------------------
- struct StructVars {
- StructVars() :
- m_struct_alignment(0),
- m_struct_size(0),
- m_struct_laid_out(false),
- m_result_name(),
- m_object_pointer_type(NULL, NULL)
- {
- }
-
- lldb::offset_t m_struct_alignment; ///< The alignment of the struct in bytes.
- size_t m_struct_size; ///< The size of the struct in bytes.
- bool m_struct_laid_out; ///< True if the struct has been laid out and the layout is valid (that is, no new fields have been added since).
- ConstString m_result_name; ///< The name of the result variable ($1, for example)
- TypeFromUser m_object_pointer_type; ///< The type of the "this" variable, if one exists
- };
-
- std::unique_ptr<StructVars> m_struct_vars;
-
- //----------------------------------------------------------------------
- /// Activate struct variables
- //----------------------------------------------------------------------
- void
- EnableStructVars()
- {
- if (!m_struct_vars.get())
- m_struct_vars.reset(new struct StructVars);
- }
-
- //----------------------------------------------------------------------
- /// Deallocate struct variables
- //----------------------------------------------------------------------
- void
- DisableStructVars()
- {
- m_struct_vars.reset();
- }
-
- //----------------------------------------------------------------------
- /// Get this parser's ID for use in extracting parser- and JIT-specific
- /// data from persistent variables.
- //----------------------------------------------------------------------
- uint64_t
- GetParserID()
- {
- return (uint64_t)this;
- }
-
- //------------------------------------------------------------------
- /// Given a target, find a data symbol that has the given name.
- ///
- /// @param[in] target
- /// The target to use as the basis for the search.
- ///
- /// @param[in] name
- /// The name as a plain C string.
- ///
- /// @param[in] module
- /// The module to limit the search to. This can be NULL
- ///
- /// @return
- /// The LLDB Symbol found, or NULL if none was found.
- //------------------------------------------------------------------
- const Symbol *
- FindGlobalDataSymbol (Target &target,
- const ConstString &name,
- Module *module = NULL);
-
- //------------------------------------------------------------------
- /// Given a target, find a variable that matches the given name and
- /// type.
- ///
- /// @param[in] target
- /// The target to use as a basis for finding the variable.
- ///
- /// @param[in] module
- /// If non-NULL, the module to search.
- ///
- /// @param[in] name
- /// The name as a plain C string.
- ///
- /// @param[in] namespace_decl
- /// If non-NULL and module is non-NULL, the parent namespace.
- ///
- /// @param[in] type
- /// The required type for the variable. This function may be called
- /// during parsing, in which case we don't know its type; hence the
- /// default.
- ///
- /// @return
- /// The LLDB Variable found, or NULL if none was found.
- //------------------------------------------------------------------
- lldb::VariableSP
- FindGlobalVariable (Target &target,
- lldb::ModuleSP &module,
- const ConstString &name,
- ClangNamespaceDecl *namespace_decl,
- TypeFromUser *type = NULL);
-
- //------------------------------------------------------------------
- /// Get the value of a variable in a given execution context and return
- /// the associated Types if needed.
- ///
- /// @param[in] var
- /// The variable to evaluate.
- ///
- /// @param[out] var_location
- /// The variable location value to fill in
- ///
- /// @param[out] found_type
- /// The type of the found value, as it was found in the user process.
- /// This is only useful when the variable is being inspected on behalf
- /// of the parser, hence the default.
- ///
- /// @param[out] parser_type
- /// The type of the found value, as it was copied into the parser's
- /// AST context. This is only useful when the variable is being
- /// inspected on behalf of the parser, hence the default.
- ///
- /// @param[in] decl
- /// The Decl to be looked up.
- ///
- /// @return
- /// Return true if the value was successfully filled in.
- //------------------------------------------------------------------
- bool
- GetVariableValue (lldb::VariableSP &var,
- lldb_private::Value &var_location,
- TypeFromUser *found_type = NULL,
- TypeFromParser *parser_type = NULL);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given LLDB
- /// Variable, and put it in the Tuple list.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] var
- /// The LLDB Variable that needs a Decl.
- ///
- /// @param[in] valobj
- /// The LLDB ValueObject for that variable.
- //------------------------------------------------------------------
- void
- AddOneVariable (NameSearchContext &context,
- lldb::VariableSP var,
- lldb::ValueObjectSP valobj,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given
- /// persistent variable, and put it in the list of found entities.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] pvar
- /// The persistent variable that needs a Decl.
- ///
- /// @param[in] current_id
- /// The ID of the current invocation of FindExternalVisibleDecls
- /// for logging purposes.
- //------------------------------------------------------------------
- void
- AddOneVariable (NameSearchContext &context,
- lldb::ClangExpressionVariableSP &pvar_sp,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given LLDB
- /// symbol (treated as a variable), and put it in the list of found
- /// entities.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] var
- /// The LLDB Variable that needs a Decl.
- //------------------------------------------------------------------
- void
- AddOneGenericVariable (NameSearchContext &context,
- const Symbol &symbol,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given
- /// function. (Functions are not placed in the Tuple list.) Can
- /// handle both fully typed functions and generic functions.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] fun
- /// The Function that needs to be created. If non-NULL, this is
- /// a fully-typed function.
- ///
- /// @param[in] sym
- /// The Symbol that corresponds to a function that needs to be
- /// created with generic type (unitptr_t foo(...)).
- //------------------------------------------------------------------
- void
- AddOneFunction (NameSearchContext &context,
- Function *fun,
- Symbol *sym,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given
- /// register.
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] reg_info
- /// The information corresponding to that register.
- //------------------------------------------------------------------
- void
- AddOneRegister (NameSearchContext &context,
- const RegisterInfo *reg_info,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Use the NameSearchContext to generate a Decl for the given
- /// type. (Types are not placed in the Tuple list.)
- ///
- /// @param[in] context
- /// The NameSearchContext to use when constructing the Decl.
- ///
- /// @param[in] type
- /// The type that needs to be created.
- //------------------------------------------------------------------
- void
- AddOneType (NameSearchContext &context,
- TypeFromUser &type,
- unsigned int current_id);
-
- //------------------------------------------------------------------
- /// Copy a C++ class type into the parser's AST context and add a
- /// member function declaration to it for the expression.
- ///
- /// @param[in] type
- /// The type that needs to be created.
- //------------------------------------------------------------------
-
- TypeFromParser
- CopyClassType(TypeFromUser &type,
- unsigned int current_id);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangExpressionDeclMap_h_
diff --git a/include/lldb/Expression/ClangExpressionVariable.h b/include/lldb/Expression/ClangExpressionVariable.h
deleted file mode 100644
index 6c210106d51e9..0000000000000
--- a/include/lldb/Expression/ClangExpressionVariable.h
+++ /dev/null
@@ -1,456 +0,0 @@
-//===-- ClangExpressionVariable.h -------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangExpressionVariable_h_
-#define liblldb_ClangExpressionVariable_h_
-
-// C Includes
-#include <signal.h>
-#include <stdint.h>
-#include <string.h>
-
-// C++ Includes
-#include <map>
-#include <string>
-#include <vector>
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-public.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Value.h"
-#include "lldb/Symbol/TaggedASTType.h"
-
-namespace llvm {
- class Value;
-}
-
-namespace lldb_private {
-
-class ClangExpressionVariableList;
-class ValueObjectConstResult;
-
-//----------------------------------------------------------------------
-/// @class ClangExpressionVariable ClangExpressionVariable.h "lldb/Expression/ClangExpressionVariable.h"
-/// @brief Encapsulates one variable for the expression parser.
-///
-/// The expression parser uses variables in three different contexts:
-///
-/// First, it stores persistent variables along with the process for use
-/// in expressions. These persistent variables contain their own data
-/// and are typed.
-///
-/// Second, in an interpreted expression, it stores the local variables
-/// for the expression along with the expression. These variables
-/// contain their own data and are typed.
-///
-/// Third, in a JIT-compiled expression, it stores the variables that
-/// the expression needs to have materialized and dematerialized at each
-/// execution. These do not contain their own data but are named and
-/// typed.
-///
-/// This class supports all of these use cases using simple type
-/// polymorphism, and provides necessary support methods. Its interface
-/// is RTTI-neutral.
-//----------------------------------------------------------------------
-class ClangExpressionVariable
-{
-public:
- ClangExpressionVariable(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size);
-
- ClangExpressionVariable (ExecutionContextScope *exe_scope,
- Value &value,
- const ConstString &name,
- uint16_t flags = EVNone);
-
- ClangExpressionVariable(const lldb::ValueObjectSP &valobj_sp);
-
- //----------------------------------------------------------------------
- /// If the variable contains its own data, make a Value point at it.
- /// If \a exe_ctx in not NULL, the value will be resolved in with
- /// that execution context.
- ///
- /// @param[in] value
- /// The value to point at the data.
- ///
- /// @param[in] exe_ctx
- /// The execution context to use to resolve \a value.
- ///
- /// @return
- /// True on success; false otherwise (in particular, if this variable
- /// does not contain its own data).
- //----------------------------------------------------------------------
- bool
- PointValueAtData(Value &value, ExecutionContext *exe_ctx);
-
- lldb::ValueObjectSP
- GetValueObject();
-
- //----------------------------------------------------------------------
- /// The following values should not live beyond parsing
- //----------------------------------------------------------------------
- class ParserVars
- {
- public:
-
- ParserVars() :
- m_parser_type(),
- m_named_decl (NULL),
- m_llvm_value (NULL),
- m_lldb_value (),
- m_lldb_var (),
- m_lldb_sym (NULL)
- {
- }
-
- TypeFromParser m_parser_type; ///< The type of the variable according to the parser
- const clang::NamedDecl *m_named_decl; ///< The Decl corresponding to this variable
- llvm::Value *m_llvm_value; ///< The IR value corresponding to this variable; usually a GlobalValue
- lldb_private::Value m_lldb_value; ///< The value found in LLDB for this variable
- lldb::VariableSP m_lldb_var; ///< The original variable for this variable
- const lldb_private::Symbol *m_lldb_sym; ///< The original symbol for this variable, if it was a symbol
- };
-
-private:
- typedef std::map <uint64_t, ParserVars> ParserVarMap;
- ParserVarMap m_parser_vars;
-
-public:
- //----------------------------------------------------------------------
- /// Make this variable usable by the parser by allocating space for
- /// parser-specific variables
- //----------------------------------------------------------------------
- void
- EnableParserVars(uint64_t parser_id)
- {
- m_parser_vars.insert(std::make_pair(parser_id, ParserVars()));
- }
-
- //----------------------------------------------------------------------
- /// Deallocate parser-specific variables
- //----------------------------------------------------------------------
- void
- DisableParserVars(uint64_t parser_id)
- {
- m_parser_vars.erase(parser_id);
- }
-
- //----------------------------------------------------------------------
- /// Access parser-specific variables
- //----------------------------------------------------------------------
- ParserVars *
- GetParserVars(uint64_t parser_id)
- {
- ParserVarMap::iterator i = m_parser_vars.find(parser_id);
-
- if (i == m_parser_vars.end())
- return NULL;
- else
- return &i->second;
- }
-
- //----------------------------------------------------------------------
- /// The following values are valid if the variable is used by JIT code
- //----------------------------------------------------------------------
- struct JITVars {
- JITVars () :
- m_alignment (0),
- m_size (0),
- m_offset (0)
- {
- }
-
- lldb::offset_t m_alignment; ///< The required alignment of the variable, in bytes
- size_t m_size; ///< The space required for the variable, in bytes
- lldb::offset_t m_offset; ///< The offset of the variable in the struct, in bytes
- };
-
-private:
- typedef std::map <uint64_t, JITVars> JITVarMap;
- JITVarMap m_jit_vars;
-
-public:
- //----------------------------------------------------------------------
- /// Make this variable usable for materializing for the JIT by allocating
- /// space for JIT-specific variables
- //----------------------------------------------------------------------
- void
- EnableJITVars(uint64_t parser_id)
- {
- m_jit_vars.insert(std::make_pair(parser_id, JITVars()));
- }
-
- //----------------------------------------------------------------------
- /// Deallocate JIT-specific variables
- //----------------------------------------------------------------------
- void
- DisableJITVars(uint64_t parser_id)
- {
- m_jit_vars.erase(parser_id);
- }
-
- JITVars *GetJITVars(uint64_t parser_id)
- {
- JITVarMap::iterator i = m_jit_vars.find(parser_id);
-
- if (i == m_jit_vars.end())
- return NULL;
- else
- return &i->second;
- }
-
- //----------------------------------------------------------------------
- /// Return the variable's size in bytes
- //----------------------------------------------------------------------
- size_t
- GetByteSize ();
-
- const ConstString &
- GetName();
-
- RegisterInfo *
- GetRegisterInfo();
-
- void
- SetRegisterInfo (const RegisterInfo *reg_info);
-
- ClangASTType
- GetClangType ();
-
- void
- SetClangType (const ClangASTType &clang_type);
-
- TypeFromUser
- GetTypeFromUser ();
-
- uint8_t *
- GetValueBytes ();
-
- void
- SetName (const ConstString &name);
-
- void
- ValueUpdated ();
-
- // this function is used to copy the address-of m_live_sp into m_frozen_sp
- // this is necessary because the results of certain cast and pointer-arithmetic
- // operations (such as those described in bugzilla issues 11588 and 11618) generate
- // frozen objects that do not have a valid address-of, which can be troublesome when
- // using synthetic children providers. Transferring the address-of the live object
- // solves these issues and provides the expected user-level behavior
- void
- TransferAddress (bool force = false);
-
- typedef std::shared_ptr<ValueObjectConstResult> ValueObjectConstResultSP;
-
- //----------------------------------------------------------------------
- /// Members
- //----------------------------------------------------------------------
- enum Flags
- {
- EVNone = 0,
- EVIsLLDBAllocated = 1 << 0, ///< This variable is resident in a location specifically allocated for it by LLDB in the target process
- EVIsProgramReference = 1 << 1, ///< This variable is a reference to a (possibly invalid) area managed by the target program
- EVNeedsAllocation = 1 << 2, ///< Space for this variable has yet to be allocated in the target process
- EVIsFreezeDried = 1 << 3, ///< This variable's authoritative version is in m_frozen_sp (for example, for statically-computed results)
- EVNeedsFreezeDry = 1 << 4, ///< Copy from m_live_sp to m_frozen_sp during dematerialization
- EVKeepInTarget = 1 << 5, ///< Keep the allocation after the expression is complete rather than freeze drying its contents and freeing it
- EVTypeIsReference = 1 << 6, ///< The original type of this variable is a reference, so materialize the value rather than the location
- EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type must be resolved after parsing is complete
- EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or some other entity.
- };
-
- typedef uint16_t FlagType;
-
- FlagType m_flags; // takes elements of Flags
-
- lldb::ValueObjectSP m_frozen_sp;
- lldb::ValueObjectSP m_live_sp;
-
- DISALLOW_COPY_AND_ASSIGN (ClangExpressionVariable);
-};
-
-//----------------------------------------------------------------------
-/// @class ClangExpressionVariableListBase ClangExpressionVariable.h "lldb/Expression/ClangExpressionVariable.h"
-/// @brief A list of variable references.
-///
-/// This class stores variables internally, acting as the permanent store.
-//----------------------------------------------------------------------
-class ClangExpressionVariableList
-{
-public:
- //----------------------------------------------------------------------
- /// Implementation of methods in ClangExpressionVariableListBase
- //----------------------------------------------------------------------
- size_t
- GetSize()
- {
- return m_variables.size();
- }
-
- lldb::ClangExpressionVariableSP
- GetVariableAtIndex(size_t index)
- {
- lldb::ClangExpressionVariableSP var_sp;
- if (index < m_variables.size())
- var_sp = m_variables[index];
- return var_sp;
- }
-
- size_t
- AddVariable (const lldb::ClangExpressionVariableSP &var_sp)
- {
- m_variables.push_back(var_sp);
- return m_variables.size() - 1;
- }
-
- bool
- ContainsVariable (const lldb::ClangExpressionVariableSP &var_sp)
- {
- const size_t size = m_variables.size();
- for (size_t index = 0; index < size; ++index)
- {
- if (m_variables[index].get() == var_sp.get())
- return true;
- }
- return false;
- }
-
- //----------------------------------------------------------------------
- /// Finds a variable by name in the list.
- ///
- /// @param[in] name
- /// The name of the requested variable.
- ///
- /// @return
- /// The variable requested, or NULL if that variable is not in the list.
- //----------------------------------------------------------------------
- lldb::ClangExpressionVariableSP
- GetVariable (const ConstString &name)
- {
- lldb::ClangExpressionVariableSP var_sp;
- for (size_t index = 0, size = GetSize(); index < size; ++index)
- {
- var_sp = GetVariableAtIndex(index);
- if (var_sp->GetName() == name)
- return var_sp;
- }
- var_sp.reset();
- return var_sp;
- }
-
- lldb::ClangExpressionVariableSP
- GetVariable (const char *name)
- {
- lldb::ClangExpressionVariableSP var_sp;
- if (name && name[0])
- {
- for (size_t index = 0, size = GetSize(); index < size; ++index)
- {
- var_sp = GetVariableAtIndex(index);
- const char *var_name_cstr = var_sp->GetName().GetCString();
- if (!var_name_cstr || !name)
- continue;
- if (::strcmp (var_name_cstr, name) == 0)
- return var_sp;
- }
- var_sp.reset();
- }
- return var_sp;
- }
-
- //----------------------------------------------------------------------
- /// Finds a variable by NamedDecl in the list.
- ///
- /// @param[in] name
- /// The name of the requested variable.
- ///
- /// @return
- /// The variable requested, or NULL if that variable is not in the list.
- //----------------------------------------------------------------------
- lldb::ClangExpressionVariableSP
- GetVariable (const clang::NamedDecl *decl, uint64_t parser_id)
- {
- lldb::ClangExpressionVariableSP var_sp;
- for (size_t index = 0, size = GetSize(); index < size; ++index)
- {
- var_sp = GetVariableAtIndex(index);
-
- ClangExpressionVariable::ParserVars *parser_vars = var_sp->GetParserVars(parser_id);
-
- if (parser_vars && parser_vars->m_named_decl == decl)
- return var_sp;
- }
- var_sp.reset();
- return var_sp;
- }
-
- //----------------------------------------------------------------------
- /// Create a new variable in the list and return its index
- //----------------------------------------------------------------------
- lldb::ClangExpressionVariableSP
- CreateVariable (ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size)
- {
- lldb::ClangExpressionVariableSP var_sp(new ClangExpressionVariable(exe_scope, byte_order, addr_byte_size));
- m_variables.push_back(var_sp);
- return var_sp;
- }
-
- lldb::ClangExpressionVariableSP
- CreateVariable(const lldb::ValueObjectSP &valobj_sp)
- {
- lldb::ClangExpressionVariableSP var_sp(new ClangExpressionVariable(valobj_sp));
- m_variables.push_back(var_sp);
- return var_sp;
- }
-
- lldb::ClangExpressionVariableSP
- CreateVariable (ExecutionContextScope *exe_scope,
- const ConstString &name,
- const TypeFromUser& user_type,
- lldb::ByteOrder byte_order,
- uint32_t addr_byte_size)
- {
- lldb::ClangExpressionVariableSP var_sp(new ClangExpressionVariable(exe_scope, byte_order, addr_byte_size));
- var_sp->SetName (name);
- var_sp->SetClangType (user_type);
- m_variables.push_back(var_sp);
- return var_sp;
- }
-
- void
- RemoveVariable (lldb::ClangExpressionVariableSP var_sp)
- {
- for (std::vector<lldb::ClangExpressionVariableSP>::iterator vi = m_variables.begin(), ve = m_variables.end();
- vi != ve;
- ++vi)
- {
- if (vi->get() == var_sp.get())
- {
- m_variables.erase(vi);
- return;
- }
- }
- }
-
- void
- Clear()
- {
- m_variables.clear();
- }
-
-private:
- std::vector <lldb::ClangExpressionVariableSP> m_variables;
-};
-
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangExpressionVariable_h_
diff --git a/include/lldb/Expression/ClangModulesDeclVendor.h b/include/lldb/Expression/ClangModulesDeclVendor.h
deleted file mode 100644
index a8297c8fa3313..0000000000000
--- a/include/lldb/Expression/ClangModulesDeclVendor.h
+++ /dev/null
@@ -1,129 +0,0 @@
-//===-- ClangModulesDeclVendor.h --------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _liblldb_ClangModulesDeclVendor_
-#define _liblldb_ClangModulesDeclVendor_
-
-#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/DeclVendor.h"
-#include "lldb/Target/Platform.h"
-
-#include <set>
-#include <vector>
-
-namespace lldb_private
-{
-
-class ClangModulesDeclVendor : public DeclVendor
-{
-public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- ClangModulesDeclVendor();
-
- virtual
- ~ClangModulesDeclVendor();
-
- static ClangModulesDeclVendor *
- Create(Target &target);
-
- typedef std::vector<ConstString> ModulePath;
- typedef uintptr_t ModuleID;
- typedef std::vector<ModuleID> ModuleVector;
-
- //------------------------------------------------------------------
- /// Add a module to the list of modules to search.
- ///
- /// @param[in] path
- /// The path to the exact module to be loaded. E.g., if the desired
- /// module is std.io, then this should be { "std", "io" }.
- ///
- /// @param[in] exported_modules
- /// If non-NULL, a pointer to a vector to populate with the ID of every
- /// module that is re-exported by the specified module.
- ///
- /// @param[in] error_stream
- /// A stream to populate with the output of the Clang parser when
- /// it tries to load the module.
- ///
- /// @return
- /// True if the module could be loaded; false if not. If the
- /// compiler encountered a fatal error during a previous module
- /// load, then this will always return false for this ModuleImporter.
- //------------------------------------------------------------------
- virtual bool
- AddModule(ModulePath &path,
- ModuleVector *exported_modules,
- Stream &error_stream) = 0;
-
- //------------------------------------------------------------------
- /// Add all modules referred to in a given compilation unit to the list
- /// of modules to search.
- ///
- /// @param[in] cu
- /// The compilation unit to scan for imported modules.
- ///
- /// @param[in] exported_modules
- /// A vector to populate with the ID of each module loaded (directly
- /// and via re-exports) in this way.
- ///
- /// @param[in] error_stream
- /// A stream to populate with the output of the Clang parser when
- /// it tries to load the modules.
- ///
- /// @return
- /// True if all modules referred to by the compilation unit could be
- /// loaded; false if one could not be loaded. If the compiler
- /// encountered a fatal error during a previous module
- /// load, then this will always return false for this ModuleImporter.
- //------------------------------------------------------------------
- virtual bool
- AddModulesForCompileUnit(CompileUnit &cu,
- ModuleVector &exported_modules,
- Stream &error_stream) = 0;
-
- //------------------------------------------------------------------
- /// Enumerate all the macros that are defined by a given set of modules
- /// that are already imported.
- ///
- /// @param[in] modules
- /// The unique IDs for all modules to query. Later modules have higher
- /// priority, just as if you @imported them in that order. This matters
- /// if module A #defines a macro and module B #undefs it.
- ///
- /// @param[in] handler
- /// A function to call with the text of each #define (including the
- /// #define directive). #undef directives are not included; we simply
- /// elide any corresponding #define. If this function returns true,
- /// we stop the iteration immediately.
- //------------------------------------------------------------------
- virtual void
- ForEachMacro(const ModuleVector &modules,
- std::function<bool (const std::string &)> handler) = 0;
-
- //------------------------------------------------------------------
- /// Query whether Clang supports modules for a particular language.
- /// LLDB uses this to decide whether to try to find the modules loaded
- /// by a gaiven compile unit.
- ///
- /// @param[in] language
- /// The language to query for.
- ///
- /// @return
- /// True if Clang has modules for the given language.
- //------------------------------------------------------------------
- static bool
- LanguageSupportsClangModules (lldb::LanguageType language);
-
-};
-
-}
-#endif /* defined(_lldb_ClangModulesDeclVendor_) */
diff --git a/include/lldb/Expression/ClangPersistentVariables.h b/include/lldb/Expression/ClangPersistentVariables.h
deleted file mode 100644
index 247f87fae41b9..0000000000000
--- a/include/lldb/Expression/ClangPersistentVariables.h
+++ /dev/null
@@ -1,91 +0,0 @@
-//===-- ClangPersistentVariables.h ------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangPersistentVariables_h_
-#define liblldb_ClangPersistentVariables_h_
-
-#include "lldb/Expression/ClangExpressionVariable.h"
-#include "lldb/Expression/ClangModulesDeclVendor.h"
-
-#include "llvm/ADT/DenseMap.h"
-
-namespace lldb_private
-{
-
-//----------------------------------------------------------------------
-/// @class ClangPersistentVariables ClangPersistentVariables.h "lldb/Expression/ClangPersistentVariables.h"
-/// @brief Manages persistent values that need to be preserved between expression invocations.
-///
-/// A list of variables that can be accessed and updated by any expression. See
-/// ClangPersistentVariable for more discussion. Also provides an increasing,
-/// 0-based counter for naming result variables.
-//----------------------------------------------------------------------
-class ClangPersistentVariables : public ClangExpressionVariableList
-{
-public:
-
- //----------------------------------------------------------------------
- /// Constructor
- //----------------------------------------------------------------------
- ClangPersistentVariables ();
-
- lldb::ClangExpressionVariableSP
- CreatePersistentVariable (const lldb::ValueObjectSP &valobj_sp);
-
- lldb::ClangExpressionVariableSP
- CreatePersistentVariable (ExecutionContextScope *exe_scope,
- const ConstString &name,
- const TypeFromUser& user_type,
- lldb::ByteOrder byte_order,
- uint32_t addr_byte_size);
-
- //----------------------------------------------------------------------
- /// Return the next entry in the sequence of strings "$0", "$1", ... for
- /// use naming persistent expression convenience variables.
- ///
- /// @return
- /// A string that contains the next persistent variable name.
- //----------------------------------------------------------------------
- ConstString
- GetNextPersistentVariableName ();
-
- void
- RemovePersistentVariable (lldb::ClangExpressionVariableSP variable);
-
- void
- RegisterPersistentType (const ConstString &name,
- clang::TypeDecl *tag_decl);
-
- clang::TypeDecl *
- GetPersistentType (const ConstString &name);
-
- void
- AddHandLoadedClangModule(ClangModulesDeclVendor::ModuleID module)
- {
- m_hand_loaded_clang_modules.push_back(module);
- }
-
- const ClangModulesDeclVendor::ModuleVector &GetHandLoadedClangModules()
- {
- return m_hand_loaded_clang_modules;
- }
-
-private:
- uint32_t m_next_persistent_variable_id; ///< The counter used by GetNextResultName().
-
- typedef llvm::DenseMap<const char *, clang::TypeDecl *> PersistentTypeMap;
- PersistentTypeMap m_persistent_types; ///< The persistent types declared by the user.
-
- ClangModulesDeclVendor::ModuleVector m_hand_loaded_clang_modules; ///< These are Clang modules we hand-loaded; these are the highest-
- ///< priority source for macros.
-};
-
-}
-
-#endif
diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h
index 9ddecc053e007..3527c3b4b153c 100644
--- a/include/lldb/Expression/DWARFExpression.h
+++ b/include/lldb/Expression/DWARFExpression.h
@@ -11,18 +11,19 @@
#define liblldb_DWARFExpression_h_
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Scalar.h"
+class DWARFCompileUnit;
+
namespace lldb_private {
+class ClangExpressionDeclMap;
class ClangExpressionVariable;
class ClangExpressionVariableList;
-class ClangExpressionDeclMap;
//----------------------------------------------------------------------
/// @class DWARFExpression DWARFExpression.h "lldb/Expression/DWARFExpression.h"
@@ -40,10 +41,17 @@ class ClangExpressionDeclMap;
class DWARFExpression
{
public:
+ enum LocationListFormat : uint8_t
+ {
+ NonLocationList, // Not a location list
+ RegularLocationList, // Location list format used in non-split dwarf files
+ SplitDwarfLocationList, // Location list format used in split dwarf files
+ };
+
//------------------------------------------------------------------
/// Constructor
//------------------------------------------------------------------
- DWARFExpression();
+ explicit DWARFExpression(DWARFCompileUnit* dwarf_cu);
//------------------------------------------------------------------
/// Constructor
@@ -60,6 +68,7 @@ public:
//------------------------------------------------------------------
DWARFExpression(lldb::ModuleSP module,
const DataExtractor& data,
+ DWARFCompileUnit* dwarf_cu,
lldb::offset_t data_offset,
lldb::offset_t data_length);
@@ -356,6 +365,7 @@ public:
RegisterContext *reg_ctx,
lldb::ModuleSP opcode_ctx,
const DataExtractor& opcodes,
+ DWARFCompileUnit* dwarf_cu,
const lldb::offset_t offset,
const lldb::offset_t length,
const lldb::RegisterKind reg_set,
@@ -397,6 +407,24 @@ public:
lldb::addr_t address,
ABI *abi);
+ static size_t
+ LocationListSize(const DWARFCompileUnit* dwarf_cu,
+ const DataExtractor& debug_loc_data,
+ lldb::offset_t offset);
+
+ static bool
+ PrintDWARFExpression(Stream &s,
+ const DataExtractor& data,
+ int address_size,
+ int dwarf_ref_size,
+ bool location_expression);
+
+ static void
+ PrintDWARFLocationList(Stream &s,
+ const DWARFCompileUnit* cu,
+ const DataExtractor& debug_loc_data,
+ lldb::offset_t offset);
+
protected:
//------------------------------------------------------------------
/// Pretty-prints the location expression to a stream
@@ -430,17 +458,26 @@ protected:
lldb::offset_t &offset,
lldb::offset_t &len);
+ static bool
+ AddressRangeForLocationListEntry(const DWARFCompileUnit* dwarf_cu,
+ const DataExtractor& debug_loc_data,
+ lldb::offset_t* offset_ptr,
+ lldb::addr_t& low_pc,
+ lldb::addr_t& high_pc);
+
//------------------------------------------------------------------
/// Classes that inherit from DWARFExpression can see and modify these
//------------------------------------------------------------------
lldb::ModuleWP m_module_wp; ///< Module which defined this expression.
DataExtractor m_data; ///< A data extractor capable of reading opcode bytes
+ DWARFCompileUnit* m_dwarf_cu; ///< The DWARF compile unit this expression belongs to. It is used
+ ///< to evaluate values indexing into the .debug_addr section (e.g.
+ ///< DW_OP_GNU_addr_index, DW_OP_GNU_const_index)
lldb::RegisterKind m_reg_kind; ///< One of the defines that starts with LLDB_REGKIND_
lldb::addr_t m_loclist_slide; ///< A value used to slide the location list offsets so that
///< they are relative to the object that owns the location list
///< (the function for frame base and variable location lists)
-
};
} // namespace lldb_private
diff --git a/include/lldb/Expression/ClangExpression.h b/include/lldb/Expression/Expression.h
index 6e831e4471e82..b5c2d575ae04c 100644
--- a/include/lldb/Expression/ClangExpression.h
+++ b/include/lldb/Expression/Expression.h
@@ -1,4 +1,4 @@
-//===-- ClangExpression.h ---------------------------------------*- C++ -*-===//
+//===-- Expression.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ClangExpression_h_
-#define liblldb_ClangExpression_h_
+#ifndef liblldb_Expression_h_
+#define liblldb_Expression_h_
// C Includes
// C++ Includes
@@ -21,23 +21,23 @@
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Target/Process.h"
+#include "lldb/Expression/ExpressionTypeSystemHelper.h"
namespace lldb_private {
class RecordingMemoryManager;
//----------------------------------------------------------------------
-/// @class ClangExpression ClangExpression.h "lldb/Expression/ClangExpression.h"
-/// @brief Encapsulates a single expression for use with Clang
+/// @class Expression Expression.h "lldb/Expression/Expression.h"
+/// @brief Encapsulates a single expression for use in lldb
///
/// LLDB uses expressions for various purposes, notably to call functions
-/// and as a backend for the expr command. ClangExpression encapsulates
+/// and as a backend for the expr command. Expression encapsulates
/// the objects needed to parse and interpret or JIT an expression. It
-/// uses the Clang parser to produce LLVM IR from the expression.
+/// uses the expression parser appropriate to the language of the expression
+/// to produce LLVM IR from the expression.
//----------------------------------------------------------------------
-class ClangExpression
+class Expression
{
public:
enum ResultType {
@@ -45,17 +45,14 @@ public:
eResultTypeId
};
- ClangExpression () :
- m_jit_process_wp(),
- m_jit_start_addr (LLDB_INVALID_ADDRESS),
- m_jit_end_addr (LLDB_INVALID_ADDRESS)
- {
- }
-
+ Expression (Target &target);
+
+ Expression (ExecutionContextScope &exe_scope);
+
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual ~ClangExpression ()
+ virtual ~Expression ()
{
}
@@ -85,24 +82,6 @@ public:
}
//------------------------------------------------------------------
- /// Return the object that the parser should use when resolving external
- /// values. May be NULL if everything should be self-contained.
- //------------------------------------------------------------------
- virtual ClangExpressionDeclMap *
- DeclMap () = 0;
-
- //------------------------------------------------------------------
- /// Return the object that the parser should allow to access ASTs.
- /// May be NULL if the ASTs do not need to be transformed.
- ///
- /// @param[in] passthrough
- /// The ASTConsumer that the returned transformer should send
- /// the ASTs to after transformation.
- //------------------------------------------------------------------
- virtual clang::ASTConsumer *
- ASTTransformer (clang::ASTConsumer *passthrough) = 0;
-
- //------------------------------------------------------------------
/// Return the desired result type of the function, or
/// eResultTypeAny if indifferent.
//------------------------------------------------------------------
@@ -130,6 +109,8 @@ public:
virtual bool
NeedsVariableResolution () = 0;
+ virtual EvaluateExpressionOptions *GetOptions() { return nullptr; };
+
//------------------------------------------------------------------
/// Return the address of the function's JIT-compiled code, or
/// LLDB_INVALID_ADDRESS if the function is not JIT compiled
@@ -139,10 +120,17 @@ public:
{
return m_jit_start_addr;
}
+
+ virtual ExpressionTypeSystemHelper *
+ GetTypeSystemHelper ()
+ {
+ return nullptr;
+ }
protected:
- lldb::ProcessWP m_jit_process_wp;
+ lldb::TargetWP m_target_wp; /// Expression's always have to have a target...
+ lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but it doesn't need to (e.g. calculator mode.)
lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
lldb::addr_t m_jit_end_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
@@ -150,4 +138,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_ClangExpression_h_
+#endif // liblldb_Expression_h_
diff --git a/include/lldb/Expression/ClangExpressionParser.h b/include/lldb/Expression/ExpressionParser.h
index 21a27a489bcd3..49333e79bf5ec 100644
--- a/include/lldb/Expression/ClangExpressionParser.h
+++ b/include/lldb/Expression/ExpressionParser.h
@@ -1,4 +1,4 @@
-//===-- ClangExpressionParser.h ---------------------------------*- C++ -*-===//
+//===-- ExpressionParser.h --------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,17 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ClangExpressionParser_h_
-#define liblldb_ClangExpressionParser_h_
+#ifndef liblldb_ExpressionParser_h_
+#define liblldb_ExpressionParser_h_
#include "lldb/lldb-public.h"
-#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Error.h"
-#include "lldb/Expression/IRForTarget.h"
-
-#include <string>
-#include <vector>
namespace lldb_private
{
@@ -25,16 +19,12 @@ namespace lldb_private
class IRExecutionUnit;
//----------------------------------------------------------------------
-/// @class ClangExpressionParser ClangExpressionParser.h "lldb/Expression/ClangExpressionParser.h"
-/// @brief Encapsulates an instance of Clang that can parse expressions.
+/// @class ExpressionParser ExpressionParser.h "lldb/Expression/ExpressionParser.h"
+/// @brief Encapsulates an instance of a compiler that can parse expressions.
///
-/// ClangExpressionParser is responsible for preparing an instance of
-/// ClangExpression for execution. ClangExpressionParser uses ClangExpression
-/// as a glorified parameter list, performing the required parsing and
-/// conversion to formats (DWARF bytecode, or JIT compiled machine code)
-/// that can be executed.
+/// ExpressionParser is the base class for llvm based Expression parsers.
//----------------------------------------------------------------------
-class ClangExpressionParser
+class ExpressionParser
{
public:
//------------------------------------------------------------------
@@ -50,14 +40,18 @@ public:
/// @param[in] expr
/// The expression to be parsed.
//------------------------------------------------------------------
- ClangExpressionParser (ExecutionContextScope *exe_scope,
- ClangExpression &expr,
- bool generate_debug_info);
+ ExpressionParser (ExecutionContextScope *exe_scope,
+ Expression &expr,
+ bool generate_debug_info) :
+ m_expr(expr),
+ m_generate_debug_info(generate_debug_info)
+ {
+ }
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- ~ClangExpressionParser ();
+ virtual ~ExpressionParser () {};
//------------------------------------------------------------------
/// Parse a single expression and convert it to IR using Clang. Don't
@@ -70,8 +64,8 @@ public:
/// The number of errors encountered during parsing. 0 means
/// success.
//------------------------------------------------------------------
- unsigned
- Parse (Stream &stream);
+ virtual unsigned
+ Parse (Stream &stream) = 0;
//------------------------------------------------------------------
/// Ready an already-parsed expression for execution, possibly
@@ -92,15 +86,10 @@ public:
/// @param[in] exe_ctx
/// The execution context to write the function into.
///
- /// @param[out] evaluated_statically
+ /// @param[out] can_interpret
/// Set to true if the expression could be interpreted statically;
/// untouched otherwise.
///
- /// @param[out] const_result
- /// If the result of the expression is constant, and the
- /// expression has no side effects, this is set to the result of the
- /// expression.
- ///
/// @param[in] execution_policy
/// Determines whether the expression must be JIT-compiled, must be
/// evaluated statically, or whether this decision may be made
@@ -110,47 +99,25 @@ public:
/// An error code indicating the success or failure of the operation.
/// Test with Success().
//------------------------------------------------------------------
- Error
+ virtual Error
PrepareForExecution (lldb::addr_t &func_addr,
lldb::addr_t &func_end,
std::shared_ptr<IRExecutionUnit> &execution_unit_sp,
ExecutionContext &exe_ctx,
bool &can_interpret,
- lldb_private::ExecutionPolicy execution_policy);
+ lldb_private::ExecutionPolicy execution_policy) = 0;
- //------------------------------------------------------------------
- /// Disassemble the machine code for a JITted function from the target
- /// process's memory and print the result to a stream.
- ///
- /// @param[in] stream
- /// The stream to print disassembly to.
- ///
- /// @param[in] exc_context
- /// The execution context to get the machine code from.
- ///
- /// @return
- /// The error generated. If .Success() is true, disassembly succeeded.
- //------------------------------------------------------------------
- Error
- DisassembleFunction (Stream &stream,
- ExecutionContext &exe_ctx);
-
bool
- GetGenerateDebugInfo () const;
-
-private:
- ClangExpression & m_expr; ///< The expression to be parsed
- std::unique_ptr<llvm::LLVMContext> m_llvm_context; ///< The LLVM context to generate IR into
- std::unique_ptr<clang::FileManager> m_file_manager; ///< The Clang file manager object used by the compiler
- std::unique_ptr<clang::CompilerInstance> m_compiler; ///< The Clang compiler used to parse expressions into IR
- std::unique_ptr<clang::Builtin::Context> m_builtin_context; ///< Context for Clang built-ins
- std::unique_ptr<clang::SelectorTable> m_selector_table; ///< Selector table for Objective-C methods
- std::unique_ptr<clang::CodeGenerator> m_code_generator; ///< The Clang object that generates IR
+ GetGenerateDebugInfo () const
+ {
+ return m_generate_debug_info;
+ }
- class LLDBPreprocessorCallbacks;
- LLDBPreprocessorCallbacks *m_pp_callbacks; ///< Called when the preprocessor encounters module imports
+protected:
+ Expression & m_expr; ///< The expression to be parsed
+ bool m_generate_debug_info;
};
}
-#endif // liblldb_ClangExpressionParser_h_
+#endif // liblldb_ExpressionParser_h_
diff --git a/include/lldb/Expression/ExpressionTypeSystemHelper.h b/include/lldb/Expression/ExpressionTypeSystemHelper.h
new file mode 100644
index 0000000000000..cb560c9b5a420
--- /dev/null
+++ b/include/lldb/Expression/ExpressionTypeSystemHelper.h
@@ -0,0 +1,54 @@
+//===-- ExpressionTypeSystemHelper.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ExpressionTypeSystemHelper_h
+#define ExpressionTypeSystemHelper_h
+
+#include "llvm/Support/Casting.h"
+
+namespace lldb_private
+{
+
+//----------------------------------------------------------------------
+/// @class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h "lldb/Expression/ExpressionTypeSystemHelper.h"
+/// @brief A helper object that the Expression can pass to its ExpressionParser to provide generic information that
+/// any type of expression will need to supply. It's only job is to support dyn_cast so that the expression parser
+/// can cast it back to the requisite specific type.
+///
+//----------------------------------------------------------------------
+
+class ExpressionTypeSystemHelper
+{
+public:
+ enum LLVMCastKind {
+ eKindClangHelper,
+ eKindSwiftHelper,
+ eKindGoHelper,
+ kNumKinds
+ };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ ExpressionTypeSystemHelper (LLVMCastKind kind) :
+ m_kind(kind)
+ {
+ }
+
+ ~ExpressionTypeSystemHelper () {}
+
+protected:
+ LLVMCastKind m_kind;
+};
+
+
+
+
+} // namespace lldb_private
+
+#endif /* ExpressionTypeSystemHelper_h */
diff --git a/include/lldb/Expression/ExpressionVariable.h b/include/lldb/Expression/ExpressionVariable.h
new file mode 100644
index 0000000000000..d8030ba1c2579
--- /dev/null
+++ b/include/lldb/Expression/ExpressionVariable.h
@@ -0,0 +1,320 @@
+//===-- ExpressionVariable.h ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExpressionVariable_h_
+#define liblldb_ExpressionVariable_h_
+
+// C Includes
+// C++ Includes
+#include <memory>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+
+namespace lldb_private
+{
+
+class ClangExpressionVariable;
+
+class ExpressionVariable :
+ public std::enable_shared_from_this<ExpressionVariable>
+{
+public:
+ //----------------------------------------------------------------------
+ // See TypeSystem.h for how to add subclasses to this.
+ //----------------------------------------------------------------------
+ enum LLVMCastKind {
+ eKindClang,
+ eKindSwift,
+ eKindGo,
+ kNumKinds
+ };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ ExpressionVariable(LLVMCastKind kind) :
+ m_flags(0),
+ m_kind(kind)
+ {
+ }
+
+ virtual ~ExpressionVariable();
+
+ size_t
+ GetByteSize ()
+ {
+ return m_frozen_sp->GetByteSize();
+ }
+
+ const ConstString &
+ GetName ()
+ {
+ return m_frozen_sp->GetName();
+ }
+
+ lldb::ValueObjectSP
+ GetValueObject()
+ {
+ return m_frozen_sp;
+ }
+
+ uint8_t *GetValueBytes();
+
+ void
+ ValueUpdated ()
+ {
+ m_frozen_sp->ValueUpdated ();
+ }
+
+ RegisterInfo *
+ GetRegisterInfo()
+ {
+ return m_frozen_sp->GetValue().GetRegisterInfo();
+ }
+
+ void
+ SetRegisterInfo (const RegisterInfo *reg_info)
+ {
+ return m_frozen_sp->GetValue().SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
+ }
+
+ CompilerType
+ GetCompilerType()
+ {
+ return m_frozen_sp->GetCompilerType();
+ }
+
+ void
+ SetCompilerType(const CompilerType &compiler_type)
+ {
+ m_frozen_sp->GetValue().SetCompilerType(compiler_type);
+ }
+
+ void
+ SetName (const ConstString &name)
+ {
+ m_frozen_sp->SetName (name);
+ }
+
+ // this function is used to copy the address-of m_live_sp into m_frozen_sp
+ // this is necessary because the results of certain cast and pointer-arithmetic
+ // operations (such as those described in bugzilla issues 11588 and 11618) generate
+ // frozen objects that do not have a valid address-of, which can be troublesome when
+ // using synthetic children providers. Transferring the address-of the live object
+ // solves these issues and provides the expected user-level behavior
+ void
+ TransferAddress (bool force = false)
+ {
+ if (m_live_sp.get() == nullptr)
+ return;
+
+ if (m_frozen_sp.get() == nullptr)
+ return;
+
+ if (force || (m_frozen_sp->GetLiveAddress() == LLDB_INVALID_ADDRESS))
+ m_frozen_sp->SetLiveAddress(m_live_sp->GetLiveAddress());
+ }
+
+ enum Flags
+ {
+ EVNone = 0,
+ EVIsLLDBAllocated = 1 << 0, ///< This variable is resident in a location specifically allocated for it by LLDB in the target process
+ EVIsProgramReference = 1 << 1, ///< This variable is a reference to a (possibly invalid) area managed by the target program
+ EVNeedsAllocation = 1 << 2, ///< Space for this variable has yet to be allocated in the target process
+ EVIsFreezeDried = 1 << 3, ///< This variable's authoritative version is in m_frozen_sp (for example, for statically-computed results)
+ EVNeedsFreezeDry = 1 << 4, ///< Copy from m_live_sp to m_frozen_sp during dematerialization
+ EVKeepInTarget = 1 << 5, ///< Keep the allocation after the expression is complete rather than freeze drying its contents and freeing it
+ EVTypeIsReference = 1 << 6, ///< The original type of this variable is a reference, so materialize the value rather than the location
+ EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type must be resolved after parsing is complete
+ EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or some other entity.
+ };
+
+ typedef uint16_t FlagType;
+
+ FlagType m_flags; // takes elements of Flags
+
+ // these should be private
+ lldb::ValueObjectSP m_frozen_sp;
+ lldb::ValueObjectSP m_live_sp;
+ LLVMCastKind m_kind;
+};
+
+//----------------------------------------------------------------------
+/// @class ExpressionVariableList ExpressionVariable.h "lldb/Expression/ExpressionVariable.h"
+/// @brief A list of variable references.
+///
+/// This class stores variables internally, acting as the permanent store.
+//----------------------------------------------------------------------
+class ExpressionVariableList
+{
+public:
+ //----------------------------------------------------------------------
+ /// Implementation of methods in ExpressionVariableListBase
+ //----------------------------------------------------------------------
+ size_t
+ GetSize()
+ {
+ return m_variables.size();
+ }
+
+ lldb::ExpressionVariableSP
+ GetVariableAtIndex(size_t index)
+ {
+ lldb::ExpressionVariableSP var_sp;
+ if (index < m_variables.size())
+ var_sp = m_variables[index];
+ return var_sp;
+ }
+
+ size_t
+ AddVariable (const lldb::ExpressionVariableSP &var_sp)
+ {
+ m_variables.push_back(var_sp);
+ return m_variables.size() - 1;
+ }
+
+ lldb::ExpressionVariableSP
+ AddNewlyConstructedVariable (ExpressionVariable *var)
+ {
+ lldb::ExpressionVariableSP var_sp(var);
+ m_variables.push_back(var_sp);
+ return m_variables.back();
+ }
+
+ bool
+ ContainsVariable (const lldb::ExpressionVariableSP &var_sp)
+ {
+ const size_t size = m_variables.size();
+ for (size_t index = 0; index < size; ++index)
+ {
+ if (m_variables[index].get() == var_sp.get())
+ return true;
+ }
+ return false;
+ }
+
+ //----------------------------------------------------------------------
+ /// Finds a variable by name in the list.
+ ///
+ /// @param[in] name
+ /// The name of the requested variable.
+ ///
+ /// @return
+ /// The variable requested, or nullptr if that variable is not in the list.
+ //----------------------------------------------------------------------
+ lldb::ExpressionVariableSP
+ GetVariable (const ConstString &name)
+ {
+ lldb::ExpressionVariableSP var_sp;
+ for (size_t index = 0, size = GetSize(); index < size; ++index)
+ {
+ var_sp = GetVariableAtIndex(index);
+ if (var_sp->GetName() == name)
+ return var_sp;
+ }
+ var_sp.reset();
+ return var_sp;
+ }
+
+ lldb::ExpressionVariableSP
+ GetVariable (const char *name)
+ {
+ lldb::ExpressionVariableSP var_sp;
+ if (name && name[0])
+ {
+ for (size_t index = 0, size = GetSize(); index < size; ++index)
+ {
+ var_sp = GetVariableAtIndex(index);
+ const char *var_name_cstr = var_sp->GetName().GetCString();
+ if (!var_name_cstr || !name)
+ continue;
+ if (::strcmp (var_name_cstr, name) == 0)
+ return var_sp;
+ }
+ var_sp.reset();
+ }
+ return var_sp;
+ }
+
+ void
+ RemoveVariable (lldb::ExpressionVariableSP var_sp)
+ {
+ for (std::vector<lldb::ExpressionVariableSP>::iterator vi = m_variables.begin(), ve = m_variables.end();
+ vi != ve;
+ ++vi)
+ {
+ if (vi->get() == var_sp.get())
+ {
+ m_variables.erase(vi);
+ return;
+ }
+ }
+ }
+
+ void
+ Clear()
+ {
+ m_variables.clear();
+ }
+
+private:
+ std::vector <lldb::ExpressionVariableSP> m_variables;
+};
+
+class PersistentExpressionState : public ExpressionVariableList {
+public:
+ //----------------------------------------------------------------------
+ // See TypeSystem.h for how to add subclasses to this.
+ //----------------------------------------------------------------------
+ enum LLVMCastKind {
+ eKindClang,
+ eKindSwift,
+ eKindGo,
+ kNumKinds
+ };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ PersistentExpressionState(LLVMCastKind kind) :
+ m_kind(kind)
+ {
+ }
+
+ virtual ~PersistentExpressionState();
+
+ virtual lldb::ExpressionVariableSP
+ CreatePersistentVariable (const lldb::ValueObjectSP &valobj_sp) = 0;
+
+ virtual lldb::ExpressionVariableSP
+ CreatePersistentVariable (ExecutionContextScope *exe_scope,
+ const ConstString &name,
+ const CompilerType &type,
+ lldb::ByteOrder byte_order,
+ uint32_t addr_byte_size) = 0;
+
+ virtual ConstString
+ GetNextPersistentVariableName () = 0;
+
+ virtual void
+ RemovePersistentVariable (lldb::ExpressionVariableSP variable) = 0;
+
+ virtual lldb::addr_t
+ LookupSymbol (const ConstString &name) = 0;
+
+private:
+ LLVMCastKind m_kind;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ExpressionVariable_h_
diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/FunctionCaller.h
index cf7e2592021f3..c9a45811670fe 100644
--- a/include/lldb/Expression/ClangFunction.h
+++ b/include/lldb/Expression/FunctionCaller.h
@@ -1,4 +1,4 @@
-//===-- ClangFunction.h -----------------------------------------*- C++ -*-===//
+//===-- FunctionCaller.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,35 +7,32 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_ClangFunction_h_
-#define lldb_ClangFunction_h_
+#ifndef liblldb_FunctionCaller_h_
+#define liblldb_FunctionCaller_h_
// C Includes
// C++ Includes
-#include <vector>
#include <list>
+#include <memory>
+#include <string>
+#include <vector>
+
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Value.h"
-#include "lldb/Core/ValueObjectList.h"
-#include "lldb/Expression/ClangExpression.h"
-#include "lldb/Symbol/ClangASTType.h"
-#include "lldb/Target/Process.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Expression/ExpressionParser.h"
+#include "lldb/Symbol/CompilerType.h"
namespace lldb_private
{
-class ASTStructExtractor;
-class ClangExpressionParser;
-
//----------------------------------------------------------------------
-/// @class ClangFunction ClangFunction.h "lldb/Expression/ClangFunction.h"
+/// @class FunctionCaller FunctionCaller.h "lldb/Expression/FunctionCaller.h"
/// @brief Encapsulates a function that can be called.
///
-/// A given ClangFunction object can handle a single function signature.
+/// A given FunctionCaller object can handle a single function signature.
/// Once constructed, it can set up any number of concurrent calls to
/// functions with that signature.
///
@@ -46,7 +43,7 @@ class ClangExpressionParser;
/// struct with the written arguments. This method lets Clang handle the
/// vagaries of function calling conventions.
///
-/// The simplest use of the ClangFunction is to construct it with a
+/// The simplest use of the FunctionCaller is to construct it with a
/// function representative of the signature you want to use, then call
/// ExecuteFunction(ExecutionContext &, Stream &, Value &).
///
@@ -61,12 +58,11 @@ class ClangExpressionParser;
/// a pointer set to LLDB_INVALID_ADDRESS and new structure will be allocated
/// and its address returned in that variable.
///
-/// Any of the methods that take arg_addr_ptr can be passed NULL, and the
+/// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
/// argument space will be managed for you.
//----------------------------------------------------------------------
-class ClangFunction : public ClangExpression
+class FunctionCaller : public Expression
{
- friend class ASTStructExtractor;
public:
//------------------------------------------------------------------
/// Constructor
@@ -75,30 +71,6 @@ public:
/// An execution context scope that gets us at least a target and
/// process.
///
- /// @param[in] function_ptr
- /// The default function to be called. Can be overridden using
- /// WriteFunctionArguments().
- ///
- /// @param[in] ast_context
- /// The AST context to evaluate argument types in.
- ///
- /// @param[in] arg_value_list
- /// The default values to use when calling this function. Can
- /// be overridden using WriteFunctionArguments().
- //------------------------------------------------------------------
- ClangFunction (ExecutionContextScope &exe_scope,
- Function &function_ptr,
- ClangASTContext *ast_context,
- const ValueList &arg_value_list,
- const char *name);
-
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// @param[in] exe_scope
- /// An execution context scope that gets us at least a target and
- /// process.
- ///
/// @param[in] ast_context
/// The AST context to evaluate argument types in.
///
@@ -113,8 +85,8 @@ public:
/// The default values to use when calling this function. Can
/// be overridden using WriteFunctionArguments().
//------------------------------------------------------------------
- ClangFunction (ExecutionContextScope &exe_scope,
- const ClangASTType &return_type,
+ FunctionCaller (ExecutionContextScope &exe_scope,
+ const CompilerType &return_type,
const Address& function_address,
const ValueList &arg_value_list,
const char *name);
@@ -122,8 +94,7 @@ public:
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual
- ~ClangFunction();
+ ~FunctionCaller() override;
//------------------------------------------------------------------
/// Compile the wrapper function
@@ -134,8 +105,8 @@ public:
/// @return
/// The number of errors.
//------------------------------------------------------------------
- unsigned
- CompileFunction (Stream &errors);
+ virtual unsigned
+ CompileFunction (Stream &errors) = 0;
//------------------------------------------------------------------
/// Insert the default function wrapper and its default argument struct
@@ -209,10 +180,7 @@ public:
/// @param[in,out] args_addr_ref
/// The address of the structure to write the arguments into. May
/// be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
- /// and args_addr_ref is pointed to it.
- ///
- /// @param[in] function_address
- /// The address of the function to call.
+ /// and args_addr_ref is pointed at it.
///
/// @param[in] arg_values
/// The values of the function's arguments.
@@ -225,12 +193,11 @@ public:
//------------------------------------------------------------------
bool WriteFunctionArguments (ExecutionContext &exe_ctx,
lldb::addr_t &args_addr_ref,
- Address function_address,
- ValueList &arg_values,
+ ValueList &arg_values,
Stream &errors);
//------------------------------------------------------------------
- /// Run the function this ClangFunction was created with.
+ /// Run the function this FunctionCaller was created with.
///
/// This is the full version.
///
@@ -238,7 +205,7 @@ public:
/// The thread & process in which this function will run.
///
/// @param[in] args_addr_ptr
- /// If NULL, the function will take care of allocating & deallocating the wrapper
+ /// If nullptr, the function will take care of allocating & deallocating the wrapper
/// args structure. Otherwise, if set to LLDB_INVALID_ADDRESS, a new structure
/// will be allocated, filled and the address returned to you. You are responsible
/// for deallocating it. And if passed in with a value other than LLDB_INVALID_ADDRESS,
@@ -264,7 +231,7 @@ public:
Value &results);
//------------------------------------------------------------------
- /// Get a thread plan to run the function this ClangFunction was created with.
+ /// Get a thread plan to run the function this FunctionCaller was created with.
///
/// @param[in] exe_ctx
/// The execution context to insert the function and its arguments
@@ -335,7 +302,7 @@ public:
/// translation unit.
//------------------------------------------------------------------
const char *
- Text ()
+ Text() override
{
return m_wrapper_function_text.c_str();
}
@@ -346,48 +313,27 @@ public:
/// function.
//------------------------------------------------------------------
const char *
- FunctionName ()
+ FunctionName() override
{
return m_wrapper_function_name.c_str();
}
//------------------------------------------------------------------
- /// Return the object that the parser should use when resolving external
- /// values. May be NULL if everything should be self-contained.
- //------------------------------------------------------------------
- ClangExpressionDeclMap *
- DeclMap ()
- {
- return NULL;
- }
-
- //------------------------------------------------------------------
/// Return the object that the parser should use when registering
- /// local variables. May be NULL if the Expression doesn't care.
+ /// local variables. May be nullptr if the Expression doesn't care.
//------------------------------------------------------------------
- ClangExpressionVariableList *
+ ExpressionVariableList *
LocalVariables ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
- /// Return the object that the parser should allow to access ASTs.
- /// May be NULL if the ASTs do not need to be transformed.
- ///
- /// @param[in] passthrough
- /// The ASTConsumer that the returned transformer should send
- /// the ASTs to after transformation.
- //------------------------------------------------------------------
- clang::ASTConsumer *
- ASTTransformer (clang::ASTConsumer *passthrough);
-
- //------------------------------------------------------------------
/// Return true if validation code should be inserted into the
/// expression.
//------------------------------------------------------------------
bool
- NeedsValidation ()
+ NeedsValidation() override
{
return false;
}
@@ -397,7 +343,7 @@ public:
/// resolved.
//------------------------------------------------------------------
bool
- NeedsVariableResolution ()
+ NeedsVariableResolution() override
{
return false;
}
@@ -407,29 +353,27 @@ public:
{
return m_arg_values;
}
-private:
- //------------------------------------------------------------------
- // For ClangFunction only
- //------------------------------------------------------------------
+protected:
// Note: the parser needs to be destructed before the execution unit, so
// declare the execution unit first.
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
- std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
+ std::unique_ptr<ExpressionParser> m_parser; ///< The parser responsible for compiling the function.
+ ///< This will get made in CompileFunction, so it is
+ ///< safe to access it after that.
+
lldb::ModuleWP m_jit_module_wp;
std::string m_name; ///< The name of this clang function - for debugging purposes.
- Function *m_function_ptr; ///< The function we're going to call. May be NULL if we don't have debug info for the function.
+ Function *m_function_ptr; ///< The function we're going to call. May be nullptr if we don't have debug info for the function.
Address m_function_addr; ///< If we don't have the FunctionSP, we at least need the address & return type.
- ClangASTType m_function_return_type; ///< The opaque clang qual type for the function return type.
+ CompilerType m_function_return_type; ///< The opaque clang qual type for the function return type.
std::string m_wrapper_function_name; ///< The name of the wrapper function.
std::string m_wrapper_function_text; ///< The contents of the wrapper function.
std::string m_wrapper_struct_name; ///< The name of the struct that contains the target function address, arguments, and result.
std::list<lldb::addr_t> m_wrapper_args_addrs; ///< The addresses of the arguments to the wrapper function.
- std::unique_ptr<ASTStructExtractor> m_struct_extractor; ///< The class that generates the argument struct below.
-
bool m_struct_valid; ///< True if the ASTStructExtractor has populated the variables below.
//------------------------------------------------------------------
@@ -446,6 +390,6 @@ private:
bool m_JITted; ///< True if the wrapper function has already been JIT-compiled.
};
-} // Namespace lldb_private
+} // namespace lldb_private
-#endif // lldb_ClangFunction_h_
+#endif // liblldb_FunctionCaller_h_
diff --git a/include/lldb/Expression/IRDynamicChecks.h b/include/lldb/Expression/IRDynamicChecks.h
index 226f5c94e98c1..ef77d55f4b340 100644
--- a/include/lldb/Expression/IRDynamicChecks.h
+++ b/include/lldb/Expression/IRDynamicChecks.h
@@ -24,11 +24,10 @@ namespace llvm {
class Value;
}
-namespace lldb_private
+namespace lldb_private
{
class ClangExpressionDeclMap;
-class ClangUtilityFunction;
class ExecutionContext;
class Stream;
@@ -77,8 +76,8 @@ public:
bool DoCheckersExplainStop (lldb::addr_t addr, Stream &message);
- std::unique_ptr<ClangUtilityFunction> m_valid_pointer_check;
- std::unique_ptr<ClangUtilityFunction> m_objc_object_check;
+ std::unique_ptr<UtilityFunction> m_valid_pointer_check;
+ std::unique_ptr<UtilityFunction> m_objc_object_check;
};
//----------------------------------------------------------------------
@@ -114,7 +113,7 @@ public:
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual ~IRDynamicChecks();
+ ~IRDynamicChecks() override;
//------------------------------------------------------------------
/// Run this IR transformer on a single module
@@ -127,18 +126,19 @@ public:
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
- bool runOnModule(llvm::Module &M);
+ bool runOnModule(llvm::Module &M) override;
//------------------------------------------------------------------
/// Interface stub
//------------------------------------------------------------------
void assignPassManager(llvm::PMStack &PMS,
- llvm::PassManagerType T = llvm::PMT_ModulePassManager);
+ llvm::PassManagerType T = llvm::PMT_ModulePassManager) override;
//------------------------------------------------------------------
/// Returns PMT_ModulePassManager
//------------------------------------------------------------------
- llvm::PassManagerType getPotentialPassManagerType() const;
+ llvm::PassManagerType getPotentialPassManagerType() const override;
+
private:
//------------------------------------------------------------------
/// A basic block-level pass to find all pointer dereferences and
@@ -164,6 +164,6 @@ private:
DynamicCheckerFunctions &m_checker_functions; ///< The checker functions for the process
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_IRDynamicChecks_h_
diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h
index bd1a795a158e4..86744b7b9726e 100644
--- a/include/lldb/Expression/IRExecutionUnit.h
+++ b/include/lldb/Expression/IRExecutionUnit.h
@@ -7,27 +7,24 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_IRExecutionUnit_h_
-#define lldb_IRExecutionUnit_h_
+#ifndef liblldb_IRExecutionUnit_h_
+#define liblldb_IRExecutionUnit_h_
// C Includes
// C++ Includes
#include <atomic>
+#include <memory>
#include <string>
#include <vector>
-#include <map>
// Other libraries and framework includes
#include "llvm/IR/Module.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/DataBufferHeap.h"
-#include "llvm/ExecutionEngine/SectionMemoryManager.h"
-#include "lldb/Expression/ClangExpression.h"
-#include "lldb/Expression/ClangExpressionParser.h"
#include "lldb/Expression/IRMemoryMap.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -37,7 +34,7 @@ namespace llvm {
class Module;
class ExecutionEngine;
-}
+} // namespace llvm
namespace lldb_private {
@@ -79,7 +76,7 @@ public:
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- ~IRExecutionUnit();
+ ~IRExecutionUnit() override;
llvm::Module *
GetModule()
@@ -90,10 +87,7 @@ public:
llvm::Function *
GetFunction()
{
- if (m_module)
- return m_module->getFunction (m_name.AsCString());
- else
- return NULL;
+ return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString()) : nullptr);
}
void
@@ -118,22 +112,22 @@ public:
//------------------------------------------------------------------
/// ObjectFileJITDelegate overrides
//------------------------------------------------------------------
- virtual lldb::ByteOrder
- GetByteOrder () const;
+ lldb::ByteOrder
+ GetByteOrder() const override;
- virtual uint32_t
- GetAddressByteSize () const;
+ uint32_t
+ GetAddressByteSize() const override;
- virtual void
- PopulateSymtab (lldb_private::ObjectFile *obj_file,
- lldb_private::Symtab &symtab);
+ void
+ PopulateSymtab(lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab) override;
- virtual void
- PopulateSectionList (lldb_private::ObjectFile *obj_file,
- lldb_private::SectionList &section_list);
+ void
+ PopulateSectionList(lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList &section_list) override;
- virtual bool
- GetArchitecture (lldb_private::ArchSpec &arch);
+ bool
+ GetArchitecture(lldb_private::ArchSpec &arch) override;
lldb::ModuleSP
GetJITModule ();
@@ -215,7 +209,7 @@ private:
public:
MemoryManager (IRExecutionUnit &parent);
- virtual ~MemoryManager();
+ ~MemoryManager() override;
//------------------------------------------------------------------
/// Allocate space for executable code, and add it to the
@@ -233,9 +227,9 @@ private:
/// @return
/// Allocated space.
//------------------------------------------------------------------
- virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID,
- llvm::StringRef SectionName);
+ uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID,
+ llvm::StringRef SectionName) override;
//------------------------------------------------------------------
/// Allocate space for data, and add it to the m_spaceBlocks map
@@ -255,10 +249,10 @@ private:
/// @return
/// Allocated space.
//------------------------------------------------------------------
- virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID,
- llvm::StringRef SectionName,
- bool IsReadOnly);
+ uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID,
+ llvm::StringRef SectionName,
+ bool IsReadOnly) override;
//------------------------------------------------------------------
/// Called when object loading is complete and section page
@@ -270,7 +264,7 @@ private:
/// @return
/// True in case of failure, false in case of success.
//------------------------------------------------------------------
- virtual bool finalizeMemory(std::string *ErrMsg) {
+ bool finalizeMemory(std::string *ErrMsg) override {
// TODO: Ensure that the instruction cache is flushed because
// relocations are updated by dy-load. See:
// sys::Memory::InvalidateInstructionCache
@@ -278,17 +272,17 @@ private:
return false;
}
- virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
- return;
+ void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override {
}
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
- virtual uint64_t getSymbolAddress(const std::string &Name);
+ uint64_t getSymbolAddress(const std::string &Name) override;
+
+ void *getPointerToNamedFunction(const std::string &Name,
+ bool AbortOnFailure = true) override;
- virtual void *getPointerToNamedFunction(const std::string &Name,
- bool AbortOnFailure = true);
private:
std::unique_ptr<SectionMemoryManager> m_default_mm_ap; ///< The memory allocator to use in actually creating space. All calls are passed through to it.
IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for.
@@ -403,4 +397,4 @@ private:
} // namespace lldb_private
-#endif // lldb_IRExecutionUnit_h_
+#endif // liblldb_IRExecutionUnit_h_
diff --git a/include/lldb/Expression/IRForTarget.h b/include/lldb/Expression/IRForTarget.h
deleted file mode 100644
index b81fab7a8a83b..0000000000000
--- a/include/lldb/Expression/IRForTarget.h
+++ /dev/null
@@ -1,745 +0,0 @@
-//===-- IRForTarget.h ---------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_IRForTarget_h_
-#define liblldb_IRForTarget_h_
-
-#include "lldb/lldb-public.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Symbol/TaggedASTType.h"
-#include "llvm/Pass.h"
-
-#include <map>
-#include <functional>
-
-namespace llvm {
- class BasicBlock;
- class CallInst;
- class Constant;
- class ConstantInt;
- class Function;
- class GlobalValue;
- class GlobalVariable;
- class Instruction;
- class IntegerType;
- class Module;
- class StoreInst;
- class DataLayout;
- class Type;
- class Value;
-}
-
-namespace lldb_private {
- class ClangExpressionDeclMap;
- class IRExecutionUnit;
- class IRMemoryMap;
-}
-
-//----------------------------------------------------------------------
-/// @class IRForTarget IRForTarget.h "lldb/Expression/IRForTarget.h"
-/// @brief Transforms the IR for a function to run in the target
-///
-/// Once an expression has been parsed and converted to IR, it can run
-/// in two contexts: interpreted by LLDB as a DWARF location expression,
-/// or compiled by the JIT and inserted into the target process for
-/// execution.
-///
-/// IRForTarget makes the second possible, by applying a series of
-/// transformations to the IR which make it relocatable. These
-/// transformations are discussed in more detail next to their relevant
-/// functions.
-//----------------------------------------------------------------------
-class IRForTarget : public llvm::ModulePass
-{
-public:
- enum class LookupResult {
- Success,
- Fail,
- Ignore
- };
-
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// @param[in] decl_map
- /// The list of externally-referenced variables for the expression,
- /// for use in looking up globals and allocating the argument
- /// struct. See the documentation for ClangExpressionDeclMap.
- ///
- /// @param[in] resolve_vars
- /// True if the external variable references (including persistent
- /// variables) should be resolved. If not, only external functions
- /// are resolved.
- ///
- /// @param[in] execution_policy
- /// Determines whether an IR interpreter can be used to statically
- /// evaluate the expression.
- ///
- /// @param[in] const_result
- /// This variable is populated with the statically-computed result
- /// of the function, if it has no side-effects and the result can
- /// be computed statically.
- ///
- /// @param[in] execution_unit
- /// The holder for raw data associated with the expression.
- ///
- /// @param[in] error_stream
- /// If non-NULL, a stream on which errors can be printed.
- ///
- /// @param[in] func_name
- /// The name of the function to prepare for execution in the target.
- //------------------------------------------------------------------
- IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map,
- bool resolve_vars,
- lldb_private::IRExecutionUnit &execution_unit,
- lldb_private::Stream *error_stream,
- const char* func_name = "$__lldb_expr");
-
- //------------------------------------------------------------------
- /// Destructor
- //------------------------------------------------------------------
- virtual ~IRForTarget();
-
- //------------------------------------------------------------------
- /// Run this IR transformer on a single module
- ///
- /// Implementation of the llvm::ModulePass::runOnModule() function.
- ///
- /// @param[in] llvm_module
- /// The module to run on. This module is searched for the function
- /// $__lldb_expr, and that function is passed to the passes one by
- /// one.
- ///
- /// @param[in] interpreter_error
- /// An error. If the expression fails to be interpreted, this error
- /// is set to a reason why.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- virtual bool
- runOnModule (llvm::Module &llvm_module);
-
- //------------------------------------------------------------------
- /// Interface stub
- ///
- /// Implementation of the llvm::ModulePass::assignPassManager()
- /// function.
- //------------------------------------------------------------------
- virtual void
- assignPassManager (llvm::PMStack &pass_mgr_stack,
- llvm::PassManagerType pass_mgr_type = llvm::PMT_ModulePassManager);
-
- //------------------------------------------------------------------
- /// Returns PMT_ModulePassManager
- ///
- /// Implementation of the llvm::ModulePass::getPotentialPassManagerType()
- /// function.
- //------------------------------------------------------------------
- virtual llvm::PassManagerType
- getPotentialPassManagerType() const;
-
-private:
- //------------------------------------------------------------------
- /// Ensures that the current function's linkage is set to external.
- /// Otherwise the JIT may not return an address for it.
- ///
- /// @param[in] llvm_function
- /// The function whose linkage is to be fixed.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- FixFunctionLinkage (llvm::Function &llvm_function);
-
- //------------------------------------------------------------------
- /// A module-level pass to replace all function pointers with their
- /// integer equivalents.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] llvm_module
- /// The module currently being processed.
- ///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
- /// @return
- /// True on success; false otherwise.
- //------------------------------------------------------------------
- bool
- HasSideEffects (llvm::Function &llvm_function);
-
- //------------------------------------------------------------------
- /// A function-level pass to check whether the function has side
- /// effects.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Get the address of a function, and a location to put the complete
- /// Value of the function if one is available.
- ///
- /// @param[in] function
- /// The function to find the location of.
- ///
- /// @param[out] ptr
- /// The location of the function in the target.
- ///
- /// @param[out] name
- /// The resolved name of the function (matters for intrinsics).
- ///
- /// @param[out] value_ptr
- /// A variable to put the function's completed Value* in, or NULL
- /// if the Value* shouldn't be stored anywhere.
- ///
- /// @return
- /// The pointer.
- //------------------------------------------------------------------
- LookupResult
- GetFunctionAddress (llvm::Function *function,
- uint64_t &ptr,
- lldb_private::ConstString &name,
- llvm::Constant **&value_ptr);
-
- //------------------------------------------------------------------
- /// Build a function pointer given a type and a raw pointer.
- ///
- /// @param[in] type
- /// The type of the function pointer to be built.
- ///
- /// @param[in] ptr
- /// The value of the pointer.
- ///
- /// @return
- /// The pointer.
- //------------------------------------------------------------------
- llvm::Constant *
- BuildFunctionPointer (llvm::Type *type,
- uint64_t ptr);
-
- void
- RegisterFunctionMetadata (llvm::LLVMContext &context,
- llvm::Value *function_ptr,
- const char *name);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
- /// @return
- /// True if the function has side effects (or if this cannot
- /// be determined); false otherwise.
- //------------------------------------------------------------------
- bool
- ResolveFunctionPointers (llvm::Module &llvm_module);
-
- //------------------------------------------------------------------
- /// A function-level pass to take the generated global value
- /// $__lldb_expr_result and make it into a persistent variable.
- /// Also see ASTResultSynthesizer.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Find the NamedDecl corresponding to a Value. This interface is
- /// exposed for the IR interpreter.
- ///
- /// @param[in] module
- /// The module containing metadata to search
- ///
- /// @param[in] global
- /// The global entity to search for
- ///
- /// @return
- /// The corresponding variable declaration
- //------------------------------------------------------------------
-public:
- static clang::NamedDecl *
- DeclForGlobal (const llvm::GlobalValue *global_val, llvm::Module *module);
-private:
- clang::NamedDecl *
- DeclForGlobal (llvm::GlobalValue *global);
-
- //------------------------------------------------------------------
- /// Set the constant result variable m_const_result to the provided
- /// constant, assuming it can be evaluated. The result variable
- /// will be reset to NULL later if the expression has side effects.
- ///
- /// @param[in] initializer
- /// The constant initializer for the variable.
- ///
- /// @param[in] name
- /// The name of the result variable.
- ///
- /// @param[in] type
- /// The Clang type of the result variable.
- //------------------------------------------------------------------
- void
- MaybeSetConstantResult (llvm::Constant *initializer,
- const lldb_private::ConstString &name,
- lldb_private::TypeFromParser type);
-
- //------------------------------------------------------------------
- /// If the IR represents a cast of a variable, set m_const_result
- /// to the result of the cast. The result variable will be reset to
- /// NULL latger if the expression has side effects.
- ///
- /// @param[in] type
- /// The Clang type of the result variable.
- //------------------------------------------------------------------
- void
- MaybeSetCastResult (lldb_private::TypeFromParser type);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- CreateResultVariable (llvm::Function &llvm_function);
-
- //------------------------------------------------------------------
- /// A module-level pass to find Objective-C constant strings and
- /// transform them to calls to CFStringCreateWithBytes.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Rewrite a single Objective-C constant string.
- ///
- /// @param[in] NSStr
- /// The constant NSString to be transformed
- ///
- /// @param[in] CStr
- /// The constant C string inside the NSString. This will be
- /// passed as the bytes argument to CFStringCreateWithBytes.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RewriteObjCConstString (llvm::GlobalVariable *NSStr,
- llvm::GlobalVariable *CStr);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RewriteObjCConstStrings ();
-
- //------------------------------------------------------------------
- /// A basic block-level pass to find all Objective-C method calls and
- /// rewrite them to use sel_registerName instead of statically allocated
- /// selectors. The reason is that the selectors are created on the
- /// assumption that the Objective-C runtime will scan the appropriate
- /// section and prepare them. This doesn't happen when code is copied
- /// into the target, though, and there's no easy way to induce the
- /// runtime to scan them. So instead we get our selectors from
- /// sel_registerName.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Replace a single selector reference
- ///
- /// @param[in] selector_load
- /// The load of the statically-allocated selector.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RewriteObjCSelector (llvm::Instruction* selector_load);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] basic_block
- /// The basic block currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RewriteObjCSelectors (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// A basic block-level pass to find all newly-declared persistent
- /// variables and register them with the ClangExprDeclMap. This
- /// allows them to be materialized and dematerialized like normal
- /// external variables. Before transformation, these persistent
- /// variables look like normal locals, so they have an allocation.
- /// This pass excises these allocations and makes references look
- /// like external references where they will be resolved -- like all
- /// other external references -- by ResolveExternals().
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Handle a single allocation of a persistent variable
- ///
- /// @param[in] persistent_alloc
- /// The allocation of the persistent variable.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RewritePersistentAlloc (llvm::Instruction *persistent_alloc);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] basic_block
- /// The basic block currently being processed.
- //------------------------------------------------------------------
- bool
- RewritePersistentAllocs (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// A function-level pass to find all external variables and functions
- /// used in the IR. Each found external variable is added to the
- /// struct, and each external function is resolved in place, its call
- /// replaced with a call to a function pointer whose value is the
- /// address of the function in the target process.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Write an initializer to a memory array of assumed sufficient
- /// size.
- ///
- /// @param[in] data
- /// A pointer to the data to write to.
- ///
- /// @param[in] initializer
- /// The initializer itself.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- MaterializeInitializer (uint8_t *data, llvm::Constant *initializer);
-
- //------------------------------------------------------------------
- /// Move an internal variable into the static allocation section.
- ///
- /// @param[in] global_variable
- /// The variable.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- MaterializeInternalVariable (llvm::GlobalVariable *global_variable);
-
- //------------------------------------------------------------------
- /// Handle a single externally-defined variable
- ///
- /// @param[in] value
- /// The variable.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- MaybeHandleVariable (llvm::Value *value);
-
- //------------------------------------------------------------------
- /// Handle a single externally-defined symbol
- ///
- /// @param[in] symbol
- /// The symbol.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- HandleSymbol (llvm::Value *symbol);
-
- //------------------------------------------------------------------
- /// Handle a single externally-defined Objective-C class
- ///
- /// @param[in] classlist_reference
- /// The reference, usually "01L_OBJC_CLASSLIST_REFERENCES_$_n"
- /// where n (if present) is an index.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- HandleObjCClass(llvm::Value *classlist_reference);
-
- //------------------------------------------------------------------
- /// Handle all the arguments to a function call
- ///
- /// @param[in] C
- /// The call instruction.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- MaybeHandleCallArguments (llvm::CallInst *call_inst);
-
- //------------------------------------------------------------------
- /// Resolve variable references in calls to external functions
- ///
- /// @param[in] basic_block
- /// The basic block currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- ResolveCalls (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// Remove calls to __cxa_atexit, which should never be generated by
- /// expressions.
- ///
- /// @param[in] call_inst
- /// The call instruction.
- ///
- /// @return
- /// True if the scan was successful; false if some operation
- /// failed
- //------------------------------------------------------------------
- bool
- RemoveCXAAtExit (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] basic_block
- /// The function currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- ResolveExternals (llvm::Function &llvm_function);
-
- //------------------------------------------------------------------
- /// A basic block-level pass to excise guard variables from the code.
- /// The result for the function is passed through Clang as a static
- /// variable. Static variables normally have guard variables to
- /// ensure that they are only initialized once.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Rewrite a load to a guard variable to return constant 0.
- ///
- /// @param[in] guard_load
- /// The load instruction to zero out.
- //------------------------------------------------------------------
- void
- TurnGuardLoadIntoZero(llvm::Instruction* guard_load);
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] basic_block
- /// The basic block currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- RemoveGuards (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// A module-level pass to allocate all string literals in a separate
- /// allocation and redirect references to them.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- ReplaceStrings ();
-
- //------------------------------------------------------------------
- /// A basic block-level pass to find all literals that will be
- /// allocated as statics by the JIT (in contrast to the Strings,
- /// which already are statics) and synthesize loads for them.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] basic_block
- /// The basic block currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- ReplaceStaticLiterals (llvm::BasicBlock &basic_block);
-
- //------------------------------------------------------------------
- /// A function-level pass to make all external variable references
- /// point at the correct offsets from the void* passed into the
- /// function. ClangExpressionDeclMap::DoStructLayout() must be called
- /// beforehand, so that the offsets are valid.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- ReplaceVariables (llvm::Function &llvm_function);
-
- //------------------------------------------------------------------
- /// A module-level pass to remove all global variables from the
- /// module since it no longer should export or import any symbols.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// The top-level pass implementation
- ///
- /// @param[in] llvm_module
- /// The module currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- StripAllGVs (llvm::Module &llvm_module);
-
- class StaticDataAllocator {
- public:
- StaticDataAllocator(lldb_private::IRExecutionUnit &execution_unit);
- lldb_private::StreamString &GetStream()
- {
- return m_stream_string;
- }
- lldb::addr_t Allocate();
-
- lldb::TargetSP
- GetTarget();
- private:
- lldb_private::IRExecutionUnit &m_execution_unit;
- lldb_private::StreamString m_stream_string;
- lldb::addr_t m_allocation;
- };
-
- /// Flags
- bool m_resolve_vars; ///< True if external variable references and persistent variable references should be resolved
- std::string m_func_name; ///< The name of the function to translate
- lldb_private::ConstString m_result_name; ///< The name of the result variable ($0, $1, ...)
- lldb_private::TypeFromParser m_result_type; ///< The type of the result variable.
- llvm::Module *m_module; ///< The module being processed, or NULL if that has not been determined yet.
- std::unique_ptr<llvm::DataLayout> m_target_data; ///< The target data for the module being processed, or NULL if there is no module.
- lldb_private::ClangExpressionDeclMap *m_decl_map; ///< The DeclMap containing the Decls
- StaticDataAllocator m_data_allocator; ///< The allocator to use for constant strings
- llvm::Constant *m_CFStringCreateWithBytes; ///< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type
- llvm::Constant *m_sel_registerName; ///< The address of the function sel_registerName, cast to the appropriate function pointer type
- llvm::IntegerType *m_intptr_ty; ///< The type of an integer large enough to hold a pointer.
- lldb_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed
-
- llvm::StoreInst *m_result_store; ///< If non-NULL, the store instruction that writes to the result variable. If m_has_side_effects is true, this is NULL.
- bool m_result_is_pointer; ///< True if the function's result in the AST is a pointer (see comments in ASTResultSynthesizer::SynthesizeBodyResult)
-
- llvm::GlobalVariable *m_reloc_placeholder; ///< A placeholder that will be replaced by a pointer to the final location of the static allocation.
-
- //------------------------------------------------------------------
- /// UnfoldConstant operates on a constant [Old] which has just been
- /// replaced with a value [New]. We assume that new_value has
- /// been properly placed early in the function, in front of the
- /// first instruction in the entry basic block
- /// [FirstEntryInstruction].
- ///
- /// UnfoldConstant reads through the uses of Old and replaces Old
- /// in those uses with New. Where those uses are constants, the
- /// function generates new instructions to compute the result of the
- /// new, non-constant expression and places them before
- /// FirstEntryInstruction. These instructions replace the constant
- /// uses, so UnfoldConstant calls itself recursively for those.
- ///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
-
- class FunctionValueCache {
- public:
- typedef std::function <llvm::Value *(llvm::Function *)> Maker;
-
- FunctionValueCache (Maker const &maker);
- ~FunctionValueCache ();
- llvm::Value *GetValue (llvm::Function *function);
- private:
- Maker const m_maker;
- typedef std::map<llvm::Function *, llvm::Value *> FunctionValueMap;
- FunctionValueMap m_values;
- };
-
- FunctionValueCache m_entry_instruction_finder;
-
- static bool
- UnfoldConstant (llvm::Constant *old_constant,
- FunctionValueCache &value_maker,
- FunctionValueCache &entry_instruction_finder);
-
- //------------------------------------------------------------------
- /// Construct a reference to m_reloc_placeholder with a given type
- /// and offset. This typically happens after inserting data into
- /// m_data_allocator.
- ///
- /// @param[in] type
- /// The type of the value being loaded.
- ///
- /// @param[in] offset
- /// The offset of the value from the base of m_data_allocator.
- ///
- /// @return
- /// The Constant for the reference, usually a ConstantExpr.
- //------------------------------------------------------------------
- llvm::Constant *
- BuildRelocation(llvm::Type *type,
- uint64_t offset);
-
- //------------------------------------------------------------------
- /// Commit the allocation in m_data_allocator and use its final
- /// location to replace m_reloc_placeholder.
- ///
- /// @param[in] module
- /// The module that m_data_allocator resides in
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- CompleteDataAllocation ();
-
-};
-
-#endif
diff --git a/include/lldb/Expression/IRInterpreter.h b/include/lldb/Expression/IRInterpreter.h
index c314bf1099ea5..4eb81bc68d19d 100644
--- a/include/lldb/Expression/IRInterpreter.h
+++ b/include/lldb/Expression/IRInterpreter.h
@@ -13,7 +13,6 @@
#include "lldb/lldb-public.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Stream.h"
-#include "lldb/Symbol/TaggedASTType.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Pass.h"
diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h
index 80add46ef0dad..6fb718a341f7c 100644
--- a/include/lldb/Expression/IRMemoryMap.h
+++ b/include/lldb/Expression/IRMemoryMap.h
@@ -50,7 +50,12 @@ public:
eAllocationPolicyProcessOnly ///< The intent is that this allocation exist only in the process.
};
- lldb::addr_t Malloc (size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, Error &error);
+ lldb::addr_t Malloc (size_t size,
+ uint8_t alignment,
+ uint32_t permissions,
+ AllocationPolicy policy,
+ bool zero_memory,
+ Error &error);
void Leak (lldb::addr_t process_address, Error &error);
void Free (lldb::addr_t process_address, Error &error);
@@ -124,7 +129,7 @@ private:
typedef std::map<lldb::addr_t, Allocation> AllocationMap;
AllocationMap m_allocations;
- lldb::addr_t FindSpace (size_t size);
+ lldb::addr_t FindSpace (size_t size, bool zero_memory = false);
bool ContainsHostOnlyAllocations ();
AllocationMap::iterator FindAllocation (lldb::addr_t addr, size_t size);
diff --git a/include/lldb/Expression/IRToDWARF.h b/include/lldb/Expression/IRToDWARF.h
deleted file mode 100644
index a4ae9b7ebfae7..0000000000000
--- a/include/lldb/Expression/IRToDWARF.h
+++ /dev/null
@@ -1,111 +0,0 @@
-//===-- IRToDWARF.h ---------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_IRToDWARF_h_
-#define liblldb_IRToDWARF_h_
-
-#include "llvm/Pass.h"
-#include "llvm/IR/LegacyPassManager.h"
-
-#include "lldb/lldb-public.h"
-
-class Relocator;
-//----------------------------------------------------------------------
-/// @class IRToDWARF IRToDWARF.h "lldb/Expression/IRToDWARF.h"
-/// @brief Transforms the IR for a function into a DWARF location expression
-///
-/// Once an expression has been parsed and converted to IR, it can run
-/// in two contexts: interpreted by LLDB as a DWARF location expression,
-/// or compiled by the JIT and inserted into the target process for
-/// execution.
-///
-/// IRToDWARF makes the first possible, by traversing the control flow
-/// graph and writing the code for each basic block out as location
-/// expression bytecode. To ensure that the links between the basic blocks
-/// remain intact, it uses a relocator that records the location of every
-/// location expression instruction that has a relocatable operand, the
-/// target of that operand (as a basic block), and the mapping of each basic
-/// block to an actual location. After all code has been written out, the
-/// relocator post-processes it and performs all necessary relocations.
-//----------------------------------------------------------------------
-class IRToDWARF : public llvm::ModulePass
-{
-public:
- //------------------------------------------------------------------
- /// Constructor
- ///
- /// @param[in] local_vars
- /// A list of variables to populate with the local variables this
- /// expression uses.
- ///
- /// @param[in] decl_map
- /// The list of externally-referenced variables for the expression,
- /// for use in looking up globals.
- ///
- /// @param[in] stream
- /// The stream to dump DWARF bytecode onto.
- ///
- /// @param[in] func_name
- /// The name of the function to translate to DWARF.
- //------------------------------------------------------------------
- IRToDWARF(lldb_private::ClangExpressionVariableList &local_vars,
- lldb_private::ClangExpressionDeclMap *decl_map,
- lldb_private::StreamString &strm,
- const char* func_name = "$__lldb_expr");
-
- //------------------------------------------------------------------
- /// Destructor
- //------------------------------------------------------------------
- virtual ~IRToDWARF();
-
- //------------------------------------------------------------------
- /// Run this IR transformer on a single module
- ///
- /// @param[in] M
- /// The module to run on. This module is searched for the function
- /// $__lldb_expr, and that function is converted to a location
- /// expression.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool runOnModule(llvm::Module &M);
-
- //------------------------------------------------------------------
- /// Interface stub
- //------------------------------------------------------------------
- void assignPassManager(llvm::PMStack &PMS,
- llvm::PassManagerType T = llvm::PMT_ModulePassManager);
-
- //------------------------------------------------------------------
- /// Returns PMT_ModulePassManager
- //------------------------------------------------------------------
- llvm::PassManagerType getPotentialPassManagerType() const;
-private:
- //------------------------------------------------------------------
- /// Run this IR transformer on a single basic block
- ///
- /// @param[in] BB
- /// The basic block to transform.
- ///
- /// @param[in] Relocator
- /// The relocator to use when registering branches.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool runOnBasicBlock(llvm::BasicBlock &BB, Relocator &Relocator);
-
- std::string m_func_name; ///< The name of the function to translate
- lldb_private::ClangExpressionVariableList &m_local_vars; ///< The list of local variables to populate while transforming
- lldb_private::ClangExpressionDeclMap *m_decl_map; ///< The list of external variables
- lldb_private::StreamString &m_strm; ///< The stream to write bytecode to
-};
-
-#endif
diff --git a/include/lldb/Expression/LLVMUserExpression.h b/include/lldb/Expression/LLVMUserExpression.h
new file mode 100644
index 0000000000000..e3d17986f4b38
--- /dev/null
+++ b/include/lldb/Expression/LLVMUserExpression.h
@@ -0,0 +1,118 @@
+//===-- LLVMUserExpression.h ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LLVMUserExpression_h
+#define liblldb_LLVMUserExpression_h
+
+// C Includes
+// C++ Includes
+#include <string>
+#include <map>
+#include <vector>
+
+// Project includes
+#include "lldb/Expression/UserExpression.h"
+
+namespace lldb_private
+{
+
+//----------------------------------------------------------------------
+/// @class LLVMUserExpression LLVMUserExpression.h "lldb/Expression/LLVMUserExpression.h"
+/// @brief Encapsulates a one-time expression for use in lldb.
+///
+/// LLDB uses expressions for various purposes, notably to call functions
+/// and as a backend for the expr command. LLVMUserExpression is a virtual base
+/// class that encapsulates the objects needed to parse and JIT an expression.
+/// The actual parsing part will be provided by the specific implementations
+/// of LLVMUserExpression - which will be vended through the appropriate TypeSystem.
+//----------------------------------------------------------------------
+class LLVMUserExpression : public UserExpression
+{
+ public:
+ LLVMUserExpression(ExecutionContextScope &exe_scope,
+ const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ ResultType desired_type,
+ const EvaluateExpressionOptions &options);
+ ~LLVMUserExpression() override;
+
+ lldb::ExpressionResults Execute(Stream &error_stream,
+ ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) override;
+
+ bool FinalizeJITExecution(Stream &error_stream,
+ ExecutionContext &exe_ctx,
+ lldb::ExpressionVariableSP &result,
+ lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+ lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override;
+
+ bool
+ CanInterpret() override
+ {
+ return m_can_interpret;
+ }
+
+ //------------------------------------------------------------------
+ /// Return the string that the parser should parse. Must be a full
+ /// translation unit.
+ //------------------------------------------------------------------
+ const char *
+ Text() override
+ {
+ return m_transformed_text.c_str();
+ }
+
+ lldb::ModuleSP GetJITModule() override;
+
+ protected:
+ virtual void ScanContext(ExecutionContext &exe_ctx, lldb_private::Error &err) = 0;
+
+ bool PrepareToExecuteJITExpression(Stream &error_stream, ExecutionContext &exe_ctx, lldb::addr_t &struct_address);
+
+ virtual bool
+ AddArguments (ExecutionContext &exe_ctx,
+ std::vector<lldb::addr_t> &args,
+ lldb::addr_t struct_address,
+ Stream &error_stream) = 0;
+
+
+ lldb::addr_t m_stack_frame_bottom; ///< The bottom of the allocated stack frame.
+ lldb::addr_t m_stack_frame_top; ///< The top of the allocated stack frame.
+
+ bool m_allow_cxx; ///< True if the language allows C++.
+ bool m_allow_objc; ///< True if the language allows Objective-C.
+ std::string m_transformed_text; ///< The text of the expression, as send to the parser
+
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; ///< The execution unit the expression is stored in.
+ std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use when running the expression.
+ lldb::ModuleWP m_jit_module_wp;
+ bool m_enforce_valid_object; ///< True if the expression parser should enforce the presence of a valid class pointer
+ ///in order to generate the expression as a method.
+ bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++ member function (true if it was parsed
+ ///when exe_ctx was in a C++ method).
+ bool m_in_objectivec_method; ///< True if the expression is compiled as an Objective-C method (true if it was parsed
+ ///when exe_ctx was in an Objective-C method).
+ bool m_in_static_method; ///< True if the expression is compiled as a static (or class) method (currently true if it
+ ///was parsed when exe_ctx was in an Objective-C class method).
+ bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and passed in. False if the expression
+ ///doesn't really use them and they can be NULL.
+ bool m_const_object; ///< True if "this" is const.
+ Target *m_target; ///< The target for storing persistent data like types and variables.
+
+ bool m_can_interpret; ///< True if the expression could be evaluated statically; false otherwise.
+ lldb::addr_t
+ m_materialized_address; ///< The address at which the arguments to the expression have been materialized.
+ Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
+};
+
+} // namespace lldb_private
+#endif
diff --git a/include/lldb/Expression/Materializer.h b/include/lldb/Expression/Materializer.h
index 208a081339234..f293fddc10224 100644
--- a/include/lldb/Expression/Materializer.h
+++ b/include/lldb/Expression/Materializer.h
@@ -7,18 +7,22 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Materializer_h
-#define lldb_Materializer_h
+#ifndef liblldb_Materializer_h
+#define liblldb_Materializer_h
+// C Includes
+// C++ Includes
+#include <memory>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Expression/IRMemoryMap.h"
-#include "lldb/Host/Mutex.h"
-#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/TaggedASTType.h"
#include "lldb/Target/StackFrame.h"
-#include <vector>
-
namespace lldb_private
{
@@ -32,8 +36,8 @@ public:
{
public:
Dematerializer () :
- m_materializer(NULL),
- m_map(NULL),
+ m_materializer(nullptr),
+ m_map(nullptr),
m_process_address(LLDB_INVALID_ADDRESS)
{
}
@@ -44,7 +48,6 @@ public:
}
void Dematerialize (Error &err,
- lldb::ClangExpressionVariableSP &result_sp,
lldb::addr_t frame_top,
lldb::addr_t frame_bottom);
@@ -54,6 +57,7 @@ public:
{
return m_materializer && m_map && (m_process_address != LLDB_INVALID_ADDRESS);
}
+
private:
friend class Materializer;
@@ -84,11 +88,28 @@ public:
DematerializerSP Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err);
- uint32_t AddPersistentVariable (lldb::ClangExpressionVariableSP &persistent_variable_sp, Error &err);
- uint32_t AddVariable (lldb::VariableSP &variable_sp, Error &err);
- uint32_t AddResultVariable (const TypeFromUser &type, bool is_lvalue, bool keep_in_memory, Error &err);
- uint32_t AddSymbol (const Symbol &symbol_sp, Error &err);
- uint32_t AddRegister (const RegisterInfo &register_info, Error &err);
+ class PersistentVariableDelegate
+ {
+ public:
+ virtual ~PersistentVariableDelegate();
+ virtual ConstString GetName() = 0;
+ virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;
+ };
+
+ uint32_t AddPersistentVariable (lldb::ExpressionVariableSP &persistent_variable_sp,
+ PersistentVariableDelegate *delegate,
+ Error &err);
+ uint32_t AddVariable (lldb::VariableSP &variable_sp,
+ Error &err);
+ uint32_t AddResultVariable (const CompilerType &type,
+ bool is_lvalue,
+ bool keep_in_memory,
+ PersistentVariableDelegate *delegate,
+ Error &err);
+ uint32_t AddSymbol (const Symbol &symbol_sp,
+ Error &err);
+ uint32_t AddRegister (const RegisterInfo &register_info,
+ Error &err);
uint32_t GetStructAlignment ()
{
@@ -100,14 +121,6 @@ public:
return m_current_offset;
}
- uint32_t GetResultOffset ()
- {
- if (m_result_entity)
- return m_result_entity->GetOffset();
- else
- return UINT32_MAX;
- }
-
class Entity
{
public:
@@ -117,11 +130,9 @@ public:
m_offset(0)
{
}
-
- virtual ~Entity ()
- {
- }
-
+
+ virtual ~Entity() = default;
+
virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err) = 0;
virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) = 0;
@@ -147,8 +158,9 @@ public:
{
m_offset = offset;
}
+
protected:
- void SetSizeAndAlignmentFromType (ClangASTType &type);
+ void SetSizeAndAlignmentFromType (CompilerType &type);
uint32_t m_alignment;
uint32_t m_size;
@@ -163,11 +175,10 @@ private:
DematerializerWP m_dematerializer_wp;
EntityVector m_entities;
- Entity *m_result_entity;
uint32_t m_current_offset;
uint32_t m_struct_alignment;
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_Materializer_h
diff --git a/include/lldb/Expression/REPL.h b/include/lldb/Expression/REPL.h
new file mode 100644
index 0000000000000..21d22de8e0d7d
--- /dev/null
+++ b/include/lldb/Expression/REPL.h
@@ -0,0 +1,211 @@
+//===-- REPL.h --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_REPL_h
+#define lldb_REPL_h
+
+// C Includes
+// C++ Includes
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Interpreter/OptionGroupFormat.h"
+#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/../../source/Commands/CommandObjectExpression.h"
+
+namespace lldb_private
+{
+
+class REPL : public IOHandlerDelegate
+{
+public:
+ //----------------------------------------------------------------------
+ // See TypeSystem.h for how to add subclasses to this.
+ //----------------------------------------------------------------------
+ enum LLVMCastKind {
+ eKindClang,
+ eKindSwift,
+ eKindGo,
+ kNumKinds
+ };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ REPL(LLVMCastKind kind, Target &target);
+
+ ~REPL() override;
+
+ //------------------------------------------------------------------
+ /// Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra arguments for the compiler.
+ ///
+ /// @param[out] error
+ /// If this language is supported but the REPL couldn't be created, this error is populated with the reason.
+ ///
+ /// @param[in] language
+ /// The language to create a REPL for.
+ ///
+ /// @param[in] debugger
+ /// If provided, and target is nullptr, the debugger to use when setting up a top-level REPL.
+ ///
+ /// @param[in] target
+ /// If provided, the target to put the REPL inside.
+ ///
+ /// @param[in] repl_options
+ /// If provided, additional options for the compiler when parsing REPL expressions.
+ ///
+ /// @return
+ /// The range of the containing object in the target process.
+ //------------------------------------------------------------------
+ static lldb::REPLSP
+ Create (Error &Error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options);
+
+ void
+ SetFormatOptions (const OptionGroupFormat &options)
+ {
+ m_format_options = options;
+ }
+
+ void
+ SetValueObjectDisplayOptions (const OptionGroupValueObjectDisplay &options)
+ {
+ m_varobj_options = options;
+ }
+
+ void
+ SetCommandOptions (const CommandObjectExpression::CommandOptions &options)
+ {
+ m_command_options = options;
+ }
+
+ void
+ SetCompilerOptions (const char *options)
+ {
+ if (options)
+ m_compiler_options = options;
+ }
+
+ lldb::IOHandlerSP
+ GetIOHandler ();
+
+ Error
+ RunLoop ();
+
+ //------------------------------------------------------------------
+ // IOHandler::Delegate functions
+ //------------------------------------------------------------------
+ void
+ IOHandlerActivated (IOHandler &io_handler) override;
+
+ bool
+ IOHandlerInterrupt (IOHandler &io_handler) override;
+
+ void
+ IOHandlerInputInterrupted (IOHandler &io_handler,
+ std::string &line) override;
+
+ const char *
+ IOHandlerGetFixIndentationCharacters () override;
+
+ ConstString
+ IOHandlerGetControlSequence (char ch) override;
+
+ const char *
+ IOHandlerGetCommandPrefix () override;
+
+ const char *
+ IOHandlerGetHelpPrologue () override;
+
+ bool
+ IOHandlerIsInputComplete (IOHandler &io_handler,
+ StringList &lines) override;
+
+ int
+ IOHandlerFixIndentation (IOHandler &io_handler,
+ const StringList &lines,
+ int cursor_position) override;
+
+ void
+ IOHandlerInputComplete (IOHandler &io_handler,
+ std::string &line) override;
+
+ int
+ IOHandlerComplete (IOHandler &io_handler,
+ const char *current_line,
+ const char *cursor,
+ const char *last_char,
+ int skip_first_n_matches,
+ int max_matches,
+ StringList &matches) override;
+
+protected:
+ static int
+ CalculateActualIndentation (const StringList &lines);
+
+ //----------------------------------------------------------------------
+ // Subclasses should override these functions to implement a functional REPL.
+ //----------------------------------------------------------------------
+
+ virtual Error
+ DoInitialization () = 0;
+
+ virtual ConstString
+ GetSourceFileBasename () = 0;
+
+ virtual const char *
+ GetAutoIndentCharacters () = 0;
+
+ virtual bool
+ SourceIsComplete (const std::string &source) = 0;
+
+ virtual lldb::offset_t
+ GetDesiredIndentation (const StringList &lines,
+ int cursor_position,
+ int tab_size) = 0; // LLDB_INVALID_OFFSET means no change
+
+ virtual lldb::LanguageType
+ GetLanguage () = 0;
+
+ virtual bool
+ PrintOneVariable (Debugger &debugger,
+ lldb::StreamFileSP &output_sp,
+ lldb::ValueObjectSP &valobj_sp,
+ ExpressionVariable *var = nullptr) = 0;
+
+ virtual int
+ CompleteCode(const std::string &current_code,
+ StringList &matches) = 0;
+
+ OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
+ OptionGroupValueObjectDisplay m_varobj_options;
+ CommandObjectExpression::CommandOptions m_command_options;
+ std::string m_compiler_options;
+
+ bool m_enable_auto_indent = true;
+ std::string m_indent_str; // Use this string for each level of indentation
+ std::string m_current_indent_str;
+ uint32_t m_current_indent_level = 0;
+
+ std::string m_repl_source_path;
+ bool m_dedicated_repl_mode = false;
+
+ StringList m_code; // All accumulated REPL statements are saved here
+
+ Target &m_target;
+ lldb::IOHandlerSP m_io_handler_sp;
+ LLVMCastKind m_kind;
+
+private:
+ std::string
+ GetSourcePath();
+};
+
+} // namespace lldb_private
+
+#endif // lldb_REPL_h
diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/UserExpression.h
index a549f5e8a547c..517dfcd1dc474 100644
--- a/include/lldb/Expression/ClangUserExpression.h
+++ b/include/lldb/Expression/UserExpression.h
@@ -1,4 +1,4 @@
-//===-- ClangUserExpression.h -----------------------------------*- C++ -*-===//
+//===-- UserExpression.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,46 +7,44 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ClangUserExpression_h_
-#define liblldb_ClangUserExpression_h_
+#ifndef liblldb_UserExpression_h_
+#define liblldb_UserExpression_h_
// C Includes
// C++ Includes
+#include <memory>
#include <string>
-#include <map>
#include <vector>
// Other libraries and framework includes
// Project includes
-
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Expression/ClangExpression.h"
-#include "lldb/Expression/ClangExpressionVariable.h"
-#include "lldb/Expression/IRForTarget.h"
+#include "lldb/Expression/Expression.h"
#include "lldb/Expression/Materializer.h"
-#include "lldb/Symbol/TaggedASTType.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
namespace lldb_private
{
//----------------------------------------------------------------------
-/// @class ClangUserExpression ClangUserExpression.h "lldb/Expression/ClangUserExpression.h"
-/// @brief Encapsulates a single expression for use with Clang
+/// @class UserExpression UserExpression.h "lldb/Expression/UserExpression.h"
+/// @brief Encapsulates a one-time expression for use in lldb.
///
/// LLDB uses expressions for various purposes, notably to call functions
-/// and as a backend for the expr command. ClangUserExpression encapsulates
-/// the objects needed to parse and interpret or JIT an expression. It
-/// uses the Clang parser to produce LLVM IR from the expression.
+/// and as a backend for the expr command. UserExpression is a virtual base
+/// class that encapsulates the objects needed to parse and interpret or
+/// JIT an expression. The actual parsing part will be provided by the specific
+/// implementations of UserExpression - which will be vended through the
+/// appropriate TypeSystem.
//----------------------------------------------------------------------
-class ClangUserExpression : public ClangExpression
+class UserExpression : public Expression
{
public:
-
enum { kDefaultTimeout = 500000u };
+
//------------------------------------------------------------------
/// Constructor
///
@@ -54,7 +52,7 @@ public:
/// The expression to parse.
///
/// @param[in] expr_prefix
- /// If non-NULL, a C string containing translation-unit level
+ /// If non-nullptr, a C string containing translation-unit level
/// definitions to be included when the expression is parsed.
///
/// @param[in] language
@@ -66,16 +64,17 @@ public:
/// If not eResultTypeAny, the type to use for the expression
/// result.
//------------------------------------------------------------------
- ClangUserExpression (const char *expr,
- const char *expr_prefix,
- lldb::LanguageType language,
- ResultType desired_type);
+ UserExpression (ExecutionContextScope &exe_scope,
+ const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ ResultType desired_type,
+ const EvaluateExpressionOptions &options);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual
- ~ClangUserExpression ();
+ ~UserExpression() override;
//------------------------------------------------------------------
/// Parse the expression
@@ -98,18 +97,14 @@ public:
/// @return
/// True on success (no errors); false otherwise.
//------------------------------------------------------------------
- bool
+ virtual bool
Parse (Stream &error_stream,
ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory,
- bool generate_debug_info);
+ bool generate_debug_info) = 0;
- bool
- CanInterpret ()
- {
- return m_can_interpret;
- }
+ virtual bool CanInterpret() = 0;
bool
MatchesContext (ExecutionContext &exe_ctx);
@@ -128,9 +123,9 @@ public:
/// Expression evaluation options.
///
/// @param[in] shared_ptr_to_me
- /// This is a shared pointer to this ClangUserExpression. This is
+ /// This is a shared pointer to this UserExpression. This is
/// needed because Execute can push a thread plan that will hold onto
- /// the ClangUserExpression for an unbounded period of time. So you
+ /// the UserExpression for an unbounded period of time. So you
/// need to give the thread plan a reference to this object that can
/// keep it alive.
///
@@ -141,12 +136,10 @@ public:
/// @return
/// A Process::Execution results value.
//------------------------------------------------------------------
- lldb::ExpressionResults
- Execute (Stream &error_stream,
- ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions& options,
- lldb::ClangUserExpressionSP &shared_ptr_to_me,
- lldb::ClangExpressionVariableSP &result);
+ virtual lldb::ExpressionResults Execute(Stream &error_stream, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) = 0;
//------------------------------------------------------------------
/// Apply the side effects of the function to program state.
@@ -171,21 +164,18 @@ public:
/// @return
/// A Process::Execution results value.
//------------------------------------------------------------------
- bool
- FinalizeJITExecution (Stream &error_stream,
- ExecutionContext &exe_ctx,
- lldb::ClangExpressionVariableSP &result,
- lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
- lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS);
+ virtual bool FinalizeJITExecution(Stream &error_stream, ExecutionContext &exe_ctx,
+ lldb::ExpressionVariableSP &result,
+ lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+ lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) = 0;
//------------------------------------------------------------------
- /// Return the string that the parser should parse. Must be a full
- /// translation unit.
+ /// Return the string that the parser should parse.
//------------------------------------------------------------------
const char *
- Text ()
+ Text() override
{
- return m_transformed_text.c_str();
+ return m_expr_text.c_str();
}
//------------------------------------------------------------------
@@ -203,7 +193,7 @@ public:
/// function.
//------------------------------------------------------------------
const char *
- FunctionName ()
+ FunctionName() override
{
return "$__lldb_expr";
}
@@ -212,39 +202,18 @@ public:
/// Return the language that should be used when parsing. To use
/// the default, return eLanguageTypeUnknown.
//------------------------------------------------------------------
- virtual lldb::LanguageType
- Language ()
+ lldb::LanguageType
+ Language() override
{
return m_language;
}
//------------------------------------------------------------------
- /// Return the object that the parser should use when resolving external
- /// values. May be NULL if everything should be self-contained.
- //------------------------------------------------------------------
- ClangExpressionDeclMap *
- DeclMap ()
- {
- return m_expr_decl_map.get();
- }
-
- //------------------------------------------------------------------
- /// Return the object that the parser should allow to access ASTs.
- /// May be NULL if the ASTs do not need to be transformed.
- ///
- /// @param[in] passthrough
- /// The ASTConsumer that the returned transformer should send
- /// the ASTs to after transformation.
- //------------------------------------------------------------------
- clang::ASTConsumer *
- ASTTransformer (clang::ASTConsumer *passthrough);
-
- //------------------------------------------------------------------
/// Return the desired result type of the function, or
/// eResultTypeAny if indifferent.
//------------------------------------------------------------------
- virtual ResultType
- DesiredResultType ()
+ ResultType
+ DesiredResultType() override
{
return m_desired_type;
}
@@ -254,7 +223,7 @@ public:
/// expression.
//------------------------------------------------------------------
bool
- NeedsValidation ()
+ NeedsValidation() override
{
return true;
}
@@ -264,63 +233,87 @@ public:
/// resolved.
//------------------------------------------------------------------
bool
- NeedsVariableResolution ()
+ NeedsVariableResolution() override
{
return true;
}
+
+ EvaluateExpressionOptions *
+ GetOptions() override
+ {
+ return &m_options;
+ }
+
+ virtual lldb::ExpressionVariableSP
+ GetResultAfterDematerialization(ExecutionContextScope *exe_scope)
+ {
+ return lldb::ExpressionVariableSP();
+ }
+
+ virtual lldb::ModuleSP
+ GetJITModule()
+ {
+ return lldb::ModuleSP();
+ }
//------------------------------------------------------------------
- /// Evaluate one expression and return its result.
+ /// Evaluate one expression in the scratch context of the
+ /// target passed in the exe_ctx and return its result.
///
/// @param[in] exe_ctx
/// The execution context to use when evaluating the expression.
///
/// @param[in] options
- /// Expression evaluation options.
+ /// Expression evaluation options. N.B. The language in the
+ /// evaluation options will be used to determine the language used for
+ /// expression evaluation.
///
/// @param[in] expr_cstr
/// A C string containing the expression to be evaluated.
///
/// @param[in] expr_prefix
- /// If non-NULL, a C string containing translation-unit level
+ /// If non-nullptr, a C string containing translation-unit level
/// definitions to be included when the expression is parsed.
///
- /// @param[in/out] result_valobj_sp
+ /// @param[in,out] result_valobj_sp
/// If execution is successful, the result valobj is placed here.
///
- /// @param[out]
+ /// @param[out] error
/// Filled in with an error in case the expression evaluation
/// fails to parse, run, or evaluated.
///
+ /// @param[in] line_offset
+ /// The offset of the first line of the expression from the "beginning" of a virtual source file used for error reporting and debug info.
+ ///
+ /// @param[out] jit_module_sp_ptr
+ /// If non-nullptr, used to persist the generated IR module.
+ ///
/// @result
/// A Process::ExpressionResults value. eExpressionCompleted for success.
//------------------------------------------------------------------
static lldb::ExpressionResults
- Evaluate (ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions& options,
- const char *expr_cstr,
- const char *expr_prefix,
- lldb::ValueObjectSP &result_valobj_sp,
- Error &error);
+ Evaluate(ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions& options,
+ const char *expr_cstr,
+ const char *expr_prefix,
+ lldb::ValueObjectSP &result_valobj_sp,
+ Error &error,
+ uint32_t line_offset = 0,
+ lldb::ModuleSP *jit_module_sp_ptr = nullptr);
static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
-private:
+
+protected:
+ static lldb::addr_t
+ GetObjectPointer (lldb::StackFrameSP frame_sp,
+ ConstString &object_name,
+ Error &err);
+
//------------------------------------------------------------------
/// Populate m_in_cplusplus_method and m_in_objectivec_method based on the environment.
//------------------------------------------------------------------
void
- ScanContext (ExecutionContext &exe_ctx,
- lldb_private::Error &err);
-
- bool
- PrepareToExecuteJITExpression (Stream &error_stream,
- ExecutionContext &exe_ctx,
- lldb::addr_t &struct_address,
- lldb::addr_t &object_ptr,
- lldb::addr_t &cmd_ptr);
-
- void
InstallContext (ExecutionContext &exe_ctx);
bool
@@ -329,37 +322,14 @@ private:
lldb::ProcessSP &process_sp,
lldb::StackFrameSP &frame_sp);
- lldb::ProcessWP m_process_wp; ///< The process used as the context for the expression.
Address m_address; ///< The address the process is stopped in.
- lldb::addr_t m_stack_frame_bottom; ///< The bottom of the allocated stack frame.
- lldb::addr_t m_stack_frame_top; ///< The top of the allocated stack frame.
-
std::string m_expr_text; ///< The text of the expression, as typed by the user
std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user
lldb::LanguageType m_language; ///< The language to use when parsing (eLanguageTypeUnknown means use defaults)
- bool m_allow_cxx; ///< True if the language allows C++.
- bool m_allow_objc; ///< True if the language allows Objective-C.
- std::string m_transformed_text; ///< The text of the expression, as send to the parser
ResultType m_desired_type; ///< The type to coerce the expression's result to. If eResultTypeAny, inferred from the expression.
-
- std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing the expression.
- std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; ///< The execution unit the expression is stored in.
- std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use when running the expression.
- std::unique_ptr<ASTResultSynthesizer> m_result_synthesizer; ///< The result synthesizer, if one is needed.
- lldb::ModuleWP m_jit_module_wp;
- bool m_enforce_valid_object; ///< True if the expression parser should enforce the presence of a valid class pointer in order to generate the expression as a method.
- bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++ member function (true if it was parsed when exe_ctx was in a C++ method).
- bool m_in_objectivec_method; ///< True if the expression is compiled as an Objective-C method (true if it was parsed when exe_ctx was in an Objective-C method).
- bool m_in_static_method; ///< True if the expression is compiled as a static (or class) method (currently true if it was parsed when exe_ctx was in an Objective-C class method).
- bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and passed in. False if the expression doesn't really use them and they can be NULL.
- bool m_const_object; ///< True if "this" is const.
- Target *m_target; ///< The target for storing persistent data like types and variables.
-
- bool m_can_interpret; ///< True if the expression could be evaluated statically; false otherwise.
- lldb::addr_t m_materialized_address; ///< The address at which the arguments to the expression have been materialized.
- Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
+ EvaluateExpressionOptions m_options; ///< Additional options provided by the user.
};
} // namespace lldb_private
-#endif // liblldb_ClangUserExpression_h_
+#endif // liblldb_UserExpression_h_
diff --git a/include/lldb/Expression/ClangUtilityFunction.h b/include/lldb/Expression/UtilityFunction.h
index bb5601fa2914c..bee83d8111e41 100644
--- a/include/lldb/Expression/ClangUtilityFunction.h
+++ b/include/lldb/Expression/UtilityFunction.h
@@ -1,4 +1,4 @@
-//===-- ClangUtilityFunction.h ----------------------------------*- C++ -*-===//
+//===-- UtilityFunction.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,36 +7,33 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ClangUtilityFunction_h_
-#define liblldb_ClangUtilityFunction_h_
+#ifndef liblldb_UtilityFunction_h_
+#define liblldb_UtilityFunction_h_
// C Includes
// C++ Includes
+#include <memory>
#include <string>
-#include <map>
-#include <vector>
// Other libraries and framework includes
// Project includes
-
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Expression/ClangExpression.h"
+#include "lldb/Expression/Expression.h"
namespace lldb_private
{
//----------------------------------------------------------------------
-/// @class ClangUtilityFunction ClangUtilityFunction.h "lldb/Expression/ClangUtilityFunction.h"
-/// @brief Encapsulates a single expression for use with Clang
+/// @class UtilityFunction UtilityFunction.h "lldb/Expression/UtilityFunction.h"
+/// @brief Encapsulates a bit of source code that provides a function that is callable
///
/// LLDB uses expressions for various purposes, notably to call functions
-/// and as a backend for the expr command. ClangUtilityFunction encapsulates
+/// and as a backend for the expr command. UtilityFunction encapsulates
/// a self-contained function meant to be used from other code. Utility
/// functions can perform error-checking for ClangUserExpressions,
//----------------------------------------------------------------------
-class ClangUtilityFunction : public ClangExpression
+class UtilityFunction : public Expression
{
public:
//------------------------------------------------------------------
@@ -48,11 +45,11 @@ public:
/// @param[in] name
/// The name of the function, as used in the text.
//------------------------------------------------------------------
- ClangUtilityFunction (const char *text,
- const char *name);
+ UtilityFunction (ExecutionContextScope &exe_scope,
+ const char *text,
+ const char *name);
- virtual
- ~ClangUtilityFunction ();
+ ~UtilityFunction() override;
//------------------------------------------------------------------
/// Install the utility function into a process
@@ -66,13 +63,13 @@ public:
/// @return
/// True on success (no errors); false otherwise.
//------------------------------------------------------------------
- bool
- Install (Stream &error_stream, ExecutionContext &exe_ctx);
+ virtual bool
+ Install (Stream &error_stream, ExecutionContext &exe_ctx) = 0;
//------------------------------------------------------------------
/// Check whether the given PC is inside the function
///
- /// Especially useful if the function dereferences NULL to indicate a failed
+ /// Especially useful if the function dereferences nullptr to indicate a failed
/// assert.
///
/// @param[in] pc
@@ -89,14 +86,13 @@ public:
// so this always returns false if the function is not JIT compiled yet
return (address >= m_jit_start_addr && address < m_jit_end_addr);
}
-
-
+
//------------------------------------------------------------------
/// Return the string that the parser should parse. Must be a full
/// translation unit.
//------------------------------------------------------------------
const char *
- Text ()
+ Text() override
{
return m_function_text.c_str();
}
@@ -107,43 +103,19 @@ public:
/// function.
//------------------------------------------------------------------
const char *
- FunctionName ()
+ FunctionName() override
{
return m_function_name.c_str();
}
//------------------------------------------------------------------
- /// Return the object that the parser should use when resolving external
- /// values. May be NULL if everything should be self-contained.
- //------------------------------------------------------------------
- ClangExpressionDeclMap *
- DeclMap ()
- {
- return m_expr_decl_map.get();
- }
-
- //------------------------------------------------------------------
/// Return the object that the parser should use when registering
- /// local variables. May be NULL if the Expression doesn't care.
+ /// local variables. May be nullptr if the Expression doesn't care.
//------------------------------------------------------------------
- ClangExpressionVariableList *
+ ExpressionVariableList *
LocalVariables ()
{
- return NULL;
- }
-
- //------------------------------------------------------------------
- /// Return the object that the parser should allow to access ASTs.
- /// May be NULL if the ASTs do not need to be transformed.
- ///
- /// @param[in] passthrough
- /// The ASTConsumer that the returned transformer should send
- /// the ASTs to after transformation.
- //------------------------------------------------------------------
- clang::ASTConsumer *
- ASTTransformer (clang::ASTConsumer *passthrough)
- {
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -151,7 +123,7 @@ public:
/// expression.
//------------------------------------------------------------------
bool
- NeedsValidation ()
+ NeedsValidation() override
{
return false;
}
@@ -161,19 +133,30 @@ public:
/// resolved.
//------------------------------------------------------------------
bool
- NeedsVariableResolution ()
+ NeedsVariableResolution() override
{
return false;
}
-private:
- std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing and materializing the expression.
+ // This makes the function caller function.
+ FunctionCaller *
+ MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, Error &error);
+
+ // This one retrieves the function caller that is already made. If you haven't made it yet, this returns nullptr
+ FunctionCaller *
+ GetFunctionCaller()
+ {
+ return m_caller_up.get();
+ }
+
+protected:
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
lldb::ModuleWP m_jit_module_wp;
std::string m_function_text; ///< The text of the function. Must be a well-formed translation unit.
std::string m_function_name; ///< The name of the function.
+ std::unique_ptr<FunctionCaller> m_caller_up;
};
} // namespace lldb_private
-#endif // liblldb_ClangUtilityFunction_h_
+#endif // liblldb_UtilityFunction_h_
diff --git a/include/lldb/Host/Condition.h b/include/lldb/Host/Condition.h
index 7431315c37a03..bd793c65e0f46 100644
--- a/include/lldb/Host/Condition.h
+++ b/include/lldb/Host/Condition.h
@@ -7,11 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DBCondition_h_
-#define liblldb_DBCondition_h_
-#if defined(__cplusplus)
-
+#ifndef liblldb_Condition_h_
+#define liblldb_Condition_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-types.h"
#include "lldb/Host/Mutex.h"
@@ -31,7 +33,6 @@ class TimeValue;
class Condition
{
public:
-
//------------------------------------------------------------------
/// Default constructor
///
@@ -73,9 +74,9 @@ public:
/// \a mutex. The waiting thread unblocks only after another thread
/// signals or broadcasts this object's condition variable.
///
- /// If \a abstime is non-NULL, this function will return when the
+ /// If \a abstime is non-nullptr, this function will return when the
/// system time reaches the time specified in \a abstime if the
- /// condition variable doesn't get unblocked. If \a abstime is NULL
+ /// condition variable doesn't get unblocked. If \a abstime is nullptr
/// this function will wait for an infinite amount of time for the
/// condition variable to be unblocked.
///
@@ -87,19 +88,19 @@ public:
/// \c pthread_cond_wait() calls.
///
/// @param[in] abstime
- /// An absolute time at which to stop waiting if non-NULL, else
+ /// An absolute time at which to stop waiting if non-nullptr, else
/// wait an infinite amount of time for the condition variable
/// toget signaled.
///
/// @param[out] timed_out
- /// If not NULL, will be set to true if the wait timed out, and
+ /// If not nullptr, will be set to true if the wait timed out, and
// false otherwise.
///
/// @see Condition::Broadcast()
/// @see Condition::Signal()
//------------------------------------------------------------------
int
- Wait (Mutex &mutex, const TimeValue *abstime = NULL, bool *timed_out = NULL);
+ Wait(Mutex &mutex, const TimeValue *abstime = nullptr, bool *timed_out = nullptr);
protected:
//------------------------------------------------------------------
@@ -119,6 +120,4 @@ protected:
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif
-
+#endif // liblldb_Condition_h_
diff --git a/include/lldb/Host/Config.h b/include/lldb/Host/Config.h
index 7872eb95aab6e..f70f4de0819d3 100644
--- a/include/lldb/Host/Config.h
+++ b/include/lldb/Host/Config.h
@@ -22,10 +22,14 @@
#include "lldb/Host/linux/Config.h"
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
#include "lldb/Host/freebsd/Config.h"
+#elif defined(__NetBSD__)
+
+#include "lldb/Host/netbsd/Config.h"
+
#elif defined(__MINGW__) || defined (__MINGW32__)
#include "lldb/Host/mingw/Config.h"
diff --git a/include/lldb/Host/Debug.h b/include/lldb/Host/Debug.h
index 87dffb9865c27..7954ee0b6b3fe 100644
--- a/include/lldb/Host/Debug.h
+++ b/include/lldb/Host/Debug.h
@@ -10,7 +10,12 @@
#ifndef liblldb_Debug_h_
#define liblldb_Debug_h_
+// C Includes
+// C++ Includes
#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -59,9 +64,7 @@ namespace lldb_private {
}
}
- ~ResumeActionList()
- {
- }
+ ~ResumeActionList() = default;
bool
IsEmpty() const
@@ -114,7 +117,7 @@ namespace lldb_private {
}
if (default_ok && tid != LLDB_INVALID_THREAD_ID)
return GetActionForThread (LLDB_INVALID_THREAD_ID, false);
- return NULL;
+ return nullptr;
}
size_t
@@ -133,7 +136,7 @@ namespace lldb_private {
bool
SetDefaultThreadActionIfNeeded (lldb::StateType action, int signal)
{
- if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == NULL)
+ if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == nullptr)
{
// There isn't a default action so we do need to set it.
ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal };
@@ -203,4 +206,5 @@ namespace lldb_private {
} details;
};
}
-#endif // #ifndef liblldb_Debug_h_
+
+#endif // liblldb_Debug_h_
diff --git a/include/lldb/Host/Endian.h b/include/lldb/Host/Endian.h
index 1ae3c40b5ca48..df0796b7baf16 100644
--- a/include/lldb/Host/Endian.h
+++ b/include/lldb/Host/Endian.h
@@ -12,7 +12,7 @@
#include "lldb/lldb-enumerations.h"
-namespace lldb {
+namespace lldb_private {
namespace endian {
@@ -22,7 +22,7 @@ namespace endian {
uint8_t bytes[sizeof(uint32_t)];
} const endianTest = { 0x01020304 };
- inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }
+ inline lldb::ByteOrder InlHostByteOrder() { return (lldb::ByteOrder)endianTest.bytes[0]; }
// ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
}
diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h
index 5747cb5adcfde..27f3f405ffd37 100644
--- a/include/lldb/Host/File.h
+++ b/include/lldb/Host/File.h
@@ -9,12 +9,15 @@
#ifndef liblldb_File_h_
#define liblldb_File_h_
-#if defined(__cplusplus)
+// C Includes
+// C++ Includes
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/IOObject.h"
@@ -73,13 +76,11 @@ public:
File (const File &rhs);
- File &
- operator= (const File &rhs);
//------------------------------------------------------------------
/// Constructor with path.
///
/// Takes a path to a file which can be just a filename, or a full
- /// path. If \a path is not NULL or empty, this function will call
+ /// path. If \a path is not nullptr or empty, this function will call
/// File::Open (const char *path, uint32_t options, uint32_t permissions).
///
/// @param[in] path
@@ -101,10 +102,10 @@ public:
/// Constructor with FileSpec.
///
/// Takes a FileSpec pointing to a file which can be just a filename, or a full
- /// path. If \a path is not NULL or empty, this function will call
+ /// path. If \a path is not nullptr or empty, this function will call
/// File::Open (const char *path, uint32_t options, uint32_t permissions).
///
- /// @param[in] path
+ /// @param[in] filespec
/// The FileSpec for this file.
///
/// @param[in] options
@@ -124,7 +125,9 @@ public:
m_descriptor (fd),
m_stream (kInvalidStream),
m_options (0),
- m_own_stream (false)
+ m_own_stream (false),
+ m_is_interactive (eLazyBoolCalculate),
+ m_is_real_terminal (eLazyBoolCalculate)
{
}
@@ -133,11 +136,13 @@ public:
///
/// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
- virtual
- ~File ();
+ ~File() override;
+
+ File &
+ operator= (const File &rhs);
bool
- IsValid () const
+ IsValid() const override
{
return DescriptorIsValid() || StreamIsValid();
}
@@ -156,7 +161,7 @@ public:
///
/// @return
/// A pointer to this object if either the directory or filename
- /// is valid, NULL otherwise.
+ /// is valid, nullptr otherwise.
//------------------------------------------------------------------
operator
bool () const
@@ -216,7 +221,7 @@ public:
uint32_t permissions = lldb::eFilePermissionsFileDefault);
Error
- Close ();
+ Close() override;
Error
Duplicate (const File &rhs);
@@ -225,8 +230,7 @@ public:
GetDescriptor() const;
WaitableHandle
- GetWaitableHandle();
-
+ GetWaitableHandle() override;
void
SetDescriptor(int fd, bool transfer_ownership);
@@ -247,7 +251,7 @@ public:
/// @param[in] buf
/// A buffer where to put the bytes that are read.
///
- /// @param[in/out] num_bytes
+ /// @param[in,out] num_bytes
/// The number of bytes to read form the current file position
/// which gets modified with the number of bytes that were read.
///
@@ -256,7 +260,7 @@ public:
/// failure.
//------------------------------------------------------------------
Error
- Read (void *buf, size_t &num_bytes);
+ Read(void *buf, size_t &num_bytes) override;
//------------------------------------------------------------------
/// Write bytes to a file at the current file position.
@@ -268,7 +272,7 @@ public:
/// @param[in] buf
/// A buffer where to put the bytes that are read.
///
- /// @param[in/out] num_bytes
+ /// @param[in,out] num_bytes
/// The number of bytes to write to the current file position
/// which gets modified with the number of bytes that were
/// written.
@@ -278,7 +282,7 @@ public:
/// failure.
//------------------------------------------------------------------
Error
- Write (const void *buf, size_t &num_bytes);
+ Write(const void *buf, size_t &num_bytes) override;
//------------------------------------------------------------------
/// Seek to an offset relative to the beginning of the file.
@@ -295,13 +299,13 @@ public:
///
/// @param[in] error_ptr
/// A pointer to a lldb_private::Error object that will be
- /// filled in if non-NULL.
+ /// filled in if non-nullptr.
///
/// @return
/// The resulting seek offset, or -1 on error.
//------------------------------------------------------------------
off_t
- SeekFromStart (off_t offset, Error *error_ptr = NULL);
+ SeekFromStart(off_t offset, Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Seek to an offset relative to the current file position.
@@ -318,13 +322,13 @@ public:
///
/// @param[in] error_ptr
/// A pointer to a lldb_private::Error object that will be
- /// filled in if non-NULL.
+ /// filled in if non-nullptr.
///
/// @return
/// The resulting seek offset, or -1 on error.
//------------------------------------------------------------------
off_t
- SeekFromCurrent (off_t offset, Error *error_ptr = NULL);
+ SeekFromCurrent(off_t offset, Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Seek to an offset relative to the end of the file.
@@ -335,20 +339,20 @@ public:
/// @see File::Read (void *, size_t, off_t &)
/// @see File::Write (const void *, size_t, off_t &)
///
- /// @param[in/out] offset
+ /// @param[in,out] offset
/// The offset to seek to within the file relative to the
/// end of the file which gets filled in with the resulting
/// absolute file offset.
///
/// @param[in] error_ptr
/// A pointer to a lldb_private::Error object that will be
- /// filled in if non-NULL.
+ /// filled in if non-nullptr.
///
/// @return
/// The resulting seek offset, or -1 on error.
//------------------------------------------------------------------
off_t
- SeekFromEnd (off_t offset, Error *error_ptr = NULL);
+ SeekFromEnd(off_t offset, Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Read bytes from a file from the specified file offset.
@@ -357,14 +361,14 @@ public:
/// own file position markers and reads on other threads won't mess
/// up the current read.
///
- /// @param[in] buf
+ /// @param[in] dst
/// A buffer where to put the bytes that are read.
///
- /// @param[in/out] num_bytes
+ /// @param[in,out] num_bytes
/// The number of bytes to read form the current file position
/// which gets modified with the number of bytes that were read.
///
- /// @param[in/out] offset
+ /// @param[in,out] offset
/// The offset within the file from which to read \a num_bytes
/// bytes. This offset gets incremented by the number of bytes
/// that were read.
@@ -383,11 +387,11 @@ public:
/// own file position markers and reads on other threads won't mess
/// up the current read.
///
- /// @param[in/out] num_bytes
+ /// @param[in,out] num_bytes
/// The number of bytes to read form the current file position
/// which gets modified with the number of bytes that were read.
///
- /// @param[in/out] offset
+ /// @param[in,out] offset
/// The offset within the file from which to read \a num_bytes
/// bytes. This offset gets incremented by the number of bytes
/// that were read.
@@ -419,15 +423,15 @@ public:
/// their own locking externally to avoid multiple people writing
/// to the file at the same time.
///
- /// @param[in] buf
+ /// @param[in] src
/// A buffer containing the bytes to write.
///
- /// @param[in/out] num_bytes
+ /// @param[in,out] num_bytes
/// The number of bytes to write to the file at offset \a offset.
/// \a num_bytes gets modified with the number of bytes that
/// were read.
///
- /// @param[in/out] offset
+ /// @param[in,out] offset
/// The offset within the file at which to write \a num_bytes
/// bytes. This offset gets incremented by the number of bytes
/// that were written.
@@ -472,7 +476,6 @@ public:
static uint32_t
GetPermissions(const FileSpec &file_spec, Error &error);
-
//------------------------------------------------------------------
/// Return true if this file is interactive.
///
@@ -497,6 +500,9 @@ public:
//------------------------------------------------------------------
bool
GetIsRealTerminal ();
+
+ bool
+ GetIsTerminalWithColors ();
//------------------------------------------------------------------
/// Output printf formatted output to the stream.
@@ -516,15 +522,13 @@ public:
size_t
PrintfVarArg(const char *format, va_list args);
-
void
SetOptions (uint32_t options)
{
m_options = options;
}
+
protected:
-
-
bool
DescriptorIsValid () const
{
@@ -549,9 +553,9 @@ protected:
bool m_own_stream;
LazyBool m_is_interactive;
LazyBool m_is_real_terminal;
+ LazyBool m_supports_colors;
};
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_File_h_
+#endif // liblldb_File_h_
diff --git a/include/lldb/Host/FileSpec.h b/include/lldb/Host/FileSpec.h
index d0338d41db1be..0ff1bc9d2f44d 100644
--- a/include/lldb/Host/FileSpec.h
+++ b/include/lldb/Host/FileSpec.h
@@ -9,10 +9,14 @@
#ifndef liblldb_FileSpec_h_
#define liblldb_FileSpec_h_
-#if defined(__cplusplus)
+// C Includes
+// C++ Includes
#include <functional>
+#include <string>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/STLUtils.h"
@@ -66,14 +70,14 @@ public:
/// Constructor with path.
///
/// Takes a path to a file which can be just a filename, or a full
- /// path. If \a path is not NULL or empty, this function will call
+ /// path. If \a path is not nullptr or empty, this function will call
/// FileSpec::SetFile (const char *path, bool resolve).
///
/// @param[in] path
/// The full or partial path to a file.
///
/// @param[in] resolve_path
- /// If \b true, then we resolve the path with realpath,
+ /// If \b true, then we resolve the path, removing stray ../.. and so forth,
/// if \b false we trust the path is in canonical form already.
///
/// @see FileSpec::SetFile (const char *path, bool resolve)
@@ -101,10 +105,10 @@ public:
/// Copy constructor
///
/// Makes a copy of the uniqued directory and filename strings from
- /// \a rhs if it is not NULL.
+ /// \a rhs if it is not nullptr.
///
/// @param[in] rhs
- /// A const FileSpec object pointer to copy if non-NULL.
+ /// A const FileSpec object pointer to copy if non-nullptr.
//------------------------------------------------------------------
FileSpec (const FileSpec* rhs);
@@ -190,7 +194,7 @@ public:
///
/// @return
/// A pointer to this object if either the directory or filename
- /// is valid, NULL otherwise.
+ /// is valid, nullptr otherwise.
//------------------------------------------------------------------
explicit operator bool() const;
@@ -444,7 +448,7 @@ public:
///
/// Returns a ConstString that represents the extension of the filename
/// for this FileSpec object. If this object does not represent a file,
- /// or the filename has no extension, ConstString(NULL) is returned.
+ /// or the filename has no extension, ConstString(nullptr) is returned.
/// The dot ('.') character is not returned as part of the extension
///
/// @return
@@ -510,10 +514,7 @@ public:
}
bool
- IsSymbolicLink () const
- {
- return GetFileType() == FileSpec::eFileTypeSymbolicLink;
- }
+ IsSymbolicLink () const;
//------------------------------------------------------------------
/// Get the memory cost of this object.
@@ -555,13 +556,12 @@ public:
///
/// @return
/// A shared pointer to the memory mapped data. This shared
- /// pointer can contain a NULL DataBuffer pointer, so the contained
+ /// pointer can contain a nullptr DataBuffer pointer, so the contained
/// pointer must be checked prior to using it.
//------------------------------------------------------------------
lldb::DataBufferSP
MemoryMapFileContents (off_t offset = 0, size_t length = SIZE_MAX) const;
-
//------------------------------------------------------------------
/// Memory map part of, or the entire contents of, a file only if
/// the file is local (not on a network mount).
@@ -594,7 +594,7 @@ public:
///
/// @return
/// A shared pointer to the memory mapped data. This shared
- /// pointer can contain a NULL DataBuffer pointer, so the contained
+ /// pointer can contain a nullptr DataBuffer pointer, so the contained
/// pointer must be checked prior to using it.
//------------------------------------------------------------------
lldb::DataBufferSP
@@ -624,16 +624,15 @@ public:
///
/// @return
/// A shared pointer to the memory mapped data. This shared
- /// pointer can contain a NULL DataBuffer pointer, so the contained
+ /// pointer can contain a nullptr DataBuffer pointer, so the contained
/// pointer must be checked prior to using it.
//------------------------------------------------------------------
lldb::DataBufferSP
- ReadFileContents (off_t offset = 0, size_t length = SIZE_MAX, Error *error_ptr = NULL) const;
+ ReadFileContents(off_t offset = 0, size_t length = SIZE_MAX, Error *error_ptr = nullptr) const;
size_t
ReadFileContents (off_t file_offset, void *dst, size_t dst_len, Error *error_ptr) const;
-
//------------------------------------------------------------------
/// Read the entire contents of a file as data that can be used
/// as a C string.
@@ -643,11 +642,11 @@ public:
///
/// @return
/// A shared pointer to the data. This shared pointer can
- /// contain a NULL DataBuffer pointer, so the contained pointer
+ /// contain a nullptr DataBuffer pointer, so the contained pointer
/// must be checked prior to using it.
//------------------------------------------------------------------
lldb::DataBufferSP
- ReadFileContentsAsCString(Error *error_ptr = NULL);
+ ReadFileContentsAsCString(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Normalize a pathname by collapsing redundant separators and
@@ -719,6 +718,7 @@ public:
{
m_is_resolved = is_resolved;
}
+
//------------------------------------------------------------------
/// Read the file into an array of strings, one per line.
///
@@ -835,5 +835,4 @@ Stream& operator << (Stream& s, const FileSpec& f);
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // liblldb_FileSpec_h_
+#endif // liblldb_FileSpec_h_
diff --git a/include/lldb/Host/FileSystem.h b/include/lldb/Host/FileSystem.h
index bea1ec80172e3..465ad451bdd6e 100644
--- a/include/lldb/Host/FileSystem.h
+++ b/include/lldb/Host/FileSystem.h
@@ -22,6 +22,8 @@ namespace lldb_private
class FileSystem
{
public:
+ static const char *DEV_NULL;
+
static FileSpec::PathSyntax GetNativePathSyntax();
static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);
@@ -35,9 +37,12 @@ class FileSystem
static bool GetFileExists(const FileSpec &file_spec);
static Error Hardlink(const FileSpec &src, const FileSpec &dst);
+ static int GetHardlinkCount(const FileSpec &file_spec);
static Error Symlink(const FileSpec &src, const FileSpec &dst);
static Error Readlink(const FileSpec &src, FileSpec &dst);
static Error Unlink(const FileSpec &file_spec);
+
+ static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high);
static bool CalculateMD5(const FileSpec &file_spec,
diff --git a/include/lldb/Host/HostGetOpt.h b/include/lldb/Host/HostGetOpt.h
index 761c1a118600d..6f512915d33c8 100644
--- a/include/lldb/Host/HostGetOpt.h
+++ b/include/lldb/Host/HostGetOpt.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#pragma once
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__NetBSD__)
#ifdef _WIN32
#define _BSD_SOURCE // Required so that getopt.h defines optreset
@@ -19,6 +19,6 @@
#else
-#include <lldb/Host/windows/getopt/GetOptInc.h>
+#include <lldb/Host/common/GetOptInc.h>
#endif
diff --git a/include/lldb/Host/HostInfo.h b/include/lldb/Host/HostInfo.h
index 6bb0099978969..96094389c7035 100644
--- a/include/lldb/Host/HostInfo.h
+++ b/include/lldb/Host/HostInfo.h
@@ -48,6 +48,9 @@
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
#define HOST_INFO_TYPE HostInfoFreeBSD
+#elif defined(__NetBSD__)
+#include "lldb/Host/netbsd/HostInfoNetBSD.h"
+#define HOST_INFO_TYPE HostInfoNetBSD
#elif defined(__APPLE__)
#include "lldb/Host/macosx/HostInfoMacOSX.h"
#define HOST_INFO_TYPE HostInfoMacOSX
diff --git a/include/lldb/Host/HostNativeThread.h b/include/lldb/Host/HostNativeThread.h
index f39c775df8e34..b0411cad7a3e9 100644
--- a/include/lldb/Host/HostNativeThread.h
+++ b/include/lldb/Host/HostNativeThread.h
@@ -18,6 +18,8 @@
#include "lldb/Host/linux/HostThreadLinux.h"
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "lldb/Host/freebsd/HostThreadFreeBSD.h"
+#elif defined(__NetBSD__)
+#include "lldb/Host/netbsd/HostThreadNetBSD.h"
#elif defined(__APPLE__)
#include "lldb/Host/macosx/HostThreadMacOSX.h"
#endif
diff --git a/include/lldb/Host/HostNativeThreadForward.h b/include/lldb/Host/HostNativeThreadForward.h
index e6bd426673b32..520031af6488f 100644
--- a/include/lldb/Host/HostNativeThreadForward.h
+++ b/include/lldb/Host/HostNativeThreadForward.h
@@ -21,6 +21,9 @@ typedef HostThreadLinux HostNativeThread;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
class HostThreadFreeBSD;
typedef HostThreadFreeBSD HostNativeThread;
+#elif defined(__NetBSD__)
+class HostThreadNetBSD;
+typedef HostThreadNetBSD HostNativeThread;
#elif defined(__APPLE__)
class HostThreadMacOSX;
typedef HostThreadMacOSX HostNativeThread;
diff --git a/include/lldb/Host/MainLoopBase.h b/include/lldb/Host/MainLoopBase.h
index bff2ce78110d3..da14349cf82e1 100644
--- a/include/lldb/Host/MainLoopBase.h
+++ b/include/lldb/Host/MainLoopBase.h
@@ -60,25 +60,25 @@ public:
protected:
ReadHandleUP
CreateReadHandle(const lldb::IOObjectSP &object_sp)
- { return ReadHandleUP(new ReadHandle(*this, object_sp)); }
+ { return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); }
virtual void
- UnregisterReadObject(const lldb::IOObjectSP &object_sp)
+ UnregisterReadObject(IOObject::WaitableHandle handle)
{ llvm_unreachable("Not implemented"); }
private:
class ReadHandle
{
public:
- ~ReadHandle() { m_mainloop.UnregisterReadObject(m_object_sp); }
+ ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
private:
- ReadHandle(MainLoopBase &mainloop, const lldb::IOObjectSP &object_sp)
- : m_mainloop(mainloop), m_object_sp(object_sp)
+ ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
+ : m_mainloop(mainloop), m_handle(handle)
{ }
MainLoopBase &m_mainloop;
- lldb::IOObjectSP m_object_sp;
+ IOObject::WaitableHandle m_handle;
friend class MainLoopBase;
DISALLOW_COPY_AND_ASSIGN(ReadHandle);
diff --git a/include/lldb/Host/MonitoringProcessLauncher.h b/include/lldb/Host/MonitoringProcessLauncher.h
index 3c3e66108f8a7..f5d0a92aa8ded 100644
--- a/include/lldb/Host/MonitoringProcessLauncher.h
+++ b/include/lldb/Host/MonitoringProcessLauncher.h
@@ -10,6 +10,10 @@
#ifndef lldb_Host_MonitoringProcessLauncher_h_
#define lldb_Host_MonitoringProcessLauncher_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/Host/ProcessLauncher.h"
namespace lldb_private
@@ -20,11 +24,12 @@ class MonitoringProcessLauncher : public ProcessLauncher
public:
explicit MonitoringProcessLauncher(std::unique_ptr<ProcessLauncher> delegate_launcher);
- virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error);
+ HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) override;
private:
std::unique_ptr<ProcessLauncher> m_delegate_launcher;
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // lldb_Host_MonitoringProcessLauncher_h_
diff --git a/include/lldb/Host/Mutex.h b/include/lldb/Host/Mutex.h
index 496dd0496c130..5a529fb4554dd 100644
--- a/include/lldb/Host/Mutex.h
+++ b/include/lldb/Host/Mutex.h
@@ -9,15 +9,17 @@
#ifndef liblldb_Mutex_h_
#define liblldb_Mutex_h_
-#if defined(__cplusplus)
-
-#include "lldb/lldb-types.h"
-#include <assert.h>
+// C Includes
+// C++ Includes
#ifdef LLDB_CONFIGURATION_DEBUG
#include <string>
#endif
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-types.h"
+
namespace lldb_private {
//----------------------------------------------------------------------
@@ -85,7 +87,7 @@ public:
Locker(Mutex* m);
//--------------------------------------------------------------
- /// Desstructor
+ /// Destructor
///
/// Unlocks any valid pthread_mutex_t that this object may
/// contain.
@@ -97,7 +99,7 @@ public:
///
/// Unlock the current mutex in this object (if it contains a
/// valid mutex) and lock the new \a mutex object if it is
- /// non-NULL.
+ /// non-nullptr.
//--------------------------------------------------------------
void
Lock (Mutex &mutex);
@@ -120,15 +122,15 @@ public:
/// will not take ownership of the mutex.
///
/// @return
- /// Returns \b true if the lock was aquired and the this
+ /// Returns \b true if the lock was acquired and the this
/// object will unlock the mutex when it goes out of scope,
/// returns \b false otherwise.
//--------------------------------------------------------------
bool
- TryLock (Mutex &mutex, const char *failure_message = NULL);
+ TryLock(Mutex &mutex, const char *failure_message = nullptr);
bool
- TryLock (Mutex *mutex, const char *failure_message = NULL)
+ TryLock(Mutex *mutex, const char *failure_message = nullptr)
{
if (mutex)
return TryLock(*mutex, failure_message);
@@ -150,7 +152,6 @@ public:
const Locker& operator=(const Locker&);
};
-
//------------------------------------------------------------------
/// Default constructor.
///
@@ -213,7 +214,7 @@ public:
virtual
#endif
int
- TryLock(const char *failure_message = NULL);
+ TryLock(const char *failure_message = nullptr);
//------------------------------------------------------------------
/// Unlock the mutex.
@@ -262,16 +263,16 @@ public:
TrackingMutex(Mutex::Type type) : Mutex (type) {}
virtual
- ~TrackingMutex() {}
+ ~TrackingMutex() = default;
virtual int
Unlock ();
virtual int
- TryLock (const char *failure_message = NULL)
+ TryLock(const char *failure_message = nullptr)
{
int return_value = Mutex::TryLock();
- if (return_value != 0 && failure_message != NULL)
+ if (return_value != 0 && failure_message != nullptr)
{
m_failure_message.assign(failure_message);
m_thread_that_tried = pthread_self();
@@ -291,7 +292,7 @@ public:
LoggingMutex(Mutex::Type type) : Mutex (type),m_locked(false) {}
virtual
- ~LoggingMutex() {}
+ ~LoggingMutex() = default;
virtual int
Lock ();
@@ -300,13 +301,13 @@ public:
Unlock ();
virtual int
- TryLock (const char *failure_message = NULL);
+ TryLock(const char *failure_message = nullptr);
+
protected:
bool m_locked;
};
-#endif
+#endif // LLDB_CONFIGURATION_DEBUG
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif
+#endif // liblldb_Mutex_h_
diff --git a/include/lldb/Host/OptionParser.h b/include/lldb/Host/OptionParser.h
index 5aa7db5d34bf0..175a1973c7af8 100644
--- a/include/lldb/Host/OptionParser.h
+++ b/include/lldb/Host/OptionParser.h
@@ -11,6 +11,7 @@
#define liblldb_OptionParser_h_
#include <string>
+#include "lldb/Host/Mutex.h"
struct option;
@@ -38,7 +39,7 @@ public:
eOptionalArgument
};
- static void Prepare();
+ static void Prepare(Mutex::Locker &locker);
static void EnableError(bool error);
diff --git a/include/lldb/Host/Predicate.h b/include/lldb/Host/Predicate.h
index ae6c99155fe02..4f386dc1dd0bd 100644
--- a/include/lldb/Host/Predicate.h
+++ b/include/lldb/Host/Predicate.h
@@ -9,13 +9,17 @@
#ifndef liblldb_Predicate_h_
#define liblldb_Predicate_h_
-#if defined(__cplusplus)
+// C Includes
+#include <stdint.h>
+#include <time.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/Condition.h"
-#include <stdint.h>
-#include <time.h>
//#define DB_PTHREAD_LOG_EVENTS
@@ -29,7 +33,6 @@ typedef enum
eBroadcastNever, ///< No broadcast will be sent when the value is modified.
eBroadcastAlways, ///< Always send a broadcast when the value is modified.
eBroadcastOnChange ///< Only broadcast if the value changes when the value is modified.
-
} PredicateBroadcastType;
//----------------------------------------------------------------------
@@ -46,7 +49,6 @@ template <class T>
class Predicate
{
public:
-
//------------------------------------------------------------------
/// Default constructor.
///
@@ -81,10 +83,7 @@ public:
///
/// Destroy the condition, mutex, and T objects.
//------------------------------------------------------------------
- ~Predicate ()
- {
- }
-
+ ~Predicate() = default;
//------------------------------------------------------------------
/// Value get accessor.
@@ -205,7 +204,7 @@ public:
/// The bits we are waiting to be set in \a m_value.
///
/// @param[in] abstime
- /// If non-NULL, the absolute time at which we should stop
+ /// If non-nullptr, the absolute time at which we should stop
/// waiting, else wait an infinite amount of time.
///
/// @return
@@ -214,7 +213,7 @@ public:
/// occurred.
//------------------------------------------------------------------
T
- WaitForSetValueBits (T bits, const TimeValue *abstime = NULL)
+ WaitForSetValueBits(T bits, const TimeValue *abstime = nullptr)
{
int err = 0;
// pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -255,7 +254,7 @@ public:
/// The bits we are waiting to be reset in \a m_value.
///
/// @param[in] abstime
- /// If non-NULL, the absolute time at which we should stop
+ /// If non-nullptr, the absolute time at which we should stop
/// waiting, else wait an infinite amount of time.
///
/// @return
@@ -263,7 +262,7 @@ public:
/// unrecoverable error occurs.
//------------------------------------------------------------------
T
- WaitForResetValueBits (T bits, const TimeValue *abstime = NULL)
+ WaitForResetValueBits(T bits, const TimeValue *abstime = nullptr)
{
int err = 0;
@@ -306,7 +305,7 @@ public:
/// The value we want \a m_value to be equal to.
///
/// @param[in] abstime
- /// If non-NULL, the absolute time at which we should stop
+ /// If non-nullptr, the absolute time at which we should stop
/// waiting, else wait an infinite amount of time.
///
/// @param[out] timed_out
@@ -318,7 +317,7 @@ public:
/// @li \b false otherwise
//------------------------------------------------------------------
bool
- WaitForValueEqualTo (T value, const TimeValue *abstime = NULL, bool *timed_out = NULL)
+ WaitForValueEqualTo(T value, const TimeValue *abstime = nullptr, bool *timed_out = nullptr)
{
int err = 0;
// pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -366,7 +365,7 @@ public:
/// returned.
///
/// @param[in] abstime
- /// If non-NULL, the absolute time at which we should stop
+ /// If non-nullptr, the absolute time at which we should stop
/// waiting, else wait an infinite amount of time.
///
/// @param[out] timed_out
@@ -378,7 +377,9 @@ public:
/// @li \b false otherwise
//------------------------------------------------------------------
bool
- WaitForValueEqualToAndSetValueTo (T wait_value, T new_value, const TimeValue *abstime = NULL, bool *timed_out = NULL)
+ WaitForValueEqualToAndSetValueTo(T wait_value, T new_value,
+ const TimeValue *abstime = nullptr,
+ bool *timed_out = nullptr)
{
int err = 0;
// pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -408,7 +409,6 @@ public:
return false;
}
-
//------------------------------------------------------------------
/// Wait for \a m_value to not be equal to \a value.
///
@@ -430,7 +430,7 @@ public:
/// The new value if \b true is returned.
///
/// @param[in] abstime
- /// If non-NULL, the absolute time at which we should stop
+ /// If non-nullptr, the absolute time at which we should stop
/// waiting, else wait an infinite amount of time.
///
/// @return
@@ -438,7 +438,7 @@ public:
/// @li \b false otherwise
//------------------------------------------------------------------
bool
- WaitForValueNotEqualTo (T value, T &new_value, const TimeValue *abstime = NULL)
+ WaitForValueNotEqualTo(T value, T &new_value, const TimeValue *abstime = nullptr)
{
int err = 0;
// pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -473,7 +473,6 @@ protected:
Condition m_condition; ///< The pthread condition variable to use for signaling that data available or changed.
private:
-
//------------------------------------------------------------------
/// Broadcast if needed.
///
@@ -500,11 +499,9 @@ private:
m_condition.Broadcast();
}
-
DISALLOW_COPY_AND_ASSIGN(Predicate);
};
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // #ifndef liblldb_Predicate_h_
+#endif // liblldb_Predicate_h_
diff --git a/include/lldb/Host/ProcessRunLock.h b/include/lldb/Host/ProcessRunLock.h
index eca1ad375fc6b..ceb1e90be757f 100644
--- a/include/lldb/Host/ProcessRunLock.h
+++ b/include/lldb/Host/ProcessRunLock.h
@@ -9,13 +9,17 @@
#ifndef liblldb_ProcessRunLock_h_
#define liblldb_ProcessRunLock_h_
-#if defined(__cplusplus)
+// C Includes
+#include <stdint.h>
+#include <time.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/Condition.h"
-#include <stdint.h>
-#include <time.h>
//----------------------------------------------------------------------
/// Enumerations for broadcasting.
@@ -34,17 +38,18 @@ class ProcessRunLock
public:
ProcessRunLock();
~ProcessRunLock();
+
bool ReadTryLock ();
bool ReadUnlock ();
bool SetRunning ();
bool TrySetRunning ();
bool SetStopped ();
-public:
+
class ProcessRunLocker
{
public:
ProcessRunLocker () :
- m_lock (NULL)
+ m_lock (nullptr)
{
}
@@ -82,11 +87,12 @@ public:
if (m_lock)
{
m_lock->ReadUnlock();
- m_lock = NULL;
+ m_lock = nullptr;
}
}
ProcessRunLock *m_lock;
+
private:
DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
};
@@ -94,11 +100,11 @@ public:
protected:
lldb::rwlock_t m_rwlock;
bool m_running;
+
private:
DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
};
} // namespace lldb_private
-#endif // #if defined(__cplusplus)
-#endif // #ifndef liblldb_ProcessRunLock_h_
+#endif // liblldb_ProcessRunLock_h_
diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h
index f4599b5ab87b3..a38b42f817c60 100644
--- a/include/lldb/Host/Socket.h
+++ b/include/lldb/Host/Socket.h
@@ -10,6 +10,7 @@
#ifndef liblldb_Host_Socket_h_
#define liblldb_Host_Socket_h_
+#include <memory>
#include <string>
#include "lldb/lldb-private.h"
@@ -45,13 +46,19 @@ public:
{
ProtocolTcp,
ProtocolUdp,
- ProtocolUnixDomain
+ ProtocolUnixDomain,
+ ProtocolUnixAbstract
} SocketProtocol;
static const NativeSocket kInvalidSocketValue;
- Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
- ~Socket();
+ ~Socket() override;
+
+ static std::unique_ptr<Socket> Create(const SocketProtocol protocol, bool child_processes_inherit, Error &error);
+
+ virtual Error Connect(llvm::StringRef name) = 0;
+ virtual Error Listen(llvm::StringRef name, int backlog) = 0;
+ virtual Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) = 0;
// Initialize a Tcp Socket object in listening mode. listen and accept are implemented
// separately because the caller may wish to manipulate or query the socket after it is
@@ -66,43 +73,23 @@ public:
static Error UdpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&send_socket, Socket *&recv_socket);
static Error UnixDomainConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
static Error UnixDomainAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-
- // Blocks on a listening socket until a connection is received. This method assumes that
- // |this->m_socket| is a listening socket, created via either TcpListen() or via the native
- // constructor that takes a NativeSocket, which itself was created via a call to |listen()|
- Error BlockingAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
+ static Error UnixAbstractConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
+ static Error UnixAbstractAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
int GetOption (int level, int option_name, int &option_value);
int SetOption (int level, int option_name, int option_value);
- // returns port number or 0 if error
- static uint16_t GetLocalPortNumber (const NativeSocket& socket);
-
- // returns port number or 0 if error
- uint16_t GetLocalPortNumber () const;
-
- // returns ip address string or empty string if error
- std::string GetLocalIPAddress () const;
-
- // must be connected
- // returns port number or 0 if error
- uint16_t GetRemotePortNumber () const;
-
- // must be connected
- // returns ip address string or empty string if error
- std::string GetRemoteIPAddress () const;
-
NativeSocket GetNativeSocket () const { return m_socket; }
SocketProtocol GetSocketProtocol () const { return m_protocol; }
- virtual Error Read (void *buf, size_t &num_bytes);
- virtual Error Write (const void *buf, size_t &num_bytes);
+ Error Read (void *buf, size_t &num_bytes) override;
+ Error Write (const void *buf, size_t &num_bytes) override;
virtual Error PreDisconnect ();
- virtual Error Close ();
+ Error Close() override;
- virtual bool IsValid () const { return m_socket != kInvalidSocketValue; }
- virtual WaitableHandle GetWaitableHandle ();
+ bool IsValid () const override { return m_socket != kInvalidSocketValue; }
+ WaitableHandle GetWaitableHandle () override;
static bool
DecodeHostAndPort (llvm::StringRef host_and_port,
@@ -112,10 +99,20 @@ public:
Error *error_ptr);
protected:
+ Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
+
+ virtual size_t Send(const void *buf, const size_t num_bytes);
+
+ static void SetLastError(Error &error);
+ static NativeSocket CreateSocket(
+ const int domain, const int type, const int protocol, bool child_processes_inherit, Error& error);
+ static NativeSocket AcceptSocket(
+ NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit, Error& error);
+
SocketProtocol m_protocol;
NativeSocket m_socket;
- SocketAddress m_udp_send_sockaddr; // Send address used for UDP connections.
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // liblldb_Host_Socket_h_
diff --git a/include/lldb/Host/Symbols.h b/include/lldb/Host/Symbols.h
index d6c86333d709c..0ca864c8c85cc 100644
--- a/include/lldb/Host/Symbols.h
+++ b/include/lldb/Host/Symbols.h
@@ -29,7 +29,7 @@ public:
// Locating the file should happen only on the local computer or using
// the current computers global settings.
//----------------------------------------------------------------------
- static FileSpec
+ static ModuleSpec
LocateExecutableObjectFile (const ModuleSpec &module_spec);
//----------------------------------------------------------------------
diff --git a/include/lldb/Host/XML.h b/include/lldb/Host/XML.h
index e3547d8346357..3ebd2c6f79ece 100644
--- a/include/lldb/Host/XML.h
+++ b/include/lldb/Host/XML.h
@@ -11,25 +11,23 @@
#define liblldb_XML_h_
// C Includes
-
#if defined( LIBXML2_DEFINED )
#include <libxml/xmlreader.h>
#endif
// C++ Includes
-
#include <functional>
#include <string>
#include <vector>
// Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
+
// Project includes
#include "lldb/lldb-private.h"
-#include "llvm/ADT/StringRef.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/StructuredData.h"
-
namespace lldb_private {
#if defined( LIBXML2_DEFINED )
@@ -94,7 +92,7 @@ namespace lldb_private {
GetChild () const;
llvm::StringRef
- GetAttributeValue(const char *name, const char *fail_value = NULL) const;
+ GetAttributeValue(const char *name, const char *fail_value = nullptr) const;
XMLNode
FindFirstChildElementWithName (const char *name) const;
@@ -140,7 +138,6 @@ namespace lldb_private {
class XMLDocument
{
public:
-
XMLDocument ();
~XMLDocument ();
@@ -163,7 +160,7 @@ namespace lldb_private {
ParseMemory (const char *xml, size_t xml_length, const char *url = "untitled.xml");
//----------------------------------------------------------------------
- // If \a name is NULL, just get the root element node, else only return
+ // If \a name is nullptr, just get the root element node, else only return
// a value XMLNode if the name of the root element matches \a name.
//----------------------------------------------------------------------
XMLNode
@@ -216,7 +213,6 @@ namespace lldb_private {
GetStructuredData();
protected:
-
// Using a node returned from GetValueNode() extract its value as a
// string (if possible). Array and dictionary nodes will return false
// as they have no string value. Boolean nodes will return true and
@@ -229,6 +225,7 @@ namespace lldb_private {
XMLDocument m_xml_doc;
XMLNode m_dict_node;
};
+
} // namespace lldb_private
#endif // liblldb_XML_h_
diff --git a/include/lldb/Host/common/GetOptInc.h b/include/lldb/Host/common/GetOptInc.h
new file mode 100644
index 0000000000000..f79644017ca54
--- /dev/null
+++ b/include/lldb/Host/common/GetOptInc.h
@@ -0,0 +1,65 @@
+#pragma once
+
+#include "lldb/lldb-defines.h"
+
+#if defined(_MSC_VER)
+#define REPLACE_GETOPT
+#define REPLACE_GETOPT_LONG
+#endif
+#if defined(_MSC_VER) || defined(__NetBSD__)
+#define REPLACE_GETOPT_LONG_ONLY
+#endif
+
+#if defined(REPLACE_GETOPT)
+// from getopt.h
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+// option structure
+struct option
+{
+ const char *name;
+ // has_arg can't be an enum because some compilers complain about
+ // type mismatches in all the code that assumes it is an int.
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+int getopt( int argc, char * const argv[], const char *optstring );
+
+// from getopt.h
+extern char * optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
+
+// defined in unistd.h
+extern int optreset;
+#else
+# include <unistd.h>
+# include <getopt.h>
+#endif
+
+#if defined(REPLACE_GETOPT_LONG)
+int getopt_long
+(
+ int argc,
+ char * const *argv,
+ const char *optstring,
+ const struct option *longopts,
+ int *longindex
+);
+#endif
+
+#if defined(REPLACE_GETOPT_LONG_ONLY)
+int getopt_long_only
+(
+ int argc,
+ char * const *argv,
+ const char *optstring,
+ const struct option *longopts,
+ int *longindex
+);
+#endif
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index 4f0f3a962d321..7236bf6590428 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -16,6 +16,7 @@
#include "lldb/lldb-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Host/MainLoop.h"
#include "llvm/ADT/StringRef.h"
#include "NativeBreakpointList.h"
@@ -284,10 +285,6 @@ namespace lldb_private
bool
UnregisterNativeDelegate (NativeDelegate &native_delegate);
- // Called before termination of NativeProcessProtocol's instance.
- virtual void
- Terminate ();
-
virtual Error
GetLoadedModuleFileSpec(const char* module_path, FileSpec& file_spec) = 0;
@@ -307,6 +304,11 @@ namespace lldb_private
/// inferior. Must outlive the NativeProcessProtocol
/// instance.
///
+ /// @param[in] mainloop
+ /// The mainloop instance with which the process can register
+ /// callbacks. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
/// @param[out] process_sp
/// On successful return from the method, this parameter
/// contains the shared pointer to the
@@ -320,6 +322,7 @@ namespace lldb_private
static Error
Launch (ProcessLaunchInfo &launch_info,
NativeDelegate &native_delegate,
+ MainLoop &mainloop,
NativeProcessProtocolSP &process_sp);
//------------------------------------------------------------------
@@ -335,6 +338,11 @@ namespace lldb_private
/// inferior. Must outlive the NativeProcessProtocol
/// instance.
///
+ /// @param[in] mainloop
+ /// The mainloop instance with which the process can register
+ /// callbacks. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
/// @param[out] process_sp
/// On successful return from the method, this parameter
/// contains the shared pointer to the
@@ -348,6 +356,7 @@ namespace lldb_private
static Error
Attach (lldb::pid_t pid,
NativeDelegate &native_delegate,
+ MainLoop &mainloop,
NativeProcessProtocolSP &process_sp);
protected:
diff --git a/include/lldb/Host/common/TCPSocket.h b/include/lldb/Host/common/TCPSocket.h
new file mode 100644
index 0000000000000..0ffe9c87bfa40
--- /dev/null
+++ b/include/lldb/Host/common/TCPSocket.h
@@ -0,0 +1,46 @@
+//===-- TCPSocket.h ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TCPSocket_h_
+#define liblldb_TCPSocket_h_
+
+#include "lldb/Host/Socket.h"
+
+namespace lldb_private
+{
+ class TCPSocket: public Socket
+ {
+ public:
+ TCPSocket(NativeSocket socket, bool should_close);
+ TCPSocket(bool child_processes_inherit, Error &error);
+
+ // returns port number or 0 if error
+ uint16_t GetLocalPortNumber () const;
+
+ // returns ip address string or empty string if error
+ std::string GetLocalIPAddress () const;
+
+ // must be connected
+ // returns port number or 0 if error
+ uint16_t GetRemotePortNumber () const;
+
+ // must be connected
+ // returns ip address string or empty string if error
+ std::string GetRemoteIPAddress () const;
+
+ int SetOptionNoDelay();
+ int SetOptionReuseAddress();
+
+ Error Connect(llvm::StringRef name) override;
+ Error Listen(llvm::StringRef name, int backlog) override;
+ Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&conn_socket) override;
+ };
+}
+
+#endif // ifndef liblldb_TCPSocket_h_
diff --git a/include/lldb/Host/common/UDPSocket.h b/include/lldb/Host/common/UDPSocket.h
new file mode 100644
index 0000000000000..afc1ec7196269
--- /dev/null
+++ b/include/lldb/Host/common/UDPSocket.h
@@ -0,0 +1,35 @@
+//===-- UDPSocket.h ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UDPSocket_h_
+#define liblldb_UDPSocket_h_
+
+#include "lldb/Host/Socket.h"
+
+namespace lldb_private
+{
+ class UDPSocket: public Socket
+ {
+ public:
+ UDPSocket(bool child_processes_inherit, Error &error);
+
+ static Error Connect(llvm::StringRef name, bool child_processes_inherit, Socket *&send_socket, Socket *&recv_socket);
+ private:
+ UDPSocket(NativeSocket socket);
+
+ size_t Send(const void *buf, const size_t num_bytes) override;
+ Error Connect(llvm::StringRef name) override;
+ Error Listen(llvm::StringRef name, int backlog) override;
+ Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) override;
+
+ SocketAddress m_send_sockaddr;
+ };
+}
+
+#endif // ifndef liblldb_UDPSocket_h_
diff --git a/include/lldb/Host/netbsd/Config.h b/include/lldb/Host/netbsd/Config.h
new file mode 100644
index 0000000000000..1e9f55299d521
--- /dev/null
+++ b/include/lldb/Host/netbsd/Config.h
@@ -0,0 +1,28 @@
+//===-- Config.h -----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+//----------------------------------------------------------------------
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
+// are going to hardcode things for now. Eventually these files will
+// be auto generated by some configuration script that can detect
+// platform functionality availability.
+//----------------------------------------------------------------------
+
+#ifndef liblldb_Platform_Config_h_
+#define liblldb_Platform_Config_h_
+
+#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
+
+#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1
+
+//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1
+
+//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
+
+#endif // #ifndef liblldb_Platform_Config_h_
diff --git a/include/lldb/Host/netbsd/HostInfoNetBSD.h b/include/lldb/Host/netbsd/HostInfoNetBSD.h
new file mode 100644
index 0000000000000..34a29346c2efd
--- /dev/null
+++ b/include/lldb/Host/netbsd/HostInfoNetBSD.h
@@ -0,0 +1,30 @@
+//===-- HostInfoNetBSD.h ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_netbsd_HostInfoNetBSD_h_
+#define lldb_Host_netbsd_HostInfoNetBSD_h_
+
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/posix/HostInfoPosix.h"
+
+namespace lldb_private
+{
+
+class HostInfoNetBSD : public HostInfoPosix
+{
+ public:
+ static uint32_t GetMaxThreadNameLength();
+ static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+};
+}
+
+#endif
diff --git a/include/lldb/Host/netbsd/HostThreadNetBSD.h b/include/lldb/Host/netbsd/HostThreadNetBSD.h
new file mode 100644
index 0000000000000..2ce1e48fa0454
--- /dev/null
+++ b/include/lldb/Host/netbsd/HostThreadNetBSD.h
@@ -0,0 +1,32 @@
+//===-- HostThreadNetBSD.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_netbsd_HostThreadNetBSD_h_
+#define lldb_Host_netbsd_HostThreadNetBSD_h_
+
+#include "lldb/Host/posix/HostThreadPosix.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/SmallString.h"
+
+namespace lldb_private
+{
+
+class HostThreadNetBSD : public HostThreadPosix
+{
+ public:
+ HostThreadNetBSD();
+ HostThreadNetBSD(lldb::thread_t thread);
+
+ static void SetName(lldb::thread_t tid, llvm::StringRef &name);
+ static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name);
+};
+}
+
+#endif
diff --git a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
index 2e0fd705b2a80..7e7904cd5fa8c 100644
--- a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -34,13 +34,24 @@ class SocketAddress;
class ConnectionFileDescriptor : public Connection
{
public:
+ static const char* LISTEN_SCHEME;
+ static const char* ACCEPT_SCHEME;
+ static const char* UNIX_ACCEPT_SCHEME;
+ static const char* CONNECT_SCHEME;
+ static const char* TCP_CONNECT_SCHEME;
+ static const char* UDP_SCHEME;
+ static const char* UNIX_CONNECT_SCHEME;
+ static const char* UNIX_ABSTRACT_CONNECT_SCHEME;
+ static const char* FD_SCHEME;
+ static const char* FILE_SCHEME;
+
ConnectionFileDescriptor(bool child_processes_inherit = false);
ConnectionFileDescriptor(int fd, bool owns_fd);
ConnectionFileDescriptor(Socket* socket);
- virtual ~ConnectionFileDescriptor();
+ ~ConnectionFileDescriptor() override;
bool IsConnected() const override;
@@ -84,6 +95,8 @@ class ConnectionFileDescriptor : public Connection
lldb::ConnectionStatus NamedSocketAccept(const char *socket_name, Error *error_ptr);
+ lldb::ConnectionStatus UnixAbstractSocketConnect(const char *socket_name, Error *error_ptr);
+
lldb::IOObjectSP m_read_sp;
lldb::IOObjectSP m_write_sp;
diff --git a/include/lldb/Host/posix/DomainSocket.h b/include/lldb/Host/posix/DomainSocket.h
new file mode 100644
index 0000000000000..76f58e4f03b26
--- /dev/null
+++ b/include/lldb/Host/posix/DomainSocket.h
@@ -0,0 +1,37 @@
+//===-- DomainSocket.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DomainSocket_h_
+#define liblldb_DomainSocket_h_
+
+#include "lldb/Host/Socket.h"
+
+namespace lldb_private
+{
+ class DomainSocket: public Socket
+ {
+ public:
+ DomainSocket(bool child_processes_inherit, Error &error);
+
+ Error Connect(llvm::StringRef name) override;
+ Error Listen(llvm::StringRef name, int backlog) override;
+ Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) override;
+
+ protected:
+ DomainSocket(SocketProtocol protocol, bool child_processes_inherit, Error &error);
+
+ virtual size_t GetNameOffset() const;
+ virtual void DeleteSocketFile(llvm::StringRef name);
+
+ private:
+ DomainSocket(NativeSocket socket);
+ };
+}
+
+#endif // ifndef liblldb_DomainSocket_h_
diff --git a/include/lldb/Host/posix/HostProcessPosix.h b/include/lldb/Host/posix/HostProcessPosix.h
index c9534991361b1..5db49d17d757d 100644
--- a/include/lldb/Host/posix/HostProcessPosix.h
+++ b/include/lldb/Host/posix/HostProcessPosix.h
@@ -10,6 +10,10 @@
#ifndef lldb_Host_HostProcesPosix_h_
#define lldb_Host_HostProcesPosix_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/HostNativeProcessBase.h"
@@ -24,7 +28,7 @@ class HostProcessPosix : public HostNativeProcessBase
public:
HostProcessPosix();
HostProcessPosix(lldb::process_t process);
- virtual ~HostProcessPosix();
+ ~HostProcessPosix() override;
virtual Error Signal(int signo) const;
static Error Signal(lldb::process_t process, int signo);
@@ -37,6 +41,7 @@ class HostProcessPosix : public HostNativeProcessBase
HostThread StartMonitoring(HostProcess::MonitorCallback callback, void *callback_baton, bool monitor_signals) override;
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // lldb_Host_HostProcesPosix_h_
diff --git a/include/lldb/Host/posix/HostThreadPosix.h b/include/lldb/Host/posix/HostThreadPosix.h
index 8839b8d4068b9..e044313cd7dc3 100644
--- a/include/lldb/Host/posix/HostThreadPosix.h
+++ b/include/lldb/Host/posix/HostThreadPosix.h
@@ -22,13 +22,14 @@ class HostThreadPosix : public HostNativeThreadBase
public:
HostThreadPosix();
HostThreadPosix(lldb::thread_t thread);
- virtual ~HostThreadPosix();
+ ~HostThreadPosix() override;
Error Join(lldb::thread_result_t *result) override;
Error Cancel() override;
Error Detach();
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // lldb_Host_posix_HostThreadPosix_h_
diff --git a/include/lldb/Host/posix/LockFilePosix.h b/include/lldb/Host/posix/LockFilePosix.h
index 999397ec2bb51..628571c8dacdf 100644
--- a/include/lldb/Host/posix/LockFilePosix.h
+++ b/include/lldb/Host/posix/LockFilePosix.h
@@ -18,7 +18,7 @@ class LockFilePosix : public LockFileBase
{
public:
explicit LockFilePosix (int fd);
- ~LockFilePosix ();
+ ~LockFilePosix () override;
protected:
Error
@@ -37,6 +37,6 @@ protected:
DoUnlock () override;
};
-} // namespace lldb_private
+} // namespace lldb_private
-#endif // liblldb_Host_posix_LockFilePosix_h_
+#endif // liblldb_Host_posix_LockFilePosix_h_
diff --git a/include/lldb/Host/posix/MainLoopPosix.h b/include/lldb/Host/posix/MainLoopPosix.h
index 9a665ded295ec..225cebde4bcec 100644
--- a/include/lldb/Host/posix/MainLoopPosix.h
+++ b/include/lldb/Host/posix/MainLoopPosix.h
@@ -60,7 +60,7 @@ public:
protected:
void
- UnregisterReadObject(const lldb::IOObjectSP &object_sp) override;
+ UnregisterReadObject(IOObject::WaitableHandle handle) override;
void
UnregisterSignal(int signo);
diff --git a/include/lldb/Initialization/SystemInitializerCommon.h b/include/lldb/Initialization/SystemInitializerCommon.h
index af66c93a5e487..b46bf506998be 100644
--- a/include/lldb/Initialization/SystemInitializerCommon.h
+++ b/include/lldb/Initialization/SystemInitializerCommon.h
@@ -28,11 +28,12 @@ class SystemInitializerCommon : public SystemInitializer
{
public:
SystemInitializerCommon();
- virtual ~SystemInitializerCommon();
+ ~SystemInitializerCommon() override;
void Initialize() override;
void Terminate() override;
};
-}
-#endif
+} // namespace lldb_private
+
+#endif // LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h
index e11636b63f179..e79318ba5626c 100644
--- a/include/lldb/Interpreter/Args.h
+++ b/include/lldb/Interpreter/Args.h
@@ -424,6 +424,9 @@ public:
static void
ExpandEscapedCharacters (const char *src, std::string &dst);
+ static std::string
+ EscapeLLDBCommandArgument (const std::string& arg, char quote_char);
+
// This one isn't really relevant to Arguments per se, but we're using the Args as a
// general strings container, so...
void
diff --git a/include/lldb/Interpreter/CommandCompletions.h b/include/lldb/Interpreter/CommandCompletions.h
index 9df3041584ead..27ab45b3fa1f7 100644
--- a/include/lldb/Interpreter/CommandCompletions.h
+++ b/include/lldb/Interpreter/CommandCompletions.h
@@ -54,7 +54,6 @@ public:
// so you can add custom enums starting from here in your Option class.
// Also if you & in this bit the base code will not process the option.
eCustomCompletion = (1u << 9)
-
} CommonCompletionTypes;
struct CommonCompletionElement
@@ -83,6 +82,7 @@ public:
SearchFilter *searcher,
bool &word_complete,
StringList &matches);
+
static int
DiskDirectories (CommandInterpreter &interpreter,
const char *partial_file_name,
@@ -170,16 +170,16 @@ public:
int max_return_elements,
StringList &matches);
- virtual ~Completer ();
+ ~Completer() override;
- virtual CallbackReturn
- SearchCallback (SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete) = 0;
+ CallbackReturn
+ SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override = 0;
- virtual Depth
- GetDepth () = 0;
+ Depth
+ GetDepth() override = 0;
virtual size_t
DoCompletion (SearchFilter *filter) = 0;
@@ -190,8 +190,9 @@ public:
int m_match_start_point;
int m_max_return_elements;
StringList &m_matches;
+
private:
- DISALLOW_COPY_AND_ASSIGN (Completer);
+ DISALLOW_COPY_AND_ASSIGN(Completer);
};
//----------------------------------------------------------------------
@@ -200,7 +201,6 @@ public:
class SourceFileCompleter : public Completer
{
public:
-
SourceFileCompleter (CommandInterpreter &interpreter,
bool include_support_files,
const char *completion_str,
@@ -208,24 +208,24 @@ public:
int max_return_elements,
StringList &matches);
- virtual Searcher::Depth GetDepth ();
+ Searcher::Depth GetDepth() override;
- virtual Searcher::CallbackReturn
- SearchCallback (SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete);
+ Searcher::CallbackReturn
+ SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
size_t
- DoCompletion (SearchFilter *filter);
+ DoCompletion(SearchFilter *filter) override;
private:
bool m_include_support_files;
FileSpecList m_matching_files;
const char *m_file_name;
const char *m_dir_name;
- DISALLOW_COPY_AND_ASSIGN (SourceFileCompleter);
+ DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
};
//----------------------------------------------------------------------
@@ -234,29 +234,28 @@ public:
class ModuleCompleter : public Completer
{
public:
-
ModuleCompleter (CommandInterpreter &interpreter,
const char *completion_str,
int match_start_point,
int max_return_elements,
StringList &matches);
- virtual Searcher::Depth GetDepth ();
+ Searcher::Depth GetDepth() override;
- virtual Searcher::CallbackReturn
- SearchCallback (SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete);
+ Searcher::CallbackReturn
+ SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
size_t
- DoCompletion (SearchFilter *filter);
+ DoCompletion(SearchFilter *filter) override;
private:
const char *m_file_name;
const char *m_dir_name;
- DISALLOW_COPY_AND_ASSIGN (ModuleCompleter);
+ DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
};
//----------------------------------------------------------------------
@@ -265,23 +264,22 @@ public:
class SymbolCompleter : public Completer
{
public:
-
SymbolCompleter (CommandInterpreter &interpreter,
const char *completion_str,
int match_start_point,
int max_return_elements,
StringList &matches);
- virtual Searcher::Depth GetDepth ();
+ Searcher::Depth GetDepth() override;
- virtual Searcher::CallbackReturn
- SearchCallback (SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete);
+ Searcher::CallbackReturn
+ SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
size_t
- DoCompletion (SearchFilter *filter);
+ DoCompletion(SearchFilter *filter) override;
private:
// struct NameCmp {
@@ -294,14 +292,14 @@ public:
RegularExpression m_regex;
typedef std::set<ConstString> collection;
collection m_match_set;
- DISALLOW_COPY_AND_ASSIGN (SymbolCompleter);
+ DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
};
private:
static CommonCompletionElement g_common_completions[];
-
};
} // namespace lldb_private
-#endif // lldb_CommandCompletions_h_
+
+#endif // lldb_CommandCompletions_h_
diff --git a/include/lldb/Interpreter/CommandHistory.h b/include/lldb/Interpreter/CommandHistory.h
index dbe6e99bb5b12..db5db15fc1e50 100644
--- a/include/lldb/Interpreter/CommandHistory.h
+++ b/include/lldb/Interpreter/CommandHistory.h
@@ -17,7 +17,6 @@
// Other libraries and framework includes
// Project includes
-
#include "lldb/lldb-private.h"
#include "lldb/Core/Stream.h"
#include "lldb/Host/Mutex.h"
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h
index 1962050dffcbf..dd5c189d0ab93 100644
--- a/include/lldb/Interpreter/CommandInterpreter.h
+++ b/include/lldb/Interpreter/CommandInterpreter.h
@@ -14,6 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Debugger.h"
@@ -199,8 +200,6 @@ class CommandInterpreter :
public IOHandlerDelegate
{
public:
-
-
typedef std::map<std::string, OptionArgVectorSP> OptionArgMap;
enum
@@ -228,11 +227,17 @@ public:
eCommandTypesAllThem = 0xFFFF // all commands
};
+ CommandInterpreter(Debugger &debugger,
+ lldb::ScriptLanguage script_language,
+ bool synchronous_execution);
+
+ ~CommandInterpreter() override;
+
// These two functions fill out the Broadcaster interface:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
@@ -241,13 +246,6 @@ public:
SourceInitFile (bool in_cwd,
CommandReturnObject &result);
- CommandInterpreter (Debugger &debugger,
- lldb::ScriptLanguage script_language,
- bool synchronous_execution);
-
- virtual
- ~CommandInterpreter ();
-
bool
AddCommand (const char *name,
const lldb::CommandObjectSP &cmd_sp,
@@ -267,8 +265,8 @@ public:
bool include_aliases);
CommandObject *
- GetCommandObject (const char *cmd,
- StringList *matches = NULL);
+ GetCommandObject(const char *cmd,
+ StringList *matches = nullptr);
bool
CommandExists (const char *cmd);
@@ -305,7 +303,6 @@ public:
OptionArgVectorSP
GetAliasOptions (const char *alias_name);
-
bool
ProcessAliasOptionsArgs (lldb::CommandObjectSP &cmd_obj_sp,
const char *options_args,
@@ -325,20 +322,20 @@ public:
CommandReturnObject &result);
bool
- HandleCommand (const char *command_line,
- LazyBool add_to_history,
- CommandReturnObject &result,
- ExecutionContext *override_context = NULL,
- bool repeat_on_empty_command = true,
- bool no_context_switching = false);
+ HandleCommand(const char *command_line,
+ LazyBool add_to_history,
+ CommandReturnObject &result,
+ ExecutionContext *override_context = nullptr,
+ bool repeat_on_empty_command = true,
+ bool no_context_switching = false);
//------------------------------------------------------------------
/// Execute a list of commands in sequence.
///
/// @param[in] commands
/// The list of commands to execute.
- /// @param[in/out] context
- /// The execution context in which to run the commands. Can be NULL in which case the default
+ /// @param[in,out] context
+ /// The execution context in which to run the commands. Can be nullptr in which case the default
/// context will be used.
/// @param[in] options
/// This object holds the options used to control when to stop, whether to execute commands,
@@ -358,8 +355,8 @@ public:
///
/// @param[in] file
/// The file from which to read in commands.
- /// @param[in/out] context
- /// The execution context in which to run the commands. Can be NULL in which case the default
+ /// @param[in,out] context
+ /// The execution context in which to run the commands. Can be nullptr in which case the default
/// context will be used.
/// @param[in] options
/// This object holds the options used to control when to stop, whether to execute commands,
@@ -393,7 +390,6 @@ public:
// Otherwise, returns the number of matches.
//
// FIXME: Only max_return_elements == -1 is supported at present.
-
int
HandleCompletion (const char *current_line,
const char *cursor,
@@ -406,7 +402,6 @@ public:
// Help command can call it for the first argument.
// word_complete tells whether the completions are considered a "complete" response (so the
// completer should complete the quote & put a space after the word.
-
int
HandleCompletionMatches (Args &input,
int &cursor_index,
@@ -416,7 +411,6 @@ public:
bool &word_complete,
StringList &matches);
-
int
GetCommandNamesMatchingPartialString (const char *cmd_cstr,
bool include_aliases,
@@ -496,7 +490,6 @@ public:
void
SetScriptLanguage (lldb::ScriptLanguage lang);
-
bool
HasCommands ();
@@ -520,7 +513,10 @@ public:
GetOptionArgumentPosition (const char *in_string);
ScriptInterpreter *
- GetScriptInterpreter (bool can_create = true);
+ GetScriptInterpreter(bool can_create = true);
+
+ void
+ SetScriptInterpreter();
void
SkipLLDBInitFiles (bool skip_lldbinit_files)
@@ -647,7 +643,7 @@ public:
}
lldb::IOHandlerSP
- GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = NULL);
+ GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = nullptr);
bool
GetStoppedForCrash () const
@@ -655,26 +651,29 @@ public:
return m_stopped_for_crash;
}
+ bool
+ GetSpaceReplPrompts () const;
+
protected:
friend class Debugger;
//------------------------------------------------------------------
// IOHandlerDelegate functions
//------------------------------------------------------------------
- virtual void
- IOHandlerInputComplete (IOHandler &io_handler,
- std::string &line);
+ void
+ IOHandlerInputComplete(IOHandler &io_handler,
+ std::string &line) override;
- virtual ConstString
- IOHandlerGetControlSequence (char ch)
+ ConstString
+ IOHandlerGetControlSequence(char ch) override
{
if (ch == 'd')
return ConstString("quit\n");
return ConstString();
}
- virtual bool
- IOHandlerInterrupt (IOHandler &io_handler);
+ bool
+ IOHandlerInterrupt(IOHandler &io_handler) override;
size_t
GetProcessOutput ();
@@ -683,11 +682,9 @@ protected:
SetSynchronous (bool value);
lldb::CommandObjectSP
- GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL);
-
+ GetCommandSP(const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = nullptr);
private:
-
Error
PreprocessCommand (std::string &command);
@@ -697,7 +694,6 @@ private:
CommandObject *
ResolveCommandImpl(std::string &command_line, CommandReturnObject &result);
-
Debugger &m_debugger; // The debugger session that this interpreter is associated with
ExecutionContextRef m_exe_ctx_ref; // The current execution context to use when handling commands
bool m_synchronous_execution;
@@ -709,7 +705,7 @@ private:
OptionArgMap m_alias_options; // Stores any options (with or without arguments) that go with any alias.
CommandHistory m_command_history;
std::string m_repeat_command; // Stores the command that will be executed for an empty command string.
- std::unique_ptr<ScriptInterpreter> m_script_interpreter_ap;
+ lldb::ScriptInterpreterSP m_script_interpreter_sp;
lldb::IOHandlerSP m_command_io_handler_sp;
char m_comment_char;
bool m_batch_command_mode;
@@ -719,10 +715,8 @@ private:
uint32_t m_num_errors;
bool m_quit_requested;
bool m_stopped_for_crash;
-
};
-
} // namespace lldb_private
-#endif // liblldb_CommandInterpreter_h_
+#endif // liblldb_CommandInterpreter_h_
diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h
index 023de29c7b6c6..8015fec41cd29 100644
--- a/include/lldb/Interpreter/CommandObject.h
+++ b/include/lldb/Interpreter/CommandObject.h
@@ -10,11 +10,14 @@
#ifndef liblldb_CommandObject_h_
#define liblldb_CommandObject_h_
+// C Includes
+// C++ Includes
#include <map>
-#include <set>
#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
@@ -28,7 +31,6 @@ namespace lldb_private {
class CommandObject
{
public:
-
typedef const char *(ArgumentHelpCallbackFunction) ();
struct ArgumentHelpCallback
@@ -44,9 +46,8 @@ public:
explicit operator bool() const
{
- return (help_callback != NULL);
+ return (help_callback != nullptr);
}
-
};
struct ArgumentTableEntry // Entries in the main argument information table
@@ -76,16 +77,15 @@ public:
typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
- CommandObject (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0);
+ CommandObject(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr,
+ uint32_t flags = 0);
virtual
~CommandObject ();
-
static const char *
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
@@ -141,15 +141,15 @@ public:
IsMultiwordObject () { return false; }
virtual lldb::CommandObjectSP
- GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL)
+ GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr)
{
return lldb::CommandObjectSP();
}
virtual CommandObject *
- GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL)
+ GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr)
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -326,7 +326,6 @@ public:
/// @return
/// The number of completions.
//------------------------------------------------------------------
-
virtual int
HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -374,13 +373,13 @@ public:
/// The complete current command line.
///
/// @return
- /// NULL if there is no special repeat command - it will use the current command line.
+ /// nullptr if there is no special repeat command - it will use the current command line.
/// Otherwise a pointer to the command to be repeated.
/// If the returned string is the empty string, the command won't be repeated.
//------------------------------------------------------------------
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
{
- return NULL;
+ return nullptr;
}
bool
@@ -488,62 +487,61 @@ protected:
// to the specified command argument entry.
static void
AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange);
-
};
class CommandObjectParsed : public CommandObject
{
public:
-
- CommandObjectParsed (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0) :
+ CommandObjectParsed(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr,
+ uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}
- virtual
- ~CommandObjectParsed () {};
+ ~CommandObjectParsed() override = default;
- virtual bool
- Execute (const char *args_string, CommandReturnObject &result);
+ bool
+ Execute(const char *args_string, CommandReturnObject &result) override;
protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result) = 0;
- virtual bool
- WantsRawCommandString() { return false; };
+ bool
+ WantsRawCommandString() override
+ {
+ return false;
+ }
};
class CommandObjectRaw : public CommandObject
{
public:
-
- CommandObjectRaw (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0) :
+ CommandObjectRaw(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr,
+ uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}
- virtual
- ~CommandObjectRaw () {};
+ ~CommandObjectRaw() override = default;
- virtual bool
- Execute (const char *args_string, CommandReturnObject &result);
+ bool
+ Execute(const char *args_string, CommandReturnObject &result) override;
protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result) = 0;
- virtual bool
- WantsRawCommandString() { return true; };
+ bool
+ WantsRawCommandString() override
+ {
+ return true;
+ }
};
-
} // namespace lldb_private
-
-#endif // liblldb_CommandObject_h_
+#endif // liblldb_CommandObject_h_
diff --git a/include/lldb/Interpreter/CommandObjectMultiword.h b/include/lldb/Interpreter/CommandObjectMultiword.h
index 491d43c4bd9db..e1ad2940c3837 100644
--- a/include/lldb/Interpreter/CommandObjectMultiword.h
+++ b/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -12,8 +12,6 @@
// C Includes
// C++ Includes
-#include <map>
-
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/CommandObject.h"
@@ -30,57 +28,66 @@ class CommandObjectMultiword : public CommandObject
friend class CommandInterpreter;
friend class CommandObjectSyntax;
public:
- CommandObjectMultiword (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0);
+ CommandObjectMultiword(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr,
+ uint32_t flags = 0);
- virtual
- ~CommandObjectMultiword ();
+ ~CommandObjectMultiword() override;
- virtual bool
- IsMultiwordObject () { return true; }
+ bool
+ IsMultiwordObject() override
+ {
+ return true;
+ }
- virtual bool
- LoadSubCommand (const char *cmd_name,
- const lldb::CommandObjectSP& command_obj);
+ bool
+ LoadSubCommand(const char *cmd_name,
+ const lldb::CommandObjectSP& command_obj) override;
- virtual void
- GenerateHelpText (Stream &output_stream);
+ void
+ GenerateHelpText(Stream &output_stream) override;
- virtual lldb::CommandObjectSP
- GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
+ lldb::CommandObjectSP
+ GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
- virtual CommandObject *
- GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
-
- virtual void
- AproposAllSubCommands (const char *prefix,
- const char *search_word,
- StringList &commands_found,
- StringList &commands_help);
-
- virtual bool
- WantsRawCommandString() { return false; };
-
- virtual int
- HandleCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
-
- virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index);
-
- virtual bool
- Execute (const char *args_string,
- CommandReturnObject &result);
+ CommandObject *
+ GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
+
+ void
+ AproposAllSubCommands(const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help) override;
+
+ bool
+ WantsRawCommandString() override
+ {
+ return false;
+ }
+
+ int
+ HandleCompletion(Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
+
+ const char *
+ GetRepeatCommand (Args &current_command_args, uint32_t index) override;
+
+ bool
+ Execute(const char *args_string,
+ CommandReturnObject &result) override;
- virtual bool
- IsRemovable() const { return m_can_be_removed; }
+ bool
+ IsRemovable() const override
+ {
+ return m_can_be_removed;
+ }
void
SetRemovable (bool removable)
@@ -93,95 +100,93 @@ protected:
CommandObject::CommandMap m_subcommand_dict;
bool m_can_be_removed;
};
-
class CommandObjectProxy : public CommandObject
{
public:
- CommandObjectProxy (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0);
+ CommandObjectProxy(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr,
+ uint32_t flags = 0);
- virtual
- ~CommandObjectProxy ();
+ ~CommandObjectProxy() override;
// Subclasses must provide a command object that will be transparently
// used for this object.
virtual CommandObject *
GetProxyCommandObject() = 0;
- virtual const char *
- GetHelpLong ();
+ const char *
+ GetHelpLong() override;
- virtual bool
- IsRemovable() const;
+ bool
+ IsRemovable() const override;
- virtual bool
- IsMultiwordObject ();
-
- virtual lldb::CommandObjectSP
- GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
-
- virtual CommandObject *
- GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
+ bool
+ IsMultiwordObject() override;
- virtual void
- AproposAllSubCommands (const char *prefix,
- const char *search_word,
- StringList &commands_found,
- StringList &commands_help);
-
- virtual bool
- LoadSubCommand (const char *cmd_name,
- const lldb::CommandObjectSP& command_obj);
-
- virtual bool
- WantsRawCommandString();
+ void
+ GenerateHelpText (Stream &result) override;
- virtual bool
- WantsCompletion();
+ lldb::CommandObjectSP
+ GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
- virtual Options *
- GetOptions ();
+ CommandObject *
+ GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
-
- virtual int
- HandleCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
-
- virtual int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
-
- virtual const char *
- GetRepeatCommand (Args &current_command_args,
- uint32_t index);
-
- virtual bool
- Execute (const char *args_string,
- CommandReturnObject &result);
+ void
+ AproposAllSubCommands(const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help) override;
+
+ bool
+ LoadSubCommand(const char *cmd_name,
+ const lldb::CommandObjectSP& command_obj) override;
+
+ bool
+ WantsRawCommandString() override;
+
+ bool
+ WantsCompletion() override;
+
+ Options *
+ GetOptions() override;
+
+ int
+ HandleCompletion(Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
+
+ int
+ HandleArgumentCompletion(Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
+
+ const char *
+ GetRepeatCommand(Args &current_command_args,
+ uint32_t index) override;
+
+ bool
+ Execute(const char *args_string,
+ CommandReturnObject &result) override;
protected:
-
// These two want to iterate over the subcommand dictionary.
friend class CommandInterpreter;
friend class CommandObjectSyntax;
-
};
} // namespace lldb_private
-#endif // liblldb_CommandObjectMultiword_h_
+#endif // liblldb_CommandObjectMultiword_h_
diff --git a/include/lldb/Interpreter/CommandObjectRegexCommand.h b/include/lldb/Interpreter/CommandObjectRegexCommand.h
index d865446387765..9f8974a32bb20 100644
--- a/include/lldb/Interpreter/CommandObjectRegexCommand.h
+++ b/include/lldb/Interpreter/CommandObjectRegexCommand.h
@@ -28,7 +28,6 @@ namespace lldb_private {
class CommandObjectRegexCommand : public CommandObjectRaw
{
public:
-
CommandObjectRegexCommand (CommandInterpreter &interpreter,
const char *name,
const char *help,
@@ -37,8 +36,7 @@ public:
uint32_t completion_type_mask,
bool is_removable);
- virtual
- ~CommandObjectRegexCommand ();
+ ~CommandObjectRegexCommand() override;
bool
IsRemovable () const override { return m_is_removable; }
@@ -83,4 +81,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_CommandObjectRegexCommand_h_
+#endif // liblldb_CommandObjectRegexCommand_h_
diff --git a/include/lldb/Interpreter/CommandOptionValidators.h b/include/lldb/Interpreter/CommandOptionValidators.h
index 6be247ad4b65c..395cb8ed3d9ec 100644
--- a/include/lldb/Interpreter/CommandOptionValidators.h
+++ b/include/lldb/Interpreter/CommandOptionValidators.h
@@ -10,6 +10,10 @@
#ifndef liblldb_CommandOptionValidators_h_
#define liblldb_CommandOptionValidators_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private-types.h"
namespace lldb_private {
@@ -19,12 +23,11 @@ class ExecutionContext;
class PosixPlatformCommandOptionValidator : public OptionValidator
{
- virtual bool IsValid(Platform &platform, const ExecutionContext &target) const;
- virtual const char* ShortConditionString() const;
- virtual const char* LongConditionString() const;
+ bool IsValid(Platform &platform, const ExecutionContext &target) const override;
+ const char* ShortConditionString() const override;
+ const char* LongConditionString() const override;
};
} // namespace lldb_private
-
-#endif // liblldb_CommandOptionValidators_h_
+#endif // liblldb_CommandOptionValidators_h_
diff --git a/include/lldb/Interpreter/CommandReturnObject.h b/include/lldb/Interpreter/CommandReturnObject.h
index b922e1731d7e5..424ac800d14c0 100644
--- a/include/lldb/Interpreter/CommandReturnObject.h
+++ b/include/lldb/Interpreter/CommandReturnObject.h
@@ -22,11 +22,9 @@
namespace lldb_private {
-
class CommandReturnObject
{
public:
-
CommandReturnObject ();
~CommandReturnObject ();
@@ -142,8 +140,8 @@ public:
AppendErrorWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
void
- SetError (const Error &error,
- const char *fallback_error_cstr = NULL);
+ SetError(const Error &error,
+ const char *fallback_error_cstr = nullptr);
void
SetError (const char *error_cstr);
@@ -189,4 +187,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_CommandReturnObject_h_
+#endif // liblldb_CommandReturnObject_h_
diff --git a/include/lldb/Interpreter/OptionGroupArchitecture.h b/include/lldb/Interpreter/OptionGroupArchitecture.h
index 7cd1ca3d710d2..5ee608506c04b 100644
--- a/include/lldb/Interpreter/OptionGroupArchitecture.h
+++ b/include/lldb/Interpreter/OptionGroupArchitecture.h
@@ -26,26 +26,23 @@ namespace lldb_private {
class OptionGroupArchitecture : public OptionGroup
{
public:
-
OptionGroupArchitecture ();
- virtual
- ~OptionGroupArchitecture ();
+ ~OptionGroupArchitecture() override;
+ uint32_t
+ GetNumDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
-
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
bool
GetArchitecture (Platform *platform, ArchSpec &arch);
@@ -55,19 +52,17 @@ public:
{
return !m_arch_str.empty();
}
+
const char *
- GetArchitectureName ()
+ GetArchitectureName()
{
- if (m_arch_str.empty())
- return NULL;
- return m_arch_str.c_str();
+ return (m_arch_str.empty() ? nullptr : m_arch_str.c_str());
}
protected:
-
std::string m_arch_str; // Save the arch triple in case a platform is specified after the architecture
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupArchitecture_h_
+#endif // liblldb_OptionGroupArchitecture_h_
diff --git a/include/lldb/Interpreter/OptionGroupBoolean.h b/include/lldb/Interpreter/OptionGroupBoolean.h
index 0d861b2416946..881a1bdf4be67 100644
--- a/include/lldb/Interpreter/OptionGroupBoolean.h
+++ b/include/lldb/Interpreter/OptionGroupBoolean.h
@@ -36,29 +36,27 @@ namespace lldb_private {
bool default_value,
bool no_argument_toggle_default);
- virtual
- ~OptionGroupBoolean ();
-
-
- virtual uint32_t
- GetNumDefinitions ()
+ ~OptionGroupBoolean() override;
+
+ uint32_t
+ GetNumDefinitions() override
{
return 1;
}
- virtual const OptionDefinition*
- GetDefinitions ()
+ const OptionDefinition*
+ GetDefinitions() override
{
return &m_option_definition;
}
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionValueBoolean &
GetOptionValue ()
@@ -75,9 +73,8 @@ namespace lldb_private {
protected:
OptionValueBoolean m_value;
OptionDefinition m_option_definition;
-
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupBoolean_h_
+#endif // liblldb_OptionGroupBoolean_h_
diff --git a/include/lldb/Interpreter/OptionGroupFile.h b/include/lldb/Interpreter/OptionGroupFile.h
index 632a2dbdf2200..9e35dd43ab7aa 100644
--- a/include/lldb/Interpreter/OptionGroupFile.h
+++ b/include/lldb/Interpreter/OptionGroupFile.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupFile.h -------------------------------*- C++ -*-===//
+//===-- OptionGroupFile.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -27,7 +27,6 @@ namespace lldb_private {
class OptionGroupFile : public OptionGroup
{
public:
-
OptionGroupFile (uint32_t usage_mask,
bool required,
const char *long_option,
@@ -36,29 +35,27 @@ public:
lldb::CommandArgumentType argument_type,
const char *usage_text);
- virtual
- ~OptionGroupFile ();
+ ~OptionGroupFile() override;
-
- virtual uint32_t
- GetNumDefinitions ()
+ uint32_t
+ GetNumDefinitions() override
{
return 1;
}
- virtual const OptionDefinition*
- GetDefinitions ()
+ const OptionDefinition*
+ GetDefinitions() override
{
return &m_option_definition;
}
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionValueFileSpec &
GetOptionValue ()
@@ -75,7 +72,6 @@ public:
protected:
OptionValueFileSpec m_file;
OptionDefinition m_option_definition;
-
};
//-------------------------------------------------------------------------
@@ -94,30 +90,27 @@ public:
lldb::CommandArgumentType argument_type,
const char *usage_text);
- virtual
- ~OptionGroupFileList ();
+ ~OptionGroupFileList() override;
-
- virtual uint32_t
- GetNumDefinitions ()
+ uint32_t
+ GetNumDefinitions() override
{
return 1;
}
- virtual const OptionDefinition*
- GetDefinitions ()
+ const OptionDefinition*
+ GetDefinitions() override
{
return &m_option_definition;
}
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
-
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionValueFileSpecList &
GetOptionValue ()
@@ -134,9 +127,8 @@ public:
protected:
OptionValueFileSpecList m_file_list;
OptionDefinition m_option_definition;
-
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupFile_h_
+#endif // liblldb_OptionGroupFile_h_
diff --git a/include/lldb/Interpreter/OptionGroupFormat.h b/include/lldb/Interpreter/OptionGroupFormat.h
index 7419b04966681..9a96cc505de4c 100644
--- a/include/lldb/Interpreter/OptionGroupFormat.h
+++ b/include/lldb/Interpreter/OptionGroupFormat.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupFormat.h -------------------------------*- C++ -*-===//
+//===-- OptionGroupFormat.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -37,23 +37,21 @@ public:
uint64_t default_byte_size = UINT64_MAX, // Pass UINT64_MAX to disable the "--size" option
uint64_t default_count = UINT64_MAX); // Pass UINT64_MAX to disable the "--count" option
- virtual
- ~OptionGroupFormat ();
+ ~OptionGroupFormat() override;
+ uint32_t
+ GetNumDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual const OptionDefinition*
- GetDefinitions ();
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
-
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
lldb::Format
GetFormat () const
@@ -112,7 +110,6 @@ public:
}
protected:
-
bool
ParserGDBFormatLetter (CommandInterpreter &interpreter,
char format_letter,
@@ -124,10 +121,9 @@ protected:
OptionValueUInt64 m_count;
char m_prev_gdb_format;
char m_prev_gdb_size;
-
bool m_has_gdb_format;
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupFormat_h_
+#endif // liblldb_OptionGroupFormat_h_
diff --git a/include/lldb/Interpreter/OptionGroupOutputFile.h b/include/lldb/Interpreter/OptionGroupOutputFile.h
index 533cd6ee8eb3f..e6083714c48d1 100644
--- a/include/lldb/Interpreter/OptionGroupOutputFile.h
+++ b/include/lldb/Interpreter/OptionGroupOutputFile.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupOutputFile.h -------------------------------*- C++ -*-===//
+//===-- OptionGroupOutputFile.h ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -26,26 +26,23 @@ namespace lldb_private {
class OptionGroupOutputFile : public OptionGroup
{
public:
-
OptionGroupOutputFile ();
- virtual
- ~OptionGroupOutputFile ();
+ ~OptionGroupOutputFile() override;
+ uint32_t
+ GetNumDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
-
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
const OptionValueFileSpec &
GetFile ()
@@ -68,9 +65,8 @@ public:
protected:
OptionValueFileSpec m_file;
OptionValueBoolean m_append;
-
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupOutputFile_h_
+#endif // liblldb_OptionGroupOutputFile_h_
diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h
index f7de50c86a563..68880236accc2 100644
--- a/include/lldb/Interpreter/OptionGroupPlatform.h
+++ b/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -27,7 +27,6 @@ namespace lldb_private {
class OptionGroupPlatform : public OptionGroup
{
public:
-
OptionGroupPlatform (bool include_platform_option) :
OptionGroup(),
m_platform_name (),
@@ -39,24 +38,21 @@ public:
{
}
- virtual
- ~OptionGroupPlatform ()
- {
- }
+ ~OptionGroupPlatform() override = default;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
lldb::PlatformSP
CreatePlatformWithOptions (CommandInterpreter &interpreter,
@@ -119,4 +115,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionGroupPlatform_h_
+#endif // liblldb_OptionGroupPlatform_h_
diff --git a/include/lldb/Interpreter/OptionGroupString.h b/include/lldb/Interpreter/OptionGroupString.h
index e62a81bc41180..6f46bdb79408c 100644
--- a/include/lldb/Interpreter/OptionGroupString.h
+++ b/include/lldb/Interpreter/OptionGroupString.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupString.h ------------------------------------*- C++ -*-===//
+//===-- OptionGroupString.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -25,7 +25,6 @@ namespace lldb_private {
class OptionGroupString : public OptionGroup
{
public:
-
OptionGroupString (uint32_t usage_mask,
bool required,
const char *long_option,
@@ -35,29 +34,27 @@ namespace lldb_private {
const char *usage_text,
const char *default_value);
- virtual
- ~OptionGroupString ();
-
-
- virtual uint32_t
- GetNumDefinitions ()
+ ~OptionGroupString() override;
+
+ uint32_t
+ GetNumDefinitions() override
{
return 1;
}
- virtual const OptionDefinition*
- GetDefinitions ()
+ const OptionDefinition*
+ GetDefinitions() override
{
return &m_option_definition;
}
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionValueString &
GetOptionValue ()
@@ -74,9 +71,8 @@ namespace lldb_private {
protected:
OptionValueString m_value;
OptionDefinition m_option_definition;
-
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupString_h_
+#endif // liblldb_OptionGroupString_h_
diff --git a/include/lldb/Interpreter/OptionGroupUInt64.h b/include/lldb/Interpreter/OptionGroupUInt64.h
index c5f9e85d2f8f8..b03c1ff889a11 100644
--- a/include/lldb/Interpreter/OptionGroupUInt64.h
+++ b/include/lldb/Interpreter/OptionGroupUInt64.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupUInt64.h ------------------------------------*- C++ -*-===//
+//===-- OptionGroupUInt64.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -18,6 +18,7 @@
#include "lldb/Interpreter/OptionValueUInt64.h"
namespace lldb_private {
+
//-------------------------------------------------------------------------
// OptionGroupUInt64
//-------------------------------------------------------------------------
@@ -25,7 +26,6 @@ namespace lldb_private {
class OptionGroupUInt64 : public OptionGroup
{
public:
-
OptionGroupUInt64 (uint32_t usage_mask,
bool required,
const char *long_option,
@@ -35,29 +35,27 @@ namespace lldb_private {
const char *usage_text,
uint64_t default_value);
- virtual
- ~OptionGroupUInt64 ();
-
-
- virtual uint32_t
- GetNumDefinitions ()
+ ~OptionGroupUInt64() override;
+
+ uint32_t
+ GetNumDefinitions() override
{
return 1;
}
- virtual const OptionDefinition*
- GetDefinitions ()
+ const OptionDefinition*
+ GetDefinitions() override
{
return &m_option_definition;
}
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionValueUInt64 &
GetOptionValue ()
@@ -74,9 +72,8 @@ namespace lldb_private {
protected:
OptionValueUInt64 m_value;
OptionDefinition m_option_definition;
-
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupUInt64_h_
+#endif // liblldb_OptionGroupUInt64_h_
diff --git a/include/lldb/Interpreter/OptionGroupUUID.h b/include/lldb/Interpreter/OptionGroupUUID.h
index ea968d737969d..6495699dce752 100644
--- a/include/lldb/Interpreter/OptionGroupUUID.h
+++ b/include/lldb/Interpreter/OptionGroupUUID.h
@@ -18,6 +18,7 @@
#include "lldb/Interpreter/OptionValueUUID.h"
namespace lldb_private {
+
//-------------------------------------------------------------------------
// OptionGroupUUID
//-------------------------------------------------------------------------
@@ -25,26 +26,23 @@ namespace lldb_private {
class OptionGroupUUID : public OptionGroup
{
public:
-
OptionGroupUUID ();
- virtual
- ~OptionGroupUUID ();
+ ~OptionGroupUUID() override;
+ uint32_t
+ GetNumDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
-
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
const OptionValueUUID &
GetOptionValue () const
@@ -58,4 +56,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionGroupUUID_h_
+#endif // liblldb_OptionGroupUUID_h_
diff --git a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
index 5cce126f89bf6..53c8550da81e7 100644
--- a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
+++ b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
@@ -1,4 +1,4 @@
-//===-- OptionGroupValueObjectDisplay.h -------------------------------*- C++ -*-===//
+//===-- OptionGroupValueObjectDisplay.h -------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -26,41 +26,38 @@ namespace lldb_private {
class OptionGroupValueObjectDisplay : public OptionGroup
{
public:
-
OptionGroupValueObjectDisplay ();
- virtual
- ~OptionGroupValueObjectDisplay ();
+ ~OptionGroupValueObjectDisplay() override;
+ uint32_t
+ GetNumDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
-
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
bool
AnyOptionWasSet () const
{
- return show_types == true ||
- no_summary_depth != 0 ||
- show_location == true ||
- flat_output == true ||
- use_objc == true ||
+ return show_types ||
+ no_summary_depth != 0 ||
+ show_location ||
+ flat_output ||
+ use_objc ||
max_depth != UINT32_MAX ||
ptr_depth != 0 ||
- use_synth == false ||
- be_raw == true ||
- ignore_cap == true ||
- run_validator == true;
+ !use_synth ||
+ be_raw ||
+ ignore_cap ||
+ run_validator;
}
DumpValueObjectOptions
@@ -85,4 +82,4 @@ public:
} // namespace lldb_private
-#endif // liblldb_OptionGroupValueObjectDisplay_h_
+#endif // liblldb_OptionGroupValueObjectDisplay_h_
diff --git a/include/lldb/Interpreter/OptionGroupVariable.h b/include/lldb/Interpreter/OptionGroupVariable.h
index 40f4d436bc698..fd338f1ba8cba 100644
--- a/include/lldb/Interpreter/OptionGroupVariable.h
+++ b/include/lldb/Interpreter/OptionGroupVariable.h
@@ -26,25 +26,23 @@ namespace lldb_private {
class OptionGroupVariable : public OptionGroup
{
public:
-
OptionGroupVariable (bool show_frame_options);
- virtual
- ~OptionGroupVariable ();
-
- virtual uint32_t
- GetNumDefinitions ();
+ ~OptionGroupVariable() override;
+
+ uint32_t
+ GetNumDefinitions() override;
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_arg);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
bool include_frame_options:1,
show_args:1, // Frame option only (include_frame_options == true)
@@ -62,4 +60,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // liblldb_OptionGroupVariable_h_
+#endif // liblldb_OptionGroupVariable_h_
diff --git a/include/lldb/Interpreter/OptionGroupWatchpoint.h b/include/lldb/Interpreter/OptionGroupWatchpoint.h
index 1298da80750e8..ddc4393bdc255 100644
--- a/include/lldb/Interpreter/OptionGroupWatchpoint.h
+++ b/include/lldb/Interpreter/OptionGroupWatchpoint.h
@@ -25,28 +25,26 @@ namespace lldb_private {
class OptionGroupWatchpoint : public OptionGroup
{
public:
-
+ OptionGroupWatchpoint ();
+
+ ~OptionGroupWatchpoint() override;
+
static bool
IsWatchSizeSupported(uint32_t watch_size);
- OptionGroupWatchpoint ();
-
- virtual
- ~OptionGroupWatchpoint ();
-
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
- virtual const OptionDefinition*
- GetDefinitions ();
+ const OptionDefinition*
+ GetDefinitions() override;
- virtual Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_arg);
+ Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg) override;
- virtual void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ void
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
// Note:
// eWatchRead == LLDB_WATCH_TYPE_READ; and
@@ -68,4 +66,4 @@ namespace lldb_private {
} // namespace lldb_private
-#endif // liblldb_OptionGroupWatchpoint_h_
+#endif // liblldb_OptionGroupWatchpoint_h_
diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h
index fd751f744de63..a05a0fb0b64f3 100644
--- a/include/lldb/Interpreter/OptionValue.h
+++ b/include/lldb/Interpreter/OptionValue.h
@@ -1,4 +1,4 @@
-//===-- OptionValue.h --------------------------------------*- C++ -*-===//
+//===-- OptionValue.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -61,7 +61,6 @@ namespace lldb_private {
eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription)
};
-
OptionValue () :
m_callback (nullptr),
m_baton(nullptr),
@@ -76,9 +75,8 @@ namespace lldb_private {
{
}
- virtual ~OptionValue ()
- {
- }
+ virtual ~OptionValue() = default;
+
//-----------------------------------------------------------------
// Subclasses should override these functions
//-----------------------------------------------------------------
@@ -99,7 +97,6 @@ namespace lldb_private {
return GetBuiltinTypeAsCString(GetType());
}
-
static const char *
GetBuiltinTypeAsCString (Type t);
@@ -156,6 +153,7 @@ namespace lldb_private {
virtual bool
DumpQualifiedName (Stream &strm) const;
+
//-----------------------------------------------------------------
// Subclasses should NOT override these functions as they use the
// above functions to implement functionality
@@ -376,7 +374,7 @@ namespace lldb_private {
SetSInt64Value (int64_t new_value);
const char *
- GetStringValue (const char *fail_value = NULL) const;
+ GetStringValue(const char *fail_value = nullptr) const;
bool
SetStringValue (const char *new_value);
@@ -415,7 +413,7 @@ namespace lldb_private {
SetValueChangedCallback (OptionValueChangedCallback callback,
void *baton)
{
- assert (m_callback == NULL);
+ assert (m_callback == nullptr);
m_callback = callback;
m_baton = baton;
}
@@ -426,6 +424,7 @@ namespace lldb_private {
if (m_callback)
m_callback (m_baton, this);
}
+
protected:
lldb::OptionValueWP m_parent_wp;
OptionValueChangedCallback m_callback;
@@ -436,9 +435,8 @@ namespace lldb_private {
// the command line or as a setting, versus if we
// just have the default value that was already
// populated in the option value.
-
};
} // namespace lldb_private
-#endif // liblldb_OptionValue_h_
+#endif // liblldb_OptionValue_h_
diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h
index 3d5d72619efca..c83dc85580842 100644
--- a/include/lldb/Interpreter/OptionValueArch.h
+++ b/include/lldb/Interpreter/OptionValueArch.h
@@ -52,8 +52,7 @@ public:
{
}
- virtual
- ~OptionValueArch()
+ ~OptionValueArch() override
{
}
@@ -61,37 +60,37 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeArch;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
+ size_t
+ AutoComplete(CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -136,4 +135,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueArch_h_
+#endif // liblldb_OptionValueArch_h_
diff --git a/include/lldb/Interpreter/OptionValueArgs.h b/include/lldb/Interpreter/OptionValueArgs.h
index 365a52a8b39fe..ad9505af30153 100644
--- a/include/lldb/Interpreter/OptionValueArgs.h
+++ b/include/lldb/Interpreter/OptionValueArgs.h
@@ -26,16 +26,15 @@ public:
{
}
- virtual
- ~OptionValueArgs()
+ ~OptionValueArgs() override
{
}
size_t
GetArgs (Args &args);
- virtual Type
- GetType() const
+ Type
+ GetType() const override
{
return eTypeArgs;
}
@@ -43,4 +42,4 @@ public:
} // namespace lldb_private
-#endif // liblldb_OptionValueArgs_h_
+#endif // liblldb_OptionValueArgs_h_
diff --git a/include/lldb/Interpreter/OptionValueArray.h b/include/lldb/Interpreter/OptionValueArray.h
index 2e44f9f074383..38b9e3c3ee97f 100644
--- a/include/lldb/Interpreter/OptionValueArray.h
+++ b/include/lldb/Interpreter/OptionValueArray.h
@@ -30,8 +30,7 @@ public:
{
}
- virtual
- ~OptionValueArray()
+ ~OptionValueArray() override
{
}
@@ -39,41 +38,41 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeArray;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_values.clear();
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual bool
- IsAggregateValue () const
+ bool
+ IsAggregateValue() const override
{
return true;
}
- virtual lldb::OptionValueSP
- GetSubValue (const ExecutionContext *exe_ctx,
- const char *name,
- bool will_modify,
- Error &error) const;
+ lldb::OptionValueSP
+ GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name,
+ bool will_modify,
+ Error &error) const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -175,4 +174,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueArray_h_
+#endif // liblldb_OptionValueArray_h_
diff --git a/include/lldb/Interpreter/OptionValueBoolean.h b/include/lldb/Interpreter/OptionValueBoolean.h
index 214fd1649d39a..52d39a9b8d27d 100644
--- a/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/include/lldb/Interpreter/OptionValueBoolean.h
@@ -35,8 +35,7 @@ public:
{
}
- virtual
- ~OptionValueBoolean()
+ ~OptionValueBoolean() override
{
}
@@ -44,34 +43,34 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeBoolean;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
+ size_t
+ AutoComplete(CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -128,8 +127,8 @@ public:
m_default_value = value;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
protected:
bool m_current_value;
@@ -138,4 +137,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueBoolean_h_
+#endif // liblldb_OptionValueBoolean_h_
diff --git a/include/lldb/Interpreter/OptionValueChar.h b/include/lldb/Interpreter/OptionValueChar.h
index 8fc02093e3d99..b05d9ca098b25 100644
--- a/include/lldb/Interpreter/OptionValueChar.h
+++ b/include/lldb/Interpreter/OptionValueChar.h
@@ -27,6 +27,7 @@ public:
m_default_value (value)
{
}
+
OptionValueChar (char current_value,
char default_value) :
OptionValue(),
@@ -35,8 +36,7 @@ public:
{
}
- virtual
- ~OptionValueChar()
+ ~OptionValueChar() override
{
}
@@ -44,21 +44,21 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeChar;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
@@ -100,8 +100,8 @@ public:
m_default_value = value;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
protected:
char m_current_value;
@@ -110,4 +110,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueChar_h_
+#endif // liblldb_OptionValueChar_h_
diff --git a/include/lldb/Interpreter/OptionValueDictionary.h b/include/lldb/Interpreter/OptionValueDictionary.h
index efa15dd6ef880..8ee8397756466 100644
--- a/include/lldb/Interpreter/OptionValueDictionary.h
+++ b/include/lldb/Interpreter/OptionValueDictionary.h
@@ -31,8 +31,7 @@ public:
{
}
- virtual
- ~OptionValueDictionary()
+ ~OptionValueDictionary() override
{
}
@@ -40,32 +39,32 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeDictionary;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_values.clear();
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual bool
- IsAggregateValue () const
+ bool
+ IsAggregateValue() const override
{
return true;
}
@@ -89,17 +88,17 @@ public:
lldb::OptionValueSP
GetValueForKey (const ConstString &key) const;
- virtual lldb::OptionValueSP
- GetSubValue (const ExecutionContext *exe_ctx,
- const char *name,
- bool will_modify,
- Error &error) const;
-
- virtual Error
- SetSubValue (const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *name,
- const char *value);
+ lldb::OptionValueSP
+ GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name,
+ bool will_modify,
+ Error &error) const override;
+
+ Error
+ SetSubValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op,
+ const char *name,
+ const char *value) override;
//---------------------------------------------------------------------
// String value getters and setters
@@ -136,4 +135,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueDictionary_h_
+#endif // liblldb_OptionValueDictionary_h_
diff --git a/include/lldb/Interpreter/OptionValueEnumeration.h b/include/lldb/Interpreter/OptionValueEnumeration.h
index e820729385de3..b3fc481dd7fae 100644
--- a/include/lldb/Interpreter/OptionValueEnumeration.h
+++ b/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -23,7 +23,6 @@
namespace lldb_private {
-
class OptionValueEnumeration : public OptionValue
{
public:
@@ -38,44 +37,43 @@ public:
OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value);
- virtual
- ~OptionValueEnumeration();
+ ~OptionValueEnumeration() override;
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeEnum;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
+ size_t
+ AutoComplete(CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -123,4 +121,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueEnumeration_h_
+#endif // liblldb_OptionValueEnumeration_h_
diff --git a/include/lldb/Interpreter/OptionValueFileSpec.h b/include/lldb/Interpreter/OptionValueFileSpec.h
index 80dd77ecef2a6..274c4d064e511 100644
--- a/include/lldb/Interpreter/OptionValueFileSpec.h
+++ b/include/lldb/Interpreter/OptionValueFileSpec.h
@@ -31,8 +31,7 @@ public:
const FileSpec &default_value,
bool resolve = true);
- virtual
- ~OptionValueFileSpec()
+ ~OptionValueFileSpec() override
{
}
@@ -40,21 +39,21 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeFileSpec;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
@@ -63,16 +62,16 @@ public:
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
+ size_t
+ AutoComplete(CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -131,4 +130,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueFileSpec_h_
+#endif // liblldb_OptionValueFileSpec_h_
diff --git a/include/lldb/Interpreter/OptionValueFileSpecList.h b/include/lldb/Interpreter/OptionValueFileSpecList.h
index a105d22e45f9a..2051323580240 100644
--- a/include/lldb/Interpreter/OptionValueFileSpecList.h
+++ b/include/lldb/Interpreter/OptionValueFileSpecList.h
@@ -34,9 +34,7 @@ public:
{
}
-
- virtual
- ~OptionValueFileSpecList()
+ ~OptionValueFileSpecList() override
{
}
@@ -44,32 +42,32 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeFileSpecList;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value.Clear();
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual bool
- IsAggregateValue () const
+ bool
+ IsAggregateValue() const override
{
return true;
}
@@ -102,4 +100,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueFileSpecList_h_
+#endif // liblldb_OptionValueFileSpecList_h_
diff --git a/include/lldb/Interpreter/OptionValueFormat.h b/include/lldb/Interpreter/OptionValueFormat.h
index 06ed128543182..1c29094599110 100644
--- a/include/lldb/Interpreter/OptionValueFormat.h
+++ b/include/lldb/Interpreter/OptionValueFormat.h
@@ -36,8 +36,7 @@ public:
{
}
- virtual
- ~OptionValueFormat()
+ ~OptionValueFormat() override
{
}
@@ -45,29 +44,29 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeFormat;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -104,4 +103,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueFormat_h_
+#endif // liblldb_OptionValueFormat_h_
diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h
index 18ace3a6a1b69..10a456a1b9948 100644
--- a/include/lldb/Interpreter/OptionValueFormatEntity.h
+++ b/include/lldb/Interpreter/OptionValueFormatEntity.h
@@ -24,8 +24,7 @@ class OptionValueFormatEntity : public OptionValue
public:
OptionValueFormatEntity (const char *default_format);
- virtual
- ~OptionValueFormatEntity()
+ ~OptionValueFormatEntity() override
{
}
@@ -94,7 +93,6 @@ public:
return m_default_entry;
}
-
protected:
std::string m_current_format;
std::string m_default_format;
@@ -104,4 +102,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueFormatEntity_h_
+#endif // liblldb_OptionValueFormatEntity_h_
diff --git a/include/lldb/Interpreter/OptionValueLanguage.h b/include/lldb/Interpreter/OptionValueLanguage.h
index fba5e22821e0d..bd6df3ea4943f 100644
--- a/include/lldb/Interpreter/OptionValueLanguage.h
+++ b/include/lldb/Interpreter/OptionValueLanguage.h
@@ -37,8 +37,7 @@ public:
{
}
- virtual
- ~OptionValueLanguage ()
+ ~OptionValueLanguage() override
{
}
@@ -104,4 +103,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueLanguage_h_
+#endif // liblldb_OptionValueLanguage_h_
diff --git a/include/lldb/Interpreter/OptionValuePathMappings.h b/include/lldb/Interpreter/OptionValuePathMappings.h
index 7b476a9cd366a..4ed1c8c848d6d 100644
--- a/include/lldb/Interpreter/OptionValuePathMappings.h
+++ b/include/lldb/Interpreter/OptionValuePathMappings.h
@@ -29,8 +29,7 @@ public:
{
}
- virtual
- ~OptionValuePathMappings()
+ ~OptionValuePathMappings() override
{
}
@@ -38,32 +37,32 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypePathMap;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_path_mappings.Clear(m_notify_changes);
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual bool
- IsAggregateValue () const
+ bool
+ IsAggregateValue() const override
{
return true;
}
@@ -91,4 +90,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValuePathMappings_h_
+#endif // liblldb_OptionValuePathMappings_h_
diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h
index 405beefff6d15..c8783bcf36eb0 100644
--- a/include/lldb/Interpreter/OptionValueProperties.h
+++ b/include/lldb/Interpreter/OptionValueProperties.h
@@ -1,4 +1,4 @@
-//===-- OptionValueProperties.h --------------------------------------*- C++ -*-===//
+//===-- OptionValueProperties.h ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
@@ -27,10 +29,6 @@ class OptionValueProperties :
public std::enable_shared_from_this<OptionValueProperties>
{
public:
-
- //---------------------------------------------------------------------
- // OptionValueProperties
- //---------------------------------------------------------------------
OptionValueProperties () :
OptionValue(),
m_name (),
@@ -42,34 +40,32 @@ public:
OptionValueProperties (const ConstString &name);
OptionValueProperties (const OptionValueProperties &global_properties);
-
- virtual
- ~OptionValueProperties()
- {
- }
-
- virtual Type
- GetType () const
+
+ ~OptionValueProperties() override = default;
+
+ Type
+ GetType() const override
{
return eTypeProperties;
}
- virtual bool
- Clear ();
+ bool
+ Clear() override;
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
- virtual Error
- SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual void
- DumpValue (const ExecutionContext *exe_ctx,
- Stream &strm,
- uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx,
+ Stream &strm,
+ uint32_t dump_mask) override;
- virtual ConstString
- GetName () const
+ ConstString
+ GetName() const override
{
return m_name;
}
@@ -149,16 +145,16 @@ public:
bool value_will_be_modified) const;
lldb::OptionValueSP
- GetSubValue (const ExecutionContext *exe_ctx,
- const char *name,
- bool value_will_be_modified,
- Error &error) const;
+ GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name,
+ bool value_will_be_modified,
+ Error &error) const override;
- virtual Error
- SetSubValue (const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *path,
- const char *value);
+ Error
+ SetSubValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op,
+ const char *path,
+ const char *value) override;
virtual bool
PredicateMatches (const ExecutionContext *exe_ctx,
@@ -171,6 +167,9 @@ public:
OptionValueArch *
GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const;
+ OptionValueLanguage *
+ GetPropertyAtIndexAsOptionValueLanguage (const ExecutionContext *exe_ctx, uint32_t idx) const;
+
bool
GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const;
@@ -251,22 +250,18 @@ public:
SetValueChangedCallback (uint32_t property_idx,
OptionValueChangedCallback callback,
void *baton);
-protected:
+protected:
Property *
- ProtectedGetPropertyAtIndex (uint32_t idx)
+ ProtectedGetPropertyAtIndex(uint32_t idx)
{
- if (idx < m_properties.size())
- return &m_properties[idx];
- return NULL;
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
}
const Property *
- ProtectedGetPropertyAtIndex (uint32_t idx) const
+ ProtectedGetPropertyAtIndex(uint32_t idx) const
{
- if (idx < m_properties.size())
- return &m_properties[idx];
- return NULL;
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
}
typedef UniqueCStringMap<size_t> NameToIndex;
@@ -278,4 +273,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueProperties_h_
+#endif // liblldb_OptionValueProperties_h_
diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h
index 5e04218dbfdfc..a094a402b1a96 100644
--- a/include/lldb/Interpreter/OptionValueRegex.h
+++ b/include/lldb/Interpreter/OptionValueRegex.h
@@ -12,8 +12,6 @@
// C Includes
// C++ Includes
-#include <string>
-
// Other libraries and framework includes
// Project includes
#include "lldb/Core/RegularExpression.h"
@@ -24,44 +22,41 @@ namespace lldb_private {
class OptionValueRegex : public OptionValue
{
public:
- OptionValueRegex (const char *value = NULL) :
+ OptionValueRegex(const char *value = nullptr) :
OptionValue(),
m_regex (value)
{
}
- virtual
- ~OptionValueRegex()
- {
- }
-
+ ~OptionValueRegex() override = default;
+
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeRegex;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_regex.Clear();
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -69,9 +64,7 @@ public:
const RegularExpression *
GetCurrentValue() const
{
- if (m_regex.IsValid())
- return &m_regex;
- return NULL;
+ return (m_regex.IsValid() ? &m_regex : nullptr);
}
void
@@ -95,4 +88,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueRegex_h_
+#endif // liblldb_OptionValueRegex_h_
diff --git a/include/lldb/Interpreter/OptionValueSInt64.h b/include/lldb/Interpreter/OptionValueSInt64.h
index 36ae97ccfcf87..8c8b201b6e82b 100644
--- a/include/lldb/Interpreter/OptionValueSInt64.h
+++ b/include/lldb/Interpreter/OptionValueSInt64.h
@@ -58,8 +58,7 @@ public:
{
}
- virtual
- ~OptionValueSInt64()
+ ~OptionValueSInt64() override
{
}
@@ -67,29 +66,29 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeSInt64;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -169,4 +168,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueSInt64_h_
+#endif // liblldb_OptionValueSInt64_h_
diff --git a/include/lldb/Interpreter/OptionValueString.h b/include/lldb/Interpreter/OptionValueString.h
index c75745d402bef..bbdd0c8ba55c2 100644
--- a/include/lldb/Interpreter/OptionValueString.h
+++ b/include/lldb/Interpreter/OptionValueString.h
@@ -1,4 +1,4 @@
-//===-- OptionValueString.h --------------------------------------*- C++ -*-===//
+//===-- OptionValueString.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -24,7 +24,6 @@ namespace lldb_private {
class OptionValueString : public OptionValue
{
public:
-
typedef Error (*ValidatorCallback) (const char* string,
void* baton);
@@ -43,8 +42,8 @@ public:
{
}
- OptionValueString (ValidatorCallback validator,
- void* baton = NULL) :
+ OptionValueString(ValidatorCallback validator,
+ void* baton = nullptr) :
OptionValue(),
m_current_value (),
m_default_value (),
@@ -84,9 +83,9 @@ public:
m_default_value.assign (default_value);
}
- OptionValueString (const char *value,
- ValidatorCallback validator,
- void* baton = NULL) :
+ OptionValueString(const char *value,
+ ValidatorCallback validator,
+ void* baton = nullptr) :
OptionValue(),
m_current_value (),
m_default_value (),
@@ -101,10 +100,10 @@ public:
}
}
- OptionValueString (const char *current_value,
- const char *default_value,
- ValidatorCallback validator,
- void* baton = NULL) :
+ OptionValueString(const char *current_value,
+ const char *default_value,
+ ValidatorCallback validator,
+ void* baton = nullptr) :
OptionValue(),
m_current_value (),
m_default_value (),
@@ -118,38 +117,35 @@ public:
m_default_value.assign (default_value);
}
- virtual
- ~OptionValueString()
- {
- }
-
+ ~OptionValueString() override = default;
+
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeString;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -213,7 +209,6 @@ public:
return m_default_value.empty();
}
-
protected:
std::string m_current_value;
std::string m_default_value;
@@ -224,4 +219,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueString_h_
+#endif // liblldb_OptionValueString_h_
diff --git a/include/lldb/Interpreter/OptionValueUInt64.h b/include/lldb/Interpreter/OptionValueUInt64.h
index 51ff8818dcff4..874e8ca166658 100644
--- a/include/lldb/Interpreter/OptionValueUInt64.h
+++ b/include/lldb/Interpreter/OptionValueUInt64.h
@@ -43,8 +43,7 @@ public:
{
}
- virtual
- ~OptionValueUInt64()
+ ~OptionValueUInt64() override
{
}
@@ -60,29 +59,29 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeUInt64;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -131,4 +130,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueUInt64_h_
+#endif // liblldb_OptionValueUInt64_h_
diff --git a/include/lldb/Interpreter/OptionValueUUID.h b/include/lldb/Interpreter/OptionValueUUID.h
index c6ab48a627f6b..4aecc39bc8c4c 100644
--- a/include/lldb/Interpreter/OptionValueUUID.h
+++ b/include/lldb/Interpreter/OptionValueUUID.h
@@ -34,8 +34,7 @@ public:
{
}
- virtual
- ~OptionValueUUID()
+ ~OptionValueUUID() override
{
}
@@ -43,29 +42,29 @@ public:
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
- virtual OptionValue::Type
- GetType () const
+ OptionValue::Type
+ GetType() const override
{
return eTypeUUID;
}
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
+ void
+ DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
- virtual Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
- virtual bool
- Clear ()
+ bool
+ Clear() override
{
m_uuid.Clear();
m_value_was_set = false;
return true;
}
- virtual lldb::OptionValueSP
- DeepCopy () const;
+ lldb::OptionValueSP
+ DeepCopy() const override;
//---------------------------------------------------------------------
// Subclass specific functions
@@ -89,13 +88,13 @@ public:
m_uuid = value;
}
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
+ size_t
+ AutoComplete(CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches) override;
protected:
UUID m_uuid;
@@ -103,4 +102,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_OptionValueUUID_h_
+#endif // liblldb_OptionValueUUID_h_
diff --git a/include/lldb/Interpreter/Options.h b/include/lldb/Interpreter/Options.h
index 6ecf08d28e750..bac26308a8d19 100644
--- a/include/lldb/Interpreter/Options.h
+++ b/include/lldb/Interpreter/Options.h
@@ -11,7 +11,6 @@
#define liblldb_Options_h_
// C Includes
-
// C++ Includes
#include <set>
#include <vector>
@@ -32,7 +31,6 @@ namespace lldb_private {
return isprint(ch);
}
-
//----------------------------------------------------------------------
/// @class Options Options.h "lldb/Interpreter/Options.h"
/// @brief A command line option parsing protocol class.
@@ -72,7 +70,7 @@ namespace lldb_private {
/// case 'g': debug = true; break;
/// case 'v': verbose = true; break;
/// case 'l': log_file = option_arg; break;
-/// case 'f': log_flags = strtoull(option_arg, NULL, 0); break;
+/// case 'f': log_flags = strtoull(option_arg, nullptr, 0); break;
/// default:
/// error.SetErrorStringWithFormat("unrecognized short option %c", option_val);
/// break;
@@ -95,11 +93,11 @@ namespace lldb_private {
///
/// struct option CommandOptions::g_options[] =
/// {
-/// { "debug", no_argument, NULL, 'g' },
-/// { "log-file", required_argument, NULL, 'l' },
-/// { "log-flags", required_argument, NULL, 'f' },
-/// { "verbose", no_argument, NULL, 'v' },
-/// { NULL, 0, NULL, 0 }
+/// { "debug", no_argument, nullptr, 'g' },
+/// { "log-file", required_argument, nullptr, 'l' },
+/// { "log-flags", required_argument, nullptr, 'f' },
+/// { "verbose", no_argument, nullptr, 'v' },
+/// { nullptr, 0, nullptr, 0 }
/// };
///
/// int main (int argc, const char **argv, const char **envp)
@@ -119,7 +117,6 @@ namespace lldb_private {
class Options
{
public:
-
Options (CommandInterpreter &interpreter);
virtual
@@ -153,7 +150,6 @@ public:
// Verify that the options given are in the options table and can
// be used together, but there may be some required options that are
// missing (used to verify options that get folded into command aliases).
-
bool
VerifyPartialOptions (CommandReturnObject &result);
@@ -173,7 +169,10 @@ public:
// class that inherits from this class.
virtual const OptionDefinition*
- GetDefinitions () { return NULL; }
+ GetDefinitions()
+ {
+ return nullptr;
+ }
// Call this prior to parsing any options. This call will call the
// subclass OptionParsingStarting() and will avoid the need for all
@@ -195,7 +194,7 @@ public:
///
/// @param[in] option_arg
/// The argument value for the option that the user entered, or
- /// NULL if there is no argument for the current option.
+ /// nullptr if there is no argument for the current option.
///
///
/// @see Args::ParseOptions (Options&)
@@ -359,15 +358,11 @@ protected:
class OptionGroup
{
public:
- OptionGroup ()
- {
- }
-
+ OptionGroup() = default;
+
virtual
- ~OptionGroup ()
- {
- }
-
+ ~OptionGroup() = default;
+
virtual uint32_t
GetNumDefinitions () = 0;
@@ -395,7 +390,6 @@ protected:
class OptionGroupOptions : public Options
{
public:
-
OptionGroupOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_option_defs (),
@@ -404,12 +398,8 @@ protected:
{
}
- virtual
- ~OptionGroupOptions ()
- {
- }
-
-
+ ~OptionGroupOptions() override = default;
+
//----------------------------------------------------------------------
/// Append options from a OptionGroup class.
///
@@ -459,18 +449,18 @@ protected:
return m_did_finalize;
}
- virtual Error
- SetOptionValue (uint32_t option_idx,
- const char *option_arg);
+ Error
+ SetOptionValue(uint32_t option_idx,
+ const char *option_arg) override;
- virtual void
- OptionParsingStarting ();
+ void
+ OptionParsingStarting() override;
- virtual Error
- OptionParsingFinished ();
+ Error
+ OptionParsingFinished() override;
const OptionDefinition*
- GetDefinitions ()
+ GetDefinitions() override
{
assert (m_did_finalize);
return &m_option_defs[0];
@@ -495,8 +485,7 @@ protected:
OptionInfos m_option_infos;
bool m_did_finalize;
};
-
} // namespace lldb_private
-#endif // liblldb_Options_h_
+#endif // liblldb_Options_h_
diff --git a/include/lldb/Interpreter/PythonDataObjects.h b/include/lldb/Interpreter/PythonDataObjects.h
deleted file mode 100644
index df281b533cba8..0000000000000
--- a/include/lldb/Interpreter/PythonDataObjects.h
+++ /dev/null
@@ -1,280 +0,0 @@
-//===-- PythonDataObjects.h----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_PythonDataObjects_h_
-#define liblldb_PythonDataObjects_h_
-
-// C Includes
-// C++ Includes
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-defines.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/StructuredData.h"
-#include "lldb/Core/Flags.h"
-#include "lldb/Interpreter/OptionValue.h"
-#include "lldb/lldb-python.h"
-
-namespace lldb_private {
-class PythonString;
-class PythonList;
-class PythonDictionary;
-class PythonObject;
-class PythonInteger;
-
-class StructuredPythonObject : public StructuredData::Generic
-{
- public:
- StructuredPythonObject()
- : StructuredData::Generic()
- {
- }
-
- StructuredPythonObject(void *obj)
- : StructuredData::Generic(obj)
- {
- Py_XINCREF(GetValue());
- }
-
- virtual ~StructuredPythonObject()
- {
- if (Py_IsInitialized())
- Py_XDECREF(GetValue());
- SetValue(nullptr);
- }
-
- bool
- IsValid() const override
- {
- return GetValue() && GetValue() != Py_None;
- }
-
- void Dump(Stream &s) const override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject);
-};
-
-enum class PyObjectType
-{
- Unknown,
- None,
- Integer,
- Dictionary,
- List,
- String
-};
-
- class PythonObject
- {
- public:
- PythonObject () :
- m_py_obj(NULL)
- {
- }
-
- explicit PythonObject (PyObject* py_obj) :
- m_py_obj(NULL)
- {
- Reset (py_obj);
- }
-
- PythonObject (const PythonObject &rhs) :
- m_py_obj(NULL)
- {
- Reset (rhs.m_py_obj);
- }
-
- virtual
- ~PythonObject ()
- {
- Reset (NULL);
- }
-
- bool
- Reset (const PythonObject &object)
- {
- return Reset(object.get());
- }
-
- virtual bool
- Reset (PyObject* py_obj = NULL)
- {
- if (py_obj != m_py_obj)
- {
- if (Py_IsInitialized())
- Py_XDECREF(m_py_obj);
- m_py_obj = py_obj;
- if (Py_IsInitialized())
- Py_XINCREF(m_py_obj);
- }
- return true;
- }
-
- void
- Dump () const
- {
- if (m_py_obj)
- _PyObject_Dump (m_py_obj);
- else
- puts ("NULL");
- }
-
- void
- Dump (Stream &strm) const;
-
- PyObject*
- get () const
- {
- return m_py_obj;
- }
-
- PyObjectType GetObjectType() const;
-
- PythonString
- Repr ();
-
- PythonString
- Str ();
-
- explicit operator bool () const
- {
- return m_py_obj != NULL;
- }
-
- bool
- IsNULLOrNone () const;
-
- StructuredData::ObjectSP CreateStructuredObject() const;
-
- protected:
- PyObject* m_py_obj;
- };
-
- class PythonString: public PythonObject
- {
- public:
- PythonString ();
- PythonString (PyObject *o);
- PythonString (const PythonObject &object);
- PythonString (llvm::StringRef string);
- PythonString (const char *string);
- virtual ~PythonString ();
-
- virtual bool
- Reset (PyObject* py_obj = NULL);
-
- llvm::StringRef
- GetString() const;
-
- size_t
- GetSize() const;
-
- void SetString(llvm::StringRef string);
-
- StructuredData::StringSP CreateStructuredString() const;
- };
-
- class PythonInteger: public PythonObject
- {
- public:
-
- PythonInteger ();
- PythonInteger (PyObject* py_obj);
- PythonInteger (const PythonObject &object);
- PythonInteger (int64_t value);
- virtual ~PythonInteger ();
-
- virtual bool
- Reset (PyObject* py_obj = NULL);
-
- int64_t GetInteger() const;
-
- void
- SetInteger (int64_t value);
-
- StructuredData::IntegerSP CreateStructuredInteger() const;
- };
-
- class PythonList: public PythonObject
- {
- public:
-
- PythonList (bool create_empty);
- PythonList (PyObject* py_obj);
- PythonList (const PythonObject &object);
- PythonList (uint32_t count);
- virtual ~PythonList ();
-
- virtual bool
- Reset (PyObject* py_obj = NULL);
-
- uint32_t GetSize() const;
-
- PythonObject GetItemAtIndex(uint32_t index) const;
-
- void
- SetItemAtIndex (uint32_t index, const PythonObject &object);
-
- void
- AppendItem (const PythonObject &object);
-
- StructuredData::ArraySP CreateStructuredArray() const;
- };
-
- class PythonDictionary: public PythonObject
- {
- public:
-
- explicit PythonDictionary (bool create_empty);
- PythonDictionary (PyObject* object);
- PythonDictionary (const PythonObject &object);
- virtual ~PythonDictionary ();
-
- virtual bool
- Reset (PyObject* object = NULL);
-
- uint32_t GetSize() const;
-
- PythonObject
- GetItemForKey (const PythonString &key) const;
-
- const char *
- GetItemForKeyAsString (const PythonString &key, const char *fail_value = NULL) const;
-
- int64_t
- GetItemForKeyAsInteger (const PythonString &key, int64_t fail_value = 0) const;
-
- PythonObject
- GetItemForKey (const char *key) const;
-
- typedef bool (*DictionaryIteratorCallback)(PythonString* key, PythonDictionary* dict);
-
- PythonList
- GetKeys () const;
-
- PythonString
- GetKeyAtPosition (uint32_t pos) const;
-
- PythonObject
- GetValueAtPosition (uint32_t pos) const;
-
- void
- SetItemForKey (const PythonString &key, PyObject *value);
-
- void
- SetItemForKey (const PythonString &key, const PythonObject& value);
-
- StructuredData::DictionarySP CreateStructuredDictionary() const;
- };
-
-} // namespace lldb_private
-
-#endif // liblldb_PythonDataObjects_h_
diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h
index 0f45dd8245e9f..eafc03a00cca4 100644
--- a/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/include/lldb/Interpreter/ScriptInterpreter.h
@@ -10,37 +10,36 @@
#ifndef liblldb_ScriptInterpreter_h_
#define liblldb_ScriptInterpreter_h_
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Error.h"
+#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Utility/PseudoTerminal.h"
-
namespace lldb_private {
class ScriptInterpreterLocker
{
public:
- ScriptInterpreterLocker ()
- {
- }
+ ScriptInterpreterLocker() = default;
- virtual ~ScriptInterpreterLocker ()
- {
- }
+ virtual ~ScriptInterpreterLocker() = default;
+
private:
DISALLOW_COPY_AND_ASSIGN (ScriptInterpreterLocker);
};
-
-class ScriptInterpreter
+class ScriptInterpreter : public PluginInterface
{
public:
-
typedef enum
{
eScriptReturnTypeCharPtr,
@@ -62,7 +61,7 @@ public:
ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang);
- virtual ~ScriptInterpreter ();
+ ~ScriptInterpreter() override;
struct ExecuteScriptOptions
{
@@ -174,13 +173,13 @@ public:
}
virtual bool
- GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL)
+ GenerateTypeScriptFunction(const char* oneliner, std::string& output, const void* name_token = nullptr)
{
return false;
}
virtual bool
- GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL)
+ GenerateTypeScriptFunction(StringList &input, std::string& output, const void* name_token = nullptr)
{
return false;
}
@@ -192,13 +191,13 @@ public:
}
virtual bool
- GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL)
+ GenerateTypeSynthClass(StringList &input, std::string& output, const void* name_token = nullptr)
{
return false;
}
virtual bool
- GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL)
+ GenerateTypeSynthClass(const char* oneliner, std::string& output, const void* name_token = nullptr)
{
return false;
}
@@ -324,7 +323,6 @@ public:
SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
const char *function_name)
{
- return;
}
/// Set a one-liner as the callback for the watchpoint.
@@ -332,7 +330,6 @@ public:
SetWatchpointCommandCallback (WatchpointOptions *wp_options,
const char *oneliner)
{
- return;
}
virtual bool
@@ -349,7 +346,7 @@ public:
}
virtual size_t
- CalculateNumChildren(const StructuredData::ObjectSP &implementor)
+ CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max)
{
return 0;
}
@@ -459,7 +456,7 @@ public:
virtual bool
GetDocumentationForItem (const char* item, std::string& dest)
{
- dest.clear();
+ dest.clear();
return false;
}
@@ -514,8 +511,8 @@ public:
int
GetMasterFileDescriptor ();
- CommandInterpreter &
- GetCommandInterpreter ();
+ CommandInterpreter &
+ GetCommandInterpreter();
static std::string
LanguageToString (lldb::ScriptLanguage language);
@@ -530,4 +527,4 @@ protected:
} // namespace lldb_private
-#endif // #ifndef liblldb_ScriptInterpreter_h_
+#endif // liblldb_ScriptInterpreter_h_
diff --git a/include/lldb/Interpreter/ScriptInterpreterNone.h b/include/lldb/Interpreter/ScriptInterpreterNone.h
deleted file mode 100644
index 6c82b60b0bcda..0000000000000
--- a/include/lldb/Interpreter/ScriptInterpreterNone.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===-- ScriptInterpreterNone.h ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ScriptInterpreterNone_h_
-#define liblldb_ScriptInterpreterNone_h_
-
-#include "lldb/Interpreter/ScriptInterpreter.h"
-
-namespace lldb_private {
-
-class ScriptInterpreterNone : public ScriptInterpreter
-{
-public:
-
- ScriptInterpreterNone (CommandInterpreter &interpreter);
-
- ~ScriptInterpreterNone ();
-
- bool
- ExecuteOneLine (const char *command, CommandReturnObject *result, const ExecuteScriptOptions &options = ExecuteScriptOptions());
-
- void
- ExecuteInterpreterLoop ();
-
-};
-
-} // namespace lldb_private
-
-#endif // #ifndef liblldb_ScriptInterpreterNone_h_
diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h
deleted file mode 100644
index 058058ecccb52..0000000000000
--- a/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ /dev/null
@@ -1,563 +0,0 @@
-//===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-#ifndef liblldb_ScriptInterpreterPython_h_
-#define liblldb_ScriptInterpreterPython_h_
-
-#ifdef LLDB_DISABLE_PYTHON
-
-// Python is disabled in this build
-
-#else
-
-#include "lldb/lldb-python.h"
-#include "lldb/lldb-private.h"
-#include "lldb/Core/IOHandler.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
-#include "lldb/Host/Terminal.h"
-
-class IOHandlerPythonInterpreter;
-
-namespace lldb_private {
-
-class ScriptInterpreterPython :
- public ScriptInterpreter,
- public IOHandlerDelegateMultiline
-{
-public:
- typedef void (*SWIGInitCallback) (void);
-
- typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::BreakpointLocationSP &bp_loc_sp);
-
- typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::WatchpointSP &wp_sp);
-
- typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name,
- void *session_dictionary,
- const lldb::ValueObjectSP& valobj_sp,
- void** pyfunct_wrapper,
- const lldb::TypeSummaryOptionsSP& options,
- std::string& retval);
-
- typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ValueObjectSP& valobj_sp);
-
- typedef void* (*SWIGPythonCreateCommandObject) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::DebuggerSP debugger_sp);
-
- typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ThreadPlanSP& thread_plan_sp);
-
- typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error);
-
- typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ProcessSP& process_sp);
-
- typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor);
- typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx);
- typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name);
- typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data);
- typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data);
- typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data);
- typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
- typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor);
-
- typedef bool (*SWIGPythonCallCommand) (const char *python_function_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger,
- const char* args,
- lldb_private::CommandReturnObject& cmd_retobj,
- lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
- typedef bool (*SWIGPythonCallCommandObject) (void *implementor,
- lldb::DebuggerSP& debugger,
- const char* args,
- lldb_private::CommandReturnObject& cmd_retobj,
- lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
-
- typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger);
-
- typedef bool (*SWIGPythonScriptKeyword_Process) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ProcessSP& process,
- std::string& output);
- typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ThreadSP& thread,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Target) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::TargetSP& target,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Frame) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::StackFrameSP& frame,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Value) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ValueObjectSP& value,
- std::string& output);
-
- typedef void* (*SWIGPython_GetDynamicSetting) (void* module,
- const char* setting,
- const lldb::TargetSP& target_sp);
-
- friend class ::IOHandlerPythonInterpreter;
-
- ScriptInterpreterPython (CommandInterpreter &interpreter);
-
- ~ScriptInterpreterPython ();
-
- bool
- Interrupt() override;
-
- bool
- ExecuteOneLine (const char *command,
- CommandReturnObject *result,
- const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
-
- void
- ExecuteInterpreterLoop () override;
-
- bool
- ExecuteOneLineWithReturn (const char *in_string,
- ScriptInterpreter::ScriptReturnType return_type,
- void *ret_value,
- const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
-
- lldb_private::Error
- ExecuteMultipleLines (const char *in_string,
- const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
-
- Error
- ExportFunctionDefinitionToInterpreter (StringList &function_def) override;
-
- bool
- GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override;
-
- bool
- GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override;
-
- bool
- GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override;
-
- // use this if the function code is just a one-liner script
- bool
- GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override;
-
- bool
- GenerateScriptAliasFunction (StringList &input, std::string& output) override;
-
- StructuredData::ObjectSP CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj) override;
-
- StructuredData::GenericSP CreateScriptCommandObject (const char *class_name) override;
-
- StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan) override;
-
- bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
- bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
- lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) override;
-
- StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) override;
-
- StructuredData::DictionarySP OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp) override;
-
- StructuredData::ArraySP OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp) override;
-
- StructuredData::StringSP OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id) override;
-
- StructuredData::DictionarySP OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid,
- lldb::addr_t context) override;
-
- StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) override;
-
- StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name,
- lldb_private::Error &error) override;
-
- size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor) override;
-
- lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) override;
-
- int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name) override;
-
- bool UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor) override;
-
- bool MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor) override;
-
- lldb::ValueObjectSP GetSyntheticValue(const StructuredData::ObjectSP &implementor) override;
-
- bool
- RunScriptBasedCommand(const char* impl_function,
- const char* args,
- ScriptedCommandSynchronicity synchronicity,
- lldb_private::CommandReturnObject& cmd_retobj,
- Error& error,
- const lldb_private::ExecutionContext& exe_ctx) override;
-
- bool
- RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp,
- const char* args,
- ScriptedCommandSynchronicity synchronicity,
- lldb_private::CommandReturnObject& cmd_retobj,
- Error& error,
- const lldb_private::ExecutionContext& exe_ctx) override;
-
- Error
- GenerateFunction(const char *signature, const StringList &input) override;
-
- Error
- GenerateBreakpointCommandCallbackData (StringList &input, std::string& output) override;
-
- bool
- GenerateWatchpointCommandCallbackData (StringList &input, std::string& output) override;
-
-// static size_t
-// GenerateBreakpointOptionsCommandCallback (void *baton,
-// InputReader &reader,
-// lldb::InputReaderAction notification,
-// const char *bytes,
-// size_t bytes_len);
-//
-// static size_t
-// GenerateWatchpointOptionsCommandCallback (void *baton,
-// InputReader &reader,
-// lldb::InputReaderAction notification,
-// const char *bytes,
-// size_t bytes_len);
-
- static bool
- BreakpointCallbackFunction (void *baton,
- StoppointCallbackContext *context,
- lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id);
-
- static bool
- WatchpointCallbackFunction (void *baton,
- StoppointCallbackContext *context,
- lldb::user_id_t watch_id);
-
- bool GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp,
- const TypeSummaryOptions &options, std::string &retval) override;
-
- void
- Clear () override;
-
- bool
- GetDocumentationForItem (const char* item, std::string& dest) override;
-
- bool
- GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override;
-
- uint32_t
- GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp) override;
-
- bool
- GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override;
-
- bool
- CheckObjectExists (const char* name) override
- {
- if (!name || !name[0])
- return false;
- std::string temp;
- return GetDocumentationForItem (name,temp);
- }
-
- bool
- RunScriptFormatKeyword (const char* impl_function,
- Process* process,
- std::string& output,
- Error& error) override;
-
- bool
- RunScriptFormatKeyword (const char* impl_function,
- Thread* thread,
- std::string& output,
- Error& error) override;
-
- bool
- RunScriptFormatKeyword (const char* impl_function,
- Target* target,
- std::string& output,
- Error& error) override;
-
- bool
- RunScriptFormatKeyword (const char* impl_function,
- StackFrame* frame,
- std::string& output,
- Error& error) override;
-
- bool
- RunScriptFormatKeyword (const char* impl_function,
- ValueObject* value,
- std::string& output,
- Error& error) override;
-
- bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error,
- StructuredData::ObjectSP *module_sp = nullptr) override;
-
- bool
- IsReservedWord (const char* word) override;
-
- std::unique_ptr<ScriptInterpreterLocker>
- AcquireInterpreterLock () override;
-
- void
- CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
- CommandReturnObject &result) override;
-
- void
- CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
- CommandReturnObject &result) override;
-
- /// Set the callback body text into the callback for the breakpoint.
- Error
- SetBreakpointCommandCallback (BreakpointOptions *bp_options,
- const char *callback_body) override;
-
- void
- SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
- const char *function_name) override;
-
- /// Set a one-liner as the callback for the watchpoint.
- void
- SetWatchpointCommandCallback (WatchpointOptions *wp_options,
- const char *oneliner) override;
-
- StringList
- ReadCommandInputFromUser (FILE *in_file);
-
- void ResetOutputFileHandle(FILE *new_fh) override;
-
- static void
- InitializePrivate ();
-
- static void
- InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
- SWIGBreakpointCallbackFunction swig_breakpoint_callback,
- SWIGWatchpointCallbackFunction swig_watchpoint_callback,
- SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
- SWIGPythonCreateSyntheticProvider swig_synthetic_script,
- SWIGPythonCreateCommandObject swig_create_cmd,
- SWIGPythonCalculateNumChildren swig_calc_children,
- SWIGPythonGetChildAtIndex swig_get_child_index,
- SWIGPythonGetIndexOfChildWithName swig_get_index_child,
- SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
- SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
- SWIGPythonUpdateSynthProviderInstance swig_update_provider,
- SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
- SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
- SWIGPythonCallCommand swig_call_command,
- SWIGPythonCallCommandObject swig_call_command_object,
- SWIGPythonCallModuleInit swig_call_module_init,
- SWIGPythonCreateOSPlugin swig_create_os_plugin,
- SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
- SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
- SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
- SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
- SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
- SWIGPython_GetDynamicSetting swig_plugin_get,
- SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
- SWIGPythonCallThreadPlan swig_call_thread_plan);
-
- const char *
- GetDictionaryName ()
- {
- return m_dictionary_name.c_str();
- }
-
-
- PyThreadState *
- GetThreadState()
- {
- return m_command_thread_state;
- }
-
- void
- SetThreadState (PyThreadState *s)
- {
- if (s)
- m_command_thread_state = s;
- }
-
- //----------------------------------------------------------------------
- // IOHandlerDelegate
- //----------------------------------------------------------------------
- void
- IOHandlerActivated (IOHandler &io_handler) override;
-
- void
- IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override;
-
-protected:
-
- bool
- EnterSession (uint16_t on_entry_flags,
- FILE *in,
- FILE *out,
- FILE *err);
-
- void
- LeaveSession ();
-
- void
- SaveTerminalState (int fd);
-
- void
- RestoreTerminalState ();
-
- class SynchronicityHandler
- {
- private:
- lldb::DebuggerSP m_debugger_sp;
- ScriptedCommandSynchronicity m_synch_wanted;
- bool m_old_asynch;
- public:
- SynchronicityHandler(lldb::DebuggerSP,
- ScriptedCommandSynchronicity);
- ~SynchronicityHandler();
- };
-
-public:
- class Locker : public ScriptInterpreterLocker
- {
- public:
-
- enum OnEntry
- {
- AcquireLock = 0x0001,
- InitSession = 0x0002,
- InitGlobals = 0x0004,
- NoSTDIN = 0x0008
- };
-
- enum OnLeave
- {
- FreeLock = 0x0001,
- FreeAcquiredLock = 0x0002, // do not free the lock if we already held it when calling constructor
- TearDownSession = 0x0004
- };
-
- Locker (ScriptInterpreterPython *py_interpreter = NULL,
- uint16_t on_entry = AcquireLock | InitSession,
- uint16_t on_leave = FreeLock | TearDownSession,
- FILE *in = NULL,
- FILE *out = NULL,
- FILE *err = NULL);
-
- ~Locker ();
-
- private:
-
- bool
- DoAcquireLock ();
-
- bool
- DoInitSession (uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err);
-
- bool
- DoFreeLock ();
-
- bool
- DoTearDownSession ();
-
- static void
- ReleasePythonLock ();
-
- bool m_teardown_session;
- ScriptInterpreterPython *m_python_interpreter;
-// FILE* m_tmp_fh;
- PyGILState_STATE m_GILState;
- };
-protected:
- enum class AddLocation
- {
- Beginning,
- End
- };
-
- static void AddToSysPath(AddLocation location, std::string path);
-
- uint32_t
- IsExecutingPython () const
- {
- return m_lock_count > 0;
- }
-
- uint32_t
- IncrementLockCount()
- {
- return ++m_lock_count;
- }
-
- uint32_t
- DecrementLockCount()
- {
- if (m_lock_count > 0)
- --m_lock_count;
- return m_lock_count;
- }
-
- enum ActiveIOHandler {
- eIOHandlerNone,
- eIOHandlerBreakpoint,
- eIOHandlerWatchpoint
- };
- PythonObject &
- GetMainModule ();
-
- PythonDictionary &
- GetSessionDictionary ();
-
- PythonDictionary &
- GetSysModuleDictionary ();
-
- bool
- GetEmbeddedInterpreterModuleObjects ();
-
- PythonObject m_saved_stdin;
- PythonObject m_saved_stdout;
- PythonObject m_saved_stderr;
- PythonObject m_main_module;
- PythonObject m_lldb_module;
- PythonDictionary m_session_dict;
- PythonDictionary m_sys_module_dict;
- PythonObject m_run_one_line_function;
- PythonObject m_run_one_line_str_global;
- std::string m_dictionary_name;
- TerminalState m_terminal_state;
- ActiveIOHandler m_active_io_handler;
- bool m_session_is_active;
- bool m_pty_slave_is_open;
- bool m_valid_session;
- uint32_t m_lock_count;
- PyThreadState *m_command_thread_state;
-};
-} // namespace lldb_private
-
-#endif // #ifdef LLDB_DISABLE_PYTHON
-
-#endif // #ifndef liblldb_ScriptInterpreterPython_h_
diff --git a/include/lldb/Symbol/ArmUnwindInfo.h b/include/lldb/Symbol/ArmUnwindInfo.h
new file mode 100644
index 0000000000000..b19af23744a4b
--- /dev/null
+++ b/include/lldb/Symbol/ArmUnwindInfo.h
@@ -0,0 +1,77 @@
+//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ArmUnwindInfo_h_
+#define liblldb_ArmUnwindInfo_h_
+
+#include <vector>
+
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/RangeMap.h"
+#include "lldb/Host/Mutex.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/lldb-private.h"
+
+/*
+ * Unwind information reader and parser for the ARM exception handling ABI
+ *
+ * Implemented based on:
+ * Exception Handling ABI for the ARM Architecture
+ * Document number: ARM IHI 0038A (current through ABI r2.09)
+ * Date of Issue: 25th January 2007, reissued 30th November 2012
+ * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
+ */
+
+namespace lldb_private {
+
+class ArmUnwindInfo
+{
+public:
+ ArmUnwindInfo(const ObjectFile& objfile,
+ lldb::SectionSP& arm_exidx,
+ lldb::SectionSP& arm_extab);
+
+ ~ArmUnwindInfo();
+
+ bool
+ GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan);
+
+private:
+ struct ArmExidxEntry
+ {
+ ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
+
+ bool
+ operator<(const ArmExidxEntry& other) const;
+
+ uint32_t file_address;
+ lldb::addr_t address;
+ uint32_t data;
+ };
+
+ const uint8_t*
+ GetExceptionHandlingTableEntry(const Address& addr);
+
+ uint8_t
+ GetByteAtOffset(const uint32_t* data, uint16_t offset) const;
+
+ uint64_t
+ GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const;
+
+ const lldb::ByteOrder m_byte_order;
+ lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
+ lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
+ DataExtractor m_arm_exidx_data; // .ARM.exidx section data
+ DataExtractor m_arm_extab_data; // .ARM.extab section data
+ std::vector<ArmExidxEntry> m_exidx_entries;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ArmUnwindInfo_h_
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h
index 59671b00b3b83..6c0793dda80fa 100644
--- a/include/lldb/Symbol/Block.h
+++ b/include/lldb/Symbol/Block.h
@@ -10,6 +10,12 @@
#ifndef liblldb_Block_h_
#define liblldb_Block_h_
+// C Includes
+// C++ Includes
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/RangeMap.h"
@@ -17,7 +23,7 @@
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
namespace lldb_private {
@@ -76,7 +82,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
- virtual ~Block ();
+ ~Block() override;
//------------------------------------------------------------------
/// Add a child to this object.
@@ -110,20 +116,20 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- CalculateSymbolContext(SymbolContext* sc);
+ void
+ CalculateSymbolContext(SymbolContext* sc) override;
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ();
+ lldb::ModuleSP
+ CalculateSymbolContextModule() override;
- virtual CompileUnit *
- CalculateSymbolContextCompileUnit ();
+ CompileUnit *
+ CalculateSymbolContextCompileUnit() override;
- virtual Function *
- CalculateSymbolContextFunction ();
+ Function *
+ CalculateSymbolContextFunction() override;
- virtual Block *
- CalculateSymbolContextBlock ();
+ Block *
+ CalculateSymbolContextBlock() override;
//------------------------------------------------------------------
/// Check if an offset is in one of the block offset ranges.
@@ -192,8 +198,8 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- DumpSymbolContext(Stream *s);
+ void
+ DumpSymbolContext(Stream *s) override;
void
DumpAddressRanges (Stream *s,
@@ -209,20 +215,19 @@ public:
/// Get the parent block.
///
/// @return
- /// The parent block pointer, or NULL if this block has no
+ /// The parent block pointer, or nullptr if this block has no
/// parent.
//------------------------------------------------------------------
Block *
GetParent () const;
-
//------------------------------------------------------------------
/// Get the inlined block that contains this block.
///
/// @return
/// If this block contains inlined function info, it will return
/// this block, else parent blocks will be searched to see if
- /// any contain this block. NULL will be returned if this block
+ /// any contain this block. nullptr will be returned if this block
/// nor any parent blocks are inlined function blocks.
//------------------------------------------------------------------
Block *
@@ -232,7 +237,7 @@ public:
/// Get the inlined parent block for this block.
///
/// @return
- /// The parent block pointer, or NULL if this block has no
+ /// The parent block pointer, or nullptr if this block has no
/// parent.
//------------------------------------------------------------------
Block *
@@ -242,7 +247,7 @@ public:
/// Get the sibling block for this block.
///
/// @return
- /// The sibling block pointer, or NULL if this block has no
+ /// The sibling block pointer, or nullptr if this block has no
/// sibling.
//------------------------------------------------------------------
Block *
@@ -252,15 +257,13 @@ public:
/// Get the first child block.
///
/// @return
- /// The first child block pointer, or NULL if this block has no
+ /// The first child block pointer, or nullptr if this block has no
/// children.
//------------------------------------------------------------------
Block *
GetFirstChild () const
{
- if (m_children.empty())
- return NULL;
- return m_children.front().get();
+ return (m_children.empty() ? nullptr : m_children.front().get());
}
//------------------------------------------------------------------
@@ -278,7 +281,6 @@ public:
lldb::VariableListSP
GetBlockVariableList (bool can_create);
-
//------------------------------------------------------------------
/// Get the variable list for this block and optionally all child
/// blocks if \a get_child_variables is \b true.
@@ -330,7 +332,7 @@ public:
/// added to the variable list until there are no parent blocks
/// or the parent block has inlined function info.
///
- /// @param[in/out] variable_list
+ /// @param[in,out] variable_list
/// All variables in this block, and optionally all parent
/// blocks will be added to this list.
///
@@ -348,7 +350,7 @@ public:
/// Get const accessor for any inlined function information.
///
/// @return
- /// A const pointer to any inlined function information, or NULL
+ /// A const pointer to any inlined function information, or nullptr
/// if this is a regular block.
//------------------------------------------------------------------
const InlineFunctionInfo*
@@ -357,8 +359,8 @@ public:
return m_inlineInfoSP.get();
}
- clang::DeclContext *
- GetClangDeclContext();
+ CompilerDeclContext
+ GetDeclContext();
//------------------------------------------------------------------
/// Get the memory cost of this object.
@@ -377,16 +379,16 @@ public:
///
/// @param[in] name
/// The method name for the inlined function. This value should
- /// not be NULL.
+ /// not be nullptr.
///
/// @param[in] mangled
/// The mangled method name for the inlined function. This can
- /// be NULL if there is no mangled name for an inlined function
+ /// be nullptr if there is no mangled name for an inlined function
/// or if the name is the same as \a name.
///
/// @param[in] decl_ptr
/// A optional pointer to declaration information for the
- /// inlined function information. This value can be NULL to
+ /// inlined function information. This value can be nullptr to
/// indicate that no declaration information is available.
///
/// @param[in] call_decl_ptr
@@ -399,7 +401,6 @@ public:
const Declaration *decl_ptr,
const Declaration *call_decl_ptr);
-
void
SetParentScope (SymbolContextScope *parent_scope)
{
@@ -422,8 +423,6 @@ public:
m_variable_list_sp = variable_list_sp;
}
-
-
bool
BlockInfoHasBeenParsed() const
{
@@ -491,7 +490,6 @@ private:
DISALLOW_COPY_AND_ASSIGN (Block);
};
-
} // namespace lldb_private
-#endif // liblldb_Block_h_
+#endif // liblldb_Block_h_
diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h
index a411e42fe0c5a..0314ce060e38e 100644
--- a/include/lldb/Symbol/ClangASTContext.h
+++ b/include/lldb/Symbol/ClangASTContext.h
@@ -14,7 +14,11 @@
#include <stdint.h>
// C++ Includes
+#include <functional>
#include <initializer_list>
+#include <map>
+#include <memory>
+#include <set>
#include <string>
#include <vector>
#include <utility>
@@ -24,36 +28,71 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/TemplateBase.h"
-
// Project includes
+#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/TypeSystem.h"
namespace lldb_private {
class Declaration;
-class ClangASTContext
+class ClangASTContext : public TypeSystem
{
public:
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
-
+
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const TypeSystem *ts)
+ {
+ return ts->getKind() == TypeSystem::eKindClang;
+ }
+
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- ClangASTContext (const char *triple = NULL);
+ ClangASTContext(const char *triple = nullptr);
+
+ ~ClangASTContext() override;
+
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString
+ GetPluginName() override;
+
+ uint32_t
+ GetPluginVersion() override;
+
+ static ConstString
+ GetPluginNameStatic ();
- ~ClangASTContext();
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, Module *module, Target *target);
+ static void
+ EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
static ClangASTContext*
GetASTContext (clang::ASTContext* ast_ctx);
clang::ASTContext *
getASTContext();
-
+
+ void setASTContext(clang::ASTContext* ast_ctx);
+
clang::Builtin::Context *
getBuiltinContext();
@@ -78,6 +117,9 @@ public:
clang::DiagnosticConsumer *
getDiagnosticConsumer();
+ clang::MangleContext *
+ getMangleContext();
+
std::shared_ptr<clang::TargetOptions> &getTargetOptions();
clang::TargetInfo *
@@ -109,7 +151,16 @@ public:
{
return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
}
-
+
+ static void
+ DumpDeclHiearchy (clang::Decl *decl);
+
+ static void
+ DumpDeclContextHiearchy (clang::DeclContext *decl_ctx);
+
+ static bool
+ DeclsAreEquivalent (clang::Decl *lhs_decl, clang::Decl *rhs_decl);
+
static bool
GetCompleteDecl (clang::ASTContext *ast,
clang::Decl *decl);
@@ -141,47 +192,53 @@ public:
//------------------------------------------------------------------
// Basic Types
//------------------------------------------------------------------
- ClangASTType
+ CompilerType
GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
- uint32_t bit_size);
+ size_t bit_size) override;
- static ClangASTType
+ static CompilerType
GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast,
lldb::Encoding encoding,
uint32_t bit_size);
- ClangASTType
+ CompilerType
GetBasicType (lldb::BasicType type);
- static ClangASTType
+ static CompilerType
GetBasicType (clang::ASTContext *ast, lldb::BasicType type);
- static ClangASTType
+ static CompilerType
GetBasicType (clang::ASTContext *ast, const ConstString &name);
static lldb::BasicType
GetBasicTypeEnumeration (const ConstString &name);
- ClangASTType
+ CompilerType
GetBuiltinTypeForDWARFEncodingAndBitSize (
const char *type_name,
uint32_t dw_ate,
uint32_t bit_size);
- ClangASTType
+ CompilerType
GetCStringType(bool is_const);
- static ClangASTType
+ static CompilerType
GetUnknownAnyType(clang::ASTContext *ast);
- ClangASTType
+ CompilerType
GetUnknownAnyType()
{
return ClangASTContext::GetUnknownAnyType(getASTContext());
}
+ static clang::DeclContext *
+ GetDeclContextForType (clang::QualType type);
+
+ static clang::DeclContext *
+ GetDeclContextForType (const CompilerType& type);
+
uint32_t
- GetPointerByteSize ();
+ GetPointerByteSize () override;
static clang::DeclContext *
GetTranslationUnitDecl (clang::ASTContext *ast);
@@ -192,40 +249,30 @@ public:
return GetTranslationUnitDecl (getASTContext());
}
- static bool
- GetClassMethodInfoForDeclContext (clang::DeclContext *decl_ctx,
- lldb::LanguageType &language,
- bool &is_instance_method,
- ConstString &language_object_name);
-
- static ClangASTType
- CopyType(clang::ASTContext *dest_context,
- ClangASTType source_type);
-
static clang::Decl *
CopyDecl (clang::ASTContext *dest_context,
clang::ASTContext *source_context,
clang::Decl *source_decl);
static bool
- AreTypesSame(ClangASTType type1,
- ClangASTType type2,
+ AreTypesSame(CompilerType type1,
+ CompilerType type2,
bool ignore_qualifiers = false);
- static ClangASTType
+ static CompilerType
GetTypeForDecl (clang::NamedDecl *decl);
- static ClangASTType
+ static CompilerType
GetTypeForDecl (clang::TagDecl *decl);
- static ClangASTType
+ static CompilerType
GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl);
template <typename RecordDeclType>
- ClangASTType
+ CompilerType
GetTypeForIdentifier (const ConstString &type_name)
{
- ClangASTType clang_type;
+ CompilerType compiler_type;
if (type_name.GetLength())
{
@@ -241,17 +288,17 @@ public:
{
clang::NamedDecl *named_decl = result[0];
if (const RecordDeclType *record_decl = llvm::dyn_cast<RecordDeclType>(named_decl))
- clang_type.SetClangType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
+ compiler_type.SetCompilerType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
}
}
}
- return clang_type;
+ return compiler_type;
}
- ClangASTType
+ CompilerType
GetOrCreateStructForIdentifier (const ConstString &type_name,
- const std::initializer_list< std::pair < const char *, ClangASTType > >& type_fields,
+ const std::initializer_list< std::pair < const char *, CompilerType > >& type_fields,
bool packed = false);
//------------------------------------------------------------------
@@ -268,18 +315,13 @@ public:
GetNumBaseClasses (const clang::CXXRecordDecl *cxx_record_decl,
bool omit_empty_base_classes);
- static uint32_t
- GetIndexForRecordBase (const clang::RecordDecl *record_decl,
- const clang::CXXBaseSpecifier *base_spec,
- bool omit_empty_base_classes);
-
- ClangASTType
- CreateRecordType (clang::DeclContext *decl_ctx,
- lldb::AccessType access_type,
- const char *name,
- int kind,
- lldb::LanguageType language,
- ClangASTMetadata *metadata = NULL);
+ CompilerType
+ CreateRecordType(clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
+ const char *name,
+ int kind,
+ lldb::LanguageType language,
+ ClangASTMetadata *metadata = nullptr);
class TemplateParameterInfos
{
@@ -328,7 +370,7 @@ public:
int kind,
const TemplateParameterInfos &infos);
- ClangASTType
+ CompilerType
CreateClassTemplateSpecializationType (clang::ClassTemplateSpecializationDecl *class_template_specialization_decl);
static clang::DeclContext *
@@ -354,17 +396,24 @@ public:
static bool
RecordHasFields (const clang::RecordDecl *record_decl);
-
- ClangASTType
- CreateObjCClass (const char *name,
- clang::DeclContext *decl_ctx,
- bool isForwardDecl,
- bool isInternal,
- ClangASTMetadata *metadata = NULL);
+ CompilerType
+ CreateObjCClass(const char *name,
+ clang::DeclContext *decl_ctx,
+ bool isForwardDecl,
+ bool isInternal,
+ ClangASTMetadata *metadata = nullptr);
+
+ bool
+ SetTagTypeKind (clang::QualType type, int kind) const;
+
+ bool
+ SetDefaultAccessForRecordFields (clang::RecordDecl* record_decl,
+ int default_accessibility,
+ int *assigned_accessibilities,
+ size_t num_assigned_accessibilities);
// Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
-
//------------------------------------------------------------------
// Namespace Declarations
//------------------------------------------------------------------
@@ -380,21 +429,21 @@ public:
clang::FunctionDecl *
CreateFunctionDeclaration (clang::DeclContext *decl_ctx,
const char *name,
- const ClangASTType &function_Type,
+ const CompilerType &function_Type,
int storage,
bool is_inline);
- static ClangASTType
+ static CompilerType
CreateFunctionType (clang::ASTContext *ast,
- const ClangASTType &result_type,
- const ClangASTType *args,
+ const CompilerType &result_type,
+ const CompilerType *args,
unsigned num_args,
bool is_variadic,
unsigned type_quals);
- ClangASTType
- CreateFunctionType (const ClangASTType &result_type,
- const ClangASTType *args,
+ CompilerType
+ CreateFunctionType (const CompilerType &result_type,
+ const CompilerType *args,
unsigned num_args,
bool is_variadic,
unsigned type_quals)
@@ -409,7 +458,7 @@ public:
clang::ParmVarDecl *
CreateParameterDeclaration (const char *name,
- const ClangASTType &param_type,
+ const CompilerType &param_type,
int storage);
void
@@ -421,57 +470,732 @@ public:
// Array Types
//------------------------------------------------------------------
- ClangASTType
- CreateArrayType (const ClangASTType &element_type,
+ CompilerType
+ CreateArrayType (const CompilerType &element_type,
size_t element_count,
bool is_vector);
//------------------------------------------------------------------
// Enumeration Types
//------------------------------------------------------------------
- ClangASTType
+ CompilerType
CreateEnumerationType (const char *name,
clang::DeclContext *decl_ctx,
const Declaration &decl,
- const ClangASTType &integer_qual_type);
+ const CompilerType &integer_qual_type);
//------------------------------------------------------------------
// Integer type functions
//------------------------------------------------------------------
-
- ClangASTType
- GetIntTypeFromBitSize (size_t bit_size, bool is_signed)
- {
- return GetIntTypeFromBitSize (getASTContext(), bit_size, is_signed);
- }
-
- static ClangASTType
+
+ static CompilerType
GetIntTypeFromBitSize (clang::ASTContext *ast,
size_t bit_size, bool is_signed);
- ClangASTType
+ CompilerType
GetPointerSizedIntType (bool is_signed)
{
return GetPointerSizedIntType (getASTContext(), is_signed);
}
- static ClangASTType
+ static CompilerType
GetPointerSizedIntType (clang::ASTContext *ast, bool is_signed);
//------------------------------------------------------------------
// Floating point functions
//------------------------------------------------------------------
+
+ static CompilerType
+ GetFloatTypeFromBitSize (clang::ASTContext *ast,
+ size_t bit_size);
+
+ //------------------------------------------------------------------
+ // TypeSystem methods
+ //------------------------------------------------------------------
+ DWARFASTParser *
+ GetDWARFParser () override;
+
+ //------------------------------------------------------------------
+ // ClangASTContext callbacks for external source lookups.
+ //------------------------------------------------------------------
+ static void
+ CompleteTagDecl (void *baton, clang::TagDecl *);
+
+ static void
+ CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
+
+ static bool
+ LayoutRecordType(void *baton,
+ const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
+
+ //----------------------------------------------------------------------
+ // CompilerDecl override functions
+ //----------------------------------------------------------------------
+ lldb::VariableSP
+ DeclGetVariable (void *opaque_decl) override;
+
+ void
+ DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) override;
- ClangASTType
- GetFloatTypeFromBitSize (size_t bit_size)
+ ConstString
+ DeclGetName (void *opaque_decl) override;
+
+ ConstString
+ DeclGetMangledName (void *opaque_decl) override;
+
+ CompilerDeclContext
+ DeclGetDeclContext (void *opaque_decl) override;
+
+ CompilerType
+ DeclGetFunctionReturnType(void *opaque_decl) override;
+
+ size_t
+ DeclGetFunctionNumArguments(void *opaque_decl) override;
+
+ CompilerType
+ DeclGetFunctionArgumentType (void *opaque_decl, size_t arg_idx) override;
+
+ //----------------------------------------------------------------------
+ // CompilerDeclContext override functions
+ //----------------------------------------------------------------------
+
+ std::vector<CompilerDecl>
+ DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override;
+
+ bool
+ DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;
+
+ ConstString
+ DeclContextGetName (void *opaque_decl_ctx) override;
+
+ bool
+ DeclContextIsClassMethod (void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override;
+
+ //----------------------------------------------------------------------
+ // Clang specific CompilerType predicates
+ //----------------------------------------------------------------------
+
+ static bool
+ IsClangType (const CompilerType &ct)
{
- return GetFloatTypeFromBitSize (getASTContext(), bit_size);
+ return llvm::dyn_cast_or_null<ClangASTContext>(ct.GetTypeSystem()) != nullptr && ct.GetOpaqueQualType() != nullptr;
}
- static ClangASTType
- GetFloatTypeFromBitSize (clang::ASTContext *ast,
- size_t bit_size);
+ //----------------------------------------------------------------------
+ // Clang specific clang::DeclContext functions
+ //----------------------------------------------------------------------
+
+ static clang::DeclContext *
+ DeclContextGetAsDeclContext (const CompilerDeclContext &dc);
+
+ static clang::ObjCMethodDecl *
+ DeclContextGetAsObjCMethodDecl (const CompilerDeclContext &dc);
+
+ static clang::CXXMethodDecl *
+ DeclContextGetAsCXXMethodDecl (const CompilerDeclContext &dc);
+
+ static clang::FunctionDecl *
+ DeclContextGetAsFunctionDecl (const CompilerDeclContext &dc);
+
+ static clang::NamespaceDecl *
+ DeclContextGetAsNamespaceDecl (const CompilerDeclContext &dc);
+
+ static ClangASTMetadata *
+ DeclContextGetMetaData (const CompilerDeclContext &dc, const void *object);
+
+ static clang::ASTContext *
+ DeclContextGetClangASTContext (const CompilerDeclContext &dc);
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ bool
+ IsArrayType (lldb::opaque_compiler_type_t type,
+ CompilerType *element_type,
+ uint64_t *size,
+ bool *is_incomplete) override;
+
+ bool
+ IsVectorType (lldb::opaque_compiler_type_t type,
+ CompilerType *element_type,
+ uint64_t *size) override;
+
+ bool
+ IsAggregateType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsAnonymousType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsBeingDefined (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsCharType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsCompleteType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsConst(lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsCStringType (lldb::opaque_compiler_type_t type, uint32_t &length) override;
+
+ static bool
+ IsCXXClassType (const CompilerType& type);
+
+ bool
+ IsDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsFloatingPointType (lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
+
+ bool
+ IsFunctionType (lldb::opaque_compiler_type_t type, bool *is_variadic_ptr) override;
+
+ uint32_t
+ IsHomogeneousAggregate (lldb::opaque_compiler_type_t type, CompilerType* base_type_ptr) override;
+
+ size_t
+ GetNumberOfFunctionArguments (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFunctionArgumentAtIndex (lldb::opaque_compiler_type_t type, const size_t index) override;
+
+ bool
+ IsFunctionPointerType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsIntegerType (lldb::opaque_compiler_type_t type, bool &is_signed) override;
+
+ static bool
+ IsObjCClassType (const CompilerType& type);
+
+ static bool
+ IsObjCClassTypeAndHasIVars (const CompilerType& type, bool check_superclass);
+
+ static bool
+ IsObjCObjectOrInterfaceType (const CompilerType& type);
+
+ static bool
+ IsObjCObjectPointerType(const CompilerType& type, CompilerType *target_type = nullptr);
+
+ bool
+ IsPolymorphicClass (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus,
+ bool check_objc) override;
+
+ bool
+ IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsPointerType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override;
+
+ bool
+ IsPointerOrReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override;
+
+ bool
+ IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool* is_rvalue) override;
+
+ bool
+ IsScalarType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsTypedefType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ IsVoidType (lldb::opaque_compiler_type_t type) override;
+
+ bool
+ SupportsLanguage (lldb::LanguageType language) override;
+
+ static bool
+ GetCXXClassName (const CompilerType& type, std::string &class_name);
+
+ static bool
+ GetObjCClassName (const CompilerType& type, std::string &class_name);
+
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
+
+ bool
+ GetCompleteType (lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ ConstString
+ GetTypeName (lldb::opaque_compiler_type_t type) override;
+
+ uint32_t
+ GetTypeInfo (lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override;
+
+ lldb::LanguageType
+ GetMinimumLanguage (lldb::opaque_compiler_type_t type) override;
+
+ lldb::TypeClass
+ GetTypeClass (lldb::opaque_compiler_type_t type) override;
+
+ unsigned
+ GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
+
+ // Using the current type, create a new typedef to that type using "typedef_name"
+ // as the name and "decl_ctx" as the decl context.
+ static CompilerType
+ CreateTypedefType (const CompilerType& type,
+ const char *typedef_name,
+ const CompilerDeclContext &compiler_decl_ctx);
+
+ CompilerType
+ GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_t *stride) override;
+
+ CompilerType
+ GetCanonicalType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFullyUnqualifiedType (lldb::opaque_compiler_type_t type) override;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a prototype
+ // Returns a value >= 0 if there is a prototype.
+ int
+ GetFunctionArgumentCount (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFunctionArgumentTypeAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override;
+
+ CompilerType
+ GetFunctionReturnType (lldb::opaque_compiler_type_t type) override;
+
+ size_t
+ GetNumMemberFunctions (lldb::opaque_compiler_type_t type) override;
+
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override;
+
+ CompilerType
+ GetNonReferenceType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetPointeeType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetPointerType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetLValueReferenceType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetRValueReferenceType (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ AddConstModifier (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ AddVolatileModifier (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ AddRestrictModifier (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ CreateTypedef (lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx) override;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType
+ GetTypedefedType (lldb::opaque_compiler_type_t type) override;
+
+ static CompilerType
+ RemoveFastQualifiers (const CompilerType& type);
+
+ //----------------------------------------------------------------------
+ // Create related types using the current type's AST
+ //----------------------------------------------------------------------
+ CompilerType
+ GetBasicTypeFromAST (lldb::BasicType basic_type) override;
+
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
+
+ uint64_t
+ GetByteSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
+ {
+ return (GetBitSize (type, exe_scope) + 7) / 8;
+ }
+
+ uint64_t
+ GetBitSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
+
+ lldb::Encoding
+ GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count) override;
+
+ lldb::Format
+ GetFormat (lldb::opaque_compiler_type_t type) override;
+
+ size_t
+ GetTypeBitAlign (lldb::opaque_compiler_type_t type) override;
+
+ uint32_t
+ GetNumChildren (lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
+
+ CompilerType
+ GetBuiltinTypeByName (const ConstString &name) override;
+
+ lldb::BasicType
+ GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type) override;
+
+ static lldb::BasicType
+ GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type, const ConstString &name);
+
+ void
+ ForEachEnumerator (lldb::opaque_compiler_type_t type, std::function <bool (const CompilerType &integer_type, const ConstString &name, const llvm::APSInt &value)> const &callback) override;
+
+ uint32_t
+ GetNumFields (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFieldAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ std::string& name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
+
+ uint32_t
+ GetNumDirectBaseClasses (lldb::opaque_compiler_type_t type) override;
+
+ uint32_t
+ GetNumVirtualBaseClasses (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetDirectBaseClassAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ CompilerType
+ GetVirtualBaseClassAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ static uint32_t
+ GetNumPointeeChildren (clang::QualType type);
+
+ CompilerType
+ GetChildCompilerTypeAtIndex (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ size_t idx,
+ bool transparent_pointers,
+ bool omit_empty_base_classes,
+ bool ignore_array_bounds,
+ std::string& child_name,
+ uint32_t &child_byte_size,
+ int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class,
+ bool &child_is_deref_of_parent,
+ ValueObject *valobj,
+ uint64_t &language_flags) override;
+
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ uint32_t
+ GetIndexOfChildWithName (lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) override;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName (lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes,
+ std::vector<uint32_t>& child_indexes) override;
+
+ size_t
+ GetNumTemplateArguments (lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetTemplateArgument (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) override;
+
+ CompilerType
+ GetTypeForFormatters (void* type) override;
+
+#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
+ // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if
+ // child_decl_ctx could not be found in decl_ctx.
+ uint32_t
+ CountDeclLevels (clang::DeclContext *frame_decl_ctx,
+ clang::DeclContext *child_decl_ctx,
+ ConstString *child_name = nullptr,
+ CompilerType *child_type = nullptr);
+
+ //----------------------------------------------------------------------
+ // Modifying RecordType
+ //----------------------------------------------------------------------
+ static clang::FieldDecl *
+ AddFieldToRecordType (const CompilerType& type,
+ const char *name,
+ const CompilerType &field_type,
+ lldb::AccessType access,
+ uint32_t bitfield_bit_size);
+
+ static void
+ BuildIndirectFields (const CompilerType& type);
+
+ static void
+ SetIsPacked (const CompilerType& type);
+
+ static clang::VarDecl *
+ AddVariableToRecordType (const CompilerType& type,
+ const char *name,
+ const CompilerType &var_type,
+ lldb::AccessType access);
+
+ clang::CXXMethodDecl *
+ AddMethodToCXXRecordType (lldb::opaque_compiler_type_t type,
+ const char *name,
+ const CompilerType &method_type,
+ lldb::AccessType access,
+ bool is_virtual,
+ bool is_static,
+ bool is_inline,
+ bool is_explicit,
+ bool is_attr_used,
+ bool is_artificial);
+
+ // C++ Base Classes
+ clang::CXXBaseSpecifier *
+ CreateBaseClassSpecifier (lldb::opaque_compiler_type_t type,
+ lldb::AccessType access,
+ bool is_virtual,
+ bool base_of_class);
+
+ static void
+ DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
+ unsigned num_base_classes);
+
+ bool
+ SetBaseClassesForClassType (lldb::opaque_compiler_type_t type,
+ clang::CXXBaseSpecifier const * const *base_classes,
+ unsigned num_base_classes);
+
+ static bool
+ SetObjCSuperClass (const CompilerType& type,
+ const CompilerType &superclass_compiler_type);
+
+ static bool
+ AddObjCClassProperty (const CompilerType& type,
+ const char *property_name,
+ const CompilerType &property_compiler_type,
+ clang::ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes,
+ ClangASTMetadata *metadata);
+
+ static clang::ObjCMethodDecl *
+ AddMethodToObjCObjectType (const CompilerType& type,
+ const char *name, // the full symbol name as seen in the symbol table (lldb::opaque_compiler_type_t type, "-[NString stringWithCString:]")
+ const CompilerType &method_compiler_type,
+ lldb::AccessType access,
+ bool is_artificial);
+
+ static bool
+ SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern);
+
+
+ static bool
+ CanImport (const CompilerType &type, lldb_private::ClangASTImporter &importer);
+
+ static bool
+ Import (const CompilerType &type, lldb_private::ClangASTImporter &importer);
+
+ static bool
+ GetHasExternalStorage (const CompilerType &type);
+ //------------------------------------------------------------------
+ // Tag Declarations
+ //------------------------------------------------------------------
+ static bool
+ StartTagDeclarationDefinition (const CompilerType &type);
+
+ static bool
+ CompleteTagDeclarationDefinition (const CompilerType &type);
+
+ //----------------------------------------------------------------------
+ // Modifying Enumeration types
+ //----------------------------------------------------------------------
+ bool
+ AddEnumerationValueToEnumerationType (lldb::opaque_compiler_type_t type,
+ const CompilerType &enumerator_qual_type,
+ const Declaration &decl,
+ const char *name,
+ int64_t enum_value,
+ uint32_t enum_value_bit_size);
+
+ CompilerType
+ GetEnumerationIntegerType (lldb::opaque_compiler_type_t type);
+
+ //------------------------------------------------------------------
+ // Pointers & References
+ //------------------------------------------------------------------
+
+ // Call this function using the class type when you want to make a
+ // member pointer type to pointee_type.
+ static CompilerType
+ CreateMemberPointerType (const CompilerType& type, const CompilerType &pointee_type);
+
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ size_t
+ ConvertStringToFloatValue (lldb::opaque_compiler_type_t type,
+ const char *s,
+ uint8_t *dst,
+ size_t dst_size) override;
+
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+ void
+ DumpValue (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ Stream *s,
+ lldb::Format format,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset,
+ bool show_types,
+ bool show_summary,
+ bool verbose,
+ uint32_t depth) override;
+
+ bool
+ DumpTypeValue (lldb::opaque_compiler_type_t type,
+ Stream *s,
+ lldb::Format format,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
+
+ void
+ DumpSummary (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ Stream *s,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size) override;
+
+ void
+ DumpTypeDescription (lldb::opaque_compiler_type_t type) override; // Dump to stdout
+
+ void
+ DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream *s) override;
+
+ static void
+ DumpTypeName (const CompilerType &type);
+
+ static clang::EnumDecl *
+ GetAsEnumDecl (const CompilerType& type);
+
+ static clang::RecordDecl *
+ GetAsRecordDecl (const CompilerType& type);
+
+ static clang::TagDecl *
+ GetAsTagDecl (const CompilerType& type);
+
+ clang::CXXRecordDecl *
+ GetAsCXXRecordDecl (lldb::opaque_compiler_type_t type);
+
+ static clang::ObjCInterfaceDecl *
+ GetAsObjCInterfaceDecl (const CompilerType& type);
+
+ static clang::QualType
+ GetQualType (const CompilerType& type)
+ {
+ // Make sure we have a clang type before making a clang::QualType
+ if (type.GetOpaqueQualType())
+ {
+ ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(type.GetTypeSystem());
+ if (ast)
+ return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
+ }
+ return clang::QualType();
+ }
+
+ static clang::QualType
+ GetCanonicalQualType (const CompilerType& type)
+ {
+ // Make sure we have a clang type before making a clang::QualType
+ ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(type.GetTypeSystem());
+ if (ast)
+ return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType()).getCanonicalType();
+ return clang::QualType();
+ }
+
+ clang::ClassTemplateDecl *
+ ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
+ const char *parent_name,
+ int tag_decl_kind,
+ const ClangASTContext::TemplateParameterInfos &template_param_infos);
+
+ clang::BlockDecl *
+ CreateBlockDeclaration (clang::DeclContext *ctx);
+
+ clang::UsingDirectiveDecl *
+ CreateUsingDirectiveDeclaration (clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl);
+
+ clang::UsingDecl *
+ CreateUsingDeclaration (clang::DeclContext *current_decl_ctx, clang::NamedDecl *target);
+
+ clang::VarDecl *
+ CreateVariableDeclaration (clang::DeclContext *decl_context, const char *name, clang::QualType type);
+
protected:
+ static clang::QualType
+ GetQualType (lldb::opaque_compiler_type_t type)
+ {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type);
+ return clang::QualType();
+ }
+
+ static clang::QualType
+ GetCanonicalQualType (lldb::opaque_compiler_type_t type)
+ {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
+ return clang::QualType();
+ }
+
//------------------------------------------------------------------
// Classes that inherit from ClangASTContext can see and modify these
//------------------------------------------------------------------
@@ -488,10 +1212,17 @@ protected:
std::unique_ptr<clang::IdentifierTable> m_identifier_table_ap;
std::unique_ptr<clang::SelectorTable> m_selector_table_ap;
std::unique_ptr<clang::Builtin::Context> m_builtins_ap;
+ std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
+ std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
+ std::unique_ptr<clang::MangleContext> m_mangle_ctx_ap;
CompleteTagDeclCallback m_callback_tag_decl;
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
void * m_callback_baton;
uint32_t m_pointer_byte_size;
+ bool m_ast_owned;
+ bool m_can_evaluate_expressions;
+ std::map<void *, std::shared_ptr<void>> m_decl_objects;
+
private:
//------------------------------------------------------------------
// For ClangASTContext only
@@ -500,6 +1231,36 @@ private:
const ClangASTContext& operator=(const ClangASTContext&);
};
+class ClangASTContextForExpressions : public ClangASTContext
+{
+public:
+ ClangASTContextForExpressions (Target &target);
+
+ ~ClangASTContextForExpressions() override = default;
+
+ UserExpression *
+ GetUserExpression (const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options) override;
+
+ FunctionCaller *
+ GetFunctionCaller (const CompilerType &return_type,
+ const Address& function_address,
+ const ValueList &arg_value_list,
+ const char *name) override;
+
+ UtilityFunction *
+ GetUtilityFunction(const char *text, const char *name) override;
+
+ PersistentExpressionState *
+ GetPersistentExpressionState() override;
+private:
+ lldb::TargetWP m_target_wp;
+ lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
+};
+
} // namespace lldb_private
-#endif // liblldb_ClangASTContext_h_
+#endif // liblldb_ClangASTContext_h_
diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h
index ee4fcada8a6d3..8c3f8735c2e16 100644
--- a/include/lldb/Symbol/ClangASTImporter.h
+++ b/include/lldb/Symbol/ClangASTImporter.h
@@ -10,14 +10,21 @@
#ifndef liblldb_ClangASTImporter_h_
#define liblldb_ClangASTImporter_h_
+// C Includes
+// C++ Includes
#include <map>
+#include <memory>
#include <set>
+#include <vector>
-#include "lldb/lldb-types.h"
+// Other libraries and framework includes
#include "clang/AST/ASTImporter.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"
-#include "lldb/Symbol/ClangNamespaceDecl.h"
+
+// Project includes
+#include "lldb/lldb-types.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
namespace lldb_private {
@@ -96,20 +103,24 @@ public:
clang::ASTContext *src_ctx,
clang::QualType type);
- lldb::clang_type_t
+ lldb::opaque_compiler_type_t
CopyType (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
- lldb::clang_type_t type);
-
+ lldb::opaque_compiler_type_t type);
+
+ CompilerType
+ CopyType (ClangASTContext &dst,
+ const CompilerType &src_type);
+
clang::Decl *
CopyDecl (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
clang::Decl *decl);
- lldb::clang_type_t
+ lldb::opaque_compiler_type_t
DeportType (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
- lldb::clang_type_t type);
+ lldb::opaque_compiler_type_t type);
clang::Decl *
DeportDecl (clang::ASTContext *dst_ctx,
@@ -127,7 +138,10 @@ public:
bool
CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
-
+
+ bool
+ CompleteAndFetchChildren (clang::QualType type);
+
bool
RequireCompleteType (clang::QualType type);
@@ -155,7 +169,7 @@ public:
// Namespace maps
//
- typedef std::vector < std::pair<lldb::ModuleSP, ClangNamespaceDecl> > NamespaceMap;
+ typedef std::vector < std::pair<lldb::ModuleSP, CompilerDeclContext> > NamespaceMap;
typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
void RegisterNamespaceMap (const clang::NamespaceDecl *decl,
@@ -199,12 +213,13 @@ public:
void ForgetDestination (clang::ASTContext *dst_ctx);
void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
+
private:
struct DeclOrigin
{
DeclOrigin () :
- ctx(NULL),
- decl(NULL)
+ ctx(nullptr),
+ decl(nullptr)
{
}
@@ -230,7 +245,7 @@ private:
bool
Valid ()
{
- return (ctx != NULL || decl != NULL);
+ return (ctx != nullptr || decl != nullptr);
}
clang::ASTContext *ctx;
@@ -250,8 +265,8 @@ private:
*source_ctx,
master.m_file_manager,
true /*minimal*/),
- m_decls_to_deport(NULL),
- m_decls_already_deported(NULL),
+ m_decls_to_deport(nullptr),
+ m_decls_already_deported(nullptr),
m_master(master),
m_source_ctx(source_ctx)
{
@@ -276,9 +291,9 @@ private:
void ImportDefinitionTo (clang::Decl *to, clang::Decl *from);
- clang::Decl *Imported (clang::Decl *from, clang::Decl *to);
+ clang::Decl *Imported(clang::Decl *from, clang::Decl *to) override;
- clang::Decl *GetOriginalDecl (clang::Decl *To);
+ clang::Decl *GetOriginalDecl(clang::Decl *To) override;
std::set<clang::NamedDecl *> *m_decls_to_deport;
std::set<clang::NamedDecl *> *m_decls_already_deported;
@@ -297,7 +312,7 @@ private:
m_minions (),
m_origins (),
m_namespace_maps (),
- m_map_completer (NULL)
+ m_map_completer (nullptr)
{
}
@@ -368,6 +383,6 @@ private:
clang::FileManager m_file_manager;
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_ClangASTImporter_h_
diff --git a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
index 41bb235636f09..5a00aa0072ab3 100644
--- a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -11,18 +11,17 @@
#define liblldb_ClangExternalASTSourceCallbacks_h_
// C Includes
-// C++ Includes
-#include <string>
-#include <vector>
#include <stdint.h>
+// C++ Includes
// Other libraries and framework includes
+#include "llvm/ADT/DenseMap.h"
#include "clang/AST/CharUnits.h"
// Project includes
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
namespace lldb_private {
@@ -30,7 +29,6 @@ namespace lldb_private {
class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon
{
public:
-
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results);
@@ -62,7 +60,7 @@ public:
{
// This method only needs to be implemented if the AST source ever
// passes back decl sets as VisibleDeclaration objects.
- return 0;
+ return nullptr;
}
clang::Stmt *
@@ -71,7 +69,7 @@ public:
// This operation is meant to be used via a LazyOffsetPtr. It only
// needs to be implemented if the AST source uses methods like
// FunctionDecl::setLazyBody when building decls.
- return 0;
+ return nullptr;
}
clang::Selector
@@ -91,23 +89,18 @@ public:
clang::CXXBaseSpecifier *
GetExternalCXXBaseSpecifiers(uint64_t Offset) override
{
- return NULL;
+ return nullptr;
}
virtual void
MaterializeVisibleDecls (const clang::DeclContext *decl_ctx)
{
- return;
}
- clang::ExternalLoadResult
- FindExternalLexicalDecls(const clang::DeclContext *decl_ctx, bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &decls) override
- {
- // This is used to support iterating through an entire lexical context,
- // which isn't something the debugger should ever need to do.
- return clang::ELR_Failure;
- }
+ void
+ FindExternalLexicalDecls(const clang::DeclContext *DC,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &Result) override;
bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
@@ -119,6 +112,7 @@ public:
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
+
void
SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback,
@@ -138,10 +132,10 @@ public:
{
if (callback_baton == m_callback_baton)
{
- m_callback_tag_decl = NULL;
- m_callback_objc_decl = NULL;
- m_callback_find_by_name = NULL;
- m_callback_layout_record_type = NULL;
+ m_callback_tag_decl = nullptr;
+ m_callback_objc_decl = nullptr;
+ m_callback_find_by_name = nullptr;
+ m_callback_layout_record_type = nullptr;
}
}
@@ -158,4 +152,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_ClangExternalASTSourceCallbacks_h_
+#endif // liblldb_ClangExternalASTSourceCallbacks_h_
diff --git a/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/include/lldb/Symbol/ClangExternalASTSourceCommon.h
index 17650f7f14fdd..711be42c15fbc 100644
--- a/include/lldb/Symbol/ClangExternalASTSourceCommon.h
+++ b/include/lldb/Symbol/ClangExternalASTSourceCommon.h
@@ -20,6 +20,7 @@
// file. So we have to define NDEBUG when including clang headers to avoid any
// mismatches. This is covered by rdar://problem/8691220
+// C Includes
#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
#define LLDB_DEFINED_NDEBUG_FOR_CLANG
#define NDEBUG
@@ -27,8 +28,6 @@
#include <assert.h>
#endif
-#include "clang/AST/ExternalASTSource.h"
-
#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
#undef NDEBUG
#undef LLDB_DEFINED_NDEBUG_FOR_CLANG
@@ -36,6 +35,11 @@
#include <assert.h>
#endif
+// C++ Includes
+// Other libraries and framework includes
+#include "clang/AST/ExternalASTSource.h"
+
+// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/dwarf.h"
@@ -124,8 +128,8 @@ public:
return lldb::eLanguageTypeC_plus_plus;
}
return lldb::eLanguageTypeUnknown;
-
}
+
const char *
GetObjectPtrName() const
{
@@ -137,7 +141,7 @@ public:
return "this";
}
else
- return NULL;
+ return nullptr;
}
bool
@@ -155,19 +159,19 @@ private:
lldb::user_id_t m_user_id;
uint64_t m_isa_ptr;
};
+
bool m_union_is_user_id : 1,
m_union_is_isa_ptr : 1,
m_has_object_ptr : 1,
m_is_self : 1,
m_is_dynamic_cxx : 1;
-
};
class ClangExternalASTSourceCommon : public clang::ExternalASTSource
{
public:
ClangExternalASTSourceCommon();
- ~ClangExternalASTSourceCommon();
+ ~ClangExternalASTSourceCommon() override;
ClangASTMetadata *GetMetadata(const void *object);
void SetMetadata(const void *object, ClangASTMetadata &metadata);
@@ -175,12 +179,13 @@ public:
static ClangExternalASTSourceCommon *
Lookup(clang::ExternalASTSource *source);
+
private:
typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;
MetadataMap m_metadata;
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_ClangExternalASTSourceCommon_h
diff --git a/include/lldb/Symbol/ClangNamespaceDecl.h b/include/lldb/Symbol/ClangNamespaceDecl.h
deleted file mode 100644
index 13a4c0011aff0..0000000000000
--- a/include/lldb/Symbol/ClangNamespaceDecl.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//===-- ClangNamespaceDecl.h ------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangNamespaceDecl_h_
-#define liblldb_ClangNamespaceDecl_h_
-
-#include <string>
-
-#include "lldb/lldb-public.h"
-#include "lldb/Core/ClangForward.h"
-
-namespace lldb_private {
-
-class ClangNamespaceDecl
-{
-public:
- ClangNamespaceDecl () :
- m_ast (NULL),
- m_namespace_decl (NULL)
- {
- }
-
- ClangNamespaceDecl (clang::ASTContext *ast, clang::NamespaceDecl *namespace_decl) :
- m_ast (ast),
- m_namespace_decl (namespace_decl)
- {
- }
-
- ClangNamespaceDecl (const ClangNamespaceDecl &rhs) :
- m_ast (rhs.m_ast),
- m_namespace_decl (rhs.m_namespace_decl)
- {
- }
-
- const ClangNamespaceDecl &
- operator = (const ClangNamespaceDecl &rhs)
- {
- m_ast = rhs.m_ast;
- m_namespace_decl = rhs.m_namespace_decl;
- return *this;
- }
-
- //------------------------------------------------------------------
- /// Convert to bool operator.
- ///
- /// This allows code to check a ClangNamespaceDecl object to see if
- /// it contains a valid namespace decl using code such as:
- ///
- /// @code
- /// ClangNamespaceDecl ns_decl(...);
- /// if (ns_decl)
- /// { ...
- /// @endcode
- ///
- /// @return
- /// /b True this object contains a valid namespace decl, \b
- /// false otherwise.
- //------------------------------------------------------------------
- explicit operator bool() const
- {
- return m_ast != NULL && m_namespace_decl != NULL;
- }
-
- clang::ASTContext *
- GetASTContext() const
- {
- return m_ast;
- }
-
- void
- SetASTContext (clang::ASTContext *ast)
- {
- m_ast = ast;
- }
-
- clang::NamespaceDecl *
- GetNamespaceDecl () const
- {
- return m_namespace_decl;
- }
-
- void
- SetNamespaceDecl (clang::NamespaceDecl *namespace_decl)
- {
- m_namespace_decl = namespace_decl;
- }
-
- std::string
- GetQualifiedName () const;
-
-protected:
- clang::ASTContext *m_ast;
- clang::NamespaceDecl *m_namespace_decl;
-};
-
-
-} // namespace lldb_private
-
-#endif // #ifndef liblldb_ClangNamespaceDecl_h_
diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h
index e0c069352bf41..0c331c38f8c60 100644
--- a/include/lldb/Symbol/CompileUnit.h
+++ b/include/lldb/Symbol/CompileUnit.h
@@ -11,6 +11,7 @@
#define liblldb_CompUnit_h_
#include "lldb/lldb-enumerations.h"
+#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
@@ -66,9 +67,12 @@ public:
/// A language enumeration type that describes the main language
/// of this compile unit.
///
+ /// @param[in] is_optimized
+ /// true if this compile unit was compiled with optimization.
+ ///
/// @see lldb::LanguageType
//------------------------------------------------------------------
- CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const char *pathname, lldb::user_id_t uid, lldb::LanguageType language);
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const char *pathname, lldb::user_id_t uid, lldb::LanguageType language, bool is_optimized);
//------------------------------------------------------------------
/// Construct with a module, file spec, UID and language.
@@ -98,15 +102,17 @@ public:
/// A language enumeration type that describes the main language
/// of this compile unit.
///
+ /// @param[in] is_optimized
+ /// true if this compile unit was compiled with optimization.
+ ///
/// @see lldb::LanguageType
//------------------------------------------------------------------
- CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language);
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language, bool is_optimized);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual
- ~CompileUnit();
+ ~CompileUnit() override;
//------------------------------------------------------------------
/// Add a function to this compile unit.
@@ -125,22 +131,22 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- CalculateSymbolContext(SymbolContext* sc);
+ void
+ CalculateSymbolContext(SymbolContext* sc) override;
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ();
+ lldb::ModuleSP
+ CalculateSymbolContextModule() override;
- virtual CompileUnit *
- CalculateSymbolContextCompileUnit ();
+ CompileUnit *
+ CalculateSymbolContextCompileUnit() override;
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- DumpSymbolContext(Stream *s);
+ void
+ DumpSymbolContext(Stream *s) override;
lldb::LanguageType
GetLanguage();
@@ -245,6 +251,9 @@ public:
LineTable*
GetLineTable ();
+ DebugMacros*
+ GetDebugMacros ();
+
//------------------------------------------------------------------
/// Get the compile unit's support file list.
///
@@ -339,6 +348,9 @@ public:
void
SetLineTable(LineTable* line_table);
+ void
+ SetDebugMacros(const DebugMacrosSP &debug_macros);
+
//------------------------------------------------------------------
/// Set accessor for the variable list.
///
@@ -406,6 +418,22 @@ public:
SymbolContextList &sc_list);
+ //------------------------------------------------------------------
+ /// Get whether compiler optimizations were enabled for this compile unit
+ ///
+ /// "optimized" means that the debug experience may be difficult
+ /// for the user to understand. Variables may not be available when
+ /// the developer would expect them, stepping through the source lines
+ /// in the function may appear strange, etc.
+ ///
+ /// @return
+ /// Returns 'true' if this compile unit was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this compile unit was built without optimization.
+ //------------------------------------------------------------------
+ bool
+ GetIsOptimized ();
+
protected:
void *m_user_data; ///< User data for the SymbolFile parser to store information into.
lldb::LanguageType m_language; ///< The programming language enumeration value.
@@ -416,7 +444,9 @@ protected:
///< compile unit.
FileSpecList m_support_files; ///< Files associated with this compile unit's line table and declarations.
std::unique_ptr<LineTable> m_line_table_ap; ///< Line table that will get parsed on demand.
+ DebugMacrosSP m_debug_macros_sp; ///< Debug macros that will get parsed on demand.
lldb::VariableListSP m_variables; ///< Global and static variable list that will get parsed on demand.
+ bool m_is_optimized; /// eLazyBoolYes if this compile unit was compiled with optimization.
private:
enum
@@ -425,8 +455,9 @@ private:
flagsParsedVariables = (1u << 1), ///< Have we already parsed globals and statics?
flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support files for this compile unit?
flagsParsedLineTable = (1u << 3), ///< Have we parsed the line table already?
- flagsParsedLanguage = (1u << 4), ///< Have we parsed the line table already?
- flagsParsedImportedModules = (1u << 5) ///< Have we parsed the imported modules already?
+ flagsParsedLanguage = (1u << 4), ///< Have we parsed the language already?
+ flagsParsedImportedModules = (1u << 5), ///< Have we parsed the imported modules already?
+ flagsParsedDebugMacros = (1u << 6) ///< Have we parsed the debug macros already?
};
DISALLOW_COPY_AND_ASSIGN (CompileUnit);
@@ -434,4 +465,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_CompUnit_h_
+#endif // liblldb_CompUnit_h_
diff --git a/include/lldb/Symbol/CompilerDecl.h b/include/lldb/Symbol/CompilerDecl.h
new file mode 100644
index 0000000000000..b749e79b459af
--- /dev/null
+++ b/include/lldb/Symbol/CompilerDecl.h
@@ -0,0 +1,135 @@
+//===-- CompilerDecl.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompilerDecl_h_
+#define liblldb_CompilerDecl_h_
+
+#include "lldb/lldb-private.h"
+#include "lldb/Core/ConstString.h"
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private {
+
+class CompilerDecl
+{
+public:
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ CompilerDecl () :
+ m_type_system (nullptr),
+ m_opaque_decl (nullptr)
+ {
+ }
+
+ CompilerDecl (TypeSystem *type_system, void *decl) :
+ m_type_system (type_system),
+ m_opaque_decl (decl)
+ {
+ }
+
+ ~CompilerDecl ()
+ {
+ }
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ explicit operator bool () const
+ {
+ return IsValid ();
+ }
+
+ bool
+ operator < (const CompilerDecl &rhs) const
+ {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl < rhs.m_opaque_decl;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool
+ IsValid () const
+ {
+ return m_type_system != nullptr && m_opaque_decl != nullptr;
+ }
+
+ bool
+ IsClang () const;
+
+ //----------------------------------------------------------------------
+ // Object linked to the decl
+ //----------------------------------------------------------------------
+ lldb::VariableSP
+ GetAsVariable ();
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ TypeSystem *
+ GetTypeSystem() const
+ {
+ return m_type_system;
+ }
+
+ void *
+ GetOpaqueDecl() const
+ {
+ return m_opaque_decl;
+ }
+
+ void
+ SetDecl (TypeSystem* type_system, void* decl)
+ {
+ m_type_system = type_system;
+ m_opaque_decl = decl;
+ }
+
+ void
+ Clear()
+ {
+ m_type_system = nullptr;
+ m_opaque_decl = nullptr;
+ }
+
+ ConstString
+ GetName () const;
+
+ ConstString
+ GetMangledName () const;
+
+ CompilerDeclContext
+ GetDeclContext() const;
+
+ // If this decl represents a function, return the return type
+ CompilerType
+ GetFunctionReturnType() const;
+
+ // If this decl represents a function, return the number of arguments for the function
+ size_t
+ GetNumFunctionArguments() const;
+
+ // If this decl represents a function, return the argument type given a zero based argument index
+ CompilerType
+ GetFunctionArgumentType (size_t arg_idx) const;
+
+private:
+ TypeSystem *m_type_system;
+ void *m_opaque_decl;
+};
+
+bool operator == (const CompilerDecl &lhs, const CompilerDecl &rhs);
+bool operator != (const CompilerDecl &lhs, const CompilerDecl &rhs);
+
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_CompilerDecl_h_
diff --git a/include/lldb/Symbol/CompilerDeclContext.h b/include/lldb/Symbol/CompilerDeclContext.h
new file mode 100644
index 0000000000000..70399b2dbb371
--- /dev/null
+++ b/include/lldb/Symbol/CompilerDeclContext.h
@@ -0,0 +1,146 @@
+//===-- CompilerDeclContext.h -----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompilerDeclContext_h_
+#define liblldb_CompilerDeclContext_h_
+
+#include <vector>
+
+#include "lldb/lldb-private.h"
+#include "lldb/Core/ConstString.h"
+
+namespace lldb_private {
+
+class CompilerDeclContext
+{
+public:
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ CompilerDeclContext () :
+ m_type_system (nullptr),
+ m_opaque_decl_ctx (nullptr)
+ {
+ }
+
+ CompilerDeclContext (TypeSystem *type_system, void *decl_ctx) :
+ m_type_system (type_system),
+ m_opaque_decl_ctx (decl_ctx)
+ {
+ }
+
+ ~CompilerDeclContext()
+ {
+ }
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ explicit operator bool () const
+ {
+ return IsValid ();
+ }
+
+ bool
+ operator < (const CompilerDeclContext &rhs) const
+ {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool
+ IsValid () const
+ {
+ return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
+ }
+
+ bool
+ IsClang () const;
+
+ std::vector<CompilerDecl>
+ FindDeclByName (ConstString name);
+
+ //----------------------------------------------------------------------
+ /// Checks if this decl context represents a method of a class.
+ ///
+ /// @param[out] language_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the language that respresents the method.
+ ///
+ /// @param[out] is_instance_method_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the method is an instance function (true)
+ /// or a class method (false indicating the function is static, or
+ /// doesn't require an instance of the class to be called).
+ ///
+ /// @param[out] language_object_name_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if implicit object name for the language
+ /// like "this" for C++, and "self" for Objective C.
+ ///
+ /// @return
+ /// Returns true if this is a decl context that represents a method
+ /// in a struct, union or class.
+ //----------------------------------------------------------------------
+ bool
+ IsClassMethod (lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr);
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ TypeSystem *
+ GetTypeSystem() const
+ {
+ return m_type_system;
+ }
+
+ void *
+ GetOpaqueDeclContext() const
+ {
+ return m_opaque_decl_ctx;
+ }
+
+ void
+ SetDeclContext (TypeSystem* type_system, void* decl_ctx)
+ {
+ m_type_system = type_system;
+ m_opaque_decl_ctx = decl_ctx;
+ }
+
+ void
+ Clear()
+ {
+ m_type_system = nullptr;
+ m_opaque_decl_ctx = nullptr;
+ }
+
+ ConstString
+ GetName () const;
+
+ bool
+ IsStructUnionOrClass () const;
+
+private:
+ TypeSystem *m_type_system;
+ void *m_opaque_decl_ctx;
+
+};
+
+bool operator == (const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+bool operator != (const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_CompilerDeclContext_h_
diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/CompilerType.h
index 2524751e092e1..4f3ecc54ba1ab 100644
--- a/include/lldb/Symbol/ClangASTType.h
+++ b/include/lldb/Symbol/CompilerType.h
@@ -1,4 +1,4 @@
-//===-- ClangASTType.h ------------------------------------------*- C++ -*-===//
+//===-- CompilerType.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,13 +7,19 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ClangASTType_h_
-#define liblldb_ClangASTType_h_
+#ifndef liblldb_CompilerType_h_
+#define liblldb_CompilerType_h_
+// C Includes
+// C++ Includes
+#include <functional>
#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h"
-#include "clang/AST/Type.h"
namespace lldb_private {
@@ -27,46 +33,40 @@ namespace lldb_private {
// and the opaque clang QualType to be specified for ease of use and
// to avoid code duplication.
//----------------------------------------------------------------------
-class ClangASTType
+class CompilerType
{
public:
//----------------------------------------------------------------------
// Constructors and Destructors
//----------------------------------------------------------------------
- ClangASTType (clang::ASTContext *ast_context, lldb::clang_type_t type) :
- m_type (type),
- m_ast (ast_context)
- {
- }
+ CompilerType (TypeSystem *type_system, lldb::opaque_compiler_type_t type);
+ CompilerType (clang::ASTContext *ast_context, clang::QualType qual_type);
- ClangASTType (clang::ASTContext *ast_context, clang::QualType qual_type);
-
- ClangASTType (const ClangASTType &rhs) :
+ CompilerType (const CompilerType &rhs) :
m_type (rhs.m_type),
- m_ast (rhs.m_ast)
+ m_type_system (rhs.m_type_system)
{
}
- ClangASTType () :
- m_type (0),
- m_ast (0)
+ CompilerType () :
+ m_type (nullptr),
+ m_type_system (nullptr)
{
}
- ~ClangASTType();
+ ~CompilerType();
//----------------------------------------------------------------------
// Operators
//----------------------------------------------------------------------
- const ClangASTType &
- operator= (const ClangASTType &rhs)
+ const CompilerType &
+ operator= (const CompilerType &rhs)
{
m_type = rhs.m_type;
- m_ast = rhs.m_ast;
+ m_type_system = rhs.m_type_system;
return *this;
}
-
//----------------------------------------------------------------------
// Tests
@@ -74,30 +74,30 @@ public:
explicit operator bool () const
{
- return m_type != NULL && m_ast != NULL;
+ return m_type != nullptr && m_type_system != nullptr;
}
bool
- operator < (const ClangASTType &rhs) const
+ operator < (const CompilerType &rhs) const
{
- if (m_ast == rhs.m_ast)
+ if (m_type_system == rhs.m_type_system)
return m_type < rhs.m_type;
- return m_ast < rhs.m_ast;
+ return m_type_system < rhs.m_type_system;
}
bool
IsValid () const
{
- return m_type != NULL && m_ast != NULL;
+ return m_type != nullptr && m_type_system != nullptr;
}
bool
- IsArrayType (ClangASTType *element_type,
+ IsArrayType (CompilerType *element_type,
uint64_t *size,
bool *is_incomplete) const;
bool
- IsVectorType (ClangASTType *element_type,
+ IsVectorType (CompilerType *element_type,
uint64_t *size) const;
bool
@@ -107,6 +107,9 @@ public:
IsAggregateType () const;
bool
+ IsAnonymousType () const;
+
+ bool
IsBeingDefined () const;
bool
@@ -122,24 +125,21 @@ public:
IsCStringType (uint32_t &length) const;
bool
- IsCXXClassType () const;
-
- bool
IsDefined() const;
bool
IsFloatingPointType (uint32_t &count, bool &is_complex) const;
bool
- IsFunctionType (bool *is_variadic_ptr = NULL) const;
+ IsFunctionType(bool *is_variadic_ptr = nullptr) const;
uint32_t
- IsHomogeneousAggregate (ClangASTType* base_type_ptr) const;
+ IsHomogeneousAggregate (CompilerType* base_type_ptr) const;
size_t
GetNumberOfFunctionArguments () const;
- ClangASTType
+ CompilerType
GetFunctionArgumentAtIndex (const size_t index) const;
bool
@@ -150,33 +150,20 @@ public:
bool
IsIntegerType (bool &is_signed) const;
-
- bool
- IsObjCClassType () const;
-
- bool
- IsObjCClassTypeAndHasIVars (bool check_superclass) const;
-
- bool
- IsObjCObjectOrInterfaceType () const;
-
- bool
- IsObjCObjectPointerType (ClangASTType *target_type = NULL);
bool
IsPolymorphicClass () const;
bool
- IsPossibleCPlusPlusDynamicType (ClangASTType *target_type = NULL) const
+ IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const
{
return IsPossibleDynamicType (target_type, true, false);
}
bool
- IsPossibleDynamicType (ClangASTType *target_type, // Can pass NULL
- bool check_cplusplus,
- bool check_objc) const;
-
+ IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus,
+ bool check_objc) const;
bool
IsPointerToScalarType () const;
@@ -185,13 +172,16 @@ public:
IsRuntimeGeneratedType () const;
bool
- IsPointerType (ClangASTType *pointee_type = NULL) const;
+ IsPointerType(CompilerType *pointee_type = nullptr) const;
bool
- IsPointerOrReferenceType (ClangASTType *pointee_type = NULL) const;
+ IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
bool
- IsReferenceType (ClangASTType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
+ IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
+
+ bool
+ ShouldTreatScalarValueAsAddress () const;
bool
IsScalarType () const;
@@ -202,13 +192,6 @@ public:
bool
IsVoidType () const;
- bool
- GetCXXClassName (std::string &class_name) const;
-
- bool
- GetObjCClassName (std::string &class_name);
-
-
//----------------------------------------------------------------------
// Type Completion
//----------------------------------------------------------------------
@@ -227,10 +210,10 @@ public:
// Accessors
//----------------------------------------------------------------------
- clang::ASTContext *
- GetASTContext() const
+ TypeSystem *
+ GetTypeSystem() const
{
- return m_ast;
+ return m_type_system;
}
ConstString
@@ -246,12 +229,12 @@ public:
GetDisplayTypeName () const;
uint32_t
- GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL) const;
+ GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
lldb::LanguageType
GetMinimumLanguage ();
- lldb::clang_type_t
+ lldb::opaque_compiler_type_t
GetOpaqueQualType() const
{
return m_type;
@@ -261,14 +244,10 @@ public:
GetTypeClass () const;
void
- SetClangType (clang::ASTContext *ast, lldb::clang_type_t type)
- {
- m_ast = ast;
- m_type = type;
- }
+ SetCompilerType (TypeSystem* type_system, lldb::opaque_compiler_type_t type);
void
- SetClangType (clang::ASTContext *ast, clang::QualType qual_type);
+ SetCompilerType (clang::ASTContext *ast, clang::QualType qual_type);
unsigned
GetTypeQualifiers() const;
@@ -276,29 +255,14 @@ public:
//----------------------------------------------------------------------
// Creating related types
//----------------------------------------------------------------------
-
- ClangASTType
- AddConstModifier () const;
-
- ClangASTType
- AddRestrictModifier () const;
-
- ClangASTType
- AddVolatileModifier () const;
- // Using the current type, create a new typedef to that type using "typedef_name"
- // as the name and "decl_ctx" as the decl context.
- ClangASTType
- CreateTypedefType (const char *typedef_name,
- clang::DeclContext *decl_ctx) const;
+ CompilerType
+ GetArrayElementType(uint64_t *stride = nullptr) const;
- ClangASTType
- GetArrayElementType (uint64_t *stride = nullptr) const;
-
- ClangASTType
+ CompilerType
GetCanonicalType () const;
- ClangASTType
+ CompilerType
GetFullyUnqualifiedType () const;
// Returns -1 if this isn't a function of if the function doesn't have a prototype
@@ -306,10 +270,10 @@ public:
int
GetFunctionArgumentCount () const;
- ClangASTType
+ CompilerType
GetFunctionArgumentTypeAtIndex (size_t idx) const;
- ClangASTType
+ CompilerType
GetFunctionReturnType () const;
size_t
@@ -318,32 +282,83 @@ public:
TypeMemberFunctionImpl
GetMemberFunctionAtIndex (size_t idx);
- ClangASTType
- GetLValueReferenceType () const;
-
- ClangASTType
+ //----------------------------------------------------------------------
+ // If this type is a reference to a type (L value or R value reference),
+ // return a new type with the reference removed, else return the current
+ // type itself.
+ //----------------------------------------------------------------------
+ CompilerType
GetNonReferenceType () const;
- ClangASTType
+ //----------------------------------------------------------------------
+ // If this type is a pointer type, return the type that the pointer
+ // points to, else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
GetPointeeType () const;
- ClangASTType
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a pointer to this type
+ //----------------------------------------------------------------------
+ CompilerType
GetPointerType () const;
-
- ClangASTType
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a L value reference to this type if
+ // this type is valid and the type system supports L value references,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
+ GetLValueReferenceType () const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a R value reference to this type if
+ // this type is valid and the type system supports R value references,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
GetRValueReferenceType () const;
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a const modifier to this type if
+ // this type is valid and the type system supports const modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
+ AddConstModifier () const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a volatile modifier to this type if
+ // this type is valid and the type system supports volatile modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
+ AddVolatileModifier () const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a restrict modifier to this type if
+ // this type is valid and the type system supports restrict modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
+ AddRestrictModifier () const;
+
+ //----------------------------------------------------------------------
+ // Create a typedef to this type using "name" as the name of the typedef
+ // this type is valid and the type system supports typedefs, else return
+ // an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType
+ CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
+
// If the current object represents a typedef type, get the underlying type
- ClangASTType
+ CompilerType
GetTypedefedType () const;
-
- ClangASTType
- RemoveFastQualifiers () const;
//----------------------------------------------------------------------
// Create related types using the current type's AST
//----------------------------------------------------------------------
- ClangASTType
+ CompilerType
GetBasicTypeFromAST (lldb::BasicType basic_type) const;
//----------------------------------------------------------------------
@@ -374,54 +389,62 @@ public:
static lldb::BasicType
GetBasicTypeEnumeration (const ConstString &name);
- uint32_t
- GetNumDirectBaseClasses () const;
-
- uint32_t
- GetNumVirtualBaseClasses () const;
-
+ //----------------------------------------------------------------------
+ // If this type is an enumeration, iterate through all of its enumerators
+ // using a callback. If the callback returns true, keep iterating, else
+ // abort the iteration.
+ //----------------------------------------------------------------------
+ void
+ ForEachEnumerator (std::function <bool (const CompilerType &integer_type,
+ const ConstString &name,
+ const llvm::APSInt &value)> const &callback) const;
+
uint32_t
GetNumFields () const;
- ClangASTType
- GetDirectBaseClassAtIndex (size_t idx,
- uint32_t *bit_offset_ptr) const;
-
- ClangASTType
- GetVirtualBaseClassAtIndex (size_t idx,
- uint32_t *bit_offset_ptr) const;
-
- ClangASTType
+ CompilerType
GetFieldAtIndex (size_t idx,
std::string& name,
uint64_t *bit_offset_ptr,
uint32_t *bitfield_bit_size_ptr,
bool *is_bitfield_ptr) const;
-
+
uint32_t
- GetIndexOfFieldWithName (const char* name,
- ClangASTType* field_clang_type = NULL,
- uint64_t *bit_offset_ptr = NULL,
- uint32_t *bitfield_bit_size_ptr = NULL,
- bool *is_bitfield_ptr = NULL) const;
-
+ GetNumDirectBaseClasses () const;
+
+ uint32_t
+ GetNumVirtualBaseClasses () const;
+
+ CompilerType
+ GetDirectBaseClassAtIndex (size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
+ CompilerType
+ GetVirtualBaseClassAtIndex (size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
uint32_t
- GetNumPointeeChildren () const;
-
- ClangASTType
- GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
- size_t idx,
- bool transparent_pointers,
- bool omit_empty_base_classes,
- bool ignore_array_bounds,
- std::string& child_name,
- uint32_t &child_byte_size,
- int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset,
- bool &child_is_base_class,
- bool &child_is_deref_of_parent,
- ValueObject *valobj) const;
+ GetIndexOfFieldWithName(const char* name,
+ CompilerType* field_compiler_type = nullptr,
+ uint64_t *bit_offset_ptr = nullptr,
+ uint32_t *bitfield_bit_size_ptr = nullptr,
+ bool *is_bitfield_ptr = nullptr) const;
+
+ CompilerType
+ GetChildCompilerTypeAtIndex (ExecutionContext *exe_ctx,
+ size_t idx,
+ bool transparent_pointers,
+ bool omit_empty_base_classes,
+ bool ignore_array_bounds,
+ std::string& child_name,
+ uint32_t &child_byte_size,
+ int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class,
+ bool &child_is_deref_of_parent,
+ ValueObject *valobj,
+ uint64_t &language_flags) const;
// Lookup a child given a name. This function will match base class names
// and member member names in "clang_type" only, not descendants.
@@ -442,136 +465,30 @@ public:
size_t
GetNumTemplateArguments () const;
- ClangASTType
+ CompilerType
GetTemplateArgument (size_t idx,
lldb::TemplateArgumentKind &kind) const;
-
-
- //----------------------------------------------------------------------
- // Modifying RecordType
- //----------------------------------------------------------------------
- clang::FieldDecl *
- AddFieldToRecordType (const char *name,
- const ClangASTType &field_type,
- lldb::AccessType access,
- uint32_t bitfield_bit_size);
-
- void
- BuildIndirectFields ();
-
- void
- SetIsPacked ();
-
- clang::VarDecl *
- AddVariableToRecordType (const char *name,
- const ClangASTType &var_type,
- lldb::AccessType access);
-
- clang::CXXMethodDecl *
- AddMethodToCXXRecordType (const char *name,
- const ClangASTType &method_type,
- lldb::AccessType access,
- bool is_virtual,
- bool is_static,
- bool is_inline,
- bool is_explicit,
- bool is_attr_used,
- bool is_artificial);
-
- // C++ Base Classes
- clang::CXXBaseSpecifier *
- CreateBaseClassSpecifier (lldb::AccessType access,
- bool is_virtual,
- bool base_of_class);
-
- static void
- DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
- unsigned num_base_classes);
-
- bool
- SetBaseClassesForClassType (clang::CXXBaseSpecifier const * const *base_classes,
- unsigned num_base_classes);
-
-
- bool
- SetObjCSuperClass (const ClangASTType &superclass_clang_type);
-
- bool
- AddObjCClassProperty (const char *property_name,
- const ClangASTType &property_clang_type,
- clang::ObjCIvarDecl *ivar_decl,
- const char *property_setter_name,
- const char *property_getter_name,
- uint32_t property_attributes,
- ClangASTMetadata *metadata);
-
- clang::ObjCMethodDecl *
- AddMethodToObjCObjectType (const char *name, // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
- const ClangASTType &method_clang_type,
- lldb::AccessType access,
- bool is_artificial);
-
- clang::DeclContext *
- GetDeclContextForType () const;
-
-
- bool
- SetDefaultAccessForRecordFields (int default_accessibility,
- int *assigned_accessibilities,
- size_t num_assigned_accessibilities);
- bool
- SetHasExternalStorage (bool has_extern);
+ CompilerType
+ GetTypeForFormatters () const;
+ LazyBool
+ ShouldPrintAsOneLiner (ValueObject* valobj) const;
- //------------------------------------------------------------------
- // clang::TagType
- //------------------------------------------------------------------
-
- bool
- SetTagTypeKind (int kind) const;
-
- //------------------------------------------------------------------
- // Tag Declarations
- //------------------------------------------------------------------
- bool
- StartTagDeclarationDefinition ();
-
- bool
- CompleteTagDeclarationDefinition ();
-
- //----------------------------------------------------------------------
- // Modifying Enumeration types
- //----------------------------------------------------------------------
bool
- AddEnumerationValueToEnumerationType (const ClangASTType &enumerator_qual_type,
- const Declaration &decl,
- const char *name,
- int64_t enum_value,
- uint32_t enum_value_bit_size);
-
-
-
- ClangASTType
- GetEnumerationIntegerType () const;
-
+ IsMeaninglessWithoutDynamicResolution () const;
//------------------------------------------------------------------
// Pointers & References
//------------------------------------------------------------------
- // Call this function using the class type when you want to make a
- // member pointer type to pointee_type.
- ClangASTType
- CreateMemberPointerType (const ClangASTType &pointee_type) const;
-
-
// Converts "s" to a floating point value and place resulting floating
// point bytes in the "dst" buffer.
size_t
ConvertStringToFloatValue (const char *s,
uint8_t *dst,
size_t dst_size) const;
+
//----------------------------------------------------------------------
// Dumping types
//----------------------------------------------------------------------
@@ -633,52 +550,22 @@ public:
lldb::addr_t addr,
AddressType address_type,
StreamString &new_value);
-
- clang::EnumDecl *
- GetAsEnumDecl () const;
-
-
- clang::RecordDecl *
- GetAsRecordDecl () const;
- clang::CXXRecordDecl *
- GetAsCXXRecordDecl () const;
-
- clang::ObjCInterfaceDecl *
- GetAsObjCInterfaceDecl () const;
-
void
Clear()
{
- m_type = NULL;
- m_ast = NULL;
- }
-
- clang::QualType
- GetQualType () const
- {
- if (m_type)
- return clang::QualType::getFromOpaquePtr(m_type);
- return clang::QualType();
- }
- clang::QualType
- GetCanonicalQualType () const
- {
- if (m_type)
- return clang::QualType::getFromOpaquePtr(m_type).getCanonicalType();
- return clang::QualType();
+ m_type = nullptr;
+ m_type_system = nullptr;
}
private:
- lldb::clang_type_t m_type;
- clang::ASTContext *m_ast;
-
+ lldb::opaque_compiler_type_t m_type;
+ TypeSystem *m_type_system;
};
-bool operator == (const ClangASTType &lhs, const ClangASTType &rhs);
-bool operator != (const ClangASTType &lhs, const ClangASTType &rhs);
+bool operator == (const CompilerType &lhs, const CompilerType &rhs);
+bool operator != (const CompilerType &lhs, const CompilerType &rhs);
-
} // namespace lldb_private
-#endif // #ifndef liblldb_ClangASTType_h_
+#endif // liblldb_CompilerType_h_
diff --git a/include/lldb/Symbol/DebugMacros.h b/include/lldb/Symbol/DebugMacros.h
new file mode 100644
index 0000000000000..24bf03a8c3b1a
--- /dev/null
+++ b/include/lldb/Symbol/DebugMacros.h
@@ -0,0 +1,140 @@
+//===-- DebugMacros.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DebugMacros_h_
+#define liblldb_DebugMacros_h_
+
+// C Includes
+// C++ Includes
+#include <memory>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Core/ConstString.h"
+
+namespace lldb_private {
+
+class CompileUnit;
+class DebugMacros;
+typedef std::shared_ptr<DebugMacros> DebugMacrosSP;
+
+class DebugMacroEntry
+{
+public:
+ enum EntryType
+ {
+ INVALID,
+ DEFINE,
+ UNDEF,
+ START_FILE,
+ END_FILE,
+ INDIRECT
+ };
+
+public:
+ static DebugMacroEntry
+ CreateDefineEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry
+ CreateUndefEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry
+ CreateStartFileEntry(uint32_t line, uint32_t debug_line_file_idx);
+
+ static DebugMacroEntry
+ CreateEndFileEntry();
+
+ static DebugMacroEntry
+ CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp);
+
+ DebugMacroEntry() : m_type(INVALID) { }
+
+ ~DebugMacroEntry() = default;
+
+ EntryType
+ GetType() const
+ {
+ return m_type;
+ }
+
+ uint64_t
+ GetLineNumber() const
+ {
+ return m_line;
+ }
+
+ ConstString
+ GetMacroString() const
+ {
+ return m_str;
+ }
+
+ const FileSpec& GetFileSpec(CompileUnit *comp_unit) const;
+
+ DebugMacros *
+ GetIndirectDebugMacros() const
+ {
+ return m_debug_macros_sp.get();
+ }
+
+private:
+ DebugMacroEntry(EntryType type,
+ uint32_t line,
+ uint32_t debug_line_file_idx,
+ const char *str);
+
+ DebugMacroEntry(EntryType type,
+ const DebugMacrosSP &debug_macros_sp);
+
+ EntryType m_type:3;
+ uint32_t m_line:29;
+ uint32_t m_debug_line_file_idx;
+ ConstString m_str;
+ DebugMacrosSP m_debug_macros_sp;
+};
+
+class DebugMacros
+{
+public:
+ DebugMacros() = default;
+
+ ~DebugMacros() = default;
+
+ void
+ AddMacroEntry(const DebugMacroEntry &entry)
+ {
+ m_macro_entries.push_back(entry);
+ }
+
+ size_t
+ GetNumMacroEntries() const
+ {
+ return m_macro_entries.size();
+ }
+
+ DebugMacroEntry
+ GetMacroEntryAtIndex(const size_t index) const
+ {
+ if (index < m_macro_entries.size())
+ return m_macro_entries[index];
+ else
+ return DebugMacroEntry();
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(DebugMacros);
+
+ std::vector<DebugMacroEntry> m_macro_entries;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DebugMacros_h_
diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h
index 0d4aabb5fd570..728b4c6fcb324 100644
--- a/include/lldb/Symbol/FuncUnwinders.h
+++ b/include/lldb/Symbol/FuncUnwinders.h
@@ -103,6 +103,9 @@ public:
GetCompactUnwindUnwindPlan (Target &target, int current_offset);
lldb::UnwindPlanSP
+ GetArmUnwindUnwindPlan (Target &target, int current_offset);
+
+ lldb::UnwindPlanSP
GetArchDefaultUnwindPlan (Thread &thread);
lldb::UnwindPlanSP
@@ -122,6 +125,7 @@ private:
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by assembly inspection so it's valid everywhere
std::vector<lldb::UnwindPlanSP> m_unwind_plan_compact_unwind;
+ lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp;
lldb::UnwindPlanSP m_unwind_plan_fast_sp;
lldb::UnwindPlanSP m_unwind_plan_arch_default_sp;
lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp;
@@ -132,6 +136,7 @@ private:
m_tried_unwind_plan_eh_frame:1,
m_tried_unwind_plan_eh_frame_augmented:1,
m_tried_unwind_plan_compact_unwind:1,
+ m_tried_unwind_plan_arm_unwind:1,
m_tried_unwind_fast:1,
m_tried_unwind_arch_default:1,
m_tried_unwind_arch_default_at_func_entry:1;
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index 30c8f168e5f16..cd2df9b6078fd 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -10,7 +10,6 @@
#ifndef liblldb_Function_h_
#define liblldb_Function_h_
-#include "lldb/Core/ClangForward.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Declaration.h"
@@ -147,7 +146,6 @@ protected:
Declaration m_declaration; ///< Information describing where this function information was defined.
};
-
//----------------------------------------------------------------------
/// @class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
/// @brief A class that describes information for an inlined function.
@@ -203,7 +201,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
- ~InlineFunctionInfo();
+ ~InlineFunctionInfo() override;
//------------------------------------------------------------------
/// Compare two inlined function information objects.
@@ -294,8 +292,8 @@ public:
///
/// @see ConstString::StaticMemorySize ()
//------------------------------------------------------------------
- virtual size_t
- MemorySize() const;
+ size_t
+ MemorySize() const override;
private:
//------------------------------------------------------------------
@@ -415,24 +413,24 @@ public:
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
- ~Function ();
+ ~Function() override;
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- CalculateSymbolContext(SymbolContext* sc);
+ void
+ CalculateSymbolContext(SymbolContext* sc) override;
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ();
+ lldb::ModuleSP
+ CalculateSymbolContextModule() override;
- virtual CompileUnit *
- CalculateSymbolContextCompileUnit ();
+ CompileUnit *
+ CalculateSymbolContextCompileUnit() override;
- virtual Function *
- CalculateSymbolContextFunction ();
+ Function *
+ CalculateSymbolContextFunction() override;
const AddressRange &
GetAddressRange()
@@ -550,8 +548,8 @@ public:
/// @return
/// The DeclContext, or NULL if none exists.
//------------------------------------------------------------------
- clang::DeclContext *
- GetClangDeclContext();
+ CompilerDeclContext
+ GetDeclContext();
//------------------------------------------------------------------
/// Get accessor for the type that describes the function
@@ -573,8 +571,8 @@ public:
const Type*
GetType() const;
- ClangASTType
- GetClangType ();
+ CompilerType
+ GetCompilerType ();
uint32_t
GetPrologueByteSize ();
@@ -600,8 +598,8 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- DumpSymbolContext(Stream *s);
+ void
+ DumpSymbolContext(Stream *s) override;
//------------------------------------------------------------------
/// Get the memory cost of this object.
@@ -616,6 +614,42 @@ public:
size_t
MemorySize () const;
+ //------------------------------------------------------------------
+ /// Get whether compiler optimizations were enabled for this function
+ ///
+ /// The debug information may provide information about whether this
+ /// function was compiled with optimization or not. In this case,
+ /// "optimized" means that the debug experience may be difficult
+ /// for the user to understand. Variables may not be available when
+ /// the developer would expect them, stepping through the source lines
+ /// in the function may appear strange, etc.
+ ///
+ /// @return
+ /// Returns 'true' if this function was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this function was built without optimization.
+ //------------------------------------------------------------------
+ bool
+ GetIsOptimized ();
+
+ //------------------------------------------------------------------
+ /// Get whether this function represents a 'top-level' function
+ ///
+ /// The concept of a top-level function is language-specific, mostly
+ /// meant to represent the notion of scripting-style code that has
+ /// global visibility of the variables/symbols/functions/...
+ /// defined within the containing file/module
+ ///
+ /// If stopped in a top-level function, LLDB will expose global variables
+ /// as-if locals in the 'frame variable' command
+ ///
+ /// @return
+ /// Returns 'true' if this function is a top-level function,
+ /// 'false' otherwise.
+ //------------------------------------------------------------------
+ bool
+ IsTopLevelFunction ();
+
lldb::DisassemblerSP
GetInstructions (const ExecutionContext &exe_ctx,
const char *flavor,
@@ -634,8 +668,6 @@ protected:
flagsCalculatedPrologueSize = (1 << 0) ///< Have we already tried to calculate the prologue size?
};
-
-
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
@@ -654,4 +686,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_Function_h_
+#endif // liblldb_Function_h_
diff --git a/include/lldb/Symbol/GoASTContext.h b/include/lldb/Symbol/GoASTContext.h
new file mode 100644
index 0000000000000..3de98da59958e
--- /dev/null
+++ b/include/lldb/Symbol/GoASTContext.h
@@ -0,0 +1,402 @@
+//===-- GoASTContext.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_GoASTContext_h_
+#define liblldb_GoASTContext_h_
+
+// C Includes
+// C++ Includes
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/ConstString.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private
+{
+
+class Declaration;
+class GoType;
+
+class GoASTContext : public TypeSystem
+{
+ public:
+ GoASTContext();
+ ~GoASTContext() override;
+
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString
+ GetPluginName() override;
+
+ uint32_t
+ GetPluginVersion() override;
+
+ static ConstString
+ GetPluginNameStatic ();
+
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, Module *module, Target *target);
+
+ static void
+ EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ DWARFASTParser *GetDWARFParser() override;
+
+ void
+ SetAddressByteSize(int byte_size)
+ {
+ m_pointer_byte_size = byte_size;
+ }
+
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const TypeSystem *ts)
+ {
+ return ts->getKind() == TypeSystem::eKindGo;
+ }
+
+ //----------------------------------------------------------------------
+ // CompilerDecl functions
+ //----------------------------------------------------------------------
+ ConstString
+ DeclGetName (void *opaque_decl) override
+ {
+ return ConstString();
+ }
+
+ lldb::VariableSP
+ DeclGetVariable (void *opaque_decl) override
+ {
+ return lldb::VariableSP();
+ }
+
+ void
+ DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) override
+ {
+ }
+
+ //----------------------------------------------------------------------
+ // CompilerDeclContext functions
+ //----------------------------------------------------------------------
+
+ bool
+ DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override
+ {
+ return false;
+ }
+
+ ConstString
+ DeclContextGetName(void *opaque_decl_ctx) override
+ {
+ return ConstString();
+ }
+
+ bool
+ DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override
+ {
+ return false;
+ }
+
+ //----------------------------------------------------------------------
+ // Creating Types
+ //----------------------------------------------------------------------
+
+ CompilerType CreateArrayType(const ConstString &name, const CompilerType &element_type, uint64_t length);
+
+ CompilerType CreateBaseType(int go_kind, const ConstString &type_name_const_str, uint64_t byte_size);
+
+ // For interface, map, chan.
+ CompilerType CreateTypedefType(int kind, const ConstString &name, CompilerType impl);
+
+ CompilerType CreateVoidType(const ConstString &name);
+ CompilerType CreateFunctionType(const lldb_private::ConstString &name, CompilerType *params, size_t params_count,
+ bool is_variadic);
+
+ CompilerType CreateStructType(int kind, const ConstString &name, uint32_t byte_size);
+
+ void CompleteStructType(const CompilerType &type);
+
+ void AddFieldToStruct(const CompilerType &struct_type, const ConstString &name, const CompilerType &field_type,
+ uint32_t byte_offset);
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ static bool IsGoString(const CompilerType &type);
+ static bool IsGoSlice(const CompilerType &type);
+ static bool IsGoInterface(const CompilerType &type);
+ static bool IsDirectIface(uint8_t kind);
+ static bool IsPointerKind(uint8_t kind);
+
+ bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override;
+
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
+
+ bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = nullptr) override;
+
+ size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override;
+
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override;
+
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) override;
+
+ bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override;
+
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
+
+ bool SupportsLanguage (lldb::LanguageType language) override;
+
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
+
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // AST related queries
+ //----------------------------------------------------------------------
+
+ uint32_t GetPointerByteSize() override;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type = nullptr) override;
+
+ lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
+
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride = nullptr) override;
+
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a prototype
+ // Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+
+ CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+
+ TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
+
+ uint64_t GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
+
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override;
+
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
+
+ lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override;
+
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) override;
+
+ uint32_t
+ GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
+ {
+ return 0;
+ }
+
+ uint32_t
+ GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
+ {
+ return 0;
+ }
+
+ CompilerType
+ GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
+ {
+ return CompilerType();
+ }
+
+ CompilerType
+ GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
+ {
+ return CompilerType();
+ }
+
+ CompilerType GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
+ bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override;
+
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
+
+ size_t
+ GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override
+ {
+ return 0;
+ }
+
+ CompilerType
+ GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, lldb::TemplateArgumentKind &kind) override
+ {
+ return CompilerType();
+ }
+
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
+ const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool show_types, bool show_summary,
+ bool verbose, uint32_t depth) override;
+
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope) override;
+
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type) override; // Dump to stdout
+
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) override;
+
+ //----------------------------------------------------------------------
+ // TODO: These methods appear unused. Should they be removed?
+ //----------------------------------------------------------------------
+
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
+
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override;
+
+ //----------------------------------------------------------------------
+ // TODO: Determine if these methods should move to ClangASTContext.
+ //----------------------------------------------------------------------
+
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
+
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override;
+
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override;
+
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override;
+
+ CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr, bool *is_rvalue = nullptr) override;
+
+ private:
+ typedef std::map<ConstString, std::unique_ptr<GoType>> TypeMap;
+ int m_pointer_byte_size;
+ int m_int_byte_size;
+ std::unique_ptr<TypeMap> m_types;
+ std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
+
+ GoASTContext(const GoASTContext &) = delete;
+ const GoASTContext &operator=(const GoASTContext &) = delete;
+};
+
+class GoASTContextForExpr : public GoASTContext
+{
+ public:
+ GoASTContextForExpr(lldb::TargetSP target) : m_target_wp(target) {}
+ UserExpression *GetUserExpression(const char *expr, const char *expr_prefix, lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options) override;
+
+ private:
+ lldb::TargetWP m_target_wp;
+};
+}
+#endif // liblldb_GoASTContext_h_
diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h
index 082caea3b12fe..374c04a7fcec4 100644
--- a/include/lldb/Symbol/LineEntry.h
+++ b/include/lldb/Symbol/LineEntry.h
@@ -140,6 +140,32 @@ struct LineEntry
static int
Compare (const LineEntry& lhs, const LineEntry& rhs);
+ //------------------------------------------------------------------
+ /// Give the range for this LineEntry + any additional LineEntries for
+ /// this same source line that are contiguous.
+ ///
+ /// A compiler may emit multiple line entries for a single source line,
+ /// e.g. to indicate subexpressions at different columns. This method
+ /// will get the AddressRange for all of the LineEntries for this source
+ /// line that are contiguous.
+ //
+ /// Line entries with a line number of 0 are treated specially - these
+ /// are compiler-generated line table entries that the user did not
+ /// write in their source code, and we want to skip past in the debugger.
+ /// If this LineEntry is for line 32, and the following LineEntry is for
+ /// line 0, we will extend the range to include the AddressRange of the
+ /// line 0 LineEntry (and it will include the range of the following
+ /// LineEntries that match either 32 or 0.)
+ ///
+ /// If the initial LineEntry this method is called on is a line #0, only
+ /// the range of contiuous LineEntries with line #0 will be included in
+ /// the complete range.
+ ///
+ /// @return
+ /// The contiguous AddressRange for this source line.
+ //------------------------------------------------------------------
+ AddressRange
+ GetSameLineContiguousAddressRange () const;
//------------------------------------------------------------------
// Member variables.
diff --git a/include/lldb/Symbol/LineTable.h b/include/lldb/Symbol/LineTable.h
index 3e25ad17e94ea..cbad9bf590c25 100644
--- a/include/lldb/Symbol/LineTable.h
+++ b/include/lldb/Symbol/LineTable.h
@@ -10,8 +10,12 @@
#ifndef liblldb_LineTable_h_
#define liblldb_LineTable_h_
+// C Includes
+// C++ Includes
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Core/ModuleChild.h"
@@ -30,7 +34,7 @@ public:
LineSequence ();
virtual
- ~LineSequence() {}
+ ~LineSequence() = default;
virtual void
Clear() = 0;
@@ -143,14 +147,14 @@ public:
///
/// @param[out] index_ptr
/// A pointer to a 32 bit integer that will get the actual line
- /// entry index if it is not NULL.
+ /// entry index if it is not nullptr.
///
/// @return
/// Returns \b true if \a so_addr is contained in a line entry
/// in this line table, \b false otherwise.
//------------------------------------------------------------------
bool
- FindLineEntryByAddress (const Address &so_addr, LineEntry& line_entry, uint32_t *index_ptr = NULL);
+ FindLineEntryByAddress(const Address &so_addr, LineEntry& line_entry, uint32_t *index_ptr = nullptr);
//------------------------------------------------------------------
/// Find a line entry index that has a matching file index and
@@ -269,7 +273,6 @@ public:
LinkLineTable (const FileRangeMap &file_range_map);
protected:
-
struct Entry
{
Entry () :
@@ -343,12 +346,12 @@ protected:
return 0;
}
-
class LessThanBinaryPredicate
{
public:
LessThanBinaryPredicate(LineTable *line_table);
bool operator() (const LineTable::Entry&, const LineTable::Entry&) const;
+
protected:
LineTable *m_line_table;
};
@@ -396,16 +399,12 @@ protected:
class LineSequenceImpl : public LineSequence
{
public:
- LineSequenceImpl() :
- LineSequence()
- {}
+ LineSequenceImpl() = default;
- virtual
- ~LineSequenceImpl()
- {}
+ ~LineSequenceImpl() override = default;
- virtual void
- Clear();
+ void
+ Clear() override;
entry_collection m_entries; ///< The collection of line entries in this sequence.
};
@@ -419,4 +418,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_LineTable_h_
+#endif // liblldb_LineTable_h_
diff --git a/include/lldb/Symbol/ObjectContainer.h b/include/lldb/Symbol/ObjectContainer.h
index 679e8f03b67a5..eeda1c4ae19d9 100644
--- a/include/lldb/Symbol/ObjectContainer.h
+++ b/include/lldb/Symbol/ObjectContainer.h
@@ -14,7 +14,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-
#include "lldb/lldb-private.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Host/FileSpec.h"
@@ -71,10 +70,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~ObjectContainer()
- {
- }
+ ~ObjectContainer() override = default;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
@@ -188,7 +184,7 @@ public:
///
/// @return
/// Returns a pointer to the object file of the requested \a
- /// arch and optional \a name. Returns NULL of no such object
+ /// arch and optional \a name. Returns nullptr of no such object
/// file exists in the container.
//------------------------------------------------------------------
virtual lldb::ObjectFileSP
@@ -203,19 +199,19 @@ public:
virtual ObjectFile *
GetObjectFileAtIndex (uint32_t object_idx)
{
- return NULL;
+ return nullptr;
}
virtual ObjectContainer *
GetObjectContainerAtIndex (uint32_t object_idx)
{
- return NULL;
+ return nullptr;
}
virtual const char *
GetObjectNameAtIndex (uint32_t object_idx) const
{
- return NULL;
+ return nullptr;
}
protected:
@@ -233,4 +229,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ObjectContainer_h_
+#endif // liblldb_ObjectContainer_h_
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index ff00ac26e67ef..4b0a2f9ff936c 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -125,8 +125,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~ObjectFile();
+ ~ObjectFile() override;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
@@ -369,12 +368,11 @@ public:
/// The list of sections contained in this object file.
//------------------------------------------------------------------
virtual SectionList *
- GetSectionList ();
+ GetSectionList (bool update_module_section_list = true);
virtual void
CreateSections (SectionList &unified_section_list) = 0;
-
//------------------------------------------------------------------
/// Notify the ObjectFile that the file addresses in the Sections
/// for this module have been changed.
@@ -595,7 +593,6 @@ public:
virtual lldb_private::Address
GetHeaderAddress () { return Address(m_memory_addr);}
-
virtual uint32_t
GetNumThreadContexts ()
{
@@ -767,7 +764,6 @@ public:
return 0;
}
-
//------------------------------------------------------------------
/// Return true if this file is a dynamic link editor (dyld)
///
@@ -823,6 +819,7 @@ public:
lldb::offset_t section_offset,
void *dst,
size_t dst_len) const;
+
virtual size_t
ReadSectionData (const Section *section,
DataExtractor& section_data) const;
@@ -843,7 +840,11 @@ public:
{
return symbol_name.str();
}
-
+
+ static lldb::SymbolType
+ GetSymbolTypeFromName (llvm::StringRef name,
+ lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined);
+
protected:
//------------------------------------------------------------------
// Member variables.
@@ -880,5 +881,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ObjectFile_h_
-
+#endif // liblldb_ObjectFile_h_
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index f9438b006c4e5..c77d3dea4bd21 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -333,6 +333,7 @@ public:
{
return m_demangled_is_synthesized;
}
+
void
SetDemangledNameIsSynthesized(bool b)
{
@@ -354,22 +355,22 @@ public:
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- CalculateSymbolContext (SymbolContext *sc);
+ void
+ CalculateSymbolContext(SymbolContext *sc) override;
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ();
+ lldb::ModuleSP
+ CalculateSymbolContextModule() override;
- virtual Symbol *
- CalculateSymbolContextSymbol ();
+ Symbol *
+ CalculateSymbolContextSymbol() override;
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
///
/// @see SymbolContextScope
//------------------------------------------------------------------
- virtual void
- DumpSymbolContext (Stream *s);
+ void
+ DumpSymbolContext(Stream *s) override;
lldb::DisassemblerSP
GetInstructions (const ExecutionContext &exe_ctx,
@@ -411,4 +412,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_Symbol_h_
+#endif // liblldb_Symbol_h_
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index c48505e1064a2..9cb709d240118 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -7,12 +7,17 @@
//
//===----------------------------------------------------------------------===//
-
#ifndef liblldb_SymbolContext_h_
#define liblldb_SymbolContext_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Mangled.h"
@@ -22,6 +27,7 @@
namespace lldb_private {
class SymbolContextScope;
+
//----------------------------------------------------------------------
/// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h"
/// @brief Defines a symbol context baton that can be handed other debug
@@ -36,11 +42,10 @@ class SymbolContextScope;
class SymbolContext
{
public:
-
//------------------------------------------------------------------
/// Default constructor.
///
- /// Initialize all pointer members to NULL and all struct members
+ /// Initialize all pointer members to nullptr and all struct members
/// to their default state.
//------------------------------------------------------------------
SymbolContext ();
@@ -81,24 +86,23 @@ public:
/// A Symbol pointer to the symbol for this context.
//------------------------------------------------------------------
explicit
- SymbolContext (const lldb::TargetSP &target_sp,
- const lldb::ModuleSP &module_sp,
- CompileUnit *comp_unit = NULL,
- Function *function = NULL,
- Block *block = NULL,
- LineEntry *line_entry = NULL,
- Symbol *symbol = NULL);
+ SymbolContext(const lldb::TargetSP &target_sp,
+ const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr,
+ Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
// This version sets the target to a NULL TargetSP if you don't know it.
explicit
- SymbolContext (const lldb::ModuleSP &module_sp,
- CompileUnit *comp_unit = NULL,
- Function *function = NULL,
- Block *block = NULL,
- LineEntry *line_entry = NULL,
- Symbol *symbol = NULL);
+ SymbolContext(const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr,
+ Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
- ~SymbolContext ();
//------------------------------------------------------------------
/// Copy constructor
///
@@ -109,6 +113,8 @@ public:
//------------------------------------------------------------------
SymbolContext (const SymbolContext& rhs);
+ ~SymbolContext ();
+
//------------------------------------------------------------------
/// Assignment operator.
///
@@ -127,7 +133,7 @@ public:
//------------------------------------------------------------------
/// Clear the object's state.
///
- /// Resets all pointer members to NULL, and clears any class objects
+ /// Resets all pointer members to nullptr, and clears any class objects
/// to their default state.
//------------------------------------------------------------------
void
@@ -203,14 +209,14 @@ public:
///
/// Address range priority is as follows:
/// - line_entry address range if line_entry is valid and eSymbolContextLineEntry is set in \a scope
- /// - block address range if block is not NULL and eSymbolContextBlock is set in \a scope
- /// - function address range if function is not NULL and eSymbolContextFunction is set in \a scope
- /// - symbol address range if symbol is not NULL and eSymbolContextSymbol is set in \a scope
+ /// - block address range if block is not nullptr and eSymbolContextBlock is set in \a scope
+ /// - function address range if function is not nullptr and eSymbolContextFunction is set in \a scope
+ /// - symbol address range if symbol is not nullptr and eSymbolContextSymbol is set in \a scope
///
/// @param[in] scope
/// A mask of symbol context bits telling this function which
/// address ranges it can use when trying to extract one from
- /// the valid (non-NULL) symbol context classes.
+ /// the valid (non-nullptr) symbol context classes.
///
/// @param[in] range_idx
/// The address range index to grab. Since many functions and
@@ -239,7 +245,6 @@ public:
bool use_inline_block_range,
AddressRange &range) const;
-
void
GetDescription(Stream *s,
lldb::DescriptionLevel level,
@@ -248,7 +253,9 @@ public:
uint32_t
GetResolvedMask () const;
-
+ lldb::LanguageType
+ GetLanguage () const;
+
//------------------------------------------------------------------
/// Find a block that defines the function represented by this
/// symbol context.
@@ -268,12 +275,11 @@ public:
///
/// @return
/// The block object pointer that defines the function that is
- /// represented by this symbol context object, NULL otherwise.
+ /// represented by this symbol context object, nullptr otherwise.
//------------------------------------------------------------------
Block *
GetFunctionBlock ();
-
//------------------------------------------------------------------
/// If this symbol context represents a function that is a method,
/// return true and provide information about the method.
@@ -299,6 +305,14 @@ public:
ConstString &language_object_name);
//------------------------------------------------------------------
+ /// Sorts the types in TypeMap according to SymbolContext
+ /// to TypeList
+ ///
+ //------------------------------------------------------------------
+ void
+ SortTypeList(TypeMap &type_map, TypeList &type_list) const;
+
+ //------------------------------------------------------------------
/// Find a name of the innermost function for the symbol context.
///
/// For instance, if the symbol context contains an inlined block,
@@ -315,7 +329,6 @@ public:
ConstString
GetFunctionName (Mangled::NamePreference preference = Mangled::ePreferDemangled) const;
-
//------------------------------------------------------------------
/// Get the line entry that corresponds to the function.
///
@@ -377,7 +390,6 @@ public:
Variable * variable; ///< The global variable matching the given query
};
-
class SymbolContextSpecifier
{
public:
@@ -427,7 +439,6 @@ private:
std::string m_class_name;
std::unique_ptr<AddressRange> m_address_range_ap;
uint32_t m_type; // Or'ed bits from SpecificationType
-
};
//----------------------------------------------------------------------
@@ -479,6 +490,7 @@ public:
uint32_t
AppendIfUnique (const SymbolContextList& sc_list,
bool merge_symbol_into_function);
+
//------------------------------------------------------------------
/// Clear the object's state.
///
@@ -558,6 +570,7 @@ public:
bool
RemoveContextAtIndex (size_t idx);
+
//------------------------------------------------------------------
/// Get accessor for a symbol context list size.
///
@@ -600,4 +613,4 @@ bool operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs);
} // namespace lldb_private
-#endif // liblldb_SymbolContext_h_
+#endif // liblldb_SymbolContext_h_
diff --git a/include/lldb/Symbol/SymbolContextScope.h b/include/lldb/Symbol/SymbolContextScope.h
index a02b4523a4c0f..212d8e6df233a 100644
--- a/include/lldb/Symbol/SymbolContextScope.h
+++ b/include/lldb/Symbol/SymbolContextScope.h
@@ -72,7 +72,7 @@ class SymbolContextScope
{
public:
virtual
- ~SymbolContextScope () {}
+ ~SymbolContextScope() = default;
//------------------------------------------------------------------
/// Reconstruct the object's symbol context into \a sc.
@@ -87,7 +87,6 @@ public:
virtual void
CalculateSymbolContext (SymbolContext *sc) = 0;
-
virtual lldb::ModuleSP
CalculateSymbolContextModule ()
{
@@ -97,25 +96,25 @@ public:
virtual CompileUnit *
CalculateSymbolContextCompileUnit ()
{
- return NULL;
+ return nullptr;
}
virtual Function *
CalculateSymbolContextFunction ()
{
- return NULL;
+ return nullptr;
}
virtual Block *
CalculateSymbolContextBlock ()
{
- return NULL;
+ return nullptr;
}
virtual Symbol *
CalculateSymbolContextSymbol ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -134,4 +133,4 @@ public:
} // namespace lldb_private
-#endif // liblldb_SymbolContextScope_h_
+#endif // liblldb_SymbolContextScope_h_
diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h
index 0efe034235d55..e27b32d01f688 100644
--- a/include/lldb/Symbol/SymbolFile.h
+++ b/include/lldb/Symbol/SymbolFile.h
@@ -12,8 +12,9 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Symbol/ClangASTType.h"
-#include "lldb/Symbol/ClangNamespaceDecl.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
#include "lldb/Symbol/Type.h"
namespace lldb_private {
@@ -55,8 +56,7 @@ public:
{
}
- virtual
- ~SymbolFile()
+ ~SymbolFile() override
{
}
@@ -123,33 +123,43 @@ public:
virtual lldb::LanguageType ParseCompileUnitLanguage (const SymbolContext& sc) = 0;
virtual size_t ParseCompileUnitFunctions (const SymbolContext& sc) = 0;
virtual bool ParseCompileUnitLineTable (const SymbolContext& sc) = 0;
+ virtual bool ParseCompileUnitDebugMacros (const SymbolContext& sc) = 0;
virtual bool ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files) = 0;
virtual bool ParseImportedModules (const SymbolContext &sc, std::vector<ConstString> &imported_modules) = 0;
virtual size_t ParseFunctionBlocks (const SymbolContext& sc) = 0;
virtual size_t ParseTypes (const SymbolContext& sc) = 0;
virtual size_t ParseVariablesForContext (const SymbolContext& sc) = 0;
virtual Type* ResolveTypeUID (lldb::user_id_t type_uid) = 0;
- virtual bool ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type) = 0;
- virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid) { return NULL; }
- virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) { return NULL; }
+ virtual bool CompleteType (CompilerType &compiler_type) = 0;
+ virtual void ParseDeclsForContext (CompilerDeclContext decl_ctx) {}
+ virtual CompilerDecl GetDeclForUID (lldb::user_id_t uid) { return CompilerDecl(); }
+ virtual CompilerDeclContext GetDeclContextForUID (lldb::user_id_t uid) { return CompilerDeclContext(); }
+ virtual CompilerDeclContext GetDeclContextContainingUID (lldb::user_id_t uid) { return CompilerDeclContext(); }
virtual uint32_t ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0;
- virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0;
- virtual uint32_t FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) = 0;
- virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) = 0;
- virtual uint32_t FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) = 0;
- virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) = 0;
- virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) = 0;
+ virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list);
+ virtual uint32_t FindGlobalVariables (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, VariableList& variables);
+ virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables);
+ virtual uint32_t FindFunctions (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list);
+ virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list);
+ virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types);
+ virtual size_t FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
+
// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0;
virtual TypeList * GetTypeList ();
virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
uint32_t type_mask,
lldb_private::TypeList &type_list) = 0;
- virtual ClangASTContext &
- GetClangASTContext ();
- virtual ClangNamespaceDecl
+
+ virtual lldb_private::TypeSystem *
+ GetTypeSystemForLanguage (lldb::LanguageType language);
+
+ virtual CompilerDeclContext
FindNamespace (const SymbolContext& sc,
const ConstString &name,
- const ClangNamespaceDecl *parent_namespace_decl) = 0;
+ const CompilerDeclContext *parent_decl_ctx)
+ {
+ return CompilerDeclContext();
+ }
ObjectFile* GetObjectFile() { return m_obj_file; }
const ObjectFile* GetObjectFile() const { return m_obj_file; }
@@ -163,16 +173,15 @@ public:
{
}
-
protected:
ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
uint32_t m_abilities;
bool m_calculated_abilities;
+
private:
DISALLOW_COPY_AND_ASSIGN (SymbolFile);
};
-
} // namespace lldb_private
-#endif // liblldb_SymbolFile_h_
+#endif // liblldb_SymbolFile_h_
diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h
index 248918af2833b..19461718ed132 100644
--- a/include/lldb/Symbol/SymbolVendor.h
+++ b/include/lldb/Symbol/SymbolVendor.h
@@ -15,9 +15,8 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/TypeList.h"
-
+#include "lldb/Symbol/TypeMap.h"
namespace lldb_private {
@@ -45,8 +44,7 @@ public:
//------------------------------------------------------------------
SymbolVendor(const lldb::ModuleSP &module_sp);
- virtual
- ~SymbolVendor();
+ ~SymbolVendor() override;
void
AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
@@ -64,6 +62,9 @@ public:
ParseCompileUnitLineTable (const SymbolContext& sc);
virtual bool
+ ParseCompileUnitDebugMacros (const SymbolContext& sc);
+
+ virtual bool
ParseCompileUnitSupportFiles (const SymbolContext& sc,
FileSpecList& support_files);
@@ -97,7 +98,7 @@ public:
virtual size_t
FindGlobalVariables (const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
bool append,
size_t max_matches,
VariableList& variables);
@@ -110,7 +111,7 @@ public:
virtual size_t
FindFunctions (const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
uint32_t name_type_mask,
bool include_inlines,
bool append,
@@ -125,15 +126,18 @@ public:
virtual size_t
FindTypes (const SymbolContext& sc,
const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
+ const CompilerDeclContext *parent_decl_ctx,
bool append,
size_t max_matches,
- TypeList& types);
+ TypeMap& types);
- virtual ClangNamespaceDecl
+ virtual size_t
+ FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
+
+ virtual CompilerDeclContext
FindNamespace (const SymbolContext& sc,
const ConstString &name,
- const ClangNamespaceDecl *parent_namespace_decl);
+ const CompilerDeclContext *parent_decl_ctx);
virtual size_t
GetNumCompileUnits();
@@ -189,11 +193,11 @@ public:
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
- virtual ConstString
- GetPluginName();
+ ConstString
+ GetPluginName() override;
- virtual uint32_t
- GetPluginVersion();
+ uint32_t
+ GetPluginVersion() override;
protected:
//------------------------------------------------------------------
@@ -215,7 +219,6 @@ private:
DISALLOW_COPY_AND_ASSIGN (SymbolVendor);
};
-
} // namespace lldb_private
-#endif // liblldb_SymbolVendor_h_
+#endif // liblldb_SymbolVendor_h_
diff --git a/include/lldb/Symbol/TaggedASTType.h b/include/lldb/Symbol/TaggedASTType.h
index c44a5356f86d9..82431a5622870 100644
--- a/include/lldb/Symbol/TaggedASTType.h
+++ b/include/lldb/Symbol/TaggedASTType.h
@@ -10,33 +10,33 @@
#ifndef liblldb_TaggedASTType_h_
#define liblldb_TaggedASTType_h_
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
namespace lldb_private
{
// For cases in which there are multiple classes of types that are not
// interchangeable, to allow static type checking.
-template <unsigned int C> class TaggedASTType : public ClangASTType
+template <unsigned int C> class TaggedASTType : public CompilerType
{
public:
- TaggedASTType (const ClangASTType &clang_type) :
- ClangASTType(clang_type)
+ TaggedASTType (const CompilerType &compiler_type) :
+ CompilerType(compiler_type)
{
}
- TaggedASTType (lldb::clang_type_t type, clang::ASTContext *ast_context) :
- ClangASTType(ast_context, type)
+ TaggedASTType (lldb::opaque_compiler_type_t type, TypeSystem * type_system) :
+ CompilerType(type_system, type)
{
}
TaggedASTType (const TaggedASTType<C> &tw) :
- ClangASTType(tw)
+ CompilerType(tw)
{
}
TaggedASTType () :
- ClangASTType()
+ CompilerType()
{
}
@@ -47,7 +47,7 @@ public:
TaggedASTType<C> &operator= (const TaggedASTType<C> &tw)
{
- ClangASTType::operator= (tw);
+ CompilerType::operator= (tw);
return *this;
}
};
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index c1784cb364a86..224e0a112df3c 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -14,7 +14,8 @@
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Declaration.h"
#include "llvm/ADT/APSInt.h"
@@ -23,6 +24,31 @@
namespace lldb_private {
+//----------------------------------------------------------------------
+// CompilerContext allows an array of these items to be passed to
+// perform detailed lookups in SymbolVendor and SymbolFile functions.
+//----------------------------------------------------------------------
+struct CompilerContext
+{
+ CompilerContext (CompilerContextKind t, const ConstString &n) :
+ type(t),
+ name(n)
+ {
+ }
+
+ bool
+ operator == (const CompilerContext &rhs) const
+ {
+ return type == rhs.type && name == rhs.name;
+ }
+
+ void
+ Dump () const;
+
+ CompilerContextKind type;
+ ConstString name;
+};
+
class SymbolFileType :
public std::enable_shared_from_this<SymbolFileType>,
public UserID
@@ -34,6 +60,9 @@ class SymbolFileType :
{
}
+ SymbolFileType (SymbolFile &symbol_file, const lldb::TypeSP &type_sp);
+
+
~SymbolFileType ()
{
}
@@ -92,8 +121,8 @@ public:
lldb::user_id_t encoding_uid,
EncodingDataType encoding_uid_type,
const Declaration& decl,
- const ClangASTType &clang_qual_type,
- ResolveState clang_type_resolve_state);
+ const CompilerType &compiler_qual_type,
+ ResolveState compiler_type_resolve_state);
// This makes an invalid type. Used for functions that return a Type when they
// get an error.
@@ -239,22 +268,19 @@ public:
// Get the clang type, and resolve definitions for any
// class/struct/union/enum types completely.
- ClangASTType
- GetClangFullType ();
+ CompilerType
+ GetFullCompilerType ();
// Get the clang type, and resolve definitions enough so that the type could
// have layout performed. This allows ptrs and refs to class/struct/union/enum
// types remain forward declarations.
- ClangASTType
- GetClangLayoutType ();
+ CompilerType
+ GetLayoutCompilerType ();
// Get the clang type and leave class/struct/union/enum types as forward
// declarations if they haven't already been fully defined.
- ClangASTType
- GetClangForwardType ();
-
- ClangASTContext &
- GetClangASTContext ();
+ CompilerType
+ GetForwardCompilerType ();
static int
Compare(const Type &a, const Type &b);
@@ -275,12 +301,6 @@ public:
uint32_t
GetEncodingMask ();
- ClangASTType
- CreateClangTypedefType (Type *typedef_type, Type *base_type);
-
- bool
- IsRealObjCClass();
-
bool
IsCompleteObjCClass()
{
@@ -302,14 +322,14 @@ protected:
EncodingDataType m_encoding_uid_type;
uint64_t m_byte_size;
Declaration m_decl;
- ClangASTType m_clang_type;
+ CompilerType m_compiler_type;
struct Flags {
#ifdef __GNUC__
// using unsigned type here to work around a very noisy gcc warning
- unsigned clang_type_resolve_state : 2;
+ unsigned compiler_type_resolve_state : 2;
#else
- ResolveState clang_type_resolve_state : 2;
+ ResolveState compiler_type_resolve_state : 2;
#endif
bool is_complete_objc_class : 1;
} m_flags;
@@ -318,7 +338,7 @@ protected:
GetEncodingType ();
bool
- ResolveClangType (ResolveState clang_type_resolve_state);
+ ResolveClangType (ResolveState compiler_type_resolve_state);
};
// these classes are used to back the SBType* objects
@@ -327,28 +347,28 @@ class TypePair
{
public:
TypePair () :
- clang_type(),
+ compiler_type(),
type_sp()
{
}
- TypePair (ClangASTType type) :
- clang_type(type),
+ TypePair (CompilerType type) :
+ compiler_type(type),
type_sp()
{
}
TypePair (lldb::TypeSP type) :
- clang_type(),
- type_sp(type)
+ compiler_type(),
+ type_sp(type)
{
- clang_type = type_sp->GetClangForwardType();
+ compiler_type = type_sp->GetForwardCompilerType ();
}
bool
IsValid () const
{
- return clang_type.IsValid() || (type_sp.get() != nullptr);
+ return compiler_type.IsValid() || (type_sp.get() != nullptr);
}
explicit operator bool () const
@@ -359,21 +379,21 @@ public:
bool
operator == (const TypePair& rhs) const
{
- return clang_type == rhs.clang_type &&
+ return compiler_type == rhs.compiler_type &&
type_sp.get() == rhs.type_sp.get();
}
bool
operator != (const TypePair& rhs) const
{
- return clang_type != rhs.clang_type ||
+ return compiler_type != rhs.compiler_type ||
type_sp.get() != rhs.type_sp.get();
}
void
Clear ()
{
- clang_type.Clear();
+ compiler_type.Clear();
type_sp.reset();
}
@@ -382,8 +402,8 @@ public:
{
if (type_sp)
return type_sp->GetName();
- if (clang_type)
- return clang_type.GetTypeName();
+ if (compiler_type)
+ return compiler_type.GetTypeName();
return ConstString ();
}
@@ -391,24 +411,24 @@ public:
GetDisplayTypeName () const
{
if (type_sp)
- return type_sp->GetClangForwardType().GetDisplayTypeName();
- if (clang_type)
- return clang_type.GetDisplayTypeName();
+ return type_sp->GetForwardCompilerType ().GetDisplayTypeName();
+ if (compiler_type)
+ return compiler_type.GetDisplayTypeName();
return ConstString();
}
void
- SetType (ClangASTType type)
+ SetType (CompilerType type)
{
type_sp.reset();
- clang_type = type;
+ compiler_type = type;
}
void
SetType (lldb::TypeSP type)
{
type_sp = type;
- clang_type = type_sp->GetClangForwardType();
+ compiler_type = type_sp->GetForwardCompilerType ();
}
lldb::TypeSP
@@ -417,72 +437,76 @@ public:
return type_sp;
}
- ClangASTType
- GetClangASTType () const
+ CompilerType
+ GetCompilerType () const
{
- return clang_type;
+ return compiler_type;
}
- ClangASTType
+ CompilerType
GetPointerType () const
{
if (type_sp)
- return type_sp->GetClangLayoutType().GetPointerType();
- return clang_type.GetPointerType();
+ return type_sp->GetForwardCompilerType().GetPointerType();
+ return compiler_type.GetPointerType();
}
- ClangASTType
+ CompilerType
GetPointeeType () const
{
if (type_sp)
- return type_sp->GetClangFullType().GetPointeeType();
- return clang_type.GetPointeeType();
+ return type_sp->GetForwardCompilerType ().GetPointeeType();
+ return compiler_type.GetPointeeType();
}
- ClangASTType
+ CompilerType
GetReferenceType () const
{
if (type_sp)
- return type_sp->GetClangLayoutType().GetLValueReferenceType();
- return clang_type.GetLValueReferenceType();
+ return type_sp->GetForwardCompilerType ().GetLValueReferenceType();
+ else
+ return compiler_type.GetLValueReferenceType();
}
- ClangASTType
+ CompilerType
GetTypedefedType () const
{
if (type_sp)
- return type_sp->GetClangFullType().GetTypedefedType();
- return clang_type.GetTypedefedType();
+ return type_sp->GetForwardCompilerType ().GetTypedefedType();
+ else
+ return compiler_type.GetTypedefedType();
}
- ClangASTType
+ CompilerType
GetDereferencedType () const
{
if (type_sp)
- return type_sp->GetClangFullType().GetNonReferenceType();
- return clang_type.GetNonReferenceType();
+ return type_sp->GetForwardCompilerType ().GetNonReferenceType();
+ else
+ return compiler_type.GetNonReferenceType();
}
- ClangASTType
+ CompilerType
GetUnqualifiedType () const
{
if (type_sp)
- return type_sp->GetClangLayoutType().GetFullyUnqualifiedType();
- return clang_type.GetFullyUnqualifiedType();
+ return type_sp->GetForwardCompilerType ().GetFullyUnqualifiedType();
+ else
+ return compiler_type.GetFullyUnqualifiedType();
}
- ClangASTType
+ CompilerType
GetCanonicalType () const
{
if (type_sp)
- return type_sp->GetClangFullType().GetCanonicalType();
- return clang_type.GetCanonicalType();
+ return type_sp->GetForwardCompilerType ().GetCanonicalType();
+ return compiler_type.GetCanonicalType();
}
- clang::ASTContext *
- GetClangASTContext () const
+ TypeSystem *
+ GetTypeSystem () const
{
- return clang_type.GetASTContext();
+ return compiler_type.GetTypeSystem();
}
lldb::ModuleSP
@@ -493,10 +517,13 @@ public:
return lldb::ModuleSP();
}
protected:
- ClangASTType clang_type;
+ CompilerType compiler_type;
lldb::TypeSP type_sp;
};
+// the two classes here are used by the public API as a backend to
+// the SBType and SBTypeList classes
+
class TypeImpl
{
public:
@@ -509,28 +536,28 @@ public:
TypeImpl (const lldb::TypeSP &type_sp);
- TypeImpl (const ClangASTType &clang_type);
+ TypeImpl (const CompilerType &compiler_type);
- TypeImpl (const lldb::TypeSP &type_sp, const ClangASTType &dynamic);
+ TypeImpl (const lldb::TypeSP &type_sp, const CompilerType &dynamic);
- TypeImpl (const ClangASTType &clang_type, const ClangASTType &dynamic);
+ TypeImpl (const CompilerType &compiler_type, const CompilerType &dynamic);
- TypeImpl (const TypePair &pair, const ClangASTType &dynamic);
+ TypeImpl (const TypePair &pair, const CompilerType &dynamic);
void
SetType (const lldb::TypeSP &type_sp);
void
- SetType (const ClangASTType &clang_type);
+ SetType (const CompilerType &compiler_type);
void
- SetType (const lldb::TypeSP &type_sp, const ClangASTType &dynamic);
+ SetType (const lldb::TypeSP &type_sp, const CompilerType &dynamic);
void
- SetType (const ClangASTType &clang_type, const ClangASTType &dynamic);
+ SetType (const CompilerType &compiler_type, const CompilerType &dynamic);
void
- SetType (const TypePair &pair, const ClangASTType &dynamic);
+ SetType (const TypePair &pair, const CompilerType &dynamic);
TypeImpl&
operator = (const TypeImpl& rhs);
@@ -575,11 +602,11 @@ public:
TypeImpl
GetCanonicalType() const;
- ClangASTType
- GetClangASTType (bool prefer_dynamic);
+ CompilerType
+ GetCompilerType (bool prefer_dynamic);
- clang::ASTContext *
- GetClangASTContext (bool prefer_dynamic);
+ TypeSystem *
+ GetTypeSystem (bool prefer_dynamic);
bool
GetDescription (lldb_private::Stream &strm,
@@ -592,7 +619,7 @@ private:
lldb::ModuleWP m_module_wp;
TypePair m_static_type;
- ClangASTType m_dynamic_type;
+ CompilerType m_dynamic_type;
};
class TypeListImpl
@@ -750,7 +777,7 @@ class TypeAndOrName
public:
TypeAndOrName ();
TypeAndOrName (lldb::TypeSP &type_sp);
- TypeAndOrName (const ClangASTType &clang_type);
+ TypeAndOrName (const CompilerType &compiler_type);
TypeAndOrName (const char *type_str);
TypeAndOrName (const TypeAndOrName &rhs);
TypeAndOrName (ConstString &type_const_string);
@@ -772,10 +799,10 @@ public:
return m_type_pair.GetTypeSP();
}
- ClangASTType
- GetClangASTType () const
+ CompilerType
+ GetCompilerType () const
{
- return m_type_pair.GetClangASTType();
+ return m_type_pair.GetCompilerType();
}
void
@@ -788,7 +815,7 @@ public:
SetTypeSP (lldb::TypeSP type_sp);
void
- SetClangASTType (ClangASTType clang_type);
+ SetCompilerType (CompilerType compiler_type);
bool
IsEmpty () const;
@@ -800,12 +827,12 @@ public:
HasTypeSP () const;
bool
- HasClangASTType () const;
+ HasCompilerType () const;
bool
HasType () const
{
- return HasTypeSP() || HasClangASTType();
+ return HasTypeSP() || HasCompilerType();
}
void
@@ -825,60 +852,43 @@ class TypeMemberFunctionImpl
{
public:
TypeMemberFunctionImpl() :
- m_type(),
- m_objc_method_decl(nullptr),
+ m_type (),
+ m_decl (),
m_name(),
- m_kind(lldb::eMemberFunctionKindUnknown)
+ m_kind (lldb::eMemberFunctionKindUnknown)
{
}
- TypeMemberFunctionImpl (const ClangASTType& type,
+ TypeMemberFunctionImpl (const CompilerType& type,
+ const CompilerDecl& decl,
const std::string& name,
const lldb::MemberFunctionKind& kind) :
- m_type(type),
- m_objc_method_decl(nullptr),
+ m_type (type),
+ m_decl (decl),
m_name(name),
- m_kind(kind)
- {
- }
-
- TypeMemberFunctionImpl (clang::ObjCMethodDecl *method,
- const std::string& name,
- const lldb::MemberFunctionKind& kind) :
- m_type(),
- m_objc_method_decl(method),
- m_name(name),
- m_kind(kind)
- {
- }
-
- TypeMemberFunctionImpl (const TypeMemberFunctionImpl& rhs) :
- m_type(rhs.m_type),
- m_objc_method_decl(rhs.m_objc_method_decl),
- m_name(rhs.m_name),
- m_kind(rhs.m_kind)
+ m_kind (kind)
{
}
- TypeMemberFunctionImpl&
- operator = (const TypeMemberFunctionImpl& rhs);
-
bool
IsValid ();
ConstString
GetName () const;
-
- ClangASTType
+
+ ConstString
+ GetMangledName () const;
+
+ CompilerType
GetType () const;
- ClangASTType
+ CompilerType
GetReturnType () const;
size_t
GetNumArguments () const;
- ClangASTType
+ CompilerType
GetArgumentAtIndex (size_t idx) const;
lldb::MemberFunctionKind
@@ -892,8 +902,8 @@ protected:
GetPrintableTypeName ();
private:
- ClangASTType m_type;
- clang::ObjCMethodDecl *m_objc_method_decl;
+ CompilerType m_type;
+ CompilerDecl m_decl;
ConstString m_name;
lldb::MemberFunctionKind m_kind;
};
@@ -909,8 +919,9 @@ public:
{
}
- TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,
- const lldb_private::ClangASTType& integer_type);
+ TypeEnumMemberImpl (const lldb::TypeImplSP &integer_type_sp,
+ const ConstString &name,
+ const llvm::APSInt &value);
TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) :
m_integer_type_sp(rhs.m_integer_type_sp),
diff --git a/include/lldb/Symbol/TypeList.h b/include/lldb/Symbol/TypeList.h
index 4f3f2c9bdbeba..f3642576ddcb4 100644
--- a/include/lldb/Symbol/TypeList.h
+++ b/include/lldb/Symbol/TypeList.h
@@ -13,7 +13,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Iterable.h"
-#include <map>
+#include <vector>
#include <functional>
namespace lldb_private {
@@ -24,7 +24,7 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- TypeList();
+ TypeList();
virtual
~TypeList();
@@ -44,17 +44,14 @@ public:
void
Insert (const lldb::TypeSP& type);
- bool
- InsertUnique (const lldb::TypeSP& type);
-
uint32_t
GetSize() const;
lldb::TypeSP
GetTypeAtIndex(uint32_t idx);
- typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
- typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
+ typedef std::vector<lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter> TypeIterable;
TypeIterable
Types ()
@@ -68,8 +65,6 @@ public:
void
ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback);
- bool
- RemoveTypeWithUID (lldb::user_id_t uid);
void
RemoveMismatchedTypes (const char *qualified_typename,
diff --git a/include/lldb/Symbol/TypeMap.h b/include/lldb/Symbol/TypeMap.h
new file mode 100644
index 0000000000000..4398acd789ae5
--- /dev/null
+++ b/include/lldb/Symbol/TypeMap.h
@@ -0,0 +1,98 @@
+//===-- TypeMap.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TypeMap_h_
+#define liblldb_TypeMap_h_
+
+#include "lldb/lldb-private.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Iterable.h"
+#include <map>
+#include <functional>
+
+namespace lldb_private {
+
+class TypeMap
+{
+public:
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ TypeMap();
+
+ virtual
+ ~TypeMap();
+
+ void
+ Clear();
+
+ void
+ Dump(Stream *s, bool show_context);
+
+ TypeMap
+ FindTypes(const ConstString &name);
+
+ void
+ Insert (const lldb::TypeSP& type);
+
+ bool
+ Empty() const;
+
+ bool
+ InsertUnique (const lldb::TypeSP& type);
+
+ uint32_t
+ GetSize() const;
+
+ lldb::TypeSP
+ GetTypeAtIndex(uint32_t idx);
+
+ typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
+
+ TypeIterable
+ Types ()
+ {
+ return TypeIterable(m_types);
+ }
+
+ void
+ ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const;
+
+ void
+ ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback);
+
+ bool
+ Remove (const lldb::TypeSP &type_sp);
+
+ void
+ RemoveMismatchedTypes (const char *qualified_typename,
+ bool exact_match);
+
+ void
+ RemoveMismatchedTypes (const std::string &type_scope,
+ const std::string &type_basename,
+ lldb::TypeClass type_class,
+ bool exact_match);
+
+ void
+ RemoveMismatchedTypes (lldb::TypeClass type_class);
+
+private:
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ collection m_types;
+
+ DISALLOW_COPY_AND_ASSIGN (TypeMap);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_TypeMap_h_
diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h
new file mode 100644
index 0000000000000..d367bcdc0b14f
--- /dev/null
+++ b/include/lldb/Symbol/TypeSystem.h
@@ -0,0 +1,604 @@
+//===-- TypeSystem.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TypeSystem_h_
+#define liblldb_TypeSystem_h_
+
+// C Includes
+// C++ Includes
+#include <functional>
+#include <map>
+#include <string>
+
+// Other libraries and framework includes
+#include "llvm/ADT/APSInt.h"
+#include "llvm/Support/Casting.h"
+
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Host/Mutex.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
+
+class DWARFDIE;
+class DWARFASTParser;
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+// Interface for representing the Type Systems in different languages.
+//----------------------------------------------------------------------
+class TypeSystem : public PluginInterface
+{
+public:
+ //----------------------------------------------------------------------
+ // Intrusive type system that allows us to use llvm casting.
+ //
+ // To add a new type system:
+ //
+ // 1 - Add a new enumeration for llvm casting below for your TypeSystem
+ // subclass, here we will use eKindFoo
+ //
+ // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs
+ // to implement a static classof() function that returns your
+ // enumeration:
+ //
+ // class Foo : public lldb_private::TypeSystem
+ // {
+ // static bool classof(const TypeSystem *ts)
+ // {
+ // return ts->getKind() == TypeSystem::eKindFoo;
+ // }
+ // };
+ //
+ // 3 - Contruct your TypeSystem subclass with the enumeration from below
+ //
+ // Foo() :
+ // TypeSystem(TypeSystem::eKindFoo),
+ // ...
+ // {
+ // }
+ //
+ // Then you can use the llvm casting on any "TypeSystem *" to get an
+ // instance of your subclass.
+ //----------------------------------------------------------------------
+ enum LLVMCastKind {
+ eKindClang,
+ eKindSwift,
+ eKindGo,
+ kNumKinds
+ };
+
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ TypeSystem(LLVMCastKind kind);
+
+ ~TypeSystem() override;
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, Module *module);
+
+ static lldb::TypeSystemSP
+ CreateInstance (lldb::LanguageType language, Target *target);
+
+ virtual DWARFASTParser *
+ GetDWARFParser ()
+ {
+ return nullptr;
+ }
+
+ virtual SymbolFile *
+ GetSymbolFile () const
+ {
+ return m_sym_file;
+ }
+
+ // Returns true if the symbol file changed during the set accessor.
+ virtual void
+ SetSymbolFile (SymbolFile *sym_file)
+ {
+ m_sym_file = sym_file;
+ }
+
+ //----------------------------------------------------------------------
+ // CompilerDecl functions
+ //----------------------------------------------------------------------
+ virtual ConstString
+ DeclGetName (void *opaque_decl) = 0;
+
+ virtual ConstString
+ DeclGetMangledName (void *opaque_decl);
+
+ virtual lldb::VariableSP
+ DeclGetVariable (void *opaque_decl) = 0;
+
+ virtual void
+ DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) = 0;
+
+ virtual CompilerDeclContext
+ DeclGetDeclContext (void *opaque_decl);
+
+ virtual CompilerType
+ DeclGetFunctionReturnType(void *opaque_decl);
+
+ virtual size_t
+ DeclGetFunctionNumArguments(void *opaque_decl);
+
+ virtual CompilerType
+ DeclGetFunctionArgumentType (void *opaque_decl, size_t arg_idx);
+
+ //----------------------------------------------------------------------
+ // CompilerDeclContext functions
+ //----------------------------------------------------------------------
+
+ virtual std::vector<CompilerDecl>
+ DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
+
+ virtual bool
+ DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0;
+
+ virtual ConstString
+ DeclContextGetName (void *opaque_decl_ctx) = 0;
+
+ virtual bool
+ DeclContextIsClassMethod (void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) = 0;
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ virtual bool
+ IsArrayType (lldb::opaque_compiler_type_t type,
+ CompilerType *element_type,
+ uint64_t *size,
+ bool *is_incomplete) = 0;
+
+ virtual bool
+ IsAggregateType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsAnonymousType (lldb::opaque_compiler_type_t type);
+
+ virtual bool
+ IsCharType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsCompleteType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsDefined(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsFloatingPointType (lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) = 0;
+
+ virtual bool
+ IsFunctionType (lldb::opaque_compiler_type_t type, bool *is_variadic_ptr) = 0;
+
+ virtual size_t
+ GetNumberOfFunctionArguments (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetFunctionArgumentAtIndex (lldb::opaque_compiler_type_t type, const size_t index) = 0;
+
+ virtual bool
+ IsFunctionPointerType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsIntegerType (lldb::opaque_compiler_type_t type, bool &is_signed) = 0;
+
+ virtual bool
+ IsPossibleDynamicType (lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass NULL
+ bool check_cplusplus,
+ bool check_objc) = 0;
+
+ virtual bool
+ IsPointerType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) = 0;
+
+ virtual bool
+ IsScalarType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsVoidType (lldb::opaque_compiler_type_t type) = 0;
+
+ // TypeSystems can support more than one language
+ virtual bool
+ SupportsLanguage (lldb::LanguageType language) = 0;
+
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
+
+ virtual bool
+ GetCompleteType (lldb::opaque_compiler_type_t type) = 0;
+
+ //----------------------------------------------------------------------
+ // AST related queries
+ //----------------------------------------------------------------------
+
+ virtual uint32_t
+ GetPointerByteSize () = 0;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ virtual ConstString
+ GetTypeName (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ GetTypeInfo (lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) = 0;
+
+ virtual lldb::LanguageType
+ GetMinimumLanguage (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual lldb::TypeClass
+ GetTypeClass (lldb::opaque_compiler_type_t type) = 0;
+
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
+
+ virtual CompilerType
+ GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_t *stride) = 0;
+
+ virtual CompilerType
+ GetCanonicalType (lldb::opaque_compiler_type_t type) = 0;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a prototype
+ // Returns a value >= 0 if there is a prototype.
+ virtual int
+ GetFunctionArgumentCount (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetFunctionArgumentTypeAtIndex (lldb::opaque_compiler_type_t type, size_t idx) = 0;
+
+ virtual CompilerType
+ GetFunctionReturnType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual size_t
+ GetNumMemberFunctions (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex (lldb::opaque_compiler_type_t type, size_t idx) = 0;
+
+ virtual CompilerType
+ GetPointeeType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetPointerType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetLValueReferenceType (lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ GetRValueReferenceType (lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ AddConstModifier (lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ AddVolatileModifier (lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ AddRestrictModifier (lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ CreateTypedef (lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx);
+
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
+
+ virtual uint64_t
+ GetBitSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) = 0;
+
+ virtual lldb::Encoding
+ GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count) = 0;
+
+ virtual lldb::Format
+ GetFormat (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ GetNumChildren (lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) = 0;
+
+ virtual CompilerType
+ GetBuiltinTypeByName (const ConstString &name);
+
+ virtual lldb::BasicType
+ GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual void
+ ForEachEnumerator (lldb::opaque_compiler_type_t type, std::function <bool (const CompilerType &integer_type, const ConstString &name, const llvm::APSInt &value)> const &callback)
+ {
+ }
+
+ virtual uint32_t
+ GetNumFields (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetFieldAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ std::string& name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) = 0;
+
+ virtual uint32_t
+ GetNumDirectBaseClasses (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ GetNumVirtualBaseClasses (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetDirectBaseClassAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) = 0;
+
+ virtual CompilerType
+ GetVirtualBaseClassAtIndex (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) = 0;
+
+ virtual CompilerType
+ GetChildCompilerTypeAtIndex (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ size_t idx,
+ bool transparent_pointers,
+ bool omit_empty_base_classes,
+ bool ignore_array_bounds,
+ std::string& child_name,
+ uint32_t &child_byte_size,
+ int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class,
+ bool &child_is_deref_of_parent,
+ ValueObject *valobj,
+ uint64_t &language_flags) = 0;
+
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ virtual uint32_t
+ GetIndexOfChildWithName (lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) = 0;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ virtual size_t
+ GetIndexOfChildMemberWithName (lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes,
+ std::vector<uint32_t>& child_indexes) = 0;
+
+ virtual size_t
+ GetNumTemplateArguments (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetTemplateArgument (lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) = 0;
+
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+
+ virtual void
+ DumpValue (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ Stream *s,
+ lldb::Format format,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset,
+ bool show_types,
+ bool show_summary,
+ bool verbose,
+ uint32_t depth) = 0;
+
+ virtual bool
+ DumpTypeValue (lldb::opaque_compiler_type_t type,
+ Stream *s,
+ lldb::Format format,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) = 0;
+
+ virtual void
+ DumpTypeDescription (lldb::opaque_compiler_type_t type) = 0; // Dump to stdout
+
+ virtual void
+ DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream *s) = 0;
+
+ //----------------------------------------------------------------------
+ // TODO: These methods appear unused. Should they be removed?
+ //----------------------------------------------------------------------
+
+ virtual bool
+ IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual void
+ DumpSummary (lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx,
+ Stream *s,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size) = 0;
+
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ virtual size_t
+ ConvertStringToFloatValue (lldb::opaque_compiler_type_t type,
+ const char *s,
+ uint8_t *dst,
+ size_t dst_size) = 0;
+
+ //----------------------------------------------------------------------
+ // TODO: Determine if these methods should move to ClangASTContext.
+ //----------------------------------------------------------------------
+
+ virtual bool
+ IsPointerOrReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) = 0;
+
+ virtual unsigned
+ GetTypeQualifiers(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsCStringType (lldb::opaque_compiler_type_t type, uint32_t &length) = 0;
+
+ virtual size_t
+ GetTypeBitAlign (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetBasicTypeFromAST (lldb::BasicType basic_type) = 0;
+
+ virtual CompilerType
+ GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) = 0;
+
+ virtual bool
+ IsBeingDefined (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsConst(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ IsHomogeneousAggregate (lldb::opaque_compiler_type_t type, CompilerType* base_type_ptr) = 0;
+
+ virtual bool
+ IsPolymorphicClass (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsTypedefType (lldb::opaque_compiler_type_t type) = 0;
+
+ // If the current object represents a typedef type, get the underlying type
+ virtual CompilerType
+ GetTypedefedType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsVectorType (lldb::opaque_compiler_type_t type,
+ CompilerType *element_type,
+ uint64_t *size) = 0;
+
+ virtual CompilerType
+ GetFullyUnqualifiedType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetNonReferenceType (lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool
+ IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool* is_rvalue) = 0;
+
+ virtual bool
+ ShouldTreatScalarValueAsAddress (lldb::opaque_compiler_type_t type)
+ {
+ return IsPointerOrReferenceType(type, nullptr);
+ }
+
+ virtual UserExpression *
+ GetUserExpression (const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options)
+ {
+ return nullptr;
+ }
+
+ virtual FunctionCaller *
+ GetFunctionCaller (const CompilerType &return_type,
+ const Address& function_address,
+ const ValueList &arg_value_list,
+ const char *name)
+ {
+ return nullptr;
+ }
+
+ virtual UtilityFunction *
+ GetUtilityFunction(const char *text, const char *name)
+ {
+ return nullptr;
+ }
+
+ virtual PersistentExpressionState *
+ GetPersistentExpressionState()
+ {
+ return nullptr;
+ }
+
+ virtual CompilerType
+ GetTypeForFormatters (void* type);
+
+ virtual LazyBool
+ ShouldPrintAsOneLiner (void* type, ValueObject* valobj);
+
+ // Type systems can have types that are placeholder types, which are meant to indicate
+ // the presence of a type, but offer no actual information about said types, and leave
+ // the burden of actually figuring type information out to dynamic type resolution. For instance
+ // a language with a generics system, can use placeholder types to indicate "type argument goes here",
+ // without promising uniqueness of the placeholder, nor attaching any actually idenfiable information
+ // to said placeholder. This API allows type systems to tell LLDB when such a type has been encountered
+ // In response, the debugger can react by not using this type as a cache entry in any type-specific way
+ // For instance, LLDB will currently not cache any formatters that are discovered on such a type as
+ // attributable to the meaningless type itself, instead preferring to use the dynamic type
+ virtual bool
+ IsMeaninglessWithoutDynamicResolution (void* type);
+
+protected:
+ const LLVMCastKind m_kind; // Support for llvm casting
+ SymbolFile *m_sym_file;
+
+};
+
+ class TypeSystemMap
+ {
+ public:
+ TypeSystemMap ();
+ ~TypeSystemMap();
+
+ void
+ Clear ();
+
+ // Iterate through all of the type systems that are created. Return true
+ // from callback to keep iterating, false to stop iterating.
+ void
+ ForEach (std::function <bool(TypeSystem *)> const &callback);
+
+ TypeSystem *
+ GetTypeSystemForLanguage (lldb::LanguageType language, Module *module, bool can_create);
+
+ TypeSystem *
+ GetTypeSystemForLanguage (lldb::LanguageType language, Target *target, bool can_create);
+
+ protected:
+ typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
+ mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
+ collection m_map;
+ };
+
+} // namespace lldb_private
+
+#endif // liblldb_TypeSystem_h_
diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h
index bfc008a5b6bce..71100138413d9 100644
--- a/include/lldb/Symbol/UnwindPlan.h
+++ b/include/lldb/Symbol/UnwindPlan.h
@@ -1,14 +1,28 @@
+//===-- UnwindPlan.h --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
#ifndef liblldb_UnwindPlan_h
#define liblldb_UnwindPlan_h
+// C Includes
+// C++ Includes
+#include <map>
+#include <memory>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ConstString.h"
-#include <map>
-#include <vector>
-
namespace lldb_private {
// The UnwindPlan object specifies how to unwind out of a function - where
@@ -38,13 +52,11 @@ namespace lldb_private {
class UnwindPlan {
public:
-
class Row {
public:
class RegisterLocation
{
public:
-
enum RestoreType
{
unspecified, // not specified, we may be able to assume this
@@ -187,7 +199,7 @@ public:
}
else
{
- *opcodes = NULL;
+ *opcodes = nullptr;
len = 0;
}
}
@@ -203,7 +215,7 @@ public:
{
if (m_type == atDWARFExpression || m_type == isDWARFExpression)
return m_location.expr.opcodes;
- return NULL;
+ return nullptr;
}
int
@@ -240,7 +252,6 @@ public:
class CFAValue
{
public:
-
enum ValueType
{
unspecified, // not specified
@@ -361,7 +372,7 @@ public:
}
else
{
- *opcodes = NULL;
+ *opcodes = nullptr;
len = 0;
}
}
@@ -371,7 +382,7 @@ public:
{
if (m_type == isDWARFExpression)
return m_value.expr.opcodes;
- return NULL;
+ return nullptr;
}
int
@@ -488,7 +499,6 @@ public:
}; // class Row
public:
-
typedef std::shared_ptr<Row> RowSP;
UnwindPlan (lldb::RegisterKind reg_kind) :
@@ -520,9 +530,7 @@ public:
m_row_list.emplace_back (new Row (*row_sp));
}
- ~UnwindPlan ()
- {
- }
+ ~UnwindPlan() = default;
void
Dump (Stream& s, Thread* thread, lldb::addr_t base_addr) const;
@@ -676,8 +684,6 @@ public:
}
private:
-
-
typedef std::vector<RowSP> collection;
collection m_row_list;
AddressRange m_plan_valid_address_range;
@@ -697,4 +703,4 @@ private:
} // namespace lldb_private
-#endif //liblldb_UnwindPlan_h
+#endif // liblldb_UnwindPlan_h
diff --git a/include/lldb/Symbol/UnwindTable.h b/include/lldb/Symbol/UnwindTable.h
index 38d3ff6dd3c9a..f69e4660de24e 100644
--- a/include/lldb/Symbol/UnwindTable.h
+++ b/include/lldb/Symbol/UnwindTable.h
@@ -34,6 +34,9 @@ public:
lldb_private::CompactUnwindInfo *
GetCompactUnwindInfo ();
+ ArmUnwindInfo *
+ GetArmUnwindInfo ();
+
lldb::FuncUnwindersSP
GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
@@ -65,9 +68,10 @@ private:
bool m_initialized; // delay some initialization until ObjectFile is set up
Mutex m_mutex;
- DWARFCallFrameInfo* m_eh_frame;
- CompactUnwindInfo *m_compact_unwind;
-
+ std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
+ std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
+ std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up;
+
DISALLOW_COPY_AND_ASSIGN (UnwindTable);
};
diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h
index 8d413cac3d7de..1cac5d0c56498 100644
--- a/include/lldb/Symbol/Variable.h
+++ b/include/lldb/Symbol/Variable.h
@@ -1,4 +1,5 @@
-//===-- Variable.h ----------------------------------------------*- C++ -*-===//
+//===-- Variable.h ----------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,6 +11,7 @@
#ifndef liblldb_Variable_h_
#define liblldb_Variable_h_
+#include <memory>
#include <vector>
#include "lldb/lldb-private.h"
@@ -21,7 +23,8 @@
namespace lldb_private {
-class Variable : public UserID
+class Variable : public UserID,
+ public std::enable_shared_from_this<Variable>
{
public:
//------------------------------------------------------------------
@@ -36,7 +39,8 @@ public:
Declaration* decl,
const DWARFExpression& location,
bool external,
- bool artificial);
+ bool artificial,
+ bool static_member = false);
virtual
~Variable();
@@ -58,6 +62,9 @@ public:
ConstString
GetName() const;
+ ConstString
+ GetUnqualifiedName() const;
+
SymbolContextScope *
GetSymbolContextScope() const
{
@@ -99,6 +106,11 @@ public:
return m_artificial;
}
+ bool IsStaticMember() const
+ {
+ return m_static_member;
+ }
+
DWARFExpression &
LocationExpression()
{
@@ -161,6 +173,11 @@ public:
StringList &matches,
bool &word_complete);
+ CompilerDeclContext
+ GetDeclContext ();
+
+ CompilerDecl
+ GetDecl ();
protected:
ConstString m_name; // The basename of the variable (no namespaces)
Mangled m_mangled; // The mangled name of the variable
@@ -171,7 +188,8 @@ protected:
DWARFExpression m_location; // The location of this variable that can be fed to DWARFExpression::Evaluate()
uint8_t m_external:1, // Visible outside the containing compile unit?
m_artificial:1, // Non-zero if the variable is not explicitly declared in source
- m_loc_is_const_data:1; // The m_location expression contains the constant variable value data, not a DWARF location
+ m_loc_is_const_data:1, // The m_location expression contains the constant variable value data, not a DWARF location
+ m_static_member:1; // Non-zero if variable is static member of a class or struct.
private:
Variable(const Variable& rhs);
Variable& operator=(const Variable& rhs);
diff --git a/include/lldb/Symbol/VariableList.h b/include/lldb/Symbol/VariableList.h
index 5f8f2a225650b..1c1d5dfefb9ef 100644
--- a/include/lldb/Symbol/VariableList.h
+++ b/include/lldb/Symbol/VariableList.h
@@ -48,10 +48,10 @@ public:
RemoveVariableAtIndex (size_t idx);
lldb::VariableSP
- FindVariable (const ConstString& name);
+ FindVariable (const ConstString& name, bool include_static_members = true);
lldb::VariableSP
- FindVariable (const ConstString& name, lldb::ValueType value_type);
+ FindVariable (const ConstString& name, lldb::ValueType value_type, bool include_static_members = true);
uint32_t
FindVariableIndex (const lldb::VariableSP &var_sp);
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index 89d4f6bdba6cc..94826d1735002 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -44,8 +44,7 @@ public:
std::unique_ptr<uint8_t[]> data_ap; /* host data pointer */
};
- virtual
- ~ABI();
+ ~ABI() override;
virtual size_t
GetRedZoneSize () const = 0;
@@ -78,7 +77,7 @@ public:
lldb::ValueObjectSP
GetReturnValueObject (Thread &thread,
- ClangASTType &type,
+ CompilerType &type,
bool persistent = true) const;
// specialized to work with llvm IR types
@@ -95,7 +94,7 @@ protected:
// This is the method the ABI will call to actually calculate the return value.
// Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
virtual lldb::ValueObjectSP
- GetReturnValueObjectImpl (Thread &thread, ClangASTType &ast_type) const = 0;
+ GetReturnValueObjectImpl (Thread &thread, CompilerType &ast_type) const = 0;
// specialized to work with llvm IR types
virtual lldb::ValueObjectSP
@@ -148,14 +147,17 @@ public:
FindPlugin (const ArchSpec &arch);
protected:
+
//------------------------------------------------------------------
// Classes that inherit from ABI can see and modify these
//------------------------------------------------------------------
ABI();
+
private:
+
DISALLOW_COPY_AND_ASSIGN (ABI);
};
} // namespace lldb_private
-#endif // liblldb_ABI_h_
+#endif // liblldb_ABI_h_
diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h
index 3e51453566b31..ac537d0ad1e50 100644
--- a/include/lldb/Target/CPPLanguageRuntime.h
+++ b/include/lldb/Target/CPPLanguageRuntime.h
@@ -25,100 +25,10 @@ class CPPLanguageRuntime :
public LanguageRuntime
{
public:
+ ~CPPLanguageRuntime() override;
- class MethodName
- {
- public:
- enum Type
- {
- eTypeInvalid,
- eTypeUnknownMethod,
- eTypeClassMethod,
- eTypeInstanceMethod
- };
-
- MethodName () :
- m_full(),
- m_basename(),
- m_context(),
- m_arguments(),
- m_qualifiers(),
- m_type (eTypeInvalid),
- m_parsed (false),
- m_parse_error (false)
- {
- }
-
- MethodName (const ConstString &s) :
- m_full(s),
- m_basename(),
- m_context(),
- m_arguments(),
- m_qualifiers(),
- m_type (eTypeInvalid),
- m_parsed (false),
- m_parse_error (false)
- {
- }
-
- void
- Clear();
-
- bool
- IsValid ()
- {
- if (!m_parsed)
- Parse();
- if (m_parse_error)
- return false;
- if (m_type == eTypeInvalid)
- return false;
- return (bool)m_full;
- }
-
- Type
- GetType () const
- {
- return m_type;
- }
-
- const ConstString &
- GetFullName () const
- {
- return m_full;
- }
-
- llvm::StringRef
- GetBasename ();
-
- llvm::StringRef
- GetContext ();
-
- llvm::StringRef
- GetArguments ();
-
- llvm::StringRef
- GetQualifiers ();
-
- protected:
- void
- Parse();
-
- ConstString m_full; // Full name: "lldb::SBTarget::GetBreakpointAtIndex(unsigned int) const"
- llvm::StringRef m_basename; // Basename: "GetBreakpointAtIndex"
- llvm::StringRef m_context; // Decl context: "lldb::SBTarget"
- llvm::StringRef m_arguments; // Arguments: "(unsigned int)"
- llvm::StringRef m_qualifiers; // Qualifiers: "const"
- Type m_type;
- bool m_parsed;
- bool m_parse_error;
- };
-
- virtual
- ~CPPLanguageRuntime();
-
- virtual lldb::LanguageType
- GetLanguageType () const
+ lldb::LanguageType
+ GetLanguageType() const override
{
return lldb::eLanguageTypeC_plus_plus;
}
@@ -126,45 +36,27 @@ public:
virtual bool
IsVTableName (const char *name) = 0;
- virtual bool
- GetObjectDescription (Stream &str, ValueObject &object);
-
- virtual bool
- GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
+ bool
+ GetObjectDescription(Stream &str, ValueObject &object) override;
- static bool
- IsCPPMangledName(const char *name);
-
- // Extract C++ context and identifier from a string using heuristic matching (as opposed to
- // CPPLanguageRuntime::MethodName which has to have a fully qualified C++ name with parens and arguments.
- // If the name is a lone C identifier (e.g. C) or a qualified C identifier (e.g. A::B::C) it will return true,
- // and identifier will be the identifier (C and C respectively) and the context will be "" and "A::B::" respectively.
- // If the name fails the heuristic matching for a qualified or unqualified C/C++ identifier, then it will return false
- // and identifier and context will be unchanged.
-
- static bool
- ExtractContextAndIdentifier (const char *name, llvm::StringRef &context, llvm::StringRef &identifier);
+ bool
+ GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override;
- // in some cases, compilers will output different names for one same type. when that happens, it might be impossible
- // to construct SBType objects for a valid type, because the name that is available is not the same as the name that
- // can be used as a search key in FindTypes(). the equivalents map here is meant to return possible alternative names
- // for a type through which a search can be conducted. Currently, this is only enabled for C++ but can be extended
- // to ObjC or other languages if necessary
- static uint32_t
- FindEquivalentNames(ConstString type_name, std::vector<ConstString>& equivalents);
-
virtual size_t
GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates) = 0;
protected:
+
//------------------------------------------------------------------
// Classes that inherit from CPPLanguageRuntime can see and modify these
//------------------------------------------------------------------
CPPLanguageRuntime(Process *process);
+
private:
+
DISALLOW_COPY_AND_ASSIGN (CPPLanguageRuntime);
};
} // namespace lldb_private
-#endif // liblldb_CPPLanguageRuntime_h_
+#endif // liblldb_CPPLanguageRuntime_h_
diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h
index 6652a5ec144f7..5eada0342a213 100644
--- a/include/lldb/Target/DynamicLoader.h
+++ b/include/lldb/Target/DynamicLoader.h
@@ -71,8 +71,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~DynamicLoader ();
+ ~DynamicLoader() override;
//------------------------------------------------------------------
/// Called after attaching a process.
@@ -264,12 +263,14 @@ protected:
virtual void
UpdateLoadedSections(lldb::ModuleSP module,
lldb::addr_t link_map_addr,
- lldb::addr_t base_addr);
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
// Utility method so base classes can share implementation of UpdateLoadedSections
void
UpdateLoadedSectionsCommon(lldb::ModuleSP module,
- lldb::addr_t base_addr);
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
/// Removes the loaded sections from the target in @p module.
///
@@ -283,8 +284,11 @@ protected:
/// Locates or creates a module given by @p file and updates/loads the
/// resulting module at the virtual base address @p base_addr.
- lldb::ModuleSP
- LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr);
+ virtual lldb::ModuleSP
+ LoadModuleAtAddress(const lldb_private::FileSpec &file,
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
const lldb_private::SectionList *
GetSectionListFromModule(const lldb::ModuleSP module) const;
@@ -303,11 +307,12 @@ protected:
// Member variables.
//------------------------------------------------------------------
Process* m_process; ///< The process that this dynamic loader plug-in is tracking.
+
private:
- DISALLOW_COPY_AND_ASSIGN (DynamicLoader);
+ DISALLOW_COPY_AND_ASSIGN (DynamicLoader);
};
} // namespace lldb_private
-#endif // liblldb_DynamicLoader_h_
+#endif // liblldb_DynamicLoader_h_
diff --git a/include/lldb/Target/ExecutionContext.h b/include/lldb/Target/ExecutionContext.h
index 50f2beaf949b0..cdf55e3b744c7 100644
--- a/include/lldb/Target/ExecutionContext.h
+++ b/include/lldb/Target/ExecutionContext.h
@@ -6,6 +6,21 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExecutionContext_h_
+#define liblldb_ExecutionContext_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private {
+
+//===----------------------------------------------------------------------===//
/// Execution context objects refer to objects in the execution of the
/// program that is being debugged. The consist of one or more of the
/// following objects: target, process, thread, and frame. Many objects
@@ -30,17 +45,6 @@
/// to a wide variety of functions that require execution contexts.
//===----------------------------------------------------------------------===//
-
-
-#ifndef liblldb_ExecutionContext_h_
-#define liblldb_ExecutionContext_h_
-
-#include "lldb/lldb-private.h"
-#include "lldb/Target/StackID.h"
-#include "lldb/Host/Mutex.h"
-
-namespace lldb_private {
-
//----------------------------------------------------------------------
/// @class ExecutionContextRef ExecutionContext.h "lldb/Target/ExecutionContext.h"
/// @brief A class that holds a weak reference to an execution context.
@@ -86,7 +90,7 @@ public:
ExecutionContextRef (const ExecutionContextRef &rhs);
//------------------------------------------------------------------
- /// Construct using an ExecutionContext object that might be NULL.
+ /// Construct using an ExecutionContext object that might be nullptr.
///
/// If \a exe_ctx_ptr is valid, then make weak references to any
/// valid objects in the ExecutionContext, otherwise no weak
@@ -102,22 +106,6 @@ public:
ExecutionContextRef (const ExecutionContext &exe_ctx);
//------------------------------------------------------------------
- /// Assignment operator
- ///
- /// Copy all weak references in \a rhs.
- //------------------------------------------------------------------
- ExecutionContextRef &
- operator =(const ExecutionContextRef &rhs);
-
- //------------------------------------------------------------------
- /// Assignment operator from a ExecutionContext
- ///
- /// Make weak references to any strongly referenced objects in \a exe_ctx.
- //------------------------------------------------------------------
- ExecutionContextRef &
- operator =(const ExecutionContext &exe_ctx);
-
- //------------------------------------------------------------------
/// Construct using the target and all the selected items inside of it
/// (the process and its selected thread, and the thread's selected
/// frame). If there is no selected thread, default to the first thread
@@ -154,10 +142,27 @@ public:
ExecutionContextRef (ExecutionContextScope &exe_scope);
~ExecutionContextRef();
+
+ //------------------------------------------------------------------
+ /// Assignment operator
+ ///
+ /// Copy all weak references in \a rhs.
+ //------------------------------------------------------------------
+ ExecutionContextRef &
+ operator =(const ExecutionContextRef &rhs);
+
+ //------------------------------------------------------------------
+ /// Assignment operator from a ExecutionContext
+ ///
+ /// Make weak references to any strongly referenced objects in \a exe_ctx.
+ //------------------------------------------------------------------
+ ExecutionContextRef &
+ operator =(const ExecutionContext &exe_ctx);
+
//------------------------------------------------------------------
/// Clear the object's state.
///
- /// Sets the process and thread to NULL, and the frame index to an
+ /// Sets the process and thread to nullptr, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void
@@ -394,6 +399,7 @@ public:
ExecutionContext (const lldb::ProcessSP &process_sp);
ExecutionContext (const lldb::ThreadSP &thread_sp);
ExecutionContext (const lldb::StackFrameSP &frame_sp);
+
//------------------------------------------------------------------
// Create execution contexts from weak pointers
//------------------------------------------------------------------
@@ -413,16 +419,6 @@ public:
//------------------------------------------------------------------
ExecutionContext (ExecutionContextScope *exe_scope);
ExecutionContext (ExecutionContextScope &exe_scope);
-
-
- ExecutionContext &
- operator =(const ExecutionContext &rhs);
-
- bool
- operator ==(const ExecutionContext &rhs) const;
-
- bool
- operator !=(const ExecutionContext &rhs) const;
//------------------------------------------------------------------
/// Construct with process, thread, and frame index.
@@ -438,16 +434,26 @@ public:
/// @param[in] frame
/// The frame index for this execution context.
//------------------------------------------------------------------
- ExecutionContext (Process* process,
- Thread *thread = NULL,
- StackFrame * frame = NULL);
+ ExecutionContext(Process* process,
+ Thread *thread = nullptr,
+ StackFrame * frame = nullptr);
~ExecutionContext();
+
+ ExecutionContext &
+ operator =(const ExecutionContext &rhs);
+
+ bool
+ operator ==(const ExecutionContext &rhs) const;
+
+ bool
+ operator !=(const ExecutionContext &rhs) const;
+
//------------------------------------------------------------------
/// Clear the object's state.
///
- /// Sets the process and thread to NULL, and the frame index to an
+ /// Sets the process and thread to nullptr, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void
@@ -468,10 +474,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the target object.
///
- /// The returned pointer might be NULL. Calling HasTargetScope(),
+ /// The returned pointer might be nullptr. Calling HasTargetScope(),
/// HasProcessScope(), HasThreadScope(), or HasFrameScope()
/// can help to pre-validate this pointer so that this accessor can
- /// freely be used without having to check for NULL each time.
+ /// freely be used without having to check for nullptr each time.
///
/// @see ExecutionContext::HasTargetScope() const
/// @see ExecutionContext::HasProcessScope() const
@@ -484,10 +490,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the process object.
///
- /// The returned pointer might be NULL. Calling HasProcessScope(),
+ /// The returned pointer might be nullptr. Calling HasProcessScope(),
/// HasThreadScope(), or HasFrameScope() can help to pre-validate
/// this pointer so that this accessor can freely be used without
- /// having to check for NULL each time.
+ /// having to check for nullptr each time.
///
/// @see ExecutionContext::HasProcessScope() const
/// @see ExecutionContext::HasThreadScope() const
@@ -499,10 +505,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the thread object.
///
- /// The returned pointer might be NULL. Calling HasThreadScope() or
+ /// The returned pointer might be nullptr. Calling HasThreadScope() or
/// HasFrameScope() can help to pre-validate this pointer so that
/// this accessor can freely be used without having to check for
- /// NULL each time.
+ /// nullptr each time.
///
/// @see ExecutionContext::HasThreadScope() const
/// @see ExecutionContext::HasFrameScope() const
@@ -516,9 +522,9 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the frame object.
///
- /// The returned pointer might be NULL. Calling HasFrameScope(),
+ /// The returned pointer might be nullptr. Calling HasFrameScope(),
/// can help to pre-validate this pointer so that this accessor can
- /// freely be used without having to check for NULL each time.
+ /// freely be used without having to check for nullptr each time.
///
/// @see ExecutionContext::HasFrameScope() const
//------------------------------------------------------------------
@@ -776,6 +782,7 @@ protected:
lldb::ThreadSP m_thread_sp; ///< The thread that owns the frame
lldb::StackFrameSP m_frame_sp; ///< The stack frame in thread.
};
+
} // namespace lldb_private
-#endif // liblldb_ExecutionContext_h_
+#endif // liblldb_ExecutionContext_h_
diff --git a/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/include/lldb/Target/InstrumentationRuntimeStopInfo.h
index 624267ce8221e..df1b937e6e261 100644
--- a/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+++ b/include/lldb/Target/InstrumentationRuntimeStopInfo.h
@@ -25,18 +25,24 @@ class InstrumentationRuntimeStopInfo : public StopInfo
{
public:
- virtual ~InstrumentationRuntimeStopInfo()
+ ~InstrumentationRuntimeStopInfo() override
{
}
- virtual lldb::StopReason
- GetStopReason () const
+ lldb::StopReason
+ GetStopReason() const override
{
return lldb::eStopReasonInstrumentation;
}
- virtual const char *
- GetDescription ();
+ const char *
+ GetDescription() override;
+
+ bool
+ DoShouldNotify(Event *event_ptr) override
+ {
+ return true;
+ }
static lldb::StopInfoSP
CreateStopReasonWithInstrumentationData (Thread &thread, std::string description, StructuredData::ObjectSP additional_data);
@@ -44,9 +50,8 @@ public:
private:
InstrumentationRuntimeStopInfo(Thread &thread, std::string description, StructuredData::ObjectSP additional_data);
-
};
} // namespace lldb_private
-#endif // liblldb_InstrumentationRuntimeStopInfo_h_
+#endif // liblldb_InstrumentationRuntimeStopInfo_h_
diff --git a/include/lldb/Target/JITLoader.h b/include/lldb/Target/JITLoader.h
index c15ae5a876f11..8a2d6828db2f8 100644
--- a/include/lldb/Target/JITLoader.h
+++ b/include/lldb/Target/JITLoader.h
@@ -50,8 +50,7 @@ public:
//------------------------------------------------------------------
JITLoader (Process *process);
- virtual
- ~JITLoader ();
+ ~JITLoader() override;
//------------------------------------------------------------------
/// Called after attaching a process.
diff --git a/include/lldb/Target/Language.h b/include/lldb/Target/Language.h
new file mode 100644
index 0000000000000..492425ec088bb
--- /dev/null
+++ b/include/lldb/Target/Language.h
@@ -0,0 +1,206 @@
+//===-- Language.h ---------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Language_h_
+#define liblldb_Language_h_
+
+// C Includes
+// C++ Includes
+#include <functional>
+#include <memory>
+#include <set>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-private.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+
+namespace lldb_private {
+
+class Language :
+public PluginInterface
+{
+public:
+ class TypeScavenger
+ {
+ public:
+ class Result
+ {
+ public:
+ virtual bool
+ IsValid () = 0;
+
+ virtual bool
+ DumpToStream (Stream& stream,
+ bool print_help_if_available) = 0;
+
+ virtual ~Result() = default;
+ };
+
+ typedef std::set<std::unique_ptr<Result>> ResultSet;
+
+ virtual ~TypeScavenger () = default;
+
+ size_t
+ Find (ExecutionContextScope *exe_scope,
+ const char *key,
+ ResultSet &results,
+ bool append = true);
+
+ protected:
+ TypeScavenger () = default;
+
+ virtual bool
+ Find_Impl (ExecutionContextScope *exe_scope,
+ const char *key,
+ ResultSet &results) = 0;
+ };
+
+ enum class FunctionNameRepresentation
+ {
+ eName,
+ eNameWithArgs,
+ eNameWithNoArgs
+ };
+
+ ~Language() override;
+
+ static Language*
+ FindPlugin (lldb::LanguageType language);
+
+ // return false from callback to stop iterating
+ static void
+ ForEach (std::function<bool(Language*)> callback);
+
+ virtual lldb::LanguageType
+ GetLanguageType () const = 0;
+
+ virtual bool
+ IsTopLevelFunction (Function& function);
+
+ virtual lldb::TypeCategoryImplSP
+ GetFormatters ();
+
+ virtual HardcodedFormatters::HardcodedFormatFinder
+ GetHardcodedFormats ();
+
+ virtual HardcodedFormatters::HardcodedSummaryFinder
+ GetHardcodedSummaries ();
+
+ virtual HardcodedFormatters::HardcodedSyntheticFinder
+ GetHardcodedSynthetics ();
+
+ virtual HardcodedFormatters::HardcodedValidatorFinder
+ GetHardcodedValidators ();
+
+ virtual std::vector<ConstString>
+ GetPossibleFormattersMatches (ValueObject& valobj, lldb::DynamicValueType use_dynamic);
+
+ virtual lldb_private::formatters::StringPrinter::EscapingHelper
+ GetStringPrinterEscapingHelper (lldb_private::formatters::StringPrinter::GetPrintableElementType);
+
+ virtual std::unique_ptr<TypeScavenger>
+ GetTypeScavenger ();
+
+ // if an individual data formatter can apply to several types and cross a language boundary
+ // it makes sense for individual languages to want to customize the printing of values of that
+ // type by appending proper prefix/suffix information in language-specific ways
+ virtual bool
+ GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
+ std::string& prefix, std::string& suffix);
+
+ // if a language has a custom format for printing variable declarations that it wants LLDB to honor
+ // it should return an appropriate closure here
+ virtual DumpValueObjectOptions::DeclPrintingHelper
+ GetDeclPrintingHelper ();
+
+ virtual LazyBool
+ IsLogicalTrue (ValueObject& valobj,
+ Error& error);
+
+ // for a ValueObject of some "reference type", if the value points to the
+ // nil/null object, this method returns true
+ virtual bool
+ IsNilReference (ValueObject& valobj);
+
+ // for a ValueObject of some "reference type", if the language provides a technique
+ // to decide whether the reference has ever been assigned to some object, this method
+ // will return true if such detection is possible, and if the reference has never been assigned
+ virtual bool
+ IsUninitializedReference (ValueObject& valobj);
+
+ virtual bool
+ GetFunctionDisplayName (const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ FunctionNameRepresentation representation,
+ Stream& s);
+
+ virtual void
+ GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s);
+
+ static void
+ GetDefaultExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s);
+
+ // These are accessors for general information about the Languages lldb knows about:
+
+ static lldb::LanguageType
+ GetLanguageTypeFromString (const char *string);
+
+ static const char *
+ GetNameForLanguageType (lldb::LanguageType language);
+
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
+ // return false from callback to stop iterating
+ static void
+ ForAllLanguages (std::function<bool(lldb::LanguageType)> callback);
+
+ static bool
+ LanguageIsCPlusPlus (lldb::LanguageType language);
+
+ static bool
+ LanguageIsObjC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsPascal (lldb::LanguageType language);
+
+ // return the primary language, so if LanguageIsC(l), return eLanguageTypeC, etc.
+ static lldb::LanguageType
+ GetPrimaryLanguage (lldb::LanguageType language);
+
+ static void
+ GetLanguagesSupportingTypeSystems (std::set<lldb::LanguageType> &languages,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void
+ GetLanguagesSupportingREPLs (std::set<lldb::LanguageType> &languages);
+
+protected:
+ //------------------------------------------------------------------
+ // Classes that inherit from Language can see and modify these
+ //------------------------------------------------------------------
+
+ Language();
+private:
+
+ DISALLOW_COPY_AND_ASSIGN (Language);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Language_h_
diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h
index d8e5ada6c96ff..686ec5ea34799 100644
--- a/include/lldb/Target/LanguageRuntime.h
+++ b/include/lldb/Target/LanguageRuntime.h
@@ -29,8 +29,8 @@ class LanguageRuntime :
public PluginInterface
{
public:
- virtual
- ~LanguageRuntime();
+
+ ~LanguageRuntime() override;
static LanguageRuntime*
FindPlugin (Process *process, lldb::LanguageType language);
@@ -52,12 +52,31 @@ public:
GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
- Address &address) = 0;
+ Address &address,
+ Value::ValueType &value_type) = 0;
+
+ // This call should return a CompilerType given a generic type name
+ // and an ExecutionContextScope in which one can actually fetch
+ // any specialization information required.
+ virtual CompilerType
+ GetConcreteType (ExecutionContextScope *exe_scope,
+ ConstString abstract_type_name)
+ {
+ return CompilerType();
+ }
// This should be a fast test to determine whether it is likely that this value would
// have a dynamic type.
virtual bool
CouldHaveDynamicValue (ValueObject &in_value) = 0;
+
+ // The contract for GetDynamicTypeAndAddress() is to return a "bare-bones" dynamic type
+ // For instance, given a Base* pointer, GetDynamicTypeAndAddress() will return the type of
+ // Derived, not Derived*. The job of this API is to correct this misalignment between the
+ // static type and the discovered dynamic type
+ virtual TypeAndOrName
+ FixUpDynamicType (const TypeAndOrName& type_and_or_name,
+ ValueObject& static_value) = 0;
virtual void
SetExceptionBreakpoints ()
@@ -92,24 +111,17 @@ public:
CreateExceptionPrecondition (lldb::LanguageType language,
bool catch_bp,
bool throw_bp);
-
- static lldb::LanguageType
- GetLanguageTypeFromString (const char *string);
-
- static const char *
- GetNameForLanguageType (lldb::LanguageType language);
-
- static void
- PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
-
- static bool
- LanguageIsCPlusPlus (lldb::LanguageType language);
-
Process *
GetProcess()
{
return m_process;
}
+
+ Target&
+ GetTargetRef()
+ {
+ return m_process->GetTarget();
+ }
virtual lldb::BreakpointResolverSP
CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
@@ -118,7 +130,7 @@ public:
CreateExceptionSearchFilter ();
virtual bool
- GetTypeBitSize (const ClangASTType& clang_type,
+ GetTypeBitSize (const CompilerType& compiler_type,
uint64_t &size)
{
return false;
@@ -133,7 +145,6 @@ public:
virtual void
ModulesDidLoad (const ModuleList &module_list)
{
- return;
}
protected:
@@ -144,9 +155,10 @@ protected:
LanguageRuntime(Process *process);
Process *m_process;
private:
+
DISALLOW_COPY_AND_ASSIGN (LanguageRuntime);
};
} // namespace lldb_private
-#endif // liblldb_LanguageRuntime_h_
+#endif // liblldb_LanguageRuntime_h_
diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h
index 88874c767a1b1..75f096fdedfee 100644
--- a/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/include/lldb/Target/ObjCLanguageRuntime.h
@@ -1,4 +1,4 @@
-//===-- ObjCLanguageRuntime.h ---------------------------------------------------*- C++ -*-===//
+//===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,14 +14,17 @@
// C++ Includes
#include <functional>
#include <map>
+#include <memory>
#include <unordered_set>
// Other libraries and framework includes
+#include "llvm/Support/Casting.h"
+
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/ThreadSafeDenseMap.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/LanguageRuntime.h"
@@ -30,115 +33,19 @@ class CommandObjectObjC_ClassTable_Dump;
namespace lldb_private {
-class ClangUtilityFunction;
+class UtilityFunction;
class ObjCLanguageRuntime :
public LanguageRuntime
{
public:
- class MethodName
+ enum class ObjCRuntimeVersions
{
- public:
- enum Type
- {
- eTypeUnspecified,
- eTypeClassMethod,
- eTypeInstanceMethod
- };
-
- MethodName () :
- m_full(),
- m_class(),
- m_category(),
- m_selector(),
- m_type (eTypeUnspecified),
- m_category_is_valid (false)
- {
- }
-
- MethodName (const char *name, bool strict) :
- m_full(),
- m_class(),
- m_category(),
- m_selector(),
- m_type (eTypeUnspecified),
- m_category_is_valid (false)
- {
- SetName (name, strict);
- }
-
- void
- Clear();
-
- bool
- IsValid (bool strict) const
- {
- // If "strict" is true, the name must have everything specified including
- // the leading "+" or "-" on the method name
- if (strict && m_type == eTypeUnspecified)
- return false;
- // Other than that, m_full will only be filled in if the objective C
- // name is valid.
- return (bool)m_full;
- }
-
- bool
- HasCategory()
- {
- return (bool)GetCategory();
- }
-
- Type
- GetType () const
- {
- return m_type;
- }
-
- const ConstString &
- GetFullName () const
- {
- return m_full;
- }
-
- ConstString
- GetFullNameWithoutCategory (bool empty_if_no_category);
-
- bool
- SetName (const char *name, bool strict);
-
- const ConstString &
- GetClassName ();
-
- const ConstString &
- GetClassNameWithCategory ();
-
- const ConstString &
- GetCategory ();
-
- const ConstString &
- GetSelector ();
-
- // Get all possible names for a method. Examples:
- // If name is "+[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "+[NSString myStringWithCString:]"
- // If name is specified without the leading '+' or '-' like "[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "-[NSString(my_additions) myStringWithCString:]"
- // names[2] => "+[NSString myStringWithCString:]"
- // names[3] => "-[NSString myStringWithCString:]"
- size_t
- GetFullNames (std::vector<ConstString> &names, bool append);
- protected:
- ConstString m_full; // Full name: "+[NSString(my_additions) myStringWithCString:]"
- ConstString m_class; // Class name: "NSString"
- ConstString m_class_category; // Class with category: "NSString(my_additions)"
- ConstString m_category; // Category: "my_additions"
- ConstString m_selector; // Selector: "myStringWithCString:"
- Type m_type;
- bool m_category_is_valid;
-
+ eObjC_VersionUnknown = 0,
+ eAppleObjC_V1 = 1,
+ eAppleObjC_V2 = 2
};
+
typedef lldb::addr_t ObjCISA;
class ClassDescriptor;
@@ -150,7 +57,6 @@ public:
class ClassDescriptor
{
public:
-
ClassDescriptor() :
m_is_kvo (eLazyBoolCalculate),
m_is_cf (eLazyBoolCalculate),
@@ -159,10 +65,8 @@ public:
}
virtual
- ~ClassDescriptor ()
- {
- }
-
+ ~ClassDescriptor() = default;
+
virtual ConstString
GetClassName () = 0;
@@ -203,12 +107,12 @@ public:
virtual bool
IsValid () = 0;
-
+
virtual bool
- GetTaggedPointerInfo (uint64_t* info_bits = NULL,
- uint64_t* value_bits = NULL,
- uint64_t* payload = NULL) = 0;
-
+ GetTaggedPointerInfo(uint64_t* info_bits = nullptr,
+ uint64_t* value_bits = nullptr,
+ uint64_t* payload = nullptr) = 0;
+
virtual uint64_t
GetInstanceSize () = 0;
@@ -247,7 +151,7 @@ public:
struct iVarDescriptor {
ConstString m_name;
- ClangASTType m_type;
+ CompilerType m_type;
uint64_t m_size;
int32_t m_offset;
};
@@ -281,12 +185,12 @@ public:
class EncodingToType
{
public:
- virtual ClangASTType RealizeType (ClangASTContext& ast_ctx, const char* name, bool for_expression);
- virtual ClangASTType RealizeType (const char* name, bool for_expression);
-
- virtual ClangASTType RealizeType (clang::ASTContext& ast_ctx, const char* name, bool for_expression) = 0;
-
virtual ~EncodingToType();
+
+ virtual CompilerType RealizeType (ClangASTContext& ast_ctx, const char* name, bool for_expression);
+ virtual CompilerType RealizeType (const char* name, bool for_expression);
+
+ virtual CompilerType RealizeType (clang::ASTContext& ast_ctx, const char* name, bool for_expression) = 0;
protected:
std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_ap;
@@ -297,10 +201,10 @@ public:
public:
ObjCExceptionPrecondition();
- virtual ~ObjCExceptionPrecondition() {}
+ ~ObjCExceptionPrecondition() override = default;
bool EvaluatePrecondition(StoppointCallbackContext &context) override;
- void DescribePrecondition(Stream &stream, lldb::DescriptionLevel level) override;
+ void GetDescription(Stream &stream, lldb::DescriptionLevel level) override;
Error ConfigurePrecondition(Args &args) override;
protected:
@@ -313,21 +217,24 @@ public:
class TaggedPointerVendor
{
public:
+ virtual
+ ~TaggedPointerVendor() = default;
+
virtual bool
IsPossibleTaggedPointer (lldb::addr_t ptr) = 0;
virtual ObjCLanguageRuntime::ClassDescriptorSP
GetClassDescriptor (lldb::addr_t ptr) = 0;
-
- virtual
- ~TaggedPointerVendor () { }
+
protected:
- TaggedPointerVendor () = default;
+ TaggedPointerVendor() = default;
private:
DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
};
+ ~ObjCLanguageRuntime() override;
+
virtual TaggedPointerVendor*
GetTaggedPointerVendor ()
{
@@ -354,9 +261,6 @@ public:
ClassDescriptorSP
GetNonKVOClassDescriptor (ObjCISA isa);
- virtual
- ~ObjCLanguageRuntime();
-
lldb::LanguageType
GetLanguageType () const override
{
@@ -393,13 +297,13 @@ public:
lldb::TypeSP
LookupInCompleteClassCache (ConstString &name);
- virtual ClangUtilityFunction *
+ virtual UtilityFunction *
CreateObjectChecker (const char *) = 0;
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
}
bool
@@ -433,14 +337,14 @@ public:
virtual DeclVendor *
GetDeclVendor()
{
- return NULL;
+ return nullptr;
}
// Finds the byte offset of the child_type ivar in parent_type. If it can't find the
// offset, returns LLDB_INVALID_IVAR_OFFSET.
virtual size_t
- GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
+ GetByteOffsetForIvar (CompilerType &parent_qual_type, const char *ivar_name);
// Given the name of an Objective-C runtime symbol (e.g., ivar offset symbol),
// try to determine from the runtime what the value of that symbol would be.
@@ -451,94 +355,6 @@ public:
return LLDB_INVALID_ADDRESS;
}
- //------------------------------------------------------------------
- /// Chop up an objective C function prototype.
- ///
- /// Chop up an objective C function fullname and optionally fill in
- /// any non-NULL ConstString objects. If a ConstString * is NULL,
- /// then this name doesn't get filled in
- ///
- /// @param[in] name
- /// A fully specified objective C function name. The string might
- /// contain a category and it includes the leading "+" or "-" and
- /// the square brackets, no types for the arguments, just the plain
- /// selector. A few examples:
- /// "-[NSStringDrawingContext init]"
- /// "-[NSStringDrawingContext addString:inRect:]"
- /// "-[NSString(NSStringDrawing) sizeWithAttributes:]"
- /// "+[NSString(NSStringDrawing) usesFontLeading]"
- ///
- /// @param[out] class_name
- /// If non-NULL, this string will be filled in with the class
- /// name including the category. The examples above would return:
- /// "NSStringDrawingContext"
- /// "NSStringDrawingContext"
- /// "NSString(NSStringDrawing)"
- /// "NSString(NSStringDrawing)"
- ///
- /// @param[out] selector_name
- /// If non-NULL, this string will be filled in with the selector
- /// name. The examples above would return:
- /// "init"
- /// "addString:inRect:"
- /// "sizeWithAttributes:"
- /// "usesFontLeading"
- ///
- /// @param[out] name_sans_category
- /// If non-NULL, this string will be filled in with the class
- /// name _without_ the category. If there is no category, and empty
- /// string will be returned (as the result would be normally returned
- /// in the "class_name" argument). The examples above would return:
- /// <empty>
- /// <empty>
- /// "-[NSString sizeWithAttributes:]"
- /// "+[NSString usesFontLeading]"
- ///
- /// @param[out] class_name_sans_category
- /// If non-NULL, this string will be filled in with the prototype
- /// name _without_ the category. If there is no category, and empty
- /// string will be returned (as this is already the value that was
- /// passed in). The examples above would return:
- /// <empty>
- /// <empty>
- /// "NSString"
- /// "NSString"
- ///
- /// @return
- /// Returns the number of strings that were successfully filled
- /// in.
- //------------------------------------------------------------------
-// static uint32_t
-// ParseMethodName (const char *name,
-// ConstString *class_name, // Class name (with category if there is one)
-// ConstString *selector_name, // selector only
-// ConstString *name_sans_category, // full function name with no category (empty if no category)
-// ConstString *class_name_sans_category);// Class name without category (empty if no category)
-
- static bool
- IsPossibleObjCMethodName (const char *name)
- {
- if (!name)
- return false;
- bool starts_right = (name[0] == '+' || name[0] == '-') && name[1] == '[';
- bool ends_right = (name[strlen(name) - 1] == ']');
- return (starts_right && ends_right);
- }
-
- static bool
- IsPossibleObjCSelector (const char *name)
- {
- if (!name)
- return false;
-
- if (strchr(name, ':') == NULL)
- return true;
- else if (name[strlen(name) - 1] == ':')
- return true;
- else
- return false;
- }
-
bool
HasNewLiteralsAndIndexing ()
{
@@ -560,7 +376,7 @@ public:
}
bool
- GetTypeBitSize (const ClangASTType& clang_type,
+ GetTypeBitSize (const CompilerType& compiler_type,
uint64_t &size) override;
protected:
@@ -568,13 +384,12 @@ protected:
// Classes that inherit from ObjCLanguageRuntime can see and modify these
//------------------------------------------------------------------
ObjCLanguageRuntime(Process *process);
-
+
virtual bool CalculateHasNewLiteralsAndIndexing()
{
return false;
}
-
bool
ISAIsCached (ObjCISA isa) const
{
@@ -621,11 +436,13 @@ private:
sel_addr = LLDB_INVALID_ADDRESS;
class_addr = LLDB_INVALID_ADDRESS;
}
+
ClassAndSel (lldb::addr_t in_sel_addr, lldb::addr_t in_class_addr) :
class_addr (in_class_addr),
sel_addr(in_sel_addr)
{
}
+
bool operator== (const ClassAndSel &rhs)
{
if (class_addr == rhs.class_addr
@@ -702,4 +519,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_ObjCLanguageRuntime_h_
+#endif // liblldb_ObjCLanguageRuntime_h_
diff --git a/include/lldb/Target/OperatingSystem.h b/include/lldb/Target/OperatingSystem.h
index f1c0eb06026f3..74de5645da5a5 100644
--- a/include/lldb/Target/OperatingSystem.h
+++ b/include/lldb/Target/OperatingSystem.h
@@ -32,7 +32,6 @@ namespace lldb_private {
class OperatingSystem :
public PluginInterface
-
{
public:
//------------------------------------------------------------------
@@ -58,8 +57,7 @@ public:
//------------------------------------------------------------------
OperatingSystem (Process *process);
- virtual
- ~OperatingSystem();
+ ~OperatingSystem() override;
//------------------------------------------------------------------
// Plug-in Methods
@@ -98,4 +96,4 @@ private:
} // namespace lldb_private
-#endif // #ifndef liblldb_OperatingSystem_h_
+#endif // liblldb_OperatingSystem_h_
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index feaac57b128a6..53c17a6a66cf5 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -37,7 +37,6 @@
namespace lldb_private {
class ModuleCache;
-
enum MmapFlags {
eMmapFlagsPrivate = 1,
eMmapFlagsAnon = 2
@@ -46,11 +45,11 @@ class ModuleCache;
class PlatformProperties : public Properties
{
public:
+ PlatformProperties();
+
static ConstString
GetSettingName ();
- PlatformProperties();
-
bool
GetUseModuleCache () const;
bool
@@ -81,6 +80,19 @@ class ModuleCache;
public PluginInterface
{
public:
+ //------------------------------------------------------------------
+ /// Default Constructor
+ //------------------------------------------------------------------
+ Platform (bool is_host_platform);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited from by the plug-in instance.
+ //------------------------------------------------------------------
+ ~Platform() override;
+
static void
Initialize ();
@@ -131,20 +143,6 @@ class ModuleCache;
GetConnectedRemotePlatformAtIndex (uint32_t idx);
//------------------------------------------------------------------
- /// Default Constructor
- //------------------------------------------------------------------
- Platform (bool is_host_platform);
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be
- /// inherited from by the plug-in instance.
- //------------------------------------------------------------------
- virtual
- ~Platform();
-
- //------------------------------------------------------------------
/// Find a platform plugin for a given process.
///
/// Scans the installed Platform plug-ins and tries to find
@@ -156,7 +154,7 @@ class ModuleCache;
///
/// @param[in] plugin_name
/// An optional name of a specific platform plug-in that
- /// should be used. If NULL, pick the best plug-in.
+ /// should be used. If nullptr, pick the best plug-in.
//------------------------------------------------------------------
// static lldb::PlatformSP
// FindPlugin (Process *process, const ConstString &plugin_name);
@@ -185,7 +183,6 @@ class ModuleCache;
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr);
-
//------------------------------------------------------------------
/// Find a symbol file given a symbol file module specification.
///
@@ -247,10 +244,21 @@ class ModuleCache;
ResolveRemotePath (const FileSpec &platform_path,
FileSpec &resolved_platform_path);
- bool
+ //------------------------------------------------------------------
+ /// Get the OS version from a connected platform.
+ ///
+ /// Some platforms might not be connected to a remote platform, but
+ /// can figure out the OS version for a process. This is common for
+ /// simulator platforms that will run native programs on the current
+ /// host, but the simulator might be simulating a different OS. The
+ /// \a process parameter might be specified to help to determine
+ /// the OS version.
+ //------------------------------------------------------------------
+ virtual bool
GetOSVersion (uint32_t &major,
uint32_t &minor,
- uint32_t &update);
+ uint32_t &update,
+ Process *process = nullptr);
bool
SetOSVersion (uint32_t major,
@@ -269,6 +277,9 @@ class ModuleCache;
virtual const char *
GetHostname ();
+
+ virtual ConstString
+ GetFullNameForDylib (ConstString basename);
virtual const char *
GetDescription () = 0;
@@ -473,9 +484,16 @@ class ModuleCache;
virtual lldb::ProcessSP
DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
- Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
Error &error);
+ virtual lldb::ProcessSP
+ ConnectProcess (const char* connect_url,
+ const char* plugin_name,
+ lldb_private::Debugger &debugger,
+ lldb_private::Target *target,
+ lldb_private::Error &error);
+
//------------------------------------------------------------------
/// Attach to an existing process using a process ID.
///
@@ -497,7 +515,7 @@ class ModuleCache;
virtual lldb::ProcessSP
Attach (ProcessAttachInfo &attach_info,
Debugger &debugger,
- Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
Error &error) = 0;
//------------------------------------------------------------------
@@ -593,6 +611,7 @@ class ModuleCache;
{
return m_max_uid_name_len;
}
+
// Used for column widths
size_t
GetMaxGroupIDNameLength() const
@@ -829,15 +848,15 @@ class ModuleCache;
virtual lldb_private::OptionGroupOptions *
GetConnectionOptions (CommandInterpreter& interpreter)
{
- return NULL;
+ return nullptr;
}
virtual lldb_private::Error
- RunShellCommand(const char *command, // Shouldn't be NULL
+ RunShellCommand(const char *command, // Shouldn't be nullptr
const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
+ int *status_ptr, // Pass nullptr if you don't want the process exit status
+ int *signo_ptr, // Pass nullptr if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass nullptr if you don't want the command output
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
virtual void
@@ -945,9 +964,105 @@ class ModuleCache;
virtual const std::vector<ConstString> &
GetTrapHandlerSymbolNames ();
+ //------------------------------------------------------------------
+ /// Find a support executable that may not live within in the
+ /// standard locations related to LLDB.
+ ///
+ /// Executable might exist within the Platform SDK directories, or
+ /// in standard tool directories within the current IDE that is
+ /// running LLDB.
+ ///
+ /// @param[in] basename
+ /// The basename of the executable to locate in the current
+ /// platform.
+ ///
+ /// @return
+ /// A FileSpec pointing to the executable on disk, or an invalid
+ /// FileSpec if the executable cannot be found.
+ //------------------------------------------------------------------
+ virtual FileSpec
+ LocateExecutable (const char *basename)
+ {
+ return FileSpec();
+ }
+
+ //------------------------------------------------------------------
+ /// Allow the platform to set preferred memory cache line size. If non-zero (and the user
+ /// has not set cache line size explicitly), this value will be used as the cache line
+ /// size for memory reads.
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetDefaultMemoryCacheLineSize() { return 0; }
+
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// Try and load a shared library into the current process. This
+ /// call might fail in the dynamic loader plug-in says it isn't safe
+ /// to try and load shared libraries at the moment.
+ ///
+ /// @param[in] process
+ /// The process to load the image.
+ ///
+ /// @param[in] local_file
+ /// The file spec that points to the shared library that you want
+ /// to load if the library is located on the host. The library will
+ /// be copied over to the location specified by remote_file or into
+ /// the current working directory with the same filename if the
+ /// remote_file isn't specified.
+ ///
+ /// @param[in] remote_file
+ /// If local_file is specified then the location where the library
+ /// should be copied over from the host. If local_file isn't
+ /// specified, then the path for the shared library on the target
+ /// what you want to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
+ uint32_t
+ LoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& local_file,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error);
+
+ virtual uint32_t
+ DoLoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error);
+
+ virtual Error
+ UnloadImage (lldb_private::Process* process, uint32_t image_token);
+
+ //------------------------------------------------------------------
+ /// Connect to all processes waiting for a debugger to attach
+ ///
+ /// If the platform have a list of processes waiting for a debugger
+ /// to connect to them then connect to all of these pending processes.
+ ///
+ /// @param[in] debugger
+ /// The debugger used for the connect.
+ ///
+ /// @param[out] error
+ /// If an error occurred during the connect then this object will
+ /// contain the error message.
+ ///
+ /// @return
+ /// The number of processes we are succesfully connected to.
+ //------------------------------------------------------------------
+ virtual size_t
+ ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error);
+
protected:
bool m_is_host;
- // Set to true when we are able to actually set the OS version while
+ // Set to true when we are able to actually set the OS version while
// being connected. For remote platforms, we might set the version ahead
// of time before we actually connect and this version might change when
// we actually connect to a remote platform. For the host platform this
@@ -1000,16 +1115,12 @@ class ModuleCache;
GetCachedUserName (uint32_t uid)
{
Mutex::Locker locker (m_mutex);
- IDToNameMap::iterator pos = m_uid_map.find (uid);
- if (pos != m_uid_map.end())
- {
- // return the empty string if our string is NULL
- // so we can tell when things were in the negative
- // cached (didn't find a valid user name, don't keep
- // trying)
- return pos->second.AsCString("");
- }
- return NULL;
+ // return the empty string if our string is NULL
+ // so we can tell when things were in the negative
+ // cached (didn't find a valid user name, don't keep
+ // trying)
+ const auto pos = m_uid_map.find(uid);
+ return ((pos != m_uid_map.end()) ? pos->second.AsCString("") : nullptr);
}
const char *
@@ -1030,7 +1141,6 @@ class ModuleCache;
Mutex::Locker locker (m_mutex);
m_uid_map[uid] = ConstString();
}
-
void
ClearCachedUserNames ()
@@ -1043,16 +1153,12 @@ class ModuleCache;
GetCachedGroupName (uint32_t gid)
{
Mutex::Locker locker (m_mutex);
- IDToNameMap::iterator pos = m_gid_map.find (gid);
- if (pos != m_gid_map.end())
- {
- // return the empty string if our string is NULL
- // so we can tell when things were in the negative
- // cached (didn't find a valid group name, don't keep
- // trying)
- return pos->second.AsCString("");
- }
- return NULL;
+ // return the empty string if our string is NULL
+ // so we can tell when things were in the negative
+ // cached (didn't find a valid group name, don't keep
+ // trying)
+ const auto pos = m_gid_map.find(gid);
+ return ((pos != m_gid_map.end()) ? pos->second.AsCString("") : nullptr);
}
const char *
@@ -1092,6 +1198,10 @@ class ModuleCache;
const uint64_t src_offset,
const uint64_t src_size,
const FileSpec& dst_file_spec);
+
+ virtual Error
+ DownloadSymbolFile (const lldb::ModuleSP& module_sp,
+ const FileSpec& dst_file_spec);
virtual const char *
GetCacheHostname ();
@@ -1123,7 +1233,6 @@ class ModuleCache;
DISALLOW_COPY_AND_ASSIGN (Platform);
};
-
class PlatformList
{
public:
@@ -1133,11 +1242,9 @@ class ModuleCache;
m_selected_platform_sp()
{
}
-
- ~PlatformList()
- {
- }
-
+
+ ~PlatformList() = default;
+
void
Append (const lldb::PlatformSP &platform_sp, bool set_selected)
{
@@ -1220,22 +1327,21 @@ class ModuleCache;
public:
OptionGroupPlatformRSync ();
- virtual
- ~OptionGroupPlatformRSync ();
+ ~OptionGroupPlatformRSync() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1256,22 +1362,21 @@ class ModuleCache;
public:
OptionGroupPlatformSSH ();
- virtual
- ~OptionGroupPlatformSSH ();
+ ~OptionGroupPlatformSSH() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1283,7 +1388,6 @@ class ModuleCache;
std::string m_ssh_opts;
private:
-
DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformSSH);
};
@@ -1292,22 +1396,21 @@ class ModuleCache;
public:
OptionGroupPlatformCaching ();
- virtual
- ~OptionGroupPlatformCaching ();
+ ~OptionGroupPlatformCaching() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1316,10 +1419,11 @@ class ModuleCache;
// Instance variables to hold the values for command options.
std::string m_cache_dir;
+
private:
DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformCaching);
};
} // namespace lldb_private
-#endif // liblldb_Platform_h_
+#endif // liblldb_Platform_h_
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index f75b3cd5683de..2e063c5bbcccd 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -17,8 +17,10 @@
// C++ Includes
#include <list>
-#include <iosfwd>
+#include <memory>
+#include <string>
#include <vector>
+#include <unordered_set>
// Other libraries and framework includes
// Project includes
@@ -55,11 +57,10 @@ struct Range;
class ProcessProperties : public Properties
{
public:
- // Pass NULL for "process" if the ProcessProperties are to be the global copy
+ // Pass nullptr for "process" if the ProcessProperties are to be the global copy
ProcessProperties (lldb_private::Process *process);
- virtual
- ~ProcessProperties();
+ ~ProcessProperties() override;
bool
GetDisableMemoryCache() const;
@@ -103,12 +104,14 @@ public:
void
SetDetachKeepsStopped (bool keep_stopped);
-protected:
+ bool
+ GetWarningsOptimization () const;
+protected:
static void
OptionValueChangedCallback (void *baton, OptionValue *option_value);
- Process * m_process; // Can be NULL for global ProcessProperties
+ Process * m_process; // Can be nullptr for global ProcessProperties
};
typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
@@ -236,7 +239,8 @@ public:
m_wait_for_launch (false),
m_ignore_existing (true),
m_continue_once_attached (false),
- m_detach_on_error (true)
+ m_detach_on_error (true),
+ m_async (false)
{
}
@@ -249,7 +253,8 @@ public:
m_wait_for_launch (false),
m_ignore_existing (true),
m_continue_once_attached (false),
- m_detach_on_error(true)
+ m_detach_on_error (true),
+ m_async (false)
{
ProcessInfo::operator= (launch_info);
SetProcessPluginName (launch_info.GetProcessPluginName());
@@ -272,6 +277,18 @@ public:
}
bool
+ GetAsync () const
+ {
+ return m_async;
+ }
+
+ void
+ SetAsync (bool b)
+ {
+ m_async = b;
+ }
+
+ bool
GetIgnoreExisting () const
{
return m_ignore_existing;
@@ -310,9 +327,7 @@ public:
const char *
GetProcessPluginName () const
{
- if (m_plugin_name.empty())
- return NULL;
- return m_plugin_name.c_str();
+ return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
}
void
@@ -384,7 +399,6 @@ public:
m_listener_sp = listener_sp;
}
-
Listener &
GetListenerForProcess (Debugger &debugger);
@@ -397,35 +411,33 @@ protected:
bool m_ignore_existing;
bool m_continue_once_attached; // Supports the use-case scenario of immediately continuing the process once attached.
bool m_detach_on_error; // If we are debugging remotely, instruct the stub to detach rather than killing the target on error.
+ bool m_async; // Use an async attach where we start the attach and return immediately (used by GUI programs with --waitfor so they can call SBProcess::Stop() to cancel attach)
};
class ProcessLaunchCommandOptions : public Options
{
public:
-
ProcessLaunchCommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
}
-
- ~ProcessLaunchCommandOptions ()
- {
- }
-
+
+ ~ProcessLaunchCommandOptions() override = default;
+
Error
- SetOptionValue (uint32_t option_idx, const char *option_arg);
+ SetOptionValue (uint32_t option_idx, const char *option_arg) override;
void
- OptionParsingStarting ()
+ OptionParsingStarting() override
{
launch_info.Clear();
disable_aslr = eLazyBoolCalculate;
}
const OptionDefinition*
- GetDefinitions ()
+ GetDefinitions() override
{
return g_option_table;
}
@@ -521,11 +533,8 @@ protected:
class ProcessInstanceInfoList
{
public:
- ProcessInstanceInfoList () :
- m_infos()
- {
- }
-
+ ProcessInstanceInfoList() = default;
+
void
Clear()
{
@@ -547,25 +556,19 @@ public:
const char *
GetProcessNameAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetName();
- return NULL;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr);
}
size_t
GetProcessNameLengthAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetNameLength();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0);
}
lldb::pid_t
GetProcessIDAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetProcessID();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0);
}
bool
@@ -592,7 +595,6 @@ protected:
collection m_infos;
};
-
// This class tracks the Modification state of the process. Things that can currently modify
// the program are running the program (which will up the StopID) and writing memory (which
// will up the MemoryID.)
@@ -600,7 +602,7 @@ protected:
class ProcessModID
{
-friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
+ friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
public:
ProcessModID () :
m_stop_id (0),
@@ -626,7 +628,7 @@ public:
return *this;
}
- ~ProcessModID () {}
+ ~ProcessModID() = default;
void BumpStopID () {
m_stop_id++;
@@ -709,6 +711,7 @@ private:
uint32_t m_running_user_expression;
lldb::EventSP m_last_natural_stop_event;
};
+
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
if (lhs.StopIDEqual (rhs)
@@ -720,11 +723,7 @@ inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
inline bool operator!= (const ProcessModID &lhs, const ProcessModID &rhs)
{
- if (!lhs.StopIDEqual (rhs)
- || !lhs.MemoryIDEqual (rhs))
- return true;
- else
- return false;
+ return (!lhs.StopIDEqual (rhs) || !lhs.MemoryIDEqual (rhs));
}
//----------------------------------------------------------------------
@@ -739,7 +738,7 @@ class Process :
public ExecutionContextScope,
public PluginInterface
{
- friend class ClangFunction; // For WaitForStateChangeEventsPrivate
+ friend class FunctionCaller; // For WaitForStateChangeEventsPrivate
friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
friend class ProcessEventData;
friend class StopInfo;
@@ -747,7 +746,6 @@ class Process :
friend class ThreadList;
public:
-
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -766,6 +764,14 @@ public:
eBroadcastInternalStateControlPause = (1<<1),
eBroadcastInternalStateControlResume = (1<<2)
};
+
+ //------------------------------------------------------------------
+ /// Process warning types.
+ //------------------------------------------------------------------
+ enum Warnings
+ {
+ eWarningsOptimization = 1
+ };
typedef Range<lldb::addr_t, lldb::addr_t> LoadRange;
// We use a read/write lock to allow on or more clients to
@@ -781,12 +787,11 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
-
//------------------------------------------------------------------
/// A notification structure that can be used by clients to listen
/// for changes in a process's lifetime.
@@ -811,13 +816,13 @@ public:
ProcessEventData ();
ProcessEventData (const lldb::ProcessSP &process, lldb::StateType state);
- virtual ~ProcessEventData();
+ ~ProcessEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const;
+ const ConstString &
+ GetFlavor() const override;
lldb::ProcessSP
GetProcessSP() const
@@ -845,10 +850,7 @@ public:
const char *
GetRestartedReasonAtIndex(size_t idx)
{
- if (idx > m_restarted_reasons.size())
- return NULL;
- else
- return m_restarted_reasons[idx].c_str();
+ return ((idx < m_restarted_reasons.size()) ? m_restarted_reasons[idx].c_str() : nullptr);
}
bool
@@ -857,11 +859,11 @@ public:
return m_interrupted;
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
- virtual void
- DoOnRemoval (Event *event_ptr);
+ void
+ DoOnRemoval(Event *event_ptr) override;
static const Process::ProcessEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -897,22 +899,24 @@ public:
SetUpdateStateOnRemoval (Event *event_ptr);
private:
-
void
SetUpdateStateOnRemoval()
{
m_update_state++;
}
+
void
SetRestarted (bool new_value)
{
m_restarted = new_value;
}
+
void
SetInterrupted (bool new_value)
{
m_interrupted = new_value;
}
+
void
AddRestartedReason (const char *reason)
{
@@ -925,32 +929,22 @@ public:
bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted.
int m_update_state;
bool m_interrupted;
- DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
+ DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
};
-
-#endif
-
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ProcessPropertiesSP &
- GetGlobalProperties();
+#endif // SWIG
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, and the Process listener.
/// Uses the Host UnixSignalsSP by default.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener);
+ Process(lldb::TargetSP target_sp, Listener &listener);
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, the Process listener,
/// and the appropriate UnixSignalsSP for the process.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
+ Process(lldb::TargetSP target_sp, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
//------------------------------------------------------------------
/// Destructor.
@@ -958,8 +952,16 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~Process();
+ ~Process() override;
+
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ProcessPropertiesSP &
+ GetGlobalProperties();
//------------------------------------------------------------------
/// Find a Process plug-in that can debug \a module using the
@@ -973,20 +975,18 @@ public:
/// The module shared pointer that this process will debug.
///
/// @param[in] plugin_name
- /// If NULL, select the best plug-in for the binary. If non-NULL
+ /// If nullptr, select the best plug-in for the binary. If non-nullptr
/// then look for a plugin whose PluginInfo's name matches
/// this string.
///
/// @see Process::CanDebug ()
//------------------------------------------------------------------
static lldb::ProcessSP
- FindPlugin (Target &target,
+ FindPlugin (lldb::TargetSP target_sp,
const char *plugin_name,
Listener &listener,
const FileSpec *crash_file_path);
-
-
//------------------------------------------------------------------
/// Static function that can be used with the \b host function
/// Host::StartMonitoringChildProcess ().
@@ -997,16 +997,16 @@ public:
/// Subclasses should call Host::StartMonitoringChildProcess ()
/// with:
/// callback = Process::SetHostProcessExitStatus
- /// callback_baton = NULL
+ /// callback_baton = nullptr
/// pid = Process::GetID()
/// monitor_signals = false
//------------------------------------------------------------------
static bool
- SetProcessExitStatus (void *callback_baton, // The callback baton which should be set to NULL
- lldb::pid_t pid, // The process ID we want to monitor
- bool exited,
- int signo, // Zero for no signal
- int status); // Exit value of process if signal is zero
+ SetProcessExitStatus(void *callback_baton, // The callback baton which should be set to nullptr
+ lldb::pid_t pid, // The process ID we want to monitor
+ bool exited,
+ int signo, // Zero for no signal
+ int status); // Exit value of process if signal is zero
lldb::ByteOrder
GetByteOrder () const;
@@ -1019,6 +1019,7 @@ public:
{
return m_process_unique_id;
}
+
//------------------------------------------------------------------
/// Check if a plug-in instance can debug the file in \a module.
///
@@ -1031,10 +1032,9 @@ public:
/// debug the executable, \b false otherwise.
//------------------------------------------------------------------
virtual bool
- CanDebug (Target &target,
+ CanDebug (lldb::TargetSP target,
bool plugin_specified_by_name) = 0;
-
//------------------------------------------------------------------
/// This object is about to be destroyed, do any necessary cleanup.
///
@@ -1043,8 +1043,7 @@ public:
//------------------------------------------------------------------
virtual void
Finalize();
-
-
+
//------------------------------------------------------------------
/// Return whether this object is valid (i.e. has not been finalized.)
///
@@ -1075,7 +1074,7 @@ public:
virtual CommandObject *
GetPluginCommandObject()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1163,7 +1162,7 @@ public:
///
/// @return
/// Returns a pointer to the SystemRuntime plugin for this Process
- /// if one is available. Else returns NULL.
+ /// if one is available. Else returns nullptr.
//------------------------------------------------------------------
virtual SystemRuntime *
GetSystemRuntime ();
@@ -1194,7 +1193,7 @@ public:
/// @param[in] strm
/// A stream where output intended for the user
/// (if the driver has a way to display that) generated during
- /// the connection. This may be NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1236,31 +1235,24 @@ public:
GetImageInfoAddress ();
//------------------------------------------------------------------
- /// Load a shared library into this process.
- ///
- /// Try and load a shared library into the current process. This
- /// call might fail in the dynamic loader plug-in says it isn't safe
- /// to try and load shared libraries at the moment.
- ///
- /// @param[in] image_spec
- /// The image file spec that points to the shared library that
- /// you want to load.
+ /// Called when the process is about to broadcast a public stop.
///
- /// @param[out] error
- /// An error object that gets filled in with any errors that
- /// might occur when trying to load the shared library.
- ///
- /// @return
- /// A token that represents the shared library that can be
- /// later used to unload the shared library. A value of
- /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
- /// library can't be opened.
+ /// There are public and private stops. Private stops are when the
+ /// process is doing things like stepping and the client doesn't
+ /// need to know about starts and stop that implement a thread plan.
+ /// Single stepping over a source line in code might end up being
+ /// implemented by one or more process starts and stops. Public stops
+ /// are when clients will be notified that the process is stopped.
+ /// These events typically trigger UI updates (thread stack frames to
+ /// be displayed, variables to be displayed, and more). This function
+ /// can be overriden and allows process subclasses to do something
+ /// before the eBroadcastBitStateChanged event is sent to public
+ /// clients.
//------------------------------------------------------------------
- virtual uint32_t
- LoadImage (const FileSpec &image_spec, Error &error);
-
- virtual Error
- UnloadImage (uint32_t image_token);
+ virtual void
+ WillPublicStop ()
+ {
+ }
//------------------------------------------------------------------
/// Register for process and thread notifications.
@@ -1278,6 +1270,7 @@ public:
void
RegisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//------------------------------------------------------------------
/// Unregister for process and thread notifications.
///
@@ -1298,6 +1291,7 @@ public:
bool
UnregisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//==================================================================
// Built in Process Control functions
//==================================================================
@@ -1334,6 +1328,7 @@ public:
Error
ResumeSynchronous (Stream *stream);
+
//------------------------------------------------------------------
/// Halts a running process.
///
@@ -1346,12 +1341,15 @@ public:
/// @param[in] clear_thread_plans
/// If true, when the process stops, clear all thread plans.
///
+ /// @param[in] use_run_lock
+ /// Whether to release the run lock after the stop.
+ ///
/// @return
/// Returns an error object. If the error is empty, the process is halted.
/// otherwise the halt has failed.
//------------------------------------------------------------------
Error
- Halt (bool clear_thread_plans = false);
+ Halt (bool clear_thread_plans = false, bool use_run_lock = true);
//------------------------------------------------------------------
/// Detaches from a running or stopped process.
@@ -1402,7 +1400,7 @@ public:
Signal (int signal);
void
- SetUnixSignals(const lldb::UnixSignalsSP &signals_sp);
+ SetUnixSignals(lldb::UnixSignalsSP &&signals_sp);
const lldb::UnixSignalsSP &
GetUnixSignals();
@@ -1447,7 +1445,7 @@ public:
/// @param[in] strm
/// A stream where output intended for the user
/// (if the driver has a way to display that) generated during
- /// the connection. This may be NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1525,7 +1523,6 @@ public:
process_arch.Clear();
}
-
//------------------------------------------------------------------
/// Called after a process re-execs itself.
///
@@ -1590,7 +1587,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after launching a process.
///
@@ -1600,8 +1596,6 @@ public:
virtual void
DidLaunch () {}
-
-
//------------------------------------------------------------------
/// Called before resuming to a process.
///
@@ -1639,7 +1633,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after resuming a process.
///
@@ -1649,7 +1642,6 @@ public:
virtual void
DidResume () {}
-
//------------------------------------------------------------------
/// Called before halting to a process.
///
@@ -1668,9 +1660,8 @@ public:
/// DoHalt must produce one and only one stop StateChanged event if it actually
/// stops the process. If the stop happens through some natural event (for
/// instance a SIGSTOP), then forwarding that event will do. Otherwise, you must
- /// generate the event manually. Note also, the private event thread is stopped when
- /// DoHalt is run to prevent the events generated while halting to trigger
- /// other state changes before the halt is complete.
+ /// generate the event manually. This function is called from the context of the
+ /// private state thread.
///
/// @param[out] caused_stop
/// If true, then this Halt caused the stop, otherwise, the
@@ -1688,7 +1679,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after halting a process.
///
@@ -1728,7 +1718,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after detaching from a process.
///
@@ -1781,7 +1770,6 @@ public:
virtual bool
DestroyRequiresHalt() { return true; }
-
//------------------------------------------------------------------
/// Called after sending a signal to a process.
///
@@ -1808,6 +1796,41 @@ public:
RefreshStateAfterStop () = 0;
//------------------------------------------------------------------
+ /// Sometimes the connection to a process can detect the host OS
+ /// version that the process is running on. The current platform
+ /// should be checked first in case the platform is connected, but
+ /// clients can fall back onto this function if the platform fails
+ /// to identify the host OS version. The platform should be checked
+ /// first in case you are running a simulator platform that might
+ /// itself be running natively, but have different heuristics for
+ /// figuring out which OS is is emulating.
+ ///
+ /// @param[out] major
+ /// The major OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @param[out] minor
+ /// The minor OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @param[out] update
+ /// The update OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @return
+ /// Returns \b true if the host OS version info was filled in
+ /// and \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ GetHostOSVersion(uint32_t &major,
+ uint32_t &minor,
+ uint32_t &update)
+ {
+ major = UINT32_MAX;
+ minor = UINT32_MAX;
+ update = UINT32_MAX;
+ return false;
+ }
+
+
+ //------------------------------------------------------------------
/// Get the target object pointer for this module.
///
/// @return
@@ -1817,7 +1840,7 @@ public:
Target &
GetTarget ()
{
- return m_target;
+ return *m_target_sp.lock();
}
//------------------------------------------------------------------
@@ -1830,7 +1853,7 @@ public:
const Target &
GetTarget () const
{
- return m_target;
+ return *m_target_sp.lock();
}
//------------------------------------------------------------------
@@ -1888,7 +1911,6 @@ public:
virtual void
ModulesDidLoad (ModuleList &module_list);
-
//------------------------------------------------------------------
/// Retrieve the list of shared libraries that are loaded for this process
///
@@ -1919,30 +1941,20 @@ public:
return StructuredData::ObjectSP();
}
-protected:
-
- void
- SetState (lldb::EventSP &event_sp);
-
- lldb::StateType
- GetPrivateState ();
-
//------------------------------------------------------------------
- /// The "private" side of resuming a process. This doesn't alter the
- /// state of m_run_lock, but just causes the process to resume.
+ /// Print a user-visible warning about a module being built with optimization
///
- /// @return
- /// An Error object describing the success or failure of the resume.
- //------------------------------------------------------------------
- Error
- PrivateResume ();
-
- //------------------------------------------------------------------
- // Called internally
+ /// Prints a async warning message to the user one time per Module
+ /// where a function is found that was compiled with optimization, per
+ /// Process.
+ ///
+ /// @param [in] sc
+ /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule
+ /// pre-computed.
//------------------------------------------------------------------
void
- CompleteAttach ();
-
+ PrintWarningOptimization (const SymbolContext &sc);
+
public:
//------------------------------------------------------------------
/// Get the exit status for a process.
@@ -1958,13 +1970,12 @@ public:
/// Get a textual description of what the process exited.
///
/// @return
- /// The textual description of why the process exited, or NULL
+ /// The textual description of why the process exited, or nullptr
/// if there is no description available.
//------------------------------------------------------------------
const char *
GetExitDescription ();
-
virtual void
DidExit ()
{
@@ -2045,7 +2056,7 @@ public:
/// otherwise.
//------------------------------------------------------------------
virtual bool
- IsAlive () = 0;
+ IsAlive ();
//------------------------------------------------------------------
/// Before lldb detaches from a process, it warns the user that they are about to lose their debug session.
@@ -2255,7 +2266,6 @@ public:
return 0;
}
-
//------------------------------------------------------------------
/// Write all or part of a scalar value to memory.
///
@@ -2329,7 +2339,6 @@ public:
size_t
WriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error);
-
//------------------------------------------------------------------
/// Actually allocate memory in the process.
///
@@ -2352,7 +2361,6 @@ public:
return LLDB_INVALID_ADDRESS;
}
-
//------------------------------------------------------------------
/// The public interface to allocating memory in the process.
///
@@ -2369,16 +2377,41 @@ public:
/// that a block that isn't set writable can still be written on from lldb,
/// just not by the process itself.
///
- /// @param[in/out] error
+ /// @param[in,out] error
/// An error object to fill in if things go wrong.
/// @return
/// The address of the allocated buffer in the process, or
/// LLDB_INVALID_ADDRESS if the allocation failed.
//------------------------------------------------------------------
-
lldb::addr_t
AllocateMemory (size_t size, uint32_t permissions, Error &error);
+ //------------------------------------------------------------------
+ /// The public interface to allocating memory in the process, this also
+ /// clears the allocated memory.
+ ///
+ /// This function will allocate memory in the process's address
+ /// space. This can't rely on the generic function calling mechanism,
+ /// since that requires this function.
+ ///
+ /// @param[in] size
+ /// The size of the allocation requested.
+ ///
+ /// @param[in] permissions
+ /// Or together any of the lldb::Permissions bits. The permissions on
+ /// a given memory allocation can't be changed after allocation. Note
+ /// that a block that isn't set writable can still be written on from lldb,
+ /// just not by the process itself.
+ ///
+ /// @param[in/out] error
+ /// An error object to fill in if things go wrong.
+ /// @return
+ /// The address of the allocated buffer in the process, or
+ /// LLDB_INVALID_ADDRESS if the allocation failed.
+ //------------------------------------------------------------------
+
+ lldb::addr_t
+ CallocateMemory (size_t size, uint32_t permissions, Error &error);
//------------------------------------------------------------------
/// Resolve dynamically loaded indirect functions.
@@ -2393,7 +2426,6 @@ public:
/// The address of the resolved function.
/// LLDB_INVALID_ADDRESS if the resolution failed.
//------------------------------------------------------------------
-
virtual lldb::addr_t
ResolveIndirectFunction(const Address *address, Error &error);
@@ -2518,7 +2550,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
virtual Error
DoDeallocateMemory (lldb::addr_t ptr)
{
@@ -2527,7 +2558,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// The public interface to deallocating memory in the process.
///
@@ -2541,7 +2571,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
Error
DeallocateMemory (lldb::addr_t ptr);
@@ -2671,7 +2700,6 @@ public:
return error;
}
-
virtual Error
DisableBreakpointSite (BreakpointSite *bp_site)
{
@@ -2680,7 +2708,6 @@ public:
return error;
}
-
// This is implemented completely using the lldb::Process API. Subclasses
// don't need to implement this function unless the standard flow of
// read existing opcode, write breakpoint opcode, verify breakpoint opcode
@@ -2717,7 +2744,6 @@ public:
Error
EnableBreakpointSiteByID (lldb::user_id_t break_id);
-
// BreakpointLocations use RemoveOwnerFromBreakpointSite to remove
// themselves from the owner's list of this breakpoint sites.
void
@@ -2811,12 +2837,16 @@ public:
// Returns the process state when it is stopped. If specified, event_sp_ptr
// is set to the event which triggered the stop. If wait_always = false,
// and the process is already stopped, this function returns immediately.
+ // If the process is hijacked and use_run_lock is true (the default), then this
+ // function releases the run lock after the stop. Setting use_run_lock to false
+ // will avoid this behavior.
lldb::StateType
- WaitForProcessToStop (const TimeValue *timeout,
- lldb::EventSP *event_sp_ptr = NULL,
- bool wait_always = true,
- Listener *hijack_listener = NULL,
- Stream *stream = NULL);
+ WaitForProcessToStop(const TimeValue *timeout,
+ lldb::EventSP *event_sp_ptr = nullptr,
+ bool wait_always = true,
+ Listener *hijack_listener = nullptr,
+ Stream *stream = nullptr,
+ bool use_run_lock = true);
uint32_t
GetIOHandlerID () const
@@ -2838,9 +2868,9 @@ public:
SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);
lldb::StateType
- WaitForStateChangedEvents (const TimeValue *timeout,
- lldb::EventSP &event_sp,
- Listener *hijack_listener); // Pass NULL to use builtin listener
+ WaitForStateChangedEvents(const TimeValue *timeout,
+ lldb::EventSP &event_sp,
+ Listener *hijack_listener); // Pass nullptr to use builtin listener
//--------------------------------------------------------------------------------------
/// Centralize the code that handles and prints descriptions for process state changes.
@@ -2851,7 +2881,7 @@ public:
/// @param[in] stream
/// The output stream to get the state change description
///
- /// @param[inout] pop_process_io_handler
+ /// @param[in,out] pop_process_io_handler
/// If this value comes in set to \b true, then pop the Process IOHandler if needed.
/// Else this variable will be set to \b true or \b false to indicate if the process
/// needs to have its process IOHandler popped.
@@ -2863,9 +2893,9 @@ public:
HandleProcessStateChangedEvent (const lldb::EventSP &event_sp,
Stream *stream,
bool &pop_process_io_handler);
+
Event *
PeekAtStateChangedEvents ();
-
class
ProcessEventHijacker
@@ -2876,6 +2906,7 @@ public:
{
m_process.HijackProcessEvents (listener);
}
+
~ProcessEventHijacker ()
{
m_process.RestoreProcessEvents();
@@ -2884,6 +2915,7 @@ public:
private:
Process &m_process;
};
+
friend class ProcessEventHijacker;
friend class ProcessProperties;
//------------------------------------------------------------------
@@ -2910,27 +2942,6 @@ public:
void
RestoreProcessEvents ();
-private:
- //------------------------------------------------------------------
- /// This is the part of the event handling that for a process event.
- /// It decides what to do with the event and returns true if the
- /// event needs to be propagated to the user, and false otherwise.
- /// If the event is not propagated, this call will most likely set
- /// the target to executing again.
- /// There is only one place where this call should be called, HandlePrivateEvent.
- /// Don't call it from anywhere else...
- ///
- /// @param[in] event_ptr
- /// This is the event we are handling.
- ///
- /// @return
- /// Returns \b true if the event should be reported to the
- /// user, \b false otherwise.
- //------------------------------------------------------------------
- bool
- ShouldBroadcastEvent (Event *event_ptr);
-
-public:
const lldb::ABISP &
GetABI ();
@@ -3004,29 +3015,29 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ()
+ lldb::ProcessSP
+ CalculateProcess() override
{
return shared_from_this();
}
- virtual lldb::ThreadSP
- CalculateThread ()
+ lldb::ThreadSP
+ CalculateThread() override
{
return lldb::ThreadSP();
}
- virtual lldb::StackFrameSP
- CalculateStackFrame ()
+ lldb::StackFrameSP
+ CalculateStackFrame() override
{
return lldb::StackFrameSP();
}
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
void
SetSTDIOFileDescriptor (int file_descriptor);
@@ -3129,9 +3140,70 @@ public:
return Error("Not supported");
}
+ size_t
+ AddImageToken(lldb::addr_t image_ptr);
+
+ lldb::addr_t
+ GetImagePtrFromToken(size_t token) const;
+
+ void
+ ResetImageToken(size_t token);
+
protected:
+ void
+ SetState (lldb::EventSP &event_sp);
+
+ lldb::StateType
+ GetPrivateState ();
+
+ //------------------------------------------------------------------
+ /// The "private" side of resuming a process. This doesn't alter the
+ /// state of m_run_lock, but just causes the process to resume.
+ ///
+ /// @return
+ /// An Error object describing the success or failure of the resume.
+ //------------------------------------------------------------------
+ Error
+ PrivateResume ();
//------------------------------------------------------------------
+ // Called internally
+ //------------------------------------------------------------------
+ void
+ CompleteAttach ();
+
+ //------------------------------------------------------------------
+ /// Print a user-visible warning one time per Process
+ ///
+ /// A facility for printing a warning to the user once per repeat_key.
+ ///
+ /// warning_type is from the Process::Warnings enums.
+ /// repeat_key is a pointer value that will be used to ensure that the
+ /// warning message is not printed multiple times. For instance, with a
+ /// warning about a function being optimized, you can pass the CompileUnit
+ /// pointer to have the warning issued for only the first function in a
+ /// CU, or the Function pointer to have it issued once for every function,
+ /// or a Module pointer to have it issued once per Module.
+ ///
+ /// Classes outside Process should call a specific PrintWarning method
+ /// so that the warning strings are all centralized in Process, instead of
+ /// calling PrintWarning() directly.
+ ///
+ /// @param [in] warning_type
+ /// One of the types defined in Process::Warnings.
+ ///
+ /// @param [in] repeat_key
+ /// A pointer value used to ensure that the warning is only printed once.
+ /// May be nullptr, indicating that the warning is printed unconditionally
+ /// every time.
+ ///
+ /// @param [in] fmt
+ /// printf style format string
+ //------------------------------------------------------------------
+ void
+ PrintWarning (uint64_t warning_type, const void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+
+ //------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
// event that is delivered to this process. There is currently only
// one next event action allowed in the process at one time. If a
@@ -3158,10 +3230,8 @@ protected:
}
virtual
- ~NextEventAction()
- {
- }
-
+ ~NextEventAction() = default;
+
virtual EventActionResult PerformAction (lldb::EventSP &event_sp) = 0;
virtual void HandleBeingUnshipped () {}
virtual EventActionResult HandleBeingInterrupted () = 0;
@@ -3170,6 +3240,7 @@ protected:
{
m_process->m_resume_requested = true;
}
+
protected:
Process *m_process;
};
@@ -3188,25 +3259,17 @@ protected:
public:
AttachCompletionHandler (Process *process, uint32_t exec_count);
- virtual
- ~AttachCompletionHandler()
- {
- }
-
- virtual EventActionResult PerformAction (lldb::EventSP &event_sp);
- virtual EventActionResult HandleBeingInterrupted ();
- virtual const char *GetExitString();
+ ~AttachCompletionHandler() override = default;
+
+ EventActionResult PerformAction(lldb::EventSP &event_sp) override;
+ EventActionResult HandleBeingInterrupted() override;
+ const char *GetExitString() override;
+
private:
uint32_t m_exec_count;
std::string m_exit_string;
};
- bool
- HijackPrivateProcessEvents (Listener *listener);
-
- void
- RestorePrivateProcessEvents ();
-
bool
PrivateStateThreadIsValid () const
{
@@ -3223,6 +3286,8 @@ protected:
// Type definitions
//------------------------------------------------------------------
typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection;
+ typedef std::unordered_set<const void *> WarningsPointerSet;
+ typedef std::map<uint64_t, WarningsPointerSet> WarningsCollection;
struct PreResumeCallbackAndBaton
{
@@ -3238,7 +3303,7 @@ protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
- Target & m_target; ///< The target that owns this process.
+ std::weak_ptr<Target> m_target_sp; ///< The target that owns this process.
ThreadSafeValue<lldb::StateType> m_public_state;
ThreadSafeValue<lldb::StateType> m_private_state; // The actual state of our process
Broadcaster m_private_state_broadcaster; // This broadcaster feeds state changed events into the private state thread's listener.
@@ -3290,7 +3355,6 @@ protected:
std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
ProcessRunLock m_public_run_lock;
ProcessRunLock m_private_run_lock;
- Predicate<bool> m_currently_handling_event; // This predicate is set in HandlePrivateEvent while all its business is being done.
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
@@ -3302,6 +3366,7 @@ protected:
std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;
bool m_destroy_in_process;
bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, don't support the ability to modify the stack.
+ WarningsCollection m_warnings_issued; // A set of object pointers which have already had warnings printed
enum {
eCanJITDontKnow= 0,
@@ -3353,6 +3418,9 @@ protected:
void
HandlePrivateEvent (lldb::EventSP &event_sp);
+ Error
+ HaltPrivate();
+
lldb::StateType
WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp);
@@ -3401,23 +3469,39 @@ protected:
}
Error
- HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
+ StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
bool
StateChangedIsExternallyHijacked();
void
LoadOperatingSystemPlugin(bool flush);
+
private:
//------------------------------------------------------------------
- // For Process only
+ /// This is the part of the event handling that for a process event.
+ /// It decides what to do with the event and returns true if the
+ /// event needs to be propagated to the user, and false otherwise.
+ /// If the event is not propagated, this call will most likely set
+ /// the target to executing again.
+ /// There is only one place where this call should be called, HandlePrivateEvent.
+ /// Don't call it from anywhere else...
+ ///
+ /// @param[in] event_ptr
+ /// This is the event we are handling.
+ ///
+ /// @return
+ /// Returns \b true if the event should be reported to the
+ /// user, \b false otherwise.
//------------------------------------------------------------------
+ bool
+ ShouldBroadcastEvent (Event *event_ptr);
+
void ControlPrivateStateThread (uint32_t signal);
DISALLOW_COPY_AND_ASSIGN (Process);
-
};
} // namespace lldb_private
-#endif // liblldb_Process_h_
+#endif // liblldb_Process_h_
diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h
index c69c825a7976d..aea506644c370 100644
--- a/include/lldb/Target/QueueItem.h
+++ b/include/lldb/Target/QueueItem.h
@@ -10,8 +10,14 @@
#ifndef liblldb_QueueItem_h_
#define liblldb_QueueItem_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
@@ -19,7 +25,6 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h"
-
namespace lldb_private {
//------------------------------------------------------------------
@@ -32,12 +37,10 @@ namespace lldb_private {
// execution of the item begins.
//------------------------------------------------------------------
-
class QueueItem :
public std::enable_shared_from_this<QueueItem>
{
public:
-
QueueItem (lldb::QueueSP queue_sp, lldb::ProcessSP process_sp, lldb::addr_t item_ref, lldb_private::Address address);
~QueueItem ();
@@ -98,7 +101,7 @@ public:
bool
IsValid ()
{
- return m_queue_wp.lock() != NULL;
+ return m_queue_wp.lock() != nullptr;
}
//------------------------------------------------------------------
@@ -200,7 +203,6 @@ protected:
void
FetchEntireItem ();
-
lldb::QueueWP m_queue_wp;
lldb::ProcessWP m_process_wp;
@@ -220,16 +222,10 @@ protected:
std::string m_queue_label;
std::string m_target_queue_label;
-
private:
- //------------------------------------------------------------------
- // For QueueItem only
- //------------------------------------------------------------------
-
DISALLOW_COPY_AND_ASSIGN (QueueItem);
-
};
} // namespace lldb_private
-#endif // liblldb_QueueItem_h_
+#endif // liblldb_QueueItem_h_
diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h
index 9108d4575259c..037c27adaf10b 100644
--- a/include/lldb/Target/RegisterContext.h
+++ b/include/lldb/Target/RegisterContext.h
@@ -29,8 +29,7 @@ public:
//------------------------------------------------------------------
RegisterContext (Thread &thread, uint32_t concrete_frame_idx);
- virtual
- ~RegisterContext ();
+ ~RegisterContext() override;
void
InvalidateIfNeeded (bool force);
@@ -93,7 +92,7 @@ public:
///
/// There may be multiple ways to enumerate the registers for a given
/// architecture. ABI references will specify one to be used with
- /// DWARF, the register numberings from stabs (aka "gcc"), there may
+ /// DWARF, the register numberings from process plugin, there may
/// be a variation used for eh_frame unwind instructions (e.g. on Darwin),
/// and so on. Register 5 by itself is meaningless - RegisterKind
/// enumeration tells you what context that number should be translated as.
@@ -213,26 +212,27 @@ public:
bool
WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval);
+
bool
ConvertBetweenRegisterKinds (lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t& target_regnum);
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
uint32_t
GetStopID () const
@@ -262,4 +262,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_RegisterContext_h_
+#endif // liblldb_RegisterContext_h_
diff --git a/include/lldb/Target/SectionLoadList.h b/include/lldb/Target/SectionLoadList.h
index 6a9bbab93c986..5f5d39e2b24bc 100644
--- a/include/lldb/Target/SectionLoadList.h
+++ b/include/lldb/Target/SectionLoadList.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/DenseMap.h"
// Project includes
#include "lldb/lldb-public.h"
+#include "lldb/Core/Section.h"
#include "lldb/Host/Mutex.h"
namespace lldb_private {
diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h
index 95e21445be04d..b65b018101762 100644
--- a/include/lldb/Target/StackFrame.h
+++ b/include/lldb/Target/StackFrame.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <memory>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Error.h"
@@ -45,11 +47,12 @@ class StackFrame :
public:
enum ExpressionPathOption
{
- eExpressionPathOptionCheckPtrVsMember = (1u << 0),
- eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
- eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
- eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
- eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4)
+ eExpressionPathOptionCheckPtrVsMember = (1u << 0),
+ eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
+ eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
+ eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
+ eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4),
+ eExpressionPathOptionsInspectAnonymousUnions = (1u << 5)
};
//------------------------------------------------------------------
@@ -135,7 +138,7 @@ public:
const Address& pc,
const SymbolContext *sc_ptr);
- virtual ~StackFrame ();
+ ~StackFrame() override;
lldb::ThreadSP
GetThread () const
@@ -223,7 +226,7 @@ public:
/// executing.
///
/// @return
- /// A pointer to the current Block. NULL is returned if this can
+ /// A pointer to the current Block. nullptr is returned if this can
/// not be provided.
//------------------------------------------------------------------
Block *
@@ -351,7 +354,7 @@ public:
/// Optional string that will be prepended to the frame output description.
//------------------------------------------------------------------
void
- DumpUsingSettingsFormat (Stream *strm, const char *frame_marker = NULL);
+ DumpUsingSettingsFormat(Stream *strm, const char *frame_marker = nullptr);
//------------------------------------------------------------------
/// Print a description for this frame using a default format.
@@ -388,10 +391,10 @@ public:
/// Returns true if successful.
//------------------------------------------------------------------
bool
- GetStatus (Stream &strm,
- bool show_frame_info,
- bool show_source,
- const char *frame_marker = NULL);
+ GetStatus(Stream &strm,
+ bool show_frame_info,
+ bool show_source,
+ const char *frame_marker = nullptr);
//------------------------------------------------------------------
/// Query whether this frame is a concrete frame on the call stack,
@@ -466,22 +469,32 @@ public:
TrackGlobalVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic);
//------------------------------------------------------------------
+ /// Query this frame to determine what the default language should be
+ /// when parsing expressions given the execution context.
+ ///
+ /// @return
+ /// The language of the frame if known, else lldb::eLanguageTypeUnknown.
+ //------------------------------------------------------------------
+ lldb::LanguageType
+ GetLanguage ();
+
+ //------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
protected:
friend class StackFrameList;
@@ -520,9 +533,10 @@ private:
ValueObjectList m_variable_list_value_objects; // Value objects for each variable in m_variable_list_sp
StreamString m_disassembly;
Mutex m_mutex;
+
DISALLOW_COPY_AND_ASSIGN (StackFrame);
};
} // namespace lldb_private
-#endif // liblldb_StackFrame_h_
+#endif // liblldb_StackFrame_h_
diff --git a/include/lldb/Target/StackFrameList.h b/include/lldb/Target/StackFrameList.h
index 2680be3e5a68d..50a656de9e690 100644
--- a/include/lldb/Target/StackFrameList.h
+++ b/include/lldb/Target/StackFrameList.h
@@ -12,6 +12,7 @@
// C Includes
// C++ Includes
+#include <memory>
#include <vector>
// Other libraries and framework includes
@@ -84,15 +85,14 @@ public:
GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr);
size_t
- GetStatus (Stream &strm,
- uint32_t first_frame,
- uint32_t num_frames,
- bool show_frame_info,
- uint32_t num_frames_with_source,
- const char *frame_marker = NULL);
+ GetStatus(Stream &strm,
+ uint32_t first_frame,
+ uint32_t num_frames,
+ bool show_frame_info,
+ uint32_t num_frames_with_source,
+ const char *frame_marker = nullptr);
protected:
-
friend class Thread;
bool
@@ -129,9 +129,6 @@ protected:
void
SetCurrentInlinedDepth (uint32_t new_depth);
- //------------------------------------------------------------------
- // Classes that inherit from StackFrameList can see and modify these
- //------------------------------------------------------------------
typedef std::vector<lldb::StackFrameSP> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
@@ -147,12 +144,9 @@ protected:
bool m_show_inlined_frames;
private:
- //------------------------------------------------------------------
- // For StackFrameList only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (StackFrameList);
};
} // namespace lldb_private
-#endif // liblldb_StackFrameList_h_
+#endif // liblldb_StackFrameList_h_
diff --git a/include/lldb/Target/StackID.h b/include/lldb/Target/StackID.h
index 75ad8ab38903f..aad9d0cfc25c6 100644
--- a/include/lldb/Target/StackID.h
+++ b/include/lldb/Target/StackID.h
@@ -28,7 +28,7 @@ public:
StackID () :
m_pc (LLDB_INVALID_ADDRESS),
m_cfa (LLDB_INVALID_ADDRESS),
- m_symbol_scope (NULL)
+ m_symbol_scope (nullptr)
{
}
@@ -47,9 +47,7 @@ public:
{
}
- ~StackID()
- {
- }
+ ~StackID() = default;
lldb::addr_t
GetPC() const
@@ -80,7 +78,7 @@ public:
{
m_pc = LLDB_INVALID_ADDRESS;
m_cfa = LLDB_INVALID_ADDRESS;
- m_symbol_scope = NULL;
+ m_symbol_scope = nullptr;
}
bool
@@ -108,7 +106,6 @@ public:
}
protected:
-
friend class StackFrame;
void
@@ -123,18 +120,15 @@ protected:
m_cfa = cfa;
}
- //------------------------------------------------------------------
- // Classes that inherit from StackID can see and modify these
- //------------------------------------------------------------------
lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will
- // only get used if the symbol scope is NULL (the code where we are
+ // only get used if the symbol scope is nullptr (the code where we are
// stopped is not represented by any function or symbol in any
// shared library).
lldb::addr_t m_cfa; // The call frame address (stack pointer) value
// at the beginning of the function that uniquely
// identifies this frame (along with m_symbol_scope below)
- SymbolContextScope *m_symbol_scope; // If NULL, there is no block or symbol for this frame.
- // If not NULL, this will either be the scope for the
+ SymbolContextScope *m_symbol_scope; // If nullptr, there is no block or symbol for this frame.
+ // If not nullptr, this will either be the scope for the
// lexical block for the frame, or the scope
// for the symbol. Symbol context scopes are
// always be unique pointers since the are part
@@ -151,4 +145,4 @@ bool operator< (const StackID& lhs, const StackID& rhs);
} // namespace lldb_private
-#endif // liblldb_StackID_h_
+#endif // liblldb_StackID_h_
diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h
index 2553887fa3d97..dfc9860b604aa 100644
--- a/include/lldb/Target/StopInfo.h
+++ b/include/lldb/Target/StopInfo.h
@@ -172,7 +172,7 @@ public:
static lldb::StopInfoSP
CreateStopReasonWithPlan (lldb::ThreadPlanSP &plan,
lldb::ValueObjectSP return_valobj_sp,
- lldb::ClangExpressionVariableSP expression_variable_sp);
+ lldb::ExpressionVariableSP expression_variable_sp);
static lldb::StopInfoSP
CreateStopReasonWithException (Thread &thread, const char *description);
@@ -183,7 +183,7 @@ public:
static lldb::ValueObjectSP
GetReturnValueObject (lldb::StopInfoSP &stop_info_sp);
- static lldb::ClangExpressionVariableSP
+ static lldb::ExpressionVariableSP
GetExpressionVariable (lldb::StopInfoSP &stop_info_sp);
protected:
diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h
index 18f38f79bdbdd..54fde88c8d12d 100644
--- a/include/lldb/Target/SystemRuntime.h
+++ b/include/lldb/Target/SystemRuntime.h
@@ -75,8 +75,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~SystemRuntime();
+ ~SystemRuntime() override;
//------------------------------------------------------------------
/// Called after attaching to a process.
@@ -354,9 +353,10 @@ protected:
std::vector<ConstString> m_types;
private:
+
DISALLOW_COPY_AND_ASSIGN (SystemRuntime);
};
} // namespace lldb_private
-#endif // liblldb_SystemRuntime_h_
+#endif // liblldb_SystemRuntime_h_
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index 427f68e4c5d4d..0cdb248a9b444 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -13,6 +13,10 @@
// C Includes
// C++ Includes
#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -24,6 +28,8 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/ProcessLaunchInfo.h"
@@ -55,8 +61,7 @@ class TargetProperties : public Properties
public:
TargetProperties(Target *target);
- virtual
- ~TargetProperties();
+ ~TargetProperties() override;
ArchSpec
GetDefaultArchitecture () const;
@@ -169,6 +174,9 @@ public:
bool
GetBreakpointsConsultPlatformAvoidList ();
+ lldb::LanguageType
+ GetLanguage () const;
+
const char *
GetExpressionPrefixContentsAsCString ();
@@ -229,7 +237,6 @@ private:
static void DisableASLRValueChangedCallback(void *target_property_ptr, OptionValue *);
static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *);
-private:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
@@ -295,9 +302,7 @@ public:
const char *
GetPrefix () const
{
- if (m_prefix.empty())
- return NULL;
- return m_prefix.c_str();
+ return (m_prefix.empty() ? nullptr : m_prefix.c_str());
}
void
@@ -438,6 +443,18 @@ public:
}
bool
+ GetColorizeErrors () const
+ {
+ return m_ansi_color_errors;
+ }
+
+ void
+ SetColorizeErrors (bool b)
+ {
+ m_ansi_color_errors = b;
+ }
+
+ bool
GetTrapExceptions() const
{
return m_trap_exceptions;
@@ -449,6 +466,18 @@ public:
m_trap_exceptions = b;
}
+ bool
+ GetREPLEnabled() const
+ {
+ return m_repl;
+ }
+
+ void
+ SetREPLEnabled (bool b)
+ {
+ m_repl = b;
+ }
+
void
SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
{
@@ -459,10 +488,36 @@ public:
bool
InvokeCancelCallback (lldb::ExpressionEvaluationPhase phase) const
{
- if (m_cancel_callback == nullptr)
- return false;
+ return ((m_cancel_callback != nullptr) ? m_cancel_callback(phase, m_cancel_callback_baton) : false);
+ }
+
+ // Allows the expression contents to be remapped to point to the specified file and line
+ // using #line directives.
+ void
+ SetPoundLine (const char *path, uint32_t line) const
+ {
+ if (path && path[0])
+ {
+ m_pound_line_file = path;
+ m_pound_line_line = line;
+ }
else
- return m_cancel_callback (phase, m_cancel_callback_baton);
+ {
+ m_pound_line_file.clear();
+ m_pound_line_line = 0;
+ }
+ }
+
+ const char *
+ GetPoundLineFilePath () const
+ {
+ return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
+ }
+
+ uint32_t
+ GetPoundLineLine () const
+ {
+ return m_pound_line_line;
}
void
@@ -489,13 +544,20 @@ private:
bool m_stop_others;
bool m_debug;
bool m_trap_exceptions;
+ bool m_repl;
bool m_generate_debug_info;
+ bool m_ansi_color_errors;
bool m_result_is_internal;
lldb::DynamicValueType m_use_dynamic;
uint32_t m_timeout_usec;
uint32_t m_one_thread_timeout_usec;
lldb::ExpressionCancelCallback m_cancel_callback;
void *m_cancel_callback_baton;
+ // If m_pound_line_file is not empty and m_pound_line_line is non-zero,
+ // use #line %u "%s" before the expression content to remap where the source
+ // originates
+ mutable std::string m_pound_line_file;
+ mutable uint32_t m_pound_line_line;
};
//----------------------------------------------------------------------
@@ -527,7 +589,7 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
@@ -540,20 +602,19 @@ public:
TargetEventData (const lldb::TargetSP &target_sp, const ModuleList &module_list);
- virtual
- ~TargetEventData();
+ ~TargetEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const
+ const ConstString &
+ GetFlavor() const override
{
return TargetEventData::GetFlavorString ();
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static const TargetEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -583,6 +644,8 @@ public:
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
+ ~Target() override;
+
static void
SettingsInitialize ();
@@ -608,8 +671,8 @@ public:
// UpdateInstanceName ();
lldb::ModuleSP
- GetSharedModule (const ModuleSpec &module_spec,
- Error *error_ptr = NULL);
+ GetSharedModule(const ModuleSpec &module_spec,
+ Error *error_ptr = nullptr);
//----------------------------------------------------------------------
// Settings accessors
@@ -618,36 +681,6 @@ public:
static const lldb::TargetPropertiesSP &
GetGlobalProperties();
-
-private:
- //------------------------------------------------------------------
- /// Construct with optional file and arch.
- ///
- /// This member is private. Clients must use
- /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- /// so all targets can be tracked from the central target list.
- ///
- /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- //------------------------------------------------------------------
- Target (Debugger &debugger,
- const ArchSpec &target_arch,
- const lldb::PlatformSP &platform_sp,
- bool is_dummy_target);
-
- // Helper function.
- bool
- ProcessIsValid ();
-
- // Copy breakpoints, stop hooks and so forth from the dummy target:
- void
- PrimeFromDummyTarget(Target *dummy_target);
-
- void
- AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
-
-public:
- ~Target();
-
Mutex &
GetAPIMutex ()
{
@@ -659,6 +692,7 @@ public:
void
CleanupProcess ();
+
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
@@ -718,7 +752,7 @@ public:
lldb::BreakpointSP
GetBreakpointByID (lldb::break_id_t break_id);
- // Use this to create a file and line breakpoint to a given module or all module it is NULL
+ // Use this to create a file and line breakpoint to a given module or all module it is nullptr
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpec &file,
@@ -744,24 +778,32 @@ public:
bool internal,
bool request_hardware);
+ // Use this to create a breakpoint from a load address and a module file spec
+ lldb::BreakpointSP
+ CreateAddressInModuleBreakpoint (lldb::addr_t file_addr,
+ bool internal,
+ const FileSpec *file_spec,
+ bool request_hardware);
+
// Use this to create Address breakpoints:
lldb::BreakpointSP
- CreateBreakpoint (Address &addr,
+ CreateBreakpoint (const Address &addr,
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is NULL
+ // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in
lldb::BreakpointSP
CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
RegularExpression &func_regexp,
+ lldb::LanguageType requested_language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
+ // Use this to create a function breakpoint by name in containingModule, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in.
// func_name_type_mask is or'ed values from the FunctionNameType enum.
@@ -770,17 +812,18 @@ public:
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
lldb::BreakpointSP
- CreateExceptionBreakpoint (enum lldb::LanguageType language,
- bool catch_bp,
- bool throw_bp,
- bool internal,
- Args *additional_args = nullptr,
- Error *additional_args_error = nullptr);
+ CreateExceptionBreakpoint(enum lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp,
+ bool internal,
+ Args *additional_args = nullptr,
+ Error *additional_args_error = nullptr);
// This is the same as the func_name breakpoint except that you can specify a vector of names. This is cheaper
// than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
@@ -792,6 +835,7 @@ public:
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
@@ -801,11 +845,11 @@ public:
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
-
// Use this to create a general breakpoint:
lldb::BreakpointSP
CreateBreakpoint (lldb::SearchFilterSP &filter_sp,
@@ -818,7 +862,7 @@ public:
lldb::WatchpointSP
CreateWatchpoint (lldb::addr_t addr,
size_t size,
- const ClangASTType *type,
+ const CompilerType *type,
uint32_t kind,
Error &error);
@@ -914,26 +958,14 @@ public:
lldb::addr_t
GetOpcodeLoadAddress (lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
-protected:
- //------------------------------------------------------------------
- /// Implementing of ModuleList::Notifier.
- //------------------------------------------------------------------
-
- virtual void
- ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
-
- virtual void
- ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
-
- virtual void
- ModuleUpdated (const ModuleList& module_list,
- const lldb::ModuleSP& old_module_sp,
- const lldb::ModuleSP& new_module_sp);
- virtual void
- WillClearList (const ModuleList& module_list);
+ // Get load_addr as breakable load address for this target.
+ // Take a addr and check if for any reason there is a better address than this to put a breakpoint on.
+ // If there is then return that address.
+ // For MIPS, if instruction at addr is a delay slot instruction then this method will find the address of its
+ // previous instruction and return that address.
+ lldb::addr_t
+ GetBreakableLoadAddress (lldb::addr_t addr);
-public:
-
void
ModulesDidLoad (ModuleList &module_list);
@@ -970,7 +1002,7 @@ public:
///
/// @return
/// The shared pointer to the executable module which can
- /// contains a NULL Module object if no executable has been
+ /// contains a nullptr Module object if no executable has been
/// set.
///
/// @see DynamicLoader
@@ -1014,9 +1046,9 @@ public:
SetExecutableModule (lldb::ModuleSP& module_sp, bool get_dependent_files);
bool
- LoadScriptingResources (std::list<Error>& errors,
- Stream* feedback_stream = NULL,
- bool continue_on_error = true)
+ LoadScriptingResources(std::list<Error>& errors,
+ Stream* feedback_stream = nullptr,
+ bool continue_on_error = true)
{
return m_images.LoadScriptingResourcesInTarget(this,errors,feedback_stream,continue_on_error);
}
@@ -1146,12 +1178,12 @@ public:
// 2 - if there is a valid process, try and read from its memory
// 3 - if (prefer_file_cache == false) then read from object file cache
size_t
- ReadMemory (const Address& addr,
- bool prefer_file_cache,
- void *dst,
- size_t dst_len,
- Error &error,
- lldb::addr_t *load_addr_ptr = NULL);
+ ReadMemory(const Address& addr,
+ bool prefer_file_cache,
+ void *dst,
+ size_t dst_len,
+ Error &error,
+ lldb::addr_t *load_addr_ptr = nullptr);
size_t
ReadCStringFromMemory (const Address& addr, std::string &out_str, Error &error);
@@ -1199,28 +1231,70 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
PathMappingList &
GetImageSearchPathList ();
+ TypeSystem *
+ GetScratchTypeSystemForLanguage (Error *error, lldb::LanguageType language, bool create_on_demand = true);
+
+ PersistentExpressionState *
+ GetPersistentExpressionStateForLanguage (lldb::LanguageType language);
+
+ // Creates a UserExpression for the given language, the rest of the parameters have the
+ // same meaning as for the UserExpression constructor.
+ // Returns a new-ed object which the caller owns.
+
+ UserExpression *
+ GetUserExpressionForLanguage(const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ Error &error);
+
+ // Creates a FunctionCaller for the given language, the rest of the parameters have the
+ // same meaning as for the FunctionCaller constructor. Since a FunctionCaller can't be
+ // IR Interpreted, it makes no sense to call this with an ExecutionContextScope that lacks
+ // a Process.
+ // Returns a new-ed object which the caller owns.
+
+ FunctionCaller *
+ GetFunctionCallerForLanguage (lldb::LanguageType language,
+ const CompilerType &return_type,
+ const Address& function_address,
+ const ValueList &arg_value_list,
+ const char *name,
+ Error &error);
+
+ // Creates a UtilityFunction for the given language, the rest of the parameters have the
+ // same meaning as for the UtilityFunction constructor.
+ // Returns a new-ed object which the caller owns.
+
+ UtilityFunction *
+ GetUtilityFunctionForLanguage (const char *expr,
+ lldb::LanguageType language,
+ const char *name,
+ Error &error);
+
ClangASTContext *
GetScratchClangASTContext(bool create_on_demand=true);
- ClangASTImporter *
+ lldb::ClangASTImporterSP
GetClangASTImporter();
//----------------------------------------------------------------------
@@ -1266,23 +1340,26 @@ public:
// in in th execution context.
lldb::ExpressionResults
EvaluateExpression (const char *expression,
- StackFrame *frame,
+ ExecutionContextScope *exe_scope,
lldb::ValueObjectSP &result_valobj_sp,
const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
- ClangPersistentVariables &
- GetPersistentVariables();
-
+ lldb::ExpressionVariableSP
+ GetPersistentVariable(const ConstString &name);
+
+ lldb::addr_t
+ GetPersistentSymbol(const ConstString &name);
+
//------------------------------------------------------------------
// Target Stop Hooks
//------------------------------------------------------------------
class StopHook : public UserID
{
public:
- ~StopHook ();
-
StopHook (const StopHook &rhs);
-
+
+ ~StopHook ();
+
StringList *
GetCommandPointer ()
{
@@ -1448,9 +1525,32 @@ public:
lldb::SearchFilterSP
GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles);
+
+ lldb::REPLSP
+ GetREPL (Error &err, lldb::LanguageType language, const char *repl_options, bool can_create);
+
+ void
+ SetREPL (lldb::LanguageType language, lldb::REPLSP repl_sp);
protected:
//------------------------------------------------------------------
+ /// Implementing of ModuleList::Notifier.
+ //------------------------------------------------------------------
+
+ void
+ ModuleAdded(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleRemoved(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleUpdated(const ModuleList& module_list,
+ const lldb::ModuleSP& old_module_sp,
+ const lldb::ModuleSP& new_module_sp) override;
+ void
+ WillClearList(const ModuleList& module_list) override;
+
+ //------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
Debugger & m_debugger;
@@ -1470,11 +1570,13 @@ protected:
lldb::ProcessSP m_process_sp;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
- lldb::ClangASTContextUP m_scratch_ast_context_ap;
- lldb::ClangASTSourceUP m_scratch_ast_source_ap;
- lldb::ClangASTImporterUP m_ast_importer_ap;
+ TypeSystemMap m_scratch_type_system_map;
+
+ typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
+ REPLMap m_repl_map;
+
+ lldb::ClangASTImporterSP m_ast_importer_sp;
lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_ap;
- lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
lldb::SourceManagerUP m_source_manager_ap;
@@ -1490,9 +1592,34 @@ protected:
void *baton);
private:
+ //------------------------------------------------------------------
+ /// Construct with optional file and arch.
+ ///
+ /// This member is private. Clients must use
+ /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ /// so all targets can be tracked from the central target list.
+ ///
+ /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ //------------------------------------------------------------------
+ Target (Debugger &debugger,
+ const ArchSpec &target_arch,
+ const lldb::PlatformSP &platform_sp,
+ bool is_dummy_target);
+
+ // Helper function.
+ bool
+ ProcessIsValid ();
+
+ // Copy breakpoints, stop hooks and so forth from the dummy target:
+ void
+ PrimeFromDummyTarget(Target *dummy_target);
+
+ void
+ AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
+
DISALLOW_COPY_AND_ASSIGN (Target);
};
} // namespace lldb_private
-#endif // liblldb_Target_h_
+#endif // liblldb_Target_h_
diff --git a/include/lldb/Target/TargetList.h b/include/lldb/Target/TargetList.h
index 27e46ba81a70f..fddb715b46f3e 100644
--- a/include/lldb/Target/TargetList.h
+++ b/include/lldb/Target/TargetList.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Broadcaster.h"
@@ -37,7 +39,6 @@ private:
TargetList(Debugger &debugger);
public:
-
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -51,12 +52,12 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
- virtual ~TargetList();
+ ~TargetList() override;
//------------------------------------------------------------------
/// Create a new Target.
@@ -72,12 +73,12 @@ public:
///
/// @param[in] file_spec
/// The main executable file for a debug target. This value
- /// can be NULL and the file can be set later using:
+ /// can be nullptr and the file can be set later using:
/// Target::SetExecutableModule (ModuleSP&)
///
/// @param[in] triple_cstr
/// A target triple string to be used for the target. This can
- /// be NULL if the triple is not known or when attaching to a
+ /// be nullptr if the triple is not known or when attaching to a
/// process.
///
/// @param[in] get_dependent_modules
@@ -86,7 +87,7 @@ public:
///
/// @param[in] platform_options
/// A pointer to the platform options to use when creating this
- /// target. If this value is NULL, then the currently selected
+ /// target. If this value is nullptr, then the currently selected
/// platform will be used.
///
/// @param[out] target_sp
@@ -149,7 +150,7 @@ public:
//------------------------------------------------------------------
/// Find the target that contains has an executable whose path
/// matches \a exe_file_spec, and whose architecture matches
- /// \a arch_ptr if arch_ptr is not NULL.
+ /// \a arch_ptr if arch_ptr is not nullptr.
///
/// @param[in] exe_file_spec
/// A file spec containing a basename, or a full path (directory
@@ -160,18 +161,18 @@ public:
/// directory, then both must match.
///
/// @param[in] exe_arch_ptr
- /// If not NULL then the architecture also needs to match, else
+ /// If not nullptr then the architecture also needs to match, else
/// the architectures will be compared.
///
/// @return
/// A shared pointer to a target object. The returned shared
- /// pointer will contain NULL if no target objects have a
+ /// pointer will contain nullptr if no target objects have a
/// executable whose full or partial path matches
/// with a matching process ID.
//------------------------------------------------------------------
lldb::TargetSP
- FindTargetWithExecutableAndArchitecture (const FileSpec &exe_file_spec,
- const ArchSpec *exe_arch_ptr = NULL) const;
+ FindTargetWithExecutableAndArchitecture(const FileSpec &exe_file_spec,
+ const ArchSpec *exe_arch_ptr = nullptr) const;
//------------------------------------------------------------------
/// Find the target that contains a process with process ID \a
@@ -182,7 +183,7 @@ public:
///
/// @return
/// A shared pointer to a target object. The returned shared
- /// pointer will contain NULL if no target objects own a process
+ /// pointer will contain nullptr if no target objects own a process
/// with a matching process ID.
//------------------------------------------------------------------
lldb::TargetSP
@@ -230,6 +231,7 @@ protected:
lldb::TargetSP m_dummy_target_sp;
mutable Mutex m_target_list_mutex;
uint32_t m_selected_target_idx;
+
private:
lldb::TargetSP
GetDummyTarget (lldb_private::Debugger &debugger);
@@ -262,4 +264,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_TargetList_h_
+#endif // liblldb_TargetList_h_
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index c6a3c8e9851ab..7aff77bd16f4a 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -10,6 +10,14 @@
#ifndef liblldb_Thread_h_
#define liblldb_Thread_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Core/Broadcaster.h"
@@ -30,8 +38,7 @@ class ThreadProperties : public Properties
public:
ThreadProperties(bool is_global);
- virtual
- ~ThreadProperties();
+ ~ThreadProperties() override;
//------------------------------------------------------------------
/// The regular expression returned determines symbols that this
@@ -39,7 +46,7 @@ public:
///
/// @return
/// A pointer to a regular expression to compare against symbols,
- /// or NULL if all symbols are allowed.
+ /// or nullptr if all symbols are allowed.
///
//------------------------------------------------------------------
const RegularExpression *
@@ -82,7 +89,7 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
@@ -97,19 +104,19 @@ public:
ThreadEventData();
- virtual ~ThreadEventData();
+ ~ThreadEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const
+ const ConstString &
+ GetFlavor() const override
{
return ThreadEventData::GetFlavorString ();
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static const ThreadEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -138,9 +145,9 @@ public:
private:
lldb::ThreadSP m_thread_sp;
StackID m_stack_id;
- DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
+
+ DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
};
-
struct ThreadStateCheckpoint
{
@@ -151,15 +158,6 @@ public:
lldb::addr_t current_inlined_pc;
};
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ThreadPropertiesSP &
- GetGlobalProperties();
-
//------------------------------------------------------------------
/// Constructor
///
@@ -179,7 +177,16 @@ public:
//------------------------------------------------------------------
Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
- virtual ~Thread();
+ ~Thread() override;
+
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ThreadPropertiesSP &
+ GetGlobalProperties();
lldb::ProcessSP
GetProcess() const
@@ -303,6 +310,9 @@ public:
lldb::StopReason
GetStopReason();
+ bool
+ StopInfoIsUpToDate() const;
+
// This sets the stop reason to a "blank" stop reason, so you can call functions on the thread
// without having the called function run with whatever stop reason you stopped with.
void
@@ -320,7 +330,7 @@ public:
virtual const char *
GetInfo ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -348,7 +358,7 @@ public:
virtual const char *
GetName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -390,12 +400,12 @@ public:
///
/// @return
/// The Queue name, if the Thread subclass implements this, else
- /// NULL.
+ /// nullptr.
//------------------------------------------------------------------
virtual const char *
GetQueueName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -475,7 +485,7 @@ public:
ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast = false);
Error
- JumpToLine (const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = NULL);
+ JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = nullptr);
virtual lldb::StackFrameSP
GetFrameWithStackID (const StackID &stack_id)
@@ -492,16 +502,11 @@ public:
}
lldb::StackFrameSP
- GetSelectedFrame ()
- {
- lldb::StackFrameListSP stack_frame_list_sp(GetStackFrameList());
- return stack_frame_list_sp->GetFrameAtIndex (stack_frame_list_sp->GetSelectedFrameIndex());
- }
+ GetSelectedFrame ();
uint32_t
SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast = false);
-
bool
SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast = false);
@@ -608,6 +613,7 @@ public:
//------------------------------------------------------------------
virtual Error
StepOut ();
+
//------------------------------------------------------------------
/// Retrieves the per-thread data area.
/// Most OSs maintain a per-thread pointer (e.g. the FS register on
@@ -684,7 +690,7 @@ public:
/// Otherwise this plan will go on the end of the plan stack.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueFundamentalPlan (bool abort_other_plans);
@@ -703,7 +709,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepSingleInstruction (bool step_over,
@@ -739,7 +745,7 @@ public:
/// If eLazyBoolCalculate, we will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOverRange (bool abort_other_plans,
@@ -748,6 +754,15 @@ public:
lldb::RunMode stop_other_threads,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+ // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple
+ // LineEntries of the same source line number to step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepOverRange (bool abort_other_plans,
+ const LineEntry &line_entry,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
//------------------------------------------------------------------
/// Queues the plan used to step through an address range, stepping into functions.
///
@@ -783,7 +798,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepInRange (bool abort_other_plans,
@@ -794,6 +809,17 @@ public:
LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+ // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple
+ // LineEntries of the same source line number to step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepInRange (bool abort_other_plans,
+ const LineEntry &line_entry,
+ const SymbolContext &addr_context,
+ const char *step_in_target,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
//------------------------------------------------------------------
/// Queue the plan used to step out of the function at the current PC of
/// \a thread.
@@ -824,7 +850,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOut (bool abort_other_plans,
@@ -863,7 +889,7 @@ public:
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans,
@@ -891,7 +917,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepThrough (StackID &return_stack_id,
@@ -914,7 +940,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForRunToAddress (bool abort_other_plans,
@@ -957,15 +983,6 @@ public:
Error
UnwindInnermostExpression();
-private:
- bool
- PlanIsBasePlan (ThreadPlan *plan_ptr);
-
- void
- BroadcastSelectedFrameChange(StackID &new_frame_id);
-
-public:
-
//------------------------------------------------------------------
/// Gets the outer-most plan that was popped off the plan stack in the
/// most recent stop. Useful for printing the stop reason accurately.
@@ -990,11 +1007,11 @@ public:
/// Gets the outer-most expression variable from the completed plans
///
/// @return
- /// A ClangExpressionVariableSP, either empty if there is no
+ /// A ExpressionVariableSP, either empty if there is no
/// plan completed an expression during the current stop
/// or the expression variable that was made for the completed expression.
//------------------------------------------------------------------
- lldb::ClangExpressionVariableSP
+ lldb::ExpressionVariableSP
GetExpressionVariable ();
//------------------------------------------------------------------
@@ -1041,7 +1058,6 @@ public:
void
QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
-
//------------------------------------------------------------------
/// Discards the plans queued on the plan stack of the current thread. This is
/// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
@@ -1147,20 +1163,20 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
lldb::StackFrameSP
GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr);
@@ -1271,7 +1287,6 @@ public:
}
protected:
-
friend class ThreadPlan;
friend class ThreadList;
friend class ThreadEventData;
@@ -1323,7 +1338,15 @@ protected:
lldb::StackFrameListSP
GetStackFrameList ();
-
+
+ void
+ SetTemporaryResumeState(lldb::StateType new_state)
+ {
+ m_temporary_resume_state = new_state;
+ }
+
+ void
+ FunctionOptimizationWarning (lldb_private::StackFrame *frame);
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
@@ -1353,14 +1376,17 @@ protected:
private:
bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info for this thread?
StructuredData::ObjectSP m_extended_info; // The extended info for this thread
- //------------------------------------------------------------------
- // For Thread only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (Thread);
+private:
+ bool
+ PlanIsBasePlan (ThreadPlan *plan_ptr);
+ void
+ BroadcastSelectedFrameChange(StackID &new_frame_id);
+
+ DISALLOW_COPY_AND_ASSIGN (Thread);
};
} // namespace lldb_private
-#endif // liblldb_Thread_h_
+#endif // liblldb_Thread_h_
diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h
index 12c430c9c8d89..e6489b25e558c 100644
--- a/include/lldb/Target/ThreadList.h
+++ b/include/lldb/Target/ThreadList.h
@@ -32,8 +32,7 @@ public:
ThreadList (const ThreadList &rhs);
- virtual
- ~ThreadList ();
+ ~ThreadList() override;
const ThreadList&
operator = (const ThreadList& rhs);
@@ -128,8 +127,8 @@ public:
void
SetStopID (uint32_t stop_id);
- virtual Mutex &
- GetMutex ();
+ Mutex &
+ GetMutex() override;
void
Update (ThreadList &rhs);
@@ -150,9 +149,10 @@ protected:
lldb::tid_t m_selected_tid; ///< For targets that need the notion of a current thread.
private:
+
ThreadList ();
};
} // namespace lldb_private
-#endif // liblldb_ThreadList_h_
+#endif // liblldb_ThreadList_h_
diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h
index db2e798940577..e6f9aeb78dd62 100644
--- a/include/lldb/Target/ThreadPlan.h
+++ b/include/lldb/Target/ThreadPlan.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -518,10 +519,10 @@ public:
// the user regained control at that point) a subsequent process control command step/continue/etc. might
// complete the expression evaluations. If so, the result of the expression evaluation will show up here.
- virtual lldb::ClangExpressionVariableSP
+ virtual lldb::ExpressionVariableSP
GetExpressionVariable ()
{
- return lldb::ClangExpressionVariableSP();
+ return lldb::ExpressionVariableSP();
}
// If a thread plan stores the state before it was run, then you might
@@ -562,13 +563,14 @@ public:
else
return m_iteration_count;
}
+
protected:
//------------------------------------------------------------------
// Classes that inherit from ThreadPlan can see and modify these
//------------------------------------------------------------------
virtual bool
- DoWillResume (lldb::StateType resume_state, bool current_plan) { return true; };
+ DoWillResume (lldb::StateType resume_state, bool current_plan) { return true; }
virtual bool
DoPlanExplainsStop (Event *event_ptr) = 0;
@@ -613,6 +615,9 @@ protected:
virtual lldb::StateType
GetPlanRunState () = 0;
+ bool
+ IsUsuallyUnexplainedStopReason(lldb::StopReason);
+
Thread &m_thread;
Vote m_stop_vote;
Vote m_run_vote;
@@ -653,47 +658,46 @@ class ThreadPlanNull : public ThreadPlan
{
public:
ThreadPlanNull (Thread &thread);
- virtual ~ThreadPlanNull ();
+ ~ThreadPlanNull() override;
- virtual void
- GetDescription (Stream *s,
- lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- IsBasePlan()
+ bool
+ IsBasePlan() override
{
return true;
}
- virtual bool
- OkayToDiscard ()
+ bool
+ OkayToDiscard() override
{
return false;
}
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanNull);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_h_
+#endif // liblldb_ThreadPlan_h_
diff --git a/include/lldb/Target/ThreadPlanBase.h b/include/lldb/Target/ThreadPlanBase.h
index 69959e12f848c..a0d30b5f0b67e 100644
--- a/include/lldb/Target/ThreadPlanBase.h
+++ b/include/lldb/Target/ThreadPlanBase.h
@@ -31,31 +31,32 @@ class ThreadPlanBase : public ThreadPlan
{
friend class Process; // RunThreadPlan manages "stopper" base plans.
public:
- virtual ~ThreadPlanBase ();
+ ~ThreadPlanBase() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual Vote ShouldReportStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
- virtual bool OkayToDiscard()
+ bool
+ OkayToDiscard() override
{
return false;
}
- virtual bool
- IsBasePlan()
+ bool
+ IsBasePlan() override
{
return true;
}
protected:
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanBase (Thread &thread);
private:
@@ -65,7 +66,6 @@ private:
DISALLOW_COPY_AND_ASSIGN (ThreadPlanBase);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlanFundamental_h_
+#endif // liblldb_ThreadPlanFundamental_h_
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 36e4d6e71c797..47eee2808f1e2 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -26,11 +26,11 @@ class ThreadPlanCallFunction : public ThreadPlan
{
// Create a thread plan to call a function at the address passed in the "function"
// argument. If you plan to call GetReturnValueObject, then pass in the
- // return type, otherwise just pass in an invalid ClangASTType.
+ // return type, otherwise just pass in an invalid CompilerType.
public:
ThreadPlanCallFunction (Thread &thread,
const Address &function,
- const ClangASTType &return_type,
+ const CompilerType &return_type,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options);
@@ -38,35 +38,34 @@ public:
const Address &function,
const EvaluateExpressionOptions &options);
- virtual
- ~ThreadPlanCallFunction ();
+ ~ThreadPlanCallFunction() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual Vote
- ShouldReportStop(Event *event_ptr);
+ Vote
+ ShouldReportStop(Event *event_ptr) override;
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
- virtual void
- DidPush ();
+ void
+ DidPush() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
// To get the return value from a function call you must create a
// lldb::ValueSP that contains a valid clang type in its context and call
@@ -77,8 +76,8 @@ public:
// plan is complete, you can call "GetReturnValue()" to retrieve the value
// that was extracted.
- virtual lldb::ValueObjectSP
- GetReturnValueObject ()
+ lldb::ValueObjectSP
+ GetReturnValueObject() override
{
return m_return_valobj_sp;
}
@@ -93,11 +92,11 @@ public:
return m_function_sp;
}
- // Classes that derive from ClangFunction, and implement
+ // Classes that derive from FunctionCaller, and implement
// their own WillPop methods should call this so that the
// thread state gets restored if the plan gets discarded.
- virtual void
- WillPop ();
+ void
+ WillPop() override;
// If the thread plan stops mid-course, this will be the stop reason that interrupted us.
// Once DoTakedown is called, this will be the real stop reason at the end of the function call.
@@ -105,8 +104,8 @@ public:
// This is needed because we want the CallFunction thread plans not to show up as the stop reason.
// But if something bad goes wrong, it is nice to be able to tell the user what really happened.
- virtual lldb::StopInfoSP
- GetRealStopInfo()
+ lldb::StopInfoSP
+ GetRealStopInfo() override
{
if (m_real_stop_info_sp)
return m_real_stop_info_sp;
@@ -120,23 +119,23 @@ public:
return m_stop_address;
}
- virtual bool
- RestoreThreadState();
+ bool
+ RestoreThreadState() override;
- virtual void
- ThreadDestroyed ()
+ void
+ ThreadDestroyed() override
{
m_takedown_done = true;
}
- virtual void
- SetStopOthers (bool new_value);
+ void
+ SetStopOthers(bool new_value) override;
protected:
void ReportRegisterState (const char *message);
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
virtual void
SetReturnValue();
@@ -184,10 +183,10 @@ protected:
lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown;
private:
- ClangASTType m_return_type;
+ CompilerType m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunction_h_
+#endif // liblldb_ThreadPlanCallFunction_h_
diff --git a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
index 83d78a5dca08b..529057175287a 100644
--- a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
+++ b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -38,7 +38,7 @@ public:
llvm::ArrayRef<ABI::CallArgument> args,
const EvaluateExpressionOptions &options);
- ~ThreadPlanCallFunctionUsingABI ();
+ ~ThreadPlanCallFunctionUsingABI() override;
void
GetDescription (Stream *s, lldb::DescriptionLevel level) override;
@@ -47,7 +47,6 @@ protected:
void
SetReturnValue () override;
-
private:
llvm::Type &m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunctionUsingABI);
@@ -55,4 +54,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
+#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index e40762c928b56..bb261d9c96b44 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -30,22 +30,21 @@ public:
Address &function,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options,
- lldb::ClangUserExpressionSP &user_expression_sp);
+ lldb::UserExpressionSP &user_expression_sp);
- virtual
- ~ThreadPlanCallUserExpression ();
+ ~ThreadPlanCallUserExpression() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual void
- WillPop ();
+ void
+ WillPop() override;
- virtual lldb::StopInfoSP
- GetRealStopInfo();
+ lldb::StopInfoSP
+ GetRealStopInfo() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
void
TransferExpressionOwnership ()
@@ -53,19 +52,19 @@ public:
m_manage_materialization = true;
}
- virtual lldb::ClangExpressionVariableSP
- GetExpressionVariable ()
+ lldb::ExpressionVariableSP
+ GetExpressionVariable() override
{
return m_result_var_sp;
}
protected:
private:
- lldb::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
+ lldb::UserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
// User expression the initiated this ThreadPlan
// lives as long as the thread plan does.
bool m_manage_materialization = false;
- lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
+ lldb::ExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
// then stuff the result expression variable here.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallUserExpression);
@@ -73,4 +72,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallUserExpression_h_
+#endif // liblldb_ThreadPlanCallUserExpression_h_
diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h
index ffcee018a5fb6..ab3fbbdf6fb5f 100644
--- a/include/lldb/Target/ThreadPlanPython.h
+++ b/include/lldb/Target/ThreadPlanPython.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -37,45 +38,44 @@ class ThreadPlanPython : public ThreadPlan
{
public:
ThreadPlanPython (Thread &thread, const char *class_name);
- virtual ~ThreadPlanPython ();
+ ~ThreadPlanPython() override;
- virtual void
- GetDescription (Stream *s,
- lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual void
- DidPush ();
+ void
+ DidPush() override;
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
private:
- std::string m_class_name;
- StructuredData::ObjectSP m_implementation_sp;
+ std::string m_class_name;
+ StructuredData::ObjectSP m_implementation_sp;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_Python_h_
+#endif // liblldb_ThreadPlan_Python_h_
diff --git a/include/lldb/Target/ThreadPlanRunToAddress.h b/include/lldb/Target/ThreadPlanRunToAddress.h
index d94820668017f..a1b974605ffbb 100644
--- a/include/lldb/Target/ThreadPlanRunToAddress.h
+++ b/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -36,37 +36,35 @@ public:
const std::vector<lldb::addr_t> &addresses,
bool stop_others);
+ ~ThreadPlanRunToAddress() override;
- virtual
- ~ThreadPlanRunToAddress ();
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- ShouldStop (Event *event_ptr);
-
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual void
- SetStopOthers (bool new_value);
+ void
+ SetStopOthers(bool new_value) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
void SetInitialBreakpoints();
bool AtOurAddress();
@@ -77,9 +75,8 @@ private:
std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are using to stop us at m_address.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanRunToAddress);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanRunToAddress_h_
+#endif // liblldb_ThreadPlanRunToAddress_h_
diff --git a/include/lldb/Target/ThreadPlanShouldStopHere.h b/include/lldb/Target/ThreadPlanShouldStopHere.h
index 26e4a1ec4fe77..a52d9e42effd5 100644
--- a/include/lldb/Target/ThreadPlanShouldStopHere.h
+++ b/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -74,9 +74,9 @@ public:
//------------------------------------------------------------------
ThreadPlanShouldStopHere (ThreadPlan *owner);
- ThreadPlanShouldStopHere (ThreadPlan *owner,
- const ThreadPlanShouldStopHereCallbacks *callbacks,
- void *baton = NULL);
+ ThreadPlanShouldStopHere(ThreadPlan *owner,
+ const ThreadPlanShouldStopHereCallbacks *callbacks,
+ void *baton = nullptr);
virtual
~ThreadPlanShouldStopHere();
@@ -139,23 +139,15 @@ protected:
// Implement this, and call it in the plan's constructor to set the default flags.
virtual void SetFlagsToDefault () = 0;
- //------------------------------------------------------------------
- // Classes that inherit from ThreadPlanShouldStopHere can see and modify these
- //------------------------------------------------------------------
ThreadPlanShouldStopHereCallbacks m_callbacks;
void * m_baton;
ThreadPlan *m_owner;
lldb_private::Flags m_flags;
private:
- //------------------------------------------------------------------
- // For ThreadPlanShouldStopHere only
- //------------------------------------------------------------------
-
DISALLOW_COPY_AND_ASSIGN (ThreadPlanShouldStopHere);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanShouldStopHere_h_
+#endif // liblldb_ThreadPlanShouldStopHere_h_
diff --git a/include/lldb/Target/ThreadPlanStepInRange.h b/include/lldb/Target/ThreadPlanStepInRange.h
index 3a22e97e30d0b..b31d355082710 100644
--- a/include/lldb/Target/ThreadPlanStepInRange.h
+++ b/include/lldb/Target/ThreadPlanStepInRange.h
@@ -42,14 +42,13 @@ public:
LazyBool step_in_avoids_code_without_debug_info,
LazyBool step_out_avoids_code_without_debug_info);
- virtual
- ~ThreadPlanStepInRange ();
+ ~ThreadPlanStepInRange() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
void SetAvoidRegexp(const char *name);
@@ -62,19 +61,19 @@ public:
SetDefaultFlagValue (uint32_t new_value);
bool
- IsVirtualStep();
+ IsVirtualStep() override;
protected:
static bool
DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
}
@@ -119,9 +118,8 @@ private:
bool m_virtual_step; // true if we've just done a "virtual step", i.e. just moved the inline stack depth.
ConstString m_step_into_target;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInRange);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInRange_h_
+#endif // liblldb_ThreadPlanStepInRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepInstruction.h b/include/lldb/Target/ThreadPlanStepInstruction.h
index 86069ffd9eb5e..da83ecadcae67 100644
--- a/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -23,19 +23,19 @@ namespace lldb_private {
class ThreadPlanStepInstruction : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepInstruction ();
+ ~ThreadPlanStepInstruction() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual bool IsPlanStale ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ bool IsPlanStale() override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanStepInstruction (Thread &thread,
bool step_over,
@@ -57,10 +57,8 @@ private:
StackID m_parent_frame_id;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInstruction);
-
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInstruction_h_
+#endif // liblldb_ThreadPlanStepInstruction_h_
diff --git a/include/lldb/Target/ThreadPlanStepOut.h b/include/lldb/Target/ThreadPlanStepOut.h
index 8c140dc9d95d1..ac5696357e9bd 100644
--- a/include/lldb/Target/ThreadPlanStepOut.h
+++ b/include/lldb/Target/ThreadPlanStepOut.h
@@ -33,32 +33,32 @@ public:
uint32_t frame_idx,
LazyBool step_out_avoids_code_without_debug_info);
- virtual ~ThreadPlanStepOut ();
+ ~ThreadPlanStepOut() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush();
- virtual bool IsPlanStale();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
- virtual lldb::ValueObjectSP GetReturnValueObject()
+ lldb::ValueObjectSP GetReturnValueObject() override
{
return m_return_valobj_sp;
}
protected:
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
}
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop (Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
bool QueueInlinedStepPlan (bool queue_now);
private:
@@ -95,9 +95,8 @@ private:
CalculateReturnValue();
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOut);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOut_h_
+#endif // liblldb_ThreadPlanStepOut_h_
diff --git a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
index a4806056afb9a..944f0e0455eea 100644
--- a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
+++ b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -22,29 +22,31 @@ namespace lldb_private {
class ThreadPlanStepOverBreakpoint : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepOverBreakpoint ();
-
ThreadPlanStepOverBreakpoint (Thread &thread);
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void ThreadDestroyed ();
- void SetAutoContinue (bool do_it);
- virtual bool ShouldAutoContinue(Event *event_ptr);
- virtual bool IsPlanStale();
+
+ ~ThreadPlanStepOverBreakpoint() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void ThreadDestroyed() override;
+ void SetAutoContinue(bool do_it);
+ bool ShouldAutoContinue(Event *event_ptr) override;
+ bool IsPlanStale() override;
lldb::addr_t
GetBreakpointLoadAddress() const
{
return m_breakpoint_addr;
}
+
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
void ReenableBreakpointSite ();
private:
@@ -55,9 +57,8 @@ private:
bool m_reenabled_breakpoint_site;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverBreakpoint);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
+#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
diff --git a/include/lldb/Target/ThreadPlanStepOverRange.h b/include/lldb/Target/ThreadPlanStepOverRange.h
index d47c6c9429d54..7defaef7d07d4 100644
--- a/include/lldb/Target/ThreadPlanStepOverRange.h
+++ b/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -25,32 +25,28 @@ class ThreadPlanStepOverRange : public ThreadPlanStepRange,
ThreadPlanShouldStopHere
{
public:
-
ThreadPlanStepOverRange (Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
lldb::RunMode stop_others,
LazyBool step_out_avoids_no_debug);
- virtual ~ThreadPlanStepOverRange ();
+ ~ThreadPlanStepOverRange() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ShouldStop (Event *event_ptr);
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ShouldStop(Event *event_ptr) override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepOverRange::s_default_flag_values);
}
-
-
-
-private:
+private:
static uint32_t s_default_flag_values;
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
@@ -59,9 +55,8 @@ private:
bool m_first_resume;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverRange);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverRange_h_
+#endif // liblldb_ThreadPlanStepOverRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepRange.h b/include/lldb/Target/ThreadPlanStepRange.h
index 43c55c2aa4119..8f6685f82aab8 100644
--- a/include/lldb/Target/ThreadPlanStepRange.h
+++ b/include/lldb/Target/ThreadPlanStepRange.h
@@ -33,24 +33,22 @@ public:
lldb::RunMode stop_others,
bool given_ranges_only = false);
- virtual ~ThreadPlanStepRange ();
-
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level) = 0;
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr) = 0;
- virtual Vote ShouldReportStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush ();
- virtual bool IsPlanStale ();
+ ~ThreadPlanStepRange() override;
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override = 0;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
void AddRange(const AddressRange &new_range);
protected:
-
bool InRange();
lldb::FrameComparison CompareCurrentFrameToStartFrame();
bool InSymbol();
@@ -88,10 +86,10 @@ protected:
private:
std::vector<lldb::DisassemblerSP> m_instruction_ranges;
- DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange);
+ DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange);
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepRange_h_
+#endif // liblldb_ThreadPlanStepRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepThrough.h b/include/lldb/Target/ThreadPlanStepThrough.h
index 16979663eb1bd..43af37c84a06d 100644
--- a/include/lldb/Target/ThreadPlanStepThrough.h
+++ b/include/lldb/Target/ThreadPlanStepThrough.h
@@ -22,20 +22,20 @@ namespace lldb_private {
class ThreadPlanStepThrough : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepThrough ();
+ ~ThreadPlanStepThrough() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
ThreadPlanStepThrough (Thread &thread,
StackID &return_stack_id,
@@ -49,6 +49,7 @@ protected:
private:
friend lldb::ThreadPlanSP
+
Thread::QueueThreadPlanForStepThrough (StackID &return_stack_id,
bool abort_other_plans,
bool stop_others);
@@ -63,9 +64,8 @@ private:
bool m_stop_others;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepThrough);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepThrough_h_
+#endif // liblldb_ThreadPlanStepThrough_h_
diff --git a/include/lldb/Target/ThreadPlanStepUntil.h b/include/lldb/Target/ThreadPlanStepUntil.h
index 5aa3876df53c8..3c1bd8c6665d2 100644
--- a/include/lldb/Target/ThreadPlanStepUntil.h
+++ b/include/lldb/Target/ThreadPlanStepUntil.h
@@ -19,33 +19,32 @@
namespace lldb_private {
-
class ThreadPlanStepUntil : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepUntil ();
+ ~ThreadPlanStepUntil() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
protected:
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanStepUntil (Thread &thread,
lldb::addr_t *address_list,
size_t num_addresses,
bool stop_others,
uint32_t frame_idx = 0);
- void AnalyzeStop(void);
-private:
+ void AnalyzeStop();
+private:
StackID m_stack_id;
lldb::addr_t m_step_from_insn;
lldb::break_id_t m_return_bp_id;
@@ -72,9 +71,8 @@ private:
// from step in.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepUntil);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepUntil_h_
+#endif // liblldb_ThreadPlanStepUntil_h_
diff --git a/include/lldb/Target/ThreadPlanTracer.h b/include/lldb/Target/ThreadPlanTracer.h
index 4eb0c783e57d8..6d064133fa917 100644
--- a/include/lldb/Target/ThreadPlanTracer.h
+++ b/include/lldb/Target/ThreadPlanTracer.h
@@ -26,7 +26,6 @@ class ThreadPlanTracer
friend class ThreadPlan;
public:
-
typedef enum ThreadPlanTracerStyle
{
eLocation = 0,
@@ -34,21 +33,18 @@ public:
eCheckFrames,
ePython
} ThreadPlanTracerStyle;
+
ThreadPlanTracer (Thread &thread, lldb::StreamSP &stream_sp);
ThreadPlanTracer (Thread &thread);
- virtual ~ThreadPlanTracer()
- {
- }
+ virtual ~ThreadPlanTracer() = default;
virtual void TracingStarted ()
{
-
}
virtual void TracingEnded ()
{
-
}
bool
@@ -90,8 +86,6 @@ protected:
Stream *
GetLogStream ();
-
-
virtual void Log();
private:
@@ -108,12 +102,13 @@ class ThreadPlanAssemblyTracer : public ThreadPlanTracer
public:
ThreadPlanAssemblyTracer (Thread &thread, lldb::StreamSP &stream_sp);
ThreadPlanAssemblyTracer (Thread &thread);
- virtual ~ThreadPlanAssemblyTracer ();
- virtual void TracingStarted ();
- virtual void TracingEnded ();
- virtual void Log();
+ ~ThreadPlanAssemblyTracer() override;
+
+ void TracingStarted() override;
+ void TracingEnded() override;
+ void Log() override;
+
private:
-
Disassembler *
GetDisassembler ();
@@ -128,4 +123,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanTracer_h_
+#endif // liblldb_ThreadPlanTracer_h_
diff --git a/include/lldb/Target/ThreadSpec.h b/include/lldb/Target/ThreadSpec.h
index e0d30934f3737..95f509a5cb9db 100644
--- a/include/lldb/Target/ThreadSpec.h
+++ b/include/lldb/Target/ThreadSpec.h
@@ -1,4 +1,4 @@
-//===-- ThreadSpec.h ------------------------------------------------*- C++ -*-===//
+//===-- ThreadSpec.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +10,12 @@
#ifndef liblldb_ThreadSpec_h_
#define liblldb_ThreadSpec_h_
-#include <map>
+// C Includes
+// C++ Includes
#include <string>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -110,7 +113,7 @@ public:
{
if (m_name.empty())
return true;
- else if (name == NULL)
+ else if (name == nullptr)
return false;
else
return m_name == name;
@@ -124,7 +127,7 @@ public:
{
if (m_queue_name.empty())
return true;
- else if (queue_name == NULL)
+ else if (queue_name == nullptr)
return false;
else
return m_queue_name == queue_name;
@@ -142,7 +145,6 @@ public:
void
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-protected:
private:
uint32_t m_index;
lldb::tid_t m_tid;
@@ -152,4 +154,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadSpec_h_
+#endif // liblldb_ThreadSpec_h_
diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h
index 76955deabc780..7a02f557067bd 100644
--- a/include/lldb/Target/UnixSignals.h
+++ b/include/lldb/Target/UnixSignals.h
@@ -98,6 +98,9 @@ public:
int32_t
GetSignalAtIndex(int32_t index) const;
+ ConstString
+ GetShortName(ConstString name) const;
+
// We assume that the elements of this object are constant once it is constructed,
// since a process should never need to add or remove symbols as it runs. So don't
// call these functions anywhere but the constructor of your subclass of UnixSignals or in
@@ -106,11 +109,11 @@ public:
void
AddSignal (int signo,
const char *name,
- const char *short_name,
bool default_suppress,
bool default_stop,
bool default_notify,
- const char *description);
+ const char *description,
+ const char *alias = nullptr);
void
RemoveSignal (int signo);
@@ -123,18 +126,18 @@ protected:
struct Signal
{
ConstString m_name;
- ConstString m_short_name;
+ ConstString m_alias;
std::string m_description;
bool m_suppress:1,
m_stop:1,
m_notify:1;
Signal (const char *name,
- const char *short_name,
bool default_suppress,
bool default_stop,
bool default_notify,
- const char *description);
+ const char *description,
+ const char *alias);
~Signal () {}
};
diff --git a/include/lldb/Target/UnwindAssembly.h b/include/lldb/Target/UnwindAssembly.h
index 963949cf07d56..6f53e7e710f55 100644
--- a/include/lldb/Target/UnwindAssembly.h
+++ b/include/lldb/Target/UnwindAssembly.h
@@ -24,8 +24,7 @@ public:
static lldb::UnwindAssemblySP
FindPlugin (const ArchSpec &arch);
- virtual
- ~UnwindAssembly();
+ ~UnwindAssembly() override;
virtual bool
GetNonCallSiteUnwindPlanFromAssembly (AddressRange& func,
@@ -59,6 +58,4 @@ private:
} // namespace lldb_private
-#endif //utility_UnwindAssembly_h_
-
-
+#endif // utility_UnwindAssembly_h_
diff --git a/include/lldb/Utility/AnsiTerminal.h b/include/lldb/Utility/AnsiTerminal.h
index 9a5117ae74ea4..a43dd1ba43251 100644
--- a/include/lldb/Utility/AnsiTerminal.h
+++ b/include/lldb/Utility/AnsiTerminal.h
@@ -41,8 +41,13 @@
#define ANSI_CTRL_CONCEAL 8
#define ANSI_CTRL_CROSSED_OUT 9
-#define ANSI_ESC_START "\033["
-#define ANSI_ESC_END "m"
+#define ANSI_ESC_START "\033["
+#define ANSI_ESC_END "m"
+
+#define ANSI_STR(s) #s
+#define ANSI_DEF_STR(s) ANSI_STR(s)
+
+#define ANSI_ESCAPE1(s) ANSI_ESC_START ANSI_DEF_STR(s) ANSI_ESC_END
#define ANSI_1_CTRL(ctrl1) "\033["##ctrl1 ANSI_ESC_END
#define ANSI_2_CTRL(ctrl1,ctrl2) "\033["##ctrl1";"##ctrl2 ANSI_ESC_END
diff --git a/include/lldb/Utility/Either.h b/include/lldb/Utility/Either.h
new file mode 100644
index 0000000000000..ae647363512d7
--- /dev/null
+++ b/include/lldb/Utility/Either.h
@@ -0,0 +1,154 @@
+//===-- Either.h -----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Either_h_
+#define liblldb_Either_h_
+
+#include "llvm/ADT/Optional.h"
+
+#include <functional>
+
+namespace lldb_utility {
+ template <typename T1, typename T2>
+ class Either
+ {
+ private:
+ enum class Selected
+ {
+ One, Two
+ };
+
+ Selected m_selected;
+ union
+ {
+ T1 m_t1;
+ T2 m_t2;
+ };
+
+ public:
+ Either (const T1& t1)
+ {
+ m_t1 = t1;
+ m_selected = Selected::One;
+ }
+
+ Either (const T2& t2)
+ {
+ m_t2 = t2;
+ m_selected = Selected::Two;
+ }
+
+ Either (const Either<T1,T2>& rhs)
+ {
+ switch (rhs.m_selected)
+ {
+ case Selected::One:
+ m_t1 = rhs.GetAs<T1>().getValue();
+ m_selected = Selected::One;
+ break;
+ case Selected::Two:
+ m_t2 = rhs.GetAs<T2>().getValue();
+ m_selected = Selected::Two;
+ break;
+ }
+ }
+
+ template <class X, typename std::enable_if<std::is_same<T1,X>::value>::type * = nullptr>
+ llvm::Optional<T1>
+ GetAs() const
+ {
+ switch (m_selected)
+ {
+ case Selected::One:
+ return m_t1;
+ default:
+ return llvm::Optional<T1>();
+ }
+ }
+
+ template <class X, typename std::enable_if<std::is_same<T2,X>::value>::type * = nullptr>
+ llvm::Optional<T2>
+ GetAs() const
+ {
+ switch (m_selected)
+ {
+ case Selected::Two:
+ return m_t2;
+ default:
+ return llvm::Optional<T2>();
+ }
+ }
+
+ template <class ResultType>
+ ResultType
+ Apply (std::function<ResultType(T1)> if_T1,
+ std::function<ResultType(T2)> if_T2) const
+ {
+ switch (m_selected)
+ {
+ case Selected::One:
+ return if_T1(m_t1);
+ case Selected::Two:
+ return if_T2(m_t2);
+ }
+ }
+
+ bool
+ operator == (const Either<T1,T2>& rhs)
+ {
+ return (GetAs<T1>() == rhs.GetAs<T1>()) && (GetAs<T2>() == rhs.GetAs<T2>());
+ }
+
+ explicit
+ operator bool ()
+ {
+ switch (m_selected)
+ {
+ case Selected::One:
+ return (bool)m_t1;
+ case Selected::Two:
+ return (bool)m_t2;
+ }
+ }
+
+ Either<T1,T2>&
+ operator = (const Either<T1,T2>& rhs)
+ {
+ switch (rhs.m_selected)
+ {
+ case Selected::One:
+ m_t1 = rhs.GetAs<T1>().getValue();
+ m_selected = Selected::One;
+ break;
+ case Selected::Two:
+ m_t2 = rhs.GetAs<T2>().getValue();
+ m_selected = Selected::Two;
+ break;
+ }
+ return *this;
+ }
+
+ ~Either ()
+ {
+ switch (m_selected)
+ {
+ case Selected::One:
+ m_t1.T1::~T1();
+ break;
+ case Selected::Two:
+ m_t2.T2::~T2();
+ break;
+ }
+ }
+ };
+
+} // namespace lldb_utility
+
+#endif // #ifndef liblldb_Either_h_
+
diff --git a/include/lldb/Utility/Iterable.h b/include/lldb/Utility/Iterable.h
index 17c8cf4d23193..2317225d126f0 100644
--- a/include/lldb/Utility/Iterable.h
+++ b/include/lldb/Utility/Iterable.h
@@ -10,6 +10,12 @@
#ifndef liblldb_Iterable_h_
#define liblldb_Iterable_h_
+// C Includes
+// C++ Includes
+#include <utility>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/Host/Mutex.h"
namespace lldb_private
@@ -34,9 +40,7 @@ template <typename C, typename E, E (*A)(typename C::const_iterator &)> class Ad
{
public:
typedef typename C::const_iterator BackingIterator;
-private:
- BackingIterator m_iter;
-public:
+
// Wrapping constructor
AdaptedConstIterator (BackingIterator backing_iterator) :
m_iter(backing_iterator)
@@ -63,7 +67,7 @@ public:
}
// Destructible
- ~AdaptedConstIterator () { }
+ ~AdaptedConstIterator() = default;
// Comparable
bool operator== (const AdaptedConstIterator &rhs)
@@ -160,6 +164,9 @@ public:
template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
friend void swap(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
+
+private:
+ BackingIterator m_iter;
};
template <typename C, typename E, E (*A)(typename C::const_iterator &)>
@@ -203,8 +210,6 @@ public:
template <typename C, typename E, E (*A)(typename C::const_iterator &)> class LockingAdaptedIterable : public AdaptedIterable<C, E, A>
{
-private:
- Mutex *m_mutex = nullptr;
public:
LockingAdaptedIterable (C &container, Mutex &mutex) :
AdaptedIterable<C,E,A>(container),
@@ -217,7 +222,7 @@ public:
AdaptedIterable<C,E,A>(rhs),
m_mutex(rhs.m_mutex)
{
- rhs.m_mutex = NULL;
+ rhs.m_mutex = nullptr;
}
~LockingAdaptedIterable ()
@@ -227,9 +232,11 @@ public:
}
private:
+ Mutex *m_mutex = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(LockingAdaptedIterable);
};
-}
+} // namespace lldb_private
-#endif
+#endif // liblldb_Iterable_h_
diff --git a/include/lldb/Utility/JSON.h b/include/lldb/Utility/JSON.h
index da5e26dbda281..e61c5ee85017c 100644
--- a/include/lldb/Utility/JSON.h
+++ b/include/lldb/Utility/JSON.h
@@ -71,8 +71,8 @@ namespace lldb_private {
JSONString&
operator = (const JSONString& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONString> SP;
@@ -84,8 +84,7 @@ namespace lldb_private {
return V->GetKind() == JSONValue::Kind::String;
}
- virtual
- ~JSONString () = default;
+ ~JSONString() override = default;
private:
@@ -98,43 +97,79 @@ namespace lldb_private {
class JSONNumber : public JSONValue
{
public:
- JSONNumber ();
- explicit JSONNumber (uint64_t i);
- explicit JSONNumber (double d);
+ typedef std::shared_ptr<JSONNumber> SP;
+
+ // We cretae a constructor for all integer and floating point type with using templates and
+ // SFINAE to avoid having ambiguous overloads because of the implicit type promotion. If we
+ // would have constructors only with int64_t, uint64_t and double types then constructing a
+ // JSONNumber from an int32_t (or any other similar type) would fail to compile.
+
+ template <typename T,
+ typename std::enable_if<std::is_integral<T>::value &&
+ std::is_unsigned<T>::value>::type* = nullptr>
+ explicit JSONNumber (T u) :
+ JSONValue(JSONValue::Kind::Number),
+ m_data_type(DataType::Unsigned)
+ {
+ m_data.m_unsigned = u;
+ }
+
+ template <typename T,
+ typename std::enable_if<std::is_integral<T>::value &&
+ std::is_signed<T>::value>::type* = nullptr>
+ explicit JSONNumber (T s) :
+ JSONValue(JSONValue::Kind::Number),
+ m_data_type(DataType::Signed)
+ {
+ m_data.m_signed = s;
+ }
+
+ template <typename T,
+ typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
+ explicit JSONNumber (T d) :
+ JSONValue(JSONValue::Kind::Number),
+ m_data_type(DataType::Double)
+ {
+ m_data.m_double = d;
+ }
+
+ ~JSONNumber() override = default;
JSONNumber (const JSONNumber& s) = delete;
JSONNumber&
operator = (const JSONNumber& s) = delete;
- virtual void
- Write (Stream& s);
-
- typedef std::shared_ptr<JSONNumber> SP;
+ void
+ Write(Stream& s) override;
uint64_t
- GetData () { return m_data; }
+ GetAsUnsigned() const;
+
+ int64_t
+ GetAsSigned() const;
double
- GetAsDouble()
- {
- if (m_is_integer)
- return (double)m_data;
- else
- return m_double;
- }
+ GetAsDouble() const;
static bool classof(const JSONValue *V)
{
return V->GetKind() == JSONValue::Kind::Number;
}
-
- virtual
- ~JSONNumber () = default;
-
+
private:
- bool m_is_integer;
- uint64_t m_data;
- double m_double;
+ enum class DataType : uint8_t
+ {
+ Unsigned,
+ Signed,
+ Double
+ } m_data_type;
+
+ union
+ {
+ uint64_t m_unsigned;
+ int64_t m_signed;
+ double m_double;
+ } m_data;
};
class JSONTrue : public JSONValue
@@ -146,8 +181,8 @@ namespace lldb_private {
JSONTrue&
operator = (const JSONTrue& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONTrue> SP;
@@ -156,8 +191,7 @@ namespace lldb_private {
return V->GetKind() == JSONValue::Kind::True;
}
- virtual
- ~JSONTrue () = default;
+ ~JSONTrue() override = default;
};
class JSONFalse : public JSONValue
@@ -169,8 +203,8 @@ namespace lldb_private {
JSONFalse&
operator = (const JSONFalse& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONFalse> SP;
@@ -179,8 +213,7 @@ namespace lldb_private {
return V->GetKind() == JSONValue::Kind::False;
}
- virtual
- ~JSONFalse () = default;
+ ~JSONFalse() override = default;
};
class JSONNull : public JSONValue
@@ -192,8 +225,8 @@ namespace lldb_private {
JSONNull&
operator = (const JSONNull& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONNull> SP;
@@ -202,8 +235,7 @@ namespace lldb_private {
return V->GetKind() == JSONValue::Kind::Null;
}
- virtual
- ~JSONNull () = default;
+ ~JSONNull() override = default;
};
class JSONObject : public JSONValue
@@ -215,8 +247,8 @@ namespace lldb_private {
JSONObject&
operator = (const JSONObject& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONObject> SP;
@@ -232,8 +264,7 @@ namespace lldb_private {
JSONValue::SP
GetObject (const std::string& key);
- virtual
- ~JSONObject () = default;
+ ~JSONObject() override = default;
private:
typedef std::map<std::string, JSONValue::SP> Map;
@@ -250,8 +281,8 @@ namespace lldb_private {
JSONArray&
operator = (const JSONArray& s) = delete;
- virtual void
- Write (Stream& s);
+ void
+ Write(Stream& s) override;
typedef std::shared_ptr<JSONArray> SP;
@@ -280,13 +311,11 @@ namespace lldb_private {
Size
GetNumElements ();
- virtual
- ~JSONArray () = default;
+ ~JSONArray() override = default;
Vector m_elements;
};
-
class JSONParser : public StringExtractor
{
public:
@@ -327,6 +356,6 @@ namespace lldb_private {
JSONValue::SP
ParseJSONArray ();
};
-}
+} // namespace lldb_private
-#endif // utility_ProcessStructReader_h_
+#endif // utility_JSON_h_
diff --git a/include/lldb/Utility/ProcessStructReader.h b/include/lldb/Utility/ProcessStructReader.h
index d053b702462e6..80f90feb87abd 100644
--- a/include/lldb/Utility/ProcessStructReader.h
+++ b/include/lldb/Utility/ProcessStructReader.h
@@ -16,7 +16,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Error.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Process.h"
#include <initializer_list>
@@ -29,7 +29,7 @@ namespace lldb_private {
protected:
struct FieldImpl
{
- ClangASTType type;
+ CompilerType type;
size_t offset;
size_t size;
};
@@ -40,7 +40,7 @@ namespace lldb_private {
size_t m_addr_byte_size;
public:
- ProcessStructReader (Process *process, lldb::addr_t base_addr, ClangASTType struct_type)
+ ProcessStructReader (Process *process, lldb::addr_t base_addr, CompilerType struct_type)
{
if (!process)
return;
@@ -55,7 +55,7 @@ namespace lldb_private {
uint64_t bit_offset;
uint32_t bitfield_bit_size;
bool is_bitfield;
- ClangASTType field_type = struct_type.GetFieldAtIndex(idx,name,&bit_offset,&bitfield_bit_size,&is_bitfield);
+ CompilerType field_type = struct_type.GetFieldAtIndex(idx,name,&bit_offset,&bitfield_bit_size,&is_bitfield);
// no support for bitfields in here (yet)
if (is_bitfield)
return;
diff --git a/include/lldb/Utility/PseudoTerminal.h b/include/lldb/Utility/PseudoTerminal.h
index 595b2fc19bfd9..d732534977469 100644
--- a/include/lldb/Utility/PseudoTerminal.h
+++ b/include/lldb/Utility/PseudoTerminal.h
@@ -260,7 +260,7 @@ private:
};
-} // namespace lldb
+} // namespace lldb_utility
#endif // #if defined(__cplusplus)
#endif // #ifndef liblldb_PseudoTerminal_h_
diff --git a/include/lldb/Utility/PythonPointer.h b/include/lldb/Utility/PythonPointer.h
deleted file mode 100644
index fe90670fd2e15..0000000000000
--- a/include/lldb/Utility/PythonPointer.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===---------------------PythonPointer.h ------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_PythonPointer_h_
-#define utility_PythonPointer_h_
-
-#include <algorithm>
-
-#include "lldb/lldb-python.h"
-
-namespace lldb_private {
-
-template<class T>
-class PythonPointer
-{
-public:
- typedef PyObject* element_type;
-private:
- element_type* ptr_;
- bool my_ref;
-public:
-
- PythonPointer(element_type p, bool steal_ref = false) :
- ptr_(p),
- my_ref(!steal_ref)
- {
- if (my_ref)
- Py_INCREF(ptr_);
- }
-
- PythonPointer(const PythonPointer& r, bool steal_ref = false) :
- ptr_(r.ptr_),
- my_ref(!steal_ref)
- {
- if (my_ref)
- Py_INCREF(ptr_);
- }
-
- ~PythonPointer()
- {
- if (my_ref)
- Py_XDECREF(ptr_);
- }
-
- PythonPointer
- StealReference()
- {
- return PythonPointer(ptr_,true);
- }
-
- PythonPointer
- DuplicateReference()
- {
- return PythonPointer(ptr_, false);
- }
-
- element_type get() const {return ptr_;}
-
- bool IsNull() { return ptr_ == NULL; }
- bool IsNone() { return ptr_ == Py_None; }
-
- operator PyObject* () { return ptr_; }
-};
-
-} // namespace lldb
-
-#endif // utility_PythonPointer_h_
diff --git a/include/lldb/Utility/SharedCluster.h b/include/lldb/Utility/SharedCluster.h
index 3a34d8ddb4157..2c03c409d97e8 100644
--- a/include/lldb/Utility/SharedCluster.h
+++ b/include/lldb/Utility/SharedCluster.h
@@ -27,14 +27,15 @@ namespace imp
shared_ptr_refcount() : shared_count (0) {}
- virtual ~shared_ptr_refcount ()
+ ~shared_ptr_refcount() override
{
}
- virtual void on_zero_shared ()
+ void on_zero_shared() override
{
manager->DecrementRefCount();
}
+
private:
T *manager;
};
@@ -100,4 +101,5 @@ private:
};
} // namespace lldb_private
+
#endif // utility_SharedCluster_h_
diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h
index 5c77dad9f7ff2..29538bc7dc03d 100644
--- a/include/lldb/Utility/SharingPtr.h
+++ b/include/lldb/Utility/SharingPtr.h
@@ -10,6 +10,8 @@
#ifndef utility_SharingPtr_h_
#define utility_SharingPtr_h_
+// C Includes
+// C++ Includes
#include <algorithm>
#include <memory>
@@ -22,6 +24,9 @@
#include <atomic>
#endif
+// Other libraries and framework includes
+// Project includes
+
//#define ENABLE_SP_LOGGING 1 // DON'T CHECK THIS LINE IN UNLESS COMMENTED OUT
#if defined (ENABLE_SP_LOGGING)
@@ -38,6 +43,13 @@ class shared_count
shared_count(const shared_count&);
shared_count& operator=(const shared_count&);
+public:
+ explicit shared_count(long refs = 0)
+ : shared_owners_(refs) {}
+
+ void add_shared();
+ void release_shared();
+ long use_count() const {return shared_owners_ + 1;}
protected:
#ifdef _MSC_VER
long shared_owners_;
@@ -45,16 +57,9 @@ protected:
std::atomic<long> shared_owners_;
#endif
virtual ~shared_count();
+
private:
virtual void on_zero_shared() = 0;
-
-public:
- explicit shared_count(long refs = 0)
- : shared_owners_(refs) {}
-
- void add_shared();
- void release_shared();
- long use_count() const {return shared_owners_ + 1;}
};
template <class T>
@@ -67,7 +72,7 @@ public:
: data_(p) {}
private:
- virtual void on_zero_shared();
+ void on_zero_shared() override;
// Outlaw copy constructor and assignment operator to keep effective C++
// warnings down to a minimum
@@ -113,7 +118,8 @@ public:
: data_(a0, a1, a2, a3, a4) {}
private:
- virtual void on_zero_shared();
+ void on_zero_shared() override;
+
public:
T* get() {return &data_;}
};
@@ -124,18 +130,20 @@ shared_ptr_emplace<T>::on_zero_shared()
{
}
-} // namespace
+} // namespace imp
template<class T>
class SharingPtr
{
public:
typedef T element_type;
+
private:
element_type* ptr_;
imp::shared_count* cntrl_;
struct nat {int for_bool_;};
+
public:
SharingPtr();
SharingPtr(std::nullptr_t);
@@ -161,7 +169,7 @@ public:
element_type* operator->() const {return ptr_;}
long use_count() const {return cntrl_ ? cntrl_->use_count() : 0;}
bool unique() const {return use_count() == 1;}
- bool empty() const {return cntrl_ == 0;}
+ bool empty() const {return cntrl_ == nullptr;}
operator nat*() const {return (nat*)get();}
static SharingPtr<T> make_shared();
@@ -182,30 +190,29 @@ public:
static SharingPtr<T> make_shared(A0&, A1&, A2&, A3&, A4&);
private:
-
template <class U> friend class SharingPtr;
};
template<class T>
inline
SharingPtr<T>::SharingPtr()
- : ptr_(0),
- cntrl_(0)
+ : ptr_(nullptr),
+ cntrl_(nullptr)
{
}
template<class T>
inline
SharingPtr<T>::SharingPtr(std::nullptr_t)
-: ptr_(0),
-cntrl_(0)
+: ptr_(nullptr),
+cntrl_(nullptr)
{
}
template<class T>
template<class Y>
SharingPtr<T>::SharingPtr(Y* p)
- : ptr_(p), cntrl_(0)
+ : ptr_(p), cntrl_(nullptr)
{
std::unique_ptr<Y> hold(p);
typedef imp::shared_ptr_pointer<Y*> _CntrlBlk;
@@ -431,7 +438,6 @@ make_shared(A0& a0, A1& a1, A2& a2, A3& a3, A4& a4)
return SharingPtr<T>::make_shared(a0, a1, a2, a3, a4);
}
-
template<class T, class U>
inline
bool
@@ -490,12 +496,8 @@ public:
// action: false means increment just happened
// true means decrement is about to happen
-private:
- Callback cb_;
- void* baton_;
+ LoggingSharingPtr() : cb_(0), baton_(nullptr) {}
-public:
- LoggingSharingPtr() : cb_(0), baton_(0) {}
LoggingSharingPtr(Callback cb, void* baton)
: cb_(cb), baton_(baton)
{
@@ -505,7 +507,7 @@ public:
template <class Y>
LoggingSharingPtr(Y* p)
- : base(p), cb_(0), baton_(0) {}
+ : base(p), cb_(0), baton_(nullptr) {}
template <class Y>
LoggingSharingPtr(Y* p, Callback cb, void* baton)
@@ -568,9 +570,12 @@ public:
cb_ = 0;
baton_ = 0;
}
+
+private:
+ Callback cb_;
+ void* baton_;
};
-
-
+
template <class T>
class IntrusiveSharingPtr;
@@ -637,14 +642,10 @@ public:
imp::shared_count(-1)
{
}
-
- virtual
- ~ReferenceCountedBaseVirtual ()
- {
- }
-
- virtual void on_zero_shared ();
-
+
+ ~ReferenceCountedBaseVirtual() override = default;
+
+ void on_zero_shared() override;
};
template <class T>
@@ -716,7 +717,7 @@ public:
// those would be builds for release. But for debug and release builds
// that are for development, we NULL out the pointers to catch potential
// issues.
- ptr_ = NULL;
+ ptr_ = nullptr;
#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
}
@@ -754,7 +755,7 @@ public:
}
void
- reset(T* ptr = NULL)
+ reset(T* ptr = nullptr)
{
IntrusiveSharingPtr(ptr).swap(*this);
}
@@ -793,7 +794,7 @@ private:
if (ptr_)
{
#if defined (ENABLE_SP_LOGGING)
- track_sp (this, NULL, ptr_->use_count() - 1);
+ track_sp (this, nullptr, ptr_->use_count() - 1);
#endif
ptr_->release_shared();
}
@@ -838,4 +839,4 @@ inline bool operator!= (T* lhs, const IntrusiveSharingPtr<U>& rhs)
} // namespace lldb_private
-#endif // utility_SharingPtr_h_
+#endif // utility_SharingPtr_h_
diff --git a/include/lldb/Utility/StringExtractor.h b/include/lldb/Utility/StringExtractor.h
index 0f2dbb166be10..db1b83b076949 100644
--- a/include/lldb/Utility/StringExtractor.h
+++ b/include/lldb/Utility/StringExtractor.h
@@ -115,6 +115,9 @@ public:
GetHexU8 (uint8_t fail_value = 0, bool set_eof_on_fail = true);
bool
+ GetHexU8Ex (uint8_t& ch, bool set_eof_on_fail = true);
+
+ bool
GetNameColonValue (std::string &name, std::string &value);
int32_t
diff --git a/include/lldb/Utility/TaskPool.h b/include/lldb/Utility/TaskPool.h
new file mode 100644
index 0000000000000..443e2a5853e26
--- /dev/null
+++ b/include/lldb/Utility/TaskPool.h
@@ -0,0 +1,221 @@
+//===--------------------- TaskPool.h ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_TaskPool_h_
+#define utility_TaskPool_h_
+
+#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all
+// calls to __uncaught_exception. Unfortunately, it does seem to eliminate
+// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is
+// declared. This may not be necessary after MSVC 12.
+#include <eh.h>
+#endif
+
+#if defined(_MSC_VER)
+// Due to another bug in MSVC 2013, including <future> will generate hundreds of
+// warnings in the Concurrency Runtime. This can be removed when we switch to
+// MSVC 2015
+#pragma warning(push)
+#pragma warning(disable:4062)
+#endif
+
+#include <cassert>
+#include <cstdint>
+#include <future>
+#include <list>
+#include <queue>
+#include <thread>
+#include <vector>
+
+// Global TaskPool class for running tasks in parallel on a set of worker thread created the first
+// time the task pool is used. The TaskPool provide no gurantee about the order the task will be run
+// and about what tasks will run in parrallel. None of the task added to the task pool should block
+// on something (mutex, future, condition variable) what will be set only by the completion of an
+// other task on the task pool as they may run on the same thread sequentally.
+class TaskPool
+{
+public:
+ // Add a new task to the task pool and return a std::future belonging to the newly created task.
+ // The caller of this function has to wait on the future for this task to complete.
+ template<typename F, typename... Args>
+ static std::future<typename std::result_of<F(Args...)>::type>
+ AddTask(F&& f, Args&&... args);
+
+ // Run all of the specified tasks on the task pool and wait until all of them are finished
+ // before returning. This method is intended to be used for small number tasks where listing
+ // them as function arguments is acceptable. For running large number of tasks you should use
+ // AddTask for each task and then call wait() on each returned future.
+ template<typename... T>
+ static void
+ RunTasks(T&&... tasks);
+
+private:
+ TaskPool() = delete;
+
+ template<typename... T>
+ struct RunTaskImpl;
+
+ static void
+ AddTaskImpl(std::function<void()>&& task_fn);
+};
+
+// Wrapper class around the global TaskPool implementation to make it possible to create a set of
+// tasks and then wait for the tasks to be completed by the WaitForNextCompletedTask call. This
+// class should be used when WaitForNextCompletedTask is needed because this class add no other
+// extra functionality to the TaskPool class and it have a very minor performance overhead.
+template <typename T> // The return type of the tasks what will be added to this task runner
+class TaskRunner
+{
+public:
+ // Add a task to the task runner what will also add the task to the global TaskPool. The
+ // function doesn't return the std::future for the task because it will be supplied by the
+ // WaitForNextCompletedTask after the task is completed.
+ template<typename F, typename... Args>
+ void
+ AddTask(F&& f, Args&&... args);
+
+ // Wait for the next task in this task runner to finish and then return the std::future what
+ // belongs to the finished task. If there is no task in this task runner (neither pending nor
+ // comleted) then this function will return an invalid future. Usually this function should be
+ // called in a loop processing the results of the tasks until it returns an invalid std::future
+ // what means that all task in this task runner is completed.
+ std::future<T>
+ WaitForNextCompletedTask();
+
+ // Convenience method to wait for all task in this TaskRunner to finish. Do NOT use this class
+ // just because of this method. Use TaskPool instead and wait for each std::future returned by
+ // AddTask in a loop.
+ void
+ WaitForAllTasks();
+
+private:
+ std::list<std::future<T>> m_ready;
+ std::list<std::future<T>> m_pending;
+ std::mutex m_mutex;
+ std::condition_variable m_cv;
+};
+
+template<typename F, typename... Args>
+std::future<typename std::result_of<F(Args...)>::type>
+TaskPool::AddTask(F&& f, Args&&... args)
+{
+ auto task_sp = std::make_shared<std::packaged_task<typename std::result_of<F(Args...)>::type()>>(
+ std::bind(std::forward<F>(f), std::forward<Args>(args)...));
+
+ AddTaskImpl([task_sp]() { (*task_sp)(); });
+
+ return task_sp->get_future();
+}
+
+template<typename... T>
+void
+TaskPool::RunTasks(T&&... tasks)
+{
+ RunTaskImpl<T...>::Run(std::forward<T>(tasks)...);
+}
+
+template<typename Head, typename... Tail>
+struct TaskPool::RunTaskImpl<Head, Tail...>
+{
+ static void
+ Run(Head&& h, Tail&&... t)
+ {
+ auto f = AddTask(std::forward<Head>(h));
+ RunTaskImpl<Tail...>::Run(std::forward<Tail>(t)...);
+ f.wait();
+ }
+};
+
+template<>
+struct TaskPool::RunTaskImpl<>
+{
+ static void
+ Run() {}
+};
+
+template <typename T>
+template<typename F, typename... Args>
+void
+TaskRunner<T>::AddTask(F&& f, Args&&... args)
+{
+ std::unique_lock<std::mutex> lock(m_mutex);
+ auto it = m_pending.emplace(m_pending.end());
+ *it = std::move(TaskPool::AddTask(
+ [this, it](F f, Args... args)
+ {
+ T&& r = f(std::forward<Args>(args)...);
+
+ std::unique_lock<std::mutex> lock(this->m_mutex);
+ this->m_ready.splice(this->m_ready.end(), this->m_pending, it);
+ lock.unlock();
+
+ this->m_cv.notify_one();
+ return r;
+ },
+ std::forward<F>(f),
+ std::forward<Args>(args)...));
+}
+
+template <>
+template<typename F, typename... Args>
+void
+TaskRunner<void>::AddTask(F&& f, Args&&... args)
+{
+ std::unique_lock<std::mutex> lock(m_mutex);
+ auto it = m_pending.emplace(m_pending.end());
+ *it = std::move(TaskPool::AddTask(
+ [this, it](F f, Args... args)
+ {
+ f(std::forward<Args>(args)...);
+
+ std::unique_lock<std::mutex> lock(this->m_mutex);
+ this->m_ready.emplace_back(std::move(*it));
+ this->m_pending.erase(it);
+ lock.unlock();
+
+ this->m_cv.notify_one();
+ },
+ std::forward<F>(f),
+ std::forward<Args>(args)...));
+}
+
+template <typename T>
+std::future<T>
+TaskRunner<T>::WaitForNextCompletedTask()
+{
+ std::unique_lock<std::mutex> lock(m_mutex);
+ if (m_ready.empty() && m_pending.empty())
+ return std::future<T>(); // No more tasks
+
+ if (m_ready.empty())
+ m_cv.wait(lock, [this](){ return !this->m_ready.empty(); });
+
+ std::future<T> res = std::move(m_ready.front());
+ m_ready.pop_front();
+
+ lock.unlock();
+ res.wait();
+
+ return std::move(res);
+}
+
+template <typename T>
+void
+TaskRunner<T>::WaitForAllTasks()
+{
+ while (WaitForNextCompletedTask().valid());
+}
+
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#endif // #ifndef utility_TaskPool_h_
diff --git a/include/lldb/lldb-defines.h b/include/lldb/lldb-defines.h
index 9dce69aef32bc..175cecd7e3229 100644
--- a/include/lldb/lldb-defines.h
+++ b/include/lldb/lldb-defines.h
@@ -137,6 +137,8 @@
#define __attribute__(X)
#endif
+#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
+
#if defined(__cplusplus)
//----------------------------------------------------------------------
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index 28614ffb23e15..ea31752b09bef 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -146,6 +146,7 @@ namespace lldb {
eFormatVectorOfUInt32,
eFormatVectorOfSInt64,
eFormatVectorOfUInt64,
+ eFormatVectorOfFloat16,
eFormatVectorOfFloat32,
eFormatVectorOfFloat64,
eFormatVectorOfUInt128,
@@ -188,11 +189,11 @@ namespace lldb {
//----------------------------------------------------------------------
enum RegisterKind
{
- eRegisterKindGCC = 0, // the register numbers seen in eh_frame
- eRegisterKindDWARF, // the register numbers seen DWARF
- eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any particular target
- eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers)
- eRegisterKindLLDB, // lldb's internal register numbers
+ eRegisterKindEHFrame = 0, // the register numbers seen in eh_frame
+ eRegisterKindDWARF, // the register numbers seen DWARF
+ eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any particular target
+ eRegisterKindProcessPlugin, // num used by the process plugin - e.g. by the remote gdb-protocol stub program
+ eRegisterKindLLDB, // lldb's internal register numbers
kNumRegisterKinds
};
@@ -421,7 +422,7 @@ namespace lldb {
eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
// Vendor Extensions
- // Note: LanguageRuntime::GetNameForLanguageType
+ // Note: Language::GetNameForLanguageType
// assumes these can be used as indexes into array language_names, and
// Language::SetLanguageFromCString and Language::AsCString
// assume these can be used as indexes into array g_languages.
@@ -595,16 +596,19 @@ namespace lldb {
eSectionTypeDataObjCMessageRefs, // Pointer to function pointer + selector
eSectionTypeDataObjCCFStrings, // Objective C const CFString/NSString objects
eSectionTypeDWARFDebugAbbrev,
+ eSectionTypeDWARFDebugAddr,
eSectionTypeDWARFDebugAranges,
eSectionTypeDWARFDebugFrame,
eSectionTypeDWARFDebugInfo,
eSectionTypeDWARFDebugLine,
eSectionTypeDWARFDebugLoc,
eSectionTypeDWARFDebugMacInfo,
+ eSectionTypeDWARFDebugMacro,
eSectionTypeDWARFDebugPubNames,
eSectionTypeDWARFDebugPubTypes,
eSectionTypeDWARFDebugRanges,
eSectionTypeDWARFDebugStr,
+ eSectionTypeDWARFDebugStrOffsets,
eSectionTypeDWARFAppleNames,
eSectionTypeDWARFAppleTypes,
eSectionTypeDWARFAppleNamespaces,
@@ -614,7 +618,10 @@ namespace lldb {
eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section
eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section
eSectionTypeEHFrame,
+ eSectionTypeARMexidx,
+ eSectionTypeARMextab,
eSectionTypeCompactUnwind, // compact unwind section in Mach-O, __TEXT,__unwind_info
+ eSectionTypeGoSymtab,
eSectionTypeOther
};
@@ -729,15 +736,16 @@ namespace lldb {
//----------------------------------------------------------------------
FLAGS_ENUM(TypeOptions)
{
- eTypeOptionNone = (0u),
- eTypeOptionCascade = (1u << 0),
- eTypeOptionSkipPointers = (1u << 1),
- eTypeOptionSkipReferences = (1u << 2),
- eTypeOptionHideChildren = (1u << 3),
- eTypeOptionHideValue = (1u << 4),
- eTypeOptionShowOneLiner = (1u << 5),
- eTypeOptionHideNames = (1u << 6),
- eTypeOptionNonCacheable = (1u << 7)
+ eTypeOptionNone = (0u),
+ eTypeOptionCascade = (1u << 0),
+ eTypeOptionSkipPointers = (1u << 1),
+ eTypeOptionSkipReferences = (1u << 2),
+ eTypeOptionHideChildren = (1u << 3),
+ eTypeOptionHideValue = (1u << 4),
+ eTypeOptionShowOneLiner = (1u << 5),
+ eTypeOptionHideNames = (1u << 6),
+ eTypeOptionNonCacheable = (1u << 7),
+ eTypeOptionHideEmptyAggregates = (1u << 8)
};
//----------------------------------------------------------------------
@@ -953,7 +961,8 @@ namespace lldb {
eTypeIsInteger = (1u << 18),
eTypeIsFloat = (1u << 19),
eTypeIsComplex = (1u << 20),
- eTypeIsSigned = (1u << 21)
+ eTypeIsSigned = (1u << 21),
+ eTypeInstanceIsPointer = (1u << 22)
};
FLAGS_ENUM(CommandFlags)
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index da90ac4775eee..516f31911c2bd 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -25,8 +25,10 @@ class AddressImpl;
class AddressRange;
class AddressResolver;
class ArchSpec;
+class ArmUnwindInfo;
class Args;
class ASTResultSynthesizer;
+class ASTStructExtractor;
class Baton;
class Block;
class Breakpoint;
@@ -48,26 +50,22 @@ class ClangASTContext;
class ClangASTImporter;
class ClangASTMetadata;
class ClangASTSource;
-class ClangASTType;
-class ClangNamespaceDecl;
-class ClangExpression;
class ClangExpressionDeclMap;
class ClangExpressionParser;
class ClangExpressionVariable;
-class ClangExpressionVariableList;
-class ClangExpressionVariableList;
class ClangExpressionVariables;
-class ClangFunction;
class ClangModulesDeclVendor;
class ClangPersistentVariables;
-class ClangUserExpression;
-class ClangUtilityFunction;
class CommandInterpreter;
class CommandInterpreterRunOptions;
class CommandObject;
class CommandReturnObject;
class Communication;
class CompactUnwindInfo;
+struct CompilerContext;
+class CompilerDecl;
+class CompilerDeclContext;
+class CompilerType;
class CompileUnit;
class Condition;
class Connection;
@@ -82,7 +80,7 @@ class DataExtractor;
class Debugger;
class Declaration;
class Disassembler;
-struct DumpValueObjectOptions;
+class DumpValueObjectOptions;
class DynamicCheckerFunctions;
class DynamicLoader;
class Editline;
@@ -95,10 +93,15 @@ class ExecutionContext;
class ExecutionContextRef;
class ExecutionContextRefLocker;
class ExecutionContextScope;
+class Expression;
+class ExpressionVariable;
+class ExpressionVariableList;
+class ExpressionTypeSystemHelper;
class File;
class FileSpec;
class FileSpecList;
class Flags;
+class GoASTContext;
class TypeCategoryImpl;
class FormatManager;
class FormattersMatchCandidate;
@@ -114,6 +117,8 @@ class IOObject;
class IRExecutionUnit;
class JITLoader;
class JITLoaderList;
+class Language;
+class LanguageCategory;
class LanguageRuntime;
class MemoryRegionInfo;
class LineTable;
@@ -130,6 +135,7 @@ class ModuleSpecList;
class Mutex;
struct NameSearchContext;
class ObjCLanguageRuntime;
+class ObjCRuntimeSyntheticProvider;
class ObjectContainer;
class OptionGroup;
class OptionGroupOptions;
@@ -160,6 +166,8 @@ class OptionValueUInt64;
class OptionValueUUID;
class NamedOption;
class PathMappingList;
+class FunctionCaller;
+class PersistentExpressionState;
class Platform;
class Process;
class ProcessAttachInfo;
@@ -177,12 +185,11 @@ class RegisterLocation;
class RegisterLocationList;
class RegisterValue;
class RegularExpression;
+class REPL;
class Scalar;
class ScriptInterpreter;
class ScriptInterpreterLocker;
-#ifndef LLDB_DISABLE_PYTHON
struct ScriptSummaryFormat;
-#endif
class SearchFilter;
class Section;
class SectionImpl;
@@ -221,6 +228,7 @@ class Symtab;
class SyntheticChildren;
class SyntheticChildrenFrontEnd;
class TypeFilterImpl;
+class TypeSystem;
#ifndef LLDB_DISABLE_PYTHON
class ScriptedSyntheticChildren;
#endif
@@ -249,6 +257,7 @@ class TypeAndOrName;
class TypeCategoryMap;
class TypeImpl;
class TypeList;
+class TypeMap;
class TypeListImpl;
class TypeMemberImpl;
class TypeMemberFunctionImpl;
@@ -264,6 +273,8 @@ class Unwind;
class UnwindAssembly;
class UnwindPlan;
class UnwindTable;
+class UserExpression;
+class UtilityFunction;
class VMRange;
class Value;
class ValueList;
@@ -300,12 +311,10 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
typedef std::unique_ptr<lldb_private::ClangASTContext> ClangASTContextUP;
- typedef std::unique_ptr<lldb_private::ClangASTImporter> ClangASTImporterUP;
- typedef std::unique_ptr<lldb_private::ClangASTSource> ClangASTSourceUP;
- typedef std::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
+ typedef std::shared_ptr<lldb_private::ClangASTImporter> ClangASTImporterSP;
typedef std::unique_ptr<lldb_private::ClangModulesDeclVendor> ClangModulesDeclVendorUP;
typedef std::unique_ptr<lldb_private::ClangPersistentVariables> ClangPersistentVariablesUP;
- typedef std::shared_ptr<lldb_private::ClangUserExpression> ClangUserExpressionSP;
+ typedef std::shared_ptr<lldb_private::UserExpression> UserExpressionSP;
typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
typedef std::shared_ptr<lldb_private::Connection> ConnectionSP;
@@ -320,14 +329,18 @@ namespace lldb {
typedef std::unique_ptr<lldb_private::DynamicLoader> DynamicLoaderUP;
typedef std::shared_ptr<lldb_private::Event> EventSP;
typedef std::shared_ptr<lldb_private::ExecutionContextRef> ExecutionContextRefSP;
+ typedef std::shared_ptr<lldb_private::ExpressionVariable> ExpressionVariableSP;
typedef std::shared_ptr<lldb_private::File> FileSP;
typedef std::shared_ptr<lldb_private::Function> FunctionSP;
+ typedef std::shared_ptr<lldb_private::FunctionCaller> FunctionCallerSP;
typedef std::shared_ptr<lldb_private::FuncUnwinders> FuncUnwindersSP;
+ typedef std::unique_ptr<lldb_private::GoASTContext> GoASTContextUP;
typedef std::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
typedef std::shared_ptr<lldb_private::Instruction> InstructionSP;
typedef std::shared_ptr<lldb_private::InstrumentationRuntime> InstrumentationRuntimeSP;
typedef std::shared_ptr<lldb_private::IOHandler> IOHandlerSP;
typedef std::shared_ptr<lldb_private::IOObject> IOObjectSP;
+ typedef std::shared_ptr<lldb_private::IRExecutionUnit> IRExecutionUnitSP;
typedef std::shared_ptr<lldb_private::JITLoader> JITLoaderSP;
typedef std::unique_ptr<lldb_private::JITLoaderList> JITLoaderListUP;
typedef std::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
@@ -373,9 +386,10 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::Queue> QueueSP;
typedef std::weak_ptr<lldb_private::Queue> QueueWP;
typedef std::shared_ptr<lldb_private::QueueItem> QueueItemSP;
-#ifndef LLDB_DISABLE_PYTHON
+ typedef std::shared_ptr<lldb_private::REPL> REPLSP;
typedef std::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
-#endif // #ifndef LLDB_DISABLE_PYTHON
+ typedef std::shared_ptr<lldb_private::ScriptInterpreter> ScriptInterpreterSP;
+ typedef std::unique_ptr<lldb_private::ScriptInterpreter> ScriptInterpreterUP;
typedef std::shared_ptr<lldb_private::Section> SectionSP;
typedef std::unique_ptr<lldb_private::SectionList> SectionListUP;
typedef std::weak_ptr<lldb_private::Section> SectionWP;
@@ -415,6 +429,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::TypeMemberFunctionImpl> TypeMemberFunctionImplSP;
typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;
typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
+ typedef std::shared_ptr<lldb_private::TypeSystem> TypeSystemSP;
typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
@@ -427,6 +442,7 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::UnixSignals> UnixSignalsWP;
typedef std::shared_ptr<lldb_private::UnwindAssembly> UnwindAssemblySP;
typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
+ typedef std::shared_ptr<lldb_private::UtilityFunction> UtilityFunctionSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
typedef std::shared_ptr<lldb_private::Value> ValueSP;
typedef std::shared_ptr<lldb_private::ValueList> ValueListSP;
diff --git a/include/lldb/lldb-private-enumerations.h b/include/lldb/lldb-private-enumerations.h
index c62863d744c70..5f8f96c6da46b 100644
--- a/include/lldb/lldb-private-enumerations.h
+++ b/include/lldb/lldb-private-enumerations.h
@@ -106,13 +106,6 @@ typedef enum SortOrder
eSortOrderByName
} SortOrder;
-typedef enum ObjCRuntimeVersions {
- eObjC_VersionUnknown = 0,
- eAppleObjC_V1 = 1,
- eAppleObjC_V2 = 2
-} ObjCRuntimeVersions;
-
-
//----------------------------------------------------------------------
// LazyBool is for boolean values that need to be calculated lazily.
// Values start off set to eLazyBoolCalculate, and then they can be
@@ -188,7 +181,7 @@ typedef enum FormatterChoiceCriterion
eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
eFormatterChoiceCriterionRegularExpressionSummary = 0x00000004,
eFormatterChoiceCriterionRegularExpressionFilter = 0x00000004,
- eFormatterChoiceCriterionDynamicObjCDiscovery = 0x00000008,
+ eFormatterChoiceCriterionLanguagePlugin = 0x00000008,
eFormatterChoiceCriterionStrippedBitField = 0x00000010,
eFormatterChoiceCriterionWentToStaticValue = 0x00000020
} FormatterChoiceCriterion;
@@ -248,6 +241,25 @@ enum class TypeValidatorResult : bool {
Success = true,
Failure = false
};
+
+//----------------------------------------------------------------------
+// Enumerations that can be used to specify scopes types when looking up
+// types.
+//----------------------------------------------------------------------
+enum class CompilerContextKind
+{
+ Invalid = 0,
+ TranslationUnit,
+ Module,
+ Namespace,
+ Class,
+ Structure,
+ Union,
+ Function,
+ Variable,
+ Enumeration,
+ Typedef
+};
} // namespace lldb_private
diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h
index 7b5c1c9d2c059..6bc8dadaebff4 100644
--- a/include/lldb/lldb-private-interfaces.h
+++ b/include/lldb/lldb-private-interfaces.h
@@ -14,6 +14,8 @@
#include "lldb/lldb-private.h"
+#include <set>
+
namespace lldb_private
{
typedef lldb::ABISP (*ABICreateInstance) (const ArchSpec &arch);
@@ -28,11 +30,13 @@ namespace lldb_private
typedef LogChannel* (*LogChannelCreateInstance) ();
typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch, InstructionType inst_type);
typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force);
+ typedef Language *(*LanguageCreateInstance) (lldb::LanguageType language);
typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject) (CommandInterpreter& interpreter);
typedef SystemRuntime *(*SystemRuntimeCreateInstance) (Process *process);
typedef lldb::PlatformSP (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
- typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path);
+ typedef lldb::ProcessSP (*ProcessCreateInstance) (lldb::TargetSP target_sp, Listener &listener, const FileSpec *crash_file_path);
+ typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(CommandInterpreter &interpreter);
typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);
typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm); // Module can be NULL for default system symbol vendor
typedef bool (*BreakpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
@@ -44,6 +48,10 @@ namespace lldb_private
typedef lldb::MemoryHistorySP (*MemoryHistoryCreateInstance) (const lldb::ProcessSP &process_sp);
typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType) ();
typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance) (const lldb::ProcessSP &process_sp);
+ typedef lldb::TypeSystemSP (*TypeSystemCreateInstance) (lldb::LanguageType language, Module *module, Target *target);
+ typedef lldb::REPLSP (*REPLCreateInstance) (Error &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options);
+ typedef void (*TypeSystemEnumerateSupportedLanguages) (std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions);
+ typedef void (*REPLEnumerateSupportedLanguages) (std::set<lldb::LanguageType> &languages);
typedef int (*ComparisonFunction)(const void *, const void *);
typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
diff --git a/include/lldb/lldb-private-types.h b/include/lldb/lldb-private-types.h
index cce637fce279e..685034a1fee34 100644
--- a/include/lldb/lldb-private-types.h
+++ b/include/lldb/lldb-private-types.h
@@ -35,7 +35,7 @@ namespace lldb_private
// name (optional), encoding, size in bytes and the default display
// format.
//----------------------------------------------------------------------
- typedef struct
+ struct RegisterInfo
{
const char *name; // Name of this register, can't be NULL
const char *alt_name; // Alternate name of this register, can be NULL
@@ -51,15 +51,15 @@ namespace lldb_private
// for this register will be valid. For example, the value list for ah
// would be eax (x86) or rax (x64).
uint32_t *invalidate_regs; // List of registers (terminated with LLDB_INVALID_REGNUM). If this value is not
- // null, all registers in this list will be invalidateed when the value of this
+ // null, all registers in this list will be invalidated when the value of this
// register changes. For example, the invalidate list for eax would be rax
// ax, ah, and al.
- } RegisterInfo;
+ };
//----------------------------------------------------------------------
// Registers are grouped into register sets
//----------------------------------------------------------------------
- typedef struct
+ struct RegisterSet
{
const char *name; // Name of this register set
const char *short_name; // A short name for this register set
@@ -69,14 +69,14 @@ namespace lldb_private
// register array. For example, if eax is defined at index 4 for a
// particular RegisterContext, eax would be included in this RegisterSet
// by adding the value 4. Not by adding the value lldb_eax_i386.
- } RegisterSet;
+ };
- typedef struct
+ struct OptionEnumValueElement
{
int64_t value;
const char *string_value;
const char *usage;
- } OptionEnumValueElement;
+ };
struct OptionValidator
{
@@ -85,7 +85,7 @@ namespace lldb_private
virtual const char * ShortConditionString() const = 0;
virtual const char * LongConditionString() const = 0;
};
-
+
struct OptionDefinition
{
uint32_t usage_mask; // Used to mark options that can be used together. If (1 << n & usage_mask) != 0
@@ -102,6 +102,8 @@ namespace lldb_private
// pass it.
};
+ typedef struct type128 { uint64_t x[2]; } type128;
+
} // namespace lldb_private
#endif // #if defined(__cplusplus)
diff --git a/include/lldb/lldb-python.h b/include/lldb/lldb-python.h
deleted file mode 100644
index c8ef054f60e17..0000000000000
--- a/include/lldb/lldb-python.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//===-- lldb-python.h --------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLDB_lldb_python_h_
-#define LLDB_lldb_python_h_
-
-// Python.h needs to be included before any system headers in order to avoid redefinition of macros
-
-#ifdef LLDB_DISABLE_PYTHON
-// Python is disabled in this build
-#else
- #if defined(__linux__)
- // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined. This value
- // may be different from the value that Python defines it to be which results
- // in a warning. Undefine _POSIX_C_SOURCE before including Python.h The same
- // holds for _XOPEN_SOURCE.
- #undef _POSIX_C_SOURCE
- #undef _XOPEN_SOURCE
- #endif
-
- // Include python for non windows machines
- #include <Python.h>
-#endif // LLDB_DISABLE_PYTHON
-
-#endif // LLDB_lldb_python_h_
diff --git a/include/lldb/lldb-types.h b/include/lldb/lldb-types.h
index fe902073698d9..2cf9904bd9d38 100644
--- a/include/lldb/lldb-types.h
+++ b/include/lldb/lldb-types.h
@@ -110,7 +110,7 @@ namespace lldb
typedef uint64_t offset_t;
typedef int32_t break_id_t;
typedef int32_t watch_id_t;
- typedef void * clang_type_t;
+ typedef void * opaque_compiler_type_t;
typedef uint64_t queue_id_t;
}