[llvm-branch-commits] [lldb] r185481 - Merge with top of tree.
Greg Clayton
gclayton at apple.com
Tue Jul 2 19:06:18 PDT 2013
Author: gclayton
Date: Tue Jul 2 16:55:02 2013
New Revision: 185481
URL: http://llvm.org/viewvc/llvm-project?rev=185481&view=rev
Log:
Merge with top of tree.
Added:
lldb/branches/lldb-platform-work/examples/functions/
- copied from r185480, lldb/trunk/examples/functions/
lldb/branches/lldb-platform-work/examples/functions/Makefile
- copied unchanged from r185480, lldb/trunk/examples/functions/Makefile
lldb/branches/lldb-platform-work/examples/functions/main.cpp
- copied unchanged from r185480, lldb/trunk/examples/functions/main.cpp
lldb/branches/lldb-platform-work/examples/python/types.py
- copied unchanged from r185480, lldb/trunk/examples/python/types.py
lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandHistory.h
- copied unchanged from r185480, lldb/trunk/include/lldb/Interpreter/CommandHistory.h
lldb/branches/lldb-platform-work/include/lldb/Utility/Range.h
- copied unchanged from r185480, lldb/trunk/include/lldb/Utility/Range.h
lldb/branches/lldb-platform-work/scripts/Python/python-swigsafecast.swig
- copied unchanged from r185480, lldb/trunk/scripts/Python/python-swigsafecast.swig
lldb/branches/lldb-platform-work/source/Interpreter/CommandHistory.cpp
- copied unchanged from r185480, lldb/trunk/source/Interpreter/CommandHistory.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/
- copied from r185480, lldb/trunk/source/Plugins/SymbolVendor/ELF/
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/CMakeLists.txt
- copied unchanged from r185480, lldb/trunk/source/Plugins/SymbolVendor/ELF/CMakeLists.txt
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/Makefile
- copied unchanged from r185480, lldb/trunk/source/Plugins/SymbolVendor/ELF/Makefile
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
- copied unchanged from r185480, lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h
- copied unchanged from r185480, lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h
lldb/branches/lldb-platform-work/source/Utility/Range.cpp
- copied unchanged from r185480, lldb/trunk/source/Utility/Range.cpp
lldb/branches/lldb-platform-work/test/functionalities/abbreviation/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/abbreviation/.categories
lldb/branches/lldb-platform-work/test/functionalities/alias/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/alias/.categories
lldb/branches/lldb-platform-work/test/functionalities/backticks/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/backticks/.categories
lldb/branches/lldb-platform-work/test/functionalities/command_history/
- copied from r185480, lldb/trunk/test/functionalities/command_history/
lldb/branches/lldb-platform-work/test/functionalities/command_history/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/command_history/.categories
lldb/branches/lldb-platform-work/test/functionalities/command_history/TestCommandHistory.py
- copied unchanged from r185480, lldb/trunk/test/functionalities/command_history/TestCommandHistory.py
lldb/branches/lldb-platform-work/test/functionalities/command_regex/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/command_regex/.categories
lldb/branches/lldb-platform-work/test/functionalities/command_script/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/command_script/.categories
lldb/branches/lldb-platform-work/test/functionalities/command_source/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/command_source/.categories
lldb/branches/lldb-platform-work/test/functionalities/completion/.categories
- copied unchanged from r185480, lldb/trunk/test/functionalities/completion/.categories
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/
- copied from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/Makefile
- copied unchanged from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/Makefile
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
- copied unchanged from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/foo.c
- copied unchanged from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/foo.c
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/foo.h
- copied unchanged from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/foo.h
lldb/branches/lldb-platform-work/test/lang/c/shared_lib_stripped_symbols/main.c
- copied unchanged from r185480, lldb/trunk/test/lang/c/shared_lib_stripped_symbols/main.c
lldb/branches/lldb-platform-work/test/python_api/objc_type/
- copied from r185480, lldb/trunk/test/python_api/objc_type/
lldb/branches/lldb-platform-work/test/python_api/objc_type/Makefile
- copied unchanged from r185480, lldb/trunk/test/python_api/objc_type/Makefile
lldb/branches/lldb-platform-work/test/python_api/objc_type/TestObjCType.py
- copied unchanged from r185480, lldb/trunk/test/python_api/objc_type/TestObjCType.py
lldb/branches/lldb-platform-work/test/python_api/objc_type/main.m
- copied unchanged from r185480, lldb/trunk/test/python_api/objc_type/main.m
lldb/branches/lldb-platform-work/www/download.html
- copied unchanged from r185480, lldb/trunk/www/download.html
lldb/branches/lldb-platform-work/www/source.html
- copied unchanged from r185480, lldb/trunk/www/source.html
lldb/branches/lldb-platform-work/www/troubleshooting.html
- copied unchanged from r185480, lldb/trunk/www/troubleshooting.html
Modified:
lldb/branches/lldb-platform-work/ (props changed)
lldb/branches/lldb-platform-work/CMakeLists.txt
lldb/branches/lldb-platform-work/docs/lldb-gdb-remote.txt
lldb/branches/lldb-platform-work/examples/lookup/Makefile
lldb/branches/lldb-platform-work/examples/lookup/main.cpp
lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py
lldb/branches/lldb-platform-work/examples/python/globals.py
lldb/branches/lldb-platform-work/examples/python/process_events.py
lldb/branches/lldb-platform-work/examples/python/symbolication.py
lldb/branches/lldb-platform-work/include/lldb/API/SBCommandReturnObject.h
lldb/branches/lldb-platform-work/include/lldb/API/SBCompileUnit.h
lldb/branches/lldb-platform-work/include/lldb/API/SBError.h
lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h
lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h
lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
lldb/branches/lldb-platform-work/include/lldb/API/SBThread.h
lldb/branches/lldb-platform-work/include/lldb/API/SBType.h
lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointSiteList.h
lldb/branches/lldb-platform-work/include/lldb/Core/ArchSpec.h
lldb/branches/lldb-platform-work/include/lldb/Core/Error.h
lldb/branches/lldb-platform-work/include/lldb/Core/Flags.h
lldb/branches/lldb-platform-work/include/lldb/Core/MappedHash.h
lldb/branches/lldb-platform-work/include/lldb/Core/Module.h
lldb/branches/lldb-platform-work/include/lldb/Core/ModuleChild.h
lldb/branches/lldb-platform-work/include/lldb/Core/Section.h
lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h
lldb/branches/lldb-platform-work/include/lldb/Core/UniqueCStringMap.h
lldb/branches/lldb-platform-work/include/lldb/Core/UserID.h
lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatCache.h
lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h
lldb/branches/lldb-platform-work/include/lldb/DataFormatters/TypeSynthetic.h
lldb/branches/lldb-platform-work/include/lldb/Expression/IRForTarget.h
lldb/branches/lldb-platform-work/include/lldb/Expression/Materializer.h
lldb/branches/lldb-platform-work/include/lldb/Host/Config.h
lldb/branches/lldb-platform-work/include/lldb/Host/FileSpec.h
lldb/branches/lldb-platform-work/include/lldb/Host/linux/Config.h
lldb/branches/lldb-platform-work/include/lldb/Host/macosx/Config.h
lldb/branches/lldb-platform-work/include/lldb/Host/mingw/Config.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandInterpreter.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObject.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreter.h
lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolContext.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h
lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeList.h
lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h
lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
lldb/branches/lldb-platform-work/include/lldb/Target/Target.h
lldb/branches/lldb-platform-work/include/lldb/lldb-defines.h
lldb/branches/lldb-platform-work/include/lldb/lldb-enumerations.h
lldb/branches/lldb-platform-work/lib/Makefile
lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
lldb/branches/lldb-platform-work/scripts/CMakeLists.txt
lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh
lldb/branches/lldb-platform-work/scripts/Python/interface/SBBreakpoint.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBCompileUnit.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBData.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBType.i
lldb/branches/lldb-platform-work/scripts/Python/interface/SBTypeCategory.i
lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig
lldb/branches/lldb-platform-work/scripts/Python/python-typemaps.swig
lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig
lldb/branches/lldb-platform-work/scripts/build-llvm.pl
lldb/branches/lldb-platform-work/scripts/lldb.swig
lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp
lldb/branches/lldb-platform-work/source/API/SBCompileUnit.cpp
lldb/branches/lldb-platform-work/source/API/SBModule.cpp
lldb/branches/lldb-platform-work/source/API/SBProcess.cpp
lldb/branches/lldb-platform-work/source/API/SBSection.cpp
lldb/branches/lldb-platform-work/source/API/SBTarget.cpp
lldb/branches/lldb-platform-work/source/API/SBType.cpp
lldb/branches/lldb-platform-work/source/API/SBTypeSynthetic.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverName.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointSiteList.cpp
lldb/branches/lldb-platform-work/source/CMakeLists.txt
lldb/branches/lldb-platform-work/source/Commands/CommandCompletions.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectBreakpoint.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.h
lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectMultiword.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectSyntax.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectType.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.h
lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/branches/lldb-platform-work/source/Core/Address.cpp
lldb/branches/lldb-platform-work/source/Core/Communication.cpp
lldb/branches/lldb-platform-work/source/Core/ConnectionFileDescriptor.cpp
lldb/branches/lldb-platform-work/source/Core/DataExtractor.cpp
lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
lldb/branches/lldb-platform-work/source/Core/Error.cpp
lldb/branches/lldb-platform-work/source/Core/Listener.cpp
lldb/branches/lldb-platform-work/source/Core/Module.cpp
lldb/branches/lldb-platform-work/source/Core/SearchFilter.cpp
lldb/branches/lldb-platform-work/source/Core/Section.cpp
lldb/branches/lldb-platform-work/source/Core/StringList.cpp
lldb/branches/lldb-platform-work/source/Core/UUID.cpp
lldb/branches/lldb-platform-work/source/Core/UserID.cpp
lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
lldb/branches/lldb-platform-work/source/DataFormatters/CF.cpp
lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp
lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp
lldb/branches/lldb-platform-work/source/DataFormatters/TypeCategoryMap.cpp
lldb/branches/lldb-platform-work/source/DataFormatters/TypeSynthetic.cpp
lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp
lldb/branches/lldb-platform-work/source/Expression/ClangExpressionParser.cpp
lldb/branches/lldb-platform-work/source/Expression/IRExecutionUnit.cpp
lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
lldb/branches/lldb-platform-work/source/Expression/IRInterpreter.cpp
lldb/branches/lldb-platform-work/source/Expression/IRMemoryMap.cpp
lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp
lldb/branches/lldb-platform-work/source/Host/Makefile
lldb/branches/lldb-platform-work/source/Host/common/FileSpec.cpp
lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp
lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp
lldb/branches/lldb-platform-work/source/Interpreter/Args.cpp
lldb/branches/lldb-platform-work/source/Interpreter/CMakeLists.txt
lldb/branches/lldb-platform-work/source/Interpreter/CommandInterpreter.cpp
lldb/branches/lldb-platform-work/source/Interpreter/CommandObject.cpp
lldb/branches/lldb-platform-work/source/Interpreter/CommandReturnObject.cpp
lldb/branches/lldb-platform-work/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/branches/lldb-platform-work/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/branches/lldb-platform-work/source/Interpreter/OptionValuePathMappings.cpp
lldb/branches/lldb-platform-work/source/Interpreter/Options.cpp
lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp
lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/branches/lldb-platform-work/source/Plugins/Makefile
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/Makefile
lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/branches/lldb-platform-work/source/Plugins/Platform/Makefile
lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h
lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/Makefile
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.h
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.h
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/CMakeLists.txt
lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp
lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp
lldb/branches/lldb-platform-work/source/Symbol/Function.cpp
lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp
lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp
lldb/branches/lldb-platform-work/source/Symbol/SymbolContext.cpp
lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp
lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp
lldb/branches/lldb-platform-work/source/Symbol/Type.cpp
lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp
lldb/branches/lldb-platform-work/source/Target/Process.cpp
lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp
lldb/branches/lldb-platform-work/source/Target/Target.cpp
lldb/branches/lldb-platform-work/source/Target/Thread.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp
lldb/branches/lldb-platform-work/source/Utility/CMakeLists.txt
lldb/branches/lldb-platform-work/source/lldb.cpp
lldb/branches/lldb-platform-work/test/dotest.py
lldb/branches/lldb-platform-work/test/expression_command/persistent_types/TestPersistentTypes.py
lldb/branches/lldb-platform-work/test/expression_command/persistent_types/main.c
lldb/branches/lldb-platform-work/test/functionalities/abbreviation/TestAbbreviations.py
lldb/branches/lldb-platform-work/test/functionalities/alias/TestAliases.py
lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/main.c
lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
lldb/branches/lldb-platform-work/test/functionalities/command_script/welcome.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp
lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py
lldb/branches/lldb-platform-work/test/functionalities/thread/TestNumThreads.py
lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
lldb/branches/lldb-platform-work/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
lldb/branches/lldb-platform-work/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
lldb/branches/lldb-platform-work/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
lldb/branches/lldb-platform-work/test/functionalities/thread/state/TestThreadStates.py
lldb/branches/lldb-platform-work/test/functionalities/thread/thread_exit/TestThreadExit.py
lldb/branches/lldb-platform-work/test/help/TestHelp.py
lldb/branches/lldb-platform-work/test/lang/c/anonymous/TestAnonymous.py
lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py
lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py
lldb/branches/lldb-platform-work/test/lldbtest.py
lldb/branches/lldb-platform-work/test/make/Makefile.rules
lldb/branches/lldb-platform-work/test/plugins/builder_base.py
lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h
lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h
lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h
lldb/branches/lldb-platform-work/tools/driver/Makefile
lldb/branches/lldb-platform-work/tools/lldb-platform/Makefile
lldb/branches/lldb-platform-work/www/lldb-gdb.html
lldb/branches/lldb-platform-work/www/sidebar.incl
lldb/branches/lldb-platform-work/www/status.html
Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 2 16:55:02 2013
@@ -1,2 +1,2 @@
/lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:154223-183457
+/lldb/trunk:154223-185480
Modified: lldb/branches/lldb-platform-work/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -118,6 +118,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
)
endif()
+if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
+ AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "3.3")
+ add_lldb_definitions(
+ -Wno-deprecated-register # Suppress "deprecated register keyword" warnings
+ )
+endif()
+
# Disable MSVC warnings
if( MSVC )
add_lldb_definitions(
Modified: lldb/branches/lldb-platform-work/docs/lldb-gdb-remote.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/docs/lldb-gdb-remote.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/docs/lldb-gdb-remote.txt (original)
+++ lldb/branches/lldb-platform-work/docs/lldb-gdb-remote.txt Tue Jul 2 16:55:02 2013
@@ -699,6 +699,26 @@ The lack of 'permissions:' indicates tha
for this region.
//----------------------------------------------------------------------
+// Detach and stay stopped:
+//
+// We extended the "D" packet to specify that the monitor should keep the
+// target suspended on detach. The normal behavior is to resume execution
+// on detach. We will send:
+//
+// qSupportsDetachAndStayStopped:
+//
+// to query whether the monitor supports the extended detach, and if it does,
+// when we want the monitor to detach but not resume the target, we will
+// send:
+//
+// D1
+//
+// In any case, if we want the normal detach behavior we will just send:
+//
+// D
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
// Stop reply packet extensions
//
// BRIEF
Modified: lldb/branches/lldb-platform-work/examples/lookup/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/lookup/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/lookup/Makefile (original)
+++ lldb/branches/lldb-platform-work/examples/lookup/Makefile Tue Jul 2 16:55:02 2013
@@ -1,11 +1,15 @@
LEVEL = ../../test/make
CXX_SOURCES := main.cpp
+EXE := lldb-lookup
+USE_LIBCPP := 1
MY_OS = $(shell uname -s)
+
ifeq "$(MY_OS)" "Darwin"
- LD_EXTRAS ?= -framework LLDB
- FRAMEWORK_INCLUDES=-F/Volumes/data/lldb/svn/trunk/build/Debug
+ LLDB_BUILD_DIR ?= /Applications/Xcode.app/Contents/SharedFrameworks
+ LD_EXTRAS ?= -framework LLDB -Wl,-rpath,"$(LLDB_BUILD_DIR)"
+ FRAMEWORK_INCLUDES=-F"$(LLDB_BUILD_DIR)"
else
LD_EXTRAS ?= $(LLDB_BUILD_DIR)/_lldb.so
endif
Modified: lldb/branches/lldb-platform-work/examples/lookup/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/lookup/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/lookup/main.cpp (original)
+++ lldb/branches/lldb-platform-work/examples/lookup/main.cpp Tue Jul 2 16:55:02 2013
@@ -7,18 +7,26 @@
//
//===----------------------------------------------------------------------===//
+#include <getopt.h>
#include <stdint.h>
#include <stdlib.h>
+#if defined(__APPLE__)
+#include <LLDB/LLDB.h>
+#else
#include "LLDB/SBBlock.h"
#include "LLDB/SBCompileUnit.h"
#include "LLDB/SBDebugger.h"
#include "LLDB/SBFunction.h"
#include "LLDB/SBModule.h"
+#include "LLDB/SBStream.h"
#include "LLDB/SBSymbol.h"
#include "LLDB/SBTarget.h"
#include "LLDB/SBThread.h"
#include "LLDB/SBProcess.h"
+#endif
+
+#include <string>
using namespace lldb;
@@ -50,38 +58,154 @@ public:
SBDebugger::Terminate();
}
};
+
+static struct option g_long_options[] =
+{
+ { "help", no_argument, NULL, 'h' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "arch", required_argument, NULL, 'a' },
+ { "platform", required_argument, NULL, 'p' },
+ { NULL, 0, NULL, 0 }
+};
+
+#define PROGRAM_NAME "lldb-lookup"
+void
+usage ()
+{
+ puts (
+ "NAME\n"
+ " " PROGRAM_NAME " -- symbolicate addresses using lldb.\n"
+ "\n"
+ "SYNOPSIS\n"
+ " " PROGRAM_NAME " [[--arch=<ARCH>] [--platform=<PLATFORM>] [--verbose] [--help] --] <PATH> <ADDRESS> [<ADDRESS>....]\n"
+ "\n"
+ "DESCRIPTION\n"
+ " Loads the executable pointed to by <PATH> and looks up and <ADDRESS>\n"
+ " arguments\n"
+ "\n"
+ "EXAMPLE\n"
+ " " PROGRAM_NAME " --arch=x86_64 -- /usr/lib/dyld 0x100000000\n"
+ );
+ exit(0);
+}
int
main (int argc, char const *argv[])
{
// Use a sentry object to properly initialize/terminate LLDB.
LLDBSentry sentry;
-
- if (argc < 3)
- exit (1);
- // The first argument is the file path we want to look something up in
- const char *exe_file_path = argv[1];
- // The second argument in the address that we want to lookup
- lldb::addr_t file_addr = strtoull (argv[2], NULL, 0);
+ SBDebugger debugger (SBDebugger::Create());
// Create a debugger instance so we can create a target
- SBDebugger debugger (SBDebugger::Create());
+ if (!debugger.IsValid())
+ fprintf (stderr, "error: failed to create a debugger object\n");
- if (debugger.IsValid())
+ bool show_usage = false;
+ bool verbose = false;
+ const char *arch = NULL;
+ const char *platform = NULL;
+ std::string short_options("h?");
+ for (const struct option *opt = g_long_options; opt->name; ++opt)
{
+ if (isprint(opt->val))
+ {
+ short_options.append(1, (char)opt->val);
+ switch (opt->has_arg)
+ {
+ case no_argument:
+ break;
+ case required_argument:
+ short_options.append(1, ':');
+ break;
+ case optional_argument:
+ short_options.append(2, ':');
+ break;
+ }
+ }
+ }
+#ifdef __GLIBC__
+ optind = 0;
+#else
+ optreset = 1;
+ optind = 1;
+#endif
+ char ch;
+ while ((ch = getopt_long_only(argc, (char * const *)argv, short_options.c_str(), g_long_options, 0)) != -1)
+ {
+ switch (ch)
+ {
+ case 0:
+ break;
+
+ case 'a':
+ if (arch != NULL)
+ {
+ fprintf (stderr, "error: the --arch option can only be specified once\n");
+ exit(1);
+ }
+ arch = optarg;
+ break;
+
+ case 'p':
+ platform = optarg;
+ break;
+
+ case 'v':
+ verbose = true;
+ break;
+
+ case 'h':
+ case '?':
+ default:
+ show_usage = true;
+ break;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (show_usage || argc < 2)
+ usage();
+
+ int arg_idx = 0;
+ // The first argument is the file path we want to look something up in
+ const char *exe_file_path = argv[arg_idx];
+ const char *addr_cstr;
+ const bool add_dependent_libs = false;
+ SBError error;
+ SBStream strm;
+ strm.RedirectToFileHandle (stdout, false);
+
+ while ((addr_cstr = argv[++arg_idx]) != NULL)
+ {
+ // The second argument in the address that we want to lookup
+ lldb::addr_t file_addr = strtoull (addr_cstr, NULL, 0);
+
// Create a target using the executable.
- SBTarget target (debugger.CreateTargetWithFileAndArch (exe_file_path, "i386"));
+ SBTarget target = debugger.CreateTarget (exe_file_path,
+ arch,
+ platform,
+ add_dependent_libs,
+ error);
+ if (!error.Success())
+ {
+ fprintf (stderr, "error: %s\n", error.GetCString());
+ exit(1);
+ }
+
+ printf ("%sLooking up 0x%llx in '%s':\n", (arg_idx > 1) ? "\n" : "", file_addr, exe_file_path);
+
if (target.IsValid())
{
// Find the executable module so we can do a lookup inside it
SBFileSpec exe_file_spec (exe_file_path, true);
SBModule module (target.FindModule (exe_file_spec));
-
+
// Take a file virtual address and resolve it to a section offset
// address that can be used to do a symbol lookup by address
SBAddress addr = module.ResolveFileAddress (file_addr);
- if (addr.IsValid())
-
+ bool success = addr.IsValid() && addr.GetSection().IsValid();
+ if (success)
{
// We can resolve a section offset address in the module
// and only ask for what we need. You can logical or together
@@ -91,28 +215,17 @@ main (int argc, char const *argv[])
//
// NOTE: the less you ask for, the less LLDB will parse as
// LLDB does partial parsing on just about everything.
- SBSymbolContext symbol_context (module.ResolveSymbolContextForAddress (addr, eSymbolContextEverything));
-
- SBCompileUnit comp_unit (symbol_context.GetCompileUnit());
- if (comp_unit.IsValid())
- {
- }
- SBFunction function (symbol_context.GetFunction());
- if (function.IsValid())
- {
- }
- SBBlock block (symbol_context.GetBlock());
- if (block.IsValid())
- {
- }
- SBLineEntry line_entry (symbol_context.GetLineEntry());
- if (line_entry.IsValid())
- {
- }
- SBSymbol symbol (symbol_context.GetSymbol());
- if (symbol.IsValid())
- {
- }
+ SBSymbolContext sc (module.ResolveSymbolContextForAddress (addr, eSymbolContextEverything));
+
+ strm.Printf (" Address: %s + 0x%llx\n Summary: ", addr.GetSection().GetName (), addr.GetOffset());
+ addr.GetDescription (strm);
+ strm.Printf ("\n");
+ if (verbose)
+ sc.GetDescription (strm);
+ }
+ else
+ {
+ printf ("error: 0x%llx does not resolve to a valid file address in '%s'\n", file_addr, exe_file_path);
}
}
}
Modified: lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/diagnose_unwind.py Tue Jul 2 16:55:02 2013
@@ -12,6 +12,7 @@ import re
import shlex
# Print the frame number, pc, frame pointer, module UUID and function name
+# Returns the SBModule that contains the PC, if it could be found
def backtrace_print_frame (target, frame_num, addr, fp):
process = target.GetProcess()
addr_for_printing = addr
@@ -45,32 +46,44 @@ def backtrace_print_frame (target, frame
print '%2d: pc==0x%-*x fp==0x%-*x %s %s + %d' % (frame_num, addr_width, addr_for_printing, addr_width, fp, module_description, sym_ctx.GetSymbol().GetName(), offset)
else:
print '%2d: pc==0x%-*x fp==0x%-*x %s' % (frame_num, addr_width, addr_for_printing, addr_width, fp, module_description)
+ return sbaddr.GetModule()
-# A simple stack walk algorithm that follows the frame chain after the first two frames.
+# A simple stack walk algorithm that follows the frame chain.
+# Returns a two-element list; the first element is a list of modules
+# seen and the second element is a list of addresses seen during the backtrace.
def simple_backtrace(debugger):
target = debugger.GetSelectedTarget()
process = target.GetProcess()
cur_thread = process.GetSelectedThread()
- backtrace_print_frame (target, 0, cur_thread.GetFrameAtIndex(0).GetPC(), cur_thread.GetFrameAtIndex(0).GetFP())
- if cur_thread.GetNumFrames() < 2:
- return
-
- cur_fp = cur_thread.GetFrameAtIndex(1).GetFP()
- cur_pc = cur_thread.GetFrameAtIndex(1).GetPC()
+ initial_fp = cur_thread.GetFrameAtIndex(0).GetFP()
# If the pseudoreg "fp" isn't recognized, on arm hardcode to r7 which is correct for Darwin programs.
- if cur_fp == lldb.LLDB_INVALID_ADDRESS and target.triple[0:3] == "arm":
+ if initial_fp == lldb.LLDB_INVALID_ADDRESS and target.triple[0:3] == "arm":
for reggroup in cur_thread.GetFrameAtIndex(1).registers:
if reggroup.GetName() == "General Purpose Registers":
for reg in reggroup:
if reg.GetName() == "r7":
- cur_fp = int (reg.GetValue(), 16)
+ initial_fp = int (reg.GetValue(), 16)
+
+ module_list = []
+ address_list = [cur_thread.GetFrameAtIndex(0).GetPC()]
+ this_module = backtrace_print_frame (target, 0, cur_thread.GetFrameAtIndex(0).GetPC(), initial_fp)
+ if this_module != None:
+ module_list.append (this_module)
+ if cur_thread.GetNumFrames() < 2:
+ return
+
+ cur_fp = process.ReadPointerFromMemory (initial_fp, lldb.SBError())
+ cur_pc = process.ReadPointerFromMemory (initial_fp + process.GetAddressByteSize(), lldb.SBError())
frame_num = 1
while cur_pc != 0 and cur_fp != 0 and cur_pc != lldb.LLDB_INVALID_ADDRESS and cur_fp != lldb.LLDB_INVALID_ADDRESS:
- backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+ address_list.append (cur_pc)
+ this_module = backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+ if this_module != None:
+ module_list.append (this_module)
frame_num = frame_num + 1
next_pc = 0
next_fp = 0
@@ -87,7 +100,10 @@ def simple_backtrace(debugger):
next_pc = next_pc & ~1
cur_pc = next_pc
cur_fp = next_fp
- backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+ this_module = backtrace_print_frame (target, frame_num, cur_pc, cur_fp)
+ if this_module != None:
+ module_list.append (this_module)
+ return [module_list, address_list]
def diagnose_unwind(debugger, command, result, dict):
"""
@@ -118,51 +134,104 @@ to be helpful when reporting the problem
if len(lldb_versions_match.groups()) >= 5 and lldb_versions_match.groups()[4]:
lldb_minor = int(lldb_versions_match.groups()[4])
+ modules_seen = []
+ addresses_seen = []
+
print 'LLDB version %s' % debugger.GetVersionString()
print 'Unwind diagnostics for thread %d' % thread.GetIndexID()
print ""
+ print "============================================================================================="
+ print ""
+ print "OS plugin setting:"
+ debugger.HandleCommand("settings show target.process.python-os-plugin-path")
+ print ""
+ print "Live register context:"
+ thread.SetSelectedFrame(0)
+ debugger.HandleCommand("register read")
+ print ""
+ print "============================================================================================="
+ print ""
print "lldb's unwind algorithm:"
print ""
frame_num = 0
for frame in thread.frames:
if not frame.IsInlined():
- backtrace_print_frame (target, frame_num, frame.GetPC(), frame.GetFP())
+ this_module = backtrace_print_frame (target, frame_num, frame.GetPC(), frame.GetFP())
+ if this_module != None:
+ modules_seen.append (this_module)
+ addresses_seen.append (frame.GetPC())
frame_num = frame_num + 1
print ""
print "============================================================================================="
print ""
print "Simple stack walk algorithm:"
print ""
- simple_backtrace(debugger)
+ simple_bt_modules_and_addresses = simple_backtrace(debugger)
+ modules_seen += simple_bt_modules_and_addresses[0]
+ addresses_seen = set(addresses_seen)
+ addresses_seen.update(set(simple_bt_modules_and_addresses[1]))
+
print ""
print "============================================================================================="
print ""
+ print "Modules seen in stack walks:"
+ print ""
+ modules_already_seen = set()
+ for module in modules_seen:
+ if module != None and module.GetFileSpec().GetFilename() != None:
+ if not module.GetFileSpec().GetFilename() in modules_already_seen:
+ debugger.HandleCommand('image list %s' % module.GetFileSpec().GetFilename())
+ modules_already_seen.add(module.GetFileSpec().GetFilename())
+
+ print ""
+ print "============================================================================================="
+ print ""
+ print "Disassembly ofaddresses seen in stack walks:"
+ print ""
+ additional_addresses_to_disassemble = addresses_seen
for frame in thread.frames:
if not frame.IsInlined():
print "--------------------------------------------------------------------------------------"
print ""
- print "Disassembly of %s, frame %d" % (frame.GetFunctionName(), frame.GetFrameID())
+ print "Disassembly of %s, frame %d, address 0x%x" % (frame.GetFunctionName(), frame.GetFrameID(), frame.GetPC())
print ""
- if lldb_major > 300 or (lldb_major == 300 and lldb_minor >= 18):
- if target.triple[0:6] == "x86_64" or target.triple[0:4] == "i386":
- debugger.HandleCommand('disassemble -F att -a 0x%x' % frame.GetPC())
- else:
- debugger.HandleCommand('disassemble -a 0x%x' % frame.GetPC())
+ if target.triple[0:6] == "x86_64" or target.triple[0:4] == "i386":
+ debugger.HandleCommand('disassemble -F att -a 0x%x' % frame.GetPC())
else:
- debugger.HandleCommand('disassemble -n "%s"' % frame.GetFunctionName())
+ debugger.HandleCommand('disassemble -a 0x%x' % frame.GetPC())
+ if frame.GetPC() in additional_addresses_to_disassemble:
+ additional_addresses_to_disassemble.remove (frame.GetPC())
+
+ for address in list(additional_addresses_to_disassemble):
+ print "--------------------------------------------------------------------------------------"
+ print ""
+ print "Disassembly of 0x%x" % address
+ print ""
+ if target.triple[0:6] == "x86_64" or target.triple[0:4] == "i386":
+ debugger.HandleCommand('disassemble -F att -a 0x%x' % address)
+ else:
+ debugger.HandleCommand('disassemble -a 0x%x' % address)
+
print ""
print "============================================================================================="
print ""
+ additional_addresses_to_show_unwind = addresses_seen
for frame in thread.frames:
if not frame.IsInlined():
print "--------------------------------------------------------------------------------------"
print ""
print "Unwind instructions for %s, frame %d" % (frame.GetFunctionName(), frame.GetFrameID())
print ""
- if lldb_major > 300 or (lldb_major == 300 and lldb_minor >= 20):
- debugger.HandleCommand('image show-unwind -a "0x%x"' % frame.GetPC())
- else:
- debugger.HandleCommand('image show-unwind -n "%s"' % frame.GetFunctionName())
+ debugger.HandleCommand('image show-unwind -a "0x%x"' % frame.GetPC())
+ if frame.GetPC() in additional_addresses_to_show_unwind:
+ additional_addresses_to_show_unwind.remove (frame.GetPC())
+
+ for address in list(additional_addresses_to_show_unwind):
+ print "--------------------------------------------------------------------------------------"
+ print ""
+ print "Unwind instructions for 0x%x" % address
+ print ""
+ debugger.HandleCommand('image show-unwind -a "0x%x"' % address)
def create_diagnose_unwind_options():
usage = "usage: %prog"
Modified: lldb/branches/lldb-platform-work/examples/python/globals.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/globals.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/globals.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/globals.py Tue Jul 2 16:55:02 2013
@@ -57,7 +57,7 @@ def globals(command_args):
parser = optparse.OptionParser(description=description, prog='globals',usage=usage)
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
parser.add_option('-a', '--arch', type='string', metavar='arch', dest='arch', help='Specify an architecture (or triple) to use when extracting from a file.')
- parser.add_option('-p', '--platform', type='string', metavar='platform', dest='platform', help='specify one platform by name')
+ parser.add_option('-p', '--platform', type='string', metavar='platform', dest='platform', help='Specify the platform to use when creating the debug target. Valid values include "localhost", "darwin-kernel", "ios-simulator", "remote-freebsd", "remote-macosx", "remote-ios", "remote-linux".')
try:
(options, args) = parser.parse_args(command_args)
except:
Modified: lldb/branches/lldb-platform-work/examples/python/process_events.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/process_events.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/process_events.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/process_events.py Tue Jul 2 16:55:02 2013
@@ -48,13 +48,6 @@ except ImportError:
print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"
sys.exit(1)
-
-
-
-
-
-
-
def print_threads(process, options):
if options.show_threads:
for thread in process:
@@ -87,6 +80,7 @@ def main(argv):
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help="Enable verbose logging.", default=False)
parser.add_option('-b', '--breakpoint', action='append', type='string', metavar='BPEXPR', dest='breakpoints', help='Breakpoint commands to create after the target has been created, the values will be sent to the "_regexp-break" command which supports breakpoints by name, file:line, and address.')
parser.add_option('-a', '--arch', type='string', dest='arch', help='The architecture to use when creating the debug target.', default=None)
+ parser.add_option('--platform', type='string', metavar='platform', dest='platform', help='Specify the platform to use when creating the debug target. Valid values include "localhost", "darwin-kernel", "ios-simulator", "remote-freebsd", "remote-macosx", "remote-ios", "remote-linux".', default=None)
parser.add_option('-l', '--launch-command', action='append', type='string', metavar='CMD', dest='launch_commands', help='LLDB command interpreter commands to run once after the process has launched. This option can be specified more than once.', default=[])
parser.add_option('-s', '--stop-command', action='append', type='string', metavar='CMD', dest='stop_commands', help='LLDB command interpreter commands to run each time the process stops. This option can be specified more than once.', default=[])
parser.add_option('-c', '--crash-command', action='append', type='string', metavar='CMD', dest='crash_commands', help='LLDB command interpreter commands to run in case the process crashes. This option can be specified more than once.', default=[])
@@ -135,16 +129,19 @@ def main(argv):
# Create a new debugger instance
debugger = lldb.SBDebugger.Create()
+ debugger.SetAsync (True)
command_interpreter = debugger.GetCommandInterpreter()
# Create a target from a file and arch
if exe:
print "Creating a target for '%s'" % exe
- target = debugger.CreateTargetWithFileAndArch (exe, options.arch)
+ error = lldb.SBError()
+ target = debugger.CreateTarget (exe, options.arch, options.platform, True, error)
if target:
- # Set any breakpoints that were specified in the args if we are launching
+ # Set any breakpoints that were specified in the args if we are launching. We use the
+ # command line command to take advantage of the shorthand breakpoint creation
if launch_info and options.breakpoints:
for bp in options.breakpoints:
debugger.HandleCommand( "_regexp-break %s" % (bp))
@@ -175,70 +172,90 @@ def main(argv):
# Make sure the launch went ok
if process and process.GetProcessID() != lldb.LLDB_INVALID_PROCESS_ID:
pid = process.GetProcessID()
- listener = lldb.SBListener("event_listener")
+ listener = debugger.GetListener()
# sign up for process state change events
- process.GetBroadcaster().AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)
stop_idx = 0
done = False
while not done:
event = lldb.SBEvent()
if listener.WaitForEvent (options.event_timeout, event):
- state = lldb.SBProcess.GetStateFromEvent (event)
- print "event %s" % (lldb.SBDebugger.StateAsCString(state))
- if state == lldb.eStateStopped:
- if stop_idx == 0:
- if launch_info:
- print "process %u launched" % (pid)
- else:
- print "attached to process %u" % (pid)
- for m in target.modules:
- print m
- if options.breakpoints:
- for bp in options.breakpoints:
- debugger.HandleCommand( "_regexp-break %s" % (bp))
- run_commands(command_interpreter, ['breakpoint list'])
- run_commands (command_interpreter, options.launch_commands)
- else:
- if options.verbose:
- print "process %u stopped" % (pid)
- run_commands (command_interpreter, options.stop_commands)
- stop_idx += 1
- print_threads (process, options)
- print "continuing process %u" % (pid)
- process.Continue()
- elif state == lldb.eStateExited:
- exit_desc = process.GetExitDescription()
- if exit_desc:
- print "process %u exited with status %u: %s" % (pid, process.GetExitStatus (), exit_desc)
+ if lldb.SBProcess.EventIsProcessEvent(event):
+ state = lldb.SBProcess.GetStateFromEvent (event)
+ if state == lldb.eStateInvalid:
+ # Not a state event
+ print 'process event = %s' % (event)
else:
- print "process %u exited with status %u" % (pid, process.GetExitStatus ())
- run_commands (command_interpreter, options.exit_commands)
- done = True
- elif state == lldb.eStateCrashed:
- print "process %u crashed" % (pid)
- print_threads (process, options)
- run_commands (command_interpreter, options.crash_commands)
- done = True
- elif state == lldb.eStateDetached:
- print "process %u detached" % (pid)
- done = True
- elif state == lldb.eStateRunning:
- # process is running, don't say anything, we will always get one of these after resuming
- if options.verbose:
- print "process %u resumed" % (pid)
- elif state == lldb.eStateUnloaded:
- print "process %u unloaded, this shouldn't happen" % (pid)
- done = True
- elif state == lldb.eStateConnected:
- print "process connected"
- elif state == lldb.eStateAttaching:
- print "process attaching"
- elif state == lldb.eStateLaunching:
- print "process launching"
+ print "process state changed event: %s" % (lldb.SBDebugger.StateAsCString(state))
+ if state == lldb.eStateStopped:
+ if stop_idx == 0:
+ if launch_info:
+ print "process %u launched" % (pid)
+ run_commands(command_interpreter, ['breakpoint list'])
+ else:
+ print "attached to process %u" % (pid)
+ for m in target.modules:
+ print m
+ if options.breakpoints:
+ for bp in options.breakpoints:
+ debugger.HandleCommand( "_regexp-break %s" % (bp))
+ run_commands(command_interpreter, ['breakpoint list'])
+ run_commands (command_interpreter, options.launch_commands)
+ else:
+ if options.verbose:
+ print "process %u stopped" % (pid)
+ run_commands (command_interpreter, options.stop_commands)
+ stop_idx += 1
+ print_threads (process, options)
+ print "continuing process %u" % (pid)
+ process.Continue()
+ elif state == lldb.eStateExited:
+ exit_desc = process.GetExitDescription()
+ if exit_desc:
+ print "process %u exited with status %u: %s" % (pid, process.GetExitStatus (), exit_desc)
+ else:
+ print "process %u exited with status %u" % (pid, process.GetExitStatus ())
+ run_commands (command_interpreter, options.exit_commands)
+ done = True
+ elif state == lldb.eStateCrashed:
+ print "process %u crashed" % (pid)
+ print_threads (process, options)
+ run_commands (command_interpreter, options.crash_commands)
+ done = True
+ elif state == lldb.eStateDetached:
+ print "process %u detached" % (pid)
+ done = True
+ elif state == lldb.eStateRunning:
+ # process is running, don't say anything, we will always get one of these after resuming
+ if options.verbose:
+ print "process %u resumed" % (pid)
+ elif state == lldb.eStateUnloaded:
+ print "process %u unloaded, this shouldn't happen" % (pid)
+ done = True
+ elif state == lldb.eStateConnected:
+ print "process connected"
+ elif state == lldb.eStateAttaching:
+ print "process attaching"
+ elif state == lldb.eStateLaunching:
+ print "process launching"
+ else:
+ print 'event = %s' % (event)
else:
# timeout waiting for an event
print "no process event for %u seconds, killing the process..." % (options.event_timeout)
done = True
+ # Now that we are done dump the stdout and stderr
+ process_stdout = process.GetSTDOUT(1024)
+ if process_stdout:
+ print "Process STDOUT:\n%s" % (process_stdout)
+ while process_stdout:
+ process_stdout = process.GetSTDOUT(1024)
+ print process_stdout
+ process_stderr = process.GetSTDERR(1024)
+ if process_stderr:
+ print "Process STDERR:\n%s" % (process_stderr)
+ while process_stderr:
+ process_stderr = process.GetSTDERR(1024)
+ print process_stderr
process.Kill() # kill the process
else:
if error:
Modified: lldb/branches/lldb-platform-work/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/symbolication.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/symbolication.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/symbolication.py Tue Jul 2 16:55:02 2013
@@ -538,7 +538,7 @@ def Symbolicate(command_args):
description='''Symbolicate one or more addresses using LLDB's python scripting API..'''
parser = optparse.OptionParser(description=description, prog='crashlog.py',usage=usage)
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
- parser.add_option('-p', '--platform', type='string', metavar='platform', dest='platform', help='specify one platform by name')
+ parser.add_option('-p', '--platform', type='string', metavar='platform', dest='platform', help='Specify the platform to use when creating the debug target. Valid values include "localhost", "darwin-kernel", "ios-simulator", "remote-freebsd", "remote-macosx", "remote-ios", "remote-linux".')
parser.add_option('-f', '--file', type='string', metavar='file', dest='file', help='Specify a file to use when symbolicating')
parser.add_option('-a', '--arch', type='string', metavar='arch', dest='arch', help='Specify a architecture to use when symbolicating')
parser.add_option('-s', '--slide', type='int', metavar='slide', dest='slide', help='Specify the slide to use on the file specified with the --file option', default=None)
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBCommandReturnObject.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBCommandReturnObject.h Tue Jul 2 16:55:02 2013
@@ -98,6 +98,13 @@ public:
const char *
GetError (bool only_if_no_immediate);
+ void
+ SetError (lldb::SBError &error,
+ const char *fallback_error_cstr = NULL);
+
+ void
+ SetError (const char* error_cstr);
+
protected:
friend class SBCommandInterpreter;
friend class SBOptions;
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBCompileUnit.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBCompileUnit.h Tue Jul 2 16:55:02 2013
@@ -59,6 +59,24 @@ public:
uint32_t
FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
+
+ //------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// compile unit.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this compile
+ /// unit.
+ ///
+ /// @return
+ /// A list of types in this compile unit that match \a type_mask
+ //------------------------------------------------------------------
+ lldb::SBTypeList
+ GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
bool
operator == (const lldb::SBCompileUnit &rhs) const;
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBError.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBError.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBError.h Tue Jul 2 16:55:02 2013
@@ -66,6 +66,7 @@ public:
protected:
+ friend class SBCommandReturnObject;
friend class SBData;
friend class SBDebugger;
friend class SBCommunication;
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBModule.h Tue Jul 2 16:55:02 2013
@@ -199,7 +199,24 @@ public:
lldb::SBType
GetBasicType(lldb::BasicType type);
-
+
+ //------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// module.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this module.
+ ///
+ /// @return
+ /// A list of types in this module that match \a type_mask
+ //------------------------------------------------------------------
+ lldb::SBTypeList
+ GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
+
//------------------------------------------------------------------
/// Get the module version numbers.
///
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h Tue Jul 2 16:55:02 2013
@@ -33,7 +33,10 @@ public:
const char *
GetName ();
-
+
+ lldb::SBSection
+ GetParent();
+
lldb::SBSection
FindSubSection (const char *sect_name);
@@ -77,6 +80,7 @@ public:
bool
GetDescription (lldb::SBStream &description);
+
private:
friend class SBAddress;
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h Tue Jul 2 16:55:02 2013
@@ -248,6 +248,8 @@ public:
SBTarget (const lldb::SBTarget& rhs);
+ SBTarget (const lldb::TargetSP& target_sp);
+
const lldb::SBTarget&
operator = (const lldb::SBTarget& rhs);
@@ -802,8 +804,6 @@ protected:
// create an instance of this class.
//------------------------------------------------------------------
- SBTarget (const lldb::TargetSP& target_sp);
-
lldb::TargetSP
GetSP () const;
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBThread.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBThread.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBThread.h Tue Jul 2 16:55:02 2013
@@ -36,6 +36,8 @@ public:
SBThread ();
SBThread (const lldb::SBThread &thread);
+
+ SBThread (const lldb::ThreadSP& lldb_object_sp);
~SBThread();
@@ -201,8 +203,6 @@ protected:
friend class SBDebugger;
friend class SBValue;
- SBThread (const lldb::ThreadSP& lldb_object_sp);
-
void
SetThread (const lldb::ThreadSP& lldb_object_sp);
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBType.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBType.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBType.h Tue Jul 2 16:55:02 2013
@@ -93,6 +93,9 @@ public:
bool
IsFunctionType ();
+ bool
+ IsPolymorphicClass ();
+
lldb::SBType
GetPointerType();
@@ -235,6 +238,8 @@ public:
private:
std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
+ friend class SBModule;
+ friend class SBCompileUnit;
};
Modified: lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointSiteList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointSiteList.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointSiteList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointSiteList.h Tue Jul 2 16:55:02 2013
@@ -16,6 +16,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointSite.h"
+#include "lldb/Host/Mutex.h"
namespace lldb_private {
@@ -130,31 +131,8 @@ public:
bool
BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id);
- //------------------------------------------------------------------
- /// Returns a shared pointer to the breakpoint site with index \a i.
- ///
- /// @param[in] i
- /// The breakpoint site index to seek for.
- ///
- /// @result
- /// A shared pointer to the breakpoint site. May contain a NULL pointer if the
- /// breakpoint doesn't exist.
- //------------------------------------------------------------------
- lldb::BreakpointSiteSP
- GetByIndex (uint32_t i);
-
- //------------------------------------------------------------------
- /// Returns a shared pointer to the breakpoint site with index \a i - const version.
- ///
- /// @param[in] i
- /// The breakpoint site index to seek for.
- ///
- /// @result
- /// A shared pointer to the breakpoint site. May contain a NULL pointer if the
- /// breakpoint doesn't exist.
- //------------------------------------------------------------------
- const lldb::BreakpointSiteSP
- GetByIndex (uint32_t i) const;
+ void
+ ForEach (std::function <void(BreakpointSite *)> const &callback);
//------------------------------------------------------------------
/// Removes the breakpoint site given by \b breakID from this list.
@@ -179,9 +157,6 @@ public:
//------------------------------------------------------------------
bool
RemoveByAddress (lldb::addr_t addr);
-
- void
- SetEnabledForAll(const bool enable, const lldb::break_id_t except_id = LLDB_INVALID_BREAK_ID);
bool
FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bound, BreakpointSiteList &bp_site_list) const;
@@ -211,8 +186,18 @@ public:
/// The number of elements.
//------------------------------------------------------------------
size_t
- GetSize() const { return m_bp_site_list.size(); }
+ GetSize() const
+ {
+ Mutex::Locker locker(m_mutex);
+ return m_bp_site_list.size();
+ }
+ bool
+ IsEmpty() const
+ {
+ Mutex::Locker locker(m_mutex);
+ return m_bp_site_list.empty();
+ }
protected:
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
@@ -222,13 +207,7 @@ protected:
collection::const_iterator
GetIDConstIterator(lldb::break_id_t breakID) const;
- // This function exposes the m_bp_site_list. I use the in Process because there
- // are places there where you want to iterate over the list, and it is less efficient
- // to do it by index. FIXME: Find a better way to do this.
-
- const collection *
- GetMap ();
-
+ mutable Mutex m_mutex;
collection m_bp_site_list; // The breakpoint site list.
};
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ArchSpec.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ArchSpec.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ArchSpec.h Tue Jul 2 16:55:02 2013
@@ -147,10 +147,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
- ///
- /// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
- virtual
~ArchSpec ();
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Error.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Error.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Error.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Error.h Tue Jul 2 16:55:02 2013
@@ -283,6 +283,19 @@ public:
//------------------------------------------------------------------
bool
Success () const;
+
+ //------------------------------------------------------------------
+ /// Test for a failure due to a generic interrupt.
+ ///
+ /// Returns true if the error code in this object was caused by an interrupt.
+ /// At present only supports Posix EINTR.
+ ///
+ /// @return
+ /// \b true if this object contains an value that describes
+ /// failure due to interrupt, \b false otherwise.
+ //------------------------------------------------------------------
+ bool
+ WasInterrupted() const;
protected:
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Flags.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Flags.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Flags.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Flags.h Tue Jul 2 16:55:02 2013
@@ -61,10 +61,7 @@ public:
//----------------------------------------------------------------------
/// Destructor.
- ///
- /// The destructor is virtual in case this class is subclassed.
//----------------------------------------------------------------------
- virtual
~Flags ()
{
}
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/MappedHash.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/MappedHash.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/MappedHash.h Tue Jul 2 16:55:02 2013
@@ -486,6 +486,10 @@ public:
virtual const char *
GetStringForKeyType (KeyType key) const = 0;
+
+ virtual bool
+ ReadHashData (uint32_t hash_data_offset,
+ HashData &hash_data) const = 0;
// This method must be implemented in any subclasses and it must try to
// read one "Pair" at the offset pointed to by the "hash_data_offset_ptr"
@@ -514,6 +518,27 @@ public:
return m_header;
}
+
+ void
+ ForEach (std::function <bool(const HashData &hash_data)> const &callback) const
+ {
+ const size_t num_hash_offsets = m_header.hashes_count;
+ for (size_t i=0; i<num_hash_offsets; ++i)
+ {
+ uint32_t hash_data_offset = GetHashDataOffset (i);
+ if (hash_data_offset != UINT32_MAX)
+ {
+ HashData hash_data;
+ if (ReadHashData (hash_data_offset, hash_data))
+ {
+ // If the callback returns false, then we are done and should stop
+ if (callback(hash_data) == false)
+ return;
+ }
+ }
+ }
+ }
+
protected:
// Implementation agnostic information
HeaderType m_header;
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Module.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Module.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Module.h Tue Jul 2 16:55:02 2013
@@ -45,7 +45,7 @@ class Module :
public SymbolContextScope
{
public:
- // Static functions that can track the lifetime of moodule objects.
+ // Static functions that can track the lifetime of module objects.
// This is handy because we might have Module objects that are in
// shared pointers that aren't in the global module list (from
// ModuleList). If this is the case we need to know about it.
@@ -638,7 +638,21 @@ public:
//------------------------------------------------------------------
virtual ObjectFile *
GetObjectFile ();
-
+
+ //------------------------------------------------------------------
+ /// Get the unified section list for the module. This is the section
+ /// list created by the module's object file and any debug info and
+ /// symbol files created by the symbol vendor.
+ ///
+ /// If the symbol vendor has not been loaded yet, this function
+ /// will return the section list for the object file.
+ ///
+ /// @return
+ /// Unified module section list.
+ //------------------------------------------------------------------
+ virtual SectionList *
+ GetUnifiedSectionList ();
+
uint32_t
GetVersion (uint32_t *versions, uint32_t num_versions);
@@ -986,6 +1000,7 @@ protected:
std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
ClangASTContext m_ast; ///< The AST context for 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
+ std::unique_ptr<lldb_private::SectionList> m_unified_sections_ap; ///< Unified section list for module.
bool m_did_load_objfile:1,
m_did_load_symbol_vendor:1,
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ModuleChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ModuleChild.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ModuleChild.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ModuleChild.h Tue Jul 2 16:55:02 2013
@@ -41,11 +41,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be
- /// inherited from.
//------------------------------------------------------------------
- virtual
~ModuleChild();
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Section.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Section.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Section.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Section.h Tue Jul 2 16:55:02 2013
@@ -18,6 +18,7 @@
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/VMRange.h"
+#include "lldb/Symbol/ObjectFile.h"
#include <limits.h>
namespace lldb_private {
@@ -31,9 +32,11 @@ public:
SectionList();
- virtual
~SectionList();
+ bool
+ Copy (SectionList* dest_section_list);
+
size_t
AddSection (const lldb::SectionSP& section_sp);
@@ -78,6 +81,10 @@ public:
bool
ReplaceSection (lldb::user_id_t sect_id, const lldb::SectionSP& section_sp, uint32_t depth = UINT32_MAX);
+ // Warning, this can be slow as it's removing items from a std::vector.
+ bool
+ DeleteSection (size_t idx);
+
lldb::SectionSP
GetSectionAtIndex (size_t idx) const;
@@ -88,6 +95,13 @@ public:
void
Finalize ();
+ // Each time Finalize() is called with changes, revision id increments.
+ uint32_t
+ GetRevisionID() const
+ {
+ return m_revision_id;
+ }
+
void
Clear ()
{
@@ -95,6 +109,8 @@ public:
}
protected:
+ bool m_changed;
+ uint32_t m_revision_id;
collection m_sections;
};
@@ -108,6 +124,7 @@ class Section :
public:
// Create a root section (one that has no parent)
Section (const lldb::ModuleSP &module_sp,
+ ObjectFile *obj_file,
lldb::user_id_t sect_id,
const ConstString &name,
lldb::SectionType sect_type,
@@ -120,6 +137,7 @@ public:
// Create a section that is a child of parent_section_sp
Section (const lldb::SectionSP &parent_section_sp, // NULL for top level sections, non-NULL for child sections
const lldb::ModuleSP &module_sp,
+ ObjectFile *obj_file,
lldb::user_id_t sect_id,
const ConstString &name,
lldb::SectionType sect_type,
@@ -272,11 +290,24 @@ public:
m_children.Finalize();
}
+ ObjectFile *
+ GetObjectFile ()
+ {
+ return m_obj_file;
+ }
+ const ObjectFile *
+ GetObjectFile () const
+ {
+ return m_obj_file;
+ }
+
+
protected:
+ ObjectFile *m_obj_file; // The object file that data for this section should be read from
+ lldb::SectionType m_type; // The type of this section
lldb::SectionWP m_parent_wp; // Weak pointer to parent section
ConstString m_name; // Name of this section
- lldb::SectionType m_type; // The type of this section
lldb::addr_t m_file_addr; // The absolute file virtual address range of this section if m_parent == NULL,
// offset from parent file virtual address if m_parent != NULL
lldb::addr_t m_byte_size; // Size in bytes that this section will occupy in memory at runtime
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/UUID.h Tue Jul 2 16:55:02 2013
@@ -56,7 +56,7 @@ public:
SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
std::string
- GetAsString () const;
+ GetAsString (const char *separator = NULL) const;
size_t
SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16);
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/UniqueCStringMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/UniqueCStringMap.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/UniqueCStringMap.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/UniqueCStringMap.h Tue Jul 2 16:55:02 2013
@@ -121,6 +121,12 @@ public:
return false;
}
+ const char *
+ GetCStringAtIndexUnchecked (uint32_t idx) const
+ {
+ return m_map[idx].cstring;
+ }
+
// Use this function if you have simple types in your map that you
// can easily copy when accessing values by index.
T
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/UserID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/UserID.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/UserID.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/UserID.h Tue Jul 2 16:55:02 2013
@@ -39,11 +39,10 @@ struct UserID
//------------------------------------------------------------------
/// Destructor.
- ///
- /// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
- virtual
- ~UserID ();
+ ~UserID ()
+ {
+ }
//------------------------------------------------------------------
/// Clears the object state.
Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h Tue Jul 2 16:55:02 2013
@@ -80,7 +80,9 @@ public:
eValueObjectRepresentationStyleLanguageSpecific,
eValueObjectRepresentationStyleLocation,
eValueObjectRepresentationStyleChildrenCount,
- eValueObjectRepresentationStyleType
+ eValueObjectRepresentationStyleType,
+ eValueObjectRepresentationStyleName,
+ eValueObjectRepresentationStyleExpressionPath
};
enum ExpressionPathScanEndReason
Modified: lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatCache.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatCache.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatCache.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatCache.h Tue Jul 2 16:55:02 2013
@@ -60,10 +60,8 @@ private:
CacheMap m_map;
Mutex m_mutex;
-#ifdef LLDB_CONFIGURATION_DEBUG
uint64_t m_cache_hits;
uint64_t m_cache_misses;
-#endif
Entry&
GetEntry (const ConstString& type);
@@ -86,7 +84,6 @@ public:
void
Clear ();
-#ifdef LLDB_CONFIGURATION_DEBUG
uint64_t
GetCacheHits ()
{
@@ -98,7 +95,6 @@ public:
{
return m_cache_misses;
}
-#endif
};
} // namespace lldb_private
Modified: lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/DataFormatters/FormatNavigator.h Tue Jul 2 16:55:02 2013
@@ -28,6 +28,7 @@
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
@@ -70,7 +71,7 @@ HasPrefix (const char* str1, const char*
// those will not match any type because of the way we strip qualifiers from typenames
// this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
// and strips the unnecessary qualifier
-static ConstString
+static inline ConstString
GetValidTypeName_Impl (const ConstString& type)
{
int strip_len = 0;
@@ -648,6 +649,36 @@ protected:
if (Get_Impl (valobj,type,entry,use_dynamic,reason))
return true;
+ // try going to the unqualified type
+ do {
+ if (log)
+ log->Printf("[Get] trying the unqualified type");
+ lldb::clang_type_t opaque_type = type.getAsOpaquePtr();
+ if (!opaque_type)
+ {
+ if (log)
+ log->Printf("[Get] could not get the opaque_type");
+ break;
+ }
+ ClangASTType unqual_clang_ast_type = ClangASTType::GetFullyUnqualifiedType(valobj.GetClangAST(),opaque_type);
+ if (!unqual_clang_ast_type.IsValid())
+ {
+ if (log)
+ log->Printf("[Get] could not get the unqual_clang_ast_type");
+ break;
+ }
+ clang::QualType unqualified_qual_type = clang::QualType::getFromOpaquePtr(unqual_clang_ast_type.GetOpaqueQualType());
+ if (unqualified_qual_type.getTypePtrOrNull() != type.getTypePtrOrNull())
+ {
+ if (log)
+ log->Printf("[Get] unqualified type is there and is not the same, let's try");
+ if (Get_Impl (valobj,unqualified_qual_type,entry,use_dynamic,reason))
+ return true;
+ }
+ else if (log)
+ log->Printf("[Get] unqualified type same as original type");
+ } while(false);
+
// if all else fails, go to static type
if (valobj.IsDynamic())
{
Modified: lldb/branches/lldb-platform-work/include/lldb/DataFormatters/TypeSynthetic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/DataFormatters/TypeSynthetic.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/DataFormatters/TypeSynthetic.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/DataFormatters/TypeSynthetic.h Tue Jul 2 16:55:02 2013
@@ -295,20 +295,20 @@ namespace lldb_private {
m_expression_paths.clear();
}
- int
+ size_t
GetCount() const
{
return m_expression_paths.size();
}
const char*
- GetExpressionPathAtIndex(int i) const
+ GetExpressionPathAtIndex(size_t i) const
{
return m_expression_paths[i].c_str();
}
bool
- SetExpressionPathAtIndex (int i, const char* path)
+ SetExpressionPathAtIndex (size_t i, const char* path)
{
return SetExpressionPathAtIndex(i, std::string(path));
}
@@ -329,7 +329,7 @@ namespace lldb_private {
}
bool
- SetExpressionPathAtIndex (int i, const std::string& path)
+ SetExpressionPathAtIndex (size_t i, const std::string& path)
{
if (i >= GetCount())
return false;
@@ -399,7 +399,7 @@ namespace lldb_private {
GetIndexOfChildWithName (const ConstString &name)
{
const char* name_cstr = name.GetCString();
- for (int i = 0; i < filter->GetCount(); i++)
+ for (size_t i = 0; i < filter->GetCount(); i++)
{
const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
if (expr_cstr)
Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/IRForTarget.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/IRForTarget.h Tue Jul 2 16:55:02 2013
@@ -18,6 +18,8 @@
#include "lldb/Symbol/TaggedASTType.h"
#include "llvm/Pass.h"
+#include <map>
+
namespace llvm {
class BasicBlock;
class CallInst;
@@ -235,8 +237,7 @@ private:
/// be determined); false otherwise.
//------------------------------------------------------------------
bool
- ResolveFunctionPointers (llvm::Module &llvm_module,
- llvm::Function &llvm_function);
+ ResolveFunctionPointers (llvm::Module &llvm_module);
//------------------------------------------------------------------
/// A function-level pass to take the generated global value
@@ -307,7 +308,7 @@ private:
CreateResultVariable (llvm::Function &llvm_function);
//------------------------------------------------------------------
- /// A function-level pass to find Objective-C constant strings and
+ /// A module-level pass to find Objective-C constant strings and
/// transform them to calls to CFStringCreateWithBytes.
//------------------------------------------------------------------
@@ -321,32 +322,21 @@ private:
/// The constant C string inside the NSString. This will be
/// passed as the bytes argument to CFStringCreateWithBytes.
///
- /// @param[in] FirstEntryInstruction
- /// An instruction early in the execution of the function.
- /// When this function synthesizes a call to
- /// CFStringCreateWithBytes, it places the call before this
- /// instruction. The instruction should come before all
- /// uses of the NSString.
- ///
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
bool
RewriteObjCConstString (llvm::GlobalVariable *NSStr,
- llvm::GlobalVariable *CStr,
- llvm::Instruction *FirstEntryInstruction);
+ llvm::GlobalVariable *CStr);
//------------------------------------------------------------------
/// The top-level pass implementation
///
- /// @param[in] llvm_function
- /// The function currently being processed.
- ///
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
bool
- RewriteObjCConstStrings (llvm::Function &llvm_function);
+ RewriteObjCConstStrings ();
//------------------------------------------------------------------
/// A basic block-level pass to find all Objective-C method calls and
@@ -654,15 +644,13 @@ private:
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.
+ 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
- lldb_private::IRMemoryMap &m_memory_map; ///< The memory map to pass to the IR interpreter
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
lldb_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed
- bool m_has_side_effects; ///< True if the function's result cannot be simply determined statically
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)
@@ -688,10 +676,26 @@ private:
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
- static bool
+
+ 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,
- llvm::Value *new_constant,
- llvm::Instruction *first_entry_inst);
+ FunctionValueCache &value_maker,
+ FunctionValueCache &entry_instruction_finder);
//------------------------------------------------------------------
/// Construct a reference to m_reloc_placeholder with a given type
Modified: lldb/branches/lldb-platform-work/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Expression/Materializer.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Expression/Materializer.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Expression/Materializer.h Tue Jul 2 16:55:02 2013
@@ -15,6 +15,7 @@
#include "lldb/Expression/IRMemoryMap.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/StackFrame.h"
#include <vector>
@@ -61,14 +62,19 @@ public:
IRMemoryMap &map,
lldb::addr_t process_address) :
m_materializer(&materializer),
- m_frame_wp(frame_sp),
m_map(&map),
m_process_address(process_address)
{
+ if (frame_sp)
+ {
+ m_thread_wp = frame_sp->GetThread();
+ m_stack_id = frame_sp->GetStackID();
+ }
}
Materializer *m_materializer;
- lldb::StackFrameWP m_frame_wp;
+ lldb::ThreadWP m_thread_wp;
+ StackID m_stack_id;
IRMemoryMap *m_map;
lldb::addr_t m_process_address;
};
Modified: lldb/branches/lldb-platform-work/include/lldb/Host/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/Config.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/Config.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/Config.h Tue Jul 2 16:55:02 2013
@@ -18,7 +18,7 @@
#include "lldb/Host/linux/Config.h"
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
#include "lldb/Host/freebsd/Config.h"
Modified: lldb/branches/lldb-platform-work/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/FileSpec.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/FileSpec.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/FileSpec.h Tue Jul 2 16:55:02 2013
@@ -95,10 +95,7 @@ public:
//------------------------------------------------------------------
/// Destructor.
- ///
- /// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
- virtual
~FileSpec ();
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Host/linux/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/linux/Config.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/linux/Config.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/linux/Config.h Tue Jul 2 16:55:02 2013
@@ -17,8 +17,6 @@
#ifndef liblldb_Platform_Config_h_
#define liblldb_Platform_Config_h_
-#define LLDB_CONFIG_SUPPORTS_SETLINEBUFFERED 1
-
#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1
Modified: lldb/branches/lldb-platform-work/include/lldb/Host/macosx/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/macosx/Config.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/macosx/Config.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/macosx/Config.h Tue Jul 2 16:55:02 2013
@@ -17,8 +17,6 @@
#ifndef liblldb_Platform_Config_h_
#define liblldb_Platform_Config_h_
-#define LLDB_CONFIG_SUPPORTS_SETLINEBUFFERED 1
-
#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1
Modified: lldb/branches/lldb-platform-work/include/lldb/Host/mingw/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/mingw/Config.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Host/mingw/Config.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Host/mingw/Config.h Tue Jul 2 16:55:02 2013
@@ -17,8 +17,6 @@
#ifndef liblldb_Platform_Config_h_
#define liblldb_Platform_Config_h_
-#define LLDB_CONFIG_SUPPORTS_SETLINEBUFFERED 1
-
//#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
//#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandInterpreter.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandInterpreter.h Tue Jul 2 16:55:02 2013
@@ -18,6 +18,7 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
+#include "lldb/Interpreter/CommandHistory.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Core/Event.h"
@@ -381,15 +382,6 @@ public:
bool
GetSynchronous ();
- void
- DumpHistory (Stream &stream, uint32_t count) const;
-
- void
- DumpHistory (Stream &stream, uint32_t start, uint32_t end) const;
-
- const char *
- FindHistoryString (const char *input_str) const;
-
size_t
FindLongestCommandWord (CommandObject::CommandMap &dict);
@@ -407,30 +399,42 @@ public:
SetBatchCommandMode (bool value) { m_batch_command_mode = value; }
void
- ChildrenTruncated()
+ ChildrenTruncated ()
{
if (m_truncation_warning == eNoTruncation)
m_truncation_warning = eUnwarnedTruncation;
}
bool
- TruncationWarningNecessary()
+ TruncationWarningNecessary ()
{
return (m_truncation_warning == eUnwarnedTruncation);
}
void
- TruncationWarningGiven()
+ TruncationWarningGiven ()
{
m_truncation_warning = eWarnedTruncation;
}
const char *
- TruncationWarningText()
+ TruncationWarningText ()
{
return "*** Some of your variables have more members than the debugger will show by default. To show all of them, you can either use the --show-all-children option to %s or raise the limit by changing the target.max-children-count setting.\n";
}
+ const CommandHistory&
+ GetCommandHistory () const
+ {
+ return m_command_history;
+ }
+
+ CommandHistory&
+ GetCommandHistory ()
+ {
+ return m_command_history;
+ }
+
//------------------------------------------------------------------
// Properties
//------------------------------------------------------------------
@@ -440,6 +444,9 @@ public:
bool
GetPromptOnQuit () const;
+ bool
+ GetStopCmdSourceOnError () const;
+
protected:
friend class Debugger;
@@ -463,11 +470,10 @@ private:
CommandObject::CommandMap m_alias_dict; // Stores user aliases/abbreviations for commands
CommandObject::CommandMap m_user_dict; // Stores user-defined commands
OptionArgMap m_alias_options; // Stores any options (with or without arguments) that go with any alias.
- std::vector<std::string> m_command_history;
+ 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;
char m_comment_char;
- char m_repeat_char;
bool m_batch_command_mode;
ChildrenTruncatedWarningStatus m_truncation_warning; // Whether we truncated children and whether the user has been told
uint32_t m_command_source_depth;
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObject.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObject.h Tue Jul 2 16:55:02 2013
@@ -108,9 +108,6 @@ public:
GetSyntax ();
const char *
- Translate ();
-
- const char *
GetCommandName ();
void
@@ -129,7 +126,7 @@ public:
// the Command object from the Command dictionary (aliases have their own
// deletion scheme, so they do not need to care about this)
virtual bool
- IsRemovable() const { return false; }
+ IsRemovable () const { return false; }
bool
IsAlias () { return m_is_alias; }
@@ -160,10 +157,11 @@ public:
{
}
+ void
+ GenerateHelpText (CommandReturnObject &result);
+
virtual void
- GenerateHelpText (CommandReturnObject &result)
- {
- }
+ GenerateHelpText (Stream &result);
// this is needed in order to allow the SBCommand class to
// transparently try and load subcommands - it will fail on
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObjectMultiword.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandObjectMultiword.h Tue Jul 2 16:55:02 2013
@@ -47,7 +47,7 @@ public:
const lldb::CommandObjectSP& command_obj);
virtual void
- GenerateHelpText (CommandReturnObject &result);
+ GenerateHelpText (Stream &output_stream);
virtual lldb::CommandObjectSP
GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/CommandReturnObject.h Tue Jul 2 16:55:02 2013
@@ -143,8 +143,11 @@ public:
void
SetError (const Error &error,
- const char *fallback_error_cstr);
+ const char *fallback_error_cstr = NULL);
+ void
+ SetError (const char *error_cstr);
+
lldb::ReturnStatus
GetStatus();
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreter.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreter.h Tue Jul 2 16:55:02 2013
@@ -121,12 +121,32 @@ public:
const char *session_dictionary_name,
lldb::DebuggerSP& debugger,
const char* args,
- std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj);
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 enum
{
@@ -397,6 +417,46 @@ public:
return false;
}
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Process* process,
+ std::string& output,
+ Error& error)
+ {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Thread* thread,
+ std::string& output,
+ Error& error)
+ {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Target* target,
+ std::string& output,
+ Error& error)
+ {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ StackFrame* frame,
+ std::string& output,
+ Error& error)
+ {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
virtual bool
GetDocumentationForItem (const char* item, std::string& dest)
{
Modified: lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Interpreter/ScriptInterpreterPython.h Tue Jul 2 16:55:02 2013
@@ -173,6 +173,30 @@ public:
}
virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Process* process,
+ std::string& output,
+ Error& error);
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Thread* thread,
+ std::string& output,
+ Error& error);
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ Target* target,
+ std::string& output,
+ Error& error);
+
+ virtual bool
+ RunScriptFormatKeyword (const char* impl_function,
+ StackFrame* frame,
+ std::string& output,
+ Error& error);
+
+ virtual bool
LoadScriptingModule (const char* filename,
bool can_reload,
bool init_session,
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h Tue Jul 2 16:55:02 2013
@@ -1003,7 +1003,16 @@ public:
const char *s,
uint8_t *dst,
size_t dst_size);
-
+
+ lldb::clang_type_t
+ GetFloatTypeFromBitSize (size_t bit_size)
+ {
+ return GetFloatTypeFromBitSize (getASTContext(), bit_size);
+ }
+
+ static lldb::clang_type_t
+ GetFloatTypeFromBitSize (clang::ASTContext *ast,
+ size_t bit_size);
//------------------------------------------------------------------
// Qualifiers
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTType.h Tue Jul 2 16:55:02 2013
@@ -151,7 +151,22 @@ public:
{
return GetTypeClass (GetASTContext(), GetOpaqueQualType());
}
-
+
+ bool
+ IsPolymorphicClass ()
+ {
+ return IsPolymorphicClass(GetASTContext(), GetOpaqueQualType());
+ }
+
+ static bool
+ IsPolymorphicClass (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+
+ ClangASTType
+ GetFullyUnqualifiedType ();
+
+ static ClangASTType
+ GetFullyUnqualifiedType (clang::ASTContext *ast_context, lldb::clang_type_t clang_type);
+
void
DumpValue (ExecutionContext *exe_ctx,
Stream *s,
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ObjectFile.h Tue Jul 2 16:55:02 2013
@@ -13,6 +13,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Host/FileSpec.h"
+#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Host/Endian.h"
@@ -78,7 +79,12 @@ public:
eStrataKernel,
eStrataRawImage
} Strata;
-
+
+ typedef enum
+ {
+ eSymtabFromUnifiedSectionList = 0x0001 /// Return symbol table from unified module section list
+ } SymtabFlags;
+
//------------------------------------------------------------------
/// Construct with a parent module, offset, and header data.
///
@@ -356,22 +362,30 @@ public:
/// Symbol table parsing can be deferred by ObjectFile instances
/// until this accessor is called the first time.
///
+ /// @param[in] flags
+ /// eSymtabFromUnifiedSectionList: Whether to get symbol table
+ /// for unified module section list, or object file.
+ ///
/// @return
/// The symbol table for this object file.
//------------------------------------------------------------------
virtual Symtab *
- GetSymtab () = 0;
+ GetSymtab (uint32_t flags = 0) = 0;
//------------------------------------------------------------------
/// Frees the symbol table.
///
/// This function should only be used when an object file is
///
+ /// @param[in] flags
+ /// eSymtabFromUnifiedSectionList: Whether to clear symbol table
+ /// for unified module section list, or object file.
+ ///
/// @return
/// The symbol table for this object file.
//------------------------------------------------------------------
virtual void
- ClearSymtab ();
+ ClearSymtab (uint32_t flags = 0);
//------------------------------------------------------------------
/// Gets the UUID for this object file.
@@ -389,6 +403,21 @@ public:
GetUUID (lldb_private::UUID* uuid) = 0;
//------------------------------------------------------------------
+ /// Gets the symbol file spec list for this object file.
+ ///
+ /// If the object file format contains a debug symbol file link,
+ /// the values will be return in the FileSpecList.
+ ///
+ /// @return
+ /// Returns filespeclist.
+ //------------------------------------------------------------------
+ virtual lldb_private::FileSpecList
+ GetDebugSymbolFilePaths()
+ {
+ return FileSpecList();
+ }
+
+ //------------------------------------------------------------------
/// Gets whether endian swapping should occur when extracting data
/// from this object file.
///
@@ -485,6 +514,7 @@ public:
{
return lldb::RegisterContextSP();
}
+
//------------------------------------------------------------------
/// The object file should be able to calculate its type by looking
/// at its file header and possibly the sections or other data in
@@ -501,6 +531,17 @@ public:
CalculateType() = 0;
//------------------------------------------------------------------
+ /// In cases where the type can't be calculated (elf files), this
+ /// routine allows someone to explicitly set it. As an example,
+ /// SymbolVendorELF uses this routine to set eTypeDebugInfo when
+ /// loading debug link files.
+ virtual void
+ SetType (Type type)
+ {
+ m_type = type;
+ }
+
+ //------------------------------------------------------------------
/// The object file should be able to calculate the strata of the
/// object file.
///
@@ -635,6 +676,8 @@ protected:
const lldb::addr_t m_memory_addr;
std::unique_ptr<lldb_private::SectionList> m_sections_ap;
std::unique_ptr<lldb_private::Symtab> m_symtab_ap;
+ std::unique_ptr<lldb_private::Symtab> m_symtab_unified_ap; ///< Unified section list symbol table.
+ uint32_t m_symtab_unified_revisionid; ///< Unified section list symbol table revision id for when m_symtab_unified_ap was last modified.
//------------------------------------------------------------------
/// Sets the architecture for a module. At present the architecture
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Symbol.h Tue Jul 2 16:55:02 2013
@@ -291,7 +291,6 @@ public:
protected:
uint32_t m_uid; // User ID (usually the original symbol table index)
- Mangled m_mangled; // uniqued symbol name/mangled name pair
uint16_t m_type_data; // data specific to m_type
uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated
m_is_synthetic:1, // non-zero if this symbol is not actually in the symbol table, but synthesized from other info in the object file.
@@ -302,8 +301,9 @@ protected:
m_calculated_size:1,
m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
m_type:8;
- uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
+ Mangled m_mangled; // uniqued symbol name/mangled name pair
AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
+ uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
};
} // namespace lldb_private
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolContext.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolContext.h Tue Jul 2 16:55:02 2013
@@ -442,6 +442,11 @@ public:
AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
+ bool
+ MergeSymbolContextIntoFunctionContext (const SymbolContext& symbol_sc,
+ uint32_t start_idx = 0,
+ uint32_t stop_idx = UINT32_MAX);
+
uint32_t
AppendIfUnique (const SymbolContextList& sc_list,
bool merge_symbol_into_function);
@@ -486,6 +491,30 @@ public:
GetContextAtIndex(size_t idx, SymbolContext& sc) const;
//------------------------------------------------------------------
+ /// Direct reference accessor for a symbol context at index \a idx.
+ ///
+ /// The index \a idx must be a valid index, no error checking will
+ /// be done to ensure that it is valid.
+ ///
+ /// @param[in] idx
+ /// The zero based index into the symbol context list.
+ ///
+ /// @return
+ /// A const reference to the symbol context to fill in.
+ //------------------------------------------------------------------
+ SymbolContext&
+ operator [] (size_t idx)
+ {
+ return m_symbol_contexts[idx];
+ }
+
+ const SymbolContext&
+ operator [] (size_t idx) const
+ {
+ return m_symbol_contexts[idx];
+ }
+
+ //------------------------------------------------------------------
/// Get accessor for the last symbol context in the list.
///
/// @param[out] sc
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolFile.h Tue Jul 2 16:55:02 2013
@@ -140,6 +140,9 @@ public:
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 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
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/SymbolVendor.h Tue Jul 2 16:55:02 2013
@@ -153,12 +153,25 @@ public:
return m_type_list;
}
+ virtual size_t
+ GetTypes (lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list);
+
SymbolFile *
GetSymbolFile()
{
return m_sym_file_ap.get();
}
+ // Get module unified section list symbol table.
+ virtual Symtab *
+ GetSymtab ();
+
+ // Clear module unified section list symbol table.
+ virtual void
+ ClearSymtab ();
+
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
@@ -179,7 +192,7 @@ protected:
TypeList m_type_list; // Uniqued types for all parsers owned by this module
CompileUnits m_compile_units; // The current compile units
lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in case it isn't the same as the module object file (debug symbols in a separate file)
- std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Suclasses can add more of these if needed.
+ std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Subclasses can add more of these if needed.
private:
//------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/Type.h Tue Jul 2 16:55:02 2013
@@ -444,6 +444,9 @@ public:
{
return m_type_sp;
}
+
+ ConstString
+ GetName ();
bool
GetDescription (lldb_private::Stream &strm,
@@ -471,6 +474,27 @@ public:
m_content.push_back(type);
}
+ class AppendVisitor
+ {
+ public:
+ AppendVisitor(TypeListImpl &type_list) :
+ m_type_list(type_list)
+ {
+ }
+
+ void
+ operator() (const lldb::TypeImplSP& type)
+ {
+ m_type_list.Append(type);
+ }
+
+ private:
+ TypeListImpl &m_type_list;
+ };
+
+ void
+ Append (const lldb_private::TypeList &type_list);
+
lldb::TypeImplSP
GetTypeAtIndex(size_t idx)
{
@@ -524,6 +548,8 @@ public:
m_bitfield_bit_size (0),
m_is_bitfield (false)
{
+ if (m_type_impl_sp)
+ m_name = m_type_impl_sp->GetName();
}
const lldb::TypeImplSP &
Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeList.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/TypeList.h Tue Jul 2 16:55:02 2013
@@ -51,6 +51,12 @@ public:
lldb::TypeSP
GetTypeAtIndex(uint32_t idx);
+ 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
RemoveTypeWithUID (lldb::user_id_t uid);
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h Tue Jul 2 16:55:02 2013
@@ -38,7 +38,6 @@ public:
PathMappingList (const PathMappingList &rhs);
- virtual
~PathMappingList ();
const PathMappingList &
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Process.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Process.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Process.h Tue Jul 2 16:55:02 2013
@@ -3294,10 +3294,6 @@ public:
return m_thread_list;
}
- // This is obsoleted and will be removed very soon.
- uint32_t
- GetNextThreadIndexID ();
-
uint32_t
GetNextThreadIndexID (uint64_t thread_id);
@@ -3530,81 +3526,12 @@ public:
ReadWriteLock &
GetRunLock ()
{
- // The "m_private_run_lock" causes problems for other platforms
- // right now, so we are leaving this in for Apple builds only
- // until we can get the kinks worked out.
if (Host::GetCurrentThread() == m_private_state_thread)
return m_private_run_lock;
else
return m_public_run_lock;
}
- //------------------------------------------------------------------
- // This is a cache of reserved and available memory address ranges
- // for a single modification ID (see m_mod_id). It's meant for use
- // by IRMemoryMap, but to stick with the process. These memory
- // ranges happen to be unallocated in the underlying process, but we
- // make no guarantee that at a future modification ID they won't be
- // gone. This is only useful if the underlying process can't
- // allocate memory.
- //
- // When a memory space is determined to be available it is
- // registered as reserved at the current modification. If it is
- // freed later, it is added to the free list if the modification ID
- // hasn't changed. Then clients can simply query the free list for
- // the size they want.
- //------------------------------------------------------------------
- class ReservationCache
- {
- public:
- ReservationCache (Process &process);
-
- //------------------------------------------------------------------
- // Mark that a particular range of addresses is in use. Adds it
- // to the reserved map, implicitly tying it to the current
- // modification ID.
- //------------------------------------------------------------------
- void
- Reserve (lldb::addr_t addr, size_t size);
-
- //------------------------------------------------------------------
- // Mark that a range is no longer in use. If it's found in the
- // reservation list, that means that the modification ID hasn't
- // changed since it was reserved, so it can be safely added to the
- // free list.
- //------------------------------------------------------------------
- void
- Unreserve (lldb::addr_t addr);
-
- //------------------------------------------------------------------
- // Try to find an unused range of the given size in the free list.
- //------------------------------------------------------------------
- lldb::addr_t
- Find (size_t size);
- private:
- //------------------------------------------------------------------
- // Clear all lists if the modification ID has changed.
- //------------------------------------------------------------------
- void CheckModID();
-
- typedef std::map <lldb::addr_t, size_t> ReservedMap;
- typedef std::vector <lldb::addr_t> FreeList;
- typedef std::map <size_t, FreeList> FreeMap;
-
- ReservedMap m_reserved_cache;
- FreeMap m_free_cache;
-
- Process &m_process;
- ProcessModID m_mod_id;
- };
-
- ReservationCache &
- GetReservationCache ()
- {
- return m_reservation_cache;
- }
-private:
- ReservationCache m_reservation_cache;
protected:
//------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
@@ -3827,7 +3754,7 @@ protected:
AppendSTDERR (const char *s, size_t len);
void
- BroadcastAsyncProfileData(const char *s, size_t len);
+ BroadcastAsyncProfileData(const std::string &one_profile_data);
static void
STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Target.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Target.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Target.h Tue Jul 2 16:55:02 2013
@@ -118,6 +118,9 @@ public:
FileSpecList &
GetExecutableSearchPaths ();
+
+ FileSpecList &
+ GetDebugFileSearchPaths ();
bool
GetEnableSyntheticValue () const;
@@ -378,6 +381,9 @@ public:
static FileSpecList
GetDefaultExecutableSearchPaths ();
+ static FileSpecList
+ GetDefaultDebugFileSearchPaths ();
+
static ArchSpec
GetDefaultArchitecture ();
Modified: lldb/branches/lldb-platform-work/include/lldb/lldb-defines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/lldb-defines.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/lldb-defines.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/lldb-defines.h Tue Jul 2 16:55:02 2013
@@ -49,6 +49,7 @@
#define LLDB_WATCH_ID_IS_VALID(uid) ((uid) != (LLDB_INVALID_WATCH_ID))
#define LLDB_WATCH_TYPE_READ (1u << 0)
#define LLDB_WATCH_TYPE_WRITE (1u << 1)
+#define LLDB_WATCH_TYPE_IS_VALID(type) ((type | LLDB_WATCH_TYPE_READ) || (type | LLDB_WATCH_TYPE_WRITE))
//----------------------------------------------------------------------
// Generic Register Numbers
Modified: lldb/branches/lldb-platform-work/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/lldb-enumerations.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/lldb-enumerations.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/lldb-enumerations.h Tue Jul 2 16:55:02 2013
@@ -518,6 +518,10 @@ namespace lldb {
eSectionTypeDWARFAppleTypes,
eSectionTypeDWARFAppleNamespaces,
eSectionTypeDWARFAppleObjC,
+ eSectionTypeELFSymbolTable, // Elf SHT_SYMTAB section
+ eSectionTypeELFDynamicSymbols, // Elf SHT_DYNSYM section
+ eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section
+ eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section
eSectionTypeEHFrame,
eSectionTypeOther
@@ -613,7 +617,7 @@ namespace lldb {
eTypeClassOther = (1u << 31),
// Define a mask that can be used for any type when finding types
eTypeClassAny = (0xffffffffu)
- }TypeClass;
+ } TypeClass;
typedef enum TemplateArgumentKind
{
Modified: lldb/branches/lldb-platform-work/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lib/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lib/Makefile (original)
+++ lldb/branches/lldb-platform-work/lib/Makefile Tue Jul 2 16:55:02 2013
@@ -40,6 +40,7 @@ USEDLIBS = lldbAPI.a \
lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \
lldbPluginObjectContainerBSDArchive.a \
lldbPluginObjectFileELF.a \
+ lldbPluginSymbolVendorELF.a \
lldbPluginObjectFilePECOFF.a \
lldbPluginOperatingSystemPython.a \
lldbPluginPlatformGDBServer.a \
@@ -80,7 +81,8 @@ endif
include $(LLDB_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
- instrumentation ipo irreader selectiondag jit mc mcjit linker
+ instrumentation ipo irreader selectiondag jit mc mcjit \
+ linker option
ifeq ($(HOST_OS),Darwin)
USEDLIBS += lldbHostMacOSX.a \
@@ -100,7 +102,7 @@ ifeq ($(HOST_OS),Linux)
lldbPluginDynamicLoaderMacOSX.a
endif
-ifeq ($(HOST_OS),FreeBSD)
+ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
USEDLIBS += lldbHostFreeBSD.a \
lldbPluginProcessPOSIX.a \
lldbPluginProcessFreeBSD.a
@@ -133,7 +135,7 @@ ifeq ($(HOST_OS),Darwin)
endif
endif
-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU))
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive
Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Tue Jul 2 16:55:02 2013
@@ -89,6 +89,7 @@
262D24E613FB8710002D1960 /* RegisterContextMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 262D24E413FB8710002D1960 /* RegisterContextMemory.cpp */; };
262ED0051631FA2800879631 /* OptionGroupString.h in Headers */ = {isa = PBXBuildFile; fileRef = 262ED0041631FA2800879631 /* OptionGroupString.h */; };
262ED0081631FA3A00879631 /* OptionGroupString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 262ED0071631FA3A00879631 /* OptionGroupString.cpp */; };
+ 2635879417822FC2004C30BA /* SymbolVendorELF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2635879017822E56004C30BA /* SymbolVendorELF.cpp */; };
26368A3C126B697600E8659F /* darwin-debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26368A3B126B697600E8659F /* darwin-debug.cpp */; };
26368AF7126B960500E8659F /* darwin-debug in Resources */ = {isa = PBXBuildFile; fileRef = 26579F68126A25920007C5CB /* darwin-debug */; };
263E949F13661AEA00E7D1CE /* UnwindAssembly-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263E949D13661AE400E7D1CE /* UnwindAssembly-x86.cpp */; };
@@ -549,6 +550,8 @@
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; };
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };
94E829CA152D33C1006F96A3 /* lldb-platform in Resources */ = {isa = PBXBuildFile; fileRef = 26DC6A101337FE6900FF7998 /* lldb-platform */; };
+ 94BA8B6D176F8C9B005A91B5 /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94BA8B6C176F8C9B005A91B5 /* Range.cpp */; };
+ 94BA8B70176F97CE005A91B5 /* CommandHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94BA8B6F176F97CE005A91B5 /* CommandHistory.cpp */; };
94CB255B16B069770059775D /* CXXFormatterFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255716B069770059775D /* CXXFormatterFunctions.cpp */; };
94CB255C16B069770059775D /* DataVisualization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255816B069770059775D /* DataVisualization.cpp */; };
94CB255D16B069770059775D /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255916B069770059775D /* FormatClasses.cpp */; };
@@ -927,6 +930,8 @@
262D24E513FB8710002D1960 /* RegisterContextMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextMemory.h; path = Utility/RegisterContextMemory.h; sourceTree = "<group>"; };
262ED0041631FA2800879631 /* OptionGroupString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionGroupString.h; path = include/lldb/Interpreter/OptionGroupString.h; sourceTree = "<group>"; };
262ED0071631FA3A00879631 /* OptionGroupString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupString.cpp; path = source/Interpreter/OptionGroupString.cpp; sourceTree = "<group>"; };
+ 2635879017822E56004C30BA /* SymbolVendorELF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolVendorELF.cpp; sourceTree = "<group>"; };
+ 2635879117822E56004C30BA /* SymbolVendorELF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolVendorELF.h; sourceTree = "<group>"; };
263664921140A4930075843B /* Debugger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = Debugger.cpp; path = source/Core/Debugger.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
263664941140A4C10075843B /* Debugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Debugger.h; path = include/lldb/Core/Debugger.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
26368A3B126B697600E8659F /* darwin-debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "darwin-debug.cpp"; path = "tools/darwin-debug/darwin-debug.cpp"; sourceTree = "<group>"; };
@@ -1552,26 +1557,13 @@
69A01E1E1236C5D400C660B5 /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mutex.cpp; sourceTree = "<group>"; };
69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbols.cpp; sourceTree = "<group>"; };
69A01E201236C5D400C660B5 /* TimeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeValue.cpp; sourceTree = "<group>"; };
- 94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-wrapper.swig"; sourceTree = "<group>"; };
+ 94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-wrapper.swig"; sourceTree = "<group>"; };
94005E0513F45A1B001EF42D /* embedded_interpreter.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = embedded_interpreter.py; path = source/Interpreter/embedded_interpreter.py; sourceTree = "<group>"; };
94031A9B13CF484600DCFF3C /* InputReaderEZ.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InputReaderEZ.h; path = include/lldb/Core/InputReaderEZ.h; sourceTree = "<group>"; };
94031A9D13CF486600DCFF3C /* InputReaderEZ.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InputReaderEZ.cpp; path = source/Core/InputReaderEZ.cpp; sourceTree = "<group>"; };
94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PriorityPointerPair.h; path = include/lldb/Utility/PriorityPointerPair.h; sourceTree = "<group>"; };
94094C68163B6CCC0083A547 /* ValueObjectCast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectCast.h; path = include/lldb/Core/ValueObjectCast.h; sourceTree = "<group>"; };
94094C69163B6CD90083A547 /* ValueObjectCast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectCast.cpp; path = source/Core/ValueObjectCast.cpp; sourceTree = "<group>"; };
- 940DB8CA16EA66FB00D3C2F1 /* Gauge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gauge.h; sourceTree = "<group>"; };
- 940DB8CE16EA670C00D3C2F1 /* Measurement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Measurement.h; sourceTree = "<group>"; };
- 940DB8D116EA671800D3C2F1 /* MemoryGauge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryGauge.cpp; sourceTree = "<group>"; };
- 940DB8D216EA671800D3C2F1 /* MemoryGauge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryGauge.h; sourceTree = "<group>"; };
- 940DB8D516EA672200D3C2F1 /* Metric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Metric.cpp; sourceTree = "<group>"; };
- 940DB8D616EA672200D3C2F1 /* Metric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Metric.h; sourceTree = "<group>"; };
- 940DB8D916EA672D00D3C2F1 /* TestCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCase.cpp; sourceTree = "<group>"; };
- 940DB8DA16EA672D00D3C2F1 /* TestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestCase.h; sourceTree = "<group>"; };
- 940DB8DD16EA673800D3C2F1 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = "<group>"; };
- 940DB8DE16EA673800D3C2F1 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
- 940DB8E116EA674000D3C2F1 /* Xcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Xcode.cpp; sourceTree = "<group>"; };
- 940DB8E216EA674000D3C2F1 /* Xcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xcode.h; sourceTree = "<group>"; };
- 940DB8E616EA709400D3C2F1 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
94145430175D7FDE00284436 /* lldb-versioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "lldb-versioning.h"; path = "include/lldb/lldb-versioning.h"; sourceTree = "<group>"; };
944372DA171F6B4300E57C32 /* RegisterContextDummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextDummy.cpp; path = Utility/RegisterContextDummy.cpp; sourceTree = "<group>"; };
944372DB171F6B4300E57C32 /* RegisterContextDummy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDummy.h; path = Utility/RegisterContextDummy.h; sourceTree = "<group>"; };
@@ -1581,6 +1573,7 @@
945759661534941F005A9070 /* PlatformPOSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformPOSIX.h; path = POSIX/PlatformPOSIX.h; sourceTree = "<group>"; };
945E8D7D152F6AA80019BCCD /* StreamGDBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamGDBRemote.h; path = include/lldb/Core/StreamGDBRemote.h; sourceTree = "<group>"; };
945E8D7F152F6AB40019BCCD /* StreamGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamGDBRemote.cpp; path = source/Core/StreamGDBRemote.cpp; sourceTree = "<group>"; };
+ 944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };
9452573616262CD000325455 /* SBDeclaration.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBDeclaration.i; sourceTree = "<group>"; };
9452573816262CEF00325455 /* SBDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBDeclaration.h; path = include/lldb/API/SBDeclaration.h; sourceTree = "<group>"; };
9452573916262D0200325455 /* SBDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBDeclaration.cpp; path = source/API/SBDeclaration.cpp; sourceTree = "<group>"; };
@@ -1616,6 +1609,10 @@
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = source/Core/ValueObjectConstResultImpl.cpp; sourceTree = "<group>"; };
94B6E76013D8833C005F417F /* ValueObjectSyntheticFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectSyntheticFilter.h; path = include/lldb/Core/ValueObjectSyntheticFilter.h; sourceTree = "<group>"; };
94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectSyntheticFilter.cpp; path = source/Core/ValueObjectSyntheticFilter.cpp; sourceTree = "<group>"; };
+ 94BA8B6C176F8C9B005A91B5 /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Range.cpp; path = source/Utility/Range.cpp; sourceTree = "<group>"; };
+ 94BA8B6E176F8CA0005A91B5 /* Range.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Range.h; path = include/lldb/Utility/Range.h; sourceTree = "<group>"; };
+ 94BA8B6F176F97CE005A91B5 /* CommandHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandHistory.cpp; path = source/Interpreter/CommandHistory.cpp; sourceTree = "<group>"; };
+ 94BA8B71176F97D4005A91B5 /* CommandHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandHistory.h; path = include/lldb/Interpreter/CommandHistory.h; sourceTree = "<group>"; };
94CB255716B069770059775D /* CXXFormatterFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CXXFormatterFunctions.cpp; path = source/DataFormatters/CXXFormatterFunctions.cpp; sourceTree = "<group>"; };
94CB255816B069770059775D /* DataVisualization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataVisualization.cpp; path = source/DataFormatters/DataVisualization.cpp; sourceTree = "<group>"; };
94CB255916B069770059775D /* FormatClasses.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatClasses.cpp; path = source/DataFormatters/FormatClasses.cpp; sourceTree = "<group>"; };
@@ -1646,9 +1643,8 @@
94D6A0A716CEB55F00833B6E /* NSArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSArray.cpp; path = source/DataFormatters/NSArray.cpp; sourceTree = "<group>"; };
94D6A0A816CEB55F00833B6E /* NSDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSDictionary.cpp; path = source/DataFormatters/NSDictionary.cpp; sourceTree = "<group>"; };
94D6A0A916CEB55F00833B6E /* NSSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSSet.cpp; path = source/DataFormatters/NSSet.cpp; sourceTree = "<group>"; };
- 94DB60F016EA888A00459D9E /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "modify-python-lldb.py"; sourceTree = "<group>"; };
- 94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-typemaps.swig"; sourceTree = "<group>"; };
+ 94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-typemaps.swig"; sourceTree = "<group>"; };
94EA1D5A15E6C99B00D4171A /* PythonDataObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonDataObjects.h; path = include/lldb/Interpreter/PythonDataObjects.h; sourceTree = "<group>"; };
94EA1D5B15E6C9B400D4171A /* PythonDataObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonDataObjects.cpp; path = source/Interpreter/PythonDataObjects.cpp; sourceTree = "<group>"; };
94EBAC8313D9EE26009BA64E /* PythonPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonPointer.h; path = include/lldb/Utility/PythonPointer.h; sourceTree = "<group>"; };
@@ -1678,7 +1674,7 @@
9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpointCommand.cpp; path = source/Commands/CommandObjectBreakpointCommand.cpp; sourceTree = "<group>"; };
9A4633DA11F65D8600955CE1 /* UserSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserSettingsController.h; path = include/lldb/Core/UserSettingsController.h; sourceTree = "<group>"; };
9A4633DC11F65D9A00955CE1 /* UserSettingsController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserSettingsController.cpp; path = source/Core/UserSettingsController.cpp; sourceTree = "<group>"; };
- 9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "python-extensions.swig"; sourceTree = "<group>"; };
+ 9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = "python-extensions.swig"; sourceTree = "<group>"; };
9A4F350F1368A51A00823F52 /* StreamAsynchronousIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamAsynchronousIO.cpp; path = source/Core/StreamAsynchronousIO.cpp; sourceTree = "<group>"; };
9A4F35111368A54100823F52 /* StreamAsynchronousIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamAsynchronousIO.h; path = include/lldb/Core/StreamAsynchronousIO.h; sourceTree = "<group>"; };
9A633FE7112DCE3C001A7E43 /* SBFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFrame.cpp; path = source/API/SBFrame.cpp; sourceTree = "<group>"; };
@@ -2091,6 +2087,7 @@
260C89E010F57C5600BB2B04 /* SymbolVendor */ = {
isa = PBXGroup;
children = (
+ 2635878D17822E56004C30BA /* ELF */,
260C89E110F57C5600BB2B04 /* MacOSX */,
);
path = SymbolVendor;
@@ -2276,6 +2273,15 @@
name = API;
sourceTree = "<group>";
};
+ 2635878D17822E56004C30BA /* ELF */ = {
+ isa = PBXGroup;
+ children = (
+ 2635879017822E56004C30BA /* SymbolVendorELF.cpp */,
+ 2635879117822E56004C30BA /* SymbolVendorELF.h */,
+ );
+ path = ELF;
+ sourceTree = "<group>";
+ };
2642FBA713D003B400ED6808 /* MacOSX-Kernel */ = {
isa = PBXGroup;
children = (
@@ -2379,6 +2385,7 @@
94FE476613FC1DA8001F8475 /* finish-swig-Python-LLDB.sh */,
94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */,
9A48A3A7124AAA5A00922451 /* python-extensions.swig */,
+ 944DC3481774C99000D7D884 /* python-swigsafecast.swig */,
94E367CE140C4EEA001C7A5A /* python-typemaps.swig */,
94005E0313F438DF001EF42D /* python-wrapper.swig */,
);
@@ -2418,6 +2425,8 @@
26D1804616CEE12C00EDFB5B /* TimeSpecTimeout.h */,
26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp */,
94EBAC8313D9EE26009BA64E /* PythonPointer.h */,
+ 94BA8B6E176F8CA0005A91B5 /* Range.h */,
+ 94BA8B6C176F8C9B005A91B5 /* Range.cpp */,
B2462249141AE62200F3D409 /* Utils.h */,
);
name = Utility;
@@ -2963,6 +2972,8 @@
26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp */,
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */,
4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */,
+ 94BA8B71176F97D4005A91B5 /* CommandHistory.h */,
+ 94BA8B6F176F97CE005A91B5 /* CommandHistory.cpp */,
26BC7DE210F1B7F900F91463 /* CommandInterpreter.h */,
26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */,
26BC7DE310F1B7F900F91463 /* CommandObject.h */,
@@ -3266,7 +3277,6 @@
265E9BE0115C2B8500D0DCCB /* debugserver */,
26F5C22510F3D956009D5894 /* Driver */,
2665CD0915080846002C8FAE /* install-headers */,
- 940DB8C416EA64D400D3C2F1 /* lldb-perf */,
26DC6A1B1337FEA400FF7998 /* lldb-platform */,
);
name = Tools;
@@ -4116,11 +4126,13 @@
2689006F13353E1A00698AC0 /* FileSpec.cpp in Sources */,
2689007013353E1A00698AC0 /* Condition.cpp in Sources */,
2689007113353E1A00698AC0 /* Host.cpp in Sources */,
+ 2635879417822FC2004C30BA /* SymbolVendorELF.cpp in Sources */,
2689007213353E1A00698AC0 /* Mutex.cpp in Sources */,
2689007313353E1A00698AC0 /* Symbols.cpp in Sources */,
2689007413353E1A00698AC0 /* Terminal.cpp in Sources */,
2689007513353E1A00698AC0 /* TimeValue.cpp in Sources */,
2689007613353E1A00698AC0 /* CFCBundle.cpp in Sources */,
+ 94BA8B70176F97CE005A91B5 /* CommandHistory.cpp in Sources */,
2689007713353E1A00698AC0 /* CFCData.cpp in Sources */,
2689007813353E1A00698AC0 /* CFCMutableArray.cpp in Sources */,
2689007913353E1A00698AC0 /* CFCMutableDictionary.cpp in Sources */,
@@ -4356,6 +4368,7 @@
260CC65215D0440D002BF2E0 /* OptionValueString.cpp in Sources */,
260CC65315D0440D002BF2E0 /* OptionValueUInt64.cpp in Sources */,
260CC65415D0440D002BF2E0 /* OptionValueUUID.cpp in Sources */,
+ 94BA8B6D176F8C9B005A91B5 /* Range.cpp in Sources */,
26DAED6315D327C200E15819 /* OptionValuePathMappings.cpp in Sources */,
B2B7CCEB15D1BD6700EEFB57 /* CommandObjectWatchpointCommand.cpp in Sources */,
B2B7CCF015D1C20F00EEFB57 /* WatchpointOptions.cpp in Sources */,
@@ -4609,7 +4622,7 @@
LLDB_TOOLS_INSTALL_DIR = /usr/bin;
LLVM_BUILD_DIR = "$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
- LLVM_CONFIGURATION = Release;
+ LLVM_CONFIGURATION = "Release+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
Modified: lldb/branches/lldb-platform-work/scripts/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/scripts/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -1,20 +1,20 @@
-set(LLVM_NO_RTTI 1)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
- DEPENDS ${LLDB_SOURCE_DIR}/scripts/lldb.swig
- # swig was directly invoked on Windows (where the Python API is not being generated) but on other platforms, we need to run the *swig-wrapper-classes.sh shell-scripts.
- #COMMAND swig -c++ -shadow -python -I${LLDB_SOURCE_DIR}/include -I./. -outdir ${LLDB_SOURCE_DIR}/scripts/Python -o ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp ${LLDB_SOURCE_DIR}/scripts/lldb.swig
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/finish-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
- COMMENT "Building lldb python wrapper")
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
-
-ADD_CUSTOM_TARGET(swig_wrapper ALL echo -n
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
- )
-
-# Install the LLDB python module on all operating systems (except Windows)
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
- install(SCRIPT lldb_python_module.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" -DCMAKE_BUILD_DIR=\"${CMAKE_BUILD_DIR}\")
-endif()
+set(LLVM_NO_RTTI 1)
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+ DEPENDS ${LLDB_SOURCE_DIR}/scripts/lldb.swig
+ # swig was directly invoked on Windows (where the Python API is not being generated) but on other platforms, we need to run the *swig-wrapper-classes.sh shell-scripts.
+ #COMMAND swig -c++ -shadow -python -I${LLDB_SOURCE_DIR}/include -I./. -outdir ${LLDB_SOURCE_DIR}/scripts/Python -o ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp ${LLDB_SOURCE_DIR}/scripts/lldb.swig
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/finish-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
+ COMMENT "Building lldb python wrapper")
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
+
+ADD_CUSTOM_TARGET(swig_wrapper ALL echo -n
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+ )
+
+# Install the LLDB python module on all operating systems (except Windows)
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+ install(SCRIPT lldb_python_module.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" -DCMAKE_BUILD_DIR=\"${CMAKE_BUILD_DIR}\")
+endif()
Modified: lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/build-swig-Python.sh Tue Jul 2 16:55:02 2013
@@ -46,6 +46,7 @@ swig_input_file=${SRC_ROOT}/scripts/lldb
swig_python_extensions=${SRC_ROOT}/scripts/Python/python-extensions.swig
swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig
swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig
+swig_python_swigsafecast=${SRC_ROOT}/scripts/Python/python-swigsafecast.swig
if [ "$LLDB_DISABLE_PYTHON" = "1" ] ; then
# We don't want Python for this build, but touch the output file so we don't have to
@@ -276,6 +277,19 @@ then
echo "swig file will need to be re-built."
fi
fi
+fi
+
+if [ $NeedToUpdate -eq 0 ]
+then
+ if [ ${swig_python_swigsafecast} -nt ${swig_output_file} ]
+ then
+ NeedToUpdate=1
+ if [ $Debug -eq 1 ]
+ then
+ echo "${swig_python_swigsafecast} is newer than ${swig_output_file}"
+ echo "swig file will need to be re-built."
+ fi
+ fi
fi
python_version=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBBreakpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBBreakpoint.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBBreakpoint.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBBreakpoint.i Tue Jul 2 16:55:02 2013
@@ -209,6 +209,26 @@ public:
static uint32_t
GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
+
+ %pythoncode %{
+
+ __swig_getmethods__["id"] = GetID
+ if _newclass: id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')
+
+ __swig_getmethods__["enabled"] = IsEnabled
+ __swig_setmethods__["enabled"] = SetEnabled
+ if _newclass: enabled = property(IsEnabled, SetEnabled, doc='''A read/write property that configures whether this breakpoint is enabled or not.''')
+
+ __swig_getmethods__["one_shot"] = IsOneShot
+ __swig_setmethods__["one_shot"] = SetOneShot
+ if _newclass: one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')
+
+ __swig_getmethods__["num_locations"] = GetNumLocations
+ if _newclass: num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')
+
+ %}
+
+
};
} // namespace lldb
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBCommandReturnObject.i Tue Jul 2 16:55:02 2013
@@ -58,7 +58,14 @@ public:
void
SetStatus (lldb::ReturnStatus status);
+
+ void
+ SetError (lldb::SBError &error,
+ const char *fallback_error_cstr = NULL);
+ void
+ SetError (const char *error_cstr);
+
lldb::ReturnStatus
GetStatus();
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBCompileUnit.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBCompileUnit.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBCompileUnit.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBCompileUnit.i Tue Jul 2 16:55:02 2013
@@ -86,6 +86,26 @@ public:
uint32_t
FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
+ %feature("docstring", "
+ //------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// compile unit.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this compile
+ /// unit.
+ ///
+ /// @return
+ /// A list of types in this compile unit that match \a type_mask
+ //------------------------------------------------------------------
+ ") GetTypes;
+ lldb::SBTypeList
+ GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
+
bool
GetDescription (lldb::SBStream &description);
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBData.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBData.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBData.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBData.i Tue Jul 2 16:55:02 2013
@@ -160,6 +160,46 @@ public:
def all(self):
return self[0:len(self)]
+ @classmethod
+ def CreateDataFromInt (cls, value, size = None, target = None, ptr_size = None, endian = None):
+ import sys
+ lldbmodule = sys.modules[cls.__module__]
+ lldbdict = lldbmodule.__dict__
+ if 'target' in lldbdict:
+ lldbtarget = lldbdict['target']
+ else:
+ lldbtarget = None
+ if target == None and lldbtarget != None and lldbtarget.IsValid():
+ target = lldbtarget
+ if ptr_size == None:
+ if target and target.IsValid():
+ ptr_size = target.addr_size
+ else:
+ ptr_size = 8
+ if endian == None:
+ if target and target.IsValid():
+ endian = target.byte_order
+ else:
+ endian = lldbdict['eByteOrderLittle']
+ if size == None:
+ if value > 2147483647:
+ size = 8
+ elif value < -2147483648:
+ size = 8
+ elif value > 4294967295:
+ size = 8
+ else:
+ size = 4
+ if size == 4:
+ if value < 0:
+ return SBData().CreateDataFromSInt32Array(endian, ptr_size, [value])
+ return SBData().CreateDataFromUInt32Array(endian, ptr_size, [value])
+ if size == 8:
+ if value < 0:
+ return SBData().CreateDataFromSInt64Array(endian, ptr_size, [value])
+ return SBData().CreateDataFromUInt64Array(endian, ptr_size, [value])
+ return None
+
def _make_helper(self, sbdata, getfunc, itemsize):
return self.read_data_helper(sbdata, getfunc, itemsize)
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBModule.i Tue Jul 2 16:55:02 2013
@@ -227,6 +227,25 @@ public:
%feature("docstring", "
//------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// module.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this module.
+ ///
+ /// @return
+ /// A list of types in this module that match \a type_mask
+ //------------------------------------------------------------------
+ ") GetTypes;
+ lldb::SBTypeList
+ GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
+
+ %feature("docstring", "
+ //------------------------------------------------------------------
/// Find global and static variables by name.
///
/// @param[in] target
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i Tue Jul 2 16:55:02 2013
@@ -54,6 +54,9 @@ public:
GetName ();
lldb::SBSection
+ GetParent();
+
+ lldb::SBSection
FindSubSection (const char *sect_name);
size_t
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBType.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBType.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBType.i Tue Jul 2 16:55:02 2013
@@ -165,6 +165,9 @@ public:
bool
IsFunctionType ();
+ bool
+ IsPolymorphicClass ();
+
lldb::SBType
GetPointerType();
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBTypeCategory.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBTypeCategory.i?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBTypeCategory.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBTypeCategory.i Tue Jul 2 16:55:02 2013
@@ -116,6 +116,103 @@ namespace lldb {
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
%pythoncode %{
+
+ class formatters_access_class(object):
+ '''A helper object that will lazily hand out formatters for a specific category.'''
+ def __init__(self, sbcategory, get_count_function, get_at_index_function, get_by_name_function):
+ self.sbcategory = sbcategory
+ self.get_count_function = get_count_function
+ self.get_at_index_function = get_at_index_function
+ self.get_by_name_function = get_by_name_function
+ self.regex_type = type(re.compile('.'))
+
+
+ def __len__(self):
+ if self.sbcategory and self.get_count_function:
+ return int(self.get_count_function(self.sbcategory))
+ return 0
+
+ def __getitem__(self, key):
+ num_items = len(self)
+ if type(key) is int:
+ if key < num_items:
+ return self.get_at_index_function(self.sbcategory,key)
+ elif type(key) is str:
+ return self.get_by_name_function(self.sbcategory,SBTypeNameSpecifier(key))
+ elif isinstance(key,self.regex_type):
+ return self.get_by_name_function(self.sbcategory,SBTypeNameSpecifier(key.pattern,True))
+ else:
+ print "error: unsupported item type: %s" % type(key)
+ return None
+
+ def get_formats_access_object(self):
+ '''An accessor function that returns an accessor object which allows lazy format access from a lldb.SBTypeCategory object.'''
+ return self.formatters_access_class (self,self.__class__.GetNumFormats,self.__class__.GetFormatAtIndex,self.__class__.GetFormatForType)
+
+ def get_formats_array(self):
+ '''An accessor function that returns a list() that contains all formats in a lldb.SBCategory object.'''
+ formats = []
+ for idx in range(self.GetNumFormats()):
+ formats.append(self.GetFormatAtIndex(idx))
+ return formats
+
+ def get_summaries_access_object(self):
+ '''An accessor function that returns an accessor object which allows lazy summary access from a lldb.SBTypeCategory object.'''
+ return self.formatters_access_class (self,self.__class__.GetNumSummaries,self.__class__.GetSummaryAtIndex,self.__class__.GetSummaryForType)
+
+ def get_summaries_array(self):
+ '''An accessor function that returns a list() that contains all summaries in a lldb.SBCategory object.'''
+ summaries = []
+ for idx in range(self.GetNumSummaries()):
+ summaries.append(self.GetSummaryAtIndex(idx))
+ return summaries
+
+ def get_synthetics_access_object(self):
+ '''An accessor function that returns an accessor object which allows lazy synthetic children provider access from a lldb.SBTypeCategory object.'''
+ return self.formatters_access_class (self,self.__class__.GetNumSynthetics,self.__class__.GetSyntheticAtIndex,self.__class__.GetSyntheticForType)
+
+ def get_synthetics_array(self):
+ '''An accessor function that returns a list() that contains all synthetic children providers in a lldb.SBCategory object.'''
+ synthetics = []
+ for idx in range(self.GetNumSynthetics()):
+ synthetics.append(self.GetSyntheticAtIndex(idx))
+ return synthetics
+
+ def get_filters_access_object(self):
+ '''An accessor function that returns an accessor object which allows lazy filter access from a lldb.SBTypeCategory object.'''
+ return self.formatters_access_class (self,self.__class__.GetNumFilters,self.__class__.GetFilterAtIndex,self.__class__.GetFilterForType)
+
+ def get_filters_array(self):
+ '''An accessor function that returns a list() that contains all filters in a lldb.SBCategory object.'''
+ filters = []
+ for idx in range(self.GetNumFilters()):
+ filters.append(self.GetFilterAtIndex(idx))
+ return filters
+
+ __swig_getmethods__["formats"] = get_formats_array
+ if _newclass: formats = property(get_formats_array, None, doc='''A read only property that returns a list() of lldb.SBTypeFormat objects contained in this category''')
+
+ __swig_getmethods__["format"] = get_formats_access_object
+ if _newclass: format = property(get_formats_access_object, None, doc=r'''A read only property that returns an object that you can use to look for formats by index or type name.''')
+
+ __swig_getmethods__["summaries"] = get_summaries_array
+ if _newclass: summaries = property(get_summaries_array, None, doc='''A read only property that returns a list() of lldb.SBTypeSummary objects contained in this category''')
+
+ __swig_getmethods__["summary"] = get_summaries_access_object
+ if _newclass: summary = property(get_summaries_access_object, None, doc=r'''A read only property that returns an object that you can use to look for summaries by index or type name or regular expression.''')
+
+ __swig_getmethods__["filters"] = get_filters_array
+ if _newclass: filters = property(get_filters_array, None, doc='''A read only property that returns a list() of lldb.SBTypeFilter objects contained in this category''')
+
+ __swig_getmethods__["filter"] = get_filters_access_object
+ if _newclass: filter = property(get_filters_access_object, None, doc=r'''A read only property that returns an object that you can use to look for filters by index or type name or regular expression.''')
+
+ __swig_getmethods__["synthetics"] = get_synthetics_array
+ if _newclass: synthetics = property(get_synthetics_array, None, doc='''A read only property that returns a list() of lldb.SBTypeSynthetic objects contained in this category''')
+
+ __swig_getmethods__["synthetic"] = get_synthetics_access_object
+ if _newclass: synthetic = property(get_synthetics_access_object, None, doc=r'''A read only property that returns an object that you can use to look for synthetic children provider by index or type name or regular expression.''')
+
__swig_getmethods__["num_formats"] = GetNumFormats
if _newclass: num_formats = property(GetNumFormats, None)
__swig_getmethods__["num_summaries"] = GetNumSummaries
Modified: lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/python-extensions.swig Tue Jul 2 16:55:02 2013
@@ -758,6 +758,26 @@
%pythoncode %{
+def command(*args, **kwargs):
+ import lldb
+ """A decorator function that registers an LLDB command line
+ command that is bound to the function it is attached to."""
+ class obj(object):
+ """The object that tracks adding the command to LLDB one time and handles
+ calling the function on subsequent calls."""
+ def __init__(self, function, command_name, doc = None):
+ if doc:
+ function.__doc__ = doc
+ command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name)
+ lldb.debugger.HandleCommand(command)
+ self.function = function
+ def __call__(self, *args, **kwargs):
+ self.function(*args, **kwargs)
+ def callable(function):
+ """Creates a callable object that gets used."""
+ return obj(function, *args, **kwargs)
+ return callable
+
class declaration(object):
'''A class that represents a source declaration location with file, line and column.'''
def __init__(self, file, line, col):
Modified: lldb/branches/lldb-platform-work/scripts/Python/python-typemaps.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/python-typemaps.swig?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/python-typemaps.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/python-typemaps.swig Tue Jul 2 16:55:02 2013
@@ -333,7 +333,7 @@
if (count >= $2)
count = $2;
PyObject* list = PyList_New(count);
- for (int j = 0; j < count; j++)
+ for (uint32_t j = 0; j < count; j++)
{
if ($1[j] < UINT32_MAX)
{
Modified: lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/python-wrapper.swig Tue Jul 2 16:55:02 2013
@@ -45,7 +45,13 @@ ResolvePythonName(const char* name,
return NULL;
}
- if (!PyDict_Check(pmodule))
+ if (PyType_Check(pmodule))
+ {
+ main_dict = ((PyTypeObject*)pmodule)->tp_dict;
+ if (!main_dict)
+ return NULL;
+ }
+ else if (!PyDict_Check(pmodule))
{
main_dict = PyModule_GetDict (pmodule);
if (!main_dict)
@@ -97,6 +103,97 @@ FindSessionDictionary(const char *sessio
return ResolvePythonName(session_dictionary_name, NULL);
}
+class PyCallable
+{
+public:
+
+ operator
+ bool ()
+ {
+ return m_callable != NULL;
+ }
+
+ template<typename ...Args>
+ PyObject*
+ operator () (Args... args)
+ {
+ return (*this)({SBTypeToSWIGWrapper(args)...});
+ }
+
+ PyObject*
+ operator () (std::initializer_list<PyObject*> args)
+ {
+ PyObject* retval = NULL;
+ PyObject* pargs = PyTuple_New (args.size());
+ if (pargs == NULL)
+ {
+ if (PyErr_Occurred())
+ PyErr_Clear();
+ return retval;
+ }
+ size_t idx = 0;
+ for (auto arg : args)
+ {
+ if (!arg)
+ return retval;
+ PyTuple_SetItem(pargs,idx,arg);
+ idx++;
+ }
+ retval = PyObject_CallObject (m_callable, pargs);
+ Py_XDECREF (pargs);
+ return retval;
+ }
+
+ static PyCallable
+ FindWithPythonObject (PyObject* pfunc)
+ {
+ return PyCallable(pfunc);
+ }
+
+ static PyCallable
+ FindWithFunctionName (const char *python_function_name,
+ const char *session_dictionary_name)
+ {
+ if (!python_function_name || !session_dictionary_name)
+ return PyCallable();
+ if ( (python_function_name[0] == 0) || (session_dictionary_name[0] == 0) )
+ return PyCallable();
+ return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name));
+ }
+
+ static PyCallable
+ FindWithFunctionName (const char *python_function_name,
+ PyObject *session_dict)
+ {
+ if (!python_function_name || !session_dict)
+ return PyCallable();
+ if ( (python_function_name[0] == 0))
+ return PyCallable();
+ return PyCallable(ResolvePythonName (python_function_name, session_dict));
+ }
+
+ static PyCallable
+ FindWithMemberFunction (PyObject *self,
+ const char *python_function_name)
+ {
+ if (self == NULL || self == Py_None)
+ return PyCallable();
+ if (!python_function_name || (python_function_name[0] == 0))
+ return PyCallable();
+ return PyCallable(PyObject_GetAttrString(self, python_function_name));
+ }
+
+private:
+ PyObject* m_callable;
+
+ PyCallable (PyObject *callable = NULL) :
+ m_callable(callable)
+ {
+ if (m_callable && PyCallable_Check(m_callable) == false)
+ m_callable = NULL;
+ }
+};
+
// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
// and is used when a script command is attached to a breakpoint for execution.
@@ -113,70 +210,27 @@ LLDBSwigPythonBreakpointCallbackFunction
lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
bool stop_at_breakpoint = true;
- PyObject *Frame_PyObj = SWIG_NewPointerObj((void *) &sb_frame, SWIGTYPE_p_lldb__SBFrame, 0);
- PyObject *Bp_Loc_PyObj = SWIG_NewPointerObj ((void *) &sb_bp_loc, SWIGTYPE_p_lldb__SBBreakpointLocation, 0);
-
- if (Frame_PyObj == NULL || Bp_Loc_PyObj == NULL)
- return stop_at_breakpoint;
-
- if (!python_function_name || !session_dictionary_name)
- return stop_at_breakpoint;
- PyObject *session_dict, *pfunc;
- PyObject *pargs, *pvalue;
-
- session_dict = FindSessionDictionary (session_dictionary_name);
- if (session_dict != NULL)
- {
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (pfunc != NULL)
- {
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- pargs = PyTuple_New (3);
- if (pargs == NULL)
- {
- if (PyErr_Occurred())
- PyErr_Clear();
- return stop_at_breakpoint;
- }
-
- PyTuple_SetItem (pargs, 0, Frame_PyObj); // This "steals" a reference to Frame_PyObj
- PyTuple_SetItem (pargs, 1, Bp_Loc_PyObj); // This "steals" a reference to Bp_Loc_PyObj
- PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict
- pvalue = PyObject_CallObject (pfunc, pargs);
- Py_DECREF (pargs);
-
- if (pvalue != NULL)
- {
- // be very conservative here and only refuse to stop if the user
- // actually returned False - anything else, just stop
- if (pvalue == Py_False)
- stop_at_breakpoint = false;
- Py_DECREF (pvalue);
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Clear();
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred ())
{
- PyErr_Clear ();
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return stop_at_breakpoint;
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (pvalue == Py_False)
+ stop_at_breakpoint = false;
+
+ Py_XDECREF (pvalue);
}
+
return stop_at_breakpoint;
}
@@ -196,67 +250,55 @@ LLDBSwigPythonWatchpointCallbackFunction
lldb::SBWatchpoint sb_wp(wp_sp);
bool stop_at_watchpoint = true;
- PyObject *Frame_PyObj = SWIG_NewPointerObj((void *) &sb_frame, SWIGTYPE_p_lldb__SBFrame, 0);
- PyObject *Wp_PyObj = SWIG_NewPointerObj ((void *) &sb_wp, SWIGTYPE_p_lldb__SBWatchpoint, 0);
- if (Frame_PyObj == NULL || Wp_PyObj == NULL)
- return stop_at_watchpoint;
+ {
+ PyErr_Cleaner py_err_cleaner(true);
- if (!python_function_name || !session_dictionary_name)
- return stop_at_watchpoint;
-
- PyObject *session_dict, *pfunc;
- PyObject *pargs, *pvalue;
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return stop_at_watchpoint;
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (pvalue == Py_False)
+ stop_at_watchpoint = false;
+
+ Py_XDECREF (pvalue);
+ }
- session_dict = FindSessionDictionary (session_dictionary_name);
- if (session_dict != NULL)
+ return stop_at_watchpoint;
+}
+
+bool
+PyObjectToString (PyObject* object,
+ std::string& retval)
+{
+ retval.clear();
+ bool was_ok = false;
+ if (object != NULL && object != Py_None)
{
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (pfunc != NULL)
+ if (PyString_Check(object))
{
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- pargs = PyTuple_New (3);
- if (pargs == NULL)
- {
- if (PyErr_Occurred())
- PyErr_Clear();
- return stop_at_watchpoint;
- }
-
- PyTuple_SetItem (pargs, 0, Frame_PyObj); // This "steals" a reference to Frame_PyObj
- PyTuple_SetItem (pargs, 1, Wp_PyObj); // This "steals" a reference to Wp_PyObj
- PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict
- pvalue = PyObject_CallObject (pfunc, pargs);
- Py_DECREF (pargs);
-
- if (pvalue != NULL)
- {
- Py_DECREF (pvalue);
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Clear();
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
+ retval.assign(PyString_AsString(object));
+ was_ok = true;
}
- else if (PyErr_Occurred())
+ else
{
- PyErr_Clear();
+ PyObject* value_as_string = PyObject_Str(object);
+ if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))
+ {
+ retval.assign(PyString_AsString(value_as_string));
+ was_ok = true;
+ }
+ Py_XDECREF(value_as_string);
}
}
- else if (PyErr_Occurred ())
- {
- PyErr_Clear ();
- }
- return stop_at_watchpoint;
+ return was_ok;
}
SWIGEXPORT bool
@@ -273,23 +315,18 @@ LLDBSwigPythonCallTypeScript
retval.clear();
- PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &sb_value, SWIGTYPE_p_lldb__SBValue, 0);
-
- if (ValObj_PyObj == NULL)
- return false;
-
if (!python_function_name || !session_dictionary)
return false;
- PyObject *session_dict = (PyObject*)session_dictionary, *pfunc = NULL, *pargs = NULL, *pvalue = NULL;
+ PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL;
if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper))
{
- pfunc = (PyObject*)(*pyfunct_wrapper);
- if (pfunc->ob_refcnt == 1)
+ pfunc_impl = (PyObject*)(*pyfunct_wrapper);
+ if (pfunc_impl->ob_refcnt == 1)
{
- Py_XDECREF(pfunc);
- pfunc = NULL;
+ Py_XDECREF(pfunc_impl);
+ pfunc_impl = NULL;
}
}
@@ -297,41 +334,32 @@ LLDBSwigPythonCallTypeScript
{
PyErr_Cleaner pyerr_cleanup(true); // show Python errors
- if (!pfunc)
+ if (!pfunc_impl)
{
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (!pfunc || !PyFunction_Check (pfunc))
+ pfunc_impl = ResolvePythonName (python_function_name, session_dict);
+ if (!pfunc_impl || !PyCallable_Check (pfunc_impl))
return false;
else
{
if (pyfunct_wrapper)
- *pyfunct_wrapper = pfunc;
+ *pyfunct_wrapper = pfunc_impl;
}
}
/*else
printf("caching works!!!!\n");*/
- pargs = PyTuple_Pack(2, ValObj_PyObj, session_dict);
- if (pargs == NULL)
+ PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl);
+
+ if (!pfunc)
return false;
- pvalue = PyObject_CallObject (pfunc, pargs);
- Py_DECREF (pargs);
+ pvalue = pfunc(sb_value,session_dict);
+
+ Py_INCREF (session_dict);
+
+ PyObjectToString(pvalue,retval);
- if (pvalue != NULL && pvalue != Py_None)
- {
- if (PyString_Check(pvalue))
- retval.assign(PyString_AsString(pvalue));
- else
- {
- PyObject* value_as_string = PyObject_Str(pvalue);
- if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))
- retval.assign(PyString_AsString(value_as_string));
- Py_XDECREF(value_as_string);
- }
- }
Py_XDECREF (pvalue);
- Py_INCREF (session_dict);
}
return true;
}
@@ -351,83 +379,31 @@ LLDBSwigPythonCreateSyntheticProvider
// I do not want the SBValue to be deallocated when going out of scope because python
// has ownership of it and will manage memory for this object by itself
- lldb::SBValue *valobj_sb = new lldb::SBValue(valobj_sp);
- valobj_sb->SetPreferSyntheticValue(false);
-
- PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *)valobj_sb, SWIGTYPE_p_lldb__SBValue, 0);
+ lldb::SBValue *sb_value = new lldb::SBValue(valobj_sp);
+ sb_value->SetPreferSyntheticValue(false);
+ PyObject *ValObj_PyObj = SBTypeToSWIGWrapper(sb_value);
if (ValObj_PyObj == NULL)
Py_RETURN_NONE;
-
- const char* python_function_name = python_class_name;
-
- PyObject *session_dict, *pfunc;
- PyObject *pvalue;
- session_dict = FindSessionDictionary (session_dictionary_name);
- if (session_dict != NULL)
- {
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (pfunc != NULL)
- {
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- PyObject *argList = Py_BuildValue("SS", ValObj_PyObj, session_dict);
-
- if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- return retval;
- }
-
- if (argList == NULL)
- {
- return retval;
- }
-
- Py_INCREF(ValObj_PyObj);
-
- pvalue = PyObject_CallObject(pfunc, argList);
-
- Py_DECREF(argList);
-
- if (pvalue != NULL)
- {
- if (pvalue != Py_None)
- retval = pvalue;
- else
- {
- retval = Py_None;
- Py_INCREF(retval);
- }
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred ())
{
- PyErr_Print();
- PyErr_Clear ();
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
+
+ Py_INCREF(ValObj_PyObj);
+
+ PyObject* session_dict = NULL;
+ retval = pfunc(ValObj_PyObj, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ Py_XINCREF(retval);
}
+
if (retval)
return retval;
else
@@ -444,64 +420,22 @@ LLDBSwigPython_CallOptionalMember
bool* was_found = NULL
)
{
- if (self == NULL || self == Py_None)
- {
- if (was_found)
- *was_found = false;
- Py_XINCREF(ret_if_not_found);
- return ret_if_not_found;
- }
-
- PyObject* pmeth = PyObject_GetAttrString(self, callee_name);
-
- if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
-
- if (pmeth == NULL || pmeth == Py_None)
- {
- if (was_found)
- *was_found = false;
- Py_XDECREF(pmeth);
- Py_XINCREF(ret_if_not_found);
- return ret_if_not_found;
- }
-
- if (PyCallable_Check(pmeth) == 0)
+ PyErr_Cleaner py_err_cleaner(false);
+
+ PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name);
+
+ if (!pfunc)
{
- if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
-
- Py_XDECREF(pmeth);
if (was_found)
*was_found = false;
Py_XINCREF(ret_if_not_found);
return ret_if_not_found;
}
-
+
if (was_found)
*was_found = true;
-
- if (PyErr_Occurred())
- {
- PyErr_Clear();
- }
-
- Py_XDECREF(pmeth);
-
- // right now we know this function exists and is callable..
- PyObject* py_return = PyObject_CallMethod(self, callee_name, NULL);
-
- // if it fails, print the error but otherwise go on
- if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
+ PyObject* py_return = pfunc();
return py_return;
}
@@ -541,18 +475,15 @@ LLDBSwigPython_GetChildAtIndex
uint32_t idx
)
{
-
- static char callee_name[] = "get_child_at_index";
- static char param_format[] = "i";
-
- if (implementor == NULL || implementor == Py_None)
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index");
+
+ if (!pfunc)
return NULL;
- PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, idx);
- if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
+
+ PyObject *py_return = NULL;
+ py_return = pfunc(idx);
if (py_return == NULL || py_return == Py_None)
{
@@ -561,17 +492,17 @@ LLDBSwigPython_GetChildAtIndex
}
lldb::SBValue* sbvalue_ptr = NULL;
-
+
if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
{
- Py_DECREF(py_return);
+ Py_XDECREF(py_return);
return NULL;
}
if (sbvalue_ptr == NULL)
return NULL;
-
- return py_return;
+
+ return py_return;
}
SWIGEXPORT int
@@ -581,33 +512,29 @@ LLDBSwigPython_GetIndexOfChildWithName
const char* child_name
)
{
- static char callee_name[] = "get_child_index";
- static char param_format[] = "s";
-
- if (implementor == NULL || implementor == Py_None)
- return 0;
- PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, child_name);
- if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index");
+
+ if (!pfunc)
+ return UINT32_MAX;
+
+ PyObject *py_return = NULL;
+ py_return = pfunc(child_name);
if (py_return == NULL || py_return == Py_None)
{
Py_XDECREF(py_return);
return UINT32_MAX;
}
+
long retval = PyInt_AsLong(py_return);
- Py_DECREF(py_return);
+ Py_XDECREF(py_return);
+
if (retval >= 0)
return (uint32_t)retval;
- if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- return 0;
+
+ return UINT32_MAX;
}
SWIGEXPORT bool
@@ -697,7 +624,6 @@ LLDBSwigPythonCallCommand
const char *session_dictionary_name,
lldb::DebuggerSP& debugger,
const char* args,
- std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj
)
{
@@ -708,86 +634,25 @@ LLDBSwigPythonCallCommand
bool retval = false;
- PyObject *DebuggerObj_PyObj = SWIG_NewPointerObj((void *) &debugger_sb, SWIGTYPE_p_lldb__SBDebugger, 0);
- PyObject *CmdRetObj_PyObj = SWIG_NewPointerObj((void *) &cmd_retobj_sb, SWIGTYPE_p_lldb__SBCommandReturnObject, 0);
-
- if (DebuggerObj_PyObj == NULL)
- return retval;
+ {
+ PyErr_Cleaner py_err_cleaner(true);
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
- if (CmdRetObj_PyObj == NULL)
- return retval;
-
- if (!python_function_name || !session_dictionary_name)
- return retval;
+ if (!pfunc)
+ return retval;
- PyObject *session_dict, *pfunc;
- PyObject *pargs, *pvalue;
-
- session_dict = FindSessionDictionary (session_dictionary_name);
- if (session_dict != NULL)
- {
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (pfunc != NULL)
- {
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- pargs = PyTuple_New (4);
- if (pargs == NULL)
- {
- if (PyErr_Occurred())
- PyErr_Clear();
- return retval;
- }
-
- PyTuple_SetItem (pargs, 0, DebuggerObj_PyObj); // This "steals" a reference to DebuggerObj_PyObj
- PyTuple_SetItem (pargs, 1, PyString_FromString(args));
- PyTuple_SetItem (pargs, 2, CmdRetObj_PyObj); // This "steals" a reference to CmdRetObj_PyObj
- PyTuple_SetItem (pargs, 3, session_dict); // This "steals" a reference to session_dict
- pvalue = PyObject_CallObject (pfunc, pargs);
- Py_DECREF (pargs);
-
- if (pvalue != NULL)
- {
- if (pvalue == Py_None) // no error
- {
- err_msg.clear();
- retval = true;
- }
- else
- {
- // return value is an error string
- if (PyString_CheckExact(pvalue))
- err_msg.assign(PyString_AsString(pvalue));
- retval = false;
- }
- Py_DECREF (pvalue);
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear ();
+ PyObject* session_dict = NULL;
+ // pass the pointer-to cmd_retobj_sb or watch the underlying object disappear from under you
+ // see comment above for SBCommandReturnObjectReleaser for further details
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+ Py_XDECREF (pvalue);
+
+ retval = true;
}
+
return retval;
}
@@ -804,84 +669,34 @@ LLDBSWIGPythonCreateOSPlugin
if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name)
Py_RETURN_NONE;
- // I do not want the SBValue to be deallocated when going out of scope because python
+ // I do not want the SBProcess to be deallocated when going out of scope because python
// has ownership of it and will manage memory for this object by itself
lldb::SBProcess *process_sb = new lldb::SBProcess(process_sp);
- PyObject *SBProc_PyObj = SWIG_NewPointerObj((void *)process_sb, SWIGTYPE_p_lldb__SBProcess, 0);
+ PyObject *SBProc_PyObj = SBTypeToSWIGWrapper(process_sb);
if (SBProc_PyObj == NULL)
Py_RETURN_NONE;
- const char* python_function_name = python_class_name;
-
- PyObject *session_dict, *pfunc;
- PyObject *pvalue;
-
- session_dict = FindSessionDictionary (session_dictionary_name);
- if (session_dict != NULL)
{
- pfunc = ResolvePythonName (python_function_name, session_dict);
- if (pfunc != NULL)
- {
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- PyObject *argList = Py_BuildValue("(O)", SBProc_PyObj);
-
- if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- return retval;
- }
-
- if (argList == NULL)
- {
- return retval;
- }
-
- Py_INCREF(SBProc_PyObj);
-
- pvalue = PyObject_CallObject(pfunc, argList);
-
- Py_DECREF(argList);
-
- if (pvalue != NULL)
- {
- if (pvalue != Py_None)
- retval = pvalue;
- else
- {
- retval = Py_None;
- Py_INCREF(retval);
- }
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
- else if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear ();
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
+
+ Py_INCREF(SBProc_PyObj);
+
+ PyObject* session_dict = NULL;
+ session_dict = session_dict = FindSessionDictionary(session_dictionary_name);
+ retval = pfunc(SBProc_PyObj);
+
+ Py_XINCREF (session_dict);
+
+ Py_XINCREF(retval);
}
+
if (retval)
return retval;
else
@@ -889,85 +704,192 @@ LLDBSWIGPythonCreateOSPlugin
}
SWIGEXPORT bool
-LLDBSwigPythonCallModuleInit
-(
- const char *python_module_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger
-)
+LLDBSWIGPythonRunScriptKeywordProcess
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::ProcessSP& process,
+std::string& output)
+
{
+ bool retval = false;
- lldb::SBDebugger debugger_sb(debugger);
+ if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+ return retval;
+ lldb::SBProcess process_sb(process);
+
+ {
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (PyObjectToString(pvalue,output))
+ retval = true;
+
+ Py_XDECREF(pvalue);
+ }
+
+ return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordThread
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::ThreadSP& thread,
+std::string& output)
+
+{
bool retval = false;
- PyObject *DebuggerObj_PyObj = SWIG_NewPointerObj((void *) &debugger_sb, SWIGTYPE_p_lldb__SBDebugger, 0);
+ if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
+ return retval;
+
+ lldb::SBThread thread_sb(thread);
+
+ {
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (PyObjectToString(pvalue,output))
+ retval = true;
+
+ Py_XDECREF(pvalue);
+ }
+
+ return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordTarget
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::TargetSP& target,
+std::string& output)
+
+{
+ bool retval = false;
- if (DebuggerObj_PyObj == NULL)
+ if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
return retval;
+
+ lldb::SBTarget target_sb(target);
+
+ {
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
- if (python_module_name == NULL || python_module_name[0] == '\0' || !session_dictionary_name)
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (PyObjectToString(pvalue,output))
+ retval = true;
+
+ Py_XDECREF(pvalue);
+ }
+
+ return retval;
+}
+
+SWIGEXPORT bool
+LLDBSWIGPythonRunScriptKeywordFrame
+(const char* python_function_name,
+const char* session_dictionary_name,
+lldb::StackFrameSP& frame,
+std::string& output)
+
+{
+ bool retval = false;
+
+ if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name)
return retval;
- PyObject *session_dict, *pfunc;
- PyObject *pargs, *pvalue;
+ lldb::SBFrame frame_sb(frame);
- session_dict = FindSessionDictionary (session_dictionary_name);
+ {
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
+ return retval;
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ if (PyObjectToString(pvalue,output))
+ retval = true;
+
+ Py_XDECREF(pvalue);
+ }
+ return retval;
+}
+
+SWIGEXPORT bool
+LLDBSwigPythonCallModuleInit
+(
+ const char *python_module_name,
+ const char *session_dictionary_name,
+ lldb::DebuggerSP& debugger
+)
+{
+ bool retval = false;
+
+ lldb::SBDebugger debugger_sb(debugger);
+
std::string python_function_name_string = python_module_name;
python_function_name_string += ".__lldb_init_module";
const char* python_function_name = python_function_name_string.c_str();
- if (session_dict != NULL)
{
- pfunc = ResolvePythonName (python_function_name, session_dict);
+ PyErr_Cleaner py_err_cleaner(true);
- if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that
- {
- PyErr_Clear();
- return true;
- }
-
- if (pfunc == NULL)
+ PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
+
+ if (!pfunc)
return true;
- else
- {
- // Set up the arguments and call the function.
-
- if (PyCallable_Check (pfunc))
- {
- pargs = PyTuple_New (2);
- if (pargs == NULL)
- {
- if (PyErr_Occurred())
- PyErr_Clear();
- return retval;
- }
-
- PyTuple_SetItem (pargs, 0, DebuggerObj_PyObj); // This "steals" a reference to DebuggerObj_PyObj
- PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict
- pvalue = PyObject_CallObject (pfunc, pargs);
- Py_DECREF (pargs);
-
- if (PyErr_Occurred ())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- else
- {
- retval = true;
- Py_XDECREF (pvalue);
- }
- Py_INCREF (session_dict);
- }
- else if (PyErr_Occurred())
- {
- PyErr_Print();
- PyErr_Clear();
- }
- }
+
+ PyObject* session_dict = NULL;
+ PyObject* pvalue = NULL;
+ pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name));
+
+ Py_XINCREF (session_dict);
+
+ retval = true;
+
+ Py_XDECREF(pvalue);
}
+
return retval;
}
%}
@@ -1023,16 +945,16 @@ LLDBSwigPythonCallSBInputReaderCallback(
if (baton != Py_None) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyObject *py_InputReader = SWIG_NewPointerObj(reader, SWIGTYPE_p_lldb__SBInputReader, false);
+ PyObject *py_InputReader = SBTypeToSWIGWrapper(reader);
PyObject *py_Notification = PyInt_FromLong(notification);
PyObject *py_Bytes = PyBytes_FromStringAndSize(bytes, bytes_len);
PyObject *tuple = PyTuple_Pack(3, py_InputReader, py_Notification, py_Bytes);
PyObject *res = PyObject_Call(reinterpret_cast<PyObject*>(baton), tuple, NULL);
- Py_DECREF(tuple);
- Py_DECREF(py_InputReader);
- Py_DECREF(py_Notification);
- Py_DECREF(py_Bytes);
+ Py_XDECREF(tuple);
+ Py_XDECREF(py_InputReader);
+ Py_XDECREF(py_Notification);
+ Py_XDECREF(py_Bytes);
if (res == NULL) {
PyObject *exc = PyErr_Occurred();
@@ -1048,7 +970,7 @@ LLDBSwigPythonCallSBInputReaderCallback(
if (res != Py_None)
result = static_cast<size_t>(PyInt_AsSsize_t(res));
- Py_DECREF(res);
+ Py_XDECREF(res);
SWIG_PYTHON_THREAD_END_BLOCK;
return result;
}
Modified: lldb/branches/lldb-platform-work/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/build-llvm.pl?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/build-llvm.pl (original)
+++ lldb/branches/lldb-platform-work/scripts/build-llvm.pl Tue Jul 2 16:55:02 2013
@@ -88,6 +88,7 @@ our @archive_files = (
"$llvm_configuration/lib/libLLVMMCDisassembler.a",
"$llvm_configuration/lib/libLLVMMCJIT.a",
"$llvm_configuration/lib/libLLVMObject.a",
+ "$llvm_configuration/lib/libLLVMOption.a",
"$llvm_configuration/lib/libLLVMRuntimeDyld.a",
"$llvm_configuration/lib/libLLVMScalarOpts.a",
"$llvm_configuration/lib/libLLVMSelectionDAG.a",
Modified: lldb/branches/lldb-platform-work/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/lldb.swig?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/lldb.swig (original)
+++ lldb/branches/lldb-platform-work/scripts/lldb.swig Tue Jul 2 16:55:02 2013
@@ -98,6 +98,9 @@ import os
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBWatchpoint.h"
+
+#include "../scripts/Python/python-swigsafecast.swig"
+
%}
/* Various liblldb typedefs that SWIG needs to know about. */
Modified: lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBCommandReturnObject.cpp Tue Jul 2 16:55:02 2013
@@ -8,8 +8,10 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -329,3 +331,21 @@ SBCommandReturnObject::Printf(const char
return 0;
}
+void
+SBCommandReturnObject::SetError (lldb::SBError &error, const char *fallback_error_cstr)
+{
+ if (m_opaque_ap.get())
+ {
+ if (error.IsValid())
+ m_opaque_ap->SetError(error.ref(), fallback_error_cstr);
+ else if (fallback_error_cstr)
+ m_opaque_ap->SetError(Error(), fallback_error_cstr);
+ }
+}
+
+void
+SBCommandReturnObject::SetError (const char *error_cstr)
+{
+ if (m_opaque_ap.get() && error_cstr)
+ m_opaque_ap->SetError(error_cstr);
+}
Modified: lldb/branches/lldb-platform-work/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBCompileUnit.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBCompileUnit.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBCompileUnit.cpp Tue Jul 2 16:55:02 2013
@@ -10,10 +10,13 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/LineTable.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Symbol/Type.h"
using namespace lldb;
using namespace lldb_private;
@@ -148,12 +151,39 @@ SBCompileUnit::GetNumSupportFiles () con
{
if (m_opaque_ptr)
{
- FileSpecList& support_files = m_opaque_ptr->GetSupportFiles ();
- return support_files.GetSize();
+ FileSpecList& support_files = m_opaque_ptr->GetSupportFiles ();
+ return support_files.GetSize();
}
return 0;
}
+
+
+lldb::SBTypeList
+SBCompileUnit::GetTypes (uint32_t type_mask)
+{
+ SBTypeList sb_type_list;
+
+ if (m_opaque_ptr)
+ {
+ ModuleSP module_sp (m_opaque_ptr->GetModule());
+ if (module_sp)
+ {
+ SymbolVendor* vendor = module_sp->GetSymbolVendor();
+ if (vendor)
+ {
+ TypeList type_list;
+ vendor->GetTypes (m_opaque_ptr, type_mask, type_list);
+ sb_type_list.m_opaque_ap->Append(type_list);
+ }
+ }
+ }
+ return sb_type_list;
+}
+
+
+
+
SBFileSpec
SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const
{
@@ -162,9 +192,9 @@ SBCompileUnit::GetSupportFileAtIndex (ui
SBFileSpec sb_file_spec;
if (m_opaque_ptr)
{
- FileSpecList &support_files = m_opaque_ptr->GetSupportFiles ();
- FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
- sb_file_spec.SetFileSpec(file_spec);
+ FileSpecList &support_files = m_opaque_ptr->GetSupportFiles ();
+ FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
+ sb_file_spec.SetFileSpec(file_spec);
}
if (log)
Modified: lldb/branches/lldb-platform-work/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBModule.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBModule.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBModule.cpp Tue Jul 2 16:55:02 2013
@@ -300,19 +300,27 @@ SBModule::GetCompileUnitAtIndex (uint32_
return sb_cu;
}
+static Symtab *
+GetUnifiedSymbolTable (const lldb::ModuleSP& module_sp)
+{
+ if (module_sp)
+ {
+ SymbolVendor *symbols = module_sp->GetSymbolVendor();
+ if (symbols)
+ return symbols->GetSymtab();
+ }
+ return NULL;
+}
+
size_t
SBModule::GetNumSymbols ()
{
ModuleSP module_sp (GetSP ());
if (module_sp)
{
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- Symtab *symtab = obj_file->GetSymtab();
- if (symtab)
- return symtab->GetNumSymbols();
- }
+ Symtab *symtab = GetUnifiedSymbolTable (module_sp);
+ if (symtab)
+ return symtab->GetNumSymbols();
}
return 0;
}
@@ -322,16 +330,9 @@ SBModule::GetSymbolAtIndex (size_t idx)
{
SBSymbol sb_symbol;
ModuleSP module_sp (GetSP ());
- if (module_sp)
- {
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- Symtab *symtab = obj_file->GetSymtab();
- if (symtab)
- sb_symbol.SetSymbol(symtab->SymbolAtIndex (idx));
- }
- }
+ Symtab *symtab = GetUnifiedSymbolTable (module_sp);
+ if (symtab)
+ sb_symbol.SetSymbol(symtab->SymbolAtIndex (idx));
return sb_symbol;
}
@@ -343,16 +344,9 @@ SBModule::FindSymbol (const char *name,
if (name && name[0])
{
ModuleSP module_sp (GetSP ());
- if (module_sp)
- {
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- Symtab *symtab = obj_file->GetSymtab();
- if (symtab)
- sb_symbol.SetSymbol(symtab->FindFirstSymbolWithNameAndType(ConstString(name), symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny));
- }
- }
+ Symtab *symtab = GetUnifiedSymbolTable (module_sp);
+ if (symtab)
+ sb_symbol.SetSymbol(symtab->FindFirstSymbolWithNameAndType(ConstString(name), symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny));
}
return sb_symbol;
}
@@ -365,28 +359,21 @@ SBModule::FindSymbols (const char *name,
if (name && name[0])
{
ModuleSP module_sp (GetSP ());
- if (module_sp)
+ Symtab *symtab = GetUnifiedSymbolTable (module_sp);
+ if (symtab)
{
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
+ std::vector<uint32_t> matching_symbol_indexes;
+ const size_t num_matches = symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type, matching_symbol_indexes);
+ if (num_matches)
{
- Symtab *symtab = obj_file->GetSymtab();
- if (symtab)
+ SymbolContext sc;
+ sc.module_sp = module_sp;
+ SymbolContextList &sc_list = *sb_sc_list;
+ for (size_t i=0; i<num_matches; ++i)
{
- std::vector<uint32_t> matching_symbol_indexes;
- const size_t num_matches = symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type, matching_symbol_indexes);
- if (num_matches)
- {
- SymbolContext sc;
- sc.module_sp = module_sp;
- SymbolContextList &sc_list = *sb_sc_list;
- for (size_t i=0; i<num_matches; ++i)
- {
- sc.symbol = symtab->SymbolAtIndex (matching_symbol_indexes[i]);
- if (sc.symbol)
- sc_list.Append(sc);
- }
- }
+ sc.symbol = symtab->SymbolAtIndex (matching_symbol_indexes[i]);
+ if (sc.symbol)
+ sc_list.Append(sc);
}
}
}
@@ -403,13 +390,11 @@ SBModule::GetNumSections ()
ModuleSP module_sp (GetSP ());
if (module_sp)
{
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- SectionList *section_list = obj_file->GetSectionList ();
- if (section_list)
- return section_list->GetSize();
- }
+ // Give the symbol vendor a chance to add to the unified section list.
+ module_sp->GetSymbolVendor();
+ SectionList *section_list = module_sp->GetUnifiedSectionList();
+ if (section_list)
+ return section_list->GetSize();
}
return 0;
}
@@ -421,14 +406,12 @@ SBModule::GetSectionAtIndex (size_t idx)
ModuleSP module_sp (GetSP ());
if (module_sp)
{
- ObjectFile *obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- SectionList *section_list = obj_file->GetSectionList ();
+ // Give the symbol vendor a chance to add to the unified section list.
+ module_sp->GetSymbolVendor();
+ SectionList *section_list = module_sp->GetUnifiedSectionList ();
- if (section_list)
- sb_section.SetSP(section_list->GetSectionAtIndex (idx));
- }
+ if (section_list)
+ sb_section.SetSP(section_list->GetSectionAtIndex (idx));
}
return sb_section;
}
@@ -561,6 +544,24 @@ SBModule::FindTypes (const char *type)
return retval;
}
+lldb::SBTypeList
+SBModule::GetTypes (uint32_t type_mask)
+{
+ SBTypeList sb_type_list;
+
+ ModuleSP module_sp (GetSP ());
+ if (module_sp)
+ {
+ SymbolVendor* vendor = module_sp->GetSymbolVendor();
+ if (vendor)
+ {
+ TypeList type_list;
+ vendor->GetTypes (NULL, type_mask, type_list);
+ sb_type_list.m_opaque_ap->Append(type_list);
+ }
+ }
+ return sb_type_list;
+}
SBSection
SBModule::FindSection (const char *sect_name)
@@ -570,18 +571,16 @@ SBModule::FindSection (const char *sect_
ModuleSP module_sp (GetSP ());
if (sect_name && module_sp)
{
- ObjectFile *objfile = module_sp->GetObjectFile();
- if (objfile)
+ // Give the symbol vendor a chance to add to the unified section list.
+ module_sp->GetSymbolVendor();
+ SectionList *section_list = module_sp->GetUnifiedSectionList();
+ if (section_list)
{
- SectionList *section_list = objfile->GetSectionList();
- if (section_list)
+ ConstString const_sect_name(sect_name);
+ SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
+ if (section_sp)
{
- ConstString const_sect_name(sect_name);
- SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
- if (section_sp)
- {
- sb_section.SetSP (section_sp);
- }
+ sb_section.SetSP (section_sp);
}
}
}
Modified: lldb/branches/lldb-platform-work/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBProcess.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBProcess.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBProcess.cpp Tue Jul 2 16:55:02 2013
@@ -173,7 +173,7 @@ SBProcess::RemoteLaunch (char const **ar
launch_flags);
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
if (exe_module)
- launch_info.SetExecutableFile(exe_module->GetFileSpec(), true);
+ launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
if (argv)
launch_info.GetArguments().AppendArguments (argv);
if (envp)
Modified: lldb/branches/lldb-platform-work/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBSection.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBSection.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBSection.cpp Tue Jul 2 16:55:02 2013
@@ -69,6 +69,20 @@ SBSection::GetName ()
return NULL;
}
+lldb::SBSection
+SBSection::GetParent()
+{
+ lldb::SBSection sb_section;
+ SectionSP section_sp (GetSP());
+ if (section_sp)
+ {
+ SectionSP parent_section_sp (section_sp->GetParent());
+ if (parent_section_sp)
+ sb_section.SetSP(parent_section_sp);
+ }
+ return sb_section;
+}
+
lldb::SBSection
SBSection::FindSubSection (const char *sect_name)
Modified: lldb/branches/lldb-platform-work/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBTarget.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBTarget.cpp Tue Jul 2 16:55:02 2013
@@ -1807,6 +1807,12 @@ SBTarget::WatchAddress (lldb::addr_t add
watch_type |= LLDB_WATCH_TYPE_READ;
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
+ if (watch_type == 0)
+ {
+ error.SetErrorString("Can't create a watchpoint that is neither read nor write.");
+ return sb_watchpoint;
+ }
+
// Target::CreateWatchpoint() is thread safe.
Error cw_error;
// This API doesn't take in a type, so we can't figure out what it is.
Modified: lldb/branches/lldb-platform-work/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBType.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBType.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBType.cpp Tue Jul 2 16:55:02 2013
@@ -231,6 +231,18 @@ SBType::IsFunctionType ()
return false;
}
+bool
+SBType::IsPolymorphicClass ()
+{
+ if (IsValid())
+ {
+ return ClangASTType::IsPolymorphicClass (m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+ }
+ return false;
+}
+
+
+
lldb::SBType
SBType::GetFunctionReturnType ()
{
Modified: lldb/branches/lldb-platform-work/source/API/SBTypeSynthetic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBTypeSynthetic.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBTypeSynthetic.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBTypeSynthetic.cpp Tue Jul 2 16:55:02 2013
@@ -116,15 +116,15 @@ SBTypeSynthetic::SetOptions (uint32_t va
bool
SBTypeSynthetic::GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level)
+ lldb::DescriptionLevel description_level)
{
- if (!CopyOnWrite_Impl())
- return false;
- else {
+ if (m_opaque_sp)
+ {
description.Printf("%s\n",
m_opaque_sp->GetDescription().c_str());
return true;
}
+ return false;
}
lldb::SBTypeSynthetic &
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp Tue Jul 2 16:55:02 2013
@@ -319,6 +319,7 @@ BreakpointLocation::ConditionSaysStop (E
{
ret = false;
error.SetErrorString("Expression did not return a result");
+ return false;
}
result_value_sp = result_variable_sp->GetValueObject();
@@ -483,9 +484,6 @@ BreakpointLocation::ResolveBreakpointSit
if (process == NULL)
return false;
- if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
- return false;
-
lldb::break_id_t new_id = process->CreateBreakpointSite (shared_from_this(), false);
if (new_id == LLDB_INVALID_BREAK_ID)
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileLine.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileLine.cpp Tue Jul 2 16:55:02 2013
@@ -87,7 +87,7 @@ BreakpointResolverFileLine::SearchCallba
while (sc_list.GetSize() > 0)
{
SymbolContextList tmp_sc_list;
- int current_idx = 0;
+ unsigned current_idx = 0;
SymbolContext sc;
bool first_entry = true;
@@ -235,7 +235,7 @@ BreakpointResolverFileLine::GetDepth()
void
BreakpointResolverFileLine::GetDescription (Stream *s)
{
- s->Printf ("file ='%s', line = %u", m_file_spec.GetFilename().AsCString(), m_line_number);
+ s->Printf ("file = '%s', line = %u", m_file_spec.GetPath().c_str(), m_line_number);
}
void
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileRegex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileRegex.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileRegex.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverFileRegex.cpp Tue Jul 2 16:55:02 2013
@@ -62,7 +62,7 @@ BreakpointResolverFileRegex::SearchCallb
std::vector<uint32_t> line_matches;
context.target_sp->GetSourceManager().FindLinesMatchingRegex(cu_file_spec, m_regex, 1, UINT32_MAX, line_matches);
uint32_t num_matches = line_matches.size();
- for (int i = 0; i < num_matches; i++)
+ for (uint32_t i = 0; i < num_matches; i++)
{
uint32_t start_idx = 0;
bool exact = false;
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverName.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointResolverName.cpp Tue Jul 2 16:55:02 2013
@@ -188,7 +188,7 @@ BreakpointResolverName::SearchCallback
)
{
SymbolContextList func_list;
- SymbolContextList sym_list;
+ //SymbolContextList sym_list;
uint32_t i;
bool new_location;
@@ -203,11 +203,10 @@ BreakpointResolverName::SearchCallback
log->Warning ("Class/method function specification not supported yet.\n");
return Searcher::eCallbackReturnStop;
}
-
- const bool include_symbols = false;
+ bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
+ const bool include_symbols = filter_by_cu == false;
const bool include_inlines = true;
const bool append = true;
- bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
switch (m_match_type)
{
@@ -228,26 +227,14 @@ BreakpointResolverName::SearchCallback
if (start_func_idx < end_func_idx)
lookup.Prune (func_list, start_func_idx);
- // If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain
- // symbols, since all the ones from a set compilation unit will have been found above already.
- else if (!filter_by_cu)
- {
- const size_t start_symbol_idx = sym_list.GetSize();
- context.module_sp->FindFunctionSymbols (lookup.lookup_name, lookup.name_type_mask, sym_list);
- const size_t end_symbol_idx = sym_list.GetSize();
- if (start_symbol_idx < end_symbol_idx)
- lookup.Prune (func_list, start_symbol_idx);
- }
}
}
break;
case Breakpoint::Regexp:
if (context.module_sp)
{
- if (!filter_by_cu)
- context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex,
- include_symbols,
+ context.module_sp->FindFunctions (m_regex,
+ !filter_by_cu, // include symbols only if we aren't filterning by CU
include_inlines,
append,
func_list);
@@ -283,33 +270,6 @@ BreakpointResolverName::SearchCallback
{
for (i = 0; i < func_list.GetSize(); i++)
{
- if (func_list.GetContextAtIndex(i, sc) == false)
- continue;
-
- if (sc.function == NULL)
- continue;
- uint32_t j = 0;
- while (j < sym_list.GetSize())
- {
- SymbolContext symbol_sc;
- if (sym_list.GetContextAtIndex(j, symbol_sc))
- {
- if (symbol_sc.symbol && symbol_sc.symbol->ValueIsAddress())
- {
- if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddress())
- {
- sym_list.RemoveContextAtIndex(j);
- continue; // Don't increment j
- }
- }
- }
-
- j++;
- }
- }
-
- for (i = 0; i < func_list.GetSize(); i++)
- {
if (func_list.GetContextAtIndex(i, sc))
{
if (sc.block && sc.block->GetInlinedFunctionInfo())
@@ -320,14 +280,21 @@ BreakpointResolverName::SearchCallback
else if (sc.function)
{
break_addr = sc.function->GetAddressRange().GetBaseAddress();
- if (m_skip_prologue)
+ if (m_skip_prologue && break_addr.IsValid())
{
- if (break_addr.IsValid())
- {
- const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
- if (prologue_byte_size)
- break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
- }
+ const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
+ if (prologue_byte_size)
+ break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
+ }
+ }
+ else if (sc.symbol)
+ {
+ break_addr = sc.symbol->GetAddress();
+ if (m_skip_prologue && break_addr.IsValid())
+ {
+ const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
+ if (prologue_byte_size)
+ break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
}
}
@@ -351,35 +318,6 @@ BreakpointResolverName::SearchCallback
}
}
- for (i = 0; i < sym_list.GetSize(); i++)
- {
- if (sym_list.GetContextAtIndex(i, sc))
- {
- if (sc.symbol && sc.symbol->ValueIsAddress())
- {
- break_addr = sc.symbol->GetAddress();
-
- if (m_skip_prologue)
- {
- const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
- if (prologue_byte_size)
- break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
- }
-
- if (filter.AddressPasses(break_addr))
- {
- BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
- if (bp_loc_sp && new_location && !m_breakpoint->IsInternal())
- {
- StreamString s;
- bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
- if (log)
- log->Printf ("Added location: %s\n", s.GetData());
- }
- }
- }
- }
- }
return Searcher::eCallbackReturnContinue;
}
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointSiteList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointSiteList.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointSiteList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointSiteList.cpp Tue Jul 2 16:55:02 2013
@@ -20,6 +20,7 @@ using namespace lldb;
using namespace lldb_private;
BreakpointSiteList::BreakpointSiteList() :
+ m_mutex (Mutex::eMutexTypeRecursive),
m_bp_site_list()
{
}
@@ -35,6 +36,7 @@ lldb::break_id_t
BreakpointSiteList::Add(const BreakpointSiteSP &bp)
{
lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
+ Mutex::Locker locker(m_mutex);
collection::iterator iter = m_bp_site_list.find (bp_site_load_addr);
if (iter == m_bp_site_list.end())
@@ -79,6 +81,7 @@ BreakpointSiteList::FindIDByAddress (lld
bool
BreakpointSiteList::Remove (lldb::break_id_t break_id)
{
+ Mutex::Locker locker(m_mutex);
collection::iterator pos = GetIDIterator(break_id); // Predicate
if (pos != m_bp_site_list.end())
{
@@ -91,6 +94,7 @@ BreakpointSiteList::Remove (lldb::break_
bool
BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
{
+ Mutex::Locker locker(m_mutex);
collection::iterator pos = m_bp_site_list.find(address);
if (pos != m_bp_site_list.end())
{
@@ -120,6 +124,7 @@ private:
BreakpointSiteList::collection::iterator
BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
{
+ Mutex::Locker locker(m_mutex);
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
@@ -127,6 +132,7 @@ BreakpointSiteList::GetIDIterator (lldb:
BreakpointSiteList::collection::const_iterator
BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
{
+ Mutex::Locker locker(m_mutex);
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
@@ -134,6 +140,7 @@ BreakpointSiteList::GetIDConstIterator (
BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::break_id_t break_id)
{
+ Mutex::Locker locker(m_mutex);
BreakpointSiteSP stop_sp;
collection::iterator pos = GetIDIterator(break_id);
if (pos != m_bp_site_list.end())
@@ -145,6 +152,7 @@ BreakpointSiteList::FindByID (lldb::brea
const BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
{
+ Mutex::Locker locker(m_mutex);
BreakpointSiteSP stop_sp;
collection::const_iterator pos = GetIDConstIterator(break_id);
if (pos != m_bp_site_list.end())
@@ -157,7 +165,7 @@ BreakpointSiteSP
BreakpointSiteList::FindByAddress (lldb::addr_t addr)
{
BreakpointSiteSP found_sp;
-
+ Mutex::Locker locker(m_mutex);
collection::iterator iter = m_bp_site_list.find(addr);
if (iter != m_bp_site_list.end())
found_sp = iter->second;
@@ -167,6 +175,7 @@ BreakpointSiteList::FindByAddress (lldb:
bool
BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
{
+ Mutex::Locker locker(m_mutex);
collection::const_iterator pos = GetIDConstIterator(bp_site_id);
if (pos != m_bp_site_list.end())
return pos->second->IsBreakpointAtThisSite (bp_id);
@@ -188,44 +197,21 @@ BreakpointSiteList::Dump (Stream *s) con
s->IndentLess();
}
-
-BreakpointSiteSP
-BreakpointSiteList::GetByIndex (uint32_t i)
-{
- BreakpointSiteSP stop_sp;
- collection::iterator end = m_bp_site_list.end();
- collection::iterator pos;
- uint32_t curr_i = 0;
- for (pos = m_bp_site_list.begin(), curr_i = 0; pos != end; ++pos, ++curr_i)
- {
- if (curr_i == i)
- stop_sp = pos->second;
- }
- return stop_sp;
-}
-
-const BreakpointSiteSP
-BreakpointSiteList::GetByIndex (uint32_t i) const
+void
+BreakpointSiteList::ForEach (std::function <void(BreakpointSite *)> const &callback)
{
- BreakpointSiteSP stop_sp;
- collection::const_iterator end = m_bp_site_list.end();
- collection::const_iterator pos;
- uint32_t curr_i = 0;
- for (pos = m_bp_site_list.begin(), curr_i = 0; pos != end; ++pos, ++curr_i)
- {
- if (curr_i == i)
- stop_sp = pos->second;
- }
- return stop_sp;
+ Mutex::Locker locker(m_mutex);
+ for (auto pair : m_bp_site_list)
+ callback (pair.second.get());
}
bool
BreakpointSiteList::FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bound, BreakpointSiteList &bp_site_list) const
{
-
if (lower_bound > upper_bound)
return false;
+ Mutex::Locker locker(m_mutex);
collection::const_iterator lower, upper, pos;
lower = m_bp_site_list.lower_bound(lower_bound);
if (lower == m_bp_site_list.end()
@@ -252,24 +238,3 @@ BreakpointSiteList::FindInRange (lldb::a
}
return true;
}
-
-
-void
-BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::break_id_t except_id)
-{
- collection::iterator end = m_bp_site_list.end();
- collection::iterator pos;
- for (pos = m_bp_site_list.begin(); pos != end; ++pos)
- {
- if (except_id != LLDB_INVALID_BREAK_ID && except_id != pos->second->GetID())
- pos->second->SetEnabled (enabled);
- else
- pos->second->SetEnabled (!enabled);
- }
-}
-
-const BreakpointSiteList::collection *
-BreakpointSiteList::GetMap ()
-{
- return &m_bp_site_list;
-}
Modified: lldb/branches/lldb-platform-work/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -49,6 +49,7 @@ set( LLDB_USED_LIBS
lldbPluginObjectFileMachO
lldbPluginObjectFileELF
+ lldbPluginSymbolVendorELF
lldbPluginObjectContainerBSDArchive
lldbPluginObjectContainerMachOArchive
lldbPluginProcessGDBRemote
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandCompletions.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandCompletions.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandCompletions.cpp Tue Jul 2 16:55:02 2013
@@ -599,7 +599,17 @@ CommandCompletions::SourceFileCompleter:
static bool
regex_chars (const char comp)
{
- if (comp == '[' || comp == ']' || comp == '(' || comp == ')')
+ if (comp == '[' || comp == ']' ||
+ comp == '(' || comp == ')' ||
+ comp == '{' || comp == '}' ||
+ comp == '+' ||
+ comp == '.' ||
+ comp == '*' ||
+ comp == '|' ||
+ comp == '^' ||
+ comp == '$' ||
+ comp == '\\' ||
+ comp == '?')
return true;
else
return false;
@@ -614,16 +624,22 @@ CommandCompletions::SymbolCompleter::Sym
) :
CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
{
- std::string regex_str ("^");
- regex_str.append(completion_str);
- regex_str.append(".*");
- std::string::iterator pos;
-
- pos = find_if(regex_str.begin(), regex_str.end(), regex_chars);
- while (pos < regex_str.end()) {
+ std::string regex_str;
+ if (completion_str && completion_str[0])
+ {
+ regex_str.append("^");
+ regex_str.append(completion_str);
+ }
+ else
+ {
+ // Match anything since the completion string is empty
+ regex_str.append(".");
+ }
+ std::string::iterator pos = find_if(regex_str.begin() + 1, regex_str.end(), regex_chars);
+ while (pos < regex_str.end())
+ {
pos = regex_str.insert(pos, '\\');
- pos += 2;
- pos = find_if(pos, regex_str.end(), regex_chars);
+ pos = find_if(pos + 2, regex_str.end(), regex_chars);
}
m_regex.Compile(regex_str.c_str());
}
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectArgs.cpp Tue Jul 2 16:55:02 2013
@@ -121,7 +121,7 @@ CommandObjectArgs::DoExecute (Args& args
}
const size_t num_args = args.GetArgumentCount ();
- int arg_index;
+ size_t arg_index;
if (!num_args)
{
@@ -256,7 +256,7 @@ CommandObjectArgs::DoExecute (Args& args
for (arg_index = 0; arg_index < num_args; ++arg_index)
{
- result.GetOutputStream ().Printf ("%d (%s): ", arg_index, args.GetArgumentAtIndex (arg_index));
+ result.GetOutputStream ().Printf ("%zu (%s): ", arg_index, args.GetArgumentAtIndex (arg_index));
value_list.GetValueAtIndex (arg_index)->Dump (&result.GetOutputStream ());
result.GetOutputStream ().Printf("\n");
}
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectBreakpoint.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectBreakpoint.cpp Tue Jul 2 16:55:02 2013
@@ -667,7 +667,9 @@ CommandObjectBreakpointSet::CommandOptio
"Can be repeated multiple times to make one breakpoint for multiple symbols." },
{ LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', required_argument, NULL, 0, eArgTypeRegularExpression,
- "Set the breakpoint specifying a regular expression to match a pattern in the source text in a given source file." },
+ "Set the breakpoint by specifying a regular expression which is matched against the source text in a source file or files "
+ "specified with the -f option. The -f option can be specified more than once. "
+ "If no source files are specified, uses the current \"default source file\"" },
{ LLDB_OPT_SET_10, true, "language-exception", 'E', required_argument, NULL, 0, eArgTypeLanguage,
"Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" },
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectCommands.cpp Tue Jul 2 16:55:02 2013
@@ -22,9 +22,12 @@
#include "lldb/Core/InputReaderEZ.h"
#include "lldb/Core/StringList.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/CommandHistory.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObjectRegexCommand.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreterPython.h"
@@ -63,7 +66,11 @@ protected:
public:
CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter)
+ Options (interpreter),
+ m_start_idx(0),
+ m_stop_idx(0),
+ m_count(0),
+ m_clear(false)
{
}
@@ -75,27 +82,27 @@ protected:
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
- bool success;
switch (short_option)
{
case 'c':
- m_end_idx = Args::StringToUInt32(option_arg, UINT_MAX, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid value for count: %s", option_arg);
- if (m_end_idx != 0)
- m_end_idx--;
- m_start_idx = 0;
+ error = m_count.SetValueFromCString(option_arg,eVarSetOperationAssign);
+ break;
+ case 's':
+ if (option_arg && strcmp("end", option_arg) == 0)
+ {
+ m_start_idx.SetCurrentValue(UINT64_MAX);
+ m_start_idx.SetOptionWasSet();
+ }
+ else
+ error = m_start_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
break;
case 'e':
- m_end_idx = Args::StringToUInt32(option_arg, 0, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid value for end index: %s", option_arg);
+ error = m_stop_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
break;
- case 's':
- m_start_idx = Args::StringToUInt32(option_arg, 0, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid value for start index: %s", option_arg);
+ case 'C':
+ m_clear.SetCurrentValue(true);
+ m_clear.SetOptionWasSet();
break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
@@ -108,8 +115,10 @@ protected:
void
OptionParsingStarting ()
{
- m_start_idx = 0;
- m_end_idx = UINT_MAX;
+ m_start_idx.Clear();
+ m_stop_idx.Clear();
+ m_count.Clear();
+ m_clear.Clear();
}
const OptionDefinition*
@@ -124,17 +133,90 @@ protected:
// Instance variables to hold the values for command options.
- uint32_t m_start_idx;
- uint32_t m_end_idx;
+ OptionValueUInt64 m_start_idx;
+ OptionValueUInt64 m_stop_idx;
+ OptionValueUInt64 m_count;
+ OptionValueBoolean m_clear;
};
bool
DoExecute (Args& command, CommandReturnObject &result)
{
-
- m_interpreter.DumpHistory (result.GetOutputStream(),
- m_options.m_start_idx,
- m_options.m_end_idx);
+ if (m_options.m_clear.GetCurrentValue() && m_options.m_clear.OptionWasSet())
+ {
+ m_interpreter.GetCommandHistory().Clear();
+ result.SetStatus(lldb::eReturnStatusSuccessFinishNoResult);
+ }
+ else
+ {
+ if (m_options.m_start_idx.OptionWasSet() && m_options.m_stop_idx.OptionWasSet() && m_options.m_count.OptionWasSet())
+ {
+ result.AppendError("--count, --start-index and --end-index cannot be all specified in the same invocation");
+ result.SetStatus(lldb::eReturnStatusFailed);
+ }
+ else
+ {
+ std::pair<bool,uint64_t> start_idx = {m_options.m_start_idx.OptionWasSet(),m_options.m_start_idx.GetCurrentValue()};
+ std::pair<bool,uint64_t> stop_idx = {m_options.m_stop_idx.OptionWasSet(),m_options.m_stop_idx.GetCurrentValue()};
+ std::pair<bool,uint64_t> count = {m_options.m_count.OptionWasSet(),m_options.m_count.GetCurrentValue()};
+
+ const CommandHistory& history(m_interpreter.GetCommandHistory());
+
+ if (start_idx.first && start_idx.second == UINT64_MAX)
+ {
+ if (count.first)
+ {
+ start_idx.second = history.GetSize() - count.second;
+ stop_idx.second = history.GetSize() - 1;
+ }
+ else if (stop_idx.first)
+ {
+ start_idx.second = stop_idx.second;
+ stop_idx.second = history.GetSize() - 1;
+ }
+ else
+ {
+ start_idx.second = 0;
+ stop_idx.second = history.GetSize() - 1;
+ }
+ }
+ else
+ {
+ if (!start_idx.first && !stop_idx.first && !count.first)
+ {
+ start_idx.second = 0;
+ stop_idx.second = history.GetSize() - 1;
+ }
+ else if (start_idx.first)
+ {
+ if (count.first)
+ {
+ stop_idx.second = start_idx.second + count.second - 1;
+ }
+ else if (!stop_idx.first)
+ {
+ stop_idx.second = history.GetSize() - 1;
+ }
+ }
+ else if (stop_idx.first)
+ {
+ if (count.first)
+ {
+ if (stop_idx.second >= count.second)
+ start_idx.second = stop_idx.second - count.second + 1;
+ else
+ start_idx.second = 0;
+ }
+ }
+ else /* if (count.first) */
+ {
+ start_idx.second = 0;
+ stop_idx.second = count.second - 1;
+ }
+ }
+ history.Dump(result.GetOutputStream(), start_idx.second, stop_idx.second);
+ }
+ }
return result.Succeeded();
}
@@ -146,8 +228,9 @@ OptionDefinition
CommandObjectCommandsHistory::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "count", 'c', required_argument, NULL, 0, eArgTypeUnsignedInteger, "How many history commands to print."},
-{ LLDB_OPT_SET_1, false, "start-index", 's', required_argument, NULL, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands."},
+{ LLDB_OPT_SET_1, false, "start-index", 's', required_argument, NULL, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)."},
{ LLDB_OPT_SET_1, false, "end-index", 'e', required_argument, NULL, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."},
+{ LLDB_OPT_SET_2, false, "clear", 'C', no_argument, NULL, 0, eArgTypeBoolean, "Clears the current command history."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -225,7 +308,8 @@ protected:
public:
CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter)
+ Options (interpreter),
+ m_stop_on_error (true)
{
}
@@ -242,9 +326,7 @@ protected:
switch (short_option)
{
case 'e':
- m_stop_on_error = Args::StringToBoolean(option_arg, true, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid value for stop-on-error: %s", option_arg);
+ error = m_stop_on_error.SetValueFromCString(option_arg);
break;
case 'c':
m_stop_on_continue = Args::StringToBoolean(option_arg, true, &success);
@@ -262,7 +344,7 @@ protected:
void
OptionParsingStarting ()
{
- m_stop_on_error = true;
+ m_stop_on_error.Clear();
m_stop_on_continue = true;
}
@@ -278,7 +360,7 @@ protected:
// Instance variables to hold the values for command options.
- bool m_stop_on_error;
+ OptionValueBoolean m_stop_on_error;
bool m_stop_on_continue;
};
@@ -296,11 +378,12 @@ protected:
ExecutionContext *exe_ctx = NULL; // Just use the default context.
bool echo_commands = true;
bool print_results = true;
+ bool stop_on_error = m_options.m_stop_on_error.OptionWasSet() ? (bool)m_options.m_stop_on_error : m_interpreter.GetStopCmdSourceOnError();
- m_interpreter.HandleCommandsFromFile (cmd_file,
+ m_interpreter.HandleCommandsFromFile (cmd_file,
exe_ctx,
m_options.m_stop_on_continue,
- m_options.m_stop_on_error,
+ stop_on_error,
echo_commands,
print_results,
eLazyBoolCalculate,
@@ -1245,7 +1328,9 @@ protected:
// Don't change the status if the command already set it...
if (result.GetStatus() == eReturnStatusInvalid)
{
- if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+ if (result.GetErrorData() && result.GetErrorData()[0])
+ result.SetStatus(eReturnStatusFailed);
+ else if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
result.SetStatus(eReturnStatusSuccessFinishNoResult);
else
result.SetStatus(eReturnStatusSuccessFinishResult);
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp Tue Jul 2 16:55:02 2013
@@ -94,7 +94,7 @@ CommandObjectHelp::DoExecute (Args& comm
CommandObject *sub_cmd_obj = cmd_obj;
// Loop down through sub_command dictionaries until we find the command object that corresponds
// to the help command entered.
- for (int i = 1; i < argc && all_okay; ++i)
+ for (size_t i = 1; i < argc && all_okay; ++i)
{
std::string sub_command = command.GetArgumentAtIndex(i);
matches.Clear();
@@ -119,13 +119,7 @@ CommandObjectHelp::DoExecute (Args& comm
{
std::string cmd_string;
command.GetCommandString (cmd_string);
- if (matches.GetSize() < 2)
- {
- result.AppendErrorWithFormat("'%s' is not a known command.\n"
- "Try 'help' to see a current list of commands.\n",
- cmd_string.c_str());
- }
- else
+ if (matches.GetSize() >= 2)
{
StreamString s;
s.Printf ("ambiguous command %s", cmd_string.c_str());
@@ -136,83 +130,29 @@ CommandObjectHelp::DoExecute (Args& comm
}
s.Printf ("\n");
result.AppendError(s.GetData());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
}
-
- result.SetStatus (eReturnStatusFailed);
- }
- else
- {
- Stream &output_strm = result.GetOutputStream();
- if (sub_cmd_obj->GetOptions() != NULL)
- {
- if (sub_cmd_obj->WantsRawCommandString())
- {
- std::string help_text (sub_cmd_obj->GetHelp());
- help_text.append (" This command takes 'raw' input (no need to quote stuff).");
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
- }
- else
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
- output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
- sub_cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, sub_cmd_obj);
- const char *long_help = sub_cmd_obj->GetHelpLong();
- if ((long_help != NULL)
- && (strlen (long_help) > 0))
- output_strm.Printf ("\n%s", long_help);
- if (sub_cmd_obj->WantsRawCommandString() && !sub_cmd_obj->WantsCompletion())
- {
- // Emit the message about using ' -- ' between the end of the command options and the raw input
- // conditionally, i.e., only if the command object does not want completion.
- m_interpreter.OutputFormattedHelpText (output_strm, "", "",
- "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options"
- " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
- }
- else if (sub_cmd_obj->GetNumArgumentEntries() > 0
- && sub_cmd_obj->GetOptions()
- && sub_cmd_obj->GetOptions()->NumCommandOptions() > 0)
- {
- // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
- m_interpreter.OutputFormattedHelpText (output_strm, "", "",
- "\nThis command takes options and free-form arguments. If your arguments resemble"
- " option specifiers (i.e., they start with a - or --), you must use ' -- ' between"
- " the end of the command options and the beginning of the arguments.", 1);
- }
-
- // Mark this help command with a success status.
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else if (sub_cmd_obj->IsMultiwordObject())
+ else if (!sub_cmd_obj)
{
- if (sub_cmd_obj->WantsRawCommandString())
- {
- std::string help_text (sub_cmd_obj->GetHelp());
- help_text.append (" This command takes 'raw' input (no need to quote stuff).");
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
- }
- else
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
- sub_cmd_obj->GenerateHelpText (result);
+ result.AppendErrorWithFormat("'%s' is not a known command.\n"
+ "Try 'help' to see a current list of commands.\n",
+ cmd_string.c_str());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
}
else
{
- const char *long_help = sub_cmd_obj->GetHelpLong();
- if ((long_help != NULL)
- && (strlen (long_help) > 0))
- output_strm.Printf ("%s", long_help);
- else if (sub_cmd_obj->WantsRawCommandString())
- {
- std::string help_text (sub_cmd_obj->GetHelp());
- help_text.append (" This command takes 'raw' input (no need to quote stuff).");
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
- }
- else
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
- output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
- // Mark this help command with a success status.
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ result.GetOutputStream().Printf("'%s' is not a known command.\n"
+ "Try 'help' to see a current list of commands.\n"
+ "The closest match is '%s'. Help on it follows.\n\n",
+ cmd_string.c_str(),
+ sub_cmd_obj->GetCommandName());
}
}
+ sub_cmd_obj->GenerateHelpText(result);
+
if (is_alias_command)
{
StreamString sstr;
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.h (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.h Tue Jul 2 16:55:02 2013
@@ -108,7 +108,7 @@ protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result);
-
+
private:
CommandOptions m_options;
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp Tue Jul 2 16:55:02 2013
@@ -521,17 +521,31 @@ protected:
type_list);
}
- if (type_list.GetSize() == 0)
+ if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && *lookup_type_name.GetCString() == '$')
{
- result.AppendErrorWithFormat ("unable to find any types that match the raw type '%s' for full type '%s'\n",
- lookup_type_name.GetCString(),
- view_as_type_cstr);
- result.SetStatus(eReturnStatusFailed);
- return false;
+ clang::TypeDecl *tdecl = target->GetPersistentVariables().GetPersistentType(ConstString(lookup_type_name));
+ if (tdecl)
+ {
+ clang_ast_type.SetClangType(&tdecl->getASTContext(),(lldb::clang_type_t)tdecl->getTypeForDecl());
+ }
}
- TypeSP type_sp (type_list.GetTypeAtIndex(0));
- clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
+ if (clang_ast_type.IsValid() == false)
+ {
+ if (type_list.GetSize() == 0)
+ {
+ result.AppendErrorWithFormat ("unable to find any types that match the raw type '%s' for full type '%s'\n",
+ lookup_type_name.GetCString(),
+ view_as_type_cstr);
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+ else
+ {
+ TypeSP type_sp (type_list.GetTypeAtIndex(0));
+ clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
+ }
+ }
while (pointer_count > 0)
{
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectMultiword.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectMultiword.cpp Tue Jul 2 16:55:02 2013
@@ -115,7 +115,7 @@ CommandObjectMultiword::Execute(const ch
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
- GenerateHelpText (result);
+ this->CommandObject::GenerateHelpText (result);
}
else
{
@@ -125,7 +125,7 @@ CommandObjectMultiword::Execute(const ch
{
if (::strcasecmp (sub_command, "help") == 0)
{
- GenerateHelpText (result);
+ this->CommandObject::GenerateHelpText (result);
}
else if (!m_subcommand_dict.empty())
{
@@ -181,12 +181,11 @@ CommandObjectMultiword::Execute(const ch
}
void
-CommandObjectMultiword::GenerateHelpText (CommandReturnObject &result)
+CommandObjectMultiword::GenerateHelpText (Stream &output_stream)
{
// First time through here, generate the help text for the object and
// push it to the return result object as well
- Stream &output_stream = result.GetOutputStream();
output_stream.PutCString ("The following subcommands are supported:\n\n");
CommandMap::iterator pos;
@@ -203,14 +202,14 @@ CommandObjectMultiword::GenerateHelpText
{
std::string help_text (pos->second->GetHelp());
help_text.append (" This command takes 'raw' input (no need to quote stuff).");
- m_interpreter.OutputFormattedHelpText (result.GetOutputStream(),
+ m_interpreter.OutputFormattedHelpText (output_stream,
indented_command.c_str(),
"--",
help_text.c_str(),
max_len);
}
else
- m_interpreter.OutputFormattedHelpText (result.GetOutputStream(),
+ m_interpreter.OutputFormattedHelpText (output_stream,
indented_command.c_str(),
"--",
pos->second->GetHelp(),
@@ -218,8 +217,6 @@ CommandObjectMultiword::GenerateHelpText
}
output_stream.PutCString ("\nFor more help on any particular subcommand, type 'help <command> <subcommand>'.\n");
-
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
int
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectSyntax.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectSyntax.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectSyntax.cpp Tue Jul 2 16:55:02 2013
@@ -65,7 +65,7 @@ CommandObjectSyntax::DoExecute (Args& co
{
cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
bool all_okay = true;
- for (int i = 1; i < argc; ++i)
+ for (size_t i = 1; i < argc; ++i)
{
std::string sub_command = command.GetArgumentAtIndex (i);
if (!cmd_obj->IsMultiwordObject())
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectTarget.cpp Tue Jul 2 16:55:02 2013
@@ -1508,10 +1508,10 @@ DumpModuleSymtab (CommandInterpreter &in
{
if (module)
{
- ObjectFile *objfile = module->GetObjectFile ();
- if (objfile)
+ SymbolVendor *sym_vendor = module->GetSymbolVendor ();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
symtab->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), sort_order);
}
@@ -1523,19 +1523,15 @@ DumpModuleSections (CommandInterpreter &
{
if (module)
{
- ObjectFile *objfile = module->GetObjectFile ();
- if (objfile)
+ SectionList *section_list = module->GetUnifiedSectionList();
+ if (section_list)
{
- SectionList *section_list = objfile->GetSectionList();
- if (section_list)
- {
- strm.Printf ("Sections for '%s' (%s):\n",
- module->GetSpecificationDescription().c_str(),
- module->GetArchitecture().GetArchitectureName());
- strm.IndentMore();
- section_list->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), true, UINT32_MAX);
- strm.IndentLess();
- }
+ strm.Printf ("Sections for '%s' (%s):\n",
+ module->GetSpecificationDescription().c_str(),
+ module->GetArchitecture().GetArchitectureName());
+ strm.IndentMore();
+ section_list->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), true, UINT32_MAX);
+ strm.IndentLess();
}
}
}
@@ -1639,10 +1635,10 @@ LookupSymbolInModule (CommandInterpreter
{
SymbolContext sc;
- ObjectFile *objfile = module->GetObjectFile ();
- if (objfile)
+ SymbolVendor *sym_vendor = module->GetSymbolVendor ();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
uint32_t i;
@@ -2500,7 +2496,7 @@ public:
CommandObjectTargetModulesDumpLineTable (CommandInterpreter &interpreter) :
CommandObjectTargetModulesSourceFileAutoComplete (interpreter,
"target modules dump line-table",
- "Dump the debug symbol file for one or more target modules.",
+ "Dump the line table for one or more compilation units.",
NULL,
eFlagRequiresTarget)
{
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectType.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectType.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectType.cpp Tue Jul 2 16:55:02 2013
@@ -1873,7 +1873,7 @@ private:
return true;
// if we have a regex and this category does not match it, just skip it
- if(param->cate_regex != NULL && param->cate_regex->Execute(cate_name) == false)
+ if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false)
return true;
result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n",
@@ -1897,7 +1897,7 @@ private:
RegularExpression* regex,
CommandReturnObject *result)
{
- if (regex == NULL || regex->Execute(type))
+ if (regex == NULL || strcmp(type,regex->GetText()) == 0 || regex->Execute(type))
result->GetOutputStream().Printf ("%s: %s\n", type, entry->GetDescription().c_str());
return true;
}
@@ -2208,7 +2208,7 @@ private:
const char* cate_name = cate->GetName();
- if (regex == NULL || regex->Execute(cate_name))
+ if (regex == NULL || strcmp(cate_name, regex->GetText()) == 0 || regex->Execute(cate_name))
result->GetOutputStream().Printf("Category %s is%s enabled\n",
cate_name,
(cate->IsEnabled() ? "" : " not"));
@@ -2421,7 +2421,7 @@ private:
return true;
// if we have a regex and this category does not match it, just skip it
- if(param->cate_regex != NULL && param->cate_regex->Execute(cate_name) == false)
+ if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false)
return true;
result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n",
@@ -2635,7 +2635,7 @@ private:
return true;
// if we have a regex and this category does not match it, just skip it
- if(param->cate_regex != NULL && param->cate_regex->Execute(cate_name) == false)
+ if(param->cate_regex != NULL && strcmp(cate_name,param->cate_regex->GetText()) != 0 && param->cate_regex->Execute(cate_name) == false)
return true;
result->GetOutputStream().Printf("-----------------------\nCategory: %s (%s)\n-----------------------\n",
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp Tue Jul 2 16:55:02 2013
@@ -88,10 +88,22 @@ WithRSAIndex(llvm::StringRef &Arg)
// Return true if wp_ids is successfully populated with the watch ids.
// False otherwise.
bool
-CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids)
+CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Target *target, Args &args, std::vector<uint32_t> &wp_ids)
{
// Pre-condition: args.GetArgumentCount() > 0.
- assert(args.GetArgumentCount() > 0);
+ if (args.GetArgumentCount() == 0)
+ {
+ if (target == NULL)
+ return false;
+ WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
+ if (watch_sp)
+ {
+ wp_ids.push_back(watch_sp->GetID());
+ return true;
+ }
+ else
+ return false;
+ }
llvm::StringRef Minus("-");
std::vector<llvm::StringRef> StrRefArgs;
@@ -292,7 +304,7 @@ protected:
{
// Particular watchpoints selected; enable them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -392,7 +404,7 @@ protected:
{
// Particular watchpoints selected; enable them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -477,7 +489,7 @@ protected:
{
// Particular watchpoints selected; disable them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -560,7 +572,7 @@ protected:
{
// Particular watchpoints selected; delete them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -701,7 +713,7 @@ protected:
{
// Particular watchpoints selected; ignore them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -858,7 +870,7 @@ protected:
{
// Particular watchpoints selected; set condition on them.
std::vector<uint32_t> wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -1066,6 +1078,7 @@ protected:
// Now it's time to create the watchpoint.
uint32_t watch_type = m_option_watchpoint.watch_type;
+
error.Clear();
Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
if (wp)
@@ -1221,16 +1234,13 @@ protected:
// If no argument is present, issue an error message. There's no way to set a watchpoint.
if (command.GetArgumentCount() == 0)
{
- result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the addres to watch for\n");
+ result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the address to watch for\n");
result.SetStatus(eReturnStatusFailed);
return false;
}
- bool with_dash_w = m_option_watchpoint.watch_type_specified;
- bool with_dash_x = (m_option_watchpoint.watch_size != 0);
-
// If no '-w' is specified, default to '-w write'.
- if (!with_dash_w)
+ if (!m_option_watchpoint.watch_type_specified)
{
m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite;
}
@@ -1271,8 +1281,11 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
- size = with_dash_x ? m_option_watchpoint.watch_size
- : target->GetArchitecture().GetAddressByteSize();
+
+ if (m_option_watchpoint.watch_size != 0)
+ size = m_option_watchpoint.watch_size;
+ else
+ size = target->GetArchitecture().GetAddressByteSize();
// Now it's time to create the watchpoint.
uint32_t watch_type = m_option_watchpoint.watch_type;
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.h (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.h Tue Jul 2 16:55:02 2013
@@ -34,7 +34,7 @@ public:
~CommandObjectMultiwordWatchpoint ();
static bool
- VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids);
+ VerifyWatchpointIDs(Target *target, Args &args, std::vector<uint32_t> &wp_ids);
};
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpointCommand.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpointCommand.cpp Tue Jul 2 16:55:02 2013
@@ -512,7 +512,7 @@ protected:
}
std::vector<uint32_t> valid_wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -678,7 +678,7 @@ protected:
}
std::vector<uint32_t> valid_wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
@@ -770,7 +770,7 @@ protected:
}
std::vector<uint32_t> valid_wp_ids;
- if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
+ if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
{
result.AppendError("Invalid watchpoints specification.");
result.SetStatus(eReturnStatusFailed);
Modified: lldb/branches/lldb-platform-work/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Address.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Address.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Address.cpp Tue Jul 2 16:55:02 2013
@@ -18,6 +18,7 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Symbol/SymbolVendor.h"
#include "llvm/ADT/Triple.h"
@@ -456,10 +457,10 @@ Address::Dump (Stream *s, ExecutionConte
case eSectionTypeData:
if (module_sp)
{
- ObjectFile *objfile = module_sp->GetObjectFile();
- if (objfile)
+ SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
const addr_t file_Addr = GetFileAddress();
@@ -1023,7 +1024,11 @@ Address::GetAddressClass () const
{
ObjectFile *obj_file = module_sp->GetObjectFile();
if (obj_file)
+ {
+ // Give the symbol vendor a chance to add to the unified section list.
+ module_sp->GetSymbolVendor();
return obj_file->GetAddressClass (GetFileAddress());
+ }
}
return eAddressClassUnknown;
}
Modified: lldb/branches/lldb-platform-work/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Communication.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Communication.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Communication.cpp Tue Jul 2 16:55:02 2013
@@ -390,8 +390,6 @@ Communication::ReadThread (void *p)
// Let clients know that this thread is exiting
comm->BroadcastEvent (eBroadcastBitReadThreadDidExit);
- comm->m_read_thread_enabled = false;
- comm->m_read_thread = LLDB_INVALID_HOST_THREAD;
return NULL;
}
Modified: lldb/branches/lldb-platform-work/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ConnectionFileDescriptor.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ConnectionFileDescriptor.cpp Tue Jul 2 16:55:02 2013
@@ -25,7 +25,7 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <sys/termios.h>
+#include <termios.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
Modified: lldb/branches/lldb-platform-work/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/DataExtractor.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/DataExtractor.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/DataExtractor.cpp Tue Jul 2 16:55:02 2013
@@ -15,11 +15,15 @@
#include <sstream>
#include <string>
+#include "clang/AST/ASTContext.h"
+
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MathExtras.h"
+
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/DataBuffer.h"
@@ -30,6 +34,7 @@
#include "lldb/Core/UUID.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/Target.h"
@@ -733,7 +738,7 @@ DataExtractor::GetFloat (offset_t *offse
{
const uint8_t *src_data = (const uint8_t *)src;
uint8_t *dst_data = (uint8_t *)&val;
- for (int i=0; i<sizeof(float_type); ++i)
+ for (size_t i=0; i<sizeof(float_type); ++i)
dst_data[sizeof(float_type) - 1 - i] = src_data[i];
}
else
@@ -757,7 +762,7 @@ DataExtractor::GetDouble (offset_t *offs
{
const uint8_t *src_data = (const uint8_t *)src;
uint8_t *dst_data = (uint8_t *)&val;
- for (int i=0; i<sizeof(float_type); ++i)
+ for (size_t i=0; i<sizeof(float_type); ++i)
dst_data[sizeof(float_type) - 1 - i] = src_data[i];
}
else
@@ -782,7 +787,7 @@ DataExtractor::GetLongDouble (offset_t *
{
const uint8_t *src_data = (const uint8_t *)src;
uint8_t *dst_data = (uint8_t *)&val;
- for (int i=0; i<sizeof(float_type); ++i)
+ for (size_t i=0; i<sizeof(float_type); ++i)
dst_data[sizeof(float_type) - 1 - i] = src_data[i];
}
else
@@ -1234,8 +1239,8 @@ DataExtractor::Skip_LEB128 (offset_t *of
return bytes_consumed;
}
-static lldb::offset_t
-DumpAPInt (Stream *s, const DataExtractor &data, lldb::offset_t offset, lldb::offset_t byte_size, bool is_signed, unsigned radix)
+static bool
+GetAPInt (const DataExtractor &data, lldb::offset_t *offset_ptr, lldb::offset_t byte_size, llvm::APInt &result)
{
llvm::SmallVector<uint64_t, 2> uint64_array;
lldb::offset_t bytes_left = byte_size;
@@ -1247,20 +1252,22 @@ DumpAPInt (Stream *s, const DataExtracto
{
if (bytes_left >= 8)
{
- u64 = data.GetU64(&offset);
+ u64 = data.GetU64(offset_ptr);
bytes_left -= 8;
}
else
{
- u64 = data.GetMaxU64(&offset, (uint32_t)bytes_left);
+ u64 = data.GetMaxU64(offset_ptr, (uint32_t)bytes_left);
bytes_left = 0;
- }
+ }
uint64_array.push_back(u64);
}
+ result = llvm::APInt(byte_size * 8, llvm::ArrayRef<uint64_t>(uint64_array));
+ return true;
}
else if (byte_order == lldb::eByteOrderBig)
{
- lldb::offset_t be_offset = offset + byte_size;
+ lldb::offset_t be_offset = *offset_ptr + byte_size;
lldb::offset_t temp_offset;
while (bytes_left > 0)
{
@@ -1277,31 +1284,55 @@ DumpAPInt (Stream *s, const DataExtracto
temp_offset = be_offset;
u64 = data.GetMaxU64(&temp_offset, (uint32_t)bytes_left);
bytes_left = 0;
- }
+ }
uint64_array.push_back(u64);
}
+ *offset_ptr += byte_size;
+ result = llvm::APInt(byte_size * 8, llvm::ArrayRef<uint64_t>(uint64_array));
+ return true;
}
- else
- return offset;
+ return false;
+}
- llvm::APInt apint (byte_size * 8, llvm::ArrayRef<uint64_t>(uint64_array));
-
- std::string apint_str(apint.toString(radix, is_signed));
- switch (radix)
+static lldb::offset_t
+DumpAPInt (Stream *s, const DataExtractor &data, lldb::offset_t offset, lldb::offset_t byte_size, bool is_signed, unsigned radix)
+{
+ llvm::APInt apint;
+ if (GetAPInt (data, &offset, byte_size, apint))
{
- case 2:
- s->Write ("0b", 2);
- break;
- case 8:
- s->Write ("0", 1);
- break;
- case 10:
- break;
+ std::string apint_str(apint.toString(radix, is_signed));
+ switch (radix)
+ {
+ case 2:
+ s->Write ("0b", 2);
+ break;
+ case 8:
+ s->Write ("0", 1);
+ break;
+ case 10:
+ break;
+ }
+ s->Write(apint_str.c_str(), apint_str.size());
}
- s->Write(apint_str.c_str(), apint_str.size());
return offset;
}
+static float half2float (uint16_t half)
+{
+ union{ float f; uint32_t u;}u;
+ int32_t v = (int16_t) half;
+
+ if( 0 == (v & 0x7c00))
+ {
+ u.u = v & 0x80007FFFU;
+ return u.f * 0x1.0p125f;
+ }
+
+ v <<= 13;
+ u.u = v | 0x70000000U;
+ return u.f * 0x1.0p-112f;
+}
+
lldb::offset_t
DataExtractor::Dump (Stream *s,
offset_t start_offset,
@@ -1686,29 +1717,117 @@ DataExtractor::Dump (Stream *s,
case eFormatFloat:
{
- std::ostringstream ss;
- if (item_byte_size == sizeof(float))
- {
- ss.precision(std::numeric_limits<float>::digits10);
- ss << GetFloat(&offset);
- }
- else if (item_byte_size == sizeof(double))
+ TargetSP target_sp;
+ bool used_apfloat = false;
+ if (exe_scope)
+ target_sp = exe_scope->CalculateTarget();
+ if (target_sp)
{
- ss.precision(std::numeric_limits<double>::digits10);
- ss << GetDouble(&offset);
- }
- else if (item_byte_size == sizeof(long double))
- {
- ss.precision(std::numeric_limits<long double>::digits10);
- ss << GetLongDouble(&offset);
+ ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
+ if (clang_ast)
+ {
+ clang::ASTContext *ast = clang_ast->getASTContext();
+ if (ast)
+ {
+ llvm::SmallVector<char, 256> sv;
+ // Show full precision when printing float values
+ const unsigned format_precision = 0;
+ const unsigned format_max_padding = 100;
+ size_t item_bit_size = item_byte_size * 8;
+
+ if (item_bit_size == ast->getTypeSize(ast->FloatTy))
+ {
+ llvm::APInt apint(item_bit_size, this->GetMaxU64(&offset, item_byte_size));
+ llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->FloatTy), apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
+ }
+ else if (item_bit_size == ast->getTypeSize(ast->DoubleTy))
+ {
+ llvm::APInt apint;
+ if (GetAPInt (*this, &offset, item_byte_size, apint))
+ {
+ llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->DoubleTy), apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
+ }
+ }
+ else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy))
+ {
+ llvm::APInt apint;
+ switch (target_sp->GetArchitecture().GetCore())
+ {
+ case ArchSpec::eCore_x86_32_i386:
+ case ArchSpec::eCore_x86_32_i486:
+ case ArchSpec::eCore_x86_32_i486sx:
+ case ArchSpec::eCore_x86_64_x86_64:
+ // clang will assert when contructing the apfloat if we use a 16 byte integer value
+ if (GetAPInt (*this, &offset, 10, apint))
+ {
+ llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
+ }
+ break;
+
+ default:
+ if (GetAPInt (*this, &offset, item_byte_size, apint))
+ {
+ llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
+ }
+ break;
+ }
+ }
+ else if (item_bit_size == ast->getTypeSize(ast->HalfTy))
+ {
+ llvm::APInt apint(item_bit_size, this->GetU16(&offset));
+ llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->HalfTy), apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
+ }
+
+ if (!sv.empty())
+ {
+ s->Printf("%*.*s", (int)sv.size(), (int)sv.size(), sv.data());
+ used_apfloat = true;
+ }
+ }
+ }
}
- else
+
+ if (!used_apfloat)
{
- s->Printf("error: unsupported byte size (%zu) for float format", item_byte_size);
- return offset;
+ std::ostringstream ss;
+ if (item_byte_size == sizeof(float) || item_byte_size == 2)
+ {
+ float f;
+ if (item_byte_size == 2)
+ {
+ uint16_t half = this->GetU16(&offset);
+ f = half2float(half);
+ }
+ else
+ {
+ f = GetFloat (&offset);
+ }
+ ss.precision(std::numeric_limits<float>::digits10);
+ ss << f;
+ }
+ else if (item_byte_size == sizeof(double))
+ {
+ ss.precision(std::numeric_limits<double>::digits10);
+ ss << GetDouble(&offset);
+ }
+ else if (item_byte_size == sizeof(long double))
+ {
+ ss.precision(std::numeric_limits<long double>::digits10);
+ ss << GetLongDouble(&offset);
+ }
+ else
+ {
+ s->Printf("error: unsupported byte size (%zu) for float format", item_byte_size);
+ return offset;
+ }
+ ss.flush();
+ s->Printf("%s", ss.str().c_str());
}
- ss.flush();
- s->Printf("%s", ss.str().c_str());
}
break;
Modified: lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Debugger.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Debugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Debugger.cpp Tue Jul 2 16:55:02 2013
@@ -1204,13 +1204,13 @@ ScanFormatDescriptor (const char* var_na
*var_name_final = *percent_position;
std::string format_name(*var_name_final+1, var_name_end-*var_name_final-1);
if (log)
- log->Printf("ScanFormatDescriptor] parsing %s as a format descriptor", format_name.c_str());
+ log->Printf("[ScanFormatDescriptor] parsing %s as a format descriptor", format_name.c_str());
if ( !FormatManager::GetFormatFromCString(format_name.c_str(),
true,
*custom_format) )
{
if (log)
- log->Printf("ScanFormatDescriptor] %s is an unknown format", format_name.c_str());
+ log->Printf("[ScanFormatDescriptor] %s is an unknown format", format_name.c_str());
switch (format_name.front())
{
@@ -1232,6 +1232,12 @@ ScanFormatDescriptor (const char* var_na
case 'T': // if this is a 'T', print the type
*val_obj_display = ValueObject::eValueObjectRepresentationStyleType;
break;
+ case 'N': // if this is a 'N', print the name
+ *val_obj_display = ValueObject::eValueObjectRepresentationStyleName;
+ break;
+ case '>': // if this is a '>', print the name
+ *val_obj_display = ValueObject::eValueObjectRepresentationStyleExpressionPath;
+ break;
default:
if (log)
log->Printf("ScanFormatDescriptor] %s is an error, leaving the previous value alone", format_name.c_str());
@@ -1242,12 +1248,12 @@ ScanFormatDescriptor (const char* var_na
else
{
if (log)
- log->Printf("ScanFormatDescriptor] will display value for this VO");
+ log->Printf("[ScanFormatDescriptor] will display value for this VO");
*val_obj_display = ValueObject::eValueObjectRepresentationStyleValue;
}
}
if (log)
- log->Printf("ScanFormatDescriptor] final format description outcome: custom_format = %d, val_obj_display = %d",
+ log->Printf("[ScanFormatDescriptor] final format description outcome: custom_format = %d, val_obj_display = %d",
*custom_format,
*val_obj_display);
return true;
@@ -1469,11 +1475,10 @@ FormatPromptRecurse
{
do_deref_pointer = true;
var_name_begin++;
+ if (log)
+ log->Printf("[Debugger::FormatPrompt] found a deref, new string is: %s",var_name_begin);
}
- if (log)
- log->Printf("[Debugger::FormatPrompt] initial string: %s",var_name_begin);
-
if (*var_name_begin == 's')
{
if (!valobj->IsSynthetic())
@@ -1481,17 +1486,16 @@ FormatPromptRecurse
if (!valobj)
break;
var_name_begin++;
+ if (log)
+ log->Printf("[Debugger::FormatPrompt] found a synthetic, new string is: %s",var_name_begin);
}
- if (log)
- log->Printf("[Debugger::FormatPrompt] initial string: %s",var_name_begin);
-
// should be a 'v' by now
if (*var_name_begin != 'v')
break;
if (log)
- log->Printf("[Debugger::FormatPrompt] initial string: %s",var_name_begin);
+ log->Printf("[Debugger::FormatPrompt] string I am working with: %s",var_name_begin);
ValueObject::ExpressionPathAftermath what_next = (do_deref_pointer ?
ValueObject::eExpressionPathAftermathDereference : ValueObject::eExpressionPathAftermathNothing);
@@ -1803,6 +1807,24 @@ FormatPromptRecurse
}
}
}
+ else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+ {
+ var_name_begin += ::strlen("script:");
+ std::string script_name(var_name_begin,var_name_end);
+ ScriptInterpreter* script_interpreter = process->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (script_interpreter)
+ {
+ std::string script_output;
+ Error script_error;
+ if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), process,script_output,script_error) && script_error.Success())
+ {
+ s.Printf("%s", script_output.c_str());
+ var_success = true;
+ }
+ else
+ s.Printf("<error: %s>",script_error.AsCString());
+ }
+ }
}
}
}
@@ -1872,6 +1894,24 @@ FormatPromptRecurse
}
}
}
+ else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+ {
+ var_name_begin += ::strlen("script:");
+ std::string script_name(var_name_begin,var_name_end);
+ ScriptInterpreter* script_interpreter = thread->GetProcess()->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (script_interpreter)
+ {
+ std::string script_output;
+ Error script_error;
+ if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), thread,script_output,script_error) && script_error.Success())
+ {
+ s.Printf("%s", script_output.c_str());
+ var_success = true;
+ }
+ else
+ s.Printf("<error: %s>",script_error.AsCString());
+ }
+ }
}
}
}
@@ -1913,6 +1953,24 @@ FormatPromptRecurse
var_success = true;
}
}
+ else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+ {
+ var_name_begin += ::strlen("script:");
+ std::string script_name(var_name_begin,var_name_end);
+ ScriptInterpreter* script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (script_interpreter)
+ {
+ std::string script_output;
+ Error script_error;
+ if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), target,script_output,script_error) && script_error.Success())
+ {
+ s.Printf("%s", script_output.c_str());
+ var_success = true;
+ }
+ else
+ s.Printf("<error: %s>",script_error.AsCString());
+ }
+ }
}
}
break;
@@ -2020,6 +2078,24 @@ FormatPromptRecurse
}
}
}
+ else if (::strncmp(var_name_begin, "script:", strlen("script:")) == 0)
+ {
+ var_name_begin += ::strlen("script:");
+ std::string script_name(var_name_begin,var_name_end);
+ ScriptInterpreter* script_interpreter = frame->GetThread()->GetProcess()->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (script_interpreter)
+ {
+ std::string script_output;
+ Error script_error;
+ if (script_interpreter->RunScriptFormatKeyword(script_name.c_str(), frame,script_output,script_error) && script_error.Success())
+ {
+ s.Printf("%s", script_output.c_str());
+ var_success = true;
+ }
+ else
+ s.Printf("<error: %s>",script_error.AsCString());
+ }
+ }
}
}
}
Modified: lldb/branches/lldb-platform-work/source/Core/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Error.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Error.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Error.cpp Tue Jul 2 16:55:02 2013
@@ -387,3 +387,13 @@ Error::Success() const
{
return m_code == 0;
}
+
+bool
+Error::WasInterrupted() const
+{
+ if (m_type == eErrorTypePOSIX && m_code == EINTR)
+ return true;
+ else
+ return false;
+}
+
Modified: lldb/branches/lldb-platform-work/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Listener.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Listener.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Listener.cpp Tue Jul 2 16:55:02 2013
@@ -44,7 +44,7 @@ Listener::~Listener()
size_t num_managers = m_broadcaster_managers.size();
- for (int i = 0; i < num_managers; i++)
+ for (size_t i = 0; i < num_managers; i++)
m_broadcaster_managers[i]->RemoveListener(*this);
if (log)
Modified: lldb/branches/lldb-platform-work/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Module.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Module.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Module.cpp Tue Jul 2 16:55:02 2013
@@ -33,6 +33,7 @@
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Symbol/SymbolFile.h"
using namespace lldb;
using namespace lldb_private;
@@ -244,6 +245,7 @@ Module::~Module()
// function calls back into this module object. The ordering is important
// here because symbol files can require the module object file. So we tear
// down the symbol file first, then the object file.
+ m_unified_sections_ap.reset();
m_symfile_ap.reset();
m_objfile_sp.reset();
}
@@ -480,10 +482,10 @@ Module::ResolveSymbolContextForAddress (
// Resolve the symbol if requested, but don't re-look it up if we've already found it.
if (resolve_scope & eSymbolContextSymbol && !(resolved_flags & eSymbolContextSymbol))
{
- ObjectFile* ofile = GetObjectFile();
- if (ofile)
+ SymbolVendor* sym_vendor = GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = ofile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
if (so_addr.IsSectionOffset())
@@ -613,6 +615,7 @@ Module::FindFunctions (const ConstString
match_name_after_lookup);
if (symbols)
+ {
symbols->FindFunctions(lookup_name,
namespace_decl,
lookup_name_type_mask,
@@ -620,13 +623,10 @@ Module::FindFunctions (const ConstString
append,
sc_list);
- // Now check our symbol table for symbols that are code symbols if requested
- if (include_symbols)
- {
- ObjectFile *objfile = GetObjectFile();
- if (objfile)
+ // Now check our symbol table for symbols that are code symbols if requested
+ if (include_symbols)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = symbols->GetSymtab();
if (symtab)
symtab->FindFunctionSymbols(lookup_name, lookup_name_type_mask, sc_list);
}
@@ -652,20 +652,17 @@ Module::FindFunctions (const ConstString
++i;
}
}
-
}
else
{
if (symbols)
+ {
symbols->FindFunctions(name, namespace_decl, name_type_mask, include_inlines, append, sc_list);
- // Now check our symbol table for symbols that are code symbols if requested
- if (include_symbols)
- {
- ObjectFile *objfile = GetObjectFile();
- if (objfile)
+ // Now check our symbol table for symbols that are code symbols if requested
+ if (include_symbols)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = symbols->GetSymtab();
if (symtab)
symtab->FindFunctionSymbols(name, name_type_mask, sc_list);
}
@@ -689,14 +686,13 @@ Module::FindFunctions (const RegularExpr
SymbolVendor *symbols = GetSymbolVendor ();
if (symbols)
- symbols->FindFunctions(regex, include_inlines, append, sc_list);
- // Now check our symbol table for symbols that are code symbols if requested
- if (include_symbols)
{
- ObjectFile *objfile = GetObjectFile();
- if (objfile)
+ symbols->FindFunctions(regex, include_inlines, append, sc_list);
+
+ // Now check our symbol table for symbols that are code symbols if requested
+ if (include_symbols)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = symbols->GetSymtab();
if (symtab)
{
std::vector<uint32_t> symbol_indexes;
@@ -704,15 +700,50 @@ Module::FindFunctions (const RegularExpr
const size_t num_matches = symbol_indexes.size();
if (num_matches)
{
- const bool merge_symbol_into_function = true;
SymbolContext sc(this);
- for (size_t i=0; i<num_matches; i++)
+ const size_t end_functions_added_index = sc_list.GetSize();
+ size_t num_functions_added_to_sc_list = end_functions_added_index - start_size;
+ if (num_functions_added_to_sc_list == 0)
+ {
+ // No functions were added, just symbols, so we can just append them
+ for (size_t i=0; i<num_matches; ++i)
+ {
+ sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
+ SymbolType sym_type = sc.symbol->GetType();
+ if (sc.symbol && (sym_type == eSymbolTypeCode ||
+ sym_type == eSymbolTypeResolver))
+ sc_list.Append(sc);
+ }
+ }
+ else
{
- sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
- SymbolType sym_type = sc.symbol->GetType();
- if (sc.symbol && (sym_type == eSymbolTypeCode ||
- sym_type == eSymbolTypeResolver))
- sc_list.AppendIfUnique (sc, merge_symbol_into_function);
+ typedef std::map<lldb::addr_t, uint32_t> FileAddrToIndexMap;
+ FileAddrToIndexMap file_addr_to_index;
+ for (size_t i=start_size; i<end_functions_added_index; ++i)
+ {
+ const SymbolContext &sc = sc_list[i];
+ if (sc.block)
+ continue;
+ file_addr_to_index[sc.function->GetAddressRange().GetBaseAddress().GetFileAddress()] = i;
+ }
+
+ FileAddrToIndexMap::const_iterator end = file_addr_to_index.end();
+ // Functions were added so we need to merge symbols into any
+ // existing function symbol contexts
+ for (size_t i=start_size; i<num_matches; ++i)
+ {
+ sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
+ SymbolType sym_type = sc.symbol->GetType();
+ if (sc.symbol && (sym_type == eSymbolTypeCode ||
+ sym_type == eSymbolTypeResolver))
+ {
+ FileAddrToIndexMap::const_iterator pos = file_addr_to_index.find(sc.symbol->GetAddress().GetFileAddress());
+ if (pos == end)
+ sc_list.Append(sc);
+ else
+ sc_list[pos->second].symbol = sc.symbol;
+ }
+ }
}
}
}
@@ -1032,13 +1063,12 @@ Module::Dump(Stream *s)
m_object_name ? ")" : "");
s->IndentMore();
+
ObjectFile *objfile = GetObjectFile ();
-
if (objfile)
objfile->Dump(s);
SymbolVendor *symbols = GetSymbolVendor ();
-
if (symbols)
symbols->Dump(s);
@@ -1080,15 +1110,29 @@ Module::GetObjectFile()
data_offset);
if (m_objfile_sp)
{
- // Once we get the object file, update our module with the object file's
- // architecture since it might differ in vendor/os if some parts were
- // unknown.
+ // Once we get the object file, update our module with the object file's
+ // architecture since it might differ in vendor/os if some parts were
+ // unknown.
m_objfile_sp->GetArchitecture (m_arch);
+
+ // Populate m_unified_sections_ap with sections from objfile.
+ SectionList *section_list = m_objfile_sp->GetSectionList();
+ if (section_list)
+ {
+ m_unified_sections_ap.reset(new SectionList());
+ section_list->Copy (m_unified_sections_ap.get());
+ m_unified_sections_ap->Finalize();
+ }
}
}
return m_objfile_sp.get();
}
+SectionList *
+Module::GetUnifiedSectionList()
+{
+ return m_unified_sections_ap.get();
+}
const Symbol *
Module::FindFirstSymbolWithNameAndType (const ConstString &name, SymbolType symbol_type)
@@ -1097,10 +1141,10 @@ Module::FindFirstSymbolWithNameAndType (
"Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)",
name.AsCString(),
symbol_type);
- ObjectFile *objfile = GetObjectFile();
- if (objfile)
+ SymbolVendor* sym_vendor = GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
return symtab->FindFirstSymbolWithNameAndType (name, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny);
}
@@ -1135,10 +1179,10 @@ Module::FindFunctionSymbols (const Const
"Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)",
name.AsCString(),
name_type_mask);
- ObjectFile *objfile = GetObjectFile ();
- if (objfile)
+ SymbolVendor* sym_vendor = GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
return symtab->FindFunctionSymbols (name, name_type_mask, sc_list);
}
@@ -1157,10 +1201,10 @@ Module::FindSymbolsWithNameAndType (cons
name.AsCString(),
symbol_type);
const size_t initial_size = sc_list.GetSize();
- ObjectFile *objfile = GetObjectFile ();
- if (objfile)
+ SymbolVendor* sym_vendor = GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
std::vector<uint32_t> symbol_indexes;
@@ -1182,10 +1226,10 @@ Module::FindSymbolsMatchingRegExAndType
regex.GetText(),
symbol_type);
const size_t initial_size = sc_list.GetSize();
- ObjectFile *objfile = GetObjectFile ();
- if (objfile)
+ SymbolVendor* sym_vendor = GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
std::vector<uint32_t> symbol_indexes;
@@ -1199,12 +1243,35 @@ Module::FindSymbolsMatchingRegExAndType
void
Module::SetSymbolFileFileSpec (const FileSpec &file)
{
+ // Remove any sections in the unified section list that come from the current symbol vendor.
+ if (m_symfile_ap)
+ {
+ SectionList *section_list = GetUnifiedSectionList();
+ SymbolFile *symbol_file = m_symfile_ap->GetSymbolFile();
+ if (section_list && symbol_file)
+ {
+ ObjectFile *obj_file = symbol_file->GetObjectFile();
+ if (obj_file)
+ {
+ size_t num_sections = section_list->GetNumSections (0);
+ for (size_t idx = num_sections; idx > 0; --idx)
+ {
+ lldb::SectionSP section_sp (section_list->GetSectionAtIndex (idx - 1));
+ if (section_sp->GetObjectFile() == obj_file)
+ {
+ m_unified_sections_ap->DeleteSection (idx - 1);
+ }
+ }
+ m_unified_sections_ap->Finalize();
+ }
+ }
+ }
+
m_symfile_spec = file;
m_symfile_ap.reset();
m_did_load_symbol_vendor = false;
}
-
bool
Module::IsExecutable ()
{
@@ -1281,15 +1348,22 @@ Module::LoadScriptingResourceInTarget (T
if (shoud_load == eLoadScriptFromSymFileWarn)
{
if (feedback_stream)
- feedback_stream->Printf("warning: '%s' contains a debug script. To run this script in this debug session:\n\n command script import \"%s\"\n\nTo run all discovered debug scripts in this session:\n\n settings set target.load-script-from-symbol-file true\n"
- ,GetFileSpec().GetFileNameStrippingExtension().GetCString(),scripting_fspec.GetPath().c_str());
+ feedback_stream->Printf("warning: '%s' contains a debug script. To run this script in "
+ "this debug session:\n\n command script import \"%s\"\n\n"
+ "To run all discovered debug scripts in this session:\n\n"
+ " settings set target.load-script-from-symbol-file true\n",
+ GetFileSpec().GetFileNameStrippingExtension().GetCString(),
+ scripting_fspec.GetPath().c_str());
return false;
}
StreamString scripting_stream;
scripting_fspec.Dump(&scripting_stream);
const bool can_reload = true;
const bool init_lldb_globals = false;
- bool did_load = script_interpreter->LoadScriptingModule(scripting_stream.GetData(), can_reload, init_lldb_globals, error);
+ bool did_load = script_interpreter->LoadScriptingModule(scripting_stream.GetData(),
+ can_reload,
+ init_lldb_globals,
+ error);
if (!did_load)
return false;
}
Modified: lldb/branches/lldb-platform-work/source/Core/SearchFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/SearchFilter.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/SearchFilter.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/SearchFilter.cpp Tue Jul 2 16:55:02 2013
@@ -688,7 +688,20 @@ SearchFilterByModuleListAndCU::CompUnitP
bool
SearchFilterByModuleListAndCU::CompUnitPasses (CompileUnit &compUnit)
{
- return m_cu_spec_list.FindFileIndex(0, compUnit, false) != UINT32_MAX;
+ bool in_cu_list = m_cu_spec_list.FindFileIndex(0, compUnit, false) != UINT32_MAX;
+ if (in_cu_list)
+ {
+ ModuleSP module_sp(compUnit.GetModule());
+ if (module_sp)
+ {
+ bool module_passes = SearchFilterByModuleList::ModulePasses(module_sp);
+ return module_passes;
+ }
+ else
+ return true;
+ }
+ else
+ return false;
}
void
Modified: lldb/branches/lldb-platform-work/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Section.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Section.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Section.cpp Tue Jul 2 16:55:02 2013
@@ -16,6 +16,7 @@ using namespace lldb;
using namespace lldb_private;
Section::Section (const ModuleSP &module_sp,
+ ObjectFile *obj_file,
user_id_t sect_id,
const ConstString &name,
SectionType sect_type,
@@ -27,9 +28,10 @@ Section::Section (const ModuleSP &module
ModuleChild (module_sp),
UserID (sect_id),
Flags (flags),
+ m_obj_file (obj_file),
+ m_type (sect_type),
m_parent_wp (),
m_name (name),
- m_type (sect_type),
m_file_addr (file_addr),
m_byte_size (byte_size),
m_file_offset (file_offset),
@@ -45,6 +47,7 @@ Section::Section (const ModuleSP &module
Section::Section (const lldb::SectionSP &parent_section_sp,
const ModuleSP &module_sp,
+ ObjectFile *obj_file,
user_id_t sect_id,
const ConstString &name,
SectionType sect_type,
@@ -56,9 +59,10 @@ Section::Section (const lldb::SectionSP
ModuleChild (module_sp),
UserID (sect_id),
Flags (flags),
+ m_obj_file (obj_file),
+ m_type (sect_type),
m_parent_wp (),
m_name (name),
- m_type (sect_type),
m_file_addr (file_addr),
m_byte_size (byte_size),
m_file_offset (file_offset),
@@ -242,13 +246,16 @@ Section::DumpName (Stream *s) const
else
{
// The top most section prints the module basename
+ const char * name = NULL;
ModuleSP module_sp (GetModule());
- if (module_sp)
- {
- const char *module_basename = module_sp->GetFileSpec().GetFilename().AsCString();
- if (module_basename && module_basename[0])
- s->Printf("%s.", module_basename);
- }
+ const FileSpec &file_spec = m_obj_file->GetFileSpec();
+
+ if (m_obj_file)
+ name = file_spec.GetFilename().AsCString();
+ if ((!name || !name[0]) && module_sp)
+ name = module_sp->GetFileSpec().GetFilename().AsCString();
+ if (name && name[0])
+ s->Printf("%s.", name);
}
m_name.Dump(s);
}
@@ -285,6 +292,8 @@ Section::Slide (addr_t slide_amount, boo
#pragma mark SectionList
SectionList::SectionList () :
+ m_changed(false),
+ m_revision_id(0),
m_sections()
{
}
@@ -294,15 +303,41 @@ SectionList::~SectionList ()
{
}
+bool
+SectionList::Copy (SectionList *dest_section_list)
+{
+ if (dest_section_list)
+ {
+ dest_section_list->m_sections = m_sections;
+ dest_section_list->m_changed = true;
+ return true;
+ }
+ return false;
+}
+
size_t
SectionList::AddSection (const lldb::SectionSP& section_sp)
{
+ m_changed = true;
assert (section_sp.get());
size_t section_index = m_sections.size();
m_sections.push_back(section_sp);
return section_index;
}
+// Warning, this can be slow as it's removing items from a std::vector.
+bool
+SectionList::DeleteSection (size_t idx)
+{
+ if (idx < m_sections.size())
+ {
+ m_changed = true;
+ m_sections.erase (m_sections.begin() + idx);
+ return true;
+ }
+ return false;
+}
+
size_t
SectionList::FindSectionIndex (const Section* sect)
{
@@ -325,11 +360,13 @@ SectionList::AddUniqueSection (const lld
{
size_t sect_idx = FindSectionIndex (sect_sp.get());
if (sect_idx == UINT32_MAX)
+ {
+ m_changed = true;
sect_idx = AddSection (sect_sp);
+ }
return sect_idx;
}
-
bool
SectionList::ReplaceSection (user_id_t sect_id, const lldb::SectionSP& sect_sp, uint32_t depth)
{
@@ -338,6 +375,7 @@ SectionList::ReplaceSection (user_id_t s
{
if ((*sect_iter)->GetID() == sect_id)
{
+ m_changed = true;
*sect_iter = sect_sp;
return true;
}
@@ -350,7 +388,6 @@ SectionList::ReplaceSection (user_id_t s
return false;
}
-
size_t
SectionList::GetNumSections (uint32_t depth) const
{
@@ -527,5 +564,10 @@ SectionList::Finalize ()
sect->GetChildren().Finalize();
}
-}
+ if (m_changed)
+ {
+ m_revision_id++;
+ m_changed = false;
+ }
+}
Modified: lldb/branches/lldb-platform-work/source/Core/StringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/StringList.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/StringList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/StringList.cpp Tue Jul 2 16:55:02 2013
@@ -235,7 +235,7 @@ StringList::CopyList(const char* item_pr
const char* items_sep)
{
StreamString strm;
- for (int i = 0; i < GetSize(); i++)
+ for (size_t i = 0; i < GetSize(); i++)
{
if (i && items_sep && items_sep[0])
strm << items_sep;
Modified: lldb/branches/lldb-platform-work/source/Core/UUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/UUID.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/UUID.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/UUID.cpp Tue Jul 2 16:55:02 2013
@@ -67,20 +67,26 @@ UUID::GetBytes() const
}
std::string
-UUID::GetAsString () const
+UUID::GetAsString (const char *separator) const
{
std::string result;
- char buf[64];
+ char buf[256];
+ if (!separator)
+ separator = "-";
const uint8_t *u = (const uint8_t *)GetBytes();
if (sizeof (buf) > (size_t)snprintf (buf,
sizeof (buf),
- "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
- u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]))
+ "%2.2X%2.2X%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
+ u[0],u[1],u[2],u[3],separator,
+ u[4],u[5],separator,
+ u[6],u[7],separator,
+ u[8],u[9],separator,
+ u[10],u[11],u[12],u[13],u[14],u[15]))
{
result.append (buf);
if (m_num_uuid_bytes == 20)
{
- if (sizeof (buf) > (size_t)snprintf (buf, sizeof (buf), "-%2.2X%2.2X%2.2X%2.2X", u[16],u[17],u[18],u[19]))
+ if (sizeof (buf) > (size_t)snprintf (buf, sizeof (buf), "%s%2.2X%2.2X%2.2X%2.2X", separator,u[16],u[17],u[18],u[19]))
result.append (buf);
}
}
Modified: lldb/branches/lldb-platform-work/source/Core/UserID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/UserID.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/UserID.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/UserID.cpp Tue Jul 2 16:55:02 2013
@@ -15,10 +15,6 @@
using namespace lldb;
using namespace lldb_private;
-UserID::~UserID ()
-{
-}
-
Stream&
lldb_private::operator << (Stream& strm, const UserID& uid)
{
Modified: lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp Tue Jul 2 16:55:02 2013
@@ -1693,6 +1693,10 @@ ValueObject::DumpPrintableRepresentation
{
const char *cstr = NULL;
+
+ // this is a local stream that we are using to ensure that the data pointed to by cstr survives
+ // long enough for us to copy it to its destination - it is necessary to have this temporary storage
+ // area for cases where our desired output is not backed by some other longer-term storage
StreamString strm;
if (custom_format != eFormatInvalid)
@@ -1724,6 +1728,15 @@ ValueObject::DumpPrintableRepresentation
case eValueObjectRepresentationStyleType:
cstr = GetTypeName().AsCString();
break;
+
+ case eValueObjectRepresentationStyleName:
+ cstr = GetName().AsCString();
+ break;
+
+ case eValueObjectRepresentationStyleExpressionPath:
+ GetExpressionPath(strm, false);
+ cstr = strm.GetString().c_str();
+ break;
}
if (!cstr)
@@ -2792,7 +2805,7 @@ ValueObject::GetValueForExpressionPath_I
}
case '[':
{
- if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray) && !root_clang_type_info.Test(ClangASTContext::eTypeIsPointer)) // if this is not a T[] nor a T*
+ if (!root_clang_type_info.Test(ClangASTContext::eTypeIsArray) && !root_clang_type_info.Test(ClangASTContext::eTypeIsPointer) && !root_clang_type_info.Test(ClangASTContext::eTypeIsVector)) // if this is not a T[] nor a T*
{
if (!root_clang_type_info.Test(ClangASTContext::eTypeIsScalar)) // if this is not even a scalar...
{
@@ -2914,7 +2927,7 @@ ValueObject::GetValueForExpressionPath_I
{
if (ClangASTType::GetMinimumLanguage(root->GetClangAST(),
root->GetClangType()) == eLanguageTypeObjC
- && ClangASTContext::IsPointerType(ClangASTType::GetPointeeType(root->GetClangType())) == false
+ && pointee_clang_type_info.AllClear(ClangASTContext::eTypeIsPointer)
&& root->HasSyntheticValue()
&& options.m_no_synthetic_children == false)
{
@@ -2937,7 +2950,7 @@ ValueObject::GetValueForExpressionPath_I
}
}
}
- else if (ClangASTContext::IsScalarType(root_clang_type))
+ else if (root_clang_type_info.Test(ClangASTContext::eTypeIsScalar))
{
root = root->GetSyntheticBitFieldChild(index, index, true);
if (!root.get())
@@ -2955,6 +2968,23 @@ ValueObject::GetValueForExpressionPath_I
return root;
}
}
+ else if (root_clang_type_info.Test(ClangASTContext::eTypeIsVector))
+ {
+ root = root->GetChildAtIndex(index, true);
+ if (!root.get())
+ {
+ *first_unparsed = expression_cstr;
+ *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+ *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+ return ValueObjectSP();
+ }
+ else
+ {
+ *first_unparsed = end+1; // skip ]
+ *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+ continue;
+ }
+ }
else if (options.m_no_synthetic_children == false)
{
if (root->HasSyntheticValue())
Modified: lldb/branches/lldb-platform-work/source/DataFormatters/CF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/CF.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/CF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/CF.cpp Tue Jul 2 16:55:02 2013
@@ -157,11 +157,12 @@ lldb_private::formatters::CFBitVectorSum
num_bytes = 1024;
DataBufferSP buffer_sp(new DataBufferHeap(num_bytes,0));
num_bytes = process_sp->ReadMemory(data_ptr, buffer_sp->GetBytes(), num_bytes, error);
- if (error.Fail())
+ if (error.Fail() || num_bytes == 0)
return false;
+ uint8_t *bytes = buffer_sp->GetBytes();
for (int byte_idx = 0; byte_idx < num_bytes-1; byte_idx++)
{
- uint8_t byte = buffer_sp->GetBytes()[byte_idx];
+ uint8_t byte = bytes[byte_idx];
bool bit0 = (byte & 1) == 1;
bool bit1 = (byte & 2) == 2;
bool bit2 = (byte & 4) == 4;
@@ -183,7 +184,7 @@ lldb_private::formatters::CFBitVectorSum
}
{
// print the last byte ensuring we do not print spurious bits
- uint8_t byte = buffer_sp->GetBytes()[num_bytes-1];
+ uint8_t byte = bytes[num_bytes-1];
bool bit0 = (byte & 1) == 1;
bool bit1 = (byte & 2) == 2;
bool bit2 = (byte & 4) == 4;
@@ -228,10 +229,7 @@ lldb_private::formatters::CFBitVectorSum
count -= 1;
}
if (count)
- {
stream.Printf("%c",bit0 ? '1' : '0');
- count -= 1;
- }
}
return true;
}
Modified: lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/CXXFormatterFunctions.cpp Tue Jul 2 16:55:02 2013
@@ -952,45 +952,6 @@ ReadAsciiBufferAndDumpToStream (lldb::ad
return true;
}
-#ifdef WANT_DEEP_PRINT
-struct lldb__notInlineMutable {
- void *buffer;
- signed long length;
- signed long capacity;
- unsigned int hasGap:1;
- unsigned int isFixedCapacity:1;
- unsigned int isExternalMutable:1;
- unsigned int capacityProvidedExternally:1;
-#if __LP64__
- unsigned long desiredCapacity:60;
-#else
- unsigned long desiredCapacity:28;
-#endif
- void* contentsAllocator;
-};
-
-struct lldb__CFString {
- uintptr_t _cfisa;
- uint8_t _cfinfo[4];
- uint32_t _rc;
- union {
- struct __inline1 {
- signed long length;
- } inline1;
- struct __notInlineImmutable1 {
- void *buffer;
- signed long length;
- void* contentsDeallocator;
- } notInlineImmutable1;
- struct __notInlineImmutable2 {
- void *buffer;
- void* contentsDeallocator;
- } notInlineImmutable2;
- struct lldb__notInlineMutable notInlineMutable;
- } variants;
-};
-#endif
-
bool
lldb_private::formatters::NSStringSummaryProvider (ValueObject& valobj, Stream& stream)
{
@@ -1057,72 +1018,6 @@ lldb_private::formatters::NSStringSummar
}
}
-#ifdef WANT_DEEP_PRINT
- lldb__CFString my_string_data;
- process_sp->ReadMemory(valobj_addr, &my_string_data, sizeof(lldb__CFString),error);
-
- printf(R"(
- __CFString my_string_data = {
- uintptr_t _cfisa = %lu
- uint8_t _cfinfo[4] = %c%c%c%c
- uint32_t _rc = %d
- union {
- struct __inline1 {
- signed long length = %ld
- } inline1;
- struct __notInlineImmutable1 {
- void *buffer = %p
- signed long length = %ld
- void* contentsDeallocator = %p
- } notInlineImmutable1;
- struct __notInlineImmutable2 {
- void *buffer = %p
- void* contentsDeallocator = %p
- } notInlineImmutable2;
- struct __notInlineMutable notInlineMutable {
- void *buffer = %p
- signed long length = %ld
- signed long capacity = %ld
- unsigned int hasGap:1 = %d
- unsigned int isFixedCapacity:1 = %d
- unsigned int isExternalMutable:1 = %d
- unsigned int capacityProvidedExternally:1 = %d
-#if __LP64__
- unsigned long desiredCapacity:60 = %lu
-#else
- unsigned long desiredCapacity:28 = %lu
-#endif
- void* contentsAllocator = %p
- }
- } variants; ==> (M:%dI:%dL:%zuU:%dS:%dN:%d)
- };\n)",
- my_string_data._cfisa,
- my_string_data._cfinfo[0],my_string_data._cfinfo[1],my_string_data._cfinfo[2],my_string_data._cfinfo[3],
- my_string_data._rc,
- my_string_data.variants.inline1.length,
- my_string_data.variants.notInlineImmutable1.buffer,
- my_string_data.variants.notInlineImmutable1.length,
- my_string_data.variants.notInlineImmutable1.contentsDeallocator,
- my_string_data.variants.notInlineImmutable2.buffer,
- my_string_data.variants.notInlineImmutable2.contentsDeallocator,
- my_string_data.variants.notInlineMutable.buffer,
- my_string_data.variants.notInlineMutable.length,
- my_string_data.variants.notInlineMutable.capacity,
- my_string_data.variants.notInlineMutable.hasGap,
- my_string_data.variants.notInlineMutable.isFixedCapacity,
- my_string_data.variants.notInlineMutable.isExternalMutable,
- my_string_data.variants.notInlineMutable.capacityProvidedExternally,
- my_string_data.variants.notInlineMutable.desiredCapacity,
- my_string_data.variants.notInlineMutable.desiredCapacity,
- my_string_data.variants.notInlineMutable.contentsAllocator,
- is_mutable,
- is_inline,
- explicit_length,
- is_unicode,
- is_special,
- has_null);
-#endif
-
if (strcmp(class_name,"NSString") &&
strcmp(class_name,"CFStringRef") &&
strcmp(class_name,"CFMutableStringRef") &&
@@ -1221,6 +1116,8 @@ lldb_private::formatters::NSStringSummar
location = process_sp->ReadPointerFromMemory(location, error);
if (error.Fail())
return false;
+ if (has_explicit_length && !has_null)
+ explicit_length++; // account for the fact that there is no NULL and we need to have one added
return ReadAsciiBufferAndDumpToStream(location,process_sp,stream,explicit_length);
}
Modified: lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/FormatManager.cpp Tue Jul 2 16:55:02 2013
@@ -334,77 +334,79 @@ GetTypeForCache (ValueObject& valobj,
return ConstString();
}
-#define USE_CACHE 1
lldb::TypeSummaryImplSP
FormatManager::GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
TypeSummaryImplSP retval;
-#if USE_CACHE
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
if (valobj_type)
{
if (log)
- log->Printf("[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
+ log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
if (m_format_cache.GetSummary(valobj_type,retval))
+ {
+ if (log)
+ {
+ log->Printf("[FormatManager::GetSummaryFormat] Cache search success. Returning.");
+ if (log->GetDebug())
+ log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+ }
return retval;
+ }
if (log)
log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
}
-#endif
retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
-#if USE_CACHE
if (valobj_type)
{
if (log)
log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
m_format_cache.SetSummary(valobj_type,retval);
}
-#ifdef LLDB_CONFIGURATION_DEBUG
- if (log)
+ if (log && log->GetDebug())
log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
-#endif
return retval;
}
#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
FormatManager::GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+ lldb::DynamicValueType use_dynamic)
{
SyntheticChildrenSP retval;
-#if USE_CACHE
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
if (valobj_type)
{
if (log)
- log->Printf("[FormatManager::GetSyntheticChildren] Looking into cache for type %s\n", valobj_type.AsCString("<invalid>"));
+ log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
if (m_format_cache.GetSynthetic(valobj_type,retval))
+ {
+ if (log)
+ {
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache search success. Returning.");
+ if (log->GetDebug())
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+ }
return retval;
+ }
if (log)
- log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route\n");
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route");
}
-#endif
retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
-#if USE_CACHE
if (valobj_type)
{
if (log)
- log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s\n",retval.get(),valobj_type.AsCString("<invalid>"));
+ log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
m_format_cache.SetSynthetic(valobj_type,retval);
}
-#ifdef LLDB_CONFIGURATION_DEBUG
- if (log)
+ if (log && log->GetDebug())
log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
-#endif
return retval;
}
#endif
-#undef USE_CACHE
FormatManager::FormatManager() :
m_format_cache(),
@@ -690,9 +692,7 @@ FormatManager::LoadSystemFormatters()
TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
- sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("unsigned char *"), string_format);
- sys_category_sp->GetSummaryNavigator()->Add(ConstString("const unsigned char *"), string_format);
sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
@@ -709,16 +709,12 @@ FormatManager::LoadSystemFormatters()
#ifndef LLDB_DISABLE_PYTHON
// FIXME because of a bug in the FormatNavigator we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags);
- AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("const char16_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
- AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("const char32_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
- AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("const wchar_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
- AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("const unichar *"), string_flags);
TypeSummaryImpl::Flags widechar_flags;
widechar_flags.SetDontShowValue(true)
Modified: lldb/branches/lldb-platform-work/source/DataFormatters/TypeCategoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/TypeCategoryMap.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/TypeCategoryMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/TypeCategoryMap.cpp Tue Jul 2 16:55:02 2013
@@ -192,13 +192,13 @@ TypeCategoryMap::GetSummaryFormat (Value
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::TypeSummaryImplSP current_format;
if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s\n", category_sp->GetName());
+ log->Printf("\n[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName());
if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
continue;
return current_format;
}
if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP\n");
+ log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
return lldb::TypeSummaryImplSP();
}
@@ -220,13 +220,13 @@ TypeCategoryMap::GetSyntheticChildren (V
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::SyntheticChildrenSP current_format;
if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s\n", category_sp->GetName());
+ log->Printf("\n[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName());
if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
continue;
return current_format;
}
if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP\n");
+ log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP");
return lldb::SyntheticChildrenSP();
}
#endif
Modified: lldb/branches/lldb-platform-work/source/DataFormatters/TypeSynthetic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/DataFormatters/TypeSynthetic.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/DataFormatters/TypeSynthetic.cpp (original)
+++ lldb/branches/lldb-platform-work/source/DataFormatters/TypeSynthetic.cpp Tue Jul 2 16:55:02 2013
@@ -39,7 +39,7 @@ TypeFilterImpl::GetDescription()
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "");
- for (int i = 0; i < GetCount(); i++)
+ for (size_t i = 0; i < GetCount(); i++)
{
sstr.Printf(" %s\n",
GetExpressionPathAtIndex(i));
Modified: lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangASTSource.cpp Tue Jul 2 16:55:02 2013
@@ -861,7 +861,7 @@ FindObjCMethodDeclsWithOrigin (unsigned
clang::Selector sel = decl_name.getObjCSelector();
- int num_args = sel.getNumArgs();
+ unsigned num_args = sel.getNumArgs();
for (unsigned i = 0;
i != num_args;
@@ -1741,6 +1741,10 @@ NameSearchContext::AddFunDecl (void *typ
m_function_types.insert(type);
+ const bool isInlineSpecified = false;
+ const bool hasWrittenPrototype = true;
+ const bool isConstexprSpecified = false;
+
clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
@@ -1749,10 +1753,10 @@ NameSearchContext::AddFunDecl (void *typ
QualType::getFromOpaquePtr(type),
NULL,
SC_Static,
- SC_Static,
- false,
- true);
-
+ isInlineSpecified,
+ hasWrittenPrototype,
+ isConstexprSpecified);
+
// We have to do more than just synthesize the FunctionDecl. We have to
// synthesize ParmVarDecls for all of the FunctionDecl's arguments. To do
// this, we raid the function's FunctionProtoType for types.
@@ -1818,7 +1822,15 @@ NameSearchContext::AddTypeDecl(void *typ
{
QualType qual_type = QualType::getFromOpaquePtr(type);
- if (const TagType *tag_type = qual_type->getAs<TagType>())
+ if (const TypedefType *typedef_type = llvm::dyn_cast<TypedefType>(qual_type))
+ {
+ TypedefNameDecl *typedef_name_decl = typedef_type->getDecl();
+
+ m_decls.push_back(typedef_name_decl);
+
+ return (NamedDecl*)typedef_name_decl;
+ }
+ else if (const TagType *tag_type = qual_type->getAs<TagType>())
{
TagDecl *tag_decl = tag_type->getDecl();
@@ -1834,14 +1846,6 @@ NameSearchContext::AddTypeDecl(void *typ
return (NamedDecl*)interface_decl;
}
- else if (const TypedefType *typedef_type = qual_type->getAs<TypedefType>())
- {
- TypedefNameDecl *typedef_name_decl = typedef_type->getDecl();
-
- m_decls.push_back(typedef_name_decl);
-
- return (NamedDecl*)typedef_name_decl;
- }
}
return NULL;
}
Modified: lldb/branches/lldb-platform-work/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/ClangExpressionParser.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/ClangExpressionParser.cpp Tue Jul 2 16:55:02 2013
@@ -36,7 +36,6 @@
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/Driver/CC1Options.h"
-#include "clang/Driver/OptTable.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendActions.h"
@@ -53,6 +52,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/TargetSelect.h"
#if defined(__FreeBSD__)
@@ -81,19 +81,16 @@ using namespace lldb_private;
//===----------------------------------------------------------------------===//
std::string GetBuiltinIncludePath(const char *Argv0) {
- llvm::sys::Path P =
- llvm::sys::Path::GetMainExecutable(Argv0,
- (void*)(intptr_t) GetBuiltinIncludePath);
-
- if (!P.isEmpty()) {
- P.eraseComponent(); // Remove /clang from foo/bin/clang
- P.eraseComponent(); // Remove /bin from foo/bin
-
+ SmallString<128> P(llvm::sys::fs::getMainExecutable(
+ Argv0, (void *)(intptr_t) GetBuiltinIncludePath));
+
+ if (!P.empty()) {
+ llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang
+ llvm::sys::path::remove_filename(P); // Remove /bin from foo/bin
+
// Get foo/lib/clang/<version>/include
- P.appendComponent("lib");
- P.appendComponent("clang");
- P.appendComponent(CLANG_VERSION_STRING);
- P.appendComponent("include");
+ llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING,
+ "include");
}
return P.str();
Modified: lldb/branches/lldb-platform-work/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRExecutionUnit.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRExecutionUnit.cpp Tue Jul 2 16:55:02 2013
@@ -564,6 +564,8 @@ IRExecutionUnit::MemoryManager::dealloca
lldb::addr_t
IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address)
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
for (AllocationRecord &record : m_records)
{
if (local_address >= record.m_host_address &&
@@ -571,9 +573,22 @@ IRExecutionUnit::GetRemoteAddressForLoca
{
if (record.m_process_address == LLDB_INVALID_ADDRESS)
return LLDB_INVALID_ADDRESS;
+
+ lldb::addr_t ret = record.m_process_address + (local_address - record.m_host_address);
+
+ if (log)
+ {
+ log->Printf("IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64 " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64 " from [0x%" PRIx64 "..0x%" PRIx64 "].",
+ local_address,
+ (unsigned long long)record.m_host_address,
+ (unsigned long long)record.m_host_address + (unsigned long long)record.m_size,
+ ret,
+ record.m_process_address,
+ record.m_process_address + record.m_size);
+ }
+
+ return ret;
}
-
- return record.m_process_address + (local_address - record.m_host_address);
}
return LLDB_INVALID_ADDRESS;
Modified: lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp Tue Jul 2 16:55:02 2013
@@ -47,6 +47,27 @@ IRForTarget::StaticDataAllocator::Static
{
}
+IRForTarget::FunctionValueCache::FunctionValueCache(Maker const &maker) :
+ m_maker(maker),
+ m_values()
+{
+}
+
+IRForTarget::FunctionValueCache::~FunctionValueCache()
+{
+}
+
+llvm::Value *IRForTarget::FunctionValueCache::GetValue(llvm::Function *function)
+{
+ if (!m_values.count(function))
+ {
+ llvm::Value *ret = m_maker(function);
+ m_values[function] = ret;
+ return ret;
+ }
+ return m_values[function];
+}
+
lldb::addr_t IRForTarget::StaticDataAllocator::Allocate()
{
lldb_private::Error err;
@@ -62,6 +83,14 @@ lldb::addr_t IRForTarget::StaticDataAllo
return m_allocation;
}
+static llvm::Value *FindEntryInstruction (llvm::Function *function)
+{
+ if (function->empty())
+ return NULL;
+
+ return function->getEntryBlock().getFirstNonPHIOrDbg();
+}
+
IRForTarget::IRForTarget (lldb_private::ClangExpressionDeclMap *decl_map,
bool resolve_vars,
lldb_private::IRExecutionUnit &execution_unit,
@@ -73,14 +102,13 @@ IRForTarget::IRForTarget (lldb_private::
m_module(NULL),
m_decl_map(decl_map),
m_data_allocator(execution_unit),
- m_memory_map(execution_unit),
m_CFStringCreateWithBytes(NULL),
m_sel_registerName(NULL),
m_error_stream(error_stream),
- m_has_side_effects(false),
m_result_store(NULL),
m_result_is_pointer(false),
- m_reloc_placeholder(NULL)
+ m_reloc_placeholder(NULL),
+ m_entry_instruction_finder (FindEntryInstruction)
{
}
@@ -128,67 +156,6 @@ IRForTarget::FixFunctionLinkage(llvm::Fu
}
bool
-IRForTarget::HasSideEffects (llvm::Function &llvm_function)
-{
- llvm::Function::iterator bbi;
- BasicBlock::iterator ii;
-
- for (bbi = llvm_function.begin();
- bbi != llvm_function.end();
- ++bbi)
- {
- BasicBlock &basic_block = *bbi;
-
- for (ii = basic_block.begin();
- ii != basic_block.end();
- ++ii)
- {
- switch (ii->getOpcode())
- {
- default:
- return true;
- case Instruction::Store:
- {
- StoreInst *store_inst = dyn_cast<StoreInst>(ii);
-
- Value *store_ptr = store_inst->getPointerOperand();
-
- std::string ptr_name;
-
- if (store_ptr->hasName())
- ptr_name = store_ptr->getName().str();
-
- if (isa <AllocaInst> (store_ptr))
- break;
-
- if (ptr_name.find("$__lldb_expr_result") != std::string::npos)
- {
- if (ptr_name.find("GV") == std::string::npos)
- m_result_store = store_inst;
- }
- else
- {
- return true;
- }
-
- break;
- }
- case Instruction::Load:
- case Instruction::Alloca:
- case Instruction::GetElementPtr:
- case Instruction::BitCast:
- case Instruction::Ret:
- case Instruction::ICmp:
- case Instruction::Br:
- break;
- }
- }
- }
-
- return false;
-}
-
-bool
IRForTarget::GetFunctionAddress (llvm::Function *fun,
uint64_t &fun_addr,
lldb_private::ConstString &name,
@@ -351,8 +318,7 @@ IRForTarget::RegisterFunctionMetadata(LL
}
bool
-IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module,
- llvm::Function &llvm_function)
+IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module)
{
lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -687,16 +653,6 @@ IRForTarget::CreateResultVariable (llvm:
Constant *initializer = result_global->getInitializer();
- // Here we write the initializer into a result variable assuming it
- // can be computed statically.
-
- if (!m_has_side_effects)
- {
- //MaybeSetConstantResult (initializer,
- // m_result_name,
- // m_result_type);
- }
-
StoreInst *synthesized_store = new StoreInst(initializer,
new_result_global,
first_entry_instruction);
@@ -706,11 +662,6 @@ IRForTarget::CreateResultVariable (llvm:
}
else
{
- if (!m_has_side_effects && lldb_private::ClangASTContext::IsPointerType (m_result_type.GetOpaqueQualType()))
- {
- //MaybeSetCastResult (m_result_type);
- }
-
result_global->replaceAllUsesWith(new_result_global);
}
@@ -751,10 +702,9 @@ static void DebugUsers(Log *log, Value *
}
#endif
-bool
+bool
IRForTarget::RewriteObjCConstString (llvm::GlobalVariable *ns_str,
- llvm::GlobalVariable *cstr,
- Instruction *FirstEntryInstruction)
+ llvm::GlobalVariable *cstr)
{
lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -845,12 +795,14 @@ IRForTarget::RewriteObjCConstString (llv
ArrayRef <Value *> CFSCWB_arguments(argument_array, 5);
- CallInst *CFSCWB_call = CallInst::Create(m_CFStringCreateWithBytes,
- CFSCWB_arguments,
- "CFStringCreateWithBytes",
- FirstEntryInstruction);
+ FunctionValueCache CFSCWB_Caller ([this, &CFSCWB_arguments] (llvm::Function *function)->llvm::Value * {
+ return CallInst::Create(m_CFStringCreateWithBytes,
+ CFSCWB_arguments,
+ "CFStringCreateWithBytes",
+ llvm::cast<Instruction>(m_entry_instruction_finder.GetValue(function)));
+ });
- if (!UnfoldConstant(ns_str, CFSCWB_call, FirstEntryInstruction))
+ if (!UnfoldConstant(ns_str, CFSCWB_Caller, m_entry_instruction_finder))
{
if (log)
log->PutCString("Couldn't replace the NSString with the result of the call");
@@ -867,26 +819,12 @@ IRForTarget::RewriteObjCConstString (llv
}
bool
-IRForTarget::RewriteObjCConstStrings(Function &llvm_function)
+IRForTarget::RewriteObjCConstStrings()
{
lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
ValueSymbolTable& value_symbol_table = m_module->getValueSymbolTable();
- BasicBlock &entry_block(llvm_function.getEntryBlock());
- Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg());
-
- if (!FirstEntryInstruction)
- {
- if (log)
- log->PutCString("Couldn't find first instruction for rewritten Objective-C strings");
-
- if (m_error_stream)
- m_error_stream->Printf("Internal error [IRForTarget]: Couldn't find the location for calls to CFStringCreateWithBytes\n");
-
- return false;
- }
-
for (ValueSymbolTable::iterator vi = value_symbol_table.begin(), ve = value_symbol_table.end();
vi != ve;
++vi)
@@ -1055,7 +993,7 @@ IRForTarget::RewriteObjCConstStrings(Fun
if (!cstr_array)
cstr_global = NULL;
- if (!RewriteObjCConstString(nsstring_global, cstr_global, FirstEntryInstruction))
+ if (!RewriteObjCConstString(nsstring_global, cstr_global))
{
if (log)
log->PutCString("Error rewriting the constant string");
@@ -1435,7 +1373,7 @@ IRForTarget::MaterializeInitializer (uin
size_t element_size = m_target_data->getTypeAllocSize(array_element_type);
- for (int i = 0; i < array_initializer->getNumOperands(); ++i)
+ for (unsigned i = 0; i < array_initializer->getNumOperands(); ++i)
{
Value *operand_value = array_initializer->getOperand(i);
Constant *operand_constant = dyn_cast<Constant>(operand_value);
@@ -1454,7 +1392,7 @@ IRForTarget::MaterializeInitializer (uin
StructType *struct_initializer_type = struct_initializer->getType();
const StructLayout *struct_layout = m_target_data->getStructLayout(struct_initializer_type);
- for (int i = 0;
+ for (unsigned i = 0;
i < struct_initializer->getNumOperands();
++i)
{
@@ -2229,7 +2167,9 @@ IRForTarget::RemoveGuards(BasicBlock &ba
// This function does not report errors; its callers are responsible.
bool
-IRForTarget::UnfoldConstant(Constant *old_constant, Value *new_constant, Instruction *first_entry_inst)
+IRForTarget::UnfoldConstant(Constant *old_constant,
+ FunctionValueCache &value_maker,
+ FunctionValueCache &entry_instruction_finder)
{
lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -2263,18 +2203,21 @@ IRForTarget::UnfoldConstant(Constant *ol
log->Printf("Unhandled constant expression type: \"%s\"", PrintValue(constant_expr).c_str());
return false;
case Instruction::BitCast:
- {
- // UnaryExpr
- // OperandList[0] is value
-
- Value *s = constant_expr->getOperand(0);
-
- if (s == old_constant)
- s = new_constant;
-
- BitCastInst *bit_cast(new BitCastInst(s, constant_expr->getType(), "", first_entry_inst));
+ {
+ FunctionValueCache bit_cast_maker ([&value_maker, &entry_instruction_finder, old_constant, constant_expr] (llvm::Function *function)->llvm::Value* {
+ // UnaryExpr
+ // OperandList[0] is value
+
+ if (constant_expr->getOperand(0) != old_constant)
+ return constant_expr;
+
+ return new BitCastInst(value_maker.GetValue(function),
+ constant_expr->getType(),
+ "",
+ llvm::cast<Instruction>(entry_instruction_finder.GetValue(function)));
+ });
- UnfoldConstant(constant_expr, bit_cast, first_entry_inst);
+ return UnfoldConstant(constant_expr, bit_cast_maker, entry_instruction_finder);
}
break;
case Instruction::GetElementPtr:
@@ -2283,33 +2226,35 @@ IRForTarget::UnfoldConstant(Constant *ol
// OperandList[0] is base
// OperandList[1]... are indices
- Value *ptr = constant_expr->getOperand(0);
-
- if (ptr == old_constant)
- ptr = new_constant;
-
- std::vector<Value*> index_vector;
-
- unsigned operand_index;
- unsigned num_operands = constant_expr->getNumOperands();
-
- for (operand_index = 1;
- operand_index < num_operands;
- ++operand_index)
- {
- Value *operand = constant_expr->getOperand(operand_index);
+ FunctionValueCache get_element_pointer_maker ([&value_maker, &entry_instruction_finder, old_constant, constant_expr] (llvm::Function *function)->llvm::Value* {
+ Value *ptr = constant_expr->getOperand(0);
- if (operand == old_constant)
- operand = new_constant;
+ if (ptr == old_constant)
+ ptr = value_maker.GetValue(function);
- index_vector.push_back(operand);
- }
-
- ArrayRef <Value*> indices(index_vector);
-
- GetElementPtrInst *get_element_ptr(GetElementPtrInst::Create(ptr, indices, "", first_entry_inst));
+ std::vector<Value*> index_vector;
+
+ unsigned operand_index;
+ unsigned num_operands = constant_expr->getNumOperands();
+
+ for (operand_index = 1;
+ operand_index < num_operands;
+ ++operand_index)
+ {
+ Value *operand = constant_expr->getOperand(operand_index);
+
+ if (operand == old_constant)
+ operand = value_maker.GetValue(function);
+
+ index_vector.push_back(operand);
+ }
+
+ ArrayRef <Value*> indices(index_vector);
+
+ return GetElementPtrInst::Create(ptr, indices, "", llvm::cast<Instruction>(entry_instruction_finder.GetValue(function)));
+ });
- UnfoldConstant(constant_expr, get_element_ptr, first_entry_inst);
+ return UnfoldConstant(constant_expr, get_element_pointer_maker, entry_instruction_finder);
}
break;
}
@@ -2323,8 +2268,16 @@ IRForTarget::UnfoldConstant(Constant *ol
}
else
{
- // simple fall-through case for non-constants
- user->replaceUsesOfWith(old_constant, new_constant);
+ if (Instruction *inst = llvm::dyn_cast<Instruction>(user))
+ {
+ inst->replaceUsesOfWith(old_constant, value_maker.GetValue(inst->getParent()->getParent()));
+ }
+ else
+ {
+ if (log)
+ log->Printf("Unhandled non-constant type: \"%s\"", PrintValue(user).c_str());
+ return false;
+ }
}
}
@@ -2465,39 +2418,58 @@ IRForTarget::ReplaceVariables (Function
name.GetCString(),
decl->getNameAsString().c_str(),
offset);
-
- ConstantInt *offset_int(ConstantInt::get(offset_type, offset, true));
- GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(argument, offset_int, "", FirstEntryInstruction);
-
+
if (value)
{
- Value *replacement = NULL;
-
if (log)
log->Printf(" Replacing [%s]", PrintValue(value).c_str());
- // Per the comment at ASTResultSynthesizer::SynthesizeBodyResult, in cases where the result
- // variable is an rvalue, we have to synthesize a dereference of the appropriate structure
- // entry in order to produce the static variable that the AST thinks it is accessing.
- if (name == m_result_name && !m_result_is_pointer)
+ FunctionValueCache body_result_maker ([this, name, offset_type, offset, argument, value] (llvm::Function *function)->llvm::Value * {
+ // Per the comment at ASTResultSynthesizer::SynthesizeBodyResult, in cases where the result
+ // variable is an rvalue, we have to synthesize a dereference of the appropriate structure
+ // entry in order to produce the static variable that the AST thinks it is accessing.
+
+ llvm::Instruction *entry_instruction = llvm::cast<Instruction>(m_entry_instruction_finder.GetValue(function));
+
+ ConstantInt *offset_int(ConstantInt::get(offset_type, offset, true));
+ GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(argument,
+ offset_int,
+ "",
+ entry_instruction);
+
+ if (name == m_result_name && !m_result_is_pointer)
+ {
+ BitCastInst *bit_cast = new BitCastInst(get_element_ptr,
+ value->getType()->getPointerTo(),
+ "",
+ entry_instruction);
+
+ LoadInst *load = new LoadInst(bit_cast, "", entry_instruction);
+
+ return load;
+ }
+ else
+ {
+ BitCastInst *bit_cast = new BitCastInst(get_element_ptr, value->getType(), "", entry_instruction);
+
+ return bit_cast;
+ }
+ });
+
+ if (Constant *constant = dyn_cast<Constant>(value))
{
- BitCastInst *bit_cast = new BitCastInst(get_element_ptr, value->getType()->getPointerTo(), "", FirstEntryInstruction);
-
- LoadInst *load = new LoadInst(bit_cast, "", FirstEntryInstruction);
-
- replacement = load;
+ UnfoldConstant(constant, body_result_maker, m_entry_instruction_finder);
}
- else
+ else if (Instruction *instruction = dyn_cast<Instruction>(value))
{
- BitCastInst *bit_cast = new BitCastInst(get_element_ptr, value->getType(), "", FirstEntryInstruction);
-
- replacement = bit_cast;
+ value->replaceAllUsesWith(body_result_maker.GetValue(instruction->getParent()->getParent()));
}
-
- if (Constant *constant = dyn_cast<Constant>(value))
- UnfoldConstant(constant, replacement, FirstEntryInstruction);
else
- value->replaceAllUsesWith(replacement);
+ {
+ if (log)
+ log->Printf("Unhandled non-constant type: \"%s\"", PrintValue(value).c_str());
+ return false;
+ }
if (GlobalVariable *var = dyn_cast<GlobalVariable>(value))
var->eraseFromParent();
@@ -2621,10 +2593,22 @@ IRForTarget::runOnModule (Module &llvm_m
m_module = &llvm_module;
m_target_data.reset(new DataLayout(m_module));
+
+ if (log)
+ {
+ std::string s;
+ raw_string_ostream oss(s);
+
+ m_module->print(oss, NULL);
+
+ oss.flush();
+
+ log->Printf("Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
+ }
- Function* function = m_module->getFunction(StringRef(m_func_name.c_str()));
+ Function* main_function = m_module->getFunction(StringRef(m_func_name.c_str()));
- if (!function)
+ if (!main_function)
{
if (log)
log->Printf("Couldn't find \"%s()\" in the module", m_func_name.c_str());
@@ -2635,7 +2619,7 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
- if (!FixFunctionLinkage (*function))
+ if (!FixFunctionLinkage (*main_function))
{
if (log)
log->Printf("Couldn't fix the linkage for the function");
@@ -2643,21 +2627,9 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
- if (log)
- {
- std::string s;
- raw_string_ostream oss(s);
-
- m_module->print(oss, NULL);
-
- oss.flush();
-
- log->Printf("Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
- }
-
llvm::Type *intptr_ty = Type::getInt8Ty(m_module->getContext());
- m_reloc_placeholder = new llvm::GlobalVariable((*m_module),
+ m_reloc_placeholder = new llvm::GlobalVariable((*m_module),
intptr_ty,
false /* IsConstant */,
GlobalVariable::InternalLinkage,
@@ -2666,16 +2638,12 @@ IRForTarget::runOnModule (Module &llvm_m
NULL /* InsertBefore */,
GlobalVariable::NotThreadLocal /* ThreadLocal */,
0 /* AddressSpace */);
-
- Function::iterator bbi;
-
- m_has_side_effects = HasSideEffects(*function);
-
+
////////////////////////////////////////////////////////////
// Replace $__lldb_expr_result with a persistent variable
//
- if (!CreateResultVariable(*function))
+ if (!CreateResultVariable(*main_function))
{
if (log)
log->Printf("CreateResultVariable() failed");
@@ -2684,42 +2652,7 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
-
- for (bbi = function->begin();
- bbi != function->end();
- ++bbi)
- {
- if (!RemoveGuards(*bbi))
- {
- if (log)
- log->Printf("RemoveGuards() failed");
-
- // RemoveGuards() reports its own errors, so we don't do so here
-
- return false;
- }
-
- if (!RewritePersistentAllocs(*bbi))
- {
- if (log)
- log->Printf("RewritePersistentAllocs() failed");
-
- // RewritePersistentAllocs() reports its own errors, so we don't do so here
-
- return false;
- }
-
- if (!RemoveCXAAtExit(*bbi))
- {
- if (log)
- log->Printf("RemoveCXAAtExit() failed");
-
- // RemoveCXAAtExit() reports its own errors, so we don't do so here
- return false;
- }
- }
-
if (log && log->GetVerbose())
{
std::string s;
@@ -2732,11 +2665,58 @@ IRForTarget::runOnModule (Module &llvm_m
log->Printf("Module after creating the result variable: \n\"%s\"", s.c_str());
}
+ for (Module::iterator fi = m_module->begin(), fe = m_module->end();
+ fi != fe;
+ ++fi)
+ {
+ llvm::Function *function = fi;
+
+ if (function->begin() == function->end())
+ continue;
+
+ Function::iterator bbi;
+
+ for (bbi = function->begin();
+ bbi != function->end();
+ ++bbi)
+ {
+ if (!RemoveGuards(*bbi))
+ {
+ if (log)
+ log->Printf("RemoveGuards() failed");
+
+ // RemoveGuards() reports its own errors, so we don't do so here
+
+ return false;
+ }
+
+ if (!RewritePersistentAllocs(*bbi))
+ {
+ if (log)
+ log->Printf("RewritePersistentAllocs() failed");
+
+ // RewritePersistentAllocs() reports its own errors, so we don't do so here
+
+ return false;
+ }
+
+ if (!RemoveCXAAtExit(*bbi))
+ {
+ if (log)
+ log->Printf("RemoveCXAAtExit() failed");
+
+ // RemoveCXAAtExit() reports its own errors, so we don't do so here
+
+ return false;
+ }
+ }
+ }
+
///////////////////////////////////////////////////////////////////////////////
// Fix all Objective-C constant strings to use NSStringWithCString:encoding:
//
-
- if (!RewriteObjCConstStrings(*function))
+
+ if (!RewriteObjCConstStrings())
{
if (log)
log->Printf("RewriteObjCConstStrings() failed");
@@ -2750,7 +2730,7 @@ IRForTarget::runOnModule (Module &llvm_m
// Resolve function pointers
//
- if (!ResolveFunctionPointers(llvm_module, *function))
+ if (!ResolveFunctionPointers(llvm_module))
{
if (log)
log->Printf("ResolveFunctionPointers() failed");
@@ -2760,49 +2740,63 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
- for (bbi = function->begin();
- bbi != function->end();
- ++bbi)
+ for (Module::iterator fi = m_module->begin(), fe = m_module->end();
+ fi != fe;
+ ++fi)
{
- if (!RewriteObjCSelectors(*bbi))
+ llvm::Function *function = fi;
+
+ for (llvm::Function::iterator bbi = function->begin(), bbe = function->end();
+ bbi != bbe;
+ ++bbi)
{
- if (log)
- log->Printf("RewriteObjCSelectors() failed");
-
- // RewriteObjCSelectors() reports its own errors, so we don't do so here
-
- return false;
+ if (!RewriteObjCSelectors(*bbi))
+ {
+ if (log)
+ log->Printf("RewriteObjCSelectors() failed");
+
+ // RewriteObjCSelectors() reports its own errors, so we don't do so here
+
+ return false;
+ }
}
}
- for (bbi = function->begin();
- bbi != function->end();
- ++bbi)
+ for (Module::iterator fi = m_module->begin(), fe = m_module->end();
+ fi != fe;
+ ++fi)
{
- if (!ResolveCalls(*bbi))
- {
- if (log)
- log->Printf("ResolveCalls() failed");
-
- // ResolveCalls() reports its own errors, so we don't do so here
-
- return false;
- }
+ llvm::Function *function = fi;
- if (!ReplaceStaticLiterals(*bbi))
+ for (llvm::Function::iterator bbi = function->begin(), bbe = function->end();
+ bbi != bbe;
+ ++bbi)
{
- if (log)
- log->Printf("ReplaceStaticLiterals() failed");
+ if (!ResolveCalls(*bbi))
+ {
+ if (log)
+ log->Printf("ResolveCalls() failed");
+
+ // ResolveCalls() reports its own errors, so we don't do so here
+
+ return false;
+ }
- return false;
+ if (!ReplaceStaticLiterals(*bbi))
+ {
+ if (log)
+ log->Printf("ReplaceStaticLiterals() failed");
+
+ return false;
+ }
}
}
-
- ///////////////////////////////
- // Run function-level passes
+
+ ////////////////////////////////////////////////////////////////////////
+ // Run function-level passes that only make sense on the main function
//
- if (!ResolveExternals(*function))
+ if (!ResolveExternals(*main_function))
{
if (log)
log->Printf("ResolveExternals() failed");
@@ -2812,7 +2806,7 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
- if (!ReplaceVariables(*function))
+ if (!ReplaceVariables(*main_function))
{
if (log)
log->Printf("ReplaceVariables() failed");
@@ -2821,7 +2815,7 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
-
+
if (!ReplaceStrings())
{
if (log)
@@ -2837,7 +2831,7 @@ IRForTarget::runOnModule (Module &llvm_m
return false;
}
-
+
if (!StripAllGVs(llvm_module))
{
if (log)
Modified: lldb/branches/lldb-platform-work/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRInterpreter.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRInterpreter.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRInterpreter.cpp Tue Jul 2 16:55:02 2013
@@ -428,6 +428,20 @@ IRInterpreter::CanInterpret (llvm::Modul
{
lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+ bool saw_function_with_body = false;
+
+ for (Module::iterator fi = module.begin(), fe = module.end();
+ fi != fe;
+ ++fi)
+ {
+ if (fi->begin() != fi->end())
+ {
+ if (saw_function_with_body)
+ return false;
+ saw_function_with_body = true;
+ }
+ }
+
for (Function::iterator bbi = function.begin(), bbe = function.end();
bbi != bbe;
++bbi)
Modified: lldb/branches/lldb-platform-work/source/Expression/IRMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRMemoryMap.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRMemoryMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRMemoryMap.cpp Tue Jul 2 16:55:02 2013
@@ -54,7 +54,7 @@ IRMemoryMap::FindSpace (size_t size)
lldb::addr_t ret = LLDB_INVALID_ADDRESS;
- if (process_sp && process_sp->CanJIT())
+ if (process_sp && process_sp->CanJIT() && process_sp->IsAlive())
{
Error alloc_error;
@@ -66,14 +66,6 @@ IRMemoryMap::FindSpace (size_t size)
return ret;
}
- if (process_sp)
- {
- ret = process_sp->GetReservationCache().Find(size);
-
- if (ret != LLDB_INVALID_ADDRESS)
- return ret;
- }
-
for (int iterations = 0; iterations < 16; ++iterations)
{
lldb::addr_t candidate = LLDB_INVALID_ADDRESS;
@@ -101,21 +93,9 @@ IRMemoryMap::FindSpace (size_t size)
if (IntersectsAllocation(candidate, size))
continue;
-
- char buf[1];
-
- Error err;
-
- if (process_sp &&
- (process_sp->ReadMemory(candidate, buf, 1, err) == 1 ||
- process_sp->ReadMemory(candidate + size, buf, 1, err) == 1))
- continue;
-
+
ret = candidate;
-
- if (process_sp)
- process_sp->GetReservationCache().Reserve(candidate, size);
-
+
return ret;
}
@@ -285,7 +265,7 @@ IRMemoryMap::Malloc (size_t size, uint8_
break;
case eAllocationPolicyMirror:
process_sp = m_process_wp.lock();
- if (process_sp && process_sp->CanJIT())
+ if (process_sp && process_sp->CanJIT() && process_sp->IsAlive())
{
allocation_address = process_sp->AllocateMemory(allocation_size, permissions, error);
if (!error.Success())
@@ -307,7 +287,7 @@ IRMemoryMap::Malloc (size_t size, uint8_
process_sp = m_process_wp.lock();
if (process_sp)
{
- if (process_sp->CanJIT())
+ if (process_sp->CanJIT() && process_sp->IsAlive())
{
allocation_address = process_sp->AllocateMemory(allocation_size, permissions, error);
if (!error.Success())
@@ -414,10 +394,8 @@ IRMemoryMap::Free (lldb::addr_t process_
lldb::ProcessSP process_sp = m_process_wp.lock();
if (process_sp)
{
- if (process_sp->CanJIT())
+ if (process_sp->CanJIT() && process_sp->IsAlive())
process_sp->DeallocateMemory(allocation.m_process_alloc); // FindSpace allocated this for real
- else
- process_sp->GetReservationCache().Unreserve(allocation.m_process_alloc); // FindSpace registered this memory
}
break;
Modified: lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/Materializer.cpp Tue Jul 2 16:55:02 2013
@@ -21,6 +21,7 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
using namespace lldb_private;
@@ -1288,7 +1289,11 @@ Materializer::Materialize (lldb::StackFr
void
Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpressionVariableSP &result_sp, lldb::addr_t frame_bottom, lldb::addr_t frame_top)
{
- lldb::StackFrameSP frame_sp = m_frame_wp.lock();
+ lldb::StackFrameSP frame_sp;
+
+ lldb::ThreadSP thread_sp = m_thread_wp.lock();
+ if (thread_sp)
+ frame_sp = thread_sp->GetFrameWithStackID(m_stack_id);
ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope();
Modified: lldb/branches/lldb-platform-work/source/Host/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Host/Makefile Tue Jul 2 16:55:02 2013
@@ -21,7 +21,7 @@ ifeq ($(HOST_OS),Linux)
DIRS += linux
endif
-ifeq ($(HOST_OS),FreeBSD)
+ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
DIRS += freebsd
endif
Modified: lldb/branches/lldb-platform-work/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/FileSpec.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/FileSpec.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/FileSpec.cpp Tue Jul 2 16:55:02 2013
@@ -12,6 +12,7 @@
#include <fcntl.h>
#include <libgen.h>
#include <sys/stat.h>
+#include <set>
#include <string.h>
#include <fstream>
@@ -553,9 +554,8 @@ FileSpec::ResolveExecutableLocation ()
if (file_cstr)
{
const std::string file_str (file_cstr);
- llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str);
- const std::string &path_str = path.str();
- llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str);
+ std::string path = llvm::sys::FindProgramByName (file_str);
+ llvm::StringRef dir_ref = llvm::sys::path::parent_path(path);
//llvm::StringRef dir_ref = path.getDirname();
if (! dir_ref.empty())
{
Modified: lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Host.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/Host.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/Host.cpp Tue Jul 2 16:55:02 2013
@@ -16,8 +16,8 @@
#include <limits.h>
#include <netdb.h>
#include <pwd.h>
-#include <sys/sysctl.h>
#include <sys/types.h>
+#include <sys/sysctl.h>
#include <unistd.h>
#if defined (__APPLE__)
@@ -27,16 +27,14 @@
#include <mach-o/dyld.h>
#include <mach/mach_port.h>
-#elif defined (__linux__) || defined(__FreeBSD_kernel__)
-/* Linux or the FreeBSD kernel with glibc (Debian KFreeBSD for example) */
+#endif
+#if defined (__linux__) || defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
#include <sys/wait.h>
+#endif
-#elif defined (__FreeBSD__)
-
-#include <sys/wait.h>
+#if defined (__FreeBSD__)
#include <pthread_np.h>
-
#endif
#include "lldb/Host/Host.h"
@@ -151,7 +149,7 @@ MonitorChildProcessThreadFunction (void
delete info;
int status = -1;
-#if defined (__FreeBSD__)
+#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
#define __WALL 0
#endif
const int options = __WALL;
@@ -524,7 +522,7 @@ Host::WillTerminate ()
{
}
-#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__linux__) // see macosx/Host.mm
+#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined (__linux__) // see macosx/Host.mm
void
Host::ThreadCreated (const char *thread_name)
@@ -544,7 +542,7 @@ Host::GetEnvironment (StringList &env)
return 0;
}
-#endif // #if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__linux__)
+#endif // #if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined (__linux__)
struct HostThreadCreateInfo
{
@@ -684,7 +682,7 @@ Host::SetThreadName (lldb::pid_t pid, ll
return true;
}
return false;
-#elif defined (__linux__)
+#elif defined (__linux__) || defined (__GLIBC__)
void *fn = dlsym (RTLD_DEFAULT, "pthread_setname_np");
if (fn)
{
@@ -742,7 +740,7 @@ Host::GetProgramFileSpec ()
exe_path[len] = 0;
g_program_filespec.SetFile(exe_path, false);
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };
size_t exe_path_size;
if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)
@@ -997,6 +995,7 @@ Host::GetLLDBPath (PathType path_type, F
}
break;
+#ifndef LLDB_DISABLE_PYTHON
case ePathTypePythonDir:
{
static ConstString g_lldb_python_dir;
@@ -1039,7 +1038,8 @@ Host::GetLLDBPath (PathType path_type, F
return file_spec.GetDirectory();
}
break;
-
+#endif
+
case ePathTypeLLDBSystemPlugins: // System plug-ins directory
{
#if defined (__APPLE__)
@@ -1180,7 +1180,7 @@ Host::GetGroupName (uint32_t gid, std::s
return NULL;
}
-#if !defined (__APPLE__) && !defined (__FreeBSD__) // see macosx/Host.mm
+#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) // see macosx/Host.mm
bool
Host::GetOSBuildString (std::string &s)
{
@@ -1229,7 +1229,7 @@ Host::FindProcesses (const ProcessInstan
}
#endif // #if !defined (__APPLE__) && !defined(__linux__)
-#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined(__linux__)
+#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined(__linux__)
bool
Host::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
{
@@ -1443,7 +1443,7 @@ Host::GetNumberCPUS ()
static uint32_t g_num_cores = UINT32_MAX;
if (g_num_cores == UINT32_MAX)
{
-#if defined(__APPLE__) or defined (__linux__) or defined (__FreeBSD__)
+#if defined(__APPLE__) or defined (__linux__) or defined (__FreeBSD__) or defined (__FreeBSD_kernel__)
g_num_cores = ::sysconf(_SC_NPROCESSORS_ONLN);
@@ -1460,7 +1460,11 @@ Host::GetNumberCPUS ()
g_num_cores = 0;
int num_cores = 0;
size_t num_cores_len = sizeof(num_cores);
+#ifdef HW_AVAILCPU
int mib[] = { CTL_HW, HW_AVAILCPU };
+#else
+ int mib[] = { CTL_HW, HW_NCPU };
+#endif
/* get the number of CPUs from the system */
if (sysctl(mib, sizeof(mib)/sizeof(int), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
Modified: lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/Symbols.cpp Tue Jul 2 16:55:02 2013
@@ -8,11 +8,21 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Symbols.h"
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/DataBuffer.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/Timer.h"
+#include "lldb/Core/UUID.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
-#if !defined (__APPLE__)
+#if defined (__linux__) || defined (__FreeBSD__)
FileSpec
Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
@@ -24,7 +34,80 @@ Symbols::LocateExecutableObjectFile (con
FileSpec
Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
{
- // FIXME
+ const char *symbol_filename = module_spec.GetSymbolFileSpec().GetFilename().AsCString();
+ if (!symbol_filename || !symbol_filename[0])
+ return FileSpec();
+
+ FileSpecList debug_file_search_paths (Target::GetDefaultDebugFileSearchPaths());
+
+ // Add module directory.
+ const ConstString &file_dir = module_spec.GetFileSpec().GetDirectory();
+ debug_file_search_paths.AppendIfUnique (FileSpec(file_dir.AsCString("."), true));
+
+ // Add current working directory.
+ debug_file_search_paths.AppendIfUnique (FileSpec(".", true));
+
+ // Add /usr/lib/debug directory.
+ debug_file_search_paths.AppendIfUnique (FileSpec("/usr/lib/debug", true));
+
+ std::string uuid_str;
+ const UUID &module_uuid = module_spec.GetUUID();
+ if (module_uuid.IsValid())
+ {
+ // Some debug files are stored in the .build-id directory like this:
+ // /usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
+ uuid_str = module_uuid.GetAsString("");
+ uuid_str.insert (2, 1, '/');
+ uuid_str = uuid_str + ".debug";
+ }
+
+ // Get full path to our module. Needed to check debug files like this:
+ // /usr/lib/debug/usr/lib/libboost_date_time.so.1.46.1
+ std::string module_filename = module_spec.GetFileSpec().GetPath();
+
+ size_t num_directories = debug_file_search_paths.GetSize();
+ for (size_t idx = 0; idx < num_directories; ++idx)
+ {
+ FileSpec dirspec = debug_file_search_paths.GetFileSpecAtIndex (idx);
+ dirspec.ResolvePath();
+ if (!dirspec.Exists() || !dirspec.IsDirectory())
+ continue;
+
+ std::vector<std::string> files;
+ std::string dirname = dirspec.GetPath();
+
+ files.push_back (dirname + "/" + symbol_filename);
+ files.push_back (dirname + "/.debug/" + symbol_filename);
+ files.push_back (dirname + "/.build-id/" + uuid_str);
+ files.push_back (dirname + module_filename);
+
+ const uint32_t num_files = files.size();
+ for (size_t idx_file = 0; idx_file < num_files; ++idx_file)
+ {
+ const std::string &filename = files[idx_file];
+ FileSpec file_spec (filename.c_str(), true);
+
+ if (file_spec == module_spec.GetFileSpec())
+ continue;
+
+ if (file_spec.Exists())
+ {
+ lldb_private::ModuleSpecList specs;
+ const size_t num_specs = ObjectFile::GetModuleSpecifications (file_spec, 0, specs);
+ assert (num_specs <= 1 && "Symbol Vendor supports only a single architecture");
+ if (num_specs == 1)
+ {
+ ModuleSpec mspec;
+ if (specs.GetModuleSpecAtIndex (0, mspec))
+ {
+ if (mspec.GetUUID() == module_uuid)
+ return file_spec;
+ }
+ }
+ }
+ }
+ }
+
return FileSpec();
}
@@ -33,6 +116,7 @@ Symbols::FindSymbolFileInBundle (const F
const lldb_private::UUID *uuid,
const ArchSpec *arch)
{
+ // FIXME
return FileSpec();
}
@@ -44,5 +128,36 @@ Symbols::DownloadObjectAndSymbolFile (Mo
return false;
}
+#elif !defined (__APPLE__)
+
+FileSpec
+Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
+{
+ // FIXME
+ return FileSpec();
+}
+
+FileSpec
+Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
+{
+ // FIXME
+ return FileSpec();
+}
+
+FileSpec
+Symbols::FindSymbolFileInBundle (const FileSpec& symfile_bundle,
+ const lldb_private::UUID *uuid,
+ const ArchSpec *arch)
+{
+ return FileSpec();
+}
+
+bool
+Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec, bool force_lookup)
+{
+ // Fill in the module_spec.GetFileSpec() for the object file and/or the
+ // module_spec.GetSymbolFileSpec() for the debug symbols file.
+ return false;
+}
#endif
Modified: lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/freebsd/Host.cpp Tue Jul 2 16:55:02 2013
@@ -127,8 +127,8 @@ Host::GetEnvironment (StringList &env)
}
bool
-Host::GetOSVersion(uint32_t &major,
- uint32_t &minor,
+Host::GetOSVersion(uint32_t &major,
+ uint32_t &minor,
uint32_t &update)
{
struct utsname un;
@@ -137,10 +137,8 @@ Host::GetOSVersion(uint32_t &major,
if (uname(&un) < 0)
return false;
- // We expect the FreeBSD OS version string in the following formats:
- // <n>-<string>, <n>.<n>-<string> or <n>.<n>.<n>-<string>.
- // We should get one digit value as minimum.
- return (sscanf(un.release, "%u.%u.%u", &major, &minor, &update) > 0);
+ status = sscanf(un.release, "%u.%u", &major, &minor);
+ return status == 2;
}
// The posix_spawn() and posix_spawnp() functions first appeared in FreeBSD 8.0.
@@ -392,7 +390,7 @@ GetFreeBSDProcessArgs (const ProcessInst
{
process_info.GetExecutableFile().SetFile(cstr, false);
- if (!(match_info_ptr == NULL ||
+ if (!(match_info_ptr == NULL ||
NameMatches (process_info.GetExecutableFile().GetFilename().GetCString(),
match_info_ptr->GetNameMatchType(),
match_info_ptr->GetProcessInfo().GetName())))
@@ -417,7 +415,7 @@ GetFreeBSDProcessArgs (const ProcessInst
return true;
}
}
- }
+ }
}
return false;
}
@@ -440,7 +438,7 @@ GetFreeBSDProcessUserAndGroup(ProcessIns
struct kinfo_proc proc_kinfo;
size_t proc_kinfo_size;
- if (process_info.ProcessIDIsValid())
+ if (process_info.ProcessIDIsValid())
{
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID,
(int)process_info.GetProcessID() };
Modified: lldb/branches/lldb-platform-work/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/Args.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/Args.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/Args.cpp Tue Jul 2 16:55:02 2013
@@ -231,7 +231,7 @@ Args::SetCommandString (const char *comm
if (quote_char == '\0')
{
arg.append (arg_piece_start, arg_end - arg_piece_start);
- if (arg_end + 1 != '\0')
+ if (arg_end[1] != '\0')
{
arg.append (arg_end + 1, 1);
arg_pos = arg_end + 2;
Modified: lldb/branches/lldb-platform-work/source/Interpreter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -2,6 +2,7 @@ set(LLVM_NO_RTTI 1)
add_lldb_library(lldbInterpreter
Args.cpp
+ CommandHistory.cpp
CommandInterpreter.cpp
CommandObject.cpp
CommandObjectRegexCommand.cpp
Modified: lldb/branches/lldb-platform-work/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/CommandInterpreter.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/CommandInterpreter.cpp Tue Jul 2 16:55:02 2013
@@ -75,13 +75,15 @@ g_properties[] =
{
{ "expand-regex-aliases", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, regular expression alias commands will show the expanded command that will be executed. This can be used to debug new regular expression alias commands." },
{ "prompt-on-quit", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, LLDB will prompt you before quitting if there are any live processes being debugged. If false, LLDB will quit without asking in any case." },
+ { "stop-command-source-on-error", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, LLDB will stop running a 'command source' script upon encountering an error." },
{ NULL , OptionValue::eTypeInvalid, true, 0 , NULL, NULL, NULL }
};
enum
{
ePropertyExpandRegexAliases = 0,
- ePropertyPromptOnQuit = 1
+ ePropertyPromptOnQuit = 1,
+ ePropertyStopCmdSourceOnError = 2
};
ConstString &
@@ -105,7 +107,6 @@ CommandInterpreter::CommandInterpreter
m_skip_app_init_files (false),
m_script_interpreter_ap (),
m_comment_char ('#'),
- m_repeat_char ('!'),
m_batch_command_mode (false),
m_truncation_warning(eNoTruncation),
m_command_source_depth (0)
@@ -132,6 +133,13 @@ CommandInterpreter::GetPromptOnQuit () c
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
+bool
+CommandInterpreter::GetStopCmdSourceOnError () const
+{
+ const uint32_t idx = ePropertyStopCmdSourceOnError;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+
void
CommandInterpreter::Initialize ()
{
@@ -842,24 +850,29 @@ CommandInterpreter::GetCommandObject (co
// If we didn't find an exact match to the command string in the commands, look in
// the aliases.
+
+ if (command_obj)
+ return command_obj;
- if (command_obj == NULL)
- {
- command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
- }
-
- // If there wasn't an exact match among the aliases, look for an inexact match
- // in just the commands.
+ command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
- if (command_obj == NULL)
- command_obj = GetCommandSP(cmd_cstr, false, false, matches).get();
+ if (command_obj)
+ return command_obj;
+
+ // If there wasn't an exact match then look for an inexact one in just the commands
+ command_obj = GetCommandSP(cmd_cstr, false, false, NULL).get();
// Finally, if there wasn't an inexact match among the commands, look for an inexact
// match in both the commands and aliases.
- if (command_obj == NULL)
- command_obj = GetCommandSP(cmd_cstr, true, false, matches).get();
-
- return command_obj;
+
+ if (command_obj)
+ {
+ if (matches)
+ matches->AppendString(command_obj->GetCommandName());
+ return command_obj;
+ }
+
+ return GetCommandSP(cmd_cstr, true, false, matches).get();
}
bool
@@ -1006,7 +1019,7 @@ CommandInterpreter::GetAliasHelp (const
if (option_arg_vector_sp)
{
OptionArgVector *options = option_arg_vector_sp.get();
- for (int i = 0; i < options->size(); ++i)
+ for (size_t i = 0; i < options->size(); ++i)
{
OptionArgPair cur_option = (*options)[i];
std::string opt = cur_option.first;
@@ -1301,7 +1314,7 @@ CommandInterpreter::BuildAliasResult (co
{
OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
- for (int i = 0; i < option_arg_vector->size(); ++i)
+ for (size_t i = 0; i < option_arg_vector->size(); ++i)
{
OptionArgPair option_pair = (*option_arg_vector)[i];
OptionArgValue value_pair = option_pair.second;
@@ -1525,9 +1538,9 @@ CommandInterpreter::HandleCommand (const
empty_command = true;
else if (command_string[non_space] == m_comment_char)
comment_command = true;
- else if (command_string[non_space] == m_repeat_char)
+ else if (command_string[non_space] == CommandHistory::g_repeat_char)
{
- const char *history_string = FindHistoryString (command_string.c_str() + non_space);
+ const char *history_string = m_command_history.FindString(command_string.c_str() + non_space);
if (history_string == NULL)
{
result.AppendErrorWithFormat ("Could not find entry: %s in history", command_string.c_str());
@@ -1544,7 +1557,7 @@ CommandInterpreter::HandleCommand (const
{
if (repeat_on_empty_command)
{
- if (m_command_history.empty())
+ if (m_command_history.IsEmpty())
{
result.AppendError ("empty command");
result.SetStatus(eReturnStatusFailed);
@@ -1689,8 +1702,10 @@ CommandInterpreter::HandleCommand (const
if (!suffix.empty())
{
- result.AppendErrorWithFormat ("multi-word commands ('%s') can't have shorthand suffixes: '%s'\n",
- next_word.c_str(),
+ result.AppendErrorWithFormat ("command '%s' did not recognize '%s%s%s' as valid (subcommand might be invalid).\n",
+ cmd_obj->GetCommandName(),
+ next_word.empty() ? "" : next_word.c_str(),
+ next_word.empty() ? " -- " : " ",
suffix.c_str());
result.SetStatus (eReturnStatusFailed);
return false;
@@ -1786,9 +1801,7 @@ CommandInterpreter::HandleCommand (const
else
m_repeat_command.assign(original_command_string.c_str());
- // Don't keep pushing the same command onto the history...
- if (m_command_history.empty() || m_command_history.back() != original_command_string)
- m_command_history.push_back (original_command_string);
+ m_command_history.AppendString (original_command_string);
}
command_string = revised_command_line.GetData();
@@ -1946,9 +1959,9 @@ CommandInterpreter::HandleCompletion (co
{
if (first_arg[0] == m_comment_char)
return 0;
- else if (first_arg[0] == m_repeat_char)
+ else if (first_arg[0] == CommandHistory::g_repeat_char)
{
- const char *history_string = FindHistoryString (first_arg);
+ const char *history_string = m_command_history.FindString (first_arg);
if (history_string != NULL)
{
matches.Clear();
@@ -2267,7 +2280,7 @@ CommandInterpreter::BuildAliasCommandArg
used[0] = true;
- for (int i = 0; i < option_arg_vector->size(); ++i)
+ for (size_t i = 0; i < option_arg_vector->size(); ++i)
{
OptionArgPair option_pair = (*option_arg_vector)[i];
OptionArgValue value_pair = option_pair.second;
@@ -2332,7 +2345,7 @@ CommandInterpreter::BuildAliasCommandArg
}
}
- for (int j = 0; j < cmd_args.GetArgumentCount(); ++j)
+ for (size_t j = 0; j < cmd_args.GetArgumentCount(); ++j)
{
if (!used[j] && !wants_raw_input)
new_args.AppendArgument (cmd_args.GetArgumentAtIndex (j));
@@ -2496,7 +2509,7 @@ CommandInterpreter::HandleCommands (cons
m_debugger.SetAsyncExecution (false);
}
- for (int idx = 0; idx < num_lines; idx++)
+ for (size_t idx = 0; idx < num_lines; idx++)
{
const char *cmd = commands.GetStringAtIndex(idx);
if (cmd[0] == '\0')
@@ -2537,7 +2550,7 @@ CommandInterpreter::HandleCommands (cons
error_msg = "<unknown error>.\n";
if (stop_on_error)
{
- result.AppendErrorWithFormat("Aborting reading of commands after command #%d: '%s' failed with %s",
+ result.AppendErrorWithFormat("Aborting reading of commands after command #%zu: '%s' failed with %s",
idx, cmd, error_msg);
result.SetStatus (eReturnStatusFailed);
m_debugger.SetAsyncExecution (old_async_execution);
@@ -2545,7 +2558,7 @@ CommandInterpreter::HandleCommands (cons
}
else if (print_results)
{
- result.AppendMessageWithFormat ("Command #%d '%s' failed with %s",
+ result.AppendMessageWithFormat ("Command #%zu '%s' failed with %s",
idx + 1,
cmd,
error_msg);
@@ -2570,10 +2583,10 @@ CommandInterpreter::HandleCommands (cons
// status in our real result before returning. This is an error if the continue was not the
// last command in the set of commands to be run.
if (idx != num_lines - 1)
- result.AppendErrorWithFormat("Aborting reading of commands after command #%d: '%s' continued the target.\n",
+ result.AppendErrorWithFormat("Aborting reading of commands after command #%zu: '%s' continued the target.\n",
idx + 1, cmd);
else
- result.AppendMessageWithFormat ("Command #%d '%s' continued the target.\n", idx + 1, cmd);
+ result.AppendMessageWithFormat ("Command #%zu '%s' continued the target.\n", idx + 1, cmd);
result.SetStatus(tmp_result.GetStatus());
m_debugger.SetAsyncExecution (old_async_execution);
@@ -2867,59 +2880,3 @@ CommandInterpreter::UpdateExecutionConte
m_exe_ctx_ref.SetTargetPtr (m_debugger.GetSelectedTarget().get(), adopt_selected);
}
}
-
-void
-CommandInterpreter::DumpHistory (Stream &stream, uint32_t count) const
-{
- DumpHistory (stream, 0, count - 1);
-}
-
-void
-CommandInterpreter::DumpHistory (Stream &stream, uint32_t start, uint32_t end) const
-{
- const size_t last_idx = std::min<size_t>(m_command_history.size(), end==UINT32_MAX ? UINT32_MAX : end + 1);
- for (size_t i = start; i < last_idx; i++)
- {
- if (!m_command_history[i].empty())
- {
- stream.Indent();
- stream.Printf ("%4zu: %s\n", i, m_command_history[i].c_str());
- }
- }
-}
-
-const char *
-CommandInterpreter::FindHistoryString (const char *input_str) const
-{
- if (input_str[0] != m_repeat_char)
- return NULL;
- if (input_str[1] == '-')
- {
- bool success;
- size_t idx = Args::StringToUInt32 (input_str+2, 0, 0, &success);
- if (!success)
- return NULL;
- if (idx > m_command_history.size())
- return NULL;
- idx = m_command_history.size() - idx;
- return m_command_history[idx].c_str();
-
- }
- else if (input_str[1] == m_repeat_char)
- {
- if (m_command_history.empty())
- return NULL;
- else
- return m_command_history.back().c_str();
- }
- else
- {
- bool success;
- uint32_t idx = Args::StringToUInt32 (input_str+1, 0, 0, &success);
- if (!success)
- return NULL;
- if (idx >= m_command_history.size())
- return NULL;
- return m_command_history[idx].c_str();
- }
-}
Modified: lldb/branches/lldb-platform-work/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/CommandObject.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/CommandObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/CommandObject.cpp Tue Jul 2 16:55:02 2013
@@ -94,7 +94,7 @@ CommandObject::GetSyntax ()
if (m_arguments.size() > 0)
{
syntax_str.Printf (" ");
- if (WantsRawCommandString())
+ if (WantsRawCommandString() && GetOptions() && GetOptions()->NumCommandOptions())
syntax_str.Printf("-- ");
GetFormattedCommandArguments (syntax_str);
}
@@ -105,13 +105,6 @@ CommandObject::GetSyntax ()
}
const char *
-CommandObject::Translate ()
-{
- //return m_cmd_func_name.c_str();
- return "This function is currently not implemented.";
-}
-
-const char *
CommandObject::GetCommandName ()
{
return m_cmd_name.c_str();
@@ -903,6 +896,83 @@ ExprPathHelpTextCallback()
}
void
+CommandObject::GenerateHelpText (CommandReturnObject &result)
+{
+ GenerateHelpText(result.GetOutputStream());
+
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+}
+
+void
+CommandObject::GenerateHelpText (Stream &output_strm)
+{
+ CommandInterpreter& interpreter = GetCommandInterpreter();
+ if (GetOptions() != NULL)
+ {
+ if (WantsRawCommandString())
+ {
+ std::string help_text (GetHelp());
+ help_text.append (" This command takes 'raw' input (no need to quote stuff).");
+ interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
+ }
+ else
+ interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1);
+ output_strm.Printf ("\nSyntax: %s\n", GetSyntax());
+ GetOptions()->GenerateOptionUsage (output_strm, this);
+ const char *long_help = GetHelpLong();
+ if ((long_help != NULL)
+ && (strlen (long_help) > 0))
+ output_strm.Printf ("\n%s", long_help);
+ if (WantsRawCommandString() && !WantsCompletion())
+ {
+ // Emit the message about using ' -- ' between the end of the command options and the raw input
+ // conditionally, i.e., only if the command object does not want completion.
+ interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options"
+ " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
+ }
+ else if (GetNumArgumentEntries() > 0
+ && GetOptions()
+ && GetOptions()->NumCommandOptions() > 0)
+ {
+ // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
+ interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nThis command takes options and free-form arguments. If your arguments resemble"
+ " option specifiers (i.e., they start with a - or --), you must use ' -- ' between"
+ " the end of the command options and the beginning of the arguments.", 1);
+ }
+ }
+ else if (IsMultiwordObject())
+ {
+ if (WantsRawCommandString())
+ {
+ std::string help_text (GetHelp());
+ help_text.append (" This command takes 'raw' input (no need to quote stuff).");
+ interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
+ }
+ else
+ interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1);
+ GenerateHelpText (output_strm);
+ }
+ else
+ {
+ const char *long_help = GetHelpLong();
+ if ((long_help != NULL)
+ && (strlen (long_help) > 0))
+ output_strm.Printf ("%s", long_help);
+ else if (WantsRawCommandString())
+ {
+ std::string help_text (GetHelp());
+ help_text.append (" This command takes 'raw' input (no need to quote stuff).");
+ interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1);
+ }
+ else
+ interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1);
+ output_strm.Printf ("\nSyntax: %s\n", GetSyntax());
+ }
+}
+
+void
CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg, CommandArgumentType ID, CommandArgumentType IDRange)
{
CommandArgumentData id_arg;
Modified: lldb/branches/lldb-platform-work/source/Interpreter/CommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/CommandReturnObject.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/CommandReturnObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/CommandReturnObject.cpp Tue Jul 2 16:55:02 2013
@@ -143,9 +143,19 @@ CommandReturnObject::SetError (const Err
const char *error_cstr = error.AsCString();
if (error_cstr == NULL)
error_cstr = fallback_error_cstr;
- AppendError (error_cstr);
- SetStatus (eReturnStatusFailed);
+ SetError(error_cstr);
}
+
+void
+CommandReturnObject::SetError (const char *error_cstr)
+{
+ if (error_cstr)
+ {
+ AppendError (error_cstr);
+ SetStatus (eReturnStatusFailed);
+ }
+}
+
// Similar to AppendError, but do not prepend 'Error: ' to message, and
// don't append "\n" to the end of it.
Modified: lldb/branches/lldb-platform-work/source/Interpreter/OptionGroupWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/OptionGroupWatchpoint.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/OptionGroupWatchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/OptionGroupWatchpoint.cpp Tue Jul 2 16:55:02 2013
@@ -77,11 +77,16 @@ OptionGroupWatchpoint::SetOptionValue (C
switch (short_option)
{
case 'w':
- watch_type = (WatchType) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
+ {
+ WatchType tmp_watch_type;
+ tmp_watch_type = (WatchType) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
if (error.Success())
+ {
+ watch_type = tmp_watch_type;
watch_type_specified = true;
+ }
break;
-
+ }
case 'x':
watch_size = (WatchType) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
break;
Modified: lldb/branches/lldb-platform-work/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/OptionValueFileSpecLIst.cpp Tue Jul 2 16:55:02 2013
@@ -150,7 +150,7 @@ OptionValueFileSpecList::SetValueFromCSt
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
+ for (size_t j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
m_current_value.Remove (j);
}
Modified: lldb/branches/lldb-platform-work/source/Interpreter/OptionValuePathMappings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/OptionValuePathMappings.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/OptionValuePathMappings.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/OptionValuePathMappings.cpp Tue Jul 2 16:55:02 2013
@@ -151,7 +151,7 @@ OptionValuePathMappings::SetValueFromCSt
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
+ for (size_t j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
m_path_mappings.Remove (j, m_notify_changes);
}
Modified: lldb/branches/lldb-platform-work/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/Options.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/Options.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/Options.cpp Tue Jul 2 16:55:02 2013
@@ -206,7 +206,7 @@ Options::BuildValidOptionSets ()
}
else
{
- for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++)
+ for (uint32_t j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++)
{
if (this_usage_mask & (1 << j))
{
@@ -224,7 +224,7 @@ Options::BuildValidOptionSets ()
for (int i = 0; i < num_options; ++i)
{
- for (int j = 0; j < num_option_sets; j++)
+ for (uint32_t j = 0; j < num_option_sets; j++)
{
if (opt_defs[i].usage_mask & 1 << j)
{
@@ -498,7 +498,7 @@ Options::GenerateOptionUsage
if (num_options == 0)
return;
- int num_option_sets = GetRequiredOptions().size();
+ uint32_t num_option_sets = GetRequiredOptions().size();
uint32_t i;
@@ -759,7 +759,7 @@ Options::HandleOptionCompletion
cur_opt_std_str.erase(char_pos);
const char *cur_opt_str = cur_opt_std_str.c_str();
- for (int i = 0; i < opt_element_vector.size(); i++)
+ for (size_t i = 0; i < opt_element_vector.size(); i++)
{
int opt_pos = opt_element_vector[i].opt_pos;
int opt_arg_pos = opt_element_vector[i].opt_arg_pos;
@@ -833,7 +833,7 @@ Options::HandleOptionCompletion
// The options definitions table has duplicates because of the
// way the grouping information is stored, so only add once.
bool duplicate = false;
- for (int k = 0; k < matches.GetSize(); k++)
+ for (size_t k = 0; k < matches.GetSize(); k++)
{
if (matches.GetStringAtIndex(k) == full_name)
{
@@ -944,7 +944,7 @@ Options::HandleOptionArgumentCompletion
if (completion_mask & CommandCompletions::eSourceFileCompletion
|| completion_mask & CommandCompletions::eSymbolCompletion)
{
- for (int i = 0; i < opt_element_vector.size(); i++)
+ for (size_t i = 0; i < opt_element_vector.size(); i++)
{
int cur_defs_index = opt_element_vector[i].opt_defs_index;
int cur_arg_pos = opt_element_vector[i].opt_arg_pos;
Modified: lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Interpreter/ScriptInterpreterPython.cpp Tue Jul 2 16:55:02 2013
@@ -58,6 +58,10 @@ static ScriptInterpreter::SWIGPythonMigh
static ScriptInterpreter::SWIGPythonCallCommand g_swig_call_command = NULL;
static ScriptInterpreter::SWIGPythonCallModuleInit g_swig_call_module_init = NULL;
static ScriptInterpreter::SWIGPythonCreateOSPlugin g_swig_create_os_plugin = NULL;
+static ScriptInterpreter::SWIGPythonScriptKeyword_Process g_swig_run_script_keyword_process = NULL;
+static ScriptInterpreter::SWIGPythonScriptKeyword_Thread g_swig_run_script_keyword_thread = NULL;
+static ScriptInterpreter::SWIGPythonScriptKeyword_Target g_swig_run_script_keyword_target = NULL;
+static ScriptInterpreter::SWIGPythonScriptKeyword_Frame g_swig_run_script_keyword_frame = NULL;
// these are the Pythonic implementations of the required callbacks
// these are scripting-language specific, which is why they belong here
@@ -115,7 +119,6 @@ LLDBSwigPythonCallCommand (const char *p
const char *session_dictionary_name,
lldb::DebuggerSP& debugger,
const char* args,
- std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj);
extern "C" bool
@@ -128,6 +131,30 @@ LLDBSWIGPythonCreateOSPlugin (const char
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp);
+extern "C" bool
+LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::ProcessSP& process,
+ std::string& output);
+
+extern "C" bool
+LLDBSWIGPythonRunScriptKeywordThread (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::ThreadSP& thread,
+ std::string& output);
+
+extern "C" bool
+LLDBSWIGPythonRunScriptKeywordTarget (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::TargetSP& target,
+ std::string& output);
+
+extern "C" bool
+LLDBSWIGPythonRunScriptKeywordFrame (const char* python_function_name,
+ const char* session_dictionary_name,
+ lldb::StackFrameSP& frame,
+ std::string& output);
+
static int
_check_and_flush (FILE *stream)
{
@@ -543,7 +570,7 @@ ScriptInterpreterPython::~ScriptInterpre
Locker locker(this,
ScriptInterpreterPython::Locker::AcquireLock,
ScriptInterpreterPython::Locker::FreeLock);
- Py_DECREF ((PyObject*)m_new_sysout);
+ Py_XDECREF ((PyObject*)m_new_sysout);
}
}
@@ -792,10 +819,10 @@ ScriptInterpreterPython::ExecuteOneLine
PythonInputReaderManager py_input(options.GetEnableIO() ? this : NULL);
pvalue = PyObject_CallObject (pfunc, pargs);
}
- Py_DECREF (pargs);
+ Py_XDECREF (pargs);
if (pvalue != NULL)
{
- Py_DECREF (pvalue);
+ Py_XDECREF (pvalue);
success = true;
}
else if (options.GetMaskoutErrors() && PyErr_Occurred ())
@@ -1063,7 +1090,7 @@ ScriptInterpreterPython::ExecuteOneLineW
if (locals != NULL
&& should_decrement_locals)
- Py_DECREF (locals);
+ Py_XDECREF (locals);
if (py_return != NULL)
{
@@ -1154,7 +1181,7 @@ ScriptInterpreterPython::ExecuteOneLineW
break;
}
}
- Py_DECREF (py_return);
+ Py_XDECREF (py_return);
if (success)
ret_success = true;
else
@@ -1227,10 +1254,10 @@ ScriptInterpreterPython::ExecuteMultiple
if (py_return != NULL)
{
success = true;
- Py_DECREF (py_return);
+ Py_XDECREF (py_return);
}
if (locals && should_decrement_locals)
- Py_DECREF (locals);
+ Py_XDECREF (locals);
}
}
}
@@ -2580,6 +2607,147 @@ ReadPythonBacktrace (PyObject* py_backtr
}
bool
+ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
+ Process* process,
+ std::string& output,
+ Error& error)
+{
+ bool ret_val;
+ if (!process)
+ {
+ error.SetErrorString("no process");
+ return false;
+ }
+ if (!impl_function || !impl_function[0])
+ {
+ error.SetErrorString("no function to execute");
+ return false;
+ }
+ if (!g_swig_run_script_keyword_process)
+ {
+ error.SetErrorString("internal helper function missing");
+ return false;
+ }
+ {
+ ProcessSP process_sp(process->shared_from_this());
+ Locker py_lock(this);
+ ret_val = g_swig_run_script_keyword_process (impl_function, m_dictionary_name.c_str(), process_sp, output);
+ if (!ret_val)
+ error.SetErrorString("python script evaluation failed");
+ }
+ return ret_val;
+}
+
+bool
+ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
+ Thread* thread,
+ std::string& output,
+ Error& error)
+{
+ bool ret_val;
+ if (!thread)
+ {
+ error.SetErrorString("no thread");
+ return false;
+ }
+ if (!impl_function || !impl_function[0])
+ {
+ error.SetErrorString("no function to execute");
+ return false;
+ }
+ if (!g_swig_run_script_keyword_thread)
+ {
+ error.SetErrorString("internal helper function missing");
+ return false;
+ }
+ {
+ ThreadSP thread_sp(thread->shared_from_this());
+ Locker py_lock(this);
+ ret_val = g_swig_run_script_keyword_thread (impl_function, m_dictionary_name.c_str(), thread_sp, output);
+ if (!ret_val)
+ error.SetErrorString("python script evaluation failed");
+ }
+ return ret_val;
+}
+
+bool
+ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
+ Target* target,
+ std::string& output,
+ Error& error)
+{
+ bool ret_val;
+ if (!target)
+ {
+ error.SetErrorString("no thread");
+ return false;
+ }
+ if (!impl_function || !impl_function[0])
+ {
+ error.SetErrorString("no function to execute");
+ return false;
+ }
+ if (!g_swig_run_script_keyword_thread)
+ {
+ error.SetErrorString("internal helper function missing");
+ return false;
+ }
+ {
+ TargetSP target_sp(target->shared_from_this());
+ Locker py_lock(this);
+ ret_val = g_swig_run_script_keyword_target (impl_function, m_dictionary_name.c_str(), target_sp, output);
+ if (!ret_val)
+ error.SetErrorString("python script evaluation failed");
+ }
+ return ret_val;
+}
+
+bool
+ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
+ StackFrame* frame,
+ std::string& output,
+ Error& error)
+{
+ bool ret_val;
+ if (!frame)
+ {
+ error.SetErrorString("no frame");
+ return false;
+ }
+ if (!impl_function || !impl_function[0])
+ {
+ error.SetErrorString("no function to execute");
+ return false;
+ }
+ if (!g_swig_run_script_keyword_thread)
+ {
+ error.SetErrorString("internal helper function missing");
+ return false;
+ }
+ {
+ StackFrameSP frame_sp(frame->shared_from_this());
+ Locker py_lock(this);
+ ret_val = g_swig_run_script_keyword_frame (impl_function, m_dictionary_name.c_str(), frame_sp, output);
+ if (!ret_val)
+ error.SetErrorString("python script evaluation failed");
+ }
+ return ret_val;
+}
+
+uint64_t replace_all(std::string& str, const std::string& oldStr, const std::string& newStr)
+{
+ size_t pos = 0;
+ uint64_t matches = 0;
+ while((pos = str.find(oldStr, pos)) != std::string::npos)
+ {
+ matches++;
+ str.replace(pos, oldStr.length(), newStr);
+ pos += newStr.length();
+ }
+ return matches;
+}
+
+bool
ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
bool can_reload,
bool init_session,
@@ -2626,13 +2794,14 @@ ScriptInterpreterPython::LoadScriptingMo
target_file.GetFileType() == FileSpec::eFileTypeRegular ||
target_file.GetFileType() == FileSpec::eFileTypeSymbolicLink)
{
- const char* directory = target_file.GetDirectory().GetCString();
+ std::string directory(target_file.GetDirectory().GetCString());
+ replace_all(directory,"'","\\'");
// now make sure that Python has "directory" in the search path
StreamString command_stream;
command_stream.Printf("if not (sys.path.__contains__('%s')):\n sys.path.insert(1,'%s');\n\n",
- directory,
- directory);
+ directory.c_str(),
+ directory.c_str());
bool syspath_retval = ExecuteMultipleLines(command_stream.GetData(), ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false));
if (!syspath_retval)
{
@@ -2658,14 +2827,25 @@ ScriptInterpreterPython::LoadScriptingMo
// check if the module is already import-ed
command_stream.Clear();
- command_stream.Printf("sys.getrefcount(%s)",basename.c_str());
+ command_stream.Printf("sys.modules.__contains__('%s')",basename.c_str());
+ bool does_contain = false;
int refcount = 0;
- // this call will fail if the module does not exist (because the parameter to it is not a string
- // but an actual Python module object, which is non-existant if the module was not imported before)
- bool was_imported = (ExecuteOneLineWithReturn(command_stream.GetData(),
- ScriptInterpreterPython::eScriptReturnTypeInt,
- &refcount,
- ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false)) && refcount > 0);
+ // this call will succeed if the module was ever imported in any Debugger in the lifetime of the process
+ // in which this LLDB framework is living
+ bool was_imported_globally = (ExecuteOneLineWithReturn(command_stream.GetData(),
+ ScriptInterpreterPython::eScriptReturnTypeBool,
+ &does_contain,
+ ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false)) && does_contain);
+ // this call will fail if the module was not imported in this Debugger before
+ command_stream.Clear();
+ command_stream.Printf("sys.getrefcount(%s)",basename.c_str());
+ bool was_imported_locally = (ExecuteOneLineWithReturn(command_stream.GetData(),
+ ScriptInterpreterPython::eScriptReturnTypeInt,
+ &refcount,
+ ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false)) && refcount > 0);
+
+ bool was_imported = (was_imported_globally || was_imported_locally);
+
if (was_imported == true && can_reload == false)
{
error.SetErrorString("module already imported");
@@ -2674,10 +2854,17 @@ ScriptInterpreterPython::LoadScriptingMo
// now actually do the import
command_stream.Clear();
+
if (was_imported)
- command_stream.Printf("reload(%s)",basename.c_str());
+ {
+ if (!was_imported_locally)
+ command_stream.Printf("import %s ; reload(%s)",basename.c_str(),basename.c_str());
+ else
+ command_stream.Printf("reload(%s)",basename.c_str());
+ }
else
command_stream.Printf("import %s",basename.c_str());
+
bool import_retval = ExecuteMultipleLines(command_stream.GetData(), ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false).SetMaskoutErrors(false));
PyObject* py_error = PyErr_Occurred(); // per Python docs: "you do not need to Py_DECREF()" the return of this function
@@ -2784,7 +2971,7 @@ ScriptInterpreterPython::RunScriptBasedC
return false;
}
- bool ret_val;
+ bool ret_val = false;
std::string err_msg;
@@ -2809,12 +2996,11 @@ ScriptInterpreterPython::RunScriptBasedC
m_dictionary_name.c_str(),
debugger_sp,
args,
- err_msg,
cmd_retobj);
}
if (!ret_val)
- error.SetErrorString(err_msg.c_str());
+ error.SetErrorString("unable to execute script function");
else
error.Clear();
@@ -2880,6 +3066,10 @@ ScriptInterpreterPython::InitializeInter
g_swig_call_command = LLDBSwigPythonCallCommand;
g_swig_call_module_init = LLDBSwigPythonCallModuleInit;
g_swig_create_os_plugin = LLDBSWIGPythonCreateOSPlugin;
+ g_swig_run_script_keyword_process = LLDBSWIGPythonRunScriptKeywordProcess;
+ g_swig_run_script_keyword_thread = LLDBSWIGPythonRunScriptKeywordThread;
+ g_swig_run_script_keyword_target = LLDBSWIGPythonRunScriptKeywordTarget;
+ g_swig_run_script_keyword_frame = LLDBSWIGPythonRunScriptKeywordFrame;
}
void
Modified: lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Tue Jul 2 16:55:02 2013
@@ -441,7 +441,7 @@ DisassemblerLLVMC::LLVMCDisassembler::LL
return;
}
- m_context_ap.reset(new llvm::MCContext(*m_asm_info_ap.get(), *(m_reg_info_ap.get()), 0));
+ m_context_ap.reset(new llvm::MCContext(m_asm_info_ap.get(), m_reg_info_ap.get(), 0));
m_disasm_ap.reset(curr_target->createMCDisassembler(*m_subtarget_info_ap.get()));
if (m_disasm_ap.get() && m_context_ap.get())
Modified: lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Jul 2 16:55:02 2013
@@ -902,7 +902,7 @@ DynamicLoaderMacOSXDYLD::AddModulesUsing
if (objc_runtime != NULL && !objc_runtime->HasReadObjCLibrary())
{
size_t num_modules = loaded_module_list.GetSize();
- for (int i = 0; i < num_modules; i++)
+ for (size_t i = 0; i < num_modules; i++)
{
if (objc_runtime->IsModuleObjCLibrary (loaded_module_list.GetModuleAtIndex (i)))
{
@@ -1031,7 +1031,7 @@ DynamicLoaderMacOSXDYLD::ReadImageInfos
{
lldb::offset_t info_data_offset = 0;
DataExtractor info_data_ref(info_data.GetBytes(), info_data.GetByteSize(), endian, addr_size);
- for (int i = 0; i < image_infos.size() && info_data_ref.ValidOffset(info_data_offset); i++)
+ for (size_t i = 0; i < image_infos.size() && info_data_ref.ValidOffset(info_data_offset); i++)
{
image_infos[i].address = info_data_ref.GetPointer(&info_data_offset);
lldb::addr_t path_addr = info_data_ref.GetPointer(&info_data_offset);
Modified: lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp Tue Jul 2 16:55:02 2013
@@ -124,27 +124,44 @@ AuxVector::DumpToLog(Log *log) const
const char *
AuxVector::GetEntryName(EntryType type)
{
- const char *name;
+ const char *name = "AT_???";
#define ENTRY_NAME(_type) _type: name = #_type
switch (type)
{
- case ENTRY_NAME(AT_NULL); break;
- case ENTRY_NAME(AT_IGNORE); break;
- case ENTRY_NAME(AT_EXECFD); break;
- case ENTRY_NAME(AT_PHDR); break;
- case ENTRY_NAME(AT_PHENT); break;
- case ENTRY_NAME(AT_PHNUM); break;
- case ENTRY_NAME(AT_PAGESZ); break;
- case ENTRY_NAME(AT_BASE); break;
- case ENTRY_NAME(AT_FLAGS); break;
- case ENTRY_NAME(AT_ENTRY); break;
- case ENTRY_NAME(AT_NOTELF); break;
- case ENTRY_NAME(AT_UID); break;
- case ENTRY_NAME(AT_EUID); break;
- case ENTRY_NAME(AT_GID); break;
- case ENTRY_NAME(AT_EGID); break;
- case ENTRY_NAME(AT_CLKTCK); break;
+ case ENTRY_NAME(AT_NULL); break;
+ case ENTRY_NAME(AT_IGNORE); break;
+ case ENTRY_NAME(AT_EXECFD); break;
+ case ENTRY_NAME(AT_PHDR); break;
+ case ENTRY_NAME(AT_PHENT); break;
+ case ENTRY_NAME(AT_PHNUM); break;
+ case ENTRY_NAME(AT_PAGESZ); break;
+ case ENTRY_NAME(AT_BASE); break;
+ case ENTRY_NAME(AT_FLAGS); break;
+ case ENTRY_NAME(AT_ENTRY); break;
+ case ENTRY_NAME(AT_NOTELF); break;
+ case ENTRY_NAME(AT_UID); break;
+ case ENTRY_NAME(AT_EUID); break;
+ case ENTRY_NAME(AT_GID); break;
+ case ENTRY_NAME(AT_EGID); break;
+ case ENTRY_NAME(AT_CLKTCK); break;
+ case ENTRY_NAME(AT_PLATFORM); break;
+ case ENTRY_NAME(AT_HWCAP); break;
+ case ENTRY_NAME(AT_FPUCW); break;
+ case ENTRY_NAME(AT_DCACHEBSIZE); break;
+ case ENTRY_NAME(AT_ICACHEBSIZE); break;
+ case ENTRY_NAME(AT_UCACHEBSIZE); break;
+ case ENTRY_NAME(AT_IGNOREPPC); break;
+ case ENTRY_NAME(AT_SECURE); break;
+ case ENTRY_NAME(AT_BASE_PLATFORM); break;
+ case ENTRY_NAME(AT_RANDOM); break;
+ case ENTRY_NAME(AT_EXECFN); break;
+ case ENTRY_NAME(AT_SYSINFO); break;
+ case ENTRY_NAME(AT_SYSINFO_EHDR); break;
+ case ENTRY_NAME(AT_L1I_CACHESHAPE); break;
+ case ENTRY_NAME(AT_L1D_CACHESHAPE); break;
+ case ENTRY_NAME(AT_L2_CACHESHAPE); break;
+ case ENTRY_NAME(AT_L3_CACHESHAPE); break;
}
#undef ENTRY_NAME
Modified: lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h Tue Jul 2 16:55:02 2013
@@ -41,23 +41,41 @@ public:
};
/// Constants describing the type of entry.
+ /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
enum EntryType {
- AT_NULL = 0, ///< End of auxv.
- AT_IGNORE = 1, ///< Ignore entry.
- AT_EXECFD = 2, ///< File descriptor of program.
- AT_PHDR = 3, ///< Program headers.
- AT_PHENT = 4, ///< Size of program header.
- AT_PHNUM = 5, ///< Number of program headers.
- AT_PAGESZ = 6, ///< Page size.
- AT_BASE = 7, ///< Interpreter base address.
- AT_FLAGS = 8, ///< Flags.
- AT_ENTRY = 9, ///< Program entry point.
- AT_NOTELF = 10, ///< Set if program is not an ELF.
- AT_UID = 11, ///< UID.
- AT_EUID = 12, ///< Effective UID.
- AT_GID = 13, ///< GID.
- AT_EGID = 14, ///< Effective GID.
- AT_CLKTCK = 17 ///< Clock frequency (e.g. times(2)).
+ AT_NULL = 0, ///< End of auxv.
+ AT_IGNORE = 1, ///< Ignore entry.
+ AT_EXECFD = 2, ///< File descriptor of program.
+ AT_PHDR = 3, ///< Program headers.
+ AT_PHENT = 4, ///< Size of program header.
+ AT_PHNUM = 5, ///< Number of program headers.
+ AT_PAGESZ = 6, ///< Page size.
+ AT_BASE = 7, ///< Interpreter base address.
+ AT_FLAGS = 8, ///< Flags.
+ AT_ENTRY = 9, ///< Program entry point.
+ AT_NOTELF = 10, ///< Set if program is not an ELF.
+ AT_UID = 11, ///< UID.
+ AT_EUID = 12, ///< Effective UID.
+ AT_GID = 13, ///< GID.
+ AT_EGID = 14, ///< Effective GID.
+ AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+ AT_PLATFORM = 15, ///< String identifying platform.
+ AT_HWCAP = 16, ///< Machine dependent hints about processor capabilities.
+ AT_FPUCW = 18, ///< Used FPU control word.
+ AT_DCACHEBSIZE = 19, ///< Data cache block size.
+ AT_ICACHEBSIZE = 20, ///< Instruction cache block size.
+ AT_UCACHEBSIZE = 21, ///< Unified cache block size.
+ AT_IGNOREPPC = 22, ///< Entry should be ignored.
+ AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+ AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
+ AT_RANDOM = 25, ///< Address of 16 random bytes.
+ AT_EXECFN = 31, ///< Filename of executable.
+ AT_SYSINFO = 32, ///< Pointer to the global system page used for system calls and other nice things.
+ AT_SYSINFO_EHDR = 33,
+ AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
+ AT_L1D_CACHESHAPE = 35,
+ AT_L2_CACHESHAPE = 36,
+ AT_L3_CACHESHAPE = 37,
};
private:
Modified: lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Tue Jul 2 16:55:02 2013
@@ -419,7 +419,6 @@ DynamicLoaderPOSIXDYLD::LoadModuleAtAddr
else if ((module_sp = target.GetSharedModule(module_spec)))
{
UpdateLoadedSections(module_sp, base_addr);
- modules.Append(module_sp);
}
return module_sp;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Tue Jul 2 16:55:02 2013
@@ -50,7 +50,9 @@ CountITSize (uint32_t ITMask) {
uint32_t TZ = llvm::countTrailingZeros(ITMask);
if (TZ > 3)
{
+#ifdef LLDB_CONFIGURATION_DEBUG
printf("Encoding error: IT Mask '0000'\n");
+#endif
return 0;
}
return (4 - TZ);
@@ -67,12 +69,16 @@ bool ITSession::InitIT(uint32_t bits7_0)
unsigned short FirstCond = Bits32(bits7_0, 7, 4);
if (FirstCond == 0xF)
{
+#ifdef LLDB_CONFIGURATION_DEBUG
printf("Encoding error: IT FirstCond '1111'\n");
+#endif
return false;
}
if (FirstCond == 0xE && ITCounter != 1)
{
+#ifdef LLDB_CONFIGURATION_DEBUG
printf("Encoding error: IT FirstCond '1110' && Mask != '1000'\n");
+#endif
return false;
}
@@ -4092,8 +4098,8 @@ EmulateInstructionARM::EmulateSTM (const
GetRegisterInfo (eRegisterKindDWARF, dwarf_r0 + n, base_reg);
// for i = 0 to 14
- int lowest_set_bit = 14;
- for (int i = 0; i < 14; ++i)
+ uint32_t lowest_set_bit = 14;
+ for (uint32_t i = 0; i < 14; ++i)
{
// if registers<i> == '1' then
if (BitIsSet (registers, i))
@@ -4217,8 +4223,8 @@ EmulateInstructionARM::EmulateSTMDA (con
GetRegisterInfo (eRegisterKindDWARF, dwarf_r0 + n, base_reg);
// for i = 0 to 14
- int lowest_bit_set = 14;
- for (int i = 0; i < 14; ++i)
+ uint32_t lowest_bit_set = 14;
+ for (uint32_t i = 0; i < 14; ++i)
{
// if registers<i> == '1' then
if (BitIsSet (registers, i))
@@ -4369,7 +4375,7 @@ EmulateInstructionARM::EmulateSTMDB (con
// for i = 0 to 14
uint32_t lowest_set_bit = 14;
- for (int i = 0; i < 14; ++i)
+ for (uint32_t i = 0; i < 14; ++i)
{
// if registers<i> == '1' then
if (BitIsSet (registers, i))
@@ -4494,7 +4500,7 @@ EmulateInstructionARM::EmulateSTMIB (con
uint32_t lowest_set_bit = 14;
// for i = 0 to 14
- for (int i = 0; i < 14; ++i)
+ for (uint32_t i = 0; i < 14; ++i)
{
// if registers<i> == '1' then
if (BitIsSet (registers, i))
@@ -10940,7 +10946,7 @@ EmulateInstructionARM::EmulateVSTM (cons
context.type = eContextRegisterStore;
// for r = 0 to regs-1
- for (int r = 0; r < regs; ++r)
+ for (uint32_t r = 0; r < regs; ++r)
{
if (single_regs)
@@ -11403,11 +11409,11 @@ EmulateInstructionARM::EmulateVLD1Multip
}
// for r = 0 to regs-1
- for (int r = 0; r < regs; ++r)
+ for (uint32_t r = 0; r < regs; ++r)
{
// for e = 0 to elements-1
uint64_t assembled_data = 0;
- for (int e = 0; e < elements; ++e)
+ for (uint32_t e = 0; e < elements; ++e)
{
// Elem[D[d+r],e,esize] = MemU[address,ebytes];
context.type = eContextRegisterLoad;
@@ -11742,7 +11748,7 @@ EmulateInstructionARM::EmulateVST1Multip
RegisterInfo data_reg;
context.type = eContextRegisterStore;
// for r = 0 to regs-1
- for (int r = 0; r < regs; ++r)
+ for (uint32_t r = 0; r < regs; ++r)
{
GetRegisterInfo (eRegisterKindDWARF, dwarf_d0 + d + r, data_reg);
uint64_t register_data = ReadRegisterUnsigned (eRegisterKindDWARF, dwarf_d0 + d + r, 0, &success);
@@ -11750,7 +11756,7 @@ EmulateInstructionARM::EmulateVST1Multip
return false;
// for e = 0 to elements-1
- for (int e = 0; e < elements; ++e)
+ for (uint32_t e = 0; e < elements; ++e)
{
// MemU[address,ebytes] = Elem[D[d+r],e,esize];
uint64_t word = Bits64 (register_data, ((e + 1) * esize) - 1, e * esize);
@@ -12046,11 +12052,11 @@ EmulateInstructionARM::EmulateVLD1Single
uint64_t replicated_element = 0;
uint32_t esize = ebytes * 8;
- for (int e = 0; e < elements; ++e)
+ for (uint32_t e = 0; e < elements; ++e)
replicated_element = (replicated_element << esize) | Bits64 (word, esize - 1, 0);
// for r = 0 to regs-1
- for (int r = 0; r < regs; ++r)
+ for (uint32_t r = 0; r < regs; ++r)
{
// D[d+r] = replicated_element;
if (!WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_d0 + d + r, replicated_element))
Modified: lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulationStateARM.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulationStateARM.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulationStateARM.cpp Tue Jul 2 16:55:02 2013
@@ -349,7 +349,7 @@ EmulationStateARM::LoadStateFromDictiona
uint32_t num_elts = mem_array->GetSize();
uint32_t address = (uint32_t) start_address;
- for (int i = 0; i < num_elts; ++i)
+ for (uint32_t i = 0; i < num_elts; ++i)
{
value_sp = mem_array->GetValueAtIndex (i);
if (value_sp.get() == NULL)
Modified: lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Tue Jul 2 16:55:02 2013
@@ -168,7 +168,7 @@ AppleObjCRuntimeV1::CreateObjectChecker(
" struct __objc_object *obj = (struct __objc_object*)$__lldb_arg_obj; \n"
" (int)strlen(obj->isa->name); \n"
"} \n",
- name) < sizeof(buf->contents));
+ name) < (int)sizeof(buf->contents));
return new ClangUtilityFunction(buf->contents, name);
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Jul 2 16:55:02 2013
@@ -529,7 +529,7 @@ AppleObjCRuntimeV2::CreateObjectChecker(
name);
}
- assert (len < sizeof(check_function_code));
+ assert (len < (int)sizeof(check_function_code));
return new ClangUtilityFunction(check_function_code, name);
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Tue Jul 2 16:55:02 2013
@@ -344,7 +344,7 @@ AppleObjCTrampolineHandler::AppleObjCVTa
m_code_start_addr = 0;
m_code_end_addr = 0;
- for (int i = 0; i < num_descriptors; i++)
+ for (size_t i = 0; i < num_descriptors; i++)
{
lldb::addr_t start_offset = offset;
uint32_t voffset = desc_extractor.GetU32 (&offset);
@@ -363,7 +363,7 @@ AppleObjCTrampolineHandler::AppleObjCVTa
// Let's compute the blocks and if they are all the same add the size to the code end address:
lldb::addr_t code_size = 0;
bool all_the_same = true;
- for (int i = 0; i < num_descriptors - 1; i++)
+ for (size_t i = 0; i < num_descriptors - 1; i++)
{
lldb::addr_t this_size = m_descriptors[i + 1].code_start - m_descriptors[i].code_start;
if (code_size == 0)
@@ -686,7 +686,7 @@ AppleObjCTrampolineHandler::AppleObjCTra
// turn the g_dispatch_functions char * array into a template table, and populate the DispatchFunction map
// from there.
- for (int i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++)
+ for (size_t i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++)
{
ConstString name_const_str(g_dispatch_functions[i].name);
const Symbol *msgSend_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (name_const_str, eSymbolTypeCode);
@@ -917,6 +917,14 @@ AppleObjCTrampolineHandler::GetStepThrou
bool success = abi->GetArgumentValues (thread, argument_values);
if (!success)
return ret_plan_sp;
+
+ lldb::addr_t obj_addr = argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
+ if (obj_addr == 0x0)
+ {
+ if (log)
+ log->Printf("Asked to step to dispatch to nil object, returning empty plan.");
+ return ret_plan_sp;
+ }
ExecutionContext exe_ctx (thread.shared_from_this());
Process *process = exe_ctx.GetProcessPtr();
Modified: lldb/branches/lldb-platform-work/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Makefile Tue Jul 2 16:55:02 2013
@@ -34,10 +34,12 @@ endif
ifeq ($(HOST_OS),Linux)
DIRS += DynamicLoader/MacOSX-DYLD
DIRS += Process/Linux Process/POSIX
+DIRS += SymbolVendor/ELF
endif
-ifeq ($(HOST_OS),FreeBSD)
+ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
DIRS += Process/FreeBSD Process/POSIX
+DIRS += SymbolVendor/ELF
endif
include $(LLDB_LEVEL)/Makefile
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue Jul 2 16:55:02 2013
@@ -262,13 +262,27 @@ ObjectFileELF::GetModuleSpecifications (
if (spec.GetArchitecture().IsValid())
{
// We could parse the ABI tag information (in .note, .notes, or .note.ABI-tag) to get the
- // machine information. However, we'd have to read a good bit of the rest of the file,
- // and this info isn't guaranteed to exist or be correct. More details here:
+ // machine information. However, this info isn't guaranteed to exist or be correct. Details:
// http://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html
// Instead of passing potentially incorrect information down the pipeline, grab
// the host information and use it.
spec.GetArchitecture().GetTriple().setOSName (Host::GetOSString().GetCString());
spec.GetArchitecture().GetTriple().setVendorName(Host::GetVendorString().GetCString());
+
+ // Try to get the UUID from the section list. Usually that's at the end, so
+ // map the file in if we don't have it already.
+ size_t section_header_end = header.e_shoff + header.e_shnum * header.e_shentsize;
+ if (section_header_end > data_sp->GetByteSize())
+ {
+ data_sp = file.MemoryMapFileContents (file_offset, section_header_end);
+ data.SetData(data_sp);
+ }
+
+ uint32_t gnu_debuglink_crc;
+ std::string gnu_debuglink_file;
+ SectionHeaderColl section_headers;
+ GetSectionHeaderInfo(section_headers, data, header, spec.GetUUID(), gnu_debuglink_file, gnu_debuglink_crc);
+
specs.Append(spec);
}
}
@@ -306,12 +320,13 @@ ObjectFileELF::ObjectFileELF (const lldb
m_header(),
m_program_headers(),
m_section_headers(),
- m_filespec_ap(),
- m_shstr_data()
+ m_filespec_ap()
{
if (file)
m_file = *file;
::memset(&m_header, 0, sizeof(m_header));
+ m_gnu_debuglink_crc = 0;
+ m_gnu_debuglink_file.clear();
}
ObjectFileELF::~ObjectFileELF()
@@ -359,18 +374,111 @@ ObjectFileELF::ParseHeader()
return m_header.Parse(m_data, &offset);
}
+/*
+ * crc function from http://svnweb.freebsd.org/base/head/sys/libkern/crc32.c
+ *
+ * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
+ * code or tables extracted from it, as desired without restriction.
+ */
+static uint32_t
+calc_gnu_debuglink_crc32(const void *buf, size_t size)
+{
+ static const uint32_t g_crc32_tab[] =
+ {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+ 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+ 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
+ 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+ 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+ 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+ 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+ 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+ 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+ 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+ 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+ 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
+ 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+ 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
+ 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
+ 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
+ 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+ 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+ };
+ const uint8_t *p = (const uint8_t *)buf;
+ uint32_t crc;
+
+ crc = ~0U;
+ while (size--)
+ crc = g_crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
+ return crc ^ ~0U;
+}
+
bool
ObjectFileELF::GetUUID(lldb_private::UUID* uuid)
{
+ // Need to parse the section list to get the UUIDs, so make sure that's been done.
+ if (!ParseSectionHeaders())
+ return false;
+
if (m_uuid.IsValid())
{
+ // We have the full build id uuid.
*uuid = m_uuid;
return true;
}
- // FIXME: Return MD5 sum here. See comment in ObjectFile.h.
+ else
+ {
+ m_gnu_debuglink_crc = calc_gnu_debuglink_crc32 (m_data.GetDataStart(), m_data.GetByteSize());
+ if (m_gnu_debuglink_crc)
+ {
+ // Use 4 bytes of crc from the .gnu_debuglink section.
+ uint32_t uuidt[4] = { m_gnu_debuglink_crc, 0, 0, 0 };
+ uuid->SetBytes (uuidt, sizeof(uuidt));
+ return true;
+ }
+ }
+
return false;
}
+lldb_private::FileSpecList
+ObjectFileELF::GetDebugSymbolFilePaths()
+{
+ FileSpecList file_spec_list;
+
+ if (!m_gnu_debuglink_file.empty())
+ {
+ FileSpec file_spec (m_gnu_debuglink_file.c_str(), false);
+ file_spec_list.Append (file_spec);
+ }
+ return file_spec_list;
+}
+
uint32_t
ObjectFileELF::GetDependentModules(FileSpecList &files)
{
@@ -416,7 +524,7 @@ ObjectFileELF::GetImageInfoAddress()
if (!dynsym_id)
return Address();
- const ELFSectionHeader *dynsym_hdr = GetSectionHeaderByIndex(dynsym_id);
+ const ELFSectionHeaderInfo *dynsym_hdr = GetSectionHeaderByIndex(dynsym_id);
if (!dynsym_hdr)
return Address();
@@ -477,7 +585,7 @@ ObjectFileELF::ParseDependentModules()
m_filespec_ap.reset(new FileSpecList());
- if (!(ParseSectionHeaders() && GetSectionHeaderStringTable()))
+ if (!ParseSectionHeaders())
return 0;
// Locate the dynamic table.
@@ -574,75 +682,160 @@ ObjectFileELF::ParseProgramHeaders()
return m_program_headers.size();
}
+static bool
+ParseNoteGNUBuildID(DataExtractor &data, lldb_private::UUID &uuid)
+{
+ // Try to parse the note section (ie .note.gnu.build-id|.notes|.note|...) and get the build id.
+ // BuildID documentation: https://fedoraproject.org/wiki/Releases/FeatureBuildId
+ struct
+ {
+ uint32_t name_len; // Length of note name
+ uint32_t desc_len; // Length of note descriptor
+ uint32_t type; // Type of note (1 is ABI_TAG, 3 is BUILD_ID)
+ } notehdr;
+ lldb::offset_t offset = 0;
+ static const uint32_t g_gnu_build_id = 3; // NT_GNU_BUILD_ID from elf.h
+
+ while (true)
+ {
+ if (data.GetU32 (&offset, ¬ehdr, 3) == NULL)
+ return false;
+
+ notehdr.name_len = llvm::RoundUpToAlignment (notehdr.name_len, 4);
+ notehdr.desc_len = llvm::RoundUpToAlignment (notehdr.desc_len, 4);
+
+ lldb::offset_t offset_next_note = offset + notehdr.name_len + notehdr.desc_len;
+
+ // 16 bytes is UUID|MD5, 20 bytes is SHA1
+ if ((notehdr.type == g_gnu_build_id) && (notehdr.name_len == 4) &&
+ (notehdr.desc_len == 16 || notehdr.desc_len == 20))
+ {
+ char name[4];
+ if (data.GetU8 (&offset, name, 4) == NULL)
+ return false;
+ if (!strcmp(name, "GNU"))
+ {
+ uint8_t uuidbuf[20];
+ if (data.GetU8 (&offset, &uuidbuf, notehdr.desc_len) == NULL)
+ return false;
+ uuid.SetBytes (uuidbuf, notehdr.desc_len);
+ return true;
+ }
+ }
+ offset = offset_next_note;
+ }
+ return false;
+}
+
//----------------------------------------------------------------------
-// ParseSectionHeaders
+// GetSectionHeaderInfo
//----------------------------------------------------------------------
size_t
-ObjectFileELF::ParseSectionHeaders()
+ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
+ lldb_private::DataExtractor &object_data,
+ const elf::ELFHeader &header,
+ lldb_private::UUID &uuid,
+ std::string &gnu_debuglink_file,
+ uint32_t &gnu_debuglink_crc)
{
// We have already parsed the section headers
- if (!m_section_headers.empty())
- return m_section_headers.size();
+ if (!section_headers.empty())
+ return section_headers.size();
// If there are no section headers we are done.
- if (m_header.e_shnum == 0)
+ if (header.e_shnum == 0)
return 0;
- m_section_headers.resize(m_header.e_shnum);
- if (m_section_headers.size() != m_header.e_shnum)
+ section_headers.resize(header.e_shnum);
+ if (section_headers.size() != header.e_shnum)
return 0;
- const size_t sh_size = m_header.e_shnum * m_header.e_shentsize;
- const elf_off sh_offset = m_header.e_shoff;
- DataExtractor data;
- if (GetData (sh_offset, sh_size, data) != sh_size)
+ const size_t sh_size = header.e_shnum * header.e_shentsize;
+ const elf_off sh_offset = header.e_shoff;
+ DataExtractor sh_data;
+ if (sh_data.SetData (object_data, sh_offset, sh_size) != sh_size)
return 0;
uint32_t idx;
lldb::offset_t offset;
- for (idx = 0, offset = 0; idx < m_header.e_shnum; ++idx)
+ for (idx = 0, offset = 0; idx < header.e_shnum; ++idx)
{
- if (m_section_headers[idx].Parse(data, &offset) == false)
+ if (section_headers[idx].Parse(sh_data, &offset) == false)
break;
}
- if (idx < m_section_headers.size())
- m_section_headers.resize(idx);
+ if (idx < section_headers.size())
+ section_headers.resize(idx);
- return m_section_headers.size();
-}
-
-size_t
-ObjectFileELF::GetSectionHeaderStringTable()
-{
- if (m_shstr_data.GetByteSize() == 0)
+ const unsigned strtab_idx = header.e_shstrndx;
+ if (strtab_idx && strtab_idx < section_headers.size())
{
- const unsigned strtab_idx = m_header.e_shstrndx;
+ const ELFSectionHeaderInfo &sheader = section_headers[strtab_idx];
+ const size_t byte_size = sheader.sh_size;
+ const Elf64_Off offset = sheader.sh_offset;
+ lldb_private::DataExtractor shstr_data;
- if (strtab_idx && strtab_idx < m_section_headers.size())
+ if (shstr_data.SetData (object_data, offset, byte_size) == byte_size)
{
- const ELFSectionHeader &sheader = m_section_headers[strtab_idx];
- const size_t byte_size = sheader.sh_size;
- const Elf64_Off offset = sheader.sh_offset;
- m_shstr_data.SetData (m_data, offset, byte_size);
+ for (SectionHeaderCollIter I = section_headers.begin();
+ I != section_headers.end(); ++I)
+ {
+ static ConstString g_sect_name_gnu_debuglink (".gnu_debuglink");
+ const ELFSectionHeaderInfo &header = *I;
+ const uint64_t section_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ ConstString name(shstr_data.PeekCStr(I->sh_name));
+
+ I->section_name = name;
+
+ if (name == g_sect_name_gnu_debuglink)
+ {
+ DataExtractor data;
+ if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+ {
+ lldb::offset_t gnu_debuglink_offset = 0;
+ gnu_debuglink_file = data.GetCStr (&gnu_debuglink_offset);
+ gnu_debuglink_offset = llvm::RoundUpToAlignment (gnu_debuglink_offset, 4);
+ data.GetU32 (&gnu_debuglink_offset, &gnu_debuglink_crc, 1);
+ }
+ }
- if (m_shstr_data.GetByteSize() != byte_size)
- return 0;
+ if (header.sh_type == SHT_NOTE && !uuid.IsValid())
+ {
+ DataExtractor data;
+ if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+ {
+ ParseNoteGNUBuildID (data, uuid);
+ }
+ }
+ }
+
+ return section_headers.size();
}
}
- return m_shstr_data.GetByteSize();
+
+ section_headers.clear();
+ return 0;
+}
+
+//----------------------------------------------------------------------
+// ParseSectionHeaders
+//----------------------------------------------------------------------
+size_t
+ObjectFileELF::ParseSectionHeaders()
+{
+ return GetSectionHeaderInfo(m_section_headers, m_data, m_header, m_uuid, m_gnu_debuglink_file, m_gnu_debuglink_crc);
}
lldb::user_id_t
ObjectFileELF::GetSectionIndexByName(const char *name)
{
- if (!(ParseSectionHeaders() && GetSectionHeaderStringTable()))
+ if (!ParseSectionHeaders())
return 0;
// Search the collection of section headers for one with a matching name.
for (SectionHeaderCollIter I = m_section_headers.begin();
I != m_section_headers.end(); ++I)
{
- const char *sectionName = m_shstr_data.PeekCStr(I->sh_name);
+ const char *sectionName = I->section_name.AsCString();
if (!sectionName)
return 0;
@@ -656,7 +849,7 @@ ObjectFileELF::GetSectionIndexByName(con
return 0;
}
-const elf::ELFSectionHeader *
+const ObjectFileELF::ELFSectionHeaderInfo *
ObjectFileELF::GetSectionHeaderByIndex(lldb::user_id_t id)
{
if (!ParseSectionHeaders() || !id)
@@ -668,67 +861,23 @@ ObjectFileELF::GetSectionHeaderByIndex(l
return NULL;
}
-static bool
-ParseNoteGNUBuildID(DataExtractor& data, lldb_private::UUID& uuid)
-{
- // Try to parse the note section (ie .note.gnu.build-id|.notes|.note|...) and get the build id.
- // BuildID documentation: https://fedoraproject.org/wiki/Releases/FeatureBuildId
- struct
- {
- uint32_t name_len; // Length of note name
- uint32_t desc_len; // Length of note descriptor
- uint32_t type; // Type of note (1 is ABI_TAG, 3 is BUILD_ID)
- } notehdr;
- lldb::offset_t offset = 0;
- static const uint32_t g_gnu_build_id = 3; // NT_GNU_BUILD_ID from elf.h
-
- while (true)
- {
- if (data.GetU32 (&offset, ¬ehdr, 3) == NULL)
- return false;
-
- notehdr.name_len = llvm::RoundUpToAlignment (notehdr.name_len, 4);
- notehdr.desc_len = llvm::RoundUpToAlignment (notehdr.desc_len, 4);
-
- lldb::offset_t offset_next_note = offset + notehdr.name_len + notehdr.desc_len;
- // 16 bytes is UUID|MD5, 20 bytes is SHA1
- if ((notehdr.type == g_gnu_build_id) && (notehdr.name_len == 4) &&
- (notehdr.desc_len == 16 || notehdr.desc_len == 20))
- {
- char name[4];
- if (data.GetU8 (&offset, name, 4) == NULL)
- return false;
- if (!strcmp(name, "GNU"))
- {
- uint8_t uuidbuf[20];
- if (data.GetU8 (&offset, &uuidbuf, notehdr.desc_len) == NULL)
- return false;
- uuid.SetBytes (uuidbuf, notehdr.desc_len);
- return true;
- }
- }
- offset = offset_next_note;
- }
- return false;
-}
-
SectionList *
ObjectFileELF::GetSectionList()
{
if (m_sections_ap.get())
return m_sections_ap.get();
- if (ParseSectionHeaders() && GetSectionHeaderStringTable())
+ if (ParseSectionHeaders())
{
m_sections_ap.reset(new SectionList());
for (SectionHeaderCollIter I = m_section_headers.begin();
I != m_section_headers.end(); ++I)
{
- const ELFSectionHeader &header = *I;
+ const ELFSectionHeaderInfo &header = *I;
- ConstString name(m_shstr_data.PeekCStr(header.sh_name));
+ ConstString& name = I->section_name;
const uint64_t file_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
const uint64_t vm_size = header.sh_flags & SHF_ALLOC ? header.sh_size : 0;
@@ -753,7 +902,7 @@ ObjectFileELF::GetSectionList()
SectionType sect_type = eSectionTypeOther;
bool is_thread_specific = false;
-
+
if (name == g_sect_name_text) sect_type = eSectionTypeCode;
else if (name == g_sect_name_data) sect_type = eSectionTypeData;
else if (name == g_sect_name_bss) sect_type = eSectionTypeZeroFill;
@@ -767,6 +916,19 @@ ObjectFileELF::GetSectionList()
sect_type = eSectionTypeZeroFill;
is_thread_specific = true;
}
+ // .debug_abbrev – Abbreviations used in the .debug_info section
+ // .debug_aranges – Lookup table for mapping addresses to compilation units
+ // .debug_frame – Call frame information
+ // .debug_info – The core DWARF information section
+ // .debug_line – Line number information
+ // .debug_loc – Location lists used in DW_AT_location attributes
+ // .debug_macinfo – Macro information
+ // .debug_pubnames – Lookup table for mapping object and function names to compilation units
+ // .debug_pubtypes – Lookup table for mapping type names to compilation units
+ // .debug_ranges – Address ranges used in DW_AT_ranges attributes
+ // .debug_str – String table used in .debug_info
+ // MISSING? .debug-index http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644
+ // MISSING? .debug_types - Type descriptions from DWARF 4? See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo
else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev;
else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges;
else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame;
@@ -779,20 +941,31 @@ ObjectFileELF::GetSectionList()
else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges;
else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr;
else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame;
- else if (header.sh_type == SHT_NOTE)
+
+ switch (header.sh_type)
{
- if (!m_uuid.IsValid())
- {
- DataExtractor data;
- if (vm_size && (GetData (header.sh_offset, vm_size, data) == vm_size))
- {
- ParseNoteGNUBuildID (data, m_uuid);
- }
- }
+ case SHT_SYMTAB:
+ assert (sect_type == eSectionTypeOther);
+ sect_type = eSectionTypeELFSymbolTable;
+ break;
+ case SHT_DYNSYM:
+ assert (sect_type == eSectionTypeOther);
+ sect_type = eSectionTypeELFDynamicSymbols;
+ break;
+ case SHT_RELA:
+ case SHT_REL:
+ assert (sect_type == eSectionTypeOther);
+ sect_type = eSectionTypeELFRelocationEntries;
+ break;
+ case SHT_DYNAMIC:
+ assert (sect_type == eSectionTypeOther);
+ sect_type = eSectionTypeELFDynamicLinkInfo;
+ break;
}
-
+
SectionSP section_sp(new Section(
GetModule(), // Module to which this section belongs.
+ this, // ObjectFile to which this section belongs and should read section data from.
SectionIndex(I), // Section ID.
name, // Section name.
sect_type, // Section type.
@@ -806,18 +979,18 @@ ObjectFileELF::GetSectionList()
section_sp->SetIsThreadSpecific (is_thread_specific);
m_sections_ap->AddSection(section_sp);
}
-
+
m_sections_ap->Finalize(); // Now that we're done adding sections, finalize to build fast-lookup caches
}
return m_sections_ap.get();
}
-static unsigned
-ParseSymbols(Symtab *symtab,
+unsigned
+ObjectFileELF::ParseSymbols(Symtab *symtab,
user_id_t start_id,
SectionList *section_list,
- const ELFSectionHeader *symtab_shdr,
+ const ELFSectionHeaderInfo *symtab_shdr,
const DataExtractor &symtab_data,
const DataExtractor &strtab_data)
{
@@ -936,6 +1109,29 @@ ParseSymbols(Symtab *symtab,
}
}
+ // If the symbol section we've found has no data (SHT_NOBITS), then check the module
+ // for the main object file and use the section there if it has data. This can happen
+ // if we're parsing the debug file and the it has no .text section, for example.
+ if (symbol_section_sp && (symbol_section_sp->GetFileSize() == 0))
+ {
+ ModuleSP module_sp(GetModule());
+ if (module_sp)
+ {
+ ObjectFile *obj_file = module_sp->GetObjectFile();
+ // Check if we've got a different object file than ourselves.
+ if (obj_file && (obj_file != this))
+ {
+ const ConstString §_name = symbol_section_sp->GetName();
+ SectionList *obj_file_section_list = obj_file->GetSectionList();
+ lldb::SectionSP section_sp (obj_file_section_list->FindSectionByName (sect_name));
+ if (section_sp && section_sp->GetFileSize())
+ {
+ symbol_section_sp = section_sp;
+ }
+ }
+ }
+ }
+
uint64_t symbol_value = symbol.st_value;
if (symbol_section_sp)
symbol_value -= symbol_section_sp->GetFileAddress();
@@ -963,18 +1159,17 @@ ParseSymbols(Symtab *symtab,
}
unsigned
-ObjectFileELF::ParseSymbolTable(Symtab *symbol_table, user_id_t start_id,
- const ELFSectionHeader *symtab_hdr,
- user_id_t symtab_id)
+ObjectFileELF::ParseSymbolTable(Symtab *symbol_table, user_id_t start_id, user_id_t symtab_id)
{
- assert(symtab_hdr->sh_type == SHT_SYMTAB ||
- symtab_hdr->sh_type == SHT_DYNSYM);
-
// Parse in the section list if needed.
SectionList *section_list = GetSectionList();
if (!section_list)
return 0;
+ const ELFSectionHeaderInfo *symtab_hdr = &m_section_headers[symtab_id - 1];
+ assert(symtab_hdr->sh_type == SHT_SYMTAB ||
+ symtab_hdr->sh_type == SHT_DYNSYM);
+
// Section ID's are ones based.
user_id_t strtab_id = symtab_hdr->sh_link + 1;
@@ -1040,10 +1235,6 @@ ObjectFileELF::FindDynamicSymbol(unsigne
if (!ParseDynamicSymbols())
return NULL;
- SectionList *section_list = GetSectionList();
- if (!section_list)
- return 0;
-
DynamicSymbolCollIter I = m_dynamic_symbols.begin();
DynamicSymbolCollIter E = m_dynamic_symbols.end();
for ( ; I != E; ++I)
@@ -1057,21 +1248,6 @@ ObjectFileELF::FindDynamicSymbol(unsigne
return NULL;
}
-Section *
-ObjectFileELF::PLTSection()
-{
- const ELFDynamic *symbol = FindDynamicSymbol(DT_JMPREL);
- SectionList *section_list = GetSectionList();
-
- if (symbol && section_list)
- {
- addr_t addr = symbol->d_ptr;
- return section_list->FindSectionContainingFileAddress(addr).get();
- }
-
- return NULL;
-}
-
unsigned
ObjectFileELF::PLTRelocationType()
{
@@ -1160,12 +1336,12 @@ ParsePLTRelocations(Symtab *symbol_table
unsigned
ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table,
user_id_t start_id,
- const ELFSectionHeader *rel_hdr,
+ const ELFSectionHeaderInfo *rel_hdr,
user_id_t rel_id)
{
assert(rel_hdr->sh_type == SHT_RELA || rel_hdr->sh_type == SHT_REL);
- // The link field points to the asscoiated symbol table. The info field
+ // The link field points to the associated symbol table. The info field
// points to the section holding the plt.
user_id_t symtab_id = rel_hdr->sh_link;
user_id_t plt_id = rel_hdr->sh_info;
@@ -1177,11 +1353,11 @@ ObjectFileELF::ParseTrampolineSymbols(Sy
symtab_id++;
plt_id++;
- const ELFSectionHeader *plt_hdr = GetSectionHeaderByIndex(plt_id);
+ const ELFSectionHeaderInfo *plt_hdr = GetSectionHeaderByIndex(plt_id);
if (!plt_hdr)
return 0;
- const ELFSectionHeader *sym_hdr = GetSectionHeaderByIndex(symtab_id);
+ const ELFSectionHeaderInfo *sym_hdr = GetSectionHeaderByIndex(symtab_id);
if (!sym_hdr)
return 0;
@@ -1235,45 +1411,82 @@ ObjectFileELF::ParseTrampolineSymbols(Sy
}
Symtab *
-ObjectFileELF::GetSymtab()
+ObjectFileELF::GetSymtab(uint32_t flags)
{
- if (m_symtab_ap.get())
- return m_symtab_ap.get();
+ ModuleSP module_sp(GetModule());
+ if (module_sp)
+ {
+ lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+
+ bool from_unified_section_list = !!(flags & eSymtabFromUnifiedSectionList);
+ SectionList *section_list = from_unified_section_list ? module_sp->GetUnifiedSectionList() : GetSectionList();
+ if (!section_list)
+ return NULL;
+
+ // If we're doing the unified section list and it has been modified, then clear our
+ // cache and reload the symbols. If needed, we could check on only the sections that
+ // we use to create the symbol table...
+ std::unique_ptr<lldb_private::Symtab> &symtab_ap = from_unified_section_list ? m_symtab_unified_ap : m_symtab_ap;
+ if (from_unified_section_list && (m_symtab_unified_revisionid != section_list->GetRevisionID()))
+ {
+ symtab_ap.reset();
+ m_symtab_unified_revisionid = section_list->GetRevisionID();
+ }
+ else if (symtab_ap.get())
+ {
+ return symtab_ap.get();
+ }
- Symtab *symbol_table = new Symtab(this);
- m_symtab_ap.reset(symbol_table);
+ Symtab *symbol_table = new Symtab(this);
+ symtab_ap.reset(symbol_table);
- Mutex::Locker locker(symbol_table->GetMutex());
-
- if (!(ParseSectionHeaders() && GetSectionHeaderStringTable()))
- return symbol_table;
+ // Sharable objects and dynamic executables usually have 2 distinct symbol
+ // tables, one named ".symtab", and the other ".dynsym". The dynsym is a smaller
+ // version of the symtab that only contains global symbols. The information found
+ // in the dynsym is therefore also found in the symtab, while the reverse is not
+ // necessarily true.
+ Section *section_sym = section_list->FindSectionByType (eSectionTypeELFSymbolTable, true).get();
+ if (!section_sym)
+ {
+ // The symtab section is non-allocable and can be stripped, so if it doesn't exist
+ // then use the dynsym section which should always be there.
+ section_sym = section_list->FindSectionByType (eSectionTypeELFDynamicSymbols, true).get();
+ }
- // Locate and parse all linker symbol tables.
- uint64_t symbol_id = 0;
- for (SectionHeaderCollIter I = m_section_headers.begin();
- I != m_section_headers.end(); ++I)
- {
- if (I->sh_type == SHT_SYMTAB || I->sh_type == SHT_DYNSYM)
+ uint64_t symbol_id = 0;
+ if (section_sym)
{
- const ELFSectionHeader &symtab_header = *I;
- user_id_t section_id = SectionIndex(I);
- symbol_id += ParseSymbolTable(symbol_table, symbol_id,
- &symtab_header, section_id);
+ user_id_t section_id = section_sym->GetID();
+ ObjectFileELF *obj_file_elf = static_cast<ObjectFileELF *>(section_sym->GetObjectFile());
+
+ symbol_id += obj_file_elf->ParseSymbolTable (symbol_table, symbol_id, section_id);
}
- }
-
- // Synthesize trampoline symbols to help navigate the PLT.
- Section *reloc_section = PLTSection();
- if (reloc_section)
- {
- user_id_t reloc_id = reloc_section->GetID();
- const ELFSectionHeader *reloc_header = GetSectionHeaderByIndex(reloc_id);
- assert(reloc_header);
- ParseTrampolineSymbols(symbol_table, symbol_id, reloc_header, reloc_id);
- }
+ Section *section = section_list->FindSectionByType (eSectionTypeELFDynamicLinkInfo, true).get();
+ if (section)
+ {
+ ObjectFileELF *obj_file_elf = static_cast<ObjectFileELF *>(section->GetObjectFile());
- return symbol_table;
+ // Synthesize trampoline symbols to help navigate the PLT.
+ const ELFDynamic *symbol = obj_file_elf->FindDynamicSymbol(DT_JMPREL);
+ if (symbol)
+ {
+ addr_t addr = symbol->d_ptr;
+ Section *reloc_section = section_list->FindSectionContainingFileAddress(addr).get();
+ if (reloc_section)
+ {
+ user_id_t reloc_id = reloc_section->GetID();
+ const ELFSectionHeaderInfo *reloc_header = obj_file_elf->GetSectionHeaderByIndex(reloc_id);
+ assert(reloc_header);
+
+ obj_file_elf->ParseTrampolineSymbols(symbol_table, symbol_id, reloc_header, reloc_id);
+ }
+ }
+ }
+
+ return symbol_table;
+ }
+ return NULL;
}
//===----------------------------------------------------------------------===//
@@ -1472,7 +1685,7 @@ ObjectFileELF::DumpELFProgramHeaders(Str
// Dump a single ELF section header to the specified output stream
//----------------------------------------------------------------------
void
-ObjectFileELF::DumpELFSectionHeader(Stream *s, const ELFSectionHeader &sh)
+ObjectFileELF::DumpELFSectionHeader(Stream *s, const ELFSectionHeaderInfo &sh)
{
s->Printf("%8.8x ", sh.sh_name);
DumpELFSectionHeader_sh_type(s, sh.sh_type);
@@ -1540,7 +1753,7 @@ ObjectFileELF::DumpELFSectionHeader_sh_f
void
ObjectFileELF::DumpELFSectionHeaders(Stream *s)
{
- if (!(ParseSectionHeaders() && GetSectionHeaderStringTable()))
+ if (!ParseSectionHeaders())
return;
s->PutCString("Section Headers\n");
@@ -1557,7 +1770,7 @@ ObjectFileELF::DumpELFSectionHeaders(Str
{
s->Printf("[%2u] ", idx);
ObjectFileELF::DumpELFSectionHeader(s, *I);
- const char* section_name = m_shstr_data.PeekCStr(I->sh_name);
+ const char* section_name = I->section_name.AsCString("");
if (section_name)
*s << ' ' << section_name << "\n";
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Tue Jul 2 16:55:02 2013
@@ -100,7 +100,7 @@ public:
GetAddressByteSize() const;
virtual lldb_private::Symtab *
- GetSymtab();
+ GetSymtab(uint32_t flags = 0);
virtual lldb_private::SectionList *
GetSectionList();
@@ -114,6 +114,9 @@ public:
virtual bool
GetUUID(lldb_private::UUID* uuid);
+ virtual lldb_private::FileSpecList
+ GetDebugSymbolFilePaths();
+
virtual uint32_t
GetDependentModules(lldb_private::FileSpecList& files);
@@ -141,7 +144,11 @@ private:
typedef ProgramHeaderColl::iterator ProgramHeaderCollIter;
typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter;
- typedef std::vector<elf::ELFSectionHeader> SectionHeaderColl;
+ struct ELFSectionHeaderInfo : public elf::ELFSectionHeader
+ {
+ lldb_private::ConstString section_name;
+ };
+ typedef std::vector<ELFSectionHeaderInfo> SectionHeaderColl;
typedef SectionHeaderColl::iterator SectionHeaderCollIter;
typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
@@ -155,9 +162,13 @@ private:
/// ELF file header.
elf::ELFHeader m_header;
- /// ELF build ID
+ /// ELF build ID.
lldb_private::UUID m_uuid;
+ /// ELF .gnu_debuglink file and crc data if available.
+ std::string m_gnu_debuglink_file;
+ uint32_t m_gnu_debuglink_crc;
+
/// Collection of program headers.
ProgramHeaderColl m_program_headers;
@@ -171,9 +182,6 @@ private:
/// libraries) on which this object file depends.
mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
- /// Data extractor holding the string table used to resolve section names.
- lldb_private::DataExtractor m_shstr_data;
-
/// Cached value of the entry point for this module.
lldb_private::Address m_entry_point_address;
@@ -197,6 +205,15 @@ private:
size_t
ParseSectionHeaders();
+ /// Parses the elf section headers and returns the uuid, debug link name, crc.
+ static size_t
+ GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
+ lldb_private::DataExtractor &data,
+ const elf::ELFHeader &header,
+ lldb_private::UUID &uuid,
+ std::string &gnu_debuglink_file,
+ uint32_t &gnu_debuglink_crc);
+
/// Scans the dynamic section and locates all dependent modules (shared
/// libraries) populating m_filespec_ap. This method will compute the
/// dependent module list only once. Returns the number of dependent
@@ -215,23 +232,26 @@ private:
unsigned
ParseSymbolTable(lldb_private::Symtab *symbol_table,
lldb::user_id_t start_id,
- const elf::ELFSectionHeader *symtab_section,
lldb::user_id_t symtab_id);
+ /// Helper routine for ParseSymbolTable().
+ unsigned
+ ParseSymbols(lldb_private::Symtab *symbol_table,
+ lldb::user_id_t start_id,
+ lldb_private::SectionList *section_list,
+ const ELFSectionHeaderInfo *symtab_shdr,
+ const lldb_private::DataExtractor &symtab_data,
+ const lldb_private::DataExtractor &strtab_data);
+
/// Scans the relocation entries and adds a set of artificial symbols to the
/// given symbol table for each PLT slot. Returns the number of symbols
/// added.
unsigned
ParseTrampolineSymbols(lldb_private::Symtab *symbol_table,
lldb::user_id_t start_id,
- const elf::ELFSectionHeader *rela_hdr,
+ const ELFSectionHeaderInfo *rela_hdr,
lldb::user_id_t section_id);
- /// Loads the section name string table into m_shstr_data. Returns the
- /// number of bytes constituting the table.
- size_t
- GetSectionHeaderStringTable();
-
/// Utility method for looking up a section given its name. Returns the
/// index of the corresponding section or zero if no section with the given
/// name can be found (note that section indices are always 1 based, and so
@@ -244,7 +264,7 @@ private:
GetSectionIndexByType(unsigned type);
/// Returns the section header with the given id or NULL.
- const elf::ELFSectionHeader *
+ const ELFSectionHeaderInfo *
GetSectionHeaderByIndex(lldb::user_id_t id);
/// @name ELF header dump routines
@@ -284,7 +304,7 @@ private:
static void
DumpELFSectionHeader(lldb_private::Stream *s,
- const elf::ELFSectionHeader& sh);
+ const ELFSectionHeaderInfo& sh);
static void
DumpELFSectionHeader_sh_type(lldb_private::Stream *s,
@@ -302,9 +322,6 @@ private:
const elf::ELFDynamic *
FindDynamicSymbol(unsigned tag);
- lldb_private::Section *
- PLTSection();
-
unsigned
PLTRelocationType();
};
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Jul 2 16:55:02 2013
@@ -838,6 +838,10 @@ ObjectFileMachO::GetAddressClass (lldb::
case eSectionTypeDWARFAppleObjC:
return eAddressClassDebug;
case eSectionTypeEHFrame: return eAddressClassRuntime;
+ case eSectionTypeELFSymbolTable:
+ case eSectionTypeELFDynamicSymbols:
+ case eSectionTypeELFRelocationEntries:
+ case eSectionTypeELFDynamicLinkInfo:
case eSectionTypeOther: return eAddressClassUnknown;
}
}
@@ -891,7 +895,7 @@ ObjectFileMachO::GetAddressClass (lldb::
}
Symtab *
-ObjectFileMachO::GetSymtab()
+ObjectFileMachO::GetSymtab(uint32_t flags)
{
ModuleSP module_sp(GetModule());
if (module_sp)
@@ -1033,6 +1037,7 @@ ObjectFileMachO::ParseSections ()
if (segment_name || is_core)
{
segment_sp.reset(new Section (module_sp, // Module to which this section belongs
+ this, // Object file to which this sections belongs
++segID << 8, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible
segment_name, // Name of this section
eSectionTypeContainer, // This section is a container of other sections.
@@ -1129,7 +1134,8 @@ ObjectFileMachO::ParseSections ()
{
// Create a fake section for the section's named segment
segment_sp.reset(new Section (segment_sp, // Parent section
- module_sp, // Module to which this section belongs
+ module_sp, // Module to which this section belongs
+ this, // Object file to which this section belongs
++segID << 8, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible
segment_name, // Name of this section
eSectionTypeContainer, // This section is a container of other sections.
@@ -1258,6 +1264,7 @@ ObjectFileMachO::ParseSections ()
SectionSP section_sp(new Section (segment_sp,
module_sp,
+ this,
++sectID,
section_name,
sect_type,
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Tue Jul 2 16:55:02 2013
@@ -102,7 +102,7 @@ public:
GetAddressClass (lldb::addr_t file_addr);
virtual lldb_private::Symtab *
- GetSymtab();
+ GetSymtab(uint32_t flags = 0);
virtual lldb_private::SectionList *
GetSectionList();
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Tue Jul 2 16:55:02 2013
@@ -511,7 +511,7 @@ ObjectFilePECOFF::GetSectionName(std::st
// GetNListSymtab
//----------------------------------------------------------------------
Symtab *
-ObjectFilePECOFF::GetSymtab()
+ObjectFilePECOFF::GetSymtab(uint32_t flags)
{
ModuleSP module_sp(GetModule());
if (module_sp)
@@ -527,7 +527,7 @@ ObjectFilePECOFF::GetSymtab()
if (num_syms > 0 && m_coff_header.symoff > 0)
{
- const uint32_t symbol_size = sizeof(section_header_t);
+ const uint32_t symbol_size = 18;
const uint32_t addr_byte_size = GetAddressByteSize ();
const size_t symbol_data_size = num_syms * symbol_size;
// Include the 4 bytes string table size at the end of the symbols
@@ -535,9 +535,14 @@ ObjectFilePECOFF::GetSymtab()
DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size);
lldb::offset_t offset = symbol_data_size;
const uint32_t strtab_size = symtab_data.GetU32 (&offset);
- DataBufferSP strtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff + symbol_data_size + 4, strtab_size));
+ DataBufferSP strtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff + symbol_data_size, strtab_size));
DataExtractor strtab_data (strtab_data_sp, GetByteOrder(), addr_byte_size);
+ // First 4 bytes should be zeroed after strtab_size has been read,
+ // because it is used as offset 0 to encode a NULL string.
+ uint32_t* strtab_data_start = (uint32_t*)strtab_data_sp->GetBytes();
+ strtab_data_start[0] = 0;
+
offset = 0;
std::string symbol_name;
Symbol *symbols = m_symtab_ap->Resize (num_syms);
@@ -571,12 +576,18 @@ ObjectFilePECOFF::GetSymtab()
symbol.type = symtab_data.GetU16 (&offset);
symbol.storage = symtab_data.GetU8 (&offset);
symbol.naux = symtab_data.GetU8 (&offset);
- Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value);
symbols[i].GetMangled ().SetValue (ConstString(symbol_name.c_str()));
- symbols[i].GetAddress() = symbol_addr;
+ if ((int16_t)symbol.sect >= 1)
+ {
+ Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value);
+ symbols[i].GetAddress() = symbol_addr;
+ }
if (symbol.naux > 0)
+ {
i += symbol.naux;
+ offset += symbol_size;
+ }
}
}
@@ -613,6 +624,18 @@ ObjectFilePECOFF::GetSectionList()
static ConstString g_reloc_sect_name (".reloc");
static ConstString g_stab_sect_name (".stab");
static ConstString g_stabstr_sect_name (".stabstr");
+ static ConstString g_sect_name_dwarf_debug_abbrev (".debug_abbrev");
+ static ConstString g_sect_name_dwarf_debug_aranges (".debug_aranges");
+ static ConstString g_sect_name_dwarf_debug_frame (".debug_frame");
+ static ConstString g_sect_name_dwarf_debug_info (".debug_info");
+ static ConstString g_sect_name_dwarf_debug_line (".debug_line");
+ static ConstString g_sect_name_dwarf_debug_loc (".debug_loc");
+ static ConstString g_sect_name_dwarf_debug_macinfo (".debug_macinfo");
+ static ConstString g_sect_name_dwarf_debug_pubnames (".debug_pubnames");
+ static ConstString g_sect_name_dwarf_debug_pubtypes (".debug_pubtypes");
+ static ConstString g_sect_name_dwarf_debug_ranges (".debug_ranges");
+ static ConstString g_sect_name_dwarf_debug_str (".debug_str");
+ static ConstString g_sect_name_eh_frame (".eh_frame");
SectionType section_type = eSectionTypeOther;
if (m_sect_headers[idx].flags & IMAGE_SCN_CNT_CODE &&
((const_sect_name == g_code_sect_name) || (const_sect_name == g_CODE_sect_name)))
@@ -644,6 +667,18 @@ ObjectFilePECOFF::GetSectionList()
{
section_type = eSectionTypeOther;
}
+ else if (const_sect_name == g_sect_name_dwarf_debug_abbrev) section_type = eSectionTypeDWARFDebugAbbrev;
+ else if (const_sect_name == g_sect_name_dwarf_debug_aranges) section_type = eSectionTypeDWARFDebugAranges;
+ else if (const_sect_name == g_sect_name_dwarf_debug_frame) section_type = eSectionTypeDWARFDebugFrame;
+ else if (const_sect_name == g_sect_name_dwarf_debug_info) section_type = eSectionTypeDWARFDebugInfo;
+ else if (const_sect_name == g_sect_name_dwarf_debug_line) section_type = eSectionTypeDWARFDebugLine;
+ else if (const_sect_name == g_sect_name_dwarf_debug_loc) section_type = eSectionTypeDWARFDebugLoc;
+ else if (const_sect_name == g_sect_name_dwarf_debug_macinfo) section_type = eSectionTypeDWARFDebugMacInfo;
+ else if (const_sect_name == g_sect_name_dwarf_debug_pubnames) section_type = eSectionTypeDWARFDebugPubNames;
+ else if (const_sect_name == g_sect_name_dwarf_debug_pubtypes) section_type = eSectionTypeDWARFDebugPubTypes;
+ else if (const_sect_name == g_sect_name_dwarf_debug_ranges) section_type = eSectionTypeDWARFDebugRanges;
+ else if (const_sect_name == g_sect_name_dwarf_debug_str) section_type = eSectionTypeDWARFDebugStr;
+ else if (const_sect_name == g_sect_name_eh_frame) section_type = eSectionTypeEHFrame;
else if (m_sect_headers[idx].flags & IMAGE_SCN_CNT_CODE)
{
section_type = eSectionTypeCode;
@@ -663,10 +698,11 @@ ObjectFilePECOFF::GetSectionList()
// Use a segment ID of the segment index shifted left by 8 so they
// never conflict with any of the sections.
SectionSP section_sp (new Section (module_sp, // Module to which this section belongs
+ this, // Object file to which this section belongs
idx + 1, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible
const_sect_name, // Name of this section
- section_type, // This section is a container of other sections.
- m_sect_headers[idx].vmaddr, // File VM address == addresses as they are found in the object file
+ section_type, // This section is a container of other sections.
+ m_coff_header_opt.image_base + m_sect_headers[idx].vmaddr, // File VM address == addresses as they are found in the object file
m_sect_headers[idx].vmsize, // VM size in bytes of this section
m_sect_headers[idx].offset, // Offset to the data for this section in the file
m_sect_headers[idx].size, // Size in bytes of this section as found in the the file
Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h Tue Jul 2 16:55:02 2013
@@ -86,7 +86,7 @@ public:
// GetAddressClass (lldb::addr_t file_addr);
//
virtual lldb_private::Symtab *
- GetSymtab();
+ GetSymtab(uint32_t flags = 0);
virtual lldb_private::SectionList *
GetSectionList();
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/Makefile Tue Jul 2 16:55:02 2013
@@ -1,4 +1,4 @@
-##===- source/Plugins/Platform/FreeBSD/Makefile --------------*- Makefile -*-===##
+##===- source/Plugins/Platform/FreeBSD/Makefile ------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Tue Jul 2 16:55:02 2013
@@ -188,7 +188,7 @@ PlatformFreeBSD::ResolveExecutable (cons
if (IsHost())
{
- // If we have "ls" as the exe_file, resolve the executable loation based on
+ // If we have "ls" as the exe_file, resolve the executable location based on
// the current path variables
if (!resolved_exe_file.Exists())
{
@@ -199,9 +199,6 @@ PlatformFreeBSD::ResolveExecutable (cons
if (!resolved_exe_file.Exists())
resolved_exe_file.ResolveExecutableLocation ();
- // Resolve any executable within a bundle on MacOSX
- //Host::ResolveExecutableInBundle (resolved_exe_file);
-
if (resolved_exe_file.Exists())
error.Clear();
else
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Tue Jul 2 16:55:02 2013
@@ -1122,7 +1122,7 @@ PlatformDarwin::GetDeveloperDirectory()
{
const char *cmd_output_ptr = command_output.c_str();
developer_dir_path[sizeof (developer_dir_path) - 1] = '\0';
- int i;
+ size_t i;
for (i = 0; i < sizeof (developer_dir_path) - 1; i++)
{
if (cmd_output_ptr[i] == '\r' || cmd_output_ptr[i] == '\n' || cmd_output_ptr[i] == '\0')
@@ -1181,7 +1181,7 @@ PlatformDarwin::SetThreadCreationBreakpo
};
FileSpecList bp_modules;
- for (int i = 0; i < sizeof(g_bp_modules)/sizeof(const char *); i++)
+ for (size_t i = 0; i < sizeof(g_bp_modules)/sizeof(const char *); i++)
{
const char *bp_module = g_bp_modules[i];
bp_modules.Append(FileSpec(bp_module, false));
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Tue Jul 2 16:55:02 2013
@@ -591,6 +591,8 @@ PlatformDarwinKernel::GetSharedModule (c
Error error;
module_sp.reset();
const FileSpec &platform_file = module_spec.GetFileSpec();
+
+ // Treat the file's path as a kext bundle ID (e.g. "com.apple.driver.AppleIRController") and search our kext index.
std::string kext_bundle_id = platform_file.GetPath();
if (!kext_bundle_id.empty())
{
@@ -611,7 +613,8 @@ PlatformDarwinKernel::GetSharedModule (c
}
}
- return error;
+ // Else fall back to treating the file's path as an actual file path - defer to PlatformDarwin's GetSharedModule.
+ return PlatformDarwin::GetSharedModule (module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr);
}
Error
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/Makefile Tue Jul 2 16:55:02 2013
@@ -24,5 +24,9 @@ DIRS := gdb-server MacOSX Linux FreeBSD
# ifeq ($(HOST_OS),FreeBSD)
# DIRS += FreeBSD
# endif
+#
+# ifeq ($(HOST_OS),GNU/kFreeBSD)
+# DIRS += FreeBSD
+# endif
include $(LLDB_LEVEL)/Makefile
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Tue Jul 2 16:55:02 2013
@@ -418,7 +418,7 @@ PlatformRemoteGDBServer::Attach (lldb_pr
"connect://%s:%u",
override_hostname ? override_hostname : GetHostname (),
port + port_offset);
- assert (connect_url_len < sizeof(connect_url));
+ assert (connect_url_len < (int)sizeof(connect_url));
error = process_sp->ConnectRemote (NULL, connect_url);
if (error.Success())
error = process_sp->Attach(attach_info);
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Tue Jul 2 16:55:02 2013
@@ -11,6 +11,7 @@
#include <errno.h>
#include <poll.h>
#include <string.h>
+#include <stdint.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ptrace.h>
@@ -69,13 +70,13 @@ PtraceWrapper(int req, lldb::pid_t pid,
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
if (log) {
- log->Printf("ptrace(%s, %u, %p, %x) called from file %s line %d",
+ log->Printf("ptrace(%s, %lu, %p, %x) called from file %s line %d",
reqName, pid, addr, data, file, line);
if (req == PT_IO) {
struct ptrace_io_desc *pi = (struct ptrace_io_desc *) addr;
log->Printf("PT_IO: op=%s offs=%zx size=%ld",
- Get_PT_IO_OP(pi->piod_op), pi->piod_offs, pi->piod_len);
+ Get_PT_IO_OP(pi->piod_op), (size_t)pi->piod_offs, pi->piod_len);
}
}
@@ -204,6 +205,7 @@ EnsureFDFlags(int fd, int flags, Error &
class Operation
{
public:
+ virtual ~Operation() {}
virtual void Execute(ProcessMonitor *monitor) = 0;
};
@@ -473,13 +475,19 @@ ResumeOperation::Execute(ProcessMonitor
data = m_signo;
if (PTRACE(PT_CONTINUE, m_tid, (caddr_t)1, data))
+ {
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
+
+ if (log)
+ log->Printf ("ResumeOperation (%" PRIu64 ") failed: %s", m_tid, strerror(errno));
m_result = false;
+ }
else
m_result = true;
}
//------------------------------------------------------------------------------
-/// @class ResumeOperation
+/// @class SingleStepOperation
/// @brief Implements ProcessMonitor::SingleStep.
class SingleStepOperation : public Operation
{
@@ -600,7 +608,7 @@ KillOperation::Execute(ProcessMonitor *m
}
//------------------------------------------------------------------------------
-/// @class KillOperation
+/// @class DetachOperation
/// @brief Implements ProcessMonitor::BringProcessIntoLimbo.
class DetachOperation : public Operation
{
@@ -724,7 +732,7 @@ WAIT_AGAIN:
// Check that the launch was a success.
if (!args->m_error.Success())
{
- StopLaunchOpThread();
+ StopOpThread();
error = args->m_error;
return;
}
@@ -780,10 +788,10 @@ WAIT_AGAIN:
}
}
- // Check that the launch was a success.
+ // Check that the attach was a success.
if (!args->m_error.Success())
{
- StopAttachOpThread();
+ StopOpThread();
error = args->m_error;
return;
}
@@ -818,18 +826,6 @@ ProcessMonitor::StartLaunchOpThread(Laun
Host::ThreadCreate(g_thread_name, LaunchOpThread, args, &error);
}
-void
-ProcessMonitor::StopLaunchOpThread()
-{
- lldb::thread_result_t result;
-
- if (!IS_VALID_LLDB_HOST_THREAD(m_operation_thread))
- return;
-
- Host::ThreadCancel(m_operation_thread, NULL);
- Host::ThreadJoin(m_operation_thread, &result, NULL);
-}
-
void *
ProcessMonitor::LaunchOpThread(void *arg)
{
@@ -856,14 +852,34 @@ ProcessMonitor::Launch(LaunchArgs *args)
const char *stdout_path = args->m_stdout_path;
const char *stderr_path = args->m_stderr_path;
const char *working_dir = args->m_working_dir;
+
+ lldb_utility::PseudoTerminal terminal;
+ const size_t err_len = 1024;
+ char err_str[err_len];
lldb::pid_t pid;
lldb::ThreadSP inferior;
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
// Propagate the environment if one is not supplied.
if (envp == NULL || envp[0] == NULL)
envp = const_cast<const char **>(environ);
+ // Pseudo terminal setup.
+ if (!terminal.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY, err_str, err_len))
+ {
+ args->m_error.SetErrorToGenericError();
+ args->m_error.SetErrorString("Could not open controlling TTY.");
+ goto FINISH;
+ }
+
+ if ((pid = terminal.Fork(err_str, err_len)) == -1)
+ {
+ args->m_error.SetErrorToGenericError();
+ args->m_error.SetErrorString("Process fork failed.");
+ goto FINISH;
+ }
+
// Recognized child exit status codes.
enum {
ePtraceFailed = 1,
@@ -874,8 +890,6 @@ ProcessMonitor::Launch(LaunchArgs *args)
eExecFailed
};
- pid = fork();
-
// Child process.
if (pid == 0)
{
@@ -931,25 +945,25 @@ ProcessMonitor::Launch(LaunchArgs *args)
args->m_error.SetErrorToGenericError();
switch (WEXITSTATUS(status))
{
- case ePtraceFailed:
+ case ePtraceFailed:
args->m_error.SetErrorString("Child ptrace failed.");
break;
- case eDupStdinFailed:
+ case eDupStdinFailed:
args->m_error.SetErrorString("Child open stdin failed.");
break;
- case eDupStdoutFailed:
+ case eDupStdoutFailed:
args->m_error.SetErrorString("Child open stdout failed.");
break;
- case eDupStderrFailed:
+ case eDupStderrFailed:
args->m_error.SetErrorString("Child open stderr failed.");
break;
case eChdirFailed:
args->m_error.SetErrorString("Child failed to set working directory.");
break;
- case eExecFailed:
+ case eExecFailed:
args->m_error.SetErrorString("Child exec failed.");
break;
- default:
+ default:
args->m_error.SetErrorString("Child returned unknown exit status.");
break;
}
@@ -967,10 +981,9 @@ ProcessMonitor::Launch(LaunchArgs *args)
goto FINISH;
}
#endif
- // XXX - Release the master terminal descriptor and pass it off to the
- // XXX - ProcessMonitor instance. Similarly stash the inferior pid.
- // For now just use stdin fd
- monitor->m_terminal_fd = ::dup(STDIN_FILENO);
+ // Release the master terminal descriptor and pass it off to the
+ // ProcessMonitor instance. Similarly stash the inferior pid.
+ monitor->m_terminal_fd = terminal.ReleaseMasterFileDescriptor();
monitor->m_pid = pid;
// Set the terminal fd to be in non blocking mode (it simplifies the
@@ -981,6 +994,8 @@ ProcessMonitor::Launch(LaunchArgs *args)
// Update the process thread list with this new thread.
inferior.reset(new POSIXThread(*processSP, pid));
+ if (log)
+ log->Printf ("ProcessMonitor::%s() adding pid = %" PRIu64, __FUNCTION__, pid);
process.GetThreadList().AddThread(inferior);
// Let our process instance know the thread has stopped.
@@ -1015,12 +1030,6 @@ ProcessMonitor::StartAttachOpThread(Atta
Host::ThreadCreate(g_thread_name, AttachOpThread, args, &error);
}
-void
-ProcessMonitor::StopAttachOpThread()
-{
- assert(!"Not implemented yet!!!");
-}
-
void *
ProcessMonitor::AttachOpThread(void *arg)
{
@@ -1086,10 +1095,22 @@ ProcessMonitor::MonitorCallback(void *ca
ProcessMessage message;
ProcessMonitor *monitor = static_cast<ProcessMonitor*>(callback_baton);
ProcessFreeBSD *process = monitor->m_process;
+ assert(process);
bool stop_monitoring;
siginfo_t info;
int ptrace_err;
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
+
+ if (exited)
+ {
+ if (log)
+ log->Printf ("ProcessMonitor::%s() got exit signal, tid = %" PRIu64, __FUNCTION__, pid);
+ message = ProcessMessage::Exit(pid, status);
+ process->SendMessage(message);
+ return pid == process->GetID();
+ }
+
if (!monitor->GetSignalInfo(pid, &info, ptrace_err))
stop_monitoring = true; // pid is gone. Bail.
else {
@@ -1117,6 +1138,8 @@ ProcessMonitor::MonitorSIGTRAP(ProcessMo
{
ProcessMessage message;
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
+
assert(monitor);
assert(info && info->si_signo == SIGTRAP && "Unexpected child signal!");
@@ -1134,17 +1157,23 @@ ProcessMonitor::MonitorSIGTRAP(ProcessMo
unsigned long data = 0;
if (!monitor->GetEventMessage(pid, &data))
data = -1;
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received exit? event, data = %lx, pid = %" PRIu64, __FUNCTION__, data, pid);
message = ProcessMessage::Limbo(pid, (data >> 8));
break;
}
case 0:
case TRAP_TRACE:
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received trace event, pid = %" PRIu64, __FUNCTION__, pid);
message = ProcessMessage::Trace(pid);
break;
case SI_KERNEL:
case TRAP_BRKPT:
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received breakpoint event, pid = %" PRIu64, __FUNCTION__, pid);
message = ProcessMessage::Break(pid);
break;
}
@@ -1159,6 +1188,8 @@ ProcessMonitor::MonitorSignal(ProcessMon
ProcessMessage message;
int signo = info->si_signo;
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
+
// POSIX says that process behaviour is undefined after it ignores a SIGFPE,
// SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a
// kill(2) or raise(3). Similarly for tgkill(2) on FreeBSD.
@@ -1169,12 +1200,21 @@ ProcessMonitor::MonitorSignal(ProcessMon
// Similarly, ACK signals generated by this monitor.
if (info->si_code == SI_USER)
{
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received signal %s with code %s, pid = %d",
+ __FUNCTION__,
+ monitor->m_process->GetUnixSignals().GetSignalAsCString (signo),
+ "SI_USER",
+ info->si_pid);
if (info->si_pid == getpid())
return ProcessMessage::SignalDelivered(pid, signo);
else
return ProcessMessage::Signal(pid, signo);
}
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received signal %s", __FUNCTION__, monitor->m_process->GetUnixSignals().GetSignalAsCString (signo));
+
if (signo == SIGSEGV) {
lldb::addr_t fault_addr = reinterpret_cast<lldb::addr_t>(info->si_addr);
ProcessMessage::CrashReason reason = GetCrashReasonForSIGSEGV(info);
@@ -1383,7 +1423,8 @@ ProcessMonitor::ServeOperation(Operation
assert(errno == EINTR);
goto READ_AGAIN;
}
-
+ if (status == 0)
+ continue; // Poll again. The connection probably terminated.
assert(status == sizeof(op));
op->Execute(monitor);
write(fdset.fd, &op, sizeof(op));
@@ -1457,19 +1498,6 @@ ProcessMonitor::WriteRegisterValue(lldb:
}
bool
-ProcessMonitor::ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
- return false;
-}
-
-bool
-ProcessMonitor::WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
-{
- return false;
-}
-
-
-bool
ProcessMonitor::ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size)
{
bool result;
@@ -1488,6 +1516,12 @@ ProcessMonitor::ReadFPR(lldb::tid_t tid,
}
bool
+ProcessMonitor::ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
+{
+ return false;
+}
+
+bool
ProcessMonitor::WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size)
{
bool result;
@@ -1506,11 +1540,24 @@ ProcessMonitor::WriteFPR(lldb::tid_t tid
}
bool
+ProcessMonitor::WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
+{
+ return false;
+}
+
+bool
ProcessMonitor::Resume(lldb::tid_t tid, uint32_t signo)
{
bool result;
+ Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
+
+ if (log)
+ log->Printf ("ProcessMonitor::%s() resuming thread = %" PRIu64 " with signal %s", __FUNCTION__, tid,
+ m_process->GetUnixSignals().GetSignalAsCString (signo));
ResumeOperation op(tid, signo, result);
DoOperation(&op);
+ if (log)
+ log->Printf ("ProcessMonitor::%s() resuming result = %s", __FUNCTION__, result ? "true" : "false");
return result;
}
@@ -1550,14 +1597,16 @@ ProcessMonitor::GetEventMessage(lldb::ti
return result;
}
-Error
+lldb_private::Error
ProcessMonitor::Detach(lldb::tid_t tid)
{
- Error result;
- DetachOperation op(result);
- DoOperation(&op);
- StopMonitor();
- return result;
+ lldb_private::Error error;
+ if (tid != LLDB_INVALID_THREAD_ID)
+ {
+ DetachOperation op(error);
+ DoOperation(&op);
+ }
+ return error;
}
bool
@@ -1588,13 +1637,26 @@ void
ProcessMonitor::StopMonitor()
{
StopMonitoringChildProcess();
- StopLaunchOpThread();
+ StopOpThread();
CloseFD(m_terminal_fd);
CloseFD(m_client_fd);
CloseFD(m_server_fd);
}
void
+ProcessMonitor::StopOpThread()
+{
+ lldb::thread_result_t result;
+
+ if (!IS_VALID_LLDB_HOST_THREAD(m_operation_thread))
+ return;
+
+ Host::ThreadCancel(m_operation_thread, NULL);
+ Host::ThreadJoin(m_operation_thread, &result, NULL);
+ m_operation_thread = LLDB_INVALID_HOST_THREAD;
+}
+
+void
ProcessMonitor::CloseFD(int &fd)
{
if (fd != -1)
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/FreeBSD/ProcessMonitor.h Tue Jul 2 16:55:02 2013
@@ -244,9 +244,6 @@ private:
void
StartLaunchOpThread(LaunchArgs *args, lldb_private::Error &error);
- void
- StopLaunchOpThread();
-
static void *
LaunchOpThread(void *arg);
@@ -269,9 +266,6 @@ private:
void
StartAttachOpThread(AttachArgs *args, lldb_private::Error &error);
- void
- StopAttachOpThread();
-
static void *
AttachOpThread(void *args);
@@ -318,6 +312,10 @@ private:
void
StopMonitor();
+ /// Stops the operation thread used to attach/launch a process.
+ void
+ StopOpThread();
+
void
CloseFD(int &fd);
};
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue Jul 2 16:55:02 2013
@@ -741,7 +741,7 @@ ResumeOperation::Execute(ProcessMonitor
}
//------------------------------------------------------------------------------
-/// @class ResumeOperation
+/// @class SingleStepOperation
/// @brief Implements ProcessMonitor::SingleStep.
class SingleStepOperation : public Operation
{
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Tue Jul 2 16:55:02 2013
@@ -42,7 +42,7 @@ CommunicationKDP::CommunicationKDP (cons
Communication(comm_name),
m_addr_byte_size (4),
m_byte_order (eByteOrderLittle),
- m_packet_timeout (1),
+ m_packet_timeout (5),
m_sequence_mutex (Mutex::eMutexTypeRecursive),
m_is_running (false),
m_session_key (0u),
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/Makefile (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/Makefile Tue Jul 2 16:55:02 2013
@@ -24,7 +24,7 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEV
CPPFLAGS += -Wno-extended-offsetof
endif
-ifeq ($(HOST_OS),FreeBSD)
+ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
# Extend the include path so we may locate ProcessMonitor
CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/FreeBSD
endif
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.cpp Tue Jul 2 16:55:02 2013
@@ -56,7 +56,7 @@ POSIXCrashStopInfo::GetStopReason() cons
const char *
POSIXCrashStopInfo::GetDescription()
{
- return ProcessMessage::GetCrashReasonString(m_crash_reason);
+ return ProcessMessage::GetCrashReasonString(m_crash_reason, m_fault_addr);
}
//===----------------------------------------------------------------------===//
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXStopInfo.h Tue Jul 2 16:55:02 2013
@@ -68,10 +68,12 @@ class POSIXCrashStopInfo
: public POSIXStopInfo
{
public:
- POSIXCrashStopInfo(POSIXThread &thread, uint32_t status,
- ProcessMessage::CrashReason reason)
+ POSIXCrashStopInfo(POSIXThread &thread, uint32_t status,
+ ProcessMessage::CrashReason reason,
+ lldb::addr_t fault_addr)
: POSIXStopInfo(thread, status),
- m_crash_reason(reason)
+ m_crash_reason(reason),
+ m_fault_addr(fault_addr)
{ }
~POSIXCrashStopInfo();
@@ -82,11 +84,9 @@ public:
const char *
GetDescription();
- ProcessMessage::CrashReason
- GetCrashReason() const;
-
private:
ProcessMessage::CrashReason m_crash_reason;
+ lldb::addr_t m_fault_addr;
};
//===----------------------------------------------------------------------===//
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.cpp Tue Jul 2 16:55:02 2013
@@ -237,7 +237,8 @@ POSIXThread::Notify(const ProcessMessage
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
- log->Printf ("POSIXThread::%s () message kind = '%s'", __FUNCTION__, message.PrintKind());
+ log->Printf ("POSIXThread::%s () message kind = '%s' for tid %" PRIu64,
+ __FUNCTION__, message.PrintKind(), GetID());
switch (message.GetKind())
{
@@ -407,15 +408,16 @@ POSIXThread::WatchNotify(const ProcessMe
const WatchpointList &wp_list = target.GetWatchpointList();
lldb::WatchpointSP wp_sp = wp_list.FindByAddress(wp_monitor_addr);
- if (wp_sp)
- SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
- wp_sp->GetID()));
+ assert(wp_sp.get() && "No watchpoint found");
+ SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
+ wp_sp->GetID()));
}
}
void
POSIXThread::TraceNotify(const ProcessMessage &message)
{
+#ifndef __FreeBSD__
RegisterContextPOSIX* reg_ctx = GetRegisterContextPOSIX();
if (reg_ctx)
{
@@ -430,6 +432,7 @@ POSIXThread::TraceNotify(const ProcessMe
}
}
}
+#endif
SetStopInfo (StopInfo::CreateStopReasonToTrace(*this));
}
@@ -467,9 +470,12 @@ POSIXThread::CrashNotify(const ProcessMe
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
- log->Printf ("POSIXThread::%s () signo = %i, reason = '%s'", __FUNCTION__, signo, message.PrintCrashReason());
+ log->Printf ("POSIXThread::%s () signo = %i, reason = '%s'",
+ __FUNCTION__, signo, message.PrintCrashReason());
- SetStopInfo (lldb::StopInfoSP(new POSIXCrashStopInfo(*this, signo, message.GetCrashReason())));
+ SetStopInfo (lldb::StopInfoSP(new POSIXCrashStopInfo(*this, signo,
+ message.GetCrashReason(),
+ message.GetFaultAddress())));
SetResumeSignal(signo);
}
@@ -482,13 +488,13 @@ POSIXThread::ThreadNotify(const ProcessM
unsigned
POSIXThread::GetRegisterIndexFromOffset(unsigned offset)
{
- unsigned reg;
+ unsigned reg = LLDB_INVALID_REGNUM;
ArchSpec arch = Host::GetArchitecture();
switch (arch.GetCore())
{
default:
- assert(false && "CPU type not supported!");
+ llvm_unreachable("CPU type not supported!");
break;
case ArchSpec::eCore_x86_32_i386:
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/POSIXThread.h Tue Jul 2 16:55:02 2013
@@ -24,7 +24,7 @@ class RegisterContextPOSIX;
//------------------------------------------------------------------------------
// @class POSIXThread
-// @brief Abstraction of a linux process (thread).
+// @brief Abstraction of a POSIX thread.
class POSIXThread
: public lldb_private::Thread
{
@@ -67,7 +67,7 @@ public:
GetRegisterNameFromOffset(unsigned offset);
//--------------------------------------------------------------------------
- // These methods form a specialized interface to linux threads.
+ // These methods form a specialized interface to POSIX threads.
//
bool Resume();
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.cpp Tue Jul 2 16:55:02 2013
@@ -9,12 +9,25 @@
#include "ProcessMessage.h"
+#include <sstream>
+
using namespace lldb_private;
+namespace {
+
+inline void AppendFaultAddr(std::string& str, lldb::addr_t addr)
+{
+ std::stringstream ss;
+ ss << " (fault address: 0x" << std::hex << addr << ")";
+ str += ss.str();
+}
+
+}
+
const char *
-ProcessMessage::GetCrashReasonString(CrashReason reason)
+ProcessMessage::GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr)
{
- const char *str = NULL;
+ static std::string str;
switch (reason)
{
@@ -24,9 +37,11 @@ ProcessMessage::GetCrashReasonString(Cra
case eInvalidAddress:
str = "invalid address";
+ AppendFaultAddr(str, fault_addr);
break;
case ePrivilegedAddress:
str = "address access protected";
+ AppendFaultAddr(str, fault_addr);
break;
case eIllegalOpcode:
str = "illegal instruction";
@@ -87,7 +102,7 @@ ProcessMessage::GetCrashReasonString(Cra
break;
}
- return str;
+ return str.c_str();
}
const char *
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessMessage.h Tue Jul 2 16:55:02 2013
@@ -164,7 +164,7 @@ public:
}
static const char *
- GetCrashReasonString(CrashReason reason);
+ GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
const char *
PrintCrashReason() const;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Tue Jul 2 16:55:02 2013
@@ -76,13 +76,12 @@ ProcessPOSIX::ProcessPOSIX(Target& targe
m_monitor(NULL),
m_module(NULL),
m_message_mutex (Mutex::eMutexTypeRecursive),
- m_in_limbo(false),
m_exit_now(false)
{
// FIXME: Putting this code in the ctor and saving the byte order in a
// member variable is a hack to avoid const qual issues in GetByteOrder.
lldb::ModuleSP module = GetTarget().GetExecutableModule();
- if (module != NULL && module->GetObjectFile() != NULL)
+ if (module && module->GetObjectFile())
m_byte_order = module->GetObjectFile()->GetByteOrder();
}
@@ -257,18 +256,9 @@ ProcessPOSIX::DoResume()
{
StateType state = GetPrivateState();
- assert(state == eStateStopped || state == eStateCrashed);
+ assert(state == eStateStopped);
- // We are about to resume a thread that will cause the process to exit so
- // set our exit status now. Do not change our state if the inferior
- // crashed.
- if (state == eStateStopped)
- {
- if (m_in_limbo)
- SetExitStatus(m_exit_status, NULL);
- else
- SetPrivateState(eStateRunning);
- }
+ SetPrivateState(eStateRunning);
bool did_resume = false;
uint32_t thread_count = m_thread_list.GetSize(false);
@@ -395,7 +385,6 @@ ProcessPOSIX::SendMessage(const ProcessM
thread->SetState(eStateStopped);
if (message.GetTID() == GetID())
{
- m_in_limbo = true;
m_exit_status = message.GetExitStatus();
if (m_exit_now)
{
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIX.h Tue Jul 2 16:55:02 2013
@@ -171,13 +171,6 @@ protected:
lldb_private::Mutex m_message_mutex;
std::queue<ProcessMessage> m_message_queue;
- /// True when the process has entered a state of "limbo".
- ///
- /// This flag qualifies eStateStopped. It lets us know that when we
- /// continue from this state the process will exit. Also, when true,
- /// Process::m_exit_status is set.
- bool m_in_limbo;
-
/// Drive any exit events to completion.
bool m_exit_now;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIXLog.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIXLog.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/ProcessPOSIXLog.h Tue Jul 2 16:55:02 2013
@@ -1,4 +1,4 @@
-//===-- ProcessLinuxLog.h -----------------------------------------*- C++ -*-===//
+//===-- ProcessPOSIXLog.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ProcessLinuxLog_h_
-#define liblldb_ProcessLinuxLog_h_
+#ifndef liblldb_ProcessPOSIXLog_h_
+#define liblldb_ProcessPOSIXLog_h_
// C Includes
// C++ Includes
@@ -76,16 +76,16 @@ public:
// recursive functions. FIXME: not thread safe!
// Example:
// void NestingFunc() {
- // LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet(POSIX_LOG_ALL));
+ // LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_ALL));
// if (log)
// {
- // ProcessLinuxLog::IncNestLevel();
- // if (ProcessLinuxLog::AtTopNestLevel())
+ // ProcessPOSIXLog::IncNestLevel();
+ // if (ProcessPOSIXLog::AtTopNestLevel())
// log->Print(msg);
// }
// NestingFunc();
// if (log)
- // ProcessLinuxLog::DecNestLevel();
+ // ProcessPOSIXLog::DecNestLevel();
// }
static bool
@@ -108,4 +108,4 @@ public:
}
};
-#endif // liblldb_ProcessLinuxLog_h_
+#endif // liblldb_ProcessPOSIXLog_h_
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp Tue Jul 2 16:55:02 2013
@@ -7,6 +7,7 @@
//
//===---------------------------------------------------------------------===//
+#include "llvm/Support/Compiler.h"
#include "RegisterContextLinux_x86_64.h"
#include <vector>
@@ -29,7 +30,7 @@ do {
} while(false);
#define DR_OFFSET(reg_index) \
- (offsetof(UserArea, u_debugreg[reg_index]))
+ (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
#define UPDATE_DR_INFO(reg_index) \
do { \
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_i386.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_i386.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_i386.cpp Tue Jul 2 16:55:02 2013
@@ -10,6 +10,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Target/Thread.h"
#include "lldb/Host/Endian.h"
+#include "llvm/Support/Compiler.h"
#include "ProcessPOSIX.h"
#include "ProcessPOSIXLog.h"
@@ -175,14 +176,14 @@ g_reg_sets[k_num_register_sets] =
eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg }, NULL, NULL }
#define DEFINE_FP(reg, i) \
- { #reg#i, NULL, FP_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \
- eFormatVectorOfUInt8, \
+ { #reg#i, NULL, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \
+ eEncodingVector, eFormatVectorOfUInt8, \
{ dwarf_##reg##i, dwarf_##reg##i, \
LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }
#define DEFINE_XMM(reg, i) \
- { #reg#i, NULL, XMM_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \
- eFormatVectorOfUInt8, \
+ { #reg#i, NULL, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \
+ eEncodingVector, eFormatVectorOfUInt8, \
{ dwarf_##reg##i, dwarf_##reg##i, \
LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp Tue Jul 2 16:55:02 2013
@@ -18,6 +18,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Host/Endian.h"
+#include "llvm/Support/Compiler.h"
#include "ProcessPOSIX.h"
#include "ProcessMonitor.h"
@@ -326,20 +327,20 @@ static uint32_t value_regs = LLDB_INVALI
eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg }, NULL, NULL }
#define DEFINE_FP(reg, i) \
- { #reg#i, NULL, FP_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \
- eFormatVectorOfUInt8, \
+ { #reg#i, NULL, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \
+ eEncodingVector, eFormatVectorOfUInt8, \
{ gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i, \
LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
#define DEFINE_XMM(reg, i) \
- { #reg#i, NULL, XMM_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \
- eFormatVectorOfUInt8, \
+ { #reg#i, NULL, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \
+ eEncodingVector, eFormatVectorOfUInt8, \
{ gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i, \
LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
#define DEFINE_YMM(reg, i) \
- { #reg#i, NULL, YMM_SIZE, YMM_OFFSET(reg[i]), eEncodingVector, \
- eFormatVectorOfUInt8, \
+ { #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(reg[i]), \
+ eEncodingVector, eFormatVectorOfUInt8, \
{ gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i, \
LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
@@ -1244,6 +1245,15 @@ RegisterContext_x86_64::IsWatchpointVaca
assert(hw_index < NumSupportedHardwareWatchpoints());
+ if (m_watchpoints_initialized == false)
+ {
+ // Reset the debug status and debug control registers
+ RegisterValue zero_bits = RegisterValue(uint64_t(0));
+ if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
+ assert(false && "Could not initialize watchpoint registers");
+ m_watchpoints_initialized = true;
+ }
+
if (ReadRegister(dr7, value))
{
uint64_t val = value.GetAsUInt64();
@@ -1313,15 +1323,6 @@ RegisterContext_x86_64::SetHardwareWatch
if (read == false && write == false)
return false;
- if (m_watchpoints_initialized == false)
- {
- // Reset the debug status and debug control registers
- RegisterValue zero_bits = RegisterValue(uint64_t(0));
- if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
- return false;
- m_watchpoints_initialized = true;
- }
-
if (!IsWatchpointVacant(hw_index))
return false;
@@ -1392,6 +1393,15 @@ RegisterContext_x86_64::IsWatchpointHit(
{
bool is_hit = false;
+ if (m_watchpoints_initialized == false)
+ {
+ // Reset the debug status and debug control registers
+ RegisterValue zero_bits = RegisterValue(uint64_t(0));
+ if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
+ assert(false && "Could not initialize watchpoint registers");
+ m_watchpoints_initialized = true;
+ }
+
if (hw_index < NumSupportedHardwareWatchpoints())
{
RegisterValue value;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Tue Jul 2 16:55:02 2013
@@ -765,8 +765,8 @@ GDBRemoteCommunicationClient::SendContin
while ((found = input.find(end_delimiter, pos)) != std::string::npos)
{
StringExtractorGDBRemote profileDataExtractor(input.substr(pos, found).c_str());
- const std::string& profile_data = HarmonizeThreadIdsForProfileData(process, profileDataExtractor);
- process->BroadcastAsyncProfileData (profile_data.c_str(), profile_data.length());
+ std::string profile_data = HarmonizeThreadIdsForProfileData(process, profileDataExtractor);
+ process->BroadcastAsyncProfileData (profile_data);
pos = found + end_delimiter_len;
}
@@ -1329,7 +1329,7 @@ GDBRemoteCommunicationClient::SendAttach
{
char packet[64];
const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%" PRIx64, pid);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
if (response.IsErrorResponse())
@@ -1360,7 +1360,7 @@ GDBRemoteCommunicationClient::AllocateMe
permissions & lldb::ePermissionsReadable ? "r" : "",
permissions & lldb::ePermissionsWritable ? "w" : "",
permissions & lldb::ePermissionsExecutable ? "x" : "");
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1383,7 +1383,7 @@ GDBRemoteCommunicationClient::Deallocate
m_supports_alloc_dealloc_memory = eLazyBoolYes;
char packet[64];
const int packet_len = ::snprintf(packet, sizeof(packet), "_m%" PRIx64, (uint64_t)addr);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1409,7 +1409,7 @@ GDBRemoteCommunicationClient::Detach (bo
{
char packet[64];
const int packet_len = ::snprintf(packet, sizeof(packet), "qSupportsDetachAndStayStopped:");
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1454,7 +1454,7 @@ GDBRemoteCommunicationClient::GetMemoryR
m_supports_memory_region_info = eLazyBoolYes;
char packet[64];
const int packet_len = ::snprintf(packet, sizeof(packet), "qMemoryRegionInfo:%" PRIx64, (uint64_t)addr);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1557,7 +1557,7 @@ GDBRemoteCommunicationClient::GetWatchpo
{
char packet[64];
const int packet_len = ::snprintf(packet, sizeof(packet), "qWatchpointSupportInfo:");
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1704,7 +1704,7 @@ GDBRemoteCommunicationClient::SetDisable
{
char packet[32];
const int packet_len = ::snprintf (packet, sizeof (packet), "QSetDisableASLR:%i", enable ? 1 : 0);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1787,7 +1787,7 @@ GDBRemoteCommunicationClient::GetProcess
{
char packet[32];
const int packet_len = ::snprintf (packet, sizeof (packet), "qProcessInfoPID:%" PRIu64, pid);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -2002,7 +2002,7 @@ GDBRemoteCommunicationClient::GetUserNam
{
char packet[32];
const int packet_len = ::snprintf (packet, sizeof (packet), "qUserName:%i", uid);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -2032,7 +2032,7 @@ GDBRemoteCommunicationClient::GetGroupNa
{
char packet[32];
const int packet_len = ::snprintf (packet, sizeof (packet), "qGroupName:%i", gid);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -2199,7 +2199,7 @@ GDBRemoteCommunicationClient::SetCurrent
packet_len = ::snprintf (packet, sizeof(packet), "Hg-1");
else
packet_len = ::snprintf (packet, sizeof(packet), "Hg%" PRIx64, tid);
- assert (packet_len + 1 < sizeof(packet));
+ assert (packet_len + 1 < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
@@ -2225,7 +2225,7 @@ GDBRemoteCommunicationClient::SetCurrent
else
packet_len = ::snprintf (packet, sizeof(packet), "Hc%" PRIx64, tid);
- assert (packet_len + 1 < sizeof(packet));
+ assert (packet_len + 1 < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
@@ -2253,7 +2253,7 @@ GDBRemoteCommunicationClient::GetThreadS
{
char packet[256];
int packet_len = ::snprintf(packet, sizeof(packet), "qThreadStopInfo%" PRIx64, tid);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
if (response.IsNormalResponse())
@@ -2293,7 +2293,7 @@ GDBRemoteCommunicationClient::SendGDBSto
addr,
length);
- assert (packet_len + 1 < sizeof(packet));
+ assert (packet_len + 1 < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse(packet, packet_len, response, true))
{
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Tue Jul 2 16:55:02 2013
@@ -247,7 +247,7 @@ GDBRemoteCommunicationServer::SendErrorR
{
char packet[16];
int packet_len = ::snprintf (packet, sizeof(packet), "E%2.2x", err);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
return SendPacketNoLock (packet, packet_len);
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Tue Jul 2 16:55:02 2013
@@ -158,7 +158,7 @@ GDBRemoteRegisterContext::GetPrimordialR
packet_len = ::snprintf (packet, sizeof(packet), "p%x;thread:%4.4" PRIx64 ";", reg, m_thread.GetProtocolID());
else
packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
- assert (packet_len < (sizeof(packet) - 1));
+ assert (packet_len < ((int)sizeof(packet) - 1));
if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false))
return PrivateSetRegisterValue (reg, response);
@@ -199,7 +199,7 @@ GDBRemoteRegisterContext::ReadRegisterBy
packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4" PRIx64 ";", m_thread.GetProtocolID());
else
packet_len = ::snprintf (packet, sizeof(packet), "g");
- assert (packet_len < (sizeof(packet) - 1));
+ assert (packet_len < ((int)sizeof(packet) - 1));
if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false))
{
if (response.IsNormalResponse())
@@ -515,7 +515,7 @@ GDBRemoteRegisterContext::ReadAllRegiste
packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4" PRIx64, m_thread.GetProtocolID());
else
packet_len = ::snprintf (packet, sizeof(packet), "g");
- assert (packet_len < (sizeof(packet) - 1));
+ assert (packet_len < ((int)sizeof(packet) - 1));
if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jul 2 16:55:02 2013
@@ -260,7 +260,7 @@ ProcessGDBRemote::BuildDynamicRegisterIn
++reg_num)
{
const int packet_len = ::snprintf (packet, sizeof(packet), "qRegisterInfo%x", reg_num);
- assert (packet_len < sizeof(packet));
+ assert (packet_len < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
@@ -744,8 +744,14 @@ ProcessGDBRemote::ConnectToDebugserver (
m_gdb_comm.SetConnection (conn_ap.release());
break;
}
+ else if (error.WasInterrupted())
+ {
+ // If we were interrupted, don't keep retrying.
+ break;
+ }
+
retry_count++;
-
+
if (retry_count >= max_retry_count)
break;
@@ -1308,7 +1314,24 @@ ProcessGDBRemote::UpdateThreadList (Thre
tid_t tid = m_thread_ids[i];
ThreadSP thread_sp (old_thread_list_copy.RemoveThreadByProtocolID(tid, false));
if (!thread_sp)
+ {
thread_sp.reset (new ThreadGDBRemote (*this, tid));
+ if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
+ log->Printf(
+ "ProcessGDBRemote::%s Making new thread: %p for thread ID: 0x%" PRIx64 ".\n",
+ __FUNCTION__,
+ thread_sp.get(),
+ thread_sp->GetID());
+ }
+ else
+ {
+ if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
+ log->Printf(
+ "ProcessGDBRemote::%s Found old thread: %p for thread ID: 0x%" PRIx64 ".\n",
+ __FUNCTION__,
+ thread_sp.get(),
+ thread_sp->GetID());
+ }
new_thread_list.AddThread(thread_sp);
}
}
@@ -1397,6 +1420,13 @@ ProcessGDBRemote::SetThreadStopInfo (Str
{
// Create the thread if we need to
thread_sp.reset (new ThreadGDBRemote (*this, tid));
+ Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD));
+ if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
+ log->Printf ("ProcessGDBRemote::%s Adding new thread: %p for thread ID: 0x%" PRIx64 ".\n",
+ __FUNCTION__,
+ thread_sp.get(),
+ thread_sp->GetID());
+
m_thread_list_real.AddThread(thread_sp);
}
gdb_thread = static_cast<ThreadGDBRemote *> (thread_sp.get());
@@ -1936,7 +1966,7 @@ ProcessGDBRemote::DoReadMemory (addr_t a
char packet[64];
const int packet_len = ::snprintf (packet, sizeof(packet), "m%" PRIx64 ",%" PRIx64, (uint64_t)addr, (uint64_t)size);
- assert (packet_len + 1 < sizeof(packet));
+ assert (packet_len + 1 < (int)sizeof(packet));
StringExtractorGDBRemote response;
if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
{
@@ -3072,7 +3102,7 @@ public:
output_strm.Printf (" packet: %s\n", packet_cstr);
std::string &response_str = response.GetStringRef();
- if (strcmp(packet_cstr, "qGetProfileData") == 0)
+ if (strstr(packet_cstr, "qGetProfileData") != NULL)
{
response_str = process->GetGDBRemote().HarmonizeThreadIdsForProfileData(process, response);
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Tue Jul 2 16:55:02 2013
@@ -26,6 +26,7 @@
#include "LogChannelDWARF.h"
#include "NameToDIE.h"
#include "SymbolFileDWARF.h"
+#include "SymbolFileDWARFDebugMap.h"
using namespace lldb;
using namespace lldb_private;
@@ -403,20 +404,26 @@ DWARFCompileUnit::BuildAddressRangeTable
sc.comp_unit = dwarf2Data->GetCompUnitForDWARFCompUnit(this);
if (sc.comp_unit)
{
- LineTable *line_table = sc.comp_unit->GetLineTable();
-
- if (line_table)
+ SymbolFileDWARFDebugMap *debug_map_sym_file = m_dwarf2Data->GetDebugMapSymfile();
+ if (debug_map_sym_file == NULL)
{
- LineTable::FileAddressRanges file_ranges;
- const bool append = true;
- const size_t num_ranges = line_table->GetContiguousFileAddressRanges (file_ranges, append);
- for (uint32_t idx=0; idx<num_ranges; ++idx)
+ LineTable *line_table = sc.comp_unit->GetLineTable();
+
+ if (line_table)
{
- const LineTable::FileAddressRanges::Entry &range = file_ranges.GetEntryRef(idx);
- debug_aranges->AppendRange(GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
- printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
+ LineTable::FileAddressRanges file_ranges;
+ const bool append = true;
+ const size_t num_ranges = line_table->GetContiguousFileAddressRanges (file_ranges, append);
+ for (uint32_t idx=0; idx<num_ranges; ++idx)
+ {
+ const LineTable::FileAddressRanges::Entry &range = file_ranges.GetEntryRef(idx);
+ debug_aranges->AppendRange(GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
+ printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
+ }
}
}
+ else
+ debug_map_sym_file->AddOSOARanges(dwarf2Data,debug_aranges);
}
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Tue Jul 2 16:55:02 2013
@@ -607,9 +607,30 @@ struct DWARFMappedHash
return m_string_table.PeekCStr (key);
}
+ virtual bool
+ ReadHashData (uint32_t hash_data_offset,
+ HashData &hash_data) const
+ {
+ lldb::offset_t offset = hash_data_offset;
+ offset += 4; // Skip string table offset that contains offset of hash name in .debug_str
+ const uint32_t count = m_data.GetU32 (&offset);
+ if (count > 0)
+ {
+ hash_data.resize(count);
+ for (uint32_t i=0; i<count; ++i)
+ {
+ if (!m_header.Read(m_data, &offset, hash_data[i]))
+ return false;
+ }
+ }
+ else
+ hash_data.clear();
+ return true;
+ }
+
virtual Result
GetHashDataForName (const char *name,
- lldb::offset_t* hash_data_offset_ptr,
+ lldb::offset_t* hash_data_offset_ptr,
Pair &pair) const
{
pair.key = m_data.GetU32 (hash_data_offset_ptr);
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp Tue Jul 2 16:55:02 2013
@@ -73,3 +73,15 @@ NameToDIE::Dump (Stream *s)
s->Printf("%p: {0x%8.8x} \"%s\"\n", cstr, m_map.GetValueAtIndexUnchecked(i), cstr);
}
}
+
+void
+NameToDIE::ForEach (std::function <bool(const char *name, uint32_t die_offset)> const &callback) const
+{
+ const uint32_t size = m_map.GetSize();
+ for (uint32_t i=0; i<size; ++i)
+ {
+ if (!callback(m_map.GetCStringAtIndexUnchecked(i),
+ m_map.GetValueAtIndexUnchecked (i)))
+ break;
+ }
+}
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/NameToDIE.h Tue Jul 2 16:55:02 2013
@@ -11,6 +11,9 @@
#define SymbolFileDWARF_NameToDIE_h_
#include "lldb/Core/UniqueCStringMap.h"
+
+#include <functional>
+
#include "lldb/lldb-defines.h"
class SymbolFileDWARF;
@@ -51,6 +54,9 @@ public:
uint32_t cu_end_offset,
DIEArray &info_array) const;
+ void
+ ForEach (std::function <bool(const char *name, uint32_t die_offset)> const &callback) const;
+
protected:
lldb_private::UniqueCStringMap<uint32_t> m_map;
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jul 2 16:55:02 2013
@@ -235,6 +235,193 @@ SymbolFileDWARF::GetTypeList ()
return m_obj_file->GetModule()->GetTypeList();
}
+void
+SymbolFileDWARF::GetTypes (DWARFCompileUnit* cu,
+ const DWARFDebugInfoEntry *die,
+ dw_offset_t min_die_offset,
+ dw_offset_t max_die_offset,
+ uint32_t type_mask,
+ TypeSet &type_set)
+{
+ if (cu)
+ {
+ if (die)
+ {
+ const dw_offset_t die_offset = die->GetOffset();
+
+ if (die_offset >= max_die_offset)
+ return;
+
+ if (die_offset >= min_die_offset)
+ {
+ const dw_tag_t tag = die->Tag();
+
+ bool add_type = false;
+
+ switch (tag)
+ {
+ case DW_TAG_array_type: add_type = (type_mask & eTypeClassArray ) != 0; break;
+ case DW_TAG_unspecified_type:
+ case DW_TAG_base_type: add_type = (type_mask & eTypeClassBuiltin ) != 0; break;
+ case DW_TAG_class_type: add_type = (type_mask & eTypeClassClass ) != 0; break;
+ case DW_TAG_structure_type: add_type = (type_mask & eTypeClassStruct ) != 0; break;
+ case DW_TAG_union_type: add_type = (type_mask & eTypeClassUnion ) != 0; break;
+ case DW_TAG_enumeration_type: add_type = (type_mask & eTypeClassEnumeration ) != 0; break;
+ case DW_TAG_subroutine_type:
+ case DW_TAG_subprogram:
+ case DW_TAG_inlined_subroutine: add_type = (type_mask & eTypeClassFunction ) != 0; break;
+ case DW_TAG_pointer_type: add_type = (type_mask & eTypeClassPointer ) != 0; break;
+ case DW_TAG_rvalue_reference_type:
+ case DW_TAG_reference_type: add_type = (type_mask & eTypeClassReference ) != 0; break;
+ case DW_TAG_typedef: add_type = (type_mask & eTypeClassTypedef ) != 0; break;
+ case DW_TAG_ptr_to_member_type: add_type = (type_mask & eTypeClassMemberPointer ) != 0; break;
+ }
+
+ if (add_type)
+ {
+ const bool assert_not_being_parsed = true;
+ Type *type = ResolveTypeUID (cu, die, assert_not_being_parsed);
+ if (type)
+ {
+ if (type_set.find(type) == type_set.end())
+ type_set.insert(type);
+ }
+ }
+ }
+
+ for (const DWARFDebugInfoEntry *child_die = die->GetFirstChild();
+ child_die != NULL;
+ child_die = child_die->GetSibling())
+ {
+ GetTypes (cu, child_die, min_die_offset, max_die_offset, type_mask, type_set);
+ }
+ }
+ }
+}
+
+size_t
+SymbolFileDWARF::GetTypes (SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ TypeList &type_list)
+
+{
+ TypeSet type_set;
+
+ CompileUnit *comp_unit = NULL;
+ DWARFCompileUnit* dwarf_cu = NULL;
+ if (sc_scope)
+ comp_unit = sc_scope->CalculateSymbolContextCompileUnit();
+
+ if (comp_unit)
+ {
+ dwarf_cu = GetDWARFCompileUnit(comp_unit);
+ if (dwarf_cu == 0)
+ return 0;
+ GetTypes (dwarf_cu,
+ dwarf_cu->DIE(),
+ dwarf_cu->GetOffset(),
+ dwarf_cu->GetNextCompileUnitOffset(),
+ type_mask,
+ type_set);
+ }
+ else
+ {
+ DWARFDebugInfo* info = DebugInfo();
+ if (info)
+ {
+ const size_t num_cus = info->GetNumCompileUnits();
+ for (size_t cu_idx=0; cu_idx<num_cus; ++cu_idx)
+ {
+ dwarf_cu = info->GetCompileUnitAtIndex(cu_idx);
+ if (dwarf_cu)
+ {
+ GetTypes (dwarf_cu,
+ dwarf_cu->DIE(),
+ 0,
+ UINT32_MAX,
+ type_mask,
+ type_set);
+ }
+ }
+ }
+ }
+// if (m_using_apple_tables)
+// {
+// DWARFMappedHash::MemoryTable *apple_types = m_apple_types_ap.get();
+// if (apple_types)
+// {
+// apple_types->ForEach([this, &type_set, apple_types, type_mask](const DWARFMappedHash::DIEInfoArray &die_info_array) -> bool {
+//
+// for (auto die_info: die_info_array)
+// {
+// bool add_type = TagMatchesTypeMask (type_mask, 0);
+// if (!add_type)
+// {
+// dw_tag_t tag = die_info.tag;
+// if (tag == 0)
+// {
+// const DWARFDebugInfoEntry *die = DebugInfo()->GetDIEPtr(die_info.offset, NULL);
+// tag = die->Tag();
+// }
+// add_type = TagMatchesTypeMask (type_mask, tag);
+// }
+// if (add_type)
+// {
+// Type *type = ResolveTypeUID(die_info.offset);
+//
+// if (type_set.find(type) == type_set.end())
+// type_set.insert(type);
+// }
+// }
+// return true; // Keep iterating
+// });
+// }
+// }
+// else
+// {
+// if (!m_indexed)
+// Index ();
+//
+// m_type_index.ForEach([this, &type_set, type_mask](const char *name, uint32_t die_offset) -> bool {
+//
+// bool add_type = TagMatchesTypeMask (type_mask, 0);
+//
+// if (!add_type)
+// {
+// const DWARFDebugInfoEntry *die = DebugInfo()->GetDIEPtr(die_offset, NULL);
+// if (die)
+// {
+// const dw_tag_t tag = die->Tag();
+// add_type = TagMatchesTypeMask (type_mask, tag);
+// }
+// }
+//
+// if (add_type)
+// {
+// Type *type = ResolveTypeUID(die_offset);
+//
+// if (type_set.find(type) == type_set.end())
+// type_set.insert(type);
+// }
+// return true; // Keep iterating
+// });
+// }
+
+ std::set<clang_type_t> clang_type_set;
+ size_t num_types_added = 0;
+ for (Type *type : type_set)
+ {
+ clang_type_t clang_type = type->GetClangForwardType();
+ if (clang_type_set.find(clang_type) == clang_type_set.end())
+ {
+ clang_type_set.insert(clang_type);
+ type_list.Insert (type->shared_from_this());
+ ++num_types_added;
+ }
+ }
+ return num_types_added;
+}
+
//----------------------------------------------------------------------
// Gets the first parent that is a lexical block, function or inlined
@@ -356,7 +543,7 @@ SymbolFileDWARF::InitializeObject()
ModuleSP module_sp (m_obj_file->GetModule());
if (module_sp)
{
- const SectionList *section_list = m_obj_file->GetSectionList();
+ const SectionList *section_list = module_sp->GetUnifiedSectionList();
const Section* section = section_list->FindSectionByName(GetDWARFMachOSegmentName ()).get();
@@ -517,8 +704,9 @@ SymbolFileDWARF::GetCachedSectionData (u
{
if (m_flags.IsClear (got_flag))
{
+ ModuleSP module_sp (m_obj_file->GetModule());
m_flags.Set (got_flag);
- const SectionList *section_list = m_obj_file->GetSectionList();
+ const SectionList *section_list = module_sp->GetUnifiedSectionList();
if (section_list)
{
SectionSP section_sp (section_list->FindSectionByType(sect_type, true));
@@ -867,7 +1055,8 @@ SymbolFileDWARF::ParseCompileUnitFunctio
lldb::addr_t highest_func_addr = func_ranges.GetMaxRangeEnd (0);
if (lowest_func_addr != LLDB_INVALID_ADDRESS && lowest_func_addr <= highest_func_addr)
{
- func_range.GetBaseAddress().ResolveAddressUsingFileSections (lowest_func_addr, m_obj_file->GetSectionList());
+ ModuleSP module_sp (m_obj_file->GetModule());
+ func_range.GetBaseAddress().ResolveAddressUsingFileSections (lowest_func_addr, module_sp->GetUnifiedSectionList());
if (func_range.GetBaseAddress().IsValid())
func_range.SetByteSize(highest_func_addr - lowest_func_addr);
}
@@ -4534,7 +4723,7 @@ SymbolFileDWARF::GetObjCClassSymbol (con
Symbol *objc_class_symbol = NULL;
if (m_obj_file)
{
- Symtab *symtab = m_obj_file->GetSymtab();
+ Symtab *symtab = m_obj_file->GetSymtab (ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
objc_class_symbol = symtab->FindFirstSymbolWithNameAndType (objc_class_name,
@@ -5551,7 +5740,8 @@ SymbolFileDWARF::ParseType (const Symbol
break;
case DW_TAG_unspecified_type:
- if (strcmp(type_name_cstr, "nullptr_t") == 0)
+ if (strcmp(type_name_cstr, "nullptr_t") == 0 ||
+ strcmp(type_name_cstr, "decltype(nullptr)") == 0 )
{
resolve_state = Type::eResolveStateFull;
clang_type = ast.getASTContext()->NullPtrTy.getAsOpaquePtr();
@@ -7242,13 +7432,12 @@ SymbolFileDWARF::ParseVariableDIE
bool linked_oso_file_addr = false;
if (is_external && location_DW_OP_addr == 0)
{
-
// we have a possible uninitialized extern global
ConstString const_name(mangled ? mangled : name);
ObjectFile *debug_map_objfile = debug_map_symfile->GetObjectFile();
if (debug_map_objfile)
{
- Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
+ Symtab *debug_map_symtab = debug_map_objfile->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (debug_map_symtab)
{
Symbol *exe_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Jul 2 16:55:02 2013
@@ -14,6 +14,7 @@
// C++ Includes
#include <list>
#include <map>
+#include <set>
#include <vector>
// Other libraries and framework includes
@@ -121,6 +122,10 @@ public:
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
virtual lldb_private::TypeList *
GetTypeList ();
+ virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list);
+
virtual lldb_private::ClangASTContext &
GetClangASTContext ();
@@ -545,6 +550,16 @@ protected:
bool
FixupAddress (lldb_private::Address &addr);
+ typedef std::set<lldb_private::Type *> TypeSet;
+
+ void
+ GetTypes (DWARFCompileUnit* dwarf_cu,
+ const DWARFDebugInfoEntry *die,
+ dw_offset_t min_die_offset,
+ dw_offset_t max_die_offset,
+ uint32_t type_mask,
+ TypeSet &type_set);
+
lldb::ModuleWP m_debug_map_module_wp;
SymbolFileDWARFDebugMap * m_debug_map_symfile;
clang::TranslationUnitDecl * m_clang_tu_decl;
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Jul 2 16:55:02 2013
@@ -9,6 +9,9 @@
#include "SymbolFileDWARFDebugMap.h"
+#include "DWARFDebugAranges.h"
+
+#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginManager.h"
@@ -72,9 +75,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
{
for (auto comp_unit_info : cu_infos)
{
- Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab();
+ Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
ModuleSP oso_module_sp (oso_objfile->GetModule());
- Symtab *oso_symtab = oso_objfile->GetSymtab();
+ Symtab *oso_symtab = oso_objfile->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction;
//SectionList *oso_sections = oso_objfile->Sections();
@@ -166,7 +169,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
exe_symfile->FinalizeOSOFileRanges (this);
// We don't need the symbols anymore for the .o files
- oso_objfile->ClearSymtab();
+ oso_objfile->ClearSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
}
}
return file_range_map;
@@ -327,7 +330,7 @@ SymbolFileDWARFDebugMap::InitOSO()
// these files exist and also contain valid DWARF. If we get any of that
// then we return the abilities of the first N_OSO's DWARF.
- Symtab* symtab = m_obj_file->GetSymtab();
+ Symtab* symtab = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
@@ -774,7 +777,7 @@ uint32_t
SymbolFileDWARFDebugMap::ResolveSymbolContext (const Address& exe_so_addr, uint32_t resolve_scope, SymbolContext& sc)
{
uint32_t resolved_flags = 0;
- Symtab* symtab = m_obj_file->GetSymtab();
+ Symtab* symtab = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
const addr_t exe_file_addr = exe_so_addr.GetFileAddress();
@@ -1120,6 +1123,43 @@ SymbolFileDWARFDebugMap::FindFunctions (
return sc_list.GetSize() - initial_size;
}
+size_t
+SymbolFileDWARFDebugMap::GetTypes (SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ TypeList &type_list)
+{
+ Timer scoped_timer (__PRETTY_FUNCTION__,
+ "SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)",
+ type_mask);
+
+
+ uint32_t initial_size = type_list.GetSize();
+ SymbolFileDWARF *oso_dwarf = NULL;
+ if (sc_scope)
+ {
+ SymbolContext sc;
+ sc_scope->CalculateSymbolContext(&sc);
+
+ CompileUnitInfo *cu_info = GetCompUnitInfo (sc);
+ if (cu_info)
+ {
+ oso_dwarf = GetSymbolFileByCompUnitInfo (cu_info);
+ if (oso_dwarf)
+ oso_dwarf->GetTypes (sc_scope, type_mask, type_list);
+ }
+ }
+ else
+ {
+ uint32_t oso_idx = 0;
+ while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL)
+ {
+ oso_dwarf->GetTypes (sc_scope, type_mask, type_list);
+ }
+ }
+ return type_list.GetSize() - initial_size;
+}
+
+
TypeSP
SymbolFileDWARFDebugMap::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx)
{
@@ -1505,4 +1545,30 @@ SymbolFileDWARFDebugMap::LinkOSOLineTabl
return NULL;
}
+size_t
+SymbolFileDWARFDebugMap::AddOSOARanges (SymbolFileDWARF* dwarf2Data, DWARFDebugAranges* debug_aranges)
+{
+ size_t num_line_entries_added = 0;
+ if (debug_aranges && dwarf2Data)
+ {
+ CompileUnitInfo *compile_unit_info = GetCompileUnitInfo(dwarf2Data);
+ if (compile_unit_info)
+ {
+ const FileRangeMap &file_range_map = compile_unit_info->GetFileRangeMap(this);
+ for (size_t idx = 0;
+ idx < file_range_map.GetSize();
+ idx++)
+ {
+ const FileRangeMap::Entry* entry = file_range_map.GetEntryAtIndex(idx);
+ if (entry)
+ {
+ printf ("[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", entry->GetRangeBase(), entry->GetRangeEnd());
+ debug_aranges->AppendRange(dwarf2Data->GetID(), entry->GetRangeBase(), entry->GetRangeEnd());
+ num_line_entries_added++;
+ }
+ }
+ }
+ }
+ return num_line_entries_added;
+}
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Tue Jul 2 16:55:02 2013
@@ -23,6 +23,7 @@
class SymbolFileDWARF;
class DWARFCompileUnit;
+class DWARFDebugAranges;
class DWARFDebugInfoEntry;
class DWARFDeclContext;
class DebugMapModule;
@@ -85,9 +86,12 @@ public:
virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
virtual lldb_private::ClangNamespaceDecl
- FindNamespace (const lldb_private::SymbolContext& sc,
- const lldb_private::ConstString &name,
- const lldb_private::ClangNamespaceDecl *parent_namespace_decl);
+ FindNamespace (const lldb_private::SymbolContext& sc,
+ const lldb_private::ConstString &name,
+ const lldb_private::ClangNamespaceDecl *parent_namespace_decl);
+ virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list);
//------------------------------------------------------------------
@@ -125,6 +129,7 @@ protected:
kNumFlags
};
+ friend class DWARFCompileUnit;
friend class SymbolFileDWARF;
friend class DebugMapModule;
struct OSOInfo
@@ -406,6 +411,10 @@ protected:
lldb_private::LineTable *
LinkOSOLineTable (SymbolFileDWARF *oso_symfile,
lldb_private::LineTable *line_table);
+
+ size_t
+ AddOSOARanges (SymbolFileDWARF* dwarf2Data,
+ DWARFDebugAranges* debug_aranges);
};
#endif // #ifndef SymbolFileDWARF_SymbolFileDWARFDebugMap_h_
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Tue Jul 2 16:55:02 2013
@@ -60,6 +60,12 @@ SymbolFileSymtab::CreateInstance (Object
return new SymbolFileSymtab(obj_file);
}
+size_t
+SymbolFileSymtab::GetTypes (SymbolContextScope *sc_scope, uint32_t type_mask, lldb_private::TypeList &type_list)
+{
+ return 0;
+}
+
SymbolFileSymtab::SymbolFileSymtab(ObjectFile* obj_file) :
SymbolFile(obj_file),
m_source_indexes(),
@@ -87,7 +93,7 @@ SymbolFileSymtab::CalculateAbilities ()
uint32_t abilities = 0;
if (m_obj_file)
{
- const Symtab *symtab = m_obj_file->GetSymtab();
+ const Symtab *symtab = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
//----------------------------------------------------------------------
@@ -153,7 +159,7 @@ SymbolFileSymtab::ParseCompileUnitAtInde
// the entire object file
if (idx < m_source_indexes.size())
{
- const Symbol *cu_symbol = m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
+ const Symbol *cu_symbol = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList)->SymbolAtIndex(m_source_indexes[idx]);
if (cu_symbol)
cu_sp.reset(new CompileUnit (m_obj_file->GetModule(), NULL, cu_symbol->GetMangled().GetName().AsCString(), 0, eLanguageTypeUnknown));
}
@@ -173,7 +179,7 @@ SymbolFileSymtab::ParseCompileUnitFuncti
size_t num_added = 0;
// We must at least have a valid compile unit
assert (sc.comp_unit != NULL);
- const Symtab *symtab = m_obj_file->GetSymtab();
+ const Symtab *symtab = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
const Symbol *curr_symbol = NULL;
const Symbol *next_symbol = NULL;
// const char *prefix = m_obj_file->SymbolPrefix();
@@ -301,13 +307,13 @@ SymbolFileSymtab::FindNamespace (const S
uint32_t
SymbolFileSymtab::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc)
{
- if (m_obj_file->GetSymtab() == NULL)
+ if (m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList) == NULL)
return 0;
uint32_t resolved_flags = 0;
if (resolve_scope & eSymbolContextSymbol)
{
- sc.symbol = m_obj_file->GetSymtab()->FindSymbolContainingFileAddress(so_addr.GetFileAddress());
+ sc.symbol = m_obj_file->GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList)->FindSymbolContainingFileAddress(so_addr.GetFileAddress());
if (sc.symbol)
resolved_flags |= eSymbolContextSymbol;
}
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Tue Jul 2 16:55:02 2013
@@ -102,8 +102,10 @@ public:
virtual uint32_t
FindTypes (const lldb_private::SymbolContext& sc,const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
-// virtual uint32_t
-// FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::TypeList& types);
+ virtual size_t
+ GetTypes (lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list);
virtual lldb_private::ClangNamespaceDecl
FindNamespace (const lldb_private::SymbolContext& sc,
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -1,3 +1,5 @@
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_subdirectory(MacOSX)
endif()
+
+add_subdirectory(ELF)
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Tue Jul 2 16:55:02 2013
@@ -83,7 +83,7 @@ UUIDsMatch(Module *module, ObjectFile *o
return false;
}
-static void
+static bool
ReplaceDSYMSectionsWithExecutableSections (ObjectFile *exec_objfile, ObjectFile *dsym_objfile)
{
// We need both the executable and the dSYM to live off of the
@@ -123,7 +123,9 @@ ReplaceDSYMSectionsWithExecutableSection
}
dsym_section_list->Finalize(); // Now that we're done adding sections, finalize to build fast-lookup caches
+ return true;
}
+ return false;
}
void
@@ -169,6 +171,15 @@ SymbolVendorMacOSX::CreateInstance (cons
if (!module_sp)
return NULL;
+ ObjectFile * obj_file = module_sp->GetObjectFile();
+ if (!obj_file)
+ return NULL;
+
+ static ConstString obj_file_macho("mach-o");
+ ConstString obj_name = obj_file->GetPluginName();
+ if (obj_name != obj_file_macho)
+ return NULL;
+
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolVendorMacOSX::CreateInstance (module = %s)",
module_sp->GetFileSpec().GetPath().c_str());
@@ -179,119 +190,115 @@ SymbolVendorMacOSX::CreateInstance (cons
path[0] = '\0';
// Try and locate the dSYM file on Mac OS X
- ObjectFile * obj_file = module_sp->GetObjectFile();
- if (obj_file)
- {
- Timer scoped_timer2 ("SymbolVendorMacOSX::CreateInstance () locate dSYM",
- "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
- module_sp->GetFileSpec().GetPath().c_str());
-
- // First check to see if the module has a symbol file in mind already.
- // If it does, then we MUST use that.
- FileSpec dsym_fspec (module_sp->GetSymbolFileFileSpec());
+ Timer scoped_timer2 ("SymbolVendorMacOSX::CreateInstance () locate dSYM",
+ "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
+ module_sp->GetFileSpec().GetPath().c_str());
+
+ // First check to see if the module has a symbol file in mind already.
+ // If it does, then we MUST use that.
+ FileSpec dsym_fspec (module_sp->GetSymbolFileFileSpec());
- ObjectFileSP dsym_objfile_sp;
- if (!dsym_fspec)
- {
- // No symbol file was specified in the module, lets try and find
- // one ourselves.
- FileSpec file_spec = obj_file->GetFileSpec();
- if (!file_spec)
- file_spec = module_sp->GetFileSpec();
+ ObjectFileSP dsym_objfile_sp;
+ if (!dsym_fspec)
+ {
+ // No symbol file was specified in the module, lets try and find
+ // one ourselves.
+ FileSpec file_spec = obj_file->GetFileSpec();
+ if (!file_spec)
+ file_spec = module_sp->GetFileSpec();
- ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
- module_spec.GetUUID() = module_sp->GetUUID();
- dsym_fspec = Symbols::LocateExecutableSymbolFile (module_spec);
- if (module_spec.GetSourceMappingList().GetSize())
- module_sp->GetSourceMappingList().Append (module_spec.GetSourceMappingList (), true);
- }
+ ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
+ module_spec.GetUUID() = module_sp->GetUUID();
+ dsym_fspec = Symbols::LocateExecutableSymbolFile (module_spec);
+ if (module_spec.GetSourceMappingList().GetSize())
+ module_sp->GetSourceMappingList().Append (module_spec.GetSourceMappingList (), true);
+ }
- if (dsym_fspec)
+ if (dsym_fspec)
+ {
+ DataBufferSP dsym_file_data_sp;
+ lldb::offset_t dsym_file_data_offset = 0;
+ dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp, dsym_file_data_offset);
+ if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm))
{
- DataBufferSP dsym_file_data_sp;
- lldb::offset_t dsym_file_data_offset = 0;
- dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp, dsym_file_data_offset);
- if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm))
+ char dsym_path[PATH_MAX];
+ if (module_sp->GetSourceMappingList().IsEmpty() && dsym_fspec.GetPath(dsym_path, sizeof(dsym_path)))
{
- char dsym_path[PATH_MAX];
- if (module_sp->GetSourceMappingList().IsEmpty() && dsym_fspec.GetPath(dsym_path, sizeof(dsym_path)))
+ lldb_private::UUID dsym_uuid;
+ if (dsym_objfile_sp->GetUUID(&dsym_uuid))
{
- lldb_private::UUID dsym_uuid;
- if (dsym_objfile_sp->GetUUID(&dsym_uuid))
+ std::string uuid_str = dsym_uuid.GetAsString ();
+ if (!uuid_str.empty())
{
- std::string uuid_str = dsym_uuid.GetAsString ();
- if (!uuid_str.empty())
+ char *resources = strstr (dsym_path, "/Contents/Resources/");
+ if (resources)
{
- char *resources = strstr (dsym_path, "/Contents/Resources/");
- if (resources)
+ char dsym_uuid_plist_path[PATH_MAX];
+ resources[strlen("/Contents/Resources/")] = '\0';
+ snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_str.c_str());
+ FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false);
+ if (dsym_uuid_plist_spec.Exists())
{
- char dsym_uuid_plist_path[PATH_MAX];
- resources[strlen("/Contents/Resources/")] = '\0';
- snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_str.c_str());
- FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false);
- if (dsym_uuid_plist_spec.Exists())
+ xmlDoc *doc = ::xmlReadFile (dsym_uuid_plist_path, NULL, 0);
+ if (doc)
{
- xmlDoc *doc = ::xmlReadFile (dsym_uuid_plist_path, NULL, 0);
- if (doc)
+ char DBGBuildSourcePath[PATH_MAX];
+ char DBGSourcePath[PATH_MAX];
+ DBGBuildSourcePath[0] = '\0';
+ DBGSourcePath[0] = '\0';
+ for (xmlNode *node = doc->children; node; node = node ? node->next : NULL)
{
- char DBGBuildSourcePath[PATH_MAX];
- char DBGSourcePath[PATH_MAX];
- DBGBuildSourcePath[0] = '\0';
- DBGSourcePath[0] = '\0';
- for (xmlNode *node = doc->children; node; node = node ? node->next : NULL)
+ if (node->type == XML_ELEMENT_NODE)
{
- if (node->type == XML_ELEMENT_NODE)
+ if (node->name && strcmp((const char*)node->name, "plist") == 0)
{
- if (node->name && strcmp((const char*)node->name, "plist") == 0)
+ xmlNode *dict_node = node->children;
+ while (dict_node && dict_node->type != XML_ELEMENT_NODE)
+ dict_node = dict_node->next;
+ if (dict_node && dict_node->name && strcmp((const char *)dict_node->name, "dict") == 0)
{
- xmlNode *dict_node = node->children;
- while (dict_node && dict_node->type != XML_ELEMENT_NODE)
- dict_node = dict_node->next;
- if (dict_node && dict_node->name && strcmp((const char *)dict_node->name, "dict") == 0)
+ for (xmlNode *key_node = dict_node->children; key_node; key_node = key_node->next)
{
- for (xmlNode *key_node = dict_node->children; key_node; key_node = key_node->next)
+ if (key_node && key_node->type == XML_ELEMENT_NODE && key_node->name)
{
- if (key_node && key_node->type == XML_ELEMENT_NODE && key_node->name)
+ if (strcmp((const char *)key_node->name, "key") == 0)
{
- if (strcmp((const char *)key_node->name, "key") == 0)
+ const char *key_name = (const char *)::xmlNodeGetContent(key_node);
+ if (strcmp(key_name, "DBGBuildSourcePath") == 0)
{
- const char *key_name = (const char *)::xmlNodeGetContent(key_node);
- if (strcmp(key_name, "DBGBuildSourcePath") == 0)
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (value_node && value_node->name)
{
- xmlNode *value_node = key_node->next;
- while (value_node && value_node->type != XML_ELEMENT_NODE)
- value_node = value_node->next;
- if (value_node && value_node->name)
+ if (strcmp((const char *)value_node->name, "string") == 0)
{
- if (strcmp((const char *)value_node->name, "string") == 0)
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
{
- const char *node_content = (const char *)::xmlNodeGetContent(value_node);
- if (node_content)
- {
- strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath));
- }
+ strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath));
}
- key_node = value_node;
}
+ key_node = value_node;
}
- else if (strcmp(key_name, "DBGSourcePath") == 0)
+ }
+ else if (strcmp(key_name, "DBGSourcePath") == 0)
+ {
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (value_node && value_node->name)
{
- xmlNode *value_node = key_node->next;
- while (value_node && value_node->type != XML_ELEMENT_NODE)
- value_node = value_node->next;
- if (value_node && value_node->name)
+ if (strcmp((const char *)value_node->name, "string") == 0)
{
- if (strcmp((const char *)value_node->name, "string") == 0)
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
{
- const char *node_content = (const char *)::xmlNodeGetContent(value_node);
- if (node_content)
- {
- FileSpec resolved_source_path(node_content, true);
- resolved_source_path.GetPath(DBGSourcePath, sizeof(DBGSourcePath));
- }
+ FileSpec resolved_source_path(node_content, true);
+ resolved_source_path.GetPath(DBGSourcePath, sizeof(DBGSourcePath));
}
- key_node = value_node;
}
+ key_node = value_node;
}
}
}
@@ -300,30 +307,39 @@ SymbolVendorMacOSX::CreateInstance (cons
}
}
}
- ::xmlFreeDoc (doc);
+ }
+ ::xmlFreeDoc (doc);
- if (DBGBuildSourcePath[0] && DBGSourcePath[0])
- {
- module_sp->GetSourceMappingList().Append (ConstString(DBGBuildSourcePath), ConstString(DBGSourcePath), true);
- }
+ if (DBGBuildSourcePath[0] && DBGSourcePath[0])
+ {
+ module_sp->GetSourceMappingList().Append (ConstString(DBGBuildSourcePath), ConstString(DBGSourcePath), true);
}
}
}
}
}
}
+ }
- ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get());
- symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
- return symbol_vendor;
+ if (ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get()))
+ {
+ SectionList *section_list = dsym_objfile_sp.get()->GetSectionList();
+ if (section_list)
+ {
+ section_list->Copy (module_sp->GetUnifiedSectionList());
+ section_list->Finalize ();
+ }
}
- }
- // Just create our symbol vendor using the current objfile as this is either
- // an executable with no dSYM (that we could locate), an executable with
- // a dSYM that has a UUID that doesn't match.
- symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this());
+ symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
+ return symbol_vendor;
+ }
}
+
+ // Just create our symbol vendor using the current objfile as this is either
+ // an executable with no dSYM (that we could locate), an executable with
+ // a dSYM that has a UUID that doesn't match.
+ symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this());
}
return symbol_vendor;
}
Modified: lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp Tue Jul 2 16:55:02 2013
@@ -1874,7 +1874,7 @@ ClangASTContext::AddMethodToCXXRecordTyp
llvm::SmallVector<ParmVarDecl *, 12> params;
- for (int param_index = 0;
+ for (unsigned param_index = 0;
param_index < num_params;
++param_index)
{
@@ -2817,7 +2817,7 @@ ClangASTContext::AddMethodToObjCObjectTy
{
llvm::SmallVector<ParmVarDecl *, 12> params;
- for (int param_index = 0; param_index < num_args; ++param_index)
+ for (unsigned param_index = 0; param_index < num_args; ++param_index)
{
params.push_back (ParmVarDecl::Create (*ast,
objc_method_decl,
@@ -2996,6 +2996,11 @@ ClangASTContext::GetTypeInfo
break;
case clang::BuiltinType::ObjCSel:
+ if (ast && pointee_or_element_clang_type)
+ *pointee_or_element_clang_type = ast->CharTy.getAsOpaquePtr();
+ builtin_type_flags |= eTypeIsPointer | eTypeIsObjC;
+ break;
+
case clang::BuiltinType::Bool:
case clang::BuiltinType::Char_U:
case clang::BuiltinType::UChar:
@@ -3384,6 +3389,19 @@ ClangASTContext::GetNumDirectBaseClasses
}
break;
+ case clang::Type::ObjCObjectPointer:
+ if (GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+ if (class_interface_decl && class_interface_decl->getSuperClass())
+ count = 1;
+ }
+ }
+ break;
+
case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
if (GetCompleteQualType (ast, qual_type))
@@ -3498,6 +3516,20 @@ ClangASTContext::GetNumFields (clang::AS
count = ClangASTContext::GetNumFields(ast, cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
break;
+ case clang::Type::ObjCObjectPointer:
+ if (GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+
+ if (class_interface_decl)
+ count = class_interface_decl->ivar_size();
+ }
+ }
+ break;
+
case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
if (GetCompleteQualType (ast, qual_type))
@@ -3550,9 +3582,9 @@ ClangASTContext::GetDirectBaseClassAtInd
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(cxx_record_decl);
const CXXRecordDecl *base_class_decl = cast<CXXRecordDecl>(base_class->getType()->getAs<RecordType>()->getDecl());
-// if (base_class->isVirtual())
-// *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
-// else
+ if (base_class->isVirtual())
+ *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
+ else
*bit_offset_ptr = record_layout.getBaseClassOffset(base_class_decl).getQuantity() * 8;
}
return base_class->getType().getAsOpaquePtr();
@@ -3561,6 +3593,27 @@ ClangASTContext::GetDirectBaseClassAtInd
}
}
break;
+
+ case clang::Type::ObjCObjectPointer:
+ if (idx == 0 && GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+ if (class_interface_decl)
+ {
+ ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
+ if (superclass_interface_decl)
+ {
+ if (bit_offset_ptr)
+ *bit_offset_ptr = 0;
+ return ast->getObjCInterfaceType(superclass_interface_decl).getAsOpaquePtr();
+ }
+ }
+ }
+ }
+ break;
case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
@@ -3675,10 +3728,69 @@ ClangASTContext::GetVirtualBaseClassAtIn
return NULL;
}
+static clang_type_t
+GetObjCFieldAtIndex (clang::ASTContext *ast,
+ ObjCInterfaceDecl * class_interface_decl,
+ size_t idx,
+ std::string& name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr)
+{
+ if (class_interface_decl)
+ {
+ if (idx < (class_interface_decl->ivar_size()))
+ {
+ ObjCInterfaceDecl::ivar_iterator ivar_pos, ivar_end = class_interface_decl->ivar_end();
+ uint32_t ivar_idx = 0;
+
+ for (ivar_pos = class_interface_decl->ivar_begin(); ivar_pos != ivar_end; ++ivar_pos, ++ivar_idx)
+ {
+ if (ivar_idx == idx)
+ {
+ const ObjCIvarDecl* ivar_decl = *ivar_pos;
+
+ QualType ivar_qual_type(ivar_decl->getType());
+
+ name.assign(ivar_decl->getNameAsString());
+
+ if (bit_offset_ptr)
+ {
+ const ASTRecordLayout &interface_layout = ast->getASTObjCInterfaceLayout(class_interface_decl);
+ *bit_offset_ptr = interface_layout.getFieldOffset (ivar_idx);
+ }
+
+ const bool is_bitfield = ivar_pos->isBitField();
+
+ if (bitfield_bit_size_ptr)
+ {
+ *bitfield_bit_size_ptr = 0;
+
+ if (is_bitfield && ast)
+ {
+ Expr *bitfield_bit_size_expr = ivar_pos->getBitWidth();
+ llvm::APSInt bitfield_apsint;
+ if (bitfield_bit_size_expr && bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint, *ast))
+ {
+ *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
+ }
+ }
+ }
+ if (is_bitfield_ptr)
+ *is_bitfield_ptr = is_bitfield;
+
+ return ivar_qual_type.getAsOpaquePtr();
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
clang_type_t
-ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
+ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
- size_t idx,
+ size_t idx,
std::string& name,
uint64_t *bit_offset_ptr,
uint32_t *bitfield_bit_size_ptr,
@@ -3739,6 +3851,18 @@ ClangASTContext::GetFieldAtIndex (clang:
}
break;
+ case clang::Type::ObjCObjectPointer:
+ if (GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectPointerType *objc_class_type = qual_type->getAsObjCInterfacePointerType();
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterfaceDecl();
+ return GetObjCFieldAtIndex(ast, class_interface_decl, idx, name, bit_offset_ptr, bitfield_bit_size_ptr, is_bitfield_ptr);
+ }
+ }
+ break;
+
case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
if (GetCompleteQualType (ast, qual_type))
@@ -3748,54 +3872,7 @@ ClangASTContext::GetFieldAtIndex (clang:
if (objc_class_type)
{
ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
-
- if (class_interface_decl)
- {
- if (idx < (class_interface_decl->ivar_size()))
- {
- ObjCInterfaceDecl::ivar_iterator ivar_pos, ivar_end = class_interface_decl->ivar_end();
- uint32_t ivar_idx = 0;
-
- for (ivar_pos = class_interface_decl->ivar_begin(); ivar_pos != ivar_end; ++ivar_pos, ++ivar_idx)
- {
- if (ivar_idx == idx)
- {
- const ObjCIvarDecl* ivar_decl = *ivar_pos;
-
- QualType ivar_qual_type(ivar_decl->getType());
-
- name.assign(ivar_decl->getNameAsString());
-
- if (bit_offset_ptr)
- {
- const ASTRecordLayout &interface_layout = ast->getASTObjCInterfaceLayout(class_interface_decl);
- *bit_offset_ptr = interface_layout.getFieldOffset (ivar_idx);
- }
-
- const bool is_bitfield = ivar_pos->isBitField();
-
- if (bitfield_bit_size_ptr)
- {
- *bitfield_bit_size_ptr = 0;
-
- if (is_bitfield && ast)
- {
- Expr *bitfield_bit_size_expr = ivar_pos->getBitWidth();
- llvm::APSInt bitfield_apsint;
- if (bitfield_bit_size_expr && bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint, *ast))
- {
- *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
- }
- }
- }
- if (is_bitfield_ptr)
- *is_bitfield_ptr = is_bitfield;
-
- return ivar_qual_type.getAsOpaquePtr();
- }
- }
- }
- }
+ return GetObjCFieldAtIndex(ast, class_interface_decl, idx, name, bit_offset_ptr, bitfield_bit_size_ptr, is_bitfield_ptr);
}
}
break;
@@ -3843,10 +3920,10 @@ ClangASTContext::GetIndexOfFieldWithName
uint32_t *bitfield_bit_size_ptr,
bool *is_bitfield_ptr)
{
- auto count = ClangASTContext::GetNumFields(ast, clang_type);
+ unsigned count = ClangASTContext::GetNumFields(ast, clang_type);
lldb::clang_type_t field_clang_type_internal;
std::string field_name;
- for (auto index = 0; index < count; index++)
+ for (unsigned index = 0; index < count; index++)
{
field_clang_type_internal = ClangASTContext::GetFieldAtIndex(ast, clang_type, index, field_name, bit_offset_ptr, bitfield_bit_size_ptr, is_bitfield_ptr);
if ( strcmp(field_name.c_str(), name) == 0 )
@@ -5457,6 +5534,10 @@ ClangASTContext::CreateFunctionDeclarati
if (decl_ctx == NULL)
decl_ctx = ast->getTranslationUnitDecl();
+
+ const bool hasWrittenPrototype = true;
+ const bool isConstexprSpecified = false;
+
if (name && name[0])
{
func_decl = FunctionDecl::Create (*ast,
@@ -5467,8 +5548,9 @@ ClangASTContext::CreateFunctionDeclarati
QualType::getFromOpaquePtr(function_clang_type),
NULL,
(FunctionDecl::StorageClass)storage,
- (FunctionDecl::StorageClass)storage,
- is_inline);
+ is_inline,
+ hasWrittenPrototype,
+ isConstexprSpecified);
}
else
{
@@ -5480,8 +5562,9 @@ ClangASTContext::CreateFunctionDeclarati
QualType::getFromOpaquePtr(function_clang_type),
NULL,
(FunctionDecl::StorageClass)storage,
- (FunctionDecl::StorageClass)storage,
- is_inline);
+ is_inline,
+ hasWrittenPrototype,
+ isConstexprSpecified);
}
if (func_decl)
decl_ctx->addDecl (func_decl);
@@ -6682,6 +6765,24 @@ ClangASTContext::ConvertStringToFloatVal
return 0;
}
+lldb::clang_type_t
+ClangASTContext::GetFloatTypeFromBitSize (clang::ASTContext *ast,
+ size_t bit_size)
+{
+ if (ast)
+ {
+ if (bit_size == ast->getTypeSize(ast->FloatTy))
+ return ast->FloatTy.getAsOpaquePtr();
+ else if (bit_size == ast->getTypeSize(ast->DoubleTy))
+ return ast->DoubleTy.getAsOpaquePtr();
+ else if (bit_size == ast->getTypeSize(ast->LongDoubleTy))
+ return ast->LongDoubleTy.getAsOpaquePtr();
+ else if (bit_size == ast->getTypeSize(ast->HalfTy))
+ return ast->HalfTy.getAsOpaquePtr();
+ }
+ return NULL;
+}
+
unsigned
ClangASTContext::GetTypeQualifiers(clang_type_t clang_type)
{
@@ -6704,7 +6805,7 @@ ClangASTContext::GetCompleteType (clang:
bool
ClangASTContext::GetCompleteType (clang_type_t clang_type)
-{
+{
return ClangASTContext::GetCompleteType (getASTContext(), clang_type);
}
Modified: lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/ClangASTType.cpp Tue Jul 2 16:55:02 2013
@@ -195,6 +195,31 @@ ClangASTType::GetPointerType (clang::AST
return NULL;
}
+ClangASTType
+ClangASTType::GetFullyUnqualifiedType ()
+{
+ return GetFullyUnqualifiedType(m_ast, m_type);
+}
+
+static clang::QualType GetFullyUnqualifiedType_Impl (clang::QualType Ty,
+ clang::ASTContext * ctx)
+{
+ if (Ty->isPointerType())
+ Ty = ctx->getPointerType(GetFullyUnqualifiedType_Impl(Ty->getPointeeType(),ctx));
+ else
+ Ty = Ty.getUnqualifiedType();
+ Ty.removeLocalConst();
+ Ty.removeLocalRestrict();
+ Ty.removeLocalVolatile();
+ return Ty;
+}
+
+ClangASTType
+ClangASTType::GetFullyUnqualifiedType (clang::ASTContext *ast_context, lldb::clang_type_t clang_type)
+{
+ return ClangASTType(ast_context,GetFullyUnqualifiedType_Impl(clang::QualType::getFromOpaquePtr(clang_type),ast_context).getAsOpaquePtr());
+}
+
lldb::Encoding
ClangASTType::GetEncoding (uint64_t &count)
{
@@ -209,6 +234,36 @@ ClangASTType::GetMinimumLanguage ()
m_type);
}
+bool
+ClangASTType::IsPolymorphicClass (clang::ASTContext *ast_context, lldb::clang_type_t clang_type)
+{
+ if (clang_type)
+ {
+ clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type).getCanonicalType());
+ const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+ switch (type_class)
+ {
+ case clang::Type::Record:
+ if (ClangASTContext::GetCompleteType (ast_context, clang_type))
+ {
+ const clang::RecordType *record_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
+ const clang::RecordDecl *record_decl = record_type->getDecl();
+ if (record_decl)
+ {
+ const clang::CXXRecordDecl *cxx_record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
+ if (cxx_record_decl)
+ return cxx_record_decl->isPolymorphic();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
lldb::TypeClass
ClangASTType::GetTypeClass (clang::ASTContext *ast_context, lldb::clang_type_t clang_type)
{
Modified: lldb/branches/lldb-platform-work/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Function.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Function.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Function.cpp Tue Jul 2 16:55:02 2013
@@ -568,9 +568,9 @@ Function::GetPrologueByteSize ()
// Check the first few instructions and look for one that has
// is_prologue_end set to true.
const uint32_t last_line_entry_idx = first_line_entry_idx + 6;
- LineEntry line_entry;
for (uint32_t idx = first_line_entry_idx + 1; idx < last_line_entry_idx; ++idx)
{
+ LineEntry line_entry;
if (line_table->GetLineEntryAtIndex (idx, line_entry))
{
if (line_entry.is_prologue_end)
@@ -581,12 +581,31 @@ Function::GetPrologueByteSize ()
}
}
}
-
+
// If we didn't find the end of the prologue in the line tables,
// then just use the end address of the first line table entry
if (prologue_end_file_addr == LLDB_INVALID_ADDRESS)
{
- prologue_end_file_addr = first_line_entry.range.GetBaseAddress().GetFileAddress() + first_line_entry.range.GetByteSize();
+ // Check the first few instructions and look for one that has
+ // a line number that's different than the first entry.
+ const uint32_t last_line_entry_idx = first_line_entry_idx + 6;
+ for (uint32_t idx = first_line_entry_idx + 1; idx < last_line_entry_idx; ++idx)
+ {
+ LineEntry line_entry;
+ if (line_table->GetLineEntryAtIndex (idx, line_entry))
+ {
+ if (line_entry.line != first_line_entry.line)
+ {
+ prologue_end_file_addr = line_entry.range.GetBaseAddress().GetFileAddress();
+ break;
+ }
+ }
+ }
+
+ if (prologue_end_file_addr == LLDB_INVALID_ADDRESS)
+ {
+ prologue_end_file_addr = first_line_entry.range.GetBaseAddress().GetFileAddress() + first_line_entry.range.GetByteSize();
+ }
}
const addr_t func_start_file_addr = m_range.GetBaseAddress().GetFileAddress();
const addr_t func_end_file_addr = func_start_file_addr + m_range.GetByteSize();
Modified: lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/ObjectFile.cpp Tue Jul 2 16:55:02 2013
@@ -244,7 +244,9 @@ ObjectFile::ObjectFile (const lldb::Modu
m_process_wp(),
m_memory_addr (LLDB_INVALID_ADDRESS),
m_sections_ap (),
- m_symtab_ap ()
+ m_symtab_ap (),
+ m_symtab_unified_ap (),
+ m_symtab_unified_revisionid (0)
{
if (file_spec_ptr)
m_file = *file_spec_ptr;
@@ -291,7 +293,9 @@ ObjectFile::ObjectFile (const lldb::Modu
m_process_wp (process_sp),
m_memory_addr (header_addr),
m_sections_ap (),
- m_symtab_ap ()
+ m_symtab_ap (),
+ m_symtab_unified_ap (),
+ m_symtab_unified_revisionid (0)
{
if (header_data_sp)
m_data.SetData (header_data_sp, 0, header_data_sp->GetByteSize());
@@ -327,7 +331,7 @@ ObjectFile::SetModulesArchitecture (cons
AddressClass
ObjectFile::GetAddressClass (addr_t file_addr)
{
- Symtab *symtab = GetSymtab();
+ Symtab *symtab = GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr);
@@ -374,6 +378,10 @@ ObjectFile::GetAddressClass (addr_t file
case eSectionTypeDWARFAppleObjC:
return eAddressClassDebug;
case eSectionTypeEHFrame: return eAddressClassRuntime;
+ case eSectionTypeELFSymbolTable:
+ case eSectionTypeELFDynamicSymbols:
+ case eSectionTypeELFRelocationEntries:
+ case eSectionTypeELFDynamicLinkInfo:
case eSectionTypeOther: return eAddressClassUnknown;
}
}
@@ -453,6 +461,10 @@ ObjectFile::CopyData (off_t offset, size
size_t
ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void *dst, size_t dst_len) const
{
+ // If some other objectfile owns this data, pass this to them.
+ if (section->GetObjectFile() != this)
+ return section->GetObjectFile()->ReadSectionData (section, section_offset, dst, dst_len);
+
if (IsInMemory())
{
ProcessSP process_sp (m_process_wp.lock());
@@ -498,6 +510,10 @@ ObjectFile::ReadSectionData (const Secti
size_t
ObjectFile::ReadSectionData (const Section *section, DataExtractor& section_data) const
{
+ // If some other objectfile owns this data, pass this to them.
+ if (section->GetObjectFile() != this)
+ return section->GetObjectFile()->ReadSectionData (section, section_data);
+
if (IsInMemory())
{
ProcessSP process_sp (m_process_wp.lock());
@@ -529,6 +545,10 @@ ObjectFile::ReadSectionData (const Secti
size_t
ObjectFile::MemoryMapSectionData (const Section *section, DataExtractor& section_data) const
{
+ // If some other objectfile owns this data, pass this to them.
+ if (section->GetObjectFile() != this)
+ return section->GetObjectFile()->MemoryMapSectionData (section, section_data);
+
if (IsInMemory())
{
return ReadSectionData (section, section_data);
@@ -566,19 +586,29 @@ ObjectFile::SplitArchivePathWithObject (
}
void
-ObjectFile::ClearSymtab ()
+ObjectFile::ClearSymtab (uint32_t flags)
{
ModuleSP module_sp(GetModule());
if (module_sp)
{
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+ bool unified_section_list = !!(flags & ObjectFile::eSymtabFromUnifiedSectionList);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
{
- log->Printf ("%p ObjectFile::ClearSymtab () symtab = %p",
+ log->Printf ("%p ObjectFile::ClearSymtab (%s) symtab = %p",
this,
- m_symtab_ap.get());
+ unified_section_list ? "unified" : "",
+ unified_section_list ? m_symtab_unified_ap.get() : m_symtab_ap.get());
+ }
+ if (unified_section_list)
+ {
+ m_symtab_unified_ap.reset();
+ m_symtab_unified_revisionid = 0;
+ }
+ else
+ {
+ m_symtab_ap.reset();
}
- m_symtab_ap.reset();
}
}
Modified: lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Symbol.cpp Tue Jul 2 16:55:02 2013
@@ -16,6 +16,7 @@
#include "lldb/Symbol/Symtab.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Symbol/SymbolVendor.h"
using namespace lldb;
using namespace lldb_private;
@@ -24,7 +25,6 @@ using namespace lldb_private;
Symbol::Symbol() :
SymbolContextScope (),
m_uid (UINT32_MAX),
- m_mangled (),
m_type_data (0),
m_type_data_resolved (false),
m_is_synthetic (false),
@@ -35,8 +35,9 @@ Symbol::Symbol() :
m_calculated_size (false),
m_demangled_is_synthesized (false),
m_type (eSymbolTypeInvalid),
- m_flags (),
- m_addr_range ()
+ m_mangled (),
+ m_addr_range (),
+ m_flags ()
{
}
@@ -58,7 +59,6 @@ Symbol::Symbol
) :
SymbolContextScope (),
m_uid (symID),
- m_mangled (ConstString(name), name_is_mangled),
m_type_data (0),
m_type_data_resolved (false),
m_is_synthetic (is_artificial),
@@ -69,8 +69,9 @@ Symbol::Symbol
m_calculated_size (size_is_valid || size > 0),
m_demangled_is_synthesized (false),
m_type (type),
- m_flags (flags),
- m_addr_range (section_sp, offset, size)
+ m_mangled (ConstString(name), name_is_mangled),
+ m_addr_range (section_sp, offset, size),
+ m_flags (flags)
{
}
@@ -90,7 +91,6 @@ Symbol::Symbol
) :
SymbolContextScope (),
m_uid (symID),
- m_mangled (ConstString(name), name_is_mangled),
m_type_data (0),
m_type_data_resolved (false),
m_is_synthetic (is_artificial),
@@ -101,15 +101,15 @@ Symbol::Symbol
m_calculated_size (size_is_valid || range.GetByteSize() > 0),
m_demangled_is_synthesized (false),
m_type (type),
- m_flags (flags),
- m_addr_range (range)
+ m_mangled (ConstString(name), name_is_mangled),
+ m_addr_range (range),
+ m_flags (flags)
{
}
Symbol::Symbol(const Symbol& rhs):
SymbolContextScope (rhs),
m_uid (rhs.m_uid),
- m_mangled (rhs.m_mangled),
m_type_data (rhs.m_type_data),
m_type_data_resolved (rhs.m_type_data_resolved),
m_is_synthetic (rhs.m_is_synthetic),
@@ -120,8 +120,9 @@ Symbol::Symbol(const Symbol& rhs):
m_calculated_size (rhs.m_calculated_size),
m_demangled_is_synthesized (rhs.m_demangled_is_synthesized),
m_type (rhs.m_type),
- m_flags (rhs.m_flags),
- m_addr_range (rhs.m_addr_range)
+ m_mangled (rhs.m_mangled),
+ m_addr_range (rhs.m_addr_range),
+ m_flags (rhs.m_flags)
{
}
@@ -132,7 +133,6 @@ Symbol::operator= (const Symbol& rhs)
{
SymbolContextScope::operator= (rhs);
m_uid = rhs.m_uid;
- m_mangled = rhs.m_mangled;
m_type_data = rhs.m_type_data;
m_type_data_resolved = rhs.m_type_data_resolved;
m_is_synthetic = rhs.m_is_synthetic;
@@ -143,8 +143,9 @@ Symbol::operator= (const Symbol& rhs)
m_calculated_size = rhs.m_calculated_size;
m_demangled_is_synthesized = rhs.m_demangled_is_synthesized;
m_type = rhs.m_type;
- m_flags = rhs.m_flags;
+ m_mangled = rhs.m_mangled;
m_addr_range = rhs.m_addr_range;
+ m_flags = rhs.m_flags;
}
return *this;
}
@@ -288,22 +289,59 @@ Symbol::GetPrologueByteSize ()
m_type_data_resolved = true;
ModuleSP module_sp (m_addr_range.GetBaseAddress().GetModule());
SymbolContext sc;
- if (module_sp && module_sp->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
- eSymbolContextLineEntry,
- sc))
+ if (module_sp)
{
- m_type_data = sc.line_entry.range.GetByteSize();
- // Sanity check - this may be a function in the middle of code that has debug information, but
- // not for this symbol. So the line entries surrounding us won't lie inside our function.
- // In that case, the line entry will be bigger than we are, so we do that quick check and
- // if that is true, we just return 0.
- if (m_type_data >= m_addr_range.GetByteSize())
+ uint32_t resolved_flags = module_sp->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
+ eSymbolContextLineEntry,
+ sc);
+ if (resolved_flags & eSymbolContextLineEntry)
+ {
+ // Default to the end of the first line entry.
+ m_type_data = sc.line_entry.range.GetByteSize();
+
+ // Set address for next line.
+ Address addr (m_addr_range.GetBaseAddress());
+ addr.Slide (m_type_data);
+
+ // Check the first few instructions and look for one that has a line number that is
+ // different than the first entry. This is also done in Function::GetPrologueByteSize().
+ uint16_t total_offset = m_type_data;
+ for (int idx = 0; idx < 6; ++idx)
+ {
+ SymbolContext sc_temp;
+ resolved_flags = module_sp->ResolveSymbolContextForAddress (addr, eSymbolContextLineEntry, sc_temp);
+ // Make sure we got line number information...
+ if (!(resolved_flags & eSymbolContextLineEntry))
+ break;
+
+ // If this line number is different than our first one, use it and we're done.
+ if (sc_temp.line_entry.line != sc.line_entry.line)
+ {
+ m_type_data = total_offset;
+ break;
+ }
+
+ // Slide addr up to the next line address.
+ addr.Slide (sc_temp.line_entry.range.GetByteSize());
+ total_offset += sc_temp.line_entry.range.GetByteSize();
+ // If we've gone too far, bail out.
+ if (total_offset >= m_addr_range.GetByteSize())
+ break;
+ }
+
+ // Sanity check - this may be a function in the middle of code that has debug information, but
+ // not for this symbol. So the line entries surrounding us won't lie inside our function.
+ // In that case, the line entry will be bigger than we are, so we do that quick check and
+ // if that is true, we just return 0.
+ if (m_type_data >= m_addr_range.GetByteSize())
+ m_type_data = 0;
+ }
+ else
+ {
+ // TODO: expose something in Process to figure out the
+ // size of a function prologue.
m_type_data = 0;
- }
- else
- {
- // TODO: expose something in Process to figure out the
- // size of a function prologue.
+ }
}
}
return m_type_data;
@@ -418,10 +456,10 @@ Symbol::GetByteSize () const
ModuleSP module_sp (GetAddress().GetModule());
if (module_sp)
{
- ObjectFile *objfile = module_sp->GetObjectFile();
- if (objfile)
+ SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
+ if (sym_vendor)
{
- Symtab *symtab = objfile->GetSymtab();
+ Symtab *symtab = sym_vendor->GetSymtab();
if (symtab)
{
const_cast<Symbol*>(this)->SetByteSize (symtab->CalculateSymbolSize (const_cast<Symbol *>(this)));
Modified: lldb/branches/lldb-platform-work/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/SymbolContext.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/SymbolContext.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/SymbolContext.cpp Tue Jul 2 16:55:02 2013
@@ -1023,6 +1023,10 @@ SymbolContextList::AppendIfUnique (const
{
for (pos = m_symbol_contexts.begin(); pos != end; ++pos)
{
+ // Don't merge symbols into inlined function symbol contexts
+ if (pos->block && pos->block->GetContainingInlinedBlock())
+ continue;
+
if (pos->function)
{
if (pos->function->GetAddressRange().GetBaseAddress() == sc.symbol->GetAddress())
@@ -1044,6 +1048,49 @@ SymbolContextList::AppendIfUnique (const
return true;
}
+bool
+SymbolContextList::MergeSymbolContextIntoFunctionContext (const SymbolContext& symbol_sc,
+ uint32_t start_idx,
+ uint32_t stop_idx)
+{
+ if (symbol_sc.symbol != NULL
+ && symbol_sc.comp_unit == NULL
+ && symbol_sc.function == NULL
+ && symbol_sc.block == NULL
+ && symbol_sc.line_entry.IsValid() == false)
+ {
+ if (symbol_sc.symbol->ValueIsAddress())
+ {
+ const size_t end = std::min<size_t>(m_symbol_contexts.size(), stop_idx);
+ for (size_t i=start_idx; i<end; ++i)
+ {
+ const SymbolContext &function_sc = m_symbol_contexts[i];
+ // Don't merge symbols into inlined function symbol contexts
+ if (function_sc.block && function_sc.block->GetContainingInlinedBlock())
+ continue;
+
+ if (function_sc.function)
+ {
+ if (function_sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddress())
+ {
+ // Do we already have a function with this symbol?
+ if (function_sc.symbol == symbol_sc.symbol)
+ return true; // Already have a symbol context with this symbol, return true
+
+ if (function_sc.symbol == NULL)
+ {
+ // We successfully merged this symbol into an existing symbol context
+ m_symbol_contexts[i].symbol = symbol_sc.symbol;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+
void
SymbolContextList::Clear()
{
Modified: lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/SymbolVendor.cpp Tue Jul 2 16:55:02 2013
@@ -35,21 +35,14 @@ SymbolVendor*
SymbolVendor::FindPlugin (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
{
std::unique_ptr<SymbolVendor> instance_ap;
- //----------------------------------------------------------------------
- // We currently only have one debug symbol parser...
- //----------------------------------------------------------------------
SymbolVendorCreateInstance create_callback;
+
for (size_t idx = 0; (create_callback = PluginManager::GetSymbolVendorCreateCallbackAtIndex(idx)) != NULL; ++idx)
{
instance_ap.reset(create_callback(module_sp, feedback_strm));
if (instance_ap.get())
{
- // TODO: make sure this symbol vendor is what we want. We
- // currently are just returning the first one we find, but
- // we may want to call this function only when we have our
- // main executable module and then give all symbol vendor
- // plug-ins a chance to compete for who wins.
return instance_ap.release();
}
}
@@ -84,7 +77,7 @@ SymbolVendor::~SymbolVendor()
}
//----------------------------------------------------------------------
-// Add a represantion given an object file.
+// Add a represention given an object file.
//----------------------------------------------------------------------
void
SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp)
@@ -352,6 +345,21 @@ SymbolVendor::FindTypes (const SymbolCon
return 0;
}
+size_t
+SymbolVendor::GetTypes (SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list)
+{
+ ModuleSP module_sp(GetModule());
+ if (module_sp)
+ {
+ lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+ if (m_sym_file_ap.get())
+ return m_sym_file_ap->GetTypes (sc_scope, type_mask, type_list);
+ }
+ return 0;
+}
+
ClangNamespaceDecl
SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *parent_namespace_decl)
{
@@ -429,6 +437,36 @@ SymbolVendor::GetCompileUnitAtIndex(size
return cu_sp;
}
+Symtab *
+SymbolVendor::GetSymtab ()
+{
+ ModuleSP module_sp(GetModule());
+ if (module_sp)
+ {
+ ObjectFile *objfile = module_sp->GetObjectFile();
+ if (objfile)
+ {
+ // Get symbol table from unified section list.
+ return objfile->GetSymtab (ObjectFile::eSymtabFromUnifiedSectionList);
+ }
+ }
+ return NULL;
+}
+
+void
+SymbolVendor::ClearSymtab()
+{
+ ModuleSP module_sp(GetModule());
+ if (module_sp)
+ {
+ ObjectFile *objfile = module_sp->GetObjectFile();
+ if (objfile)
+ {
+ // Clear symbol table from unified section list.
+ objfile->ClearSymtab (ObjectFile::eSymtabFromUnifiedSectionList);
+ }
+ }
+}
//------------------------------------------------------------------
// PluginInterface protocol
Modified: lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp Tue Jul 2 16:55:02 2013
@@ -721,7 +721,7 @@ Symtab::AppendSymbolIndexesMatchingRegEx
uint32_t prev_size = indexes.size();
uint32_t sym_end = m_symbols.size();
- for (int i = 0; i < sym_end; i++)
+ for (uint32_t i = 0; i < sym_end; i++)
{
if (symbol_type == eSymbolTypeAny || m_symbols[i].GetType() == symbol_type)
{
@@ -745,7 +745,7 @@ Symtab::AppendSymbolIndexesMatchingRegEx
uint32_t prev_size = indexes.size();
uint32_t sym_end = m_symbols.size();
- for (int i = 0; i < sym_end; i++)
+ for (uint32_t i = 0; i < sym_end; i++)
{
if (symbol_type == eSymbolTypeAny || m_symbols[i].GetType() == symbol_type)
{
Modified: lldb/branches/lldb-platform-work/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Type.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Type.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Type.cpp Tue Jul 2 16:55:02 2013
@@ -33,6 +33,33 @@
using namespace lldb;
using namespace lldb_private;
+class TypeAppendVisitor
+{
+public:
+ TypeAppendVisitor(TypeListImpl &type_list) :
+ m_type_list(type_list)
+ {
+ }
+
+ bool
+ operator() (const lldb::TypeSP& type)
+ {
+ m_type_list.Append(TypeImplSP(new TypeImpl(type)));
+ return true;
+ }
+
+private:
+ TypeListImpl &m_type_list;
+};
+
+void
+TypeListImpl::Append (const lldb_private::TypeList &type_list)
+{
+ TypeAppendVisitor cb(*this);
+ type_list.ForEach(cb);
+}
+
+
Type *
SymbolFileType::GetType ()
{
@@ -982,3 +1009,10 @@ TypeImpl::GetDescription (lldb_private::
return true;
}
+ConstString
+TypeImpl::GetName ()
+{
+ if (m_clang_ast_type.IsValid())
+ return m_clang_ast_type.GetConstQualifiedTypeName();
+ return ConstString();
+}
Modified: lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp Tue Jul 2 16:55:02 2013
@@ -135,6 +135,27 @@ TypeList::GetTypeAtIndex(uint32_t idx)
return TypeSP();
}
+void
+TypeList::ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const
+{
+ for (auto pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
+ {
+ if (!callback(pos->second))
+ break;
+ }
+}
+
+void
+TypeList::ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback)
+{
+ for (auto pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
+ {
+ if (!callback(pos->second))
+ break;
+ }
+}
+
+
bool
TypeList::RemoveTypeWithUID (user_id_t uid)
{
Modified: lldb/branches/lldb-platform-work/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Process.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Process.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Process.cpp Tue Jul 2 16:55:02 2013
@@ -996,7 +996,6 @@ Process::Process(Target &target, Listene
ProcessProperties (false),
UserID (LLDB_INVALID_PROCESS_ID),
Broadcaster (&(target.GetDebugger()), "lldb.process"),
- m_reservation_cache (*this),
m_target (target),
m_public_state (eStateUnloaded),
m_private_state (eStateUnloaded),
@@ -1564,6 +1563,8 @@ Process::UpdateThreadListIfNeeded ()
new_thread_list = real_thread_list;
}
}
+
+ m_thread_list_real.Update(real_thread_list);
m_thread_list.Update (new_thread_list);
m_thread_list.SetStopID (stop_id);
}
@@ -1580,15 +1581,6 @@ Process::CreateOSPluginThread (lldb::tid
return ThreadSP();
}
-
-
-// This is obsoleted. Staged removal for Xcode.
-uint32_t
-Process::GetNextThreadIndexID ()
-{
- return ++m_thread_index_id;
-}
-
uint32_t
Process::GetNextThreadIndexID (uint64_t thread_id)
{
@@ -1707,10 +1699,7 @@ Process::SetPrivateState (StateType new_
const StateType old_state = m_private_state.GetValueNoLock ();
state_changed = old_state != new_state;
- // This code is left commented out in case we ever need to control
- // the private process state with another run lock. Right now it doesn't
- // seem like we need to do this, but if we ever do, we can uncomment and
- // use this code.
+
const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
const bool new_state_is_stopped = StateIsStoppedState(new_state, false);
if (old_state_is_stopped != new_state_is_stopped)
@@ -2007,12 +1996,10 @@ Process::GetBreakpointSiteList() const
void
Process::DisableAllBreakpointSites ()
{
- m_breakpoint_site_list.SetEnabledForAll (false);
- size_t num_sites = m_breakpoint_site_list.GetSize();
- for (size_t i = 0; i < num_sites; i++)
- {
- DisableBreakpointSite (m_breakpoint_site_list.GetByIndex(i).get());
- }
+ m_breakpoint_site_list.ForEach([this](BreakpointSite *bp_site) -> void {
+// bp_site->SetEnabled(true);
+ DisableBreakpointSite(bp_site);
+ });
}
Error
@@ -2116,29 +2103,26 @@ size_t
Process::RemoveBreakpointOpcodesFromBuffer (addr_t bp_addr, size_t size, uint8_t *buf) const
{
size_t bytes_removed = 0;
- addr_t intersect_addr;
- size_t intersect_size;
- size_t opcode_offset;
- size_t idx;
- BreakpointSiteSP bp_sp;
BreakpointSiteList bp_sites_in_range;
if (m_breakpoint_site_list.FindInRange (bp_addr, bp_addr + size, bp_sites_in_range))
{
- for (idx = 0; (bp_sp = bp_sites_in_range.GetByIndex(idx)); ++idx)
- {
- if (bp_sp->GetType() == BreakpointSite::eSoftware)
+ bp_sites_in_range.ForEach([bp_addr, size, buf, &bytes_removed](BreakpointSite *bp_site) -> void {
+ if (bp_site->GetType() == BreakpointSite::eSoftware)
{
- if (bp_sp->IntersectsRange(bp_addr, size, &intersect_addr, &intersect_size, &opcode_offset))
+ addr_t intersect_addr;
+ size_t intersect_size;
+ size_t opcode_offset;
+ if (bp_site->IntersectsRange(bp_addr, size, &intersect_addr, &intersect_size, &opcode_offset))
{
assert(bp_addr <= intersect_addr && intersect_addr < bp_addr + size);
assert(bp_addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= bp_addr + size);
- assert(opcode_offset + intersect_size <= bp_sp->GetByteSize());
+ assert(opcode_offset + intersect_size <= bp_site->GetByteSize());
size_t buf_offset = intersect_addr - bp_addr;
- ::memcpy(buf + buf_offset, bp_sp->GetSavedOpcodeBytes() + opcode_offset, intersect_size);
+ ::memcpy(buf + buf_offset, bp_site->GetSavedOpcodeBytes() + opcode_offset, intersect_size);
}
}
- }
+ });
}
return bytes_removed;
}
@@ -2596,64 +2580,73 @@ Process::WriteMemory (addr_t addr, const
// (enabled software breakpoints) any software traps (breakpoints) that we
// may have placed in our tasks memory.
- BreakpointSiteList::collection::const_iterator iter = m_breakpoint_site_list.GetMap()->lower_bound (addr);
- BreakpointSiteList::collection::const_iterator end = m_breakpoint_site_list.GetMap()->end();
-
- if (iter == end || iter->second->GetLoadAddress() > addr + size)
- return WriteMemoryPrivate (addr, buf, size, error);
+ BreakpointSiteList bp_sites_in_range;
+
+ if (m_breakpoint_site_list.FindInRange (addr, addr + size, bp_sites_in_range))
+ {
+ // No breakpoint sites overlap
+ if (bp_sites_in_range.IsEmpty())
+ return WriteMemoryPrivate (addr, buf, size, error);
+ else
+ {
+ const uint8_t *ubuf = (const uint8_t *)buf;
+ uint64_t bytes_written = 0;
- BreakpointSiteList::collection::const_iterator pos;
- size_t bytes_written = 0;
- addr_t intersect_addr = 0;
- size_t intersect_size = 0;
- size_t opcode_offset = 0;
- const uint8_t *ubuf = (const uint8_t *)buf;
-
- for (pos = iter; pos != end; ++pos)
- {
- BreakpointSiteSP bp;
- bp = pos->second;
-
- assert(bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset));
- assert(addr <= intersect_addr && intersect_addr < addr + size);
- assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
- assert(opcode_offset + intersect_size <= bp->GetByteSize());
-
- // Check for bytes before this breakpoint
- const addr_t curr_addr = addr + bytes_written;
- if (intersect_addr > curr_addr)
- {
- // There are some bytes before this breakpoint that we need to
- // just write to memory
- size_t curr_size = intersect_addr - curr_addr;
- size_t curr_bytes_written = WriteMemoryPrivate (curr_addr,
- ubuf + bytes_written,
- curr_size,
- error);
- bytes_written += curr_bytes_written;
- if (curr_bytes_written != curr_size)
- {
- // We weren't able to write all of the requested bytes, we
- // are done looping and will return the number of bytes that
- // we have written so far.
- break;
- }
+ bp_sites_in_range.ForEach([this, addr, size, &bytes_written, &ubuf, &error](BreakpointSite *bp) -> void {
+
+ if (error.Success())
+ {
+ addr_t intersect_addr;
+ size_t intersect_size;
+ size_t opcode_offset;
+ const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
+ assert(intersects);
+ assert(addr <= intersect_addr && intersect_addr < addr + size);
+ assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
+ assert(opcode_offset + intersect_size <= bp->GetByteSize());
+
+ // Check for bytes before this breakpoint
+ const addr_t curr_addr = addr + bytes_written;
+ if (intersect_addr > curr_addr)
+ {
+ // There are some bytes before this breakpoint that we need to
+ // just write to memory
+ size_t curr_size = intersect_addr - curr_addr;
+ size_t curr_bytes_written = WriteMemoryPrivate (curr_addr,
+ ubuf + bytes_written,
+ curr_size,
+ error);
+ bytes_written += curr_bytes_written;
+ if (curr_bytes_written != curr_size)
+ {
+ // We weren't able to write all of the requested bytes, we
+ // are done looping and will return the number of bytes that
+ // we have written so far.
+ if (error.Success())
+ error.SetErrorToGenericError();
+ }
+ }
+ // Now write any bytes that would cover up any software breakpoints
+ // directly into the breakpoint opcode buffer
+ ::memcpy(bp->GetSavedOpcodeBytes() + opcode_offset, ubuf + bytes_written, intersect_size);
+ bytes_written += intersect_size;
+ }
+ });
+
+ if (bytes_written < size)
+ bytes_written += WriteMemoryPrivate (addr + bytes_written,
+ ubuf + bytes_written,
+ size - bytes_written,
+ error);
}
-
- // Now write any bytes that would cover up any software breakpoints
- // directly into the breakpoint opcode buffer
- ::memcpy(bp->GetSavedOpcodeBytes() + opcode_offset, ubuf + bytes_written, intersect_size);
- bytes_written += intersect_size;
+ }
+ else
+ {
+ return WriteMemoryPrivate (addr, buf, size, error);
}
// Write any remaining bytes after the last breakpoint if we have any left
- if (bytes_written < size)
- bytes_written += WriteMemoryPrivate (addr + bytes_written,
- ubuf + bytes_written,
- size - bytes_written,
- error);
-
- return bytes_written;
+ return 0; //bytes_written;
}
size_t
@@ -3222,7 +3215,7 @@ Process::CompleteAttach ()
size_t num_modules = target_modules.GetSize();
ModuleSP new_executable_module_sp;
- for (int i = 0; i < num_modules; i++)
+ for (size_t i = 0; i < num_modules; i++)
{
ModuleSP module_sp (target_modules.GetModuleAtIndexUnlocked (i));
if (module_sp && module_sp->IsExecutable())
@@ -4404,10 +4397,10 @@ Process::AppendSTDERR (const char * s, s
}
void
-Process::BroadcastAsyncProfileData(const char *s, size_t len)
+Process::BroadcastAsyncProfileData(const std::string &one_profile_data)
{
Mutex::Locker locker (m_profile_data_comm_mutex);
- m_profile_data.push_back(s);
+ m_profile_data.push_back(one_profile_data);
BroadcastEventIfUnique (eBroadcastBitProfileData, new ProcessEventData (shared_from_this(), GetState()));
}
@@ -4417,8 +4410,9 @@ Process::GetAsyncProfileData (char *buf,
Mutex::Locker locker(m_profile_data_comm_mutex);
if (m_profile_data.empty())
return 0;
-
- size_t bytes_available = m_profile_data.front().size();
+
+ std::string &one_profile_data = m_profile_data.front();
+ size_t bytes_available = one_profile_data.size();
if (bytes_available > 0)
{
Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
@@ -4426,13 +4420,13 @@ Process::GetAsyncProfileData (char *buf,
log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
if (bytes_available > buf_size)
{
- memcpy(buf, m_profile_data.front().data(), buf_size);
- m_profile_data.front().erase(0, buf_size);
+ memcpy(buf, one_profile_data.c_str(), buf_size);
+ one_profile_data.erase(0, buf_size);
bytes_available = buf_size;
}
else
{
- memcpy(buf, m_profile_data.front().data(), bytes_available);
+ memcpy(buf, one_profile_data.c_str(), bytes_available);
m_profile_data.erase(m_profile_data.begin());
}
}
@@ -4533,7 +4527,7 @@ Process::ProcessInputReaderCallback (voi
break;
case eInputReaderInterrupt:
- process->Halt ();
+ process->SendAsyncInterrupt();
break;
case eInputReaderEndOfFile:
@@ -5592,60 +5586,3 @@ Process::DidExec ()
DoDidExec();
CompleteAttach ();
}
-
-Process::ReservationCache::ReservationCache (Process &process) : m_process(process)
-{
- m_mod_id = process.GetModID();
-}
-
-void
-Process::ReservationCache::Reserve (lldb::addr_t addr, size_t size)
-{
- CheckModID();
- m_reserved_cache[addr] = size;
-}
-
-void
-Process::ReservationCache::Unreserve (lldb::addr_t addr)
-{
- CheckModID();
- ReservedMap::iterator iter = m_reserved_cache.find(addr);
-
- if (iter != m_reserved_cache.end())
- {
- size_t size = iter->second;
- m_reserved_cache.erase(iter);
- m_free_cache[size].push_back(addr);
- }
-}
-
-lldb::addr_t
-Process::ReservationCache::Find (size_t size)
-{
- CheckModID();
- lldb::addr_t ret = LLDB_INVALID_ADDRESS;
- FreeMap::iterator map_iter = m_free_cache.find(size);
- if (map_iter != m_free_cache.end())
- {
- if (!map_iter->second.empty())
- {
- ret = map_iter->second.back();
- map_iter->second.pop_back();
- m_reserved_cache[ret] = size;
- }
- }
-
- return ret;
-}
-
-void
-Process::ReservationCache::CheckModID()
-{
- if (m_mod_id != m_process.GetModID())
- {
- // wipe all our caches, they're invalid
- m_reserved_cache.clear();
- m_free_cache.clear();
- m_mod_id = m_process.GetModID();
- }
-}
Modified: lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/StopInfo.cpp Tue Jul 2 16:55:02 2013
@@ -667,16 +667,20 @@ protected:
{
if (!wp_triggers_after)
{
+ StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo();
+ assert (stored_stop_info_sp.get() == this);
+
ThreadPlan *new_plan = thread_sp->QueueThreadPlanForStepSingleInstruction(false, // step-over
false, // abort_other_plans
true); // stop_other_threads
new_plan->SetIsMasterPlan (true);
new_plan->SetOkayToDiscard (false);
+ new_plan->SetPrivate (true);
process->GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
process->Resume ();
process->WaitForProcessToStop (NULL);
process->GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
- MakeStopInfoValid(); // make sure we do not fail to stop because of the single-step taken above
+ thread_sp->SetStopInfo(stored_stop_info_sp);
}
}
}
Modified: lldb/branches/lldb-platform-work/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Target.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Target.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Target.cpp Tue Jul 2 16:55:02 2013
@@ -564,6 +564,7 @@ Target::CreateWatchpoint(lldb::addr_t ad
error.SetErrorString("process is not alive");
return wp_sp;
}
+
if (addr == LLDB_INVALID_ADDRESS || size == 0)
{
if (size == 0)
@@ -572,6 +573,11 @@ Target::CreateWatchpoint(lldb::addr_t ad
error.SetErrorStringWithFormat("invalid watch address: %" PRIu64, addr);
return wp_sp;
}
+
+ if (!LLDB_WATCH_TYPE_IS_VALID(kind))
+ {
+ error.SetErrorStringWithFormat ("invalid watchpoint type: %d", kind);
+ }
// Currently we only support one watchpoint per address, with total number
// of watchpoints limited by the hardware which the inferior is running on.
@@ -588,10 +594,13 @@ Target::CreateWatchpoint(lldb::addr_t ad
(matched_sp->WatchpointRead() ? LLDB_WATCH_TYPE_READ : 0) |
(matched_sp->WatchpointWrite() ? LLDB_WATCH_TYPE_WRITE : 0);
// Return the existing watchpoint if both size and type match.
- if (size == old_size && kind == old_type) {
+ if (size == old_size && kind == old_type)
+ {
wp_sp = matched_sp;
wp_sp->SetEnabled(false, notify);
- } else {
+ }
+ else
+ {
// Nil the matched watchpoint; we will be creating a new one.
m_process_sp->DisableWatchpoint(matched_sp.get(), notify);
m_watchpoint_list.Remove(matched_sp->GetID(), true);
@@ -773,6 +782,7 @@ Target::RemoveAllWatchpoints (bool end_t
return false;
}
m_watchpoint_list.RemoveAll (true);
+ m_last_created_watchpoint.reset();
return true; // Success!
}
@@ -940,6 +950,10 @@ Target::RemoveWatchpointByID (lldb::watc
if (log)
log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+ WatchpointSP watch_to_remove_sp = m_watchpoint_list.FindByID(watch_id);
+ if (watch_to_remove_sp == m_last_created_watchpoint)
+ m_last_created_watchpoint.reset();
+
if (DisableWatchpointByID (watch_id))
{
m_watchpoint_list.Remove(watch_id, true);
@@ -1186,7 +1200,7 @@ Target::ModuleIsExcludedForNonModuleSpec
// black list.
if (num_modules > 0)
{
- for (int i = 0; i < num_modules; i++)
+ for (size_t i = 0; i < num_modules; i++)
{
if (!ModuleIsExcludedForNonModuleSpecificSearches (matchingModules.GetModuleAtIndex(i)))
return false;
@@ -1766,6 +1780,15 @@ Target::GetDefaultExecutableSearchPaths
return FileSpecList();
}
+FileSpecList
+Target::GetDefaultDebugFileSearchPaths ()
+{
+ TargetPropertiesSP properties_sp(Target::GetGlobalProperties());
+ if (properties_sp)
+ return properties_sp->GetDebugFileSearchPaths();
+ return FileSpecList();
+}
+
ArchSpec
Target::GetDefaultArchitecture ()
{
@@ -2296,6 +2319,7 @@ g_properties[] =
"and the second is where the remainder of the original build hierarchy is rooted on the local system. "
"Each element of the array is checked in order and the first one that results in a match wins." },
{ "exec-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , NULL, NULL, "Executable search paths to use when locating executable files whose paths don't match the local file system." },
+ { "debug-file-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , NULL, NULL, "List of directories to be searched when locating debug symbol files." },
{ "max-children-count" , OptionValue::eTypeSInt64 , false, 256 , NULL, NULL, "Maximum number of children to expand in any level of depth." },
{ "max-string-summary-length" , OptionValue::eTypeSInt64 , false, 1024 , NULL, NULL, "Maximum number of characters to show when using %s in summary strings." },
{ "max-memory-read-size" , OptionValue::eTypeSInt64 , false, 1024 , NULL, NULL, "Maximum number of bytes that 'memory read' will fetch before --force must be specified." },
@@ -2331,6 +2355,7 @@ enum
ePropertySkipPrologue,
ePropertySourceMap,
ePropertyExecutableSearchPaths,
+ ePropertyDebugFileSearchPaths,
ePropertyMaxChildrenCount,
ePropertyMaxSummaryLength,
ePropertyMaxMemReadSize,
@@ -2606,6 +2631,15 @@ TargetProperties::GetExecutableSearchPat
OptionValueFileSpecList *option_value = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpecList (NULL, false, idx);
assert(option_value);
return option_value->GetCurrentValue();
+}
+
+FileSpecList &
+TargetProperties::GetDebugFileSearchPaths ()
+{
+ const uint32_t idx = ePropertyDebugFileSearchPaths;
+ OptionValueFileSpecList *option_value = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpecList (NULL, false, idx);
+ assert(option_value);
+ return option_value->GetCurrentValue();
}
bool
Modified: lldb/branches/lldb-platform-work/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Thread.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Thread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Thread.cpp Tue Jul 2 16:55:02 2013
@@ -704,8 +704,9 @@ Thread::ShouldStop (Event* event_ptr)
if (log)
{
- log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64,
- __FUNCTION__,
+ log->Printf ("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64,
+ __FUNCTION__,
+ this,
GetID (),
GetProtocolID (),
GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS);
@@ -966,8 +967,9 @@ Thread::ShouldReportRun (Event* event_pt
{
// Don't use GetCompletedPlan here, since that suppresses private plans.
if (log)
- log->Printf ("Current Plan for thread %d (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
- GetIndexID(),
+ log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
+ GetIndexID(),
+ this,
GetID(),
StateAsCString(GetTemporaryResumeState()),
m_completed_plan_stack.back()->GetName());
@@ -977,8 +979,9 @@ Thread::ShouldReportRun (Event* event_pt
else
{
if (log)
- log->Printf ("Current Plan for thread %d (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
- GetIndexID(),
+ log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
+ GetIndexID(),
+ this,
GetID(),
StateAsCString(GetTemporaryResumeState()),
GetCurrentPlan()->GetName());
@@ -1013,7 +1016,8 @@ Thread::PushPlan (ThreadPlanSP &thread_p
{
StreamString s;
thread_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull);
- log->Printf("Pushing plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+ log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
+ this,
s.GetData(),
thread_plan_sp->GetThread().GetID());
}
@@ -1043,9 +1047,13 @@ Thread::PopPlan ()
void
Thread::DiscardPlan ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_plan_stack.size() > 1)
{
ThreadPlanSP &plan = m_plan_stack.back();
+ if (log)
+ log->Printf("Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".", plan->GetName(), plan->GetThread().GetID());
+
m_discarded_plan_stack.push_back (plan);
plan->WillPop();
m_plan_stack.pop_back();
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp Tue Jul 2 16:55:02 2013
@@ -159,10 +159,11 @@ ThreadPlan::WillResume (StateType resume
addr_t pc = reg_ctx->GetPC();
addr_t sp = reg_ctx->GetSP();
addr_t fp = reg_ctx->GetFP();
- log->Printf("%s Thread #%u: tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
+ log->Printf("%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
"plan = '%s', state = %s, stop others = %d",
__FUNCTION__,
- m_thread.GetIndexID(),
+ m_thread.GetIndexID(),
+ &m_thread,
m_thread.GetID(),
(uint64_t)pc,
(uint64_t)sp,
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepUntil.cpp Tue Jul 2 16:55:02 2013
@@ -80,7 +80,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
m_stack_id = m_thread.GetStackFrameAtIndex(frame_idx)->GetStackID();
// Now set breakpoints on all our return addresses:
- for (int i = 0; i < num_addresses; i++)
+ for (size_t i = 0; i < num_addresses; i++)
{
Breakpoint *until_bp = target_sp->CreateBreakpoint (address_list[i], true).get();
if (until_bp != NULL)
Modified: lldb/branches/lldb-platform-work/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/CMakeLists.txt?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Utility/CMakeLists.txt (original)
+++ lldb/branches/lldb-platform-work/source/Utility/CMakeLists.txt Tue Jul 2 16:55:02 2013
@@ -4,6 +4,7 @@ add_lldb_library(lldbUtility
ARM_DWARF_Registers.cpp
KQueue.cpp
PseudoTerminal.cpp
+ Range.cpp
RefCounter.cpp
SharingPtr.cpp
StringExtractor.cpp
Modified: lldb/branches/lldb-platform-work/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/lldb.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/lldb.cpp (original)
+++ lldb/branches/lldb-platform-work/source/lldb.cpp Tue Jul 2 16:55:02 2013
@@ -30,6 +30,7 @@
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
+#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
@@ -99,6 +100,7 @@ lldb_private::Initialize ()
DisassemblerLLVMC::Initialize();
ObjectContainerBSDArchive::Initialize();
ObjectFileELF::Initialize();
+ SymbolVendorELF::Initialize();
SymbolFileDWARF::Initialize();
SymbolFileSymtab::Initialize();
UnwindAssemblyInstEmulation::Initialize();
@@ -178,6 +180,7 @@ lldb_private::Terminate ()
DisassemblerLLVMC::Terminate();
ObjectContainerBSDArchive::Terminate();
ObjectFileELF::Terminate();
+ SymbolVendorELF::Terminate();
SymbolFileDWARF::Terminate();
SymbolFileSymtab::Terminate();
UnwindAssembly_x86::Terminate();
@@ -362,6 +365,10 @@ lldb_private::GetSectionTypeAsCString (S
case eSectionTypeDWARFDebugPubTypes: return "dwarf-pubtypes";
case eSectionTypeDWARFDebugRanges: return "dwarf-ranges";
case eSectionTypeDWARFDebugStr: return "dwarf-str";
+ case eSectionTypeELFSymbolTable: return "elf-symbol-table";
+ case eSectionTypeELFDynamicSymbols: return "elf-dynamic-symbols";
+ case eSectionTypeELFRelocationEntries: return "elf-relocation-entries";
+ case eSectionTypeELFDynamicLinkInfo: return "elf-dynamic-link-info";
case eSectionTypeDWARFAppleNames: return "apple-names";
case eSectionTypeDWARFAppleTypes: return "apple-types";
case eSectionTypeDWARFAppleNamespaces: return "apple-namespaces";
Modified: lldb/branches/lldb-platform-work/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/dotest.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Tue Jul 2 16:55:02 2013
@@ -80,7 +80,8 @@ validCategories = {
'expression':'Tests related to the expression parser',
'objc':'Tests related to the Objective-C programming language support',
'pyapi':'Tests related to the Python API',
-'basic_process': 'Basic process execution sniff tests.'
+'basic_process': 'Basic process execution sniff tests.',
+'cmdline' : 'Tests related to the LLDB command-line interface'
}
# The test suite.
@@ -101,7 +102,7 @@ just_do_benchmarks_test = False
# Use @dsym_test or @dwarf_test decorators, defined in lldbtest.py, to mark a test
# as a dsym or dwarf test. Use '-N dsym' or '-N dwarf' to exclude dsym or dwarf
# tests from running.
-dont_do_dsym_test = "linux" in sys.platform
+dont_do_dsym_test = "linux" in sys.platform or "freebsd" in sys.platform
dont_do_dwarf_test = False
# The blacklist is optional (-b blacklistFile) and allows a central place to skip
@@ -330,6 +331,9 @@ def unique_string_match(yourentry,list):
candidate = item
return candidate
+class ArgParseNamespace(object):
+ pass
+
def parseOptionsAndInitTestdirs():
"""Initialize the list of directories containing our unittest scripts.
@@ -442,7 +446,14 @@ def parseOptionsAndInitTestdirs():
group = parser.add_argument_group('Test directories')
group.add_argument('args', metavar='test-dir', nargs='*', help='Specify a list of directory names to search for test modules named after Test*.py (test discovery). If empty, search from the current working directory instead.')
- args = parser.parse_args()
+
+ args = ArgParseNamespace()
+
+ if ('LLDB_TEST_ARGUMENTS' in os.environ):
+ print "Arguments passed through environment: '%s'" % os.environ['LLDB_TEST_ARGUMENTS']
+ args = parser.parse_args([sys.argv[0]].__add__(os.environ['LLDB_TEST_ARGUMENTS'].split()),namespace=args)
+
+ args = parser.parse_args(namespace=args)
platform_system = platform.system()
platform_machine = platform.machine()
@@ -457,7 +468,7 @@ def parseOptionsAndInitTestdirs():
# only print the args if being verbose (and parsable is off)
if args.v and not args.q:
- print args
+ print sys.argv
if args.h:
do_help = True
@@ -1221,6 +1232,7 @@ if not noHeaders:
if not os.path.isdir(sdir_name):
os.mkdir(sdir_name)
+where_to_save_session = os.getcwd()
fname = os.path.join(sdir_name, "TestStarted")
with open(fname, "w") as f:
print >> f, "Test started at: %s\n" % timestamp_started
@@ -1467,6 +1479,8 @@ for ia in range(len(archs) if iterArchs
def hardMarkAsSkipped(self,test):
getattr(test, test._testMethodName).__func__.__unittest_skip__ = True
getattr(test, test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
+ test.__class__.__unittest_skip__ = True
+ test.__class__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
def startTest(self, test):
if self.shouldSkipBecauseOfCategories(test):
@@ -1581,6 +1595,7 @@ if useCategories and len(failuresPerCate
for category in failuresPerCategory:
sys.stderr.write("%s - %d\n" % (category,failuresPerCategory[category]))
+os.chdir(where_to_save_session)
fname = os.path.join(sdir_name, "TestFinished")
with open(fname, "w") as f:
print >> f, "Test finished at: %s\n" % datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
Modified: lldb/branches/lldb-platform-work/test/expression_command/persistent_types/TestPersistentTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/expression_command/persistent_types/TestPersistentTypes.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/expression_command/persistent_types/TestPersistentTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/expression_command/persistent_types/TestPersistentTypes.py Tue Jul 2 16:55:02 2013
@@ -34,6 +34,16 @@ class PersistenttypesTestCase(TestBase):
self.expect("expression $bar i = 5; i",
startstr = "($bar) $1 = 5")
+ self.runCmd("expression struct $foobar { char a; char b; char c; char d; };")
+ self.runCmd("next")
+
+ self.expect("memory read foo -t $foobar",
+ substrs = ['($foobar) 0x', ' = {', "a = 'H'","b = 'e'","c = 'l'","d = 'l'"]) # persistent types are OK to use for memory read
+
+ self.expect("memory read foo -t foobar",
+ substrs = ['($foobar) 0x', ' = {', "a = 'H'","b = 'e'","c = 'l'","d = 'l'"],matching=False,error=True) # the type name is $foobar, make sure we settle for nothing less
+
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
Modified: lldb/branches/lldb-platform-work/test/expression_command/persistent_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/expression_command/persistent_types/main.c?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/expression_command/persistent_types/main.c (original)
+++ lldb/branches/lldb-platform-work/test/expression_command/persistent_types/main.c Tue Jul 2 16:55:02 2013
@@ -9,5 +9,6 @@
int main (int argc, char const *argv[])
{
+ const char* foo = "Hello world";
return 0;
}
Modified: lldb/branches/lldb-platform-work/test/functionalities/abbreviation/TestAbbreviations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/abbreviation/TestAbbreviations.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/abbreviation/TestAbbreviations.py Tue Jul 2 16:55:02 2013
@@ -125,10 +125,10 @@ class AbbreviationsTestCase(TestBase):
self.expect("break list",
substrs = ["1: name = 'product', locations = 1",
"2: name = 'sum', locations = 1",
- "3: file ='main.cpp', line = 32, locations = 1"])
+ "3: file = 'main.cpp', line = 32, locations = 1"])
self.expect("br cl -l 32 -f main.cpp",
startstr = "1 breakpoints cleared:",
- substrs = ["3: file ='main.cpp', line = 32, locations = 1"])
+ substrs = ["3: file = 'main.cpp', line = 32, locations = 1"])
# Add a future to terminate the current process being debugged.
#
Modified: lldb/branches/lldb-platform-work/test/functionalities/alias/TestAliases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/alias/TestAliases.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/alias/TestAliases.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/alias/TestAliases.py Tue Jul 2 16:55:02 2013
@@ -96,7 +96,7 @@ class AliasTestCase(TestBase):
startstr = "Current breakpoints:",
substrs = [ "1: name = 'foo', locations = 1",
"2: name = 'sum', locations = 1",
- "3: file ='main.cpp', line = 32, locations = 1" ])
+ "3: file = 'main.cpp', line = 32, locations = 1" ])
self.runCmd ("bpa -s python 1 -o 'print frame; print bp_loc'")
self.runCmd ("bpa -s command 2 -o 'frame variable b'")
Modified: lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Tue Jul 2 16:55:02 2013
@@ -62,13 +62,13 @@ class BreakpointCommandTestCase(TestBase
# The breakpoint list now only contains breakpoint 1.
self.expect("breakpoint list", "Breakpoints 1 & 2 created",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.line,
- "2: file ='main.c', line = %d, locations = 1" % self.line] )
+ substrs = ["2: file = 'main.c', line = %d, locations = 1" % self.line],
+ patterns = ["1: file = '.*main.c', line = %d, locations = 1" % self.line] )
self.expect("breakpoint list -f", "Breakpoints 1 & 2 created",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.line,
- "2: file ='main.c', line = %d, locations = 1" % self.line],
- patterns = ["1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,
+ substrs = ["2: file = 'main.c', line = %d, locations = 1" % self.line],
+ patterns = ["1: file = '.*main.c', line = %d, locations = 1" % self.line,
+ "1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,
"2.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line])
self.expect("breakpoint command list 1", "Breakpoint 1 command ok",
@@ -143,13 +143,13 @@ class BreakpointCommandTestCase(TestBase
# The breakpoint list now only contains breakpoint 1.
self.expect("breakpoint list -f", "Breakpoint 1 exists",
- substrs = ["1: file ='main.c', line = %d, locations = 1, resolved = 1" %
+ patterns = ["1: file = '.*main.c', line = %d, locations = 1, resolved = 1" %
self.line,
"hit count = 1"])
# Not breakpoint 2.
self.expect("breakpoint list -f", "No more breakpoint 2", matching=False,
- substrs = ["2: file ='main.c', line = %d, locations = 1, resolved = 1" %
+ substrs = ["2: file = 'main.c', line = %d, locations = 1, resolved = 1" %
self.line])
# Run the program again, with breakpoint 1 remaining.
Modified: lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Tue Jul 2 16:55:02 2013
@@ -117,6 +117,20 @@ class BreakpointConditionsTestCase(TestB
self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
startstr = '(int) val = 1')
+ self.runCmd("process kill")
+ self.runCmd("breakpoint disable")
+
+ self.runCmd("breakpoint set -p Loop")
+ self.runCmd("breakpoint modify -c ($eax&&!i)")
+ self.runCmd("run")
+
+ self.expect("process status", PROCESS_STOPPED,
+ patterns = ['Process .* stopped'])
+
+ self.runCmd("continue")
+
+ self.expect("process status", PROCESS_EXITED,
+ patterns = ['Process .* exited'])
def breakpoint_conditions_python(self):
"""Use Python APIs to set breakpoint conditions."""
Modified: lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/main.c?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/main.c (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/main.c Tue Jul 2 16:55:02 2013
@@ -46,6 +46,9 @@ int main (int argc, char const *argv[])
int A3 = a(3); // a(3) -> c(3)
printf("a(3) returns %d\n", A3);
+
+ for (int i = 0; i < 2; ++i)
+ printf("Loop\n");
return 0;
}
Modified: lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py Tue Jul 2 16:55:02 2013
@@ -41,7 +41,7 @@ class BreakpointLocationsTestCase(TestBa
# The breakpoint list should show 3 locations.
self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 3" % self.line],
+ substrs = ["1: file = 'main.c', line = %d, locations = 3" % self.line],
patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0",
"where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
Modified: lldb/branches/lldb-platform-work/test/functionalities/command_script/welcome.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/command_script/welcome.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/command_script/welcome.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/command_script/welcome.py Tue Jul 2 16:55:02 2013
@@ -13,9 +13,7 @@ def target_name_impl(debugger, args, res
file = target.GetExecutable()
print >>result, ('Current target ' + file.GetFilename())
if args == 'fail':
- return 'a test for error in command'
- else:
- return None
+ result.SetError('a test for error in command')
def print_wait_impl(debugger, args, result, dict):
result.SetImmediateOutputFile(sys.stdout)
@@ -25,11 +23,10 @@ def print_wait_impl(debugger, args, resu
print >>result, ('Still doing long task..')
time.sleep(1)
print >>result, ('Done; if you saw the delays I am doing OK')
- return None
def check_for_synchro(debugger, args, result, dict):
if debugger.GetAsync() == True:
print >>result, ('I am running async')
if debugger.GetAsync() == False:
print >>result, ('I am running sync')
- return None
+
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp Tue Jul 2 16:55:02 2013
@@ -61,8 +61,11 @@ struct SimpleWithPointers
SimpleWithPointers(int X, float Y, char Z) :
x(new int (X)),
y(new float (Y)),
- z(new char (Z))
- {}
+ z(new char[2])
+ {
+ z[0] = Z;
+ z[1] = '\0';
+ }
};
struct Couple
@@ -168,4 +171,4 @@ int main (int argc, const char * argv[])
VeryLong a_long_guy;
return 0; // Set break point at this line.
-}
\ No newline at end of file
+}
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py Tue Jul 2 16:55:02 2013
@@ -81,7 +81,7 @@ class NamedSummariesDataFormatterTestCas
self.expect("frame variable second --summary AllUseIt",
substrs = ['AllUseIt: x=65',
- 'y=43.21'])
+ 'y=43.25'])
self.expect("frame variable third --summary AllUseIt",
substrs = ['AllUseIt: x=96',
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp Tue Jul 2 16:55:02 2013
@@ -46,7 +46,7 @@ struct Third
int main (int argc, const char * argv[])
{
First first(12,34);
- Second second(65,43.21);
+ Second second(65,43.25);
Third *third = new Third(96,'E');
first.dummy = 1; // Set break point at this line.
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Tue Jul 2 16:55:02 2013
@@ -283,29 +283,29 @@ class SmartArrayDataFormatterTestCase(Te
self.expect("frame variable flarr",
substrs = ['flarr = arr =',
- '{78.5},{77.4},{78},{76.1},{76.7},{76.8},{77}'])
+ '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}'])
self.expect("frame variable other.flarr",
substrs = ['flarr = arr = ',
- '{25.5},{25.7},{25.9},{26.4},{27.1},{27.3},{26.9}'])
+ '{25.5},{25.25},{25.125},{26.75},{27.375},{27.5},{26.125}'])
# printing full array as an array
self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float [7]\"")
self.expect("frame variable flarr",
substrs = ['flarr = arr =',
- '78.5,77.4,78,76.1,76.7,76.8,77'])
+ '78.5,77.25,78,76.125,76.75,76.875,77'])
self.expect("frame variable other.flarr",
substrs = ['flarr = arr =',
- '25.5,25.7,25.9,26.4,27.1,27.3,26.9'])
+ '25.5,25.25,25.125,26.75,27.375,27.5,26.125'])
# using array smart summary strings for pointers should make no sense
self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float *\"")
self.runCmd("type summary add --summary-string \"arr = ${var%int32_t[]}\" \"int *\"")
self.expect("frame variable flptr", matching=False,
- substrs = ['78.5,77.4,78,76.1,76.7,76.8,77'])
+ substrs = ['78.5,77.25,78,76.125,76.75,76.875,77'])
self.expect("frame variable intptr", matching=False,
substrs = ['1,1,2,3,5'])
@@ -316,11 +316,11 @@ class SmartArrayDataFormatterTestCase(Te
self.expect("frame variable flarr",
substrs = ['flarr = arr =',
- '00 00 9d 42,cd cc 9a 42,00 00 9c 42,33 33 98 42,66 66 99 42,9a 99 99 42,00 00 9a 42'])
+ '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42'])
self.expect("frame variable other.flarr",
substrs = ['flarr = arr =',
- '00 00 cc 41,9a 99 cd 41,33 33 cf 41,33 33 d3 41,cd cc d8 41,66 66 da 41,33 33 d7 41'])
+ '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41'])
self.expect("frame variable intarr",
substrs = ['intarr = arr =',
@@ -335,13 +335,11 @@ class SmartArrayDataFormatterTestCase(Te
self.expect("frame variable flarr",
substrs = ['flarr = arr =',
- '...B,cd cc 9a 42',
- 'ff.B,9a 99 99 42'])
+ '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 . at .B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B'])
self.expect("frame variable other.flarr",
substrs = ['flarr = arr =',
- '...A,33 33 cf 41',
- '33.A,cd cc d8 41'])
+ '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A'])
self.expect("frame variable intarr",
substrs = ['intarr = arr =',
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp Tue Jul 2 16:55:02 2013
@@ -36,12 +36,12 @@ struct SomeOtherData
intarr[4] = 5;
flarr[0] = 25.5;
- flarr[1] = 25.7;
- flarr[2] = 25.9;
- flarr[3] = 26.4;
- flarr[4] = 27.1;
- flarr[5] = 27.3;
- flarr[6] = 26.9;
+ flarr[1] = 25.25;
+ flarr[2] = 25.125;
+ flarr[3] = 26.75;
+ flarr[4] = 27.375;
+ flarr[5] = 27.5;
+ flarr[6] = 26.125;
}
};
@@ -51,7 +51,7 @@ int main (int argc, const char * argv[])
char *strptr = NULL;
strptr = "Hello world!";
int intarr[5] = {1,1,2,3,5};
- float flarr[7] = {78.5,77.4,78.0,76.1,76.7,76.8,77.0};
+ float flarr[7] = {78.5,77.25,78.0,76.125,76.75,76.875,77.0};
SomeData data;
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py Tue Jul 2 16:55:02 2013
@@ -26,20 +26,6 @@ class StdListDataFormatterTestCase(TestB
self.buildDwarf()
self.data_formatter_commands()
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- @dsym_test
- def test_with_dsym_and_run_command(self):
- """Test data formatter commands."""
- self.buildDsym()
- self.data_formatter_commands_after_steps()
-
- @dwarf_test
- @expectedFailureLinux # llvm.org/pr15301 Multiple LLDB steps do not all complete synchronously.
- def test_with_dwarf_and_run_command_after_steps(self):
- """Test data formatter commands with multiple steps."""
- self.buildDwarf()
- self.data_formatter_commands_after_steps()
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -74,36 +60,35 @@ class StdListDataFormatterTestCase(TestB
self.addTearDownHook(cleanup)
self.runCmd("frame variable numbers_list --show-types")
- #self.runCmd("type synth add std::int_list std::string_list int_list string_list -l StdListSynthProvider")
- self.runCmd("type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e")
+
self.runCmd("type format add -f hex int")
self.expect("frame variable numbers_list --raw", matching=False,
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
self.expect("frame variable &numbers_list._M_impl._M_node --raw", matching=False,
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
self.expect("frame variable numbers_list",
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
self.expect("p numbers_list",
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 1 items',
+ substrs = ['size=1',
'[0] = ',
'0x12345678'])
self.runCmd("n");self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 4 items',
+ substrs = ['size=4',
'[0] = ',
'0x12345678',
'[1] =',
@@ -116,7 +101,7 @@ class StdListDataFormatterTestCase(TestB
self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 6 items',
+ substrs = ['size=6',
'[0] = ',
'0x12345678',
'0x11223344',
@@ -128,7 +113,7 @@ class StdListDataFormatterTestCase(TestB
'0x0cab0cab'])
self.expect("p numbers_list",
- substrs = ['list has 6 items',
+ substrs = ['size=6',
'[0] = ',
'0x12345678',
'0x11223344',
@@ -155,13 +140,13 @@ class StdListDataFormatterTestCase(TestB
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 4 items',
+ substrs = ['size=4',
'[0] = ', '1',
'[1] = ', '2',
'[2] = ', '3',
@@ -172,7 +157,7 @@ class StdListDataFormatterTestCase(TestB
self.runCmd("n")
self.expect("frame variable text_list",
- substrs = ['list has 0 items',
+ substrs = ['size=0',
'{}'])
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.final_line, num_expected_locations=-1)
@@ -185,14 +170,14 @@ class StdListDataFormatterTestCase(TestB
'stop reason = breakpoint'])
self.expect("frame variable text_list",
- substrs = ['list has 4 items',
+ substrs = ['size=4',
'[0]', 'goofy',
'[1]', 'is',
'[2]', 'smart',
'[3]', '!!!'])
self.expect("p text_list",
- substrs = ['list has 4 items',
+ substrs = ['size=4',
'\"goofy\"',
'\"is\"',
'\"smart\"',
@@ -211,46 +196,6 @@ class StdListDataFormatterTestCase(TestB
# check that MightHaveChildren() gets it right
self.assertTrue(self.frame().FindVariable("text_list").MightHaveChildren(), "text_list.MightHaveChildren() says False for non empty!")
- def data_formatter_commands_after_steps(self):
- """Test that that file and class static variables display correctly after multiple step instructions."""
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.optional_line, num_expected_locations=-1)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- self.expect("frame variable text_list",
- substrs = ['{}'])
-
- # Verify that steps in rapid succession are processed prior to inspecting text_list.
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
-
- self.expect("frame variable text_list",
- substrs = ['list has 4 items',
- '[0]', 'goofy',
- '[1]', 'is',
- '[2]', 'smart',
- '[3]', '!!!'])
-
- self.expect("p text_list",
- substrs = ['list has 4 items',
- '\"goofy\"',
- '\"is\"',
- '\"smart\"',
- '\"!!!\"'])
-
- # check access-by-index
- self.expect("frame variable text_list[0]",
- substrs = ['goofy']);
- self.expect("frame variable text_list[3]",
- substrs = ['!!!']);
-
-
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py Tue Jul 2 16:55:02 2013
@@ -39,7 +39,7 @@ class StdMapDataFormatterTestCase(TestBa
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
@@ -68,7 +68,7 @@ class StdMapDataFormatterTestCase(TestBa
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect('frame variable ii',
substrs = ['map has 2 items',
@@ -79,7 +79,7 @@ class StdMapDataFormatterTestCase(TestBa
'first = 1',
'second = 1'])
- self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect('frame variable ii',
substrs = ['map has 4 items',
@@ -90,8 +90,7 @@ class StdMapDataFormatterTestCase(TestBa
'first = 3',
'second = 1'])
- self.runCmd("n");self.runCmd("n");
- self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable ii",
substrs = ['map has 9 items',
@@ -133,20 +132,19 @@ class StdMapDataFormatterTestCase(TestBa
#self.expect("expression ii[8]", matching=False, error=True,
# substrs = ['1234567'])
- self.runCmd("n")
+ self.runCmd("c")
self.expect('frame variable ii',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n")
self.runCmd("frame variable si --show-types")
self.expect('frame variable si',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n")
+ self.runCmd("c")
self.expect('frame variable si',
substrs = ['map has 1 items',
@@ -154,7 +152,7 @@ class StdMapDataFormatterTestCase(TestBa
'first = \"zero\"',
'second = 0'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable si",
substrs = ['map has 5 items',
@@ -208,20 +206,19 @@ class StdMapDataFormatterTestCase(TestBa
#self.expect("expression si[0]", matching=False, error=True,
# substrs = ['first = ', 'zero'])
- self.runCmd("n")
+ self.runCmd("c")
self.expect('frame variable si',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n")
self.runCmd("frame variable is --show-types")
self.expect('frame variable is',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable is",
substrs = ['map has 4 items',
@@ -269,20 +266,19 @@ class StdMapDataFormatterTestCase(TestBa
#self.expect("expression is[0]", matching=False, error=True,
# substrs = ['first = ', 'goofy'])
- self.runCmd("n")
+ self.runCmd("c")
self.expect('frame variable is',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n")
self.runCmd("frame variable ss --show-types")
self.expect('frame variable ss',
substrs = ['map has 0 items',
'{}'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable ss",
substrs = ['map has 4 items',
@@ -329,7 +325,7 @@ class StdMapDataFormatterTestCase(TestBa
#self.expect("expression ss[3]", matching=False, error=True,
# substrs = ['gatto'])
- self.runCmd("n")
+ self.runCmd("c")
self.expect('frame variable ss',
substrs = ['map has 0 items',
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp Tue Jul 2 16:55:02 2013
@@ -13,43 +13,43 @@ int main()
ii[0] = 0; // Set break point at this line.
ii[1] = 1;
- ii[2] = 0;
+ ii[2] = 0;// Set break point at this line.
ii[3] = 1;
- ii[4] = 0;
+ ii[4] = 0;// Set break point at this line.
ii[5] = 1;
ii[6] = 0;
ii[7] = 1;
ii[85] = 1234567;
- ii.clear();
+ ii.clear();// Set break point at this line.
strint_map si;
- si["zero"] = 0;
- si["one"] = 1;
+ si["zero"] = 0;// Set break point at this line.
+ si["one"] = 1;// Set break point at this line.
si["two"] = 2;
si["three"] = 3;
si["four"] = 4;
- si.clear();
+ si.clear();// Set break point at this line.
intstr_map is;
- is[85] = "goofy";
+ is[85] = "goofy";// Set break point at this line.
is[1] = "is";
is[2] = "smart";
is[3] = "!!!";
- is.clear();
+ is.clear();// Set break point at this line.
strstr_map ss;
- ss["ciao"] = "hello";
+ ss["ciao"] = "hello";// Set break point at this line.
ss["casa"] = "house";
ss["gatto"] = "cat";
ss["a Mac.."] = "..is always a Mac!";
- ss.clear();
+ ss.clear();// Set break point at this line.
- return 0;
+ return 0;// Set break point at this line.
}
\ No newline at end of file
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py Tue Jul 2 16:55:02 2013
@@ -36,7 +36,7 @@ class StdVectorDataFormatterTestCase(Tes
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
@@ -61,7 +61,7 @@ class StdVectorDataFormatterTestCase(Tes
self.expect("frame variable numbers",
substrs = ['numbers = size=0'])
- self.runCmd("n")
+ self.runCmd("c")
# first value added
self.expect("frame variable numbers",
@@ -70,7 +70,7 @@ class StdVectorDataFormatterTestCase(Tes
'}'])
# add some more data
- self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable numbers",
substrs = ['numbers = size=4',
@@ -104,7 +104,7 @@ class StdVectorDataFormatterTestCase(Tes
self.runCmd("type summary delete int_vect")
# add some more data
- self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable numbers",
substrs = ['numbers = size=7',
@@ -148,12 +148,12 @@ class StdVectorDataFormatterTestCase(Tes
self.assertTrue(self.frame().FindVariable("numbers").MightHaveChildren(), "numbers.MightHaveChildren() says False for non empty!")
# clear out the vector and see that we do the right thing once again
- self.runCmd("n")
+ self.runCmd("c")
self.expect("frame variable numbers",
substrs = ['numbers = size=0'])
- self.runCmd("n")
+ self.runCmd("c")
# first value added
self.expect("frame variable numbers",
@@ -162,10 +162,7 @@ class StdVectorDataFormatterTestCase(Tes
'}'])
# check if we can display strings
- self.runCmd("n")
- self.runCmd("n")
- self.runCmd("n")
- self.runCmd("n")
+ self.runCmd("c")
self.expect("frame variable strings",
substrs = ['goofy',
@@ -191,7 +188,7 @@ class StdVectorDataFormatterTestCase(Tes
'is',
'smart'])
- self.runCmd("n");
+ self.runCmd("c");
self.expect("frame variable strings",
substrs = ['vector has 4 items'])
@@ -211,7 +208,7 @@ class StdVectorDataFormatterTestCase(Tes
# check that MightHaveChildren() gets it right
self.assertTrue(self.frame().FindVariable("strings").MightHaveChildren(), "strings.MightHaveChildren() says False for non empty!")
- self.runCmd("n")
+ self.runCmd("c")
self.expect("frame variable strings",
substrs = ['vector has 0 items'])
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp Tue Jul 2 16:55:02 2013
@@ -7,25 +7,25 @@ int main()
{
int_vect numbers;
numbers.push_back(1); // Set break point at this line.
- numbers.push_back(12);
+ numbers.push_back(12); // Set break point at this line.
numbers.push_back(123);
numbers.push_back(1234);
- numbers.push_back(12345);
+ numbers.push_back(12345); // Set break point at this line.
numbers.push_back(123456);
numbers.push_back(1234567);
- numbers.clear();
+ numbers.clear(); // Set break point at this line.
- numbers.push_back(7);
+ numbers.push_back(7); // Set break point at this line.
- string_vect strings;
+ string_vect strings; // Set break point at this line.
strings.push_back(std::string("goofy"));
strings.push_back(std::string("is"));
strings.push_back(std::string("smart"));
- strings.push_back(std::string("!!!"));
+ strings.push_back(std::string("!!!")); // Set break point at this line.
- strings.clear();
+ strings.clear(); // Set break point at this line.
- return 0;
+ return 0;// Set break point at this line.
}
Modified: lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py Tue Jul 2 16:55:02 2013
@@ -45,13 +45,22 @@ class RegisterCommandsTestCase(TestBase)
self.buildDefault()
self.convenience_registers()
- @skipIfLinux # Expression evaluation fails after attach by pid
+ @skipIfLinux # llvm.org/pr16301 LLDB occasionally exits with SIGABRT
def test_convenience_registers_with_process_attach(self):
"""Test convenience registers after a 'process attach'."""
if not self.getArchitecture() in ['x86_64']:
self.skipTest("This test requires x86_64 as the architecture for the inferior")
self.buildDefault()
- self.convenience_registers_with_process_attach()
+ self.convenience_registers_with_process_attach(test_16bit_regs=False)
+
+ @expectedFailureLinux("llvm.org/pr14600") # Linux doesn't support 16-bit convenience registers
+ @skipIfLinux # llvm.org/pr16301 LLDB occasionally exits with SIGABRT
+ def test_convenience_registers_16bit_with_process_attach(self):
+ """Test convenience registers after a 'process attach'."""
+ if not self.getArchitecture() in ['x86_64']:
+ self.skipTest("This test requires x86_64 as the architecture for the inferior")
+ self.buildDefault()
+ self.convenience_registers_with_process_attach(test_16bit_regs=True)
def common_setup(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -67,6 +76,11 @@ class RegisterCommandsTestCase(TestBase)
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs = ['stopped', 'stop reason = breakpoint'])
+ def remove_log(self):
+ """ Remove the temporary log file generated by some tests."""
+ if os.path.exists(self.log_file):
+ os.remove(self.log_file)
+
# platform specific logging of the specified category
def log_enable(self, category):
self.platform = ""
@@ -76,11 +90,11 @@ class RegisterCommandsTestCase(TestBase)
self.platform = "linux"
if self.platform != "":
- log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
- self.runCmd("log enable " + self.platform + " " + str(category) + " registers -v -f " + log_file, RUN_SUCCEEDED)
+ self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
+ self.runCmd("log enable " + self.platform + " " + str(category) + " registers -v -f " + self.log_file, RUN_SUCCEEDED)
if not self.has_teardown:
self.has_teardown = True
- self.addTearDownHook(lambda: os.remove(log_file))
+ self.addTearDownHook(self.remove_log)
def register_commands(self):
"""Test commands related to registers, in particular vector registers."""
@@ -220,18 +234,23 @@ class RegisterCommandsTestCase(TestBase)
self.expect("register read rax 0x1234567887654321",
substrs = ['0x1234567887654321'])
- def convenience_registers_with_process_attach(self):
+ def convenience_registers_with_process_attach(self, test_16bit_regs):
"""Test convenience registers after a 'process attach'."""
exe = self.lldbHere
-
+
# Spawn a new process
- proc = self.spawnSubprocess(exe, [self.lldbOption])
+ pid = 0
+ if sys.platform.startswith('linux'):
+ pid = self.forkSubprocess(exe, [self.lldbOption])
+ else:
+ proc = self.spawnSubprocess(exe, [self.lldbOption])
+ pid = proc.pid
self.addTearDownHook(self.cleanupSubprocesses)
if self.TraceOn():
- print "pid of spawned process: %d" % proc.pid
+ print "pid of spawned process: %d" % pid
- self.runCmd("process attach -p %d" % proc.pid)
+ self.runCmd("process attach -p %d" % pid)
# Check that "register read eax" works.
self.runCmd("register read eax")
@@ -240,8 +259,9 @@ class RegisterCommandsTestCase(TestBase)
self.expect("expr -- ($rax & 0xffffffff) == $eax",
substrs = ['true'])
- self.expect("expr -- $ax == (($ah << 8) | $al)",
- substrs = ['true'])
+ if test_16bit_regs:
+ self.expect("expr -- $ax == (($ah << 8) | $al)",
+ substrs = ['true'])
if __name__ == '__main__':
import atexit
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/TestNumThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/TestNumThreads.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/TestNumThreads.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/TestNumThreads.py Tue Jul 2 16:55:02 2013
@@ -41,7 +41,7 @@ class NumberOfThreadsTestCase(TestBase):
# The breakpoint list should show 3 locations.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.line])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.line])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py Tue Jul 2 16:55:02 2013
@@ -21,6 +21,7 @@ class BreakpointAfterJoinTestCase(TestBa
self.breakpoint_after_join_test()
@expectedFailureDarwin("llvm.org/pr15824") # thread states not properly maintained
+ @skipIfLinux # Causes hangs (llvm.org/pr16170) when run using "make check"
@dwarf_test
def test_with_dwarf(self):
"""Test breakpoint handling after a thread join."""
@@ -43,7 +44,7 @@ class BreakpointAfterJoinTestCase(TestBa
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.breakpoint])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py Tue Jul 2 16:55:02 2013
@@ -19,6 +19,9 @@ class CreateAfterAttachTestCase(TestBase
self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False))
self.create_after_attach(use_fork=False)
+ @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but
+ # not yet investigated. Revisit once required functionality
+ # is implemented for FreeBSD.
@skipIfLinux # Hangs, see llvm.org/pr16229
@dwarf_test
def test_create_after_attach_with_dwarf_and_popen(self):
@@ -26,6 +29,8 @@ class CreateAfterAttachTestCase(TestBase
self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False))
self.create_after_attach(use_fork=False)
+ @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented
+ # for FreeBSD.
@dwarf_test
def test_create_after_attach_with_dwarf_and_fork(self):
"""Test thread creation after process attach."""
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/create_during_step/TestCreateDuringStep.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/create_during_step/TestCreateDuringStep.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/create_during_step/TestCreateDuringStep.py Tue Jul 2 16:55:02 2013
@@ -86,7 +86,7 @@ class CreateDuringStepTestCase(TestBase)
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.breakpoint])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py Tue Jul 2 16:55:02 2013
@@ -43,7 +43,7 @@ class ExitDuringBreakpointTestCase(TestB
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.breakpoint])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_step/TestExitDuringStep.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_step/TestExitDuringStep.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/exit_during_step/TestExitDuringStep.py Tue Jul 2 16:55:02 2013
@@ -86,7 +86,7 @@ class ExitDuringStepTestCase(TestBase):
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.breakpoint])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py Tue Jul 2 16:55:02 2013
@@ -43,7 +43,7 @@ class MultipleBreakpointTestCase(TestBas
# The breakpoint list should show 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.breakpoint])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/state/TestThreadStates.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/state/TestThreadStates.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/state/TestThreadStates.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/state/TestThreadStates.py Tue Jul 2 16:55:02 2013
@@ -98,7 +98,7 @@ class ThreadStateTestCase(TestBase):
# The breakpoint list should show 1 breakpoint with 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.break_1])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -139,7 +139,7 @@ class ThreadStateTestCase(TestBase):
# The breakpoint list should show 1 breakpoints with 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.break_1])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -188,7 +188,7 @@ class ThreadStateTestCase(TestBase):
# The breakpoint list should show 1 breakpoints with 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.break_1])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -232,7 +232,7 @@ class ThreadStateTestCase(TestBase):
# The breakpoint list should show 1 breakpoints with 1 location.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.break_1])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -286,8 +286,8 @@ class ThreadStateTestCase(TestBase):
# The breakpoint list should show 2 breakpoints with 1 location each.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.c', line = %d, locations = 1" % self.break_1,
- "2: file ='main.c', line = %d, locations = 1" % self.break_2])
+ substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1,
+ "2: file = 'main.c', line = %d, locations = 1" % self.break_2])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/thread_exit/TestThreadExit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/thread_exit/TestThreadExit.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/thread_exit/TestThreadExit.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/thread_exit/TestThreadExit.py Tue Jul 2 16:55:02 2013
@@ -49,10 +49,10 @@ class ThreadExitTestCase(TestBase):
# The breakpoint list should show 1 locations.
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file ='main.cpp', line = %d, locations = 1" % self.break_1,
- "2: file ='main.cpp', line = %d, locations = 1" % self.break_2,
- "3: file ='main.cpp', line = %d, locations = 1" % self.break_3,
- "4: file ='main.cpp', line = %d, locations = 1" % self.break_4])
+ substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1,
+ "2: file = 'main.cpp', line = %d, locations = 1" % self.break_2,
+ "3: file = 'main.cpp', line = %d, locations = 1" % self.break_3,
+ "4: file = 'main.cpp', line = %d, locations = 1" % self.break_4])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
Modified: lldb/branches/lldb-platform-work/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/help/TestHelp.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/help/TestHelp.py (original)
+++ lldb/branches/lldb-platform-work/test/help/TestHelp.py Tue Jul 2 16:55:02 2013
@@ -124,7 +124,7 @@ class HelpCommandTestCase(TestBase):
"""Command 'help image du line' is not ambiguous and should work."""
# 'image' is an alias for 'target modules'.
self.expect("help image du line",
- substrs = ['Dump the debug symbol file for one or more target modules'])
+ substrs = ['Dump the line table for one or more compilation units'])
def test_help_target_variable_syntax(self):
"""Command 'help target variable' should display <variable-name> ..."""
Modified: lldb/branches/lldb-platform-work/test/lang/c/anonymous/TestAnonymous.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/anonymous/TestAnonymous.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/anonymous/TestAnonymous.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/anonymous/TestAnonymous.py Tue Jul 2 16:55:02 2013
@@ -124,6 +124,8 @@ class AnonymousTestCase(TestBase):
substrs = ["= 2"])
def expr_parent(self):
+ if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
+ self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.common_setup(self.line2)
# These should display correctly.
Modified: lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py Tue Jul 2 16:55:02 2013
@@ -105,7 +105,7 @@ class ArrayTypesTestCase(TestBase):
# Sanity check the print representation of breakpoint.
bp = str(breakpoint)
self.expect(bp, msg="Breakpoint looks good", exe=False,
- substrs = ["file ='main.c'",
+ substrs = ["file = 'main.c'",
"line = %d" % self.line,
"locations = 1"])
self.expect(bp, msg="Breakpoint is not resolved as yet", exe=False, matching=False,
@@ -139,7 +139,7 @@ class ArrayTypesTestCase(TestBase):
# The breakpoint should be resolved by now.
bp = str(breakpoint)
self.expect(bp, "Breakpoint looks good and is resolved", exe=False,
- substrs = ["file ='main.c'",
+ substrs = ["file = 'main.c'",
"line = %d" % self.line,
"locations = 1"])
Modified: lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py Tue Jul 2 16:55:02 2013
@@ -63,6 +63,10 @@ class SharedLibTestCase(TestBase):
def expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
+
+ if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
+ self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+
self.common_setup()
# This should display correctly.
Modified: lldb/branches/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Tue Jul 2 16:55:02 2013
@@ -605,6 +605,21 @@ def expectedFailureDarwin(bugnumber=None
return wrapper
return expectedFailureDarwin_impl
+def skipIfFreeBSD(func):
+ """Decorate the item to skip tests that should be skipped on FreeBSD."""
+ if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+ raise Exception("@skipIfFreeBSD can only be used to decorate a test method")
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ from unittest2 import case
+ self = args[0]
+ platform = sys.platform
+ if "freebsd" in platform:
+ self.skipTest("skip on FreeBSD")
+ else:
+ func(*args, **kwargs)
+ return wrapper
+
def skipIfLinux(func):
"""Decorate the item to skip tests that should be skipped on Linux."""
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -941,7 +956,6 @@ class Base(unittest2.TestCase):
if child_pid == 0:
# If more I/O support is required, this can be beefed up.
fd = os.open(os.devnull, os.O_RDWR)
- os.dup2(fd, 0)
os.dup2(fd, 1)
os.dup2(fd, 2)
# This call causes the child to have its of group ID
@@ -1586,7 +1600,7 @@ class TestBase(Base):
if matched:
self.runCmd('thread select %s' % matched.group(1))
- def runCmd(self, cmd, msg=None, check=True, trace=False):
+ def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False):
"""
Ask the command interpreter to handle the command and then check its
return status.
@@ -1632,7 +1646,7 @@ class TestBase(Base):
running = (cmd.startswith("run") or cmd.startswith("process launch"))
for i in range(self.maxLaunchCount if running else 1):
- self.ci.HandleCommand(cmd, self.res)
+ self.ci.HandleCommand(cmd, self.res, inHistory)
with recording(self, trace) as sbuf:
print >> sbuf, "runCmd:", cmd
@@ -1699,7 +1713,7 @@ class TestBase(Base):
return match_object
- def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True):
+ def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True, inHistory=False):
"""
Similar to runCmd; with additional expect style output matching ability.
@@ -1728,7 +1742,7 @@ class TestBase(Base):
if exe:
# First run the command. If we are expecting error, set check=False.
# Pass the assert message along since it provides more semantic info.
- self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error)
+ self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error, inHistory=inHistory)
# Then compare the output against expected strings.
output = self.res.GetError() if error else self.res.GetOutput()
Modified: lldb/branches/lldb-platform-work/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/make/Makefile.rules?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/make/Makefile.rules (original)
+++ lldb/branches/lldb-platform-work/test/make/Makefile.rules Tue Jul 2 16:55:02 2013
@@ -16,6 +16,7 @@
# FRAMEWORK_INCLUDES (Darwin only) :=
# CFLAGS_EXTRAS :=
# LD_EXTRAS :=
+# SPLIT_DEBUG_SYMBOLS := YES
#
# And test/functionalities/archives/Makefile:
# MAKE_DSYM := NO
@@ -79,6 +80,10 @@ else
ifeq "$(ARCH)" "i386"
override ARCH := $(subst i386,32,$(ARCH))
endif
+
+ ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ DSYM = $(EXE).debug
+ endif
endif
CFLAGS ?= -g -O0
@@ -117,11 +122,19 @@ cxx_linker = $(if $(findstring clang,$(1
ifeq (1,$(USE_LIBSTDCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
- CFLAGS += -stdlib=libstdc++
+ CXXFLAGS += -stdlib=libstdc++
LDFLAGS += -stdlib=libstdc++
endif
endif
+ifeq (1,$(USE_LIBCPP))
+ # Clang requires an extra flag: -stdlib=libstdc++
+ ifneq (,$(findstring clang,$(CC)))
+ CXXFLAGS += -stdlib=libc++
+ LDFLAGS += -stdlib=libc++
+ endif
+endif
+
#----------------------------------------------------------------------
# dylib settings
#----------------------------------------------------------------------
@@ -221,13 +234,20 @@ endif
#----------------------------------------------------------------------
# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
#----------------------------------------------------------------------
+$(DSYM) : $(EXE)
ifeq "$(OS)" "Darwin"
ifneq "$(MAKE_DSYM)" "NO"
ifeq "$(DYLIB_ONLY)" ""
-$(DSYM) : $(EXE)
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
endif
endif
+else
+ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ifeq "$(DYLIB_ONLY)" ""
+ objcopy --only-keep-debug "$(EXE)" "$(DSYM)"
+ objcopy --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
+endif
+endif
endif
#----------------------------------------------------------------------
@@ -271,6 +291,10 @@ endif
endif
else
$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)"
+ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ objcopy --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
+ objcopy --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
+endif
endif
#----------------------------------------------------------------------
@@ -332,9 +356,9 @@ dsym: $(DSYM)
all: $(EXE) $(DSYM)
clean::
ifeq "$(DYLIB_NAME)" ""
- rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
+ rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
else
- rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).dSYM
+ rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).dSYM $(DYLIB_FILENAME).debug *.d.[0-9] *.d.[0-9][0-9] *.d.[0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
endif
#----------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/plugins/builder_base.py?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/plugins/builder_base.py (original)
+++ lldb/branches/lldb-platform-work/test/plugins/builder_base.py Tue Jul 2 16:55:02 2013
@@ -13,6 +13,7 @@ variable.
"""
import os
+import platform
import lldbtest
def getArchitecture():
@@ -37,6 +38,13 @@ def getArchFlag():
return (" ARCHFLAG=" + archflag) if archflag else ""
+def getMake():
+ """Returns the name for GNU make"""
+ if platform.system() == "FreeBSD":
+ return "gmake "
+ else:
+ return "make "
+
def getArchSpec(architecture):
"""
Helper function to return the key-value string to specify the architecture
@@ -81,13 +89,14 @@ def buildDefault(sender=None, architectu
"""Build the binaries the default way."""
if clean:
lldbtest.system(["/bin/sh", "-c",
- "make clean" + getCmdLine(dictionary) + "; make"
+ getMake() + "clean" + getCmdLine(dictionary) + ";"
+ + getMake()
+ getArchSpec(architecture) + getCCSpec(compiler)
+ getCmdLine(dictionary)],
sender=sender)
else:
lldbtest.system(["/bin/sh", "-c",
- "make" + getArchSpec(architecture) + getCCSpec(compiler)
+ getMake() + getArchSpec(architecture) + getCCSpec(compiler)
+ getCmdLine(dictionary)],
sender=sender)
@@ -98,14 +107,14 @@ def buildDwarf(sender=None, architecture
"""Build the binaries with dwarf debug info."""
if clean:
lldbtest.system(["/bin/sh", "-c",
- "make clean" + getCmdLine(dictionary)
- + "; make MAKE_DSYM=NO"
+ getMake() + "clean" + getCmdLine(dictionary)
+ + ";" + getMake() + "MAKE_DSYM=NO"
+ getArchSpec(architecture) + getCCSpec(compiler)
+ getCmdLine(dictionary)],
sender=sender)
else:
lldbtest.system(["/bin/sh", "-c",
- "make MAKE_DSYM=NO"
+ getMake() + "MAKE_DSYM=NO"
+ getArchSpec(architecture) + getCCSpec(compiler)
+ getCmdLine(dictionary)],
sender=sender)
@@ -118,7 +127,8 @@ def cleanup(sender=None, dictionary=None
#import traceback
#traceback.print_stack()
if os.path.isfile("Makefile"):
- lldbtest.system(["/bin/sh", "-c", "make clean"+getCmdLine(dictionary)],
+ lldbtest.system(["/bin/sh", "-c",
+ getMake() + "clean" + getCmdLine(dictionary)],
sender=sender)
# True signifies that we can handle cleanup.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp Tue Jul 2 16:55:02 2013
@@ -132,7 +132,7 @@ waitpid_thread (void *arg)
while (1)
{
pid_t child_pid = waitpid(pid, &status, 0);
- DNBLogThreadedIf(LOG_PROCESS, "waitpid_process_thread (): waitpid (pid = %i, &status, 0) => %i, status = %i, errno = %i", pid, child_pid, status, errno);
+ DNBLogThreadedIf(LOG_PROCESS, "waitpid_thread (): waitpid (pid = %i, &status, 0) => %i, status = %i, errno = %i", pid, child_pid, status, errno);
if (child_pid < 0)
{
@@ -148,7 +148,7 @@ waitpid_thread (void *arg)
}
else// if (WIFEXITED(status) || WIFSIGNALED(status))
{
- DNBLogThreadedIf(LOG_PROCESS, "waitpid_process_thread (): setting exit status for pid = %i to %i", child_pid, status);
+ DNBLogThreadedIf(LOG_PROCESS, "waitpid_thread (): setting exit status for pid = %i to %i", child_pid, status);
DNBProcessSetExitStatus (child_pid, status);
return NULL;
}
@@ -157,7 +157,7 @@ waitpid_thread (void *arg)
// We should never exit as long as our child process is alive, so if we
// do something else went wrong and we should exit...
- DNBLogThreadedIf(LOG_PROCESS, "waitpid_process_thread (): main loop exited, setting exit status to an invalid value (-1) for pid %i", pid);
+ DNBLogThreadedIf(LOG_PROCESS, "waitpid_thread (): main loop exited, setting exit status to an invalid value (-1) for pid %i", pid);
DNBProcessSetExitStatus (pid, -1);
return NULL;
}
@@ -901,227 +901,44 @@ DNBProcessResetEvents (nub_process_t pid
}
// Breakpoints
-nub_break_t
+nub_bool_t
DNBBreakpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, nub_bool_t hardware)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- {
- return procSP->CreateBreakpoint(addr, size, hardware, THREAD_NULL);
- }
- return INVALID_NUB_BREAK_ID;
-}
-
-nub_bool_t
-DNBBreakpointClear (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- return procSP->DisableBreakpoint(breakID, true);
- }
- }
- return false; // Failed
-}
-
-nub_ssize_t
-DNBBreakpointGetHitCount (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- return bp->GetHitCount();
- }
- }
- return 0;
-}
-
-nub_ssize_t
-DNBBreakpointGetIgnoreCount (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- return bp->GetIgnoreCount();
- }
- }
- return 0;
-}
-
-nub_bool_t
-DNBBreakpointSetIgnoreCount (nub_process_t pid, nub_break_t breakID, nub_size_t ignore_count)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- {
- bp->SetIgnoreCount(ignore_count);
- return true;
- }
- }
- }
+ return procSP->CreateBreakpoint(addr, size, hardware) != NULL;
return false;
}
-// Set the callback function for a given breakpoint. The callback function will
-// get called as soon as the breakpoint is hit. The function will be called
-// with the process ID, thread ID, breakpoint ID and the baton, and can return
-//
nub_bool_t
-DNBBreakpointSetCallback (nub_process_t pid, nub_break_t breakID, DNBCallbackBreakpointHit callback, void *baton)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- {
- bp->SetCallback(callback, baton);
- return true;
- }
- }
- }
- return false;
-}
-
-//----------------------------------------------------------------------
-// Dump the breakpoints stats for process PID for a breakpoint by ID.
-//----------------------------------------------------------------------
-void
-DNBBreakpointPrint (nub_process_t pid, nub_break_t breakID)
+DNBBreakpointClear (nub_process_t pid, nub_addr_t addr)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- procSP->DumpBreakpoint(breakID);
+ return procSP->DisableBreakpoint(addr, true);
+ return false; // Failed
}
+
//----------------------------------------------------------------------
// Watchpoints
//----------------------------------------------------------------------
-nub_watch_t
+nub_bool_t
DNBWatchpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, uint32_t watch_flags, nub_bool_t hardware)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- {
- return procSP->CreateWatchpoint(addr, size, watch_flags, hardware, THREAD_NULL);
- }
- return INVALID_NUB_WATCH_ID;
-}
-
-nub_bool_t
-DNBWatchpointClear (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- return procSP->DisableWatchpoint(watchID, true);
- }
- }
- return false; // Failed
-}
-
-nub_ssize_t
-DNBWatchpointGetHitCount (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- return bp->GetHitCount();
- }
- }
- return 0;
-}
-
-nub_ssize_t
-DNBWatchpointGetIgnoreCount (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- return bp->GetIgnoreCount();
- }
- }
- return 0;
-}
-
-nub_bool_t
-DNBWatchpointSetIgnoreCount (nub_process_t pid, nub_watch_t watchID, nub_size_t ignore_count)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- {
- bp->SetIgnoreCount(ignore_count);
- return true;
- }
- }
- }
+ return procSP->CreateWatchpoint(addr, size, watch_flags, hardware) != NULL;
return false;
}
-// Set the callback function for a given watchpoint. The callback function will
-// get called as soon as the watchpoint is hit. The function will be called
-// with the process ID, thread ID, watchpoint ID and the baton, and can return
-//
nub_bool_t
-DNBWatchpointSetCallback (nub_process_t pid, nub_watch_t watchID, DNBCallbackBreakpointHit callback, void *baton)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- {
- bp->SetCallback(callback, baton);
- return true;
- }
- }
- }
- return false;
-}
-
-//----------------------------------------------------------------------
-// Dump the watchpoints stats for process PID for a watchpoint by ID.
-//----------------------------------------------------------------------
-void
-DNBWatchpointPrint (nub_process_t pid, nub_watch_t watchID)
+DNBWatchpointClear (nub_process_t pid, nub_addr_t addr)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- procSP->DumpWatchpoint(watchID);
+ return procSP->DisableWatchpoint(addr, true);
+ return false; // Failed
}
//----------------------------------------------------------------------
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h Tue Jul 2 16:55:02 2013
@@ -121,24 +121,14 @@ const char * DNBThreadGetInfo
//----------------------------------------------------------------------
// Breakpoint functions
//----------------------------------------------------------------------
-nub_break_t DNBBreakpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, nub_bool_t hardware) DNB_EXPORT;
-nub_bool_t DNBBreakpointClear (nub_process_t pid, nub_break_t breakID) DNB_EXPORT;
-nub_ssize_t DNBBreakpointGetHitCount (nub_process_t pid, nub_break_t breakID) DNB_EXPORT;
-nub_ssize_t DNBBreakpointGetIgnoreCount (nub_process_t pid, nub_break_t breakID) DNB_EXPORT;
-nub_bool_t DNBBreakpointSetIgnoreCount (nub_process_t pid, nub_break_t breakID, nub_size_t ignore_count) DNB_EXPORT;
-nub_bool_t DNBBreakpointSetCallback (nub_process_t pid, nub_break_t breakID, DNBCallbackBreakpointHit callback, void *baton) DNB_EXPORT;
-void DNBBreakpointPrint (nub_process_t pid, nub_break_t breakID) DNB_EXPORT;
+nub_bool_t DNBBreakpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, nub_bool_t hardware) DNB_EXPORT;
+nub_bool_t DNBBreakpointClear (nub_process_t pid, nub_addr_t addr) DNB_EXPORT;
//----------------------------------------------------------------------
// Watchpoint functions
//----------------------------------------------------------------------
-nub_watch_t DNBWatchpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, uint32_t watch_flags, nub_bool_t hardware) DNB_EXPORT;
-nub_bool_t DNBWatchpointClear (nub_process_t pid, nub_watch_t watchID) DNB_EXPORT;
-nub_ssize_t DNBWatchpointGetHitCount (nub_process_t pid, nub_watch_t watchID) DNB_EXPORT;
-nub_ssize_t DNBWatchpointGetIgnoreCount (nub_process_t pid, nub_watch_t watchID) DNB_EXPORT;
-nub_bool_t DNBWatchpointSetIgnoreCount (nub_process_t pid, nub_watch_t watchID, nub_size_t ignore_count) DNB_EXPORT;
-nub_bool_t DNBWatchpointSetCallback (nub_process_t pid, nub_watch_t watchID, DNBCallbackBreakpointHit callback, void *baton) DNB_EXPORT;
-void DNBWatchpointPrint (nub_process_t pid, nub_watch_t watchID) DNB_EXPORT;
+nub_bool_t DNBWatchpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, uint32_t watch_flags, nub_bool_t hardware) DNB_EXPORT;
+nub_bool_t DNBWatchpointClear (nub_process_t pid, nub_addr_t addr) DNB_EXPORT;
uint32_t DNBWatchpointGetNumSupportedHWP (nub_process_t pid) DNB_EXPORT;
const DNBRegisterSetInfo *
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp Tue Jul 2 16:55:02 2013
@@ -12,16 +12,17 @@
//===----------------------------------------------------------------------===//
#include "DNBBreakpoint.h"
+#include "MachProcess.h"
+#include <assert.h>
#include <algorithm>
#include <inttypes.h>
#include "DNBLog.h"
#pragma mark -- DNBBreakpoint
-DNBBreakpoint::DNBBreakpoint(nub_addr_t addr, nub_size_t byte_size, nub_thread_t tid, bool hardware) :
- m_breakID(GetNextID()),
- m_tid(tid),
- m_byte_size(byte_size),
+DNBBreakpoint::DNBBreakpoint(nub_addr_t addr, nub_size_t byte_size, bool hardware) :
+ m_retain_count (1),
+ m_byte_size (byte_size),
m_opcode(),
m_addr(addr),
m_enabled(0),
@@ -29,11 +30,7 @@ DNBBreakpoint::DNBBreakpoint(nub_addr_t
m_is_watchpoint(0),
m_watch_read(0),
m_watch_write(0),
- m_hw_index(INVALID_NUB_HW_INDEX),
- m_hit_count(0),
- m_ignore_count(0),
- m_callback(NULL),
- m_callback_baton(NULL)
+ m_hw_index(INVALID_NUB_HW_INDEX)
{
}
@@ -41,71 +38,27 @@ DNBBreakpoint::~DNBBreakpoint()
{
}
-nub_break_t
-DNBBreakpoint::GetNextID()
-{
- static uint32_t g_nextBreakID = 0;
- return ++g_nextBreakID;
-}
-
-void
-DNBBreakpoint::SetCallback(DNBCallbackBreakpointHit callback, void *callback_baton)
-{
- m_callback = callback;
- m_callback_baton = callback_baton;
-}
-
-
-// RETURNS - true if we should stop at this breakpoint, false if we
-// should continue.
-
-bool
-DNBBreakpoint::BreakpointHit(nub_process_t pid, nub_thread_t tid)
-{
- m_hit_count++;
-
- if (m_hit_count > m_ignore_count)
- {
- if (m_callback)
- return m_callback(pid, tid, GetID(), m_callback_baton);
- return true;
- }
- return false;
-}
-
void
DNBBreakpoint::Dump() const
{
if (IsBreakpoint())
{
- DNBLog ("DNBBreakpoint %u: tid = %8.8" PRIx64 " addr = 0x%llx state = %s type = %s breakpoint hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %p baton = %p",
- m_breakID,
- m_tid,
+ DNBLog ("DNBBreakpoint addr = 0x%llx state = %s type = %s breakpoint hw_index = %i",
(uint64_t)m_addr,
m_enabled ? "enabled " : "disabled",
IsHardware() ? "hardware" : "software",
- GetHardwareIndex(),
- GetHitCount(),
- GetIgnoreCount(),
- m_callback,
- m_callback_baton);
+ GetHardwareIndex());
}
else
{
- DNBLog ("DNBBreakpoint %u: tid = %8.8" PRIx64 " addr = 0x%llx size = %llu state = %s type = %s watchpoint (%s%s) hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %p baton = %p",
- m_breakID,
- m_tid,
+ DNBLog ("DNBBreakpoint addr = 0x%llx size = %llu state = %s type = %s watchpoint (%s%s) hw_index = %i",
(uint64_t)m_addr,
(uint64_t)m_byte_size,
m_enabled ? "enabled " : "disabled",
IsHardware() ? "hardware" : "software",
m_watch_read ? "r" : "",
m_watch_write ? "w" : "",
- GetHardwareIndex(),
- GetHitCount(),
- GetIgnoreCount(),
- m_callback,
- m_callback_baton);
+ GetHardwareIndex());
}
}
@@ -120,46 +73,18 @@ DNBBreakpointList::~DNBBreakpointList()
}
-nub_break_t
-DNBBreakpointList::Add(const DNBBreakpoint& bp)
-{
- m_breakpoints.push_back(bp);
- return m_breakpoints.back().GetID();
-}
-
-bool
-DNBBreakpointList::ShouldStop(nub_process_t pid, nub_thread_t tid, nub_break_t breakID)
-{
- DNBBreakpoint *bp = FindByID (breakID);
- if (bp)
- {
- // Let the breakpoint decide if it should stop here (could not have
- // reached it's target hit count yet, or it could have a callback
- // that decided it shouldn't stop (shared library loads/unloads).
- return bp->BreakpointHit(pid, tid);
- }
- // We should stop here since this breakpoint isn't valid anymore or it
- // doesn't exist.
- return true;
-}
-
-nub_break_t
-DNBBreakpointList::FindIDByAddress (nub_addr_t addr)
+DNBBreakpoint *
+DNBBreakpointList::Add(nub_addr_t addr, nub_size_t length, bool hardware)
{
- DNBBreakpoint *bp = FindByAddress (addr);
- if (bp)
- {
- DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%16.16llx ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID());
- return bp->GetID();
- }
- DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%16.16llx ) => NONE", __FUNCTION__, (uint64_t)addr);
- return INVALID_NUB_BREAK_ID;
+ m_breakpoints.insert(std::make_pair(addr, DNBBreakpoint(addr, length, hardware)));
+ iterator pos = m_breakpoints.find (addr);
+ return &pos->second;
}
bool
-DNBBreakpointList::Remove (nub_break_t breakID)
+DNBBreakpointList::Remove (nub_addr_t addr)
{
- iterator pos = GetBreakIDIterator(breakID); // Predicate
+ iterator pos = m_breakpoints.find(addr);
if (pos != m_breakpoints.end())
{
m_breakpoints.erase(pos);
@@ -168,146 +93,133 @@ DNBBreakpointList::Remove (nub_break_t b
return false;
}
-
-class BreakpointIDMatches
-{
-public:
- BreakpointIDMatches (nub_break_t breakID) : m_breakID(breakID) {}
- bool operator() (const DNBBreakpoint& bp) const
- {
- return m_breakID == bp.GetID();
- }
- private:
- const nub_break_t m_breakID;
-};
-
-class BreakpointAddressMatches
-{
-public:
- BreakpointAddressMatches (nub_addr_t addr) : m_addr(addr) {}
- bool operator() (const DNBBreakpoint& bp) const
- {
- return m_addr == bp.Address();
- }
- private:
- const nub_addr_t m_addr;
-};
-
-DNBBreakpointList::iterator
-DNBBreakpointList::GetBreakIDIterator (nub_break_t breakID)
-{
- return std::find_if(m_breakpoints.begin(), m_breakpoints.end(), // Search full range
- BreakpointIDMatches(breakID)); // Predicate
-}
-
-DNBBreakpointList::const_iterator
-DNBBreakpointList::GetBreakIDConstIterator (nub_break_t breakID) const
-{
- return std::find_if(m_breakpoints.begin(), m_breakpoints.end(), // Search full range
- BreakpointIDMatches(breakID)); // Predicate
-}
-
DNBBreakpoint *
-DNBBreakpointList::FindByID (nub_break_t breakID)
+DNBBreakpointList::FindByAddress (nub_addr_t addr)
{
- iterator pos = GetBreakIDIterator(breakID);
+ iterator pos = m_breakpoints.find(addr);
if (pos != m_breakpoints.end())
- return &(*pos);
+ return &pos->second;
return NULL;
}
const DNBBreakpoint *
-DNBBreakpointList::FindByID (nub_break_t breakID) const
+DNBBreakpointList::FindByAddress (nub_addr_t addr) const
{
- const_iterator pos = GetBreakIDConstIterator(breakID);
+ const_iterator pos = m_breakpoints.find(addr);
if (pos != m_breakpoints.end())
- return &(*pos);
-
+ return &pos->second;
+
return NULL;
}
-DNBBreakpoint *
-DNBBreakpointList::FindByAddress (nub_addr_t addr)
+// Finds the next breakpoint at an address greater than or equal to "addr"
+size_t
+DNBBreakpointList::FindBreakpointsThatOverlapRange (nub_addr_t addr,
+ nub_addr_t size,
+ std::vector<DNBBreakpoint *> &bps)
{
+ bps.clear();
iterator end = m_breakpoints.end();
- iterator pos = std::find_if(m_breakpoints.begin(), end, // Search full range
- BreakpointAddressMatches(addr)); // Predicate
- if (pos != end)
- return &(*pos);
-
- return NULL;
-}
-
-const DNBBreakpoint *
-DNBBreakpointList::FindByAddress (nub_addr_t addr) const
-{
- const_iterator end = m_breakpoints.end();
- const_iterator pos = std::find_if(m_breakpoints.begin(), end, // Search full range
- BreakpointAddressMatches(addr)); // Predicate
+ // Find the first breakpoint with an address >= to "addr"
+ iterator pos = m_breakpoints.lower_bound(addr);
if (pos != end)
- return &(*pos);
-
- return NULL;
-}
-
-bool
-DNBBreakpointList::SetCallback(nub_break_t breakID, DNBCallbackBreakpointHit callback, void *callback_baton)
-{
- DNBBreakpoint *bp = FindByID (breakID);
- if (bp)
{
- bp->SetCallback(callback, callback_baton);
- return true;
+ if (pos != m_breakpoints.begin())
+ {
+ // Watch out for a breakpoint at an address less than "addr" that might still overlap
+ iterator prev_pos = pos;
+ --prev_pos;
+ if (prev_pos->second.IntersectsRange (addr, size, NULL, NULL, NULL))
+ bps.push_back (&pos->second);
+
+ }
+
+ while (pos != end)
+ {
+ // When we hit a breakpoint whose start address is greater than "addr + size" we are done.
+ // Do the math in a way that doesn't risk unsigned overflow with bad input.
+ if ((pos->second.Address() - addr) >= size)
+ break;
+
+ // Check if this breakpoint overlaps, and if it does, add it to the list
+ if (pos->second.IntersectsRange (addr, size, NULL, NULL, NULL))
+ {
+ bps.push_back (&pos->second);
+ ++pos;
+ }
+ }
}
- return false;
+ return bps.size();
}
-
void
DNBBreakpointList::Dump() const
{
const_iterator pos;
const_iterator end = m_breakpoints.end();
for (pos = m_breakpoints.begin(); pos != end; ++pos)
- (*pos).Dump();
+ pos->second.Dump();
}
+void
+DNBBreakpointList::DisableAll ()
+{
+ iterator pos, end = m_breakpoints.end();
+ for (pos = m_breakpoints.begin(); pos != end; ++pos)
+ pos->second.SetEnabled(false);
+}
-DNBBreakpoint *
-DNBBreakpointList::GetByIndex (uint32_t i)
+
+void
+DNBBreakpointList::RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, void *p) const
{
- iterator end = m_breakpoints.end();
- iterator pos;
- uint32_t curr_i = 0;
- for (pos = m_breakpoints.begin(), curr_i = 0; pos != end; ++pos, ++curr_i)
+ uint8_t *buf = (uint8_t *)p;
+ const_iterator end = m_breakpoints.end();
+ const_iterator pos = m_breakpoints.lower_bound(addr);
+ while (pos != end && (pos->first < (addr + size)))
{
- if (curr_i == i)
- return &(*pos);
+ nub_addr_t intersect_addr;
+ nub_size_t intersect_size;
+ nub_size_t opcode_offset;
+ const DNBBreakpoint &bp = pos->second;
+ if (bp.IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset))
+ {
+ assert(addr <= intersect_addr && intersect_addr < addr + size);
+ assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
+ assert(opcode_offset + intersect_size <= bp.ByteSize());
+ nub_size_t buf_offset = intersect_addr - addr;
+ ::memcpy(buf + buf_offset, bp.SavedOpcodeBytes() + opcode_offset, intersect_size);
+ }
+ ++pos;
}
- return NULL;
}
void
-DNBBreakpointList::DisableAll ()
+DNBBreakpointList::DisableAllBreakpoints(MachProcess *process)
{
iterator pos, end = m_breakpoints.end();
for (pos = m_breakpoints.begin(); pos != end; ++pos)
- (*pos).SetEnabled(false);
+ process->DisableBreakpoint(pos->second.Address(), false);
}
+void
+DNBBreakpointList::DisableAllWatchpoints(MachProcess *process)
+{
+ iterator pos, end = m_breakpoints.end();
+ for (pos = m_breakpoints.begin(); pos != end; ++pos)
+ process->DisableWatchpoint(pos->second.Address(), false);
+}
-const DNBBreakpoint *
-DNBBreakpointList::GetByIndex (uint32_t i) const
+void
+DNBBreakpointList::RemoveDisabled()
{
- const_iterator end = m_breakpoints.end();
- const_iterator pos;
- uint32_t curr_i = 0;
- for (pos = m_breakpoints.begin(), curr_i = 0; pos != end; ++pos, ++curr_i)
+ iterator pos = m_breakpoints.begin();
+ while (pos != m_breakpoints.end())
{
- if (curr_i == i)
- return &(*pos);
+ if (!pos->second.IsEnabled())
+ pos = m_breakpoints.erase(pos);
+ else
+ ++pos;
}
- return NULL;
}
-
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h Tue Jul 2 16:55:02 2013
@@ -14,25 +14,33 @@
#ifndef __DNBBreakpoint_h__
#define __DNBBreakpoint_h__
-#include <list>
+#include <mach/mach.h>
+
+#include <map>
+#include <vector>
#include "DNBDefs.h"
+class MachProcess;
+
class DNBBreakpoint
{
public:
- DNBBreakpoint(nub_addr_t m_addr, nub_size_t byte_size, nub_thread_t tid, bool hardware);
+ DNBBreakpoint(nub_addr_t m_addr, nub_size_t byte_size, bool hardware);
~DNBBreakpoint();
- nub_break_t GetID() const { return m_breakID; }
nub_size_t ByteSize() const { return m_byte_size; }
uint8_t * SavedOpcodeBytes() { return &m_opcode[0]; }
const uint8_t *
SavedOpcodeBytes() const { return &m_opcode[0]; }
nub_addr_t Address() const { return m_addr; }
- nub_thread_t ThreadID() const { return m_tid; }
+// nub_thread_t ThreadID() const { return m_tid; }
bool IsEnabled() const { return m_enabled; }
- bool IntersectsRange(nub_addr_t addr, nub_size_t size, nub_addr_t *intersect_addr, nub_size_t *intersect_size, nub_size_t *opcode_offset) const
+ bool IntersectsRange(nub_addr_t addr,
+ nub_size_t size,
+ nub_addr_t *intersect_addr,
+ nub_size_t *intersect_size,
+ nub_size_t *opcode_offset) const
{
// We only use software traps for software breakpoints
if (IsBreakpoint() && IsEnabled() && !IsHardware())
@@ -93,19 +101,21 @@ public:
bool IsHardware() const { return m_hw_index != INVALID_NUB_HW_INDEX; }
uint32_t GetHardwareIndex() const { return m_hw_index; }
void SetHardwareIndex(uint32_t hw_index) { m_hw_index = hw_index; }
-// StateType GetState() const { return m_state; }
-// void SetState(StateType newState) { m_state = newState; }
- int32_t GetHitCount() const { return m_hit_count; }
- int32_t GetIgnoreCount() const { return m_ignore_count; }
- void SetIgnoreCount(int32_t n) { m_ignore_count = n; }
- bool BreakpointHit(nub_process_t pid, nub_thread_t tid);
- void SetCallback(DNBCallbackBreakpointHit callback, void *callback_baton);
void Dump() const;
+ uint32_t Retain ()
+ {
+ return ++m_retain_count;
+ }
+ uint32_t Release ()
+ {
+ if (m_retain_count == 0)
+ return 0;
+ return --m_retain_count;
+ }
private:
- nub_break_t m_breakID; // The unique identifier for this breakpoint
- nub_thread_t m_tid; // Thread ID for the breakpoint (can be INVALID_NUB_THREAD for all threads)
- nub_size_t m_byte_size; // Length in bytes of the breakpoint if set in memory
+ uint32_t m_retain_count; // Each breakpoint is maintained by address and is ref counted in case multiple people set a breakpoint at the same address
+ uint32_t m_byte_size; // Length in bytes of the breakpoint if set in memory
uint8_t m_opcode[8]; // Saved opcode bytes
nub_addr_t m_addr; // Address of this breakpoint
uint32_t m_enabled:1, // Flags for this breakpoint
@@ -114,14 +124,6 @@ private:
m_watch_read:1, // 1 if we stop when the watched data is read from
m_watch_write:1; // 1 if we stop when the watched data is written to
uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint
- int32_t m_hit_count; // Number of times this breakpoint has been hit
- int32_t m_ignore_count; // Number of times to ignore this breakpoint
- DNBCallbackBreakpointHit
- m_callback; // Callback to call when this breakpoint gets hit
- void * m_callback_baton; // Callback user data to pass to callback
-
- static nub_break_t GetNextID();
-
};
@@ -131,28 +133,31 @@ public:
DNBBreakpointList();
~DNBBreakpointList();
- nub_break_t Add (const DNBBreakpoint& bp);
- nub_break_t FindIDByAddress (nub_addr_t addr);
- bool ShouldStop (nub_process_t pid, nub_thread_t tid, nub_break_t breakID);
- bool Remove (nub_break_t breakID);
- bool SetCallback (nub_break_t breakID, DNBCallbackBreakpointHit callback, void *callback_baton);
+ DNBBreakpoint * Add (nub_addr_t addr, nub_size_t length, bool hardware);
+ bool Remove (nub_addr_t addr);
DNBBreakpoint * FindByAddress (nub_addr_t addr);
const DNBBreakpoint * FindByAddress (nub_addr_t addr) const;
- DNBBreakpoint * FindByID (nub_break_t breakID);
- const DNBBreakpoint * FindByID (nub_break_t breakID) const;
+
+ size_t FindBreakpointsThatOverlapRange (nub_addr_t addr,
+ nub_addr_t size,
+ std::vector<DNBBreakpoint *> &bps);
+
void Dump () const;
size_t Size() const { return m_breakpoints.size(); }
- DNBBreakpoint * GetByIndex (uint32_t i);
- const DNBBreakpoint * GetByIndex (uint32_t i) const;
void DisableAll ();
+ void RemoveTrapsFromBuffer (nub_addr_t addr,
+ nub_size_t size,
+ void *buf) const;
+
+ void DisableAllBreakpoints (MachProcess *process);
+ void DisableAllWatchpoints(MachProcess *process);
+ void RemoveDisabled ();
protected:
- typedef std::list<DNBBreakpoint> collection;
+ typedef std::map<nub_addr_t, DNBBreakpoint> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
- iterator GetBreakIDIterator(nub_break_t breakID);
- const_iterator GetBreakIDConstIterator(nub_break_t breakID) const;
collection m_breakpoints;
};
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h Tue Jul 2 16:55:02 2013
@@ -55,15 +55,12 @@ typedef uint64_t nub_addr_t;
typedef size_t nub_size_t;
typedef ssize_t nub_ssize_t;
-typedef uint32_t nub_break_t;
-typedef uint32_t nub_watch_t;
typedef uint32_t nub_index_t;
typedef pid_t nub_process_t;
typedef uint64_t nub_thread_t;
typedef uint32_t nub_event_t;
typedef uint32_t nub_bool_t;
-#define INVALID_NUB_BREAK_ID ((nub_break_t)0)
#define INVALID_NUB_PROCESS ((nub_process_t)0)
#define INVALID_NUB_THREAD ((nub_thread_t)0)
#define INVALID_NUB_WATCH_ID ((nub_watch_t)0)
@@ -71,9 +68,6 @@ typedef uint32_t nub_bool_t;
#define INVALID_NUB_REGNUM UINT32_MAX
#define NUB_GENERIC_ERROR UINT32_MAX
-#define NUB_BREAK_ID_IS_VALID(breakID) ((breakID) != (INVALID_NUB_BREAK_ID))
-#define NUB_WATCH_ID_IS_VALID(watchID) ((watchID) != (INVALID_NUB_WATCH_ID))
-
// Watchpoint types
#define WATCH_TYPE_READ (1u << 0)
#define WATCH_TYPE_WRITE (1u << 1)
@@ -361,7 +355,6 @@ enum DNBProfileDataScanType
eProfileAll = 0xffffffff
};
-typedef nub_bool_t (*DNBCallbackBreakpointHit)(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
typedef nub_addr_t (*DNBCallbackNameToAddress)(nub_process_t pid, const char *name, const char *shlib_regex, void *baton);
typedef nub_size_t (*DNBCallbackCopyExecutableImageInfos)(nub_process_t pid, struct DNBExecutableImageInfo **image_infos, nub_bool_t only_changed, void *baton);
typedef void (*DNBCallbackLog)(void *baton, uint32_t flags, const char *format, va_list args);
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp Tue Jul 2 16:55:02 2013
@@ -268,23 +268,27 @@ MachProcess::SetState(nub_state_t new_st
PTHREAD_MUTEX_LOCKER(locker, m_state_mutex);
const nub_state_t old_state = m_state;
- if (old_state != new_state)
+ if (old_state == eStateExited)
+ {
+ DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState(%s) ignoring new state since current state is exited", DNBStateAsString(new_state));
+ }
+ else if (old_state == new_state)
+ {
+ DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState(%s) ignoring redundant state change...", DNBStateAsString(new_state));
+ }
+ else
{
if (NUB_STATE_IS_STOPPED(new_state))
event_mask = eEventProcessStoppedStateChanged;
else
event_mask = eEventProcessRunningStateChanged;
- DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState ( old = %s, new = %s ) updating state, event_mask = 0x%8.8x", DNBStateAsString(old_state), DNBStateAsString(new_state), event_mask);
+ DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState(%s) upating state (previous state was %s), event_mask = 0x%8.8x", DNBStateAsString(new_state), DNBStateAsString(old_state), event_mask);
m_state = new_state;
if (new_state == eStateStopped)
m_stop_count++;
}
- else
- {
- DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState ( old = %s, new = %s ) ignoring state...", DNBStateAsString(old_state), DNBStateAsString(new_state));
- }
}
if (event_mask != 0)
@@ -557,29 +561,6 @@ MachProcess::Detach()
return true;
}
-nub_size_t
-MachProcess::RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, uint8_t *buf) const
-{
- nub_size_t bytes_removed = 0;
- const DNBBreakpoint *bp;
- nub_addr_t intersect_addr;
- nub_size_t intersect_size;
- nub_size_t opcode_offset;
- nub_size_t idx;
- for (idx = 0; (bp = m_breakpoints.GetByIndex(idx)) != NULL; ++idx)
- {
- if (bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset))
- {
- assert(addr <= intersect_addr && intersect_addr < addr + size);
- assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
- assert(opcode_offset + intersect_size <= bp->ByteSize());
- nub_size_t buf_offset = intersect_addr - addr;
- ::memcpy(buf + buf_offset, bp->SavedOpcodeBytes() + opcode_offset, intersect_size);
- }
- }
- return bytes_removed;
-}
-
//----------------------------------------------------------------------
// ReadMemory from the MachProcess level will always remove any software
// breakpoints from the memory buffer before returning. If you wish to
@@ -599,7 +580,7 @@ MachProcess::ReadMemory (nub_addr_t addr
// Then place any opcodes that fall into this range back into the buffer
// before we return this to callers.
if (bytes_read > 0)
- RemoveTrapsFromBuffer (addr, size, (uint8_t *)buf);
+ m_breakpoints.RemoveTrapsFromBuffer (addr, bytes_read, buf);
return bytes_read;
}
@@ -619,38 +600,28 @@ MachProcess::WriteMemory (nub_addr_t add
// (enabled software breakpoints) any software traps (breakpoints) that we
// may have placed in our tasks memory.
- std::map<nub_addr_t, DNBBreakpoint *> addr_to_bp_map;
- DNBBreakpoint *bp;
- nub_size_t idx;
- for (idx = 0; (bp = m_breakpoints.GetByIndex(idx)) != NULL; ++idx)
- {
- if (bp->IntersectsRange(addr, size, NULL, NULL, NULL))
- addr_to_bp_map[bp->Address()] = bp;
- }
-
- // If we don't have any software breakpoints that are in this buffer, then
- // we can just write memory and be done with it.
- if (addr_to_bp_map.empty())
+ std::vector<DNBBreakpoint *> bps;
+
+ const size_t num_bps = m_breakpoints.FindBreakpointsThatOverlapRange(addr, size, bps);
+ if (num_bps == 0)
return m_task.WriteMemory(addr, size, buf);
- // If we make it here, we have some breakpoints that overlap and we need
- // to work around them.
-
nub_size_t bytes_written = 0;
nub_addr_t intersect_addr;
nub_size_t intersect_size;
nub_size_t opcode_offset;
const uint8_t *ubuf = (const uint8_t *)buf;
- std::map<nub_addr_t, DNBBreakpoint *>::iterator pos, end = addr_to_bp_map.end();
- for (pos = addr_to_bp_map.begin(); pos != end; ++pos)
+
+ for (size_t i=0; i<num_bps; ++i)
{
- bp = pos->second;
+ DNBBreakpoint *bp = bps[i];
- assert(bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset));
+ const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
+ assert(intersects);
assert(addr <= intersect_addr && intersect_addr < addr + size);
assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
assert(opcode_offset + intersect_size <= bp->ByteSize());
-
+
// Check for bytes before this breakpoint
const nub_addr_t curr_addr = addr + bytes_written;
if (intersect_addr > curr_addr)
@@ -668,17 +639,17 @@ MachProcess::WriteMemory (nub_addr_t add
break;
}
}
-
+
// Now write any bytes that would cover up any software breakpoints
// directly into the breakpoint opcode buffer
::memcpy(bp->SavedOpcodeBytes() + opcode_offset, ubuf + bytes_written, intersect_size);
bytes_written += intersect_size;
}
-
+
// Write any remaining bytes after the last breakpoint if we have any left
if (bytes_written < size)
bytes_written += m_task.WriteMemory(addr + bytes_written, size - bytes_written, ubuf + bytes_written);
-
+
return bytes_written;
}
@@ -743,110 +714,105 @@ MachProcess::PrivateResume ()
m_task.Resume();
}
-nub_break_t
-MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length, bool hardware, thread_t tid)
+DNBBreakpoint *
+MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length, bool hardware)
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, hardware, tid);
- if (hardware && tid == INVALID_NUB_THREAD)
- tid = GetCurrentThread();
-
- DNBBreakpoint bp(addr, length, tid, hardware);
- nub_break_t breakID = m_breakpoints.Add(bp);
- if (EnableBreakpoint(breakID))
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, hardware = %i)", (uint64_t)addr, (uint64_t)length, hardware);
+
+ DNBBreakpoint *bp = m_breakpoints.FindByAddress(addr);
+ if (bp)
+ bp->Retain();
+ else
+ bp = m_breakpoints.Add(addr, length, hardware);
+
+ if (EnableBreakpoint(addr))
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%4.4x ) => %u", (uint64_t)addr, (uint64_t)length, tid, breakID);
- return breakID;
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu) => %p", (uint64_t)addr, (uint64_t)length, bp);
+ return bp;
}
- else
+ else if (bp->Release() == 0)
{
- m_breakpoints.Remove(breakID);
+ m_breakpoints.Remove(addr);
}
// We failed to enable the breakpoint
- return INVALID_NUB_BREAK_ID;
+ return NULL;
}
-nub_watch_t
-MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length, uint32_t watch_flags, bool hardware, thread_t tid)
+DNBBreakpoint *
+MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length, uint32_t watch_flags, bool hardware)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, watch_flags, hardware, tid);
- if (hardware && tid == INVALID_NUB_THREAD)
- tid = GetCurrentThread();
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, flags = 0x%8.8x, hardware = %i)", (uint64_t)addr, (uint64_t)length, watch_flags, hardware);
- DNBBreakpoint watch(addr, length, tid, hardware);
- watch.SetIsWatchpoint(watch_flags);
+ DNBBreakpoint *wp = m_watchpoints.FindByAddress(addr);
+ // since the Z packets only send an address, we can only have one watchpoint at
+ // an address. If there is already one, we must refuse to create another watchpoint
+ if (wp)
+ return NULL;
+
+ wp = m_watchpoints.Add(addr, length, hardware);
+ wp->SetIsWatchpoint(watch_flags);
- nub_watch_t watchID = m_watchpoints.Add(watch);
- if (EnableWatchpoint(watchID))
+ if (EnableWatchpoint(addr))
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => %u", (uint64_t)addr, (uint64_t)length, tid, watchID);
- return watchID;
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu) => %p", (uint64_t)addr, (uint64_t)length, wp);
+ return wp;
}
else
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, (uint64_t)length, tid, watchID);
- m_watchpoints.Remove(watchID);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu) => FAILED", (uint64_t)addr, (uint64_t)length);
+ m_watchpoints.Remove(addr);
}
// We failed to enable the watchpoint
- return INVALID_NUB_BREAK_ID;
+ return NULL;
}
-nub_size_t
-MachProcess::DisableAllBreakpoints(bool remove)
+void
+MachProcess::DisableAllBreakpoints (bool remove)
{
DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::%s (remove = %d )", __FUNCTION__, remove);
- DNBBreakpoint *bp;
- nub_size_t disabled_count = 0;
- nub_size_t idx = 0;
- while ((bp = m_breakpoints.GetByIndex(idx)) != NULL)
- {
- bool success = DisableBreakpoint(bp->GetID(), remove);
-
- if (success)
- disabled_count++;
- // If we failed to disable the breakpoint or we aren't removing the breakpoint
- // increment the breakpoint index. Otherwise DisableBreakpoint will have removed
- // the breakpoint at this index and we don't need to change it.
- if ((success == false) || (remove == false))
- idx++;
- }
- return disabled_count;
+
+ m_breakpoints.DisableAllBreakpoints (this);
+
+ if (remove)
+ m_breakpoints.RemoveDisabled();
}
-nub_size_t
+void
MachProcess::DisableAllWatchpoints(bool remove)
{
DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::%s (remove = %d )", __FUNCTION__, remove);
- DNBBreakpoint *wp;
- nub_size_t disabled_count = 0;
- nub_size_t idx = 0;
- while ((wp = m_watchpoints.GetByIndex(idx)) != NULL)
- {
- bool success = DisableWatchpoint(wp->GetID(), remove);
-
- if (success)
- disabled_count++;
- // If we failed to disable the watchpoint or we aren't removing the watchpoint
- // increment the watchpoint index. Otherwise DisableWatchpoint will have removed
- // the watchpoint at this index and we don't need to change it.
- if ((success == false) || (remove == false))
- idx++;
- }
- return disabled_count;
+
+ m_watchpoints.DisableAllWatchpoints(this);
+
+ if (remove)
+ m_watchpoints.RemoveDisabled();
}
bool
-MachProcess::DisableBreakpoint(nub_break_t breakID, bool remove)
+MachProcess::DisableBreakpoint(nub_addr_t addr, bool remove)
{
- DNBBreakpoint *bp = m_breakpoints.FindByID (breakID);
+ DNBBreakpoint *bp = m_breakpoints.FindByAddress(addr);
if (bp)
{
// After "exec" we might end up with a bunch of breakpoints that were disabled
// manually, just ignore them
if (!bp->IsEnabled())
+ {
+ // Breakpoint might have been disabled by an exec
+ if (remove && bp->Release() == 0)
+ {
+ m_thread_list.NotifyBreakpointChanged(bp);
+ m_breakpoints.Remove(addr);
+ }
+ return true;
+ }
+
+ // We have multiple references to this breakpoint, decrement the ref count
+ // and if it isn't zero, then return true;
+ if (remove && bp->Release() > 0)
return true;
- nub_addr_t addr = bp->Address();
- DNBLogThreadedIf(LOG_BREAKPOINTS | LOG_VERBOSE, "MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx", breakID, remove, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS | LOG_VERBOSE, "MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d )", (uint64_t)addr, remove);
if (bp->IsHardware())
{
@@ -859,9 +825,9 @@ MachProcess::DisableBreakpoint(nub_break
if (remove)
{
m_thread_list.NotifyBreakpointChanged(bp);
- m_breakpoints.Remove(breakID);
+ m_breakpoints.Remove(addr);
}
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx (hardware) => success", breakID, remove, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) (hardware) => success", (uint64_t)addr, remove);
return true;
}
@@ -895,19 +861,19 @@ MachProcess::DisableBreakpoint(nub_break
}
else
{
- DNBLogError("MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx memory write failed when restoring original opcode", breakID, remove, (uint64_t)addr);
+ DNBLogError("MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) memory write failed when restoring original opcode", addr, remove);
}
}
else
{
- DNBLogWarning("MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx expected a breakpoint opcode but didn't find one.", breakID, remove, (uint64_t)addr);
+ DNBLogWarning("MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) expected a breakpoint opcode but didn't find one.", addr, remove);
// Set verify to true and so we can check if the original opcode has already been restored
verify = true;
}
}
else
{
- DNBLogThreadedIf(LOG_BREAKPOINTS | LOG_VERBOSE, "MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx is not enabled", breakID, remove, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS | LOG_VERBOSE, "MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) is not enabled", addr, remove);
// Set verify to true and so we can check if the original opcode is there
verify = true;
}
@@ -924,20 +890,20 @@ MachProcess::DisableBreakpoint(nub_break
// SUCCESS
bp->SetEnabled(false);
// Let the thread list know that a breakpoint has been modified
- if (remove)
+ if (remove && bp->Release() == 0)
{
m_thread_list.NotifyBreakpointChanged(bp);
- m_breakpoints.Remove(breakID);
+ m_breakpoints.Remove(addr);
}
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx => success", breakID, remove, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) => success", (uint64_t)addr, remove);
return true;
}
else
{
if (break_op_found)
- DNBLogError("MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx: failed to restore original opcode", breakID, remove, (uint64_t)addr);
+ DNBLogError("MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) : failed to restore original opcode", (uint64_t)addr, remove);
else
- DNBLogError("MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx: opcode changed", breakID, remove, (uint64_t)addr);
+ DNBLogError("MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) : opcode changed", (uint64_t)addr, remove);
}
}
else
@@ -954,20 +920,24 @@ MachProcess::DisableBreakpoint(nub_break
}
else
{
- DNBLogError("MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) invalid breakpoint ID", breakID, remove);
+ DNBLogError("MachProcess::DisableBreakpoint ( addr = 0x%8.8llx, remove = %d ) invalid breakpoint address", (uint64_t)addr, remove);
}
return false;
}
bool
-MachProcess::DisableWatchpoint(nub_watch_t watchID, bool remove)
+MachProcess::DisableWatchpoint(nub_addr_t addr, bool remove)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::%s(watchID = %d, remove = %d)", __FUNCTION__, watchID, remove);
- DNBBreakpoint *wp = m_watchpoints.FindByID (watchID);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::%s(addr = 0x%8.8llx, remove = %d)", __FUNCTION__, (uint64_t)addr, remove);
+ DNBBreakpoint *wp = m_watchpoints.FindByAddress(addr);
if (wp)
{
+ // If we have multiple references to a watchpoint, removing the watchpoint shouldn't clear it
+ if (remove && wp->Release() > 0)
+ return true;
+
nub_addr_t addr = wp->Address();
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::DisableWatchpoint ( watchID = %d, remove = %d ) addr = 0x%8.8llx", watchID, remove, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::DisableWatchpoint ( addr = 0x%8.8llx, remove = %d )", (uint64_t)addr, remove);
if (wp->IsHardware())
{
@@ -977,8 +947,8 @@ MachProcess::DisableWatchpoint(nub_watch
{
wp->SetEnabled(false);
if (remove)
- m_watchpoints.Remove(watchID);
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::Disablewatchpoint ( watchID = %d, remove = %d ) addr = 0x%8.8llx (hardware) => success", watchID, remove, (uint64_t)addr);
+ m_watchpoints.Remove(addr);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::Disablewatchpoint ( addr = 0x%8.8llx, remove = %d ) (hardware) => success", (uint64_t)addr, remove);
return true;
}
}
@@ -987,50 +957,12 @@ MachProcess::DisableWatchpoint(nub_watch
}
else
{
- DNBLogError("MachProcess::DisableWatchpoint ( watchID = %d, remove = %d ) invalid watchpoint ID", watchID, remove);
+ DNBLogError("MachProcess::DisableWatchpoint ( addr = 0x%8.8llx, remove = %d ) invalid watchpoint ID", (uint64_t)addr, remove);
}
return false;
}
-void
-MachProcess::DumpBreakpoint(nub_break_t breakID) const
-{
- DNBLogThreaded("MachProcess::DumpBreakpoint(breakID = %d)", breakID);
-
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- const DNBBreakpoint *bp = m_breakpoints.FindByID(breakID);
- if (bp)
- bp->Dump();
- else
- DNBLog("MachProcess::DumpBreakpoint(breakID = %d): invalid breakID", breakID);
- }
- else
- {
- m_breakpoints.Dump();
- }
-}
-
-void
-MachProcess::DumpWatchpoint(nub_watch_t watchID) const
-{
- DNBLogThreaded("MachProcess::DumpWatchpoint(watchID = %d)", watchID);
-
- if (NUB_BREAK_ID_IS_VALID(watchID))
- {
- const DNBBreakpoint *wp = m_watchpoints.FindByID(watchID);
- if (wp)
- wp->Dump();
- else
- DNBLog("MachProcess::DumpWatchpoint(watchID = %d): invalid watchID", watchID);
- }
- else
- {
- m_watchpoints.Dump();
- }
-}
-
uint32_t
MachProcess::GetNumSupportedHardwareWatchpoints () const
{
@@ -1038,16 +970,15 @@ MachProcess::GetNumSupportedHardwareWatc
}
bool
-MachProcess::EnableBreakpoint(nub_break_t breakID)
+MachProcess::EnableBreakpoint(nub_addr_t addr)
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::EnableBreakpoint ( breakID = %d )", breakID);
- DNBBreakpoint *bp = m_breakpoints.FindByID (breakID);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::EnableBreakpoint ( addr = 0x%8.8llx )", (uint64_t)addr);
+ DNBBreakpoint *bp = m_breakpoints.FindByAddress(addr);
if (bp)
{
- nub_addr_t addr = bp->Address();
if (bp->IsEnabled())
{
- DNBLogWarning("MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: breakpoint already enabled.", breakID, (uint64_t)addr);
+ DNBLogWarning("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ): breakpoint already enabled.", (uint64_t)addr);
return true;
}
else
@@ -1081,32 +1012,32 @@ MachProcess::EnableBreakpoint(nub_break_
bp->SetEnabled(true);
// Let the thread list know that a breakpoint has been modified
m_thread_list.NotifyBreakpointChanged(bp);
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: SUCCESS.", breakID, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ) : SUCCESS.", (uint64_t)addr);
return true;
}
else
{
- DNBLogError("MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: breakpoint opcode verification failed.", breakID, (uint64_t)addr);
+ DNBLogError("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ): breakpoint opcode verification failed.", (uint64_t)addr);
}
}
else
{
- DNBLogError("MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: unable to read memory to verify breakpoint opcode.", breakID, (uint64_t)addr);
+ DNBLogError("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ): unable to read memory to verify breakpoint opcode.", (uint64_t)addr);
}
}
else
{
- DNBLogError("MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: unable to write breakpoint opcode to memory.", breakID, (uint64_t)addr);
+ DNBLogError("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ): unable to write breakpoint opcode to memory.", (uint64_t)addr);
}
}
else
{
- DNBLogError("MachProcess::EnableBreakpoint ( breakID = %d ) addr = 0x%8.8llx: unable to read memory at breakpoint address.", breakID, (uint64_t)addr);
+ DNBLogError("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ): unable to read memory at breakpoint address.", (uint64_t)addr);
}
}
else
{
- DNBLogError("MachProcess::EnableBreakpoint ( breakID = %d ) no software breakpoint opcode for current architecture.", breakID);
+ DNBLogError("MachProcess::EnableBreakpoint ( addr = 0x%8.8llx ) no software breakpoint opcode for current architecture.", (uint64_t)addr);
}
}
}
@@ -1114,16 +1045,16 @@ MachProcess::EnableBreakpoint(nub_break_
}
bool
-MachProcess::EnableWatchpoint(nub_watch_t watchID)
+MachProcess::EnableWatchpoint(nub_addr_t addr)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::EnableWatchpoint(watchID = %d)", watchID);
- DNBBreakpoint *wp = m_watchpoints.FindByID (watchID);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::EnableWatchpoint(addr = 0x%8.8llx)", (uint64_t)addr);
+ DNBBreakpoint *wp = m_watchpoints.FindByAddress(addr);
if (wp)
{
nub_addr_t addr = wp->Address();
if (wp->IsEnabled())
{
- DNBLogWarning("MachProcess::EnableWatchpoint(watchID = %d) addr = 0x%8.8llx: watchpoint already enabled.", watchID, (uint64_t)addr);
+ DNBLogWarning("MachProcess::EnableWatchpoint(addr = 0x%8.8llx): watchpoint already enabled.", (uint64_t)addr);
return true;
}
else
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h Tue Jul 2 16:55:02 2013
@@ -114,22 +114,20 @@ public:
//----------------------------------------------------------------------
// Breakpoint functions
//----------------------------------------------------------------------
- nub_break_t CreateBreakpoint (nub_addr_t addr, nub_size_t length, bool hardware, thread_t thread);
- bool DisableBreakpoint (nub_break_t breakID, bool remove);
- nub_size_t DisableAllBreakpoints (bool remove);
- bool EnableBreakpoint (nub_break_t breakID);
- void DumpBreakpoint(nub_break_t breakID) const;
+ DNBBreakpoint * CreateBreakpoint (nub_addr_t addr, nub_size_t length, bool hardware);
+ bool DisableBreakpoint (nub_addr_t addr, bool remove);
+ void DisableAllBreakpoints (bool remove);
+ bool EnableBreakpoint (nub_addr_t addr);
DNBBreakpointList& Breakpoints() { return m_breakpoints; }
const DNBBreakpointList& Breakpoints() const { return m_breakpoints; }
//----------------------------------------------------------------------
// Watchpoint functions
//----------------------------------------------------------------------
- nub_watch_t CreateWatchpoint (nub_addr_t addr, nub_size_t length, uint32_t watch_type, bool hardware, thread_t thread);
- bool DisableWatchpoint (nub_watch_t watchID, bool remove);
- nub_size_t DisableAllWatchpoints (bool remove);
- bool EnableWatchpoint (nub_watch_t watchID);
- void DumpWatchpoint(nub_watch_t watchID) const;
+ DNBBreakpoint * CreateWatchpoint (nub_addr_t addr, nub_size_t length, uint32_t watch_type, bool hardware);
+ bool DisableWatchpoint (nub_addr_t addr, bool remove);
+ void DisableAllWatchpoints (bool remove);
+ bool EnableWatchpoint (nub_addr_t addr);
uint32_t GetNumSupportedHardwareWatchpoints () const;
DNBBreakpointList& Watchpoints() { return m_watchpoints; }
const DNBBreakpointList& Watchpoints() const { return m_watchpoints; }
@@ -263,7 +261,6 @@ private:
void Clear ();
void ReplyToAllExceptions ();
void PrivateResume ();
- nub_size_t RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, uint8_t *buf) const;
uint32_t Flags () const { return m_flags; }
nub_state_t DoSIGSTOP (bool clear_bps_and_wps, bool allow_running, uint32_t *thread_idx_ptr);
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp Tue Jul 2 16:55:02 2013
@@ -31,7 +31,6 @@ MachThread::MachThread (MachProcess *pro
m_seq_id (GetSequenceID()),
m_state (eStateUnloaded),
m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
- m_break_id (INVALID_NUB_BREAK_ID),
m_suspend_count (0),
m_stop_exception (),
m_arch_ap (DNBArchProtocol::Create (this)),
@@ -361,13 +360,12 @@ MachThread::Dump(uint32_t index)
default: thread_run_state = "???"; break;
}
- DNBLogThreaded("[%3u] #%3u tid: 0x%8.8" PRIx64 ", pc: 0x%16.16" PRIx64 ", sp: 0x%16.16" PRIx64 ", breakID: %3d, user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
+ DNBLogThreaded("[%3u] #%3u tid: 0x%8.8" PRIx64 ", pc: 0x%16.16" PRIx64 ", sp: 0x%16.16" PRIx64 ", user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
index,
m_seq_id,
m_unique_id,
GetPC(INVALID_NUB_ADDRESS),
GetSP(INVALID_NUB_ADDRESS),
- m_break_id,
m_basic_info.user_time.seconds, m_basic_info.user_time.microseconds,
m_basic_info.system_time.seconds, m_basic_info.system_time.microseconds,
m_basic_info.cpu_usage,
@@ -406,35 +404,23 @@ MachThread::ThreadWillResume(const DNBTh
m_stop_exception.Clear();
}
-nub_break_t
+DNBBreakpoint *
MachThread::CurrentBreakpoint()
{
- return m_process->Breakpoints().FindIDByAddress(GetPC());
+ return m_process->Breakpoints().FindByAddress(GetPC());
}
bool
MachThread::ShouldStop(bool &step_more)
{
// See if this thread is at a breakpoint?
- nub_break_t breakID = CurrentBreakpoint();
+ DNBBreakpoint *bp = CurrentBreakpoint();
- if (NUB_BREAK_ID_IS_VALID(breakID))
+ if (bp)
{
// This thread is sitting at a breakpoint, ask the breakpoint
// if we should be stopping here.
- if (Process()->Breakpoints().ShouldStop(ProcessID(), ThreadID(), breakID))
- return true;
- else
- {
- // The breakpoint said we shouldn't stop, but we may have gotten
- // a signal or the user may have requested to stop in some other
- // way. Stop if we have a valid exception (this thread won't if
- // another thread was the reason this process stopped) and that
- // exception, is NOT a breakpoint exception (a common case would
- // be a SIGINT signal).
- if (GetStopException().IsValid() && !GetStopException().IsBreakpoint())
- return true;
- }
+ return true;
}
else
{
@@ -467,18 +453,7 @@ MachThread::ShouldStop(bool &step_more)
bool
MachThread::IsStepping()
{
-#if ENABLE_AUTO_STEPPING_OVER_BP
- // Return true if this thread is currently being stepped.
- // MachThread::ThreadWillResume currently determines this by looking if we
- // have been asked to single step, or if we are at a breakpoint instruction
- // and have been asked to resume. In the latter case we need to disable the
- // breakpoint we are at, single step, re-enable and continue.
- nub_state_t state = GetState();
- return ((state == eStateStepping) ||
- (state == eStateRunning && NUB_BREAK_ID_IS_VALID(CurrentBreakpoint())));
-#else
return GetState() == eStateStepping;
-#endif
}
@@ -507,52 +482,10 @@ MachThread::ThreadDidStop()
// Update the basic information for a thread
MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info);
-#if ENABLE_AUTO_STEPPING_OVER_BP
- // See if we were at a breakpoint when we last resumed that we disabled,
- // re-enable it.
- nub_break_t breakID = CurrentBreakpoint();
-
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- m_process->EnableBreakpoint(breakID);
- if (m_basic_info.suspend_count > 0)
- {
- SetState(eStateSuspended);
- }
- else
- {
- // If we last were at a breakpoint and we single stepped, our state
- // will be "running" to indicate we need to continue after stepping
- // over the breakpoint instruction. If we step over a breakpoint
- // instruction, we need to stop.
- if (GetState() == eStateRunning)
- {
- // Leave state set to running so we will continue automatically
- // from this breakpoint
- }
- else
- {
- SetState(eStateStopped);
- }
- }
- }
- else
- {
- if (m_basic_info.suspend_count > 0)
- {
- SetState(eStateSuspended);
- }
- else
- {
- SetState(eStateStopped);
- }
- }
-#else
if (m_basic_info.suspend_count > 0)
SetState(eStateSuspended);
else
SetState(eStateStopped);
-#endif
return true;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h Tue Jul 2 16:55:02 2013
@@ -62,7 +62,7 @@ public:
bool SetPC(uint64_t value); // Set program counter
uint64_t GetSP(uint64_t failValue = INVALID_NUB_ADDRESS); // Get stack pointer
- nub_break_t CurrentBreakpoint();
+ DNBBreakpoint * CurrentBreakpoint();
uint32_t EnableHardwareBreakpoint (const DNBBreakpoint *breakpoint);
uint32_t EnableHardwareWatchpoint (const DNBBreakpoint *watchpoint);
bool DisableHardwareBreakpoint (const DNBBreakpoint *breakpoint);
@@ -125,7 +125,6 @@ protected:
uint32_t m_seq_id; // A Sequential ID that increments with each new thread
nub_state_t m_state; // The state of our process
PThreadMutex m_state_mutex; // Multithreaded protection for m_state
- nub_break_t m_break_id; // Breakpoint that this thread is (stopped)/was(running) at (NULL for none)
struct thread_basic_info m_basic_info; // Basic information for a thread used to see if a thread is valid
int32_t m_suspend_count; // The current suspend count > 0 means we have suspended m_suspendCount times,
// < 0 means we have resumed it m_suspendCount times.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp Tue Jul 2 16:55:02 2013
@@ -499,9 +499,9 @@ MachThreadList::EnableHardwareBreakpoint
{
if (bp != NULL)
{
- MachThreadSP thread_sp (GetThreadByID (bp->ThreadID()));
- if (thread_sp)
- return thread_sp->EnableHardwareBreakpoint(bp);
+ const uint32_t num_threads = m_threads.size();
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
+ m_threads[idx]->EnableHardwareBreakpoint(bp);
}
return INVALID_NUB_HW_INDEX;
}
@@ -511,9 +511,9 @@ MachThreadList::DisableHardwareBreakpoin
{
if (bp != NULL)
{
- MachThreadSP thread_sp (GetThreadByID (bp->ThreadID()));
- if (thread_sp)
- return thread_sp->DisableHardwareBreakpoint(bp);
+ const uint32_t num_threads = m_threads.size();
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
+ m_threads[idx]->DisableHardwareBreakpoint(bp);
}
return false;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp Tue Jul 2 16:55:02 2013
@@ -235,6 +235,22 @@ static uint64_t GetPhysicalMemory()
void
MachVMMemory::GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t &dirty_size)
{
+#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
+
+ task_vm_info_data_t vm_info;
+ mach_msg_type_number_t info_count;
+ kern_return_t kr;
+
+ info_count = TASK_VM_INFO_COUNT;
+#ifdef TASK_VM_INFO_PURGEABLE
+ kr = task_info(task, TASK_VM_INFO_PURGEABLE, (task_info_t)&vm_info, &info_count);
+#else
+ kr = task_info(task, TASK_VM_INFO, (task_info_t)&vm_info, &info_count);
+#endif
+ if (kr == KERN_SUCCESS)
+ dirty_size = vm_info.internal;
+
+#else
mach_vm_address_t address = 0;
mach_vm_size_t size;
kern_return_t err = 0;
@@ -285,6 +301,8 @@ MachVMMemory::GetRegionSizes(task_t task
vm_size_t pagesize = PageSize (task);
rsize = pages_resident * pagesize;
dirty_size = pages_dirtied * pagesize;
+
+#endif
}
// Test whether the virtual address is within the architecture's shared region.
@@ -418,7 +436,7 @@ MachVMMemory::GetMemorySizes(task_t task
}
#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
-
+#ifndef TASK_VM_INFO_PURGEABLE
// cribbed from sysmond
static uint64_t
SumVMPurgeableInfo(const vm_purgeable_info_t info)
@@ -438,7 +456,7 @@ SumVMPurgeableInfo(const vm_purgeable_in
return sum;
}
-
+#endif /* !TASK_VM_INFO_PURGEABLE */
#endif
static void
@@ -447,11 +465,14 @@ GetPurgeableAndAnonymous(task_t task, ui
#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
kern_return_t kr;
+#ifndef TASK_VM_INFO_PURGEABLE
task_purgable_info_t purgeable_info;
uint64_t purgeable_sum = 0;
+#endif /* !TASK_VM_INFO_PURGEABLE */
mach_msg_type_number_t info_count;
task_vm_info_data_t vm_info;
+#ifndef TASK_VM_INFO_PURGEABLE
typedef kern_return_t (*task_purgable_info_type) (task_t, task_purgable_info_t *);
task_purgable_info_type task_purgable_info_ptr = NULL;
task_purgable_info_ptr = (task_purgable_info_type)dlsym(RTLD_NEXT, "task_purgable_info");
@@ -463,11 +484,20 @@ GetPurgeableAndAnonymous(task_t task, ui
purgeable = purgeable_sum;
}
}
+#endif /* !TASK_VM_INFO_PURGEABLE */
info_count = TASK_VM_INFO_COUNT;
+#ifdef TASK_VM_INFO_PURGEABLE
+ kr = task_info(task, TASK_VM_INFO_PURGEABLE, (task_info_t)&vm_info, &info_count);
+#else
kr = task_info(task, TASK_VM_INFO, (task_info_t)&vm_info, &info_count);
+#endif
if (kr == KERN_SUCCESS)
{
+#ifdef TASK_VM_INFO_PURGEABLE
+ purgeable = vm_info.purgeable_volatile_resident;
+ anonymous = vm_info.internal - vm_info.purgeable_volatile_pmap;
+#else
if (purgeable_sum < vm_info.internal)
{
anonymous = vm_info.internal - purgeable_sum;
@@ -476,8 +506,9 @@ GetPurgeableAndAnonymous(task_t task, ui
{
anonymous = 0;
}
+#endif
}
-
+
#endif
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Tue Jul 2 16:55:02 2013
@@ -422,51 +422,7 @@ DNBArchMachARM::ThreadDidStop()
// We are single stepping, was this the primary thread?
if (m_thread->IsStepping())
{
- // Are we software single stepping?
- if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id) || m_sw_single_step_itblock_break_count)
- {
- // Remove any software single stepping breakpoints that we have set
-
- // Do we have a normal software single step breakpoint?
- if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id))
- {
- DNBLogThreadedIf(LOG_STEP, "%s: removing software single step breakpoint (breakID=%d)", __FUNCTION__, m_sw_single_step_break_id);
- success = m_thread->Process()->DisableBreakpoint(m_sw_single_step_break_id, true);
- m_sw_single_step_break_id = INVALID_NUB_BREAK_ID;
- }
-
- // Do we have any Thumb IT breakpoints?
- if (m_sw_single_step_itblock_break_count > 0)
- {
- // See if we hit one of our Thumb IT breakpoints?
- DNBBreakpoint *step_bp = m_thread->Process()->Breakpoints().FindByAddress(m_state.context.gpr.__pc);
-
- if (step_bp)
- {
- // We did hit our breakpoint, tell the breakpoint it was
- // hit so that it can run its callback routine and fixup
- // the PC.
- DNBLogThreadedIf(LOG_STEP, "%s: IT software single step breakpoint hit (breakID=%u)", __FUNCTION__, step_bp->GetID());
- step_bp->BreakpointHit(m_thread->Process()->ProcessID(), m_thread->ThreadID());
- }
-
- // Remove all Thumb IT breakpoints
- for (int i = 0; i < m_sw_single_step_itblock_break_count; i++)
- {
- if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_itblock_break_id[i]))
- {
- DNBLogThreadedIf(LOG_STEP, "%s: removing IT software single step breakpoint (breakID=%d)", __FUNCTION__, m_sw_single_step_itblock_break_id[i]);
- success = m_thread->Process()->DisableBreakpoint(m_sw_single_step_itblock_break_id[i], true);
- m_sw_single_step_itblock_break_id[i] = INVALID_NUB_BREAK_ID;
- }
- }
- m_sw_single_step_itblock_break_count = 0;
-
- }
-
- }
- else
- success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
+ success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
}
else
{
@@ -701,18 +657,6 @@ DNBArchMachARM::ConditionPassed(uint8_t
return false;
}
-nub_bool_t
-DNBArchMachARM::BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
-{
- nub_addr_t bkpt_pc = (nub_addr_t)baton;
- DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s(pid = %i, tid = %4.4x, breakID = %u, baton = %p): Setting PC to 0x%8.8x", __FUNCTION__, pid, tid, breakID, baton, bkpt_pc);
-
- DNBRegisterValue pc_value;
- DNBThreadGetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
- pc_value.value.uint32 = bkpt_pc;
- return DNBThreadSetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
-}
-
uint32_t
DNBArchMachARM::NumSupportedHardwareBreakpoints()
{
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Tue Jul 2 16:55:02 2013
@@ -29,9 +29,6 @@ public:
m_thread(thread),
m_state(),
m_hw_single_chained_step_addr(INVALID_NUB_ADDRESS),
- m_sw_single_step_next_pc(INVALID_NUB_ADDRESS),
- m_sw_single_step_break_id(INVALID_NUB_BREAK_ID),
- m_sw_single_step_itblock_break_count(0),
m_last_decode_pc(INVALID_NUB_ADDRESS),
m_watchpoint_hw_index(-1),
m_watchpoint_did_occur(false),
@@ -41,8 +38,6 @@ public:
#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
ThumbStaticsInit(&m_last_decode_thumb);
#endif
- for (int i = 0; i < kMaxNumThumbITBreakpoints; i++)
- m_sw_single_step_itblock_break_id[i] = INVALID_NUB_BREAK_ID;
}
virtual ~DNBArchMachARM()
@@ -100,7 +95,6 @@ protected:
void DecodeITBlockInstructions(nub_addr_t curr_pc);
#endif
void EvaluateNextInstructionForSoftwareBreakpointSetup(nub_addr_t currentPC, uint32_t cpsr, bool currentPCIsThumb, nub_addr_t *nextPC, bool *nextPCIsThumb);
- static nub_bool_t BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
typedef enum RegisterSetTag
{
@@ -249,16 +243,6 @@ protected:
State m_state;
DBG m_dbg_save;
nub_addr_t m_hw_single_chained_step_addr;
- // Software single stepping support
- nub_addr_t m_sw_single_step_next_pc;
- nub_break_t m_sw_single_step_break_id;
- nub_break_t m_sw_single_step_itblock_break_id[kMaxNumThumbITBreakpoints];
- nub_addr_t m_sw_single_step_itblock_break_count;
- // Disassembler state
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
- thumb_static_data_t m_last_decode_thumb;
- arm_decoded_instruction_t m_last_decode_arm;
-#endif
nub_addr_t m_last_decode_pc;
// The following member variables should be updated atomically.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Tue Jul 2 16:55:02 2013
@@ -647,8 +647,8 @@ DNBArchImplI386::NotifyException(MachExc
// Check for a breakpoint at one byte prior to the current PC value
// since the PC will be just past the trap.
- nub_break_t breakID = m_thread->Process()->Breakpoints().FindIDByAddress(pc);
- if (NUB_BREAK_ID_IS_VALID(breakID))
+ DNBBreakpoint *bp = m_thread->Process()->Breakpoints().FindByAddress(pc);
+ if (bp)
{
// Backup the PC for i386 since the trap was taken and the PC
// is at the address following the single byte trap instruction.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Tue Jul 2 16:55:02 2013
@@ -602,8 +602,8 @@ DNBArchImplX86_64::NotifyException(MachE
// Check for a breakpoint at one byte prior to the current PC value
// since the PC will be just past the trap.
- nub_break_t breakID = m_thread->Process()->Breakpoints().FindIDByAddress(pc);
- if (NUB_BREAK_ID_IS_VALID(breakID))
+ DNBBreakpoint *bp = m_thread->Process()->Breakpoints().FindByAddress(pc);
+ if (bp)
{
// Backup the PC for i386 since the trap was taken and the PC
// is at the address following the single byte trap instruction.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp Tue Jul 2 16:55:02 2013
@@ -71,7 +71,6 @@ RNBRemote::RNBRemote () :
m_rx_packets(),
m_rx_partial_data(),
m_rx_pthread(0),
- m_breakpoints(),
m_max_payload_size(DEFAULT_GDB_REMOTE_PROTOCOL_BUFSIZE - 4),
m_extended_mode(false),
m_noack_mode(false),
@@ -782,6 +781,29 @@ RNBRemote::ThreadFunctionReadRemoteData(
}
+// If we fail to get back a valid CPU type for the remote process,
+// make a best guess for the CPU type based on the currently running
+// debugserver binary -- the debugger may not handle the case of an
+// un-specified process CPU type correctly.
+
+static cpu_type_t
+best_guess_cpu_type ()
+{
+#if defined (__arm__)
+ return CPU_TYPE_ARM;
+#elif defined (__i386__) || defined (__x86_64__)
+ if (sizeof (char*) == 8)
+ {
+ return CPU_TYPE_X86_64;
+ }
+ else
+ {
+ return CPU_TYPE_I386;
+ }
+#endif
+ return 0;
+}
+
/* Read the bytes in STR which are GDB Remote Protocol binary encoded bytes
(8-bit bytes).
@@ -1134,6 +1156,12 @@ RNBRemote::InitializeRegisters (bool for
else
{
uint32_t cpu_type = DNBProcessGetCPUType (pid);
+ if (cpu_type == 0)
+ {
+ DNBLog ("Unable to get the process cpu_type, making a best guess.");
+ cpu_type = best_guess_cpu_type ();
+ }
+
DNBLogThreadedIf (LOG_RNB_PROC, "RNBRemote::%s() getting gdb registers(%s)", __FUNCTION__, m_arch.c_str());
#if defined (__i386__) || defined (__x86_64__)
if (cpu_type == CPU_TYPE_X86_64)
@@ -1528,7 +1556,6 @@ get_value (std::string &line)
return value;
}
-
extern void FileLogCallback(void *baton, uint32_t flags, const char *format, va_list args);
extern void ASLLogCallback(void *baton, uint32_t flags, const char *format, va_list args);
@@ -3252,32 +3279,16 @@ RNBRemote::HandlePacket_z (const char *p
{
case '0': // set software breakpoint
case '1': // set hardware breakpoint
- {
- // gdb can send multiple Z packets for the same address and
- // these calls must be ref counted.
- bool hardware = (break_type == '1');
-
- // Check if we currently have a breakpoint already set at this address
- BreakpointMapIter pos = m_breakpoints.find(addr);
- if (pos != m_breakpoints.end())
- {
- // We do already have a breakpoint at this address, increment
- // its reference count and return OK
- pos->second.Retain();
- return SendPacket ("OK");
- }
- else
{
- // We do NOT already have a breakpoint at this address, So lets
- // create one.
- nub_break_t break_id = DNBBreakpointSet (pid, addr, byte_size, hardware);
- if (NUB_BREAK_ID_IS_VALID(break_id))
+ // gdb can send multiple Z packets for the same address and
+ // these calls must be ref counted.
+ bool hardware = (break_type == '1');
+
+ if (DNBBreakpointSet (pid, addr, byte_size, hardware))
{
// We successfully created a breakpoint, now lets full out
// a ref count structure with the breakID and add it to our
// map.
- Breakpoint rnbBreakpoint(break_id);
- m_breakpoints[addr] = rnbBreakpoint;
return SendPacket ("OK");
}
else
@@ -3286,43 +3297,23 @@ RNBRemote::HandlePacket_z (const char *p
return SendPacket ("E09");
}
}
- }
break;
case '2': // set write watchpoint
case '3': // set read watchpoint
case '4': // set access watchpoint
- {
- bool hardware = true;
- uint32_t watch_flags = 0;
- if (break_type == '2')
- watch_flags = WATCH_TYPE_WRITE;
- else if (break_type == '3')
- watch_flags = WATCH_TYPE_READ;
- else
- watch_flags = WATCH_TYPE_READ | WATCH_TYPE_WRITE;
-
- // Check if we currently have a watchpoint already set at this address
- BreakpointMapIter pos = m_watchpoints.find(addr);
- if (pos != m_watchpoints.end())
- {
- // We do already have a watchpoint at this address, increment
- // its reference count and return OK
- pos->second.Retain();
- return SendPacket ("OK");
- }
- else
{
- // We do NOT already have a watchpoint at this address, So lets
- // create one.
- nub_watch_t watch_id = DNBWatchpointSet (pid, addr, byte_size, watch_flags, hardware);
- if (NUB_WATCH_ID_IS_VALID(watch_id))
+ bool hardware = true;
+ uint32_t watch_flags = 0;
+ if (break_type == '2')
+ watch_flags = WATCH_TYPE_WRITE;
+ else if (break_type == '3')
+ watch_flags = WATCH_TYPE_READ;
+ else
+ watch_flags = WATCH_TYPE_READ | WATCH_TYPE_WRITE;
+
+ if (DNBWatchpointSet (pid, addr, byte_size, watch_flags, hardware))
{
- // We successfully created a watchpoint, now lets full out
- // a ref count structure with the watch_id and add it to our
- // map.
- Breakpoint rnbWatchpoint(watch_id);
- m_watchpoints[addr] = rnbWatchpoint;
return SendPacket ("OK");
}
else
@@ -3331,7 +3322,6 @@ RNBRemote::HandlePacket_z (const char *p
return SendPacket ("E09");
}
}
- }
break;
default:
@@ -3345,83 +3335,27 @@ RNBRemote::HandlePacket_z (const char *p
{
case '0': // remove software breakpoint
case '1': // remove hardware breakpoint
- {
- // gdb can send multiple z packets for the same address and
- // these calls must be ref counted.
- BreakpointMapIter pos = m_breakpoints.find(addr);
- if (pos != m_breakpoints.end())
- {
- // We currently have a breakpoint at address ADDR. Decrement
- // its reference count, and it that count is now zero we
- // can clear the breakpoint.
- pos->second.Release();
- if (pos->second.RefCount() == 0)
- {
- if (DNBBreakpointClear (pid, pos->second.BreakID()))
- {
- m_breakpoints.erase(pos);
- return SendPacket ("OK");
- }
- else
- {
- return SendPacket ("E08");
- }
- }
- else
- {
- // We still have references to this breakpoint don't
- // delete it, just decrementing the reference count
- // is enough.
- return SendPacket ("OK");
- }
+ if (DNBBreakpointClear (pid, addr))
+ {
+ return SendPacket ("OK");
}
else
{
- // We don't know about any breakpoints at this address
return SendPacket ("E08");
}
- }
break;
case '2': // remove write watchpoint
case '3': // remove read watchpoint
case '4': // remove access watchpoint
- {
- // gdb can send multiple z packets for the same address and
- // these calls must be ref counted.
- BreakpointMapIter pos = m_watchpoints.find(addr);
- if (pos != m_watchpoints.end())
- {
- // We currently have a watchpoint at address ADDR. Decrement
- // its reference count, and it that count is now zero we
- // can clear the watchpoint.
- pos->second.Release();
- if (pos->second.RefCount() == 0)
- {
- if (DNBWatchpointClear (pid, pos->second.BreakID()))
- {
- m_watchpoints.erase(pos);
- return SendPacket ("OK");
- }
- else
- {
- return SendPacket ("E08");
- }
- }
- else
- {
- // We still have references to this watchpoint don't
- // delete it, just decrementing the reference count
- // is enough.
- return SendPacket ("OK");
- }
+ if (DNBWatchpointClear (pid, addr))
+ {
+ return SendPacket ("OK");
}
else
{
- // We don't know about any watchpoints at this address
return SendPacket ("E08");
}
- }
break;
default:
@@ -4070,6 +4004,12 @@ RNBRemote::HandlePacket_qProcessInfo (co
}
cpu_type_t cputype = DNBProcessGetCPUType (pid);
+ if (cputype == 0)
+ {
+ DNBLog ("Unable to get the process cpu_type, making a best guess.");
+ cputype = best_guess_cpu_type();
+ }
+
if (cputype != 0)
{
rep << "cputype:" << std::hex << cputype << ";";
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h Tue Jul 2 16:55:02 2013
@@ -301,39 +301,6 @@ protected:
nub_thread_t
ExtractThreadIDFromThreadSuffix (const char *p);
- // gdb can send multiple Z/z packets for the same address and
- // these calls must be ref counted.
- struct Breakpoint
- {
- Breakpoint(nub_break_t breakID) :
- m_breakID(breakID),
- m_refCount(1)
- {
- }
-
- Breakpoint() :
- m_breakID(INVALID_NUB_BREAK_ID),
- m_refCount(0)
- {
- }
-
- Breakpoint(const Breakpoint& rhs) :
- m_breakID(rhs.m_breakID),
- m_refCount(rhs.m_refCount)
- {
- }
-
- nub_break_t BreakID() const { return m_breakID; }
- uint32_t RefCount() const { return m_refCount; }
- void Release() { if (m_refCount > 0) --m_refCount; }
- void Retain() { ++m_refCount; }
-
- nub_break_t m_breakID;
- uint32_t m_refCount;
- };
- typedef std::map<nub_addr_t, Breakpoint> BreakpointMap;
- typedef BreakpointMap::iterator BreakpointMapIter;
- typedef BreakpointMap::const_iterator BreakpointMapConstIter;
RNBContext m_ctx; // process context
RNBSocket m_comm; // communication port
std::string m_arch;
@@ -345,8 +312,6 @@ protected:
std::deque<std::string> m_rx_packets;
std::string m_rx_partial_data; // For packets that may come in more than one batch, anything left over can be left here
pthread_t m_rx_pthread;
- BreakpointMap m_breakpoints;
- BreakpointMap m_watchpoints;
uint32_t m_max_payload_size; // the maximum sized payload we should send to gdb
bool m_extended_mode; // are we in extended mode?
bool m_noack_mode; // are we in no-ack mode?
Modified: lldb/branches/lldb-platform-work/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Makefile (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Makefile Tue Jul 2 16:55:02 2013
@@ -21,7 +21,7 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,"$(PROJ_SRC_DIR)/lldb-Info.plist"
endif
-ifeq ($(HOST_OS),Linux)
+ifneq (,$(filter $(HOST_OS), Linux GNU/kFreeBSD))
LLVMLibsOptions += -Wl,-rpath,$(LibDir)
endif
Modified: lldb/branches/lldb-platform-work/tools/lldb-platform/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/lldb-platform/Makefile?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/lldb-platform/Makefile (original)
+++ lldb/branches/lldb-platform-work/tools/lldb-platform/Makefile Tue Jul 2 16:55:02 2013
@@ -18,6 +18,6 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -Wl,-rpath, at loader_path/../lib/
endif
-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD))
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU/kFreeBSD))
LLVMLibsOptions += -Wl,-rpath,$(LibDir)
endif
Modified: lldb/branches/lldb-platform-work/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/lldb-gdb.html?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/lldb-gdb.html (original)
+++ lldb/branches/lldb-platform-work/www/lldb-gdb.html Tue Jul 2 16:55:02 2013
@@ -1213,7 +1213,7 @@
<b>(gdb)</b> directory /my/path<br>
</td>
<td class="content">
- (<i>No equivalent command yet.)<br>
+ (<i>No equivalent command - use the source-map instead.)<br>
</td>
</tr>
Modified: lldb/branches/lldb-platform-work/www/sidebar.incl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/sidebar.incl?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/sidebar.incl (original)
+++ lldb/branches/lldb-platform-work/www/sidebar.incl Tue Jul 2 16:55:02 2013
@@ -22,6 +22,7 @@
<li><a href="python-reference.html">Python Reference</a></li>
<li><a href="scripting.html">Python Example</a></li>
<li><a href="symbols.html">Symbols on Mac OS X</a></li>
+ <li><a href="troubleshooting.html">Troubleshooting</a></li>
<li><a href="architecture.html">Architecture</a></li>
</ul>
</div>
@@ -37,9 +38,10 @@
</div>
<div class="menu">
<div class="urbangreymenu">
- <h1 class="headerbar">Source</h1>
+ <h1 class="headerbar">Resources</h1>
<ul>
<li><a href="download.html">Download</a></li>
+ <li><a href="source.html">Source</a></li>
<li><a href="build.html">Build</a></li>
<li><a href="http://llvm.org/bugs">Bug Reports</a></li>
<li><a href="http://llvm.org/svn/llvm-project/lldb/trunk">Browse SVN</a></li>
Modified: lldb/branches/lldb-platform-work/www/status.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/status.html?rev=185481&r1=185480&r2=185481&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/status.html (original)
+++ lldb/branches/lldb-platform-work/www/status.html Tue Jul 2 16:55:02 2013
@@ -33,10 +33,9 @@
</div>
<h1 class ="postheader">Linux Status</h1>
<div class="postcontent">
- <p> LLDB is improving on Linux. While the debugserver is not ported
- (to enable remote debugging) and debugging of multi-threaded programs is in its infancy, most
- of the functionality, including the Python API and the command line tool,
- is working on the x86_64 architecture, and partially working with i386.
+ <p> LLDB is improving on Linux. While the debugserver has not been ported
+ (to enable remote debugging) Linux is nearing feature completeness with Darwin
+ to debug x86_64 programs, and is partially working with i386 programs.
FreeBSD is untested. ARM architectures on Linux are untested.
For more details, see the Features by OS section below.
</div>
@@ -84,6 +83,11 @@
<td>OK</td>
</tr>
<tr>
+ <td>Core file debugging</td>
+ <td>Not implemented</td>
+ <td>OK</td>
+ </tr>
+ <tr>
<td>Debugserver (remote debugging)</td>
<td>Not ported</td>
<td>OK</td>
@@ -117,13 +121,15 @@
<tr>
<td>Process control
<ul>
- <li>launch
<li>attach
<li>continue
+ <li>exec, execve...
<li>fork
+ <li>launch
+ <li>status
</ul>
</td>
- <td>OK</td>
+ <td>OK (except exec*)</td>
<td>OK</td>
</tr>
<tr>
@@ -156,7 +162,7 @@
</tr>
<tr>
<td>Thread inspection and stepping</td>
- <td>OK for single thread (no multi-threaded support)</td>
+ <td>OK</td>
<td>OK</td>
</tr>
<tr>
More information about the llvm-branch-commits
mailing list