[llvm-branch-commits] [lldb] r198989 - Merged top of tree.
Greg Clayton
gclayton at apple.com
Fri Jan 10 17:16:50 PST 2014
Author: gclayton
Date: Fri Jan 10 19:16:50 2014
New Revision: 198989
URL: http://llvm.org/viewvc/llvm-project?rev=198989&view=rev
Log:
Merged top of tree.
Modified:
lldb/branches/iohandler/ (props changed)
lldb/branches/iohandler/examples/darwin/heap_find/heap.py
lldb/branches/iohandler/include/lldb/Breakpoint/Breakpoint.h
lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocation.h
lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocationList.h
lldb/branches/iohandler/include/lldb/Core/ValueObject.h
lldb/branches/iohandler/include/lldb/DataFormatters/CXXFormatterFunctions.h
lldb/branches/iohandler/include/lldb/Symbol/SymbolContext.h
lldb/branches/iohandler/include/lldb/Target/Process.h
lldb/branches/iohandler/include/lldb/Target/Target.h
lldb/branches/iohandler/lldb.xcodeproj/project.pbxproj
lldb/branches/iohandler/resources/LLDB-Info.plist
lldb/branches/iohandler/scripts/Python/python-typemaps.swig
lldb/branches/iohandler/source/Breakpoint/Breakpoint.cpp
lldb/branches/iohandler/source/Breakpoint/BreakpointLocation.cpp
lldb/branches/iohandler/source/Breakpoint/BreakpointLocationList.cpp
lldb/branches/iohandler/source/Breakpoint/BreakpointResolverName.cpp
lldb/branches/iohandler/source/Core/Address.cpp
lldb/branches/iohandler/source/Core/ValueObject.cpp
lldb/branches/iohandler/source/DataFormatters/FormatManager.cpp
lldb/branches/iohandler/source/DataFormatters/LibCxx.cpp
lldb/branches/iohandler/source/Expression/Materializer.cpp
lldb/branches/iohandler/source/Host/macosx/Host.mm
lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/branches/iohandler/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/branches/iohandler/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/branches/iohandler/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.h
lldb/branches/iohandler/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/branches/iohandler/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/iohandler/source/Target/LanguageRuntime.cpp
lldb/branches/iohandler/source/Target/Process.cpp
lldb/branches/iohandler/source/Target/Target.cpp
lldb/branches/iohandler/test/crashinfo.c
lldb/branches/iohandler/test/lang/objc/foundation/TestObjCMethods.py
lldb/branches/iohandler/tools/debugserver/CMakeLists.txt
lldb/branches/iohandler/tools/debugserver/debugserver.xcodeproj/project.pbxproj
lldb/branches/iohandler/www/lldb-gdb.html
Propchange: lldb/branches/iohandler/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 10 19:16:50 2014
@@ -1 +1,2 @@
/lldb/branches/apple/python-GIL:156467-162159
+/lldb/trunk:198360-198987
Modified: lldb/branches/iohandler/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/examples/darwin/heap_find/heap.py?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/examples/darwin/heap_find/heap.py (original)
+++ lldb/branches/iohandler/examples/darwin/heap_find/heap.py Fri Jan 10 19:16:50 2014
@@ -154,6 +154,7 @@ if (KERN_SUCCESS == err)
if options.search_stack:
expr += '''
+#ifdef NUM_STACKS
// Call the callback for the thread stack ranges
for (uint32_t i=0; i<NUM_STACKS; ++i) {
range_callback(task, &baton, 8, stacks[i].base, stacks[i].size);
@@ -161,13 +162,15 @@ for (uint32_t i=0; i<NUM_STACKS; ++i) {
range_callback(task, &baton, 16, stacks[i].base - STACK_RED_ZONE_SIZE, STACK_RED_ZONE_SIZE);
}
}
- '''
+#endif'''
if options.search_segments:
expr += '''
+#ifdef NUM_SEGMENTS
// Call the callback for all segments
for (uint32_t i=0; i<NUM_SEGMENTS; ++i)
- range_callback(task, &baton, 32, segments[i].base, segments[i].size);'''
+ range_callback(task, &baton, 32, segments[i].base, segments[i].size);
+#endif'''
if user_return_code:
expr += "\n%s" % (user_return_code,)
@@ -447,133 +450,130 @@ def display_match_results (result, optio
print "expression result:"
print expr_sbvalue
if expr_sbvalue.error.Success():
- if expr_sbvalue.unsigned:
- match_value = lldb.value(expr_sbvalue)
- i = 0
- match_idx = 0
- while 1:
- print_entry = True
- match_entry = match_value[i]; i += 1
- if i > options.max_matches:
- result.AppendMessage('warning: the max number of matches (%u) was reached, use the --max-matches option to get more results' % (options.max_matches))
- break
- malloc_addr = match_entry.addr.sbvalue.unsigned
- if malloc_addr == 0:
- break
- malloc_size = int(match_entry.size)
- offset = int(match_entry.offset)
-
- if options.offset >= 0 and options.offset != offset:
- print_entry = False
- else:
- match_addr = malloc_addr + offset
- type_flags = int(match_entry.type)
- #result.AppendMessage (hex(malloc_addr + offset))
- if type_flags == 64:
- search_stack_old = options.search_stack
- search_segments_old = options.search_segments
- search_heap_old = options.search_heap
- search_vm_regions = options.search_vm_regions
- options.search_stack = True
- options.search_segments = True
- options.search_heap = True
- options.search_vm_regions = False
- if malloc_info_impl (lldb.debugger, result, options, [hex(malloc_addr + offset)]):
- print_entry = False
- options.search_stack = search_stack_old
- options.search_segments = search_segments_old
- options.search_heap = search_heap_old
- options.search_vm_regions = search_vm_regions
- if print_entry:
- description = '%#16.16x: %s' % (match_addr, type_flags_to_description(type_flags, malloc_addr, malloc_size, offset))
- if options.show_size:
- description += ' <%5u>' % (malloc_size)
- if options.show_range:
- description += ' [%#x - %#x)' % (malloc_addr, malloc_addr + malloc_size)
- derefed_dynamic_value = None
- dynamic_value = match_entry.addr.sbvalue.GetDynamicValue(lldb.eDynamicCanRunTarget)
- if dynamic_value.type.name == 'void *':
- if options.type == 'pointer' and malloc_size == 4096:
- error = lldb.SBError()
- process = expr_sbvalue.GetProcess()
- target = expr_sbvalue.GetTarget()
- data = bytearray(process.ReadMemory(malloc_addr, 16, error))
- if data == '\xa1\xa1\xa1\xa1AUTORELEASE!':
- ptr_size = target.addr_size
- thread = 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 += ' '
- 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)
- if member_list:
- member_path = ''
- for member in member_list:
- member_name = member.name
- if member_name:
- if member_path:
- member_path += '.'
- member_path += member_name
- if member_path:
- if options.ivar_regex_blacklist:
- for ivar_regex in options.ivar_regex_blacklist:
- if ivar_regex.match(member_path):
- print_entry = False
- 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]
+ match_value = lldb.value(expr_sbvalue)
+ i = 0
+ match_idx = 0
+ while 1:
+ print_entry = True
+ match_entry = match_value[i]; i += 1
+ if i > options.max_matches:
+ result.AppendMessage('warning: the max number of matches (%u) was reached, use the --max-matches option to get more results' % (options.max_matches))
+ break
+ malloc_addr = match_entry.addr.sbvalue.unsigned
+ if malloc_addr == 0:
+ break
+ malloc_size = int(match_entry.size)
+ offset = int(match_entry.offset)
+
+ if options.offset >= 0 and options.offset != offset:
+ print_entry = False
+ else:
+ match_addr = malloc_addr + offset
+ type_flags = int(match_entry.type)
+ #result.AppendMessage (hex(malloc_addr + offset))
+ if type_flags == 64:
+ search_stack_old = options.search_stack
+ search_segments_old = options.search_segments
+ search_heap_old = options.search_heap
+ search_vm_regions = options.search_vm_regions
+ options.search_stack = True
+ options.search_segments = True
+ options.search_heap = True
+ options.search_vm_regions = False
+ if malloc_info_impl (lldb.debugger, result, options, [hex(malloc_addr + offset)]):
+ print_entry = False
+ options.search_stack = search_stack_old
+ options.search_segments = search_segments_old
+ options.search_heap = search_heap_old
+ options.search_vm_regions = search_vm_regions
if print_entry:
- match_idx += 1
- result_output = ''
- if description:
- result_output += description
- if options.print_type and derefed_dynamic_value:
- result_output += ' %s' % (derefed_dynamic_value)
- if options.print_object_description and dynamic_value:
- desc = dynamic_value.GetObjectDescription()
- if desc:
- result_output += '\n%s' % (desc)
- if result_output:
- result.AppendMessage(result_output)
- if options.memory:
- cmd_result = lldb.SBCommandReturnObject()
- if options.format == None:
- memory_command = "memory read --force 0x%x 0x%x" % (malloc_addr, malloc_addr + malloc_size)
+ description = '%#16.16x: %s' % (match_addr, type_flags_to_description(type_flags, malloc_addr, malloc_size, offset))
+ if options.show_size:
+ description += ' <%5u>' % (malloc_size)
+ if options.show_range:
+ description += ' [%#x - %#x)' % (malloc_addr, malloc_addr + malloc_size)
+ derefed_dynamic_value = None
+ dynamic_value = match_entry.addr.sbvalue.GetDynamicValue(lldb.eDynamicCanRunTarget)
+ if dynamic_value.type.name == 'void *':
+ if options.type == 'pointer' and malloc_size == 4096:
+ error = lldb.SBError()
+ process = expr_sbvalue.GetProcess()
+ target = expr_sbvalue.GetTarget()
+ data = bytearray(process.ReadMemory(malloc_addr, 16, error))
+ if data == '\xa1\xa1\xa1\xa1AUTORELEASE!':
+ ptr_size = target.addr_size
+ thread = 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 += ' '
+ 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)
+ if member_list:
+ member_path = ''
+ for member in member_list:
+ member_name = member.name
+ if member_name:
+ if member_path:
+ member_path += '.'
+ member_path += member_name
+ if member_path:
+ if options.ivar_regex_blacklist:
+ for ivar_regex in options.ivar_regex_blacklist:
+ if ivar_regex.match(member_path):
+ print_entry = False
+ description += '.%s' % (member_path)
+ else:
+ description += '%u bytes after %s' % (offset - derefed_dynamic_type_size, derefed_dynamic_type_name)
else:
- memory_command = "memory read --force -f %s 0x%x 0x%x" % (options.format, malloc_addr, malloc_addr + malloc_size)
- if options.verbose:
- result.AppendMessage(memory_command)
- lldb.debugger.GetCommandInterpreter().HandleCommand(memory_command, cmd_result)
- result.AppendMessage(cmd_result.GetOutput())
- if options.stack_history:
- dump_stack_history_entries(options, result, malloc_addr, 1)
- elif options.stack:
- dump_stack_history_entries(options, result, malloc_addr, 0)
- return i
- elif print_no_matches:
- result.AppendMessage('no matches found for %s' % (arg_str_description))
+ # 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 = ''
+ if description:
+ result_output += description
+ if options.print_type and derefed_dynamic_value:
+ result_output += ' %s' % (derefed_dynamic_value)
+ if options.print_object_description and dynamic_value:
+ desc = dynamic_value.GetObjectDescription()
+ if desc:
+ result_output += '\n%s' % (desc)
+ if result_output:
+ result.AppendMessage(result_output)
+ if options.memory:
+ cmd_result = lldb.SBCommandReturnObject()
+ if options.format == None:
+ memory_command = "memory read --force 0x%x 0x%x" % (malloc_addr, malloc_addr + malloc_size)
+ else:
+ memory_command = "memory read --force -f %s 0x%x 0x%x" % (options.format, malloc_addr, malloc_addr + malloc_size)
+ if options.verbose:
+ result.AppendMessage(memory_command)
+ lldb.debugger.GetCommandInterpreter().HandleCommand(memory_command, cmd_result)
+ result.AppendMessage(cmd_result.GetOutput())
+ if options.stack_history:
+ dump_stack_history_entries(options, result, malloc_addr, 1)
+ elif options.stack:
+ dump_stack_history_entries(options, result, malloc_addr, 0)
+ return i
else:
result.AppendMessage(str(expr_sbvalue.error))
return 0
@@ -871,7 +871,7 @@ stacks[%(index)u].base = 0x%(base)x;
stacks[%(index)u].size = 0x%(size)x;''' % stack_dict
return result
else:
- return None
+ return ''
def get_sections_ranges_struct (process):
'''Create code that defines a structure that represents all segments that
@@ -903,7 +903,7 @@ segments[%(index)u].base = 0x%(base)x;
segments[%(index)u].size = 0x%(size)x;''' % segment_dict
return result
else:
- return None
+ return ''
def section_ptr_refs(debugger, command, result, dict):
command_args = shlex.split(command)
Modified: lldb/branches/iohandler/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Breakpoint/Breakpoint.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/branches/iohandler/include/lldb/Breakpoint/Breakpoint.h Fri Jan 10 19:16:50 2014
@@ -612,12 +612,30 @@ protected:
/// Only the Target can make a breakpoint, and it owns the breakpoint lifespans.
/// The constructor takes a filter and a resolver. Up in Target there are convenience
/// variants that make breakpoints for some common cases.
+ ///
+ /// @param[in] target
+ /// The target in which the breakpoint will be set.
+ ///
+ /// @param[in] filter_sp
+ /// Shared pointer to the search filter that restricts the search domain of the breakpoint.
+ ///
+ /// @param[in] resolver_sp
+ /// Shared pointer to the resolver object that will determine breakpoint matches.
+ ///
+ /// @param hardware
+ /// If true, request a hardware breakpoint to be used to implement the breakpoint locations.
+ ///
+ /// @param resolve_indirect_symbols
+ /// If true, and the address of a given breakpoint location in this breakpoint is set on an
+ /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual breakpoint site will
+ /// be set on the target of the indirect symbol.
//------------------------------------------------------------------
// This is the generic constructor
Breakpoint(Target &target,
lldb::SearchFilterSP &filter_sp,
lldb::BreakpointResolverSP &resolver_sp,
- bool hardware);
+ bool hardware,
+ bool resolve_indirect_symbols = true);
friend class BreakpointLocation; // To call the following two when determining whether to stop.
@@ -643,6 +661,7 @@ private:
BreakpointOptions m_options; // Settable breakpoint options
BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
std::string m_kind_description;
+ bool m_resolve_indirect_symbols;
void
SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind);
Modified: lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocation.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocation.h Fri Jan 10 19:16:50 2014
@@ -321,7 +321,59 @@ public:
//------------------------------------------------------------------
bool
InvokeCallback (StoppointCallbackContext *context);
+
+ //------------------------------------------------------------------
+ /// Returns whether we should resolve Indirect functions in setting the breakpoint site
+ /// for this location.
+ ///
+ /// @return
+ /// \b true if the breakpoint SITE for this location should be set on the
+ /// resolved location for Indirect functions.
+ //------------------------------------------------------------------
+ bool
+ ShouldResolveIndirectFunctions ()
+ {
+ return m_should_resolve_indirect_functions;
+ }
+ //------------------------------------------------------------------
+ /// Returns whether the address set in the breakpoint site for this location was found by resolving
+ /// an indirect symbol.
+ ///
+ /// @return
+ /// \b true or \b false as given in the description above.
+ //------------------------------------------------------------------
+ bool
+ IsIndirect ()
+ {
+ return m_is_indirect;
+ }
+
+ void
+ SetIsIndirect (bool is_indirect)
+ {
+ m_is_indirect = is_indirect;
+ }
+
+ //------------------------------------------------------------------
+ /// Returns whether the address set in the breakpoint location was re-routed to the target of a
+ /// re-exported symbol.
+ ///
+ /// @return
+ /// \b true or \b false as given in the description above.
+ //------------------------------------------------------------------
+ bool
+ IsReExported ()
+ {
+ return m_is_reexported;
+ }
+
+ void
+ SetIsReExported (bool is_reexported)
+ {
+ m_is_reexported = is_reexported;
+ }
+
protected:
friend class BreakpointLocationList;
friend class Process;
@@ -375,12 +427,16 @@ private:
Breakpoint &owner,
const Address &addr,
lldb::tid_t tid,
- bool hardware);
-
+ bool hardware,
+ bool check_for_resolver = true);
+
//------------------------------------------------------------------
// Data members:
//------------------------------------------------------------------
bool m_being_created;
+ bool m_should_resolve_indirect_functions;
+ bool m_is_reexported;
+ bool m_is_indirect;
Address m_address; ///< The address defining this location.
Breakpoint &m_owner; ///< The breakpoint that produced this object.
std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
@@ -390,6 +446,12 @@ private:
size_t m_condition_hash; ///< For testing whether the condition source code changed.
void
+ SetShouldResolveIndirectFunctions (bool do_resolve)
+ {
+ m_should_resolve_indirect_functions = do_resolve;
+ }
+
+ void
SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind);
DISALLOW_COPY_AND_ASSIGN (BreakpointLocation);
Modified: lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocationList.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocationList.h (original)
+++ lldb/branches/iohandler/include/lldb/Breakpoint/BreakpointLocationList.h Fri Jan 10 19:16:50 2014
@@ -236,7 +236,7 @@ protected:
/// Returns breakpoint location id.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
- Create (const Address &addr);
+ Create (const Address &addr, bool resolve_indirect_symbols);
void
StartRecordingNewLocations(BreakpointLocationCollection &new_locations);
@@ -246,6 +246,7 @@ protected:
lldb::BreakpointLocationSP
AddLocation (const Address &addr,
+ bool resolve_indirect_symbols,
bool *new_location = NULL);
bool
Modified: lldb/branches/iohandler/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Core/ValueObject.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/iohandler/include/lldb/Core/ValueObject.h Fri Jan 10 19:16:50 2014
@@ -619,7 +619,8 @@ public:
DumpPrintableRepresentation (Stream& s,
ValueObjectRepresentationStyle val_obj_display = eValueObjectRepresentationStyleSummary,
lldb::Format custom_format = lldb::eFormatInvalid,
- PrintableRepresentationSpecialCases special = ePrintableRepresentationSpecialCasesAllow);
+ PrintableRepresentationSpecialCases special = ePrintableRepresentationSpecialCasesAllow,
+ bool do_dump_error = true);
bool
GetValueIsValid () const;
Modified: lldb/branches/iohandler/include/lldb/DataFormatters/CXXFormatterFunctions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/DataFormatters/CXXFormatterFunctions.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/DataFormatters/CXXFormatterFunctions.h (original)
+++ lldb/branches/iohandler/include/lldb/DataFormatters/CXXFormatterFunctions.h Fri Jan 10 19:16:50 2014
@@ -79,6 +79,9 @@ namespace lldb_private {
bool
LibcxxWStringSummaryProvider (ValueObject& valobj, Stream& stream); // libc++ std::wstring
+
+ bool
+ LibcxxSmartPointerSummaryProvider (ValueObject& valobj, Stream& stream); // libc++ std::shared_ptr<> and std::weak_ptr<>
bool
ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream);
Modified: lldb/branches/iohandler/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Symbol/SymbolContext.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/branches/iohandler/include/lldb/Symbol/SymbolContext.h Fri Jan 10 19:16:50 2014
@@ -17,6 +17,7 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Utility/Iterable.h"
namespace lldb_private {
@@ -552,6 +553,14 @@ protected:
// Member variables.
//------------------------------------------------------------------
collection m_symbol_contexts; ///< The list of symbol contexts.
+
+public:
+ typedef AdaptedIterable<collection, SymbolContext, vector_adapter> SymbolContextIterable;
+ SymbolContextIterable
+ SymbolContexts()
+ {
+ return SymbolContextIterable(m_symbol_contexts);
+ }
};
bool operator== (const SymbolContext& lhs, const SymbolContext& rhs);
Modified: lldb/branches/iohandler/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Target/Process.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Target/Process.h (original)
+++ lldb/branches/iohandler/include/lldb/Target/Process.h Fri Jan 10 19:16:50 2014
@@ -3019,11 +3019,7 @@ public:
//------------------------------------------------------------------
virtual lldb::addr_t
- ResolveIndirectFunction(const Address *address, Error &error)
- {
- error.SetErrorStringWithFormat("error: %s does not support indirect functions in the debug process", GetPluginName().GetCString());
- return LLDB_INVALID_ADDRESS;
- }
+ ResolveIndirectFunction(const Address *address, Error &error);
virtual Error
GetMemoryRegionInfo (lldb::addr_t load_addr,
@@ -3714,6 +3710,12 @@ protected:
{
return IS_VALID_LLDB_HOST_THREAD(m_private_state_thread);
}
+
+ void
+ ForceNextEventDelivery()
+ {
+ m_force_next_event_delivery = true;
+ }
//------------------------------------------------------------------
// Type definitions
@@ -3788,7 +3790,9 @@ protected:
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
bool m_finalize_called;
bool m_clear_thread_plans_on_stop;
+ bool m_force_next_event_delivery;
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
+ std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;
bool m_destroy_in_process;
enum {
Modified: lldb/branches/iohandler/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Target/Target.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Target/Target.h (original)
+++ lldb/branches/iohandler/include/lldb/Target/Target.h Fri Jan 10 19:16:50 2014
@@ -637,7 +637,8 @@ public:
CreateBreakpoint (lldb::SearchFilterSP &filter_sp,
lldb::BreakpointResolverSP &resolver_sp,
bool internal,
- bool request_hardware);
+ bool request_hardware,
+ bool resolve_indirect_symbols);
// Use this to create a watchpoint:
lldb::WatchpointSP
Modified: lldb/branches/iohandler/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/lldb.xcodeproj/project.pbxproj?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/iohandler/lldb.xcodeproj/project.pbxproj Fri Jan 10 19:16:50 2014
@@ -4839,9 +4839,9 @@
CLANG_LINK_OBJC_RUNTIME = NO;
CLANG_OBJC_RUNTIME = NO;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4900,10 +4900,10 @@
CLANG_LINK_OBJC_RUNTIME = NO;
CLANG_OBJC_RUNTIME = NO;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4960,7 +4960,7 @@
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -4986,7 +4986,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
OTHER_CFLAGS = "";
@@ -5003,7 +5003,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
OTHER_CFLAGS = "";
@@ -5017,8 +5017,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -5053,8 +5053,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -5089,8 +5089,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -5191,7 +5191,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5233,10 +5233,10 @@
CLANG_OBJC_RUNTIME = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -5860,7 +5860,7 @@
26F5C26C10F3D9A5009D5894 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5890,7 +5890,7 @@
26F5C26D10F3D9A5009D5894 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -6008,7 +6008,7 @@
49BB8F381611172B00BDD462 /* DebugClang */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -6042,9 +6042,9 @@
CLANG_LINK_OBJC_RUNTIME = NO;
CLANG_OBJC_RUNTIME = NO;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -6113,8 +6113,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
- DYLIB_CURRENT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
+ DYLIB_CURRENT_VERSION = 320.99.0;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -6294,7 +6294,7 @@
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
Modified: lldb/branches/iohandler/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/resources/LLDB-Info.plist?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/resources/LLDB-Info.plist (original)
+++ lldb/branches/iohandler/resources/LLDB-Info.plist Fri Jan 10 19:16:50 2014
@@ -17,7 +17,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>310.99.0</string>
+ <string>320.99.0</string>
<key>CFBundleName</key>
<string>${EXECUTABLE_NAME}</string>
</dict>
Modified: lldb/branches/iohandler/scripts/Python/python-typemaps.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/scripts/Python/python-typemaps.swig?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/scripts/Python/python-typemaps.swig (original)
+++ lldb/branches/iohandler/scripts/Python/python-typemaps.swig Fri Jan 10 19:16:50 2014
@@ -418,7 +418,7 @@
else // if (flags & __SRW)
mode[i++] = 'a';
#endif
- $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fclose);
+ $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fflush);
}
%typemap(in) (const char* string, int len) {
Modified: lldb/branches/iohandler/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Breakpoint/Breakpoint.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/iohandler/source/Breakpoint/Breakpoint.cpp Fri Jan 10 19:16:50 2014
@@ -45,14 +45,19 @@ Breakpoint::GetEventIdentifier ()
//----------------------------------------------------------------------
// Breakpoint constructor
//----------------------------------------------------------------------
-Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp, bool hardware) :
+Breakpoint::Breakpoint(Target &target,
+ SearchFilterSP &filter_sp,
+ BreakpointResolverSP &resolver_sp,
+ bool hardware,
+ bool resolve_indirect_symbols) :
m_being_created(true),
m_hardware(hardware),
m_target (target),
m_filter_sp (filter_sp),
m_resolver_sp (resolver_sp),
m_options (),
- m_locations (*this)
+ m_locations (*this),
+ m_resolve_indirect_symbols(resolve_indirect_symbols)
{
m_being_created = false;
}
@@ -87,7 +92,7 @@ Breakpoint::GetTarget () const
BreakpointLocationSP
Breakpoint::AddLocation (const Address &addr, bool *new_location)
{
- return m_locations.AddLocation (addr, new_location);
+ return m_locations.AddLocation (addr, m_resolve_indirect_symbols, new_location);
}
BreakpointLocationSP
Modified: lldb/branches/iohandler/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Breakpoint/BreakpointLocation.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/iohandler/source/Breakpoint/BreakpointLocation.cpp Fri Jan 10 19:16:50 2014
@@ -39,16 +39,29 @@ BreakpointLocation::BreakpointLocation
Breakpoint &owner,
const Address &addr,
lldb::tid_t tid,
- bool hardware
+ bool hardware,
+ bool check_for_resolver
) :
StoppointLocation (loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware),
m_being_created(true),
+ m_should_resolve_indirect_functions (false),
+ m_is_reexported (false),
+ m_is_indirect (false),
m_address (addr),
m_owner (owner),
m_options_ap (),
m_bp_site_sp (),
m_condition_mutex ()
{
+ if (check_for_resolver)
+ {
+ Symbol *symbol = m_address.CalculateSymbolContextSymbol();
+ if (symbol && symbol->IsIndirect())
+ {
+ SetShouldResolveIndirectFunctions (true);
+ }
+ }
+
SetThreadID (tid);
m_being_created = false;
}
@@ -545,7 +558,10 @@ BreakpointLocation::GetDescription (Stre
if (level == lldb::eDescriptionLevelFull || level == eDescriptionLevelInitial)
{
- s->PutCString("where = ");
+ if (IsReExported())
+ s->PutCString ("re-exported target = ");
+ else
+ s->PutCString("where = ");
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false);
}
else
@@ -584,7 +600,10 @@ BreakpointLocation::GetDescription (Stre
if (sc.symbol)
{
s->EOL();
- s->Indent("symbol = ");
+ if (IsReExported())
+ s->Indent ("re-exported target = ");
+ else
+ s->Indent("symbol = ");
s->PutCString(sc.symbol->GetMangled().GetName().AsCString("<unknown>"));
}
}
@@ -612,6 +631,24 @@ BreakpointLocation::GetDescription (Stre
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
else
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+
+ if (IsIndirect() && m_bp_site_sp)
+ {
+ Address resolved_address;
+ resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target);
+ Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol();
+ if (resolved_symbol)
+ {
+ if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)
+ s->Printf (", ");
+ else if (level == lldb::eDescriptionLevelVerbose)
+ {
+ s->EOL();
+ s->Indent();
+ }
+ s->Printf ("indirect target = %s", resolved_symbol->GetName().GetCString());
+ }
+ }
if (level == lldb::eDescriptionLevelVerbose)
{
Modified: lldb/branches/iohandler/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Breakpoint/BreakpointLocationList.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/branches/iohandler/source/Breakpoint/BreakpointLocationList.cpp Fri Jan 10 19:16:50 2014
@@ -41,12 +41,12 @@ BreakpointLocationList::~BreakpointLocat
}
BreakpointLocationSP
-BreakpointLocationList::Create (const Address &addr)
+BreakpointLocationList::Create (const Address &addr, bool resolve_indirect_symbols)
{
Mutex::Locker locker (m_mutex);
// The location ID is just the size of the location list + 1
lldb::break_id_t bp_loc_id = ++m_next_id;
- BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr, LLDB_INVALID_THREAD_ID, m_owner.IsHardware()));
+ BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr, LLDB_INVALID_THREAD_ID, m_owner.IsHardware(), resolve_indirect_symbols));
m_locations.push_back (bp_loc_sp);
m_address_to_location[addr] = bp_loc_sp;
return bp_loc_sp;
@@ -247,7 +247,7 @@ BreakpointLocationList::GetDescription (
}
BreakpointLocationSP
-BreakpointLocationList::AddLocation (const Address &addr, bool *new_location)
+BreakpointLocationList::AddLocation (const Address &addr, bool resolve_indirect_symbols, bool *new_location)
{
Mutex::Locker locker (m_mutex);
@@ -256,7 +256,7 @@ BreakpointLocationList::AddLocation (con
BreakpointLocationSP bp_loc_sp (FindByAddress(addr));
if (!bp_loc_sp)
{
- bp_loc_sp = Create (addr);
+ bp_loc_sp = Create (addr, resolve_indirect_symbols);
if (bp_loc_sp)
{
bp_loc_sp->ResolveBreakpointSite();
Modified: lldb/branches/iohandler/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Breakpoint/BreakpointResolverName.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/branches/iohandler/source/Breakpoint/BreakpointResolverName.cpp Fri Jan 10 19:16:50 2014
@@ -272,6 +272,8 @@ BreakpointResolverName::SearchCallback
{
if (func_list.GetContextAtIndex(i, sc))
{
+ bool is_reexported = false;
+
if (sc.block && sc.block->GetInlinedFunctionInfo())
{
if (!sc.block->GetStartAddress(break_addr))
@@ -293,7 +295,10 @@ BreakpointResolverName::SearchCallback
{
const Symbol *actual_symbol = sc.symbol->ResolveReExportedSymbol(m_breakpoint->GetTarget());
if (actual_symbol)
+ {
+ is_reexported = true;
break_addr = actual_symbol->GetAddress();
+ }
}
else
{
@@ -313,6 +318,7 @@ BreakpointResolverName::SearchCallback
if (filter.AddressPasses(break_addr))
{
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
+ bp_loc_sp->SetIsReExported(is_reexported);
if (bp_loc_sp && new_location && !m_breakpoint->IsInternal())
{
if (log)
Modified: lldb/branches/iohandler/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/Address.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/Address.cpp (original)
+++ lldb/branches/iohandler/source/Core/Address.cpp Fri Jan 10 19:16:50 2014
@@ -328,15 +328,27 @@ Address::GetLoadAddress (Target *target)
addr_t
Address::GetCallableLoadAddress (Target *target, bool is_indirect) const
{
- if (is_indirect && target) {
+ addr_t code_addr = LLDB_INVALID_ADDRESS;
+
+ if (is_indirect && target)
+ {
ProcessSP processSP = target->GetProcessSP();
Error error;
if (processSP.get())
- return processSP->ResolveIndirectFunction(this, error);
+ {
+ code_addr = processSP->ResolveIndirectFunction(this, error);
+ if (!error.Success())
+ code_addr = LLDB_INVALID_ADDRESS;
+ }
}
-
- addr_t code_addr = GetLoadAddress (target);
-
+ else
+ {
+ code_addr = GetLoadAddress (target);
+ }
+
+ if (code_addr == LLDB_INVALID_ADDRESS)
+ return code_addr;
+
if (target)
return target->GetCallableLoadAddress (code_addr, GetAddressClass());
return code_addr;
Modified: lldb/branches/iohandler/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ValueObject.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ValueObject.cpp (original)
+++ lldb/branches/iohandler/source/Core/ValueObject.cpp Fri Jan 10 19:16:50 2014
@@ -1546,7 +1546,8 @@ bool
ValueObject::DumpPrintableRepresentation(Stream& s,
ValueObjectRepresentationStyle val_obj_display,
Format custom_format,
- PrintableRepresentationSpecialCases special)
+ PrintableRepresentationSpecialCases special,
+ bool do_dump_error)
{
Flags flags(GetTypeInfo());
@@ -1745,7 +1746,12 @@ ValueObject::DumpPrintableRepresentation
else
{
if (m_error.Fail())
- s.Printf("<%s>", m_error.AsCString());
+ {
+ if (do_dump_error)
+ s.Printf("<%s>", m_error.AsCString());
+ else
+ return false;
+ }
else if (val_obj_display == eValueObjectRepresentationStyleSummary)
s.PutCString("<no summary available>");
else if (val_obj_display == eValueObjectRepresentationStyleValue)
Modified: lldb/branches/iohandler/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/DataFormatters/FormatManager.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/branches/iohandler/source/DataFormatters/FormatManager.cpp Fri Jan 10 19:16:50 2014
@@ -963,8 +963,9 @@ FormatManager::LoadLibcxxFormatters()
AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::unordered containers summary provider", ConstString("^(std::__1::)unordered_(multi)?(map|set)<.+> >$"), stl_summary_flags, true);
stl_summary_flags.SetSkipPointers(true);
- AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
- AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
+
+ AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::shared_ptr summary provider", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
+ AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::weak_ptr summary provider", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^std::__1::__wrap_iter<.+>$"), stl_synth_flags, true);
@@ -1256,6 +1257,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
+ AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__CFString"), appkit_flags);
AddCXXSummary(corefoundation_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("NSMutableString"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
Modified: lldb/branches/iohandler/source/DataFormatters/LibCxx.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/DataFormatters/LibCxx.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/DataFormatters/LibCxx.cpp (original)
+++ lldb/branches/iohandler/source/DataFormatters/LibCxx.cpp Fri Jan 10 19:16:50 2014
@@ -26,6 +26,51 @@ using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
+bool
+lldb_private::formatters::LibcxxSmartPointerSummaryProvider (ValueObject& valobj, Stream& stream)
+{
+ ValueObjectSP valobj_sp(valobj.GetNonSyntheticValue());
+ if (!valobj_sp)
+ return false;
+ ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true));
+ ValueObjectSP count_sp(valobj_sp->GetChildAtNamePath( {ConstString("__cntrl_"),ConstString("__shared_owners_")} ));
+ ValueObjectSP weakcount_sp(valobj_sp->GetChildAtNamePath( {ConstString("__cntrl_"),ConstString("__shared_weak_owners_")} ));
+
+ if (!ptr_sp)
+ return false;
+
+ if (ptr_sp->GetValueAsUnsigned(0) == 0)
+ {
+ stream.Printf("nullptr");
+ return true;
+ }
+ else
+ {
+ bool print_pointee = false;
+ Error error;
+ ValueObjectSP pointee_sp = ptr_sp->Dereference(error);
+ if (pointee_sp && error.Success())
+ {
+ if (pointee_sp->DumpPrintableRepresentation(stream,
+ ValueObject::eValueObjectRepresentationStyleSummary,
+ lldb::eFormatInvalid,
+ ValueObject::ePrintableRepresentationSpecialCasesDisable,
+ false))
+ print_pointee = true;
+ }
+ if (!print_pointee)
+ stream.Printf("ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
+ }
+
+ if (count_sp)
+ stream.Printf(" strong=%" PRIu64, 1+count_sp->GetValueAsUnsigned(0));
+
+ if (weakcount_sp)
+ stream.Printf(" weak=%" PRIu64, 1+weakcount_sp->GetValueAsUnsigned(0));
+
+ return true;
+}
+
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::LibcxxVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
SyntheticChildrenFrontEnd(*valobj_sp.get()),
m_bool_type(),
Modified: lldb/branches/iohandler/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Expression/Materializer.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Expression/Materializer.cpp (original)
+++ lldb/branches/iohandler/source/Expression/Materializer.cpp Fri Jan 10 19:16:50 2014
@@ -461,7 +461,9 @@ public:
}
else
{
- lldb::addr_t addr_of_valobj = valobj_sp->GetAddressOf();
+ AddressType address_type = eAddressTypeInvalid;
+ const bool scalar_is_load_address = false;
+ lldb::addr_t addr_of_valobj = valobj_sp->GetAddressOf(scalar_is_load_address, &address_type);
if (addr_of_valobj != LLDB_INVALID_ADDRESS)
{
Error write_error;
Modified: lldb/branches/iohandler/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/macosx/Host.mm?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/macosx/Host.mm (original)
+++ lldb/branches/iohandler/source/Host/macosx/Host.mm Fri Jan 10 19:16:50 2014
@@ -1003,61 +1003,69 @@ Host::GetOSVersion
uint32_t &update
)
{
- static const char *version_plist_file = "/System/Library/CoreServices/SystemVersion.plist";
- char buffer[256];
- const char *product_version_str = NULL;
-
- CFCReleaser<CFURLRef> plist_url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
- (UInt8 *) version_plist_file,
- strlen (version_plist_file), NO));
- if (plist_url.get())
+ static uint32_t g_major = 0;
+ static uint32_t g_minor = 0;
+ static uint32_t g_update = 0;
+
+ if (g_major == 0)
{
- CFCReleaser<CFPropertyListRef> property_list;
- CFCReleaser<CFStringRef> error_string;
- CFCReleaser<CFDataRef> resource_data;
- SInt32 error_code;
-
- // Read the XML file.
- if (CFURLCreateDataAndPropertiesFromResource (kCFAllocatorDefault,
- plist_url.get(),
- resource_data.ptr_address(),
- NULL,
- NULL,
- &error_code))
+ static const char *version_plist_file = "/System/Library/CoreServices/SystemVersion.plist";
+ char buffer[256];
+ const char *product_version_str = NULL;
+
+ CFCReleaser<CFURLRef> plist_url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
+ (UInt8 *) version_plist_file,
+ strlen (version_plist_file), NO));
+ if (plist_url.get())
{
- // Reconstitute the dictionary using the XML data.
- property_list = CFPropertyListCreateFromXMLData (kCFAllocatorDefault,
- resource_data.get(),
- kCFPropertyListImmutable,
- error_string.ptr_address());
- if (CFGetTypeID(property_list.get()) == CFDictionaryGetTypeID())
+ CFCReleaser<CFPropertyListRef> property_list;
+ CFCReleaser<CFStringRef> error_string;
+ CFCReleaser<CFDataRef> resource_data;
+ SInt32 error_code;
+
+ // Read the XML file.
+ if (CFURLCreateDataAndPropertiesFromResource (kCFAllocatorDefault,
+ plist_url.get(),
+ resource_data.ptr_address(),
+ NULL,
+ NULL,
+ &error_code))
{
- CFDictionaryRef property_dict = (CFDictionaryRef) property_list.get();
- CFStringRef product_version_key = CFSTR("ProductVersion");
- CFPropertyListRef product_version_value;
- product_version_value = CFDictionaryGetValue(property_dict, product_version_key);
- if (product_version_value && CFGetTypeID(product_version_value) == CFStringGetTypeID())
+ // Reconstitute the dictionary using the XML data.
+ property_list = CFPropertyListCreateFromXMLData (kCFAllocatorDefault,
+ resource_data.get(),
+ kCFPropertyListImmutable,
+ error_string.ptr_address());
+ if (CFGetTypeID(property_list.get()) == CFDictionaryGetTypeID())
{
- CFStringRef product_version_cfstr = (CFStringRef) product_version_value;
- product_version_str = CFStringGetCStringPtr(product_version_cfstr, kCFStringEncodingUTF8);
- if (product_version_str != NULL) {
- if (CFStringGetCString(product_version_cfstr, buffer, 256, kCFStringEncodingUTF8))
- product_version_str = buffer;
+ CFDictionaryRef property_dict = (CFDictionaryRef) property_list.get();
+ CFStringRef product_version_key = CFSTR("ProductVersion");
+ CFPropertyListRef product_version_value;
+ product_version_value = CFDictionaryGetValue(property_dict, product_version_key);
+ if (product_version_value && CFGetTypeID(product_version_value) == CFStringGetTypeID())
+ {
+ CFStringRef product_version_cfstr = (CFStringRef) product_version_value;
+ product_version_str = CFStringGetCStringPtr(product_version_cfstr, kCFStringEncodingUTF8);
+ if (product_version_str != NULL) {
+ if (CFStringGetCString(product_version_cfstr, buffer, 256, kCFStringEncodingUTF8))
+ product_version_str = buffer;
+ }
}
}
}
}
+ if (product_version_str)
+ Args::StringToVersion(product_version_str, g_major, g_minor, g_update);
}
-
- if (product_version_str)
+ if (g_major != 0)
{
- Args::StringToVersion(product_version_str, major, minor, update);
+ major = g_major;
+ minor = g_minor;
+ update = g_update;
return true;
}
- else
- return false;
-
+ return false;
}
static bool
@@ -1327,8 +1335,29 @@ GetPosixspawnFlags (ProcessLaunchInfo &l
flags |= POSIX_SPAWN_SETPGROUP;
#ifdef POSIX_SPAWN_CLOEXEC_DEFAULT
+#if defined (__APPLE__) && (defined (__x86_64__) || defined (__i386__))
+ static LazyBool g_use_close_on_exec_flag = eLazyBoolCalculate;
+ if (g_use_close_on_exec_flag == eLazyBoolCalculate)
+ {
+ g_use_close_on_exec_flag = eLazyBoolNo;
+
+ uint32_t major, minor, update;
+ if (Host::GetOSVersion(major, minor, update))
+ {
+ // Kernel panic if we use the POSIX_SPAWN_CLOEXEC_DEFAULT on 10.7 or earlier
+ if (major > 10 || (major == 10 && minor > 7))
+ {
+ // Only enable for 10.8 and later OS versions
+ g_use_close_on_exec_flag = eLazyBoolYes;
+ }
+ }
+ }
+#else
+ static LazyBool g_use_close_on_exec_flag = eLazyBoolYes;
+#endif
// Close all files exception those with file actions if this is supported.
- flags |= POSIX_SPAWN_CLOEXEC_DEFAULT;
+ if (g_use_close_on_exec_flag == eLazyBoolYes)
+ flags |= POSIX_SPAWN_CLOEXEC_DEFAULT;
#endif
return flags;
Modified: lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist (original)
+++ lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist Fri Jan 10 19:16:50 2014
@@ -25,7 +25,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>310.99.0</string>
+ <string>320.99.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
<key>XPCService</key>
Modified: lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist (original)
+++ lldb/branches/iohandler/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist Fri Jan 10 19:16:50 2014
@@ -25,7 +25,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>310.99.0</string>
+ <string>320.99.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
<key>XPCService</key>
Modified: lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Jan 10 19:16:50 2014
@@ -1534,8 +1534,18 @@ DynamicLoaderMacOSXDYLD::SetNotification
// callback function that will get called each time the
// breakpoint gets hit. We will use this to track when shared
// libraries get loaded/unloaded.
+ bool resolved = m_process->GetTarget().ResolveLoadAddress(m_dyld_all_image_infos.notification, so_addr);
+ if (!resolved)
+ {
+ ModuleSP dyld_module_sp = m_dyld_module_wp.lock();
+ if (dyld_module_sp)
+ {
+ UpdateImageLoadAddress (dyld_module_sp.get(), m_dyld);
+ resolved = m_process->GetTarget().ResolveLoadAddress(m_dyld_all_image_infos.notification, so_addr);
+ }
+ }
- if (m_process->GetTarget().ResolveLoadAddress(m_dyld_all_image_infos.notification, so_addr))
+ if (resolved)
{
Breakpoint *dyld_break = m_process->GetTarget().CreateBreakpoint (so_addr, true, false).get();
dyld_break->SetCallback (DynamicLoaderMacOSXDYLD::NotifyBreakpointHit, this, true);
@@ -1586,14 +1596,6 @@ DynamicLoaderMacOSXDYLD::PrivateProcessS
}
}
-// This bit in the n_desc field of the mach file means that this is a
-// stub that runs arbitrary code to determine the trampoline target.
-// We've established a naming convention with the CoreOS folks for the
-// equivalent symbols they will use for this (which the objc guys didn't follow...)
-// For now we'll just look for all symbols matching that naming convention...
-
-#define MACH_O_N_SYMBOL_RESOLVER 0x100
-
ThreadPlanSP
DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)
{
@@ -1602,104 +1604,123 @@ DynamicLoaderMacOSXDYLD::GetStepThroughT
const SymbolContext ¤t_context = current_frame->GetSymbolContext(eSymbolContextSymbol);
Symbol *current_symbol = current_context.symbol;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ TargetSP target_sp (thread.CalculateTarget());
if (current_symbol != NULL)
{
+ std::vector<Address> addresses;
+
if (current_symbol->IsTrampoline())
{
const ConstString &trampoline_name = current_symbol->GetMangled().GetName(Mangled::ePreferMangled);
if (trampoline_name)
{
- SymbolContextList target_symbols;
- TargetSP target_sp (thread.CalculateTarget());
const ModuleList &images = target_sp->GetImages();
- images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode, target_symbols);
-
- size_t num_original_symbols = target_symbols.GetSize();
- // FIXME: The resolver symbol is only valid in object files. In binaries it is reused for the
- // shared library slot number. So we'll have to look this up in the dyld info.
- // For now, just turn this off.
-
- // bool orig_is_resolver = (current_symbol->GetFlags() & MACH_O_N_SYMBOL_RESOLVER) == MACH_O_N_SYMBOL_RESOLVER;
- // FIXME: Actually that isn't true, the N_SYMBOL_RESOLVER bit is only valid in .o files. You can't use
- // the symbol flags to tell whether something is a symbol resolver in a linked image.
- bool orig_is_resolver = false;
+ SymbolContextList code_symbols;
+ images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode, code_symbols);
+ size_t num_code_symbols = code_symbols.GetSize();
- if (num_original_symbols > 0)
+ if (num_code_symbols > 0)
{
- // We found symbols that look like they are the targets to our symbol. Now look through the
- // modules containing our symbols to see if there are any for our symbol.
-
- ModuleList modules_to_search;
-
- for (size_t i = 0; i < num_original_symbols; i++)
- {
- SymbolContext sc;
- target_symbols.GetContextAtIndex(i, sc);
-
- ModuleSP module_sp (sc.symbol->CalculateSymbolContextModule());
- if (module_sp)
- modules_to_search.AppendIfNeeded(module_sp);
- }
-
- // If the original stub symbol is a resolver, then we don't want to break on the symbol with the
- // original name, but instead on all the symbols it could resolve to since otherwise we would stop
- // in the middle of the resolution...
- // Note that the stub is not of the resolver type it will point to the equivalent symbol,
- // not the original name, so in that case we don't need to do anything.
-
- if (orig_is_resolver)
+ for (uint32_t i = 0; i < num_code_symbols; i++)
{
- target_symbols.Clear();
-
- FindEquivalentSymbols (current_symbol, modules_to_search, target_symbols);
- }
-
- // FIXME - Make the Run to Address take multiple addresses, and
- // run to any of them.
- uint32_t num_symbols = target_symbols.GetSize();
- if (num_symbols > 0)
- {
- std::vector<lldb::addr_t> addresses;
- addresses.resize (num_symbols);
- for (uint32_t i = 0; i < num_symbols; i++)
+ SymbolContext context;
+ AddressRange addr_range;
+ if (code_symbols.GetContextAtIndex(i, context))
{
- SymbolContext context;
- AddressRange addr_range;
- if (target_symbols.GetContextAtIndex(i, context))
+ context.GetAddressRange (eSymbolContextEverything, 0, false, addr_range);
+ addresses.push_back(addr_range.GetBaseAddress());
+ if (log)
{
- context.GetAddressRange (eSymbolContextEverything, 0, false, addr_range);
- lldb::addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
- addresses[i] = load_addr;
+ addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
+
+ log->Printf ("Found a trampoline target symbol at 0x%" PRIx64 ".", load_addr);
}
}
- if (addresses.size() > 0)
- thread_plan_sp.reset (new ThreadPlanRunToAddress (thread, addresses, stop_others));
- else
- {
- if (log)
- log->Printf ("Couldn't resolve the symbol contexts.");
- }
}
- else
+ }
+
+ SymbolContextList reexported_symbols;
+ images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeReExported, reexported_symbols);
+ size_t num_reexported_symbols = reexported_symbols.GetSize();
+ if (num_reexported_symbols > 0)
+ {
+ for (uint32_t i = 0; i < num_reexported_symbols; i++)
{
- if (log)
+ SymbolContext context;
+ if (reexported_symbols.GetContextAtIndex(i, context))
{
- log->Printf ("Found a resolver stub for: \"%s\" but could not find any symbols it resolves to.",
- trampoline_name.AsCString());
+ if (context.symbol)
+ {
+ Symbol *actual_symbol = context.symbol->ResolveReExportedSymbol(*target_sp.get());
+ if (actual_symbol)
+ {
+ if (actual_symbol->GetAddress().IsValid())
+ {
+ addresses.push_back(actual_symbol->GetAddress());
+ if (log)
+ {
+ lldb::addr_t load_addr = actual_symbol->GetAddress().GetLoadAddress(target_sp.get());
+ log->Printf ("Found a re-exported symbol: %s at 0x%" PRIx64 ".",
+ actual_symbol->GetName().GetCString(), load_addr);
+ }
+ }
+ }
+ }
}
}
}
- else
+ }
+ }
+ else if (current_symbol->GetType() == eSymbolTypeReExported)
+ {
+ // I am not sure we could ever end up stopped AT a re-exported symbol. But just in case:
+
+ const Symbol *actual_symbol = current_symbol->ResolveReExportedSymbol(*(target_sp.get()));
+ if (actual_symbol)
+ {
+ Address target_addr(actual_symbol->GetAddress());
+ if (target_addr.IsValid())
{
if (log)
+ log->Printf ("Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64 ".",
+ current_symbol->GetName().GetCString(),
+ actual_symbol->GetName().GetCString(),
+ target_addr.GetLoadAddress(target_sp.get()));
+ addresses.push_back (target_addr.GetLoadAddress(target_sp.get()));
+
+ }
+ }
+ }
+
+ if (addresses.size() > 0)
+ {
+ // First check whether any of the addresses point to Indirect symbols, and if they do, resolve them:
+ std::vector<lldb::addr_t> load_addrs;
+ for (Address address : addresses)
+ {
+ Symbol *symbol = address.CalculateSymbolContextSymbol();
+ if (symbol && symbol->IsIndirect())
+ {
+ Error error;
+ addr_t resolved_addr = thread.GetProcess()->ResolveIndirectFunction(&symbol->GetAddress(), error);
+ if (error.Success())
{
- log->Printf ("Could not find symbol for trampoline target: \"%s\"", trampoline_name.AsCString());
+ load_addrs.push_back(resolved_addr);
+ if (log)
+ log->Printf("ResolveIndirectFunction found resolved target for %s at 0x%" PRIx64 ".",
+ symbol->GetName().GetCString(), resolved_addr);
}
}
+ else
+ {
+ load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
+ }
+
}
+ thread_plan_sp.reset (new ThreadPlanRunToAddress (thread, load_addrs, stop_others));
}
}
else
@@ -1722,7 +1743,7 @@ DynamicLoaderMacOSXDYLD::FindEquivalentS
size_t initial_size = equivalent_symbols.GetSize();
- static const char *resolver_name_regex = "(_gc|_non_gc|\\$[A-Z0-9]+)$";
+ static const char *resolver_name_regex = "(_gc|_non_gc|\\$[A-Za-z0-9\\$]+)$";
std::string equivalent_regex_buf("^");
equivalent_regex_buf.append (trampoline_name.GetCString());
equivalent_regex_buf.append (resolver_name_regex);
Modified: lldb/branches/iohandler/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Fri Jan 10 19:16:50 2014
@@ -289,37 +289,65 @@ EmulateInstructionARM::GetRegisterInfo (
uint32_t
EmulateInstructionARM::GetFramePointerRegisterNumber () const
{
- if (m_opcode_mode == eModeThumb)
+ bool is_apple = false;
+ if (m_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+ is_apple = true;
+ switch (m_arch.GetTriple().getOS())
{
- switch (m_arch.GetTriple().getOS())
- {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
- return 7;
+ is_apple = true;
+ break;
default:
break;
- }
}
- return 11;
+
+ /* On Apple iOS et al, the frame pointer register is always r7.
+ * Typically on other ARM systems, thumb code uses r7; arm code uses r11.
+ */
+
+ uint32_t fp_regnum = 11;
+
+ if (is_apple)
+ fp_regnum = 7;
+
+ if (m_opcode_mode == eModeThumb)
+ fp_regnum = 7;
+
+ return fp_regnum;
}
uint32_t
EmulateInstructionARM::GetFramePointerDWARFRegisterNumber () const
{
- if (m_opcode_mode == eModeThumb)
+ bool is_apple = false;
+ if (m_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+ is_apple = true;
+ switch (m_arch.GetTriple().getOS())
{
- switch (m_arch.GetTriple().getOS())
- {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
- return dwarf_r7;
+ is_apple = true;
+ break;
default:
break;
- }
}
- return dwarf_r11;
+
+ /* On Apple iOS et al, the frame pointer register is always r7.
+ * Typically on other ARM systems, thumb code uses r7; arm code uses r11.
+ */
+
+ uint32_t fp_regnum = dwarf_r11;
+
+ if (is_apple)
+ fp_regnum = dwarf_r7;
+
+ if (m_opcode_mode == eModeThumb)
+ fp_regnum = dwarf_r7;
+
+ return fp_regnum;
}
// Push Multiple Registers stores multiple registers to the stack, storing to
Modified: lldb/branches/iohandler/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Fri Jan 10 19:16:50 2014
@@ -403,7 +403,9 @@ ItaniumABILanguageRuntime::CreateExcepti
FileSpecList filter_modules;
BreakpointResolverSP exception_resolver_sp = CreateExceptionResolver (NULL, catch_bp, throw_bp, for_expressions);
SearchFilterSP filter_sp (CreateExceptionSearchFilter ());
- return target.CreateBreakpoint (filter_sp, exception_resolver_sp, is_internal, false);
+ const bool hardware = false;
+ const bool resolve_indirect_functions = false;
+ return target.CreateBreakpoint (filter_sp, exception_resolver_sp, is_internal, hardware, resolve_indirect_functions);
}
void
Modified: lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Jan 10 19:16:50 2014
@@ -1569,8 +1569,9 @@ ParseTrieEntries (DataExtractor &data,
e.entry.address = data.GetULEB128(&offset);
if ( e.entry.flags & EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER )
{
- resolver_addresses.insert(e.entry.address);
+ //resolver_addresses.insert(e.entry.address);
e.entry.other = data.GetULEB128(&offset);
+ resolver_addresses.insert(e.entry.other);
}
else
e.entry.other = 0;
@@ -2004,6 +2005,31 @@ ObjectFileMachO::ParseSymtab ()
std::string memory_symbol_name;
uint32_t unmapped_local_symbols_found = 0;
+ std::vector<TrieEntryWithOffset> trie_entries;
+ std::set<lldb::addr_t> resolver_addresses;
+
+ if (dyld_trie_data.GetByteSize() > 0)
+ {
+ std::vector<llvm::StringRef> nameSlices;
+ ParseTrieEntries (dyld_trie_data,
+ 0,
+ nameSlices,
+ resolver_addresses,
+ trie_entries);
+
+ ConstString text_segment_name ("__TEXT");
+ SectionSP text_segment_sp = GetSectionList()->FindSectionByName(text_segment_name);
+ if (text_segment_sp)
+ {
+ const lldb::addr_t text_segment_file_addr = text_segment_sp->GetFileAddress();
+ if (text_segment_file_addr != LLDB_INVALID_ADDRESS)
+ {
+ for (auto &e : trie_entries)
+ e.entry.address += text_segment_file_addr;
+ }
+ }
+ }
+
#if defined (__APPLE__) && defined (__arm__)
// Some recent builds of the dyld_shared_cache (hereafter: DSC) have been optimized by moving LOCAL
@@ -2839,10 +2865,17 @@ ObjectFileMachO::ParseSymtab ()
// into the N_FUN flags to avoid duplicate symbols in the symbol table
sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+ if (resolver_addresses.find(nlist.n_value) != resolver_adresses.end())
+ sym[pos->second].SetType (eSymbolTypeResolver);
sym[sym_idx].Clear();
continue;
}
}
+ else
+ {
+ if (resolver_addresses.find(nlist.n_value) != resolver_adresses.end())
+ sym[sym_idx].SetType (eSymbolTypeResolver);
+ }
}
else if (type == eSymbolTypeData)
{
@@ -2919,7 +2952,7 @@ ObjectFileMachO::ParseSymtab ()
// Must reset this in case it was mutated above!
nlist_data_offset = 0;
#endif
-
+
if (nlist_data.GetByteSize() > 0)
{
@@ -3584,10 +3617,17 @@ ObjectFileMachO::ParseSymtab ()
// into the N_FUN flags to avoid duplicate symbols in the symbol table
sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+ if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
+ sym[pos->second].SetType (eSymbolTypeResolver);
sym[sym_idx].Clear();
continue;
}
}
+ else
+ {
+ if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
+ sym[sym_idx].SetType (eSymbolTypeResolver);
+ }
}
else if (type == eSymbolTypeData)
{
@@ -3736,31 +3776,6 @@ ObjectFileMachO::ParseSymtab ()
sym = symtab->Resize (num_syms);
}
- std::vector<TrieEntryWithOffset> trie_entries;
- std::set<lldb::addr_t> resolver_addresses;
-
- if (dyld_trie_data.GetByteSize() > 0)
- {
- std::vector<llvm::StringRef> nameSlices;
- ParseTrieEntries (dyld_trie_data,
- 0,
- nameSlices,
- resolver_addresses,
- trie_entries);
-
- ConstString text_segment_name ("__TEXT");
- SectionSP text_segment_sp = GetSectionList()->FindSectionByName(text_segment_name);
- if (text_segment_sp)
- {
- const lldb::addr_t text_segment_file_addr = text_segment_sp->GetFileAddress();
- if (text_segment_file_addr != LLDB_INVALID_ADDRESS)
- {
- for (auto &e : trie_entries)
- e.entry.address += text_segment_file_addr;
- }
- }
- }
-
// Now synthesize indirect symbols
if (m_dysymtab.nindirectsyms != 0)
{
Modified: lldb/branches/iohandler/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Fri Jan 10 19:16:50 2014
@@ -409,8 +409,8 @@ CommunicationKDP::SendRequestConnect (ui
MakeRequestPacketHeader (command, request_packet, command_length);
// Always send connect ports as little endian
request_packet.SetByteOrder (eByteOrderLittle);
- request_packet.PutHex16 (reply_port);
- request_packet.PutHex16 (exc_port);
+ request_packet.PutHex16 (htons(reply_port));
+ request_packet.PutHex16 (htons(exc_port));
request_packet.SetByteOrder (m_byte_order);
request_packet.PutCString (greeting);
DataExtractor reply_packet;
@@ -438,7 +438,7 @@ CommunicationKDP::SendRequestReattach (u
MakeRequestPacketHeader (command, request_packet, command_length);
// Always send connect ports as little endian
request_packet.SetByteOrder (eByteOrderLittle);
- request_packet.PutHex16(reply_port);
+ request_packet.PutHex16(htons(reply_port));
request_packet.SetByteOrder (m_byte_order);
DataExtractor reply_packet;
if (SendRequestAndGetReply (command, request_packet, reply_packet))
@@ -1035,8 +1035,8 @@ CommunicationKDP::DumpPacket (Stream &s,
{
case KDP_CONNECT:
{
- const uint16_t reply_port = packet.GetU16 (&offset);
- const uint16_t exc_port = packet.GetU16 (&offset);
+ const uint16_t reply_port = ntohs(packet.GetU16 (&offset));
+ const uint16_t exc_port = ntohs(packet.GetU16 (&offset));
s.Printf(" (reply_port = %u, exc_port = %u, greeting = \"%s\")", reply_port, exc_port, packet.GetCStr(&offset));
}
break;
@@ -1214,7 +1214,7 @@ CommunicationKDP::DumpPacket (Stream &s,
case KDP_REATTACH:
{
- const uint16_t reply_port = packet.GetU16 (&offset);
+ const uint16_t reply_port = ntohs(packet.GetU16 (&offset));
s.Printf(" (reply_port = %u)", reply_port);
}
break;
Modified: lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Fri Jan 10 19:16:50 2014
@@ -632,20 +632,6 @@ ProcessPOSIX::DoDeallocateMemory(lldb::a
return error;
}
-addr_t
-ProcessPOSIX::ResolveIndirectFunction(const Address *address, Error &error)
-{
- addr_t function_addr = LLDB_INVALID_ADDRESS;
- if (address == NULL) {
- error.SetErrorStringWithFormat("unable to determine direct function call for NULL address");
- } else if (!InferiorCall(this, address, function_addr)) {
- function_addr = LLDB_INVALID_ADDRESS;
- error.SetErrorStringWithFormat("unable to determine direct function call for indirect function %s",
- address->CalculateSymbolContextSymbol()->GetName().AsCString());
- }
- return function_addr;
-}
-
size_t
ProcessPOSIX::GetSoftwareBreakpointTrapOpcode(BreakpointSite* bp_site)
{
Modified: lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.h (original)
+++ lldb/branches/iohandler/source/Plugins/Process/POSIX/ProcessPOSIX.h Fri Jan 10 19:16:50 2014
@@ -104,9 +104,6 @@ public:
virtual lldb_private::Error
DoDeallocateMemory(lldb::addr_t ptr);
- virtual lldb::addr_t
- ResolveIndirectFunction(const lldb_private::Address *address, lldb_private::Error &error);
-
virtual size_t
GetSoftwareBreakpointTrapOpcode(lldb_private::BreakpointSite* bp_site);
Modified: lldb/branches/iohandler/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Fri Jan 10 19:16:50 2014
@@ -34,9 +34,16 @@
using namespace lldb;
using namespace lldb_private;
-bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
- addr_t addr, addr_t length, unsigned prot,
- unsigned flags, addr_t fd, addr_t offset) {
+bool
+lldb_private::InferiorCallMmap (Process *process,
+ addr_t &allocated_addr,
+ addr_t addr,
+ addr_t length,
+ unsigned prot,
+ unsigned flags,
+ addr_t fd,
+ addr_t offset)
+{
Thread *thread = process->GetThreadList().GetSelectedThread().get();
if (thread == NULL)
return false;
@@ -139,8 +146,11 @@ bool lldb_private::InferiorCallMmap(Proc
return false;
}
-bool lldb_private::InferiorCallMunmap(Process *process, addr_t addr,
- addr_t length) {
+bool
+lldb_private::InferiorCallMunmap (Process *process,
+ addr_t addr,
+ addr_t length)
+{
Thread *thread = process->GetThreadList().GetSelectedThread().get();
if (thread == NULL)
return false;
@@ -209,7 +219,14 @@ bool lldb_private::InferiorCallMunmap(Pr
return false;
}
-bool lldb_private::InferiorCall(Process *process, const Address *address, addr_t &returned_func) {
+// FIXME: This has nothing to do with Posix, it is just a convenience function that calls a
+// function of the form "void * (*)(void)". We should find a better place to put this.
+
+bool
+lldb_private::InferiorCall (Process *process,
+ const Address *address,
+ addr_t &returned_func)
+{
Thread *thread = process->GetThreadList().GetSelectedThread().get();
if (thread == NULL || address == NULL)
return false;
@@ -233,7 +250,7 @@ bool lldb_private::InferiorCall(Process
lldb::ThreadPlanSP call_plan_sp (call_function_thread_plan);
if (call_plan_sp)
{
- StreamFile error_strm;
+ StreamString error_strm;
// This plan is a utility plan, so set it to discard itself when done.
call_plan_sp->SetIsMasterPlan (true);
call_plan_sp->SetOkayToDiscard(true);
Modified: lldb/branches/iohandler/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Jan 10 19:16:50 2014
@@ -1201,7 +1201,7 @@ RegisterContextLLDB::SavedLocationForReg
regloc.type = UnwindLLDB::RegisterLocation::eRegisterValueInferred;
regloc.location.inferred_value = m_cfa + offset;
m_registers[lldb_regnum] = regloc;
- UnwindLogMsg ("supplying caller's register %d, value is CFA plus offset", lldb_regnum);
+ UnwindLogMsg ("supplying caller's register %d, value is CFA plus offset %d", lldb_regnum, offset);
return UnwindLLDB::RegisterSearchResult::eRegisterFound;
}
@@ -1211,7 +1211,7 @@ RegisterContextLLDB::SavedLocationForReg
regloc.type = UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation;
regloc.location.target_memory_location = m_cfa + offset;
m_registers[lldb_regnum] = regloc;
- UnwindLogMsg ("supplying caller's register %d from the stack, saved at CFA plus offset", lldb_regnum);
+ UnwindLogMsg ("supplying caller's register %d from the stack, saved at CFA plus offset %d", lldb_regnum, offset);
return UnwindLLDB::RegisterSearchResult::eRegisterFound;
}
Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Jan 10 19:16:50 2014
@@ -598,12 +598,12 @@ GDBRemoteCommunication::ListenThread (ll
}
Error
-GDBRemoteCommunication::StartDebugserverProcess (const char *host_and_port,
+GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
+ uint16_t in_port,
lldb_private::ProcessLaunchInfo &launch_info,
- uint16_t &port)
+ uint16_t &out_port)
{
- port = 0;
-
+ out_port = in_port;
Error error;
// If we locate debugserver, keep that located version around
static FileSpec g_debugserver_file_spec;
@@ -651,8 +651,17 @@ GDBRemoteCommunication::StartDebugserver
debugserver_args.AppendArgument(debugserver_path);
// If a host and port is supplied then use it
- if (host_and_port)
+ char host_and_port[128];
+ if (hostname)
+ {
+ snprintf (host_and_port, sizeof(host_and_port), "%s:%u", hostname, in_port);
debugserver_args.AppendArgument(host_and_port);
+ }
+ else
+ {
+ host_and_port[0] = '\0';
+ }
+
// use native registers, not the GDB registers
debugserver_args.AppendArgument("--native-regs");
// make debugserver run in its own session so signals generated by
@@ -661,34 +670,45 @@ GDBRemoteCommunication::StartDebugserver
char named_pipe_path[PATH_MAX];
- if (host_and_port)
+ bool listen = false;
+ if (host_and_port[0])
{
// Create a temporary file to get the stdout/stderr and redirect the
// output of the command into this file. We will later read this file
// if all goes well and fill the data into "command_output_ptr"
- FileSpec tmpdir_file_spec;
- if (Host::GetLLDBPath (ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
- {
- tmpdir_file_spec.GetFilename().SetCString("debugserver-named-pipe.XXXXXX");
- strncpy(named_pipe_path, tmpdir_file_spec.GetPath().c_str(), sizeof(named_pipe_path));
- }
- else
- {
- strncpy(named_pipe_path, "/tmp/debugserver-named-pipe.XXXXXX", sizeof(named_pipe_path));
- }
- if (::mktemp (named_pipe_path))
+ if (in_port == 0)
{
- if (::mkfifo(named_pipe_path, 0600) == 0)
+ // Binding to port zero, we need to figure out what port it ends up
+ // using using a named pipe...
+ FileSpec tmpdir_file_spec;
+ if (Host::GetLLDBPath (ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
{
- debugserver_args.AppendArgument("--named-pipe");
- debugserver_args.AppendArgument(named_pipe_path);
+ tmpdir_file_spec.GetFilename().SetCString("debugserver-named-pipe.XXXXXX");
+ strncpy(named_pipe_path, tmpdir_file_spec.GetPath().c_str(), sizeof(named_pipe_path));
+ }
+ else
+ {
+ strncpy(named_pipe_path, "/tmp/debugserver-named-pipe.XXXXXX", sizeof(named_pipe_path));
+ }
+
+ if (::mktemp (named_pipe_path))
+ {
+ if (::mkfifo(named_pipe_path, 0600) == 0)
+ {
+ debugserver_args.AppendArgument("--named-pipe");
+ debugserver_args.AppendArgument(named_pipe_path);
+ }
+ else
+ named_pipe_path[0] = '\0';
}
else
named_pipe_path[0] = '\0';
}
else
- named_pipe_path[0] = '\0';
+ {
+ listen = true;
+ }
}
else
{
@@ -701,10 +721,10 @@ GDBRemoteCommunication::StartDebugserver
return error;
ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection ();
- port = connection->GetBoundPort(3);
- assert (port != 0);
+ out_port = connection->GetBoundPort(3);
+ assert (out_port != 0);
char port_cstr[32];
- snprintf(port_cstr, sizeof(port_cstr), "localhost:%i", port);
+ snprintf(port_cstr, sizeof(port_cstr), "localhost:%i", out_port);
// Send the host and port down that debugserver and specify an option
// so that it connects back to the port we are listening to in this process
debugserver_args.AppendArgument("--reverse-connect");
@@ -746,11 +766,15 @@ GDBRemoteCommunication::StartDebugserver
error = name_pipe_file.Read(port_cstr, num_bytes);
assert (error.Success());
assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
- port = Args::StringToUInt32(port_cstr, 0);
+ out_port = Args::StringToUInt32(port_cstr, 0);
name_pipe_file.Close();
}
Host::Unlink(named_pipe_path);
}
+ else if (listen)
+ {
+
+ }
else
{
// Make sure we actually connect with the debugserver...
Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Fri Jan 10 19:16:50 2014
@@ -121,9 +121,10 @@ public:
// supplied connection URL.
//------------------------------------------------------------------
lldb_private::Error
- StartDebugserverProcess (const char *host_and_port,
+ StartDebugserverProcess (const char *hostname,
+ uint16_t in_port, // If set to zero, then out_port will contain the bound port on exit
lldb_private::ProcessLaunchInfo &launch_info,
- uint16_t &port);
+ uint16_t &out_port);
void
DumpHistory(lldb_private::Stream &strm);
Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Fri Jan 10 19:16:50 2014
@@ -841,18 +841,16 @@ GDBRemoteCommunicationServer::Handle_qLa
{
// Spawn a debugserver and try to get the port it listens to.
ProcessLaunchInfo debugserver_launch_info;
- StreamString host_and_port;
if (hostname.empty())
hostname = "localhost";
- host_and_port.Printf("%s:%u", hostname.c_str(), port);
- const char *host_and_port_cstr = host_and_port.GetString().c_str();
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
if (log)
- log->Printf("Launching debugserver with: %s...\n", host_and_port_cstr);
+ log->Printf("Launching debugserver with: %s:%u...\n", hostname.c_str(), port);
debugserver_launch_info.SetMonitorProcessCallback(ReapDebugserverProcess, this, false);
- error = StartDebugserverProcess (host_and_port_cstr,
+ error = StartDebugserverProcess (hostname.empty() ? NULL : hostname.c_str(),
+ port,
debugserver_launch_info,
port);
Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jan 10 19:16:50 2014
@@ -166,6 +166,34 @@ namespace {
} // anonymous namespace end
+static bool rand_initialized = false;
+
+// TODO Randomly assigning a port is unsafe. We should get an unused
+// ephemeral port from the kernel and make sure we reserve it before passing
+// it to debugserver.
+
+#if defined (__APPLE__)
+#define LOW_PORT (IPPORT_RESERVED)
+#define HIGH_PORT (IPPORT_HIFIRSTAUTO)
+#else
+#define LOW_PORT (1024u)
+#define HIGH_PORT (49151u)
+#endif
+
+static inline uint16_t
+get_random_port ()
+{
+ if (!rand_initialized)
+ {
+ time_t seed = time(NULL);
+
+ rand_initialized = true;
+ srand(seed);
+ }
+ return (rand() % (HIGH_PORT - LOW_PORT)) + LOW_PORT;
+}
+
+
lldb_private::ConstString
ProcessGDBRemote::GetPluginNameStatic()
{
@@ -508,6 +536,10 @@ ProcessGDBRemote::BuildDynamicRegisterIn
m_register_info.AddRegister(reg_info, reg_name, alt_name, set_name);
}
+ else
+ {
+ break; // ensure exit before reg_num is incremented
+ }
}
else
{
@@ -2488,7 +2520,6 @@ Error
ProcessGDBRemote::LaunchAndConnectToDebugserver (const ProcessInfo &process_info)
{
Error error;
- uint16_t port = 0;
if (m_debugserver_pid == LLDB_INVALID_PROCESS_ID)
{
// If we locate debugserver, keep that located version around
@@ -2498,7 +2529,20 @@ ProcessGDBRemote::LaunchAndConnectToDebu
debugserver_launch_info.SetMonitorProcessCallback (MonitorDebugserverProcess, this, false);
debugserver_launch_info.SetUserID(process_info.GetUserID());
- error = m_gdb_comm.StartDebugserverProcess (NULL,
+#if defined (__APPLE__) && defined (__arm__)
+ // On iOS, still do a local connection using a random port
+ const char *hostname = "localhost";
+ uint16_t port = get_random_port ();
+#else
+ // Set hostname being NULL to do the reverse connect where debugserver
+ // will bind to port zero and it will communicate back to us the port
+ // that we will connect to
+ const char *hostname = NULL;
+ uint16_t port = 0;
+#endif
+
+ error = m_gdb_comm.StartDebugserverProcess (hostname,
+ port,
debugserver_launch_info,
port);
@@ -2526,9 +2570,9 @@ ProcessGDBRemote::LaunchAndConnectToDebu
}
else
{
- char connect_url[128];
- snprintf (connect_url, sizeof(connect_url), "connect://localhost:%u", port);
- error = ConnectToDebugserver (connect_url);
+ StreamString connect_url;
+ connect_url.Printf("connect://%s:%u", hostname, port);
+ error = ConnectToDebugserver (connect_url.GetString().c_str());
}
}
Modified: lldb/branches/iohandler/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/LanguageRuntime.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/LanguageRuntime.cpp (original)
+++ lldb/branches/iohandler/source/Target/LanguageRuntime.cpp Fri Jan 10 19:16:50 2014
@@ -269,7 +269,8 @@ LanguageRuntime::CreateExceptionBreakpoi
BreakpointResolverSP resolver_sp(new ExceptionBreakpointResolver(language, catch_bp, throw_bp));
SearchFilterSP filter_sp(new ExceptionSearchFilter(target.shared_from_this(), language));
bool hardware = false;
- BreakpointSP exc_breakpt_sp (target.CreateBreakpoint (filter_sp, resolver_sp, is_internal, hardware));
+ bool resolve_indirect_functions = false;
+ BreakpointSP exc_breakpt_sp (target.CreateBreakpoint (filter_sp, resolver_sp, is_internal, hardware, resolve_indirect_functions));
if (is_internal)
exc_breakpt_sp->SetBreakpointKind("exception");
Modified: lldb/branches/iohandler/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/Process.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/Process.cpp (original)
+++ lldb/branches/iohandler/source/Target/Process.cpp Fri Jan 10 19:16:50 2014
@@ -20,6 +20,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
+#include "lldb/Symbol/Symbol.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
@@ -42,6 +43,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanBase.h"
+#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
#ifndef LLDB_DISABLE_POSIX
#include <spawn.h>
@@ -1053,6 +1055,7 @@ Process::Process(Target &target, Listene
m_currently_handling_event(false),
m_finalize_called(false),
m_clear_thread_plans_on_stop (false),
+ m_force_next_event_delivery(false),
m_last_broadcast_state (eStateInvalid),
m_destroy_in_process (false),
m_can_jit(eCanJITDontKnow)
@@ -2160,7 +2163,60 @@ Process::EnableBreakpointSiteByID (lldb:
lldb::break_id_t
Process::CreateBreakpointSite (const BreakpointLocationSP &owner, bool use_hardware)
{
- const addr_t load_addr = owner->GetAddress().GetOpcodeLoadAddress (&m_target);
+ addr_t load_addr = LLDB_INVALID_ADDRESS;
+
+ bool show_error = true;
+ switch (GetState())
+ {
+ case eStateInvalid:
+ case eStateUnloaded:
+ case eStateConnected:
+ case eStateAttaching:
+ case eStateLaunching:
+ case eStateDetached:
+ case eStateExited:
+ show_error = false;
+ break;
+
+ case eStateStopped:
+ case eStateRunning:
+ case eStateStepping:
+ case eStateCrashed:
+ case eStateSuspended:
+ show_error = IsAlive();
+ break;
+ }
+
+ // Reset the IsIndirect flag here, in case the location changes from
+ // pointing to a indirect symbol to a regular symbol.
+ owner->SetIsIndirect (false);
+
+ if (owner->ShouldResolveIndirectFunctions())
+ {
+ Symbol *symbol = owner->GetAddress().CalculateSymbolContextSymbol();
+ if (symbol && symbol->IsIndirect())
+ {
+ Error error;
+ load_addr = ResolveIndirectFunction (&symbol->GetAddress(), error);
+ if (!error.Success() && show_error)
+ {
+ m_target.GetDebugger().GetErrorFile().Printf ("warning: failed to resolve indirect function at 0x%" PRIx64 " for breakpoint %i.%i: %s\n",
+ symbol->GetAddress().GetLoadAddress(&m_target),
+ owner->GetBreakpoint().GetID(),
+ owner->GetID(),
+ error.AsCString() ? error.AsCString() : "unkown error");
+ return LLDB_INVALID_BREAK_ID;
+ }
+ Address resolved_address(load_addr);
+ load_addr = resolved_address.GetOpcodeLoadAddress (&m_target);
+ owner->SetIsIndirect(true);
+ }
+ else
+ load_addr = owner->GetAddress().GetOpcodeLoadAddress (&m_target);
+ }
+ else
+ load_addr = owner->GetAddress().GetOpcodeLoadAddress (&m_target);
+
if (load_addr != LLDB_INVALID_ADDRESS)
{
BreakpointSiteSP bp_site_sp;
@@ -2189,28 +2245,6 @@ Process::CreateBreakpointSite (const Bre
}
else
{
- bool show_error = true;
- switch (GetState())
- {
- case eStateInvalid:
- case eStateUnloaded:
- case eStateConnected:
- case eStateAttaching:
- case eStateLaunching:
- case eStateDetached:
- case eStateExited:
- show_error = false;
- break;
-
- case eStateStopped:
- case eStateRunning:
- case eStateStepping:
- case eStateCrashed:
- case eStateSuspended:
- show_error = IsAlive();
- break;
- }
-
if (show_error)
{
// Report error for setting breakpoint...
@@ -3819,33 +3853,38 @@ Process::ShouldBroadcastEvent (Event *ev
// stopped -> running: Report except when there is one or more no votes
// and no yes votes.
SynchronouslyNotifyStateChanged (state);
- switch (m_last_broadcast_state)
+ if (m_force_next_event_delivery)
+ return_value = true;
+ else
{
- case eStateRunning:
- case eStateStepping:
- // We always suppress multiple runnings with no PUBLIC stop in between.
- return_value = false;
- break;
- default:
- // TODO: make this work correctly. For now always report
- // run if we aren't running so we don't miss any runnning
- // events. If I run the lldb/test/thread/a.out file and
- // break at main.cpp:58, run and hit the breakpoints on
- // multiple threads, then somehow during the stepping over
- // of all breakpoints no run gets reported.
+ switch (m_last_broadcast_state)
+ {
+ case eStateRunning:
+ case eStateStepping:
+ // We always suppress multiple runnings with no PUBLIC stop in between.
+ return_value = false;
+ break;
+ default:
+ // TODO: make this work correctly. For now always report
+ // run if we aren't running so we don't miss any runnning
+ // events. If I run the lldb/test/thread/a.out file and
+ // break at main.cpp:58, run and hit the breakpoints on
+ // multiple threads, then somehow during the stepping over
+ // of all breakpoints no run gets reported.
- // This is a transition from stop to run.
- switch (m_thread_list.ShouldReportRun (event_ptr))
- {
- case eVoteYes:
- case eVoteNoOpinion:
- return_value = true;
- break;
- case eVoteNo:
- return_value = false;
- break;
- }
- break;
+ // This is a transition from stop to run.
+ switch (m_thread_list.ShouldReportRun (event_ptr))
+ {
+ case eVoteYes:
+ case eVoteNoOpinion:
+ return_value = true;
+ break;
+ case eVoteNo:
+ return_value = false;
+ break;
+ }
+ break;
+ }
}
break;
case eStateStopped:
@@ -3918,6 +3957,9 @@ Process::ShouldBroadcastEvent (Event *ev
break;
}
+ // Forcing the next event delivery is a one shot deal. So reset it here.
+ m_force_next_event_delivery = false;
+
// We do some coalescing of events (for instance two consecutive running events get coalesced.)
// But we only coalesce against events we actually broadcast. So we use m_last_broadcast_state
// to track that. NB - you can't use "m_public_state.GetValue()" for that purpose, as was originally done,
@@ -5094,6 +5136,22 @@ Process::RunThreadPlan (ExecutionContext
final_timeout.OffsetWithMicroSeconds(timeout_usec);
}
+ // This isn't going to work if there are unfetched events on the queue.
+ // Are there cases where we might want to run the remaining events here, and then try to
+ // call the function? That's probably being too tricky for our own good.
+
+ Event *other_events = listener.PeekAtNextEvent();
+ if (other_events != NULL)
+ {
+ errors.Printf("Calling RunThreadPlan with pending events on the queue.");
+ return eExecutionSetupError;
+ }
+
+ // We also need to make sure that the next event is delivered. We might be calling a function as part of
+ // a thread plan, in which case the last delivered event could be the running event, and we don't want
+ // event coalescing to cause us to lose OUR running event...
+ ForceNextEventDelivery();
+
// This while loop must exit out the bottom, there's cleanup that we need to do when we are done.
// So don't call return anywhere within it.
@@ -5882,3 +5940,39 @@ Process::DidExec ()
target.DidExec();
}
+addr_t
+Process::ResolveIndirectFunction(const Address *address, Error &error)
+{
+ if (address == nullptr)
+ {
+ Symbol *symbol = address->CalculateSymbolContextSymbol();
+ error.SetErrorStringWithFormat("unable to determine direct function call for indirect function %s",
+ symbol ? symbol->GetName().AsCString() : "<UNKNOWN>");
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ addr_t function_addr = LLDB_INVALID_ADDRESS;
+
+ addr_t addr = address->GetLoadAddress(&GetTarget());
+ std::map<addr_t,addr_t>::const_iterator iter = m_resolved_indirect_addresses.find(addr);
+ if (iter != m_resolved_indirect_addresses.end())
+ {
+ function_addr = (*iter).second;
+ }
+ else
+ {
+ if (!InferiorCall(this, address, function_addr))
+ {
+ Symbol *symbol = address->CalculateSymbolContextSymbol();
+ error.SetErrorStringWithFormat ("Unable to call resolver for indirect function %s",
+ symbol ? symbol->GetName().AsCString() : "<UNKNOWN>");
+ function_addr = LLDB_INVALID_ADDRESS;
+ }
+ else
+ {
+ m_resolved_indirect_addresses.insert(std::pair<addr_t, addr_t>(addr, function_addr));
+ }
+ }
+ return function_addr;
+}
+
Modified: lldb/branches/iohandler/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/Target.cpp?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/Target.cpp (original)
+++ lldb/branches/iohandler/source/Target/Target.cpp Fri Jan 10 19:16:50 2014
@@ -251,7 +251,7 @@ Target::CreateSourceRegexBreakpoint (con
{
SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, source_file_spec_list));
BreakpointResolverSP resolver_sp(new BreakpointResolverFileRegex (NULL, source_regex));
- return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
@@ -305,7 +305,7 @@ Target::CreateBreakpoint (const FileSpec
line_no,
check_inlines,
skip_prologue));
- return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
@@ -332,7 +332,7 @@ Target::CreateBreakpoint (Address &addr,
{
SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr));
- return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, false);
}
BreakpointSP
@@ -357,7 +357,7 @@ Target::CreateBreakpoint (const FileSpec
func_name_type_mask,
Breakpoint::Exact,
skip_prologue));
- bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
return bp_sp;
}
@@ -384,7 +384,7 @@ Target::CreateBreakpoint (const FileSpec
func_names,
func_name_type_mask,
skip_prologue));
- bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
return bp_sp;
}
@@ -412,7 +412,7 @@ Target::CreateBreakpoint (const FileSpec
num_names,
func_name_type_mask,
skip_prologue));
- bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
return bp_sp;
}
@@ -490,7 +490,7 @@ Target::CreateFuncRegexBreakpoint (const
func_regex,
skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
- return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware);
+ return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
lldb::BreakpointSP
@@ -500,12 +500,12 @@ Target::CreateExceptionBreakpoint (enum
}
BreakpointSP
-Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp, bool internal, bool request_hardware)
+Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp, bool internal, bool request_hardware, bool resolve_indirect_symbols)
{
BreakpointSP bp_sp;
if (filter_sp && resolver_sp)
{
- bp_sp.reset(new Breakpoint (*this, filter_sp, resolver_sp, request_hardware));
+ bp_sp.reset(new Breakpoint (*this, filter_sp, resolver_sp, request_hardware, resolve_indirect_symbols));
resolver_sp->SetBreakpoint (bp_sp.get());
if (internal)
Modified: lldb/branches/iohandler/test/crashinfo.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/crashinfo.c?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/test/crashinfo.c (original)
+++ lldb/branches/iohandler/test/crashinfo.c Fri Jan 10 19:16:50 2014
@@ -35,7 +35,7 @@ static PyObject* setCrashReporterDescrip
char* data = PyString_AsString(string);
if (size > 0 && data)
{
- ++size; // Include the NULL terminateor in allocation and memcpy()
+ ++size; // Include the NULL terminateor in allocation and memcpy()
__crashreporter_info__ = malloc(size);
memcpy(__crashreporter_info__, data, size);
return Py_True;
Modified: lldb/branches/iohandler/test/lang/objc/foundation/TestObjCMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/lang/objc/foundation/TestObjCMethods.py?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/test/lang/objc/foundation/TestObjCMethods.py (original)
+++ lldb/branches/iohandler/test/lang/objc/foundation/TestObjCMethods.py Fri Jan 10 19:16:50 2014
@@ -6,6 +6,7 @@ Also lookup objective-c data types and e
import os, time
import unittest2
import lldb
+import string
from lldbtest import *
import lldbutil
@@ -111,6 +112,53 @@ class FoundationTestCase(TestBase):
self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]",
substrs = ["Foundation`-[NSAutoreleasePool release]"])
+ @dsym_test
+ @expectedFailureDarwin(15797390)
+ def test_expression_lookups_objc_dsym(self):
+ """Test running an expression detect spurious debug info lookups (dSYM)."""
+ self.buildDsym()
+ self.expression_lookups_objc()
+
+ @dwarf_test
+ @expectedFailureDarwin(15797390)
+ def test_expression_lookups_objc_dwarf(self):
+ """Test running an expression detect spurious debug info lookups (DWARF)."""
+ self.buildDwarf()
+ self.expression_lookups_objc()
+
+ def expression_lookups_objc (self):
+ """Test running an expression and make sure we don't search all dwarf files for any internal names (anything that contains '__lldb')."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Stop at -[MyString initWithNSString:].
+ lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # Log any DWARF lookups
+ logfile = os.path.join(os.getcwd(), "dwarf-lookups.txt")
+ self.runCmd("log enable -f %s dwarf lookups" % (logfile))
+ self.runCmd("expr self")
+ self.runCmd("log disable dwarf lookups")
+
+ def cleanup():
+ sys.unlink (logfile)
+
+ self.addTearDownHook(cleanup)
+
+ f = open(logfile)
+ lines = f.readlines()
+ num_errors = 0
+ for line in lines:
+ if string.find(line, "$__lldb") != -1:
+ if num_errors == 0:
+ print "error: found spurious name lookups when evaluating an expression:"
+ num_errors += 1
+ print line,
+ self.assertTrue(num_errors == 0, "Spurious lookups detected")
+ f.close()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
Modified: lldb/branches/iohandler/tools/debugserver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/debugserver/CMakeLists.txt?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/debugserver/CMakeLists.txt (original)
+++ lldb/branches/iohandler/tools/debugserver/CMakeLists.txt Fri Jan 10 19:16:50 2014
@@ -1,3 +1,3 @@
-project(C CXX ASM)
+project(C CXX ASM-ATT)
add_subdirectory(scripts)
add_subdirectory(source)
Modified: lldb/branches/iohandler/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/branches/iohandler/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jan 10 19:16:50 2014
@@ -473,7 +473,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -501,7 +501,7 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEAD_CODE_STRIPPING = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -534,7 +534,7 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEAD_CODE_STRIPPING = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -555,7 +555,7 @@
CLANG_CXX_LIBRARY = "libc++";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -608,7 +608,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -660,7 +660,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -722,7 +722,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -744,7 +744,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 310.99.0;
+ CURRENT_PROJECT_VERSION = 320.99.0;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
Modified: lldb/branches/iohandler/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/www/lldb-gdb.html?rev=198989&r1=198988&r2=198989&view=diff
==============================================================================
--- lldb/branches/iohandler/www/lldb-gdb.html (original)
+++ lldb/branches/iohandler/www/lldb-gdb.html Fri Jan 10 19:16:50 2014
@@ -126,6 +126,16 @@
</td>
</tr>
+ <tr><td class="header" colspan="2">Unset environment variables for process before launching.</td></tr>
+ <td class="content">
+ <b>(gdb)</b> unset env DEBUG<br>
+ </td>
+ <td class="content">
+ <b>(lldb)</b> settings remove target.env-vars DEBUG<br>
+ <b>(lldb)</b> set rem target.env-vars DEBUG<br>
+ </td>
+ </tr>
+
<tr><td class="header" colspan="2">Show the arguments that will be or were passed to the program when run.</td></tr>
<td class="content">
<b>(gdb)</b> show args<br>
More information about the llvm-branch-commits
mailing list