[Lldb-commits] [lldb] r159418 - in /lldb/branches/apple/python-GIL: ./ examples/darwin/heap_find/ examples/darwin/heap_find/heap/ examples/python/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Target/ lldb.xcodeproj/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolVendor/MacOSX/ source/Target/ test/functionalities/data-formatter/data-formatter-objc/ tools/debugserver/source/MacOSX/arm/
Filipe Cabecinhas
me at filcab.net
Fri Jun 29 02:55:43 PDT 2012
Author: filcab
Date: Fri Jun 29 04:55:43 2012
New Revision: 159418
URL: http://llvm.org/viewvc/llvm-project?rev=159418&view=rev
Log:
Merge changes from ToT trunk.
Modified:
lldb/branches/apple/python-GIL/ (props changed)
lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap.py
lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap/heap_find.cpp
lldb/branches/apple/python-GIL/examples/python/crashlog.py
lldb/branches/apple/python-GIL/examples/python/symbolication.py
lldb/branches/apple/python-GIL/include/lldb/API/SBCommandReturnObject.h
lldb/branches/apple/python-GIL/include/lldb/API/SBSection.h
lldb/branches/apple/python-GIL/include/lldb/API/SBTarget.h
lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Breakpoint.h
lldb/branches/apple/python-GIL/include/lldb/Breakpoint/BreakpointLocation.h
lldb/branches/apple/python-GIL/include/lldb/Breakpoint/StoppointLocation.h
lldb/branches/apple/python-GIL/include/lldb/Target/PathMappingList.h
lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj
lldb/branches/apple/python-GIL/scripts/Python/interface/SBBlock.i
lldb/branches/apple/python-GIL/scripts/Python/interface/SBCommandReturnObject.i
lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i
lldb/branches/apple/python-GIL/scripts/Python/interface/SBSection.i
lldb/branches/apple/python-GIL/source/API/SBCommandReturnObject.cpp
lldb/branches/apple/python-GIL/source/API/SBLineEntry.cpp
lldb/branches/apple/python-GIL/source/API/SBSection.cpp
lldb/branches/apple/python-GIL/source/Breakpoint/Breakpoint.cpp
lldb/branches/apple/python-GIL/source/Breakpoint/BreakpointLocation.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectCommands.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp
lldb/branches/apple/python-GIL/source/Core/FormatManager.cpp
lldb/branches/apple/python-GIL/source/Core/ModuleList.cpp
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/apple/python-GIL/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/branches/apple/python-GIL/source/Target/PathMappingList.cpp
lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/main.m
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
Propchange: lldb/branches/apple/python-GIL/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 29 04:55:43 2012
@@ -1 +1 @@
-/lldb/trunk:156467-159180
+/lldb/trunk:156467-159389
Modified: lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap.py?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap.py (original)
+++ lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap.py Fri Jun 29 04:55:43 2012
@@ -44,8 +44,9 @@
# Remake the dylib
make_command = '(cd "%s" ; make EXE="%s" ARCH=%s)' % (heap_code_directory, libheap_dylib_path, string.split(triple, '-')[0])
# print make_command
- make_output = commands.getoutput(make_command)
- # print make_output
+ (make_exit_status, make_output) = commands.getstatusoutput(make_command)
+ if make_exit_status != 0:
+ print make_output
if os.path.exists(libheap_dylib_path):
libheap_dylib_spec = lldb.SBFileSpec(libheap_dylib_path)
if lldb.target.FindModule(libheap_dylib_spec):
Modified: lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap/heap_find.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap/heap_find.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap/heap_find.cpp (original)
+++ lldb/branches/apple/python-GIL/examples/darwin/heap_find/heap/heap_find.cpp Fri Jun 29 04:55:43 2012
@@ -68,14 +68,80 @@
#include <ctype.h>
#include <mach/mach.h>
#include <malloc/malloc.h>
-extern "C" {
-#include <stack_logging.h>
-}
#include <stdio.h>
#include <stdlib.h>
#include <vector>
+//----------------------------------------------------------------------
+// Redefine private types from "/usr/local/include/stack_logging.h"
+//----------------------------------------------------------------------
+typedef struct {
+ uint32_t type_flags;
+ uint64_t stack_identifier;
+ uint64_t argument;
+ mach_vm_address_t address;
+} mach_stack_logging_record_t;
+
+//----------------------------------------------------------------------
+// Redefine private defines from "/usr/local/include/stack_logging.h"
+//----------------------------------------------------------------------
+#define stack_logging_type_free 0
+#define stack_logging_type_generic 1
+#define stack_logging_type_alloc 2
+#define stack_logging_type_dealloc 4
+
+//----------------------------------------------------------------------
+// Redefine private function prototypes from
+// "/usr/local/include/stack_logging.h"
+//----------------------------------------------------------------------
+extern "C" kern_return_t
+__mach_stack_logging_set_file_path (
+ task_t task,
+ char* file_path
+);
+
+extern "C" kern_return_t
+__mach_stack_logging_get_frames (
+ task_t task,
+ mach_vm_address_t address,
+ mach_vm_address_t *stack_frames_buffer,
+ uint32_t max_stack_frames,
+ uint32_t *count
+);
+
+extern "C" kern_return_t
+__mach_stack_logging_enumerate_records (
+ task_t task,
+ mach_vm_address_t address,
+ void enumerator(mach_stack_logging_record_t, void *),
+ void *context
+);
+
+extern "C" kern_return_t
+__mach_stack_logging_frames_for_uniqued_stack (
+ task_t task,
+ uint64_t stack_identifier,
+ mach_vm_address_t *stack_frames_buffer,
+ uint32_t max_stack_frames,
+ uint32_t *count
+);
+
+//----------------------------------------------------------------------
+// Redefine private gloval variables prototypes from
+// "/usr/local/include/stack_logging.h"
+//----------------------------------------------------------------------
+
+extern "C" int stack_logging_enable_logging;
+extern "C" int stack_logging_dontcompact;
+
+//----------------------------------------------------------------------
+// Local defines
+//----------------------------------------------------------------------
#define MAX_FRAMES 1024
+
+//----------------------------------------------------------------------
+// Local Typedefs and Types
+//----------------------------------------------------------------------
typedef void range_callback_t (task_t task, void *baton, unsigned type, uint64_t ptr_addr, uint64_t ptr_size);
typedef void zone_callback_t (void *info, const malloc_zone_t *zone);
@@ -127,7 +193,9 @@
std::vector<uintptr_t> frames;
};
-
+//----------------------------------------------------------------------
+// Local global variables
+//----------------------------------------------------------------------
std::vector<malloc_match> g_matches;
const void *g_lookup_addr = 0;
std::vector<malloc_stack_entry> g_malloc_stack_history;
Modified: lldb/branches/apple/python-GIL/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/examples/python/crashlog.py?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/examples/python/crashlog.py (original)
+++ lldb/branches/apple/python-GIL/examples/python/crashlog.py Fri Jun 29 04:55:43 2012
@@ -29,9 +29,11 @@
import lldb
import commands
import cmd
+import datetime
import glob
import optparse
import os
+import platform
import plistlib
import pprint # pp = pprint.PrettyPrinter(indent=4); pp.pprint(command_args)
import re
@@ -467,7 +469,7 @@
if crash_log.error:
print crash_log.error
continue
- if options.verbose:
+ if options.debug:
crash_log.dump()
if not crash_log.images:
print 'error: no images in crash log "%s"' % (crash_log)
@@ -480,7 +482,84 @@
interpreter.do_list()
interpreter.cmdloop()
+
+def save_crashlog(debugger, command, result, dict):
+ usage = "usage: %prog [options] <output-path>"
+ description='''Export the state of current target into a crashlog file'''
+ parser = optparse.OptionParser(description=description, prog='save_crashlog',usage=usage)
+ parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ try:
+ (options, args) = parser.parse_args(shlex.split(command))
+ except:
+ result.PutCString ("error: invalid options");
+ return
+ if len(args) != 1:
+ result.PutCString ("error: invalid arguments, a single output file is the only valid argument")
+ return
+ out_file = open(args[0], 'w')
+ if not out_file:
+ result.PutCString ("error: failed to open file '%s' for writing...", args[0]);
+ return
+ if lldb.target:
+ identifier = lldb.target.executable.basename
+ if lldb.process:
+ pid = lldb.process.id
+ if pid != lldb.LLDB_INVALID_PROCESS_ID:
+ out_file.write('Process: %s [%u]\n' % (identifier, pid))
+ out_file.write('Path: %s\n' % (lldb.target.executable.fullpath))
+ out_file.write('Identifier: %s\n' % (identifier))
+ out_file.write('\nDate/Time: %s\n' % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
+ out_file.write('OS Version: Mac OS X %s (%s)\n' % (platform.mac_ver()[0], commands.getoutput('sysctl -n kern.osversion')));
+ out_file.write('Report Version: 9\n')
+ for thread_idx in range(lldb.process.num_threads):
+ thread = lldb.process.thread[thread_idx]
+ out_file.write('\nThread %u:\n' % (thread_idx))
+ for (frame_idx, frame) in enumerate(thread.frames):
+ frame_pc = frame.pc
+ frame_offset = 0
+ if frame.function:
+ block = frame.GetFrameBlock()
+ block_range = block.range[frame.addr]
+ if block_range:
+ block_start_addr = block_range[0]
+ frame_offset = frame_pc - block_start_addr.load_addr
+ else:
+ frame_offset = frame_pc - frame.function.addr.load_addr
+ elif frame.symbol:
+ frame_offset = frame_pc - frame.symbol.addr.load_addr
+ out_file.write('%-3u %-32s 0x%16.16x %s' % (frame_idx, frame.module.file.basename, frame_pc, frame.name))
+ if frame_offset > 0:
+ out_file.write(' + %u' % (frame_offset))
+ line_entry = frame.line_entry
+ if line_entry:
+ if options.verbose:
+ # This will output the fullpath + line + column
+ out_file.write(' %s' % (line_entry))
+ else:
+ out_file.write(' %s:%u' % (line_entry.file.basename, line_entry.line))
+ column = line_entry.column
+ if column:
+ out_file.write(':%u' % (column))
+ out_file.write('\n')
+
+ out_file.write('\nBinary Images:\n')
+ for module in lldb.target.modules:
+ text_segment = module.section['__TEXT']
+ if text_segment:
+ text_segment_load_addr = text_segment.GetLoadAddress(lldb.target)
+ if text_segment_load_addr != lldb.LLDB_INVALID_ADDRESS:
+ text_segment_end_load_addr = text_segment_load_addr + text_segment.size
+ identifier = module.file.basename
+ module_version = '???'
+ module_version_array = module.GetVersion()
+ if module_version_array:
+ module_version = '.'.join(map(str,module_version_array))
+ out_file.write (' 0x%16.16x - 0x%16.16x %s (%s - ???) <%s> %s\n' % (text_segment_load_addr, text_segment_end_load_addr, identifier, module_version, module.GetUUIDString(), module.file.fullpath))
+ out_file.close()
+ else:
+ result.PutCString ("error: invalid target");
+
def Symbolicate(debugger, command, result, dict):
try:
SymbolicateCrashLogs (shlex.split(command))
@@ -491,7 +570,7 @@
if crash_log.error:
print crash_log.error
return
- if options.verbose:
+ if options.debug:
crash_log.dump()
if not crash_log.images:
print 'error: no images in crash log'
@@ -537,10 +616,10 @@
for frame_idx, frame in enumerate(thread.frames):
disassemble = (this_thread_crashed or options.disassemble_all_threads) and frame_idx < options.disassemble_depth;
if frame_idx == 0:
- symbolicated_frame_addresses = crash_log.symbolicate (frame.pc)
+ symbolicated_frame_addresses = crash_log.symbolicate (frame.pc, options.verbose)
else:
# Any frame above frame zero and we have to subtract one to get the previous line entry
- symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1)
+ symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1, options.verbose)
if symbolicated_frame_addresses:
symbolicated_frame_address_idx = 0
@@ -572,9 +651,10 @@
usage = "usage: %prog [options] <FILE> [FILE ...]"
option_parser = optparse.OptionParser(description=description, prog='crashlog',usage=usage)
option_parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ option_parser.add_option('-g', '--debug', action='store_true', dest='debug', help='display verbose debug logging', default=False)
option_parser.add_option('-a', '--load-all', action='store_true', dest='load_all_images', help='load all executable images, not just the images found in the crashed stack frames', default=False)
option_parser.add_option('--images', action='store_true', dest='dump_image_list', help='show image list', default=False)
- option_parser.add_option('-g', '--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
+ option_parser.add_option('--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
option_parser.add_option('-c', '--crashed-only', action='store_true', dest='crashed_only', help='only symbolicate the crashed thread', default=False)
option_parser.add_option('-d', '--disasm-depth', type='int', dest='disassemble_depth', help='set the depth in stack frames that should be disassembled (default is 1)', default=1)
option_parser.add_option('-D', '--disasm-all', action='store_true', dest='disassemble_all_threads', help='enabled disassembly of frames on all threads (not just the crashed thread)', default=False)
@@ -599,7 +679,7 @@
except:
return
- if options.verbose:
+ if options.debug:
print 'command_args = %s' % command_args
print 'options', options
print 'args', args
@@ -623,5 +703,6 @@
SymbolicateCrashLogs (sys.argv[1:])
elif getattr(lldb, 'debugger', None):
lldb.debugger.HandleCommand('command script add -f lldb.macosx.crashlog.Symbolicate crashlog')
- print '"crashlog" command installed, type "crashlog --help" for detailed help'
+ lldb.debugger.HandleCommand('command script add -f lldb.macosx.crashlog.save_crashlog save_crashlog')
+ print '"crashlog" and "save_crashlog" command installed, use the "--help" option for detailed help'
Modified: lldb/branches/apple/python-GIL/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/examples/python/symbolication.py?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/examples/python/symbolication.py (original)
+++ lldb/branches/apple/python-GIL/examples/python/symbolication.py Fri Jun 29 04:55:43 2012
@@ -83,7 +83,7 @@
return sym_ctx.GetSymbol().GetInstructions(self.target)
return None
- def symbolicate(self):
+ def symbolicate(self, verbose = False):
if self.symbolication == None:
self.symbolication = ''
self.inlined = False
@@ -91,7 +91,11 @@
if sym_ctx:
module = sym_ctx.GetModule()
if module:
- self.symbolication += module.GetFileSpec().GetFilename() + '`'
+ # Print full source file path in verbose mode
+ if verbose:
+ self.symbolication += str(module.GetFileSpec()) + '`'
+ else:
+ self.symbolication += module.GetFileSpec().GetFilename() + '`'
function_start_load_addr = -1
function = sym_ctx.GetFunction()
block = sym_ctx.GetBlock()
@@ -126,11 +130,15 @@
# Print out any line information if any is available
if line_entry.GetFileSpec():
+ # Print full source file path in verbose mode
+ if verbose:
+ self.symbolication += ' at %s' % line_entry.GetFileSpec()
+ else:
self.symbolication += ' at %s' % line_entry.GetFileSpec().GetFilename()
- self.symbolication += ':%u' % line_entry.GetLine ()
- column = line_entry.GetColumn()
- if column > 0:
- self.symbolication += ':%u' % column
+ self.symbolication += ':%u' % line_entry.GetLine ()
+ column = line_entry.GetColumn()
+ if column > 0:
+ self.symbolication += ':%u' % column
return True
return False
@@ -393,7 +401,7 @@
return self.target
return None
- def symbolicate(self, load_addr):
+ def symbolicate(self, load_addr, verbose = False):
if not self.target:
self.create_target()
if self.target:
@@ -401,7 +409,7 @@
if image:
image.add_module (self.target)
symbolicated_address = Address(self.target, load_addr)
- if symbolicated_address.symbolicate ():
+ if symbolicated_address.symbolicate (verbose):
if symbolicated_address.so_addr:
symbolicated_addresses = list()
@@ -418,7 +426,7 @@
symbolicated_address = Address(self.target, inlined_parent_so_addr.GetLoadAddress(self.target))
symbolicated_address.sym_ctx = inlined_parent_sym_ctx
symbolicated_address.so_addr = inlined_parent_so_addr
- symbolicated_address.symbolicate ()
+ symbolicated_address.symbolicate (verbose)
# push the new frame onto the new frame stack
symbolicated_addresses.append (symbolicated_address)
@@ -532,7 +540,7 @@
if target:
for addr_str in args:
addr = int(addr_str, 0)
- symbolicated_addrs = symbolicator.symbolicate(addr)
+ symbolicated_addrs = symbolicator.symbolicate(addr, options.verbose)
for symbolicated_addr in symbolicated_addrs:
print symbolicated_addr
print
Modified: lldb/branches/apple/python-GIL/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/API/SBCommandReturnObject.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/API/SBCommandReturnObject.h Fri Jun 29 04:55:43 2012
@@ -61,6 +61,9 @@
lldb::ReturnStatus
GetStatus();
+
+ void
+ SetStatus (lldb::ReturnStatus status);
bool
Succeeded ();
Modified: lldb/branches/apple/python-GIL/include/lldb/API/SBSection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/API/SBSection.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/API/SBSection.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/API/SBSection.h Fri Jun 29 04:55:43 2012
@@ -47,6 +47,9 @@
GetFileAddress ();
lldb::addr_t
+ GetLoadAddress (lldb::SBTarget &target);
+
+ lldb::addr_t
GetByteSize ();
uint64_t
Modified: lldb/branches/apple/python-GIL/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/API/SBTarget.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/API/SBTarget.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/API/SBTarget.h Fri Jun 29 04:55:43 2012
@@ -741,6 +741,7 @@
friend class SBInstruction;
friend class SBModule;
friend class SBProcess;
+ friend class SBSection;
friend class SBSourceManager;
friend class SBSymbol;
friend class SBValue;
Modified: lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Breakpoint.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Breakpoint.h Fri Jun 29 04:55:43 2012
@@ -345,7 +345,7 @@
//------------------------------------------------------------------
uint32_t
GetIgnoreCount () const;
-
+
//------------------------------------------------------------------
/// Return the current hit count for all locations.
/// @return
@@ -551,6 +551,18 @@
//------------------------------------------------------------------
// This is the generic constructor
Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp, lldb::BreakpointResolverSP &resolver_sp);
+
+ friend class BreakpointLocation; // To call the following two when determining whether to stop.
+
+ void
+ DecrementIgnoreCount();
+
+ // BreakpointLocation::IgnoreCountShouldStop & Breakpoint::IgnoreCountShouldStop can only be called once per stop,
+ // and BreakpointLocation::IgnoreCountShouldStop should be tested first, and if it returns false we should
+ // continue, otherwise we should test Breakpoint::IgnoreCountShouldStop.
+
+ bool
+ IgnoreCountShouldStop ();
private:
//------------------------------------------------------------------
Modified: lldb/branches/apple/python-GIL/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Breakpoint/BreakpointLocation.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Breakpoint/BreakpointLocation.h Fri Jun 29 04:55:43 2012
@@ -336,6 +336,12 @@
bool
SetBreakpointSite (lldb::BreakpointSiteSP& bp_site_sp);
+ void
+ DecrementIgnoreCount();
+
+ bool
+ IgnoreCountShouldStop();
+
private:
//------------------------------------------------------------------
Modified: lldb/branches/apple/python-GIL/include/lldb/Breakpoint/StoppointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Breakpoint/StoppointLocation.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Breakpoint/StoppointLocation.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Breakpoint/StoppointLocation.h Fri Jun 29 04:55:43 2012
@@ -69,12 +69,6 @@
return m_hit_count;
}
- void
- IncrementHitCount ()
- {
- ++m_hit_count;
- }
-
uint32_t
GetHardwareIndex () const
{
@@ -133,6 +127,13 @@
// hardware breakpoints, or the length of the watchpoint.
uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit
+ // If you override this, be sure to call the base class to increment the internal counter.
+ void
+ IncrementHitCount ()
+ {
+ ++m_hit_count;
+ }
+
private:
//------------------------------------------------------------------
// For StoppointLocation only
Modified: lldb/branches/apple/python-GIL/include/lldb/Target/PathMappingList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Target/PathMappingList.h?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Target/PathMappingList.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Target/PathMappingList.h Fri Jun 29 04:55:43 2012
@@ -57,6 +57,12 @@
void
Dump (Stream *s, int pair_index=-1);
+ bool
+ IsEmpty() const
+ {
+ return m_pairs.empty();
+ }
+
size_t
GetSize () const
{
Modified: lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj Fri Jun 29 04:55:43 2012
@@ -401,6 +401,7 @@
26C72C961243229A0068DC16 /* SBStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C72C951243229A0068DC16 /* SBStream.cpp */; };
26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; };
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */ = {isa = PBXBuildFile; fileRef = 26651A14133BEC76005B64B7 /* lldb-public.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 26D55235159A7DB100708D8D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D55234159A7DB100708D8D /* libxml2.dylib */; };
26D5E15F135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */; };
26D5E163135BB054006EA0A7 /* OptionGroupPlatform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E162135BB054006EA0A7 /* OptionGroupPlatform.cpp */; };
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D7E45C13D5E30A007FD12B /* SocketAddress.cpp */; };
@@ -1207,6 +1208,7 @@
26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = "<group>"; };
26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFHeader.cpp; sourceTree = "<group>"; };
26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFHeader.h; sourceTree = "<group>"; };
+ 26D55234159A7DB100708D8D /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupArchitecture.cpp; path = source/Interpreter/OptionGroupArchitecture.cpp; sourceTree = "<group>"; };
26D5E160135BAEB0006EA0A7 /* OptionGroupArchitecture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupArchitecture.h; path = include/lldb/Interpreter/OptionGroupArchitecture.h; sourceTree = "<group>"; };
26D5E161135BB040006EA0A7 /* OptionGroupPlatform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupPlatform.h; path = include/lldb/Interpreter/OptionGroupPlatform.h; sourceTree = "<group>"; };
@@ -1564,6 +1566,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 26D55235159A7DB100708D8D /* libxml2.dylib in Frameworks */,
268901161335BBC300698AC0 /* liblldb-core.a in Frameworks */,
2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */,
26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */,
@@ -1620,16 +1623,11 @@
08FB7794FE84155DC02AAC07 /* lldb */ = {
isa = PBXGroup;
children = (
- AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */,
- AFF87C8C150FF680000E1742 /* com.apple.debugserver.applist.plist */,
- AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist */,
- AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */,
- AFF87C86150FF669000E1742 /* com.apple.debugserver.plist */,
26F5C32810F3DF7D009D5894 /* Libraries */,
+ 264E8576159BE51A00E9D7A2 /* Resources */,
08FB7795FE84155DC02AAC07 /* Source */,
26F5C22410F3D950009D5894 /* Tools */,
1AB674ADFE9D54B511CA2CBB /* Products */,
- 2689FFCA13353D7A00698AC0 /* liblldb-core.a */,
);
name = lldb;
sourceTree = "<group>";
@@ -2089,6 +2087,18 @@
name = "GDB Server";
sourceTree = "<group>";
};
+ 264E8576159BE51A00E9D7A2 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */,
+ AFF87C8C150FF680000E1742 /* com.apple.debugserver.applist.plist */,
+ AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist */,
+ AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */,
+ AFF87C86150FF669000E1742 /* com.apple.debugserver.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
26579F55126A255E0007C5CB /* darwin-debug */ = {
isa = PBXGroup;
children = (
@@ -2991,9 +3001,11 @@
265ABF6210F42EE900531910 /* DebugSymbols.framework */,
260C876910F538E700BB2B04 /* Foundation.framework */,
26F5C32A10F3DFDD009D5894 /* libedit.dylib */,
+ 2689FFCA13353D7A00698AC0 /* liblldb-core.a */,
26F5C37410F3F61B009D5894 /* libobjc.dylib */,
26F5C32410F3DF23009D5894 /* libpython.dylib */,
26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */,
+ 26D55234159A7DB100708D8D /* libxml2.dylib */,
4C74CB6212288704006A8171 /* Carbon.framework */,
EDB919B414F6F10D008FF64B /* Security.framework */,
);
@@ -4367,6 +4379,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
@@ -4396,6 +4409,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
@@ -4425,6 +4439,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBBlock.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBBlock.i?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBBlock.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBBlock.i Fri Jun 29 04:55:43 2012
@@ -123,6 +123,10 @@
count = len(self)
if type(key) is int:
return self.sbblock.get_range_at_index (key);
+ if isinstance(key, SBAddress):
+ range_idx = self.sbblock.GetRangeIndexForBlockAddress(key);
+ if range_idx < len(self):
+ return [self.sbblock.GetRangeStartAddress(range_idx), self.sbblock.GetRangeEndAddress(range_idx)]
else:
print "error: unsupported item type: %s" % type(key)
return None
Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBCommandReturnObject.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBCommandReturnObject.i?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBCommandReturnObject.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBCommandReturnObject.i Fri Jun 29 04:55:43 2012
@@ -50,6 +50,9 @@
void
Clear();
+ void
+ SetStatus (lldb::ReturnStatus status);
+
lldb::ReturnStatus
GetStatus();
Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i Fri Jun 29 04:55:43 2012
@@ -341,7 +341,7 @@
'''An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.'''
threads = []
for idx in range(self.GetNumThreads()):
- threads.append(GetThreadAtIndex(idx))
+ threads.append(self.threads_access(idx))
return threads
__swig_getmethods__["threads"] = get_process_thread_list
Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBSection.i?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBSection.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBSection.i Fri Jun 29 04:55:43 2012
@@ -66,6 +66,9 @@
GetFileAddress ();
lldb::addr_t
+ GetLoadAddress (lldb::SBTarget &target);
+
+ lldb::addr_t
GetByteSize ();
uint64_t
Modified: lldb/branches/apple/python-GIL/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/API/SBCommandReturnObject.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/branches/apple/python-GIL/source/API/SBCommandReturnObject.cpp Fri Jun 29 04:55:43 2012
@@ -160,6 +160,13 @@
return lldb::eReturnStatusInvalid;
}
+void
+SBCommandReturnObject::SetStatus(lldb::ReturnStatus status)
+{
+ if (m_opaque_ap.get())
+ m_opaque_ap->SetStatus(status);
+}
+
bool
SBCommandReturnObject::Succeeded ()
{
Modified: lldb/branches/apple/python-GIL/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/API/SBLineEntry.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/API/SBLineEntry.cpp (original)
+++ lldb/branches/apple/python-GIL/source/API/SBLineEntry.cpp Fri Jun 29 04:55:43 2012
@@ -110,7 +110,7 @@
bool
SBLineEntry::IsValid () const
{
- return m_opaque_ap.get() != NULL;
+ return m_opaque_ap.get() && m_opaque_ap->IsValid();
}
Modified: lldb/branches/apple/python-GIL/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/API/SBSection.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/API/SBSection.cpp (original)
+++ lldb/branches/apple/python-GIL/source/API/SBSection.cpp Fri Jun 29 04:55:43 2012
@@ -9,6 +9,7 @@
#include "lldb/API/SBSection.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBTarget.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
@@ -126,6 +127,22 @@
}
lldb::addr_t
+SBSection::GetLoadAddress (lldb::SBTarget &sb_target)
+{
+ TargetSP target_sp(sb_target.GetSP());
+ if (target_sp)
+ {
+ SectionSP section_sp (GetSP());
+ if (section_sp)
+ return section_sp->GetLoadBaseAddress(target_sp.get());
+ }
+ return LLDB_INVALID_ADDRESS;
+
+}
+
+
+
+lldb::addr_t
SBSection::GetByteSize ()
{
SectionSP section_sp (GetSP());
Modified: lldb/branches/apple/python-GIL/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Breakpoint/Breakpoint.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Breakpoint/Breakpoint.cpp Fri Jun 29 04:55:43 2012
@@ -152,12 +152,36 @@
SendBreakpointChangedEvent (eBreakpointEventTypeIgnoreChanged);
}
+void
+Breakpoint::DecrementIgnoreCount ()
+{
+ uint32_t ignore = m_options.GetIgnoreCount();
+ if (ignore != 0)
+ m_options.SetIgnoreCount(ignore - 1);
+}
+
uint32_t
Breakpoint::GetIgnoreCount () const
{
return m_options.GetIgnoreCount();
}
+bool
+Breakpoint::IgnoreCountShouldStop ()
+{
+ uint32_t ignore = GetIgnoreCount();
+ if (ignore != 0)
+ {
+ // When we get here we know the location that caused the stop doesn't have an ignore count,
+ // since by contract we call it first... So we don't have to find & decrement it, we only have
+ // to decrement our own ignore count.
+ DecrementIgnoreCount();
+ return false;
+ }
+ else
+ return true;
+}
+
uint32_t
Breakpoint::GetHitCount () const
{
Modified: lldb/branches/apple/python-GIL/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Breakpoint/BreakpointLocation.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Breakpoint/BreakpointLocation.cpp Fri Jun 29 04:55:43 2012
@@ -254,6 +254,34 @@
SendBreakpointLocationChangedEvent (eBreakpointEventTypeIgnoreChanged);
}
+void
+BreakpointLocation::DecrementIgnoreCount()
+{
+ if (m_options_ap.get() != NULL)
+ {
+ uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
+ if (loc_ignore != 0)
+ m_options_ap->SetIgnoreCount(loc_ignore - 1);
+ }
+}
+
+bool
+BreakpointLocation::IgnoreCountShouldStop()
+{
+ if (m_options_ap.get() != NULL)
+ {
+ uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
+ if (loc_ignore != 0)
+ {
+ m_owner.DecrementIgnoreCount();
+ DecrementIgnoreCount(); // Have to decrement our owners' ignore count, since it won't get a
+ // chance to.
+ return false;
+ }
+ }
+ return true;
+}
+
const BreakpointOptions *
BreakpointLocation::GetOptionsNoCreate () const
{
@@ -297,7 +325,10 @@
if (!IsEnabled())
return false;
- if (GetHitCount() <= GetIgnoreCount())
+ if (!IgnoreCountShouldStop())
+ return false;
+
+ if (!m_owner.IgnoreCountShouldStop())
return false;
// We only run synchronous callbacks in ShouldStop:
Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectCommands.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectCommands.cpp Fri Jun 29 04:55:43 2012
@@ -1214,6 +1214,8 @@
Error error;
+ result.SetStatus(eReturnStatusInvalid);
+
if (!scripter || scripter->RunScriptBasedCommand(m_function_name.c_str(),
raw_command_line,
m_synchro,
@@ -1224,7 +1226,16 @@
result.SetStatus(eReturnStatusFailed);
}
else
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ {
+ // Don't change the status if the command already set it...
+ if (result.GetStatus() == eReturnStatusInvalid)
+ {
+ if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ else
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ }
+ }
return result.Succeeded();
}
Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp Fri Jun 29 04:55:43 2012
@@ -2865,6 +2865,10 @@
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
const bool use_global_module_list = m_options.m_use_global_module_list;
+ // Define a local module list here to ensure it lives longer than any "locker"
+ // object which might lock its contents below (through the "module_list_ptr"
+ // variable).
+ ModuleList module_list;
if (target == NULL && use_global_module_list == false)
{
result.AppendError ("invalid target, create a debug target using the 'target create' command");
@@ -2919,8 +2923,6 @@
Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-NULL.
// Otherwise it will lock the AllocationModuleCollectionMutex when accessing
// the global module list directly.
-
- ModuleList module_list;
ModuleList *module_list_ptr = NULL;
const size_t argc = command.GetArgumentCount();
if (argc == 0)
Modified: lldb/branches/apple/python-GIL/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Core/FormatManager.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Core/FormatManager.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Core/FormatManager.cpp Fri Jun 29 04:55:43 2012
@@ -1014,7 +1014,8 @@
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFString_SummaryProvider", ConstString("__NSCFString"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFString_SummaryProvider", ConstString("NSCFConstantString"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFString_SummaryProvider", ConstString("NSCFString"), appkit_flags);
-
+ AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFString_SummaryProvider", ConstString("NSPathStore2"), appkit_flags);
+
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSBundle.NSBundle_SummaryProvider", ConstString("NSBundle"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSData.NSData_SummaryProvider", ConstString("NSData"), appkit_flags);
Modified: lldb/branches/apple/python-GIL/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Core/ModuleList.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Core/ModuleList.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Core/ModuleList.cpp Fri Jun 29 04:55:43 2012
@@ -37,8 +37,12 @@
// Copy constructor
//----------------------------------------------------------------------
ModuleList::ModuleList(const ModuleList& rhs) :
- m_modules(rhs.m_modules)
+ m_modules(),
+ m_modules_mutex (Mutex::eMutexTypeRecursive)
{
+ Mutex::Locker lhs_locker(m_modules_mutex);
+ Mutex::Locker rhs_locker(rhs.m_modules_mutex);
+ m_modules = rhs.m_modules;
}
//----------------------------------------------------------------------
@@ -49,7 +53,8 @@
{
if (this != &rhs)
{
- Mutex::Locker locker(m_modules_mutex);
+ Mutex::Locker lhs_locker(m_modules_mutex);
+ Mutex::Locker rhs_locker(rhs.m_modules_mutex);
m_modules = rhs.m_modules;
}
return *this;
Modified: lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Jun 29 04:55:43 2012
@@ -760,7 +760,7 @@
}
else
{
- error_str.assign ("failed to send the qLaunchSuccess packet");
+ error_str.assign ("timed out waiting for app to launch");
}
return false;
}
Modified: lldb/branches/apple/python-GIL/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Fri Jun 29 04:55:43 2012
@@ -9,6 +9,10 @@
#include "SymbolVendorMacOSX.h"
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <string.h>
+
#include <AvailabilityMacros.h>
#include "lldb/Core/Module.h"
@@ -172,6 +176,100 @@
dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp);
if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get()))
{
+ char dsym_path[PATH_MAX];
+ if (module_sp->GetSourceMappingList().IsEmpty() && dsym_fspec.GetPath(dsym_path, sizeof(dsym_path)))
+ {
+ lldb_private::UUID dsym_uuid;
+ if (dsym_objfile_sp->GetUUID(&dsym_uuid))
+ {
+ char uuid_cstr_buf[64];
+ const char *uuid_cstr = dsym_uuid.GetAsCString (uuid_cstr_buf, sizeof(uuid_cstr_buf));
+ if (uuid_cstr)
+ {
+ char *resources = strstr (dsym_path, "/Contents/Resources/");
+ if (resources)
+ {
+ char dsym_uuid_plist_path[PATH_MAX];
+ resources[strlen("/Contents/Resources/")] = '\0';
+ snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_cstr);
+ FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false);
+ if (dsym_uuid_plist_spec.Exists())
+ {
+ xmlDoc *doc = ::xmlReadFile (dsym_uuid_plist_path, NULL, 0);
+ if (doc)
+ {
+ char DBGBuildSourcePath[PATH_MAX];
+ char DBGSourcePath[PATH_MAX];
+ DBGBuildSourcePath[0] = '\0';
+ DBGSourcePath[0] = '\0';
+ for (xmlNode *node = doc->children; node; node = node ? node->next : NULL)
+ {
+ if (node->type == XML_ELEMENT_NODE)
+ {
+ if (node->name && strcmp((const char*)node->name, "plist") == 0)
+ {
+ xmlNode *dict_node = node->children;
+ while (dict_node && dict_node->type != XML_ELEMENT_NODE)
+ dict_node = dict_node->next;
+ if (dict_node && dict_node->name && strcmp((const char *)dict_node->name, "dict") == 0)
+ {
+ for (xmlNode *key_node = dict_node->children; key_node; key_node = key_node->next)
+ {
+ if (key_node && key_node->type == XML_ELEMENT_NODE && key_node->name)
+ {
+ if (strcmp((const char *)key_node->name, "key") == 0)
+ {
+ const char *key_name = (const char *)::xmlNodeGetContent(key_node);
+ if (strcmp(key_name, "DBGBuildSourcePath") == 0)
+ {
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (strcmp((const char *)value_node->name, "string") == 0)
+ {
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
+ {
+ strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath));
+ }
+ }
+ key_node = value_node;
+ }
+ else if (strcmp(key_name, "DBGSourcePath") == 0)
+ {
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (strcmp((const char *)value_node->name, "string") == 0)
+ {
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
+ {
+ strncpy(DBGSourcePath, node_content, sizeof(DBGSourcePath));
+ }
+ }
+ key_node = value_node;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ::xmlFreeDoc (doc);
+
+ if (DBGBuildSourcePath[0] && DBGSourcePath[0])
+ {
+ module_sp->GetSourceMappingList().Append (ConstString(DBGBuildSourcePath), ConstString(DBGSourcePath), true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get());
symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
return symbol_vendor;
Modified: lldb/branches/apple/python-GIL/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/PathMappingList.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/PathMappingList.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/PathMappingList.cpp Fri Jun 29 04:55:43 2012
@@ -176,7 +176,7 @@
bool
PathMappingList::RemapPath (const char *path, std::string &new_path) const
{
- if (!m_pairs.empty() || path == NULL || path[0] == '\0')
+ if (m_pairs.empty() || path == NULL || path[0] == '\0')
return false;
const_iterator pos, end = m_pairs.end();
Modified: lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Fri Jun 29 04:55:43 2012
@@ -266,6 +266,9 @@
'(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
'(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
+ self.expect('frame variable -d run-target path',substrs = ['usr/blah/stuff'])
+ self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+
self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
substrs = ['(NSData *) immutableData = ',' 4 bytes',
'(NSData *) mutableData = ',' 14 bytes',
Modified: lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-objc/main.m Fri Jun 29 04:55:43 2012
@@ -646,6 +646,9 @@
Class myclass4 = NSClassFromString(@"NSMutableArray");
Class myclass5 = [nil class];
+ NSArray *components = @[@"usr", @"blah", @"stuff"];
+ NSString *path = [NSString pathWithComponents: components];
+
// Set break point at this line.
[molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];
Modified: lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=159418&r1=159417&r2=159418&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Fri Jun 29 04:55:43 2012
@@ -62,8 +62,6 @@
// I'm seeing this, instead.
#define WATCHPOINT_OCCURRED ((uint32_t)(10u))
-//#define DNB_ARCH_MACH_ARM_DEBUG_SW_STEP 1
-
static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
@@ -340,23 +338,20 @@
// Do we need to step this thread? If so, let the mach thread tell us so.
if (m_thread->IsStepping())
{
- bool step_handled = false;
// This is the primary thread, let the arch do anything it needs
if (NumSupportedHardwareBreakpoints() > 0)
{
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
- bool half_step = m_hw_single_chained_step_addr != INVALID_NUB_ADDRESS;
-#endif
- step_handled = EnableHardwareSingleStep(true) == KERN_SUCCESS;
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
- if (!half_step)
- step_handled = false;
-#endif
+ if (EnableHardwareSingleStep(true) != KERN_SUCCESS)
+ {
+ DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable hardware single step");
+ }
}
-
- if (!step_handled)
+ else
{
- SetSingleStepSoftwareBreakpoints();
+ if (SetSingleStepSoftwareBreakpoints() != KERN_SUCCESS)
+ {
+ DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable software single step");
+ }
}
}
@@ -434,32 +429,6 @@
// We are single stepping, was this the primary thread?
if (m_thread->IsStepping())
{
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
- success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
- // Hardware single step must work if we are going to test software
- // single step functionality
- assert(success);
- if (m_hw_single_chained_step_addr == INVALID_NUB_ADDRESS && m_sw_single_step_next_pc != INVALID_NUB_ADDRESS)
- {
- uint32_t sw_step_next_pc = m_sw_single_step_next_pc & 0xFFFFFFFEu;
- bool sw_step_next_pc_is_thumb = (m_sw_single_step_next_pc & 1) != 0;
- bool actual_next_pc_is_thumb = (m_state.context.gpr.__cpsr & 0x20) != 0;
- if (m_state.context.gpr.__pc != sw_step_next_pc)
- {
- DNBLogError("curr pc = 0x%8.8x - calculated single step target PC was incorrect: 0x%8.8x != 0x%8.8x", m_state.context.gpr.__pc, sw_step_next_pc, m_state.context.gpr.__pc);
- exit(1);
- }
- if (actual_next_pc_is_thumb != sw_step_next_pc_is_thumb)
- {
- DNBLogError("curr pc = 0x%8.8x - calculated single step calculated mode mismatch: sw single mode = %s != %s",
- m_state.context.gpr.__pc,
- actual_next_pc_is_thumb ? "Thumb" : "ARM",
- sw_step_next_pc_is_thumb ? "Thumb" : "ARM");
- exit(1);
- }
- m_sw_single_step_next_pc = INVALID_NUB_ADDRESS;
- }
-#else
// Are we software single stepping?
if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id) || m_sw_single_step_itblock_break_count)
{
@@ -512,7 +481,6 @@
}
else
success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
-#endif
}
else
{
@@ -2153,11 +2121,6 @@
{
err = KERN_SUCCESS;
-#if defined DNB_ARCH_MACH_ARM_DEBUG_SW_STEP
- m_sw_single_step_next_pc = next_pc;
- if (next_pc_is_thumb)
- m_sw_single_step_next_pc |= 1; // Set bit zero if the next PC is expected to be Thumb
-#else
const DNBBreakpoint *bp = m_thread->Process()->Breakpoints().FindByAddress(next_pc);
if (bp == NULL)
@@ -2167,7 +2130,6 @@
err = KERN_INVALID_ARGUMENT;
DNBLogThreadedIf(LOG_STEP, "%s: software single step breakpoint with breakID=%d set at 0x%8.8x", __FUNCTION__, m_sw_single_step_break_id, next_pc);
}
-#endif
}
#else
err.LogThreaded("%s: ARMDisassembler.framework support is disabled", __FUNCTION__);
More information about the lldb-commits
mailing list