[Lldb-commits] [lldb] r165942 - in /lldb/branches/windows: ./ docs/ examples/darwin/heap_find/ examples/darwin/heap_find/heap/ examples/plugins/ examples/summaries/cocoa/ include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Host/ include/lldb/Interpreter/ include/lldb/Symbol/ include/lldb/Target/ lib/ lldb.xcodeproj/ scripts/ scripts/Python/ scripts/Python/interface/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ sourc...
Carlo Kok
ck at remobjects.com
Mon Oct 15 09:28:00 PDT 2012
Author: carlokok
Date: Mon Oct 15 11:27:58 2012
New Revision: 165942
URL: http://llvm.org/viewvc/llvm-project?rev=165942&view=rev
Log:
Merge lldb/trunk into branhes/windows (and make it compile again)
Added:
lldb/branches/windows/examples/plugins/
- copied from r165938, lldb/trunk/examples/plugins/
lldb/branches/windows/include/lldb/API/SBDeclaration.h
- copied unchanged from r165938, lldb/trunk/include/lldb/API/SBDeclaration.h
lldb/branches/windows/include/lldb/Host/DynamicLibrary.h
- copied, changed from r165938, lldb/trunk/include/lldb/Host/DynamicLibrary.h
lldb/branches/windows/scripts/Python/interface/SBDeclaration.i
- copied unchanged from r165938, lldb/trunk/scripts/Python/interface/SBDeclaration.i
lldb/branches/windows/source/API/SBDeclaration.cpp
- copied unchanged from r165938, lldb/trunk/source/API/SBDeclaration.cpp
lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp
- copied unchanged from r165938, lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/branches/windows/source/Commands/CommandObjectPlugin.h
- copied unchanged from r165938, lldb/trunk/source/Commands/CommandObjectPlugin.h
lldb/branches/windows/source/Host/common/DynamicLibrary.cpp
- copied unchanged from r165938, lldb/trunk/source/Host/common/DynamicLibrary.cpp
lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt
Modified:
lldb/branches/windows/ (props changed)
lldb/branches/windows/docs/code-signing.txt
lldb/branches/windows/examples/darwin/heap_find/heap.py
lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp
lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py
lldb/branches/windows/include/lldb/API/LLDB.h
lldb/branches/windows/include/lldb/API/SBBreakpoint.h
lldb/branches/windows/include/lldb/API/SBCommandInterpreter.h
lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h
lldb/branches/windows/include/lldb/API/SBDebugger.h
lldb/branches/windows/include/lldb/API/SBDefines.h
lldb/branches/windows/include/lldb/API/SBError.h
lldb/branches/windows/include/lldb/API/SBEvent.h
lldb/branches/windows/include/lldb/API/SBFileSpec.h
lldb/branches/windows/include/lldb/API/SBProcess.h
lldb/branches/windows/include/lldb/API/SBStream.h
lldb/branches/windows/include/lldb/API/SBThread.h
lldb/branches/windows/include/lldb/API/SBType.h
lldb/branches/windows/include/lldb/API/SBValue.h
lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h
lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h
lldb/branches/windows/include/lldb/Core/Broadcaster.h
lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h
lldb/branches/windows/include/lldb/Core/Debugger.h
lldb/branches/windows/include/lldb/Core/FormatManager.h
lldb/branches/windows/include/lldb/Core/FormatNavigator.h
lldb/branches/windows/include/lldb/Core/Log.h
lldb/branches/windows/include/lldb/Core/ValueObject.h
lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h
lldb/branches/windows/include/lldb/Expression/IRForTarget.h
lldb/branches/windows/include/lldb/Host/Symbols.h
lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h
lldb/branches/windows/include/lldb/Interpreter/CommandObject.h
lldb/branches/windows/include/lldb/Interpreter/CommandObjectCrossref.h
lldb/branches/windows/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h
lldb/branches/windows/include/lldb/Symbol/VariableList.h
lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
lldb/branches/windows/include/lldb/Target/Process.h
lldb/branches/windows/include/lldb/Target/Thread.h
lldb/branches/windows/include/lldb/lldb-enumerations.h
lldb/branches/windows/include/lldb/lldb-forward.h
lldb/branches/windows/include/lldb/lldb-private-log.h
lldb/branches/windows/lib/Makefile
lldb/branches/windows/lldb.xcodeproj/project.pbxproj
lldb/branches/windows/scripts/Python/build-swig-Python.sh
lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i
lldb/branches/windows/scripts/Python/interface/SBCommandInterpreter.i
lldb/branches/windows/scripts/Python/interface/SBCommandReturnObject.i
lldb/branches/windows/scripts/Python/interface/SBProcess.i
lldb/branches/windows/scripts/Python/interface/SBStream.i
lldb/branches/windows/scripts/Python/interface/SBThread.i
lldb/branches/windows/scripts/Python/interface/SBType.i
lldb/branches/windows/scripts/Python/interface/SBValue.i
lldb/branches/windows/scripts/Python/python-extensions.swig
lldb/branches/windows/scripts/build-llvm.pl
lldb/branches/windows/scripts/lldb.swig
lldb/branches/windows/source/API/CMakeLists.txt
lldb/branches/windows/source/API/SBBreakpoint.cpp
lldb/branches/windows/source/API/SBCommandInterpreter.cpp
lldb/branches/windows/source/API/SBCommandReturnObject.cpp
lldb/branches/windows/source/API/SBDebugger.cpp
lldb/branches/windows/source/API/SBProcess.cpp
lldb/branches/windows/source/API/SBTarget.cpp
lldb/branches/windows/source/API/SBThread.cpp
lldb/branches/windows/source/API/SBType.cpp
lldb/branches/windows/source/API/SBTypeNameSpecifier.cpp
lldb/branches/windows/source/API/SBTypeSummary.cpp
lldb/branches/windows/source/API/SBValue.cpp
lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp
lldb/branches/windows/source/Breakpoint/BreakpointResolverName.cpp
lldb/branches/windows/source/Commands/CMakeLists.txt
lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp
lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
lldb/branches/windows/source/Commands/CommandObjectFrame.cpp
lldb/branches/windows/source/Commands/CommandObjectHelp.cpp
lldb/branches/windows/source/Commands/CommandObjectLog.cpp
lldb/branches/windows/source/Commands/CommandObjectMultiword.cpp
lldb/branches/windows/source/Commands/CommandObjectProcess.cpp
lldb/branches/windows/source/Commands/CommandObjectSyntax.cpp
lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
lldb/branches/windows/source/Commands/CommandObjectThread.cpp
lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp
lldb/branches/windows/source/Core/Communication.cpp
lldb/branches/windows/source/Core/DataBufferMemoryMap.cpp
lldb/branches/windows/source/Core/Debugger.cpp
lldb/branches/windows/source/Core/FormatManager.cpp
lldb/branches/windows/source/Core/Log.cpp
lldb/branches/windows/source/Core/Module.cpp
lldb/branches/windows/source/Core/ModuleList.cpp
lldb/branches/windows/source/Core/Section.cpp
lldb/branches/windows/source/Core/StreamCallback.cpp
lldb/branches/windows/source/Core/ValueObject.cpp
lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp
lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
lldb/branches/windows/source/Expression/ClangUserExpression.cpp
lldb/branches/windows/source/Expression/IRForTarget.cpp
lldb/branches/windows/source/Expression/IRInterpreter.cpp
lldb/branches/windows/source/Host/common/CMakeLists.txt
lldb/branches/windows/source/Host/common/Host.cpp
lldb/branches/windows/source/Host/common/Symbols.cpp
lldb/branches/windows/source/Host/macosx/Symbols.cpp
lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
lldb/branches/windows/source/Interpreter/CommandObject.cpp
lldb/branches/windows/source/Interpreter/CommandObjectRegexCommand.cpp
lldb/branches/windows/source/Interpreter/CommandObjectScript.cpp
lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp
lldb/branches/windows/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/branches/windows/source/Interpreter/OptionValuePathMappings.cpp
lldb/branches/windows/source/Interpreter/Options.cpp
lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
lldb/branches/windows/source/Plugins/DynamicLoader/CMakeLists.txt
lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
lldb/branches/windows/source/Plugins/Makefile
lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp
lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/branches/windows/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/branches/windows/source/Plugins/Process/Linux/ProcessLinux.cpp
lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp
lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h
lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp
lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h
lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.cpp
lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.h
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h
lldb/branches/windows/source/Symbol/ClangASTContext.cpp
lldb/branches/windows/source/Symbol/ClangASTImporter.cpp
lldb/branches/windows/source/Symbol/ClangASTType.cpp
lldb/branches/windows/source/Symbol/Function.cpp
lldb/branches/windows/source/Symbol/VariableList.cpp
lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
lldb/branches/windows/source/Target/Process.cpp
lldb/branches/windows/source/Target/StackFrameList.cpp
lldb/branches/windows/source/Target/StopInfo.cpp
lldb/branches/windows/source/Target/Target.cpp
lldb/branches/windows/source/Target/TargetList.cpp
lldb/branches/windows/source/Target/Thread.cpp
lldb/branches/windows/source/Target/ThreadPlanTracer.cpp
lldb/branches/windows/source/Utility/StringExtractor.cpp
lldb/branches/windows/source/Utility/StringExtractor.h
lldb/branches/windows/source/lldb-log.cpp
lldb/branches/windows/source/lldb.cpp
lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py
lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m
lldb/branches/windows/test/redo.py
lldb/branches/windows/test/source-manager/TestSourceManager.py
lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp
lldb/branches/windows/tools/driver/CMakeLists.txt
lldb/branches/windows/tools/driver/Driver.cpp
lldb/branches/windows/tools/driver/Driver.h
lldb/branches/windows/www/lldb-gdb.html
Propchange: lldb/branches/windows/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 15 11:27:58 2012
@@ -1,2 +1,2 @@
/lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:163223-164814
+/lldb/trunk:163223-165938
Modified: lldb/branches/windows/docs/code-signing.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/docs/code-signing.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/docs/code-signing.txt (original)
+++ lldb/branches/windows/docs/code-signing.txt Mon Oct 15 11:27:58 2012
@@ -32,7 +32,7 @@
The next steps are necessary on SnowLeopard, but are probably because of a bug
how Keychain Access makes certificates.
-[Note: These also apply for Lion.]
+[Note: These also apply for Lion and Mountain Lion.]
- Option-drag the new lldb_codesign certificate from the login keychain to
the System keychain in the Keychains pane of the main Keychain Access window
Modified: lldb/branches/windows/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/darwin/heap_find/heap.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/examples/darwin/heap_find/heap.py (original)
+++ lldb/branches/windows/examples/darwin/heap_find/heap.py Mon Oct 15 11:27:58 2012
@@ -133,6 +133,7 @@
parser.add_option('-S', '--stack-history', action='store_true', dest='stack_history', help='gets the stack history for all allocations whose start address matches each malloc block if MallocStackLogging is enabled', default=False)
parser.add_option('-M', '--max-matches', type='int', dest='max_matches', help='the maximum number of matches to print', default=256)
parser.add_option('-O', '--offset', type='int', dest='offset', help='the matching data must be at this offset', default=-1)
+ parser.add_option('-V', '--vm-regions', action='store_true', dest='check_vm_regions', help='Also check the VM regions', default=False)
def dump_stack_history_entry(result, stack_history_entry, idx):
address = int(stack_history_entry.address)
@@ -313,22 +314,22 @@
print_no_matches = True
arg_str_description = arg_str
if options.type == 'pointer':
- expr = 'find_pointer_in_heap((void *)%s)' % (arg_str)
+ expr = 'find_pointer_in_heap((void *)%s, (int)%u)' % (arg_str, options.check_vm_regions)
arg_str_description = 'malloc block containing pointer %s' % arg_str
if options.format == None:
options.format = "A" # 'A' is "address" format
elif options.type == 'isa':
- expr = 'find_objc_objects_in_memory ((void *)%s)' % (arg_str)
+ expr = 'find_objc_objects_in_memory ((void *)%s, (int)%u)' % (arg_str, options.check_vm_regions)
#result.AppendMessage ('expr -u0 -- %s' % expr) # REMOVE THIS LINE
arg_str_description = 'objective C classes with isa %s' % arg_str
options.offset = 0
if options.format == None:
options.format = "A" # 'A' is "address" format
elif options.type == 'cstr':
- expr = 'find_cstring_in_heap("%s")' % arg_str
+ expr = 'find_cstring_in_heap("%s", (int)%u)' % (arg_str, options.check_vm_regions)
arg_str_description = 'malloc block containing "%s"' % arg_str
elif options.type == 'addr':
- expr = 'find_block_for_address((void *)%s)' % arg_str
+ expr = 'find_block_for_address((void *)%s, (int)%u)' % (arg_str, options.check_vm_regions)
arg_str_description = 'malloc block for %s' % arg_str
elif options.type == 'all':
expr = 'get_heap_info(1)'
@@ -430,6 +431,56 @@
else:
heap_search (result, options, None)
+def stack_ptr_refs(debugger, command, result, dict):
+ command_args = shlex.split(command)
+ usage = "usage: %prog [options] <EXPR> [EXPR ...]"
+ description='''Searches thread stack contents for pointer values in darwin user space programs.'''
+ parser = optparse.OptionParser(description=description, prog='section_ptr_refs',usage=usage)
+ add_common_options(parser)
+ try:
+ (options, args) = parser.parse_args(command_args)
+ except:
+ return
+
+ options.type = 'pointer'
+
+ stack_threads = list()
+ stack_bases = list()
+ stack_sizes = list()
+ for thread in lldb.process:
+ min_sp = thread.frame[0].sp
+ max_sp = min_sp
+ for frame in thread.frames:
+ sp = frame.sp
+ if sp < min_sp: min_sp = sp
+ if sp > max_sp: max_sp = sp
+ result.AppendMessage ('%s stack [%#x - %#x)' % (thread, min_sp, max_sp))
+ if min_sp < max_sp:
+ stack_threads.append (thread)
+ stack_bases.append (min_sp)
+ stack_sizes.append (max_sp-min_sp)
+
+ if stack_bases:
+ dylid_load_err = load_dylib()
+ if dylid_load_err:
+ result.AppendMessage(dylid_load_err)
+ return
+ for expr_str in args:
+ for (idx, stack_base) in enumerate(stack_bases):
+ stack_size = stack_sizes[idx]
+ expr = 'find_pointer_in_memory(0x%xllu, %ullu, (void *)%s)' % (stack_base, stack_size, expr_str)
+ arg_str_description = 'thead %s stack containing "%s"' % (stack_threads[idx], expr_str)
+ num_matches = display_match_results (result, options, arg_str_description, lldb.frame.EvaluateExpression (expr), False)
+ if num_matches:
+ if num_matches < options.max_matches:
+ options.max_matches = options.max_matches - num_matches
+ else:
+ options.max_matches = 0
+ if options.max_matches == 0:
+ return
+ else:
+ result.AppendMessage('error: no thread stacks were found that match any of %s' % (', '.join(options.section_names)))
+
def section_ptr_refs(debugger, command, result, dict):
command_args = shlex.split(command)
usage = "usage: %prog [options] <EXPR> [EXPR ...]"
@@ -443,7 +494,7 @@
return
options.type = 'pointer'
-
+
sections = list()
section_modules = list()
if not options.section_names:
@@ -520,8 +571,9 @@
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.malloc_info malloc_info')
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.heap heap')
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.section_ptr_refs section_ptr_refs')
+lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.stack_ptr_refs stack_ptr_refs')
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.objc_refs objc_refs')
-print '"ptr_refs", "cstr_refs", "malloc_info", "heap" and "section_ptr_refs" commands have been installed, use the "--help" options on these commands for detailed help.'
+print '"ptr_refs", "cstr_refs", "malloc_info", "heap", "section_ptr_refs" and "stack_ptr_refs" commands have been installed, use the "--help" options on these commands for detailed help.'
Modified: lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp (original)
+++ lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp Mon Oct 15 11:27:58 2012
@@ -68,6 +68,7 @@
#include <ctype.h>
#include <dlfcn.h>
#include <mach/mach.h>
+#include <mach/mach_vm.h>
#include <malloc/malloc.h>
#include <objc/objc-runtime.h>
#include <stdio.h>
@@ -91,6 +92,8 @@
#define stack_logging_type_generic 1
#define stack_logging_type_alloc 2
#define stack_logging_type_dealloc 4
+// This bit is made up by this code
+#define stack_logging_type_vm_region 8
//----------------------------------------------------------------------
// Redefine private function prototypes from
@@ -130,6 +133,13 @@
extern "C" void *gdb_class_getClass (void *objc_class);
+static void
+range_info_callback (task_t task,
+ void *baton,
+ unsigned type,
+ uint64_t ptr_addr,
+ uint64_t ptr_size);
+
//----------------------------------------------------------------------
// Redefine private gloval variables prototypes from
// "/usr/local/include/stack_logging.h"
@@ -153,6 +163,7 @@
zone_callback_t *zone_callback;
range_callback_t *range_callback;
void *baton;
+ int check_vm_regions;
};
enum data_type_t
@@ -188,6 +199,7 @@
};
uint32_t match_count;
bool done;
+ bool unique;
};
struct malloc_match
@@ -195,6 +207,7 @@
void *addr;
intptr_t size;
intptr_t offset;
+ uintptr_t type;
};
struct malloc_stack_entry
@@ -239,6 +252,7 @@
clear()
{
m_size = 0;
+ bzero (&m_entries, sizeof(m_entries));
}
bool
@@ -248,8 +262,17 @@
}
void
- push_back (const malloc_match& m)
+ push_back (const malloc_match& m, bool unique = false)
{
+ if (unique)
+ {
+ // Don't add the entry if there is already a match for this address
+ for (uint32_t i=0; i<m_size; ++i)
+ {
+ if (((uint8_t *)m_entries[i].addr + m_entries[i].offset) == ((uint8_t *)m.addr + m.offset))
+ return; // Duplicate entry
+ }
+ }
if (m_size < k_max_entries - 1)
{
m_entries[m_size] = m;
@@ -264,7 +287,7 @@
if (empty())
return NULL;
// In not empty, terminate and return the result
- malloc_match terminator_entry = { NULL, 0, 0 };
+ malloc_match terminator_entry = { NULL, 0, 0, 0 };
// We always leave room for an empty entry at the end
m_entries[m_size] = terminator_entry;
return m_entries;
@@ -584,6 +607,49 @@
info->zone_callback (info, (const malloc_zone_t *)zones[i]);
}
}
+
+ if (info->check_vm_regions)
+ {
+#if defined (VM_REGION_SUBMAP_SHORT_INFO_COUNT_64)
+ typedef vm_region_submap_short_info_data_64_t RegionInfo;
+ enum { kRegionInfoSize = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64 };
+#else
+ typedef vm_region_submap_info_data_64_t RegionInfo;
+ enum { kRegionInfoSize = VM_REGION_SUBMAP_INFO_COUNT_64 };
+#endif
+ task_t task = mach_task_self();
+ mach_vm_address_t vm_region_base_addr;
+ mach_vm_size_t vm_region_size;
+ natural_t vm_region_depth;
+ RegionInfo vm_region_info;
+
+ ((range_contains_data_callback_info_t *)info->baton)->unique = true;
+
+ for (vm_region_base_addr = 0, vm_region_size = 1; vm_region_size != 0; vm_region_base_addr += vm_region_size)
+ {
+ mach_msg_type_number_t vm_region_info_size = kRegionInfoSize;
+ const kern_return_t err = mach_vm_region_recurse (task,
+ &vm_region_base_addr,
+ &vm_region_size,
+ &vm_region_depth,
+ (vm_region_recurse_info_t)&vm_region_info,
+ &vm_region_info_size);
+ if (err)
+ break;
+ // Check all read + write regions. This will cover the thread stacks
+ // and any regions of memory that aren't covered by the heap
+ if (vm_region_info.protection & VM_PROT_WRITE &&
+ vm_region_info.protection & VM_PROT_READ)
+ {
+ //printf ("checking vm_region: [0x%16.16llx - 0x%16.16llx)\n", (uint64_t)vm_region_base_addr, (uint64_t)vm_region_base_addr + vm_region_size);
+ range_info_callback (task,
+ info->baton,
+ stack_logging_type_vm_region,
+ vm_region_base_addr,
+ vm_region_size);
+ }
+ }
+ }
}
//----------------------------------------------------------------------
@@ -635,8 +701,8 @@
if (ptr_addr <= info->addr && info->addr < end_addr)
{
++info->match_count;
- malloc_match match = { (void *)ptr_addr, ptr_size, info->addr - ptr_addr };
- g_matches.push_back(match);
+ malloc_match match = { (void *)ptr_addr, ptr_size, info->addr - ptr_addr, type };
+ g_matches.push_back(match, info->unique);
}
break;
@@ -659,8 +725,8 @@
if (memcmp (buffer, ptr_data, size) == 0)
{
++info->match_count;
- malloc_match match = { (void *)ptr_addr, ptr_size, addr - ptr_addr };
- g_matches.push_back(match);
+ malloc_match match = { (void *)ptr_addr, ptr_size, addr - ptr_addr, type };
+ g_matches.push_back(match, info->unique);
}
}
}
@@ -714,8 +780,8 @@
{
//printf (" success\n");
++info->match_count;
- malloc_match match = { (void *)ptr_addr, ptr_size, 0 };
- g_matches.push_back(match);
+ malloc_match match = { (void *)ptr_addr, ptr_size, 0, type };
+ g_matches.push_back(match, info->unique);
}
else
{
@@ -830,7 +896,7 @@
// blocks.
//----------------------------------------------------------------------
malloc_match *
-find_pointer_in_heap (const void * addr)
+find_pointer_in_heap (const void * addr, int check_vm_regions)
{
g_matches.clear();
// Setup "info" to look for a malloc block that contains data
@@ -844,8 +910,11 @@
data_info.data.align = sizeof(addr); // Align to a pointer byte size
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
- range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
+ data_info.unique = false; // Set to true when iterating on the vm_regions
+ range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info, check_vm_regions };
foreach_zone_in_this_process (&info);
+
+
}
return g_matches.data();
}
@@ -869,6 +938,7 @@
data_info.data.align = sizeof(addr); // Align to a pointer byte size
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
+ data_info.unique = false; // Set to true when iterating on the vm_regions
range_info_callback (mach_task_self(), &data_info, stack_logging_type_generic, memory_addr, memory_size);
return g_matches.data();
}
@@ -881,7 +951,7 @@
// inherit from 'c'
//----------------------------------------------------------------------
malloc_match *
-find_objc_objects_in_memory (void *isa)
+find_objc_objects_in_memory (void *isa, int check_vm_regions)
{
g_matches.clear();
if (g_objc_classes.Update())
@@ -894,7 +964,8 @@
data_info.objc.match_superclasses = true;
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
- range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
+ data_info.unique = false; // Set to true when iterating on the vm_regions
+ range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info, check_vm_regions };
foreach_zone_in_this_process (&info);
}
return g_matches.data();
@@ -920,7 +991,9 @@
data_info.type = eDataTypeHeapInfo; // Check each block for data
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
- range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
+ data_info.unique = false; // Set to true when iterating on the vm_regions
+ const int check_vm_regions = false;
+ range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info, check_vm_regions };
foreach_zone_in_this_process (&info);
// Sort and print byte total bytes
@@ -949,7 +1022,7 @@
// Finds a C string inside one or more currently valid malloc blocks.
//----------------------------------------------------------------------
malloc_match *
-find_cstring_in_heap (const char *s)
+find_cstring_in_heap (const char *s, int check_vm_regions)
{
g_matches.clear();
if (s == NULL || s[0] == '\0')
@@ -966,7 +1039,8 @@
data_info.data.align = 1; // Data doesn't need to be aligned, so set the alignment to 1
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
- range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
+ data_info.unique = false; // Set to true when iterating on the vm_regions
+ range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info, check_vm_regions };
foreach_zone_in_this_process (&info);
return g_matches.data();
}
@@ -977,7 +1051,7 @@
// Find the malloc block that whose address range contains "addr".
//----------------------------------------------------------------------
malloc_match *
-find_block_for_address (const void *addr)
+find_block_for_address (const void *addr, int check_vm_regions)
{
g_matches.clear();
// Setup "info" to look for a malloc block that contains data
@@ -987,7 +1061,8 @@
data_info.addr = (uintptr_t)addr; // What data? The C string passed in
data_info.match_count = 0; // Initialize the match count to zero
data_info.done = false; // Set done to false so searching doesn't stop
- range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
+ data_info.unique = false; // Set to true when iterating on the vm_regions
+ range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info, check_vm_regions };
foreach_zone_in_this_process (&info);
return g_matches.data();
}
Modified: lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py (original)
+++ lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py Mon Oct 15 11:27:58 2012
@@ -32,8 +32,12 @@
if not(self.sys_params.types_cache.NSUInteger):
if self.sys_params.is_64_bit:
self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
else:
self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
+ if not(self.sys_params.types_cache.uint32):
+ self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
self.update();
def update(self):
@@ -44,21 +48,22 @@
# the count is stored in the set itself, 3 pointers into it
# otherwise, it will store a pointer to an additional data structure (2 pointers into itself) and this
# additional structure will contain the count two pointers deep
- # to distinguish the two modes, one reads two pointers deep into the object data: if only the MSB
- # is set, then we are in mode 1, using that area to store flags, otherwise, the read pointer is the
- # location to go look for count in mode 2
+ # a bunch of flags allow us to detect an empty set, vs. a one-range set, vs. a multi-range set
def count(self):
logger = lldb.formatters.Logger.Logger()
mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser",
- 2*self.sys_params.pointer_size,
- self.sys_params.types_cache.NSUInteger)
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.uint32)
mode_chooser = mode_chooser_vo.GetValueAsUnsigned(0)
if self.sys_params.is_64_bit:
- mode_chooser = mode_chooser & 0xFFFFFFFFFFFFFF00
- else:
- mode_chooser = mode_chooser & 0xFFFFFF00
- if mode_chooser == 0:
+ mode_chooser = mode_chooser & 0x00000000FFFFFFFF
+ # empty set
+ if mode_chooser & 0x01 == 1:
+ return 0
+ # single range
+ if mode_chooser & 0x02 == 2:
mode = 1
+ # multi range
else:
mode = 2
if mode == 1:
@@ -66,9 +71,11 @@
3*self.sys_params.pointer_size,
self.sys_params.types_cache.NSUInteger)
else:
- count_ptr = mode_chooser_vo.GetValueAsUnsigned(0)
+ count_ptr = self.valobj.CreateChildAtOffset("count_ptr",
+ 2*self.sys_params.pointer_size,
+ self.sys_params.types_cache.NSUInteger)
count_vo = self.valobj.CreateValueFromAddress("count",
- count_ptr+2*self.sys_params.pointer_size,
+ count_ptr.GetValueAsUnsigned()+2*self.sys_params.pointer_size,
self.sys_params.types_cache.NSUInteger)
return count_vo.GetValueAsUnsigned(0)
Modified: lldb/branches/windows/include/lldb/API/LLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/LLDB.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/LLDB.h (original)
+++ lldb/branches/windows/include/lldb/API/LLDB.h Mon Oct 15 11:27:58 2012
@@ -26,6 +26,7 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBData.h"
#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
Modified: lldb/branches/windows/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBBreakpoint.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/branches/windows/include/lldb/API/SBBreakpoint.h Mon Oct 15 11:27:58 2012
@@ -64,6 +64,12 @@
bool
IsEnabled ();
+ void
+ SetOneShot (bool one_shot);
+
+ bool
+ IsOneShot () const;
+
bool
IsInternal ();
Modified: lldb/branches/windows/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBCommandInterpreter.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/API/SBCommandInterpreter.h Mon Oct 15 11:27:58 2012
@@ -11,6 +11,7 @@
#define LLDB_SBCommandInterpreter_h_
#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBDebugger.h"
namespace lldb {
@@ -67,6 +68,15 @@
lldb::SBProcess
GetProcess ();
+
+ lldb::SBDebugger
+ GetDebugger ();
+
+ lldb::SBCommand
+ AddMultiwordCommand (const char* name, const char* help);
+
+ lldb::SBCommand
+ AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help);
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
@@ -101,6 +111,9 @@
SetCommandOverrideCallback (const char *command_name,
lldb::CommandOverrideCallback callback,
void *baton);
+
+ SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr); // Access using SBDebugger::GetCommandInterpreter();
+
protected:
lldb_private::CommandInterpreter &
@@ -114,14 +127,58 @@
private:
friend class SBDebugger;
- SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr); // Access using SBDebugger::GetCommandInterpreter();
-
static void
InitializeSWIG ();
lldb_private::CommandInterpreter *m_opaque_ptr;
};
+class SBCommandPluginInterface
+{
+public:
+ virtual bool
+ DoExecute (lldb::SBDebugger debugger,
+ char** command,
+ lldb::SBCommandReturnObject &result)
+ {
+ return false;
+ }
+
+ virtual
+ ~SBCommandPluginInterface ()
+ {}
+};
+
+class SBCommand
+{
+public:
+
+ SBCommand ();
+
+ bool
+ IsValid ();
+
+ const char*
+ GetName ();
+
+ const char*
+ GetHelp ();
+
+ lldb::SBCommand
+ AddMultiwordCommand (const char* name, const char* help = NULL);
+
+ lldb::SBCommand
+ AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help = NULL);
+
+private:
+
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+ SBCommand (lldb::CommandObjectSP cmd_sp);
+
+ lldb::CommandObjectSP m_opaque_sp;
+};
} // namespace lldb
Modified: lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h Mon Oct 15 11:27:58 2012
@@ -74,6 +74,9 @@
void
AppendMessage (const char *message);
+ void
+ AppendWarning (const char *message);
+
bool
GetDescription (lldb::SBStream &description);
Modified: lldb/branches/windows/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBDebugger.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBDebugger.h (original)
+++ lldb/branches/windows/include/lldb/API/SBDebugger.h Mon Oct 15 11:27:58 2012
@@ -295,11 +295,12 @@
private:
+ friend class SBCommandInterpreter;
friend class SBInputReader;
+ friend class SBListener;
friend class SBProcess;
friend class SBSourceManager;
friend class SBTarget;
- friend class SBListener;
lldb::SBTarget
FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
Modified: lldb/branches/windows/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBDefines.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBDefines.h (original)
+++ lldb/branches/windows/include/lldb/API/SBDefines.h Mon Oct 15 11:27:58 2012
@@ -29,12 +29,15 @@
class SBBreakpoint;
class SBBreakpointLocation;
class SBBroadcaster;
+class SBCommand;
class SBCommandInterpreter;
+class SBCommandPluginInterface;
class SBCommandReturnObject;
class SBCommunication;
class SBCompileUnit;
class SBData;
class SBDebugger;
+class SBDeclaration;
class SBError;
class SBEvent;
class SBEventList;
Modified: lldb/branches/windows/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBError.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBError.h (original)
+++ lldb/branches/windows/include/lldb/API/SBError.h Mon Oct 15 11:27:58 2012
@@ -66,7 +66,6 @@
protected:
- friend class SBArguments;
friend class SBData;
friend class SBDebugger;
friend class SBCommunication;
Modified: lldb/branches/windows/include/lldb/API/SBEvent.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBEvent.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBEvent.h (original)
+++ lldb/branches/windows/include/lldb/API/SBEvent.h Mon Oct 15 11:27:58 2012
@@ -74,6 +74,7 @@
friend class SBBreakpoint;
friend class SBDebugger;
friend class SBProcess;
+ friend class SBThread;
SBEvent (lldb::EventSP &event_sp);
Modified: lldb/branches/windows/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBFileSpec.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBFileSpec.h (original)
+++ lldb/branches/windows/include/lldb/API/SBFileSpec.h Mon Oct 15 11:27:58 2012
@@ -58,6 +58,7 @@
friend class SBAttachInfo;
friend class SBBlock;
friend class SBCompileUnit;
+ friend class SBDeclaration;
friend class SBFileSpecList;
friend class SBHostOS;
friend class SBLaunchInfo;
Modified: lldb/branches/windows/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBProcess.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBProcess.h (original)
+++ lldb/branches/windows/include/lldb/API/SBProcess.h Mon Oct 15 11:27:58 2012
@@ -116,7 +116,10 @@
SetSelectedThread (const lldb::SBThread &thread);
bool
- SetSelectedThreadByID (uint32_t tid);
+ SetSelectedThreadByID (uint32_t tid); // DEPRECATED
+
+ bool
+ SetSelectedThreadByID (lldb::tid_t tid);
bool
SetSelectedThreadByIndexID (uint32_t index_id);
Modified: lldb/branches/windows/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBStream.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBStream.h (original)
+++ lldb/branches/windows/include/lldb/API/SBStream.h Mon Oct 15 11:27:58 2012
@@ -65,6 +65,7 @@
friend class SBCompileUnit;
friend class SBData;
friend class SBDebugger;
+ friend class SBDeclaration;
friend class SBEvent;
friend class SBFileSpec;
friend class SBFileSpecList;
Modified: lldb/branches/windows/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBThread.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBThread.h (original)
+++ lldb/branches/windows/include/lldb/API/SBThread.h Mon Oct 15 11:27:58 2012
@@ -21,6 +21,17 @@
class SBThread
{
public:
+ enum
+ {
+ eBroadcastBitStackChanged = (1 << 0),
+ eBroadcastBitThreadSuspended = (1 << 1),
+ eBroadcastBitThreadResumed = (1 << 2),
+ eBroadcastBitSelectedFrameChanged = (1 << 3)
+ };
+
+ static const char *
+ GetBroadcasterClassName ();
+
SBThread ();
SBThread (const lldb::SBThread &thread);
@@ -146,6 +157,15 @@
lldb::SBFrame
SetSelectedFrame (uint32_t frame_idx);
+
+ static bool
+ EventIsThreadEvent (const SBEvent &event);
+
+ static SBFrame
+ GetStackFrameFromEvent (const SBEvent &event);
+
+ static SBThread
+ GetThreadFromEvent (const SBEvent &event);
lldb::SBProcess
GetProcess ();
@@ -161,6 +181,9 @@
bool
GetDescription (lldb::SBStream &description) const;
+
+ bool
+ GetStatus (lldb::SBStream &status) const;
protected:
friend class SBBreakpoint;
Modified: lldb/branches/windows/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBType.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBType.h (original)
+++ lldb/branches/windows/include/lldb/API/SBType.h Mon Oct 15 11:27:58 2012
@@ -105,6 +105,12 @@
lldb::SBType
GetUnqualifiedType();
+ // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
+ // type eBasicTypeInvalid will be returned
+ lldb::BasicType
+ GetBasicType();
+
+ // The call below confusing and should really be renamed to "CreateBasicType"
lldb::SBType
GetBasicType(lldb::BasicType type);
Modified: lldb/branches/windows/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBValue.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBValue.h (original)
+++ lldb/branches/windows/include/lldb/API/SBValue.h Mon Oct 15 11:27:58 2012
@@ -269,6 +269,9 @@
lldb::SBData
GetData ();
+ lldb::SBDeclaration
+ GetDeclaration ();
+
uint32_t
GetNumChildren ();
Modified: lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h Mon Oct 15 11:27:58 2012
@@ -356,6 +356,20 @@
//------------------------------------------------------------------
+ /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
+ //------------------------------------------------------------------
+ void
+ SetOneShot (bool one_shot);
+
+ //------------------------------------------------------------------
+ /// Check the OneShot state.
+ /// @return
+ /// \b true if the breakpoint is one shot, \b false otherwise.
+ //------------------------------------------------------------------
+ bool
+ IsOneShot () const;
+
+ //------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
/// @param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
Modified: lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h Mon Oct 15 11:27:58 2012
@@ -67,7 +67,8 @@
void *baton,
bool enabled = true,
int32_t ignore = 0,
- lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
+ lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID,
+ bool one_shot = false);
virtual ~BreakpointOptions();
@@ -195,13 +196,39 @@
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool
- IsEnabled () const;
+ IsEnabled () const
+ {
+ return m_enabled;
+ }
+
+ //------------------------------------------------------------------
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ //------------------------------------------------------------------
+ void
+ SetEnabled (bool enabled)
+ {
+ m_enabled = enabled;
+ }
+
+ //------------------------------------------------------------------
+ /// Check the One-shot state.
+ /// @return
+ /// \b true if the breakpoint is one-shot, \b false otherwise.
+ //------------------------------------------------------------------
+ bool
+ IsOneShot () const
+ {
+ return m_one_shot;
+ }
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void
- SetEnabled (bool enabled);
+ SetOneShot (bool one_shot)
+ {
+ m_one_shot = one_shot;
+ }
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
@@ -210,7 +237,10 @@
//------------------------------------------------------------------
void
- SetIgnoreCount (uint32_t n);
+ SetIgnoreCount (uint32_t n)
+ {
+ m_ignore_count = n;
+ }
//------------------------------------------------------------------
/// Return the current Ignore Count.
@@ -218,7 +248,10 @@
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t
- GetIgnoreCount () const;
+ GetIgnoreCount () const
+ {
+ return m_ignore_count;
+ }
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return NULL if the no thread
@@ -314,6 +347,7 @@
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;
bool m_enabled;
+ bool m_one_shot;
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
std::auto_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
std::auto_ptr<ClangUserExpression> m_condition_ap; // The condition to test.
Modified: lldb/branches/windows/include/lldb/Core/Broadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Broadcaster.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Broadcaster.h (original)
+++ lldb/branches/windows/include/lldb/Core/Broadcaster.h Mon Oct 15 11:27:58 2012
@@ -430,6 +430,10 @@
void
RestoreBroadcaster ();
+ // This needs to be filled in if you are going to register the broadcaster with the broadcaster
+ // manager and do broadcaster class matching.
+ // FIXME: Probably should make a ManagedBroadcaster subclass with all the bits needed to work
+ // with the BroadcasterManager, so that it is clearer how to add one.
virtual ConstString &GetBroadcasterClass() const;
BroadcasterManager *GetManager();
Modified: lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h (original)
+++ lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h Mon Oct 15 11:27:58 2012
@@ -60,6 +60,9 @@
bool
NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
+ bool
+ RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream);
+
template bool
NSDictionarySummaryProvider<true> (ValueObject&, Stream&) ;
Modified: lldb/branches/windows/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Debugger.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Debugger.h (original)
+++ lldb/branches/windows/include/lldb/Core/Debugger.h Mon Oct 15 11:27:58 2012
@@ -17,6 +17,9 @@
#include <stack>
#include "lldb/lldb-public.h"
+
+#include "lldb/API/SBDefines.h"
+
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/FormatManager.h"
@@ -318,6 +321,11 @@
{
return m_instance_name;
}
+
+ typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
+
+ bool
+ LoadPlugin (const FileSpec& spec);
protected:
@@ -356,7 +364,12 @@
LogStreamMap m_log_streams;
lldb::StreamSP m_log_callback_stream_sp;
ConstString m_instance_name;
-
+ typedef std::vector<lldb::DynamicLibrarySP> LoadedPluginsList;
+ LoadedPluginsList m_loaded_plugins;
+
+ void
+ InstanceInitialize ();
+
private:
// Use Debugger::CreateInstance() to get a shared pointer to a new
Modified: lldb/branches/windows/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/FormatManager.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/FormatManager.h (original)
+++ lldb/branches/windows/include/lldb/Core/FormatManager.h Mon Oct 15 11:27:58 2012
@@ -294,7 +294,7 @@
Enable (bool value,
uint32_t position)
{
- Mutex::Locker(m_mutex);
+ Mutex::Locker locker(m_mutex);
m_enabled = value;
m_enabled_position = position;
if (m_change_listener)
@@ -358,7 +358,7 @@
Add (KeyType name,
const ValueSP& entry)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
m_map[name] = entry;
if (listener)
listener->Changed();
@@ -367,7 +367,7 @@
bool
Delete (KeyType name)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.find(name);
if (iter == m_map.end())
return false;
@@ -382,7 +382,7 @@
Enable (KeyType category_name,
Position pos = Default)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
ValueSP category;
if (!Get(category_name,category))
return false;
@@ -392,7 +392,7 @@
bool
Disable (KeyType category_name)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
ValueSP category;
if (!Get(category_name,category))
return false;
@@ -403,7 +403,7 @@
Enable (ValueSP category,
Position pos = Default)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
if (category.get())
{
Position pos_w = pos;
@@ -432,7 +432,7 @@
bool
Disable (ValueSP category)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
if (category.get())
{
m_active_categories.remove_if(delete_matching_categories(category));
@@ -445,7 +445,7 @@
void
Clear ()
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
m_map.clear();
m_active_categories.clear();
if (listener)
@@ -456,7 +456,7 @@
Get (KeyType name,
ValueSP& entry)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.find(name);
if (iter == m_map.end())
return false;
@@ -468,7 +468,7 @@
Get (uint32_t pos,
ValueSP& entry)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.begin();
MapIterator end = m_map.end();
while (pos > 0)
Modified: lldb/branches/windows/include/lldb/Core/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/FormatNavigator.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/FormatNavigator.h (original)
+++ lldb/branches/windows/include/lldb/Core/FormatNavigator.h Mon Oct 15 11:27:58 2012
@@ -129,7 +129,7 @@
else
entry->GetRevision() = 0;
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
m_map[name] = entry;
if (listener)
listener->Changed();
@@ -138,7 +138,7 @@
bool
Delete (KeyType name)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.find(name);
if (iter == m_map.end())
return false;
@@ -151,7 +151,7 @@
void
Clear ()
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
m_map.clear();
if (listener)
listener->Changed();
@@ -161,7 +161,7 @@
Get(KeyType name,
ValueSP& entry)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.find(name);
if (iter == m_map.end())
return false;
@@ -174,7 +174,7 @@
{
if (callback)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator pos, end = m_map.end();
for (pos = m_map.begin(); pos != end; pos++)
{
@@ -194,7 +194,7 @@
ValueSP
GetValueAtIndex (uint32_t index)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.begin();
MapIterator end = m_map.end();
while (index > 0)
@@ -210,7 +210,7 @@
KeyType
GetKeyAtIndex (uint32_t index)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator iter = m_map.begin();
MapIterator end = m_map.end();
while (index > 0)
@@ -504,14 +504,14 @@
log->Printf("no valid ObjC runtime, skipping dynamic");
return false;
}
- ObjCLanguageRuntime::ObjCISA isa = runtime->GetISA(valobj);
- if (runtime->IsValidISA(isa) == false)
+ ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (runtime->GetClassDescriptor(valobj));
+ if (!objc_class_sp)
{
if (log)
log->Printf("invalid ISA, skipping dynamic");
return false;
}
- ConstString name = runtime->GetActualTypeName(isa);
+ ConstString name (objc_class_sp->GetClassName());
if (log)
log->Printf("dynamic type inferred is %s - looking for direct dynamic match", name.GetCString());
if (Get(name, entry))
Modified: lldb/branches/windows/include/lldb/Core/Log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Log.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Log.h (original)
+++ lldb/branches/windows/include/lldb/Core/Log.h Mon Oct 15 11:27:58 2012
@@ -44,6 +44,7 @@
#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP (1u << 4)
#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5)
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6)
+#define LLDB_LOG_OPTION_BACKTRACE (1U << 7)
//----------------------------------------------------------------------
// Logging Functions
Modified: lldb/branches/windows/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ValueObject.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObject.h Mon Oct 15 11:27:58 2012
@@ -1086,7 +1086,7 @@
bool
HasChildAtIndex (uint32_t idx)
{
- Mutex::Locker(m_mutex);
+ Mutex::Locker locker(m_mutex);
ChildrenIterator iter = m_children.find(idx);
ChildrenIterator end = m_children.end();
return (iter != end);
@@ -1095,7 +1095,7 @@
ValueObject*
GetChildAtIndex (uint32_t idx)
{
- Mutex::Locker(m_mutex);
+ Mutex::Locker locker(m_mutex);
ChildrenIterator iter = m_children.find(idx);
ChildrenIterator end = m_children.end();
if (iter == end)
@@ -1108,7 +1108,7 @@
SetChildAtIndex (uint32_t idx, ValueObject* valobj)
{
ChildrenPair pair(idx,valobj); // we do not need to be mutex-protected to make a pair
- Mutex::Locker(m_mutex);
+ Mutex::Locker locker(m_mutex);
m_children.insert(pair);
}
@@ -1128,7 +1128,7 @@
Clear()
{
m_children_count = 0;
- Mutex::Locker(m_mutex);
+ Mutex::Locker locker(m_mutex);
m_children.clear();
}
Modified: lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h Mon Oct 15 11:27:58 2012
@@ -101,6 +101,14 @@
virtual lldb::ValueObjectSP
GetNonSyntheticValue ();
+ virtual bool
+ ResolveValue (Scalar &scalar)
+ {
+ if (m_parent)
+ return m_parent->ResolveValue(scalar);
+ return false;
+ }
+
protected:
virtual bool
UpdateValue ();
@@ -110,6 +118,9 @@
virtual lldb::clang_type_t
GetClangTypeImpl ();
+
+ virtual void
+ CreateSynthFilter ();
// we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
lldb::SyntheticChildrenSP m_synth_sp;
@@ -124,6 +135,8 @@
ByIndexMap m_children_byindex;
NameToIndexMap m_name_toindex;
uint32_t m_synthetic_children_count; // FIXME use the ValueObject's ChildrenManager instead of a special purpose solution
+
+ ConstString m_parent_type_name;
private:
friend class ValueObject;
Modified: lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h Mon Oct 15 11:27:58 2012
@@ -20,7 +20,7 @@
class Function;
class Instruction;
class Module;
- class TargetData;
+ class DataLayout;
class Value;
}
Modified: lldb/branches/windows/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRForTarget.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRForTarget.h Mon Oct 15 11:27:58 2012
@@ -28,7 +28,7 @@
class Instruction;
class Module;
class StoreInst;
- class TargetData;
+ class DataLayout;
class Type;
class Value;
}
@@ -661,7 +661,7 @@
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::auto_ptr<llvm::TargetData> m_target_data; ///< The target data for the module being processed, or NULL if there is no module.
+ std::auto_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; ///< If non-NULL, the allocator to use for constant strings
llvm::Constant *m_CFStringCreateWithBytes; ///< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type
Copied: lldb/branches/windows/include/lldb/Host/DynamicLibrary.h (from r165938, lldb/trunk/include/lldb/Host/DynamicLibrary.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/DynamicLibrary.h?p2=lldb/branches/windows/include/lldb/Host/DynamicLibrary.h&p1=lldb/trunk/include/lldb/Host/DynamicLibrary.h&r1=165938&r2=165942&rev=165942&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/DynamicLibrary.h (original)
+++ lldb/branches/windows/include/lldb/Host/DynamicLibrary.h Mon Oct 15 11:27:58 2012
@@ -24,7 +24,11 @@
~DynamicLibrary ();
- template <typename T = void*>
+ template <typename T
+#ifndef _MSC_VER
+ = void*
+#endif
+ >
T GetSymbol (const char* name)
{
Error err;
Modified: lldb/branches/windows/include/lldb/Host/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/Symbols.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Symbols.h (original)
+++ lldb/branches/windows/include/lldb/Host/Symbols.h Mon Oct 15 11:27:58 2012
@@ -50,11 +50,15 @@
// Locate the object and symbol file given a module specification.
//
// Locating the file can try to download the file from a corporate build
- // respository, or using any other meeans necessary to locate both the
- // unstripped object file and the debug symbols.
+ // respository, or using any other means necessary to locate both the
+ // unstripped object file and the debug symbols.
+ // The force_lookup argument controls whether the external program is called
+ // unconditionally to find the symbol file, or if the user's settings are
+ // checked to see if they've enabled the external program before calling.
+ //
//----------------------------------------------------------------------
static bool
- DownloadObjectAndSymbolFile (ModuleSpec &module_spec);
+ DownloadObjectAndSymbolFile (ModuleSpec &module_spec, bool force_lookup = true);
};
Modified: lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h Mon Oct 15 11:27:58 2012
@@ -412,13 +412,6 @@
FindCommandsForApropos (const char *word,
StringList &commands_found,
StringList &commands_help);
-
- void
- AproposAllSubCommands (CommandObject *cmd_obj,
- const char *prefix,
- const char *search_word,
- StringList &commands_found,
- StringList &commands_help);
bool
GetBatchCommandMode () { return m_batch_command_mode; }
Modified: lldb/branches/windows/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandObject.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandObject.h Mon Oct 15 11:27:58 2012
@@ -133,7 +133,7 @@
// 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() { return false; }
+ IsRemovable() const { return false; }
bool
IsAlias () { return m_is_alias; }
@@ -144,6 +144,42 @@
virtual bool
IsMultiwordObject () { return false; }
+ virtual lldb::CommandObjectSP
+ GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL)
+ {
+ return lldb::CommandObjectSP();
+ }
+
+ virtual CommandObject *
+ GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL)
+ {
+ return NULL;
+ }
+
+ virtual void
+ AproposAllSubCommands (const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help)
+ {
+ }
+
+ virtual void
+ GenerateHelpText (CommandReturnObject &result)
+ {
+ }
+
+ // this is needed in order to allow the SBCommand class to
+ // transparently try and load subcommands - it will fail on
+ // anything but a multiword command, but it avoids us doing
+ // type checkings and casts
+ virtual bool
+ LoadSubCommand (const char *cmd_name,
+ const lldb::CommandObjectSP& command_obj)
+ {
+ return false;
+ }
+
virtual bool
WantsRawCommandString() = 0;
Modified: lldb/branches/windows/include/lldb/Interpreter/CommandObjectCrossref.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandObjectCrossref.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandObjectCrossref.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandObjectCrossref.h Mon Oct 15 11:27:58 2012
@@ -34,7 +34,7 @@
virtual
~CommandObjectCrossref ();
- void
+ virtual void
GenerateHelpText (CommandReturnObject &result);
virtual bool
Modified: lldb/branches/windows/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandObjectMultiword.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandObjectMultiword.h Mon Oct 15 11:27:58 2012
@@ -42,19 +42,25 @@
virtual bool
IsMultiwordObject () { return true; }
- bool
+ virtual bool
LoadSubCommand (const char *cmd_name,
const lldb::CommandObjectSP& command_obj);
- void
+ virtual void
GenerateHelpText (CommandReturnObject &result);
- lldb::CommandObjectSP
+ virtual lldb::CommandObjectSP
GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
- CommandObject *
+ virtual CommandObject *
GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
+ virtual void
+ AproposAllSubCommands (const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help);
+
virtual bool
WantsRawCommandString() { return false; };
@@ -72,9 +78,114 @@
virtual bool
Execute (const char *args_string,
CommandReturnObject &result);
+
+ virtual bool
+ IsRemovable() const { return m_can_be_removed; }
+
+ void
+ SetRemovable (bool removable)
+ {
+ m_can_be_removed = removable;
+ }
+
protected:
CommandObject::CommandMap m_subcommand_dict;
+ bool m_can_be_removed;
+};
+
+
+class CommandObjectProxy : public CommandObject
+{
+public:
+ CommandObjectProxy (CommandInterpreter &interpreter,
+ const char *name,
+ const char *help = NULL,
+ const char *syntax = NULL,
+ uint32_t flags = 0);
+
+ virtual
+ ~CommandObjectProxy ();
+
+ // Subclasses must provide a command object that will be transparently
+ // used for this object.
+ virtual CommandObject *
+ GetProxyCommandObject() = 0;
+
+ virtual const char *
+ GetHelpLong ();
+
+ virtual void
+ AddObject (const char *obj_name);
+
+ virtual bool
+ IsCrossRefObject ();
+
+ virtual bool
+ IsRemovable() const;
+
+ virtual bool
+ IsMultiwordObject ();
+
+ virtual lldb::CommandObjectSP
+ GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
+
+ virtual CommandObject *
+ GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
+
+ virtual void
+ AproposAllSubCommands (const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help);
+
+ virtual bool
+ LoadSubCommand (const char *cmd_name,
+ const lldb::CommandObjectSP& command_obj);
+
+ virtual bool
+ WantsRawCommandString();
+
+ virtual bool
+ WantsCompletion();
+
+ virtual Options *
+ GetOptions ();
+
+
+ virtual int
+ HandleCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches);
+
+ virtual int
+ HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches);
+
+ virtual const char *
+ GetRepeatCommand (Args ¤t_command_args,
+ uint32_t index);
+
+ virtual bool
+ Execute (const char *args_string,
+ CommandReturnObject &result);
+
+protected:
+
+ // These two want to iterate over the subcommand dictionary.
+ friend class CommandInterpreter;
+ friend class CommandObjectSyntax;
+
};
} // namespace lldb_private
Modified: lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h Mon Oct 15 11:27:58 2012
@@ -274,6 +274,9 @@
lldb::clang_type_t
GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl);
+ static lldb::BasicType
+ GetLLDBBasicTypeEnumeration (lldb::clang_type_t clang_type);
+
//------------------------------------------------------------------
// CVR modifiers
//------------------------------------------------------------------
Modified: lldb/branches/windows/include/lldb/Symbol/VariableList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/VariableList.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/VariableList.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/VariableList.h Mon Oct 15 11:27:58 2012
@@ -50,11 +50,6 @@
lldb::VariableSP
FindVariable (const ConstString& name);
- // Find the argument variable that represents the language specific
- // object pointer ("this" in C++, or "self" in Objective C).
- lldb::VariableSP
- FindArtificialObjectVariable (lldb::LanguageType language) const;
-
uint32_t
FindVariableIndex (const lldb::VariableSP &var_sp);
Modified: lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h Mon Oct 15 11:27:58 2012
@@ -98,17 +98,10 @@
virtual uint64_t
GetInstanceSize () = 0;
- virtual bool
- IsRealized ()
- {
- // anything other than some instances of v2 classes are always realized
- return true;
- }
-
// use to implement version-specific additional constraints on pointers
virtual bool
CheckPointer (lldb::addr_t value,
- uint32_t ptr_size)
+ uint32_t ptr_size) const
{
return true;
}
@@ -135,7 +128,7 @@
uint32_t ptr_size,
bool allow_NULLs = false,
bool allow_tagged = false,
- bool check_version_specific = false);
+ bool check_version_specific = false) const;
private:
LazyBool m_is_kvo;
@@ -167,8 +160,10 @@
GetISA () { return 0; }
virtual bool
- CheckPointer (lldb::addr_t value,
- uint32_t ptr_size) { return false; }
+ CheckPointer (lldb::addr_t value, uint32_t ptr_size) const
+ {
+ return false;
+ }
virtual
~ClassDescriptor_Invalid ()
@@ -177,16 +172,19 @@
};
virtual ClassDescriptorSP
- GetClassDescriptor (ValueObject& in_value)
- {
- return ClassDescriptorSP();
- }
+ GetClassDescriptor (ValueObject& in_value);
+ ClassDescriptorSP
+ GetNonKVOClassDescriptor (ValueObject& in_value);
+
virtual ClassDescriptorSP
- GetClassDescriptor (ObjCISA isa)
- {
- return ClassDescriptorSP();
- }
+ GetClassDescriptor (const ConstString &class_name);
+
+ virtual ClassDescriptorSP
+ GetClassDescriptor (ObjCISA isa);
+
+ ClassDescriptorSP
+ GetNonKVOClassDescriptor (ObjCISA isa);
virtual
~ObjCLanguageRuntime();
@@ -208,7 +206,7 @@
virtual lldb::ThreadPlanSP
GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) = 0;
-
+
lldb::addr_t
LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t sel);
@@ -236,17 +234,15 @@
return eObjC_VersionUnknown;
}
- virtual bool
- IsValidISA(ObjCISA isa) = 0;
-
- virtual ObjCISA
- GetISA(ValueObject& valobj) = 0;
-
- virtual void
- UpdateISAToDescriptorMap_Impl()
+ bool
+ IsValidISA(ObjCISA isa)
{
- // to be implemented by runtimes if they support doing this
+ UpdateISAToDescriptorMap();
+ return m_isa_to_descriptor_cache.count(isa) > 0;
}
+
+ virtual bool
+ UpdateISAToDescriptorMap_Impl() = 0;
void
UpdateISAToDescriptorMap()
@@ -254,9 +250,7 @@
if (m_isa_to_descriptor_cache_is_up_to_date)
return;
- m_isa_to_descriptor_cache_is_up_to_date = true;
-
- UpdateISAToDescriptorMap_Impl();
+ m_isa_to_descriptor_cache_is_up_to_date = UpdateISAToDescriptorMap_Impl();
}
virtual ObjCISA
Modified: lldb/branches/windows/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Process.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Process.h (original)
+++ lldb/branches/windows/include/lldb/Target/Process.h Mon Oct 15 11:27:58 2012
@@ -1585,6 +1585,26 @@
}
//------------------------------------------------------------------
+ /// Return a multi-word command object that can be used to expose
+ /// plug-in specific commands.
+ ///
+ /// This object will be used to resolve plug-in commands and can be
+ /// triggered by a call to:
+ ///
+ /// (lldb) process commmand <args>
+ ///
+ /// @return
+ /// A CommandObject which can be one of the concrete subclasses
+ /// of CommandObject like CommandObjectRaw, CommandObjectParsed,
+ /// or CommandObjectMultiword.
+ //------------------------------------------------------------------
+ virtual CommandObject *
+ GetPluginCommandObject()
+ {
+ return NULL;
+ }
+
+ //------------------------------------------------------------------
/// Launch a new process.
///
/// Launch a new process by spawning a new process using the
@@ -1679,8 +1699,22 @@
virtual Error
Attach (ProcessAttachInfo &attach_info);
+ //------------------------------------------------------------------
+ /// Attach to a remote system via a URL
+ ///
+ /// @param[in] strm
+ /// A stream where output intended for the user
+ /// (if the driver has a way to display that) generated during
+ /// the connection. This may be NULL if no output is needed.A
+ ///
+ /// @param[in] remote_url
+ /// The URL format that we are connecting to.
+ ///
+ /// @return
+ /// Returns an error object.
+ //------------------------------------------------------------------
virtual Error
- ConnectRemote (const char *remote_url);
+ ConnectRemote (Stream *strm, const char *remote_url);
bool
GetShouldDetach () const
@@ -1902,8 +1936,22 @@
return Error();
}
+ //------------------------------------------------------------------
+ /// Attach to a remote system via a URL
+ ///
+ /// @param[in] strm
+ /// A stream where output intended for the user
+ /// (if the driver has a way to display that) generated during
+ /// the connection. This may be NULL if no output is needed.A
+ ///
+ /// @param[in] remote_url
+ /// The URL format that we are connecting to.
+ ///
+ /// @return
+ /// Returns an error object.
+ //------------------------------------------------------------------
virtual Error
- DoConnectRemote (const char *remote_url)
+ DoConnectRemote (Stream *strm, const char *remote_url)
{
Error error;
error.SetErrorString ("remote connections are not supported");
@@ -2525,7 +2573,7 @@
/// Read a NULL terminated C string from memory
///
/// This function will read a cache page at a time until the NULL
- /// C stirng terminator is found. It will stop reading if the NULL
+ /// C string terminator is found. It will stop reading if the NULL
/// termination byte isn't found before reading \a cstr_max_len
/// bytes, and the results are always guaranteed to be NULL
/// terminated (at most cstr_max_len - 1 bytes will be read).
Modified: lldb/branches/windows/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Thread.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Thread.h (original)
+++ lldb/branches/windows/include/lldb/Target/Thread.h Mon Oct 15 11:27:58 2012
@@ -12,6 +12,8 @@
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Core/Broadcaster.h"
+#include "lldb/Core/Event.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Target/ExecutionContextScope.h"
@@ -47,15 +49,89 @@
typedef STD_SHARED_PTR(ThreadProperties) ThreadPropertiesSP;
-
class Thread :
public STD_ENABLE_SHARED_FROM_THIS(Thread),
public ThreadProperties,
public UserID,
- public ExecutionContextScope
+ public ExecutionContextScope,
+ public Broadcaster
{
+friend class ThreadEventData;
+
public:
- // TODO: You shouldn't just checkpoint the register state alone, so this should get
+ //------------------------------------------------------------------
+ /// Broadcaster event bits definitions.
+ //------------------------------------------------------------------
+ enum
+ {
+ eBroadcastBitStackChanged = (1 << 0),
+ eBroadcastBitThreadSuspended = (1 << 1),
+ eBroadcastBitThreadResumed = (1 << 2),
+ eBroadcastBitSelectedFrameChanged = (1 << 3)
+ };
+
+ static ConstString &GetStaticBroadcasterClass ();
+
+ virtual ConstString &GetBroadcasterClass() const
+ {
+ return GetStaticBroadcasterClass();
+ }
+
+ class ThreadEventData :
+ public EventData
+ {
+ public:
+ ThreadEventData (const lldb::ThreadSP thread_sp);
+
+ ThreadEventData (const lldb::ThreadSP thread_sp, const StackID &stack_id);
+
+ ThreadEventData();
+
+ virtual ~ThreadEventData();
+
+ static const ConstString &
+ GetFlavorString ();
+
+ virtual const ConstString &
+ GetFlavor () const
+ {
+ return ThreadEventData::GetFlavorString ();
+ }
+
+ virtual void
+ Dump (Stream *s) const;
+
+ static const ThreadEventData *
+ GetEventDataFromEvent (const Event *event_ptr);
+
+ static lldb::ThreadSP
+ GetThreadFromEvent (const Event *event_ptr);
+
+ static StackID
+ GetStackIDFromEvent (const Event *event_ptr);
+
+ static lldb::StackFrameSP
+ GetStackFrameFromEvent (const Event *event_ptr);
+
+ lldb::ThreadSP
+ GetThread () const
+ {
+ return m_thread_sp;
+ }
+
+ StackID
+ GetStackID () const
+ {
+ return m_stack_id;
+ }
+
+ private:
+ lldb::ThreadSP m_thread_sp;
+ StackID m_stack_id;
+ DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
+ };
+
+ // TODO: You shouldn't just checkpoint the register state alone, so this should get
// moved to protected. To do that ThreadStateCheckpoint needs to be returned as a token...
class RegisterCheckpoint
{
@@ -141,7 +217,7 @@
static const ThreadPropertiesSP &
GetGlobalProperties();
- Thread (const lldb::ProcessSP &process_sp, lldb::tid_t tid);
+ Thread (Process &process, lldb::tid_t tid);
virtual ~Thread();
lldb::ProcessSP
@@ -289,10 +365,10 @@
}
Error
- ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp);
+ ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast = false);
Error
- ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp);
+ ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast = false);
virtual lldb::StackFrameSP
GetFrameWithStackID (const StackID &stack_id)
@@ -314,16 +390,10 @@
}
uint32_t
- SetSelectedFrame (lldb_private::StackFrame *frame)
- {
- return GetStackFrameList()->SetSelectedFrame(frame);
- }
+ SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast = false);
bool
- SetSelectedFrameByIndex (uint32_t frame_idx)
- {
- return GetStackFrameList()->SetSelectedFrameByIndex(frame_idx);
- }
+ SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast = false);
void
SetDefaultFileAndLineToSelectedFrame()
@@ -557,6 +627,9 @@
bool
PlanIsBasePlan (ThreadPlan *plan_ptr);
+ void
+ BroadcastSelectedFrameChange(StackID &new_frame_id);
+
public:
//------------------------------------------------------------------
Modified: lldb/branches/windows/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-enumerations.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-enumerations.h (original)
+++ lldb/branches/windows/include/lldb/lldb-enumerations.h Mon Oct 15 11:27:58 2012
@@ -537,7 +537,10 @@
eBasicTypeVoid = 1,
eBasicTypeChar,
eBasicTypeSignedChar,
+ eBasicTypeUnsignedChar,
eBasicTypeWChar,
+ eBasicTypeSignedWChar,
+ eBasicTypeUnsignedWChar,
eBasicTypeChar16,
eBasicTypeChar32,
eBasicTypeShort,
@@ -551,6 +554,7 @@
eBasicTypeInt128,
eBasicTypeUnsignedInt128,
eBasicTypeBool,
+ eBasicTypeHalf,
eBasicTypeFloat,
eBasicTypeDouble,
eBasicTypeLongDouble,
@@ -559,7 +563,9 @@
eBasicTypeLongDoubleComplex,
eBasicTypeObjCID,
eBasicTypeObjCClass,
- eBasicTypeObjCSel
+ eBasicTypeObjCSel,
+ eBasicTypeNullPtr,
+ eBasicTypeOther
} BasicType;
typedef enum TypeClass
Modified: lldb/branches/windows/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-forward.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-forward.h (original)
+++ lldb/branches/windows/include/lldb/lldb-forward.h Mon Oct 15 11:27:58 2012
@@ -94,6 +94,7 @@
class Debugger;
class Declaration;
class Disassembler;
+class DynamicLibrary;
class DynamicLoader;
class EmulateInstruction;
class Error;
@@ -289,6 +290,7 @@
typedef STD_SHARED_PTR(lldb_private::Debugger) DebuggerSP;
typedef STD_WEAK_PTR( lldb_private::Debugger) DebuggerWP;
typedef STD_SHARED_PTR(lldb_private::Disassembler) DisassemblerSP;
+ typedef STD_SHARED_PTR(lldb_private::DynamicLibrary) DynamicLibrarySP;
typedef STD_SHARED_PTR(lldb_private::DynamicLoader) DynamicLoaderSP;
typedef STD_SHARED_PTR(lldb_private::Event) EventSP;
typedef STD_SHARED_PTR(lldb_private::ExecutionContextRef) ExecutionContextRefSP;
Modified: lldb/branches/windows/include/lldb/lldb-private-log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-private-log.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-private-log.h (original)
+++ lldb/branches/windows/include/lldb/lldb-private-log.h Mon Oct 15 11:27:58 2012
@@ -40,6 +40,7 @@
#define LIBLLDB_LOG_COMMANDS (1U << 18)
#define LIBLLDB_LOG_TYPES (1u << 19)
#define LIBLLDB_LOG_SYMBOLS (1u << 20)
+#define LIBLLDB_LOG_MODULES (1u << 21)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
Modified: lldb/branches/windows/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lib/Makefile?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/lib/Makefile (original)
+++ lldb/branches/windows/lib/Makefile Mon Oct 15 11:27:58 2012
@@ -85,9 +85,13 @@
endif
ifeq ($(HOST_OS),Linux)
- USEDLIBS += lldbPluginProcessPOSIX.a \
+ USEDLIBS += lldbHostLinux.a \
lldbPluginProcessLinux.a \
- lldbHostLinux.a
+ lldbPluginProcessPOSIX.a \
+ lldbPluginDynamicLoaderMacOSX.a \
+ lldbPluginDynamicLoaderDarwinKernel.a \
+ lldbPluginOperatingSystemDarwinKernel.a
+
endif
ifeq ($(HOST_OS),FreeBSD)
Modified: lldb/branches/windows/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lldb.xcodeproj/project.pbxproj?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/lldb.xcodeproj/project.pbxproj Mon Oct 15 11:27:58 2012
@@ -484,6 +484,7 @@
26FFC19C14FC072100087D58 /* DYLDRendezvous.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FFC19614FC072100087D58 /* DYLDRendezvous.h */; };
26FFC19D14FC072100087D58 /* DynamicLoaderPOSIXDYLD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FFC19714FC072100087D58 /* DynamicLoaderPOSIXDYLD.cpp */; };
26FFC19E14FC072100087D58 /* DynamicLoaderPOSIXDYLD.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FFC19814FC072100087D58 /* DynamicLoaderPOSIXDYLD.h */; };
+ 490A966B1628C3BF00F0002E /* SBDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9452573816262CEF00325455 /* SBDeclaration.h */; settings = {ATTRIBUTES = (Public, ); }; };
494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494260D914579144003C1C78 /* VerifyDecl.cpp */; };
4966DCC4148978A10028481B /* ClangExternalASTSourceCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4966DCC3148978A10028481B /* ClangExternalASTSourceCommon.cpp */; };
49A1CAC51430E8DE00306AC9 /* ExpressionSourceCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49A1CAC31430E8BD00306AC9 /* ExpressionSourceCode.cpp */; };
@@ -515,6 +516,8 @@
941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568914E355F2003A195C /* SBTypeSynthetic.h */; settings = {ATTRIBUTES = (Public, ); }; };
9443B122140C18C40013457C /* SBData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9443B121140C18C10013457C /* SBData.cpp */; };
9443B123140C26AB0013457C /* SBData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9443B120140C18A90013457C /* SBData.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 9452573A16262D0200325455 /* SBDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9452573916262D0200325455 /* SBDeclaration.cpp */; };
+ 9456F2241616671900656F91 /* DynamicLibrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9456F2211616644B00656F91 /* DynamicLibrary.cpp */; };
94611EB213CCA4A4003A22AF /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94611EB113CCA4A4003A22AF /* RefCounter.cpp */; };
9461569A14E358A6003A195C /* SBTypeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568A14E35621003A195C /* SBTypeFilter.cpp */; };
9461569B14E358A6003A195C /* SBTypeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568B14E35621003A195C /* SBTypeFormat.cpp */; };
@@ -527,6 +530,8 @@
9475C18914E5EA08001BFC6D /* SBTypeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */; settings = {ATTRIBUTES = (Public, ); }; };
9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */; };
9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 947A1D641616476B0017C8D1 /* CommandObjectPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */; };
+ 947A1D651616476B0017C8D1 /* CommandObjectPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; };
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };
94CDEB9D15F0258500DD2A7A /* CXXFormatterFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CDEB9C15F0258400DD2A7A /* CXXFormatterFunctions.cpp */; };
@@ -1504,6 +1509,11 @@
9415F61713B2C0EF00A52B36 /* FormatManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = FormatManager.cpp; path = source/Core/FormatManager.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
9443B120140C18A90013457C /* SBData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBData.h; path = include/lldb/API/SBData.h; sourceTree = "<group>"; };
9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; 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>"; };
+ 9456F2211616644B00656F91 /* DynamicLibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLibrary.cpp; sourceTree = "<group>"; };
+ 9456F2231616645A00656F91 /* DynamicLibrary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DynamicLibrary.h; path = include/lldb/Host/DynamicLibrary.h; sourceTree = "<group>"; };
94611EAF13CCA363003A22AF /* RefCounter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RefCounter.h; path = include/lldb/Utility/RefCounter.h; sourceTree = "<group>"; };
94611EB113CCA4A4003A22AF /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCounter.cpp; path = source/Utility/RefCounter.cpp; sourceTree = "<group>"; };
9461568614E355F2003A195C /* SBTypeFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeFilter.h; path = include/lldb/API/SBTypeFilter.h; sourceTree = "<group>"; };
@@ -1530,6 +1540,8 @@
9475C18B14E5F818001BFC6D /* SBTypeNameSpecifier.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeNameSpecifier.i; sourceTree = "<group>"; };
9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeNameSpecifier.h; path = include/lldb/API/SBTypeNameSpecifier.h; sourceTree = "<group>"; };
9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeNameSpecifier.cpp; path = source/API/SBTypeNameSpecifier.cpp; sourceTree = "<group>"; };
+ 947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectPlugin.cpp; path = source/Commands/CommandObjectPlugin.cpp; sourceTree = "<group>"; };
+ 947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectPlugin.h; path = source/Commands/CommandObjectPlugin.h; sourceTree = "<group>"; };
949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectConstResultImpl.h; path = include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = "<group>"; };
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = source/Core/ValueObjectConstResultImpl.cpp; sourceTree = "<group>"; };
94A8287514031D05006C37A8 /* FormatNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatNavigator.h; path = include/lldb/Core/FormatNavigator.h; sourceTree = "<group>"; };
@@ -2010,6 +2022,7 @@
2611FEF7142D83060017FEA3 /* SBCompileUnit.i */,
2611FEF8142D83060017FEA3 /* SBData.i */,
2611FEF9142D83060017FEA3 /* SBDebugger.i */,
+ 9452573616262CD000325455 /* SBDeclaration.i */,
2611FEFA142D83060017FEA3 /* SBError.i */,
2611FEFB142D83060017FEA3 /* SBEvent.i */,
2611FEFC142D83060017FEA3 /* SBFileSpec.i */,
@@ -2099,6 +2112,8 @@
9443B121140C18C10013457C /* SBData.cpp */,
9A9830FB1125FC5800A56CB0 /* SBDebugger.h */,
9A9830FA1125FC5800A56CB0 /* SBDebugger.cpp */,
+ 9452573816262CEF00325455 /* SBDeclaration.h */,
+ 9452573916262D0200325455 /* SBDeclaration.cpp */,
2682F286115EF3BD00CCFF99 /* SBError.h */,
2682F284115EF3A700CCFF99 /* SBError.cpp */,
9A9830FE1125FC5800A56CB0 /* SBEvent.h */,
@@ -2163,8 +2178,8 @@
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */,
9A357582116CFDEE00E8ED2F /* SBValueList.h */,
9A35758D116CFE0F00E8ED2F /* SBValueList.cpp */,
- B2A58723143119D50092BFBA /* SBWatchpoint.cpp */,
B2A58721143119810092BFBA /* SBWatchpoint.h */,
+ B2A58723143119D50092BFBA /* SBWatchpoint.cpp */,
);
name = API;
sourceTree = "<group>";
@@ -2741,6 +2756,8 @@
26BC7E3610F1B84700F91463 /* CommandObjectMemory.cpp */,
26879CE51333F5750012C1F8 /* CommandObjectPlatform.h */,
26879CE71333F58B0012C1F8 /* CommandObjectPlatform.cpp */,
+ 947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */,
+ 947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */,
26BC7D1F10F1B76300F91463 /* CommandObjectProcess.h */,
26BC7E3810F1B84700F91463 /* CommandObjectProcess.cpp */,
26BC7D2010F1B76300F91463 /* CommandObjectQuit.h */,
@@ -2822,6 +2839,7 @@
26BC7EE510F1B88100F91463 /* MacOSX */,
26BC7DD210F1B7D500F91463 /* Condition.h */,
266F5CBB12FC846200DFCE33 /* Config.h */,
+ 9456F2231616645A00656F91 /* DynamicLibrary.h */,
26BC7DD310F1B7D500F91463 /* Endian.h */,
260C6EA013011578005E16B0 /* File.h */,
26FA4315130103F400E71120 /* FileSpec.h */,
@@ -3274,6 +3292,7 @@
69A01E1A1236C5D400C660B5 /* common */ = {
isa = PBXGroup;
children = (
+ 9456F2211616644B00656F91 /* DynamicLibrary.cpp */,
260C6EA213011581005E16B0 /* File.cpp */,
26FA43171301048600E71120 /* FileSpec.cpp */,
69A01E1B1236C5D400C660B5 /* Condition.cpp */,
@@ -3325,10 +3344,12 @@
26DE205511618FB800A093E2 /* SBCompileUnit.h in Headers */,
9443B123140C26AB0013457C /* SBData.h in Headers */,
26680220115FD13D008E1FE4 /* SBDebugger.h in Headers */,
+ 490A966B1628C3BF00F0002E /* SBDeclaration.h in Headers */,
26680221115FD13D008E1FE4 /* SBDefines.h in Headers */,
26680222115FD13D008E1FE4 /* SBError.h in Headers */,
26680223115FD13D008E1FE4 /* SBEvent.h in Headers */,
26680224115FD13D008E1FE4 /* SBFileSpec.h in Headers */,
+ 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
26680225115FD13D008E1FE4 /* SBFrame.h in Headers */,
26DE205311618FAC00A093E2 /* SBFunction.h in Headers */,
9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */,
@@ -3339,6 +3360,7 @@
26680227115FD13D008E1FE4 /* SBListener.h in Headers */,
26DE204F11618E9800A093E2 /* SBModule.h in Headers */,
2668022A115FD13D008E1FE4 /* SBProcess.h in Headers */,
+ 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
2668022B115FD13D008E1FE4 /* SBSourceManager.h in Headers */,
26C72C94124322890068DC16 /* SBStream.h in Headers */,
9A357671116E7B5200E8ED2F /* SBStringList.h in Headers */,
@@ -3356,11 +3378,9 @@
941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */,
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */,
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */,
+ B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */,
26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */,
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */,
- 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
- 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
- B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3399,6 +3419,7 @@
2697A39515E404BA003E682C /* OptionValueArch.h in Headers */,
2698699D15E6CBD0002415FF /* OperatingSystemPython.h in Headers */,
260D9B2715EC369500960137 /* ModuleSpec.h in Headers */,
+ 947A1D651616476B0017C8D1 /* CommandObjectPlugin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3751,6 +3772,7 @@
2660AAB914622483003A9694 /* LLDBWrapPython.cpp in Sources */,
9475C18814E5E9FA001BFC6D /* SBTypeCategory.cpp in Sources */,
9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */,
+ 9452573A16262D0200325455 /* SBDeclaration.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3758,6 +3780,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 9456F2241616671900656F91 /* DynamicLibrary.cpp in Sources */,
49C8507C1384A786007DB519 /* ProcessDataAllocator.cpp in Sources */,
2689FFDA13353D9D00698AC0 /* lldb.cpp in Sources */,
2689FFDB13353DA300698AC0 /* lldb-log.cpp in Sources */,
@@ -4119,6 +4142,7 @@
94EA1D5C15E6C9B400D4171A /* PythonDataObjects.cpp in Sources */,
2698699B15E6CBD0002415FF /* OperatingSystemPython.cpp in Sources */,
94CDEB9D15F0258500DD2A7A /* CXXFormatterFunctions.cpp in Sources */,
+ 947A1D641616476B0017C8D1 /* CommandObjectPlugin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -4278,12 +4302,13 @@
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
LLVM_CONFIGURATION = "Release+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
+ MACOSX_DEPLOYMENT_TARGET = "";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-flimit-debug-info",
"-Wparentheses",
);
- SDKROOT = macosx;
+ SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4336,12 +4361,13 @@
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
LLVM_CONFIGURATION = Release;
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
+ MACOSX_DEPLOYMENT_TARGET = "";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-flimit-debug-info",
"-Wparentheses",
);
- SDKROOT = macosx;
+ SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4522,7 +4548,6 @@
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -4540,7 +4565,6 @@
CURRENT_PROJECT_VERSION = 168;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -4558,7 +4582,6 @@
CURRENT_PROJECT_VERSION = 168;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -4582,7 +4605,6 @@
HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CPLUSPLUSFLAGS = (
"-fno-rtti",
"-Wglobal-constructors",
@@ -4613,7 +4635,6 @@
HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CPLUSPLUSFLAGS = (
"-fno-rtti",
"-Wglobal-constructors",
@@ -4644,7 +4665,6 @@
HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CPLUSPLUSFLAGS = (
"-fno-rtti",
"-Wglobal-constructors",
@@ -4709,11 +4729,12 @@
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
LLVM_CONFIGURATION = Release;
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
+ MACOSX_DEPLOYMENT_TARGET = "";
OTHER_CFLAGS = (
"-flimit-debug-info",
"-Wparentheses",
);
- SDKROOT = macosx;
+ SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -5188,12 +5209,13 @@
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
LLVM_CONFIGURATION = "Debug+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
+ MACOSX_DEPLOYMENT_TARGET = "";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-flimit-debug-info",
"-Wparentheses",
);
- SDKROOT = macosx;
+ SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -5341,7 +5363,6 @@
HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CPLUSPLUSFLAGS = (
"-fno-rtti",
"-Wglobal-constructors",
@@ -5510,7 +5531,6 @@
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
Modified: lldb/branches/windows/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/build-swig-Python.sh?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/windows/scripts/Python/build-swig-Python.sh Mon Oct 15 11:27:58 2012
@@ -104,7 +104,7 @@
" ${SRC_ROOT}/include/lldb/API/SBTypeSynthetic.h"\
" ${SRC_ROOT}/include/lldb/API/SBValue.h"\
" ${SRC_ROOT}/include/lldb/API/SBValueList.h"\
-" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\
+" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"
INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\
@@ -117,6 +117,7 @@
" ${SRC_ROOT}/scripts/Python/interface/SBCompileUnit.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBData.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBDebugger.i"\
+" ${SRC_ROOT}/scripts/Python/interface/SBDeclaration.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBError.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBEvent.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBFileSpec.i"\
Modified: lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i Mon Oct 15 11:27:58 2012
@@ -119,6 +119,12 @@
bool
IsEnabled ();
+ void
+ SetOneShot (bool one_shot);
+
+ bool
+ IsOneShot ();
+
bool
IsInternal ();
Modified: lldb/branches/windows/scripts/Python/interface/SBCommandInterpreter.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBCommandInterpreter.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBCommandInterpreter.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBCommandInterpreter.i Mon Oct 15 11:27:58 2012
@@ -101,6 +101,9 @@
lldb::SBProcess
GetProcess ();
+
+ lldb::SBDebugger
+ GetDebugger ();
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
Modified: lldb/branches/windows/scripts/Python/interface/SBCommandReturnObject.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBCommandReturnObject.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBCommandReturnObject.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBCommandReturnObject.i Mon Oct 15 11:27:58 2012
@@ -65,6 +65,9 @@
void
AppendMessage (const char *message);
+ void
+ AppendWarning (const char *message);
+
bool
GetDescription (lldb::SBStream &description);
Modified: lldb/branches/windows/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBProcess.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBProcess.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBProcess.i Mon Oct 15 11:27:58 2012
@@ -158,7 +158,7 @@
SetSelectedThread (const lldb::SBThread &thread);
bool
- SetSelectedThreadByID (uint32_t tid);
+ SetSelectedThreadByID (lldb::tid_t tid);
bool
SetSelectedThreadByIndexID (uint32_t index_id);
@@ -364,8 +364,9 @@
def get_process_thread_list(self):
'''An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.'''
threads = []
- for idx in range(self.GetNumThreads()):
- threads.append(self.threads_access(idx))
+ accessor = self.get_threads_access_object()
+ for idx in range(len(accessor)):
+ threads.append(accessor[idx])
return threads
__swig_getmethods__["threads"] = get_process_thread_list
Modified: lldb/branches/windows/scripts/Python/interface/SBStream.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBStream.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBStream.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBStream.i Mon Oct 15 11:27:58 2012
@@ -68,9 +68,15 @@
size_t
GetSize();
- void
- Printf (const char *format, ...);
-
+ // wrapping the variadic Printf() with a plain Print()
+ // because it is hard to support varargs in SWIG bridgings
+ %extend {
+ void Print (const char* str)
+ {
+ self->Printf("%s", str);
+ }
+ }
+
void
RedirectToFile (const char *path, bool append);
Modified: lldb/branches/windows/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBThread.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBThread.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBThread.i Mon Oct 15 11:27:58 2012
@@ -46,6 +46,15 @@
SBThread (const lldb::SBThread &thread);
~SBThread();
+
+ static bool
+ EventIsThreadEvent (const SBEvent &event);
+
+ static SBFrame
+ GetStackFrameFromEvent (const SBEvent &event);
+
+ static SBThread
+ GetThreadFromEvent (const SBEvent &event);
bool
IsValid() const;
@@ -183,6 +192,9 @@
bool
GetDescription (lldb::SBStream &description) const;
+ bool
+ GetStatus (lldb::SBStream &status) const;
+
%pythoncode %{
class frames_access(object):
'''A helper object that will lazily hand out frames for a thread when supplied an index.'''
Modified: lldb/branches/windows/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBType.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBType.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBType.i Mon Oct 15 11:27:58 2012
@@ -177,6 +177,9 @@
lldb::SBType
GetUnqualifiedType();
+ lldb::BasicType
+ GetBasicType();
+
lldb::SBType
GetBasicType (lldb::BasicType type);
Modified: lldb/branches/windows/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBValue.i?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBValue.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBValue.i Mon Oct 15 11:27:58 2012
@@ -281,6 +281,9 @@
lldb::SBValue
GetValueForExpressionPath(const char* expr_path);
+ lldb::SBDeclaration
+ GetDeclaration ();
+
uint32_t
GetNumChildren ();
Modified: lldb/branches/windows/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/python-extensions.swig?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/python-extensions.swig (original)
+++ lldb/branches/windows/scripts/Python/python-extensions.swig Mon Oct 15 11:27:58 2012
@@ -111,6 +111,20 @@
return PyString_FromString("");
}
}
+%extend lldb::SBDeclaration {
+ PyObject *lldb::SBDeclaration::__str__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description);
+ const char *desc = description.GetData();
+ size_t desc_len = description.GetSize();
+ if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
+ --desc_len;
+ if (desc_len > 0)
+ return PyString_FromStringAndSize (desc, desc_len);
+ else
+ return PyString_FromString("");
+ }
+}
%extend lldb::SBError {
PyObject *lldb::SBError::__str__ (){
lldb::SBStream description;
@@ -539,13 +553,15 @@
# Allow array access if this value has children...
if type(key) is int:
return value(self.sbvalue.GetValueForExpressionPath("[%i]" % key))
- raise TypeError
+ if type(key) is value:
+ return value(self.sbvalue.GetValueForExpressionPath("[%i]" % int(key)))
+ raise TypeError("No array item of type %s" % str(type(key)))
def __getattr__(self, name):
child_sbvalue = self.sbvalue.GetChildMemberWithName (name)
if child_sbvalue:
return value(child_sbvalue)
- raise AttributeError
+ raise AttributeError("Attribute '%s' is not defined" % name)
def __add__(self, other):
return int(self) + int(other)
@@ -690,8 +706,22 @@
return '0x%x' % self.sbvalue.GetValueAsUnsigned()
def __eq__(self, other):
- return self.sbvalue.GetValueAsUnsigned() == self.sbvalue.GetValueAsUnsigned()
-
+ if type(other) is int:
+ return int(self) == other
+ elif type(other) is str:
+ return str(self) == other
+ elif type(other) is value:
+ self_err = SBError()
+ other_err = SBError()
+ self_val = self.sbvalue.GetValueAsUnsigned(self_err)
+ if self_err.fail:
+ raise ValueError("unable to extract value of self")
+ other_val = other.sbvalue.GetValueAsUnsigned(other_err)
+ if other_err.fail:
+ raise ValueError("unable to extract value of other")
+ return self_val == other_val
+ raise TypeError("Unknown type %s, No equality operation defined." % str(type(other)))
+
def __neq__(self, other):
return not self.__eq__(other)
%}
Modified: lldb/branches/windows/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/build-llvm.pl?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/build-llvm.pl (original)
+++ lldb/branches/windows/scripts/build-llvm.pl Mon Oct 15 11:27:58 2012
@@ -129,9 +129,6 @@
{
do_command ("cd '$llvm_srcroot/tools/clang' && patch -p0 < $patch");
}
-
- print "Removing the llvm/test and llvm/tools/clang/test directories...\n";
- do_command ("cd '$llvm_srcroot' && rm -rf test && rm -rf tools/clang/test ", "removing test directories", 1);
}
# If our output file already exists then we need not generate it again.
Modified: lldb/branches/windows/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/lldb.swig?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/scripts/lldb.swig (original)
+++ lldb/branches/windows/scripts/lldb.swig Mon Oct 15 11:27:58 2012
@@ -63,6 +63,7 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBData.h"
#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
@@ -121,6 +122,7 @@
%include "./Python/interface/SBCompileUnit.i"
%include "./Python/interface/SBData.i"
%include "./Python/interface/SBDebugger.i"
+%include "./Python/interface/SBDeclaration.i"
%include "./Python/interface/SBError.i"
%include "./Python/interface/SBEvent.i"
%include "./Python/interface/SBFileSpec.i"
Modified: lldb/branches/windows/source/API/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/CMakeLists.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/CMakeLists.txt (original)
+++ lldb/branches/windows/source/API/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -12,6 +12,7 @@
SBCompileUnit.cpp
SBData.cpp
SBDebugger.cpp
+ SBDeclaration.cpp
SBError.cpp
SBEvent.cpp
SBFileSpec.cpp
Modified: lldb/branches/windows/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBBreakpoint.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBBreakpoint.cpp (original)
+++ lldb/branches/windows/source/API/SBBreakpoint.cpp Mon Oct 15 11:27:58 2012
@@ -234,6 +234,33 @@
return false;
}
+void
+SBBreakpoint::SetOneShot (bool one_shot)
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)", m_opaque_sp.get(), one_shot);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ m_opaque_sp->SetOneShot (one_shot);
+ }
+}
+
+bool
+SBBreakpoint::IsOneShot () const
+{
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ return m_opaque_sp->IsOneShot();
+ }
+ else
+ return false;
+}
+
bool
SBBreakpoint::IsInternal ()
{
Modified: lldb/branches/windows/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBCommandInterpreter.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/branches/windows/source/API/SBCommandInterpreter.cpp Mon Oct 15 11:27:58 2012
@@ -8,15 +8,14 @@
//===----------------------------------------------------------------------===//
#include "lldb/lldb-types.h"
-#include "lldb/Interpreter/Args.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/Listener.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Target.h"
#include "lldb/API/SBBroadcaster.h"
-#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBCommandInterpreter.h"
#include "lldb/API/SBProcess.h"
@@ -28,6 +27,34 @@
using namespace lldb;
using namespace lldb_private;
+class CommandPluginInterfaceImplementation : public CommandObjectParsed
+{
+public:
+ CommandPluginInterfaceImplementation (CommandInterpreter &interpreter,
+ const char *name,
+ lldb::SBCommandPluginInterface* backend,
+ const char *help = NULL,
+ const char *syntax = NULL,
+ uint32_t flags = 0) :
+ CommandObjectParsed (interpreter, name, help, syntax, flags),
+ m_backend(backend) {}
+
+ virtual bool
+ IsRemovable() const { return true; }
+
+protected:
+ virtual bool
+ DoExecute (Args& command, CommandReturnObject &result)
+ {
+ SBCommandReturnObject sb_return(&result);
+ SBCommandInterpreter sb_interpreter(&m_interpreter);
+ SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
+ bool ret = m_backend->DoExecute (debugger_sb,(char**)command.GetArgumentVector(), sb_return);
+ sb_return.Release();
+ return ret;
+ }
+ lldb::SBCommandPluginInterface* m_backend;
+};
SBCommandInterpreter::SBCommandInterpreter()
{
@@ -222,6 +249,22 @@
return sb_process;
}
+SBDebugger
+SBCommandInterpreter::GetDebugger ()
+{
+ SBDebugger sb_debugger;
+ if (m_opaque_ptr)
+ sb_debugger.reset(m_opaque_ptr->GetDebugger().shared_from_this());
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBCommandInterpreter(%p)::GetDebugger () => SBDebugger(%p)",
+ m_opaque_ptr, sb_debugger.get());
+
+
+ return sb_debugger;
+}
+
CommandInterpreter *
SBCommandInterpreter::get ()
{
@@ -372,3 +415,82 @@
}
}
+lldb::SBCommand
+SBCommandInterpreter::AddMultiwordCommand (const char* name, const char* help)
+{
+ CommandObjectMultiword *new_command = new CommandObjectMultiword(*m_opaque_ptr,name,help);
+ new_command->SetRemovable (true);
+ lldb::CommandObjectSP new_command_sp(new_command);
+ if (new_command_sp && m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
+ return lldb::SBCommand(new_command_sp);
+ return lldb::SBCommand();
+}
+
+lldb::SBCommand
+SBCommandInterpreter::AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help)
+{
+ lldb::CommandObjectSP new_command_sp;
+ new_command_sp.reset(new CommandPluginInterfaceImplementation(*m_opaque_ptr,name,impl,help));
+
+ if (new_command_sp && m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
+ return lldb::SBCommand(new_command_sp);
+ return lldb::SBCommand();
+}
+
+SBCommand::SBCommand ()
+{}
+
+SBCommand::SBCommand (lldb::CommandObjectSP cmd_sp) : m_opaque_sp (cmd_sp)
+{}
+
+bool
+SBCommand::IsValid ()
+{
+ return (bool)m_opaque_sp;
+}
+
+const char*
+SBCommand::GetName ()
+{
+ if (IsValid ())
+ return m_opaque_sp->GetCommandName ();
+ return NULL;
+}
+
+const char*
+SBCommand::GetHelp ()
+{
+ if (IsValid ())
+ return m_opaque_sp->GetHelp ();
+ return NULL;
+}
+
+lldb::SBCommand
+SBCommand::AddMultiwordCommand (const char* name, const char* help)
+{
+ if (!IsValid ())
+ return lldb::SBCommand();
+ if (m_opaque_sp->IsMultiwordObject() == false)
+ return lldb::SBCommand();
+ CommandObjectMultiword *new_command = new CommandObjectMultiword(m_opaque_sp->GetCommandInterpreter(),name,help);
+ new_command->SetRemovable (true);
+ lldb::CommandObjectSP new_command_sp(new_command);
+ if (new_command_sp && m_opaque_sp->LoadSubCommand(name,new_command_sp))
+ return lldb::SBCommand(new_command_sp);
+ return lldb::SBCommand();
+}
+
+lldb::SBCommand
+SBCommand::AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help)
+{
+ if (!IsValid ())
+ return lldb::SBCommand();
+ if (m_opaque_sp->IsMultiwordObject() == false)
+ return lldb::SBCommand();
+ lldb::CommandObjectSP new_command_sp;
+ new_command_sp.reset(new CommandPluginInterfaceImplementation(m_opaque_sp->GetCommandInterpreter(),name,impl,help));
+ if (new_command_sp && m_opaque_sp->LoadSubCommand(name,new_command_sp))
+ return lldb::SBCommand(new_command_sp);
+ return lldb::SBCommand();
+}
+
Modified: lldb/branches/windows/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBCommandReturnObject.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/branches/windows/source/API/SBCommandReturnObject.cpp Mon Oct 15 11:27:58 2012
@@ -190,6 +190,13 @@
m_opaque_ap->AppendMessage (message);
}
+void
+SBCommandReturnObject::AppendWarning (const char *message)
+{
+ if (m_opaque_ap.get())
+ m_opaque_ap->AppendWarning (message);
+}
+
CommandReturnObject *
SBCommandReturnObject::operator ->() const
{
Modified: lldb/branches/windows/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBDebugger.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBDebugger.cpp (original)
+++ lldb/branches/windows/source/API/SBDebugger.cpp Mon Oct 15 11:27:58 2012
@@ -555,7 +555,6 @@
if (m_opaque_sp)
{
FileSpec file_spec (filename, true);
- TargetSP target_sp;
const bool add_dependent_modules = true;
Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
file_spec,
Modified: lldb/branches/windows/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBProcess.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBProcess.cpp (original)
+++ lldb/branches/windows/source/API/SBProcess.cpp Mon Oct 15 11:27:58 2012
@@ -398,6 +398,12 @@
bool
SBProcess::SetSelectedThreadByID (uint32_t tid)
{
+ return SetSelectedThreadByID ((lldb::tid_t)tid);
+}
+
+bool
+SBProcess::SetSelectedThreadByID (lldb::tid_t tid)
+{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_val = false;
@@ -409,7 +415,7 @@
}
if (log)
- log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4x) => %s",
+ log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4llx) => %s",
process_sp.get(), tid, (ret_val ? "true" : "false"));
return ret_val;
@@ -1078,7 +1084,6 @@
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
process_sp.get(), num);
Modified: lldb/branches/windows/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTarget.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTarget.cpp (original)
+++ lldb/branches/windows/source/API/SBTarget.cpp Mon Oct 15 11:27:58 2012
@@ -1087,7 +1087,7 @@
if (process_sp)
{
sb_process.SetSP (process_sp);
- error.SetError (process_sp->ConnectRemote (url));
+ error.SetError (process_sp->ConnectRemote (NULL, url));
}
else
{
Modified: lldb/branches/windows/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBThread.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBThread.cpp (original)
+++ lldb/branches/windows/source/API/SBThread.cpp Mon Oct 15 11:27:58 2012
@@ -32,6 +32,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBValue.h"
@@ -39,6 +40,12 @@
using namespace lldb;
using namespace lldb_private;
+const char *
+SBThread::GetBroadcasterClassName ()
+{
+ return Thread::GetStaticBroadcasterClass().AsCString();
+}
+
//----------------------------------------------------------------------
// Constructors
//----------------------------------------------------------------------
@@ -1123,6 +1130,24 @@
return sb_frame;
}
+bool
+SBThread::EventIsThreadEvent (const SBEvent &event)
+{
+ return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL;
+}
+
+SBFrame
+SBThread::GetStackFrameFromEvent (const SBEvent &event)
+{
+ return Thread::ThreadEventData::GetStackFrameFromEvent (event.get());
+
+}
+
+SBThread
+SBThread::GetThreadFromEvent (const SBEvent &event)
+{
+ return Thread::ThreadEventData::GetThreadFromEvent (event.get());
+}
bool
SBThread::operator == (const SBThread &rhs) const
@@ -1137,6 +1162,22 @@
}
bool
+SBThread::GetStatus (SBStream &status) const
+{
+ Stream &strm = status.ref();
+
+ ExecutionContext exe_ctx (m_opaque_sp.get());
+ if (exe_ctx.HasThreadScope())
+ {
+ exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1);
+ }
+ else
+ strm.PutCString ("No status");
+
+ return true;
+}
+
+bool
SBThread::GetDescription (SBStream &description) const
{
Stream &strm = description.ref();
Modified: lldb/branches/windows/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBType.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBType.cpp (original)
+++ lldb/branches/windows/source/API/SBType.cpp Mon Oct 15 11:27:58 2012
@@ -229,24 +229,51 @@
return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getUnqualifiedType().getAsOpaquePtr()));
}
+lldb::BasicType
+SBType::GetBasicType()
+{
+ if (IsValid())
+ return ClangASTContext::GetLLDBBasicTypeEnumeration (m_opaque_sp->GetOpaqueQualType());
+ return eBasicTypeInvalid;
+}
SBType
SBType::GetBasicType(lldb::BasicType type)
{
-
if (!IsValid())
return SBType();
- clang::CanQualType base_type_qual;
+ clang::QualType base_type_qual;
switch (type)
{
+ case eBasicTypeVoid:
+ base_type_qual = m_opaque_sp->GetASTContext()->VoidTy;
+ break;
case eBasicTypeChar:
base_type_qual = m_opaque_sp->GetASTContext()->CharTy;
break;
case eBasicTypeSignedChar:
base_type_qual = m_opaque_sp->GetASTContext()->SignedCharTy;
break;
+ case eBasicTypeUnsignedChar:
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedCharTy;
+ break;
+ case eBasicTypeWChar:
+ base_type_qual = m_opaque_sp->GetASTContext()->getWCharType();
+ break;
+ case eBasicTypeSignedWChar:
+ base_type_qual = m_opaque_sp->GetASTContext()->getSignedWCharType();
+ break;
+ case eBasicTypeUnsignedWChar:
+ base_type_qual = m_opaque_sp->GetASTContext()->getUnsignedWCharType();
+ break;
+ case eBasicTypeChar16:
+ base_type_qual = m_opaque_sp->GetASTContext()->Char16Ty;
+ break;
+ case eBasicTypeChar32:
+ base_type_qual = m_opaque_sp->GetASTContext()->Char32Ty;
+ break;
case eBasicTypeShort:
base_type_qual = m_opaque_sp->GetASTContext()->ShortTy;
break;
@@ -265,30 +292,6 @@
case eBasicTypeUnsignedLong:
base_type_qual = m_opaque_sp->GetASTContext()->UnsignedLongTy;
break;
- case eBasicTypeBool:
- base_type_qual = m_opaque_sp->GetASTContext()->BoolTy;
- break;
- case eBasicTypeFloat:
- base_type_qual = m_opaque_sp->GetASTContext()->FloatTy;
- break;
- case eBasicTypeDouble:
- base_type_qual = m_opaque_sp->GetASTContext()->DoubleTy;
- break;
- case eBasicTypeObjCID:
- base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinIdTy;
- break;
- case eBasicTypeVoid:
- base_type_qual = m_opaque_sp->GetASTContext()->VoidTy;
- break;
- case eBasicTypeWChar:
- base_type_qual = m_opaque_sp->GetASTContext()->WCharTy;
- break;
- case eBasicTypeChar16:
- base_type_qual = m_opaque_sp->GetASTContext()->Char16Ty;
- break;
- case eBasicTypeChar32:
- base_type_qual = m_opaque_sp->GetASTContext()->Char32Ty;
- break;
case eBasicTypeLongLong:
base_type_qual = m_opaque_sp->GetASTContext()->LongLongTy;
break;
@@ -301,6 +304,18 @@
case eBasicTypeUnsignedInt128:
base_type_qual = m_opaque_sp->GetASTContext()->UnsignedInt128Ty;
break;
+ case eBasicTypeBool:
+ base_type_qual = m_opaque_sp->GetASTContext()->BoolTy;
+ break;
+ case eBasicTypeHalf:
+ base_type_qual = m_opaque_sp->GetASTContext()->HalfTy;
+ break;
+ case eBasicTypeFloat:
+ base_type_qual = m_opaque_sp->GetASTContext()->FloatTy;
+ break;
+ case eBasicTypeDouble:
+ base_type_qual = m_opaque_sp->GetASTContext()->DoubleTy;
+ break;
case eBasicTypeLongDouble:
base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleTy;
break;
@@ -313,12 +328,18 @@
case eBasicTypeLongDoubleComplex:
base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleComplexTy;
break;
+ case eBasicTypeObjCID:
+ base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinIdTy;
+ break;
case eBasicTypeObjCClass:
base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinClassTy;
break;
case eBasicTypeObjCSel:
base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinSelTy;
break;
+ case eBasicTypeNullPtr:
+ base_type_qual = m_opaque_sp->GetASTContext()->NullPtrTy;
+ break;
default:
return SBType();
}
Modified: lldb/branches/windows/source/API/SBTypeNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTypeNameSpecifier.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTypeNameSpecifier.cpp (original)
+++ lldb/branches/windows/source/API/SBTypeNameSpecifier.cpp Mon Oct 15 11:27:58 2012
@@ -116,6 +116,8 @@
if (IsRegex() != rhs.IsRegex())
return false;
+ if (GetName() == NULL || rhs.GetName() == NULL)
+ return false;
return (strcmp(GetName(), rhs.GetName()) == 0);
}
Modified: lldb/branches/windows/source/API/SBTypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTypeSummary.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTypeSummary.cpp (original)
+++ lldb/branches/windows/source/API/SBTypeSummary.cpp Mon Oct 15 11:27:58 2012
@@ -233,7 +233,7 @@
if (IsFunctionName() != rhs.IsFunctionName())
return false;
- if ( strcmp(GetData(), rhs.GetData()) )
+ if ( GetData() == NULL || rhs.GetData() == NULL || strcmp(GetData(), rhs.GetData()) )
return false;
return GetOptions() == rhs.GetOptions();
Modified: lldb/branches/windows/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBValue.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBValue.cpp (original)
+++ lldb/branches/windows/source/API/SBValue.cpp Mon Oct 15 11:27:58 2012
@@ -9,6 +9,7 @@
#include "lldb/API/SBValue.h"
+#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTypeFilter.h"
#include "lldb/API/SBTypeFormat.h"
@@ -28,6 +29,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/Variable.h"
@@ -1694,6 +1696,20 @@
return sb_data;
}
+lldb::SBDeclaration
+SBValue::GetDeclaration ()
+{
+ lldb::ValueObjectSP value_sp(GetSP());
+ SBDeclaration decl_sb;
+ if (value_sp)
+ {
+ Declaration decl;
+ if (value_sp->GetDeclaration(decl))
+ decl_sb.SetDeclaration(decl);
+ }
+ return decl_sb;
+}
+
lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
Modified: lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/Breakpoint.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/Breakpoint.cpp Mon Oct 15 11:27:58 2012
@@ -189,6 +189,18 @@
return m_locations.GetHitCount();
}
+bool
+Breakpoint::IsOneShot () const
+{
+ return m_options.IsOneShot();
+}
+
+void
+Breakpoint::SetOneShot (bool one_shot)
+{
+ m_options.SetOneShot (one_shot);
+}
+
void
Breakpoint::SetThreadID (lldb::tid_t thread_id)
{
Modified: lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp Mon Oct 15 11:27:58 2012
@@ -39,6 +39,7 @@
m_callback_baton_sp (),
m_callback_is_synchronous (false),
m_enabled (true),
+ m_one_shot (false),
m_ignore_count (0),
m_thread_spec_ap (NULL),
m_condition_ap()
@@ -53,6 +54,7 @@
m_callback_baton_sp (rhs.m_callback_baton_sp),
m_callback_is_synchronous (rhs.m_callback_is_synchronous),
m_enabled (rhs.m_enabled),
+ m_one_shot (rhs.m_one_shot),
m_ignore_count (rhs.m_ignore_count),
m_thread_spec_ap (NULL),
m_condition_ap (NULL)
@@ -73,6 +75,7 @@
m_callback_baton_sp = rhs.m_callback_baton_sp;
m_callback_is_synchronous = rhs.m_callback_is_synchronous;
m_enabled = rhs.m_enabled;
+ m_one_shot = rhs.m_one_shot;
m_ignore_count = rhs.m_ignore_count;
if (rhs.m_thread_spec_ap.get() != NULL)
m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
@@ -179,33 +182,6 @@
return NULL;
}
-//------------------------------------------------------------------
-// Enabled/Ignore Count
-//------------------------------------------------------------------
-bool
-BreakpointOptions::IsEnabled () const
-{
- return m_enabled;
-}
-
-void
-BreakpointOptions::SetEnabled (bool enabled)
-{
- m_enabled = enabled;
-}
-
-uint32_t
-BreakpointOptions::GetIgnoreCount () const
-{
- return m_ignore_count;
-}
-
-void
-BreakpointOptions::SetIgnoreCount (uint32_t n)
-{
- m_ignore_count = n;
-}
-
const ThreadSpec *
BreakpointOptions::GetThreadSpecNoCreate () const
{
@@ -234,7 +210,7 @@
// Figure out if there are any options not at their default value, and only print
// anything if there are:
- if (m_ignore_count != 0 || !m_enabled || (GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ()))
+ if (m_ignore_count != 0 || !m_enabled || m_one_shot || (GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ()))
{
if (level == lldb::eDescriptionLevelVerbose)
{
@@ -252,6 +228,9 @@
s->Printf("ignore: %d ", m_ignore_count);
s->Printf("%sabled ", m_enabled ? "en" : "dis");
+ if (m_one_shot)
+ s->Printf ("one-shot ");
+
if (m_thread_spec_ap.get())
m_thread_spec_ap->GetDescription (s, level);
else if (level == eDescriptionLevelBrief)
Modified: lldb/branches/windows/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointResolverName.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointResolverName.cpp Mon Oct 15 11:27:58 2012
@@ -168,9 +168,9 @@
if (context.module_sp)
{
size_t num_names = m_func_names.size();
- for (int i = 0; i < num_names; i++)
+ for (int j = 0; j < num_names; j++)
{
- uint32_t num_functions = context.module_sp->FindFunctions (m_func_names[i],
+ uint32_t num_functions = context.module_sp->FindFunctions (m_func_names[j],
NULL,
m_func_name_type_mask,
include_symbols,
@@ -183,7 +183,7 @@
if (num_functions == 0 && !filter_by_cu)
{
if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto))
- context.module_sp->FindSymbolsWithNameAndType (m_func_names[i], eSymbolTypeCode, sym_list);
+ context.module_sp->FindSymbolsWithNameAndType (m_func_names[j], eSymbolTypeCode, sym_list);
}
}
}
Modified: lldb/branches/windows/source/Commands/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CMakeLists.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Commands/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -16,6 +16,7 @@
CommandObjectMemory.cpp
CommandObjectMultiword.cpp
CommandObjectPlatform.cpp
+ CommandObjectPlugin.cpp
CommandObjectProcess.cpp
CommandObjectQuit.cpp
CommandObjectRegister.cpp
Modified: lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp Mon Oct 15 11:27:58 2012
@@ -105,7 +105,8 @@
m_catch_bp (false),
m_throw_bp (true),
m_language (eLanguageTypeUnknown),
- m_skip_prologue (eLazyBoolCalculate)
+ m_skip_prologue (eLazyBoolCalculate),
+ m_one_shot (false)
{
}
@@ -130,6 +131,11 @@
error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg);
break;
+ case 'b':
+ m_func_names.push_back (option_arg);
+ m_func_name_type_mask |= eFunctionNameTypeBase;
+ break;
+
case 'C':
m_column = Args::StringToUInt32 (option_arg, 0);
break;
@@ -138,59 +144,116 @@
m_condition.assign(option_arg);
break;
+ case 'E':
+ {
+ LanguageType language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
+
+ switch (language)
+ {
+ case eLanguageTypeC89:
+ case eLanguageTypeC:
+ case eLanguageTypeC99:
+ m_language = eLanguageTypeC;
+ break;
+ case eLanguageTypeC_plus_plus:
+ m_language = eLanguageTypeC_plus_plus;
+ break;
+ case eLanguageTypeObjC:
+ m_language = eLanguageTypeObjC;
+ break;
+ case eLanguageTypeObjC_plus_plus:
+ error.SetErrorStringWithFormat ("Set exception breakpoints separately for c++ and objective-c");
+ break;
+ case eLanguageTypeUnknown:
+ error.SetErrorStringWithFormat ("Unknown language type: '%s' for exception breakpoint", option_arg);
+ break;
+ default:
+ error.SetErrorStringWithFormat ("Unsupported language type: '%s' for exception breakpoint", option_arg);
+ }
+ }
+ break;
+
case 'f':
m_filenames.AppendIfUnique (FileSpec(option_arg, false));
break;
- case 'l':
- m_line_num = Args::StringToUInt32 (option_arg, 0);
+ case 'F':
+ m_func_names.push_back (option_arg);
+ m_func_name_type_mask |= eFunctionNameTypeFull;
break;
- case 'b':
- m_func_names.push_back (option_arg);
- m_func_name_type_mask |= eFunctionNameTypeBase;
+ case 'h':
+ {
+ bool success;
+ m_catch_bp = Args::StringToBoolean (option_arg, true, &success);
+ if (!success)
+ error.SetErrorStringWithFormat ("Invalid boolean value for on-catch option: '%s'", option_arg);
+ }
+
+ case 'i':
+ {
+ m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
+ if (m_ignore_count == UINT32_MAX)
+ error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
break;
+ }
- case 'n':
- m_func_names.push_back (option_arg);
- m_func_name_type_mask |= eFunctionNameTypeAuto;
+ case 'K':
+ {
+ bool success;
+ bool value;
+ value = Args::StringToBoolean (option_arg, true, &success);
+ if (value)
+ m_skip_prologue = eLazyBoolYes;
+ else
+ m_skip_prologue = eLazyBoolNo;
+
+ if (!success)
+ error.SetErrorStringWithFormat ("Invalid boolean value for skip prologue option: '%s'", option_arg);
+ }
+ break;
+
+ case 'l':
+ m_line_num = Args::StringToUInt32 (option_arg, 0);
break;
- case 'F':
+ case 'M':
m_func_names.push_back (option_arg);
- m_func_name_type_mask |= eFunctionNameTypeFull;
+ m_func_name_type_mask |= eFunctionNameTypeMethod;
break;
- case 'S':
+ case 'n':
m_func_names.push_back (option_arg);
- m_func_name_type_mask |= eFunctionNameTypeSelector;
+ m_func_name_type_mask |= eFunctionNameTypeAuto;
break;
- case 'M':
- m_func_names.push_back (option_arg);
- m_func_name_type_mask |= eFunctionNameTypeMethod;
+ case 'o':
+ m_one_shot = true;
break;
case 'p':
m_source_text_regexp.assign (option_arg);
break;
+ case 'q':
+ m_queue_name.assign (option_arg);
+ break;
+
case 'r':
m_func_regexp.assign (option_arg);
break;
case 's':
- {
- m_modules.AppendIfUnique (FileSpec (option_arg, false));
- break;
- }
- case 'i':
{
- m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
- if (m_ignore_count == UINT32_MAX)
- error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
+ m_modules.AppendIfUnique (FileSpec (option_arg, false));
+ break;
}
- break;
+
+ case 'S':
+ m_func_names.push_back (option_arg);
+ m_func_name_type_mask |= eFunctionNameTypeSelector;
+ break;
+
case 't' :
{
m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
@@ -198,48 +261,11 @@
error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
}
break;
+
case 'T':
m_thread_name.assign (option_arg);
break;
- case 'q':
- m_queue_name.assign (option_arg);
- break;
- case 'x':
- {
- m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
- if (m_thread_id == UINT32_MAX)
- error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
-
- }
- break;
- case 'E':
- {
- LanguageType language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
- switch (language)
- {
- case eLanguageTypeC89:
- case eLanguageTypeC:
- case eLanguageTypeC99:
- m_language = eLanguageTypeC;
- break;
- case eLanguageTypeC_plus_plus:
- m_language = eLanguageTypeC_plus_plus;
- break;
- case eLanguageTypeObjC:
- m_language = eLanguageTypeObjC;
- break;
- case eLanguageTypeObjC_plus_plus:
- error.SetErrorStringWithFormat ("Set exception breakpoints separately for c++ and objective-c");
- break;
- case eLanguageTypeUnknown:
- error.SetErrorStringWithFormat ("Unknown language type: '%s' for exception breakpoint", option_arg);
- break;
- default:
- error.SetErrorStringWithFormat ("Unsupported language type: '%s' for exception breakpoint", option_arg);
- }
- }
- break;
case 'w':
{
bool success;
@@ -248,27 +274,16 @@
error.SetErrorStringWithFormat ("Invalid boolean value for on-throw option: '%s'", option_arg);
}
break;
- case 'h':
- {
- bool success;
- m_catch_bp = Args::StringToBoolean (option_arg, true, &success);
- if (!success)
- error.SetErrorStringWithFormat ("Invalid boolean value for on-catch option: '%s'", option_arg);
- }
- case 'K':
+
+ case 'x':
{
- bool success;
- bool value;
- value = Args::StringToBoolean (option_arg, true, &success);
- if (value)
- m_skip_prologue = eLazyBoolYes;
- else
- m_skip_prologue = eLazyBoolNo;
-
- if (!success)
- error.SetErrorStringWithFormat ("Invalid boolean value for skip prologue option: '%s'", option_arg);
+ m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
+ if (m_thread_id == UINT32_MAX)
+ error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
+
}
break;
+
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -298,6 +313,7 @@
m_throw_bp = true;
m_language = eLanguageTypeUnknown;
m_skip_prologue = eLazyBoolCalculate;
+ m_one_shot = false;
}
const OptionDefinition*
@@ -331,6 +347,7 @@
bool m_throw_bp;
lldb::LanguageType m_language;
LazyBool m_skip_prologue;
+ bool m_one_shot;
};
@@ -507,6 +524,8 @@
if (!m_options.m_condition.empty())
bp->GetOptions()->SetCondition(m_options.m_condition.c_str());
+
+ bp->SetOneShot (m_options.m_one_shot);
}
if (bp)
@@ -587,6 +606,9 @@
{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', required_argument, NULL, 0, eArgTypeCount,
"Set the number of times this breakpoint is skipped before stopping." },
+ { LLDB_OPT_SET_ALL, false, "one-shot", 'o', no_argument, NULL, 0, eArgTypeNone,
+ "The breakpoint is deleted the first time it stop causes a stop." },
+
{ LLDB_OPT_SET_ALL, false, "condition", 'c', required_argument, NULL, 0, eArgTypeExpression,
"The breakpoint stops only if this condition expression evaluates to true."},
@@ -703,11 +725,13 @@
m_thread_name(),
m_queue_name(),
m_condition (),
+ m_one_shot (false),
m_enable_passed (false),
m_enable_value (false),
m_name_passed (false),
m_queue_passed (false),
- m_condition_passed (false)
+ m_condition_passed (false),
+ m_one_shot_passed (false)
{
}
@@ -744,6 +768,19 @@
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
}
break;
+ case 'o':
+ {
+ bool value, success;
+ value = Args::StringToBoolean(option_arg, false, &success);
+ if (success)
+ {
+ m_one_shot_passed = true;
+ m_one_shot = value;
+ }
+ else
+ error.SetErrorStringWithFormat("invalid boolean value '%s' passed for -o option", option_arg);
+ }
+ break;
case 't' :
{
if (option_arg[0] == '\0')
@@ -810,10 +847,12 @@
m_thread_name.clear();
m_queue_name.clear();
m_condition.clear();
+ m_one_shot = false;
m_enable_passed = false;
m_queue_passed = false;
m_name_passed = false;
m_condition_passed = false;
+ m_one_shot_passed = false;
}
const OptionDefinition*
@@ -837,11 +876,13 @@
std::string m_thread_name;
std::string m_queue_name;
std::string m_condition;
+ bool m_one_shot;
bool m_enable_passed;
bool m_enable_value;
bool m_name_passed;
bool m_queue_passed;
bool m_condition_passed;
+ bool m_one_shot_passed;
};
@@ -940,6 +981,7 @@
CommandObjectBreakpointModify::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', required_argument, NULL, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
+{ LLDB_OPT_SET_ALL, false, "one-shot", 'o', required_argument, NULL, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
{ LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose indeX matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread-id", 't', required_argument, NULL, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread-name", 'T', required_argument, NULL, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument."},
@@ -947,7 +989,7 @@
{ LLDB_OPT_SET_ALL, false, "condition", 'c', required_argument, NULL, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true."},
{ LLDB_OPT_SET_1, false, "enable", 'e', no_argument, NULL, 0, eArgTypeNone, "Enable the breakpoint."},
{ LLDB_OPT_SET_2, false, "disable", 'd', no_argument, NULL, 0, eArgTypeNone, "Disable the breakpoint."},
-{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
+{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
Modified: lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectCommands.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectCommands.cpp Mon Oct 15 11:27:58 2012
@@ -599,8 +599,7 @@
{
const std::string sub_command = args.GetArgumentAtIndex(0);
assert (sub_command.length() != 0);
- subcommand_obj_sp =
- (((CommandObjectMultiword *) cmd_obj)->GetSubcommandSP (sub_command.c_str()));
+ subcommand_obj_sp = cmd_obj->GetSubcommandSP (sub_command.c_str());
if (subcommand_obj_sp.get())
{
sub_cmd_obj = subcommand_obj_sp.get();
@@ -1186,7 +1185,7 @@
}
virtual bool
- IsRemovable ()
+ IsRemovable () const
{
return true;
}
Modified: lldb/branches/windows/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectFrame.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectFrame.cpp Mon Oct 15 11:27:58 2012
@@ -265,8 +265,9 @@
m_options.GenerateOptionUsage (result.GetErrorStream(), this);
}
}
-
- bool success = thread->SetSelectedFrameByIndex (frame_idx);
+
+ const bool broadcast = true;
+ bool success = thread->SetSelectedFrameByIndex (frame_idx, broadcast);
if (success)
{
exe_ctx.SetFrameSP(thread->GetSelectedFrame ());
Modified: lldb/branches/windows/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectHelp.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectHelp.cpp Mon Oct 15 11:27:58 2012
@@ -103,8 +103,7 @@
else
{
CommandObject *found_cmd;
- found_cmd = ((CommandObjectMultiword *) sub_cmd_obj)->GetSubcommandObject(sub_command.c_str(),
- &matches);
+ found_cmd = sub_cmd_obj->GetSubcommandObject(sub_command.c_str(), &matches);
if (found_cmd == NULL)
all_okay = false;
else if (matches.GetSize() > 1)
@@ -189,7 +188,7 @@
}
else
m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
- ((CommandObjectMultiword *) sub_cmd_obj)->GenerateHelpText (result);
+ sub_cmd_obj->GenerateHelpText (result);
}
else
{
Modified: lldb/branches/windows/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectLog.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectLog.cpp Mon Oct 15 11:27:58 2012
@@ -144,6 +144,7 @@
case 'T': log_options |= LLDB_LOG_OPTION_PREPEND_TIMESTAMP; break;
case 'p': log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break;
case 'n': log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME; break;
+ case 'S': log_options |= LLDB_LOG_OPTION_BACKTRACE; break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -215,6 +216,7 @@
{ LLDB_OPT_SET_1, false, "timestamp", 'T', no_argument, NULL, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
{ LLDB_OPT_SET_1, false, "pid-tid", 'p', no_argument, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
{ LLDB_OPT_SET_1, false, "thread-name",'n', no_argument, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
+{ LLDB_OPT_SET_1, false, "stack", 'S', no_argument, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/branches/windows/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectMultiword.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectMultiword.cpp Mon Oct 15 11:27:58 2012
@@ -307,3 +307,232 @@
return sub_command_object->GetRepeatCommand(current_command_args, index);
}
+
+void
+CommandObjectMultiword::AproposAllSubCommands (const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help)
+{
+ CommandObject::CommandMap::const_iterator pos;
+
+ for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos)
+ {
+ const char * command_name = pos->first.c_str();
+ CommandObject *sub_cmd_obj = pos->second.get();
+ StreamString complete_command_name;
+
+ complete_command_name.Printf ("%s %s", prefix, command_name);
+
+ if (sub_cmd_obj->HelpTextContainsWord (search_word))
+ {
+ commands_found.AppendString (complete_command_name.GetData());
+ commands_help.AppendString (sub_cmd_obj->GetHelp());
+ }
+
+ if (sub_cmd_obj->IsMultiwordObject())
+ sub_cmd_obj->AproposAllSubCommands (complete_command_name.GetData(),
+ search_word,
+ commands_found,
+ commands_help);
+ }
+}
+
+
+
+CommandObjectProxy::CommandObjectProxy (CommandInterpreter &interpreter,
+ const char *name,
+ const char *help,
+ const char *syntax,
+ uint32_t flags) :
+ CommandObject (interpreter, name, help, syntax, flags)
+{
+}
+
+CommandObjectProxy::~CommandObjectProxy ()
+{
+}
+
+const char *
+CommandObjectProxy::GetHelpLong ()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->GetHelpLong();
+ return NULL;
+}
+
+void
+CommandObjectProxy::AddObject (const char *obj_name)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->AddObject (obj_name);
+}
+
+bool
+CommandObjectProxy::IsCrossRefObject ()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->IsCrossRefObject();
+ return false;
+}
+
+bool
+CommandObjectProxy::IsRemovable() const
+{
+ const CommandObject *proxy_command = const_cast<CommandObjectProxy *>(this)->GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->IsRemovable();
+ return false;
+}
+
+bool
+CommandObjectProxy::IsMultiwordObject ()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->IsMultiwordObject();
+ return false;
+}
+
+lldb::CommandObjectSP
+CommandObjectProxy::GetSubcommandSP (const char *sub_cmd, StringList *matches)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->GetSubcommandSP(sub_cmd, matches);
+ return lldb::CommandObjectSP();
+}
+
+CommandObject *
+CommandObjectProxy::GetSubcommandObject (const char *sub_cmd, StringList *matches)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->GetSubcommandObject(sub_cmd, matches);
+ return NULL;
+}
+
+void
+CommandObjectProxy::AproposAllSubCommands (const char *prefix,
+ const char *search_word,
+ StringList &commands_found,
+ StringList &commands_help)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->AproposAllSubCommands (prefix,
+ search_word,
+ commands_found,
+ commands_help);
+}
+
+bool
+CommandObjectProxy::LoadSubCommand (const char *cmd_name,
+ const lldb::CommandObjectSP& command_sp)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->LoadSubCommand (cmd_name, command_sp);
+ return false;
+}
+
+bool
+CommandObjectProxy::WantsRawCommandString()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->WantsRawCommandString();
+ return false;
+}
+
+bool
+CommandObjectProxy::WantsCompletion()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->WantsCompletion();
+ return false;
+}
+
+
+Options *
+CommandObjectProxy::GetOptions ()
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->GetOptions ();
+ return NULL;
+}
+
+
+int
+CommandObjectProxy::HandleCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->HandleCompletion (input,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ word_complete,
+ matches);
+ matches.Clear();
+ return 0;
+}
+int
+CommandObjectProxy::HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->HandleArgumentCompletion (input,
+ cursor_index,
+ cursor_char_position,
+ opt_element_vector,
+ match_start_point,
+ max_return_elements,
+ word_complete,
+ matches);
+ matches.Clear();
+ return 0;
+}
+
+const char *
+CommandObjectProxy::GetRepeatCommand (Args ¤t_command_args,
+ uint32_t index)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->GetRepeatCommand (current_command_args, index);
+ return NULL;
+}
+
+bool
+CommandObjectProxy::Execute (const char *args_string,
+ CommandReturnObject &result)
+{
+ CommandObject *proxy_command = GetProxyCommandObject();
+ if (proxy_command)
+ return proxy_command->Execute (args_string, result);
+ result.AppendError ("command is not implemented");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+}
+
+
Modified: lldb/branches/windows/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectProcess.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectProcess.cpp Mon Oct 15 11:27:58 2012
@@ -1041,7 +1041,7 @@
if (process)
{
- error = process->ConnectRemote (remote_url);
+ error = process->ConnectRemote (&process->GetTarget().GetDebugger().GetOutputStream(), remote_url);
if (error.Fail())
{
@@ -1071,7 +1071,6 @@
CommandOptions m_options;
};
-
OptionDefinition
CommandObjectProcessConnect::CommandOptions::g_option_table[] =
{
@@ -1080,6 +1079,39 @@
};
//-------------------------------------------------------------------------
+// CommandObjectProcessPlugin
+//-------------------------------------------------------------------------
+#pragma mark CommandObjectProcessPlugin
+
+class CommandObjectProcessPlugin : public CommandObjectProxy
+{
+public:
+
+ CommandObjectProcessPlugin (CommandInterpreter &interpreter) :
+ CommandObjectProxy (interpreter,
+ "process plugin",
+ "Send a custom command to the current process plug-in.",
+ "process plugin <args>",
+ 0)
+ {
+ }
+
+ ~CommandObjectProcessPlugin ()
+ {
+ }
+
+ virtual CommandObject *
+ GetProxyCommandObject()
+ {
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+ if (process)
+ return process->GetPluginCommandObject();
+ return NULL;
+ }
+};
+
+
+//-------------------------------------------------------------------------
// CommandObjectProcessLoad
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLoad
@@ -1794,6 +1826,7 @@
LoadSubCommand ("status", CommandObjectSP (new CommandObjectProcessStatus (interpreter)));
LoadSubCommand ("interrupt", CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
LoadSubCommand ("kill", CommandObjectSP (new CommandObjectProcessKill (interpreter)));
+ LoadSubCommand ("plugin", CommandObjectSP (new CommandObjectProcessPlugin (interpreter)));
}
CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()
Modified: lldb/branches/windows/source/Commands/CommandObjectSyntax.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectSyntax.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectSyntax.cpp Mon Oct 15 11:27:58 2012
@@ -66,14 +66,12 @@
for (int i = 1; i < argc; ++i)
{
std::string sub_command = command.GetArgumentAtIndex (i);
- if (! cmd_obj->IsMultiwordObject())
+ if (!cmd_obj->IsMultiwordObject())
all_okay = false;
else
{
- pos = ((CommandObjectMultiword *) cmd_obj)->m_subcommand_dict.find (sub_command);
- if (pos != ((CommandObjectMultiword *) cmd_obj)->m_subcommand_dict.end())
- cmd_obj = pos->second.get();
- else
+ cmd_obj = cmd_obj->GetSubcommandObject(sub_command.c_str());
+ if (!cmd_obj)
all_okay = false;
}
}
Modified: lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectTarget.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectTarget.cpp Mon Oct 15 11:27:58 2012
@@ -1227,7 +1227,7 @@
static void
DumpModuleUUID (Stream &strm, Module *module)
{
- if (module->GetUUID().IsValid())
+ if (module && module->GetUUID().IsValid())
module->GetUUID().Dump (&strm);
else
strm.PutCString(" ");
@@ -2720,8 +2720,14 @@
}
else
{
- module->GetFileSpec().GetPath (path, sizeof(path));
- result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
+ FileSpec *module_spec_file = module_spec.GetFileSpecPtr();
+ if (module_spec_file)
+ {
+ module_spec_file->GetPath (path, sizeof(path));
+ result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
+ }
+ else
+ result.AppendError ("no module spec");
result.SetStatus (eReturnStatusFailed);
}
}
@@ -3033,6 +3039,12 @@
PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
{
+ if (module == NULL)
+ {
+ strm.PutCString("Null module");
+ return;
+ }
+
bool dump_object_name = false;
if (m_options.m_format_array.empty())
{
@@ -3855,9 +3867,9 @@
const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, false);
if (num_matches > 0)
{
- for (size_t i=0; i<num_matches; ++i)
+ for (size_t j=0; j<num_matches; ++j)
{
- Module *module = module_list.GetModulePointerAtIndex(i);
+ Module *module = module_list.GetModulePointerAtIndex(j);
if (module)
{
if (LookupInModule (m_interpreter, module, result, syntax_error))
Modified: lldb/branches/windows/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectThread.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectThread.cpp Mon Oct 15 11:27:58 2012
@@ -1338,7 +1338,8 @@
Error error;
ThreadSP thread_sp = exe_ctx.GetThreadSP();
- error = thread_sp->ReturnFromFrame (frame_sp, return_valobj_sp);
+ const bool broadcast = true;
+ error = thread_sp->ReturnFromFrame (frame_sp, return_valobj_sp, broadcast);
if (!error.Success())
{
result.AppendErrorWithFormat("Error returning from frame %d of thread %d: %s.", frame_idx, thread_sp->GetIndexID(), error.AsCString());
@@ -1346,7 +1347,6 @@
return false;
}
- thread_sp->GetStatus(result.GetOutputStream(), 0, 1, 1);
result.SetStatus (eReturnStatusSuccessFinishResult);
return true;
}
Modified: lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp (original)
+++ lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp Mon Oct 15 11:27:58 2012
@@ -164,6 +164,10 @@
uint64_t value = 0;
const char* class_name = descriptor->GetClassName().GetCString();
+
+ if (!class_name || !*class_name)
+ return false;
+
if (!strcmp(class_name,"__NSDictionaryI"))
{
Error error;
@@ -230,6 +234,10 @@
uint64_t value = 0;
const char* class_name = descriptor->GetClassName().GetCString();
+
+ if (!class_name || !*class_name)
+ return false;
+
if (!strcmp(class_name,"__NSArrayI"))
{
Error error;
@@ -290,6 +298,10 @@
uint64_t value = 0;
const char* class_name = descriptor->GetClassName().GetCString();
+
+ if (!class_name || !*class_name)
+ return false;
+
if (!strcmp(class_name,"NSConcreteData") ||
!strcmp(class_name,"NSConcreteMutableData") ||
!strcmp(class_name,"__NSCFData"))
@@ -341,6 +353,9 @@
const char* class_name = descriptor->GetClassName().GetCString();
+ if (!class_name || !*class_name)
+ return false;
+
if (!strcmp(class_name,"NSNumber") || !strcmp(class_name,"__NSCFNumber"))
{
if (descriptor->IsTagged())
@@ -461,6 +476,62 @@
}
}
+static bool
+ReadUTFBufferAndDumpToStream (uint64_t location,
+ const ProcessSP& process_sp,
+ Stream& stream)
+{
+ Error error;
+ lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024,0));
+ size_t data_read = process_sp->ReadMemoryFromInferior(location, (char*)buffer_sp->GetBytes(), 1024, error);
+ if (error.Fail())
+ {
+ stream.Printf("unable to read data");
+ return true;
+ }
+ else
+ stream.Printf("@\"");
+ if (data_read)
+ {
+ UTF16 *data_ptr = (UTF16*)buffer_sp->GetBytes();
+ UTF16 *data_end_ptr = data_ptr + 256;
+
+ while (data_ptr < data_end_ptr)
+ {
+ if (!*data_ptr)
+ {
+ data_end_ptr = data_ptr;
+ break;
+ }
+ data_ptr++;
+ }
+
+ *data_ptr = 0;
+ data_ptr = (UTF16*)buffer_sp->GetBytes();
+
+ lldb::DataBufferSP utf8_data_buffer_sp(new DataBufferHeap(1024,0));
+ UTF8* utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
+ UTF8* utf8_data_end_ptr = utf8_data_ptr + 1024;
+
+ ConvertUTF16toUTF8 ( (const UTF16**)&data_ptr,
+ data_end_ptr,
+ &utf8_data_ptr,
+ utf8_data_end_ptr,
+ lenientConversion);
+ utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
+ for (;utf8_data_ptr != utf8_data_end_ptr; utf8_data_ptr++)
+ {
+ if (!*utf8_data_ptr)
+ break;
+ stream.Printf("%c",*utf8_data_ptr);
+ }
+ stream.Printf("\"");
+ return true;
+ }
+ stream.Printf("\"");
+ return true;
+}
+
bool
lldb_private::formatters::NSStringSummaryProvider (ValueObject& valobj, Stream& stream)
{
@@ -487,6 +558,9 @@
const char* class_name = descriptor->GetClassName().GetCString();
+ if (!class_name || !*class_name)
+ return false;
+
uint64_t info_bits_location = valobj_addr + ptr_size;
if (process_sp->GetByteOrder() != lldb::eByteOrderLittle)
info_bits_location += 3;
@@ -523,56 +597,7 @@
if (error.Fail())
return false;
if (has_explicit_length and is_unicode)
- {
- lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024,0));
- size_t data_read = process_sp->ReadMemoryFromInferior(location, (char*)buffer_sp->GetBytes(), 1024, error);
- if (error.Fail())
- {
- stream.Printf("erorr reading pte");
- return true;
- }
- else
- stream.Printf("@\"");
- if (data_read)
- {
- UTF16 *data_ptr = (UTF16*)buffer_sp->GetBytes();
- UTF16 *data_end_ptr = data_ptr + 256;
-
- while (data_ptr < data_end_ptr)
- {
- if (!*data_ptr)
- {
- data_end_ptr = data_ptr;
- break;
- }
- data_ptr++;
- }
-
- *data_ptr = 0;
- data_ptr = (UTF16*)buffer_sp->GetBytes();
-
- lldb::DataBufferSP utf8_data_buffer_sp(new DataBufferHeap(1024,0));
- UTF8* utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- UTF8* utf8_data_end_ptr = utf8_data_ptr + 1024;
-
- ConvertUTF16toUTF8 ( (const UTF16**)&data_ptr,
- data_end_ptr,
- &utf8_data_ptr,
- utf8_data_end_ptr,
- lenientConversion);
- utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- for (;utf8_data_ptr != utf8_data_end_ptr; utf8_data_ptr++)
- {
- if (!*utf8_data_ptr)
- break;
- stream.Printf("%c",*utf8_data_ptr);
- }
- stream.Printf("\"");
- return true;
- }
- stream.Printf("\"");
- return true;
- }
+ return ReadUTFBufferAndDumpToStream (location, process_sp, stream);
else
{
location++;
@@ -615,106 +640,12 @@
if (error.Fail())
return false;
}
- lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024,0));
- size_t data_read = process_sp->ReadMemoryFromInferior(location, (char*)buffer_sp->GetBytes(), 1024, error);
- if (error.Fail())
- {
- stream.Printf("erorr reading pte");
- return true;
- }
- else
- stream.Printf("@\"");
- if (data_read)
- {
- UTF16 *data_ptr = (UTF16*)buffer_sp->GetBytes();
- UTF16 *data_end_ptr = data_ptr + 256;
-
- while (data_ptr < data_end_ptr)
- {
- if (!*data_ptr)
- {
- data_end_ptr = data_ptr;
- break;
- }
- data_ptr++;
- }
-
- *data_ptr = 0;
- data_ptr = (UTF16*)buffer_sp->GetBytes();
-
- lldb::DataBufferSP utf8_data_buffer_sp(new DataBufferHeap(1024,0));
- UTF8* utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- UTF8* utf8_data_end_ptr = utf8_data_ptr + 1024;
-
- ConvertUTF16toUTF8 ( (const UTF16**)&data_ptr,
- data_end_ptr,
- &utf8_data_ptr,
- utf8_data_end_ptr,
- lenientConversion);
- utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- for (;utf8_data_ptr != utf8_data_end_ptr; utf8_data_ptr++)
- {
- if (!*utf8_data_ptr)
- break;
- stream.Printf("%c",*utf8_data_ptr);
- }
- stream.Printf("\"");
- return true;
- }
- stream.Printf("\"");
- return true;
+ return ReadUTFBufferAndDumpToStream (location, process_sp, stream);
}
else if (is_special)
{
uint64_t location = valobj_addr + (ptr_size == 8 ? 12 : 8);
- lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024,0));
- size_t data_read = process_sp->ReadMemoryFromInferior(location, (char*)buffer_sp->GetBytes(), 1024, error);
- if (error.Fail())
- {
- stream.Printf("erorr reading pte");
- return true;
- }
- else
- stream.Printf("@\"");
- if (data_read)
- {
- UTF16 *data_ptr = (UTF16*)buffer_sp->GetBytes();
- UTF16 *data_end_ptr = data_ptr + 256;
-
- while (data_ptr < data_end_ptr)
- {
- if (!*data_ptr)
- {
- data_end_ptr = data_ptr;
- break;
- }
- data_ptr++;
- }
-
- *data_ptr = 0;
- data_ptr = (UTF16*)buffer_sp->GetBytes();
-
- lldb::DataBufferSP utf8_data_buffer_sp(new DataBufferHeap(1024,0));
- UTF8* utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- UTF8* utf8_data_end_ptr = utf8_data_ptr + 1024;
-
- ConvertUTF16toUTF8 ( (const UTF16**)&data_ptr,
- data_end_ptr,
- &utf8_data_ptr,
- utf8_data_end_ptr,
- lenientConversion);
- utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
- for (;utf8_data_ptr != utf8_data_end_ptr; utf8_data_ptr++)
- {
- if (!*utf8_data_ptr)
- break;
- stream.Printf("%c",*utf8_data_ptr);
- }
- stream.Printf("\"");
- return true;
- }
- stream.Printf("\"");
- return true;
+ return ReadUTFBufferAndDumpToStream (location, process_sp, stream);
}
else if (is_inline)
{
@@ -748,6 +679,13 @@
return true;
}
+bool
+lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream)
+{
+ stream.Printf("%s",valobj.GetObjectDescription());
+ return true;
+}
+
lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
SyntheticChildrenFrontEnd(*valobj_sp.get()),
m_exe_ctx_ref(),
@@ -755,39 +693,11 @@
m_data_32(NULL),
m_data_64(NULL)
{
- if (!valobj_sp)
- return;
- if (valobj_sp->IsDynamic())
- valobj_sp = valobj_sp->GetStaticValue();
- if (!valobj_sp)
- return;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Error error;
- if (valobj_sp->IsPointerType())
- {
- valobj_sp = valobj_sp->Dereference(error);
- if (error.Fail() || !valobj_sp)
- return;
- }
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
- if (m_ptr_size == 4)
- {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
- }
- else
+ if (valobj_sp)
{
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
+ m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
+ Update();
}
- if (error.Fail())
- return;
- m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
}
uint32_t
@@ -823,6 +733,42 @@
lldb_private::formatters::NSArrayMSyntheticFrontEnd::Update()
{
m_children.clear();
+ ValueObjectSP valobj_sp = m_backend.GetSP();
+ m_ptr_size = 0;
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+ if (valobj_sp->IsDynamic())
+ valobj_sp = valobj_sp->GetStaticValue();
+ if (!valobj_sp)
+ return false;
+ m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+ Error error;
+ if (valobj_sp->IsPointerType())
+ {
+ valobj_sp = valobj_sp->Dereference(error);
+ if (error.Fail() || !valobj_sp)
+ return false;
+ }
+ error.Clear();
+ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return false;
+ m_ptr_size = process_sp->GetAddressByteSize();
+ uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+ if (m_ptr_size == 4)
+ {
+ m_data_32 = new DataDescriptor_32();
+ process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
+ }
+ else
+ {
+ m_data_64 = new DataDescriptor_64();
+ process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
+ }
+ if (error.Fail())
+ return false;
return false;
}
@@ -875,31 +821,11 @@
m_items(0),
m_data_ptr(0)
{
- if (!valobj_sp)
- return;
- if (valobj_sp->IsDynamic())
- valobj_sp = valobj_sp->GetStaticValue();
- if (!valobj_sp)
- return;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Error error;
- if (valobj_sp->IsPointerType())
+ if (valobj_sp)
{
- valobj_sp = valobj_sp->Dereference(error);
- if (error.Fail() || !valobj_sp)
- return;
+ m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
+ Update();
}
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
- m_items = process_sp->ReadPointerFromMemory(data_location, error);
- if (error.Fail())
- return;
- m_data_ptr = data_location+m_ptr_size;
- m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
}
lldb_private::formatters::NSArrayISyntheticFrontEnd::~NSArrayISyntheticFrontEnd ()
@@ -925,7 +851,33 @@
bool
lldb_private::formatters::NSArrayISyntheticFrontEnd::Update()
{
+ m_ptr_size = 0;
+ m_items = 0;
+ m_data_ptr = 0;
m_children.clear();
+ ValueObjectSP valobj_sp = m_backend.GetSP();
+ if (valobj_sp->IsDynamic())
+ valobj_sp = valobj_sp->GetStaticValue();
+ if (!valobj_sp)
+ return false;
+ m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+ Error error;
+ if (valobj_sp->IsPointerType())
+ {
+ valobj_sp = valobj_sp->Dereference(error);
+ if (error.Fail() || !valobj_sp)
+ return false;
+ }
+ error.Clear();
+ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return false;
+ m_ptr_size = process_sp->GetAddressByteSize();
+ uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+ m_items = process_sp->ReadPointerFromMemory(data_location, error);
+ if (error.Fail())
+ return false;
+ m_data_ptr = data_location+m_ptr_size;
return false;
}
@@ -975,6 +927,10 @@
return NULL;
const char* class_name = descriptor->GetClassName().GetCString();
+
+ if (!class_name || !*class_name)
+ return NULL;
+
if (!strcmp(class_name,"__NSArrayI"))
{
return (new NSArrayISyntheticFrontEnd(valobj_sp));
@@ -1052,6 +1008,10 @@
return NULL;
const char* class_name = descriptor->GetClassName().GetCString();
+
+ if (!class_name || !*class_name)
+ return NULL;
+
if (!strcmp(class_name,"__NSDictionaryI"))
{
return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
@@ -1091,7 +1051,7 @@
StreamString value_fetcher_expr;
value_fetcher_expr.Printf("(id)[%s objectForKey:%s]",valobj_expr_path.GetData(),key_fetcher_expr.GetData());
StreamString object_fetcher_expr;
- object_fetcher_expr.Printf("struct { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = %s; _lldb_valgen_item.value = %s; _lldb_valgen_item;",key_fetcher_expr.GetData(),value_fetcher_expr.GetData());
+ object_fetcher_expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = %s; _lldb_valgen_item.value = %s; _lldb_valgen_item;",key_fetcher_expr.GetData(),value_fetcher_expr.GetData());
lldb::ValueObjectSP child_sp;
m_backend.GetTargetSP()->EvaluateExpression(object_fetcher_expr.GetData(), m_backend.GetFrameSP().get(), child_sp,
Target::EvaluateExpressionOptions().SetKeepInMemory(true));
@@ -1122,39 +1082,8 @@
m_data_32(NULL),
m_data_64(NULL)
{
- if (!valobj_sp)
- return;
- if (valobj_sp->IsDynamic())
- valobj_sp = valobj_sp->GetStaticValue();
- if (!valobj_sp)
- return;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Error error;
- if (valobj_sp->IsPointerType())
- {
- valobj_sp = valobj_sp->Dereference(error);
- if (error.Fail() || !valobj_sp)
- return;
- }
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
- if (m_ptr_size == 4)
- {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
- }
- else
- {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
- }
- if (error.Fail())
- return;
- m_data_ptr = data_location + m_ptr_size;
+ if (valobj_sp)
+ Update();
}
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheticFrontEnd ()
@@ -1187,6 +1116,45 @@
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update()
{
m_children.clear();
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+ m_ptr_size = 0;
+ ValueObjectSP valobj_sp = m_backend.GetSP();
+ if (!valobj_sp)
+ return false;
+ if (valobj_sp->IsDynamic())
+ valobj_sp = valobj_sp->GetStaticValue();
+ if (!valobj_sp)
+ return false;
+ m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+ Error error;
+ if (valobj_sp->IsPointerType())
+ {
+ valobj_sp = valobj_sp->Dereference(error);
+ if (error.Fail() || !valobj_sp)
+ return false;
+ }
+ error.Clear();
+ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return false;
+ m_ptr_size = process_sp->GetAddressByteSize();
+ uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+ if (m_ptr_size == 4)
+ {
+ m_data_32 = new DataDescriptor_32();
+ process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
+ }
+ else
+ {
+ m_data_64 = new DataDescriptor_64();
+ process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
+ }
+ if (error.Fail())
+ return false;
+ m_data_ptr = data_location + m_ptr_size;
return false;
}
@@ -1241,7 +1209,7 @@
{
// make the new ValueObject
StreamString expr;
- expr.Printf("struct { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
+ expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
StreamString idx_name;
idx_name.Printf("[%d]",idx);
dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
@@ -1256,38 +1224,8 @@
m_data_32(NULL),
m_data_64(NULL)
{
- if (!valobj_sp)
- return;
- if (valobj_sp->IsDynamic())
- valobj_sp = valobj_sp->GetStaticValue();
- if (!valobj_sp)
- return;
- m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- Error error;
- if (valobj_sp->IsPointerType())
- {
- valobj_sp = valobj_sp->Dereference(error);
- if (error.Fail() || !valobj_sp)
- return;
- }
- error.Clear();
- lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
- if (!process_sp)
- return;
- m_ptr_size = process_sp->GetAddressByteSize();
- uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
- if (m_ptr_size == 4)
- {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
- }
- else
- {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
- }
- if (error.Fail())
- return;
+ if (valobj_sp)
+ Update ();
}
lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd ()
@@ -1320,6 +1258,44 @@
lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update()
{
m_children.clear();
+ ValueObjectSP valobj_sp = m_backend.GetSP();
+ m_ptr_size = 0;
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+ if (!valobj_sp)
+ return false;
+ if (valobj_sp->IsDynamic())
+ valobj_sp = valobj_sp->GetStaticValue();
+ if (!valobj_sp)
+ return false;
+ m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+ Error error;
+ if (valobj_sp->IsPointerType())
+ {
+ valobj_sp = valobj_sp->Dereference(error);
+ if (error.Fail() || !valobj_sp)
+ return false;
+ }
+ error.Clear();
+ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return false;
+ m_ptr_size = process_sp->GetAddressByteSize();
+ uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+ if (m_ptr_size == 4)
+ {
+ m_data_32 = new DataDescriptor_32();
+ process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
+ }
+ else
+ {
+ m_data_64 = new DataDescriptor_64();
+ process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
+ }
+ if (error.Fail())
+ return false;
return false;
}
@@ -1377,7 +1353,7 @@
{
// make the new ValueObject
StreamString expr;
- expr.Printf("struct { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
+ expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
StreamString idx_name;
idx_name.Printf("[%d]",idx);
dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
Modified: lldb/branches/windows/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Communication.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Communication.cpp (original)
+++ lldb/branches/windows/source/Core/Communication.cpp Mon Oct 15 11:27:58 2012
@@ -208,7 +208,7 @@
{
lldb::ConnectionSP connection_sp (m_connection_sp);
- Mutex::Locker (m_write_mutex);
+ Mutex::Locker locker(m_write_mutex);
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
"%p Communication::Write (src = %p, src_len = %llu) connection = %p",
this,
Modified: lldb/branches/windows/source/Core/DataBufferMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/DataBufferMemoryMap.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/DataBufferMemoryMap.cpp (original)
+++ lldb/branches/windows/source/Core/DataBufferMemoryMap.cpp Mon Oct 15 11:27:58 2012
@@ -111,15 +111,15 @@
// offset.
//----------------------------------------------------------------------
size_t
-DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* file,
+DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* filespec,
off_t offset,
size_t length,
bool writeable)
{
- if (file != NULL)
+ if (filespec != NULL)
{
char path[PATH_MAX];
- if (file->GetPath(path, sizeof(path)))
+ if (filespec->GetPath(path, sizeof(path)))
{
uint32_t options = File::eOpenOptionRead;
if (writeable)
Modified: lldb/branches/windows/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Debugger.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Debugger.cpp (original)
+++ lldb/branches/windows/source/Core/Debugger.cpp Mon Oct 15 11:27:58 2012
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "lldb/API/SBDebugger.h"
+
#include "lldb/Core/Debugger.h"
#include <map>
@@ -28,6 +30,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/Host/DynamicLibrary.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
@@ -334,6 +337,109 @@
Target::SettingsTerminate ();
}
+bool
+Debugger::LoadPlugin (const FileSpec& spec)
+{
+ lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec));
+ lldb::DebuggerSP debugger_sp(shared_from_this());
+ lldb::SBDebugger debugger_sb(debugger_sp);
+ // TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays
+ LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
+ if (!init_func)
+ return false;
+ if (init_func(debugger_sb))
+ {
+ m_loaded_plugins.push_back(dynlib_sp);
+ return true;
+ }
+ return false;
+}
+
+static FileSpec::EnumerateDirectoryResult
+LoadPluginCallback
+(
+ void *baton,
+ FileSpec::FileType file_type,
+ const FileSpec &file_spec
+ )
+{
+ Error error;
+
+ static ConstString g_dylibext("dylib");
+
+ if (!baton)
+ return FileSpec::eEnumerateDirectoryResultQuit;
+
+ Debugger *debugger = (Debugger*)baton;
+
+ // If we have a regular file, a symbolic link or unknown file type, try
+ // and process the file. We must handle unknown as sometimes the directory
+ // enumeration might be enumerating a file system that doesn't have correct
+ // file type information.
+ if (file_type == FileSpec::eFileTypeRegular ||
+ file_type == FileSpec::eFileTypeSymbolicLink ||
+ file_type == FileSpec::eFileTypeUnknown )
+ {
+ FileSpec plugin_file_spec (file_spec);
+ plugin_file_spec.ResolvePath ();
+
+ if (plugin_file_spec.GetFileNameExtension() != g_dylibext)
+ return FileSpec::eEnumerateDirectoryResultNext;
+
+ debugger->LoadPlugin (plugin_file_spec);
+
+ return FileSpec::eEnumerateDirectoryResultNext;
+ }
+
+ else if (file_type == FileSpec::eFileTypeUnknown ||
+ file_type == FileSpec::eFileTypeDirectory ||
+ file_type == FileSpec::eFileTypeSymbolicLink )
+ {
+ // Try and recurse into anything that a directory or symbolic link.
+ // We must also do this for unknown as sometimes the directory enumeration
+ // might be enurating a file system that doesn't have correct file type
+ // information.
+ return FileSpec::eEnumerateDirectoryResultEnter;
+ }
+
+ return FileSpec::eEnumerateDirectoryResultNext;
+}
+
+void
+Debugger::InstanceInitialize ()
+{
+ FileSpec dir_spec;
+ const bool find_directories = true;
+ const bool find_files = true;
+ const bool find_other = true;
+ char dir_path[PATH_MAX];
+ if (Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec))
+ {
+ if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path)))
+ {
+ FileSpec::EnumerateDirectory (dir_path,
+ find_directories,
+ find_files,
+ find_other,
+ LoadPluginCallback,
+ this);
+ }
+ }
+
+ if (Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec))
+ {
+ if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path)))
+ {
+ FileSpec::EnumerateDirectory (dir_path,
+ find_directories,
+ find_files,
+ find_other,
+ LoadPluginCallback,
+ this);
+ }
+ }
+}
+
DebuggerSP
Debugger::CreateInstance (lldb::LogOutputCallback log_callback, void *baton)
{
@@ -343,6 +449,7 @@
Mutex::Locker locker (GetDebuggerListMutex ());
GetDebuggerList().push_back(debugger_sp);
}
+ debugger_sp->InstanceInitialize ();
return debugger_sp;
}
Modified: lldb/branches/windows/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/FormatManager.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/FormatManager.cpp (original)
+++ lldb/branches/windows/source/Core/FormatManager.cpp Mon Oct 15 11:27:58 2012
@@ -413,7 +413,7 @@
const char** matching_category,
TypeCategoryImpl::FormatCategoryItems* matching_type)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
MapIterator pos, end = m_map.end();
for (pos = m_map.begin(); pos != end; pos++)
@@ -432,7 +432,7 @@
CategoryMap::GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
@@ -548,7 +548,7 @@
CategoryMap::GetSyntheticChildren (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
uint32_t reason_why;
@@ -571,7 +571,7 @@
{
if (callback)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
// loop through enabled categories in respective order
{
@@ -603,7 +603,7 @@
TypeCategoryImplSP
CategoryMap::GetAtIndex (uint32_t index)
{
- Mutex::Locker(m_map_mutex);
+ Mutex::Locker locker(m_map_mutex);
if (index < m_map.size())
{
@@ -1129,6 +1129,11 @@
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
+
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider", ConstString("NSSet"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFSetRef"), appkit_flags);
Modified: lldb/branches/windows/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Log.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Log.cpp (original)
+++ lldb/branches/windows/source/Core/Log.cpp Mon Oct 15 11:27:58 2012
@@ -126,6 +126,9 @@
header.PrintfVarArg (format, args);
m_stream_sp->Printf("%s\n", header.GetData());
+
+ if (m_options.Test (LLDB_LOG_OPTION_BACKTRACE))
+ Host::Backtrace (*m_stream_sp, 1024);
m_stream_sp->Flush();
}
}
Modified: lldb/branches/windows/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Module.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Module.cpp (original)
+++ lldb/branches/windows/source/Core/Module.cpp Mon Oct 15 11:27:58 2012
@@ -117,7 +117,7 @@
}
#endif
-
+
Module::Module (const ModuleSpec &module_spec) :
m_mutex (Mutex::eMutexTypeRecursive),
m_mod_time (module_spec.GetFileSpec().GetModificationTime()),
@@ -146,7 +146,7 @@
GetModuleCollection().push_back(this);
}
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
if (log)
log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
this,
@@ -191,7 +191,7 @@
if (object_name)
m_object_name = *object_name;
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
if (log)
log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
this,
@@ -211,10 +211,10 @@
ModuleCollection &modules = GetModuleCollection();
ModuleCollection::iterator end = modules.end();
ModuleCollection::iterator pos = std::find(modules.begin(), end, this);
- if (pos != end)
- modules.erase(pos);
+ assert (pos != end);
+ modules.erase(pos);
}
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
if (log)
log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')",
this,
@@ -1171,7 +1171,7 @@
const FileSpec &platform_file_spec = module_ref.GetPlatformFileSpec();
if (platform_file_spec)
{
- if (!FileSpec::Equal (platform_file_spec, m_platform_file, platform_file_spec.GetDirectory()))
+ if (!FileSpec::Equal (platform_file_spec, GetPlatformFileSpec (), platform_file_spec.GetDirectory()))
return false;
}
Modified: lldb/branches/windows/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ModuleList.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ModuleList.cpp (original)
+++ lldb/branches/windows/source/Core/ModuleList.cpp Mon Oct 15 11:27:58 2012
@@ -454,13 +454,14 @@
if (total_matches < max_matches)
{
+ SymbolContext world_sc;
for (pos = m_modules.begin(); pos != end; ++pos)
{
// Search the module if the module is not equal to the one in the symbol
// context "sc". If "sc" contains a empty module shared pointer, then
// the comparisong will always be true (valid_module_ptr != NULL).
if (sc.module_sp.get() != (*pos).get())
- total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types);
+ total_matches += (*pos)->FindTypes (world_sc, name, name_is_fully_qualified, max_matches, types);
if (total_matches >= max_matches)
break;
@@ -723,6 +724,11 @@
{
if (old_module_sp_ptr && !old_module_sp_ptr->get())
*old_module_sp_ptr = module_sp;
+
+ LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_MODULES));
+ if (log)
+ log->Printf("module changed: %p, removing from global module list", module_sp.get());
+
shared_module_list.Remove (module_sp);
module_sp.reset();
}
Modified: lldb/branches/windows/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Section.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Section.cpp (original)
+++ lldb/branches/windows/source/Core/Section.cpp Mon Oct 15 11:27:58 2012
@@ -304,7 +304,7 @@
addr = linked_section_sp->GetFileAddress() + m_linked_offset;
}
- int indent = 26 + s->GetIndentLevel();
+ int indent = 28 + s->GetIndentLevel();
s->Printf("%*.*s", indent, indent, "");
VMRange linked_range(addr, addr + m_byte_size);
linked_range.Dump (s, 0);
Modified: lldb/branches/windows/source/Core/StreamCallback.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/StreamCallback.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/StreamCallback.cpp (original)
+++ lldb/branches/windows/source/Core/StreamCallback.cpp Mon Oct 15 11:27:58 2012
@@ -35,7 +35,7 @@
StreamString &
StreamCallback::FindStreamForThread(lldb::tid_t cur_tid)
{
- Mutex::Locker (m_collection_mutex);
+ Mutex::Locker locker(m_collection_mutex);
collection::iterator iter = m_accumulated_data.find (cur_tid);
if (iter == m_accumulated_data.end())
{
Modified: lldb/branches/windows/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObject.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObject.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObject.cpp Mon Oct 15 11:27:58 2012
@@ -3223,12 +3223,11 @@
s.Printf(", dynamic type: unknown) ");
else
{
- ObjCLanguageRuntime::ObjCISA isa = runtime->GetISA(*valobj);
- if (!runtime->IsValidISA(isa))
- s.Printf(", dynamic type: unknown) ");
+ ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (runtime->GetNonKVOClassDescriptor(*valobj));
+ if (objc_class_sp)
+ s.Printf(", dynamic type: %s) ", objc_class_sp->GetClassName().GetCString());
else
- s.Printf(", dynamic type: %s) ",
- runtime->GetActualTypeName(isa).GetCString());
+ s.Printf(", dynamic type: unknown) ");
}
}
}
Modified: lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp Mon Oct 15 11:27:58 2012
@@ -55,10 +55,10 @@
ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter) :
ValueObject(parent),
m_synth_sp(filter),
- m_synth_filter_ap(filter->GetFrontEnd(parent)),
m_children_byindex(),
m_name_toindex(),
- m_synthetic_children_count(UINT32_MAX)
+ m_synthetic_children_count(UINT32_MAX),
+ m_parent_type_name(parent.GetTypeName())
{
#ifdef LLDB_CONFIGURATION_DEBUG
std::string new_name(parent.GetName().AsCString());
@@ -67,8 +67,7 @@
#else
SetName(parent.GetName());
#endif
- if (!m_synth_filter_ap.get())
- m_synth_filter_ap.reset(new DummySyntheticFrontEnd(parent));
+ CreateSynthFilter();
}
ValueObjectSynthetic::~ValueObjectSynthetic()
@@ -114,6 +113,14 @@
return m_parent->GetValueType();
}
+void
+ValueObjectSynthetic::CreateSynthFilter ()
+{
+ m_synth_filter_ap = (m_synth_sp->GetFrontEnd(*m_parent));
+ if (!m_synth_filter_ap.get())
+ m_synth_filter_ap.reset(new DummySyntheticFrontEnd(*m_parent));
+}
+
bool
ValueObjectSynthetic::UpdateValue ()
{
@@ -127,6 +134,15 @@
m_error = m_parent->GetError();
return false;
}
+
+ // regenerate the synthetic filter if our typename changes
+ // <rdar://problem/12424824>
+ ConstString new_parent_type_name = m_parent->GetTypeName();
+ if (new_parent_type_name != m_parent_type_name)
+ {
+ m_parent_type_name = new_parent_type_name;
+ CreateSynthFilter();
+ }
// let our backend do its update
if (m_synth_filter_ap->Update() == false)
Modified: lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp Mon Oct 15 11:27:58 2012
@@ -117,12 +117,14 @@
++entity_index)
{
ClangExpressionVariableSP var_sp(m_found_entities.GetVariableAtIndex(entity_index));
- if (var_sp &&
- var_sp->m_parser_vars.get() &&
- var_sp->m_parser_vars->m_lldb_value)
+ if (var_sp)
+ {
+ if (var_sp->m_parser_vars.get() &&
+ var_sp->m_parser_vars->m_lldb_value)
delete var_sp->m_parser_vars->m_lldb_value;
- var_sp->DisableParserVars();
+ var_sp->DisableParserVars();
+ }
}
for (size_t pvar_index = 0, num_pvars = m_parser_vars->m_persistent_vars->GetSize();
@@ -301,9 +303,7 @@
context);
if (!user_type.GetOpaqueQualType())
- {
- lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
+ {
if (log)
log->Printf("ClangExpressionDeclMap::BuildCastVariable - Couldn't export the type for a constant cast result");
@@ -2708,7 +2708,7 @@
append,
sc_list);
}
- else if (!namespace_decl)
+ else if (target && !namespace_decl)
{
const bool include_symbols = true;
Modified: lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionParser.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionParser.cpp Mon Oct 15 11:27:58 2012
@@ -757,6 +757,7 @@
{
ret.SetErrorToGenericError();
ret.SetErrorString("Couldn't find the target");
+ return ret;
}
lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0));
Modified: lldb/branches/windows/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangUserExpression.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangUserExpression.cpp Mon Oct 15 11:27:58 2012
@@ -552,7 +552,7 @@
if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
{
- lldb::addr_t struct_address;
+ lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
lldb::addr_t object_ptr = 0;
lldb::addr_t cmd_ptr = 0;
Modified: lldb/branches/windows/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRForTarget.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/windows/source/Expression/IRForTarget.cpp Mon Oct 15 11:27:58 2012
@@ -11,12 +11,12 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Constants.h"
+#include "llvm/DataLayout.h"
#include "llvm/InstrTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
-#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/ValueSymbolTable.h"
@@ -78,11 +78,14 @@
PrintValue(const Value *value, bool truncate = false)
{
std::string s;
- raw_string_ostream rso(s);
- value->print(rso);
- rso.flush();
- if (truncate)
- s.resize(s.length() - 1);
+ if (value)
+ {
+ raw_string_ostream rso(s);
+ value->print(rso);
+ rso.flush();
+ if (truncate)
+ s.resize(s.length() - 1);
+ }
return s;
}
@@ -238,7 +241,7 @@
// Check for an alternate mangling for "std::basic_string<char>"
// that is part of the itanium C++ name mangling scheme
const char *name_cstr = name.GetCString();
- if (strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0)
+ if (name_cstr && strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0)
{
std::string alternate_mangling("_ZNKSs");
alternate_mangling.append (name_cstr + strlen("_ZNKSbIcE"));
@@ -492,6 +495,9 @@
}
}
+ if (!original_load)
+ return;
+
Value *loaded_value = original_load->getPointerOperand();
GlobalVariable *loaded_global = dyn_cast<GlobalVariable>(loaded_value);
@@ -840,7 +846,8 @@
Type *i8_ptr_ty = Type::getInt8PtrTy(m_module->getContext());
IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
- (m_module->getPointerSize() == Module::Pointer64) ? 64 : 32);
+ (m_module->getPointerSize()
+ == Module::Pointer64) ? 64 : 32);
Type *i32_ty = Type::getInt32Ty(m_module->getContext());
Type *i8_ty = Type::getInt8Ty(m_module->getContext());
@@ -1724,7 +1731,6 @@
log->Printf("Found \"%s\" at 0x%llx", name.GetCString(), symbol_addr);
Type *symbol_type = symbol->getType();
-
IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
(m_module->getPointerSize() == Module::Pointer64) ? 64 : 32);
@@ -1807,7 +1813,8 @@
return false;
IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
- (m_module->getPointerSize() == Module::Pointer64) ? 64 : 32);
+ (m_module->getPointerSize()
+ == Module::Pointer64) ? 64 : 32);
Constant *class_addr = ConstantInt::get(intptr_ty, (uint64_t)class_ptr);
Constant *class_bitcast = ConstantExpr::getIntToPtr(class_addr, load_instruction->getType());
@@ -2686,7 +2693,7 @@
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
m_module = &llvm_module;
- m_target_data.reset(new TargetData(m_module));
+ m_target_data.reset(new DataLayout(m_module));
Function* function = m_module->getFunction(StringRef(m_func_name.c_str()));
Modified: lldb/branches/windows/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRInterpreter.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRInterpreter.cpp (original)
+++ lldb/branches/windows/source/Expression/IRInterpreter.cpp Mon Oct 15 11:27:58 2012
@@ -20,7 +20,7 @@
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include <map>
@@ -176,7 +176,7 @@
MemoryMap m_memory;
lldb::ByteOrder m_byte_order;
lldb::addr_t m_addr_byte_size;
- TargetData &m_target_data;
+ DataLayout &m_target_data;
lldb_private::ClangExpressionDeclMap &m_decl_map;
@@ -195,7 +195,7 @@
}
public:
- Memory (TargetData &target_data,
+ Memory (DataLayout &target_data,
lldb_private::ClangExpressionDeclMap &decl_map,
lldb::addr_t alloc_start,
lldb::addr_t alloc_max) :
@@ -205,7 +205,7 @@
m_decl_map(decl_map)
{
m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
- m_addr_byte_size = (target_data.getPointerSize());
+ m_addr_byte_size = (target_data.getPointerSize(0));
}
Region Malloc (size_t size, size_t align)
@@ -408,7 +408,7 @@
ValueMap m_values;
Memory &m_memory;
- TargetData &m_target_data;
+ DataLayout &m_target_data;
lldb_private::ClangExpressionDeclMap &m_decl_map;
const BasicBlock *m_bb;
BasicBlock::const_iterator m_ii;
@@ -417,7 +417,7 @@
lldb::ByteOrder m_byte_order;
size_t m_addr_byte_size;
- InterpreterStackFrame (TargetData &target_data,
+ InterpreterStackFrame (DataLayout &target_data,
Memory &memory,
lldb_private::ClangExpressionDeclMap &decl_map) :
m_memory (memory),
@@ -425,7 +425,7 @@
m_decl_map (decl_map)
{
m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
- m_addr_byte_size = (target_data.getPointerSize());
+ m_addr_byte_size = (target_data.getPointerSize(0));
}
void Jump (const BasicBlock *bb)
@@ -1047,8 +1047,8 @@
break;
}
- TargetData target_data(&llvm_module);
- if (target_data.getPointerSize() != target_info.address_byte_size)
+ DataLayout target_data(&llvm_module);
+ if (target_data.getPointerSize(0) != target_info.address_byte_size)
{
err.SetErrorToGenericError();
err.SetErrorString(interpreter_initialization_error);
Modified: lldb/branches/windows/source/Host/common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/CMakeLists.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Host/common/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -2,6 +2,7 @@
add_lldb_library(lldbHostCommon
Condition.cpp
+ DynamicLibrary.cpp
File.cpp
FileSpec.cpp
Host.cpp
Modified: lldb/branches/windows/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Host.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Host.cpp (original)
+++ lldb/branches/windows/source/Host/common/Host.cpp Mon Oct 15 11:27:58 2012
@@ -353,6 +353,11 @@
g_host_arch_32.Clear();
g_host_arch_64.Clear();
+ // If the OS is Linux, "unknown" in the vendor slot isn't what we want
+ // for the default triple. It's probably an artifact of config.guess.
+ if (triple.getOS() == llvm::Triple::Linux && triple.getVendor() == llvm::Triple::UnknownVendor)
+ triple.setVendorName("");
+
switch (triple.getArch())
{
default:
@@ -398,15 +403,9 @@
static ConstString g_vendor;
if (!g_vendor)
{
-#if defined (__APPLE__)
const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
const llvm::StringRef &str_ref = host_arch.GetTriple().getVendorName();
g_vendor.SetCStringWithLength(str_ref.data(), str_ref.size());
-#elif defined (__linux__)
- g_vendor.SetCString("gnu");
-#elif defined (__FreeBSD__)
- g_vendor.SetCString("freebsd");
-#endif
}
return g_vendor;
}
@@ -417,15 +416,9 @@
static ConstString g_os_string;
if (!g_os_string)
{
-#if defined (__APPLE__)
const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
const llvm::StringRef &str_ref = host_arch.GetTriple().getOSName();
g_os_string.SetCStringWithLength(str_ref.data(), str_ref.size());
-#elif defined (__linux__)
- g_os_string.SetCString("linux");
-#elif defined (__FreeBSD__)
- g_os_string.SetCString("freebsd");
-#endif
}
return g_os_string;
}
Modified: lldb/branches/windows/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Symbols.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/common/Symbols.cpp Mon Oct 15 11:27:58 2012
@@ -37,7 +37,7 @@
}
bool
-Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec)
+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.
Modified: lldb/branches/windows/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/Symbols.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/macosx/Symbols.cpp Mon Oct 15 11:27:58 2012
@@ -356,7 +356,7 @@
{
if (::CFURLGetFileSystemRepresentation (dsym_url.get(), true, (UInt8*)path, sizeof(path)-1))
{
- out_dsym_fspec->SetFile(path, false);
+ out_dsym_fspec->SetFile(path, path[0] == '~');
if (out_dsym_fspec->GetFileType () == FileSpec::eFileTypeDirectory)
{
@@ -378,7 +378,7 @@
char uuid_cstr_buf[64];
const char *uuid_cstr = uuid->GetAsCString (uuid_cstr_buf, sizeof(uuid_cstr_buf));
CFCString uuid_cfstr (uuid_cstr);
- CFDictionaryRef uuid_dict = static_cast<CFDictionaryRef>(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get()));
+ uuid_dict = static_cast<CFDictionaryRef>(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get()));
if (uuid_dict)
{
@@ -643,11 +643,41 @@
bool
-Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec)
+Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec, bool force_lookup)
{
bool success = false;
const UUID *uuid_ptr = module_spec.GetUUIDPtr();
const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
+
+ // It's expensive to check for the DBGShellCommands defaults setting, only do it once per
+ // lldb run and cache the result.
+ static bool g_have_checked_for_dbgshell_command = false;
+ static const char *g_dbgshell_command = NULL;
+ if (g_have_checked_for_dbgshell_command == false)
+ {
+ g_have_checked_for_dbgshell_command = true;
+ CFTypeRef defaults_setting = CFPreferencesCopyAppValue (CFSTR ("DBGShellCommands"), CFSTR ("com.apple.DebugSymbols"));
+ if (defaults_setting && CFGetTypeID (defaults_setting) == CFStringGetTypeID())
+ {
+ char cstr_buf[PATH_MAX];
+ if (CFStringGetCString ((CFStringRef) defaults_setting, cstr_buf, sizeof (cstr_buf), kCFStringEncodingUTF8))
+ {
+ g_dbgshell_command = strdup (cstr_buf); // this malloc'ed memory will never be freed
+ }
+ }
+ if (defaults_setting)
+ {
+ CFRelease (defaults_setting);
+ }
+ }
+
+ // When g_dbgshell_command is NULL, the user has not enabled the use of an external program
+ // to find the symbols, don't run it for them.
+ if (force_lookup == false && g_dbgshell_command == NULL)
+ {
+ return false;
+ }
+
if (uuid_ptr || (file_spec_ptr && file_spec_ptr->Exists()))
{
static bool g_located_dsym_for_uuid_exe = false;
@@ -671,9 +701,15 @@
if (!g_dsym_for_uuid_exe_exists)
{
dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false);
+ g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
}
}
-
+ if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL)
+ {
+ dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true);
+ g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
+ }
+
if (g_dsym_for_uuid_exe_exists)
dsym_for_uuid_exe_spec.GetPath (g_dsym_for_uuid_exe_path, sizeof(g_dsym_for_uuid_exe_path));
}
@@ -693,9 +729,9 @@
StreamString command;
if (uuid_cstr)
- command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, uuid_cstr);
+ command.Printf("%s --ignoreNegativeCache --copyExecutable %s", g_dsym_for_uuid_exe_path, uuid_cstr);
else if (file_path && file_path[0])
- command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, file_path);
+ command.Printf("%s --ignoreNegativeCache --copyExecutable %s", g_dsym_for_uuid_exe_path, file_path);
if (!command.GetString().empty())
{
Modified: lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp Mon Oct 15 11:27:58 2012
@@ -28,6 +28,7 @@
#include "../Commands/CommandObjectLog.h"
#include "../Commands/CommandObjectMemory.h"
#include "../Commands/CommandObjectPlatform.h"
+#include "../Commands/CommandObjectPlugin.h"
#include "../Commands/CommandObjectProcess.h"
#include "../Commands/CommandObjectQuit.h"
#include "../Commands/CommandObjectRegister.h"
@@ -157,9 +158,9 @@
if (cmd_obj_sp)
AddAlias ("b", cmd_obj_sp);
- cmd_obj_sp = GetCommandSPExact ("thread backtrace", false);
+ cmd_obj_sp = GetCommandSPExact ("_regexp-tbreak",false);
if (cmd_obj_sp)
- AddAlias ("bt", cmd_obj_sp);
+ AddAlias ("tbreak", cmd_obj_sp);
cmd_obj_sp = GetCommandSPExact ("thread step-inst", false);
if (cmd_obj_sp)
@@ -201,6 +202,12 @@
AddAlias ("f", cmd_obj_sp);
}
+ cmd_obj_sp = GetCommandSPExact ("thread select", false);
+ if (cmd_obj_sp)
+ {
+ AddAlias ("t", cmd_obj_sp);
+ }
+
cmd_obj_sp = GetCommandSPExact ("source list", false);
if (cmd_obj_sp)
{
@@ -238,6 +245,10 @@
if (cmd_obj_sp)
AddAlias ("undisplay", cmd_obj_sp);
+ cmd_obj_sp = GetCommandSPExact ("_regexp-bt", false);
+ if (cmd_obj_sp)
+ AddAlias ("bt", cmd_obj_sp);
+
cmd_obj_sp = GetCommandSPExact ("target create", false);
if (cmd_obj_sp)
AddAlias ("file", cmd_obj_sp);
@@ -272,7 +283,6 @@
if (cmd_obj_sp)
{
AddAlias ("kill", cmd_obj_sp);
- AddAlias ("k", cmd_obj_sp);
}
cmd_obj_sp = GetCommandSPExact ("process launch", false);
@@ -358,6 +368,7 @@
m_command_dict["log"] = CommandObjectSP (new CommandObjectLog (*this));
m_command_dict["memory"] = CommandObjectSP (new CommandObjectMemory (*this));
m_command_dict["platform"] = CommandObjectSP (new CommandObjectPlatform (*this));
+ m_command_dict["plugin"] = CommandObjectSP (new CommandObjectPlugin (*this));
m_command_dict["process"] = CommandObjectSP (new CommandObjectMultiwordProcess (*this));
m_command_dict["quit"] = CommandObjectSP (new CommandObjectQuit (*this));
m_command_dict["register"] = CommandObjectSP (new CommandObjectRegister (*this));
@@ -370,21 +381,34 @@
m_command_dict["version"] = CommandObjectSP (new CommandObjectVersion (*this));
m_command_dict["watchpoint"]= CommandObjectSP (new CommandObjectMultiwordWatchpoint (*this));
+ const char *break_regexes[][2] = {{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$", "breakpoint set --file '%1' --line %2"},
+ {"^([[:digit:]]+)[[:space:]]*$", "breakpoint set --line %1"},
+ {"^(0x[[:xdigit:]]+)[[:space:]]*$", "breakpoint set --address %1"},
+ {"^[\"']?([-+]\\[.*\\])[\"']?[[:space:]]*$", "breakpoint set --name '%1'"},
+ {"^(-.*)$", "breakpoint set %1"},
+ {"^(.*[^[:space:]])`(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%2' --shlib '%1'"},
+ {"^(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%1'"}};
+
+ size_t num_regexes = sizeof break_regexes/sizeof(char *[2]);
+
std::auto_ptr<CommandObjectRegexCommand>
break_regex_cmd_ap(new CommandObjectRegexCommand (*this,
"_regexp-break",
"Set a breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.",
"_regexp-break [<filename>:<linenum>]\n_regexp-break [<linenum>]\n_regexp-break [<address>]\n_regexp-break <...>", 2));
+
if (break_regex_cmd_ap.get())
{
- if (break_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$", "breakpoint set --file '%1' --line %2") &&
- break_regex_cmd_ap->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$", "breakpoint set --line %1") &&
- break_regex_cmd_ap->AddRegexCommand("^(0x[[:xdigit:]]+)[[:space:]]*$", "breakpoint set --address %1") &&
- break_regex_cmd_ap->AddRegexCommand("^[\"']?([-+]\\[.*\\])[\"']?[[:space:]]*$", "breakpoint set --name '%1'") &&
- break_regex_cmd_ap->AddRegexCommand("^$", "breakpoint list --full") &&
- break_regex_cmd_ap->AddRegexCommand("^(-.*)$", "breakpoint set %1") &&
- break_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])`(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%2' --shlib '%1'") &&
- break_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*$", "breakpoint set --name '%1'"))
+ bool success = true;
+ for (size_t i = 0; i < num_regexes; i++)
+ {
+ success = break_regex_cmd_ap->AddRegexCommand (break_regexes[i][0], break_regexes[i][1]);
+ if (!success)
+ break;
+ }
+ success = break_regex_cmd_ap->AddRegexCommand("^$", "breakpoint list --full");
+
+ if (success)
{
CommandObjectSP break_regex_cmd_sp(break_regex_cmd_ap.release());
m_command_dict[break_regex_cmd_sp->GetCommandName ()] = break_regex_cmd_sp;
@@ -392,6 +416,34 @@
}
std::auto_ptr<CommandObjectRegexCommand>
+ tbreak_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "_regexp-tbreak",
+ "Set a one shot breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.",
+ "_regexp-tbreak [<filename>:<linenum>]\n_regexp-break [<linenum>]\n_regexp-break [<address>]\n_regexp-break <...>", 2));
+
+ if (tbreak_regex_cmd_ap.get())
+ {
+ bool success = true;
+ for (size_t i = 0; i < num_regexes; i++)
+ {
+ // If you add a resultant command string longer than 1024 characters be sure to increase the size of this buffer.
+ char buffer[1024];
+ int num_printed = snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o");
+ assert (num_printed < 1024);
+ success = tbreak_regex_cmd_ap->AddRegexCommand (break_regexes[i][0], buffer);
+ if (!success)
+ break;
+ }
+ success = tbreak_regex_cmd_ap->AddRegexCommand("^$", "breakpoint list --full");
+
+ if (success)
+ {
+ CommandObjectSP tbreak_regex_cmd_sp(tbreak_regex_cmd_ap.release());
+ m_command_dict[tbreak_regex_cmd_sp->GetCommandName ()] = tbreak_regex_cmd_sp;
+ }
+ }
+
+ std::auto_ptr<CommandObjectRegexCommand>
attach_regex_cmd_ap(new CommandObjectRegexCommand (*this,
"_regexp-attach",
"Attach to a process id if in decimal, otherwise treat the argument as a process name to attach to.",
@@ -494,6 +546,26 @@
}
}
+ std::auto_ptr<CommandObjectRegexCommand>
+ bt_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "_regexp-bt",
+ "Show a backtrace. An optional argument is accepted; if that argument is a number, it specifies the number of frames to display. If that argument is 'all', full backtraces of all threads are displayed.",
+ "bt [<digit>|all]", 2));
+ if (bt_regex_cmd_ap.get())
+ {
+ // accept but don't document "bt -c <number>" -- before bt was a regex command if you wanted to backtrace
+ // three frames you would do "bt -c 3" but the intention is to have this emulate the gdb "bt" command and
+ // so now "bt 3" is the preferred form, in line with gdb.
+ if (bt_regex_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "thread backtrace -c %1") &&
+ bt_regex_cmd_ap->AddRegexCommand("^-c ([[:digit:]]+)$", "thread backtrace -c %1") &&
+ bt_regex_cmd_ap->AddRegexCommand("^all$", "thread backtrace all") &&
+ bt_regex_cmd_ap->AddRegexCommand("^$", "thread backtrace"))
+ {
+ CommandObjectSP command_sp(bt_regex_cmd_ap.release());
+ m_command_dict[command_sp->GetCommandName ()] = command_sp;
+ }
+ }
+
}
int
@@ -624,11 +696,11 @@
if (name && name[0])
{
std::string name_sstr(name);
- if (!can_replace)
- {
- if (m_command_dict.find (name_sstr) != m_command_dict.end())
- return false;
- }
+ bool found = (m_command_dict.find (name_sstr) != m_command_dict.end());
+ if (found && !can_replace)
+ return false;
+ if (found && m_command_dict[name_sstr]->IsRemovable() == false)
+ return false;
m_command_dict[name_sstr] = cmd_sp;
return true;
}
@@ -647,11 +719,21 @@
// do not allow replacement of internal commands
if (CommandExists(name_cstr))
- return false;
+ {
+ if (can_replace == false)
+ return false;
+ if (m_command_dict[name]->IsRemovable() == false)
+ return false;
+ }
+
+ if (UserCommandExists(name_cstr))
+ {
+ if (can_replace == false)
+ return false;
+ if (m_user_dict[name]->IsRemovable() == false)
+ return false;
+ }
- if (can_replace == false && UserCommandExists(name_cstr))
- return false;
-
m_user_dict[name] = cmd_sp;
return true;
}
@@ -683,8 +765,7 @@
{
if (cmd_obj_sp->IsMultiwordObject())
{
- cmd_obj_sp = ((CommandObjectMultiword *) cmd_obj_sp.get())->GetSubcommandSP
- (cmd_words.GetArgumentAtIndex (j));
+ cmd_obj_sp = cmd_obj_sp->GetSubcommandSP (cmd_words.GetArgumentAtIndex (j));
if (cmd_obj_sp.get() == NULL)
// The sub-command name was invalid. Fail and return the empty 'ret_val'.
return ret_val;
@@ -969,8 +1050,7 @@
else if (cmd_obj->IsMultiwordObject ())
{
// Our current object is a multi-word object; see if the cmd_word is a valid sub-command for our object.
- CommandObject *sub_cmd_obj =
- ((CommandObjectMultiword *) cmd_obj)->GetSubcommandObject (cmd_word.c_str());
+ CommandObject *sub_cmd_obj = cmd_obj->GetSubcommandObject (cmd_word.c_str());
if (sub_cmd_obj)
cmd_obj = sub_cmd_obj;
else // cmd_word was not a valid sub-command word, so we are donee
@@ -1467,7 +1547,7 @@
{
if (cmd_obj->IsMultiwordObject ())
{
- CommandObject *sub_cmd_obj = ((CommandObjectMultiword *) cmd_obj)->GetSubcommandObject (next_word.c_str());
+ CommandObject *sub_cmd_obj = cmd_obj->GetSubcommandObject (next_word.c_str());
if (sub_cmd_obj)
{
actual_cmd_name_len += next_word.length() + 1;
@@ -2642,35 +2722,6 @@
}
void
-CommandInterpreter::AproposAllSubCommands (CommandObject *cmd_obj, const char *prefix, const char *search_word,
- StringList &commands_found, StringList &commands_help)
-{
- CommandObject::CommandMap::const_iterator pos;
- CommandObject::CommandMap sub_cmd_dict = ((CommandObjectMultiword *) cmd_obj)->m_subcommand_dict;
- CommandObject *sub_cmd_obj;
-
- for (pos = sub_cmd_dict.begin(); pos != sub_cmd_dict.end(); ++pos)
- {
- const char * command_name = pos->first.c_str();
- sub_cmd_obj = pos->second.get();
- StreamString complete_command_name;
-
- complete_command_name.Printf ("%s %s", prefix, command_name);
-
- if (sub_cmd_obj->HelpTextContainsWord (search_word))
- {
- commands_found.AppendString (complete_command_name.GetData());
- commands_help.AppendString (sub_cmd_obj->GetHelp());
- }
-
- if (sub_cmd_obj->IsMultiwordObject())
- AproposAllSubCommands (sub_cmd_obj, complete_command_name.GetData(), search_word, commands_found,
- commands_help);
- }
-
-}
-
-void
CommandInterpreter::FindCommandsForApropos (const char *search_word, StringList &commands_found,
StringList &commands_help)
{
@@ -2688,7 +2739,10 @@
}
if (cmd_obj->IsMultiwordObject())
- AproposAllSubCommands (cmd_obj, command_name, search_word, commands_found, commands_help);
+ cmd_obj->AproposAllSubCommands (command_name,
+ search_word,
+ commands_found,
+ commands_help);
}
}
Modified: lldb/branches/windows/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandObject.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandObject.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandObject.cpp Mon Oct 15 11:27:58 2012
@@ -379,23 +379,19 @@
bool
CommandObject::HelpTextContainsWord (const char *search_word)
{
- const char *short_help;
- const char *long_help;
- const char *syntax_help;
std::string options_usage_help;
-
bool found_word = false;
- short_help = GetHelp();
- long_help = GetHelpLong();
- syntax_help = GetSyntax();
+ const char *short_help = GetHelp();
+ const char *long_help = GetHelpLong();
+ const char *syntax_help = GetSyntax();
- if (strcasestr (short_help, search_word))
+ if (short_help && strcasestr (short_help, search_word))
found_word = true;
- else if (strcasestr (long_help, search_word))
+ else if (long_help && strcasestr (long_help, search_word))
found_word = true;
- else if (strcasestr (syntax_help, search_word))
+ else if (syntax_help && strcasestr (syntax_help, search_word))
found_word = true;
if (!found_word
Modified: lldb/branches/windows/source/Interpreter/CommandObjectRegexCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandObjectRegexCommand.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandObjectRegexCommand.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandObjectRegexCommand.cpp Mon Oct 15 11:27:58 2012
@@ -82,9 +82,12 @@
}
}
result.SetStatus(eReturnStatusFailed);
- result.AppendErrorWithFormat ("Command contents '%s' failed to match any regular expression in the '%s' regex command.\n",
- command,
- m_cmd_name.c_str());
+ if (GetSyntax() != NULL)
+ result.AppendError (GetSyntax());
+ else
+ result.AppendErrorWithFormat ("Command contents '%s' failed to match any regular expression in the '%s' regex command.\n",
+ command,
+ m_cmd_name.c_str());
return false;
}
result.AppendError("empty command passed to regular expression command");
Modified: lldb/branches/windows/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandObjectScript.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandObjectScript.cpp Mon Oct 15 11:27:58 2012
@@ -55,6 +55,7 @@
{
result.AppendError("no script interpreter");
result.SetStatus (eReturnStatusFailed);
+ return false;
}
DataVisualization::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
Modified: lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp Mon Oct 15 11:27:58 2012
@@ -93,7 +93,7 @@
if (value_cstr && value_cstr[0])
{
m_value_was_set = true;
- m_current_value.SetFile(value_cstr, false);
+ m_current_value.SetFile(value_cstr, value_cstr[0] == '~');
}
else
{
Modified: lldb/branches/windows/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueFileSpecLIst.cpp Mon Oct 15 11:27:58 2012
@@ -150,9 +150,9 @@
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
+ for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
- m_current_value.Remove (i);
+ m_current_value.Remove (j);
}
}
}
Modified: lldb/branches/windows/source/Interpreter/OptionValuePathMappings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValuePathMappings.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValuePathMappings.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValuePathMappings.cpp Mon Oct 15 11:27:58 2012
@@ -151,9 +151,9 @@
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
+ for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
- m_path_mappings.Remove (i, m_notify_changes);
+ m_path_mappings.Remove (j, m_notify_changes);
}
}
}
Modified: lldb/branches/windows/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Options.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Options.cpp (original)
+++ lldb/branches/windows/source/Interpreter/Options.cpp Mon Oct 15 11:27:58 2012
@@ -439,7 +439,8 @@
// Different option sets may require different args.
StreamString args_str;
- cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
+ if (cmd)
+ cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
// First go through and print all options that take no arguments as
// a single string. If a command has "-a" "-b" and "-c", this will show
@@ -569,7 +570,8 @@
}
}
- if (cmd->WantsRawCommandString() &&
+ if (cmd &&
+ cmd->WantsRawCommandString() &&
arguments_str.GetSize() > 0)
{
strm.PutChar('\n');
Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Mon Oct 15 11:27:58 2012
@@ -940,7 +940,7 @@
switch (name[1])
{
case 'b':
- if (name[2] == 'x' || name[2] == 'p')
+ if (name[2] == 'x') // ebp is volatile in the ABI, but the unwinders can find it
return name[3] == '\0';
break;
case 'd':
Modified: lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Mon Oct 15 11:27:58 2012
@@ -618,9 +618,8 @@
unsigned char buffer[16];
ByteOrder byte_order = data.GetByteOrder();
- uint32_t return_bytes;
- return_bytes = data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order);
+ data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order);
xmm0_value.SetBytes(buffer, 16, byte_order);
reg_ctx->WriteRegister(xmm0_info, xmm0_value);
set_it_simple = true;
Modified: lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Mon Oct 15 11:27:58 2012
@@ -178,11 +178,15 @@
uint32_t addr_nibble_size = 8;
addr_t base_addr = LLDB_INVALID_ADDRESS;
Target *target = exe_ctx ? exe_ctx->GetTargetPtr() : NULL;
- if (target && !target->GetSectionLoadList().IsEmpty())
- base_addr = GetAddress().GetLoadAddress (target);
+ if (target)
+ {
+ addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2;
+ if (!target->GetSectionLoadList().IsEmpty())
+ base_addr = GetAddress().GetLoadAddress (target);
+ }
+
if (base_addr == LLDB_INVALID_ADDRESS)
base_addr = GetAddress().GetFileAddress ();
- addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2;
lldb::addr_t PC = base_addr + EDInstByteSize(m_inst);
Modified: lldb/branches/windows/source/Plugins/DynamicLoader/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/CMakeLists.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -1,4 +1,4 @@
-#add_subdirectory(Darwin-Kernel)
+add_subdirectory(Darwin-Kernel)
add_subdirectory(MacOSX-DYLD)
add_subdirectory(POSIX-DYLD)
add_subdirectory(Static)
Added: lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt?rev=165942&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt (added)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginDynamicLoaderDarwinKernel
+ DynamicLoaderDarwinKernel.cpp
+ )
Modified: lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Mon Oct 15 11:27:58 2012
@@ -17,13 +17,14 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
+#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
-#include "lldb/Target/StackFrame.h"
+
#include "DynamicLoaderDarwinKernel.h"
@@ -38,11 +39,6 @@
using namespace lldb;
using namespace lldb_private;
-/// FIXME - The ObjC Runtime trampoline handler doesn't really belong here.
-/// I am putting it here so I can invoke it in the Trampoline code here, but
-/// it should be moved to the ObjC Runtime support when it is set up.
-
-
//----------------------------------------------------------------------
// Create an instance of this class. This function is filled into
// the plugin info class that gets handed out by the plugin factory and
@@ -188,6 +184,7 @@
return true;
bool uuid_is_valid = uuid.IsValid();
+ bool memory_module_is_kernel = false;
Target &target = process->GetTarget();
ModuleSP memory_module_sp;
@@ -206,6 +203,16 @@
uuid = memory_module_sp->GetUUID();
uuid_is_valid = uuid.IsValid();
}
+ if (memory_module_sp->GetObjectFile()
+ && memory_module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeExecutable
+ && memory_module_sp->GetObjectFile()->GetStrata() == ObjectFile::eStrataKernel)
+ {
+ memory_module_is_kernel = true;
+ if (memory_module_sp->GetArchitecture().IsValid())
+ {
+ target.SetArchitecture(memory_module_sp->GetArchitecture());
+ }
+ }
}
if (!module_sp)
@@ -214,83 +221,107 @@
{
ModuleList &target_images = target.GetImages();
module_sp = target_images.FindModule(uuid);
-
+
if (!module_sp)
{
ModuleSpec module_spec;
module_spec.GetUUID() = uuid;
- module_sp = target.GetSharedModule (module_spec);
+ module_spec.GetArchitecture() = target.GetArchitecture();
+
+ // For the kernel, we really do need an on-disk file copy of the
+ // binary.
+ bool force_symbols_search = false;
+ if (memory_module_is_kernel)
+ {
+ force_symbols_search = true;
+ }
+
+ if (Symbols::DownloadObjectAndSymbolFile (module_spec, force_symbols_search))
+ {
+ if (module_spec.GetFileSpec().Exists())
+ {
+ module_sp.reset(new Module (module_spec.GetFileSpec(), target.GetArchitecture()));
+ if (module_sp.get() && module_sp->MatchesModuleSpec (module_spec))
+ {
+ ModuleList loaded_module_list;
+ loaded_module_list.Append (module_sp);
+ target.ModulesDidLoad (loaded_module_list);
+ }
+ }
+ }
+
+ // Ask the Target to find this file on the local system, if possible.
+ // This will search in the list of currently-loaded files, look in the
+ // standard search paths on the system, and on a Mac it will try calling
+ // the DebugSymbols framework with the UUID to find the binary via its
+ // search methods.
+ if (!module_sp)
+ {
+ module_sp = target.GetSharedModule (module_spec);
+ }
}
}
}
- if (memory_module_sp)
+ if (memory_module_sp && module_sp)
{
- // Someone already supplied a file, make sure it is the right one.
- if (module_sp)
+ if (module_sp->GetUUID() == memory_module_sp->GetUUID())
{
- if (module_sp->GetUUID() == memory_module_sp->GetUUID())
+ target.GetImages().Append(module_sp);
+ if (memory_module_is_kernel && target.GetExecutableModulePointer() != module_sp.get())
+ {
+ target.SetExecutableModule (module_sp, false);
+ }
+
+ ObjectFile *ondisk_object_file = module_sp->GetObjectFile();
+ ObjectFile *memory_object_file = memory_module_sp->GetObjectFile();
+ if (memory_object_file && ondisk_object_file)
{
- ObjectFile *ondisk_object_file = module_sp->GetObjectFile();
- ObjectFile *memory_object_file = memory_module_sp->GetObjectFile();
- if (memory_object_file && ondisk_object_file)
+ SectionList *ondisk_section_list = ondisk_object_file->GetSectionList ();
+ SectionList *memory_section_list = memory_object_file->GetSectionList ();
+ if (memory_section_list && ondisk_section_list)
{
- SectionList *ondisk_section_list = ondisk_object_file->GetSectionList ();
- SectionList *memory_section_list = memory_object_file->GetSectionList ();
- if (memory_section_list && ondisk_section_list)
+ const uint32_t num_ondisk_sections = ondisk_section_list->GetSize();
+ // There may be CTF sections in the memory image so we can't
+ // always just compare the number of sections (which are actually
+ // segments in mach-o parlance)
+ uint32_t sect_idx = 0;
+
+ // Use the memory_module's addresses for each section to set the
+ // file module's load address as appropriate. We don't want to use
+ // a single slide value for the entire kext - different segments may
+ // be slid different amounts by the kext loader.
+
+ uint32_t num_sections_loaded = 0;
+ for (sect_idx=0; sect_idx<num_ondisk_sections; ++sect_idx)
{
- const uint32_t num_ondisk_sections = ondisk_section_list->GetSize();
- // There may be CTF sections in the memory image so we can't
- // always just compare the number of sections (which are actually
- // segments in mach-o parlance)
- uint32_t sect_idx = 0;
-
-
- // We now iterate through all sections in the file module
- // and look to see if the memory module has a load address
- // for that section.
- uint32_t num_sections_loaded = 0;
- for (sect_idx=0; sect_idx<num_ondisk_sections; ++sect_idx)
+ SectionSP ondisk_section_sp(ondisk_section_list->GetSectionAtIndex(sect_idx));
+ if (ondisk_section_sp)
{
- SectionSP ondisk_section_sp(ondisk_section_list->GetSectionAtIndex(sect_idx));
- if (ondisk_section_sp)
+ const Section *memory_section = memory_section_list->FindSectionByName(ondisk_section_sp->GetName()).get();
+ if (memory_section)
{
- const Section *memory_section = memory_section_list->FindSectionByName(ondisk_section_sp->GetName()).get();
- if (memory_section)
- {
- target.GetSectionLoadList().SetSectionLoadAddress (ondisk_section_sp, memory_section->GetFileAddress());
- ++num_sections_loaded;
- }
+ target.GetSectionLoadList().SetSectionLoadAddress (ondisk_section_sp, memory_section->GetFileAddress());
+ ++num_sections_loaded;
}
}
- if (num_sections_loaded > 0)
- load_process_stop_id = process->GetStopID();
- else
- module_sp.reset(); // No sections were loaded
}
+ if (num_sections_loaded > 0)
+ load_process_stop_id = process->GetStopID();
else
- module_sp.reset(); // One or both section lists
+ module_sp.reset(); // No sections were loaded
}
else
- module_sp.reset(); // One or both object files missing
+ module_sp.reset(); // One or both section lists
}
else
- module_sp.reset(); // UUID mismatch
- }
-
- // Use the memory module as the module if we didn't like the file
- // module we either found or were supplied with
- if (!module_sp)
- {
- module_sp = memory_module_sp;
- // Load the memory image in the target as all adresses are already correct
- bool changed = false;
- target.GetImages().Append (memory_module_sp);
- if (module_sp->SetLoadAddress (target, 0, changed))
- load_process_stop_id = process->GetStopID();
+ module_sp.reset(); // One or both object files missing
}
+ else
+ module_sp.reset(); // UUID mismatch
}
+
bool is_loaded = IsLoaded();
if (so_address.IsValid())
@@ -301,6 +332,28 @@
target.GetImages().ResolveFileAddress (address, so_address);
}
+
+ if (is_loaded && module_sp && memory_module_is_kernel)
+ {
+ Stream *s = &target.GetDebugger().GetOutputStream();
+ if (s)
+ {
+ char uuidbuf[64];
+ s->Printf ("Kernel UUID: %s\n", module_sp->GetUUID().GetAsCString(uuidbuf, sizeof (uuidbuf)));
+ s->Printf ("Load Address: 0x%llx\n", address);
+ if (module_sp->GetFileSpec().GetDirectory().IsEmpty())
+ {
+ s->Printf ("Loaded kernel file %s\n", module_sp->GetFileSpec().GetFilename().AsCString());
+ }
+ else
+ {
+ s->Printf ("Loaded kernel file %s/%s\n",
+ module_sp->GetFileSpec().GetDirectory().AsCString(),
+ module_sp->GetFileSpec().GetFilename().AsCString());
+ }
+ s->Flush ();
+ }
+ }
return is_loaded;
}
@@ -342,7 +395,17 @@
{
m_kernel.Clear(false);
m_kernel.module_sp = m_process->GetTarget().GetExecutableModule();
- strncpy(m_kernel.name, "mach_kernel", sizeof(m_kernel.name));
+
+ ConstString kernel_name("mach_kernel");
+ if (m_kernel.module_sp.get()
+ && m_kernel.module_sp->GetObjectFile()
+ && !m_kernel.module_sp->GetObjectFile()->GetFileSpec().GetFilename().IsEmpty())
+ {
+ kernel_name = m_kernel.module_sp->GetObjectFile()->GetFileSpec().GetFilename();
+ }
+ strncpy (m_kernel.name, kernel_name.AsCString(), sizeof(m_kernel.name));
+ m_kernel.name[sizeof (m_kernel.name) - 1] = '\0';
+
if (m_kernel.address == LLDB_INVALID_ADDRESS)
{
m_kernel.address = m_process->GetImageInfoAddress ();
@@ -353,7 +416,25 @@
// the file if we have one
ObjectFile *kernel_object_file = m_kernel.module_sp->GetObjectFile();
if (kernel_object_file)
- m_kernel.address = kernel_object_file->GetHeaderAddress().GetFileAddress();
+ {
+ addr_t load_address = kernel_object_file->GetHeaderAddress().GetLoadAddress(&m_process->GetTarget());
+ addr_t file_address = kernel_object_file->GetHeaderAddress().GetFileAddress();
+ if (load_address != LLDB_INVALID_ADDRESS && load_address != 0)
+ {
+ m_kernel.address = load_address;
+ if (load_address != file_address)
+ {
+ // Don't accidentally relocate the kernel to the File address --
+ // the Load address has already been set to its actual in-memory address.
+ // Mark it as IsLoaded.
+ m_kernel.load_process_stop_id = m_process->GetStopID();
+ }
+ }
+ else
+ {
+ m_kernel.address = file_address;
+ }
+ }
}
}
@@ -365,7 +446,7 @@
}
}
- if (m_kernel.IsLoaded())
+ if (m_kernel.IsLoaded() && m_kernel.module_sp)
{
static ConstString kext_summary_symbol ("gLoadedKextSummaries");
const Symbol *symbol = m_kernel.module_sp->FindFirstSymbolWithNameAndType (kext_summary_symbol, eSymbolTypeData);
@@ -484,46 +565,25 @@
return false;
Stream *s = &m_process->GetTarget().GetDebugger().GetOutputStream();
+ if (s)
+ s->Printf ("Loading %d kext modules ", count);
for (uint32_t i = 0; i < count; i++)
{
- if (s)
- {
- const uint8_t *u = (const uint8_t *)kext_summaries[i].uuid.GetBytes();
- if (u)
- {
- s->Printf("Loading kext: %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 0x%16.16llx \"%s\"...",
- 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],
- kext_summaries[i].address, kext_summaries[i].name);
- }
- else
- {
- s->Printf("0x%16.16llx \"%s\"...", kext_summaries[i].address, kext_summaries[i].name);
- }
- }
-
if (!kext_summaries[i].LoadImageUsingMemoryModule (m_process))
kext_summaries[i].LoadImageAtFileAddress (m_process);
if (s)
- {
- if (kext_summaries[i].module_sp)
- {
- if (kext_summaries[i].module_sp->GetFileSpec().GetDirectory())
- s->Printf("\n found kext: %s/%s\n",
- kext_summaries[i].module_sp->GetFileSpec().GetDirectory().AsCString(),
- kext_summaries[i].module_sp->GetFileSpec().GetFilename().AsCString());
- else
- s->Printf("\n found kext: %s\n",
- kext_summaries[i].module_sp->GetFileSpec().GetFilename().AsCString());
- }
- else
- s->Printf (" failed to locate/load.\n");
- }
-
+ s->Printf (".");
+
if (log)
kext_summaries[i].PutToLog (log.get());
}
+ if (s)
+ {
+ s->Printf (" done.\n");
+ s->Flush ();
+ }
+
bool return_value = AddModulesUsingImageInfos (kext_summaries);
return return_value;
}
@@ -567,10 +627,6 @@
DataBufferHeap data(count, 0);
Error error;
- Stream *s = &m_process->GetTarget().GetDebugger().GetOutputStream();
-
- if (s)
- s->Printf ("Reading %u kext summaries...\n", image_infos_count);
const bool prefer_file_cache = false;
const size_t bytes_read = m_process->GetTarget().ReadMemory (kext_summary_addr,
prefer_file_cache,
@@ -725,7 +781,6 @@
DEBUG_PRINTF("DynamicLoaderDarwinKernel::%s() process state = %s\n", __FUNCTION__, StateAsCString(m_process->GetState()));
Clear(true);
m_process = process;
- m_process->GetTarget().GetSectionLoadList().Clear();
}
void
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Mon Oct 15 11:27:58 2012
@@ -168,6 +168,30 @@
return cstr_len > 0;
}
+lldb::ModuleSP
+AppleObjCRuntime::GetObjCModule ()
+{
+ ModuleSP module_sp (m_objc_module_wp.lock());
+ if (module_sp)
+ return module_sp;
+
+ Process *process = GetProcess();
+ if (process)
+ {
+ ModuleList& modules = process->GetTarget().GetImages();
+ for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+ {
+ module_sp = modules.GetModuleAtIndex(idx);
+ if (AppleObjCRuntime::AppleIsModuleObjCLibrary(module_sp))
+ {
+ m_objc_module_wp = module_sp;
+ return module_sp;
+ }
+ }
+ }
+ return ModuleSP();
+}
+
Address *
AppleObjCRuntime::GetPrintForDebuggerAddr()
{
@@ -211,15 +235,17 @@
bool
AppleObjCRuntime::AppleIsModuleObjCLibrary (const ModuleSP &module_sp)
{
- const FileSpec &module_file_spec = module_sp->GetFileSpec();
- static ConstString ObjCName ("libobjc.A.dylib");
-
- if (module_file_spec)
+ if (module_sp)
{
- if (module_file_spec.GetFilename() == ObjCName)
- return true;
+ const FileSpec &module_file_spec = module_sp->GetFileSpec();
+ static ConstString ObjCName ("libobjc.A.dylib");
+
+ if (module_file_spec)
+ {
+ if (module_file_spec.GetFilename() == ObjCName)
+ return true;
+ }
}
-
return false;
}
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Mon Oct 15 11:27:58 2012
@@ -63,17 +63,10 @@
virtual lldb::ThreadPlanSP
GetStepThroughTrampolinePlan (Thread &thread, bool stop_others);
- virtual bool
- IsValidISA(ObjCISA isa)
- {
- return false;
- }
-
- virtual ObjCISA
- GetISA(ValueObject& valobj)
- {
- return 0;
- }
+ // Get the "libobjc.A.dylib" module from the current target if we can find
+ // it, also cache it once it is found to ensure quick lookups.
+ lldb::ModuleSP
+ GetObjCModule ();
//------------------------------------------------------------------
// Static Functions
@@ -111,8 +104,9 @@
bool m_read_objc_library;
std::auto_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
lldb::BreakpointSP m_objc_exception_bp_sp;
+ lldb::ModuleWP m_objc_module_wp;
- AppleObjCRuntime(Process *process) :
+ AppleObjCRuntime(Process *process) :
lldb_private::ObjCLanguageRuntime(process),
m_read_objc_library (false),
m_objc_trampoline_handler_ap(NULL)
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Mon Oct 15 11:27:58 2012
@@ -24,6 +24,7 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
@@ -155,35 +156,35 @@
// this code relies on the assumption that an Objective-C object always starts
// with an ISA at offset 0.
-ObjCLanguageRuntime::ObjCISA
-AppleObjCRuntimeV1::GetISA(ValueObject& valobj)
-{
- if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != eLanguageTypeObjC)
- return 0;
-
- // if we get an invalid VO (which might still happen when playing around
- // with pointers returned by the expression parser, don't consider this
- // a valid ObjC object)
- if (valobj.GetValue().GetContextType() == Value::eContextTypeInvalid)
- return 0;
-
- addr_t isa_pointer = valobj.GetPointerValue();
-
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-
- Process *process = exe_ctx.GetProcessPtr();
- if (process)
- {
- uint8_t pointer_size = process->GetAddressByteSize();
-
- Error error;
- return process->ReadUnsignedIntegerFromMemory (isa_pointer,
- pointer_size,
- 0,
- error);
- }
- return 0;
-}
+//ObjCLanguageRuntime::ObjCISA
+//AppleObjCRuntimeV1::GetISA(ValueObject& valobj)
+//{
+//// if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != eLanguageTypeObjC)
+//// return 0;
+//
+// // if we get an invalid VO (which might still happen when playing around
+// // with pointers returned by the expression parser, don't consider this
+// // a valid ObjC object)
+// if (valobj.GetValue().GetContextType() == Value::eContextTypeInvalid)
+// return 0;
+//
+// addr_t isa_pointer = valobj.GetPointerValue();
+//
+// ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+//
+// Process *process = exe_ctx.GetProcessPtr();
+// if (process)
+// {
+// uint8_t pointer_size = process->GetAddressByteSize();
+//
+// Error error;
+// return process->ReadUnsignedIntegerFromMemory (isa_pointer,
+// pointer_size,
+// 0,
+// error);
+// }
+// return 0;
+//}
AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1 (ValueObject &isa_pointer)
{
@@ -287,34 +288,124 @@
return ObjCLanguageRuntime::ClassDescriptorSP(new AppleObjCRuntimeV1::ClassDescriptorV1(m_parent_isa,process_sp));
}
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV1::GetClassDescriptor (ValueObject& in_value)
+bool
+AppleObjCRuntimeV1::UpdateISAToDescriptorMap_Impl()
{
- ObjCISA isa = GetISA(in_value);
+ lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- ObjCLanguageRuntime::ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ObjCLanguageRuntime::ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
+ Process *process_ptr = GetProcess();
- if (found != end && found->second)
- return found->second;
+ if (!process_ptr)
+ return false;
- ClassDescriptorSP descriptor = ClassDescriptorSP(new ClassDescriptorV1(in_value));
- if (descriptor && descriptor->IsValid())
- m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
- return descriptor;
-}
-
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV1::GetClassDescriptor (ObjCISA isa)
-{
- ObjCLanguageRuntime::ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ObjCLanguageRuntime::ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
+ ProcessSP process_sp = process_ptr->shared_from_this();
+
+ ModuleSP objc_module_sp(GetObjCModule());
+
+ if (!objc_module_sp)
+ return false;
+
+ uint32_t isa_count = 0;
- if (found != end && found->second)
- return found->second;
+ static ConstString g_objc_debug_class_hash("_objc_debug_class_hash");
- ClassDescriptorSP descriptor = ClassDescriptorSP(new ClassDescriptorV1(isa,m_process->CalculateProcess()));
- if (descriptor && descriptor->IsValid())
- m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
- return descriptor;
+ const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_objc_debug_class_hash, lldb::eSymbolTypeData);
+ if (symbol)
+ {
+ lldb::addr_t objc_debug_class_hash_addr = symbol->GetAddress().GetLoadAddress(&process_sp->GetTarget());
+
+ if (objc_debug_class_hash_addr != LLDB_INVALID_ADDRESS)
+ {
+ Error error;
+ lldb::addr_t objc_debug_class_hash_ptr = process_sp->ReadPointerFromMemory(objc_debug_class_hash_addr, error);
+ if (error.Success() && objc_debug_class_hash_ptr != 0 && objc_debug_class_hash_ptr != LLDB_INVALID_ADDRESS)
+ {
+ // Read the NXHashTable struct:
+ //
+ // typedef struct {
+ // const NXHashTablePrototype *prototype;
+ // unsigned count;
+ // unsigned nbBuckets;
+ // void *buckets;
+ // const void *info;
+ // } NXHashTable;
+
+ DataBufferHeap buffer(1024, 0);
+ if (process_sp->ReadMemory(objc_debug_class_hash_ptr, buffer.GetBytes(), 20, error) == 20)
+ {
+ const uint32_t addr_size = m_process->GetAddressByteSize();
+ const ByteOrder byte_order = m_process->GetByteOrder();
+ DataExtractor data (buffer.GetBytes(), buffer.GetByteSize(), byte_order, addr_size);
+ uint32_t offset = addr_size + 4; // Skip prototype
+ const uint32_t num_buckets = data.GetU32(&offset);
+ const addr_t buckets_ptr = data.GetPointer(&offset);
+
+ const uint32_t data_size = num_buckets * 2 * sizeof(uint32_t);
+ buffer.SetByteSize(data_size);
+
+ if (process_sp->ReadMemory(buckets_ptr, buffer.GetBytes(), data_size, error) == data_size)
+ {
+ data.SetData(buffer.GetBytes(), buffer.GetByteSize(), byte_order);
+ offset = 0;
+ for (uint32_t bucket_idx = 0; bucket_idx < num_buckets; ++bucket_idx)
+ {
+ const uint32_t bucket_isa_count = data.GetU32 (&offset);
+ const lldb::addr_t bucket_data = data.GetU32 (&offset);
+
+
+ if (bucket_isa_count == 0)
+ continue;
+
+ isa_count += bucket_isa_count;
+
+ ObjCISA isa;
+ if (bucket_isa_count == 1)
+ {
+ // When we only have one entry in the bucket, the bucket data is the "isa"
+ isa = bucket_data;
+ if (isa)
+ {
+ if (m_isa_to_descriptor_cache.count(isa) == 0)
+ {
+ ClassDescriptorSP descriptor_sp (new ClassDescriptorV1(isa, process_sp));
+
+ if (log && log->GetVerbose())
+ log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%llx from _objc_debug_class_hash to isa->descriptor cache", isa);
+
+ m_isa_to_descriptor_cache[isa] = descriptor_sp;
+ }
+ }
+ }
+ else
+ {
+ // When we have more than one entry in the bucket, the bucket data is a pointer
+ // to an array of "isa" values
+ addr_t isa_addr = bucket_data;
+ for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count; ++isa_idx, isa_addr += addr_size)
+ {
+ isa = m_process->ReadPointerFromMemory(isa_addr, error);
+
+ if (isa && isa != LLDB_INVALID_ADDRESS)
+ {
+ if (m_isa_to_descriptor_cache.count(isa) == 0)
+ {
+ ClassDescriptorSP descriptor_sp (new ClassDescriptorV1(isa, process_sp));
+
+ if (log && log->GetVerbose())
+ log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%llx from _objc_debug_class_hash to isa->descriptor cache", isa);
+
+ m_isa_to_descriptor_cache[isa] = descriptor_sp;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return isa_count > 0;
}
+
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Mon Oct 15 11:27:58 2012
@@ -124,19 +124,7 @@
}
virtual bool
- IsValidISA(ObjCISA isa)
- {
- return (isa != 0) && ( (isa % 2) == 0);
- }
-
- virtual ObjCISA
- GetISA(ValueObject& valobj);
-
- virtual ClassDescriptorSP
- GetClassDescriptor (ValueObject& in_value);
-
- virtual ClassDescriptorSP
- GetClassDescriptor (ObjCISA isa);
+ UpdateISAToDescriptorMap_Impl();
protected:
virtual lldb::BreakpointResolverSP
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Oct 15 11:27:58 2012
@@ -107,7 +107,8 @@
const ModuleSP &objc_module_sp) :
AppleObjCRuntime (process),
m_get_class_name_args(LLDB_INVALID_ADDRESS),
- m_get_class_name_args_mutex(Mutex::eMutexTypeNormal)
+ m_get_class_name_args_mutex(Mutex::eMutexTypeNormal),
+ m_process_wp (process->shared_from_this())
{
static const ConstString g_gdb_object_getClass("gdb_object_getClass");
m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
@@ -117,7 +118,7 @@
AppleObjCRuntimeV2::RunFunctionToFindClassName(addr_t object_addr, Thread *thread, char *name_dst, size_t max_name_len)
{
// Since we are going to run code we have to make sure only one thread at a time gets to try this.
- Mutex::Locker (m_get_class_name_args_mutex);
+ Mutex::Locker locker(m_get_class_name_args_mutex);
StreamString errors;
@@ -584,7 +585,7 @@
bool
AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr)
{
- return (ptr & 0x01);
+ return (ptr & 1);
}
class RemoteNXMapTable
@@ -596,14 +597,14 @@
m_end_iterator(*this, -1),
m_load_addr(load_addr),
m_map_pair_size(m_process_sp->GetAddressByteSize() * 2),
- m_NXMAPNOTAKEY(m_process_sp->GetAddressByteSize() == 8 ? 0xffffffffffffffffull : 0xffffffffull)
+ m_NXMAPNOTAKEY(m_process_sp->GetAddressByteSize() == 8 ? UINT64_MAX : UINT32_MAX)
{
lldb::addr_t cursor = load_addr;
Error err;
// const struct +NXMapTablePrototype *prototype;
- m_prototype_la = m_process_sp->ReadPointerFromMemory(cursor, err);
+ m_prototype_ptr = m_process_sp->ReadPointerFromMemory(cursor, err);
cursor += m_process_sp->GetAddressByteSize();
// unsigned count;
@@ -615,7 +616,7 @@
cursor += sizeof(unsigned);
// void *buckets;
- m_buckets_la = m_process_sp->ReadPointerFromMemory(cursor, err);
+ m_buckets_ptr = m_process_sp->ReadPointerFromMemory(cursor, err);
}
// const_iterator mimics NXMapState and its code comes from NXInitMapState and NXNextMapState.
@@ -672,16 +673,16 @@
return element();
}
- lldb::addr_t pairs_la = m_parent.m_buckets_la;
+ lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
size_t map_pair_size = m_parent.m_map_pair_size;
- lldb::addr_t pair_la = pairs_la + (m_index * map_pair_size);
+ lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
Error err;
- lldb::addr_t key = m_parent.m_process_sp->ReadPointerFromMemory(pair_la, err);
+ lldb::addr_t key = m_parent.m_process_sp->ReadPointerFromMemory(pair_ptr, err);
if (!err.Success())
return element();
- lldb::addr_t value = m_parent.m_process_sp->ReadPointerFromMemory(pair_la + m_parent.m_process_sp->GetAddressByteSize(), err);
+ lldb::addr_t value = m_parent.m_process_sp->ReadPointerFromMemory(pair_ptr + m_parent.m_process_sp->GetAddressByteSize(), err);
if (!err.Success())
return element();
@@ -699,15 +700,15 @@
if (m_index == -1)
return;
- lldb::addr_t pairs_la = m_parent.m_buckets_la;
+ lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
size_t map_pair_size = m_parent.m_map_pair_size;
lldb::addr_t NXMAPNOTAKEY = m_parent.m_NXMAPNOTAKEY;
Error err;
while (m_index--)
{
- lldb::addr_t pair_la = pairs_la + (m_index * map_pair_size);
- lldb::addr_t key = m_parent.m_process_sp->ReadPointerFromMemory(pair_la, err);
+ lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
+ lldb::addr_t key = m_parent.m_process_sp->ReadPointerFromMemory(pair_ptr, err);
if (!err.Success())
{
@@ -735,10 +736,10 @@
private:
// contents of _NXMapTable struct
- lldb::addr_t m_prototype_la;
+ lldb::addr_t m_prototype_ptr;
uint32_t m_count;
uint32_t m_nbBucketsMinusOne;
- lldb::addr_t m_buckets_la;
+ lldb::addr_t m_buckets_ptr;
lldb::ProcessSP m_process_sp;
const_iterator m_end_iterator;
@@ -781,9 +782,9 @@
if (m_version != 12)
return;
- m_clsopt_la = load_addr + m_clsopt_offset;
+ m_clsopt_ptr = load_addr + m_clsopt_offset;
- cursor = m_clsopt_la;
+ cursor = m_clsopt_ptr;
// uint32_t capacity;
m_capacity = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(uint32_t), 0, err);
@@ -800,7 +801,7 @@
cursor += sizeof(uint32_t);
// uint32_t zero;
- m_zero_offset = cursor - m_clsopt_la;
+ m_zero_offset = cursor - m_clsopt_ptr;
cursor += sizeof(uint32_t);
// uint32_t unused;
@@ -822,7 +823,7 @@
cursor += sizeof(int32_t) * m_capacity;
// objc_classheader_t clsOffsets[capacity];
- m_clsOffsets_la = cursor;
+ m_clsOffsets_ptr = cursor;
cursor += (m_classheader_size * m_capacity);
// uint32_t duplicateCount;
@@ -830,7 +831,7 @@
cursor += sizeof(uint32_t);
// objc_classheader_t duplicateOffsets[duplicateCount];
- m_duplicateOffsets_la = cursor;
+ m_duplicateOffsets_ptr = cursor;
}
friend class const_iterator;
@@ -888,23 +889,23 @@
if (m_index >= m_parent.m_capacity + m_parent.m_duplicateCount)
return 0; // index out of range
- lldb::addr_t classheader_la;
+ lldb::addr_t classheader_ptr;
if (m_index >= m_parent.m_capacity)
{
// index in the duplicate offsets
uint32_t index = (uint32_t)((uint64_t)m_index - (uint64_t)m_parent.m_capacity);
- classheader_la = m_parent.m_duplicateOffsets_la + (index * m_parent.m_classheader_size);
+ classheader_ptr = m_parent.m_duplicateOffsets_ptr + (index * m_parent.m_classheader_size);
}
else
{
// index in the offsets
uint32_t index = (uint32_t)m_index;
- classheader_la = m_parent.m_clsOffsets_la + (index * m_parent.m_classheader_size);
+ classheader_ptr = m_parent.m_clsOffsets_ptr + (index * m_parent.m_classheader_size);
}
Scalar clsOffset;
- m_parent.m_process_sp->ReadScalarIntegerFromMemory(classheader_la, sizeof(int32_t), /*is_signed*/ true, clsOffset, err);
+ m_parent.m_process_sp->ReadScalarIntegerFromMemory(classheader_ptr, sizeof(int32_t), /*is_signed*/ true, clsOffset, err);
if (!err.Success())
return 0;
@@ -915,7 +916,7 @@
if (clsOffset_int == m_parent.m_zero_offset)
return 0; // == offsetof(objc_clsopt_t, zero)
- return m_parent.m_clsopt_la + (int64_t)clsOffset_int;
+ return m_parent.m_clsopt_ptr + (int64_t)clsOffset_int;
}
void AdvanceToValidIndex ()
@@ -954,14 +955,14 @@
uint32_t m_version;
int32_t m_clsopt_offset;
- lldb::addr_t m_clsopt_la;
+ lldb::addr_t m_clsopt_ptr;
// contents of objc_clsopt struct
uint32_t m_capacity;
uint32_t m_mask;
uint32_t m_duplicateCount;
- lldb::addr_t m_clsOffsets_la;
- lldb::addr_t m_duplicateOffsets_la;
+ lldb::addr_t m_clsOffsets_ptr;
+ lldb::addr_t m_duplicateOffsets_ptr;
int32_t m_zero_offset;
lldb::ProcessSP m_process_sp;
@@ -973,50 +974,63 @@
class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
{
public:
- ClassDescriptorV2 (ObjCLanguageRuntime &runtime, ValueObject &ptr_to_object) :
- m_runtime(runtime)
- {
- lldb::addr_t object_la = ptr_to_object.GetValueAsUnsigned(0);
- lldb::ProcessSP process_sp = ptr_to_object.GetProcessSP();
-
- Error error;
- ObjCLanguageRuntime::ObjCISA isa = process_sp->ReadPointerFromMemory(object_la,
- error);
-
- if (isa == LLDB_INVALID_ADDRESS)
- m_valid = false;
- else
- Initialize (isa, process_sp);
- }
+ friend class lldb_private::AppleObjCRuntimeV2;
- ClassDescriptorV2 (ObjCLanguageRuntime &runtime, ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp) :
- m_runtime(runtime)
+private:
+ // The constructor should only be invoked by the runtime as it builds its caches
+ // or populates them. A ClassDescriptorV2 should only ever exist in a cache.
+ ClassDescriptorV2 (AppleObjCRuntimeV2 &runtime, ObjCLanguageRuntime::ObjCISA isa) :
+ m_runtime (runtime),
+ m_objc_class_ptr (isa),
+ m_name ()
{
- Initialize (isa, process_sp);
}
+public:
virtual ConstString
GetClassName ()
{
- if (!m_valid)
- return ConstString();
-
+ if (!m_name)
+ {
+ lldb::ProcessSP process_sp = m_runtime.GetProcessSP();
+
+ if (process_sp)
+ {
+ std::auto_ptr<objc_class_t> objc_class;
+ std::auto_ptr<class_ro_t> class_ro;
+ std::auto_ptr<class_rw_t> class_rw;
+
+ if (!Read_objc_class(process_sp, objc_class))
+ return m_name;
+ if (!Read_class_row(process_sp, *objc_class, class_ro, class_rw))
+ return m_name;
+
+ m_name = ConstString(class_ro->m_name.c_str());
+ }
+ }
return m_name;
}
virtual ObjCLanguageRuntime::ClassDescriptorSP
GetSuperclass ()
{
- if (!m_valid)
+ lldb::ProcessSP process_sp = m_runtime.GetProcessSP();
+
+ if (!process_sp)
return ObjCLanguageRuntime::ClassDescriptorSP();
- return m_runtime.GetClassDescriptor(m_objc_class.m_superclass);
+ std::auto_ptr<objc_class_t> objc_class;
+
+ if (!Read_objc_class(process_sp, objc_class))
+ return ObjCLanguageRuntime::ClassDescriptorSP();
+
+ return m_runtime.ObjCLanguageRuntime::GetClassDescriptor(objc_class->m_superclass);
}
virtual bool
IsValid ()
{
- return m_valid;
+ return true; // any Objective-C v2 runtime class descriptor we vend is valid
}
virtual bool
@@ -1028,19 +1042,29 @@
virtual uint64_t
GetInstanceSize ()
{
- if (!m_valid)
- return 0;
+ lldb::ProcessSP process_sp = m_runtime.GetProcessSP();
- return m_instance_size;
+ if (process_sp)
+ {
+ std::auto_ptr<objc_class_t> objc_class;
+ std::auto_ptr<class_ro_t> class_ro;
+ std::auto_ptr<class_rw_t> class_rw;
+
+ if (!Read_objc_class(process_sp, objc_class))
+ return 0;
+ if (!Read_class_row(process_sp, *objc_class, class_ro, class_rw))
+ return 0;
+
+ return class_ro->m_instanceSize;
+ }
+
+ return 0;
}
virtual ObjCLanguageRuntime::ObjCISA
GetISA ()
- {
- if (!m_valid)
- return 0;
-
- return m_objc_class_la;
+ {
+ return m_objc_class_ptr;
}
virtual bool
@@ -1048,45 +1072,28 @@
std::function <void (const char *, const char *)> const &instance_method_func,
std::function <void (const char *, const char *)> const &class_method_func)
{
- if (!m_valid)
- return false;
-
- std::auto_ptr <class_ro_t> ro;
- std::auto_ptr <class_rw_t> rw;
-
- ProcessSP process_sp = m_process_wp.lock();
-
- if (!process_sp)
- return false;
+ lldb::ProcessSP process_sp = m_runtime.GetProcessSP();
+
+ std::auto_ptr<objc_class_t> objc_class;
+ std::auto_ptr<class_ro_t> class_ro;
+ std::auto_ptr<class_rw_t> class_rw;
- if (IsRealized())
- {
- rw.reset(new class_rw_t);
- if (!rw->Read(process_sp, m_objc_class.m_data_la))
- return false;
-
- ro.reset(new class_ro_t);
- if (!ro->Read(process_sp, rw->m_ro_la))
- return false;
- }
- else
- {
- ro.reset(new class_ro_t);
- if (!ro->Read(process_sp, m_objc_class.m_data_la))
- return false;
- }
+ if (!Read_objc_class(process_sp, objc_class))
+ return 0;
+ if (!Read_class_row(process_sp, *objc_class, class_ro, class_rw))
+ return 0;
static ConstString NSObject_name("NSObject");
if (m_name != NSObject_name && superclass_func)
- superclass_func(m_objc_class.m_superclass);
+ superclass_func(objc_class->m_superclass);
if (instance_method_func)
{
std::auto_ptr <method_list_t> base_method_list;
base_method_list.reset(new method_list_t);
- if (!base_method_list->Read(process_sp, ro->m_baseMethods_la))
+ if (!base_method_list->Read(process_sp, class_ro->m_baseMethods_ptr))
return false;
if (base_method_list->m_entsize != method_t::GetSize(process_sp))
@@ -1097,7 +1104,7 @@
for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i)
{
- method->Read(process_sp, base_method_list->m_first_la + (i * base_method_list->m_entsize));
+ method->Read(process_sp, base_method_list->m_first_ptr + (i * base_method_list->m_entsize));
instance_method_func(method->m_name.c_str(), method->m_types.c_str());
}
@@ -1105,195 +1112,66 @@
if (class_method_func)
{
- ObjCLanguageRuntime::ClassDescriptorSP metaclass = m_runtime.GetClassDescriptor(m_objc_class.m_isa);
+ ClassDescriptorV2 metaclass(m_runtime, objc_class->m_isa); // The metaclass is not in the cache
// We don't care about the metaclass's superclass, or its class methods. Its instance methods are
// our class methods.
- metaclass->Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
- class_method_func,
- std::function <void (const char *, const char *)> (nullptr));
+ metaclass.Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
+ class_method_func,
+ std::function <void (const char *, const char *)> (nullptr));
}
while (0);
return true;
}
- virtual bool
- IsRealized ()
- {
- if (!m_valid)
- return false;
-
- return m_realized;
- }
-
virtual
~ClassDescriptorV2 ()
{
}
-
-protected:
- virtual bool
- CheckPointer (lldb::addr_t value,
- uint32_t ptr_size)
- {
- if (ptr_size != 8)
- return true;
- return ((value & 0xFFFF800000000000) == 0);
- }
-
- void
- Initialize (ObjCLanguageRuntime::ObjCISA objc_class_la, lldb::ProcessSP process_sp)
- {
- m_valid = true;
-
- if (!objc_class_la || !process_sp)
- {
- m_valid = false;
- return;
- }
-
- m_objc_class_la = objc_class_la;
-
- size_t ptr_size = process_sp->GetAddressByteSize();
- Error error;
-
- const bool allow_NULLs = false;
- const bool allow_tagged = false;
- const bool check_version_specific = true;
-
- if (!IsPointerValid(m_objc_class_la, ptr_size, allow_NULLs, allow_tagged, check_version_specific))
- {
- m_valid = false;
- return;
- }
-
- if (!m_objc_class.Read(process_sp, m_objc_class_la))
- {
- m_valid = false;
- return;
- }
-
- // Now we just want to grab the instance size and the name.
- // Since we find out whether the class is realized on the way, we'll remember that too.
-
- // The flags for class_r[ow]_t always are the first uint32_t. So just read that.
- if (!IsPointerValid(m_objc_class.m_data_la, ptr_size, allow_NULLs, allow_tagged, check_version_specific))
- {
- m_valid = false;
- return;
- }
-
- uint32_t class_row_t_flags = process_sp->ReadUnsignedIntegerFromMemory(m_objc_class.m_data_la, sizeof(uint32_t), 0, error);
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- m_realized = class_row_t_flags & RW_REALIZED;
-
- lldb::addr_t class_ro_t_la = 0;
-
- if (m_realized)
- {
- lldb::addr_t class_rw_t_la = m_objc_class.m_data_la;
-
- class_ro_t_la = process_sp->ReadPointerFromMemory(class_rw_t_la
- + sizeof(uint32_t) // uint32_t flags
- + sizeof(uint32_t), // uint32_t version
- error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
- }
- else
- {
- class_ro_t_la = m_objc_class.m_data_la;
- }
-
- if (!IsPointerValid(class_ro_t_la, ptr_size))
- {
- m_valid = false;
- return;
- }
-
- // Now that we have a handle on class_ro_t_la, read the desired data out
-
- m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(class_ro_t_la
- + sizeof(uint32_t) // uint32_t flags
- + sizeof(uint32_t), // uint32_t instanceStart
- sizeof(uint32_t),
- 0,
- error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(class_ro_t_la
- + sizeof(uint32_t) // uint32_t flags
- + sizeof(uint32_t) // uint32_t instanceStart
- + sizeof(uint32_t) // uint32_t instanceSize
- + (ptr_size == 8 ? sizeof(uint32_t) : 0) // uint32_t reserved (__LP64__ only)
- + ptr_size, // const uint8_t *ivarLayout
- error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- const size_t buffer_size = 1024;
-
- DataBufferHeap buffer(buffer_size, 0);
- size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer.GetBytes(), buffer_size, error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- if (count)
- m_name = ConstString((char*)buffer.GetBytes());
- else
- m_name = ConstString();
-
- m_process_wp = lldb::ProcessWP(process_sp);
- }
private:
static const uint32_t RW_REALIZED = (1 << 31);
- ObjCLanguageRuntime &m_runtime; // The runtime, so we can read our metaclass.
- bool m_valid; // Gates whether we trust anything here at all.
- lldb::addr_t m_objc_class_la; // The address of the objc_class_t.
-
struct objc_class_t {
ObjCLanguageRuntime::ObjCISA m_isa; // The class's metaclass.
ObjCLanguageRuntime::ObjCISA m_superclass;
- lldb::addr_t m_cache_la;
- lldb::addr_t m_vtable_la;
- lldb::addr_t m_data_la;
+ lldb::addr_t m_cache_ptr;
+ lldb::addr_t m_vtable_ptr;
+ lldb::addr_t m_data_ptr;
uint8_t m_flags;
+ objc_class_t () :
+ m_isa (0),
+ m_superclass (0),
+ m_cache_ptr (0),
+ m_vtable_ptr (0),
+ m_data_ptr (0),
+ m_flags (0)
+ {
+ }
+
+ void
+ Clear()
+ {
+ m_isa = 0;
+ m_superclass = 0;
+ m_cache_ptr = 0;
+ m_vtable_ptr = 0;
+ m_data_ptr = 0;
+ m_flags = 0;
+ }
+
bool Read(ProcessSP &process_sp, lldb::addr_t addr)
{
size_t ptr_size = process_sp->GetAddressByteSize();
size_t objc_class_size = ptr_size // uintptr_t isa;
- + ptr_size // Class superclass;
- + ptr_size // void *cache;
- + ptr_size // IMP *vtable;
- + ptr_size; // uintptr_t data_NEVER_USE;
+ + ptr_size // Class superclass;
+ + ptr_size // void *cache;
+ + ptr_size // IMP *vtable;
+ + ptr_size; // uintptr_t data_NEVER_USE;
DataBufferHeap objc_class_buf (objc_class_size, '\0');
Error error;
@@ -1308,56 +1186,51 @@
uint32_t cursor = 0;
- m_isa = extractor.GetAddress_unchecked(&cursor); // uintptr_t isa;
- m_superclass = extractor.GetAddress_unchecked(&cursor); // Class superclass;
- m_cache_la = extractor.GetAddress_unchecked(&cursor); // void *cache;
- m_vtable_la = extractor.GetAddress_unchecked(&cursor); // IMP *vtable;
+ m_isa = extractor.GetAddress_unchecked(&cursor); // uintptr_t isa;
+ m_superclass = extractor.GetAddress_unchecked(&cursor); // Class superclass;
+ m_cache_ptr = extractor.GetAddress_unchecked(&cursor); // void *cache;
+ m_vtable_ptr = extractor.GetAddress_unchecked(&cursor); // IMP *vtable;
lldb::addr_t data_NEVER_USE = extractor.GetAddress_unchecked(&cursor); // uintptr_t data_NEVER_USE;
- m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
- m_data_la = data_NEVER_USE & ~(lldb::addr_t)3;
+ m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
+ m_data_ptr = data_NEVER_USE & ~(lldb::addr_t)3;
return true;
}
};
- objc_class_t m_objc_class;
-
- // cached information from the class_r[ow]_t
- ConstString m_name;
- uint32_t m_instance_size;
- bool m_realized;
-
struct class_ro_t {
uint32_t m_flags;
uint32_t m_instanceStart;
uint32_t m_instanceSize;
uint32_t m_reserved;
- lldb::addr_t m_ivarLayout_la;
- lldb::addr_t m_name_la;
- lldb::addr_t m_baseMethods_la;
- lldb::addr_t m_baseProtocols_la;
- lldb::addr_t m_ivars_la;
+ lldb::addr_t m_ivarLayout_ptr;
+ lldb::addr_t m_name_ptr;
+ lldb::addr_t m_baseMethods_ptr;
+ lldb::addr_t m_baseProtocols_ptr;
+ lldb::addr_t m_ivars_ptr;
+
+ lldb::addr_t m_weakIvarLayout_ptr;
+ lldb::addr_t m_baseProperties_ptr;
- lldb::addr_t m_weakIvarLayout_la;
- lldb::addr_t m_baseProperties_la;
+ std::string m_name;
bool Read(ProcessSP &process_sp, lldb::addr_t addr)
{
size_t ptr_size = process_sp->GetAddressByteSize();
- size_t size = sizeof(uint32_t) // uint32_t flags;
- + sizeof(uint32_t) // uint32_t instanceStart;
- + sizeof(uint32_t) // uint32_t instanceSize;
- + (ptr_size == 8 ? sizeof(uint32_t) : 0) // uint32_t reserved; // __LP64__ only
- + ptr_size // const uint8_t *ivarLayout;
- + ptr_size // const char *name;
- + ptr_size // const method_list_t *baseMethods;
- + ptr_size // const protocol_list_t *baseProtocols;
- + ptr_size // const ivar_list_t *ivars;
- + ptr_size // const uint8_t *weakIvarLayout;
- + ptr_size; // const property_list_t *baseProperties;
+ size_t size = sizeof(uint32_t) // uint32_t flags;
+ + sizeof(uint32_t) // uint32_t instanceStart;
+ + sizeof(uint32_t) // uint32_t instanceSize;
+ + (ptr_size == 8 ? sizeof(uint32_t) : 0) // uint32_t reserved; // __LP64__ only
+ + ptr_size // const uint8_t *ivarLayout;
+ + ptr_size // const char *name;
+ + ptr_size // const method_list_t *baseMethods;
+ + ptr_size // const protocol_list_t *baseProtocols;
+ + ptr_size // const ivar_list_t *ivars;
+ + ptr_size // const uint8_t *weakIvarLayout;
+ + ptr_size; // const property_list_t *baseProperties;
DataBufferHeap buffer (size, '\0');
Error error;
@@ -1379,14 +1252,25 @@
m_reserved = extractor.GetU32_unchecked(&cursor);
else
m_reserved = 0;
- m_ivarLayout_la = extractor.GetAddress_unchecked(&cursor);
- m_name_la = extractor.GetAddress_unchecked(&cursor);
- m_baseMethods_la = extractor.GetAddress_unchecked(&cursor);
- m_baseProtocols_la = extractor.GetAddress_unchecked(&cursor);
- m_ivars_la = extractor.GetAddress_unchecked(&cursor);
- m_weakIvarLayout_la = extractor.GetAddress_unchecked(&cursor);
- m_baseProperties_la = extractor.GetAddress_unchecked(&cursor);
+ m_ivarLayout_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_name_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_baseMethods_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_baseProtocols_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_ivars_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_weakIvarLayout_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_baseProperties_ptr = extractor.GetAddress_unchecked(&cursor);
+
+ DataBufferHeap name_buf(1024, '\0');
+
+ process_sp->ReadCStringFromMemory(m_name_ptr, (char*)name_buf.GetBytes(), name_buf.GetByteSize(), error);
+
+ if (error.Fail())
+ {
+ return false;
+ }
+ m_name.assign((char*)name_buf.GetBytes());
+
return true;
}
};
@@ -1395,13 +1279,13 @@
uint32_t m_flags;
uint32_t m_version;
- lldb::addr_t m_ro_la;
+ lldb::addr_t m_ro_ptr;
union {
- lldb::addr_t m_method_list_la;
- lldb::addr_t m_method_lists_la;
+ lldb::addr_t m_method_list_ptr;
+ lldb::addr_t m_method_lists_ptr;
};
- lldb::addr_t m_properties_la;
- lldb::addr_t m_protocols_la;
+ lldb::addr_t m_properties_ptr;
+ lldb::addr_t m_protocols_ptr;
ObjCLanguageRuntime::ObjCISA m_firstSubclass;
ObjCLanguageRuntime::ObjCISA m_nextSiblingClass;
@@ -1411,13 +1295,13 @@
size_t ptr_size = process_sp->GetAddressByteSize();
size_t size = sizeof(uint32_t) // uint32_t flags;
- + sizeof(uint32_t) // uint32_t version;
- + ptr_size // const class_ro_t *ro;
- + ptr_size // union { method_list_t **method_lists; method_list_t *method_list; };
- + ptr_size // struct chained_property_list *properties;
- + ptr_size // const protocol_list_t **protocols;
- + ptr_size // Class firstSubclass;
- + ptr_size; // Class nextSiblingClass;
+ + sizeof(uint32_t) // uint32_t version;
+ + ptr_size // const class_ro_t *ro;
+ + ptr_size // union { method_list_t **method_lists; method_list_t *method_list; };
+ + ptr_size // struct chained_property_list *properties;
+ + ptr_size // const protocol_list_t **protocols;
+ + ptr_size // Class firstSubclass;
+ + ptr_size; // Class nextSiblingClass;
DataBufferHeap buffer (size, '\0');
Error error;
@@ -1434,9 +1318,9 @@
m_flags = extractor.GetU32_unchecked(&cursor);
m_version = extractor.GetU32_unchecked(&cursor);
- m_ro_la = extractor.GetAddress_unchecked(&cursor);
- m_method_list_la = extractor.GetAddress_unchecked(&cursor);
- m_properties_la = extractor.GetAddress_unchecked(&cursor);
+ m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_method_list_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_properties_ptr = extractor.GetAddress_unchecked(&cursor);
m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
m_nextSiblingClass = extractor.GetAddress_unchecked(&cursor);
@@ -1448,12 +1332,12 @@
{
uint32_t m_entsize;
uint32_t m_count;
- lldb::addr_t m_first_la;
+ lldb::addr_t m_first_ptr;
bool Read(ProcessSP &process_sp, lldb::addr_t addr)
- {
+ {
size_t size = sizeof(uint32_t) // uint32_t entsize_NEVER_USE;
- + sizeof(uint32_t); // uint32_t count;
+ + sizeof(uint32_t); // uint32_t count;
DataBufferHeap buffer (size, '\0');
Error error;
@@ -1470,7 +1354,7 @@
m_entsize = extractor.GetU32_unchecked(&cursor) & ~(uint32_t)3;
m_count = extractor.GetU32_unchecked(&cursor);
- m_first_la = addr + cursor;
+ m_first_ptr = addr + cursor;
return true;
}
@@ -1478,9 +1362,9 @@
struct method_t
{
- lldb::addr_t m_name_la;
- lldb::addr_t m_types_la;
- lldb::addr_t m_imp_la;
+ lldb::addr_t m_name_ptr;
+ lldb::addr_t m_types_ptr;
+ lldb::addr_t m_imp_ptr;
std::string m_name;
std::string m_types;
@@ -1488,10 +1372,10 @@
static size_t GetSize(ProcessSP &process_sp)
{
size_t ptr_size = process_sp->GetAddressByteSize();
-
+
return ptr_size // SEL name;
- + ptr_size // const char *types;
- + ptr_size; // IMP imp;
+ + ptr_size // const char *types;
+ + ptr_size; // IMP imp;
}
bool Read(ProcessSP &process_sp, lldb::addr_t addr)
@@ -1511,26 +1395,83 @@
uint32_t cursor = 0;
- m_name_la = extractor.GetAddress_unchecked(&cursor);
- m_types_la = extractor.GetAddress_unchecked(&cursor);
- m_imp_la = extractor.GetAddress_unchecked(&cursor);
+ m_name_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_types_ptr = extractor.GetAddress_unchecked(&cursor);
+ m_imp_ptr = extractor.GetAddress_unchecked(&cursor);
const size_t buffer_size = 1024;
size_t count;
DataBufferHeap string_buf(buffer_size, 0);
- count = process_sp->ReadCStringFromMemory(m_name_la, (char*)string_buf.GetBytes(), buffer_size, error);
+ count = process_sp->ReadCStringFromMemory(m_name_ptr, (char*)string_buf.GetBytes(), buffer_size, error);
m_name.assign((char*)string_buf.GetBytes(), count);
- count = process_sp->ReadCStringFromMemory(m_types_la, (char*)string_buf.GetBytes(), buffer_size, error);
+ count = process_sp->ReadCStringFromMemory(m_types_ptr, (char*)string_buf.GetBytes(), buffer_size, error);
m_types.assign((char*)string_buf.GetBytes(), count);
return true;
}
};
- lldb::ProcessWP m_process_wp;
+ bool Read_objc_class (lldb::ProcessSP process_sp, std::auto_ptr<objc_class_t> &objc_class)
+ {
+ objc_class.reset(new objc_class_t);
+
+ bool ret = objc_class->Read (process_sp, m_objc_class_ptr);
+
+ if (!ret)
+ objc_class.reset();
+
+ return ret;
+ }
+
+ bool Read_class_row (lldb::ProcessSP process_sp, const objc_class_t &objc_class, std::auto_ptr<class_ro_t> &class_ro, std::auto_ptr<class_rw_t> &class_rw)
+ {
+ class_ro.reset();
+ class_rw.reset();
+
+ Error error;
+ uint32_t class_row_t_flags = process_sp->ReadUnsignedIntegerFromMemory(objc_class.m_data_ptr, sizeof(uint32_t), 0, error);
+ if (!error.Success())
+ return false;
+
+ if (class_row_t_flags & RW_REALIZED)
+ {
+ class_rw.reset(new class_rw_t);
+
+ if (!class_rw->Read(process_sp, objc_class.m_data_ptr))
+ {
+ class_rw.reset();
+ return false;
+ }
+
+ class_ro.reset(new class_ro_t);
+
+ if (!class_ro->Read(process_sp, class_rw->m_ro_ptr))
+ {
+ class_rw.reset();
+ class_ro.reset();
+ return false;
+ }
+ }
+ else
+ {
+ class_ro.reset(new class_ro_t);
+
+ if (!class_ro->Read(process_sp, objc_class.m_data_ptr))
+ {
+ class_ro.reset();
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ AppleObjCRuntimeV2 &m_runtime; // The runtime, so we can read information lazily.
+ lldb::addr_t m_objc_class_ptr; // The address of the objc_class_t. (I.e., objects of this class type have this as their ISA)
+ ConstString m_name; // May be NULL
};
class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
@@ -1727,62 +1668,45 @@
};
ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::GetClassDescriptor (ObjCISA isa)
-{
- ObjCLanguageRuntime::ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ObjCLanguageRuntime::ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
-
- if (found != end && found->second)
- return found->second;
-
- ClassDescriptorSP descriptor = ClassDescriptorSP(new ClassDescriptorV2(*this, isa, m_process->CalculateProcess()));
- if (descriptor && descriptor->IsValid())
- m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
- return descriptor;
-}
-
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::GetClassDescriptor (ValueObject& in_value)
+AppleObjCRuntimeV2::GetClassDescriptor (ValueObject& valobj)
{
- uint64_t ptr_value = in_value.GetValueAsUnsigned(0);
- if (ptr_value == 0)
- return ObjCLanguageRuntime::ClassDescriptorSP();
-
- ObjCISA isa = GetISA(in_value);
-
- ObjCLanguageRuntime::ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ObjCLanguageRuntime::ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
-
- if (found != end && found->second)
- return found->second;
-
- ClassDescriptorSP descriptor;
-
- if (ptr_value & 1)
- return ClassDescriptorSP(new ClassDescriptorV2Tagged(in_value)); // do not save tagged pointers
- descriptor = ClassDescriptorSP(new ClassDescriptorV2(*this, in_value));
-
- if (descriptor && descriptor->IsValid())
- m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
- return descriptor;
-}
-
-ModuleSP FindLibobjc (Target &target)
-{
- ModuleList& modules = target.GetImages();
- for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+ ClassDescriptorSP objc_class_sp;
+ // if we get an invalid VO (which might still happen when playing around
+ // with pointers returned by the expression parser, don't consider this
+ // a valid ObjC object)
+ if (valobj.GetValue().GetContextType() != Value::eContextTypeInvalid)
{
- lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
- if (!module_sp)
- continue;
- if (strncmp(module_sp->GetFileSpec().GetFilename().AsCString(""), "libobjc.", sizeof("libobjc.") - 1) == 0)
- return module_sp;
+ addr_t isa_pointer = valobj.GetPointerValue();
+
+ // tagged pointer
+ if (IsTaggedPointer(isa_pointer))
+ {
+ objc_class_sp.reset (new ClassDescriptorV2Tagged(valobj));
+
+ // probably an invalid tagged pointer - say it's wrong
+ if (objc_class_sp->IsValid())
+ return objc_class_sp;
+ else
+ objc_class_sp.reset();
+ }
+ else
+ {
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process)
+ {
+ Error error;
+ ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
+ if (isa != LLDB_INVALID_ADDRESS)
+ objc_class_sp = ObjCLanguageRuntime::GetClassDescriptor (isa);
+ }
+ }
}
-
- return ModuleSP();
+ return objc_class_sp;
}
-void
+bool
AppleObjCRuntimeV2::UpdateISAToDescriptorMap_Impl()
{
lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
@@ -1790,198 +1714,105 @@
Process *process_ptr = GetProcess();
if (!process_ptr)
- return;
-
- ProcessSP process_sp = process_ptr->shared_from_this();
+ return false;
- Target &target(process_sp->GetTarget());
+ ProcessSP process_sp (process_ptr->shared_from_this());
- ModuleSP objc_module_sp(FindLibobjc(target));
+ ModuleSP objc_module_sp(GetObjCModule());
if (!objc_module_sp)
- return;
-
- do
- {
- SymbolContextList sc_list;
-
- size_t num_symbols = objc_module_sp->FindSymbolsWithNameAndType(ConstString("gdb_objc_realized_classes"),
- lldb::eSymbolTypeData,
- sc_list);
-
- if (!num_symbols)
- break;
-
- SymbolContext gdb_objc_realized_classes_sc;
-
- if (!sc_list.GetContextAtIndex(0, gdb_objc_realized_classes_sc))
- break;
-
- AddressRange gdb_objc_realized_classes_addr_range;
-
- const uint32_t scope = eSymbolContextSymbol;
- const uint32_t range_idx = 0;
- bool use_inline_block_range = false;
+ return false;
- if (!gdb_objc_realized_classes_sc.GetAddressRange(scope,
- range_idx,
- use_inline_block_range,
- gdb_objc_realized_classes_addr_range))
- break;
-
- lldb::addr_t gdb_objc_realized_classes_la = gdb_objc_realized_classes_addr_range.GetBaseAddress().GetLoadAddress(&target);
-
- if (gdb_objc_realized_classes_la == LLDB_INVALID_ADDRESS)
- break;
-
- // <rdar://problem/10763513>
-
- lldb::addr_t gdb_objc_realized_classes_nxmaptable_la;
-
- {
- Error err;
- gdb_objc_realized_classes_nxmaptable_la = process_sp->ReadPointerFromMemory(gdb_objc_realized_classes_la, err);
- if (!err.Success())
- break;
- }
+ uint32_t num_map_table_isas = 0;
+ uint32_t num_objc_opt_ro_isas = 0;
+
+ static ConstString g_gdb_objc_realized_classes("gdb_objc_realized_classes");
+
+ const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_objc_realized_classes, lldb::eSymbolTypeData);
+ if (symbol)
+ {
+ lldb::addr_t gdb_objc_realized_classes_ptr = symbol->GetAddress().GetLoadAddress(&process_sp->GetTarget());
- RemoteNXMapTable gdb_objc_realized_classes(process_sp, gdb_objc_realized_classes_nxmaptable_la);
-
- for (RemoteNXMapTable::element elt : gdb_objc_realized_classes)
+ if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS)
{
- if (m_isa_to_descriptor_cache.count(elt.second))
- continue;
-
- ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, elt.second, process_sp));
+ // <rdar://problem/10763513>
+
+ lldb::addr_t gdb_objc_realized_classes_nxmaptable_ptr;
- if (log && log->GetVerbose())
- log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from dynamic table to isa->descriptor cache", elt.second, elt.first.AsCString());
+ Error err;
+ gdb_objc_realized_classes_nxmaptable_ptr = process_sp->ReadPointerFromMemory(gdb_objc_realized_classes_ptr, err);
+ if (err.Success())
+ {
+ RemoteNXMapTable gdb_objc_realized_classes(process_sp, gdb_objc_realized_classes_nxmaptable_ptr);
- m_isa_to_descriptor_cache[elt.second] = descriptor_sp;
+ for (RemoteNXMapTable::element elt : gdb_objc_realized_classes)
+ {
+ ++num_map_table_isas;
+
+ if (m_isa_to_descriptor_cache.count(elt.second))
+ continue;
+
+ ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, elt.second));
+
+ if (log && log->GetVerbose())
+ log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from dynamic table to isa->descriptor cache", elt.second, elt.first.AsCString());
+
+ m_isa_to_descriptor_cache[elt.second] = descriptor_sp;
+ }
+ }
}
}
- while(0);
- do
+ ObjectFile *objc_object = objc_module_sp->GetObjectFile();
+
+ if (objc_object)
{
- ObjectFile *objc_object = objc_module_sp->GetObjectFile();
-
- if (!objc_object)
- break;
-
SectionList *section_list = objc_object->GetSectionList();
-
- if (!section_list)
- break;
-
- SectionSP TEXT_section_sp = section_list->FindSectionByName(ConstString("__TEXT"));
-
- if (!TEXT_section_sp)
- break;
-
- SectionList &TEXT_children = TEXT_section_sp->GetChildren();
-
- SectionSP objc_opt_section_sp = TEXT_children.FindSectionByName(ConstString("__objc_opt_ro"));
-
- if (!objc_opt_section_sp)
- break;
-
- lldb::addr_t objc_opt_la = objc_opt_section_sp->GetLoadBaseAddress(&target);
-
- if (objc_opt_la == LLDB_INVALID_ADDRESS)
- break;
-
- RemoteObjCOpt objc_opt(process_sp, objc_opt_la);
-
- for (ObjCLanguageRuntime::ObjCISA objc_isa : objc_opt)
+
+ if (section_list)
{
- if (m_isa_to_descriptor_cache.count(objc_isa))
- continue;
-
- ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, objc_isa, process_sp));
+ SectionSP text_segment_sp (section_list->FindSectionByName(ConstString("__TEXT")));
- if (log && log->GetVerbose())
- log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from static table to isa->descriptor cache", objc_isa, descriptor_sp->GetClassName().AsCString());
-
- m_isa_to_descriptor_cache[objc_isa] = descriptor_sp;
+ if (text_segment_sp)
+ {
+ SectionSP objc_opt_section_sp (text_segment_sp->GetChildren().FindSectionByName(ConstString("__objc_opt_ro")));
+
+ if (objc_opt_section_sp)
+ {
+ lldb::addr_t objc_opt_ptr = objc_opt_section_sp->GetLoadBaseAddress(&process_sp->GetTarget());
+
+ if (objc_opt_ptr != LLDB_INVALID_ADDRESS)
+ {
+ RemoteObjCOpt objc_opt(process_sp, objc_opt_ptr);
+
+ for (ObjCLanguageRuntime::ObjCISA objc_isa : objc_opt)
+ {
+ ++num_objc_opt_ro_isas;
+ if (m_isa_to_descriptor_cache.count(objc_isa))
+ continue;
+
+ ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, objc_isa));
+
+ if (log && log->GetVerbose())
+ log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from static table to isa->descriptor cache", objc_isa, descriptor_sp->GetClassName().AsCString());
+
+ m_isa_to_descriptor_cache[objc_isa] = descriptor_sp;
+ }
+ }
+ }
+ }
}
}
- while (0);
-}
-
-// this code relies on the assumption that an Objective-C object always starts
-// with an ISA at offset 0. an ISA is effectively a pointer to an instance of
-// struct class_t in the ObjCv2 runtime
-ObjCLanguageRuntime::ObjCISA
-AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
-{
- if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != eLanguageTypeObjC)
- return 0;
-
- // if we get an invalid VO (which might still happen when playing around
- // with pointers returned by the expression parser, don't consider this
- // a valid ObjC object)
- if (valobj.GetValue().GetContextType() == Value::eContextTypeInvalid)
- return 0;
-
- addr_t isa_pointer = valobj.GetPointerValue();
-
- // tagged pointer
- if (IsTaggedPointer(isa_pointer))
- {
- ClassDescriptorV2Tagged descriptor(valobj);
-
- // probably an invalid tagged pointer - say it's wrong
- if (!descriptor.IsValid())
- return 0;
-
- static const ConstString g_objc_tagged_isa_nsatom_name ("NSAtom");
- static const ConstString g_objc_tagged_isa_nsnumber_name ("NSNumber");
- static const ConstString g_objc_tagged_isa_nsdatets_name ("NSDateTS");
- static const ConstString g_objc_tagged_isa_nsmanagedobject_name ("NSManagedObject");
- static const ConstString g_objc_tagged_isa_nsdate_name ("NSDate");
-
- ConstString class_name_const_string = descriptor.GetClassName();
-
- if (class_name_const_string == g_objc_tagged_isa_nsatom_name)
- return g_objc_Tagged_ISA_NSAtom;
- if (class_name_const_string == g_objc_tagged_isa_nsnumber_name)
- return g_objc_Tagged_ISA_NSNumber;
- if (class_name_const_string == g_objc_tagged_isa_nsdatets_name)
- return g_objc_Tagged_ISA_NSDateTS;
- if (class_name_const_string == g_objc_tagged_isa_nsmanagedobject_name)
- return g_objc_Tagged_ISA_NSManagedObject;
- if (class_name_const_string == g_objc_tagged_isa_nsdate_name)
- return g_objc_Tagged_ISA_NSDate;
- return g_objc_Tagged_ISA;
- }
-
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-
- Process *process = exe_ctx.GetProcessPtr();
- if (process)
- {
- uint8_t pointer_size = process->GetAddressByteSize();
- Error error;
- return process->ReadUnsignedIntegerFromMemory (isa_pointer,
- pointer_size,
- 0,
- error);
- }
- return 0;
+ return num_objc_opt_ro_isas > 0 && num_map_table_isas > 0;
}
-// TODO: should we have a transparent_kvo parameter here to say if we
+
+// TODO: should we have a transparent_kvo parameter here to say if we
// want to replace the KVO swizzled class with the actual user-level type?
ConstString
AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
{
- static const ConstString g_unknown ("unknown");
-
- if (!IsValidISA(isa))
- return ConstString();
-
if (isa == g_objc_Tagged_ISA)
{
static const ConstString g_objc_tagged_isa_name ("_lldb_Tagged_ObjC_ISA");
@@ -2012,26 +1843,7 @@
static const ConstString g_objc_tagged_isa_nsdate_name ("NSDate");
return g_objc_tagged_isa_nsdate_name;
}
-
- ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
-
- if (found != end && found->second)
- return found->second->GetClassName();
-
- ClassDescriptorSP descriptor(GetClassDescriptor(isa));
- if (!descriptor.get() || !descriptor->IsValid())
- return ConstString();
- ConstString class_name = descriptor->GetClassName();
- if (descriptor->IsKVO())
- {
- ClassDescriptorSP superclass(descriptor->GetSuperclass());
- if (!superclass.get() || !superclass->IsValid())
- return ConstString();
- descriptor = superclass;
- }
- m_isa_to_descriptor_cache[isa] = descriptor;
- return descriptor->GetClassName();
+ return ObjCLanguageRuntime::GetActualTypeName(isa);
}
TypeVendor *
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Mon Oct 15 11:27:58 2012
@@ -73,14 +73,8 @@
virtual size_t
GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
- virtual void
- UpdateISAToDescriptorMap_Impl();
-
virtual bool
- IsValidISA (ObjCLanguageRuntime::ObjCISA isa)
- {
- return (isa != 0);
- }
+ UpdateISAToDescriptorMap_Impl();
// none of these are valid ISAs - we use them to infer the type
// of tagged pointers - if we have something meaningful to say
@@ -94,22 +88,21 @@
static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSManagedObject = 5;
static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDate = 6;
-
- virtual ObjCLanguageRuntime::ObjCISA
- GetISA(ValueObject& valobj);
-
virtual ConstString
GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa);
virtual ClassDescriptorSP
GetClassDescriptor (ValueObject& in_value);
- virtual ClassDescriptorSP
- GetClassDescriptor (ObjCISA isa);
-
virtual TypeVendor *
GetTypeVendor();
+ lldb::ProcessSP
+ GetProcessSP ()
+ {
+ return m_process_wp.lock();
+ }
+
protected:
virtual lldb::BreakpointResolverSP
CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp);
@@ -131,6 +124,7 @@
Mutex m_get_class_name_args_mutex;
std::auto_ptr<TypeVendor> m_type_vendor_ap;
+ lldb::ProcessWP m_process_wp; // used by class descriptors to lazily fill their own data
static const char *g_find_class_name_function_name;
static const char *g_find_class_name_function_body;
Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Mon Oct 15 11:27:58 2012
@@ -350,7 +350,7 @@
}
else
{
- is_zero_argument = true;
+ is_zero_argument = false;
selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor, colon_loc - name_cursor)));
name_cursor = colon_loc + 1;
}
@@ -571,9 +571,6 @@
uint32_t ret = 0;
- // TODO Remove this return once testing is complete.
- return ret;
-
do
{
// See if the type is already in our ASTContext.
@@ -640,6 +637,8 @@
log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for isa 0x%llx",
current_id,
(uint64_t)isa);
+
+ break;
}
clang::QualType new_iface_type = ast_ctx->getObjCInterfaceType(iface_decl);
@@ -651,6 +650,8 @@
current_id,
dumper.GetCString(),
(uint64_t)isa);
+
+ break;
}
types.push_back(ClangASTType(ast_ctx, new_iface_type.getAsOpaquePtr()));
Modified: lldb/branches/windows/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Makefile?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Makefile (original)
+++ lldb/branches/windows/source/Plugins/Makefile Mon Oct 15 11:27:58 2012
@@ -33,6 +33,8 @@
endif
ifeq ($(HOST_OS),Linux)
+DIRS += DynamicLoader/MacOSX-DYLD DynamicLoader/Darwin-Kernel
+DIRS += OperatingSystem/Darwin-Kernel
DIRS += Process/Linux Process/POSIX
endif
Modified: lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon Oct 15 11:27:58 2012
@@ -3571,28 +3571,31 @@
GetNumThreadContexts ();
const FileRangeArray::Entry *thread_context_file_range = m_thread_context_offsets.GetEntryAtIndex (idx);
+ if (thread_context_file_range)
+ {
- DataExtractor data (m_data,
- thread_context_file_range->GetRangeBase(),
- thread_context_file_range->GetByteSize());
+ DataExtractor data (m_data,
+ thread_context_file_range->GetRangeBase(),
+ thread_context_file_range->GetByteSize());
#if defined(__APPLE__)
- switch (m_header.cputype)
- {
- case llvm::MachO::CPUTypeARM:
- reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data));
- break;
-
- case llvm::MachO::CPUTypeI386:
- reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data));
- break;
-
- case llvm::MachO::CPUTypeX86_64:
- reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data));
- break;
- }
+ switch (m_header.cputype)
+ {
+ case llvm::MachO::CPUTypeARM:
+ reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data));
+ break;
+
+ case llvm::MachO::CPUTypeI386:
+ reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data));
+ break;
+
+ case llvm::MachO::CPUTypeX86_64:
+ reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data));
+ break;
+ }
#else
- llvm_unreachable("Should only occur for host debugging");
+ llvm_unreachable("Should only occur for host debugging");
#endif
+ }
}
return reg_ctx_sp;
}
Modified: lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp Mon Oct 15 11:27:58 2012
@@ -249,7 +249,7 @@
ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));
if (!thread_sp)
- thread_sp.reset (new ThreadMemory (m_process->shared_from_this(), tid, valobj_sp));
+ thread_sp.reset (new ThreadMemory (*m_process, tid, valobj_sp));
new_thread_list.AddThread(thread_sp);
Modified: lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Mon Oct 15 11:27:58 2012
@@ -188,7 +188,7 @@
ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));
if (!thread_sp)
- thread_sp.reset (new ThreadMemory (m_process->shared_from_this(),
+ thread_sp.reset (new ThreadMemory (*m_process,
tid,
name,
queue));
Modified: lldb/branches/windows/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Mon Oct 15 11:27:58 2012
@@ -403,7 +403,7 @@
GetHostname (),
port);
assert (connect_url_len < sizeof(connect_url));
- error = process_sp->ConnectRemote (connect_url);
+ error = process_sp->ConnectRemote (NULL, connect_url);
if (error.Success())
error = process_sp->Attach(attach_info);
}
Modified: lldb/branches/windows/source/Plugins/Process/Linux/ProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Linux/ProcessLinux.cpp Mon Oct 15 11:27:58 2012
@@ -106,8 +106,7 @@
assert(m_monitor);
ThreadSP thread_sp (old_thread_list.FindThreadByID (GetID(), false));
if (!thread_sp) {
- ProcessSP me = this->shared_from_this();
- thread_sp.reset(new POSIXThread(me, GetID()));
+ thread_sp.reset(new POSIXThread(*this, GetID()));
}
if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
Modified: lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp Mon Oct 15 11:27:58 2012
@@ -967,7 +967,6 @@
{
ProcessMonitor *monitor = args->m_monitor;
ProcessLinux &process = monitor->GetProcess();
- lldb::ProcessSP processSP = process.shared_from_this();
const char **argv = args->m_argv;
const char **envp = args->m_envp;
const char *stdin_path = args->m_stdin_path;
@@ -1106,7 +1105,7 @@
// Update the process thread list with this new thread.
// FIXME: should we be letting UpdateThreadList handle this?
// FIXME: by using pids instead of tids, we can only support one thread.
- inferior.reset(new POSIXThread(processSP, pid));
+ inferior.reset(new POSIXThread(process, pid));
if (log)
log->Printf ("ProcessMonitor::%s() adding pid = %i", __FUNCTION__, pid);
process.GetThreadList().AddThread(inferior);
@@ -1168,7 +1167,6 @@
ProcessMonitor *monitor = args->m_monitor;
ProcessLinux &process = monitor->GetProcess();
- lldb::ProcessSP processSP = process.shared_from_this();
lldb::ThreadSP inferior;
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
@@ -1193,8 +1191,10 @@
goto FINISH;
}
+ monitor->m_pid = pid;
+
// Update the process thread list with the attached thread.
- inferior.reset(new POSIXThread(processSP, pid));
+ inferior.reset(new POSIXThread(process, pid));
if (log)
log->Printf ("ProcessMonitor::%s() adding tid = %i", __FUNCTION__, pid);
process.GetThreadList().AddThread(inferior);
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Mon Oct 15 11:27:58 2012
@@ -11,6 +11,7 @@
#include "CommunicationKDP.h"
// C Includes
+#include <errno.h>
#include <limits.h>
#include <string.h>
@@ -22,6 +23,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/State.h"
+#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/TimeValue.h"
@@ -499,6 +501,51 @@
return m_kdp_hostinfo_cpu_subtype;
}
+lldb_private::UUID
+CommunicationKDP::GetUUID ()
+{
+ UUID uuid;
+ if (GetKernelVersion() == NULL)
+ return uuid;
+
+ if (m_kernel_version.find("UUID=") == std::string::npos)
+ return uuid;
+
+ size_t p = m_kernel_version.find("UUID=") + strlen ("UUID=");
+ std::string uuid_str = m_kernel_version.substr(p, 36);
+ if (uuid_str.size() < 32)
+ return uuid;
+
+ if (uuid.SetFromCString (uuid_str.c_str()) == 0)
+ {
+ UUID invalid_uuid;
+ return invalid_uuid;
+ }
+
+ return uuid;
+}
+
+lldb::addr_t
+CommunicationKDP::GetLoadAddress ()
+{
+ if (GetKernelVersion() == NULL)
+ return LLDB_INVALID_ADDRESS;
+
+ if (m_kernel_version.find("stext=") == std::string::npos)
+ return LLDB_INVALID_ADDRESS;
+ size_t p = m_kernel_version.find("stext=") + strlen ("stext=");
+ if (m_kernel_version[p] != '0' || m_kernel_version[p + 1] != 'x')
+ return LLDB_INVALID_ADDRESS;
+
+ addr_t kernel_load_address;
+ errno = 0;
+ kernel_load_address = ::strtoul (m_kernel_version.c_str() + p, NULL, 16);
+ if (errno != 0 || kernel_load_address == 0)
+ return LLDB_INVALID_ADDRESS;
+
+ return kernel_load_address;
+}
+
bool
CommunicationKDP::SendRequestHostInfo ()
{
@@ -624,7 +671,7 @@
uint32_t command_addr_byte_size = use_64 ? 8 : 4;
const CommandType command = use_64 ? KDP_WRITEMEM64 : KDP_WRITEMEM;
// Size is header + address size + uint32_t length
- const uint32_t command_length = 8 + command_addr_byte_size + 4;
+ const uint32_t command_length = 8 + command_addr_byte_size + 4 + src_len;
const uint32_t request_sequence_id = m_request_sequence_id;
MakeRequestPacketHeader (command, request_packet, command_length);
request_packet.PutMaxHex64 (addr, command_addr_byte_size);
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h Mon Oct 15 11:27:58 2012
@@ -213,6 +213,12 @@
uint32_t
GetCPUSubtype ();
+ lldb_private::UUID
+ GetUUID ();
+
+ lldb::addr_t
+ GetLoadAddress ();
+
bool
SendRequestResume ();
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Mon Oct 15 11:27:58 2012
@@ -17,8 +17,11 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
+#include "lldb/Core/UUID.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
@@ -28,6 +31,7 @@
#include "ProcessKDP.h"
#include "ProcessKDPLog.h"
#include "ThreadKDP.h"
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
using namespace lldb;
using namespace lldb_private;
@@ -102,7 +106,9 @@
m_comm("lldb.process.kdp-remote.communication"),
m_async_broadcaster (NULL, "lldb.process.kdp-remote.async-broadcaster"),
m_async_thread (LLDB_INVALID_HOST_THREAD),
- m_destroy_in_process (false)
+ m_destroy_in_process (false),
+ m_dyld_plugin_name (),
+ m_kernel_load_addr (LLDB_INVALID_ADDRESS)
{
m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit, "async thread should exit");
m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue, "async thread continue");
@@ -167,7 +173,7 @@
}
Error
-ProcessKDP::DoConnectRemote (const char *remote_url)
+ProcessKDP::DoConnectRemote (Stream *strm, const char *remote_url)
{
Error error;
@@ -214,6 +220,18 @@
ArchSpec kernel_arch;
kernel_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
m_target.SetArchitecture(kernel_arch);
+
+ /* Get the kernel's UUID and load address via kdp-kernelversion packet. */
+
+ UUID kernel_uuid = m_comm.GetUUID ();
+ addr_t kernel_load_addr = m_comm.GetLoadAddress ();
+
+ if (kernel_load_addr != LLDB_INVALID_ADDRESS)
+ {
+ m_kernel_load_addr = kernel_load_addr;
+ m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
+ }
+
// Set the thread ID
UpdateThreadListIfNeeded ();
SetID (1);
@@ -237,13 +255,11 @@
}
else
{
- puts ("KDP_CONNECT failed"); // REMOVE THIS
error.SetErrorString("KDP_REATTACH failed");
}
}
else
{
- puts ("KDP_REATTACH failed"); // REMOVE THIS
error.SetErrorString("KDP_REATTACH failed");
}
}
@@ -313,6 +329,20 @@
}
}
+addr_t
+ProcessKDP::GetImageInfoAddress()
+{
+ return m_kernel_load_addr;
+}
+
+lldb_private::DynamicLoader *
+ProcessKDP::GetDynamicLoader ()
+{
+ if (m_dyld_ap.get() == NULL)
+ m_dyld_ap.reset (DynamicLoader::FindPlugin(this, m_dyld_plugin_name.empty() ? NULL : m_dyld_plugin_name.c_str()));
+ return m_dyld_ap.get();
+}
+
Error
ProcessKDP::WillResume ()
{
@@ -340,17 +370,14 @@
case eStateSuspended:
// Nothing to do here when a thread will stay suspended
// we just leave the CPU mask bit set to zero for the thread
- puts("REMOVE THIS: ProcessKDP::DoResume () -- thread suspended");
break;
case eStateStepping:
- puts("REMOVE THIS: ProcessKDP::DoResume () -- thread stepping");
kernel_thread_sp->GetRegisterContext()->HardwareSingleStep (true);
resume = true;
break;
case eStateRunning:
- puts("REMOVE THIS: ProcessKDP::DoResume () -- thread running");
kernel_thread_sp->GetRegisterContext()->HardwareSingleStep (false);
resume = true;
break;
@@ -392,7 +419,7 @@
ThreadSP thread_sp (old_thread_list.FindThreadByID (kernel_tid, false));
if (!thread_sp)
{
- thread_sp.reset(new ThreadKDP (shared_from_this(), kernel_tid));
+ thread_sp.reset(new ThreadKDP (*this, kernel_tid));
new_thread_list.AddThread(thread_sp);
}
return thread_sp;
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Mon Oct 15 11:27:58 2012
@@ -90,7 +90,7 @@
WillAttachToProcessWithName (const char *process_name, bool wait_for_launch);
virtual lldb_private::Error
- DoConnectRemote (const char *remote_url);
+ DoConnectRemote (lldb_private::Stream *strm, const char *remote_url);
virtual lldb_private::Error
DoAttachToProcessWithID (lldb::pid_t pid);
@@ -104,6 +104,12 @@
virtual void
DidAttach ();
+ lldb::addr_t
+ GetImageInfoAddress();
+
+ lldb_private::DynamicLoader *
+ GetDynamicLoader ();
+
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
@@ -252,6 +258,8 @@
lldb_private::Broadcaster m_async_broadcaster;
lldb::thread_t m_async_thread;
bool m_destroy_in_process;
+ std::string m_dyld_plugin_name;
+ lldb::addr_t m_kernel_load_addr;
bool
StartAsyncThread ();
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp Mon Oct 15 11:27:58 2012
@@ -37,8 +37,8 @@
// Thread Registers
//----------------------------------------------------------------------
-ThreadKDP::ThreadKDP (const lldb::ProcessSP &process_sp, lldb::tid_t tid) :
- Thread(process_sp, tid),
+ThreadKDP::ThreadKDP (Process &process, lldb::tid_t tid) :
+ Thread(process, tid),
m_thread_name (),
m_dispatch_queue_name (),
m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS)
Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h Mon Oct 15 11:27:58 2012
@@ -20,7 +20,7 @@
class ThreadKDP : public lldb_private::Thread
{
public:
- ThreadKDP (const lldb::ProcessSP &process_sp,
+ ThreadKDP (lldb_private::Process &process,
lldb::tid_t tid);
virtual
Modified: lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp Mon Oct 15 11:27:58 2012
@@ -33,7 +33,7 @@
using namespace lldb_private;
-POSIXThread::POSIXThread(ProcessSP &process, lldb::tid_t tid)
+POSIXThread::POSIXThread(Process &process, lldb::tid_t tid)
: Thread(process, tid),
m_frame_ap(0)
{
Modified: lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h Mon Oct 15 11:27:58 2012
@@ -29,7 +29,7 @@
: public lldb_private::Thread
{
public:
- POSIXThread(lldb::ProcessSP &process, lldb::tid_t tid);
+ POSIXThread(lldb_private::Process &process, lldb::tid_t tid);
virtual ~POSIXThread();
Modified: lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Mon Oct 15 11:27:58 2012
@@ -510,8 +510,7 @@
assert(m_monitor);
ThreadSP thread_sp (old_thread_list.FindThreadByID (GetID(), false));
if (!thread_sp) {
- ProcessSP me = this->shared_from_this();
- thread_sp.reset(new POSIXThread(me, GetID()));
+ thread_sp.reset(new POSIXThread(*this, GetID()));
}
if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
Modified: lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Mon Oct 15 11:27:58 2012
@@ -779,7 +779,7 @@
// right thing. It'd be nice if there was a way to ask the eh_frame directly if it is asynchronous
// (can be trusted at every instruction point) or synchronous (the normal case - only at call sites).
// But there is not.
- if (process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx))
+ if (process && process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx))
{
unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite (m_current_offset_backed_up_one);
if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress (m_current_pc))
Modified: lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp Mon Oct 15 11:27:58 2012
@@ -17,10 +17,10 @@
using namespace lldb;
using namespace lldb_private;
-ThreadMemory::ThreadMemory (const ProcessSP &process_sp,
+ThreadMemory::ThreadMemory (Process &process,
tid_t tid,
const ValueObjectSP &thread_info_valobj_sp) :
- Thread (process_sp, tid),
+ Thread (process, tid),
m_thread_info_valobj_sp (thread_info_valobj_sp),
m_name(),
m_queue()
@@ -28,11 +28,11 @@
}
-ThreadMemory::ThreadMemory (const lldb::ProcessSP &process_sp,
+ThreadMemory::ThreadMemory (Process &process,
lldb::tid_t tid,
const char *name,
const char *queue) :
- Thread (process_sp, tid),
+ Thread (process, tid),
m_thread_info_valobj_sp (),
m_name(),
m_queue()
Modified: lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h Mon Oct 15 11:27:58 2012
@@ -17,11 +17,11 @@
{
public:
- ThreadMemory (const lldb::ProcessSP &process_sp,
+ ThreadMemory (lldb_private::Process &process,
lldb::tid_t tid,
const lldb::ValueObjectSP &thread_info_valobj_sp);
- ThreadMemory (const lldb::ProcessSP &process_sp,
+ ThreadMemory (lldb_private::Process &process,
lldb::tid_t tid,
const char *name,
const char *queue);
Modified: lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.cpp Mon Oct 15 11:27:58 2012
@@ -175,7 +175,7 @@
{
if (m_frames.back()->cfa == cursor_sp->cfa)
goto unwind_done; // Infinite loop where the current cursor is the same as the previous one...
- else if (abi->StackUsesFrames())
+ else if (abi && abi->StackUsesFrames())
{
// We might have a CFA that is not using the frame pointer and
// we want to validate that the frame pointer is valid.
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Mon Oct 15 11:27:58 2012
@@ -1946,12 +1946,12 @@
}
bool
-GDBRemoteCommunicationClient::GetThreadStopInfo (uint32_t tid, StringExtractorGDBRemote &response)
+GDBRemoteCommunicationClient::GetThreadStopInfo (lldb::tid_t tid, StringExtractorGDBRemote &response)
{
if (m_supports_qThreadStopInfo)
{
char packet[256];
- int packet_len = ::snprintf(packet, sizeof(packet), "qThreadStopInfo%x", tid);
+ int packet_len = ::snprintf(packet, sizeof(packet), "qThreadStopInfo%llx", tid);
assert (packet_len < sizeof(packet));
if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
{
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Mon Oct 15 11:27:58 2012
@@ -294,7 +294,7 @@
GetStopReply (StringExtractorGDBRemote &response);
bool
- GetThreadStopInfo (uint32_t tid,
+ GetThreadStopInfo (lldb::tid_t tid,
StringExtractorGDBRemote &response);
bool
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Oct 15 11:27:58 2012
@@ -46,6 +46,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
+#include "lldb/Host/Symbols.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/DynamicLoader.h"
@@ -65,6 +66,8 @@
#include "ProcessGDBRemoteLog.h"
#include "ThreadGDBRemote.h"
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
+
namespace lldb
{
// Provide a function that can easily dump the packet history if we know a
@@ -204,7 +207,10 @@
m_addr_to_mmap_size (),
m_thread_create_bp_sp (),
m_waiting_for_attach (false),
- m_destroy_tried_resuming (false)
+ m_destroy_tried_resuming (false),
+ m_dyld_plugin_name(),
+ m_kernel_load_addr (LLDB_INVALID_ADDRESS),
+ m_command_sp ()
{
m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit, "async thread should exit");
m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue, "async thread continue");
@@ -427,7 +433,7 @@
}
Error
-ProcessGDBRemote::DoConnectRemote (const char *remote_url)
+ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url)
{
Error error (WillLaunchOrAttach ());
@@ -440,6 +446,8 @@
return error;
StartAsyncThread ();
+ CheckForKernel (strm);
+
lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
if (pid == LLDB_INVALID_PROCESS_ID)
{
@@ -477,6 +485,110 @@
return error;
}
+// When we are establishing a connection to a remote system and we have no executable specified,
+// or the executable is a kernel, we may be looking at a KASLR situation (where the kernel has been
+// slid in memory.)
+//
+// This function tries to locate the kernel in memory if this is possibly a kernel debug session.
+//
+// If a kernel is found, return the address of the kernel in GetImageInfoAddress() -- the
+// DynamicLoaderDarwinKernel plugin uses this address as the kernel load address and will load the
+// binary, if needed, along with all the kexts.
+
+void
+ProcessGDBRemote::CheckForKernel (Stream *strm)
+{
+ // early return if this isn't an "unknown" system (kernel debugging doesn't have a system type)
+ const ArchSpec &gdb_remote_arch = m_gdb_comm.GetHostArchitecture();
+ if (!gdb_remote_arch.IsValid() || gdb_remote_arch.GetTriple().getVendor() != llvm::Triple::UnknownVendor)
+ return;
+
+ Module *exe_module = GetTarget().GetExecutableModulePointer();
+ ObjectFile *exe_objfile = NULL;
+ if (exe_module)
+ exe_objfile = exe_module->GetObjectFile();
+
+ // early return if we have an executable and it is not a kernel--this is very unlikely to be a kernel debug session.
+ if (exe_objfile
+ && (exe_objfile->GetType() != ObjectFile::eTypeExecutable
+ || exe_objfile->GetStrata() != ObjectFile::eStrataKernel))
+ return;
+
+ // See if the kernel is in memory at the File address (slide == 0) -- no work needed, if so.
+ if (exe_objfile && exe_objfile->GetHeaderAddress().IsValid())
+ {
+ ModuleSP memory_module_sp;
+ memory_module_sp = ReadModuleFromMemory (exe_module->GetFileSpec(), exe_objfile->GetHeaderAddress().GetFileAddress(), false, false);
+ if (memory_module_sp.get()
+ && memory_module_sp->GetUUID().IsValid()
+ && memory_module_sp->GetUUID() == exe_module->GetUUID())
+ {
+ m_kernel_load_addr = exe_objfile->GetHeaderAddress().GetFileAddress();
+ m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
+ SetCanJIT(false);
+ return;
+ }
+ }
+
+ // See if the kernel's load address is stored in the kernel's low globals page; this is
+ // done when a debug boot-arg has been set.
+
+ Error error;
+ uint8_t buf[24];
+ ModuleSP memory_module_sp;
+ addr_t kernel_addr = LLDB_INVALID_ADDRESS;
+
+ // First try the 32-bit
+ if (memory_module_sp.get() == NULL)
+ {
+ DataExtractor data4 (buf, sizeof(buf), gdb_remote_arch.GetByteOrder(), 4);
+ if (DoReadMemory (0xffff0110, buf, 4, error) == 4)
+ {
+ uint32_t offset = 0;
+ kernel_addr = data4.GetU32(&offset);
+ memory_module_sp = ReadModuleFromMemory (FileSpec("mach_kernel", false), kernel_addr, false, false);
+ if (!memory_module_sp.get()
+ || !memory_module_sp->GetUUID().IsValid()
+ || memory_module_sp->GetObjectFile() == NULL
+ || memory_module_sp->GetObjectFile()->GetType() != ObjectFile::eTypeExecutable
+ || memory_module_sp->GetObjectFile()->GetStrata() != ObjectFile::eStrataKernel)
+ {
+ memory_module_sp.reset();
+ }
+ }
+ }
+
+ // Now try the 64-bit location
+ if (memory_module_sp.get() == NULL)
+ {
+ DataExtractor data8 (buf, sizeof(buf), gdb_remote_arch.GetByteOrder(), 8);
+ if (DoReadMemory (0xffffff8000002010ULL, buf, 8, error) == 8)
+ {
+ uint32_t offset = 0;
+ kernel_addr = data8.GetU32(&offset);
+ memory_module_sp = ReadModuleFromMemory (FileSpec("mach_kernel", false), kernel_addr, false, false);
+ if (!memory_module_sp.get()
+ || !memory_module_sp->GetUUID().IsValid()
+ || memory_module_sp->GetObjectFile() == NULL
+ || memory_module_sp->GetObjectFile()->GetType() != ObjectFile::eTypeExecutable
+ || memory_module_sp->GetObjectFile()->GetStrata() != ObjectFile::eStrataKernel)
+ {
+ memory_module_sp.reset();
+ }
+ }
+ }
+
+ if (memory_module_sp.get()
+ && memory_module_sp->GetArchitecture().IsValid()
+ && memory_module_sp->GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple)
+ {
+ m_kernel_load_addr = kernel_addr;
+ m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
+ SetCanJIT(false);
+ return;
+ }
+}
+
Error
ProcessGDBRemote::WillLaunchOrAttach ()
{
@@ -1240,7 +1352,7 @@
tid_t tid = m_thread_ids[i];
ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));
if (!thread_sp)
- thread_sp.reset (new ThreadGDBRemote (shared_from_this(), tid));
+ thread_sp.reset (new ThreadGDBRemote (*this, tid));
new_thread_list.AddThread(thread_sp);
}
}
@@ -1307,7 +1419,7 @@
if (!thread_sp)
{
// Create the thread if we need to
- thread_sp.reset (new ThreadGDBRemote (shared_from_this(), tid));
+ thread_sp.reset (new ThreadGDBRemote (*this, tid));
m_thread_list.AddThread(thread_sp);
}
}
@@ -1889,10 +2001,16 @@
return m_gdb_comm.IsConnected() && m_private_state.GetValue() != eStateExited;
}
+// For kernel debugging, we return the load address of the kernel binary as the
+// ImageInfoAddress and we return the DynamicLoaderDarwinKernel as the GetDynamicLoader()
+// name so the correct DynamicLoader plugin is chosen.
addr_t
ProcessGDBRemote::GetImageInfoAddress()
{
- return m_gdb_comm.GetShlibInfoAddr();
+ if (m_kernel_load_addr != LLDB_INVALID_ADDRESS)
+ return m_kernel_load_addr;
+ else
+ return m_gdb_comm.GetShlibInfoAddr();
}
//------------------------------------------------------------------
@@ -2402,8 +2520,8 @@
::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags);
debugserver_args.AppendArgument(arg_cstr);
}
- debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt");
- debugserver_args.AppendArgument("--log-flags=0x802e0e");
+// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt");
+// debugserver_args.AppendArgument("--log-flags=0x802e0e");
// We currently send down all arguments, attach pids, or attach
// process names in dedicated GDB server packets, so we don't need
@@ -2909,4 +3027,66 @@
return true;
}
+lldb_private::DynamicLoader *
+ProcessGDBRemote::GetDynamicLoader ()
+{
+ if (m_dyld_ap.get() == NULL)
+ m_dyld_ap.reset (DynamicLoader::FindPlugin(this, m_dyld_plugin_name.empty() ? NULL : m_dyld_plugin_name.c_str()));
+ return m_dyld_ap.get();
+}
+
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+class CommandObjectProcessGDBRemotePacket : public CommandObjectParsed
+{
+private:
+
+public:
+ CommandObjectProcessGDBRemotePacket(CommandInterpreter &interpreter) :
+ CommandObjectParsed (interpreter,
+ "process plugin packet",
+ "Send a custom packet through the GDB remote protocol and print the answer.",
+ NULL)
+ {
+ }
+
+ ~CommandObjectProcessGDBRemotePacket ()
+ {
+ }
+
+ bool
+ DoExecute (Args& command, CommandReturnObject &result)
+ {
+ printf ("CommandObjectProcessGDBRemotePacket::DoExecute() called!!!\n");
+ return true;
+ }
+};
+
+
+class CommandObjectMultiwordProcessGDBRemote : public CommandObjectMultiword
+{
+public:
+ CommandObjectMultiwordProcessGDBRemote (CommandInterpreter &interpreter) :
+ CommandObjectMultiword (interpreter,
+ "process plugin",
+ "A set of commands for operating on a ProcessGDBRemote process.",
+ "process plugin <subcommand> [<subcommand-options>]")
+ {
+ LoadSubCommand ("packet", CommandObjectSP (new CommandObjectProcessGDBRemotePacket (interpreter)));
+ }
+
+ ~CommandObjectMultiwordProcessGDBRemote ()
+ {
+ }
+};
+
+
+
+CommandObject *
+ProcessGDBRemote::GetPluginCommandObject()
+{
+ if (!m_command_sp)
+ m_command_sp.reset (new CommandObjectMultiwordProcessGDBRemote (GetTarget().GetDebugger().GetCommandInterpreter()));
+ return m_command_sp.get();
+}
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Mon Oct 15 11:27:58 2012
@@ -71,8 +71,8 @@
CanDebug (lldb_private::Target &target,
bool plugin_specified_by_name);
-// virtual uint32_t
-// ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
+ virtual lldb_private::CommandObject *
+ GetPluginCommandObject();
//------------------------------------------------------------------
// Creating a new process, or attaching to an existing one
@@ -94,7 +94,7 @@
WillAttachToProcessWithName (const char *process_name, bool wait_for_launch);
virtual lldb_private::Error
- DoConnectRemote (const char *remote_url);
+ DoConnectRemote (lldb_private::Stream *strm, const char *remote_url);
lldb_private::Error
WillLaunchOrAttach ();
@@ -293,6 +293,10 @@
lldb_private::Mutex::Locker locker (m_last_stop_packet_mutex);
m_last_stop_packet = response;
}
+
+ void
+ CheckForKernel (lldb_private::Stream *strm);
+
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -325,6 +329,9 @@
lldb::BreakpointSP m_thread_create_bp_sp;
bool m_waiting_for_attach;
bool m_destroy_tried_resuming;
+ std::string m_dyld_plugin_name;
+ lldb::addr_t m_kernel_load_addr;
+ lldb::CommandObjectSP m_command_sp;
bool
StartAsyncThread ();
@@ -373,6 +380,9 @@
bool catch_stop_event,
lldb::EventSP &stop_event_sp);
+ lldb_private::DynamicLoader *
+ GetDynamicLoader ();
+
private:
//------------------------------------------------------------------
// For ProcessGDBRemote only
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Mon Oct 15 11:27:58 2012
@@ -32,15 +32,15 @@
// Thread Registers
//----------------------------------------------------------------------
-ThreadGDBRemote::ThreadGDBRemote (const ProcessSP &process_sp, lldb::tid_t tid) :
- Thread(process_sp, tid),
+ThreadGDBRemote::ThreadGDBRemote (Process &process, lldb::tid_t tid) :
+ Thread(process, tid),
m_thread_name (),
m_dispatch_queue_name (),
m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS)
{
ProcessGDBRemoteLog::LogIf(GDBR_LOG_THREAD, "%p: ThreadGDBRemote::ThreadGDBRemote (pid = %i, tid = 0x%4.4x)",
this,
- process_sp ? process_sp->GetID() : LLDB_INVALID_PROCESS_ID,
+ process.GetID(),
GetID());
}
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h Mon Oct 15 11:27:58 2012
@@ -21,7 +21,7 @@
class ThreadGDBRemote : public lldb_private::Thread
{
public:
- ThreadGDBRemote (const lldb::ProcessSP &process_sp, lldb::tid_t tid);
+ ThreadGDBRemote (lldb_private::Process &process, lldb::tid_t tid);
virtual
~ThreadGDBRemote ();
Modified: lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.cpp Mon Oct 15 11:27:58 2012
@@ -231,6 +231,8 @@
return error;
}
+ SetCanJIT(false);
+
llvm::MachO::mach_header header;
DataExtractor data (&header,
sizeof(header),
@@ -308,25 +310,13 @@
if (header_addr != LLDB_INVALID_ADDRESS)
GetDynamicLoaderAddress (header_addr);
}
-
-// if (m_dyld_addr == LLDB_INVALID_ADDRESS)
-// {
-// // We haven't found our dyld or mach_kernel yet,
-// // so we need to exhaustively look
-// const size_t num_core_aranges = m_core_aranges.GetSize();
-// bool done = false;
-// for (size_t i=0; !done && i<num_core_aranges; ++i)
-// {
-// const addr_t start_vaddr = m_core_aranges.GetEntryRef(i).GetRangeBase();
-// const addr_t end_vaddr = m_core_aranges.GetEntryRef(i).GetRangeEnd();
-// // printf("core_arange[%u] [0x%16.16llx - 0x%16.16llx)\n", (uint32_t)i, start_vaddr, end_vaddr);
-//
-// for (addr_t vaddr = start_vaddr; !done && start_vaddr < end_vaddr; vaddr += 0x1000)
-// {
-// done = GetDynamicLoaderAddress (vaddr);
-// }
-// }
-// }
+ else
+ {
+ Error header_addr_error;
+ addr_t header_addr = ReadPointerFromMemory (0xffff0110, header_addr_error);
+ if (header_addr != LLDB_INVALID_ADDRESS)
+ GetDynamicLoaderAddress (header_addr);
+ }
}
return error;
@@ -354,7 +344,7 @@
const uint32_t num_threads = core_objfile->GetNumThreadContexts ();
for (lldb::tid_t tid = 0; tid < num_threads; ++tid)
{
- ThreadSP thread_sp(new ThreadMachCore (shared_from_this(), tid));
+ ThreadSP thread_sp(new ThreadMachCore (*this, tid));
new_thread_list.AddThread (thread_sp);
}
}
Modified: lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.cpp Mon Oct 15 11:27:58 2012
@@ -36,8 +36,8 @@
// Thread Registers
//----------------------------------------------------------------------
-ThreadMachCore::ThreadMachCore (const lldb::ProcessSP &process_sp, lldb::tid_t tid) :
- Thread(process_sp, tid),
+ThreadMachCore::ThreadMachCore (Process &process, lldb::tid_t tid) :
+ Thread(process, tid),
m_thread_name (),
m_dispatch_queue_name (),
m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS),
Modified: lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.h (original)
+++ lldb/branches/windows/source/Plugins/Process/mach-core/ThreadMachCore.h Mon Oct 15 11:27:58 2012
@@ -19,7 +19,7 @@
class ThreadMachCore : public lldb_private::Thread
{
public:
- ThreadMachCore (const lldb::ProcessSP &process_sp,
+ ThreadMachCore (lldb_private::Process &process,
lldb::tid_t tid);
virtual
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Mon Oct 15 11:27:58 2012
@@ -386,7 +386,9 @@
// down.
const bool clear_dies = ExtractDIEsIfNeeded (false) > 1;
- DIE()->BuildAddressRangeTable(dwarf2Data, this, debug_aranges);
+ const DWARFDebugInfoEntry* die = DIE();
+ if (die)
+ die->BuildAddressRangeTable(dwarf2Data, this, debug_aranges);
// Keep memory down by clearing DIEs if this generate function
// caused them to be parsed
@@ -410,7 +412,9 @@
"DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]",
GetOffset());
}
- DIE()->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get());
+ const DWARFDebugInfoEntry* die = DIE();
+ if (die)
+ die->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get());
const bool minimize = false;
m_func_aranges_ap->Sort(minimize);
}
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Mon Oct 15 11:27:58 2012
@@ -117,10 +117,11 @@
for (size_t i=0; i<num_entries; ++i)
{
const RangeToDIE::Entry *entry = m_aranges.GetEntryAtIndex(i);
- log->Printf ("0x%8.8x: [0x%llx - 0x%llx)",
- entry->data,
- entry->GetRangeBase(),
- entry->GetRangeEnd());
+ if (entry)
+ log->Printf ("0x%8.8x: [0x%llx - 0x%llx)",
+ entry->data,
+ entry->GetRangeBase(),
+ entry->GetRangeEnd());
}
}
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Mon Oct 15 11:27:58 2012
@@ -701,7 +701,10 @@
{
const DWARFCompileUnitSP& cu_sp = *pos;
DumpCallback(m_dwarf2Data, (DWARFCompileUnitSP&)cu_sp, NULL, 0, curr_depth, &dumpInfo);
- cu_sp->DIE()->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth);
+
+ const DWARFDebugInfoEntry* die = cu_sp->DIE();
+ if (die)
+ die->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth);
}
}
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Mon Oct 15 11:27:58 2012
@@ -1035,6 +1035,7 @@
{
bool verbose = s.GetVerbose();
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
+
const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL;
if (verbose)
s.Offset (*offset_ptr);
@@ -1158,7 +1159,8 @@
form_value.Dump(s, debug_str_data, cu);
uint32_t ranges_offset = form_value.Unsigned();
dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
- DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr);
+ if (dwarf2Data)
+ DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr);
}
break;
@@ -1509,6 +1511,9 @@
) const
{
const char* name = NULL;
+ if (!dwarf2Data)
+ return name;
+
DWARFFormValue form_value;
if (GetAttributeValue(dwarf2Data, cu, DW_AT_MIPS_linkage_name, form_value))
@@ -1546,6 +1551,12 @@
Stream &s
)
{
+ if (dwarf2Data == NULL)
+ {
+ s.PutCString("NULL");
+ return false;
+ }
+
DWARFDebugInfoEntry die;
uint32_t offset = die_offset;
if (die.Extract(dwarf2Data, cu, &offset))
@@ -1589,6 +1600,12 @@
Stream &s
)
{
+ if (dwarf2Data == NULL)
+ {
+ s.PutCString("NULL");
+ return false;
+ }
+
DWARFDebugInfoEntry die;
uint32_t offset = die_offset;
if (die.Extract(dwarf2Data, cu, &offset))
@@ -1609,6 +1626,9 @@
{
bool result = true;
const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+
+ if (abbrevDecl == NULL)
+ return false;
switch (abbrevDecl->Tag())
{
@@ -2142,23 +2162,26 @@
const DWARFCompileUnit *cu,
dw_offset_t &offset) const
{
- offset = GetOffset();
-
- const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx);
- if (abbrev_decl)
+ if (dwarf2Data)
{
- // Make sure the abbreviation code still matches. If it doesn't and
- // the DWARF data was mmap'ed, the backing file might have been modified
- // which is bad news.
- const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset);
-
- if (abbrev_decl->Code() == abbrev_code)
- return abbrev_decl;
+ offset = GetOffset();
- dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)",
- GetOffset(),
- (uint32_t)abbrev_decl->Code(),
- (uint32_t)abbrev_code);
+ const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx);
+ if (abbrev_decl)
+ {
+ // Make sure the abbreviation code still matches. If it doesn't and
+ // the DWARF data was mmap'ed, the backing file might have been modified
+ // which is bad news.
+ const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset);
+
+ if (abbrev_decl->Code() == abbrev_code)
+ return abbrev_decl;
+
+ dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)",
+ GetOffset(),
+ (uint32_t)abbrev_decl->Code(),
+ (uint32_t)abbrev_code);
+ }
}
offset = DW_INVALID_OFFSET;
return NULL;
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp Mon Oct 15 11:27:58 2012
@@ -34,11 +34,12 @@
s.PutCString("\n ");
s.Indent();
- s.AddressRange (start_addr + base_addr,
- end_addr + base_addr,
- cu->GetAddressByteSize(),
- NULL,
- ": ");
+ if (cu)
+ s.AddressRange (start_addr + base_addr,
+ end_addr + base_addr,
+ cu->GetAddressByteSize(),
+ NULL,
+ ": ");
uint32_t loc_length = debug_loc_data.GetU16(&offset);
DataExtractor locationData(debug_loc_data, offset, loc_length);
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Oct 15 11:27:58 2012
@@ -921,9 +921,12 @@
if (dwarf_cu)
{
const DWARFDebugInfoEntry *die = dwarf_cu->GetCompileUnitDIEOnly();
- const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
- if (language)
- return (lldb::LanguageType)language;
+ if (die)
+ {
+ const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
+ if (language)
+ return (lldb::LanguageType)language;
+ }
}
return eLanguageTypeUnknown;
}
@@ -5916,14 +5919,16 @@
if (accessibility == eAccessNone)
accessibility = eAccessPublic;
- clang::ObjCMethodDecl *objc_method_decl;
- objc_method_decl = ast.AddMethodToObjCObjectType (class_opaque_type,
- type_name_cstr,
- clang_type,
- accessibility);
- LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(objc_method_decl), die);
+ clang::ObjCMethodDecl *objc_method_decl = ast.AddMethodToObjCObjectType (class_opaque_type,
+ type_name_cstr,
+ clang_type,
+ accessibility);
type_handled = objc_method_decl != NULL;
- GetClangASTContext().SetMetadata((uintptr_t)objc_method_decl, MakeUserID(die->GetOffset()));
+ if (type_handled)
+ {
+ LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(objc_method_decl), die);
+ GetClangASTContext().SetMetadata((uintptr_t)objc_method_decl, MakeUserID(die->GetOffset()));
+ }
}
}
else if (is_cxx_method)
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon Oct 15 11:27:58 2012
@@ -50,6 +50,11 @@
{
}
+ virtual
+ ~DebugMapModule ()
+ {
+ }
+
virtual ObjectFile *
GetObjectFile ()
{
Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp Mon Oct 15 11:27:58 2012
@@ -9,7 +9,7 @@
#include "UnwindAssembly-x86.h"
-#include "llvm-c/EnhancedDisassembly.h"
+#include "llvm-c/Disassembler.h"
#include "llvm/Support/TargetSelect.h"
#include "lldb/Core/Address.h"
@@ -117,7 +117,9 @@
class AssemblyParse_x86 {
public:
- AssemblyParse_x86 (const ExecutionContext &exe_ctx, int cpu, AddressRange func);
+ AssemblyParse_x86 (const ExecutionContext &exe_ctx, int cpu, ArchSpec &arch, AddressRange func);
+
+ ~AssemblyParse_x86 ();
bool get_non_call_site_unwind_plan (UnwindPlan &unwind_plan);
@@ -157,11 +159,13 @@
int m_wordsize;
int m_cpu;
+ ArchSpec m_arch;
+ ::LLVMDisasmContextRef m_disasm_context;
DISALLOW_COPY_AND_ASSIGN (AssemblyParse_x86);
};
-AssemblyParse_x86::AssemblyParse_x86 (const ExecutionContext &exe_ctx, int cpu, AddressRange func) :
+AssemblyParse_x86::AssemblyParse_x86 (const ExecutionContext &exe_ctx, int cpu, ArchSpec &arch, AddressRange func) :
m_exe_ctx (exe_ctx),
m_func_bounds(func),
m_cur_insn (),
@@ -172,7 +176,8 @@
m_lldb_sp_regnum (LLDB_INVALID_REGNUM),
m_lldb_fp_regnum (LLDB_INVALID_REGNUM),
m_wordsize (-1),
- m_cpu(cpu)
+ m_cpu(cpu),
+ m_arch(arch)
{
int *initialized_flag = NULL;
if (cpu == k_i386)
@@ -236,8 +241,18 @@
if (machine_regno_to_lldb_regno (m_machine_ip_regnum, lldb_regno))
m_lldb_ip_regnum = lldb_regno;
}
+
+ m_disasm_context = ::LLVMCreateDisasm(m_arch.GetTriple().getTriple().c_str(),
+ (void*)this,
+ /*TagType=*/1,
+ NULL,
+ NULL);
}
+AssemblyParse_x86::~AssemblyParse_x86 ()
+{
+ ::LLVMDisasmDispose(m_disasm_context);
+}
// This function expects an x86 native register number (i.e. the bits stripped out of the
// actual instruction), not an lldb register number.
@@ -451,79 +466,34 @@
return false;
}
-struct edis_byte_read_token
-{
- Address *address;
- Target *target;
-};
-
-
-static int
-read_byte_for_edis (uint8_t *buf, uint64_t offset_address, void *arg)
-{
- if (arg == 0)
- return -1;
- struct edis_byte_read_token *tok = (edis_byte_read_token *) arg;
- Address *base_address = tok->address;
- Target *target = tok->target;
-
- Address read_addr = *base_address;
- read_addr.SetOffset (offset_address);
-
- uint8_t onebyte_buf[1];
- Error error;
- const bool prefer_file_cache = true;
- if (target->ReadMemory (read_addr, prefer_file_cache, onebyte_buf, 1, error) != -1)
- {
- *buf = onebyte_buf[0];
- return 0;
- }
- return -1;
-}
-
-
bool
AssemblyParse_x86::instruction_length (Address addr, int &length)
{
- const char *triple;
+ const uint32_t max_op_byte_size = m_arch.GetMaximumOpcodeByteSize();
+ llvm::SmallVector <uint8_t, 32> opcode_data;
+ opcode_data.resize (max_op_byte_size);
if (!addr.IsValid())
return false;
- // FIXME should probably pass down the ArchSpec and work from that to make a portable triple
- if (m_cpu == k_i386)
- triple = "i386-unknown-unknown";
- else
- triple = "x86_64-unknown-unknown";
-
- // Initialize the LLVM objects needed to use the disassembler.
- static struct InitializeLLVM {
- InitializeLLVM() {
- llvm::InitializeAllTargetInfos();
- llvm::InitializeAllTargetMCs();
- llvm::InitializeAllAsmParsers();
- llvm::InitializeAllDisassemblers();
- }
- } InitializeLLVM;
-
- EDDisassemblerRef disasm;
- EDInstRef cur_insn;
-
- if (EDGetDisassembler (&disasm, triple, kEDAssemblySyntaxX86ATT) != 0)
+ const bool prefer_file_cache = true;
+ Error error;
+ Target *target = m_exe_ctx.GetTargetPtr();
+ if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(), max_op_byte_size, error) == -1)
{
return false;
}
+
+ char out_string[512];
+ const addr_t pc = addr.GetFileAddress();
+ const size_t inst_size = ::LLVMDisasmInstruction (m_disasm_context,
+ opcode_data.data(),
+ max_op_byte_size,
+ pc, // PC value
+ out_string,
+ sizeof(out_string));
- uint64_t addr_offset = addr.GetOffset();
- struct edis_byte_read_token arg;
- arg.address = &addr;
- arg.target = m_exe_ctx.GetTargetPtr();
- if (EDCreateInsts (&cur_insn, 1, disasm, read_byte_for_edis, addr_offset, &arg) != 1)
- {
- return false;
- }
- length = EDInstByteSize (cur_insn);
- EDReleaseInst (cur_insn);
+ length = inst_size;
return true;
}
@@ -907,7 +877,8 @@
UnwindAssembly_x86::UnwindAssembly_x86 (const ArchSpec &arch, int cpu) :
lldb_private::UnwindAssembly(arch),
- m_cpu(cpu)
+ m_cpu(cpu),
+ m_arch(arch)
{
}
@@ -920,7 +891,7 @@
UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly (AddressRange& func, Thread& thread, UnwindPlan& unwind_plan)
{
ExecutionContext exe_ctx (thread.shared_from_this());
- AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, func);
+ AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, m_arch, func);
return asm_parse.get_non_call_site_unwind_plan (unwind_plan);
}
@@ -928,14 +899,14 @@
UnwindAssembly_x86::GetFastUnwindPlan (AddressRange& func, Thread& thread, UnwindPlan &unwind_plan)
{
ExecutionContext exe_ctx (thread.shared_from_this());
- AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, func);
+ AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, m_arch, func);
return asm_parse.get_fast_unwind_plan (func, unwind_plan);
}
bool
UnwindAssembly_x86::FirstNonPrologueInsn (AddressRange& func, const ExecutionContext &exe_ctx, Address& first_non_prologue_insn)
{
- AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, func);
+ AssemblyParse_x86 asm_parse(exe_ctx, m_cpu, m_arch, func);
return asm_parse.find_first_non_prologue_insn (first_non_prologue_insn);
}
Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h Mon Oct 15 11:27:58 2012
@@ -10,6 +10,8 @@
#ifndef liblldb_UnwindAssembly_x86_h_
#define liblldb_UnwindAssembly_x86_h_
+#include "llvm-c/Disassembler.h"
+
#include "lldb/lldb-private.h"
#include "lldb/Target/UnwindAssembly.h"
@@ -67,6 +69,7 @@
UnwindAssembly_x86 (const lldb_private::ArchSpec &arch, int cpu);
int m_cpu;
+ lldb_private::ArchSpec m_arch;
};
Modified: lldb/branches/windows/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTContext.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTContext.cpp Mon Oct 15 11:27:58 2012
@@ -3645,6 +3645,63 @@
return NULL;
}
+lldb::BasicType
+ClangASTContext::GetLLDBBasicTypeEnumeration (clang_type_t clang_type)
+{
+ if (clang_type)
+ {
+ QualType qual_type(QualType::getFromOpaquePtr(clang_type));
+ const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+ switch (type_class)
+ {
+ case clang::Type::Builtin:
+ switch (cast<clang::BuiltinType>(qual_type)->getKind())
+
+ case clang::BuiltinType::Void: return eBasicTypeVoid;
+ case clang::BuiltinType::Bool: return eBasicTypeBool;
+ case clang::BuiltinType::Char_S: return eBasicTypeSignedChar;
+ case clang::BuiltinType::Char_U: return eBasicTypeUnsignedChar;
+ case clang::BuiltinType::Char16: return eBasicTypeChar16;
+ case clang::BuiltinType::Char32: return eBasicTypeChar32;
+ case clang::BuiltinType::UChar: return eBasicTypeUnsignedChar;
+ case clang::BuiltinType::SChar: return eBasicTypeSignedChar;
+ case clang::BuiltinType::WChar_S: return eBasicTypeSignedWChar;
+ case clang::BuiltinType::WChar_U: return eBasicTypeUnsignedWChar;
+ case clang::BuiltinType::Short: return eBasicTypeShort;
+ case clang::BuiltinType::UShort: return eBasicTypeUnsignedShort;
+ case clang::BuiltinType::Int: return eBasicTypeInt;
+ case clang::BuiltinType::UInt: return eBasicTypeUnsignedInt;
+ case clang::BuiltinType::Long: return eBasicTypeLong;
+ case clang::BuiltinType::ULong: return eBasicTypeUnsignedLong;
+ case clang::BuiltinType::LongLong: return eBasicTypeLongLong;
+ case clang::BuiltinType::ULongLong: return eBasicTypeUnsignedLongLong;
+ case clang::BuiltinType::Int128: return eBasicTypeInt128;
+ case clang::BuiltinType::UInt128: return eBasicTypeUnsignedInt128;
+
+ case clang::BuiltinType::Half: return eBasicTypeHalf;
+ case clang::BuiltinType::Float: return eBasicTypeFloat;
+ case clang::BuiltinType::Double: return eBasicTypeDouble;
+ case clang::BuiltinType::LongDouble:return eBasicTypeLongDouble;
+
+ case clang::BuiltinType::NullPtr: return eBasicTypeNullPtr;
+ case clang::BuiltinType::ObjCId: return eBasicTypeObjCID;
+ case clang::BuiltinType::ObjCClass: return eBasicTypeObjCClass;
+ case clang::BuiltinType::ObjCSel: return eBasicTypeObjCSel;
+ case clang::BuiltinType::Dependent:
+ case clang::BuiltinType::Overload:
+ case clang::BuiltinType::BoundMember:
+ case clang::BuiltinType::PseudoObject:
+ case clang::BuiltinType::UnknownAny:
+ case clang::BuiltinType::BuiltinFn:
+ case clang::BuiltinType::ARCUnbridgedCast:
+ return eBasicTypeOther;
+ }
+ }
+
+ return eBasicTypeInvalid;
+}
+
+
// If a pointer to a pointee type (the clang_type arg) says that it has no
// children, then we either need to trust it, or override it and return a
@@ -4772,7 +4829,7 @@
ObjCInterfaceDecl::ivar_iterator ivar_pos, ivar_end = class_interface_decl->ivar_end();
ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
- for (ivar_pos = class_interface_decl->ivar_begin(); ivar_pos != ivar_end; ++ivar_pos)
+ for (ivar_pos = class_interface_decl->ivar_begin(); ivar_pos != ivar_end; ++ivar_pos, ++child_idx)
{
const ObjCIvarDecl* ivar_decl = *ivar_pos;
Modified: lldb/branches/windows/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTImporter.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTImporter.cpp Mon Oct 15 11:27:58 2012
@@ -316,6 +316,7 @@
void
ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl)
{
+ assert (decl);
ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
const DeclContext *parent_context = decl->getDeclContext();
Modified: lldb/branches/windows/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTType.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTType.cpp Mon Oct 15 11:27:58 2012
@@ -284,7 +284,7 @@
return lldb::eLanguageTypeObjC;
clang::QualType pointee_type (qual_type->getPointeeType());
- if (pointee_type->getCXXRecordDeclForPointerType() != NULL)
+ if (pointee_type->getPointeeCXXRecordDecl() != NULL)
return lldb::eLanguageTypeC_plus_plus;
if (pointee_type->isObjCObjectOrInterfaceType())
return lldb::eLanguageTypeObjC;
Modified: lldb/branches/windows/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Function.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Function.cpp (original)
+++ lldb/branches/windows/source/Symbol/Function.cpp Mon Oct 15 11:27:58 2012
@@ -343,7 +343,9 @@
Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
{
Type* func_type = GetType();
- *s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = ";
+ const char *name = func_type ? func_type->GetName().AsCString() : "<unknown>";
+
+ *s << "id = " << (const UserID&)*this << ", name = \"" << name << "\", range = ";
Address::DumpStyle fallback_style;
if (level == eDescriptionLevelVerbose)
@@ -493,10 +495,14 @@
clang_type_t
Function::GetReturnClangType ()
{
- clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType()));
- const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
- if (function_type)
- return function_type->getResultType().getAsOpaquePtr();
+ Type *type = GetType();
+ if (type)
+ {
+ clang::QualType clang_type (clang::QualType::getFromOpaquePtr(type->GetClangFullType()));
+ const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
+ if (function_type)
+ return function_type->getResultType().getAsOpaquePtr();
+ }
return NULL;
}
Modified: lldb/branches/windows/source/Symbol/VariableList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/VariableList.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/VariableList.cpp (original)
+++ lldb/branches/windows/source/Symbol/VariableList.cpp Mon Oct 15 11:27:58 2012
@@ -178,41 +178,3 @@
(*pos)->Dump(s, show_context);
}
}
-
-lldb::VariableSP
-VariableList::FindArtificialObjectVariable (lldb::LanguageType language) const
-{
- lldb::VariableSP object_variable_sp;
- ConstString object_variable_name;
- switch (language)
- {
- case eLanguageTypeC_plus_plus:
- object_variable_name.SetCString("this");
- break;
-
- case eLanguageTypeObjC:
- case eLanguageTypeObjC_plus_plus:
- object_variable_name.SetCString("self");
- break;
-
- default:
- break;
- }
- if (object_variable_name)
- {
- const_iterator pos, end = m_variables.end();
- for (pos = m_variables.begin(); pos != end; ++pos)
- {
- Variable *variable = pos->get();
- if (variable->IsArtificial() &&
- variable->GetScope() == eValueTypeVariableArgument &&
- variable->GetName() == object_variable_name)
- {
- object_variable_sp = *pos;
- break;
- }
- }
- }
- return object_variable_sp;
-}
-
Modified: lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp Mon Oct 15 11:27:58 2012
@@ -31,6 +31,7 @@
ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
LanguageRuntime (process),
m_has_new_literals_and_indexing (eLazyBoolCalculate),
+ m_isa_to_descriptor_cache(),
m_isa_to_descriptor_cache_is_up_to_date (false)
{
@@ -269,7 +270,7 @@
uint32_t ptr_size,
bool allow_NULLs,
bool allow_tagged,
- bool check_version_specific)
+ bool check_version_specific) const
{
if (!value)
return allow_NULLs;
@@ -284,91 +285,124 @@
ObjCLanguageRuntime::ObjCISA
ObjCLanguageRuntime::GetISA(const ConstString &name)
{
- // Try once regardless of whether the map has been brought up to date. We
- // might have encountered the relevant isa directly.
-
- for (std::map<ObjCISA, ClassDescriptorSP>::iterator it =
- m_isa_to_descriptor_cache.begin(); it != m_isa_to_descriptor_cache.end(); ++it)
- if (it->second && it->second->GetClassName() == name)
- return it->first;
-
- // If the map is up to date and we didn't find the isa, give up.
- if (m_isa_to_descriptor_cache_is_up_to_date)
- return 0;
-
- // Try again after bringing the map up to date.
- UpdateISAToDescriptorMap();
+ UpdateISAToDescriptorMap();
for (std::map<ObjCISA, ClassDescriptorSP>::iterator it =
m_isa_to_descriptor_cache.begin(); it != m_isa_to_descriptor_cache.end(); ++it)
if (it->second && it->second->GetClassName() == name)
return it->first;
-
- // Now we know for sure that the class isn't there. Give up.
return 0;
}
ObjCLanguageRuntime::ObjCISA
ObjCLanguageRuntime::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
{
- if (!IsValidISA(isa))
- return 0;
-
- ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
-
- if (found != end && found->second)
+ ClassDescriptorSP objc_class_sp (GetClassDescriptor(isa));
+ if (objc_class_sp)
{
- ClassDescriptorSP superclass = found->second->GetSuperclass();
- if (!superclass || !superclass->IsValid())
- return 0;
- else
- {
- ObjCISA parent_isa = superclass->GetISA();
- m_isa_to_descriptor_cache[parent_isa] = superclass;
- return parent_isa;
- }
+ ClassDescriptorSP objc_super_class_sp (objc_class_sp->GetSuperclass());
+ if (objc_super_class_sp)
+ return objc_super_class_sp->GetISA();
}
-
- ClassDescriptorSP descriptor(GetClassDescriptor(isa));
- if (!descriptor.get() || !descriptor->IsValid())
- return 0;
- m_isa_to_descriptor_cache[isa] = descriptor;
- ClassDescriptorSP superclass(descriptor->GetSuperclass());
- if (!superclass.get() || !superclass->IsValid())
- return 0;
- ObjCISA parent_isa = superclass->GetISA();
- m_isa_to_descriptor_cache[parent_isa] = superclass;
- return parent_isa;
+ return 0;
}
-// TODO: should we have a transparent_kvo parameter here to say if we
-// want to replace the KVO swizzled class with the actual user-level type?
ConstString
ObjCLanguageRuntime::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
{
- static const ConstString g_unknown ("unknown");
-
- if (!IsValidISA(isa))
- return ConstString();
-
- ISAToDescriptorIterator found = m_isa_to_descriptor_cache.find(isa);
- ISAToDescriptorIterator end = m_isa_to_descriptor_cache.end();
-
- if (found != end && found->second)
- return found->second->GetClassName();
-
- ClassDescriptorSP descriptor(GetClassDescriptor(isa));
- if (!descriptor.get() || !descriptor->IsValid())
- return ConstString();
- ConstString class_name = descriptor->GetClassName();
- if (descriptor->IsKVO())
- {
- ClassDescriptorSP superclass(descriptor->GetSuperclass());
- if (!superclass.get() || !superclass->IsValid())
- return ConstString();
- descriptor = superclass;
+ ClassDescriptorSP objc_class_sp (GetNonKVOClassDescriptor(isa));
+ if (objc_class_sp)
+ return objc_class_sp->GetClassName();
+ return ConstString();
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+ObjCLanguageRuntime::GetClassDescriptor (const ConstString &class_name)
+{
+ UpdateISAToDescriptorMap();
+ for (std::map<ObjCISA, ClassDescriptorSP>::iterator it =
+ m_isa_to_descriptor_cache.begin(); it != m_isa_to_descriptor_cache.end(); ++it)
+ if (it->second && it->second->GetClassName() == class_name)
+ return it->second;
+ return ClassDescriptorSP();
+
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+ObjCLanguageRuntime::GetClassDescriptor (ValueObject& valobj)
+{
+ ClassDescriptorSP objc_class_sp;
+ // if we get an invalid VO (which might still happen when playing around
+ // with pointers returned by the expression parser, don't consider this
+ // a valid ObjC object)
+ if (valobj.GetValue().GetContextType() != Value::eContextTypeInvalid)
+ {
+ addr_t isa_pointer = valobj.GetPointerValue();
+ if (isa_pointer != LLDB_INVALID_ADDRESS)
+ {
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process)
+ {
+ Error error;
+ ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
+ if (isa != LLDB_INVALID_ADDRESS)
+ objc_class_sp = GetClassDescriptor (isa);
+ }
+ }
+ }
+ return objc_class_sp;
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+ObjCLanguageRuntime::GetNonKVOClassDescriptor (ValueObject& valobj)
+{
+ ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (GetClassDescriptor (valobj));
+ if (objc_class_sp)
+ {
+ if (!objc_class_sp->IsKVO())
+ return objc_class_sp;
+
+ ClassDescriptorSP non_kvo_objc_class_sp(objc_class_sp->GetSuperclass());
+ if (non_kvo_objc_class_sp && non_kvo_objc_class_sp->IsValid())
+ return non_kvo_objc_class_sp;
+ }
+ return ClassDescriptorSP();
+}
+
+
+ObjCLanguageRuntime::ClassDescriptorSP
+ObjCLanguageRuntime::GetClassDescriptor (ObjCISA isa)
+{
+ if (isa)
+ {
+ UpdateISAToDescriptorMap();
+ ObjCLanguageRuntime::ISAToDescriptorIterator pos = m_isa_to_descriptor_cache.find(isa);
+ if (pos != m_isa_to_descriptor_cache.end())
+ return pos->second;
+ }
+ return ClassDescriptorSP();
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+ObjCLanguageRuntime::GetNonKVOClassDescriptor (ObjCISA isa)
+{
+ if (isa)
+ {
+ ClassDescriptorSP objc_class_sp = GetClassDescriptor (isa);
+ if (objc_class_sp && objc_class_sp->IsValid())
+ {
+ if (!objc_class_sp->IsKVO())
+ return objc_class_sp;
+
+ ClassDescriptorSP non_kvo_objc_class_sp(objc_class_sp->GetSuperclass());
+ if (non_kvo_objc_class_sp && non_kvo_objc_class_sp->IsValid())
+ return non_kvo_objc_class_sp;
+ }
}
- m_isa_to_descriptor_cache[isa] = descriptor;
- return descriptor->GetClassName();
+ return ClassDescriptorSP();
}
+
+
+
Modified: lldb/branches/windows/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Process.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Process.cpp (original)
+++ lldb/branches/windows/source/Target/Process.cpp Mon Oct 15 11:27:58 2012
@@ -2751,10 +2751,19 @@
error = WillAttachToProcessWithName(process_name, wait_for_launch);
if (error.Success())
{
- m_should_detach = true;
+ if (m_run_lock.WriteTryLock())
+ {
+ m_should_detach = true;
+ SetPublicState (eStateAttaching);
+ // Now attach using these arguments.
+ error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
+ }
+ else
+ {
+ // This shouldn't happen
+ error.SetErrorString("failed to acquire process run lock");
+ }
- SetPublicState (eStateAttaching);
- error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
if (error.Fail())
{
if (GetID() != LLDB_INVALID_PROCESS_ID)
@@ -2818,10 +2827,20 @@
error = WillAttachToProcessWithID(attach_pid);
if (error.Success())
{
- m_should_detach = true;
- SetPublicState (eStateAttaching);
- error = DoAttachToProcessWithID (attach_pid, attach_info);
+ if (m_run_lock.WriteTryLock())
+ {
+ // Now attach using these arguments.
+ m_should_detach = true;
+ SetPublicState (eStateAttaching);
+ error = DoAttachToProcessWithID (attach_pid, attach_info);
+ }
+ else
+ {
+ // This shouldn't happen
+ error.SetErrorString("failed to acquire process run lock");
+ }
+
if (error.Success())
{
@@ -2907,7 +2926,7 @@
}
Error
-Process::ConnectRemote (const char *remote_url)
+Process::ConnectRemote (Stream *strm, const char *remote_url)
{
m_abi_sp.reset();
m_process_input_reader.reset();
@@ -2915,7 +2934,7 @@
// Find the process and its architecture. Make sure it matches the architecture
// of the current Target, and if not adjust it.
- Error error (DoConnectRemote (remote_url));
+ Error error (DoConnectRemote (strm, remote_url));
if (error.Success())
{
if (GetID() != LLDB_INVALID_PROCESS_ID)
@@ -3132,7 +3151,6 @@
if (state != eStateStopped)
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("Process::Destroy() Halt failed to stop, state is: %s", StateAsCString(state));
// If we really couldn't stop the process then we should just error out here, but if the
@@ -3148,7 +3166,6 @@
}
else
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
return error;
Modified: lldb/branches/windows/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StackFrameList.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StackFrameList.cpp (original)
+++ lldb/branches/windows/source/Target/StackFrameList.cpp Mon Oct 15 11:27:58 2012
@@ -274,8 +274,6 @@
if (end_idx > 0)
end_idx += inlined_depth;
}
- else
- inlined_depth = 0;
}
StackFrameSP unwind_frame_sp;
Modified: lldb/branches/windows/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StopInfo.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StopInfo.cpp (original)
+++ lldb/branches/windows/source/Target/StopInfo.cpp Mon Oct 15 11:27:58 2012
@@ -99,13 +99,11 @@
m_should_stop (false),
m_should_stop_is_valid (false),
m_should_perform_action (true),
- m_address (LLDB_INVALID_ADDRESS)
+ m_address (LLDB_INVALID_ADDRESS),
+ m_break_id(LLDB_INVALID_BREAK_ID),
+ m_was_one_shot (false)
{
- BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByID (m_value));
- if (bp_site_sp)
- {
- m_address = bp_site_sp->GetLoadAddress();
- }
+ StoreBPInfo();
}
StopInfoBreakpoint (Thread &thread, break_id_t break_id, bool should_stop) :
@@ -114,12 +112,28 @@
m_should_stop (should_stop),
m_should_stop_is_valid (true),
m_should_perform_action (true),
- m_address (LLDB_INVALID_ADDRESS)
+ m_address (LLDB_INVALID_ADDRESS),
+ m_break_id(LLDB_INVALID_BREAK_ID),
+ m_was_one_shot (false)
+ {
+ StoreBPInfo();
+ }
+
+ void StoreBPInfo ()
{
BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByID (m_value));
if (bp_site_sp)
{
- m_address = bp_site_sp->GetLoadAddress();
+ if (bp_site_sp->GetNumberOfOwners() == 1)
+ {
+ BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(0);
+ if (bp_loc_sp)
+ {
+ m_break_id = bp_loc_sp->GetBreakpoint().GetID();
+ m_was_one_shot = bp_loc_sp->GetBreakpoint().IsOneShot();
+ }
+ }
+ m_address = bp_site_sp->GetLoadAddress();
}
}
@@ -298,6 +312,12 @@
if (callback_says_stop)
m_should_stop = true;
+
+ // If we are going to stop for this breakpoint, then remove the breakpoint.
+ if (callback_says_stop && bp_loc_sp && bp_loc_sp->GetBreakpoint().IsOneShot())
+ {
+ m_thread.GetProcess()->GetTarget().RemoveBreakpointByID (bp_loc_sp->GetBreakpoint().GetID());
+ }
// Also make sure that the callback hasn't continued the target.
// If it did, when we'll set m_should_start to false and get out of here.
@@ -316,10 +336,10 @@
{
m_should_stop = true;
m_should_stop_is_valid = true;
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ LogSP log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);
+ if (log_process)
+ log_process->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);
}
if (log)
log->Printf ("Process::%s returning from action with m_should_stop: %d.", __FUNCTION__, m_should_stop);
@@ -362,10 +382,18 @@
else
{
StreamString strm;
- if (m_address == LLDB_INVALID_ADDRESS)
+ if (m_break_id != LLDB_INVALID_BREAK_ID)
+ {
+ if (m_was_one_shot)
+ strm.Printf ("one-shot breakpoint %d", m_break_id);
+ else
+ strm.Printf ("breakpoint %d which has been deleted.", m_break_id);
+ }
+ else if (m_address == LLDB_INVALID_ADDRESS)
strm.Printf("breakpoint site %lli which has been deleted - unknown address", m_value);
else
strm.Printf("breakpoint site %lli which has been deleted - was at 0x%llx", m_value, m_address);
+
m_description.swap (strm.GetString());
}
}
@@ -381,6 +409,8 @@
lldb::addr_t m_address; // We use this to capture the breakpoint site address when we create the StopInfo,
// in case somebody deletes it between the time the StopInfo is made and the
// description is asked for.
+ lldb::break_id_t m_break_id;
+ bool m_was_one_shot;
};
@@ -676,10 +706,10 @@
}
else
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ LogSP log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf ("Process::%s could not find watchpoint id: %lld...", __FUNCTION__, m_value);
+ if (log_process)
+ log_process->Printf ("Process::%s could not find watchpoint id: %lld...", __FUNCTION__, m_value);
}
if (log)
log->Printf ("Process::%s returning from action with m_should_stop: %d.", __FUNCTION__, m_should_stop);
Modified: lldb/branches/windows/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Target.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Target.cpp (original)
+++ lldb/branches/windows/source/Target/Target.cpp Mon Oct 15 11:27:58 2012
@@ -58,7 +58,7 @@
//----------------------------------------------------------------------
Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp) :
TargetProperties (this),
- Broadcaster (&debugger, "lldb.target"),
+ Broadcaster (&debugger, Target::GetStaticBroadcasterClass().AsCString()),
ExecutionContextScope (),
m_debugger (debugger),
m_platform_sp (platform_sp),
Modified: lldb/branches/windows/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/TargetList.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/TargetList.cpp (original)
+++ lldb/branches/windows/source/Target/TargetList.cpp Mon Oct 15 11:27:58 2012
@@ -38,7 +38,7 @@
// TargetList constructor
//----------------------------------------------------------------------
TargetList::TargetList(Debugger &debugger) :
- Broadcaster(&debugger, "TargetList"),
+ Broadcaster(&debugger, TargetList::GetStaticBroadcasterClass().AsCString()),
m_target_list(),
m_target_list_mutex (Mutex::eMutexTypeRecursive),
m_selected_target_idx (0)
Modified: lldb/branches/windows/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Thread.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Thread.cpp (original)
+++ lldb/branches/windows/source/Target/Thread.cpp Mon Oct 15 11:27:58 2012
@@ -136,13 +136,112 @@
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
+//------------------------------------------------------------------
+// Thread Event Data
+//------------------------------------------------------------------
-Thread::Thread (const ProcessSP &process_sp, lldb::tid_t tid) :
+
+const ConstString &
+Thread::ThreadEventData::GetFlavorString ()
+{
+ static ConstString g_flavor ("Thread::ThreadEventData");
+ return g_flavor;
+}
+
+Thread::ThreadEventData::ThreadEventData (const lldb::ThreadSP thread_sp) :
+ m_thread_sp (thread_sp),
+ m_stack_id ()
+{
+}
+
+Thread::ThreadEventData::ThreadEventData (const lldb::ThreadSP thread_sp, const StackID &stack_id) :
+ m_thread_sp (thread_sp),
+ m_stack_id (stack_id)
+{
+}
+
+Thread::ThreadEventData::ThreadEventData () :
+ m_thread_sp (),
+ m_stack_id ()
+{
+}
+
+Thread::ThreadEventData::~ThreadEventData ()
+{
+}
+
+void
+Thread::ThreadEventData::Dump (Stream *s) const
+{
+
+}
+
+const Thread::ThreadEventData *
+Thread::ThreadEventData::GetEventDataFromEvent (const Event *event_ptr)
+{
+ if (event_ptr)
+ {
+ const EventData *event_data = event_ptr->GetData();
+ if (event_data && event_data->GetFlavor() == ThreadEventData::GetFlavorString())
+ return static_cast <const ThreadEventData *> (event_ptr->GetData());
+ }
+ return NULL;
+}
+
+ThreadSP
+Thread::ThreadEventData::GetThreadFromEvent (const Event *event_ptr)
+{
+ ThreadSP thread_sp;
+ const ThreadEventData *event_data = GetEventDataFromEvent (event_ptr);
+ if (event_data)
+ thread_sp = event_data->GetThread();
+ return thread_sp;
+}
+
+StackID
+Thread::ThreadEventData::GetStackIDFromEvent (const Event *event_ptr)
+{
+ StackID stack_id;
+ const ThreadEventData *event_data = GetEventDataFromEvent (event_ptr);
+ if (event_data)
+ stack_id = event_data->GetStackID();
+ return stack_id;
+}
+
+StackFrameSP
+Thread::ThreadEventData::GetStackFrameFromEvent (const Event *event_ptr)
+{
+ const ThreadEventData *event_data = GetEventDataFromEvent (event_ptr);
+ StackFrameSP frame_sp;
+ if (event_data)
+ {
+ ThreadSP thread_sp = event_data->GetThread();
+ if (thread_sp)
+ {
+ frame_sp = thread_sp->GetStackFrameList()->GetFrameWithStackID (event_data->GetStackID());
+ }
+ }
+ return frame_sp;
+}
+
+//------------------------------------------------------------------
+// Thread class
+//------------------------------------------------------------------
+
+ConstString &
+Thread::GetStaticBroadcasterClass ()
+{
+ static ConstString class_name ("lldb.thread");
+ return class_name;
+}
+
+Thread::Thread (Process &process, lldb::tid_t tid) :
ThreadProperties (false),
UserID (tid),
- m_process_wp (process_sp),
+ Broadcaster(&process.GetTarget().GetDebugger(), Thread::GetStaticBroadcasterClass().AsCString()),
+ m_process_wp (process.shared_from_this()),
m_actual_stop_info_sp (),
- m_index_id (process_sp->GetNextThreadIndexID ()),
+ m_index_id (process.GetNextThreadIndexID ()),
m_reg_context_sp (),
m_state (eStateUnloaded),
m_state_mutex (Mutex::eMutexTypeRecursive),
@@ -163,6 +262,7 @@
if (log)
log->Printf ("%p Thread::Thread(tid = 0x%4.4llx)", this, GetID());
+ CheckInWithManager();
QueueFundamentalPlan(true);
}
@@ -186,6 +286,38 @@
m_destroy_called = true;
}
+void
+Thread::BroadcastSelectedFrameChange(StackID &new_frame_id)
+{
+ if (EventTypeHasListeners(eBroadcastBitSelectedFrameChanged))
+ BroadcastEvent(eBroadcastBitSelectedFrameChanged, new ThreadEventData (this->shared_from_this(), new_frame_id));
+}
+
+uint32_t
+Thread::SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast)
+{
+ uint32_t ret_value = GetStackFrameList()->SetSelectedFrame(frame);
+ if (broadcast)
+ BroadcastSelectedFrameChange(frame->GetStackID());
+ return ret_value;
+}
+
+bool
+Thread::SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast)
+{
+ StackFrameSP frame_sp(GetStackFrameList()->GetFrameAtIndex (frame_idx));
+ if (frame_sp)
+ {
+ GetStackFrameList()->SetSelectedFrame(frame_sp.get());
+ if (broadcast)
+ BroadcastSelectedFrameChange(frame_sp->GetStackID());
+ return true;
+ }
+ else
+ return false;
+}
+
+
lldb::StopInfoSP
Thread::GetStopInfo ()
{
@@ -210,7 +342,7 @@
{
lldb::StopInfoSP stop_info_sp (GetStopInfo ());
if (stop_info_sp)
- stop_info_sp->GetStopReason();
+ return stop_info_sp->GetStopReason();
return eStopReasonNone;
}
@@ -1285,7 +1417,7 @@
Error
-Thread::ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp)
+Thread::ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast)
{
StackFrameSP frame_sp = GetStackFrameAtIndex (frame_idx);
Error return_error;
@@ -1295,11 +1427,11 @@
return_error.SetErrorStringWithFormat("Could not find frame with index %d in thread 0x%llx.", frame_idx, GetID());
}
- return ReturnFromFrame(frame_sp, return_value_sp);
+ return ReturnFromFrame(frame_sp, return_value_sp, broadcast);
}
Error
-Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp)
+Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast)
{
Error return_error;
@@ -1319,6 +1451,7 @@
if (!abi)
{
return_error.SetErrorString("Could not find ABI to set return value.");
+ return return_error;
}
SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
@@ -1358,6 +1491,8 @@
{
thread->DiscardThreadPlans(true);
thread->ClearStackFrames();
+ if (broadcast && EventTypeHasListeners(eBroadcastBitStackChanged))
+ BroadcastEvent(eBroadcastBitStackChanged, new ThreadEventData (this->shared_from_this()));
return return_error;
}
else
Modified: lldb/branches/windows/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanTracer.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanTracer.cpp Mon Oct 15 11:27:58 2012
@@ -72,9 +72,12 @@
bool show_fullpaths = false;
Stream *stream = GetLogStream();
- m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths);
- stream->Printf("\n");
- stream->Flush();
+ if (stream)
+ {
+ m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths);
+ stream->Printf("\n");
+ stream->Flush();
+ }
}
Modified: lldb/branches/windows/source/Utility/StringExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/StringExtractor.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/StringExtractor.cpp (original)
+++ lldb/branches/windows/source/Utility/StringExtractor.cpp Mon Oct 15 11:27:58 2012
@@ -16,6 +16,43 @@
// Other libraries and framework includes
// Project includes
+static const uint8_t
+g_hex_ascii_to_hex_integer[256] = {
+
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,
+ 0x8, 0x9, 255, 255, 255, 255, 255, 255,
+ 255, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255,
+};
+
static inline int
xdigit_to_sint (char ch)
{
@@ -101,35 +138,6 @@
return fail_value;
}
-uint32_t
-StringExtractor::GetNumHexASCIICharsAtFilePos (uint32_t max) const
-{
- uint32_t idx = m_index;
- const size_t size = m_packet.size();
- while (idx < size && idx - m_index < max && isxdigit(m_packet[idx]))
- ++idx;
- return idx - m_index;
-}
-//----------------------------------------------------------------------
-// Extract a signed character from two hex ASCII chars in the packet
-// string
-//----------------------------------------------------------------------
-int8_t
-StringExtractor::GetHexS8 (int8_t fail_value)
-{
- if (GetNumHexASCIICharsAtFilePos(2))
- {
- char hi_nibble_char = m_packet[m_index];
- char lo_nibble_char = m_packet[m_index+1];
- char hi_nibble = xdigit_to_sint (hi_nibble_char);
- char lo_nibble = xdigit_to_sint (lo_nibble_char);
- m_index += 2;
- return (hi_nibble << 4) + lo_nibble;
- }
- m_index = UINT32_MAX;
- return fail_value;
-}
-
//----------------------------------------------------------------------
// Extract an unsigned character from two hex ASCII chars in the packet
// string
@@ -137,14 +145,16 @@
uint8_t
StringExtractor::GetHexU8 (uint8_t fail_value, bool set_eof_on_fail)
{
- if (GetNumHexASCIICharsAtFilePos(2))
+ uint32_t i = m_index;
+ if ((i + 2) <= m_packet.size())
{
- uint8_t hi_nibble_char = m_packet[m_index];
- uint8_t lo_nibble_char = m_packet[m_index+1];
- uint8_t hi_nibble = xdigit_to_uint (hi_nibble_char);
- uint8_t lo_nibble = xdigit_to_uint (lo_nibble_char);
- m_index += 2;
- return (hi_nibble << 4) + lo_nibble;
+ const uint8_t hi_nibble = g_hex_ascii_to_hex_integer[m_packet[i]];
+ const uint8_t lo_nibble = g_hex_ascii_to_hex_integer[m_packet[i+1]];
+ if (hi_nibble < 16 && lo_nibble < 16)
+ {
+ m_index += 2;
+ return (hi_nibble << 4) + lo_nibble;
+ }
}
if (set_eof_on_fail || m_index >= m_packet.size())
m_index = UINT32_MAX;
Modified: lldb/branches/windows/source/Utility/StringExtractor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/StringExtractor.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/StringExtractor.h (original)
+++ lldb/branches/windows/source/Utility/StringExtractor.h Mon Oct 15 11:27:58 2012
@@ -89,9 +89,6 @@
char
GetChar (char fail_value = '\0');
- int8_t
- GetHexS8 (int8_t fail_value = 0);
-
uint8_t
GetHexU8 (uint8_t fail_value = 0, bool set_eof_on_fail = true);
@@ -133,9 +130,6 @@
// will march along as things get extracted. If set
// to UINT32_MAX the end of the packet data was
// reached when decoding information
-
- uint32_t
- GetNumHexASCIICharsAtFilePos (uint32_t max = UINT32_MAX) const;
};
#endif // utility_StringExtractor_h_
Modified: lldb/branches/windows/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/lldb-log.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/lldb-log.cpp (original)
+++ lldb/branches/windows/source/lldb-log.cpp Mon Oct 15 11:27:58 2012
@@ -135,6 +135,7 @@
else if (0 == ::strncasecmp(arg, "unwind", 6)) flag_bits &= ~LIBLLDB_LOG_UNWIND;
else if (0 == ::strncasecmp(arg, "types", 5)) flag_bits &= ~LIBLLDB_LOG_TYPES;
else if (0 == ::strncasecmp(arg, "symbol", 6)) flag_bits &= ~LIBLLDB_LOG_SYMBOLS;
+ else if (0 == ::strncasecmp(arg, "module", 6)) flag_bits &= ~LIBLLDB_LOG_MODULES;
else
{
feedback_strm->Printf ("error: unrecognized log category '%s'\n", arg);
@@ -201,6 +202,7 @@
else if (0 == ::strncasecmp(arg, "unwind", 6)) flag_bits |= LIBLLDB_LOG_UNWIND;
else if (0 == ::strncasecmp(arg, "types", 5)) flag_bits |= LIBLLDB_LOG_TYPES;
else if (0 == ::strncasecmp(arg, "symbol", 6)) flag_bits |= LIBLLDB_LOG_SYMBOLS;
+ else if (0 == ::strncasecmp(arg, "module", 6)) flag_bits |= LIBLLDB_LOG_MODULES;
else
{
feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
@@ -220,23 +222,24 @@
lldb_private::ListLogCategories (Stream *strm)
{
strm->Printf("Logging categories for 'lldb':\n"
- " all - turn on all available logging categories\n"
- " api - enable logging of API calls and return values\n"
- " command - log command argument parsing\n"
- " default - enable the default set of logging categories for liblldb\n"
- " break - log breakpoints\n"
- " events - log broadcaster, listener and event queue activities\n"
- " expr - log expressions\n"
- " object - log object construction/destruction for important objects\n"
- " process - log process events and activities\n"
- " thread - log thread events and activities\n"
- " script - log events about the script interpreter\n"
- " dyld - log shared library related activities\n"
- " state - log private and public process state changes\n"
- " step - log step related activities\n"
- " unwind - log stack unwind activities\n"
- " verbose - enable verbose logging\n"
- " symbol - log symbol related issues and warnings\n"
- " watch - log watchpoint related activities\n"
- " types - log type system related activities\n");
+ " all - turn on all available logging categories\n"
+ " api - enable logging of API calls and return values\n"
+ " break - log breakpoints\n"
+ " command - log command argument parsing\n"
+ " default - enable the default set of logging categories for liblldb\n"
+ " dyld - log shared library related activities\n"
+ " events - log broadcaster, listener and event queue activities\n"
+ " expr - log expressions\n"
+ " object - log object construction/destruction for important objects\n"
+ " module - log module activities such as when modules are created, detroyed, replaced, and more\n"
+ " process - log process events and activities\n"
+ " script - log events about the script interpreter\n"
+ " state - log private and public process state changes\n"
+ " step - log step related activities\n"
+ " symbol - log symbol related issues and warnings\n"
+ " thread - log thread events and activities\n"
+ " types - log type system related activities\n"
+ " unwind - log stack unwind activities\n"
+ " verbose - enable verbose logging\n"
+ " watch - log watchpoint related activities\n");
}
Modified: lldb/branches/windows/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/lldb.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/source/lldb.cpp (original)
+++ lldb/branches/windows/source/lldb.cpp Mon Oct 15 11:27:58 2012
@@ -44,10 +44,10 @@
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#if defined (__APPLE__)
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
-#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h"
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
@@ -126,11 +126,11 @@
ObjectContainerUniversalMachO::Initialize();
ObjectFileMachO::Initialize();
+ DynamicLoaderDarwinKernel::Initialize();
#if defined (__APPLE__)
//----------------------------------------------------------------------
// Apple/Darwin hosted plugins
//----------------------------------------------------------------------
- DynamicLoaderDarwinKernel::Initialize();
OperatingSystemDarwinKernel::Initialize();
ItaniumABILanguageRuntime::Initialize();
AppleObjCRuntimeV2::Initialize();
@@ -209,8 +209,8 @@
#endif
DynamicLoaderMacOSXDYLD::Terminate();
-#if defined (__APPLE__)
DynamicLoaderDarwinKernel::Terminate();
+#if defined (__APPLE__)
OperatingSystemDarwinKernel::Terminate();
ItaniumABILanguageRuntime::Terminate();
AppleObjCRuntimeV2::Terminate();
Modified: lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py Mon Oct 15 11:27:58 2012
@@ -36,6 +36,7 @@
startstr = "The following is a list of built-in, permanent debugger commands:")
# Several matching commands: list them and error out.
+ self.runCmd("command unalias t")
self.expect("t",
COMMAND_FAILED_AS_EXPECTED, error = True,
substrs = ["Ambiguous command 't'. Possible matches:",
@@ -88,7 +89,7 @@
patterns = [ "Current executable set to .*a.out.*" ])
# By default, the setting interpreter.expand-regex-aliases is false.
- self.expect("_regexp-b product", matching=False,
+ self.expect("_regexp-br product", matching=False,
substrs = [ "breakpoint set --name" ])
match_object = lldbutil.run_break_set_command (self, "br s -n sum")
Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Mon Oct 15 11:27:58 2012
@@ -229,6 +229,9 @@
'(NSNumber *) num8_N = ',' @"0"',
'(NSNumber *) num9 = ',' (short)-31616'])
+ self.expect('frame variable decimal_one',
+ substrs = ['(NSDecimalNumber *) decimal_one = 0x','1'])
+
self.expect('frame variable num_at1 num_at2 num_at3 num_at4',
substrs = ['(NSNumber *) num_at1 = ',' (int)12',
'(NSNumber *) num_at2 = ',' (int)-12',
@@ -309,6 +312,15 @@
self.expect('frame variable date1 date2',
substrs = ['1985-04','2011-01'])
+ self.expect('frame variable localhost',
+ substrs = ['<NSHost ','> localhost ((','"127.0.0.1"'])
+
+ self.expect('frame variable my_task',
+ substrs = ['<NS','Task: 0x'])
+
+ self.expect('frame variable range_value',
+ substrs = ['NSRange: {4, 4}'])
+
# this test might fail if we hit the breakpoint late on December 31st of some given year
# and midnight comes between hitting the breakpoint and running this line of code
# hopefully the output will be revealing enough in that case :-)
Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m Mon Oct 15 11:27:58 2012
@@ -158,6 +158,8 @@
NSNumber* num_at3 = @12.5;
NSNumber* num_at4 = @-12.5;
+ NSDecimalNumber* decimal_one = [NSDecimalNumber one];
+
NSString *str0 = [num6 stringValue];
NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
@@ -554,7 +556,7 @@
NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)];
NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init];
- [imset addIndex:4];
+ [imset addIndex:1936];
[imset addIndex:7];
[imset addIndex:9];
[imset addIndex:11];
@@ -582,12 +584,19 @@
NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"];
NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"];
+ NSHost *localhost = [NSHost hostWithAddress:@"127.0.0.1"];
+
+ NSTask *my_task = [[NSTask alloc] init];
+
CFGregorianUnits cf_greg_units = {1,3,5,12,5,7};
CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL);
CFRange cf_range = {4,4};
NSPoint ns_point = {4,4};
NSRange ns_range = {4,4};
+
+ NSValue *range_value = [NSValue valueWithRange:ns_range];
+
NSRect ns_rect = {{1,1},{5,5}};
NSRect* ns_rect_ptr = &ns_rect;
NSRectArray ns_rect_arr = &ns_rect;
Modified: lldb/branches/windows/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/redo.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/test/redo.py (original)
+++ lldb/branches/windows/test/redo.py Mon Oct 15 11:27:58 2012
@@ -169,12 +169,14 @@
usage()
filters = " -f ".join(redo_specs)
- compilers = (" -C %s" % "^".join(comp_specs)) if comp_specs else None
- archs = (" -A %s" % "^".join(arch_specs)) if arch_specs else None
+ compilers = ''
+ for comp in comp_specs:
+ compilers += " -C %s" % (comp)
+ archs = ''
+ for arch in arch_specs:
+ archs += "--arch %s " % (arch)
- command = "./dotest.py %s %s -v %s -f " % (compilers if compilers else "",
- archs if archs else "",
- "" if no_trace else "-t")
+ command = "./dotest.py %s %s -v %s -f " % (compilers, archs, "" if no_trace else "-t")
print "Running %s" % (command + filters)
Modified: lldb/branches/windows/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/source-manager/TestSourceManager.py?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/test/source-manager/TestSourceManager.py (original)
+++ lldb/branches/windows/test/source-manager/TestSourceManager.py Mon Oct 15 11:27:58 2012
@@ -78,7 +78,7 @@
patterns = ['=> %d.*Hello world' % self.line])
# Boundary condition testings for SBStream(). LLDB should not crash!
- stream.Printf(None)
+ stream.Print(None)
stream.RedirectToFile(None, True)
def move_and_then_display_source(self):
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp Mon Oct 15 11:27:58 2012
@@ -1533,11 +1533,13 @@
case eLaunchFlavorSpringBoard:
{
const char *app_ext = strstr(path, ".app");
- if (app_ext != NULL)
+ if (app_ext && (app_ext[4] == '\0' || app_ext[4] == '/'))
{
std::string app_bundle_path(path, app_ext + strlen(".app"));
if (SBLaunchForDebug (app_bundle_path.c_str(), argv, envp, no_stdio, launch_err) != 0)
return m_pid; // A successful SBLaunchForDebug() returns and assigns a non-zero m_pid.
+ else
+ break; // We tried a springboard launch, but didn't succeed lets get out
}
}
// In case the executable name has a ".app" fragment which confuses our debugserver,
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Mon Oct 15 11:27:58 2012
@@ -3223,7 +3223,7 @@
return 0;
::memcpy (buf, &m_state.context, size);
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, buf_len, (uint64_t)size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
// Return the size of the register context even if NULL was passed in
return size;
}
@@ -3245,7 +3245,7 @@
SetVFPState();
SetEXCState();
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, buf_len, (uint64_t)size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
return size;
}
Modified: lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp Mon Oct 15 11:27:58 2012
@@ -189,7 +189,9 @@
// Disconnect from any previous connections
Disconnect(false);
- if (::lockdown_secure_checkin (&m_fd, NULL, NULL, NULL) != kLDESuccess)
+ SSLContextRef ssl_ctx;
+ bzero(&ssl_ctx, sizeof(ssl_ctx));
+ if (::lockdown_secure_checkin (&m_fd, &ssl_ctx, NULL, NULL) != kLDESuccess)
{
DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_secure_checkin(&m_fd, NULL, NULL, NULL) failed");
m_fd = -1;
Modified: lldb/branches/windows/tools/driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/CMakeLists.txt?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/CMakeLists.txt (original)
+++ lldb/branches/windows/tools/driver/CMakeLists.txt Mon Oct 15 11:27:58 2012
@@ -34,6 +34,8 @@
lldbPluginDynamicLoaderPosixDYLD
lldbPluginUnwindAssemblyInstEmulation
lldbPluginUnwindAssemblyX86
+ lldbPluginDynamicLoaderDarwinKernel
+
# Windows
lldbHostWindows
Modified: lldb/branches/windows/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/Driver.cpp?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/Driver.cpp (original)
+++ lldb/branches/windows/tools/driver/Driver.cpp Mon Oct 15 11:27:58 2012
@@ -189,6 +189,25 @@
}
}
}
+void
+Driver::HandleThreadEvent (const SBEvent &event)
+{
+ // At present the only thread event we handle is the Frame Changed event, and all we do for that is just
+ // reprint the thread status for that thread.
+ using namespace lldb;
+ const uint32_t event_type = event.GetType();
+ if (event_type == SBThread::eBroadcastBitStackChanged)
+ {
+ SBThread thread = SBThread::GetThreadFromEvent (event);
+ if (thread.IsValid())
+ {
+ SBStream out_stream;
+ thread.GetStatus(out_stream);
+ m_io_channel_ap->OutWrite (out_stream.GetData (), out_stream.GetSize (), ASYNC);
+ }
+ }
+}
+
void LogOutput(const char * msg, void *baton)
{
@@ -217,12 +236,15 @@
m_interpreter = &sb_interpreter;
SBListener listener(m_debugger.GetListener());
- listener.StartListeningForEventClass(m_debugger,
- SBTarget::GetBroadcasterClassName(),
- SBTarget::eBroadcastBitBreakpointChanged);
if (!listener.IsValid())
return;
+ listener.StartListeningForEventClass(m_debugger,
+ SBTarget::GetBroadcasterClassName(),
+ SBTarget::eBroadcastBitBreakpointChanged);
+ listener.StartListeningForEventClass(m_debugger,
+ SBThread::GetBroadcasterClassName(),
+ SBThread::eBroadcastBitStackChanged);
listener.StartListeningForEvents (*m_io_channel_ap,
IOChannel::eBroadcastBitHasUserInput |
IOChannel::eBroadcastBitUserInterrupt |
@@ -291,6 +313,10 @@
if (event.IsValid())
{
ProcessEvent(event);
+ }
+ else if (SBThread::EventIsThreadEvent (event))
+ {
+ HandleThreadEvent (event);
}
}
Modified: lldb/branches/windows/tools/driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/Driver.h?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/Driver.h (original)
+++ lldb/branches/windows/tools/driver/Driver.h Mon Oct 15 11:27:58 2012
@@ -69,6 +69,9 @@
void
HandleBreakpointEvent (const lldb::SBEvent &event);
+ void
+ HandleThreadEvent (const lldb::SBEvent &event);
+
lldb::SBError
ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit);
Modified: lldb/branches/windows/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/www/lldb-gdb.html?rev=165942&r1=165941&r2=165942&view=diff
==============================================================================
--- lldb/branches/windows/www/lldb-gdb.html (original)
+++ lldb/branches/windows/www/lldb-gdb.html Mon Oct 15 11:27:58 2012
@@ -17,12 +17,14 @@
<div id="middle">
<div class="post">
- <h1 class ="postheader">LLDB to GDB Command Map</h1>
+ <h1 class ="postheader">GDB to LLDB Command Map</h1>
<div class="post">
- <p>Below is a table of LLDB commands with the GDB counterparts.
+ <p>Below is a table of GDB commands with the LLDB counterparts.
The built in GDB-compatibility aliases in LLDB are also
- listed.</p>
+ listed. The full lldb command names are often long, but any
+ unique short form can be used. Instead of "<b>breakpoint set</b>",
+ "<b>br se</b>" is also acceptable.</p>
</div>
<div class="postfooter"></div>
@@ -33,197 +35,199 @@
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Launch a process no arguments.</td></tr>
<td class="content">
+ <b>(gdb)</b> run<br>
+ <b>(gdb)</b> r
+ </td>
+ <td class="content">
<b>(lldb)</b> process launch<br>
<b>(lldb)</b> run<br>
<b>(lldb)</b> r
</td>
- <td class="content">
- <b>(gdb)</b> run<br>
- <b>(gdb)</b> r
- </td>
</tr>
<tr><td class="header" colspan="2">Launch a process with arguments <code><args></code>.</td></tr>
<td class="content">
- <b>(lldb)</b> process launch -- <args><br>
- <b>(lldb)</b> r <args>
- </td>
- <td class="content">
<b>(gdb)</b> run <args><br>
<b>(gdb)</b> r <args>
</td>
+ <td class="content">
+ <b>(lldb)</b> process launch -- <args><br>
+ <b>(lldb)</b> r <args>
+ </td>
</tr>
<tr><td class="header" colspan="2">Launch a process for with arguments <b><code>a.out 1 2 3</code></b> without having to supply the args every time.</td></tr>
<td class="content">
- <b>%</b> lldb -- a.out 1 2 3<br>
- <b>(lldb)</b> run<br>
+ <b>%</b> gdb --args a.out 1 2 3<br>
+ <b>(gdb)</b> run<br>
...<br>
- <b>(lldb)</b> run<br>
+ <b>(gdb)</b> run<br>
...<br>
</td>
<td class="content">
- <b>%</b> gdb --args a.out 1 2 3<br>
- <b>(gdb)</b> run<br>
+ <b>%</b> lldb -- a.out 1 2 3<br>
+ <b>(lldb)</b> run<br>
...<br>
- <b>(gdb)</b> run<br>
+ <b>(lldb)</b> run<br>
...<br>
</td>
</tr>
<tr><td class="header" colspan="2">Launch a process with arguments in new terminal window (Mac OS X only).</td></tr>
<td class="content">
- <b>(lldb)</b> process launch --tty -- <args><br>
- <b>(lldb)</b> pro la -t -- <args><br>
</td>
<td class="content">
+ <b>(lldb)</b> process launch --tty -- <args><br>
+ <b>(lldb)</b> pro la -t -- <args><br>
</td>
</tr>
<tr><td class="header" colspan="2">Launch a process with arguments in existing terminal <cope>/dev/ttys006</code> (Mac OS X only).</td></tr>
<td class="content">
- <b>(lldb)</b> process launch --tty=/dev/ttys006 -- <args><br>
- <b>(lldb)</b> pro la -t/dev/ttys006 -- <args><br>
</td>
<td class="content">
+ <b>(lldb)</b> process launch --tty=/dev/ttys006 -- <args><br>
+ <b>(lldb)</b> pro la -t/dev/ttys006 -- <args><br>
</td>
</tr>
<tr><td class="header" colspan="2">Attach to a process with process ID 123.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> process attach --pid 123<br>
- <b>(lldb)</b> attach -p 123
+ <b>(gdb)</b> attach 123
</td>
<td class="content">
- <b>(gdb)</b> attach 123
+ <b>(lldb)</b> process attach --pid 123<br>
+ <b>(lldb)</b> attach -p 123
</td>
</tr>
<tr><td class="header" colspan="2">Attach to a process named "a.out".</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> process attach --name a.out<br>
- <b>(lldb)</b> pro at -n a.out
+ <b>(gdb)</b> attach a.out
</td>
<td class="content">
- <b>(gdb)</b> attach a.out
+ <b>(lldb)</b> process attach --name a.out<br>
+ <b>(lldb)</b> pro at -n a.out
</td>
</tr>
<tr><td class="header" colspan="2">Wait for a process named "a.out" to launch and attach.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> process attach --name a.out --waitfor<br>
- <b>(lldb)</b> pro at -n a.out -w
+ <b>(gdb)</b> attach -waitfor a.out
</td>
<td class="content">
- <b>(gdb)</b> attach -waitfor a.out
+ <b>(lldb)</b> process attach --name a.out --waitfor<br>
+ <b>(lldb)</b> pro at -n a.out -w
</td>
</tr>
<tr><td class="header" colspan="2">Attach to a remote gdb protocol server running on system "eorgadd", port 8000.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> gdb-remote eorgadd:8000
+ <b>(gdb)</b> target remote eorgadd:8000
</td>
<td class="content">
- <b>(gdb)</b> target remote eorgadd:8000
+ <b>(lldb)</b> gdb-remote eorgadd:8000
</td>
</tr>
<tr><td class="header" colspan="2">Attach to a remote gdb protocol server running on the local system, port 8000.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> gdb-remote 8000
+ <b>(gdb)</b> target remote localhost:8000
</td>
<td class="content">
- <b>(gdb)</b> target remote localhost:8000
+ <b>(lldb)</b> gdb-remote 8000
</td>
</tr>
<tr><td class="header" colspan="2">Attach to a Darwin kernel in kdp mode on system "eorgadd".</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> kdp-remote eorgadd
+ <b>(gdb)</b> kdp-reattach eorgadd
</td>
<td class="content">
- <b>(gdb)</b> kdp-reattach eorgadd
+ <b>(lldb)</b> kdp-remote eorgadd
</td>
</tr>
<tr><td class="header" colspan="2">Do a source level single step in the currently selected thread.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> step<br>
+ <b>(gdb)</b> s
+ </td>
+ <td class="content">
<b>(lldb)</b> thread step-in<br>
<b>(lldb)</b> step<br>
<b>(lldb)</b> s
</td>
- <td class="content">
- <b>(gdb)</b> step<br>
- <b>(gdb)</b> s
- </td>
</tr>
<tr><td class="header" colspan="2">Do a source level single step over in the currently selected thread.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> next<br>
+ <b>(gdb)</b> n
+ </td>
+ <td class="content">
<b>(lldb)</b> thread step-over<br>
<b>(lldb)</b> next<br>
<b>(lldb)</b> n<br>
</td>
- <td class="content">
- <b>(gdb)</b> next<br>
- <b>(gdb)</b> n
- </td>
</tr>
<tr><td class="header" colspan="2">Do an instruction level single step in the currently selected thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> thread step-inst<br>
- <b>(lldb)</b> si<br>
- </td>
- <td class="content">
<b>(gdb)</b> stepi<br>
<b>(gdb)</b> si
</td>
+ <td class="content">
+ <b>(lldb)</b> thread step-inst<br>
+ <b>(lldb)</b> si<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Do an instruction level single step over in the currently selected thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> thread step-inst-over<br>
- <b>(lldb)</b> ni
- </td>
- <td class="content">
<b>(gdb)</b> nexti<br>
<b>(gdb)</b> ni
</td>
+ <td class="content">
+ <b>(lldb)</b> thread step-inst-over<br>
+ <b>(lldb)</b> ni
+ </td>
</tr>
<tr><td class="header" colspan="2">Step out of the currently selected frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> thread step-out<br>
- <b>(lldb)</b> finish<br>
+ <b>(gdb)</b> finish<br>
</td>
<td class="content">
- <b>(gdb)</b> finish<br>
+ <b>(lldb)</b> thread step-out<br>
+ <b>(lldb)</b> finish<br>
</td>
</tr>
<tr><td class="header" colspan="2">Backtrace and disassemble every time you stop.</td></tr>
<tr>
- <td class="content" colspan="2">
+ <td class="content">
+ </td>
+ <td class="content">
<b>(lldb)</b> target stop-hook add<br>
Enter your stop hook command(s). Type 'DONE' to end.<br>
> bt<br>
@@ -245,88 +249,88 @@
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Set a breakpoint at all functions named <b>main</b>.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> break main
+ </td>
+ <td class="content">
<b>(lldb)</b> breakpoint set --name main<br>
<b>(lldb)</b> br s -n main<br>
<b>(lldb)</b> b main
</td>
- <td class="content">
- <b>(gdb)</b> break main
- </td>
</tr>
<tr><td class="header" colspan="2">Set a breakpoint in file <b>test.c</b> at line <b>12</b>.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> break test.c:12
+ </td>
+ <td class="content">
<b>(lldb)</b> breakpoint set --file test.c --line 12<br>
<b>(lldb)</b> br s -f test.c -l 12<br>
<b>(lldb)</b> b test.c:12
</td>
- <td class="content">
- <b>(gdb)</b> break test.c:12
- </td>
</tr>
<tr><td class="header" colspan="2">Set a breakpoint at all C++ methods whose basename is <b>main</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> breakpoint set --method main<br>
- <b>(lldb)</b> br s -M main<br>
- </td>
- <td class="content">
<b>(gdb)</b> break main<br>
<i>(Hope that there are no C funtions named <b>main</b>)</i>.
</td>
+ <td class="content">
+ <b>(lldb)</b> breakpoint set --method main<br>
+ <b>(lldb)</b> br s -M main<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Set a breakpoint at and object C function: <b>-[NSString stringWithFormat:]</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> breakpoint set --name "-[NSString stringWithFormat:]"<br>
- <b>(lldb)</b> b -[NSString stringWithFormat:]<br>
+ <b>(gdb)</b> break -[NSString stringWithFormat:]<br>
</td>
<td class="content">
- <b>(gdb)</b> break -[NSString stringWithFormat:]<br>
+ <b>(lldb)</b> breakpoint set --name "-[NSString stringWithFormat:]"<br>
+ <b>(lldb)</b> b -[NSString stringWithFormat:]<br>
</td>
</tr>
<tr><td class="header" colspan="2">Set a breakpoint at all Objective C methods whose selector is <b>count</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> breakpoint set --selector count<br>
- <b>(lldb)</b> br s -S count<br>
- </td>
- <td class="content">
<b>(gdb)</b> break count<br>
<i>(Hope that there are no C or C++ funtions named <b>count</b>)</i>.
</td>
+ <td class="content">
+ <b>(lldb)</b> breakpoint set --selector count<br>
+ <b>(lldb)</b> br s -S count<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">List all breakpoints.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> breakpoint list<br>
- <b>(lldb)</b> br l<br>
+ <b>(gdb)</b> info break<br>
</td>
<td class="content">
- <b>(gdb)</b> info break<br>
+ <b>(lldb)</b> breakpoint list<br>
+ <b>(lldb)</b> br l<br>
</td>
</tr>
<tr><td class="header" colspan="2">Delete a breakpoint.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> breakpoint delete 1<br>
- <b>(lldb)</b> br del 1<br>
+ <b>(gdb)</b> delete 1<br>
</td>
<td class="content">
- <b>(gdb)</b> delete 1<br>
+ <b>(lldb)</b> breakpoint delete 1<br>
+ <b>(lldb)</b> br del 1<br>
</td>
</tr>
@@ -342,18 +346,18 @@
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Set a watchpoint on a variable when it is written to.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> watchpoint set variable -w write global_var<br>
- <b>(lldb)</b> watch set var -w write global_var<br>
+ <b>(gdb)</b> watch global_var
</td>
<td class="content">
- <b>(gdb)</b> watch global_var
+ <b>(lldb)</b> watchpoint set variable global_var<br>
+ <b>(lldb)</b> wa s v global_var<br>
</td>
</tr>
@@ -361,18 +365,20 @@
This command takes raw input, evaluated as an expression returning an unsigned integer pointing to the start of the region, after the '--' option terminator.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> watchpoint set expression -w write -- my_ptr<br>
- <b>(lldb)</b> watch set exp -w write -- my_ptr<br>
- </td>
- <td class="content">
<b>(gdb)</b> watch -location g_char_ptr
</td>
+ <td class="content">
+ <b>(lldb)</b> watchpoint set expression -- my_ptr<br>
+ <b>(lldb)</b> wa s e -- my_ptr<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Set a condition on a watchpoint</b>.</td></tr>
<tr>
- <td class="content" colspan="2">
- <b>(lldb)</b> watch set var -w write global<br>
+ <td class="content">
+ </td>
+ <td class="content">
+ <b>(lldb)</b> watch set var global<br>
<b>(lldb)</b> watchpoint modify -c '(global==5)'<br>
<b>(lldb)</b> c<br>
...<br>
@@ -389,22 +395,22 @@
<tr><td class="header" colspan="2">List all watchpoints.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> watchpoint list<br>
- <b>(lldb)</b> watch l<br>
+ <b>(gdb)</b> info break<br>
</td>
<td class="content">
- <b>(gdb)</b> info break<br>
+ <b>(lldb)</b> watchpoint list<br>
+ <b>(lldb)</b> watch l<br>
</td>
</tr>
<tr><td class="header" colspan="2">Delete a watchpoint.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> watchpoint delete 1<br>
- <b>(lldb)</b> watch del 1<br>
+ <b>(gdb)</b> delete 1<br>
</td>
<td class="content">
- <b>(gdb)</b> delete 1<br>
+ <b>(lldb)</b> watchpoint delete 1<br>
+ <b>(lldb)</b> watch del 1<br>
</td>
</tr>
@@ -418,95 +424,98 @@
<p>
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Show the arguments and local variables for the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> frame variable<br>
- </td>
- <td class="content">
<b>(gdb)</b> info args<br>
and<br>
<b>(gdb)</b> info locals<br>
</td>
+ <td class="content">
+ <b>(lldb)</b> frame variable<br>
+ <b>(lldb)</b> fr v<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Show the local variables for the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> frame variable --no-args<br>
- <b>(lldb)</b> fr v -a<br>
+ <b>(gdb)</b> info locals<br>
</td>
<td class="content">
- <b>(gdb)</b> info locals<br>
+ <b>(lldb)</b> frame variable --no-args<br>
+ <b>(lldb)</b> fr v -a<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the contents of local variable "bar".</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> p bar<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> frame variable bar <br>
<b>(lldb)</b> fr v bar <br>
<b>(lldb)</b> p bar <br>
</td>
- <td class="content">
- <b>(gdb)</b> p bar<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Show the contents of local variable "bar" formatted as hex.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> frame variable --format x bar <br>
- <b>(lldb)</b> fr v -f x bar <br>
+ <b>(gdb)</b> p/x bar<br>
</td>
<td class="content">
- <b>(gdb)</b> p/x bar<br>
+ <b>(lldb)</b> frame variable --format x bar <br>
+ <b>(lldb)</b> fr v -f x bar <br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the contents of global variable "baz".</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> target variable baz <br>
- <b>(lldb)</b> ta v baz <br>
+ <b>(gdb)</b> p baz<br>
</td>
<td class="content">
- <b>(gdb)</b> p baz<br>
+ <b>(lldb)</b> target variable baz <br>
+ <b>(lldb)</b> ta v baz <br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the global/static variables defined in the current source file.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> target variable <br>
- <b>(lldb)</b> ta v <br>
+ n/a<br>
</td>
<td class="content">
- n/a<br>
+ <b>(lldb)</b> target variable <br>
+ <b>(lldb)</b> ta v <br>
</td>
</tr>
<tr><td class="header" colspan="2">Display a the variable "argc" and "argv" every time you stop.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> display argc<br>
+ <b>(gdb)</b> display argv<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> target stop-hook add --one-liner "frame variable argc argv"<br>
<b>(lldb)</b> ta st a -o "fr v argc argv"<br>
<b>(lldb)</b> display argc<br>
<b>(lldb)</b> display argv<br>
</td>
- <td class="content">
- <b>(gdb)</b> display argc<br>
- <b>(gdb)</b> display argv<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Display a the variable "argc" and "argv" only when you stop in the function named <b>main</b>.</td></tr>
<tr>
- <td class="content" colspan="2">
+ <td class="content">
+ </td>
+ <td class="content">
<b>(lldb)</b> target stop-hook add --name main --one-liner "frame variable argc argv"<br>
<b>(lldb)</b> ta st a -n main -o "fr v argc argv"<br>
</td>
@@ -514,7 +523,9 @@
<tr><td class="header" colspan="2">Display the variable "*this" only when you stop in c class named <b>MyClass</b>.</td></tr>
<tr>
- <td class="content" colspan="2">
+ <td class="content">
+ </td>
+ <td class="content">
<b>(lldb)</b> target stop-hook add --classname MyClass --one-liner "frame variable *this"<br>
<b>(lldb)</b> ta st a -c MyClass -o "fr v *this"<br>
</td>
@@ -532,49 +543,49 @@
<p>
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Evaluating a generalized expression in the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> expr (int) printf ("Print nine: %d.", 4 + 5)<br>
- or using the print alias:<br>
- <b>(lldb)</b> print (int) printf ("Print nine: %d.", 4 + 5)<br>
- </td>
- <td class="content">
<b>(gdb)</b> print (int) printf ("Print nine: %d.", 4 + 5)<br>
or if you don't want to see void returns: <br>
<b>(gdb)</b> call (int) printf ("Print nine: %d.", 4 + 5)<br>
</td>
+ <td class="content">
+ <b>(lldb)</b> expr (int) printf ("Print nine: %d.", 4 + 5)<br>
+ or using the print alias:<br>
+ <b>(lldb)</b> print (int) printf ("Print nine: %d.", 4 + 5)<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Printing the ObjC "description" of an object.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> po [SomeClass returnAnObject]<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> expr -o -- [SomeClass returnAnObject]<br>
or using the po alias:<br>
<b>(lldb)</b> po [SomeClass returnAnObject]<br>
</td>
- <td class="content">
- <b>(gdb)</b> po [SomeClass returnAnObject]<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Print the dynamic type of the result of an expression.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> set print object 1<br>
+ <b>(gdb)</b> p someCPPObjectPtrOrReference<br>
+ only works for C++ objects.<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> expr -d 1 -- [SomeClass returnAnObject]<br>
<b>(lldb)</b> expr -d 1 -- someCPPObjectPtrOrReference<br>
or set dynamic type printing to be the default:
<b>(lldb)</b> settings set target.prefer-dynamic run-target<br>
</td>
- <td class="content">
- <b>(gdb)</b> set print object 1<br>
- <b>(gdb)</b> p someCPPObjectPtrOrReference<br>
- only works for C++ objects.<br>
- </td>
</tr>
@@ -587,97 +598,99 @@
<p>
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Show the stack backtrace for the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> thread backtrace<br>
- <b>(lldb)</b> bt<br>
+ <b>(gdb)</b> bt<br>
</td>
<td class="content">
- <b>(gdb)</b> bt<br>
+ <b>(lldb)</b> thread backtrace<br>
+ <b>(lldb)</b> bt<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the stack backtraces for all threads.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> thread backtrace all<br>
- <b>(lldb)</b> bt all
+ <b>(gdb)</b> thread apply all bt
</td>
<td class="content">
- <b>(gdb)</b> thread apply all bt
+ <b>(lldb)</b> thread backtrace all<br>
+ <b>(lldb)</b> bt all
</td>
</tr>
<tr><td class="header" colspan="2">Select a different stack frame by index for the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> frame select 12<br>
+ <b>(gdb)</b> frame 12
</td>
<td class="content">
- <b>(gdb)</b> frame 12
+ <b>(lldb)</b> frame select 12<br>
+ <b>(lldb)</b> fr s 12<br>
+ <b>(lldb)</b> f 12<br>
</td>
</tr>
<tr><td class="header" colspan="2">List information about the currently selected frame in the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> frame info<br>
</td>
<td class="content">
+ <b>(lldb)</b> frame info<br>
</td>
</tr>
<tr><td class="header" colspan="2">Select the stack frame that called the current stack frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> up<br>
- <b>(lldb)</b> frame select --relative=1<br>
+ <b>(gdb)</b> up
</td>
<td class="content">
- <b>(gdb)</b> up
+ <b>(lldb)</b> up<br>
+ <b>(lldb)</b> frame select --relative=1<br>
</td>
</tr>
<tr><td class="header" colspan="2">Select the stack frame that is called by the current stack frame.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> down
+ </td>
+ <td class="content">
<b>(lldb)</b> down<br>
<b>(lldb)</b> frame select --relative=-1<br>
<b>(lldb)</b> fr s -r-1<br>
</td>
- <td class="content">
- <b>(gdb)</b> down
- </td>
</tr>
<tr><td class="header" colspan="2">Select a different stack frame using a relative offset.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> up 2<br>
+ <b>(gdb)</b> down 3<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> frame select --relative 2<br>
<b>(lldb)</b> fr s -r2<br>
<br>
<b>(lldb)</b> frame select --relative -3<br>
<b>(lldb)</b> fr s -r-3<br>
</td>
- <td class="content">
- <b>(gdb)</b> up 2<br>
- <b>(gdb)</b> down 3<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Show the general purpose registers for the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> register read<br>
+ <b>(gdb)</b> info registers<br>
</td>
<td class="content">
- <b>(gdb)</b> info registers<br>
+ <b>(lldb)</b> register read<br>
</td>
</tr>
@@ -685,40 +698,43 @@
the same format characters as <b>printf(3)</b> when possible. Type "help format" to see the full list of format specifiers.</td></tr>
<tr>
<td class="content">
+ </td>
+ <td class="content">
<b>(lldb)</b> register read --format i<br>
<b>(lldb)</b> re r -f i<br>
<br>
<i>LLDB now supports the GDB shorthand format syntax but there can't be space after the command:</i><br>
<b>(lldb)</b> register read/d<br>
</td>
- <td class="content">
- </td>
</tr>
<tr><td class="header" colspan="2">Show all registers in all register sets for the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> register read --all<br>
- <b>(lldb)</b> re r -a<br>
+ <b>(gdb)</b> info all-registers<br>
</td>
<td class="content">
- <b>(gdb)</b> info all-registers<br>
+ <b>(lldb)</b> register read --all<br>
+ <b>(lldb)</b> re r -a<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the values for the registers named "rax", "rsp" and "rbp" in the current thread.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> register read rax rsp rbp<br>
+ <b>(gdb)</b> info all-registers rax rsp rbp<br>
</td>
<td class="content">
- <b>(gdb)</b> info all-registers rax rsp rbp<br>
+ <b>(lldb)</b> register read rax rsp rbp<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the values for the register named "rax" in the current thread formatted as <b>binary</b>.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> p/t $rax<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> register read --format binary rax<br>
<b>(lldb)</b> re r -f b rax<br>
<br>
@@ -726,14 +742,14 @@
<b>(lldb)</b> register read/t rax<br>
<b>(lldb)</b> p/t $rax<br>
</td>
- <td class="content">
- <b>(gdb)</b> p/t $rax<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Read memory from address 0xbffff3c0 and show 4 hex uint32_t values.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> x/4xw 0xbffff3c0<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> memory read --size 4 --format x --count 4 0xbffff3c0<br>
<b>(lldb)</b> me r -s4 -fx -c4 0xbffff3c0<br>
<b>(lldb)</b> x -s4 -fx -c4 0xbffff3c0<br>
@@ -743,124 +759,119 @@
<b>(lldb)</b> x/4xw 0xbffff3c0<br>
<b>(lldb)</b> memory read --gdb-format 4xw 0xbffff3c0<br>
</td>
- <td class="content">
- <b>(gdb)</b> x/4xw 0xbffff3c0<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Read memory starting at the expression "argv[0]".</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> x argv[0]<br>
+ </td>
+ <td class="content">
<b>(lldb)</b> memory read `argv[0]`<br>
<i><b>NOTE:</b> any command can inline a scalar expression result (as long as the target is stopped) using backticks around any expression:</i><br>
<b>(lldb)</b> memory read --size `sizeof(int)` `argv[0]`<br>
</td>
- <td class="content">
- <b>(gdb)</b> x argv[0]<br>
- </td>
</tr>
<tr><td class="header" colspan="2">Read 512 bytes of memory from address 0xbffff3c0 and save results to a local file as <b>text</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0<br>
- <b>(lldb)</b> me r -o/tmp/mem.txt -c512 0xbffff3c0<br>
- <b>(lldb)</b> x/512bx -o/tmp/mem.txt 0xbffff3c0<br>
- </td>
- <td class="content">
<b>(gdb)</b> set logging on<br>
<b>(gdb)</b> set logging file /tmp/mem.txt<br>
<b>(gdb)</b> x/512bx 0xbffff3c0<br>
<b>(gdb)</b> set logging off<br>
</td>
+ <td class="content">
+ <b>(lldb)</b> memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0<br>
+ <b>(lldb)</b> me r -o/tmp/mem.txt -c512 0xbffff3c0<br>
+ <b>(lldb)</b> x/512bx -o/tmp/mem.txt 0xbffff3c0<br>
+ </td>
</tr>
<tr><td class="header" colspan="2">Save binary memory data starting at 0x1000 and ending at 0x2000 to a file.</td></tr>
<tr>
- <td class="content"colspan=2>
+ <td class="content">
+ <b>(gdb)</b> dump memory /tmp/mem.bin 0x1000 0x2000
+ </td>
+ <td class="content">
<b>(lldb)</b> memory read --outfile /tmp/mem.bin --binary 0x1000 0x1200<br>
<b>(lldb)</b> me r -o /tmp/mem.bin -b 0x1000 0x1200<br>
</td>
</tr>
- <tr>
- <td class="content" colspan="2">
- <b>(gdb)</b> dump memory /tmp/mem.bin 0x1000 0x2000
- </td>
- </tr>
<tr><td class="header" colspan="2">Disassemble the current function for the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --frame<br>
- <b>(lldb)</b> di -f
+ <b>(gdb)</b> disassemble
</td>
<td class="content">
- <b>(gdb)</b> disassemble
+ <b>(lldb)</b> disassemble --frame<br>
+ <b>(lldb)</b> di -f
</td>
</tr>
<tr><td class="header" colspan="2">Disassemble any functions named <b>main</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --name main<br>
- <b>(lldb)</b> di -n main
+ <b>(gdb)</b> disassemble main
</td>
<td class="content">
- <b>(gdb)</b> disassemble main
+ <b>(lldb)</b> disassemble --name main<br>
+ <b>(lldb)</b> di -n main
</td>
</tr>
<tr><td class="header" colspan="2">Disassemble an address range.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --start-address 0x1eb8 --end-address 0x1ec3<br>
- <b>(lldb)</b> di -s 0x1eb8 -e 0x1ec3<br>
+ <b>(gdb)</b> disassemble 0x1eb8 0x1ec3
</td>
<td class="content">
- <b>(gdb)</b> disassemble 0x1eb8 0x1ec3
+ <b>(lldb)</b> disassemble --start-address 0x1eb8 --end-address 0x1ec3<br>
+ <b>(lldb)</b> di -s 0x1eb8 -e 0x1ec3<br>
</td>
</tr>
<tr><td class="header" colspan="2">Disassemble 20 instructions from a given address.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --start-address 0x1eb8 --count 20<br>
- <b>(lldb)</b> di -s 0x1eb8 -c 20<br>
+ <b>(gdb)</b> x/20i 0x1eb8
</td>
<td class="content">
- <b>(gdb)</b> x/20i 0x1eb8
+ <b>(lldb)</b> disassemble --start-address 0x1eb8 --count 20<br>
+ <b>(lldb)</b> di -s 0x1eb8 -c 20<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show mixed source and disassembly for the current function for the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --frame --mixed<br>
- <b>(lldb)</b> di -f -m
+ n/a
</td>
<td class="content">
- n/a
+ <b>(lldb)</b> disassemble --frame --mixed<br>
+ <b>(lldb)</b> di -f -m
</td>
</tr>
<tr><td class="header" colspan="2">Disassemble the current function for the current frame and show the opcode bytes.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --frame --bytes<br>
- <b>(lldb)</b> di -f -b
+ n/a
</td>
<td class="content">
- n/a
+ <b>(lldb)</b> disassemble --frame --bytes<br>
+ <b>(lldb)</b> di -f -b
</td>
</tr>
<tr><td class="header" colspan="2">Disassemble the current source line for the current frame.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> disassemble --line<br>
- <b>(lldb)</b> di -l
+ n/a
</td>
<td class="content">
- n/a
+ <b>(lldb)</b> disassemble --line<br>
+ <b>(lldb)</b> di -l
</td>
</tr>
@@ -876,101 +887,101 @@
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">List the main executable and all dependent shared libraries.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image list<br>
+ <b>(gdb)</b> info shared<br>
</td>
<td class="content">
- <b>(gdb)</b> info shared<br>
+ <b>(lldb)</b> image list<br>
</td>
</tr>
<tr><td class="header" colspan="2">Lookup information for a raw address in the executable or any shared libraries.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image lookup --address 0x1ec4<br>
- <b>(lldb)</b> im loo -a 0x1ec4<br>
+ <b>(gdb)</b> info symbol 0x1ec4<br>
</td>
<td class="content">
- <b>(gdb)</b> info symbol 0x1ec4<br>
+ <b>(lldb)</b> image lookup --address 0x1ec4<br>
+ <b>(lldb)</b> im loo -a 0x1ec4<br>
</td>
</tr>
<tr><td class="header" colspan="2">Lookup functions matching a regular expression in a binary.</td></tr>
<tr>
<td class="content">
+ <b>(gdb)</b> info function <FUNC_REGEX><br>
+ </td>
+ <td class="content">
This one finds debug symbols:<br>
<b>(lldb)</b> image lookup -r -n <FUNC_REGEX><br><br>
This one finds non-debug symbols:<br>
<b>(lldb)</b> image lookup -r -s <FUNC_REGEX><br><br>
Provide a list of binaries as arguments to limit the search.
</td>
- <td class="content">
- <b>(gdb)</b> info function <FUNC_REGEX><br>
- </td>
</tr>
<tr><td class="header" colspan="2">Lookup information for an address in <b>a.out</a> only.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image lookup --address 0x1ec4 a.out<br>
- <b>(lldb)</b> im loo -a 0x1ec4 a.out<br>
</td>
<td class="content">
+ <b>(lldb)</b> image lookup --address 0x1ec4 a.out<br>
+ <b>(lldb)</b> im loo -a 0x1ec4 a.out<br>
</td>
</tr>
<tr><td class="header" colspan="2">Lookup information for for a type <code>Point</code> by name.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image lookup --type Point<br>
- <b>(lldb)</b> im loo -t Point<br>
+ <b>(lldb)</b> ptype Point<br>
</td>
<td class="content">
- <b>(lldb)</b> ptype Point<br>
+ <b>(lldb)</b> image lookup --type Point<br>
+ <b>(lldb)</b> im loo -t Point<br>
</td>
</tr>
<tr><td class="header" colspan="2">Dump all sections from the main executable and any shared libraries.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image dump sections<br>
+ <b>(gdb)</b> maintenance info sections<br>
</td>
<td class="content">
- <b>(gdb)</b> maintenance info sections<br>
+ <b>(lldb)</b> image dump sections<br>
</td>
</tr>
<tr><td class="header" colspan="2">Dump all sections in the <b>a.out</b> module.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image dump sections a.out<br>
</td>
<td class="content">
+ <b>(lldb)</b> image dump sections a.out<br>
</td>
</tr>
<tr><td class="header" colspan="2">Dump all symbols from the main executable and any shared libraries.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image dump symtab<br>
</td>
<td class="content">
+ <b>(lldb)</b> image dump symtab<br>
</td>
</tr>
<tr><td class="header" colspan="2">Dump all symbols in <b>a.out</b> and <b>liba.so</b>.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> image dump symtab a.out liba.so<br>
</td>
<td class="content">
+ <b>(lldb)</b> image dump symtab a.out liba.so<br>
</td>
</tr>
@@ -983,17 +994,17 @@
<p>
<table class="stats" width="620" cellspacing="0">
<tr>
- <td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
+ <td class="hed" width="50%">LLDB</td>
</tr>
<tr><td class="header" colspan="2">Echo text to the screen.</td></tr>
<tr>
<td class="content">
- <b>(lldb)</b> script print "Here is some text"<br>
+ <b>(gdb)</b> echo Here is some text\n<br>
</td>
<td class="content">
- <b>(gdb)</b> echo Here is some text\n<br>
+ <b>(lldb)</b> script print "Here is some text"<br>
</td>
</tr>
More information about the lldb-commits
mailing list