[Lldb-commits] [lldb] r164159 - in /lldb/branches/windows: ./ examples/darwin/heap_find/ examples/darwin/heap_find/heap/ examples/python/ examples/summaries/cocoa/ examples/synthetic/ include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Host/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/ lldb.xcodeproj/xcshareddata/xcschemes/ scripts/ scripts/Python/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Host/commo...
Carlo Kok
ck at remobjects.com
Tue Sep 18 11:57:47 PDT 2012
Author: carlokok
Date: Tue Sep 18 13:57:46 2012
New Revision: 164159
URL: http://llvm.org/viewvc/llvm-project?rev=164159&view=rev
Log:
merge of trunk so the %zu/%zx are replaced with %llu/%llx
Added:
lldb/branches/windows/examples/python/gdb_disassemble.py
- copied unchanged from r164155, lldb/trunk/examples/python/gdb_disassemble.py
lldb/branches/windows/examples/python/stacks.py
- copied unchanged from r164155, lldb/trunk/examples/python/stacks.py
lldb/branches/windows/include/lldb/Symbol/TypeVendor.h
- copied unchanged from r164155, lldb/trunk/include/lldb/Symbol/TypeVendor.h
lldb/branches/windows/scripts/clang.utfroutines.diff
- copied unchanged from r164155, lldb/trunk/scripts/clang.utfroutines.diff
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
- copied unchanged from r164155, lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h
- copied unchanged from r164155, lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h
lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/
- copied from r164155, lldb/trunk/test/functionalities/data-formatter/rdar-11086338/
lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/
- copied from r164155, lldb/trunk/test/functionalities/data-formatter/rdar-11988289/
lldb/branches/windows/test/functionalities/inline-stepping/
- copied from r164155, lldb/trunk/test/functionalities/inline-stepping/
Removed:
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.h
Modified:
lldb/branches/windows/ (props changed)
lldb/branches/windows/examples/darwin/heap_find/heap.py
lldb/branches/windows/examples/darwin/heap_find/heap/heap_find.cpp
lldb/branches/windows/examples/python/cmdtemplate.py
lldb/branches/windows/examples/python/operating_system.py
lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py
lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py
lldb/branches/windows/examples/synthetic/libcxx.py
lldb/branches/windows/include/lldb/API/SBDebugger.h
lldb/branches/windows/include/lldb/API/SBThread.h
lldb/branches/windows/include/lldb/API/SBValue.h
lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h
lldb/branches/windows/include/lldb/Core/FormatClasses.h
lldb/branches/windows/include/lldb/Core/FormatNavigator.h
lldb/branches/windows/include/lldb/Core/ValueObject.h
lldb/branches/windows/include/lldb/Core/cxa_demangle.h
lldb/branches/windows/include/lldb/Expression/ClangExpression.h
lldb/branches/windows/include/lldb/Host/Symbols.h
lldb/branches/windows/include/lldb/Target/ABI.h
lldb/branches/windows/include/lldb/Target/LanguageRuntime.h
lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
lldb/branches/windows/include/lldb/Target/Platform.h
lldb/branches/windows/include/lldb/Target/Process.h
lldb/branches/windows/include/lldb/Target/RegisterContext.h
lldb/branches/windows/include/lldb/Target/StackFrameList.h
lldb/branches/windows/include/lldb/Target/Target.h
lldb/branches/windows/include/lldb/Target/Thread.h
lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h
lldb/branches/windows/include/lldb/lldb-enumerations.h
lldb/branches/windows/include/lldb/lldb-forward.h
lldb/branches/windows/lldb.xcodeproj/project.pbxproj
lldb/branches/windows/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
lldb/branches/windows/scripts/Python/build-swig-Python.sh
lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh
lldb/branches/windows/scripts/Python/interface/SBThread.i
lldb/branches/windows/scripts/build-swig-wrapper-classes.sh
lldb/branches/windows/scripts/llvm.amalgamated.diff
lldb/branches/windows/source/API/SBBreakpoint.cpp
lldb/branches/windows/source/API/SBCommunication.cpp
lldb/branches/windows/source/API/SBDebugger.cpp
lldb/branches/windows/source/API/SBFileSpec.cpp
lldb/branches/windows/source/API/SBFrame.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/SBValue.cpp
lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
lldb/branches/windows/source/Breakpoint/BreakpointLocationList.cpp
lldb/branches/windows/source/Breakpoint/WatchpointList.cpp
lldb/branches/windows/source/Commands/CommandObjectArgs.cpp
lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/branches/windows/source/Commands/CommandObjectExpression.cpp
lldb/branches/windows/source/Commands/CommandObjectFrame.cpp
lldb/branches/windows/source/Commands/CommandObjectMemory.cpp
lldb/branches/windows/source/Commands/CommandObjectProcess.cpp
lldb/branches/windows/source/Commands/CommandObjectSettings.cpp
lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
lldb/branches/windows/source/Commands/CommandObjectThread.cpp
lldb/branches/windows/source/Commands/CommandObjectWatchpoint.cpp
lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp
lldb/branches/windows/source/Core/Communication.cpp
lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp
lldb/branches/windows/source/Core/ConstString.cpp
lldb/branches/windows/source/Core/EmulateInstruction.cpp
lldb/branches/windows/source/Core/FormatClasses.cpp
lldb/branches/windows/source/Core/FormatManager.cpp
lldb/branches/windows/source/Core/Listener.cpp
lldb/branches/windows/source/Core/Mangled.cpp
lldb/branches/windows/source/Core/Module.cpp
lldb/branches/windows/source/Core/RegisterValue.cpp
lldb/branches/windows/source/Core/ValueObject.cpp
lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp
lldb/branches/windows/source/Core/cxa_demangle.cpp
lldb/branches/windows/source/Expression/ClangASTSource.cpp
lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
lldb/branches/windows/source/Expression/ClangFunction.cpp
lldb/branches/windows/source/Expression/ClangUserExpression.cpp
lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp
lldb/branches/windows/source/Expression/DWARFExpression.cpp
lldb/branches/windows/source/Expression/ExpressionSourceCode.cpp
lldb/branches/windows/source/Host/common/Host.cpp
lldb/branches/windows/source/Host/common/Symbols.cpp
lldb/branches/windows/source/Host/freebsd/Host.cpp
lldb/branches/windows/source/Host/macosx/Host.mm
lldb/branches/windows/source/Host/macosx/Symbols.cpp
lldb/branches/windows/source/Interpreter/Args.cpp
lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
lldb/branches/windows/source/Interpreter/CommandObject.cpp
lldb/branches/windows/source/Interpreter/Makefile
lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/branches/windows/source/Interpreter/OptionValueArray.cpp
lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
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/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/branches/windows/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/branches/windows/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.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/POSIX/ProcessPOSIX.cpp
lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.h
lldb/branches/windows/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
lldb/branches/windows/source/Symbol/ClangASTContext.cpp
lldb/branches/windows/source/Symbol/ObjectFile.cpp
lldb/branches/windows/source/Target/Memory.cpp
lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
lldb/branches/windows/source/Target/Platform.cpp
lldb/branches/windows/source/Target/Process.cpp
lldb/branches/windows/source/Target/RegisterContext.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/Thread.cpp
lldb/branches/windows/source/Target/ThreadList.cpp
lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp
lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp
lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp
lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
lldb/branches/windows/test/warnings/uuid/TestAddDsymCommand.py
lldb/branches/windows/tools/debugserver/source/DNB.cpp
lldb/branches/windows/tools/debugserver/source/DNBBreakpoint.cpp
lldb/branches/windows/tools/debugserver/source/DNBLog.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/MachException.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/MachTask.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/branches/windows/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/branches/windows/tools/debugserver/source/RNBRemote.cpp
lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp
lldb/branches/windows/tools/debugserver/source/debugserver.cpp
lldb/branches/windows/tools/driver/DriverOptions.cpp
lldb/branches/windows/tools/install-headers/Makefile
lldb/branches/windows/www/build.html
lldb/branches/windows/www/lldb-gdb.html
Propchange: lldb/branches/windows/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 18 13:57:46 2012
@@ -1 +1,2 @@
/lldb/branches/apple/python-GIL:156467-162159
+/lldb/trunk:163223-164155
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/darwin/heap_find/heap.py (original)
+++ lldb/branches/windows/examples/darwin/heap_find/heap.py Tue Sep 18 13:57:46 2012
@@ -124,6 +124,8 @@
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
parser.add_option('-t', '--type', action='store_true', dest='print_type', help='print the full value of the type for each matching malloc block', default=False)
parser.add_option('-o', '--po', action='store_true', dest='print_object_description', help='print the object descriptions for any matches', default=False)
+ parser.add_option('-z', '--size', action='store_true', dest='show_size', help='print the allocation size in bytes', default=False)
+ parser.add_option('-r', '--range', action='store_true', dest='show_range', help='print the allocation address range instead of just the allocation base address', default=False)
parser.add_option('-m', '--memory', action='store_true', dest='memory', help='dump the memory for each matching block', default=False)
parser.add_option('-f', '--format', type='string', dest='format', help='the format to use when dumping memory if --memory is specified', default=None)
parser.add_option('-I', '--omit-ivar-regex', type='string', action='callback', callback=append_regex_callback, dest='ivar_regex_blacklist', default=[], help='specify one or more regular expressions used to backlist any matches that are in ivars')
@@ -212,24 +214,45 @@
else:
match_addr = malloc_addr + offset
dynamic_value = match_entry.addr.sbvalue.GetDynamicValue(lldb.eDynamicCanRunTarget)
- description = '[%u] %s: addr = 0x%x' % (match_idx, arg_str_description, malloc_addr)
- if offset != 0:
- description += ' + %u' % (offset)
- description += ', size = %u' % (malloc_size)
+ description = '%#x: ' % (match_addr)
+ if options.show_size:
+ description += '<%5u> ' % (malloc_size)
+ if options.show_range:
+ if offset > 0:
+ description += '[%#x - %#x) + %-6u ' % (malloc_addr, malloc_addr + malloc_size, offset)
+ else:
+ description += '[%#x - %#x)' % (malloc_addr, malloc_addr + malloc_size)
+ else:
+ if options.type != 'isa':
+ description += '%#x + %-6u ' % (malloc_addr, offset)
derefed_dynamic_value = None
if dynamic_value.type.name == 'void *':
if options.type == 'pointer' and malloc_size == 4096:
error = lldb.SBError()
data = bytearray(lldb.process.ReadMemory(malloc_addr, 16, error))
if data == '\xa1\xa1\xa1\xa1AUTORELEASE!':
- description += ', type = (AUTORELEASE!)'
+ ptr_size = lldb.target.addr_size
+ thread = lldb.process.ReadUnsignedFromMemory (malloc_addr + 16 + ptr_size, ptr_size, error)
+ # 4 bytes 0xa1a1a1a1
+ # 12 bytes 'AUTORELEASE!'
+ # ptr bytes autorelease insertion point
+ # ptr bytes pthread_t
+ # ptr bytes next colder page
+ # ptr bytes next hotter page
+ # 4 bytes this page's depth in the list
+ # 4 bytes high-water mark
+ description += 'AUTORELEASE! for pthread_t %#x' % (thread)
+ else:
+ description += 'malloc(%u)' % (malloc_size)
+ else:
+ description += 'malloc(%u)' % (malloc_size)
else:
derefed_dynamic_value = dynamic_value.deref
if derefed_dynamic_value:
derefed_dynamic_type = derefed_dynamic_value.type
derefed_dynamic_type_size = derefed_dynamic_type.size
derefed_dynamic_type_name = derefed_dynamic_type.name
- description += ', type = %s <%u>' % (derefed_dynamic_type_name, derefed_dynamic_type_size)
+ description += derefed_dynamic_type_name
if offset < derefed_dynamic_type_size:
member_list = list();
get_member_types_for_offset (derefed_dynamic_type, offset, member_list)
@@ -246,7 +269,12 @@
for ivar_regex in options.ivar_regex_blacklist:
if ivar_regex.match(member_path):
print_entry = False
- description += ', ivar = %s' % (member_path)
+ description += '.%s' % (member_path)
+ else:
+ description += '%u bytes after %s' % (offset - derefed_dynamic_type_size, derefed_dynamic_type_name)
+ else:
+ # strip the "*" from the end of the name since we were unable to dereference this
+ description += dynamic_value.type.name[0:-1]
if print_entry:
match_idx += 1
result_output = ''
@@ -257,7 +285,7 @@
if options.print_object_description and dynamic_value:
desc = dynamic_value.GetObjectDescription()
if desc:
- result_output += ', po=%s' % (desc)
+ result_output += '\n%s' % (desc)
if result_output:
result.AppendMessage(result_output)
if options.memory:
@@ -282,6 +310,7 @@
result.AppendMessage(dylid_load_err)
return
expr = None
+ print_no_matches = True
arg_str_description = arg_str
if options.type == 'pointer':
expr = 'find_pointer_in_heap((void *)%s)' % (arg_str)
@@ -301,6 +330,10 @@
elif options.type == 'addr':
expr = 'find_block_for_address((void *)%s)' % arg_str
arg_str_description = 'malloc block for %s' % arg_str
+ elif options.type == 'all':
+ expr = 'get_heap_info(1)'
+ arg_str_description = None
+ print_no_matches = False
else:
result.AppendMessage('error: invalid type "%s"\nvalid values are "pointer", "cstr"' % options.type)
return
@@ -378,29 +411,24 @@
else:
result.AppendMessage('error: no c string arguments were given to search for')
-def malloc_history(debugger, command, result, dict):
+def heap(debugger, command, result, dict):
command_args = shlex.split(command)
usage = "usage: %prog [options] <EXPR> [EXPR ...]"
- description='''Gets the allocation history for an expression whose result is an address.
-
- Programs should set the MallocStackLogging=1 in the environment to enable stack history. This can be done
- with "process launch -v MallocStackLogging=1 -- [arg1 ...]"'''
+ description='''Traverse all allocations on the heap and report statistics.
- dylid_load_err = load_dylib()
- if dylid_load_err:
- result.AppendMessage(dylid_load_err)
+ If programs set the MallocStackLogging=1 in the environment, then stack
+ history is available for any allocations. '''
+ parser = optparse.OptionParser(description=description, prog='cstr_refs',usage=usage)
+ add_common_options(parser)
+ try:
+ (options, args) = parser.parse_args(command_args)
+ except:
+ return
+ options.type = 'all'
+ if args:
+ result.AppendMessage('error: heap command takes no arguments, only options')
else:
- if command_args:
- for addr_expr_str in command_args:
- expr_sbvalue = lldb.frame.EvaluateExpression (addr_expr_str)
- if expr_sbvalue.error.Success():
- addr = expr_sbvalue.unsigned
- if addr != 0:
- dump_stack_history_entries (addr, 1)
- else:
- result.AppendMessage('error: expression error for "%s": %s' % (addr_expr_str, expr_sbvalue.error))
- else:
- result.AppendMessage('error: no address expressions were specified')
+ heap_search (result, options, None)
def section_ptr_refs(debugger, command, result, dict):
command_args = shlex.split(command)
@@ -471,6 +499,7 @@
isa = expr_sbvalue.unsigned
if isa:
options.type = 'isa'
+ result.AppendMessage('Searching for all instances of classes or subclasses of %s (isa=0x%x)' % (class_name, isa))
heap_search (result, options, '0x%x' % isa)
else:
result.AppendMessage('error: Can\'t find isa for an ObjC class named "%s"' % (class_name))
@@ -489,10 +518,10 @@
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.ptr_refs ptr_refs')
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.cstr_refs cstr_refs')
lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.malloc_info malloc_info')
-lldb.debugger.HandleCommand('command script add -f lldb.macosx.heap.malloc_history malloc_history')
+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.objc_refs objc_refs')
-print '"ptr_refs", "cstr_refs", "malloc_info", "malloc_history" 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" and "section_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=164159&r1=164158&r2=164159&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 Tue Sep 18 13:57:46 2012
@@ -147,7 +147,7 @@
//----------------------------------------------------------------------
typedef void range_callback_t (task_t task, void *baton, unsigned type, uint64_t ptr_addr, uint64_t ptr_size);
typedef void zone_callback_t (void *info, const malloc_zone_t *zone);
-
+typedef int (*comare_function_t)(const void *, const void *);
struct range_callback_info_t
{
zone_callback_t *zone_callback;
@@ -159,7 +159,8 @@
{
eDataTypeAddress,
eDataTypeContainsData,
- eDataTypeObjC
+ eDataTypeObjC,
+ eDataTypeHeapInfo
};
struct aligned_data_t
@@ -171,7 +172,7 @@
struct objc_data_t
{
- Class match_isa; // Set to NULL for all objective C objects
+ void *match_isa; // Set to NULL for all objective C objects
bool match_superclasses;
};
@@ -201,16 +202,355 @@
const void *address;
uint64_t argument;
uint32_t type_flags;
- std::vector<uintptr_t> frames;
+ uint32_t num_frames;
+ mach_vm_address_t frames[MAX_FRAMES];
};
+struct malloc_block_contents
+{
+ union {
+ Class isa;
+ void *pointers[2];
+ };
+};
+
+static int
+compare_void_ptr (const void *a, const void *b)
+{
+ Class a_ptr = *(Class *)a;
+ Class b_ptr = *(Class *)b;
+ if (a_ptr < b_ptr) return -1;
+ if (a_ptr > b_ptr) return +1;
+ return 0;
+}
+
+class MatchResults
+{
+ enum {
+ k_max_entries = 8 * 1024
+ };
+public:
+ MatchResults () :
+ m_size(0)
+ {
+ }
+
+ void
+ clear()
+ {
+ m_size = 0;
+ }
+
+ bool
+ empty() const
+ {
+ return m_size == 0;
+ }
+
+ void
+ push_back (const malloc_match& m)
+ {
+ if (m_size < k_max_entries - 1)
+ {
+ m_entries[m_size] = m;
+ m_size++;
+ }
+ }
+
+ malloc_match *
+ data ()
+ {
+ // If empty, return NULL
+ if (empty())
+ return NULL;
+ // In not empty, terminate and return the result
+ malloc_match terminator_entry = { NULL, 0, 0 };
+ // We always leave room for an empty entry at the end
+ m_entries[m_size] = terminator_entry;
+ return m_entries;
+ }
+
+protected:
+ malloc_match m_entries[k_max_entries];
+ uint32_t m_size;
+};
+
+class MallocStackLoggingEntries
+{
+ enum { k_max_entries = 128 };
+public:
+ MallocStackLoggingEntries () :
+ m_size(0)
+ {
+ }
+
+ void
+ clear()
+ {
+ m_size = 0;
+ }
+
+ bool
+ empty() const
+ {
+ return m_size == 0;
+ }
+
+
+ malloc_stack_entry *
+ next ()
+ {
+ if (m_size < k_max_entries - 1)
+ {
+ malloc_stack_entry * result = m_entries + m_size;
+ ++m_size;
+ return result;
+ }
+ return NULL; // Out of entries...
+ }
+
+ malloc_stack_entry *
+ data ()
+ {
+ // If empty, return NULL
+ if (empty())
+ return NULL;
+ // In not empty, terminate and return the result
+ m_entries[m_size].address = NULL;
+ m_entries[m_size].argument = 0;
+ m_entries[m_size].type_flags = 0;
+ m_entries[m_size].num_frames = 0;
+ return m_entries;
+ }
+
+protected:
+ malloc_stack_entry m_entries[k_max_entries];
+ uint32_t m_size;
+};
+
+//----------------------------------------------------------------------
+// A safe way to allocate memory and keep it from interfering with the
+// malloc enumerators.
+//----------------------------------------------------------------------
+void *
+safe_malloc(size_t n_bytes)
+{
+ if (n_bytes > 0)
+ {
+ const int k_page_size = getpagesize();
+ const mach_vm_size_t vm_size = ((n_bytes + k_page_size - 1)/k_page_size) * k_page_size;
+ vm_address_t address = NULL;
+ kern_return_t kerr = vm_allocate (mach_task_self(), &address, vm_size, true);
+ if (kerr == KERN_SUCCESS)
+ return (void *)address;
+ }
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------
+// ObjCClasses
+//----------------------------------------------------------------------
+class ObjCClasses
+{
+public:
+ ObjCClasses() :
+ m_objc_class_ptrs (NULL),
+ m_size (0)
+ {
+ }
+
+ bool
+ Update()
+ {
+ // TODO: find out if class list has changed and update if needed
+ if (m_objc_class_ptrs == NULL)
+ {
+ m_size = objc_getClassList(NULL, 0);
+ if (m_size > 0)
+ {
+ // Allocate the class pointers
+ m_objc_class_ptrs = (Class *)safe_malloc (m_size * sizeof(Class));
+ m_size = objc_getClassList(m_objc_class_ptrs, m_size);
+ // Sort Class pointers for quick lookup
+ ::qsort (m_objc_class_ptrs, m_size, sizeof(Class), compare_void_ptr);
+ }
+ else
+ return false;
+ }
+ return true;
+ }
+
+ uint32_t
+ FindClassIndex (Class isa)
+ {
+ Class *matching_class = (Class *)bsearch (&isa,
+ m_objc_class_ptrs,
+ m_size,
+ sizeof(Class),
+ compare_void_ptr);
+ if (matching_class)
+ {
+ uint32_t idx = matching_class - m_objc_class_ptrs;
+ return idx;
+ }
+ return UINT32_MAX;
+ }
+
+ Class
+ GetClassAtIndex (uint32_t idx) const
+ {
+ if (idx < m_size)
+ return m_objc_class_ptrs[idx];
+ return NULL;
+ }
+ uint32_t
+ GetSize() const
+ {
+ return m_size;
+ }
+private:
+ Class *m_objc_class_ptrs;
+ uint32_t m_size;
+};
+
+
+
//----------------------------------------------------------------------
// Local global variables
//----------------------------------------------------------------------
-std::vector<malloc_match> g_matches;
-std::vector<malloc_stack_entry> g_malloc_stack_history;
-mach_vm_address_t g_stack_frames[MAX_FRAMES];
-char g_error_string[PATH_MAX];
+MatchResults g_matches;
+MallocStackLoggingEntries g_malloc_stack_history;
+ObjCClasses g_objc_classes;
+
+//----------------------------------------------------------------------
+// ObjCClassInfo
+//----------------------------------------------------------------------
+
+enum HeapInfoSortType
+{
+ eSortTypeNone,
+ eSortTypeBytes,
+ eSortTypeCount
+};
+
+class ObjCClassInfo
+{
+public:
+ ObjCClassInfo() :
+ m_entries (NULL),
+ m_size (0),
+ m_sort_type (eSortTypeNone)
+ {
+ }
+
+ void
+ Update (const ObjCClasses &objc_classes)
+ {
+ m_size = objc_classes.GetSize();
+ m_entries = (Entry *)safe_malloc (m_size * sizeof(Entry));
+ m_sort_type = eSortTypeNone;
+ Reset ();
+ }
+
+ bool
+ AddInstance (uint32_t idx, uint64_t ptr_size)
+ {
+ if (m_size == 0)
+ Update (g_objc_classes);
+ // Update the totals for the classes
+ if (idx < m_size)
+ {
+ m_entries[idx].bytes += ptr_size;
+ ++m_entries[idx].count;
+ return true;
+ }
+ return false;
+ }
+
+ void
+ Reset ()
+ {
+ m_sort_type = eSortTypeNone;
+ for (uint32_t i=0; i<m_size; ++i)
+ {
+ // In case we sort the entries after gathering the data, we will
+ // want to know the index into the m_objc_class_ptrs[] array.
+ m_entries[i].idx = i;
+ m_entries[i].bytes = 0;
+ m_entries[i].count = 0;
+ }
+ }
+ void
+ SortByTotalBytes (const ObjCClasses &objc_classes, bool print)
+ {
+ if (m_sort_type != eSortTypeBytes && m_size > 0)
+ {
+ ::qsort (m_entries, m_size, sizeof(Entry), (comare_function_t)compare_bytes);
+ m_sort_type = eSortTypeBytes;
+ }
+ if (print && m_size > 0)
+ {
+ puts("Objective C objects by total bytes:");
+ puts("Total Bytes Class Name");
+ puts("----------- -----------------------------------------------------------------");
+ for (uint32_t i=0; i<m_size && m_entries[i].bytes > 0; ++i)
+ {
+ printf ("%11llu %s\n", m_entries[i].bytes, class_getName (objc_classes.GetClassAtIndex(m_entries[i].idx)));
+ }
+ }
+ }
+ void
+ SortByTotalCount (const ObjCClasses &objc_classes, bool print)
+ {
+ if (m_sort_type != eSortTypeCount && m_size > 0)
+ {
+ ::qsort (m_entries, m_size, sizeof(Entry), (comare_function_t)compare_count);
+ m_sort_type = eSortTypeCount;
+ }
+ if (print && m_size > 0)
+ {
+ puts("Objective C objects by total count:");
+ puts("Count Class Name");
+ puts("-------- -----------------------------------------------------------------");
+ for (uint32_t i=0; i<m_size && m_entries[i].count > 0; ++i)
+ {
+ printf ("%8u %s\n", m_entries[i].count, class_getName (objc_classes.GetClassAtIndex(m_entries[i].idx)));
+ }
+ }
+ }
+private:
+ struct Entry
+ {
+ uint32_t idx; // Index into the m_objc_class_ptrs[] array
+ uint32_t count; // Number of object instances that were found
+ uint64_t bytes; // Total number of bytes for each objc class
+ };
+
+ static int
+ compare_bytes (const Entry *a, const Entry *b)
+ {
+ // Reverse the comparisong to most bytes entries end up at top of list
+ if (a->bytes > b->bytes) return -1;
+ if (a->bytes < b->bytes) return +1;
+ return 0;
+ }
+
+ static int
+ compare_count (const Entry *a, const Entry *b)
+ {
+ // Reverse the comparisong to most count entries end up at top of list
+ if (a->count > b->count) return -1;
+ if (a->count < b->count) return +1;
+ return 0;
+ }
+
+ Entry *m_entries;
+ uint32_t m_size;
+ HeapInfoSortType m_sort_type;
+};
+
+ObjCClassInfo g_objc_class_snapshot;
//----------------------------------------------------------------------
// task_peek
@@ -296,7 +636,7 @@
{
++info->match_count;
malloc_match match = { (void *)ptr_addr, ptr_size, info->addr - ptr_addr };
- g_matches.push_back(match);
+ g_matches.push_back(match);
}
break;
@@ -337,31 +677,14 @@
// of any sort where the first pointer in the object is an OBJC class
// pointer (an isa)
{
- struct objc_class *objc_object_ptr = NULL;
- if (task_peek (task, ptr_addr, sizeof(void *), (void **)&objc_object_ptr) == KERN_SUCCESS)
+ malloc_block_contents *block_contents = NULL;
+ if (task_peek (task, ptr_addr, sizeof(void *), (void **)&block_contents) == KERN_SUCCESS)
{
- const uint64_t isa_bits = (uintptr_t)objc_object_ptr->isa;
- //printf ("objc: addr = 0x%16.16llx, size = %6llu, isa = 0x%16.16llx", ptr_addr, ptr_size, isa_bits);
- Dl_info dl_info;
-
- if (isa_bits == 0 || isa_bits % sizeof(void*))
- {
- //printf (" error: invalid pointer\n");
- return;
- }
- if (dladdr(objc_object_ptr->isa, &dl_info) == 0)
- {
- //printf (" error: symbol lookup failed\n");
- return;
- }
- if (dl_info.dli_sname == NULL)
- {
- //printf (" error: no symbol name\n");
- return;
- }
-
- if ((dl_info.dli_sname[0] == 'O' && strncmp("OBJC_CLASS_$_" , dl_info.dli_sname, 13) == 0) ||
- (dl_info.dli_sname[0] == '.' && strncmp(".objc_class_name_", dl_info.dli_sname, 17) == 0))
+ // We assume that g_objc_classes is up to date
+ // that the class list was verified to have some classes in it
+ // before calling this function
+ const uint32_t objc_class_idx = g_objc_classes.FindClassIndex (block_contents->isa);
+ if (objc_class_idx != UINT32_MAX)
{
bool match = false;
if (info->objc.match_isa == 0)
@@ -373,11 +696,11 @@
{
// Only match exact isa values in the current class or
// optionally in the super classes
- if (info->objc.match_isa == objc_object_ptr->isa)
+ if (info->objc.match_isa == block_contents->isa)
match = true;
else if (info->objc.match_superclasses)
{
- Class super = class_getSuperclass(objc_object_ptr->isa);
+ Class super = class_getSuperclass(block_contents->isa);
while (super)
{
match = super == info->objc.match_isa;
@@ -407,37 +730,63 @@
}
}
break;
+
+ case eDataTypeHeapInfo:
+ // Check if the current malloc block contains an objective C object
+ // of any sort where the first pointer in the object is an OBJC class
+ // pointer (an isa)
+ {
+ malloc_block_contents *block_contents = NULL;
+ if (task_peek (task, ptr_addr, sizeof(void *), (void **)&block_contents) == KERN_SUCCESS)
+ {
+ // We assume that g_objc_classes is up to date
+ // that the class list was verified to have some classes in it
+ // before calling this function
+ const uint32_t objc_class_idx = g_objc_classes.FindClassIndex (block_contents->isa);
+ if (objc_class_idx != UINT32_MAX)
+ {
+ // This is an objective C object
+ g_objc_class_snapshot.AddInstance (objc_class_idx, ptr_size);
+ }
+ else
+ {
+ // Classify other heap info
+ }
+ }
+ }
+ break;
+
}
}
static void
get_stack_for_address_enumerator(mach_stack_logging_record_t stack_record, void *task_ptr)
{
- uint32_t num_frames = 0;
- kern_return_t err = __mach_stack_logging_frames_for_uniqued_stack (*(task_t *)task_ptr,
- stack_record.stack_identifier,
- g_stack_frames,
- MAX_FRAMES,
- &num_frames);
- g_malloc_stack_history.resize(g_malloc_stack_history.size() + 1);
- g_malloc_stack_history.back().address = (void *)stack_record.address;
- g_malloc_stack_history.back().type_flags = stack_record.type_flags;
- g_malloc_stack_history.back().argument = stack_record.argument;
- if (num_frames > 0)
- g_malloc_stack_history.back().frames.assign(g_stack_frames, g_stack_frames + num_frames);
- g_malloc_stack_history.back().frames.push_back(0); // Terminate the frames with zero
+ malloc_stack_entry *stack_entry = g_malloc_stack_history.next();
+ if (stack_entry)
+ {
+ stack_entry->address = (void *)stack_record.address;
+ stack_entry->type_flags = stack_record.type_flags;
+ stack_entry->argument = stack_record.argument;
+ stack_entry->num_frames = 0;
+ stack_entry->frames[0] = 0;
+ kern_return_t err = __mach_stack_logging_frames_for_uniqued_stack (*(task_t *)task_ptr,
+ stack_record.stack_identifier,
+ stack_entry->frames,
+ MAX_FRAMES,
+ &stack_entry->num_frames);
+ // Terminate the frames with zero if there is room
+ if (stack_entry->num_frames < MAX_FRAMES)
+ stack_entry->frames[stack_entry->num_frames] = 0;
+ }
}
malloc_stack_entry *
get_stack_history_for_address (const void * addr, int history)
{
- std::vector<malloc_stack_entry> empty;
- g_malloc_stack_history.swap(empty);
if (!stack_logging_enable_logging)
- {
- strncpy(g_error_string, "error: stack logging is not enabled, set MallocStackLogging=1 in the environment when launching to enable stack logging.", sizeof(g_error_string));
return NULL;
- }
+ g_malloc_stack_history.clear();
kern_return_t err;
task_t task = mach_task_self();
if (history)
@@ -449,26 +798,28 @@
}
else
{
- uint32_t num_frames = 0;
- err = __mach_stack_logging_get_frames(task, (mach_vm_address_t)addr, g_stack_frames, MAX_FRAMES, &num_frames);
- if (err == 0 && num_frames > 0)
- {
- g_malloc_stack_history.resize(1);
- g_malloc_stack_history.back().address = addr;
- g_malloc_stack_history.back().type_flags = stack_logging_type_alloc;
- g_malloc_stack_history.back().argument = 0;
- if (num_frames > 0)
- g_malloc_stack_history.back().frames.assign(g_stack_frames, g_stack_frames + num_frames);
- g_malloc_stack_history.back().frames.push_back(0); // Terminate the frames with zero
+ malloc_stack_entry *stack_entry = g_malloc_stack_history.next();
+ if (stack_entry)
+ {
+ stack_entry->address = addr;
+ stack_entry->type_flags = stack_logging_type_alloc;
+ stack_entry->argument = 0;
+ stack_entry->num_frames = 0;
+ stack_entry->frames[0] = 0;
+ err = __mach_stack_logging_get_frames(task, (mach_vm_address_t)addr, stack_entry->frames, MAX_FRAMES, &stack_entry->num_frames);
+ if (err == 0 && stack_entry->num_frames > 0)
+ {
+ // Terminate the frames with zero if there is room
+ if (stack_entry->num_frames < MAX_FRAMES)
+ stack_entry->frames[stack_entry->num_frames] = 0;
+ }
+ else
+ {
+ g_malloc_stack_history.clear();
+ }
}
}
- // Append an empty entry
- if (g_malloc_stack_history.empty())
- return NULL;
- g_malloc_stack_history.resize(g_malloc_stack_history.size() + 1);
- g_malloc_stack_history.back().address = 0;
- g_malloc_stack_history.back().type_flags = 0;
- g_malloc_stack_history.back().argument = 0;
+ // Return data if there is any
return g_malloc_stack_history.data();
}
@@ -496,10 +847,6 @@
range_callback_info_t info = { enumerate_range_in_zone, range_info_callback, &data_info };
foreach_zone_in_this_process (&info);
}
- if (g_matches.empty())
- return NULL;
- malloc_match match = { NULL, 0, 0 };
- g_matches.push_back(match);
return g_matches.data();
}
@@ -523,10 +870,6 @@
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_info_callback (mach_task_self(), &data_info, stack_logging_type_generic, memory_addr, memory_size);
- if (g_matches.empty())
- return NULL;
- malloc_match match = { NULL, 0, 0 };
- g_matches.push_back(match);
return g_matches.data();
}
@@ -541,24 +884,66 @@
find_objc_objects_in_memory (void *isa)
{
g_matches.clear();
- // Setup "info" to look for a malloc block that contains data
- // that is the a pointer
- range_contains_data_callback_info_t data_info;
- data_info.type = eDataTypeObjC; // Check each block for data
- data_info.objc.match_isa = (Class)isa;
- 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 };
- foreach_zone_in_this_process (&info);
- if (g_matches.empty())
- return NULL;
- malloc_match match = { NULL, 0, 0 };
- g_matches.push_back(match);
+ if (g_objc_classes.Update())
+ {
+ // Setup "info" to look for a malloc block that contains data
+ // that is the a pointer
+ range_contains_data_callback_info_t data_info;
+ data_info.type = eDataTypeObjC; // Check each block for data
+ data_info.objc.match_isa = isa;
+ 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 };
+ foreach_zone_in_this_process (&info);
+ }
return g_matches.data();
}
//----------------------------------------------------------------------
+// get_heap_info
+//
+// Gather information for all allocations on the heap and report
+// statistics.
+//----------------------------------------------------------------------
+
+void
+get_heap_info (int sort_type)
+{
+ if (g_objc_classes.Update())
+ {
+ // Reset all stats
+ g_objc_class_snapshot.Reset ();
+ // Setup "info" to look for a malloc block that contains data
+ // that is the a pointer
+ range_contains_data_callback_info_t data_info;
+ 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 };
+ foreach_zone_in_this_process (&info);
+
+ // Sort and print byte total bytes
+ switch (sort_type)
+ {
+ case eSortTypeNone:
+ default:
+ case eSortTypeBytes:
+ g_objc_class_snapshot.SortByTotalBytes(g_objc_classes, true);
+ break;
+
+ case eSortTypeCount:
+ g_objc_class_snapshot.SortByTotalCount(g_objc_classes, true);
+ break;
+ }
+ }
+ else
+ {
+ printf ("error: no objective C classes\n");
+ }
+}
+
+//----------------------------------------------------------------------
// find_cstring_in_heap
//
// Finds a C string inside one or more currently valid malloc blocks.
@@ -583,10 +968,6 @@
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 };
foreach_zone_in_this_process (&info);
- if (g_matches.empty())
- return NULL;
- malloc_match match = { NULL, 0, 0 };
- g_matches.push_back(match);
return g_matches.data();
}
@@ -608,9 +989,5 @@
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 };
foreach_zone_in_this_process (&info);
- if (g_matches.empty())
- return NULL;
- malloc_match match = { NULL, 0, 0 };
- g_matches.push_back(match);
return g_matches.data();
}
Modified: lldb/branches/windows/examples/python/cmdtemplate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/python/cmdtemplate.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/python/cmdtemplate.py (original)
+++ lldb/branches/windows/examples/python/cmdtemplate.py Tue Sep 18 13:57:46 2012
@@ -7,12 +7,6 @@
# import it with the full path using the "command script import"
# command
# (lldb) command script import /path/to/cmdtemplate.py
-#
-# For the shells csh, tcsh:
-# ( setenv PYTHONPATH /path/to/LLDB.framework/Resources/Python ; ./cmdtemplate.py )
-#
-# For the shells sh, bash:
-# PYTHONPATH=/path/to/LLDB.framework/Resources/Python ./cmdtemplate.py
#----------------------------------------------------------------------
import lldb
@@ -20,12 +14,27 @@
import optparse
import shlex
-def ls(debugger, command, result, dict):
- command_args = shlex.split(command)
+def create_ls_options():
usage = "usage: %prog [options] <PATH> [PATH ...]"
- description='''This command lets you run the /bin/ls command from within lldb as a quick and easy example.'''
+ description='''This command lets you run the /bin/ls shell command from
+within lldb. This code is designed to demonstrate the best principles that
+should be used when creating a new LLDB command through python.
+Creating the options in a separate function allows the parser to be
+created without running the command. The usage string is generated by the
+optparse module and can be used to populate the ls.__doc__ documentation
+string in the command interpreter function prior to registering the
+command with LLDB. The allows the output of "ls --help" to exactly match
+the output of "help ls" when both commands are run from within LLDB.
+'''
parser = optparse.OptionParser(description=description, prog='ls',usage=usage)
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ return parser
+
+def ls(debugger, command, result, dict):
+ # Use the Shell Lexer to properly parse up command options just like a
+ # shell would
+ command_args = shlex.split(command)
+ parser = create_ls_options()
try:
(options, args) = parser.parse_args(command_args)
except:
@@ -37,14 +46,12 @@
else:
result.PutCString(commands.getoutput('/bin/ls -lAF "%s"' % arg))
-if __name__ == '__main__':
- # This script is being run from the command line, create a debugger in case we are
- # going to use any debugger functions in our function.
- lldb.debugger = lldb.SBDebugger.Create()
- ls (sys.argv)
-
def __lldb_init_module (debugger, dict):
- # This initializer is being run from LLDB in the embedded command interpreter
+ # This initializer is being run from LLDB in the embedded command interpreter
+ # Make the options so we can generate the help text for the new LLDB
+ # command line command prior to registering it with LLDB below
+ parser = create_ls_options()
+ ls.__doc__ = parser.format_help()
# Add any commands contained in this module to LLDB
debugger.HandleCommand('command script add -f cmdtemplate.ls ls')
- print '"ls" command installed, type "ls --help" for detailed help'
+ print 'The "ls" command has been installed, type "help ls" or "ls --help" for detailed help.'
Modified: lldb/branches/windows/examples/python/operating_system.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/python/operating_system.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/python/operating_system.py (original)
+++ lldb/branches/windows/examples/python/operating_system.py Tue Sep 18 13:57:46 2012
@@ -7,7 +7,10 @@
"""Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class"""
def __init__(self, process):
- '''Initialization needs a valid.SBProcess object'''
+ '''Initialization needs a valid.SBProcess object.
+
+ This plug-in will get created after a live process is valid and has stopped for the
+ first time.'''
self.process = None
self.registers = None
self.threads = None
@@ -15,8 +18,25 @@
self.process = process
self.threads = None # Will be an dictionary containing info for each thread
+ def get_target(self):
+ # NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target"
+ # tracks the current target in the LLDB command interpreter which isn't the
+ # correct thing to use for this plug-in.
+ return self.process.target
+
def get_thread_info(self):
if not self.threads:
+ # The sample dictionary below shows the values that can be returned for a thread
+ # tid => thread ID (mandatory)
+ # name => thread name (optional key/value pair)
+ # queue => thread dispatch queue name (optional key/value pair)
+ # state => thred state (mandatory, set to 'stopped' for now)
+ # stop_reason => thread stop reason. (mandatory, usually set to 'none')
+ # Possible values include:
+ # 'breakpoint' if the thread is stopped at a breakpoint
+ # 'none' thread is just stopped because the process is stopped
+ # 'trace' the thread just single stepped
+ # The usual value for this while threads are in memory is 'none'
self.threads = [
{ 'tid' : 0x111111111, 'name' : 'one' , 'queue' : 'queue1', 'state' : 'stopped', 'stop_reason' : 'breakpoint'},
{ 'tid' : 0x222222222, 'name' : 'two' , 'queue' : 'queue2', 'state' : 'stopped', 'stop_reason' : 'none' },
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py (original)
+++ lldb/branches/windows/examples/summaries/cocoa/NSIndexSet.py Tue Sep 18 13:57:46 2012
@@ -133,7 +133,7 @@
if isinstance(summary, basestring):
return summary
else:
- summary = str(summary) + (' objects' if summary != 1 else ' object')
+ summary = str(summary) + (' indexes' if summary != 1 else ' index')
return summary
return 'Summary Unavailable'
Modified: lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py Tue Sep 18 13:57:46 2012
@@ -75,7 +75,10 @@
logger = lldb.formatters.Logger.Logger()
# assume the only thing that has a Foundation.framework is a Mac
# assume anything < Lion does not even exist
- mod = target.module['Foundation']
+ try:
+ mod = target.module['Foundation']
+ except:
+ mod = None
if mod is None or mod.IsValid() == 0:
return None
ver = mod.GetVersion()
Modified: lldb/branches/windows/examples/synthetic/libcxx.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/synthetic/libcxx.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/examples/synthetic/libcxx.py (original)
+++ lldb/branches/windows/examples/synthetic/libcxx.py Tue Sep 18 13:57:46 2012
@@ -203,6 +203,7 @@
def __init__(self, valobj, dict):
logger = lldb.formatters.Logger.Logger()
self.valobj = valobj
+ self.count = None
def next_node(self,node):
logger = lldb.formatters.Logger.Logger()
@@ -441,6 +442,7 @@
logger = lldb.formatters.Logger.Logger()
self.valobj = valobj;
self.pointer_size = self.valobj.GetProcess().GetAddressByteSize()
+ self.count = None
def update(self):
logger = lldb.formatters.Logger.Logger()
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBDebugger.h (original)
+++ lldb/branches/windows/include/lldb/API/SBDebugger.h Tue Sep 18 13:57:46 2012
@@ -193,6 +193,12 @@
void
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
+ // DEPRECATED
+ void
+ DispatchInput (void* baton,
+ const void* data,
+ size_t data_len);
+
void
DispatchInput (const void *data, size_t data_len);
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBThread.h (original)
+++ lldb/branches/windows/include/lldb/API/SBThread.h Tue Sep 18 13:57:46 2012
@@ -101,6 +101,9 @@
void
RunToAddress (lldb::addr_t addr);
+
+ SBError
+ ReturnFromFrame (SBFrame &frame, SBValue &return_value);
//--------------------------------------------------------------------------
/// LLDB currently supports process centric debugging which means when any
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBValue.h (original)
+++ lldb/branches/windows/include/lldb/API/SBValue.h Tue Sep 18 13:57:46 2012
@@ -383,6 +383,7 @@
protected:
friend class SBValueList;
friend class SBFrame;
+ friend class SBThread;
lldb::ValueObjectSP
GetSP () const;
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h (original)
+++ lldb/branches/windows/include/lldb/Core/CXXFormatterFunctions.h Tue Sep 18 13:57:46 2012
@@ -10,49 +10,290 @@
#ifndef liblldb_CXXFormatterFunctions_h_
#define liblldb_CXXFormatterFunctions_h_
+#include <stdint.h>
#include "lldb/lldb-forward.h"
#ifdef _MSC_VER
typedef unsigned __int64 uint64_t;
#endif
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/FormatClasses.h"
+
+#include "clang/AST/ASTContext.h"
+
namespace lldb_private {
namespace formatters
{
bool
- CodeRunning_Fetcher (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- uint64_t &value);
+ ExtractValueFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ uint64_t &value);
+
+ lldb::ValueObjectSP
+ CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ uint64_t index);
+
+ lldb::ValueObjectSP
+ CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ const char* key);
template<bool name_entries>
bool
- NSDictionary_SummaryProvider (ValueObject& valobj, Stream& stream);
+ NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream);
bool
- NSArray_SummaryProvider (ValueObject& valobj, Stream& stream);
+ NSArraySummaryProvider (ValueObject& valobj, Stream& stream);
template<bool needs_at>
bool
- NSData_SummaryProvider (ValueObject& valobj, Stream& stream);
+ NSDataSummaryProvider (ValueObject& valobj, Stream& stream);
bool
- NSNumber_SummaryProvider (ValueObject& valobj, Stream& stream);
+ NSNumberSummaryProvider (ValueObject& valobj, Stream& stream);
bool
- NSString_SummaryProvider (ValueObject& valobj, Stream& stream);
+ NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
template bool
- NSDictionary_SummaryProvider<true> (ValueObject&, Stream&) ;
+ NSDictionarySummaryProvider<true> (ValueObject&, Stream&) ;
template bool
- NSDictionary_SummaryProvider<false> (ValueObject&, Stream&) ;
+ NSDictionarySummaryProvider<false> (ValueObject&, Stream&) ;
template bool
- NSData_SummaryProvider<true> (ValueObject&, Stream&) ;
+ NSDataSummaryProvider<true> (ValueObject&, Stream&) ;
template bool
- NSData_SummaryProvider<false> (ValueObject&, Stream&) ;
+ NSDataSummaryProvider<false> (ValueObject&, Stream&) ;
+
+ class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ private:
+ struct DataDescriptor_32
+ {
+ uint32_t _used;
+ uint32_t _priv1 : 2 ;
+ uint32_t _size : 30;
+ uint32_t _priv2 : 2;
+ uint32_t offset : 30;
+ uint32_t _priv3;
+ uint32_t _data;
+ };
+ struct DataDescriptor_64
+ {
+ uint64_t _used;
+ uint64_t _priv1 : 2 ;
+ uint64_t _size : 62;
+ uint64_t _priv2 : 2;
+ uint64_t offset : 62;
+ uint32_t _priv3;
+ uint64_t _data;
+ };
+ public:
+ NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSArrayMSyntheticFrontEnd ();
+ private:
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ DataDescriptor_32 *m_data_32;
+ DataDescriptor_64 *m_data_64;
+ ClangASTType m_id_type;
+ std::vector<lldb::ValueObjectSP> m_children;
+ };
+
+ class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ public:
+ NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSArrayISyntheticFrontEnd ();
+ private:
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ uint64_t m_items;
+ lldb::addr_t m_data_ptr;
+ ClangASTType m_id_type;
+ std::vector<lldb::ValueObjectSP> m_children;
+ };
+
+ class NSArrayCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ public:
+ NSArrayCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSArrayCodeRunningSyntheticFrontEnd ();
+ };
+
+ SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
+
+ class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ private:
+ struct DataDescriptor_32
+ {
+ uint32_t _used : 26;
+ uint32_t _szidx : 6;
+ };
+ struct DataDescriptor_64
+ {
+ uint64_t _used : 58;
+ uint32_t _szidx : 6;
+ };
+
+ struct DictionaryItemDescriptor
+ {
+ lldb::addr_t key_ptr;
+ lldb::addr_t val_ptr;
+ lldb::ValueObjectSP valobj_sp;
+ };
+
+ public:
+ NSDictionaryISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSDictionaryISyntheticFrontEnd ();
+ private:
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ DataDescriptor_32 *m_data_32;
+ DataDescriptor_64 *m_data_64;
+ lldb::addr_t m_data_ptr;
+ std::vector<DictionaryItemDescriptor> m_children;
+ };
+
+ class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ private:
+ struct DataDescriptor_32
+ {
+ uint32_t _used : 26;
+ uint32_t _kvo : 1;
+ uint32_t _size;
+ uint32_t _mutations;
+ uint32_t _objs_addr;
+ uint32_t _keys_addr;
+ };
+ struct DataDescriptor_64
+ {
+ uint64_t _used : 58;
+ uint32_t _kvo : 1;
+ uint64_t _size;
+ uint64_t _mutations;
+ uint64_t _objs_addr;
+ uint64_t _keys_addr;
+ };
+ struct DictionaryItemDescriptor
+ {
+ lldb::addr_t key_ptr;
+ lldb::addr_t val_ptr;
+ lldb::ValueObjectSP valobj_sp;
+ };
+ public:
+ NSDictionaryMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSDictionaryMSyntheticFrontEnd ();
+ private:
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ uint64_t m_items;
+ DataDescriptor_32 *m_data_32;
+ DataDescriptor_64 *m_data_64;
+ std::vector<DictionaryItemDescriptor> m_children;
+ };
+
+ class NSDictionaryCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+ {
+ public:
+ NSDictionaryCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ virtual uint32_t
+ CalculateNumChildren ();
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx);
+
+ virtual bool
+ Update();
+
+ virtual uint32_t
+ GetIndexOfChildWithName (const ConstString &name);
+
+ virtual
+ ~NSDictionaryCodeRunningSyntheticFrontEnd ();
+ };
+
+ SyntheticChildrenFrontEnd* NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
}
}
Modified: lldb/branches/windows/include/lldb/Core/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/FormatClasses.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/FormatClasses.h (original)
+++ lldb/branches/windows/include/lldb/Core/FormatClasses.h Tue Sep 18 13:57:46 2012
@@ -240,7 +240,7 @@
CalculateNumChildren() = 0;
virtual lldb::ValueObjectSP
- GetChildAtIndex (uint32_t idx, bool can_create) = 0;
+ GetChildAtIndex (uint32_t idx) = 0;
virtual uint32_t
GetIndexOfChildWithName (const ConstString &name) = 0;
@@ -555,11 +555,11 @@
}
virtual lldb::ValueObjectSP
- GetChildAtIndex (uint32_t idx, bool can_create)
+ GetChildAtIndex (uint32_t idx)
{
if (idx >= filter->GetCount())
return lldb::ValueObjectSP();
- return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), can_create);
+ return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), true);
}
virtual bool
@@ -601,6 +601,42 @@
DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
};
+ class CXXSyntheticChildren : public SyntheticChildren
+ {
+ public:
+ typedef SyntheticChildrenFrontEnd* (*CreateFrontEndCallback) (CXXSyntheticChildren*, lldb::ValueObjectSP);
+ protected:
+ CreateFrontEndCallback m_create_callback;
+ std::string m_description;
+ public:
+ CXXSyntheticChildren(const SyntheticChildren::Flags& flags,
+ const char* description,
+ CreateFrontEndCallback callback) :
+ SyntheticChildren(flags),
+ m_create_callback(callback),
+ m_description(description ? description : "")
+ {
+ }
+
+ bool
+ IsScripted()
+ {
+ return false;
+ }
+
+ std::string
+ GetDescription();
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend)
+ {
+ return SyntheticChildrenFrontEnd::AutoPointer(m_create_callback(this, backend.GetSP()));
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+ };
+
#ifndef LLDB_DISABLE_PYTHON
class TypeSyntheticImpl : public SyntheticChildren
@@ -679,7 +715,7 @@
}
virtual lldb::ValueObjectSP
- GetChildAtIndex (uint32_t idx, bool can_create);
+ GetChildAtIndex (uint32_t idx);
virtual bool
Update()
@@ -887,11 +923,11 @@
}
virtual lldb::ValueObjectSP
- GetChildAtIndex (uint32_t idx, bool can_create)
+ GetChildAtIndex (uint32_t idx)
{
if (idx >= filter->GetCount())
return lldb::ValueObjectSP();
- return m_backend.GetSyntheticArrayMember(filter->GetRealIndexForIndex(idx), can_create);
+ return m_backend.GetSyntheticArrayMember(filter->GetRealIndexForIndex(idx), true);
}
virtual bool
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/FormatNavigator.h (original)
+++ lldb/branches/windows/include/lldb/Core/FormatNavigator.h Tue Sep 18 13:57:46 2012
@@ -25,6 +25,9 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/ValueObject.h"
+
+#include "lldb/Symbol/ClangASTContext.h"
+
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
@@ -425,13 +428,16 @@
bool
Get_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
{
+ const char* key_cstr = key.AsCString();
+ if (!key_cstr)
+ return false;
Mutex& x_mutex = m_format_map.mutex();
lldb_private::Mutex::Locker locker(x_mutex);
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if (regex->Execute(key.AsCString()))
+ if (regex->Execute(key_cstr))
{
value = pos->second;
return true;
@@ -575,8 +581,7 @@
return true;
}
}
-
- if (typePtr->isPointerType())
+ else if (typePtr->isPointerType())
{
if (log)
log->Printf("stripping pointer");
@@ -588,7 +593,13 @@
}
}
- if (typePtr->isObjCObjectPointerType())
+ bool canBeObjCDynamic = ClangASTContext::IsPossibleDynamicType (valobj.GetClangAST(),
+ type.getAsOpaquePtr(),
+ NULL,
+ false, // no C++
+ true); // yes ObjC
+
+ if (canBeObjCDynamic)
{
if (use_dynamic != lldb::eNoDynamicValues)
{
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObject.h Tue Sep 18 13:57:46 2012
@@ -910,6 +910,23 @@
ValueObject *valobj,
const DumpValueObjectOptions& options);
+ static lldb::ValueObjectSP
+ CreateValueObjectFromExpression (const char* name,
+ const char* expression,
+ const ExecutionContext& exe_ctx);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromAddress (const char* name,
+ uint64_t address,
+ const ExecutionContext& exe_ctx,
+ ClangASTType type);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromData (const char* name,
+ DataExtractor& data,
+ const ExecutionContext& exe_ctx,
+ ClangASTType type);
+
static void
LogValueObject (Log *log,
ValueObject *valobj);
Modified: lldb/branches/windows/include/lldb/Core/cxa_demangle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/cxa_demangle.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/cxa_demangle.h (original)
+++ lldb/branches/windows/include/lldb/Core/cxa_demangle.h Tue Sep 18 13:57:46 2012
@@ -10,6 +10,8 @@
#ifndef _CXA_DEMANGLE_H
#define _CXA_DEMANGLE_H
+// FreeBSD9-STABLE fix (define size_t before including cxxabi.h)
+#include <cstdlib>
#include <cxxabi.h>
#pragma GCC visibility push(hidden)
Modified: lldb/branches/windows/include/lldb/Expression/ClangExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangExpression.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangExpression.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangExpression.h Tue Sep 18 13:57:46 2012
@@ -47,7 +47,7 @@
};
ClangExpression () :
- m_jit_process_sp(),
+ m_jit_process_wp(),
m_jit_alloc (LLDB_INVALID_ADDRESS),
m_jit_start_addr (LLDB_INVALID_ADDRESS),
m_jit_end_addr (LLDB_INVALID_ADDRESS)
@@ -143,13 +143,13 @@
void
DeallocateJITFunction ()
{
- if (m_jit_process_sp && m_jit_alloc != LLDB_INVALID_ADDRESS)
+ lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
+ if (jit_process_sp && m_jit_alloc != LLDB_INVALID_ADDRESS)
{
- m_jit_process_sp->DeallocateMemory (m_jit_alloc);
+ jit_process_sp->DeallocateMemory (m_jit_alloc);
// If this process is ever used for anything else, we can not clear it
// here. For now it is only used in order to deallocate any code if
// m_jit_alloc is a valid address.
- m_jit_process_sp.reset();
m_jit_alloc = LLDB_INVALID_ADDRESS;
}
}
@@ -166,7 +166,7 @@
protected:
- lldb::ProcessSP m_jit_process_sp;
+ lldb::ProcessWP m_jit_process_wp;
lldb::addr_t m_jit_alloc; ///< The address of the block containing JITted code. LLDB_INVALID_ADDRESS if invalid.
lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
lldb::addr_t m_jit_end_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Symbols.h (original)
+++ lldb/branches/windows/include/lldb/Host/Symbols.h Tue Sep 18 13:57:46 2012
@@ -28,6 +28,11 @@
static FileSpec
LocateExecutableSymbolFile (const ModuleSpec &module_spec);
+
+ static FileSpec
+ FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec,
+ const lldb_private::UUID *uuid,
+ const ArchSpec *arch);
};
} // namespace lldb_private
Modified: lldb/branches/windows/include/lldb/Target/ABI.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/ABI.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ABI.h (original)
+++ lldb/branches/windows/include/lldb/Target/ABI.h Tue Sep 18 13:57:46 2012
@@ -14,6 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Core/Error.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/lldb-private.h"
@@ -50,6 +51,10 @@
GetReturnValueObject (Thread &thread,
ClangASTType &type,
bool persistent = true) const;
+
+ // Set the Return value object in the current frame as though a function with
+ virtual Error
+ SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
protected:
// This is the method the ABI will call to actually calculate the return value.
Modified: lldb/branches/windows/include/lldb/Target/LanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/LanguageRuntime.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/branches/windows/include/lldb/Target/LanguageRuntime.h Tue Sep 18 13:57:46 2012
@@ -83,6 +83,12 @@
static const char *
GetNameForLanguageType (lldb::LanguageType language);
+
+ Process *
+ GetProcess()
+ {
+ return m_process;
+ }
protected:
//------------------------------------------------------------------
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h Tue Sep 18 13:57:46 2012
@@ -19,6 +19,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeVendor.h"
#include "lldb/Target/LanguageRuntime.h"
namespace lldb_private {
@@ -94,6 +95,13 @@
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,
@@ -222,14 +230,34 @@
virtual ObjCISA
GetISA(ValueObject& valobj) = 0;
+ virtual void
+ UpdateISAToDescriptorMap_Impl()
+ {
+ // to be implemented by runtimes if they support doing this
+ }
+
+ void
+ UpdateISAToDescriptorMap()
+ {
+ if (m_isa_to_descriptor_cache_is_up_to_date)
+ return;
+
+ m_isa_to_descriptor_cache_is_up_to_date = true;
+
+ UpdateISAToDescriptorMap_Impl();
+ }
+
+ virtual ObjCISA
+ GetISA(const ConstString &name);
+
virtual ConstString
GetActualTypeName(ObjCISA isa);
virtual ObjCISA
GetParentClass(ObjCISA isa);
- virtual SymbolVendor *
- GetSymbolVendor()
+ virtual TypeVendor *
+ GetTypeVendor()
{
return NULL;
}
@@ -404,10 +432,10 @@
LazyBool m_has_new_literals_and_indexing;
protected:
-
typedef std::map<ObjCISA, ClassDescriptorSP> ISAToDescriptorMap;
typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
ISAToDescriptorMap m_isa_to_descriptor_cache;
+ bool m_isa_to_descriptor_cache_is_up_to_date;
typedef std::map<lldb::addr_t,TypeAndOrName> ClassNameMap;
typedef ClassNameMap::iterator ClassNameIterator;
Modified: lldb/branches/windows/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Platform.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Platform.h (original)
+++ lldb/branches/windows/include/lldb/Target/Platform.h Tue Sep 18 13:57:46 2012
@@ -118,6 +118,59 @@
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr);
+
+ //------------------------------------------------------------------
+ /// Find a symbol file given a symbol file module specification.
+ ///
+ /// Each platform might have tricks to find symbol files for an
+ /// executable given information in a symbol file ModuleSpec. Some
+ /// platforms might also support symbol files that are bundles and
+ /// know how to extract the right symbol file given a bundle.
+ ///
+ /// @param[in] target
+ /// The target in which we are trying to resolve the symbol file.
+ /// The target has a list of modules that we might be able to
+ /// use in order to help find the right symbol file. If the
+ /// "m_file" or "m_platform_file" entries in the \a sym_spec
+ /// are filled in, then we might be able to locate a module in
+ /// the target, extract its UUID and locate a symbol file.
+ /// If just the "m_uuid" is specified, then we might be able
+ /// to find the module in the target that matches that UUID
+ /// and pair the symbol file along with it. If just "m_symbol_file"
+ /// is specified, we can use a variety of tricks to locate the
+ /// symbols in an SDK, PDK, or other development kit location.
+ ///
+ /// @param[in] sym_spec
+ /// A module spec that describes some information about the
+ /// symbol file we are trying to resolve. The ModuleSpec might
+ /// contain the following:
+ /// m_file - A full or partial path to an executable from the
+ /// target (might be empty).
+ /// m_platform_file - Another executable hint that contains
+ /// the path to the file as known on the
+ /// local/remote platform.
+ /// m_symbol_file - A full or partial path to a symbol file
+ /// or symbol bundle that should be used when
+ /// trying to resolve the symbol file.
+ /// m_arch - The architecture we are looking for when resolving
+ /// the symbol file.
+ /// m_uuid - The UUID of the executable and symbol file. This
+ /// can often be used to match up an exectuable with
+ /// a symbol file, or resolve an symbol file in a
+ /// symbol file bundle.
+ ///
+ /// @param[out] sym_file
+ /// The resolved symbol file spec if the returned error
+ /// indicates succes.
+ ///
+ /// @return
+ /// Returns an error that describes success or failure.
+ //------------------------------------------------------------------
+ virtual Error
+ ResolveSymbolFile (Target &target,
+ const ModuleSpec &sym_spec,
+ FileSpec &sym_file);
+
//------------------------------------------------------------------
/// Resolves the FileSpec to a (possibly) remote path. Remote
/// platforms must override this to resolve to a path on the remote
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Process.h (original)
+++ lldb/branches/windows/include/lldb/Target/Process.h Tue Sep 18 13:57:46 2012
@@ -3039,7 +3039,7 @@
GetNextEvent (lldb::EventSP &event_sp);
lldb::StateType
- WaitForProcessToStop (const TimeValue *timeout);
+ WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp_ptr = NULL);
lldb::StateType
WaitForStateChangedEvents (const TimeValue *timeout, lldb::EventSP &event_sp);
Modified: lldb/branches/windows/include/lldb/Target/RegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/RegisterContext.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/RegisterContext.h (original)
+++ lldb/branches/windows/include/lldb/Target/RegisterContext.h Tue Sep 18 13:57:46 2012
@@ -72,6 +72,9 @@
virtual bool
WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) = 0;
+ bool
+ CopyFromRegisterContext (lldb::RegisterContextSP context);
+
virtual uint32_t
ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) = 0;
Modified: lldb/branches/windows/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/StackFrameList.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/StackFrameList.h (original)
+++ lldb/branches/windows/include/lldb/Target/StackFrameList.h Tue Sep 18 13:57:46 2012
@@ -125,6 +125,9 @@
uint32_t
GetCurrentInlinedDepth ();
+ void
+ SetCurrentInlinedDepth (uint32_t new_depth);
+
//------------------------------------------------------------------
// Classes that inherit from StackFrameList can see and modify these
//------------------------------------------------------------------
Modified: lldb/branches/windows/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Target.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Target.h (original)
+++ lldb/branches/windows/include/lldb/Target/Target.h Tue Sep 18 13:57:46 2012
@@ -760,6 +760,105 @@
ClangASTImporter *
GetClangASTImporter();
+ class EvaluateExpressionOptions
+ {
+ public:
+ EvaluateExpressionOptions() :
+ m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
+ m_coerce_to_id(false),
+ m_unwind_on_error(true),
+ m_keep_in_memory(false),
+ m_use_dynamic(lldb::eNoDynamicValues),
+ m_single_thread_timeout_usec(500000)
+ {}
+
+ ExecutionPolicy
+ GetExecutionPolicy () const
+ {
+ return m_execution_policy;
+ }
+
+ EvaluateExpressionOptions&
+ SetExecutionPolicy (ExecutionPolicy policy = eExecutionPolicyAlways)
+ {
+ m_execution_policy = policy;
+ return *this;
+ }
+
+ bool
+ DoesCoerceToId () const
+ {
+ return m_coerce_to_id;
+ }
+
+ EvaluateExpressionOptions&
+ SetCoerceToId (bool coerce = true)
+ {
+ m_coerce_to_id = coerce;
+ return *this;
+ }
+
+ bool
+ DoesUnwindOnError () const
+ {
+ return m_unwind_on_error;
+ }
+
+ EvaluateExpressionOptions&
+ SetUnwindOnError (bool unwind = false)
+ {
+ m_unwind_on_error = unwind;
+ return *this;
+ }
+
+ bool
+ DoesKeepInMemory () const
+ {
+ return m_keep_in_memory;
+ }
+
+ EvaluateExpressionOptions&
+ SetKeepInMemory (bool keep = true)
+ {
+ m_keep_in_memory = keep;
+ return *this;
+ }
+
+ lldb::DynamicValueType
+ GetUseDynamic () const
+ {
+ return m_use_dynamic;
+ }
+
+ EvaluateExpressionOptions&
+ SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget)
+ {
+ m_use_dynamic = dynamic;
+ return *this;
+ }
+
+ uint32_t
+ GetSingleThreadTimeoutUsec () const
+ {
+ return m_single_thread_timeout_usec;
+ }
+
+ EvaluateExpressionOptions&
+ SetSingleThreadTimeoutUsec (uint32_t timeout = 0)
+ {
+ m_single_thread_timeout_usec = timeout;
+ return *this;
+ }
+
+ private:
+ ExecutionPolicy m_execution_policy;
+ bool m_coerce_to_id;
+ bool m_unwind_on_error;
+ bool m_keep_in_memory;
+ lldb::DynamicValueType m_use_dynamic;
+ uint32_t m_single_thread_timeout_usec;
+ };
+
// Since expressions results can persist beyond the lifetime of a process,
// and the const expression results are available after a process is gone,
// we provide a way for expressions to be evaluated from the Target itself.
@@ -768,13 +867,8 @@
ExecutionResults
EvaluateExpression (const char *expression,
StackFrame *frame,
- lldb_private::ExecutionPolicy execution_policy,
- bool coerce_to_id,
- bool unwind_on_error,
- bool keep_in_memory,
- lldb::DynamicValueType use_dynamic,
lldb::ValueObjectSP &result_valobj_sp,
- uint32_t single_thread_timeout_usec = 500000);
+ const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
ClangPersistentVariables &
GetPersistentVariables()
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Thread.h (original)
+++ lldb/branches/windows/include/lldb/Target/Thread.h Tue Sep 18 13:57:46 2012
@@ -128,6 +128,8 @@
uint32_t orig_stop_id; // Dunno if I need this yet but it is an interesting bit of data.
lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you might continue with the wrong signals.
RegisterCheckpoint register_backup; // You need to restore the registers, of course...
+ uint32_t current_inlined_depth;
+ lldb::addr_t current_inlined_pc;
};
static void
@@ -280,9 +282,15 @@
uint32_t
GetCurrentInlinedDepth()
{
- return GetStackFrameList()->DecrementCurrentInlinedDepth();
+ return GetStackFrameList()->GetCurrentInlinedDepth();
}
+ Error
+ ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp);
+
+ Error
+ ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp);
+
virtual lldb::StackFrameSP
GetFrameWithStackID (const StackID &stack_id)
{
@@ -745,6 +753,10 @@
virtual bool
RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
+
+ // register_data_sp must be a DataSP passed to ReadAllRegisterValues.
+ bool
+ ResetFrameZeroRegisters (lldb::DataBufferSP register_data_sp);
virtual lldb_private::Unwind *
GetUnwinder ();
Modified: lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h (original)
+++ lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h Tue Sep 18 13:57:46 2012
@@ -80,6 +80,7 @@
std::auto_ptr<RegularExpression> m_avoid_regexp_ap;
bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put a switch in for this if there's
// demand for that.
+ bool m_virtual_step; // true if we've just done a "virtual step", i.e. just moved the inline stack depth.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInRange);
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-enumerations.h (original)
+++ lldb/branches/windows/include/lldb/lldb-enumerations.h Tue Sep 18 13:57:46 2012
@@ -370,6 +370,7 @@
eArgTypeFrameIndex,
eArgTypeFullName,
eArgTypeFunctionName,
+ eArgTypeFunctionOrSymbol,
eArgTypeGDBFormat,
eArgTypeIndex,
eArgTypeLanguage,
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-forward.h (original)
+++ lldb/branches/windows/include/lldb/lldb-forward.h Tue Sep 18 13:57:46 2012
@@ -85,6 +85,7 @@
class Connection;
class ConnectionFileDescriptor;
class ConstString;
+class CXXSyntheticChildren;
class DWARFCallFrameInfo;
class DWARFExpression;
class DataBuffer;
Modified: lldb/branches/windows/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lldb.xcodeproj/project.pbxproj?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/lldb.xcodeproj/project.pbxproj Tue Sep 18 13:57:46 2012
@@ -491,7 +491,7 @@
49A71FE8141FFACF00D59478 /* DataEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268ED0A4140FF54200DE830F /* DataEncoder.cpp */; };
49C8507C1384A786007DB519 /* ProcessDataAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C850781384A0CA007DB519 /* ProcessDataAllocator.cpp */; };
49D8FB3913B5598F00411094 /* ClangASTImporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D8FB3513B558DE00411094 /* ClangASTImporter.cpp */; };
- 49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */; };
+ 49DA65031485C92A005FF180 /* AppleObjCTypeVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA65021485C92A005FF180 /* AppleObjCTypeVendor.cpp */; };
4C6649A014EEE7F100B0316F /* StreamCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C66499F14EEE7F100B0316F /* StreamCallback.h */; };
4C6649A314EEE81000B0316F /* StreamCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6649A214EEE81000B0316F /* StreamCallback.cpp */; };
4C701C1E15ABB70C00B50001 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D55234159A7DB100708D8D /* libxml2.dylib */; };
@@ -1412,6 +1412,7 @@
49A1CAC31430E8BD00306AC9 /* ExpressionSourceCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExpressionSourceCode.cpp; path = source/Expression/ExpressionSourceCode.cpp; sourceTree = "<group>"; };
49A8A39F11D568A300AD3B68 /* ASTResultSynthesizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ASTResultSynthesizer.cpp; path = source/Expression/ASTResultSynthesizer.cpp; sourceTree = "<group>"; };
49A8A3A311D568BF00AD3B68 /* ASTResultSynthesizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASTResultSynthesizer.h; path = include/lldb/Expression/ASTResultSynthesizer.h; sourceTree = "<group>"; };
+ 49B01A2D15F67B1700666829 /* TypeVendor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeVendor.h; path = include/lldb/Symbol/TypeVendor.h; sourceTree = "<group>"; };
49BB309511F79450001A4197 /* TaggedASTType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TaggedASTType.h; path = include/lldb/Symbol/TaggedASTType.h; sourceTree = "<group>"; };
49C850761384A02F007DB519 /* ProcessDataAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProcessDataAllocator.h; path = include/lldb/Expression/ProcessDataAllocator.h; sourceTree = "<group>"; };
49C850781384A0CA007DB519 /* ProcessDataAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProcessDataAllocator.cpp; path = source/Expression/ProcessDataAllocator.cpp; sourceTree = "<group>"; };
@@ -1423,8 +1424,8 @@
49D7072811B5AD11001AD875 /* ClangASTSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTSource.cpp; path = source/Expression/ClangASTSource.cpp; sourceTree = "<group>"; };
49D8FB3513B558DE00411094 /* ClangASTImporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTImporter.cpp; path = source/Symbol/ClangASTImporter.cpp; sourceTree = "<group>"; };
49D8FB3713B5594900411094 /* ClangASTImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangASTImporter.h; path = include/lldb/Symbol/ClangASTImporter.h; sourceTree = "<group>"; };
- 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCSymbolVendor.cpp; sourceTree = "<group>"; };
- 49DA65041485C942005FF180 /* AppleObjCSymbolVendor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleObjCSymbolVendor.h; sourceTree = "<group>"; };
+ 49DA65021485C92A005FF180 /* AppleObjCTypeVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCTypeVendor.cpp; sourceTree = "<group>"; };
+ 49DA65041485C942005FF180 /* AppleObjCTypeVendor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleObjCTypeVendor.h; sourceTree = "<group>"; };
49E45FA911F660DC008F7B28 /* ClangASTType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangASTType.h; path = include/lldb/Symbol/ClangASTType.h; sourceTree = "<group>"; };
49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTType.cpp; path = source/Symbol/ClangASTType.cpp; sourceTree = "<group>"; };
49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanCallFunction.cpp; path = source/Target/ThreadPlanCallFunction.cpp; sourceTree = "<group>"; };
@@ -2649,6 +2650,7 @@
9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */,
26BC7C6610F1B6E900F91463 /* TypeList.h */,
26BC7F2110F1B8EC00F91463 /* TypeList.cpp */,
+ 49B01A2D15F67B1700666829 /* TypeVendor.h */,
269FF07F12494F8E00225026 /* UnwindPlan.h */,
961FABB91235DE1600F93A47 /* UnwindPlan.cpp */,
269FF08112494FC200225026 /* UnwindTable.h */,
@@ -3237,10 +3239,10 @@
4CCA644513B40B82003BDF98 /* AppleObjCRuntimeV1.h */,
4CCA644613B40B82003BDF98 /* AppleObjCRuntimeV2.cpp */,
4CCA644713B40B82003BDF98 /* AppleObjCRuntimeV2.h */,
- 49DA65041485C942005FF180 /* AppleObjCSymbolVendor.h */,
- 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */,
4CCA644813B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp */,
4CCA644913B40B82003BDF98 /* AppleObjCTrampolineHandler.h */,
+ 49DA65041485C942005FF180 /* AppleObjCTypeVendor.h */,
+ 49DA65021485C92A005FF180 /* AppleObjCTypeVendor.cpp */,
4CCA644A13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */,
4CCA644B13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.h */,
);
@@ -4081,7 +4083,7 @@
B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */,
49A1CAC51430E8DE00306AC9 /* ExpressionSourceCode.cpp in Sources */,
494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */,
- 49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */,
+ 49DA65031485C92A005FF180 /* AppleObjCTypeVendor.cpp in Sources */,
4966DCC4148978A10028481B /* ClangExternalASTSourceCommon.cpp in Sources */,
26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */,
26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */,
Modified: lldb/branches/windows/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/branches/windows/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Tue Sep 18 13:57:46 2012
@@ -90,7 +90,6 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "YES"
debugDocumentVersioning = "YES"
- enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/windows/scripts/Python/build-swig-Python.sh Tue Sep 18 13:57:46 2012
@@ -18,13 +18,19 @@
debug_flag=$5
SWIG=$6
-swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp
+os_name=`uname -s`
+if [ "$os_name" == "Darwin" ]
+then
+ swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp
+else
+ swig_output_file=${TARGET_DIR}/LLDBWrapPython.cpp
+fi
swig_input_file=${SRC_ROOT}/scripts/lldb.swig
swig_python_extensions=${SRC_ROOT}/scripts/Python/python-extensions.swig
swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig
swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig
-if [ $LLDB_DISABLE_PYTHON = "1" ] ; then
+if [ "$LLDB_DISABLE_PYTHON" = "1" ] ; then
# We don't want Python for this build, but touch the output file so we don't have to
# conditionalize the build on this as well.
# Note, at present iOS doesn't have Python, so if you're building for iOS be sure to
@@ -252,8 +258,7 @@
fi
fi
-os_name=`uname -s`
-python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
+python_version=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
if [ "$os_name" == "Darwin" ]
then
Modified: lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh Tue Sep 18 13:57:46 2012
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# finish-swig-Python.sh
#
@@ -37,7 +37,7 @@
# Note, at present iOS doesn't have Python, so if you're building for iOS be sure to
# set LLDB_DISABLE_PYTHON to 1.
-if [ ! $LLDB_DISABLE_PYTHON = "1" ] ; then
+if [ ! "$LLDB_DISABLE_PYTHON" = "1" ] ; then
if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
then
@@ -47,7 +47,7 @@
fi
OS_NAME=`uname -s`
-PYTHON_VERSION=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
+PYTHON_VERSION=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
if [ $Debug == 1 ]
@@ -134,9 +134,6 @@
then
cd "${framework_python_dir}"
ln -s "../../../LLDB" _lldb.so
- else
- cd "${TARGET_DIR}"
- ln -s "../LLDB" _lldb.so
fi
else
if [ $Debug == 1 ]
@@ -146,7 +143,7 @@
fi
-function create_python_package {
+create_python_package () {
package_dir="${framework_python_dir}$1"
package_files="$2"
package_name=`echo $1 | tr '/' '.'`
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBThread.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBThread.i Tue Sep 18 13:57:46 2012
@@ -130,6 +130,9 @@
void
RunToAddress (lldb::addr_t addr);
+ SBError
+ ReturnFromFrame (SBFrame &frame, SBValue &return_value);
+
%feature("docstring", "
//--------------------------------------------------------------------------
/// LLDB currently supports process centric debugging which means when any
Modified: lldb/branches/windows/scripts/build-swig-wrapper-classes.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/build-swig-wrapper-classes.sh?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/scripts/build-swig-wrapper-classes.sh (original)
+++ lldb/branches/windows/scripts/build-swig-wrapper-classes.sh Tue Sep 18 13:57:46 2012
@@ -119,7 +119,7 @@
echo "Executing $curlang build script..."
fi
- ./build-swig-${curlang}.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" "${SWIG}"
+ ./build-swig-${curlang}.sh "$SRC_ROOT" "$TARGET_DIR" "$CONFIG_BUILD_DIR" "${PREFIX}" "${debug_flag}" "${SWIG}"
fi
fi
done
Modified: lldb/branches/windows/scripts/llvm.amalgamated.diff
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/llvm.amalgamated.diff?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/scripts/llvm.amalgamated.diff (original)
+++ lldb/branches/windows/scripts/llvm.amalgamated.diff Tue Sep 18 13:57:46 2012
@@ -1424,3 +1424,120 @@
Ctx.reset(ctx);
DisAsm.reset(disAsm);
IP.reset(iP);
+Index: tools/llvm-nm/llvm-nm.cpp
+===================================================================
+--- tools/llvm-nm/llvm-nm.cpp (revision 152265)
++++ tools/llvm-nm/llvm-nm.cpp (working copy)
+@@ -204,9 +204,9 @@ static void SortAndPrintSymbolList() {
+ strcpy(SymbolSizeStr, " ");
+
+ if (i->Address != object::UnknownAddressOrSize)
+- format("%08"PRIx64, i->Address).print(SymbolAddrStr, sizeof(SymbolAddrStr));
++ format("%08" PRIx64, i->Address).print(SymbolAddrStr, sizeof(SymbolAddrStr));
+ if (i->Size != object::UnknownAddressOrSize)
+- format("%08"PRIx64, i->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
++ format("%08" PRIx64, i->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
+
+ if (OutputFormat == posix) {
+ outs() << i->Name << " " << i->TypeChar << " "
+Index: lib/DebugInfo/DWARFFormValue.cpp
+===================================================================
+--- lib/DebugInfo/DWARFFormValue.cpp (revision 152265)
++++ lib/DebugInfo/DWARFFormValue.cpp (working copy)
+@@ -348,7 +348,7 @@ DWARFFormValue::dump(raw_ostream &OS, const DWARFC
+ }
+
+ if (cu_relative_offset)
+- OS << format(" => {0x%8.8"PRIx64"}", (uvalue + (cu ? cu->getOffset() : 0)));
++ OS << format(" => {0x%8.8" PRIx64 "}", (uvalue + (cu ? cu->getOffset() : 0)));
+ }
+
+ const char*
+Index: tools/llvm-objdump/llvm-objdump.cpp
+===================================================================
+--- tools/llvm-objdump/llvm-objdump.cpp (revision 152265)
++++ tools/llvm-objdump/llvm-objdump.cpp (working copy)
+@@ -300,7 +300,7 @@ static void DisassembleObject(const ObjectFile *Ob
+
+ if (DisAsm->getInstruction(Inst, Size, memoryObject, Index,
+ DebugOut, nulls())) {
+- outs() << format("%8"PRIx64":\t", SectionAddr + Index);
++ outs() << format("%8" PRIx64":\t", SectionAddr + Index);
+ DumpBytes(StringRef(Bytes.data() + Index, Size));
+ IP->printInst(&Inst, outs(), "");
+ outs() << "\n";
+@@ -327,7 +327,7 @@ static void DisassembleObject(const ObjectFile *Ob
+ if (error(rel_cur->getTypeName(name))) goto skip_print_rel;
+ if (error(rel_cur->getValueString(val))) goto skip_print_rel;
+
+- outs() << format("\t\t\t%8"PRIx64": ", SectionAddr + addr) << name << "\t"
++ outs() << format("\t\t\t%8" PRIx64 ": ", SectionAddr + addr) << name << "\t"
+ << val << "\n";
+
+ skip_print_rel:
+@@ -388,7 +388,7 @@ static void PrintSectionHeaders(const ObjectFile *
+ if (error(si->isBSS(BSS))) return;
+ std::string Type = (std::string(Text ? "TEXT " : "") +
+ (Data ? "DATA " : "") + (BSS ? "BSS" : ""));
+- outs() << format("%3d %-13s %09"PRIx64" %017"PRIx64" %s\n", i, Name.str().c_str(), Size,
++ outs() << format("%3d %-13s %09" PRIx64 " %017" PRIx64 " %s\n", i, Name.str().c_str(), Size,
+ Address, Type.c_str());
+ ++i;
+ }
+@@ -411,7 +411,7 @@ static void PrintSectionContents(const ObjectFile
+
+ // Dump out the content as hex and printable ascii characters.
+ for (std::size_t addr = 0, end = Contents.size(); addr < end; addr += 16) {
+- outs() << format(" %04"PRIx64" ", BaseAddr + addr);
++ outs() << format(" %04" PRIx64 " ", BaseAddr + addr);
+ // Dump line of hex.
+ for (std::size_t i = 0; i < 16; ++i) {
+ if (i != 0 && i % 4 == 0)
+@@ -519,7 +519,7 @@ static void PrintSymbolTable(const ObjectFile *o)
+ else if (Type == SymbolRef::ST_Function)
+ FileFunc = 'F';
+
+- outs() << format("%08"PRIx64, Address) << " "
++ outs() << format("%08" PRIx64, Address) << " "
+ << GlobLoc // Local -> 'l', Global -> 'g', Neither -> ' '
+ << (Weak ? 'w' : ' ') // Weak?
+ << ' ' // Constructor. Not supported yet.
+@@ -539,7 +539,7 @@ static void PrintSymbolTable(const ObjectFile *o)
+ outs() << SectionName;
+ }
+ outs() << '\t'
+- << format("%08"PRIx64" ", Size)
++ << format("%08" PRIx64 " ", Size)
+ << Name
+ << '\n';
+ }
+Index: tools/bugpoint/ToolRunner.cpp
+===================================================================
+--- tools/bugpoint/ToolRunner.cpp (revision 152265)
++++ tools/bugpoint/ToolRunner.cpp (working copy)
+@@ -128,7 +128,7 @@ static int RunProgramRemotelyWithTimeout(const sys
+ ErrorFile.close();
+ }
+
+- errs() << OS;
++ errs() << OS.str();
+ }
+
+ return ReturnCode;
+Index: tools/llvm-readobj/llvm-readobj.cpp
+===================================================================
+--- tools/llvm-readobj/llvm-readobj.cpp (revision 152265)
++++ tools/llvm-readobj/llvm-readobj.cpp (working copy)
+@@ -95,9 +95,9 @@ void DumpSymbol(const SymbolRef &sym) {
+ // format() can't handle StringRefs
+ outs() << format(" %-32s", Name.str().c_str())
+ << format(" %-4s", GetTypeStr(Type))
+- << format(" %16"PRIx64, Address)
+- << format(" %16"PRIx64, Size)
+- << format(" %16"PRIx64, FileOffset)
++ << format(" %16" PRIx64, Address)
++ << format(" %16" PRIx64, Size)
++ << format(" %16" PRIx64, FileOffset)
+ << " " << GetFlagStr(Flags)
+ << "\n";
+ }
Modified: lldb/branches/windows/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBBreakpoint.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBBreakpoint.cpp (original)
+++ lldb/branches/windows/source/API/SBBreakpoint.cpp Tue Sep 18 13:57:46 2012
@@ -440,7 +440,7 @@
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved);
+ log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);
return num_resolved;
}
@@ -455,7 +455,7 @@
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs);
+ log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_locs);
return num_locs;
}
@@ -469,7 +469,7 @@
m_opaque_sp->GetResolverDescription (s.get());
m_opaque_sp->GetFilterDescription (s.get());
const size_t num_locations = m_opaque_sp->GetNumLocations ();
- s.Printf(", locations = %zu", num_locations);
+ s.Printf(", locations = %llu", (uint64_t)num_locations);
return true;
}
s.Printf ("No value");
Modified: lldb/branches/windows/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBCommunication.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBCommunication.cpp (original)
+++ lldb/branches/windows/source/API/SBCommunication.cpp Tue Sep 18 13:57:46 2012
@@ -139,8 +139,11 @@
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...",
- m_opaque, dst, dst_len, timeout_usec);
+ log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%llu, timeout_usec=%u, &status)...",
+ m_opaque,
+ dst,
+ (uint64_t)dst_len,
+ timeout_usec);
size_t bytes_read = 0;
if (m_opaque)
bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL);
@@ -148,9 +151,13 @@
status = eConnectionStatusNoConnection;
if (log)
- log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status=%s) => %zu",
- m_opaque, dst, dst_len, timeout_usec, Communication::ConnectionStatusAsCString (status),
- bytes_read);
+ log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%llu, timeout_usec=%u, &status=%s) => %llu",
+ m_opaque,
+ dst,
+ (uint64_t)dst_len,
+ timeout_usec,
+ Communication::ConnectionStatusAsCString (status),
+ (uint64_t)bytes_read);
return bytes_read;
}
@@ -166,8 +173,8 @@
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu",
- m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written);
+ log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%llu, &status=%s) => %llu",
+ m_opaque, src, (uint64_t)src_len, Communication::ConnectionStatusAsCString (status), (uint64_t)bytes_written);
return 0;
}
Modified: lldb/branches/windows/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBDebugger.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBDebugger.cpp (original)
+++ lldb/branches/windows/source/API/SBDebugger.cpp Tue Sep 18 13:57:46 2012
@@ -794,13 +794,22 @@
}
void
+SBDebugger::DispatchInput (void* baton, const void *data, size_t data_len)
+{
+ DispatchInput (data,data_len);
+}
+
+void
SBDebugger::DispatchInput (const void *data, size_t data_len)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(),
- (int) data_len, (const char *) data, data_len);
+ log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\", size_t=%llu)",
+ m_opaque_sp.get(),
+ (int) data_len,
+ (const char *) data,
+ (uint64_t)data_len);
if (m_opaque_sp)
m_opaque_sp->DispatchInput ((const char *) data, data_len);
Modified: lldb/branches/windows/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBFileSpec.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBFileSpec.cpp (original)
+++ lldb/branches/windows/source/API/SBFileSpec.cpp Tue Sep 18 13:57:46 2012
@@ -154,8 +154,8 @@
result = m_opaque_ap->GetPath (dst_path, dst_len);
if (log)
- log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%zu) => %u",
- m_opaque_ap.get(), result, dst_path, dst_len, result);
+ log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%llu) => %u",
+ m_opaque_ap.get(), result, dst_path, (uint64_t)dst_len, result);
if (result == 0 && dst_path && dst_len > 0)
*dst_path = '\0';
Modified: lldb/branches/windows/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBFrame.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBFrame.cpp (original)
+++ lldb/branches/windows/source/API/SBFrame.cpp Tue Sep 18 13:57:46 2012
@@ -1082,17 +1082,14 @@
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, fetch_dynamic_value, frame_description.GetString().c_str());
#endif
- const bool coerce_to_id = false;
- const bool keep_in_memory = false;
-
+ Target::EvaluateExpressionOptions options;
+ options.SetUnwindOnError(unwind_on_error)
+ .SetUseDynamic(fetch_dynamic_value);
+
exe_results = target->EvaluateExpression (expr,
frame,
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- fetch_dynamic_value,
- expr_value_sp);
+ expr_value_sp,
+ options);
expr_result.SetSP(expr_value_sp);
#ifdef LLDB_CONFIGURATION_DEBUG
Host::SetCrashDescription (NULL);
Modified: lldb/branches/windows/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBProcess.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBProcess.cpp (original)
+++ lldb/branches/windows/source/API/SBProcess.cpp Tue Sep 18 13:57:46 2012
@@ -310,8 +310,12 @@
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%zu) => %zu",
- process_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
+ log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%llu) => %llu",
+ process_sp.get(),
+ (int) bytes_read,
+ dst,
+ (uint64_t)dst_len,
+ (uint64_t)bytes_read);
return bytes_read;
}
@@ -329,8 +333,12 @@
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%zu) => %zu",
- process_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
+ log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%llu) => %llu",
+ process_sp.get(),
+ (int) bytes_read,
+ dst,
+ (uint64_t)dst_len,
+ (uint64_t)bytes_read);
return bytes_read;
}
@@ -850,11 +858,11 @@
if (log)
{
- log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p))...",
+ log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%llu, SBError (%p))...",
process_sp.get(),
addr,
dst,
- dst_len,
+ (uint64_t)dst_len,
sb_error.get());
}
@@ -882,14 +890,14 @@
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p): %s) => %zu",
+ log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%llu, SBError (%p): %s) => %llu",
process_sp.get(),
addr,
dst,
- dst_len,
+ (uint64_t)dst_len,
sb_error.get(),
sstr.GetData(),
- bytes_read);
+ (uint64_t)bytes_read);
}
return bytes_read;
@@ -990,11 +998,11 @@
if (log)
{
- log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...",
+ log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, src_len=%llu, SBError (%p))...",
process_sp.get(),
addr,
src,
- src_len,
+ (uint64_t)src_len,
sb_error.get());
}
@@ -1018,14 +1026,14 @@
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p): %s) => %zu",
+ log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, src_len=%llu, SBError (%p): %s) => %llu",
process_sp.get(),
addr,
src,
- src_len,
+ (uint64_t)src_len,
sb_error.get(),
sstr.GetData(),
- bytes_written);
+ (uint64_t)bytes_written);
}
return bytes_written;
Modified: lldb/branches/windows/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTarget.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTarget.cpp (original)
+++ lldb/branches/windows/source/API/SBTarget.cpp Tue Sep 18 13:57:46 2012
@@ -957,10 +957,13 @@
attach_info.SetUserID(instance_info.GetEffectiveUserID());
}
error.SetError (process_sp->Attach (attach_info));
- // If we are doing synchronous mode, then wait for the
- // process to stop!
- if (target_sp->GetDebugger().GetAsyncExecution () == false)
+ if (error.Success())
+ {
+ // If we are doing synchronous mode, then wait for the
+ // process to stop!
+ if (target_sp->GetDebugger().GetAsyncExecution () == false)
process_sp->WaitForProcessToStop (NULL);
+ }
}
else
{
Modified: lldb/branches/windows/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBThread.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBThread.cpp (original)
+++ lldb/branches/windows/source/API/SBThread.cpp Tue Sep 18 13:57:46 2012
@@ -625,7 +625,7 @@
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
- bool stop_other_threads = true;
+ bool stop_other_threads = false;
Thread *thread = exe_ctx.GetThreadPtr();
@@ -661,7 +661,7 @@
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
- bool stop_other_threads = true;
+ bool stop_other_threads = false;
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlan *new_plan = thread->QueueThreadPlanForStepOut (abort_other_plans,
@@ -765,7 +765,6 @@
return sb_error;
}
- StackFrameSP frame_sp;
if (!frame_sp)
{
frame_sp = thread->GetSelectedFrame ();
@@ -819,7 +818,7 @@
std::vector<addr_t> step_over_until_addrs;
const bool abort_other_plans = false;
- const bool stop_other_threads = true;
+ const bool stop_other_threads = false;
const bool check_inlines = true;
const bool exact = false;
@@ -877,6 +876,29 @@
return sb_error;
}
+SBError
+SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
+{
+ SBError sb_error;
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+
+ if (log)
+ log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID());
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
+ }
+
+ return sb_error;
+}
+
bool
SBThread::Suspend()
Modified: lldb/branches/windows/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBValue.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBValue.cpp (original)
+++ lldb/branches/windows/source/API/SBValue.cpp Tue Sep 18 13:57:46 2012
@@ -206,7 +206,7 @@
}
if (log)
- log->Printf ("SBValue(%p)::GetByteSize () => %zu", value_sp.get(), result);
+ log->Printf ("SBValue(%p)::GetByteSize () => %llu", value_sp.get(), (uint64_t)result);
return result;
}
@@ -732,14 +732,12 @@
Target* target = exe_ctx.GetTargetPtr();
if (target)
{
+ Target::EvaluateExpressionOptions options;
+ options.SetKeepInMemory(true);
target->EvaluateExpression (expression,
exe_ctx.GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- false, // coerce to id
- true, // unwind on error
- true, // keep in memory
- eNoDynamicValues,
- new_value_sp);
+ new_value_sp,
+ options);
if (new_value_sp)
{
new_value_sp->SetName(ConstString(name));
Modified: lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/Breakpoint.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/Breakpoint.cpp Tue Sep 18 13:57:46 2012
@@ -525,9 +525,9 @@
case lldb::eDescriptionLevelFull:
if (num_locations > 0)
{
- s->Printf(", locations = %zu", num_locations);
+ s->Printf(", locations = %llu", (uint64_t)num_locations);
if (num_resolved_locations > 0)
- s->Printf(", resolved = %zu", num_resolved_locations);
+ s->Printf(", resolved = %llu", (uint64_t)num_resolved_locations);
}
else
{
Modified: lldb/branches/windows/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointLocationList.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointLocationList.cpp Tue Sep 18 13:57:46 2012
@@ -128,7 +128,7 @@
s->Printf("%p: ", this);
//s->Indent();
Mutex::Locker locker (m_mutex);
- s->Printf("BreakpointLocationList with %zu BreakpointLocations:\n", m_locations.size());
+ s->Printf("BreakpointLocationList with %llu BreakpointLocations:\n", (uint64_t)m_locations.size());
s->IndentMore();
collection::const_iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
Modified: lldb/branches/windows/source/Breakpoint/WatchpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/WatchpointList.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/WatchpointList.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/WatchpointList.cpp Tue Sep 18 13:57:46 2012
@@ -51,8 +51,8 @@
Mutex::Locker locker (m_mutex);
s->Printf("%p: ", this);
//s->Indent();
- s->Printf("WatchpointList with %zu Watchpoints:\n",
- m_watchpoints.size());
+ s->Printf("WatchpointList with %llu Watchpoints:\n",
+ (uint64_t)m_watchpoints.size());
s->IndentMore();
wp_collection::const_iterator pos, end = m_watchpoints.end();
for (pos = m_watchpoints.begin(); pos != end; ++pos)
Modified: lldb/branches/windows/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectArgs.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectArgs.cpp Tue Sep 18 13:57:46 2012
@@ -266,6 +266,6 @@
CommandObjectArgs::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
- { 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp Tue Sep 18 13:57:46 2012
@@ -609,16 +609,16 @@
OptionDefinition
CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, NULL, eArgTypeOneLiner,
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, 0, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, NULL, eArgTypeBoolean,
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, 0, eArgTypeBoolean,
"Specify whether breakpoint command execution should terminate on error." },
- { LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, NULL, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, 0, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
- { LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, NULL, eArgTypePythonFunction,
+ { LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, 0, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
Modified: lldb/branches/windows/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectExpression.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectExpression.cpp Tue Sep 18 13:57:46 2012
@@ -298,15 +298,17 @@
break;
}
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(m_command_options.print_object)
+ .SetUnwindOnError(m_command_options.unwind_on_error)
+ .SetKeepInMemory(keep_in_memory)
+ .SetUseDynamic(use_dynamic)
+ .SetSingleThreadTimeoutUsec(0);
+
exe_results = target->EvaluateExpression (expr,
m_interpreter.GetExecutionContext().GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- m_command_options.print_object,
- m_command_options.unwind_on_error,
- keep_in_memory,
- use_dynamic,
result_valobj_sp,
- 0 /* no timeout */);
+ options);
if (exe_results == eExecutionInterrupted && !m_command_options.unwind_on_error)
{
Modified: lldb/branches/windows/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectFrame.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectFrame.cpp Tue Sep 18 13:57:46 2012
@@ -307,7 +307,7 @@
CommandObjectFrameSelect::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "relative", 'r', required_argument, NULL, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."},
-{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
+{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
#pragma mark CommandObjectFrameVariable
Modified: lldb/branches/windows/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectMemory.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectMemory.cpp Tue Sep 18 13:57:46 2012
@@ -703,7 +703,7 @@
}
else
{
- result.AppendErrorWithFormat("Failed to write %zu bytes to '%s'.\n", bytes_read, path);
+ result.AppendErrorWithFormat("Failed to write %llu bytes to '%s'.\n", (uint64_t)bytes_read, path);
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -1042,13 +1042,13 @@
if (bytes_written == length)
{
// All bytes written
- result.GetOutputStream().Printf("%zu bytes were written to 0x%llx\n", bytes_written, addr);
+ result.GetOutputStream().Printf("%llu bytes were written to 0x%llx\n", (uint64_t)bytes_written, addr);
result.SetStatus(eReturnStatusSuccessFinishResult);
}
else if (bytes_written > 0)
{
// Some byte written
- result.GetOutputStream().Printf("%zu bytes of %zu requested were written to 0x%llx\n", bytes_written, length, addr);
+ result.GetOutputStream().Printf("%llu bytes of %llu requested were written to 0x%llx\n", (uint64_t)bytes_written, (uint64_t)length, addr);
result.SetStatus(eReturnStatusSuccessFinishResult);
}
else
Modified: lldb/branches/windows/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectProcess.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectProcess.cpp Tue Sep 18 13:57:46 2012
@@ -630,12 +630,13 @@
if (!old_arch_spec.IsValid())
{
- result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetArchitectureName());
+ result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetTriple().getTriple().c_str());
}
else if (old_arch_spec != target->GetArchitecture())
{
result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
- old_arch_spec.GetArchitectureName(), target->GetArchitecture().GetArchitectureName());
+ old_arch_spec.GetTriple().getTriple().c_str(),
+ target->GetArchitecture().GetTriple().getTriple().c_str());
}
// This supports the use-case scenario of immediately continuing the process once attached.
@@ -792,14 +793,17 @@
}
}
- const uint32_t num_threads = process->GetThreadList().GetSize();
+ { // Scope for thread list mutex:
+ Mutex::Locker locker (process->GetThreadList().GetMutex());
+ const uint32_t num_threads = process->GetThreadList().GetSize();
- // Set the actions that the threads should each take when resuming
- for (uint32_t idx=0; idx<num_threads; ++idx)
- {
- process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
+ // Set the actions that the threads should each take when resuming
+ for (uint32_t idx=0; idx<num_threads; ++idx)
+ {
+ process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
+ }
}
-
+
Error error(process->Resume());
if (error.Success())
{
Modified: lldb/branches/windows/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectSettings.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectSettings.cpp Tue Sep 18 13:57:46 2012
@@ -292,7 +292,7 @@
OptionDefinition
CommandObjectSettingsSet::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_2, false, "global", 'g', no_argument, NULL, NULL, eArgTypeNone, "Apply the new value to the global default value." },
+ { LLDB_OPT_SET_2, false, "global", 'g', no_argument, NULL, 0, eArgTypeNone, "Apply the new value to the global default value." },
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectTarget.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectTarget.cpp Tue Sep 18 13:57:46 2012
@@ -3886,22 +3886,22 @@
OptionDefinition
CommandObjectTargetModulesLookup::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, true, "address", 'a', required_argument, NULL, 0, eArgTypeAddress, "Lookup an address in one or more target modules."},
- { LLDB_OPT_SET_1, false, "offset", 'o', required_argument, NULL, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
+ { LLDB_OPT_SET_1, true, "address", 'a', required_argument, NULL, 0, eArgTypeAddress, "Lookup an address in one or more target modules."},
+ { LLDB_OPT_SET_1, false, "offset", 'o', required_argument, NULL, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
{ LLDB_OPT_SET_2| LLDB_OPT_SET_4 | LLDB_OPT_SET_5
/* FIXME: re-enable this for types when the LookupTypeInModule actually uses the regex option: | LLDB_OPT_SET_6 */ ,
- false, "regex", 'r', no_argument, NULL, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
- { LLDB_OPT_SET_2, true, "symbol", 's', required_argument, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."},
- { LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."},
- { LLDB_OPT_SET_3, false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
+ false, "regex", 'r', no_argument, NULL, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
+ { LLDB_OPT_SET_2, true, "symbol", 's', required_argument, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."},
+ { LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."},
+ { LLDB_OPT_SET_3, false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
{ LLDB_OPT_SET_FROM_TO(3,5),
- false, "no-inlines", 'i', no_argument, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."},
- { LLDB_OPT_SET_4, true, "function", 'F', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."},
- { LLDB_OPT_SET_5, true, "name", 'n', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function or symbol by name in one or more target modules."},
- { LLDB_OPT_SET_6, true, "type", 't', required_argument, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."},
- { LLDB_OPT_SET_ALL, false, "verbose", 'v', no_argument, NULL, 0, eArgTypeNone, "Enable verbose lookup information."},
- { LLDB_OPT_SET_ALL, false, "all", 'A', no_argument, NULL, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."},
- { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+ false, "no-inlines", 'i', no_argument, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."},
+ { LLDB_OPT_SET_4, true, "function", 'F', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."},
+ { LLDB_OPT_SET_5, true, "name", 'n', required_argument, NULL, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."},
+ { LLDB_OPT_SET_6, true, "type", 't', required_argument, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."},
+ { LLDB_OPT_SET_ALL, false, "verbose", 'v', no_argument, NULL, 0, eArgTypeNone, "Enable verbose lookup information."},
+ { LLDB_OPT_SET_ALL, false, "all", 'A', no_argument, NULL, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."},
+ { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -4040,12 +4040,21 @@
}
else
{
+ PlatformSP platform_sp (target->GetPlatform());
+
for (size_t i=0; i<argc; ++i)
{
const char *symfile_path = args.GetArgumentAtIndex(i);
if (symfile_path)
{
- FileSpec symfile_spec(symfile_path, true);
+ ModuleSpec sym_spec;
+ FileSpec symfile_spec;
+ sym_spec.GetSymbolFileSpec().SetFile(symfile_path, true);
+ if (platform_sp)
+ platform_sp->ResolveSymbolFile(*target, sym_spec, symfile_spec);
+ else
+ symfile_spec.SetFile(symfile_path, true);
+
ArchSpec arch;
if (symfile_spec.Exists())
{
@@ -4561,17 +4570,17 @@
OptionDefinition
CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "one-liner", 'o', required_argument, NULL, NULL, eArgTypeOneLiner,
+ { LLDB_OPT_SET_ALL, false, "one-liner", 'o', required_argument, NULL, 0, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
{ LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName,
"Set the module within which the stop-hook is to be run."},
- { LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, NULL, eArgTypeThreadIndex,
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, 0, eArgTypeThreadIndex,
"The stop hook is run only for the thread whose index matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-id", 't', required_argument, NULL, NULL, eArgTypeThreadID,
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', required_argument, NULL, 0, eArgTypeThreadID,
"The stop hook is run only for the thread whose TID matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread-name", 'T', required_argument, NULL, NULL, eArgTypeThreadName,
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', required_argument, NULL, 0, eArgTypeThreadName,
"The stop hook is run only for the thread whose thread name matches this argument."},
- { LLDB_OPT_SET_ALL, false, "queue-name", 'q', required_argument, NULL, NULL, eArgTypeQueueName,
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', required_argument, NULL, 0, eArgTypeQueueName,
"The stop hook is run only for threads in the queue whose name is given by this argument."},
{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,
"Specify the source file within which the stop-hook is to be run." },
@@ -4579,7 +4588,7 @@
"Set the start of the line range for which the stop-hook is to be run."},
{ LLDB_OPT_SET_1, false, "end-line", 'e', required_argument, NULL, 0, eArgTypeLineNum,
"Set the end of the line range for which the stop-hook is to be run."},
- { LLDB_OPT_SET_2, false, "classname", 'c', required_argument, NULL, NULL, eArgTypeClassName,
+ { LLDB_OPT_SET_2, false, "classname", 'c', required_argument, NULL, 0, eArgTypeClassName,
"Specify the class within which the stop-hook is to be run." },
{ LLDB_OPT_SET_3, false, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,
"Set the function name within which the stop hook will be run." },
Modified: lldb/branches/windows/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectThread.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectThread.cpp Tue Sep 18 13:57:46 2012
@@ -13,6 +13,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/lldb-private.h"
#include "lldb/Core/State.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Host/Host.h"
@@ -185,6 +186,7 @@
else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+ Mutex::Locker locker (process->GetThreadList().GetMutex());
uint32_t num_threads = process->GetThreadList().GetSize();
for (uint32_t i = 0; i < num_threads; i++)
{
@@ -208,6 +210,7 @@
{
uint32_t num_args = command.GetArgumentCount();
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+ Mutex::Locker locker (process->GetThreadList().GetMutex());
std::vector<ThreadSP> thread_sps;
for (uint32_t i = 0; i < num_args; i++)
@@ -446,6 +449,13 @@
bool bool_stop_other_threads;
if (m_options.m_run_mode == eAllThreads)
bool_stop_other_threads = false;
+ else if (m_options.m_run_mode == eOnlyDuringStepping)
+ {
+ if (m_step_type == eStepTypeOut)
+ bool_stop_other_threads = false;
+ else
+ bool_stop_other_threads = true;
+ }
else
bool_stop_other_threads = true;
@@ -1051,7 +1061,7 @@
&address_list.front(),
address_list.size(),
m_options.m_stop_others,
- thread->GetSelectedFrameIndex ());
+ m_options.m_frame_idx);
// User level plans should be master plans so they can be interrupted (e.g. by hitting a breakpoint)
// and other plans executed by the user (stepping around the breakpoint) and then a "continue"
// will resume the original plan.
@@ -1242,6 +1252,107 @@
}
};
+class CommandObjectThreadReturn : public CommandObjectRaw
+{
+public:
+ CommandObjectThreadReturn (CommandInterpreter &interpreter) :
+ CommandObjectRaw (interpreter,
+ "thread return",
+ "Return from the currently selected frame, short-circuiting execution of the frames below it, with an optional return value.",
+ "thread return",
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+ {
+ CommandArgumentEntry arg;
+ CommandArgumentData expression_arg;
+
+ // Define the first (and only) variant of this arg.
+ expression_arg.arg_type = eArgTypeExpression;
+ expression_arg.arg_repetition = eArgRepeatPlain;
+
+ // There is only one variant this argument could be; put it into the argument entry.
+ arg.push_back (expression_arg);
+
+ // Push the data for the first argument into the m_arguments vector.
+ m_arguments.push_back (arg);
+
+
+ }
+
+ ~CommandObjectThreadReturn()
+ {
+ }
+
+protected:
+
+ bool DoExecute
+ (
+ const char *command,
+ CommandReturnObject &result
+ )
+ {
+ // If there is a command string, pass it to the expression parser:
+ ExecutionContext exe_ctx = m_interpreter.GetExecutionContext();
+ if (!(exe_ctx.HasProcessScope() && exe_ctx.HasThreadScope() && exe_ctx.HasFrameScope()))
+ {
+ result.AppendError("Must have selected process, thread and frame for thread return.");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+
+ ValueObjectSP return_valobj_sp;
+
+ StackFrameSP frame_sp = exe_ctx.GetFrameSP();
+ uint32_t frame_idx = frame_sp->GetFrameIndex();
+
+ if (frame_sp->IsInlined())
+ {
+ result.AppendError("Don't know how to return from inlined frames.");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+
+ if (command && command[0] != '\0')
+ {
+ Target *target = exe_ctx.GetTargetPtr();
+ Target::EvaluateExpressionOptions options;
+
+ options.SetUnwindOnError(true);
+ options.SetUseDynamic(eNoDynamicValues);
+
+ ExecutionResults exe_results = eExecutionSetupError;
+ exe_results = target->EvaluateExpression (command,
+ frame_sp.get(),
+ return_valobj_sp,
+ options);
+ if (exe_results != eExecutionCompleted)
+ {
+ if (return_valobj_sp)
+ result.AppendErrorWithFormat("Error evaluating result expression: %s", return_valobj_sp->GetError().AsCString());
+ else
+ result.AppendErrorWithFormat("Unknown error evaluating result expression.");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+
+ }
+ }
+
+ Error error;
+ ThreadSP thread_sp = exe_ctx.GetThreadSP();
+ error = thread_sp->ReturnFromFrame (frame_sp, return_valobj_sp);
+ if (!error.Success())
+ {
+ result.AppendErrorWithFormat("Error returning from frame %d of thread %d: %s.", frame_idx, thread_sp->GetIndexID(), error.AsCString());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+
+ thread_sp->GetStatus(result.GetOutputStream(), 0, 1, 1);
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ return true;
+ }
+
+};
+
//-------------------------------------------------------------------------
// CommandObjectMultiwordThread
//-------------------------------------------------------------------------
@@ -1255,6 +1366,7 @@
LoadSubCommand ("backtrace", CommandObjectSP (new CommandObjectThreadBacktrace (interpreter)));
LoadSubCommand ("continue", CommandObjectSP (new CommandObjectThreadContinue (interpreter)));
LoadSubCommand ("list", CommandObjectSP (new CommandObjectThreadList (interpreter)));
+ LoadSubCommand ("return", CommandObjectSP (new CommandObjectThreadReturn (interpreter)));
LoadSubCommand ("select", CommandObjectSP (new CommandObjectThreadSelect (interpreter)));
LoadSubCommand ("until", CommandObjectSP (new CommandObjectThreadUntil (interpreter)));
LoadSubCommand ("step-in", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
Modified: lldb/branches/windows/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectWatchpoint.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectWatchpoint.cpp Tue Sep 18 13:57:46 2012
@@ -743,7 +743,7 @@
OptionDefinition
CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', required_argument, NULL, NULL, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
+ { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', required_argument, NULL, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -906,7 +906,7 @@
OptionDefinition
CommandObjectWatchpointModify::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "condition", 'c', required_argument, NULL, NULL, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
+{ LLDB_OPT_SET_ALL, false, "condition", 'c', required_argument, NULL, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
{ 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -970,6 +970,21 @@
}
protected:
+ static uint32_t GetVariableCallback (void *baton,
+ const char *name,
+ VariableList &variable_list)
+ {
+ Target *target = static_cast<Target *>(baton);
+ if (target)
+ {
+ return target->GetImages().FindGlobalVariables (ConstString(name),
+ true,
+ UINT32_MAX,
+ variable_list);
+ }
+ return 0;
+ }
+
virtual bool
DoExecute (Args& command,
CommandReturnObject &result)
@@ -1023,6 +1038,24 @@
expr_path_options,
var_sp,
error);
+
+ if (!valobj_sp) {
+ // Not in the frame; let's check the globals.
+
+ VariableList variable_list;
+ ValueObjectList valobj_list;
+
+ Error error (Variable::GetValuesForVariableExpressionPath (command.GetArgumentAtIndex(0),
+ exe_ctx.GetBestExecutionContextScope(),
+ GetVariableCallback,
+ target,
+ variable_list,
+ valobj_list));
+
+ if (valobj_list.GetSize())
+ valobj_sp = valobj_list.GetValueObjectAtIndex(0);
+ }
+
if (valobj_sp) {
AddressType addr_type;
addr = valobj_sp->GetAddressOf(false, &addr_type);
@@ -1201,18 +1234,16 @@
}
// Use expression evaluation to arrive at the address to watch.
- const bool coerce_to_id = true;
- const bool unwind_on_error = true;
- const bool keep_in_memory = false;
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(false)
+ .SetSingleThreadTimeoutUsec(0);
+
ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(),
frame,
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- eNoDynamicValues,
valobj_sp,
- 0 /* no timeout */);
+ options);
if (expr_result != eExecutionCompleted) {
result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n");
result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str());
Modified: lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp Tue Sep 18 13:57:46 2012
@@ -599,16 +599,16 @@
OptionDefinition
CommandObjectWatchpointCommandAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, NULL, eArgTypeOneLiner,
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, 0, eArgTypeOneLiner,
"Specify a one-line watchpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, NULL, eArgTypeBoolean,
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, 0, eArgTypeBoolean,
"Specify whether watchpoint command execution should terminate on error." },
- { LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, NULL, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, 0, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
- { LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, NULL, eArgTypePythonFunction,
+ { LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, 0, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this watchpoint. Be sure to give a module name if appropriate."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
Modified: lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp (original)
+++ lldb/branches/windows/source/Core/CXXFormatterFunctions.cpp Tue Sep 18 13:57:46 2012
@@ -13,8 +13,12 @@
#define CLANG_NEEDS_THESE_ONE_DAY
#include "clang/Basic/ConvertUTF.h"
+#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Host/Endian.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
@@ -23,10 +27,10 @@
using namespace lldb_private::formatters;
bool
-lldb_private::formatters::CodeRunning_Fetcher (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- uint64_t &value)
+lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ uint64_t &value)
{
if (!target_type || !*target_type)
return false;
@@ -42,23 +46,98 @@
StackFrame* stack_frame = exe_ctx.GetFramePtr();
if (!target || !stack_frame)
return false;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
target->EvaluateExpression(expr.GetData(),
stack_frame,
- eExecutionPolicyOnlyWhenNeeded,
- false,
- true,
- true,
- lldb::eDynamicCanRunTarget,
- result_sp);
+ result_sp,
+ options);
if (!result_sp)
return false;
value = result_sp->GetValueAsUnsigned(0);
return true;
}
+lldb::ValueObjectSP
+lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ uint64_t index)
+{
+ lldb::ValueObjectSP valobj_sp;
+ if (!return_type || !*return_type)
+ return valobj_sp;
+ if (!selector || !*selector)
+ return valobj_sp;
+ StreamString expr_path_stream;
+ valobj.GetExpressionPath(expr_path_stream, false);
+ StreamString expr;
+ expr.Printf("(%s)[%s %s:%lld]",return_type,expr_path_stream.GetData(),selector,index);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = exe_ctx.GetFramePtr();
+ if (!target || !stack_frame)
+ return valobj_sp;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ valobj_sp,
+ options);
+ return valobj_sp;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ const char* key)
+{
+ lldb::ValueObjectSP valobj_sp;
+ if (!return_type || !*return_type)
+ return valobj_sp;
+ if (!selector || !*selector)
+ return valobj_sp;
+ if (!key || !*key)
+ return valobj_sp;
+ StreamString expr_path_stream;
+ valobj.GetExpressionPath(expr_path_stream, false);
+ StreamString expr;
+ expr.Printf("(%s)[%s %s:%s]",return_type,expr_path_stream.GetData(),selector,key);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = exe_ctx.GetFramePtr();
+ if (!target || !stack_frame)
+ return valobj_sp;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ valobj_sp,
+ options);
+ return valobj_sp;
+}
+
template<bool name_entries>
bool
-lldb_private::formatters::NSDictionary_SummaryProvider (ValueObject& valobj, Stream& stream)
+lldb_private::formatters::NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream)
{
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
@@ -112,7 +191,7 @@
}
else
{
- if (!CodeRunning_Fetcher(valobj, "int", "count", value))
+ if (!ExtractValueFromObjCExpression(valobj, "int", "count", value))
return false;
}
@@ -125,7 +204,7 @@
}
bool
-lldb_private::formatters::NSArray_SummaryProvider (ValueObject& valobj, Stream& stream)
+lldb_private::formatters::NSArraySummaryProvider (ValueObject& valobj, Stream& stream)
{
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
@@ -174,7 +253,7 @@
}
else
{
- if (!CodeRunning_Fetcher(valobj, "int", "count", value))
+ if (!ExtractValueFromObjCExpression(valobj, "int", "count", value))
return false;
}
@@ -186,7 +265,7 @@
template<bool needs_at>
bool
-lldb_private::formatters::NSData_SummaryProvider (ValueObject& valobj, Stream& stream)
+lldb_private::formatters::NSDataSummaryProvider (ValueObject& valobj, Stream& stream)
{
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
@@ -223,7 +302,7 @@
}
else
{
- if (!CodeRunning_Fetcher(valobj, "int", "length", value))
+ if (!ExtractValueFromObjCExpression(valobj, "int", "length", value))
return false;
}
@@ -237,7 +316,7 @@
}
bool
-lldb_private::formatters::NSNumber_SummaryProvider (ValueObject& valobj, Stream& stream)
+lldb_private::formatters::NSNumberSummaryProvider (ValueObject& valobj, Stream& stream)
{
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
@@ -353,7 +432,7 @@
}
else
{
- // similar to CodeRunning_Fetcher but uses summary instead of value
+ // similar to ExtractValueFromObjCExpression but uses summary instead of value
StreamString expr_path_stream;
valobj.GetExpressionPath(expr_path_stream, false);
StreamString expr;
@@ -364,14 +443,17 @@
StackFrame* stack_frame = exe_ctx.GetFramePtr();
if (!target || !stack_frame)
return false;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
target->EvaluateExpression(expr.GetData(),
stack_frame,
- eExecutionPolicyOnlyWhenNeeded,
- false,
- true,
- true,
- lldb::eDynamicCanRunTarget,
- result_sp);
+ result_sp,
+ options);
if (!result_sp)
return false;
stream.Printf("%s",result_sp->GetSummaryAsCString());
@@ -380,7 +462,7 @@
}
bool
-lldb_private::formatters::NSString_SummaryProvider (ValueObject& valobj, Stream& stream)
+lldb_private::formatters::NSStringSummaryProvider (ValueObject& valobj, Stream& stream)
{
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
@@ -666,14 +748,651 @@
return true;
}
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+SyntheticChildrenFrontEnd(*valobj_sp.get()),
+m_exe_ctx_ref(),
+m_ptr_size(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_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
+}
+
+uint32_t
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren ()
+{
+ if (m_data_32)
+ return m_data_32->_used;
+ if (m_data_64)
+ return m_data_64->_used;
+ return 0;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ if (!m_data_32 && !m_data_64)
+ return lldb::ValueObjectSP();
+ if (idx >= CalculateNumChildren())
+ return lldb::ValueObjectSP();
+ lldb::addr_t object_at_idx = (m_data_32 ? m_data_32->_data : m_data_64->_data);
+ object_at_idx += (idx * m_ptr_size);
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ lldb::ValueObjectSP retval_sp = ValueObject::CreateValueObjectFromAddress(idx_name.GetData(),
+ object_at_idx,
+ m_exe_ctx_ref,
+ m_id_type);
+ m_children.push_back(retval_sp);
+ return retval_sp;
+}
+
+bool
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::Update()
+{
+ m_children.clear();
+ return false;
+}
+
+static uint32_t
+ExtractIndexFromString (const char* item_name)
+{
+ if (!item_name || !*item_name)
+ return UINT32_MAX;
+ if (*item_name != '[')
+ return UINT32_MAX;
+ item_name++;
+ uint32_t idx = 0;
+ while(*item_name)
+ {
+ char x = *item_name;
+ if (x == ']')
+ break;
+ if (x < '0' || x > '9')
+ return UINT32_MAX;
+ idx = 10*idx + (x-'0');
+ item_name++;
+ }
+ return idx;
+}
+
+uint32_t
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ if (!m_data_32 && !m_data_64)
+ return UINT32_MAX;
+ const char* item_name = name.GetCString();
+ uint32_t idx = ExtractIndexFromString(item_name);
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+ return UINT32_MAX;
+ return idx;
+}
+
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::~NSArrayMSyntheticFrontEnd ()
+{
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+}
+
+lldb_private::formatters::NSArrayISyntheticFrontEnd::NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+SyntheticChildrenFrontEnd(*valobj_sp.get()),
+m_exe_ctx_ref(),
+m_ptr_size(8),
+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())
+ {
+ 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;
+ 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 ()
+{
+}
+
+uint32_t
+lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ const char* item_name = name.GetCString();
+ uint32_t idx = ExtractIndexFromString(item_name);
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+ return UINT32_MAX;
+ return idx;
+}
+
+uint32_t
+lldb_private::formatters::NSArrayISyntheticFrontEnd::CalculateNumChildren ()
+{
+ return m_items;
+}
+
+bool
+lldb_private::formatters::NSArrayISyntheticFrontEnd::Update()
+{
+ m_children.clear();
+ return false;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ if (idx >= CalculateNumChildren())
+ return lldb::ValueObjectSP();
+ lldb::addr_t object_at_idx = m_data_ptr;
+ object_at_idx += (idx * m_ptr_size);
+ ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+ if (!process_sp)
+ return lldb::ValueObjectSP();
+ Error error;
+ object_at_idx = process_sp->ReadPointerFromMemory(object_at_idx, error);
+ if (error.Fail())
+ return lldb::ValueObjectSP();
+ StreamString expr;
+ expr.Printf("(id)%llu",object_at_idx);
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ lldb::ValueObjectSP retval_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
+ m_children.push_back(retval_sp);
+ return retval_sp;
+}
+
+SyntheticChildrenFrontEnd* lldb_private::formatters::NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
+{
+ lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return NULL;
+ ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
+ if (!runtime)
+ return NULL;
+
+ if (!valobj_sp->IsPointerType())
+ {
+ Error error;
+ valobj_sp = valobj_sp->AddressOf(error);
+ if (error.Fail() || !valobj_sp)
+ return NULL;
+ }
+
+ ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp.get()));
+
+ if (!descriptor.get() || !descriptor->IsValid())
+ return NULL;
+
+ const char* class_name = descriptor->GetClassName().GetCString();
+ if (!strcmp(class_name,"__NSArrayI"))
+ {
+ return (new NSArrayISyntheticFrontEnd(valobj_sp));
+ }
+ else if (!strcmp(class_name,"__NSArrayM"))
+ {
+ return (new NSArrayMSyntheticFrontEnd(valobj_sp));
+ }
+ else
+ {
+ return (new NSArrayCodeRunningSyntheticFrontEnd(valobj_sp));
+ }
+}
+
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::NSArrayCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+SyntheticChildrenFrontEnd(*valobj_sp.get())
+{}
+
+uint32_t
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::CalculateNumChildren ()
+{
+ uint64_t count = 0;
+ if (ExtractValueFromObjCExpression(m_backend, "int", "count", count))
+ return count;
+ return 0;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ lldb::ValueObjectSP valobj_sp = CallSelectorOnObject(m_backend,"id","objectAtIndex:",idx);
+ if (valobj_sp)
+ valobj_sp->SetName(ConstString(idx_name.GetData()));
+ return valobj_sp;
+}
+
+bool
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::Update()
+{
+ return false;
+}
+
+uint32_t
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ return 0;
+}
+
+lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::~NSArrayCodeRunningSyntheticFrontEnd ()
+{}
+
+SyntheticChildrenFrontEnd* lldb_private::formatters::NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
+{
+
+ lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
+ if (!process_sp)
+ return NULL;
+ ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
+ if (!runtime)
+ return NULL;
+
+ if (!valobj_sp->IsPointerType())
+ {
+ Error error;
+ valobj_sp = valobj_sp->AddressOf(error);
+ if (error.Fail() || !valobj_sp)
+ return NULL;
+ }
+
+ ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp.get()));
+
+ if (!descriptor.get() || !descriptor->IsValid())
+ return NULL;
+
+ const char* class_name = descriptor->GetClassName().GetCString();
+ if (!strcmp(class_name,"__NSDictionaryI"))
+ {
+ return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
+ }
+ else if (!strcmp(class_name,"__NSDictionaryM"))
+ {
+ return (new NSDictionaryMSyntheticFrontEnd(valobj_sp));
+ }
+ else
+ {
+ return (new NSDictionaryCodeRunningSyntheticFrontEnd(valobj_sp));
+ }
+}
+
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::NSDictionaryCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+SyntheticChildrenFrontEnd(*valobj_sp.get())
+{}
+
+uint32_t
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::CalculateNumChildren ()
+{
+ uint64_t count = 0;
+ if (ExtractValueFromObjCExpression(m_backend, "int", "count", count))
+ return count;
+ return 0;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ StreamString valobj_expr_path;
+ m_backend.GetExpressionPath(valobj_expr_path, false);
+ StreamString key_fetcher_expr;
+ key_fetcher_expr.Printf("(id)[(NSArray*)[%s allKeys] objectAtIndex:%d]",valobj_expr_path.GetData(),idx);
+ 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());
+ lldb::ValueObjectSP child_sp;
+ m_backend.GetTargetSP()->EvaluateExpression(object_fetcher_expr.GetData(), m_backend.GetFrameSP().get(), child_sp,
+ Target::EvaluateExpressionOptions().SetKeepInMemory(true));
+ if (child_sp)
+ child_sp->SetName(ConstString(idx_name.GetData()));
+ return child_sp;
+}
+
+bool
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::Update()
+{
+ return false;
+}
+
+uint32_t
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ return 0;
+}
+
+lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::~NSDictionaryCodeRunningSyntheticFrontEnd ()
+{}
+
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::NSDictionaryISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+ SyntheticChildrenFrontEnd(*valobj_sp.get()),
+ m_exe_ctx_ref(),
+ m_ptr_size(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;
+}
+
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheticFrontEnd ()
+{
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+}
+
+uint32_t
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ const char* item_name = name.GetCString();
+ uint32_t idx = ExtractIndexFromString(item_name);
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+ return UINT32_MAX;
+ return idx;
+}
+
+uint32_t
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::CalculateNumChildren ()
+{
+ if (!m_data_32 && !m_data_64)
+ return 0;
+ return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update()
+{
+ m_children.clear();
+ return false;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ uint32_t num_children = CalculateNumChildren();
+
+ if (idx >= num_children)
+ return lldb::ValueObjectSP();
+
+ if (m_children.empty())
+ {
+ // do the scan phase
+ lldb::addr_t key_at_idx = 0, val_at_idx = 0;
+
+ uint32_t tries = 0;
+ uint32_t test_idx = 0;
+
+ while(tries < num_children)
+ {
+ key_at_idx = m_data_ptr + (2*test_idx * m_ptr_size);
+ val_at_idx = key_at_idx + m_ptr_size;
+ ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+ if (!process_sp)
+ return lldb::ValueObjectSP();
+ Error error;
+ key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
+ if (error.Fail())
+ return lldb::ValueObjectSP();
+ val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
+ if (error.Fail())
+ return lldb::ValueObjectSP();
+
+ test_idx++;
+
+ if (!key_at_idx || !val_at_idx)
+ continue;
+ tries++;
+
+ DictionaryItemDescriptor descriptor = {key_at_idx,val_at_idx,lldb::ValueObjectSP()};
+
+ m_children.push_back(descriptor);
+ }
+ }
+
+ if (idx >= m_children.size()) // should never happen
+ return lldb::ValueObjectSP();
+
+ DictionaryItemDescriptor &dict_item = m_children[idx];
+ if (!dict_item.valobj_sp)
+ {
+ // 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);
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
+ }
+ return dict_item.valobj_sp;
+}
+
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::NSDictionaryMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+ SyntheticChildrenFrontEnd(*valobj_sp.get()),
+ m_exe_ctx_ref(),
+ m_ptr_size(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;
+}
+
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd ()
+{
+ delete m_data_32;
+ m_data_32 = NULL;
+ delete m_data_64;
+ m_data_64 = NULL;
+}
+
+uint32_t
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+{
+ const char* item_name = name.GetCString();
+ uint32_t idx = ExtractIndexFromString(item_name);
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+ return UINT32_MAX;
+ return idx;
+}
+
+uint32_t
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::CalculateNumChildren ()
+{
+ if (!m_data_32 && !m_data_64)
+ return 0;
+ return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update()
+{
+ m_children.clear();
+ return false;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex (uint32_t idx)
+{
+ lldb::addr_t m_keys_ptr = (m_data_32 ? m_data_32->_keys_addr : m_data_64->_keys_addr);
+ lldb::addr_t m_values_ptr = (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
+
+ uint32_t num_children = CalculateNumChildren();
+
+ if (idx >= num_children)
+ return lldb::ValueObjectSP();
+
+ if (m_children.empty())
+ {
+ // do the scan phase
+ lldb::addr_t key_at_idx = 0, val_at_idx = 0;
+
+ uint32_t tries = 0;
+ uint32_t test_idx = 0;
+
+ while(tries < num_children)
+ {
+ key_at_idx = m_keys_ptr + (test_idx * m_ptr_size);
+ val_at_idx = m_values_ptr + (test_idx * m_ptr_size);;
+ ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+ if (!process_sp)
+ return lldb::ValueObjectSP();
+ Error error;
+ key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
+ if (error.Fail())
+ return lldb::ValueObjectSP();
+ val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
+ if (error.Fail())
+ return lldb::ValueObjectSP();
+
+ test_idx++;
+
+ if (!key_at_idx || !val_at_idx)
+ continue;
+ tries++;
+
+ DictionaryItemDescriptor descriptor = {key_at_idx,val_at_idx,lldb::ValueObjectSP()};
+
+ m_children.push_back(descriptor);
+ }
+ }
+
+ if (idx >= m_children.size()) // should never happen
+ return lldb::ValueObjectSP();
+
+ DictionaryItemDescriptor &dict_item = m_children[idx];
+ if (!dict_item.valobj_sp)
+ {
+ // 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);
+ StreamString idx_name;
+ idx_name.Printf("[%d]",idx);
+ dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
+ }
+ return dict_item.valobj_sp;
+}
+
template bool
-lldb_private::formatters::NSDictionary_SummaryProvider<true> (ValueObject&, Stream&) ;
+lldb_private::formatters::NSDictionarySummaryProvider<true> (ValueObject&, Stream&) ;
template bool
-lldb_private::formatters::NSDictionary_SummaryProvider<false> (ValueObject&, Stream&) ;
+lldb_private::formatters::NSDictionarySummaryProvider<false> (ValueObject&, Stream&) ;
template bool
-lldb_private::formatters::NSData_SummaryProvider<true> (ValueObject&, Stream&) ;
+lldb_private::formatters::NSDataSummaryProvider<true> (ValueObject&, Stream&) ;
template bool
-lldb_private::formatters::NSData_SummaryProvider<false> (ValueObject&, Stream&) ;
+lldb_private::formatters::NSDataSummaryProvider<false> (ValueObject&, Stream&) ;
Modified: lldb/branches/windows/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Communication.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Communication.cpp (original)
+++ lldb/branches/windows/source/Core/Communication.cpp Tue Sep 18 13:57:46 2012
@@ -136,10 +136,10 @@
Communication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status, Error *error_ptr)
{
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
- "%p Communication::Read (dst = %p, dst_len = %zu, timeout = %u usec) connection = %p",
+ "%p Communication::Read (dst = %p, dst_len = %llu, timeout = %u usec) connection = %p",
this,
dst,
- dst_len,
+ (uint64_t)dst_len,
timeout_usec,
m_connection_sp.get());
@@ -210,10 +210,10 @@
Mutex::Locker (m_write_mutex);
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
- "%p Communication::Write (src = %p, src_len = %zu) connection = %p",
+ "%p Communication::Write (src = %p, src_len = %llu) connection = %p",
this,
src,
- src_len,
+ (uint64_t)src_len,
connection_sp.get());
if (connection_sp.get())
@@ -295,8 +295,8 @@
Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast, ConnectionStatus status)
{
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
- "%p Communication::AppendBytesToCache (src = %p, src_len = %zu, broadcast = %i)",
- this, bytes, len, broadcast);
+ "%p Communication::AppendBytesToCache (src = %p, src_len = %llu, broadcast = %i)",
+ this, bytes, (uint64_t)len, broadcast);
if ((bytes == NULL || len == 0)
&& (status != lldb::eConnectionStatusEndOfFile))
return;
Modified: lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp Tue Sep 18 13:57:46 2012
@@ -385,8 +385,8 @@
{
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %zu)...",
- this, m_fd_recv, dst, dst_len);
+ log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %llu)...",
+ this, m_fd_recv, dst, (uint64_t)dst_len);
Mutex::Locker locker;
bool got_lock = locker.TryLock (m_mutex);
@@ -448,12 +448,12 @@
}
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %zu) => %zi, error = %s",
+ log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %llu) => %lli, error = %s",
this,
m_fd_recv,
dst,
- dst_len,
- bytes_read,
+ (uint64_t)dst_len,
+ (int64_t)bytes_read,
error.AsCString());
if (error_ptr)
@@ -512,7 +512,7 @@
{
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %zu)", this, src, src_len);
+ log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %llu)", this, src, (uint64_t)src_len);
if (!IsConnected ())
{
@@ -570,32 +570,32 @@
switch (m_fd_send_type)
{
case eFDTypeFile: // Other FD requireing read/write
- log->Printf ("%p ConnectionFileDescriptor::Write() ::write (fd = %i, src = %p, src_len = %zu) => %zi (error = %s)",
+ log->Printf ("%p ConnectionFileDescriptor::Write() ::write (fd = %i, src = %p, src_len = %llu) => %lli (error = %s)",
this,
m_fd_send,
src,
- src_len,
- bytes_sent,
+ (uint64_t)src_len,
+ (int64_t)bytes_sent,
error.AsCString());
break;
case eFDTypeSocket: // Socket requiring send/recv
- log->Printf ("%p ConnectionFileDescriptor::Write() ::send (socket = %i, src = %p, src_len = %zu, flags = 0) => %zi (error = %s)",
+ log->Printf ("%p ConnectionFileDescriptor::Write() ::send (socket = %i, src = %p, src_len = %llu, flags = 0) => %lli (error = %s)",
this,
m_fd_send,
src,
- src_len,
- bytes_sent,
+ (uint64_t)src_len,
+ (int64_t)bytes_sent,
error.AsCString());
break;
case eFDTypeSocketUDP: // Unconnected UDP socket requiring sendto/recvfrom
- log->Printf ("%p ConnectionFileDescriptor::Write() ::sendto (socket = %i, src = %p, src_len = %zu, flags = 0) => %zi (error = %s)",
+ log->Printf ("%p ConnectionFileDescriptor::Write() ::sendto (socket = %i, src = %p, src_len = %llu, flags = 0) => %lli (error = %s)",
this,
m_fd_send,
src,
- src_len,
- bytes_sent,
+ (uint64_t)src_len,
+ (int64_t)bytes_sent,
error.AsCString());
break;
}
Modified: lldb/branches/windows/source/Core/ConstString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ConstString.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ConstString.cpp (original)
+++ lldb/branches/windows/source/Core/ConstString.cpp Tue Sep 18 13:57:46 2012
@@ -291,7 +291,7 @@
size_t cstr_len = GetLength();
// Only print the parens if we have a non-NULL string
const char *parens = cstr ? "\"" : "";
- s->Printf("%*p: ConstString, string = %s%s%s, length = %zu", (int)sizeof(void*) * 2, this, parens, cstr, parens, cstr_len);
+ s->Printf("%*p: ConstString, string = %s%s%s, length = %llu", (int)sizeof(void*) * 2, this, parens, cstr, parens, (uint64_t)cstr_len);
}
void
Modified: lldb/branches/windows/source/Core/EmulateInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/EmulateInstruction.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/EmulateInstruction.cpp (original)
+++ lldb/branches/windows/source/Core/EmulateInstruction.cpp Tue Sep 18 13:57:46 2012
@@ -361,7 +361,7 @@
size_t length)
{
StreamFile strm (stdout, false);
- strm.Printf (" Read from Memory (address = 0x%llx, length = %zu, context = ", addr, length);
+ strm.Printf (" Read from Memory (address = 0x%llx, length = %llu, context = ", addr, (uint64_t)length);
context.Dump (strm, instruction);
strm.EOL();
*((uint64_t *) dst) = 0xdeadbeef;
@@ -377,7 +377,7 @@
size_t length)
{
StreamFile strm (stdout, false);
- strm.Printf (" Write to Memory (address = 0x%llx, length = %zu, context = ", addr, length);
+ strm.Printf (" Write to Memory (address = 0x%llx, length = %llu, context = ", addr, (uint64_t)length);
context.Dump (strm, instruction);
strm.EOL();
return length;
Modified: lldb/branches/windows/source/Core/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/FormatClasses.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/FormatClasses.cpp (original)
+++ lldb/branches/windows/source/Core/FormatClasses.cpp Tue Sep 18 13:57:46 2012
@@ -277,6 +277,20 @@
}
std::string
+CXXSyntheticChildren::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s Generator at %p - %s\n",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "",
+ m_create_callback,
+ m_description.c_str());
+
+ return sstr.GetString();
+}
+
+std::string
SyntheticArrayView::GetDescription()
{
StreamString sstr;
@@ -310,7 +324,7 @@
m_wrapper_sp(),
m_interpreter(NULL)
{
- if (backend == NULL)
+ if (backend == LLDB_INVALID_UID)
return;
TargetSP target_sp = backend.GetTargetSP();
@@ -329,7 +343,7 @@
}
lldb::ValueObjectSP
-TypeSyntheticImpl::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_create)
+TypeSyntheticImpl::FrontEnd::GetChildAtIndex (uint32_t idx)
{
if (!m_wrapper_sp || !m_interpreter)
return lldb::ValueObjectSP();
Modified: lldb/branches/windows/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/FormatManager.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/FormatManager.cpp (original)
+++ lldb/branches/windows/source/Core/FormatManager.cpp Tue Sep 18 13:57:46 2012
@@ -895,6 +895,7 @@
}
#endif
+#ifndef LLDB_DISABLE_PYTHON
static void
AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
CXXFunctionSummaryFormat::Callback funct,
@@ -906,6 +907,19 @@
category_sp->GetSummaryNavigator()->Add(type_name,
summary_sp);
}
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
+ CXXSyntheticChildren::CreateFrontEndCallback generator,
+ const char* description,
+ ConstString type_name,
+ TypeSyntheticImpl::Flags flags)
+{
+ lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
+ category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
+}
+#endif
void
FormatManager::LoadObjCFormatters()
@@ -1038,15 +1052,43 @@
.SetShowMembersOneLiner(false)
.SetHideItemNames(false);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArray_SummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
-
+ appkit_flags.SetDontShowChildren(false);
+
#ifndef LLDB_DISABLE_PYTHON
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
+
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
+#endif
+ // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags);
+
+ appkit_flags.SetDontShowChildren(true);
+
+#ifndef LLDB_DISABLE_PYTHON
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), TypeSyntheticImpl::Flags());
+
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), TypeSyntheticImpl::Flags());
+
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("CFBagRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("__CFBag"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("const struct __CFBag"), appkit_flags);
@@ -1054,53 +1096,40 @@
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBinaryHeap.CFBinaryHeap_SummaryProvider", ConstString("CFBinaryHeapRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBinaryHeap.CFBinaryHeap_SummaryProvider", ConstString("__CFBinaryHeap"), appkit_flags);
-#endif // LLDB_DISABLE_PYTHON
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionary_SummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
-
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSString_SummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
-#ifndef LLDB_DISABLE_PYTHON
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFAttributedString_SummaryProvider", ConstString("NSAttributedString"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSBundle.NSBundle_SummaryProvider", ConstString("NSBundle"), appkit_flags);
-#endif // LLDB_DISABLE_PYTHON
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSData_SummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
-#ifndef LLDB_DISABLE_PYTHON
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSException.NSException_SummaryProvider", ConstString("NSException"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSMachPort.NSMachPort_SummaryProvider", ConstString("NSMachPort"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSNotification"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSConcreteNotification"), appkit_flags);
-#endif // LLDB_DISABLE_PYTHON
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumber_SummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumber_SummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumber_SummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumber_SummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumber_SummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), 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::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
+ AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
-#ifndef LLDB_DISABLE_PYTHON
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);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFMutableSetRef"), appkit_flags);
Modified: lldb/branches/windows/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Listener.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Listener.cpp (original)
+++ lldb/branches/windows/source/Core/Listener.cpp Tue Sep 18 13:57:46 2012
@@ -270,7 +270,7 @@
EventSP &event_sp,
bool remove)
{
- //LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
Mutex::Locker lock(m_events_mutex);
@@ -292,6 +292,18 @@
if (pos != m_events.end())
{
event_sp = *pos;
+
+ if (log)
+ log->Printf ("%p '%s' Listener::FindNextEventInternal(broadcaster=%p, broadcaster_names=%p[%u], event_type_mask=0x%8.8x, remove=%i) event %p",
+ this,
+ GetName(),
+ broadcaster,
+ broadcaster_names,
+ num_broadcaster_names,
+ event_type_mask,
+ remove,
+ event_sp.get());
+
if (remove)
{
m_events.erase(pos);
@@ -413,14 +425,14 @@
{
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
if (log)
- log->Printf ("%p Listener::WaitForEvents() timed out for %s", this, m_name.c_str());
+ log->Printf ("%p Listener::WaitForEventsInternal() timed out for %s", this, m_name.c_str());
break;
}
else
{
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
if (log)
- log->Printf ("%p Listener::WaitForEvents() unknown error for %s", this, m_name.c_str());
+ log->Printf ("%p Listener::WaitForEventsInternal() unknown error for %s", this, m_name.c_str());
break;
}
}
Modified: lldb/branches/windows/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Mangled.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Mangled.cpp (original)
+++ lldb/branches/windows/source/Core/Mangled.cpp Tue Sep 18 13:57:46 2012
@@ -16,6 +16,8 @@
#include "lldb/Core/cxa_demangle.h"
#else
#ifdef LLDB_LIBCXXABI
+// FreeBSD9-STABLE requires this to know about size_t in cxxabi.h
+#include <cstddef>
#include <cxxabi.h>
#endif
#endif
Modified: lldb/branches/windows/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Module.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Module.cpp (original)
+++ lldb/branches/windows/source/Core/Module.cpp Tue Sep 18 13:57:46 2012
@@ -99,7 +99,7 @@
Mutex::Locker locker (Module::GetAllocationModuleCollectionMutex());
ModuleCollection &modules = GetModuleCollection();
const size_t count = modules.size();
- printf ("%s: %zu modules:\n", __PRETTY_FUNCTION__, count);
+ printf ("%s: %llu modules:\n", __PRETTY_FUNCTION__, (uint64_t)count);
for (size_t i=0; i<count; ++i)
{
Modified: lldb/branches/windows/source/Core/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/RegisterValue.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/RegisterValue.cpp (original)
+++ lldb/branches/windows/source/Core/RegisterValue.cpp Tue Sep 18 13:57:46 2012
@@ -287,9 +287,9 @@
case eEncodingIEEE754:
if (byte_size == sizeof(float))
m_type = eTypeFloat;
- if (byte_size == sizeof(double))
+ else if (byte_size == sizeof(double))
m_type = eTypeDouble;
- if (byte_size == sizeof(long double))
+ else if (byte_size == sizeof(long double))
m_type = eTypeLongDouble;
break;
Modified: lldb/branches/windows/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObject.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObject.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObject.cpp Tue Sep 18 13:57:46 2012
@@ -3990,3 +3990,67 @@
}
return NULL;
}
+
+lldb::ValueObjectSP
+ValueObject::CreateValueObjectFromExpression (const char* name,
+ const char* expression,
+ const ExecutionContext& exe_ctx)
+{
+ lldb::ValueObjectSP retval_sp;
+ lldb::TargetSP target_sp(exe_ctx.GetTargetSP());
+ if (!target_sp)
+ return retval_sp;
+ if (!expression || !*expression)
+ return retval_sp;
+ target_sp->EvaluateExpression (expression,
+ exe_ctx.GetFrameSP().get(),
+ retval_sp);
+ if (retval_sp && name && *name)
+ retval_sp->SetName(ConstString(name));
+ return retval_sp;
+}
+
+lldb::ValueObjectSP
+ValueObject::CreateValueObjectFromAddress (const char* name,
+ uint64_t address,
+ const ExecutionContext& exe_ctx,
+ ClangASTType type)
+{
+ ClangASTType pointer_type(type.GetASTContext(),type.GetPointerType());
+ lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
+ lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
+ pointer_type.GetASTContext(),
+ pointer_type.GetOpaqueQualType(),
+ ConstString(name),
+ buffer,
+ lldb::endian::InlHostByteOrder(),
+ exe_ctx.GetAddressByteSize()));
+ if (ptr_result_valobj_sp)
+ {
+ ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+ Error err;
+ ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
+ if (ptr_result_valobj_sp && name && *name)
+ ptr_result_valobj_sp->SetName(ConstString(name));
+ }
+ return ptr_result_valobj_sp;
+}
+
+lldb::ValueObjectSP
+ValueObject::CreateValueObjectFromData (const char* name,
+ DataExtractor& data,
+ const ExecutionContext& exe_ctx,
+ ClangASTType type)
+{
+ lldb::ValueObjectSP new_value_sp;
+ new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
+ type.GetASTContext() ,
+ type.GetOpaqueQualType(),
+ ConstString(name),
+ data,
+ LLDB_INVALID_ADDRESS);
+ new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
+ if (new_value_sp && name && *name)
+ new_value_sp->SetName(ConstString(name));
+ return new_value_sp;
+}
Modified: lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObjectSyntheticFilter.cpp Tue Sep 18 13:57:46 2012
@@ -19,6 +19,39 @@
using namespace lldb_private;
+class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+ DummySyntheticFrontEnd(ValueObject &backend) :
+ SyntheticChildrenFrontEnd(backend)
+ {}
+
+ uint32_t
+ CalculateNumChildren()
+ {
+ return 0;
+ }
+
+ lldb::ValueObjectSP
+ GetChildAtIndex (uint32_t idx)
+ {
+ return lldb::ValueObjectSP();
+ }
+
+ uint32_t
+ GetIndexOfChildWithName (const ConstString &name)
+ {
+ return UINT32_MAX;
+ }
+
+ bool
+ Update()
+ {
+ return false;
+ }
+
+};
+
ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter) :
ValueObject(parent),
m_synth_sp(filter),
@@ -34,6 +67,8 @@
#else
SetName(parent.GetName());
#endif
+ if (!m_synth_filter_ap.get())
+ m_synth_filter_ap.reset(new DummySyntheticFrontEnd(parent));
}
ValueObjectSynthetic::~ValueObjectSynthetic()
@@ -121,7 +156,7 @@
{
if (can_create && m_synth_filter_ap.get() != NULL)
{
- lldb::ValueObjectSP synth_guy = m_synth_filter_ap->GetChildAtIndex (idx, can_create);
+ lldb::ValueObjectSP synth_guy = m_synth_filter_ap->GetChildAtIndex (idx);
if (!synth_guy)
return synth_guy;
m_children_byindex[idx]= synth_guy.get();
Modified: lldb/branches/windows/source/Core/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/cxa_demangle.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/cxa_demangle.cpp (original)
+++ lldb/branches/windows/source/Core/cxa_demangle.cpp Tue Sep 18 13:57:46 2012
@@ -6915,6 +6915,10 @@
first = t+1;
}
break;
+ case 'T':
+ // Invalid mangled name per
+ // http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html
+ break;
default:
{
// might be named type
Modified: lldb/branches/windows/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangASTSource.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangASTSource.cpp Tue Sep 18 13:57:46 2012
@@ -622,9 +622,11 @@
name.GetCString(),
(name_string ? name_string : "<anonymous>"));
}
-
+
+ clang::ASTContext *type_ast = type_sp->GetClangAST();
+ lldb::clang_type_t full_type = type_sp->GetClangFullType();
- void *copied_type = GuardedCopyType(m_ast_context, type_sp->GetClangAST(), type_sp->GetClangFullType());
+ void *copied_type = GuardedCopyType(m_ast_context, type_ast, full_type);
if (!copied_type)
{
@@ -641,6 +643,87 @@
} while(0);
}
+static void
+FindObjCMethodDeclsWithOrigin (unsigned int current_id,
+ NameSearchContext &context,
+ ObjCInterfaceDecl *original_interface_decl,
+ clang::ASTContext *ast_context,
+ ClangASTImporter *ast_importer,
+ const char *log_info)
+{
+ const DeclarationName &decl_name(context.m_decl_name);
+ clang::ASTContext *original_ctx = &original_interface_decl->getASTContext();
+
+ Selector original_selector;
+
+ if (decl_name.isObjCZeroArgSelector())
+ {
+ IdentifierInfo *ident = &original_ctx->Idents.get(decl_name.getAsString());
+ original_selector = original_ctx->Selectors.getSelector(0, &ident);
+ }
+ else if (decl_name.isObjCOneArgSelector())
+ {
+ const std::string &decl_name_string = decl_name.getAsString();
+ std::string decl_name_string_without_colon(decl_name_string.c_str(), decl_name_string.length() - 1);
+ IdentifierInfo *ident = &original_ctx->Idents.get(decl_name_string_without_colon.c_str());
+ original_selector = original_ctx->Selectors.getSelector(1, &ident);
+ }
+ else
+ {
+ SmallVector<IdentifierInfo *, 4> idents;
+
+ clang::Selector sel = decl_name.getObjCSelector();
+
+ int num_args = sel.getNumArgs();
+
+ for (unsigned i = 0;
+ i != num_args;
+ ++i)
+ {
+ idents.push_back(&original_ctx->Idents.get(sel.getNameForSlot(i)));
+ }
+
+ original_selector = original_ctx->Selectors.getSelector(num_args, idents.data());
+ }
+
+ DeclarationName original_decl_name(original_selector);
+
+ ObjCInterfaceDecl::lookup_result result = original_interface_decl->lookup(original_decl_name);
+
+ if (result.first == result.second)
+ return;
+
+ if (!*result.first)
+ return;
+
+ ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(*result.first);
+
+ if (!result_method)
+ return;
+
+ Decl *copied_decl = ast_importer->CopyDecl(ast_context, &result_method->getASTContext(), result_method);
+
+ if (!copied_decl)
+ return;
+
+ ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
+
+ if (!copied_method_decl)
+ return;
+
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ if (log)
+ {
+ ASTDumper dumper((Decl*)copied_method_decl);
+ log->Printf(" CAS::FOMD[%d] found (%s) %s", current_id, log_info, dumper.GetCString());
+ }
+
+ context.AddNamedDecl(copied_method_decl);
+
+ return;
+}
+
void
ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
{
@@ -669,72 +752,12 @@
ObjCInterfaceDecl *original_interface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl);
- Selector original_selector;
-
- if (decl_name.isObjCZeroArgSelector())
- {
- IdentifierInfo *ident = &original_ctx->Idents.get(decl_name.getAsString());
- original_selector = original_ctx->Selectors.getSelector(0, &ident);
- }
- else if (decl_name.isObjCOneArgSelector())
- {
- const std::string &decl_name_string = decl_name.getAsString();
- std::string decl_name_string_without_colon(decl_name_string.c_str(), decl_name_string.length() - 1);
- IdentifierInfo *ident = &original_ctx->Idents.get(decl_name_string_without_colon.c_str());
- original_selector = original_ctx->Selectors.getSelector(1, &ident);
- }
- else
- {
- SmallVector<IdentifierInfo *, 4> idents;
-
- clang::Selector sel = decl_name.getObjCSelector();
-
- int num_args = sel.getNumArgs();
-
- for (unsigned i = 0;
- i != num_args;
- ++i)
- {
- idents.push_back(&original_ctx->Idents.get(sel.getNameForSlot(i)));
- }
-
- original_selector = original_ctx->Selectors.getSelector(num_args, idents.data());
- }
-
- DeclarationName original_decl_name(original_selector);
-
- ObjCInterfaceDecl::lookup_result result = original_interface_decl->lookup(original_decl_name);
-
- if (result.first == result.second)
- break;
-
- if (!*result.first)
- break;
-
- ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(*result.first);
-
- if (!result_method)
- break;
-
- Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &result_method->getASTContext(), result_method);
-
- if (!copied_decl)
- continue;
-
- ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
-
- if (!copied_method_decl)
- continue;
-
- if (log)
- {
- ASTDumper dumper((Decl*)copied_method_decl);
- log->Printf(" CAS::FOMD[%d] found (in debug info) %s", current_id, dumper.GetCString());
- }
-
- context.AddNamedDecl(copied_method_decl);
-
- return;
+ FindObjCMethodDeclsWithOrigin(current_id,
+ context,
+ original_interface_decl,
+ m_ast_context,
+ m_ast_importer,
+ "in debug info");
} while (0);
StreamString ss;
@@ -845,53 +868,105 @@
}
while (0);
- for (uint32_t i = 0, e = sc_list.GetSize();
- i != e;
- ++i)
+ if (sc_list.GetSize())
{
- SymbolContext sc;
-
- if (!sc_list.GetContextAtIndex(i, sc))
- continue;
-
- if (!sc.function)
- continue;
-
- DeclContext *function_ctx = sc.function->GetClangDeclContext();
-
- if (!function_ctx)
- continue;
-
- ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(function_ctx);
-
- if (!method_decl)
- continue;
+ // We found a good function symbol. Use that.
- ObjCInterfaceDecl *found_interface_decl = method_decl->getClassInterface();
-
- if (!found_interface_decl)
- continue;
-
- if (found_interface_decl->getName() == interface_decl->getName())
+ for (uint32_t i = 0, e = sc_list.GetSize();
+ i != e;
+ ++i)
{
- Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &method_decl->getASTContext(), method_decl);
+ SymbolContext sc;
+
+ if (!sc_list.GetContextAtIndex(i, sc))
+ continue;
- if (!copied_decl)
+ if (!sc.function)
continue;
- ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
+ DeclContext *function_ctx = sc.function->GetClangDeclContext();
- if (!copied_method_decl)
+ if (!function_ctx)
continue;
- if (log)
+ ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(function_ctx);
+
+ if (!method_decl)
+ continue;
+
+ ObjCInterfaceDecl *found_interface_decl = method_decl->getClassInterface();
+
+ if (!found_interface_decl)
+ continue;
+
+ if (found_interface_decl->getName() == interface_decl->getName())
{
- ASTDumper dumper((Decl*)copied_method_decl);
- log->Printf(" CAS::FOMD[%d] found (in debug info) %s", current_id, dumper.GetCString());
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &method_decl->getASTContext(), method_decl);
+
+ if (!copied_decl)
+ continue;
+
+ ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
+
+ if (!copied_method_decl)
+ continue;
+
+ if (log)
+ {
+ ASTDumper dumper((Decl*)copied_method_decl);
+ log->Printf(" CAS::FOMD[%d] found (in debug info) %s", current_id, dumper.GetCString());
+ }
+
+ context.AddNamedDecl(copied_method_decl);
}
+ }
+ }
+ else
+ {
+ do
+ {
+ // We need to look at the runtime.
+
+ lldb::ProcessSP process(m_target->GetProcessSP());
+
+ if (!process)
+ break;
+
+ ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+
+ TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+
+ if (!type_vendor)
+ break;
+
+ ConstString interface_name(interface_decl->getNameAsString().c_str());
+ bool append = false;
+ uint32_t max_matches = 1;
+ std::vector <ClangASTType> types;
+
+ if (!type_vendor->FindTypes(interface_name,
+ append,
+ max_matches,
+ types))
+ break;
+
+ const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
+
+ const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type);
- context.AddNamedDecl(copied_method_decl);
+ if (!runtime_interface_type)
+ break;
+
+ ObjCInterfaceDecl *runtime_interface_decl = runtime_interface_type->getDecl();
+
+ FindObjCMethodDeclsWithOrigin(current_id,
+ context,
+ runtime_interface_decl,
+ m_ast_context,
+ m_ast_importer,
+ "in runtime");
}
+ while(0);
}
}
@@ -1055,41 +1130,89 @@
if (!language_runtime)
return;
- lldb::TypeSP complete_type_sp(language_runtime->LookupInCompleteClassCache(class_name));
-
- if (!complete_type_sp)
- return;
-
- TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType(), complete_type_sp->GetClangAST());
- lldb::clang_type_t complete_opaque_type = complete_type.GetOpaqueQualType();
-
- if (!complete_opaque_type)
- return;
-
- const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr();
- const ObjCInterfaceType *complete_interface_type = dyn_cast<ObjCInterfaceType>(complete_clang_type);
-
- if (!complete_interface_type)
- return;
-
- DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_type->getDecl());
-
- if (complete_iface_decl.decl == origin_iface_decl.decl)
- return; // already checked this one
-
- if (log)
- log->Printf("CAS::FOPD[%d] trying origin (ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
- current_id,
- complete_iface_decl.decl,
- &complete_iface_decl->getASTContext());
-
+ do
+ {
+ // First see if any other debug information has this property/ivar.
+
+ lldb::TypeSP complete_type_sp(language_runtime->LookupInCompleteClassCache(class_name));
+
+ if (!complete_type_sp)
+ break;
+
+ TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType(), complete_type_sp->GetClangAST());
+ lldb::clang_type_t complete_opaque_type = complete_type.GetOpaqueQualType();
+
+ if (!complete_opaque_type)
+ break;
+
+ const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr();
+ const ObjCInterfaceType *complete_interface_type = dyn_cast<ObjCInterfaceType>(complete_clang_type);
+
+ if (!complete_interface_type)
+ break;
+
+ DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_type->getDecl());
+
+ if (complete_iface_decl.decl == origin_iface_decl.decl)
+ break; // already checked this one
+
+ if (log)
+ log->Printf("CAS::FOPD[%d] trying origin (ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+ current_id,
+ complete_iface_decl.decl,
+ &complete_iface_decl->getASTContext());
+
+ if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id,
+ context,
+ *m_ast_context,
+ m_ast_importer,
+ complete_iface_decl))
+ return;
+ }
+ while(0);
- if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id,
- context,
- *m_ast_context,
- m_ast_importer,
- complete_iface_decl))
- return;
+ do
+ {
+ // Now check the runtime.
+
+ TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+
+ if (!type_vendor)
+ break;
+
+ bool append = false;
+ uint32_t max_matches = 1;
+ std::vector <ClangASTType> types;
+
+ if (!type_vendor->FindTypes(class_name,
+ append,
+ max_matches,
+ types))
+ break;
+
+ const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
+
+ const ObjCInterfaceType *runtime_interface_type = dyn_cast<ObjCInterfaceType>(runtime_clang_type);
+
+ if (!runtime_interface_type)
+ break;
+
+ DeclFromUser<const ObjCInterfaceDecl> runtime_iface_decl(runtime_interface_type->getDecl());
+
+ if (log)
+ log->Printf("CAS::FOPD[%d] trying runtime (ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+ current_id,
+ runtime_iface_decl.decl,
+ &runtime_iface_decl->getASTContext());
+
+ if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id,
+ context,
+ *m_ast_context,
+ m_ast_importer,
+ runtime_iface_decl))
+ return;
+ }
+ while(0);
}
typedef llvm::DenseMap <const FieldDecl *, uint64_t> FieldOffsetMap;
Modified: lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp Tue Sep 18 13:57:46 2012
@@ -1456,7 +1456,7 @@
if (log)
log->PutCString("Not bothering to allocate a struct because no arguments are needed");
- m_material_vars->m_allocated_area = NULL;
+ m_material_vars->m_allocated_area = 0UL;
return true;
}
Modified: lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionParser.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionParser.cpp Tue Sep 18 13:57:46 2012
@@ -200,6 +200,8 @@
llvm::InitializeAllAsmPrinters();
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();
+
+ llvm::DisablePrettyStackTrace = true;
}
} InitializeLLVM;
Modified: lldb/branches/windows/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangFunction.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangFunction.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangFunction.cpp Tue Sep 18 13:57:46 2012
@@ -66,9 +66,9 @@
m_compiled (false),
m_JITted (false)
{
- m_jit_process_sp = exe_scope.CalculateProcess();
+ m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
// Can't make a ClangFunction without a process.
- assert (m_jit_process_sp);
+ assert (m_jit_process_wp.lock());
}
ClangFunction::ClangFunction
@@ -89,9 +89,9 @@
m_compiled (false),
m_JITted (false)
{
- m_jit_process_sp = exe_scope.CalculateProcess();
+ m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
// Can't make a ClangFunction without a process.
- assert (m_jit_process_sp);
+ assert (m_jit_process_wp.lock());
m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
m_function_return_qual_type = m_function_ptr->GetReturnClangType();
@@ -186,7 +186,7 @@
char arg_buf[32];
args_buffer.append (" ");
args_buffer.append (type_name);
- snprintf(arg_buf, 31, "arg_%zd", i);
+ snprintf(arg_buf, 31, "arg_%llu", (uint64_t)i);
args_buffer.push_back (' ');
args_buffer.append (arg_buf);
args_buffer.append (";\n");
@@ -219,10 +219,19 @@
log->Printf ("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
// Okay, now compile this expression
-
- m_parser.reset(new ClangExpressionParser(m_jit_process_sp.get(), *this));
- num_errors = m_parser->Parse (errors);
+ lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
+ if (jit_process_sp)
+ {
+ m_parser.reset(new ClangExpressionParser(jit_process_sp.get(), *this));
+
+ num_errors = m_parser->Parse (errors);
+ }
+ else
+ {
+ errors.Printf("no process - unable to inject function");
+ num_errors = 1;
+ }
m_compiled = (num_errors == 0);
@@ -239,8 +248,10 @@
if (!process)
return false;
-
- if (process != m_jit_process_sp.get())
+
+ lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
+
+ if (process != jit_process_sp.get())
return false;
if (!m_compiled)
@@ -265,7 +276,7 @@
if (!jit_error.Success())
return false;
if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
- m_jit_process_sp = process->shared_from_this();
+ m_jit_process_wp = lldb::ProcessWP(process->shared_from_this());
return true;
}
@@ -302,7 +313,9 @@
if (process == NULL)
return return_value;
- if (process != m_jit_process_sp.get())
+ lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
+
+ if (process != jit_process_sp.get())
return false;
if (args_addr_ref == LLDB_INVALID_ADDRESS)
@@ -426,7 +439,10 @@
if (process == NULL)
return false;
- if (process != m_jit_process_sp.get())
+
+ lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
+
+ if (process != jit_process_sp.get())
return false;
Error error;
@@ -462,7 +478,7 @@
{
const bool try_all_threads = false;
const bool discard_on_error = true;
- return ExecuteFunction (exe_ctx, NULL, errors, stop_others, NULL, try_all_threads, discard_on_error, results);
+ return ExecuteFunction (exe_ctx, NULL, errors, stop_others, 0UL, try_all_threads, discard_on_error, results);
}
ExecutionResults
Modified: lldb/branches/windows/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangUserExpression.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangUserExpression.cpp Tue Sep 18 13:57:46 2012
@@ -351,7 +351,7 @@
if (jit_error.Success())
{
if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
- m_jit_process_sp = process->shared_from_this();
+ m_jit_process_wp = lldb::ProcessWP(process->shared_from_this());
return true;
}
else
Modified: lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp Tue Sep 18 13:57:46 2012
@@ -148,7 +148,7 @@
}
if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
- m_jit_process_sp = process->shared_from_this();
+ m_jit_process_wp = lldb::ProcessWP(process->shared_from_this());
#if 0
// jingham: look here
Modified: lldb/branches/windows/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/DWARFExpression.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/DWARFExpression.cpp (original)
+++ lldb/branches/windows/source/Expression/DWARFExpression.cpp Tue Sep 18 13:57:46 2012
@@ -1345,7 +1345,7 @@
for (size_t i=0; i<count; ++i)
{
StreamString new_value;
- new_value.Printf("[%zu]", i);
+ new_value.Printf("[%llu]", (uint64_t)i);
stack[i].Dump(&new_value);
log->Printf(" %s", new_value.GetData());
}
@@ -3186,7 +3186,7 @@
for (size_t i=0; i<count; ++i)
{
StreamString new_value;
- new_value.Printf("[%zu]", i);
+ new_value.Printf("[%llu]", (uint64_t)i);
stack[i].Dump(&new_value);
log->Printf(" %s", new_value.GetData());
}
Modified: lldb/branches/windows/source/Expression/ExpressionSourceCode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ExpressionSourceCode.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ExpressionSourceCode.cpp (original)
+++ lldb/branches/windows/source/Expression/ExpressionSourceCode.cpp Tue Sep 18 13:57:46 2012
@@ -13,6 +13,20 @@
using namespace lldb_private;
+static const char *global_defines = "#undef NULL \n"
+ "#undef Nil \n"
+ "#undef nil \n"
+ "#undef YES \n"
+ "#undef NO \n"
+ "#define NULL ((int)0) \n"
+ "#define Nil ((Class)0) \n"
+ "#define nil ((id)0) \n"
+ "#define YES ((BOOL)1) \n"
+ "#define NO ((BOOL)0) \n"
+ "typedef int BOOL; \n"
+ "typedef unsigned short unichar; \n";
+
+
bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method) const
{
if (m_wrap)
@@ -35,33 +49,27 @@
break;
case lldb::eLanguageTypeC:
wrap_stream.Printf("%s \n"
- "#undef NULL \n"
- "#define NULL 0 \n"
- "#undef nil \n"
- "#define nil (id)0 \n"
- "typedef unsigned short unichar;\n"
+ "%s \n"
"void \n"
"%s(void *$__lldb_arg) \n"
"{ \n"
" %s; \n"
"} \n",
m_prefix.c_str(),
+ global_defines,
m_name.c_str(),
m_body.c_str());
break;
case lldb::eLanguageTypeC_plus_plus:
wrap_stream.Printf("%s \n"
- "#undef NULL \n"
- "#define NULL 0 \n"
- "#undef nil \n"
- "#define nil (id)0 \n"
- "typedef unsigned short unichar; \n"
+ "%s \n"
"void \n"
"$__lldb_class::%s(void *$__lldb_arg) %s\n"
"{ \n"
" %s; \n"
"} \n",
m_prefix.c_str(),
+ global_defines,
m_name.c_str(),
(const_object ? "const" : ""),
m_body.c_str());
@@ -70,33 +78,26 @@
if (static_method)
{
wrap_stream.Printf("%s \n"
- "#undef NULL \n"
- "#define NULL 0 \n"
- "#undef nil \n"
- "#define nil (id)0 \n"
- "typedef unsigned short unichar; \n"
- "@interface $__lldb_objc_class ($__lldb_category) \n"
- "+(void)%s:(void *)$__lldb_arg; \n"
- "@end \n"
- "@implementation $__lldb_objc_class ($__lldb_category) \n"
- "+(void)%s:(void *)$__lldb_arg \n"
- "{ \n"
- " %s; \n"
- "} \n"
- "@end \n",
- m_prefix.c_str(),
- m_name.c_str(),
- m_name.c_str(),
- m_body.c_str());
+ "%s \n"
+ "@interface $__lldb_objc_class ($__lldb_category) \n"
+ "+(void)%s:(void *)$__lldb_arg; \n"
+ "@end \n"
+ "@implementation $__lldb_objc_class ($__lldb_category) \n"
+ "+(void)%s:(void *)$__lldb_arg \n"
+ "{ \n"
+ " %s; \n"
+ "} \n"
+ "@end \n",
+ m_prefix.c_str(),
+ global_defines,
+ m_name.c_str(),
+ m_name.c_str(),
+ m_body.c_str());
}
else
{
wrap_stream.Printf("%s \n"
- "#undef NULL \n"
- "#define NULL 0 \n"
- "#undef nil \n"
- "#define nil (id)0 \n"
- "typedef unsigned short unichar; \n"
+ "%s \n"
"@interface $__lldb_objc_class ($__lldb_category) \n"
"-(void)%s:(void *)$__lldb_arg; \n"
"@end \n"
@@ -107,6 +108,7 @@
"} \n"
"@end \n",
m_prefix.c_str(),
+ global_defines,
m_name.c_str(),
m_name.c_str(),
m_body.c_str());
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Host.cpp (original)
+++ lldb/branches/windows/source/Host/common/Host.cpp Tue Sep 18 13:57:46 2012
@@ -42,6 +42,7 @@
#include <dispatch/dispatch.h>
#include <libproc.h>
#include <mach-o/dyld.h>
+#include <mach/mach_port.h>
#include <sys/sysctl.h>
@@ -360,6 +361,12 @@
break;
case llvm::Triple::x86_64:
+ g_host_arch_64.SetTriple(triple);
+ g_supports_64 = true;
+ g_host_arch_32.SetTriple(triple.get32BitArchVariant());
+ g_supports_32 = true;
+ break;
+
case llvm::Triple::sparcv9:
case llvm::Triple::ppc64:
case llvm::Triple::cellspu:
@@ -445,7 +452,12 @@
Host::GetCurrentThreadID()
{
#if defined (__APPLE__)
- return ::mach_thread_self();
+ // Calling "mach_port_deallocate()" bumps the reference count on the thread
+ // port, so we need to deallocate it. mach_task_self() doesn't bump the ref
+ // count.
+ thread_port_t thread_self = mach_thread_self();
+ mach_port_deallocate(mach_task_self(), thread_self);
+ return thread_self;
#elif defined(__FreeBSD__)
return lldb::tid_t(pthread_getthreadid_np());
#elif defined(_WIN32)
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/common/Symbols.cpp Tue Sep 18 13:57:46 2012
@@ -28,4 +28,13 @@
return FileSpec();
}
+FileSpec
+Symbols::FindSymbolFileInBundle (const FileSpec& symfile_bundle,
+ const lldb_private::UUID *uuid,
+ const ArchSpec *arch)
+{
+ return FileSpec();
+}
+
+
#endif
Modified: lldb/branches/windows/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/freebsd/Host.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/freebsd/Host.cpp (original)
+++ lldb/branches/windows/source/Host/freebsd/Host.cpp Tue Sep 18 13:57:46 2012
@@ -178,7 +178,7 @@
ProcessInstanceInfo &process_info)
{
if (process_info.ProcessIDIsValid()) {
- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, process_info.GetProcessID() };
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, (int)process_info.GetProcessID() };
char arg_data[8192];
size_t arg_data_size = sizeof(arg_data);
@@ -243,7 +243,7 @@
if (process_info.ProcessIDIsValid())
{
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID,
- process_info.GetProcessID() };
+ (int)process_info.GetProcessID() };
proc_kinfo_size = sizeof(struct kinfo_proc);
if (::sysctl (mib, 4, &proc_kinfo, &proc_kinfo_size, NULL, 0) == 0)
@@ -301,7 +301,7 @@
pid.piod_addr = &ps_strings;
pid.piod_offs = ps_strings_addr;
pid.piod_len = sizeof(ps_strings);
- if (::ptrace(PT_IO, process->GetID(), (caddr_t)&pid, NULL)) {
+ if (::ptrace(PT_IO, process->GetID(), (caddr_t)&pid, 0)) {
perror("failed to fetch ps_strings");
buf_ap.release();
goto done;
@@ -312,7 +312,7 @@
pid.piod_addr = aux_info;
pid.piod_offs = auxv_addr;
pid.piod_len = sizeof(aux_info);
- if (::ptrace(PT_IO, process->GetID(), (caddr_t)&pid, NULL)) {
+ if (::ptrace(PT_IO, process->GetID(), (caddr_t)&pid, 0)) {
perror("failed to fetch aux_info");
buf_ap.release();
goto done;
Modified: lldb/branches/windows/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/Host.mm?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Host.mm (original)
+++ lldb/branches/windows/source/Host/macosx/Host.mm Tue Sep 18 13:57:46 2012
@@ -1039,14 +1039,24 @@
mib_len++;
cpu_type_t cpu, sub = 0;
- size_t cpu_len = sizeof(cpu);
- if (::sysctl (mib, mib_len, &cpu, &cpu_len, 0, 0) == 0)
+ size_t len = sizeof(cpu);
+ if (::sysctl (mib, mib_len, &cpu, &len, 0, 0) == 0)
{
switch (cpu)
{
case llvm::MachO::CPUTypeI386: sub = llvm::MachO::CPUSubType_I386_ALL; break;
case llvm::MachO::CPUTypeX86_64: sub = llvm::MachO::CPUSubType_X86_64_ALL; break;
- default: break;
+ case llvm::MachO::CPUTypeARM:
+ {
+ uint32_t cpusubtype = 0;
+ len = sizeof(cpusubtype);
+ if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) == 0)
+ sub = cpusubtype;
+ }
+ break;
+
+ default:
+ break;
}
process_info.GetArchitecture ().SetArchitecture (eArchTypeMachO, cpu, sub);
return true;
@@ -1521,7 +1531,7 @@
size_t ocount = 0;
error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
if (error.Fail() || log)
- error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
+ error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %llu )", cpu, (uint64_t)ocount);
if (error.Fail() || ocount != 1)
return error;
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/macosx/Symbols.cpp Tue Sep 18 13:57:46 2012
@@ -244,12 +244,10 @@
return false;
}
-static FileSpec
-LocateDSYMMachFileInDSYMBundle
-(
- const FileSpec& dsym_bundle_fspec,
- const lldb_private::UUID *uuid,
- const ArchSpec *arch)
+FileSpec
+Symbols::FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec,
+ const lldb_private::UUID *uuid,
+ const ArchSpec *arch)
{
char path[PATH_MAX];
@@ -361,7 +359,7 @@
if (out_dsym_fspec->GetFileType () == FileSpec::eFileTypeDirectory)
{
- *out_dsym_fspec = LocateDSYMMachFileInDSYMBundle (*out_dsym_fspec, uuid, arch);
+ *out_dsym_fspec = Symbols::FindSymbolFileInBundle (*out_dsym_fspec, uuid, arch);
if (*out_dsym_fspec)
++items_found;
}
Modified: lldb/branches/windows/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Args.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Args.cpp (original)
+++ lldb/branches/windows/source/Interpreter/Args.cpp Tue Sep 18 13:57:46 2012
@@ -93,15 +93,6 @@
void
Args::Dump (Stream *s)
{
-// int argc = GetArgumentCount();
-//
-// arg_sstr_collection::const_iterator pos, begin = m_args.begin(), end = m_args.end();
-// for (pos = m_args.begin(); pos != end; ++pos)
-// {
-// s->Indent();
-// s->Printf("args[%zu]=%s\n", std::distance(begin, pos), pos->c_str());
-// }
-// s->EOL();
const int argc = m_argv.size();
for (int i=0; i<argc; ++i)
{
Modified: lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp Tue Sep 18 13:57:46 2012
@@ -1195,19 +1195,19 @@
target = Host::GetDummyTarget(GetDebugger()).get();
if (target)
{
- const bool coerce_to_id = false;
- const bool unwind_on_error = true;
- const bool keep_in_memory = false;
ValueObjectSP expr_result_valobj_sp;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(false)
+ .SetSingleThreadTimeoutUsec(0);
+
ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(),
- exe_ctx.GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- eNoDynamicValues,
+ exe_ctx.GetFramePtr(),
expr_result_valobj_sp,
- 0 /* no timeout */);
+ options);
+
if (expr_result == eExecutionCompleted)
{
Scalar scalar;
Modified: lldb/branches/windows/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandObject.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandObject.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandObject.cpp Tue Sep 18 13:57:46 2012
@@ -938,6 +938,7 @@
{ eArgTypeFrameIndex, "frame-index", CommandCompletions::eNoCompletion, { NULL, false }, "Index into a thread's list of frames." },
{ eArgTypeFullName, "fullname", CommandCompletions::eNoCompletion, { NULL, false }, "Help text goes here." },
{ eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a function." },
+ { eArgTypeFunctionOrSymbol, "function-or-symbol", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a function or symbol." },
{ eArgTypeGDBFormat, "gdb-format", CommandCompletions::eNoCompletion, { GDBFormatHelpTextCallback, true }, NULL },
{ eArgTypeIndex, "index", CommandCompletions::eNoCompletion, { NULL, false }, "An index into a list." },
{ eArgTypeLanguage, "language", CommandCompletions::eNoCompletion, { NULL, false }, "A source language name." },
Modified: lldb/branches/windows/source/Interpreter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Makefile?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Makefile (original)
+++ lldb/branches/windows/source/Interpreter/Makefile Tue Sep 18 13:57:46 2012
@@ -16,6 +16,10 @@
include $(LLDB_LEVEL)/Makefile
-include $(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.d
+# edit-swig-python-wrapper-file.py needs $(SRCROOT)
+export SRCROOT := $(PROJ_SRC_DIR)/$(LLDB_LEVEL)
+TARGET_DIR := $(PROJ_OBJ_DIR)
+
PYTHON_DIR := $(LibDir)/python/lldb
ifeq ($(HOST_OS),Darwin)
PYTHON_DEST_DIR := $(DESTDIR)/$(call realpath,/Library/Python/$(shell python -c 'import sys; print sys.version[:3]')/site-packages)/lldb
@@ -126,26 +130,29 @@
else $(RM) -f "$(PROJ_OBJ_DIR)/$*.cpp.d.tmp"; exit 1; fi
LLDBWrapPython.cpp: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \
- $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py
+ $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py \
+ $(wildcard $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/interface/*.i)
$(Echo) Generating LLDBWrapPython.cpp
$(Verb) $(MKDIR) $(PYTHON_DIR)
- $(Verb) if swig -c++ -shadow -python $(LLDB_SWIG_INCLUDE_DIRS) \
- -D__STDC_LIMIT_MACROS -outdir "$(PYTHON_DIR)" \
- $(SWIG_DEPEND_OPTIONS) \
- -o LLDBWrapPython.cpp "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/lldb.swig" ; \
- $(CPP_DEPEND_MOVEFILE)
- $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py" \
- "$(PYTHON_DIR)"
- $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py" \
- "$(PROJ_OBJ_DIR)"
- $(Verb) if test -f "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited"; then \
- $(MV) "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited" \
- "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp"; fi
- $(Verb) $(MV) "$(PYTHON_DIR)/lldb.py" "$(PYTHON_DIR)/__init__.py"
- $(Verb) $(CP) "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)"
- $(Verb) $(RM) -f $(PYTHON_DIR)/_lldb.so
- $(Verb) $(AliasTool) $(LIBLLDB) $(PYTHON_DIR)/_lldb.so
- $(LLDB_COPY_PACKAGE)
+ $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/build-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(TARGET_DIR)" "$(PYTHON_DIR)" "$(PYTHON_DIR)"
+ $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/finish-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(TARGET_DIR)" "$(PYTHON_DIR)" "$(PYTHON_DIR)"
+# $(Verb) if swig -c++ -shadow -python $(LLDB_SWIG_INCLUDE_DIRS) \
+# -D__STDC_LIMIT_MACROS -outdir "$(PYTHON_DIR)" \
+# $(SWIG_DEPEND_OPTIONS) \
+# -o LLDBWrapPython.cpp "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/lldb.swig" ; \
+# $(CPP_DEPEND_MOVEFILE)
+# $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py" \
+# "$(PYTHON_DIR)"
+# $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py" \
+# "$(PROJ_OBJ_DIR)"
+# $(Verb) if test -f "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited"; then \
+# $(MV) "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited" \
+# "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp"; fi
+# $(Verb) $(MV) "$(PYTHON_DIR)/lldb.py" "$(PYTHON_DIR)/__init__.py"
+# $(Verb) $(CP) "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)"
+# $(Verb) $(RM) -f $(PYTHON_DIR)/_lldb.so
+# $(Verb) $(AliasTool) $(LIBLLDB) $(PYTHON_DIR)/_lldb.so
+# $(LLDB_COPY_PACKAGE)
else
Modified: lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp Tue Sep 18 13:57:46 2012
@@ -42,7 +42,7 @@
{ LLDB_OPT_SET_1, false, "no-summary-depth", 'Y', optional_argument, NULL, 0, eArgTypeCount, "Set the depth at which omitting summary information stops (default is 1)."},
{ LLDB_OPT_SET_1, false, "raw-output", 'R', no_argument, NULL, 0, eArgTypeNone, "Don't use formatting options."},
{ LLDB_OPT_SET_1, false, "show-all-children",'A', no_argument, NULL, 0, eArgTypeNone, "Ignore the upper bound on the number of children to show."},
- { 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
+ { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
uint32_t
Modified: lldb/branches/windows/source/Interpreter/OptionValueArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueArray.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueArray.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueArray.cpp Tue Sep 18 13:57:46 2012
@@ -126,9 +126,9 @@
if (array_count == 0)
error.SetErrorStringWithFormat("index %i is not valid for an empty array", idx);
else if (idx > 0)
- error.SetErrorStringWithFormat("index %i out of range, valid values are 0 through %zu", idx, array_count - 1);
+ error.SetErrorStringWithFormat("index %i out of range, valid values are 0 through %llu", idx, (uint64_t)(array_count - 1));
else
- error.SetErrorStringWithFormat("negative index %i out of range, valid values are -1 through -%zu", idx, array_count);
+ error.SetErrorStringWithFormat("negative index %i out of range, valid values are -1 through -%llu", idx, (uint64_t)array_count);
}
}
}
Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp Tue Sep 18 13:57:46 2012
@@ -507,6 +507,13 @@
return return_valobj_sp;
}
+Error
+ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
+{
+ Error return_error("I can't do that yet Jim.");
+ return return_error;
+}
+
bool
ABIMacOSX_arm::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h Tue Sep 18 13:57:46 2012
@@ -41,6 +41,9 @@
GetArgumentValues (lldb_private::Thread &thread,
lldb_private::ValueList &values) const;
+ virtual lldb_private::Error
+ SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value);
+
protected:
virtual lldb::ValueObjectSP
GetReturnValueObjectImpl (lldb_private::Thread &thread,
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=164159&r1=164158&r2=164159&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 Tue Sep 18 13:57:46 2012
@@ -774,6 +774,13 @@
return return_valobj_sp;
}
+Error
+ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
+{
+ Error return_error("I can't do that yet Jim.");
+ return return_error;
+}
+
bool
ABIMacOSX_i386::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h Tue Sep 18 13:57:46 2012
@@ -51,6 +51,9 @@
GetArgumentValues (lldb_private::Thread &thread,
lldb_private::ValueList &values) const;
+ virtual lldb_private::Error
+ SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value);
+
protected:
virtual lldb::ValueObjectSP
GetReturnValueObjectImpl (lldb_private::Thread &thread,
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=164159&r1=164158&r2=164159&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 Tue Sep 18 13:57:46 2012
@@ -921,7 +921,7 @@
// These two tests are just sanity checks. If I somehow get the
// type calculation wrong above it is better to just return nothing
- // than to assert or crash.
+ // than to assert or crash.
if (!copy_from_extractor)
return return_valobj_sp;
if (copy_from_offset + field_byte_width > copy_from_extractor->GetByteSize())
@@ -959,6 +959,13 @@
return return_valobj_sp;
}
+Error
+ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
+{
+ Error return_error("I can't do that yet Jim.");
+ return return_error;
+}
+
bool
ABISysV_x86_64::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
Modified: lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h (original)
+++ lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Tue Sep 18 13:57:46 2012
@@ -45,6 +45,9 @@
GetArgumentValues (lldb_private::Thread &thread,
lldb_private::ValueList &values) const;
+ virtual lldb_private::Error
+ SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value);
+
protected:
lldb::ValueObjectSP
GetReturnValueObjectSimple (lldb_private::Thread &thread,
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Tue Sep 18 13:57:46 2012
@@ -280,10 +280,10 @@
AppleObjCRuntimeV1::ClassDescriptorV1::GetSuperclass ()
{
if (!m_valid)
- return NULL;
+ return AppleObjCRuntime::ClassDescriptorSP();
ProcessSP process_sp = m_process_wp.lock();
if (!process_sp)
- return NULL;
+ return AppleObjCRuntime::ClassDescriptorSP();
return ObjCLanguageRuntime::ClassDescriptorSP(new AppleObjCRuntimeV1::ClassDescriptorV1(m_parent_isa,process_sp));
}
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Sep 18 13:57:46 2012
@@ -20,6 +20,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/DataBufferMemoryMap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
@@ -31,7 +32,9 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
+#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
@@ -39,7 +42,7 @@
#include "lldb/Target/Thread.h"
#include "AppleObjCRuntimeV2.h"
-#include "AppleObjCSymbolVendor.h"
+#include "AppleObjCTypeVendor.h"
#include "AppleObjCTrampolineHandler.h"
#include <vector>
@@ -585,6 +588,800 @@
return (ptr & 0x01);
}
+class RemoteNXMapTable
+{
+public:
+ RemoteNXMapTable (lldb::ProcessSP process_sp,
+ lldb::addr_t load_addr) :
+ m_process_sp(process_sp),
+ 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)
+ {
+ lldb::addr_t cursor = load_addr;
+
+ Error err;
+
+ // const struct +NXMapTablePrototype *prototype;
+ m_prototype_la = m_process_sp->ReadPointerFromMemory(cursor, err);
+ cursor += m_process_sp->GetAddressByteSize();
+
+ // unsigned count;
+ m_count = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(unsigned), 0, err);
+ cursor += sizeof(unsigned);
+
+ // unsigned nbBucketsMinusOne;
+ m_nbBucketsMinusOne = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(unsigned), 0, err);
+ cursor += sizeof(unsigned);
+
+ // void *buckets;
+ m_buckets_la = m_process_sp->ReadPointerFromMemory(cursor, err);
+ }
+
+ // const_iterator mimics NXMapState and its code comes from NXInitMapState and NXNextMapState.
+ typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA> element;
+
+ friend class const_iterator;
+ class const_iterator
+ {
+ public:
+ const_iterator (RemoteNXMapTable &parent, int index) : m_parent(parent), m_index(index)
+ {
+ AdvanceToValidIndex();
+ }
+
+ const_iterator (const const_iterator &rhs) : m_parent(rhs.m_parent), m_index(rhs.m_index)
+ {
+ // AdvanceToValidIndex() has been called by rhs already.
+ }
+
+ const_iterator &operator=(const const_iterator &rhs)
+ {
+ // AdvanceToValidIndex() has been called by rhs already.
+ assert (&m_parent == &rhs.m_parent);
+ m_index = rhs.m_index;
+ return *this;
+ }
+
+ bool operator==(const const_iterator &rhs) const
+ {
+ if (&m_parent != &rhs.m_parent)
+ return false;
+ if (m_index != rhs.m_index)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const const_iterator &rhs) const
+ {
+ return !(operator==(rhs));
+ }
+
+ const_iterator &operator++()
+ {
+ AdvanceToValidIndex();
+ return *this;
+ }
+
+ const element operator*() const
+ {
+ if (m_index == -1)
+ {
+ // TODO find a way to make this an error, but not an assert
+ return element();
+ }
+
+ lldb::addr_t pairs_la = m_parent.m_buckets_la;
+ size_t map_pair_size = m_parent.m_map_pair_size;
+ lldb::addr_t pair_la = pairs_la + (m_index * map_pair_size);
+
+ Error err;
+
+ lldb::addr_t key = m_parent.m_process_sp->ReadPointerFromMemory(pair_la, 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);
+ if (!err.Success())
+ return element();
+
+ std::string key_string;
+
+ m_parent.m_process_sp->ReadCStringFromMemory(key, key_string, err);
+ if (!err.Success())
+ return element();
+
+ return element(ConstString(key_string.c_str()), (ObjCLanguageRuntime::ObjCISA)value);
+ }
+ private:
+ void AdvanceToValidIndex ()
+ {
+ if (m_index == -1)
+ return;
+
+ lldb::addr_t pairs_la = m_parent.m_buckets_la;
+ 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);
+
+ if (!err.Success())
+ {
+ m_index = -1;
+ return;
+ }
+
+ if (key != NXMAPNOTAKEY)
+ return;
+ }
+ }
+ RemoteNXMapTable &m_parent;
+ int m_index;
+ };
+
+ const_iterator begin ()
+ {
+ return const_iterator(*this, m_nbBucketsMinusOne + 1);
+ }
+
+ const_iterator end ()
+ {
+ return m_end_iterator;
+ }
+
+private:
+ // contents of _NXMapTable struct
+ lldb::addr_t m_prototype_la;
+ uint32_t m_count;
+ uint32_t m_nbBucketsMinusOne;
+ lldb::addr_t m_buckets_la;
+
+ lldb::ProcessSP m_process_sp;
+ const_iterator m_end_iterator;
+ lldb::addr_t m_load_addr;
+ size_t m_map_pair_size;
+ lldb::addr_t m_NXMAPNOTAKEY;
+};
+
+class RemoteObjCOpt
+{
+public:
+ RemoteObjCOpt (lldb::ProcessSP process_sp,
+ lldb::addr_t load_addr) :
+ m_process_sp(process_sp),
+ m_end_iterator(*this, -1ll),
+ m_load_addr(load_addr)
+ {
+ lldb::addr_t cursor = load_addr;
+
+ Error err;
+
+ // uint32_t version;
+ m_version = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(uint32_t), 0, err);
+ cursor += sizeof(uint32_t);
+
+ // int32_t selopt_offset;
+ cursor += sizeof(int32_t);
+
+ // int32_t headeropt_offset;
+ cursor += sizeof(int32_t);
+
+ // int32_t clsopt_offset;
+ {
+ Scalar clsopt_offset;
+ m_process_sp->ReadScalarIntegerFromMemory(cursor, sizeof(int32_t), /*is_signed*/ true, clsopt_offset, err);
+ m_clsopt_offset = clsopt_offset.SInt();
+ cursor += sizeof(int32_t);
+ }
+
+ if (m_version != 12)
+ return;
+
+ m_clsopt_la = load_addr + m_clsopt_offset;
+
+ cursor = m_clsopt_la;
+
+ // uint32_t capacity;
+ m_capacity = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(uint32_t), 0, err);
+ cursor += sizeof(uint32_t);
+
+ // uint32_t occupied;
+ cursor += sizeof(uint32_t);
+
+ // uint32_t shift;
+ cursor += sizeof(uint32_t);
+
+ // uint32_t mask;
+ m_mask = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(uint32_t), 0, err);
+ cursor += sizeof(uint32_t);
+
+ // uint32_t zero;
+ m_zero_offset = cursor - m_clsopt_la;
+ cursor += sizeof(uint32_t);
+
+ // uint32_t unused;
+ cursor += sizeof(uint32_t);
+
+ // uint64_t salt;
+ cursor += sizeof(uint64_t);
+
+ // uint32_t scramble[256];
+ cursor += sizeof(uint32_t) * 256;
+
+ // uint8_t tab[mask+1];
+ cursor += sizeof(uint8_t) * (m_mask + 1);
+
+ // uint8_t checkbytes[capacity];
+ cursor += sizeof(uint8_t) * m_capacity;
+
+ // int32_t offset[capacity];
+ cursor += sizeof(int32_t) * m_capacity;
+
+ // objc_classheader_t clsOffsets[capacity];
+ m_clsOffsets_la = cursor;
+ cursor += (m_classheader_size * m_capacity);
+
+ // uint32_t duplicateCount;
+ m_duplicateCount = m_process_sp->ReadUnsignedIntegerFromMemory(cursor, sizeof(uint32_t), 0, err);
+ cursor += sizeof(uint32_t);
+
+ // objc_classheader_t duplicateOffsets[duplicateCount];
+ m_duplicateOffsets_la = cursor;
+ }
+
+ friend class const_iterator;
+ class const_iterator
+ {
+ public:
+ const_iterator (RemoteObjCOpt &parent, int64_t index) : m_parent(parent), m_index(index)
+ {
+ AdvanceToValidIndex();
+ }
+
+ const_iterator (const const_iterator &rhs) : m_parent(rhs.m_parent), m_index(rhs.m_index)
+ {
+ // AdvanceToValidIndex() has been called by rhs already
+ }
+
+ const_iterator &operator=(const const_iterator &rhs)
+ {
+ assert (&m_parent == &rhs.m_parent);
+ m_index = rhs.m_index;
+ return *this;
+ }
+
+ bool operator==(const const_iterator &rhs) const
+ {
+ if (&m_parent != &rhs.m_parent)
+ return false;
+ if (m_index != rhs.m_index)
+ return false;
+ return true;
+ }
+
+ bool operator!=(const const_iterator &rhs) const
+ {
+ return !(operator==(rhs));
+ }
+
+ const_iterator &operator++()
+ {
+ AdvanceToValidIndex();
+ return *this;
+ }
+
+ const ObjCLanguageRuntime::ObjCISA operator*() const
+ {
+ if (m_index == -1)
+ return 0;
+
+ Error err;
+ return isaForIndex(err);
+ }
+ private:
+ ObjCLanguageRuntime::ObjCISA isaForIndex(Error &err) const
+ {
+ if (m_index >= m_parent.m_capacity + m_parent.m_duplicateCount)
+ return 0; // index out of range
+
+ lldb::addr_t classheader_la;
+
+ 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);
+ }
+ 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);
+ }
+
+ Scalar clsOffset;
+ m_parent.m_process_sp->ReadScalarIntegerFromMemory(classheader_la, sizeof(int32_t), /*is_signed*/ true, clsOffset, err);
+ if (!err.Success())
+ return 0;
+
+ int32_t clsOffset_int = clsOffset.SInt();
+ if (clsOffset_int & 0x1)
+ return 0; // not even
+
+ 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;
+ }
+
+ void AdvanceToValidIndex ()
+ {
+ if (m_index == -1)
+ return;
+
+ Error err;
+
+ m_index--;
+
+ while (m_index >= 0)
+ {
+ ObjCLanguageRuntime::ObjCISA objc_isa = isaForIndex(err);
+ if (objc_isa)
+ return;
+ m_index--;
+ }
+ }
+ RemoteObjCOpt &m_parent;
+ int64_t m_index;
+ };
+
+ const_iterator begin ()
+ {
+ return const_iterator(*this, (int64_t)m_capacity + (int64_t)m_duplicateCount);
+ }
+
+ const_iterator end ()
+ {
+ return m_end_iterator;
+ }
+
+private:
+ // contents of objc_opt struct
+ uint32_t m_version;
+ int32_t m_clsopt_offset;
+
+ lldb::addr_t m_clsopt_la;
+
+ // 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;
+ int32_t m_zero_offset;
+
+ lldb::ProcessSP m_process_sp;
+ const_iterator m_end_iterator;
+ lldb::addr_t m_load_addr;
+ const size_t m_classheader_size = (sizeof(int32_t) * 2);
+};
+
+class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
+{
+public:
+ ClassDescriptorV2 (ValueObject &isa_pointer)
+ {
+ ObjCLanguageRuntime::ObjCISA ptr_value = isa_pointer.GetValueAsUnsigned(0);
+
+ lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
+
+ Initialize (ptr_value,process_sp);
+ }
+
+ ClassDescriptorV2 (ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp)
+ {
+ Initialize (isa, process_sp);
+ }
+
+ virtual ConstString
+ GetClassName ()
+ {
+ return m_name;
+ }
+
+ virtual ObjCLanguageRuntime::ClassDescriptorSP
+ GetSuperclass ()
+ {
+ if (!m_valid)
+ return ObjCLanguageRuntime::ClassDescriptorSP();
+ ProcessSP process_sp = m_process_wp.lock();
+ if (!process_sp)
+ return ObjCLanguageRuntime::ClassDescriptorSP();
+ return AppleObjCRuntime::ClassDescriptorSP(new ClassDescriptorV2(m_parent_isa,process_sp));
+ }
+
+ virtual bool
+ IsValid ()
+ {
+ return m_valid;
+ }
+
+ virtual bool
+ IsTagged ()
+ {
+ return false; // we use a special class for tagged descriptors
+ }
+
+ virtual uint64_t
+ GetInstanceSize ()
+ {
+ return m_instance_size;
+ }
+
+ virtual ObjCLanguageRuntime::ObjCISA
+ GetISA ()
+ {
+ return m_isa;
+ }
+
+ virtual bool
+ IsRealized ()
+ {
+ 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 isa, lldb::ProcessSP process_sp)
+ {
+ if (!isa || !process_sp)
+ {
+ m_valid = false;
+ return;
+ }
+
+ m_valid = true;
+
+ Error error;
+
+ m_isa = process_sp->ReadPointerFromMemory(isa, error);
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+ if (!IsPointerValid(m_isa,ptr_size,false,false,true))
+ {
+ m_valid = false;
+ return;
+ }
+
+ lldb::addr_t data_ptr = process_sp->ReadPointerFromMemory(m_isa + 4 * ptr_size, error);
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ if (!IsPointerValid(data_ptr,ptr_size,false,false,true))
+ {
+ m_valid = false;
+ return;
+ }
+
+ m_parent_isa = process_sp->ReadPointerFromMemory(isa + ptr_size,error);
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ // sanity checks
+ lldb::addr_t cache_ptr = process_sp->ReadPointerFromMemory(m_isa + 2*ptr_size, error);
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+ if (!IsPointerValid(cache_ptr,ptr_size,true,false,true))
+ {
+ m_valid = false;
+ return;
+ }
+
+ lldb::addr_t rot_pointer;
+
+ // now construct the data object
+
+ uint32_t flags;
+ process_sp->ReadMemory(data_ptr, &flags, 4, error);
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ if (flags & RW_REALIZED)
+ {
+ m_realized = true;
+ rot_pointer = process_sp->ReadPointerFromMemory(data_ptr + 8, error);
+ }
+ else
+ {
+ m_realized = false;
+ rot_pointer = data_ptr;
+ }
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ if (!IsPointerValid(rot_pointer,ptr_size))
+ {
+ m_valid = false;
+ return;
+ }
+
+ // now read from the rot
+
+ lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(rot_pointer + (ptr_size == 8 ? 24 : 16) ,error);
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
+
+ size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer_sp->GetBytes(), 1024, error);
+
+ if (error.Fail())
+ {
+ m_valid = false;
+ return;
+ }
+
+ if (count)
+ m_name = ConstString((char*)buffer_sp->GetBytes());
+ else
+ m_name = ConstString();
+
+ m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(rot_pointer + 8, ptr_size, 0, error);
+
+ m_process_wp = lldb::ProcessWP(process_sp);
+ }
+
+private:
+ static const uint32_t RW_REALIZED = (1 << 31);
+ ConstString m_name;
+ ObjCLanguageRuntime::ObjCISA m_isa;
+ ObjCLanguageRuntime::ObjCISA m_parent_isa;
+ bool m_valid;
+ lldb::ProcessWP m_process_wp;
+ uint64_t m_instance_size;
+ bool m_realized;
+};
+
+class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
+{
+public:
+ ClassDescriptorV2Tagged (ValueObject &isa_pointer)
+ {
+ m_valid = false;
+ uint64_t value = isa_pointer.GetValueAsUnsigned(0);
+ lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
+ if (process_sp)
+ m_pointer_size = process_sp->GetAddressByteSize();
+ else
+ {
+ m_name = ConstString("");
+ m_pointer_size = 0;
+ return;
+ }
+
+ m_valid = true;
+ m_class_bits = (value & 0xE) >> 1;
+ lldb::TargetSP target_sp = isa_pointer.GetTargetSP();
+
+ LazyBool is_lion = IsLion(target_sp);
+
+ // TODO: check for OSX version - for now assume Mtn Lion
+ if (is_lion == eLazyBoolCalculate)
+ {
+ // if we can't determine the matching table (e.g. we have no Foundation),
+ // assume this is not a valid tagged pointer
+ m_valid = false;
+ }
+ else if (is_lion == eLazyBoolNo)
+ {
+ switch (m_class_bits)
+ {
+ case 0:
+ m_name = ConstString("NSAtom");
+ break;
+ case 3:
+ m_name = ConstString("NSNumber");
+ break;
+ case 4:
+ m_name = ConstString("NSDateTS");
+ break;
+ case 5:
+ m_name = ConstString("NSManagedObject");
+ break;
+ case 6:
+ m_name = ConstString("NSDate");
+ break;
+ default:
+ m_valid = false;
+ break;
+ }
+ }
+ else
+ {
+ switch (m_class_bits)
+ {
+ case 1:
+ m_name = ConstString("NSNumber");
+ break;
+ case 5:
+ m_name = ConstString("NSManagedObject");
+ break;
+ case 6:
+ m_name = ConstString("NSDate");
+ break;
+ case 7:
+ m_name = ConstString("NSDateTS");
+ break;
+ default:
+ m_valid = false;
+ break;
+ }
+ }
+ if (!m_valid)
+ m_name = ConstString("");
+ else
+ {
+ m_info_bits = (value & 0xF0ULL) >> 4;
+ m_value_bits = (value & ~0x0000000000000000FFULL) >> 8;
+ }
+ }
+
+ virtual ConstString
+ GetClassName ()
+ {
+ return m_name;
+ }
+
+ virtual ObjCLanguageRuntime::ClassDescriptorSP
+ GetSuperclass ()
+ {
+ // tagged pointers can represent a class that has a superclass, but since that information is not
+ // stored in the object itself, we would have to query the runtime to discover the hierarchy
+ // for the time being, we skip this step in the interest of static discovery
+ return ObjCLanguageRuntime::ClassDescriptorSP(new ObjCLanguageRuntime::ClassDescriptor_Invalid());
+ }
+
+ virtual bool
+ IsValid ()
+ {
+ return m_valid;
+ }
+
+ virtual bool
+ IsKVO ()
+ {
+ return false; // tagged pointers are not KVO'ed
+ }
+
+ virtual bool
+ IsCFType ()
+ {
+ return false; // tagged pointers are not CF objects
+ }
+
+ virtual bool
+ IsTagged ()
+ {
+ return true; // we use this class to describe tagged pointers
+ }
+
+ virtual uint64_t
+ GetInstanceSize ()
+ {
+ return (IsValid() ? m_pointer_size : 0);
+ }
+
+ virtual ObjCLanguageRuntime::ObjCISA
+ GetISA ()
+ {
+ return 0; // tagged pointers have no ISA
+ }
+
+ virtual uint64_t
+ GetClassBits ()
+ {
+ return (IsValid() ? m_class_bits : 0);
+ }
+
+ // these calls are not part of any formal tagged pointers specification
+ virtual uint64_t
+ GetValueBits ()
+ {
+ return (IsValid() ? m_value_bits : 0);
+ }
+
+ virtual uint64_t
+ GetInfoBits ()
+ {
+ return (IsValid() ? m_info_bits : 0);
+ }
+
+ virtual
+ ~ClassDescriptorV2Tagged ()
+ {}
+
+protected:
+ // TODO make this into a smarter OS version detector
+ LazyBool
+ IsLion (lldb::TargetSP &target_sp)
+ {
+ if (!target_sp)
+ return eLazyBoolCalculate;
+ ModuleList& modules = target_sp->GetImages();
+ for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+ {
+ lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
+ if (!module_sp)
+ continue;
+ if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
+ {
+ uint32_t major = UINT32_MAX;
+ module_sp->GetVersion(&major,1);
+ if (major == UINT32_MAX)
+ return eLazyBoolCalculate;
+
+ return (major > 900 ? eLazyBoolNo : eLazyBoolYes);
+ }
+ }
+ return eLazyBoolCalculate;
+ }
+
+private:
+ ConstString m_name;
+ uint8_t m_pointer_size;
+ bool m_valid;
+ uint64_t m_class_bits;
+ uint64_t m_info_bits;
+ uint64_t m_value_bits;
+};
+
ObjCLanguageRuntime::ClassDescriptorSP
AppleObjCRuntimeV2::GetClassDescriptor (ObjCISA isa)
{
@@ -605,7 +1402,7 @@
{
uint64_t ptr_value = in_value.GetValueAsUnsigned(0);
if (ptr_value == 0)
- return NULL;
+ return ObjCLanguageRuntime::ClassDescriptorSP();
ObjCISA isa = GetISA(in_value);
@@ -626,6 +1423,148 @@
return descriptor;
}
+ModuleSP FindLibobjc (Target &target)
+{
+ ModuleList& modules = target.GetImages();
+ for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+ {
+ 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;
+ }
+
+ return ModuleSP();
+}
+
+void
+AppleObjCRuntimeV2::UpdateISAToDescriptorMap_Impl()
+{
+ lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+
+ Process *process_ptr = GetProcess();
+
+ if (!process_ptr)
+ return;
+
+ ProcessSP process_sp = process_ptr->shared_from_this();
+
+ Target &target(process_sp->GetTarget());
+
+ ModuleSP objc_module_sp(FindLibobjc(target));
+
+ 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;
+
+ 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;
+ }
+
+ RemoteNXMapTable gdb_objc_realized_classes(process_sp, gdb_objc_realized_classes_nxmaptable_la);
+
+ for (RemoteNXMapTable::element elt : gdb_objc_realized_classes)
+ {
+ if (m_isa_to_descriptor_cache.count(elt.second))
+ continue;
+
+ ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(elt.second, process_sp));
+
+ if (log)
+ 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)
+ 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 (m_isa_to_descriptor_cache.count(objc_isa))
+ continue;
+
+ ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(objc_isa, process_sp));
+
+ if (log)
+ 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
@@ -645,7 +1584,33 @@
// 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());
@@ -678,7 +1643,32 @@
static const ConstString g_objc_tagged_isa_name ("_lldb_Tagged_ObjC_ISA");
return g_objc_tagged_isa_name;
}
-
+ if (isa == g_objc_Tagged_ISA_NSAtom)
+ {
+ static const ConstString g_objc_tagged_isa_nsatom_name ("NSAtom");
+ return g_objc_tagged_isa_nsatom_name;
+ }
+ if (isa == g_objc_Tagged_ISA_NSNumber)
+ {
+ static const ConstString g_objc_tagged_isa_nsnumber_name ("NSNumber");
+ return g_objc_tagged_isa_nsnumber_name;
+ }
+ if (isa == g_objc_Tagged_ISA_NSDateTS)
+ {
+ static const ConstString g_objc_tagged_isa_nsdatets_name ("NSDateTS");
+ return g_objc_tagged_isa_nsdatets_name;
+ }
+ if (isa == g_objc_Tagged_ISA_NSManagedObject)
+ {
+ static const ConstString g_objc_tagged_isa_nsmanagedobject_name ("NSManagedObject");
+ return g_objc_tagged_isa_nsmanagedobject_name;
+ }
+ if (isa == g_objc_Tagged_ISA_NSDate)
+ {
+ 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();
@@ -700,262 +1690,11 @@
return descriptor->GetClassName();
}
-SymbolVendor *
-AppleObjCRuntimeV2::GetSymbolVendor()
-{
- if (!m_symbol_vendor_ap.get())
- m_symbol_vendor_ap.reset(new AppleObjCSymbolVendor(m_process));
-
- return m_symbol_vendor_ap.get();
-}
-
-AppleObjCRuntimeV2::ClassDescriptorV2::ClassDescriptorV2 (ValueObject &isa_pointer)
-{
- ObjCISA ptr_value = isa_pointer.GetValueAsUnsigned(0);
-
- lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
-
- Initialize (ptr_value,process_sp);
-}
-
-AppleObjCRuntimeV2::ClassDescriptorV2::ClassDescriptorV2 (ObjCISA isa, lldb::ProcessSP process_sp)
-{
- Initialize (isa, process_sp);
-}
-
-void
-AppleObjCRuntimeV2::ClassDescriptorV2::Initialize (ObjCISA isa, lldb::ProcessSP process_sp)
-{
- if (!isa || !process_sp)
- {
- m_valid = false;
- return;
- }
-
- m_valid = true;
-
- Error error;
-
- m_isa = process_sp->ReadPointerFromMemory(isa, error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- uint32_t ptr_size = process_sp->GetAddressByteSize();
-
- if (!IsPointerValid(m_isa,ptr_size,false,false,true))
- {
- m_valid = false;
- return;
- }
-
- lldb::addr_t data_ptr = process_sp->ReadPointerFromMemory(m_isa + 4 * ptr_size, error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- if (!IsPointerValid(data_ptr,ptr_size,false,false,true))
- {
- m_valid = false;
- return;
- }
-
- m_parent_isa = process_sp->ReadPointerFromMemory(isa + ptr_size,error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- // sanity checks
- lldb::addr_t cache_ptr = process_sp->ReadPointerFromMemory(m_isa + 2*ptr_size, error);
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
- if (!IsPointerValid(cache_ptr,ptr_size,true,false,true))
- {
- m_valid = false;
- return;
- }
- lldb::addr_t vtable_ptr = process_sp->ReadPointerFromMemory(m_isa + 3*ptr_size, error);
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
- if (!IsPointerValid(vtable_ptr,ptr_size,true,false,true))
- {
- m_valid = false;
- return;
- }
-
- // now construct the data object
-
- lldb::addr_t rot_pointer = process_sp->ReadPointerFromMemory(data_ptr + 8, error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- if (!IsPointerValid(rot_pointer,ptr_size))
- {
- m_valid = false;
- return;
- }
-
- // now read from the rot
-
- lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(rot_pointer + (ptr_size == 8 ? 24 : 16) ,error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
-
- size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer_sp->GetBytes(), 1024, error);
-
- if (error.Fail())
- {
- m_valid = false;
- return;
- }
-
- if (count)
- m_name = ConstString((char*)buffer_sp->GetBytes());
- else
- m_name = ConstString();
-
- m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(rot_pointer + 8, ptr_size, 0, error);
-
- m_process_wp = lldb::ProcessWP(process_sp);
-}
-
-AppleObjCRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::ClassDescriptorV2::GetSuperclass ()
-{
- if (!m_valid)
- return NULL;
- ProcessSP process_sp = m_process_wp.lock();
- if (!process_sp)
- return NULL;
- return AppleObjCRuntime::ClassDescriptorSP(new AppleObjCRuntimeV2::ClassDescriptorV2(m_parent_isa,process_sp));
-}
-
-AppleObjCRuntimeV2::ClassDescriptorV2Tagged::ClassDescriptorV2Tagged (ValueObject &isa_pointer)
+TypeVendor *
+AppleObjCRuntimeV2::GetTypeVendor()
{
- m_valid = false;
- uint64_t value = isa_pointer.GetValueAsUnsigned(0);
- lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
- if (process_sp)
- m_pointer_size = process_sp->GetAddressByteSize();
- else
- {
- m_name = ConstString("");
- m_pointer_size = 0;
- return;
- }
-
- m_valid = true;
- m_class_bits = (value & 0xE) >> 1;
- lldb::TargetSP target_sp = isa_pointer.GetTargetSP();
+ if (!m_type_vendor_ap.get())
+ m_type_vendor_ap.reset(new AppleObjCTypeVendor(*this));
- LazyBool is_lion = IsLion(target_sp);
-
- // TODO: check for OSX version - for now assume Mtn Lion
- if (is_lion == eLazyBoolCalculate)
- {
- // if we can't determine the matching table (e.g. we have no Foundation),
- // assume this is not a valid tagged pointer
- m_valid = false;
- }
- else if (is_lion == eLazyBoolNo)
- {
- switch (m_class_bits)
- {
- case 0:
- m_name = ConstString("NSAtom");
- break;
- case 3:
- m_name = ConstString("NSNumber");
- break;
- case 4:
- m_name = ConstString("NSDateTS");
- break;
- case 5:
- m_name = ConstString("NSManagedObject");
- break;
- case 6:
- m_name = ConstString("NSDate");
- break;
- default:
- m_valid = false;
- break;
- }
- }
- else
- {
- switch (m_class_bits)
- {
- case 1:
- m_name = ConstString("NSNumber");
- break;
- case 5:
- m_name = ConstString("NSManagedObject");
- break;
- case 6:
- m_name = ConstString("NSDate");
- break;
- case 7:
- m_name = ConstString("NSDateTS");
- break;
- default:
- m_valid = false;
- break;
- }
- }
- if (!m_valid)
- m_name = ConstString("");
- else
- {
- m_info_bits = (value & 0xF0ULL) >> 4;
- m_value_bits = (value & ~0x0000000000000000FFULL) >> 8;
- }
-}
-
-LazyBool
-AppleObjCRuntimeV2::ClassDescriptorV2Tagged::IsLion (lldb::TargetSP &target_sp)
-{
- if (!target_sp)
- return eLazyBoolCalculate;
- ModuleList& modules = target_sp->GetImages();
- for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
- {
- lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
- if (!module_sp)
- continue;
- if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
- {
- uint32_t major = UINT32_MAX;
- module_sp->GetVersion(&major,1);
- if (major == UINT32_MAX)
- return eLazyBoolCalculate;
-
- return (major > 900 ? eLazyBoolNo : eLazyBoolYes);
- }
- }
- return eLazyBoolCalculate;
+ return m_type_vendor_ap.get();
}
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Tue Sep 18 13:57:46 2012
@@ -27,165 +27,6 @@
public AppleObjCRuntime
{
public:
-
- class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
- {
- public:
- ClassDescriptorV2 (ValueObject &isa_pointer);
- ClassDescriptorV2 (ObjCISA isa, lldb::ProcessSP process);
-
- virtual ConstString
- GetClassName ()
- {
- return m_name;
- }
-
- virtual ClassDescriptorSP
- GetSuperclass ();
-
- virtual bool
- IsValid ()
- {
- return m_valid;
- }
-
- virtual bool
- IsTagged ()
- {
- return false; // we use a special class for tagged descriptors
- }
-
- virtual uint64_t
- GetInstanceSize ()
- {
- return m_instance_size;
- }
-
- virtual ObjCISA
- GetISA ()
- {
- return m_isa;
- }
-
- 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 (ObjCISA isa, lldb::ProcessSP process_sp);
-
- private:
- ConstString m_name;
- ObjCISA m_isa;
- ObjCISA m_parent_isa;
- bool m_valid;
- lldb::ProcessWP m_process_wp;
- uint64_t m_instance_size;
- };
-
- class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
- {
- public:
- ClassDescriptorV2Tagged (ValueObject &isa_pointer);
-
- virtual ConstString
- GetClassName ()
- {
- return m_name;
- }
-
- virtual ClassDescriptorSP
- GetSuperclass ()
- {
- // tagged pointers can represent a class that has a superclass, but since that information is not
- // stored in the object itself, we would have to query the runtime to discover the hierarchy
- // for the time being, we skip this step in the interest of static discovery
- return ClassDescriptorSP(new ObjCLanguageRuntime::ClassDescriptor_Invalid());
- }
-
- virtual bool
- IsValid ()
- {
- return m_valid;
- }
-
- virtual bool
- IsKVO ()
- {
- return false; // tagged pointers are not KVO'ed
- }
-
- virtual bool
- IsCFType ()
- {
- return false; // tagged pointers are not CF objects
- }
-
- virtual bool
- IsTagged ()
- {
- return true; // we use this class to describe tagged pointers
- }
-
- virtual uint64_t
- GetInstanceSize ()
- {
- return (IsValid() ? m_pointer_size : 0);
- }
-
- virtual ObjCISA
- GetISA ()
- {
- return 0; // tagged pointers have no ISA
- }
-
- virtual uint64_t
- GetClassBits ()
- {
- return (IsValid() ? m_class_bits : 0);
- }
-
- // these calls are not part of any formal tagged pointers specification
- virtual uint64_t
- GetValueBits ()
- {
- return (IsValid() ? m_value_bits : 0);
- }
-
- virtual uint64_t
- GetInfoBits ()
- {
- return (IsValid() ? m_info_bits : 0);
- }
-
- virtual
- ~ClassDescriptorV2Tagged ()
- {}
-
- protected:
- // TODO make this into a smarter OS version detector
- LazyBool
- IsLion (lldb::TargetSP &target_sp);
-
- private:
- ConstString m_name;
- uint8_t m_pointer_size;
- bool m_valid;
- uint64_t m_class_bits;
- uint64_t m_info_bits;
- uint64_t m_value_bits;
- };
-
virtual ~AppleObjCRuntimeV2() { }
// These are generic runtime functions:
@@ -232,19 +73,30 @@
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);
}
- // this is not a valid ISA in the sense that no valid
- // class pointer can live at address 1. we use it to refer to
- // tagged types, where the ISA must be dynamically determined
+ // none of these are valid ISAs - we use them to infer the type
+ // of tagged pointers - if we have something meaningful to say
+ // we report an actual type - otherwise, we just say tagged
+ // there is no connection between the values here and the tagged pointers map
static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA = 1;
+
+ static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSAtom = 2;
+ static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSNumber = 3;
+ static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDateTS = 4;
+ 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);
+ GetISA(ValueObject& valobj);
virtual ConstString
GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa);
@@ -255,8 +107,8 @@
virtual ClassDescriptorSP
GetClassDescriptor (ObjCISA isa);
- virtual SymbolVendor *
- GetSymbolVendor();
+ virtual TypeVendor *
+ GetTypeVendor();
protected:
virtual lldb::BreakpointResolverSP
@@ -278,7 +130,7 @@
lldb::addr_t m_get_class_name_args;
Mutex m_get_class_name_args_mutex;
- std::auto_ptr<SymbolVendor> m_symbol_vendor_ap;
+ std::auto_ptr<TypeVendor> m_type_vendor_ap;
static const char *g_find_class_name_function_name;
static const char *g_find_class_name_function_body;
Removed: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp?rev=164158&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp (removed)
@@ -1,83 +0,0 @@
-//===-- AppleObjCSymbolVendor.cpp -------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "AppleObjCSymbolVendor.h"
-
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Target.h"
-
-#include "clang/AST/ASTContext.h"
-
-using namespace lldb_private;
-
-AppleObjCSymbolVendor::AppleObjCSymbolVendor(Process *process) :
- SymbolVendor(lldb::ModuleSP()),
- m_process(process->shared_from_this()),
- m_ast_ctx(process->GetTarget().GetArchitecture().GetTriple().getTriple().c_str())
-{
-}
-
-uint32_t
-AppleObjCSymbolVendor::FindTypes (const SymbolContext& sc,
- const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
- bool append,
- uint32_t max_matches,
- TypeList& types)
-{
- lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); // FIXME - a more appropriate log channel?
-
- if (log)
- log->Printf("ObjC SymbolVendor asked for '%s'",
- name.AsCString());
-
- if (!append)
- types.Clear();
-
- uint32_t ret = 0;
-
- ModuleList &target_modules = m_process->GetTarget().GetImages();
- Mutex::Locker modules_locker(target_modules.GetMutex());
-
- for (size_t image_index = 0, end_index = target_modules.GetSize();
- image_index < end_index;
- ++image_index)
- {
- Module *image = target_modules.GetModulePointerAtIndexUnlocked(image_index);
-
- if (!image)
- continue;
-
- SymbolVendor *symbol_vendor = image->GetSymbolVendor();
-
- if (!symbol_vendor)
- continue;
-
- SymbolFile *symbol_file = image->GetSymbolVendor()->GetSymbolFile();
-
- // Don't use a symbol file if it actually has types. We are specifically
- // looking for something in runtime information, not from debug information,
- // as the data in debug information will get parsed by the debug info
- // symbol files. So we veto any symbol file that has actual variable
- // type parsing abilities.
- if (symbol_file == NULL || (symbol_file->GetAbilities() & SymbolFile::VariableTypes))
- continue;
-
- const bool inferior_append = true;
-
- ret += symbol_file->FindTypes (sc, name, namespace_decl, inferior_append, max_matches - ret, types);
-
- if (ret >= max_matches)
- break;
- }
-
- return ret;
-}
Removed: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.h?rev=164158&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.h (removed)
@@ -1,47 +0,0 @@
-//===-- AppleObjCSymbolVendor.h ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_AppleObjCSymbolVendor_h_
-#define liblldb_AppleObjCSymbolVendor_h_
-
-// C Includes
-// C++ Includes
-
-#include <map>
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/SymbolVendor.h"
-#include "lldb/Symbol/SymbolFile.h"
-
-namespace lldb_private {
-
-class AppleObjCSymbolVendor : public SymbolVendor
-{
-public:
- AppleObjCSymbolVendor(Process* process);
-
- virtual uint32_t
- FindTypes (const SymbolContext& sc,
- const ConstString &name,
- const ClangNamespaceDecl *namespace_decl,
- bool append,
- uint32_t max_matches,
- TypeList& types);
-
-private:
- lldb::ProcessSP m_process;
- ClangASTContext m_ast_ctx;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_AppleObjCSymbolVendor_h_
Modified: lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Tue Sep 18 13:57:46 2012
@@ -289,10 +289,10 @@
if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data))
{
Timer scoped_timer (__PRETTY_FUNCTION__,
- "ObjectContainerBSDArchive::CreateInstance (module = %s/%s, file = %p, file_offset = 0x%z8.8x, file_size = 0x%z8.8x)",
+ "ObjectContainerBSDArchive::CreateInstance (module = %s/%s, file = %p, file_offset = 0x%8.8llx, file_size = 0x%8.8llx)",
module_sp->GetFileSpec().GetDirectory().AsCString(),
module_sp->GetFileSpec().GetFilename().AsCString(),
- file, offset, length);
+ file, (uint64_t) offset, (uint64_t) length);
Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module_sp->GetArchitecture(), module_sp->GetModificationTime()));
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Sep 18 13:57:46 2012
@@ -1482,36 +1482,36 @@
FileSpec dsc_filespec(dsc_path, false);
// We need definitions of two structures in the on-disk DSC, copy them here manually
-struct lldb_copy_dyld_cache_header
-{
- char magic[16];
- uint32_t mappingOffset;
- uint32_t mappingCount;
- uint32_t imagesOffset;
- uint32_t imagesCount;
- uint64_t dyldBaseAddress;
- uint64_t codeSignatureOffset;
- uint64_t codeSignatureSize;
- uint64_t slideInfoOffset;
- uint64_t slideInfoSize;
- uint64_t localSymbolsOffset;
- uint64_t localSymbolsSize;
-};
-struct lldb_copy_dyld_cache_local_symbols_info
-{
- uint32_t nlistOffset;
- uint32_t nlistCount;
- uint32_t stringsOffset;
- uint32_t stringsSize;
- uint32_t entriesOffset;
- uint32_t entriesCount;
-};
-struct lldb_copy_dyld_cache_local_symbols_entry
-{
- uint32_t dylibOffset;
- uint32_t nlistStartIndex;
- uint32_t nlistCount;
-};
+ struct lldb_copy_dyld_cache_header
+ {
+ char magic[16];
+ uint32_t mappingOffset;
+ uint32_t mappingCount;
+ uint32_t imagesOffset;
+ uint32_t imagesCount;
+ uint64_t dyldBaseAddress;
+ uint64_t codeSignatureOffset;
+ uint64_t codeSignatureSize;
+ uint64_t slideInfoOffset;
+ uint64_t slideInfoSize;
+ uint64_t localSymbolsOffset;
+ uint64_t localSymbolsSize;
+ };
+ struct lldb_copy_dyld_cache_local_symbols_info
+ {
+ uint32_t nlistOffset;
+ uint32_t nlistCount;
+ uint32_t stringsOffset;
+ uint32_t stringsSize;
+ uint32_t entriesOffset;
+ uint32_t entriesCount;
+ };
+ struct lldb_copy_dyld_cache_local_symbols_entry
+ {
+ uint32_t dylibOffset;
+ uint32_t nlistStartIndex;
+ uint32_t nlistCount;
+ };
/* The dyld_cache_header has a pointer to the dyld_cache_local_symbols_info structure (localSymbolsOffset).
The dyld_cache_local_symbols_info structure gives us three things:
@@ -1823,6 +1823,24 @@
if (so_path && so_path[0])
{
std::string full_so_path (so_path);
+ const size_t double_slash_pos = full_so_path.find("//");
+ if (double_slash_pos != std::string::npos)
+ {
+ // The linker has been generating bad N_SO entries with doubled up paths
+ // in the format "%s%s" where the first stirng in the DW_AT_comp_dir,
+ // and the second is the directory for the source file so you end up with
+ // a path that looks like "/tmp/src//tmp/src/"
+ FileSpec so_dir(so_path, false);
+ if (!so_dir.Exists())
+ {
+ so_dir.SetFile(&full_so_path[double_slash_pos + 1], false);
+ if (so_dir.Exists())
+ {
+ // Trim off the incorrect path
+ full_so_path.erase(0, double_slash_pos + 1);
+ }
+ }
+ }
if (*full_so_path.rbegin() != '/')
full_so_path += '/';
full_so_path += symbol_name;
@@ -1831,8 +1849,12 @@
m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
}
}
+ else
+ {
+ // This could be a relative path to a N_SO
+ N_SO_index = sym_idx;
+ }
}
-
break;
case StabObjectFileName:
@@ -2542,6 +2564,24 @@
if (so_path && so_path[0])
{
std::string full_so_path (so_path);
+ const size_t double_slash_pos = full_so_path.find("//");
+ if (double_slash_pos != std::string::npos)
+ {
+ // The linker has been generating bad N_SO entries with doubled up paths
+ // in the format "%s%s" where the first stirng in the DW_AT_comp_dir,
+ // and the second is the directory for the source file so you end up with
+ // a path that looks like "/tmp/src//tmp/src/"
+ FileSpec so_dir(so_path, false);
+ if (!so_dir.Exists())
+ {
+ so_dir.SetFile(&full_so_path[double_slash_pos + 1], false);
+ if (so_dir.Exists())
+ {
+ // Trim off the incorrect path
+ full_so_path.erase(0, double_slash_pos + 1);
+ }
+ }
+ }
if (*full_so_path.rbegin() != '/')
full_so_path += '/';
full_so_path += symbol_name;
@@ -2550,6 +2590,11 @@
m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
}
}
+ else
+ {
+ // This could be a relative path to a N_SO
+ N_SO_index = sym_idx;
+ }
}
break;
Modified: lldb/branches/windows/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Tue Sep 18 13:57:46 2012
@@ -43,10 +43,14 @@
create = true;
break;
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+ // Only accept "unknown" for the vendor if the host is BSD and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownArch:
create = !arch->TripleVendorWasSpecified();
break;
-
+#endif
default:
break;
}
@@ -59,10 +63,14 @@
case llvm::Triple::KFreeBSD:
break;
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+ // Only accept "unknown" for the OS if the host is BSD and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownOS:
create = arch->TripleOSWasSpecified();
break;
-
+#endif
default:
create = false;
break;
Modified: lldb/branches/windows/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/Linux/PlatformLinux.cpp Tue Sep 18 13:57:46 2012
@@ -46,10 +46,14 @@
create = true;
break;
+#if defined(__linux__)
+ // Only accept "unknown" for the vendor if the host is linux and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified_
case llvm::Triple::UnknownArch:
create = !arch->TripleVendorWasSpecified();
break;
-
+#endif
default:
break;
}
@@ -61,10 +65,14 @@
case llvm::Triple::Linux:
break;
+#if defined(__linux__)
+ // Only accept "unknown" for the OS if the host is linux and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownOS:
create = !arch->TripleOSWasSpecified();
break;
-
+#endif
default:
create = false;
break;
@@ -304,6 +312,17 @@
arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
return arch.IsValid();
}
+ else if (idx == 1)
+ {
+ // If the default host architecture is 64-bit, look for a 32-bit variant
+ ArchSpec hostArch
+ = Host::GetArchitecture(Host::eSystemDefaultArchitecture);
+ if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ {
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ return arch.IsValid();
+ }
+ }
return false;
}
Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Tue Sep 18 13:57:46 2012
@@ -19,6 +19,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
@@ -170,6 +171,33 @@
return error;
}
+Error
+PlatformDarwin::ResolveSymbolFile (Target &target,
+ const ModuleSpec &sym_spec,
+ FileSpec &sym_file)
+{
+ Error error;
+ sym_file = sym_spec.GetSymbolFileSpec();
+ if (sym_file.Exists())
+ {
+ if (sym_file.GetFileType() == FileSpec::eFileTypeDirectory)
+ {
+ sym_file = Symbols::FindSymbolFileInBundle (sym_file,
+ sym_spec.GetUUIDPtr(),
+ sym_spec.GetArchitecturePtr());
+ }
+ }
+ else
+ {
+ if (sym_spec.GetUUID().IsValid())
+ {
+
+ }
+ }
+ return error;
+
+}
+
Error
Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwin.h Tue Sep 18 13:57:46 2012
@@ -34,6 +34,11 @@
const lldb_private::FileSpecList *module_search_paths_ptr);
virtual lldb_private::Error
+ ResolveSymbolFile (lldb_private::Target &target,
+ const lldb_private::ModuleSpec &sym_spec,
+ lldb_private::FileSpec &sym_file);
+
+ virtual lldb_private::Error
GetSharedModule (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr,
Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Tue Sep 18 13:57:46 2012
@@ -79,10 +79,14 @@
create = true;
break;
+#if defined(__APPLE__)
+ // Only accept "unknown" for vendor if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownArch:
create = !arch->TripleVendorWasSpecified();
break;
-
+#endif
default:
break;
}
@@ -94,11 +98,14 @@
case llvm::Triple::Darwin: // Deprecated, but still support Darwin for historical reasons
case llvm::Triple::MacOSX:
break;
-
+#if defined(__APPLE__)
+ // Only accept "vendor" for vendor if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownOS:
create = !arch->TripleOSWasSpecified();
break;
-
+#endif
default:
create = false;
break;
Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Tue Sep 18 13:57:46 2012
@@ -102,14 +102,18 @@
create = true;
break;
+#if defined(__APPLE__)
+ // Only accept "unknown" for the vendor if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownArch:
create = !arch->TripleVendorWasSpecified();
break;
+#endif
default:
break;
}
-
if (create)
{
switch (triple.getOS())
@@ -118,10 +122,14 @@
case llvm::Triple::IOS: // This is the right triple value for iOS debugging
break;
+#if defined(__APPLE__)
+ // Only accept "unknown" for the OS if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownOS:
create = !arch->TripleOSWasSpecified();
break;
-
+#endif
default:
create = false;
break;
Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Tue Sep 18 13:57:46 2012
@@ -78,10 +78,14 @@
create = true;
break;
+#if defined(__APPLE__)
+ // Only accept "unknown" for the vendor if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownArch:
create = !arch->TripleVendorWasSpecified();
break;
-
+#endif
default:
break;
}
@@ -95,10 +99,14 @@
case llvm::Triple::IOS: // IOS is not used for simulator triples, but accept it just in case
break;
+#if defined(__APPLE__)
+ // Only accept "unknown" for the OS if the host is Apple and
+ // it "unknown" wasn't specified (it was just returned becasue it
+ // was NOT specified)
case llvm::Triple::UnknownOS:
create = !arch->TripleOSWasSpecified();
break;
-
+#endif
default:
create = false;
break;
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue Sep 18 13:57:46 2012
@@ -77,19 +77,19 @@
verbose_log->Printf("PTRACE_POKETEXT %s", buf.GetData());
break;
}
- case PTRACE_POKEDATA:
+ case PTRACE_POKEDATA:
{
DisplayBytes(buf, &data, 8);
verbose_log->Printf("PTRACE_POKEDATA %s", buf.GetData());
break;
}
- case PTRACE_POKEUSER:
+ case PTRACE_POKEUSER:
{
DisplayBytes(buf, &data, 8);
verbose_log->Printf("PTRACE_POKEUSER %s", buf.GetData());
break;
}
- case PTRACE_SETREGS:
+ case PTRACE_SETREGS:
{
DisplayBytes(buf, data, sizeof(user_regs_struct));
verbose_log->Printf("PTRACE_SETREGS %s", buf.GetData());
@@ -101,7 +101,7 @@
verbose_log->Printf("PTRACE_SETFPREGS %s", buf.GetData());
break;
}
- case PTRACE_SETSIGINFO:
+ case PTRACE_SETSIGINFO:
{
DisplayBytes(buf, data, sizeof(siginfo_t));
verbose_log->Printf("PTRACE_SETSIGINFO %s", buf.GetData());
@@ -126,7 +126,7 @@
if (log)
log->Printf("ptrace(%s, %u, %p, %p) called from file %s line %d",
reqName, pid, addr, data, file, line);
-
+
PtraceDisplayBytes(req, data);
errno = 0;
@@ -163,9 +163,11 @@
// functions without needed to go thru the thread funnel.
static size_t
-DoReadMemory(lldb::pid_t pid, unsigned word_size,
+DoReadMemory(lldb::pid_t pid,
lldb::addr_t vm_addr, void *buf, size_t size, Error &error)
{
+ // ptrace word size is determined by the host, not the child
+ static const unsigned word_size = sizeof(void*);
unsigned char *dst = static_cast<unsigned char*>(buf);
size_t bytes_read;
size_t remainder;
@@ -179,7 +181,6 @@
pid, word_size, (void*)vm_addr, buf, size);
assert(sizeof(data) >= word_size);
- assert(sizeof(void*) == word_size);
for (bytes_read = 0; bytes_read < size; bytes_read += remainder)
{
errno = 0;
@@ -218,9 +219,11 @@
}
static size_t
-DoWriteMemory(lldb::pid_t pid, unsigned word_size,
+DoWriteMemory(lldb::pid_t pid,
lldb::addr_t vm_addr, const void *buf, size_t size, Error &error)
{
+ // ptrace word size is determined by the host, not the child
+ static const unsigned word_size = sizeof(void*);
const unsigned char *src = static_cast<const unsigned char*>(buf);
size_t bytes_written = 0;
size_t remainder;
@@ -232,7 +235,6 @@
log->Printf ("ProcessMonitor::%s(%d, %d, %p, %p, %d, _)", __FUNCTION__,
pid, word_size, (void*)vm_addr, buf, size);
- assert(sizeof(void*) == word_size);
for (bytes_written = 0; bytes_written < size; bytes_written += remainder)
{
remainder = size - bytes_written;
@@ -263,7 +265,7 @@
else
{
unsigned char buff[8];
- if (DoReadMemory(pid, word_size, vm_addr,
+ if (DoReadMemory(pid, vm_addr,
buff, word_size, error) != word_size)
{
if (log)
@@ -273,7 +275,7 @@
memcpy(buff, src, remainder);
- if (DoWriteMemory(pid, word_size, vm_addr,
+ if (DoWriteMemory(pid, vm_addr,
buff, word_size, error) != word_size)
{
if (log)
@@ -361,10 +363,9 @@
void
ReadOperation::Execute(ProcessMonitor *monitor)
{
- const unsigned word_size = monitor->GetProcess().GetAddressByteSize();
lldb::pid_t pid = monitor->GetPID();
- m_result = DoReadMemory(pid, word_size, m_addr, m_buff, m_size, m_error);
+ m_result = DoReadMemory(pid, m_addr, m_buff, m_size, m_error);
}
//------------------------------------------------------------------------------
@@ -392,10 +393,9 @@
void
WriteOperation::Execute(ProcessMonitor *monitor)
{
- const unsigned word_size = monitor->GetProcess().GetAddressByteSize();
lldb::pid_t pid = monitor->GetPID();
- m_result = DoWriteMemory(pid, word_size, m_addr, m_buff, m_size, m_error);
+ m_result = DoWriteMemory(pid, m_addr, m_buff, m_size, m_error);
}
@@ -744,7 +744,7 @@
if (ptrace(PT_DETACH, pid, NULL, 0) < 0)
m_error.SetErrorToErrno();
-
+
}
ProcessMonitor::OperationArgs::OperationArgs(ProcessMonitor *monitor)
@@ -1060,22 +1060,22 @@
args->m_error.SetErrorToGenericError();
switch (WEXITSTATUS(status))
{
- case ePtraceFailed:
+ case ePtraceFailed:
args->m_error.SetErrorString("Child ptrace failed.");
break;
- case eDupStdinFailed:
+ case eDupStdinFailed:
args->m_error.SetErrorString("Child open stdin failed.");
break;
- case eDupStdoutFailed:
+ case eDupStdoutFailed:
args->m_error.SetErrorString("Child open stdout failed.");
break;
- case eDupStderrFailed:
+ case eDupStderrFailed:
args->m_error.SetErrorString("Child open stderr failed.");
break;
- case eExecFailed:
+ case eExecFailed:
args->m_error.SetErrorString("Child exec failed.");
break;
- default:
+ default:
args->m_error.SetErrorString("Child returned unknown exit status.");
break;
}
@@ -1228,7 +1228,7 @@
case SIGTRAP:
message = MonitorSIGTRAP(monitor, &info, pid);
break;
-
+
default:
message = MonitorSignal(monitor, &info, pid);
break;
@@ -1342,7 +1342,7 @@
reason = ProcessMessage::eInvalidCrashReason;
- switch (info->si_code)
+ switch (info->si_code)
{
default:
assert(false && "unexpected si_code for SIGSEGV");
@@ -1354,7 +1354,7 @@
reason = ProcessMessage::ePrivilegedAddress;
break;
}
-
+
return reason;
}
@@ -1675,7 +1675,7 @@
DoOperation(&op);
StopMonitor();
return result;
-}
+}
bool
ProcessMonitor::DupDescriptor(const char *path, int fd, int flags)
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Tue Sep 18 13:57:46 2012
@@ -145,7 +145,7 @@
return true;
if (log)
- log->Printf ("error: failed to send packet entire packet %zu of %zu bytes sent", bytes_written, packet_size);
+ log->Printf ("error: failed to send packet entire packet %llu of %llu bytes sent", (uint64_t)bytes_written, (uint64_t)packet_size);
}
return false;
}
@@ -189,12 +189,12 @@
size_t bytes_read = Read (buffer, sizeof(buffer), timeout_usec, status, &error);
if (log)
- log->Printf ("%s: Read (buffer, (sizeof(buffer), timeout_usec = 0x%x, status = %s, error = %s) => bytes_read = %zu",
+ log->Printf ("%s: Read (buffer, (sizeof(buffer), timeout_usec = 0x%x, status = %s, error = %s) => bytes_read = %llu",
__PRETTY_FUNCTION__,
timeout_usec,
Communication::ConnectionStatusAsCString (status),
error.AsCString(),
- bytes_read);
+ (uint64_t)bytes_read);
if (bytes_read > 0)
{
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Tue Sep 18 13:57:46 2012
@@ -118,6 +118,12 @@
}
Error
+ProcessPOSIX::DoAttachToProcessWithID (lldb::pid_t pid, const ProcessAttachInfo &attach_info)
+{
+ return DoAttachToProcessWithID(pid);
+}
+
+Error
ProcessPOSIX::WillLaunch(Module* module)
{
Error error;
Modified: lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.h?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.h (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/ProcessPOSIX.h Tue Sep 18 13:57:46 2012
@@ -49,6 +49,9 @@
DoAttachToProcessWithID(lldb::pid_t pid);
virtual lldb_private::Error
+ DoAttachToProcessWithID (lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info);
+
+ virtual lldb_private::Error
DoLaunch (lldb_private::Module *exe_module,
const lldb_private::ProcessLaunchInfo &launch_info);
Modified: lldb/branches/windows/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Tue Sep 18 13:57:46 2012
@@ -15,7 +15,10 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
+
+#ifndef LLDB_DISABLE_PYTHON
#include "lldb/Interpreter/PythonDataObjects.h"
+#endif
using namespace lldb;
using namespace lldb_private;
@@ -47,6 +50,7 @@
size_t
DynamicRegisterInfo::SetRegisterInfo (const lldb_private::PythonDataDictionary &dict)
{
+#ifndef LLDB_DISABLE_PYTHON
PythonDataArray sets (dict.GetItemForKey("sets").GetArrayObject());
if (sets)
{
@@ -160,6 +164,7 @@
}
Finalize ();
}
+#endif
return 0;
}
Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue Sep 18 13:57:46 2012
@@ -298,12 +298,12 @@
size_t bytes_read = Read (buffer, sizeof(buffer), timeout_usec, status, &error);
if (log)
- log->Printf ("%s: Read (buffer, (sizeof(buffer), timeout_usec = 0x%x, status = %s, error = %s) => bytes_read = %zu",
+ log->Printf ("%s: Read (buffer, (sizeof(buffer), timeout_usec = 0x%x, status = %s, error = %s) => bytes_read = %llu",
__PRETTY_FUNCTION__,
timeout_usec,
Communication::ConnectionStatusAsCString (status),
error.AsCString(),
- bytes_read);
+ (uint64_t)bytes_read);
if (bytes_read > 0)
{
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Tue Sep 18 13:57:46 2012
@@ -1219,7 +1219,8 @@
{
m_supports_alloc_dealloc_memory = eLazyBoolYes;
char packet[64];
- const int packet_len = ::snprintf (packet, sizeof(packet), "_M%zx,%s%s%s", size,
+ const int packet_len = ::snprintf (packet, sizeof(packet), "_M%llx,%s%s%s",
+ (uint64_t)size,
permissions & lldb::ePermissionsReadable ? "r" : "",
permissions & lldb::ePermissionsWritable ? "w" : "",
permissions & lldb::ePermissionsExecutable ? "x" : "");
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Sep 18 13:57:46 2012
@@ -1756,7 +1756,7 @@
ThreadList &threads = GetThreadList();
{
- Mutex::Locker(threads.GetMutex());
+ Mutex::Locker locker(threads.GetMutex());
size_t num_threads = threads.GetSize();
for (size_t i = 0; i < num_threads; i++)
@@ -1791,7 +1791,7 @@
// have to run the risk of letting those threads proceed a bit.
{
- Mutex::Locker(threads.GetMutex());
+ Mutex::Locker locker(threads.GetMutex());
size_t num_threads = threads.GetSize();
for (size_t i = 0; i < num_threads; i++)
@@ -1910,7 +1910,7 @@
}
char packet[64];
- const int packet_len = ::snprintf (packet, sizeof(packet), "m%llx,%zx", (uint64_t)addr, size);
+ const int packet_len = ::snprintf (packet, sizeof(packet), "m%llx,%llx", (uint64_t)addr, (uint64_t)size);
assert (packet_len + 1 < sizeof(packet));
StringExtractorGDBRemote response;
if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
@@ -1946,7 +1946,7 @@
}
StreamString packet;
- packet.Printf("M%llx,%zx:", addr, size);
+ packet.Printf("M%llx,%llx:", addr, (uint64_t)size);
packet.PutBytesAsRawHex8(buf, size, lldb::endian::InlHostByteOrder(), lldb::endian::InlHostByteOrder());
StringExtractorGDBRemote response;
if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetData(), packet.GetSize(), response, true))
@@ -2003,7 +2003,7 @@
}
if (allocated_addr == LLDB_INVALID_ADDRESS)
- error.SetErrorStringWithFormat("unable to allocate %zu bytes of memory with permissions %s", size, GetPermissionsAsCString (permissions));
+ error.SetErrorStringWithFormat("unable to allocate %llu bytes of memory with permissions %s", (uint64_t)size, GetPermissionsAsCString (permissions));
else
error.Clear();
return allocated_addr;
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Tue Sep 18 13:57:46 2012
@@ -142,7 +142,7 @@
if (log)
{
orig_arange_size = m_aranges.GetSize();
- log->Printf ("DWARFDebugAranges::Sort(minimize = %u) with %zu entries", minimize, orig_arange_size);
+ log->Printf ("DWARFDebugAranges::Sort(minimize = %u) with %llu entries", minimize, (uint64_t)orig_arange_size);
}
m_aranges.Sort();
@@ -154,8 +154,10 @@
{
const size_t new_arange_size = m_aranges.GetSize();
const size_t delta = orig_arange_size - new_arange_size;
- log->Printf ("DWARFDebugAranges::Sort() %zu entries after minimizing (%zu entries combined for %zu bytes saved)",
- new_arange_size, delta, delta * sizeof(Range));
+ log->Printf ("DWARFDebugAranges::Sort() %llu entries after minimizing (%llu entries combined for %llu bytes saved)",
+ (uint64_t)new_arange_size,
+ (uint64_t)delta,
+ (uint64_t)delta * sizeof(Range));
}
Dump (log.get());
}
Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp Tue Sep 18 13:57:46 2012
@@ -32,11 +32,11 @@
DWARFDebugPubnames::Extract(const DataExtractor& data)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
- "DWARFDebugPubnames::Extract (byte_size = %zu)",
- data.GetByteSize());
+ "DWARFDebugPubnames::Extract (byte_size = %llu)",
+ (uint64_t)data.GetByteSize());
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
if (log)
- log->Printf("DWARFDebugPubnames::Extract (byte_size = %zu)", data.GetByteSize());
+ log->Printf("DWARFDebugPubnames::Extract (byte_size = %llu)", (uint64_t)data.GetByteSize());
if (data.ValidOffset(0))
{
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Sep 18 13:57:46 2012
@@ -126,15 +126,15 @@
{
StreamString log_strm;
const size_t n = m_dies.size();
- log_strm.Printf("DIEStack[%zu]:\n", n);
+ log_strm.Printf("DIEStack[%llu]:\n", (uint64_t)n);
for (size_t i=0; i<n; i++)
{
DWARFCompileUnit *cu = m_dies[i].cu;
const DWARFDebugInfoEntry *die = m_dies[i].die;
std::string qualified_name;
die->GetQualifiedName(dwarf, cu, qualified_name);
- log_strm.Printf ("[%zu] 0x%8.8x: %s name='%s'\n",
- i,
+ log_strm.Printf ("[%llu] 0x%8.8x: %s name='%s'\n",
+ (uint64_t)i,
die->GetOffset(),
DW_TAG_value_to_name(die->Tag()),
qualified_name.c_str());
Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Tue Sep 18 13:57:46 2012
@@ -344,10 +344,10 @@
if (log && log->GetVerbose ())
{
StreamString strm;
- strm.Printf ("UnwindAssemblyInstEmulation::ReadMemory (addr = 0x%16.16llx, dst = %p, dst_len = %zu, context = ",
+ strm.Printf ("UnwindAssemblyInstEmulation::ReadMemory (addr = 0x%16.16llx, dst = %p, dst_len = %llu, context = ",
addr,
dst,
- dst_len);
+ (uint64_t)dst_len);
context.Dump(strm, instruction);
log->PutCString (strm.GetData ());
}
Modified: lldb/branches/windows/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTContext.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTContext.cpp Tue Sep 18 13:57:46 2012
@@ -4500,8 +4500,6 @@
named_decl_pos != path->Decls.second && parent_record_decl;
++named_decl_pos)
{
- //printf ("path[%zu] = %s\n", child_indexes.size(), (*named_decl_pos)->getNameAsCString());
-
child_idx = GetIndexForRecordChild (parent_record_decl, *named_decl_pos, omit_empty_base_classes);
if (child_idx == UINT32_MAX)
{
@@ -5603,7 +5601,7 @@
{
bool is_complete = cxx_record_decl->isCompleteDefinition();
if (!is_complete)
- is_complete = ClangASTContext::GetCompleteType (ast, clang_type);
+ is_complete = ClangASTContext::GetCompleteType (ast, pointee_qual_type.getAsOpaquePtr());
if (is_complete)
{
Modified: lldb/branches/windows/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ObjectFile.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ObjectFile.cpp (original)
+++ lldb/branches/windows/source/Symbol/ObjectFile.cpp Tue Sep 18 13:57:46 2012
@@ -34,10 +34,10 @@
if (module_sp)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
- "ObjectFile::FindPlugin (module = %s/%s, file = %p, file_offset = 0x%z8.8x, file_size = 0x%z8.8x)",
+ "ObjectFile::FindPlugin (module = %s/%s, file = %p, file_offset = 0x%8.8llx, file_size = 0x%8.8llx)",
module_sp->GetFileSpec().GetDirectory().AsCString(),
module_sp->GetFileSpec().GetFilename().AsCString(),
- file, file_offset, file_size);
+ file, (uint64_t) file_offset, (uint64_t) file_size);
if (file)
{
// Memory map the entire file contents
Modified: lldb/branches/windows/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Memory.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Memory.cpp (original)
+++ lldb/branches/windows/source/Target/Memory.cpp Tue Sep 18 13:57:46 2012
@@ -68,14 +68,11 @@
else
num_cache_lines = (UINT64_MAX - first_cache_line_addr + 1)/cache_line_byte_size;
- //printf ("MemoryCache::Flush (0x%16.16llx, %zu (0x%zx))\n", addr, size, size);
-
uint32_t cache_idx = 0;
for (addr_t curr_addr = first_cache_line_addr;
cache_idx < num_cache_lines;
curr_addr += cache_line_byte_size, ++cache_idx)
{
- //printf ("flushing: 0x%16.16llx\n", curr_addr); /// REMOVE THIS PRIOR TO CHECKIN!!!!
BlockMap::iterator pos = m_cache.find (curr_addr);
if (pos != m_cache.end())
m_cache.erase(pos);
Modified: lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp Tue Sep 18 13:57:46 2012
@@ -30,7 +30,8 @@
ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
LanguageRuntime (process),
- m_has_new_literals_and_indexing (eLazyBoolCalculate)
+ m_has_new_literals_and_indexing (eLazyBoolCalculate),
+ m_isa_to_descriptor_cache_is_up_to_date (false)
{
}
@@ -281,6 +282,33 @@
}
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();
+
+ 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))
Modified: lldb/branches/windows/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Platform.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Platform.cpp (original)
+++ lldb/branches/windows/source/Target/Platform.cpp Tue Sep 18 13:57:46 2012
@@ -466,6 +466,22 @@
return error;
}
+Error
+Platform::ResolveSymbolFile (Target &target,
+ const ModuleSpec &sym_spec,
+ FileSpec &sym_file)
+{
+ Error error;
+ if (sym_spec.GetSymbolFileSpec().Exists())
+ sym_file = sym_spec.GetSymbolFileSpec();
+ else
+ error.SetErrorString("unable to resolve symbol file");
+ return error;
+
+}
+
+
+
bool
Platform::ResolveRemotePath (const FileSpec &platform_path,
FileSpec &resolved_platform_path)
Modified: lldb/branches/windows/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Process.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Process.cpp (original)
+++ lldb/branches/windows/source/Target/Process.cpp Tue Sep 18 13:57:46 2012
@@ -1079,12 +1079,13 @@
StateType
-Process::WaitForProcessToStop (const TimeValue *timeout)
+Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp_ptr)
{
// We can't just wait for a "stopped" event, because the stopped event may have restarted the target.
// We have to actually check each event, and in the case of a stopped event check the restarted flag
// on the event.
- EventSP event_sp;
+ if (event_sp_ptr)
+ event_sp_ptr->reset();
StateType state = GetState();
// If we are exited or detached, we won't ever get back to any
// other valid state...
@@ -1093,7 +1094,11 @@
while (state != eStateInvalid)
{
+ EventSP event_sp;
state = WaitForStateChangedEvents (timeout, event_sp);
+ if (event_sp_ptr && event_sp)
+ *event_sp_ptr = event_sp;
+
switch (state)
{
case eStateCrashed:
@@ -2943,7 +2948,7 @@
Error
Process::PrivateResume ()
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_STEP));
if (log)
log->Printf("Process::Resume() m_stop_id = %u, public state: %s private state: %s",
m_mod_id.GetStopID(),
@@ -3109,6 +3114,7 @@
Error error (WillDestroy());
if (error.Success())
{
+ EventSP exit_event_sp;
if (m_public_state.GetValue() == eStateRunning)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
@@ -3118,10 +3124,12 @@
if (error.Success())
{
// Consume the halt event.
- EventSP stop_event;
TimeValue timeout (TimeValue::Now());
timeout.OffsetWithSeconds(1);
- StateType state = WaitForProcessToStop (&timeout);
+ StateType state = WaitForProcessToStop (&timeout, &exit_event_sp);
+ if (state != eStateExited)
+ exit_event_sp.reset(); // It is ok to consume any non-exit stop events
+
if (state != eStateStopped)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
@@ -3132,16 +3140,18 @@
StateType private_state = m_private_state.GetValue();
if (private_state != eStateStopped && private_state != eStateExited)
{
+ // If we exited when we were waiting for a process to stop, then
+ // forward the event here so we don't lose the event
return error;
}
}
}
else
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
- return error;
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
+ return error;
}
}
@@ -3167,7 +3177,16 @@
m_target.GetDebugger().PopInputReader (m_process_input_reader);
if (m_process_input_reader)
m_process_input_reader.reset();
-
+
+ // If we exited when we were waiting for a process to stop, then
+ // forward the event here so we don't lose the event
+ if (exit_event_sp)
+ {
+ // Directly broadcast our exited event because we shut down our
+ // private state thread above
+ BroadcastEvent(exit_event_sp);
+ }
+
// If we have been interrupted (to kill us) in the middle of running, we may not end up propagating
// the last events through the event system, in which case we might strand the write lock. Unlock
// it here so when we do to tear down the process we don't get an error destroying the lock.
@@ -3284,6 +3303,9 @@
if (m_thread_list.ShouldStop (event_ptr) == false)
{
+ // ShouldStop may have restarted the target already. If so, don't
+ // resume it twice.
+ bool was_restarted = ProcessEventData::GetRestartedFromEvent (event_ptr);
switch (m_thread_list.ShouldReportStop (event_ptr))
{
case eVoteYes:
@@ -3297,7 +3319,8 @@
if (log)
log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", event_ptr, StateAsCString(state));
- PrivateResume ();
+ if (!was_restarted)
+ PrivateResume ();
}
else
{
@@ -3902,7 +3925,7 @@
{
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::GetSTDOUT (buf = %p, size = %zu)", buf, buf_size);
+ log->Printf ("Process::GetSTDOUT (buf = %p, size = %llu)", buf, (uint64_t)buf_size);
if (bytes_available > buf_size)
{
memcpy(buf, m_stdout_data.c_str(), buf_size);
@@ -3928,7 +3951,7 @@
{
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::GetSTDERR (buf = %p, size = %zu)", buf, buf_size);
+ log->Printf ("Process::GetSTDERR (buf = %p, size = %llu)", buf, (uint64_t)buf_size);
if (bytes_available > buf_size)
{
memcpy(buf, m_stderr_data.c_str(), buf_size);
@@ -4861,6 +4884,7 @@
{
size_t num_thread_infos_dumped = 0;
+ Mutex::Locker locker (GetThreadList().GetMutex());
const size_t num_threads = GetThreadList().GetSize();
for (uint32_t i = 0; i < num_threads; i++)
{
Modified: lldb/branches/windows/source/Target/RegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/RegisterContext.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/RegisterContext.cpp (original)
+++ lldb/branches/windows/source/Target/RegisterContext.cpp Tue Sep 18 13:57:46 2012
@@ -196,6 +196,47 @@
return false;
}
+bool
+RegisterContext::CopyFromRegisterContext (lldb::RegisterContextSP context)
+{
+ uint32_t num_register_sets = context->GetRegisterSetCount();
+ // We don't know that two threads have the same register context, so require the threads to be the same.
+ if (context->GetThreadID() != GetThreadID())
+ return false;
+
+ if (num_register_sets != GetRegisterSetCount())
+ return false;
+
+ RegisterContextSP frame_zero_context = m_thread.GetRegisterContext();
+
+ for (uint32_t set_idx = 0; set_idx < num_register_sets; ++set_idx)
+ {
+ const RegisterSet * const reg_set = GetRegisterSet(set_idx);
+
+ const uint32_t num_registers = reg_set->num_registers;
+ for (uint32_t reg_idx = 0; reg_idx < num_registers; ++reg_idx)
+ {
+ const uint32_t reg = reg_set->registers[reg_idx];
+ const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
+ if (!reg_info || reg_info->value_regs)
+ continue;
+ RegisterValue reg_value;
+
+ // If we can reconstruct the register from the frame we are copying from, then do so, otherwise
+ // use the value from frame 0.
+ if (context->ReadRegister(reg_info, reg_value))
+ {
+ WriteRegister(reg_info, reg_value);
+ }
+ else if (frame_zero_context->ReadRegister(reg_info, reg_value))
+ {
+ WriteRegister(reg_info, reg_value);
+ }
+ }
+ }
+ return true;
+}
+
lldb::tid_t
RegisterContext::GetThreadID() const
{
Modified: lldb/branches/windows/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StackFrameList.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StackFrameList.cpp (original)
+++ lldb/branches/windows/source/Target/StackFrameList.cpp Tue Sep 18 13:57:46 2012
@@ -13,6 +13,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Symbol/Block.h"
@@ -77,13 +80,16 @@
uint32_t
StackFrameList::GetCurrentInlinedDepth ()
{
- if (m_show_inlined_frames)
+ if (m_show_inlined_frames && m_current_inlined_pc != LLDB_INVALID_ADDRESS)
{
lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
if (cur_pc != m_current_inlined_pc)
{
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
m_current_inlined_depth = UINT32_MAX;
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ if (log && log->GetVerbose())
+ log->Printf ("GetCurrentInlinedDepth: invalidating current inlined depth.\n");
}
return m_current_inlined_depth;
}
@@ -93,18 +99,19 @@
}
}
-static const bool LLDB_FANCY_INLINED_STEPPING = false;
-
void
StackFrameList::ResetCurrentInlinedDepth ()
{
- if (LLDB_FANCY_INLINED_STEPPING && m_show_inlined_frames)
+ if (m_show_inlined_frames)
{
GetFramesUpTo(0);
if (!m_frames[0]->IsInlined())
{
m_current_inlined_depth = UINT32_MAX;
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ if (log && log->GetVerbose())
+ log->Printf ("ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
}
else
{
@@ -138,11 +145,6 @@
{
switch (stop_info_sp->GetStopReason())
{
- case eStopReasonBreakpoint:
- {
-
- }
- break;
case eStopReasonWatchpoint:
case eStopReasonException:
case eStopReasonSignal:
@@ -150,6 +152,37 @@
m_current_inlined_pc = curr_pc;
m_current_inlined_depth = 0;
break;
+ case eStopReasonBreakpoint:
+ {
+ // FIXME: Figure out what this break point is doing, and set the inline depth
+ // appropriately. Be careful to take into account breakpoints that implement
+ // step over prologue, since that should do the default calculation.
+ // For now, if the breakpoints corresponding to this hit are all internal,
+ // I set the stop location to the top of the inlined stack, since that will make
+ // things like stepping over prologues work right. But if there are any non-internal
+ // breakpoints I do to the bottom of the stack, since that was the old behavior.
+ uint32_t bp_site_id = stop_info_sp->GetValue();
+ BreakpointSiteSP bp_site_sp(m_thread.GetProcess()->GetBreakpointSiteList().FindByID(bp_site_id));
+ bool all_internal = true;
+ if (bp_site_sp)
+ {
+ uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
+ for (uint32_t i = 0; i < num_owners; i++)
+ {
+ Breakpoint &bp_ref = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
+ if (!bp_ref.IsInternal())
+ {
+ all_internal = false;
+ }
+ }
+ }
+ if (!all_internal)
+ {
+ m_current_inlined_pc = curr_pc;
+ m_current_inlined_depth = 0;
+ break;
+ }
+ }
default:
{
// Otherwise, we should set ourselves at the container of the inlining, so that the
@@ -170,6 +203,9 @@
}
m_current_inlined_pc = curr_pc;
m_current_inlined_depth = num_inlined_functions + 1;
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ if (log && log->GetVerbose())
+ log->Printf ("ResetCurrentInlinedDepth: setting inlined depth: %d 0x%llx.\n", m_current_inlined_depth, curr_pc);
}
break;
@@ -191,14 +227,26 @@
if (current_inlined_depth != UINT32_MAX)
{
if (current_inlined_depth > 0)
+ {
m_current_inlined_depth--;
- return true;
+ return true;
+ }
}
}
return false;
}
void
+StackFrameList::SetCurrentInlinedDepth (uint32_t new_depth)
+{
+ m_current_inlined_depth = new_depth;
+ if (new_depth == UINT32_MAX)
+ m_current_inlined_pc = LLDB_INVALID_ADDRESS;
+ else
+ m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
+}
+
+void
StackFrameList::GetFramesUpTo(uint32_t end_idx)
{
// We've already gotten more frames than asked for, or we've already finished unwinding, return.
@@ -214,10 +262,11 @@
#endif
// If we are hiding some frames from the outside world, we need to add those onto the total count of
// frames to fetch. However, we don't need ot do that if end_idx is 0 since in that case we always
- // get the first concrete frame and all the inlined frames below it...
+ // get the first concrete frame and all the inlined frames below it... And of course, if end_idx is
+ // UINT32_MAX that means get all, so just do that...
uint32_t inlined_depth = 0;
- if (end_idx > 0)
+ if (end_idx > 0 && end_idx != UINT32_MAX)
{
inlined_depth = GetCurrentInlinedDepth();
if (inlined_depth != UINT32_MAX)
@@ -320,6 +369,10 @@
{
StackFrameList *prev_frames = m_prev_frames_sp.get();
StackFrameList *curr_frames = this;
+
+ //curr_frames->m_current_inlined_depth = prev_frames->m_current_inlined_depth;
+ //curr_frames->m_current_inlined_pc = prev_frames->m_current_inlined_pc;
+ //printf ("GetFramesUpTo: Copying current inlined depth: %d 0x%llx.\n", curr_frames->m_current_inlined_depth, curr_frames->m_current_inlined_pc);
#if defined (DEBUG_STACK_FRAMES)
s.PutCString("\nprev_frames:\n");
Modified: lldb/branches/windows/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StopInfo.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StopInfo.cpp (original)
+++ lldb/branches/windows/source/Target/StopInfo.cpp Tue Sep 18 13:57:46 2012
@@ -598,7 +598,7 @@
const bool discard_on_error = true;
Error error;
result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
- eExecutionPolicyAlways,
+ eExecutionPolicyOnlyWhenNeeded,
lldb::eLanguageTypeUnknown,
ClangUserExpression::eResultTypeAny,
discard_on_error,
Modified: lldb/branches/windows/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Target.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Target.cpp (original)
+++ lldb/branches/windows/source/Target/Target.cpp Tue Sep 18 13:57:46 2012
@@ -247,8 +247,6 @@
LazyBool skip_prologue,
bool internal)
{
- SearchFilterSP filter_sp(GetSearchFilterForModuleList (containingModules));
-
if (check_inlines == eLazyBoolCalculate)
{
const InlineStrategy inline_strategy = GetInlineStrategy();
@@ -270,6 +268,18 @@
break;
}
}
+ SearchFilterSP filter_sp;
+ if (check_inlines == eLazyBoolNo)
+ {
+ // Not checking for inlines, we are looking only for matching compile units
+ FileSpecList compile_unit_list;
+ compile_unit_list.Append (file);
+ filter_sp = GetSearchFilterForModuleAndCUList (containingModules, &compile_unit_list);
+ }
+ else
+ {
+ filter_sp = GetSearchFilterForModuleList (containingModules);
+ }
BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL,
file,
line_no,
@@ -517,8 +527,8 @@
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
if (log)
- log->Printf("Target::%s (addr = 0x%8.8llx size = %zu type = %u)\n",
- __FUNCTION__, addr, size, type);
+ log->Printf("Target::%s (addr = 0x%8.8llx size = %llu type = %u)\n",
+ __FUNCTION__, addr, (uint64_t)size, type);
WatchpointSP wp_sp;
if (!ProcessIsValid())
@@ -1225,7 +1235,7 @@
if (bytes_read == 0)
error.SetErrorStringWithFormat("read memory from 0x%llx failed", load_addr);
else
- error.SetErrorStringWithFormat("only %zu of %zu bytes were read from memory at 0x%llx", bytes_read, dst_len, load_addr);
+ error.SetErrorStringWithFormat("only %llu of %llu bytes were read from memory at 0x%llx", (uint64_t)bytes_read, (uint64_t)dst_len, load_addr);
}
}
if (bytes_read)
@@ -1606,18 +1616,13 @@
(
const char *expr_cstr,
StackFrame *frame,
- lldb_private::ExecutionPolicy execution_policy,
- bool coerce_to_id,
- bool unwind_on_error,
- bool keep_in_memory,
- lldb::DynamicValueType use_dynamic,
lldb::ValueObjectSP &result_valobj_sp,
- uint32_t single_thread_timeout_usec
+ const EvaluateExpressionOptions& options
)
{
- ExecutionResults execution_results = eExecutionSetupError;
-
result_valobj_sp.reset();
+
+ ExecutionResults execution_results = eExecutionSetupError;
if (expr_cstr == NULL || expr_cstr[0] == '\0')
return execution_results;
@@ -1645,7 +1650,7 @@
if (::strcspn (expr_cstr, "()+*&|!~<=/^%,?") == expr_cstr_len)
{
result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
- use_dynamic,
+ options.GetUseDynamic(),
expr_path_options,
var_sp,
error);
@@ -1679,9 +1684,9 @@
}
else
{
- if (use_dynamic != lldb::eNoDynamicValues)
+ if (options.GetUseDynamic() != lldb::eNoDynamicValues)
{
- ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(use_dynamic);
+ ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(options.GetUseDynamic());
if (dynamic_sp)
result_valobj_sp = dynamic_sp;
}
@@ -1735,14 +1740,14 @@
const char *prefix = GetExpressionPrefixContentsAsCString();
execution_results = ClangUserExpression::Evaluate (exe_ctx,
- execution_policy,
+ options.GetExecutionPolicy(),
lldb::eLanguageTypeUnknown,
- coerce_to_id ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
- unwind_on_error,
+ options.DoesCoerceToId() ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
+ options.DoesUnwindOnError(),
expr_cstr,
prefix,
result_valobj_sp,
- single_thread_timeout_usec);
+ options.GetSingleThreadTimeoutUsec());
}
}
Modified: lldb/branches/windows/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Thread.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Thread.cpp (original)
+++ lldb/branches/windows/source/Target/Thread.cpp Tue Sep 18 13:57:46 2012
@@ -241,6 +241,8 @@
ProcessSP process_sp (GetProcess());
if (process_sp)
saved_state.orig_stop_id = process_sp->GetStopID();
+ saved_state.current_inlined_depth = GetCurrentInlinedDepth();
+
return true;
}
@@ -251,6 +253,7 @@
if (saved_state.stop_info_sp)
saved_state.stop_info_sp->MakeStopInfoValid();
SetStopInfo(saved_state.stop_info_sp);
+ GetStackFrameList()->SetCurrentInlinedDepth (saved_state.current_inlined_depth);
return true;
}
@@ -417,9 +420,6 @@
return false;
}
- // Adjust the stack frame's current inlined depth if it is needed.
- GetStackFrameList()->CalculateCurrentInlinedDepth();
-
if (log)
{
log->Printf ("Thread::%s for tid = 0x%4.4llx, pc = 0x%16.16llx",
@@ -447,6 +447,13 @@
return false;
}
+ // If we've already been restarted, don't query the plans since the state they would examine is not current.
+ if (Process::ProcessEventData::GetRestartedFromEvent(event_ptr))
+ return false;
+
+ // Before the plans see the state of the world, calculate the current inlined depth.
+ GetStackFrameList()->CalculateCurrentInlinedDepth();
+
// If the base plan doesn't understand why we stopped, then we have to find a plan that does.
// If that plan is still working, then we don't need to do any more work. If the plan that explains
// the stop is done, then we should pop all the plans below it, and pop it, and then let the plans above it decide
@@ -948,7 +955,7 @@
{
int master_plan_idx;
- bool discard;
+ bool discard = true;
// Find the first master plan, see if it wants discarding, and if yes discard up to it.
for (master_plan_idx = m_plan_stack.size() - 1; master_plan_idx >= 0; master_plan_idx--)
@@ -1264,6 +1271,67 @@
return GetStackFrameList()->GetFrameWithConcreteFrameIndex (unwind_idx);
}
+
+Error
+Thread::ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp)
+{
+ StackFrameSP frame_sp = GetStackFrameAtIndex (frame_idx);
+ Error return_error;
+
+ if (!frame_sp)
+ {
+ return_error.SetErrorStringWithFormat("Could not find frame with index %d in thread 0x%llx.", frame_idx, GetID());
+ }
+
+ return ReturnFromFrame(frame_sp, return_value_sp);
+}
+
+Error
+Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp)
+{
+ Error return_error;
+
+ if (!frame_sp)
+ {
+ return_error.SetErrorString("Can't return to a null frame.");
+ return return_error;
+ }
+
+ Thread *thread = frame_sp->GetThread().get();
+ uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
+ StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
+
+ if (return_value_sp)
+ {
+ // TODO: coerce the return_value_sp to the type of the function in frame_sp.
+
+ lldb::ABISP abi = thread->GetProcess()->GetABI();
+ if (!abi)
+ {
+ return_error.SetErrorString("Could not find ABI to set return value.");
+ }
+ return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
+ if (!return_error.Success())
+ return return_error;
+ }
+
+ // Now write the return registers for the chosen frame:
+ // Note, we can't use ReadAllRegisterValues->WriteAllRegisterValues, since the read & write
+ // cook their data
+ bool copy_success = thread->GetStackFrameAtIndex(0)->GetRegisterContext()->CopyFromRegisterContext(older_frame_sp->GetRegisterContext());
+ if (copy_success)
+ {
+ thread->DiscardThreadPlans(true);
+ thread->ClearStackFrames();
+ return return_error;
+ }
+ else
+ {
+ return_error.SetErrorString("Could not reset register values.");
+ return return_error;
+ }
+}
+
void
Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
{
@@ -1423,10 +1491,16 @@
bool
Thread::RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint)
{
+ return ResetFrameZeroRegisters (checkpoint.GetData());
+}
+
+bool
+Thread::ResetFrameZeroRegisters (lldb::DataBufferSP register_data_sp)
+{
lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0));
if (frame_sp)
{
- bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (checkpoint.GetData());
+ bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (register_data_sp);
// Clear out all stack frames as our world just changed.
ClearStackFrames();
Modified: lldb/branches/windows/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadList.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadList.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadList.cpp Tue Sep 18 13:57:46 2012
@@ -189,7 +189,7 @@
if (log)
{
log->PutCString("");
- log->Printf ("ThreadList::%s: %zu threads", __FUNCTION__, m_threads.size());
+ log->Printf ("ThreadList::%s: %llu threads", __FUNCTION__, (uint64_t)m_threads.size());
}
for (pos = m_threads.begin(); pos != end; ++pos)
@@ -228,7 +228,7 @@
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
- log->Printf ("ThreadList::%s %zu threads", __FUNCTION__, m_threads.size());
+ log->Printf ("ThreadList::%s %llu threads", __FUNCTION__, (uint64_t)m_threads.size());
// Run through the threads and ask whether we should report this event.
// For stopping, a YES vote wins over everything. A NO vote wins over NO opinion.
Modified: lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp Tue Sep 18 13:57:46 2012
@@ -132,7 +132,7 @@
m_valid (false),
m_stop_other_threads (stop_other_threads),
m_function_addr (function),
- m_function_sp (NULL),
+ m_function_sp (0),
m_return_type (return_type),
m_takedown_done (false),
m_stop_address (LLDB_INVALID_ADDRESS),
@@ -196,7 +196,7 @@
m_valid (false),
m_stop_other_threads (stop_other_threads),
m_function_addr (function),
- m_function_sp(NULL),
+ m_function_sp(0),
m_return_type (return_type),
m_takedown_done (false),
m_stop_address (LLDB_INVALID_ADDRESS)
Modified: lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp Tue Sep 18 13:57:46 2012
@@ -46,7 +46,8 @@
) :
ThreadPlanStepRange (ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others),
ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL),
- m_step_past_prologue (true)
+ m_step_past_prologue (true),
+ m_virtual_step (false)
{
SetFlagsToDefault ();
}
@@ -86,113 +87,122 @@
ThreadPlan* new_plan = NULL;
- // Stepping through should be done stopping other threads in general, since we're setting a breakpoint and
- // continuing...
-
- bool stop_others;
- if (m_stop_others != lldb::eAllThreads)
- stop_others = true;
- else
- stop_others = false;
-
- FrameComparison frame_order = CompareCurrentFrameToStartFrame();
-
- if (frame_order == eFrameCompareOlder)
+ if (m_virtual_step)
{
- // If we're in an older frame then we should stop.
- //
- // A caveat to this is if we think the frame is older but we're actually in a trampoline.
- // I'm going to make the assumption that you wouldn't RETURN to a trampoline. So if we are
- // in a trampoline we think the frame is older because the trampoline confused the backtracer.
- new_plan = m_thread.QueueThreadPlanForStepThrough (m_stack_id, false, stop_others);
- if (new_plan == NULL)
- return true;
- else if (log)
- {
- log->Printf("Thought I stepped out, but in fact arrived at a trampoline.");
- }
-
- }
- else if (frame_order == eFrameCompareEqual && InSymbol())
- {
- // If we are not in a place we should step through, we're done.
- // One tricky bit here is that some stubs don't push a frame, so we have to check
- // both the case of a frame that is younger, or the same as this frame.
- // However, if the frame is the same, and we are still in the symbol we started
- // in, the we don't need to do this. This first check isn't strictly necessary,
- // but it is more efficient.
-
- // If we're still in the range, keep going, either by running to the next branch breakpoint, or by
- // stepping.
- if (InRange())
- {
- SetNextBranchBreakpoint();
- return false;
- }
-
- SetPlanComplete();
- return true;
+ // If we've just completed a virtual step, all we need to do is check for a ShouldStopHere plan, and otherwise
+ // we're done.
+ new_plan = InvokeShouldStopHereCallback();
}
-
- // If we get to this point, we're not going to use a previously set "next branch" breakpoint, so delete it:
- ClearNextBranchBreakpoint();
-
- // We may have set the plan up above in the FrameIsOlder section:
-
- if (new_plan == NULL)
- new_plan = m_thread.QueueThreadPlanForStepThrough (m_stack_id, false, stop_others);
-
- if (log)
+ else
{
- if (new_plan != NULL)
- log->Printf ("Found a step through plan: %s", new_plan->GetName());
+ // Stepping through should be done stopping other threads in general, since we're setting a breakpoint and
+ // continuing...
+
+ bool stop_others;
+ if (m_stop_others != lldb::eAllThreads)
+ stop_others = true;
else
- log->Printf ("No step through plan found.");
- }
-
- // If not, give the "should_stop" callback a chance to push a plan to get us out of here.
- // But only do that if we actually have stepped in.
- if (!new_plan && frame_order == eFrameCompareYounger)
- new_plan = InvokeShouldStopHereCallback();
-
- // If we've stepped in and we are going to stop here, check to see if we were asked to
- // run past the prologue, and if so do that.
-
- if (new_plan == NULL && frame_order == eFrameCompareYounger && m_step_past_prologue)
- {
- lldb::StackFrameSP curr_frame = m_thread.GetStackFrameAtIndex(0);
- if (curr_frame)
- {
- size_t bytes_to_skip = 0;
- lldb::addr_t curr_addr = m_thread.GetRegisterContext()->GetPC();
- Address func_start_address;
-
- SymbolContext sc = curr_frame->GetSymbolContext (eSymbolContextFunction | eSymbolContextSymbol);
+ stop_others = false;
- if (sc.function)
+ FrameComparison frame_order = CompareCurrentFrameToStartFrame();
+
+ if (frame_order == eFrameCompareOlder)
+ {
+ // If we're in an older frame then we should stop.
+ //
+ // A caveat to this is if we think the frame is older but we're actually in a trampoline.
+ // I'm going to make the assumption that you wouldn't RETURN to a trampoline. So if we are
+ // in a trampoline we think the frame is older because the trampoline confused the backtracer.
+ new_plan = m_thread.QueueThreadPlanForStepThrough (m_stack_id, false, stop_others);
+ if (new_plan == NULL)
+ return true;
+ else if (log)
{
- func_start_address = sc.function->GetAddressRange().GetBaseAddress();
- if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget().get()))
- bytes_to_skip = sc.function->GetPrologueByteSize();
+ log->Printf("Thought I stepped out, but in fact arrived at a trampoline.");
}
- else if (sc.symbol)
+
+ }
+ else if (frame_order == eFrameCompareEqual && InSymbol())
+ {
+ // If we are not in a place we should step through, we're done.
+ // One tricky bit here is that some stubs don't push a frame, so we have to check
+ // both the case of a frame that is younger, or the same as this frame.
+ // However, if the frame is the same, and we are still in the symbol we started
+ // in, the we don't need to do this. This first check isn't strictly necessary,
+ // but it is more efficient.
+
+ // If we're still in the range, keep going, either by running to the next branch breakpoint, or by
+ // stepping.
+ if (InRange())
{
- func_start_address = sc.symbol->GetAddress();
- if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget().get()))
- bytes_to_skip = sc.symbol->GetPrologueByteSize();
+ SetNextBranchBreakpoint();
+ return false;
}
-
- if (bytes_to_skip != 0)
+
+ SetPlanComplete();
+ return true;
+ }
+
+ // If we get to this point, we're not going to use a previously set "next branch" breakpoint, so delete it:
+ ClearNextBranchBreakpoint();
+
+ // We may have set the plan up above in the FrameIsOlder section:
+
+ if (new_plan == NULL)
+ new_plan = m_thread.QueueThreadPlanForStepThrough (m_stack_id, false, stop_others);
+
+ if (log)
+ {
+ if (new_plan != NULL)
+ log->Printf ("Found a step through plan: %s", new_plan->GetName());
+ else
+ log->Printf ("No step through plan found.");
+ }
+
+ // If not, give the "should_stop" callback a chance to push a plan to get us out of here.
+ // But only do that if we actually have stepped in.
+ if (!new_plan && frame_order == eFrameCompareYounger)
+ new_plan = InvokeShouldStopHereCallback();
+
+ // If we've stepped in and we are going to stop here, check to see if we were asked to
+ // run past the prologue, and if so do that.
+
+ if (new_plan == NULL && frame_order == eFrameCompareYounger && m_step_past_prologue)
+ {
+ lldb::StackFrameSP curr_frame = m_thread.GetStackFrameAtIndex(0);
+ if (curr_frame)
{
- func_start_address.Slide (bytes_to_skip);
- log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
- if (log)
- log->Printf ("Pushing past prologue ");
-
- new_plan = m_thread.QueueThreadPlanForRunToAddress(false, func_start_address,true);
+ size_t bytes_to_skip = 0;
+ lldb::addr_t curr_addr = m_thread.GetRegisterContext()->GetPC();
+ Address func_start_address;
+
+ SymbolContext sc = curr_frame->GetSymbolContext (eSymbolContextFunction | eSymbolContextSymbol);
+
+ if (sc.function)
+ {
+ func_start_address = sc.function->GetAddressRange().GetBaseAddress();
+ if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget().get()))
+ bytes_to_skip = sc.function->GetPrologueByteSize();
+ }
+ else if (sc.symbol)
+ {
+ func_start_address = sc.symbol->GetAddress();
+ if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget().get()))
+ bytes_to_skip = sc.symbol->GetPrologueByteSize();
+ }
+
+ if (bytes_to_skip != 0)
+ {
+ func_start_address.Slide (bytes_to_skip);
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ if (log)
+ log->Printf ("Pushing past prologue ");
+
+ new_plan = m_thread.QueueThreadPlanForRunToAddress(false, func_start_address,true);
+ }
}
}
- }
+ }
if (new_plan == NULL)
{
@@ -306,6 +316,9 @@
// The only variation is that if we are doing "step by running to next branch" in which case
// if we hit our branch breakpoint we don't set the plan to complete.
+ if (m_virtual_step)
+ return true;
+
StopInfoSP stop_info_sp = GetPrivateStopReason();
if (stop_info_sp)
{
@@ -347,6 +360,10 @@
log->Printf ("ThreadPlanStepInRange::WillResume: returning false, inline_depth: %d",
m_thread.GetCurrentInlinedDepth());
SetStopInfo(StopInfo::CreateStopReasonToTrace(m_thread));
+
+ // FIXME: Maybe it would be better to create a InlineStep stop reason, but then
+ // the whole rest of the world would have to handle that stop reason.
+ m_virtual_step = true;
}
return !step_without_resume;
}
Modified: lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp Tue Sep 18 13:57:46 2012
@@ -146,9 +146,12 @@
if (log)
{
StreamString s;
- m_addr_context.line_entry.range.Dump (&s,
- m_thread.CalculateTarget().get(),
- Address::DumpStyleLoadAddress);
+ m_addr_context.line_entry.Dump (&s,
+ m_thread.CalculateTarget().get(),
+ true,
+ Address::DumpStyleLoadAddress,
+ Address::DumpStyleLoadAddress,
+ true);
log->Printf ("Step range plan stepped to another range of same line: %s", s.GetData());
}
@@ -167,9 +170,12 @@
if (log)
{
StreamString s;
- m_addr_context.line_entry.range.Dump (&s,
- m_thread.CalculateTarget().get(),
- Address::DumpStyleLoadAddress);
+ m_addr_context.line_entry.Dump (&s,
+ m_thread.CalculateTarget().get(),
+ true,
+ Address::DumpStyleLoadAddress,
+ Address::DumpStyleLoadAddress,
+ true);
log->Printf ("Step range plan stepped to the middle of new line(%d): %s, continuing to clear this line.",
new_context.line_entry.line,
@@ -367,6 +373,14 @@
bool
ThreadPlanStepRange::MischiefManaged ()
{
+ // If we have pushed some plans between ShouldStop & MischiefManaged, then we're not done...
+ // I do this check first because we might have stepped somewhere that will fool InRange into
+ // thinking it needs to step past the end of that line. This happens, for instance, when stepping
+ // over inlined code that is in the middle of the current line.
+
+ if (!m_no_more_plans)
+ return false;
+
bool done = true;
if (!IsPlanComplete())
{
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=164159&r1=164158&r2=164159&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 Tue Sep 18 13:57:46 2012
@@ -338,7 +338,7 @@
#self.runCmd("p (int)[imset count]")
self.expect('frame variable iset1 iset2 imset',
- substrs = ['4 objects','512 objects','10 objects'])
+ substrs = ['4 indexes','512 indexes','10 indexes'])
self.expect('frame variable cupertino home europe',
substrs = ['@"America/Los_Angeles"',
Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py Tue Sep 18 13:57:46 2012
@@ -80,9 +80,9 @@
self.expect('frame variable nscounted_set', matching=False,
substrs = ['1 objects'])
self.expect('frame variable imset',
- substrs = ['1 object'])
+ substrs = ['1 index'])
self.expect('frame variable imset', matching=False,
- substrs = ['1 objects'])
+ substrs = ['1 indexes'])
self.expect('frame variable binheap_ref',
substrs = ['@"1 item"'])
self.expect('frame variable binheap_ref', matching=False,
Modified: lldb/branches/windows/test/warnings/uuid/TestAddDsymCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/warnings/uuid/TestAddDsymCommand.py?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/test/warnings/uuid/TestAddDsymCommand.py (original)
+++ lldb/branches/windows/test/warnings/uuid/TestAddDsymCommand.py Tue Sep 18 13:57:46 2012
@@ -43,6 +43,17 @@
self.exe_name = 'a.out'
self.do_add_dsym_with_success(self.exe_name)
+ def test_add_dsym_with_dSYM_bundle(self):
+ """Test that the 'add-dsym' command informs the user about success."""
+
+ # Call the program generator to produce main.cpp, version 1.
+ self.generate_main_cpp(version=1)
+ self.buildDsym(clean=True)
+
+ self.exe_name = 'a.out'
+ self.do_add_dsym_with_dSYM_bundle(self.exe_name)
+
+
def generate_main_cpp(self, version=0):
"""Generate main.cpp from main.cpp.template."""
temp = os.path.join(os.getcwd(), self.template)
@@ -64,12 +75,11 @@
"""Test that the 'add-dsym' command informs the user about failures."""
self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
- wrong_path = "%s.dSYM" % exe_name
+ wrong_path = os.path.join("%s.dSYM" % exe_name, "Contents")
self.expect("add-dsym " + wrong_path, error=True,
- substrs = ['symbol file', 'with UUID', 'does not match',
- 'please specify the full path to the symbol file'])
+ substrs = ['invalid module path'])
- right_path = os.path.join(wrong_path, "Contents", "Resources", "DWARF", exe_name)
+ right_path = os.path.join("%s.dSYM" % exe_name, "Contents", "Resources", "DWARF", exe_name)
self.expect("add-dsym " + right_path, error=True,
substrs = ['symbol file', 'with UUID', 'does not match'])
@@ -83,6 +93,16 @@
substrs = ['symbol file', 'with UUID', 'has been successfully added to the',
'module'])
+ def do_add_dsym_with_dSYM_bundle(self, exe_name):
+ """Test that the 'add-dsym' command informs the user about success when loading files in bundles."""
+ self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
+
+ # This time, the UUID should be found inside the bundle
+ right_path = "%s.dSYM" % exe_name
+ self.expect("add-dsym " + right_path,
+ substrs = ['symbol file', 'with UUID', 'has been successfully added to the',
+ 'module'])
+
if __name__ == '__main__':
import atexit
Modified: lldb/branches/windows/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNB.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/DNB.cpp Tue Sep 18 13:57:46 2012
@@ -185,7 +185,7 @@
char *err_str,
size_t err_len)
{
- DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, working_dir=%s, stdin=%s, stdout=%s, stderr=%s, no-stdio=%i, launch_flavor = %u, disable_aslr = %d, err = %p, err_len = %zu) called...",
+ DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, working_dir=%s, stdin=%s, stdout=%s, stderr=%s, no-stdio=%i, launch_flavor = %u, disable_aslr = %d, err = %p, err_len = %llu) called...",
__FUNCTION__,
path,
argv,
@@ -198,7 +198,7 @@
launch_flavor,
disable_aslr,
err_str,
- err_len);
+ (uint64_t)err_len);
if (err_str && err_len > 0)
err_str[0] = '\0';
@@ -291,7 +291,7 @@
}
else if (num_matching_proc_infos > 1)
{
- DNBLogError ("error: %zu processes match '%s':\n", num_matching_proc_infos, name);
+ DNBLogError ("error: %llu processes match '%s':\n", (uint64_t)num_matching_proc_infos, name);
size_t i;
for (i=0; i<num_matching_proc_infos; ++i)
DNBLogError ("%6u - %s\n", matching_proc_infos[i].kp_proc.p_pid, matching_proc_infos[i].kp_proc.p_comm);
Modified: lldb/branches/windows/tools/debugserver/source/DNBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNBBreakpoint.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNBBreakpoint.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/DNBBreakpoint.cpp Tue Sep 18 13:57:46 2012
@@ -91,11 +91,11 @@
}
else
{
- DNBLog ("DNBBreakpoint %u: tid = %4.4x addr = 0x%llx size = %zu state = %s type = %s watchpoint (%s%s) hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %p baton = %p",
+ DNBLog ("DNBBreakpoint %u: tid = %4.4x addr = 0x%llx size = %llu state = %s type = %s watchpoint (%s%s) hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %p baton = %p",
m_breakID,
m_tid,
(uint64_t)m_addr,
- m_byte_size,
+ (uint64_t)m_byte_size,
m_enabled ? "enabled " : "disabled",
IsHardware() ? "hardware" : "software",
m_watch_read ? "r" : "",
Modified: lldb/branches/windows/tools/debugserver/source/DNBLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNBLog.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNBLog.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/DNBLog.cpp Tue Sep 18 13:57:46 2012
@@ -185,13 +185,21 @@
timersub (&tv, &g_timeval, &delta);
}
g_timeval = tv;
+
+ // Calling "mach_port_deallocate()" bumps the reference count on the thread
+ // port, so we need to deallocate it. mach_task_self() doesn't bump the ref
+ // count.
+ thread_port_t thread_self = mach_thread_self();
+
_DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s",
++g_message_id,
delta.tv_sec,
delta.tv_usec,
getpid(),
- mach_thread_self(),
+ thread_self,
arg_msg);
+
+ mach_port_deallocate(mach_task_self(), thread_self);
free (arg_msg);
}
}
@@ -230,13 +238,22 @@
timersub (&tv, &g_timeval, &delta);
}
g_timeval = tv;
- _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s",
+
+ // Calling "mach_port_deallocate()" bumps the reference count on the thread
+ // port, so we need to deallocate it. mach_task_self() doesn't bump the ref
+ // count.
+ thread_port_t thread_self = mach_thread_self();
+
+ _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s",
++g_message_id,
delta.tv_sec,
delta.tv_usec,
getpid(),
- mach_thread_self(),
+ thread_self,
arg_msg);
+
+ mach_port_deallocate(mach_task_self(), thread_self);
+
free (arg_msg);
}
}
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/MachException.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/MachException.cpp Tue Sep 18 13:57:46 2012
@@ -237,7 +237,7 @@
size_t idx;
if (desc < end_desc)
{
- desc += snprintf(desc, end_desc - desc, " data[%zu] = {", stop_info->details.exception.data_count);
+ desc += snprintf(desc, end_desc - desc, " data[%llu] = {", (uint64_t)stop_info->details.exception.data_count);
for (idx = 0; desc < end_desc && idx < stop_info->details.exception.data_count; ++idx)
desc += snprintf(desc, end_desc - desc, "0x%llx%c", (uint64_t)exc_data[idx], ((idx + 1 == stop_info->details.exception.data_count) ? '}' : ','));
@@ -278,7 +278,7 @@
if (log_exceptions && ((options & MACH_RCV_TIMEOUT) == 0))
{
// Dump this log message if we have no timeout in case it never returns
- DNBLogThreaded ("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = 0, rcv_size = %zu, rcv_name = %#x, timeout = %u, notify = %#x)",
+ DNBLogThreaded ("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = 0, rcv_size = %llu, rcv_name = %#x, timeout = %u, notify = %#x)",
exc_msg.hdr.msgh_bits,
exc_msg.hdr.msgh_size,
exc_msg.hdr.msgh_remote_port,
@@ -286,7 +286,7 @@
exc_msg.hdr.msgh_reserved,
exc_msg.hdr.msgh_id,
options,
- sizeof (exc_msg.data),
+ (uint64_t)sizeof (exc_msg.data),
port,
mach_msg_timeout,
notify_port);
@@ -464,7 +464,7 @@
size_t idx;
for (idx = 0; idx < exc_data_count; ++idx)
{
- DNBLogThreadedIf(LOG_EXCEPTIONS, " exc_data[%zu]: 0x%llx", idx, (uint64_t)exc_data[idx]);
+ DNBLogThreadedIf(LOG_EXCEPTIONS, " exc_data[%llu]: 0x%llx", (uint64_t)idx, (uint64_t)exc_data[idx]);
}
}
}
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/MachProcess.cpp Tue Sep 18 13:57:46 2012
@@ -659,7 +659,7 @@
nub_break_t
MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length, bool hardware, thread_t tid)
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, hardware, tid);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, hardware, tid);
if (hardware && tid == INVALID_NUB_THREAD)
tid = GetCurrentThread();
@@ -667,7 +667,7 @@
nub_break_t breakID = m_breakpoints.Add(bp);
if (EnableBreakpoint(breakID))
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%4.4x ) => %u", (uint64_t)addr, length, tid, breakID);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%4.4x ) => %u", (uint64_t)addr, (uint64_t)length, tid, breakID);
return breakID;
}
else
@@ -681,7 +681,7 @@
nub_watch_t
MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length, uint32_t watch_flags, bool hardware, thread_t tid)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, watch_flags, hardware, tid);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, watch_flags, hardware, tid);
if (hardware && tid == INVALID_NUB_THREAD)
tid = GetCurrentThread();
@@ -691,12 +691,12 @@
nub_watch_t watchID = m_watchpoints.Add(watch);
if (EnableWatchpoint(watchID))
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => %u", (uint64_t)addr, length, tid, watchID);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => %u", (uint64_t)addr, (uint64_t)length, tid, watchID);
return watchID;
}
else
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, length, tid, watchID);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, (uint64_t)length, tid, watchID);
m_watchpoints.Remove(watchID);
}
// We failed to enable the watchpoint
@@ -1072,7 +1072,7 @@
{
// We have a complete bundle of exceptions for our child process.
PTHREAD_MUTEX_LOCKER (locker, m_exception_messages_mutex);
- DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %zu exception messages.", __PRETTY_FUNCTION__, m_exception_messages.size());
+ DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %llu exception messages.", __PRETTY_FUNCTION__, (uint64_t)m_exception_messages.size());
if (!m_exception_messages.empty())
{
// Let all threads recover from stopping and do any clean up based
@@ -1115,7 +1115,7 @@
}
else
{
- DNBLogThreadedIf(LOG_EXCEPTIONS, "%s empty exception messages bundle (%zu exceptions).", __PRETTY_FUNCTION__, m_exception_messages.size());
+ DNBLogThreadedIf(LOG_EXCEPTIONS, "%s empty exception messages bundle (%llu exceptions).", __PRETTY_FUNCTION__, (uint64_t)m_exception_messages.size());
}
}
@@ -1141,7 +1141,7 @@
void
MachProcess::AppendSTDOUT (char* s, size_t len)
{
- DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%zu> %s) ...", __FUNCTION__, len, s);
+ DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%llu> %s) ...", __FUNCTION__, (uint64_t)len, s);
PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
m_stdout_data.append(s, len);
m_events.SetEvents(eEventStdioAvailable);
@@ -1153,7 +1153,7 @@
size_t
MachProcess::GetAvailableSTDOUT (char *buf, size_t buf_size)
{
- DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%zu]) ...", __FUNCTION__, buf, buf_size);
+ DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__, buf, (uint64_t)buf_size);
PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
size_t bytes_available = m_stdout_data.size();
if (bytes_available > 0)
@@ -1690,7 +1690,7 @@
size_t ocount = 0;
err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu_type, &ocount), DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
- err.LogThreaded("::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu_type, ocount);
+ err.LogThreaded("::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %llu )", cpu_type, (uint64_t)ocount);
if (err.Fail() != 0 || ocount != 1)
return INVALID_NUB_PROCESS;
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/MachTask.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/MachTask.cpp Tue Sep 18 13:57:46 2012
@@ -172,7 +172,7 @@
{
n = m_vm_memory.Read(task, addr, buf, size);
- DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes read", (uint64_t)addr, size, buf, n);
+ DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %llu, buf = %p) => %llu bytes read", (uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
{
DNBDataRef data((uint8_t*)buf, n, false);
@@ -194,7 +194,7 @@
if (task != TASK_NULL)
{
n = m_vm_memory.Write(task, addr, buf, size);
- DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes written", (uint64_t)addr, size, buf, n);
+ DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %llu, buf = %p) => %llu bytes written", (uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
{
DNBDataRef data((uint8_t*)buf, n, false);
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Tue Sep 18 13:57:46 2012
@@ -2288,9 +2288,9 @@
byte_addr_select | // Set the correct byte address select so we only trigger on the correct opcode
S_USER | // Which modes should this breakpoint stop in?
BCR_ENABLE; // Enable this hardware breakpoint
- DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %zu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
+ DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %llu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
(uint64_t)addr,
- size,
+ (uint64_t)size,
i,
i,
m_state.dbg.__bvr[i],
@@ -2303,9 +2303,9 @@
BAS_IMVA_ALL | // Stop on any of the four bytes following the IMVA
S_USER | // Which modes should this breakpoint stop in?
BCR_ENABLE; // Enable this hardware breakpoint
- DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %zu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
+ DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %llu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
(uint64_t)addr,
- size,
+ (uint64_t)size,
i,
i,
m_state.dbg.__bvr[i],
@@ -2320,7 +2320,7 @@
}
else
{
- DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint(addr = 0x%8.8llx, size = %zu) => all hardware breakpoint resources are being used.", (uint64_t)addr, size);
+ DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint(addr = 0x%8.8llx, size = %llu) => all hardware breakpoint resources are being used.", (uint64_t)addr, (uint64_t)size);
}
}
@@ -2361,7 +2361,7 @@
uint32_t
DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint(addr = 0x%8.8llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint(addr = 0x%8.8llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
@@ -3223,7 +3223,7 @@
return 0;
::memcpy (buf, &m_state.context, size);
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, 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 = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, buf_len, (uint64_t)size);
return size;
}
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Tue Sep 18 13:57:46 2012
@@ -857,7 +857,7 @@
uint32_t
DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
@@ -1524,17 +1524,17 @@
kern_return_t kret;
if ((kret = GetGPRState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to read: %u ", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to read: %u ", buf, (uint64_t)buf_len, kret);
size = 0;
}
else if ((kret = GetFPUState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: %s regs failed to read: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: %s regs failed to read: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
size = 0;
}
else if ((kret = GetEXCState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: EXC regs failed to read: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: EXC regs failed to read: %u", buf, (uint64_t)buf_len, kret);
size = 0;
}
else
@@ -1543,7 +1543,7 @@
::memcpy (buf, &m_state.context, size);
}
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::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;
}
@@ -1563,13 +1563,13 @@
::memcpy (&m_state.context, buf, size);
kern_return_t kret;
if ((kret = SetGPRState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to write: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to write: %u", buf, (uint64_t)buf_len, kret);
if ((kret = SetFPUState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: %s regs failed to write: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: %s regs failed to write: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
if ((kret = SetEXCState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: EXP regs failed to write: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: EXP regs failed to write: %u", buf, (uint64_t)buf_len, kret);
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
return size;
}
Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Tue Sep 18 13:57:46 2012
@@ -831,7 +831,7 @@
uint32_t
DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
{
- DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
@@ -1837,19 +1837,19 @@
kern_return_t kret;
if ((kret = GetGPRState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to read: %u ", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to read: %u ", buf, (uint64_t)buf_len, kret);
size = 0;
}
else
if ((kret = GetFPUState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: %s regs failed to read: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: %s regs failed to read: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
size = 0;
}
else
if ((kret = GetEXCState(force)) != KERN_SUCCESS)
{
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: EXC regs failed to read: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: EXC regs failed to read: %u", buf, (uint64_t)buf_len, kret);
size = 0;
}
else
@@ -1858,7 +1858,7 @@
::memcpy (buf, &m_state.context, size);
}
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::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;
}
@@ -1878,13 +1878,13 @@
::memcpy (&m_state.context, buf, size);
kern_return_t kret;
if ((kret = SetGPRState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to write: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to write: %u", buf, (uint64_t)buf_len, kret);
if ((kret = SetFPUState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: %s regs failed to write: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: %s regs failed to write: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
if ((kret = SetEXCState()) != KERN_SUCCESS)
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: EXP regs failed to write: %u", buf, buf_len, kret);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: EXP regs failed to write: %u", buf, (uint64_t)buf_len, kret);
}
- DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+ DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
return size;
}
Modified: lldb/branches/windows/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/RNBRemote.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/RNBRemote.cpp Tue Sep 18 13:57:46 2012
@@ -2599,7 +2599,7 @@
}
else
{
- DNBLogError("RNBRemote::HandlePacket_G(%s): extracted %zu of %zu bytes, size mismatch\n", p, bytes_extracted, reg_ctx_size);
+ DNBLogError("RNBRemote::HandlePacket_G(%s): extracted %llu of %llu bytes, size mismatch\n", p, (uint64_t)bytes_extracted, (uint64_t)reg_ctx_size);
return SendPacket ("E64");
}
}
@@ -3525,10 +3525,17 @@
rnb_err_t
RNBRemote::HandlePacket_stop_process (const char *p)
{
+//#define TEST_EXIT_ON_INTERRUPT // This should only be uncommented to test exiting on interrupt
+#if defined(TEST_EXIT_ON_INTERRUPT)
+ rnb_err_t err = HandlePacket_k (p);
+ m_comm.Disconnect(true);
+ return err;
+#else
DNBProcessSignal (m_ctx.ProcessID(), SIGSTOP);
//DNBProcessSignal (m_ctx.ProcessID(), SIGINT);
// Do not send any response packet! Wait for the stop reply packet to naturally happen
return rnb_success;
+#endif
}
/* 's'
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=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/RNBSocket.cpp Tue Sep 18 13:57:46 2012
@@ -263,7 +263,7 @@
p.append(buf, bytesread);
if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
- err.LogThreaded("::read ( %i, %p, %zu ) => %i", m_fd, buf, sizeof (buf), bytesread);
+ err.LogThreaded("::read ( %i, %p, %llu ) => %i", m_fd, buf, sizeof (buf), (uint64_t)bytesread);
// Our port went away - we have to mark this so IsConnected will return the truth.
if (bytesread == 0)
@@ -297,7 +297,7 @@
err.SetError(errno, DNBError::POSIX);
if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
- err.LogThreaded("::write ( socket = %i, buffer = %p, length = %zu) => %i", m_fd, buffer, length, bytessent);
+ err.LogThreaded("::write ( socket = %i, buffer = %p, length = %llu) => %i", m_fd, buffer, length, (uint64_t)bytessent);
if (bytessent < 0)
return rnb_err;
Modified: lldb/branches/windows/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/debugserver.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/debugserver.cpp Tue Sep 18 13:57:46 2012
@@ -447,18 +447,18 @@
if (ctx.GetProcessStopCount() == 1)
{
- DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+ DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %llu (old %llu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
}
else
{
- DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+ DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %llu (old %llu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
remote->NotifyThatProcessStopped ();
}
}
else
{
- DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+ DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %llu (old %llu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
}
}
return eRNBRunLoopModeInferiorExecuting;
Modified: lldb/branches/windows/tools/driver/DriverOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/DriverOptions.cpp?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/DriverOptions.cpp (original)
+++ lldb/branches/windows/tools/driver/DriverOptions.cpp Tue Sep 18 13:57:46 2012
@@ -35,34 +35,34 @@
static OptionDefinition g_options[] =
{
- { LLDB_OPT_SET_1, true , "help" , 'h', no_argument , NULL, eArgTypeNone,
+ { LLDB_OPT_SET_1, true , "help" , 'h', no_argument , 0, eArgTypeNone,
"Prints out the usage information for the LLDB debugger." },
- { LLDB_OPT_SET_2, true , "version" , 'v', no_argument , NULL, eArgTypeNone,
+ { LLDB_OPT_SET_2, true , "version" , 'v', no_argument , 0, eArgTypeNone,
"Prints out the current version number of the LLDB debugger." },
- { LLDB_OPT_SET_3, true , "arch" , 'a', required_argument, NULL, eArgTypeArchitecture,
+ { LLDB_OPT_SET_3, true , "arch" , 'a', required_argument, 0, eArgTypeArchitecture,
"Tells the debugger to use the specified architecture when starting and running the program. <architecture> must "
"be one of the architectures for which the program was compiled." },
- { LLDB_OPT_SET_3, true , "file" , 'f', required_argument, NULL, eArgTypeFilename,
+ { LLDB_OPT_SET_3, true , "file" , 'f', required_argument, 0, eArgTypeFilename,
"Tells the debugger to use the file <filename> as the program to be debugged." },
- { LLDB_OPT_SET_4, true , "attach-name" , 'n', required_argument, NULL, eArgTypeProcessName,
+ { LLDB_OPT_SET_4, true , "attach-name" , 'n', required_argument, 0, eArgTypeProcessName,
"Tells the debugger to attach to a process with the given name." },
- { LLDB_OPT_SET_4, true , "wait-for" , 'w', no_argument , NULL, eArgTypeNone,
+ { LLDB_OPT_SET_4, true , "wait-for" , 'w', no_argument , 0, eArgTypeNone,
"Tells the debugger to wait for a process with the given pid or name to launch before attaching." },
- { LLDB_OPT_SET_5, true , "attach-pid" , 'p', required_argument, NULL, eArgTypePid,
+ { LLDB_OPT_SET_5, true , "attach-pid" , 'p', required_argument, 0, eArgTypePid,
"Tells the debugger to attach to a process with the given pid." },
- { LLDB_3_TO_5, false, "script-language", 'l', required_argument, NULL, eArgTypeScriptLang,
+ { LLDB_3_TO_5, false, "script-language", 'l', required_argument, 0, eArgTypeScriptLang,
"Tells the debugger to use the specified scripting language for user-defined scripts, rather than the default. "
"Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl. Currently only the Python "
"extensions have been implemented." },
- { LLDB_3_TO_5, false, "debug" , 'd', no_argument , NULL, eArgTypeNone,
+ { LLDB_3_TO_5, false, "debug" , 'd', no_argument , 0, eArgTypeNone,
"Tells the debugger to print out extra information for debugging itself." },
- { LLDB_3_TO_5, false, "source" , 's', required_argument, NULL, eArgTypeFilename,
+ { LLDB_3_TO_5, false, "source" , 's', required_argument, 0, eArgTypeFilename,
"Tells the debugger to read in and execute the file <file>, which should contain lldb commands." },
- { LLDB_3_TO_5, false, "editor" , 'e', no_argument , NULL, eArgTypeNone,
+ { LLDB_3_TO_5, false, "editor" , 'e', no_argument , 0, eArgTypeNone,
"Tells the debugger to open source files using the host's \"external editor\" mechanism." },
- { LLDB_3_TO_5, false, "no-lldbinit" , 'x', no_argument , NULL, eArgTypeNone,
+ { LLDB_3_TO_5, false, "no-lldbinit" , 'x', no_argument , 0, eArgTypeNone,
"Do not automatically parse any '.lldbinit' files." },
- { 0, false, NULL , 0 , 0 , NULL, eArgTypeNone, NULL }
+ { 0, false, NULL , 0 , 0 , 0, eArgTypeNone, NULL }
};
static const uint32_t last_option_set_with_args = 2;
Modified: lldb/branches/windows/tools/install-headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/install-headers/Makefile?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/tools/install-headers/Makefile (original)
+++ lldb/branches/windows/tools/install-headers/Makefile Tue Sep 18 13:57:46 2012
@@ -7,11 +7,13 @@
clean:
echo "clean (doing nothing)"
+TRUNCATED_VERSION = $(shell echo $(CURRENT_PROJECT_VERSION) | /usr/bin/sed -E "s/^([0-9]+)(\.[0-9]+)?$$/\1/g")
+
installhdrs:
cd "${TARGET_BUILD_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers" ;\
for file in *.h ;\
do \
/usr/bin/sed -i '' 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$$file" ;\
/usr/bin/sed -i '' 's|<LLDB/Utility|<LLDB|' "$$file" ;\
- /usr/bin/sed -i '' "s|//#define LLDB_VERSION|#define LLDB_VERSION ${CURRENT_PROJECT_VERSION} |" "$$file" ;\
+ /usr/bin/sed -i '' "s|//#define LLDB_VERSION|#define LLDB_VERSION $(TRUNCATED_VERSION) |" "$$file" ;\
done
Modified: lldb/branches/windows/www/build.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/www/build.html?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/www/build.html (original)
+++ lldb/branches/windows/www/build.html Tue Sep 18 13:57:46 2012
@@ -115,12 +115,14 @@
<code>> cd $llvm/..
<br>> mkdir build
<br>> cd build
- <br>> $llvm/configure --enable-targets=x86 --enable-jit
- <br>> make</code>
+ <br>> $llvm/configure --enable-targets=x86 --enable-jit --enable-libcpp
+ <br>> make CXXFLAGS+=c++11</code>
<p>Note that once both LLVM and Clang have been configured and built it is not
necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB.
- You can build from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
+ You can build from the <tt>build/tools/lldb</tt> subdirectory as well. If your
+ compiler doesn't support c++11 or libc++, you may need to tweak or remove the last
+ parameter to the configure script and make command.</p>
<h2>Additional Notes</h2>
<p>LLDB has a Python scripting capability and supplies it’s own Python module,
@@ -141,4 +143,4 @@
</div>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
Modified: lldb/branches/windows/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/www/lldb-gdb.html?rev=164159&r1=164158&r2=164159&view=diff
==============================================================================
--- lldb/branches/windows/www/lldb-gdb.html (original)
+++ lldb/branches/windows/www/lldb-gdb.html Tue Sep 18 13:57:46 2012
@@ -872,6 +872,20 @@
</td>
</tr>
+ <tr><td class="header" colspan="2">Lookup functions matching a regular expression in a binary.</td></tr>
+ <tr>
+ <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">
More information about the lldb-commits
mailing list