From johnny.chen at apple.com Mon Nov 1 11:08:47 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 01 Nov 2010 16:08:47 -0000 Subject: [Lldb-commits] [lldb] r117924 - in /lldb/trunk/test: array_types/TestArrayTypes.py lldbtest.py Message-ID: <20101101160847.32C722A6C12C@llvm.org> Author: johnny Date: Mon Nov 1 11:08:47 2010 New Revision: 117924 URL: http://llvm.org/viewvc/llvm-project?rev=117924&view=rev Log: Python API changes: SBValue.IsPtrType() -> SBValue.IsPointerType(). SBFrame print representation: idx: 0 -> #0 Modified: lldb/trunk/test/array_types/TestArrayTypes.py lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/array_types/TestArrayTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=117924&r1=117923&r2=117924&view=diff ============================================================================== --- lldb/trunk/test/array_types/TestArrayTypes.py (original) +++ lldb/trunk/test/array_types/TestArrayTypes.py Mon Nov 1 11:08:47 2010 @@ -145,7 +145,7 @@ self.expect(frm, "Frame looks good with correct index %d" % frame.GetFrameID(), exe=False, - substrs = ["idx = %d" % frame.GetFrameID()]) + substrs = ["#%d" % frame.GetFrameID()]) # Lookup the "strings" string array variable and sanity check its print # representation. Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=117924&r1=117923&r2=117924&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Mon Nov 1 11:08:47 2010 @@ -781,11 +781,11 @@ err = sys.stderr err.write(val.GetName() + ":\n") - err.write('\t' + "TypeName -> " + val.GetTypeName() + '\n') - err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n') - err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n') - err.write('\t' + "Value -> " + str(val.GetValue(frame)) + '\n') - err.write('\t' + "Summary -> " + str(val.GetSummary(frame)) + '\n') - err.write('\t' + "IsPtrType -> " + str(val.TypeIsPtrType()) + '\n') - err.write('\t' + "Location -> " + val.GetLocation(frame) + '\n') + err.write('\t' + "TypeName -> " + val.GetTypeName() + '\n') + err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n') + err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n') + err.write('\t' + "Value -> " + str(val.GetValue(frame)) + '\n') + err.write('\t' + "Summary -> " + str(val.GetSummary(frame)) + '\n') + err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n') + err.write('\t' + "Location -> " + val.GetLocation(frame) + '\n') From johnny.chen at apple.com Mon Nov 1 11:39:24 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 01 Nov 2010 16:39:24 -0000 Subject: [Lldb-commits] [lldb] r117926 - /lldb/trunk/utils/emacs/README Message-ID: <20101101163924.5047C2A6C12D@llvm.org> Author: johnny Date: Mon Nov 1 11:39:24 2010 New Revision: 117926 URL: http://llvm.org/viewvc/llvm-project?rev=117926&view=rev Log: Change the README to reflect the new the screen shot file name lldb-gud-window.png. Modified: lldb/trunk/utils/emacs/README Modified: lldb/trunk/utils/emacs/README URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/README?rev=117926&r1=117925&r2=117926&view=diff ============================================================================== --- lldb/trunk/utils/emacs/README (original) +++ lldb/trunk/utils/emacs/README Mon Nov 1 11:39:24 2010 @@ -5,6 +5,6 @@ To use it, load the file from within emacs and type 'M-x lldb' to invoke lldb. -The lldb-gud-window.tiff is a screen capture of the gud (with lldb) at work on +The lldb-gud-window.png is a screen capture of the gud (with lldb) at work on Aquamacs distribution 2.1 by loading the gud.el in this directory and 'M-x lldb' on the ../../test/condition_break directory. From johnny.chen at apple.com Mon Nov 1 12:29:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 01 Nov 2010 17:29:38 -0000 Subject: [Lldb-commits] [lldb] r117933 - in /lldb/trunk/utils/emacs: gud-diffs.txt gud.el Message-ID: <20101101172938.A4CCC2A6C12C@llvm.org> Author: johnny Date: Mon Nov 1 12:29:38 2010 New Revision: 117933 URL: http://llvm.org/viewvc/llvm-project?rev=117933&view=rev Log: Add keyboard shortcuts: 'thread backtrace' => Control-C b (gud-bt) "Show stack for the current thread." 'thread backtrace all' => Control-C B (gud-bt-all) "Show stacks for all the threads." Change the function name of one existing shortcut: 'breakpoint list" => Control-C l (gud-listb) "List all breakpoints." Modified: lldb/trunk/utils/emacs/gud-diffs.txt lldb/trunk/utils/emacs/gud.el Modified: lldb/trunk/utils/emacs/gud-diffs.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud-diffs.txt?rev=117933&r1=117932&r2=117933&view=diff ============================================================================== --- lldb/trunk/utils/emacs/gud-diffs.txt (original) +++ lldb/trunk/utils/emacs/gud-diffs.txt Mon Nov 1 12:29:38 2010 @@ -1,5 +1,5 @@ --- /tmp/gud.el 2009-05-06 05:16:32.000000000 -0700 -+++ utils/emacs/gud.el 2010-10-29 16:41:53.000000000 -0700 ++++ utils/emacs/gud.el 2010-11-01 10:13:13.000000000 -0700 @@ -144,12 +144,12 @@ (display-graphic-p) (fboundp 'x-show-tip)) @@ -71,7 +71,7 @@ %p -- Prefix argument to the command (if any) as a number. %c -- Fully qualified class name derived from the expression surrounding point (jdb only). -@@ -930,6 +931,126 @@ +@@ -930,6 +931,131 @@ ;; ====================================================================== @@ -140,8 +140,13 @@ + (set (make-local-variable 'gud-minor-mode) 'lldb) + (setq lldb-oneshot-break-defined nil) + -+ (gud-def gud-lbreak "breakpoint list" ++ (gud-def gud-listb "breakpoint list" + "l" "List all breakpoints.") ++ (gud-def gud-bt "thread backtrace" ++ "b" "Show stack for the current thread.") ++ (gud-def gud-bt-all "thread backtrace all" ++ "B" "Show stacks for all the threads.") ++ + (gud-def gud-break "breakpoint set -f %f -l %l" + "\C-b" "Set breakpoint at current line.") + (gud-def gud-tbreak @@ -198,7 +203,7 @@ ;; sdb functions ;; History of argument lists passed to sdb. -@@ -2372,9 +2493,10 @@ +@@ -2372,9 +2498,10 @@ "Major mode for interacting with an inferior debugger process. You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx, @@ -212,7 +217,7 @@ After startup, the following commands are available in both the GUD interaction buffer and any source buffer GUD visits due to a breakpoint stop -@@ -2404,7 +2526,7 @@ +@@ -2404,7 +2531,7 @@ except that the breakpoint is temporary; that is, it is removed when execution stops on it. @@ -221,7 +226,7 @@ frame. \\[gud-down] drops back down through one. If you are using gdb or xdb, \\[gud-finish] runs execution to the return from -@@ -2724,7 +2846,7 @@ +@@ -2724,7 +2851,7 @@ result) (while (and str (let ((case-fold-search nil)) @@ -230,7 +235,7 @@ (let ((key (string-to-char (match-string 2 str))) subst) (cond -@@ -2753,6 +2875,8 @@ +@@ -2753,6 +2880,8 @@ (setq subst (gud-find-expr))) ((eq key ?a) (setq subst (gud-read-address))) @@ -239,7 +244,7 @@ ((eq key ?c) (setq subst (gud-find-class -@@ -3372,6 +3496,8 @@ +@@ -3372,6 +3501,8 @@ (defun gud-tooltip-print-command (expr) "Return a suitable command to print the expression EXPR." (case gud-minor-mode Modified: lldb/trunk/utils/emacs/gud.el URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud.el?rev=117933&r1=117932&r2=117933&view=diff ============================================================================== --- lldb/trunk/utils/emacs/gud.el (original) +++ lldb/trunk/utils/emacs/gud.el Mon Nov 1 12:29:38 2010 @@ -996,8 +996,13 @@ (set (make-local-variable 'gud-minor-mode) 'lldb) (setq lldb-oneshot-break-defined nil) - (gud-def gud-lbreak "breakpoint list" + (gud-def gud-listb "breakpoint list" "l" "List all breakpoints.") + (gud-def gud-bt "thread backtrace" + "b" "Show stack for the current thread.") + (gud-def gud-bt-all "thread backtrace all" + "B" "Show stacks for all the threads.") + (gud-def gud-break "breakpoint set -f %f -l %l" "\C-b" "Set breakpoint at current line.") (gud-def gud-tbreak From scallanan at apple.com Mon Nov 1 15:28:09 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 01 Nov 2010 20:28:09 -0000 Subject: [Lldb-commits] [lldb] r117947 - /lldb/trunk/source/Expression/ClangExpressionParser.cpp Message-ID: <20101101202809.D20AD2A6C12C@llvm.org> Author: spyffe Date: Mon Nov 1 15:28:09 2010 New Revision: 117947 URL: http://llvm.org/viewvc/llvm-project?rev=117947&view=rev Log: Print notes for expressions as well as errors and warnings. Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=117947&r1=117946&r2=117947&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Mon Nov 1 15:28:09 2010 @@ -308,7 +308,7 @@ TextDiagnosticBuffer::const_iterator diag_iterator; int num_errors = 0; - + for (diag_iterator = diag_buf->warn_begin(); diag_iterator != diag_buf->warn_end(); ++diag_iterator) @@ -324,6 +324,11 @@ stream.Printf("error: %s\n", (*diag_iterator).second.c_str()); } + for (diag_iterator = diag_buf->note_begin(); + diag_iterator != diag_buf->note_end(); + ++diag_iterator) + stream.Printf("note: %s\n", (*diag_iterator).second.c_str()); + return num_errors; } From gclayton at apple.com Mon Nov 1 15:32:12 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 01 Nov 2010 20:32:12 -0000 Subject: [Lldb-commits] [lldb] r117948 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20101101203212.EB73D2A6C12C@llvm.org> Author: gclayton Date: Mon Nov 1 15:32:12 2010 New Revision: 117948 URL: http://llvm.org/viewvc/llvm-project?rev=117948&view=rev Log: Fixed globals not showing up for any but the first compile unit due to a mismatch: I was using the compile unit user ID (the compile unit offset in the DWARF) as the compile unit index. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=117948&r1=117947&r2=117948&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Nov 1 15:32:12 2010 @@ -3447,7 +3447,12 @@ { if (sc.comp_unit != NULL) { - DWARFCompileUnit* dwarf_cu = GetDWARFCompileUnitForUID(sc.comp_unit->GetID()); + DWARFDebugInfo* info = DebugInfo(); + if (info == NULL) + return 0; + + uint32_t cu_idx = UINT32_MAX; + DWARFCompileUnit* dwarf_cu = info->GetCompileUnit(sc.comp_unit->GetID(), &cu_idx).get(); if (dwarf_cu == NULL) return 0; @@ -3476,9 +3481,8 @@ if (!m_indexed) Index (); - std::vector global_die_info_array; - const size_t num_globals = m_global_index.FindAllEntriesForCompileUnitWithIndex (sc.comp_unit->GetID(), global_die_info_array); + const size_t num_globals = m_global_index.FindAllEntriesForCompileUnitWithIndex (cu_idx, global_die_info_array); for (size_t idx=0; idxGetDIEAtIndexUnchecked(global_die_info_array[idx].die_idx), LLDB_INVALID_ADDRESS)); From johnny.chen at apple.com Mon Nov 1 15:35:01 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 01 Nov 2010 20:35:01 -0000 Subject: [Lldb-commits] [lldb] r117949 - /lldb/trunk/test/lldbtest.py Message-ID: <20101101203501.852EE2A6C12C@llvm.org> Author: johnny Date: Mon Nov 1 15:35:01 2010 New Revision: 117949 URL: http://llvm.org/viewvc/llvm-project?rev=117949&view=rev Log: Replace the two call sites of inspect.getsource(obj) with a utility function getsource_if_available(obj) which also handles the exception if it occurs. Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=117949&r1=117948&r2=117949&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Mon Nov 1 15:35:01 2010 @@ -292,6 +292,17 @@ raise CalledProcessError(retcode, cmd) return output +def getsource_if_available(obj): + """ + Return the text of the source code for an object if available. Otherwise, + a print representation is returned. + """ + import inspect + try: + return inspect.getsource(obj) + except: + return repr(obj) + class TestBase(unittest2.TestCase): """ This abstract base class is meant to be subclassed. It provides default @@ -536,8 +547,7 @@ """ if callable(hook): with recording(self, traceAlways) as sbuf: - import inspect - print >> sbuf, "Adding tearDown hook:", inspect.getsource(hook) + print >> sbuf, "Adding tearDown hook:", getsource_if_available(hook) self.hooks.append(hook) def tearDown(self): @@ -547,8 +557,7 @@ # Check and run any hook functions. for hook in self.hooks: with recording(self, traceAlways) as sbuf: - import inspect - print >> sbuf, "Executing tearDown hook:", inspect.getsource(hook) + print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook) hook() # Terminate the current process being debugged, if any. From johnny.chen at apple.com Mon Nov 1 16:52:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 01 Nov 2010 21:52:20 -0000 Subject: [Lldb-commits] [lldb] r117962 - /lldb/trunk/test/conditional_break/TestConditionalBreak.py Message-ID: <20101101215220.383BD2A6C12C@llvm.org> Author: johnny Date: Mon Nov 1 16:52:20 2010 New Revision: 117962 URL: http://llvm.org/viewvc/llvm-project?rev=117962&view=rev Log: Add comment on test class failing for clang as well as llvm-gcc. Modified: lldb/trunk/test/conditional_break/TestConditionalBreak.py Modified: lldb/trunk/test/conditional_break/TestConditionalBreak.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/TestConditionalBreak.py?rev=117962&r1=117961&r2=117962&view=diff ============================================================================== --- lldb/trunk/test/conditional_break/TestConditionalBreak.py (original) +++ lldb/trunk/test/conditional_break/TestConditionalBreak.py Mon Nov 1 16:52:20 2010 @@ -8,6 +8,11 @@ import lldb, lldbutil from lldbtest import * +# rdar://problem/8532131 +# lldb not able to digest the clang-generated debug info correctly with respect to function name +# +# This class currently fails for clang as well as llvm-gcc. + class ConditionalBreakTestCase(TestBase): mydir = "conditional_break" From scallanan at apple.com Mon Nov 1 18:22:47 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 01 Nov 2010 23:22:47 -0000 Subject: [Lldb-commits] [lldb] r117972 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20101101232247.D413D2A6C12C@llvm.org> Author: spyffe Date: Mon Nov 1 18:22:47 2010 New Revision: 117972 URL: http://llvm.org/viewvc/llvm-project?rev=117972&view=rev Log: Improved logging and cleaned up a redundant return statement. Now when ClangExpressionDeclMap returns a variable for a name, it pretty-prints that variable to the log instead of printing a (fairly useless) NamedDecl pointer. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=117972&r1=117971&r2=117972&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Nov 1 18:22:47 2010 @@ -14,6 +14,7 @@ // Other libraries and framework includes // Project includes #include "clang/AST/DeclarationName.h" +#include "clang/AST/Decl.h" #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" #include "lldb/Core/Error.h" @@ -35,6 +36,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" +#include "llvm/Support/raw_ostream.h" using namespace lldb_private; using namespace clang; @@ -949,8 +951,6 @@ } return var.get(); - - return NULL; } // Interface for ClangASTSource @@ -1242,7 +1242,12 @@ if (log) { - log->Printf("Found variable %s, returned (NamedDecl)%p", decl_name.c_str(), var_decl); + std::string var_decl_print_string; + llvm::raw_string_ostream var_decl_print_stream(var_decl_print_string); + var_decl->print(var_decl_print_stream); + var_decl_print_stream.flush(); + + log->Printf("Found variable %s, returned %s", decl_name.c_str(), var_decl_print_string.c_str()); } } @@ -1268,7 +1273,14 @@ pvar->m_parser_vars->m_lldb_value = NULL; if (log) - log->Printf("Added pvar %s, returned (NamedDecl)%p", pvar->m_name.GetCString(), var_decl); + { + std::string var_decl_print_string; + llvm::raw_string_ostream var_decl_print_stream(var_decl_print_string); + var_decl->print(var_decl_print_stream); + var_decl_print_stream.flush(); + + log->Printf("Added pvar %s, returned %s", pvar->m_name.GetCString(), var_decl_print_string.c_str()); + } } void @@ -1343,7 +1355,12 @@ if (log) { - log->Printf("Found %s function %s, returned (NamedDecl)%p", (fun ? "specific" : "generic"), decl_name.c_str(), fun_decl); + std::string fun_decl_print_string; + llvm::raw_string_ostream fun_decl_print_stream(fun_decl_print_string); + fun_decl->print(fun_decl_print_stream); + fun_decl_print_stream.flush(); + + log->Printf("Found %s function %s, returned %s", (fun ? "specific" : "generic"), decl_name.c_str(), fun_decl_print_string.c_str()); } } From gclayton at apple.com Mon Nov 1 20:50:16 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 01:50:16 -0000 Subject: [Lldb-commits] [lldb] r117999 - in /lldb/trunk/source/Core: Value.cpp ValueObject.cpp ValueObjectChild.cpp Message-ID: <20101102015016.D82BB2A6C12C@llvm.org> Author: gclayton Date: Mon Nov 1 20:50:16 2010 New Revision: 117999 URL: http://llvm.org/viewvc/llvm-project?rev=117999&view=rev Log: Print better error messages when memory reads fail when displaying variable values. Always show the variable types for the top level items when dumping program variables. Modified: lldb/trunk/source/Core/Value.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Core/ValueObjectChild.cpp Modified: lldb/trunk/source/Core/Value.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=117999&r1=117998&r2=117999&view=diff ============================================================================== --- lldb/trunk/source/Core/Value.cpp (original) +++ lldb/trunk/source/Core/Value.cpp Mon Nov 1 20:50:16 2010 @@ -498,7 +498,7 @@ switch (m_value_type) { default: - error.SetErrorStringWithFormat("Invalid value type %i.\n", m_value_type); + error.SetErrorStringWithFormat("invalid value type %i", m_value_type); break; case eValueTypeScalar: @@ -506,17 +506,17 @@ data.SetAddressByteSize(sizeof(void *)); if (m_value.GetData (data)) return error; // Success; - error.SetErrorStringWithFormat("Extracting data from value failed.\n"); + error.SetErrorStringWithFormat("extracting data from value failed"); break; case eValueTypeLoadAddress: if (exe_ctx == NULL) { - error.SetErrorString ("Can't read memory (no execution context)."); + error.SetErrorString ("can't read memory (no execution context)"); } else if (exe_ctx->process == NULL) { - error.SetErrorString ("Can't read memory (invalid process)."); + error.SetErrorString ("can't read memory (invalid process)"); } else { @@ -564,7 +564,7 @@ } else { - error.SetErrorStringWithFormat ("Unable to resolve the module for file address 0x%llx for variable '%s'.\n", file_addr, variable->GetName().AsCString("")); + error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%llx for variable '%s'", file_addr, variable->GetName().AsCString("")); } } else @@ -576,7 +576,7 @@ { // Can't convert a file address to anything valid without more // context (which Module it came from) - error.SetErrorString ("Can't read memory from file address without more context."); + error.SetErrorString ("can't read memory from file address without more context"); } } break; @@ -595,7 +595,7 @@ if (address == LLDB_INVALID_ADDRESS) { - error.SetErrorStringWithFormat ("Invalid %s address.\n", address_type == eAddressTypeHost ? "host" : "load"); + error.SetErrorStringWithFormat ("invalid %s address", address_type == eAddressTypeHost ? "host" : "load"); return error; } @@ -628,16 +628,18 @@ { if (error.Success()) error.SetErrorStringWithFormat("read %u bytes of memory from 0x%llx failed", (uint64_t)address, byte_size); + else + error.SetErrorStringWithFormat("read memory from 0x%llx failed", (uint64_t)address); } } else { - error.SetErrorStringWithFormat ("Unsupported lldb::AddressType value (%i).\n", address_type); + error.SetErrorStringWithFormat ("unsupported lldb::AddressType value (%i)", address_type); } } else { - error.SetErrorStringWithFormat ("Out of memory.\n"); + error.SetErrorStringWithFormat ("out of memory"); } return error; Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=117999&r1=117998&r2=117999&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Mon Nov 1 20:50:16 2010 @@ -990,7 +990,8 @@ s.Indent(); - if (show_types) + // Always show the type for the top level items. + if (show_types || curr_depth == 0) s.Printf("(%s) ", valobj->GetTypeName().AsCString()); @@ -1021,7 +1022,7 @@ if (err_cstr) { - s.Printf (" %s\n", err_cstr); + s.Printf (" error: %s\n", err_cstr); } else { Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=117999&r1=117998&r2=117999&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Mon Nov 1 20:50:16 2010 @@ -146,13 +146,27 @@ { uint32_t offset = 0; m_value.GetScalar() = parent->GetDataExtractor().GetPointer(&offset); - // For pointers, m_byte_offset should only ever be set if we - // ValueObject::GetSyntheticArrayMemberFromPointer() was called - if (ClangASTContext::IsPointerType (parent->GetClangType()) && m_byte_offset) - m_value.GetScalar() += m_byte_offset; - if (value_type == Value::eValueTypeScalar || - value_type == Value::eValueTypeFileAddress) - m_value.SetValueType (Value::eValueTypeLoadAddress); + + lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + + if (addr == LLDB_INVALID_ADDRESS) + { + m_error.SetErrorString ("parent address is invalid."); + } + else if (addr == 0) + { + m_error.SetErrorString ("parent is NULL"); + } + else + { + // For pointers, m_byte_offset should only ever be set if we + // ValueObject::GetSyntheticArrayMemberFromPointer() was called + if (ClangASTContext::IsPointerType (parent->GetClangType()) && m_byte_offset) + m_value.GetScalar() += m_byte_offset; + if (value_type == Value::eValueTypeScalar || + value_type == Value::eValueTypeFileAddress) + m_value.SetValueType (Value::eValueTypeLoadAddress); + } } else { @@ -163,14 +177,20 @@ case Value::eValueTypeHostAddress: { lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); - if (addr == LLDB_INVALID_ADDRESS || addr == 0) + if (addr == LLDB_INVALID_ADDRESS) + { + m_error.SetErrorString ("parent address is invalid."); + } + else if (addr == 0) + { + m_error.SetErrorString ("parent is NULL"); + } + else { - m_error.SetErrorStringWithFormat("Parent address is invalid: 0x%llx.\n", addr); - break; + // Set this object's scalar value to the address of its + // value be adding its byte offset to the parent address + m_value.GetScalar() += GetByteOffset(); } - // Set this object's scalar value to the address of its - // value be adding its byte offset to the parent address - m_value.GetScalar() += GetByteOffset(); } break; From gclayton at apple.com Mon Nov 1 20:53:22 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 01:53:22 -0000 Subject: [Lldb-commits] [lldb] r118000 - /lldb/trunk/source/Core/Debugger.cpp Message-ID: <20101102015322.121B82A6C12C@llvm.org> Author: gclayton Date: Mon Nov 1 20:53:21 2010 New Revision: 118000 URL: http://llvm.org/viewvc/llvm-project?rev=118000&view=rev Log: Fixed our overly verbose stop reasons which by default included the thread name and thread queue. Users can modify the thread-format strings to add these back if needed. Modified: lldb/trunk/source/Core/Debugger.cpp Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=118000&r1=117999&r2=118000&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Mon Nov 1 20:53:21 2010 @@ -1655,10 +1655,17 @@ MODULE_WITH_FUNC\ FILE_AND_LINE\ "{, stop reason = ${thread.stop-reason}}"\ - "{, name = ${thread.name}}"\ - "{, queue = ${thread.queue}}"\ "\\n" +//#define DEFAULT_THREAD_FORMAT "thread #${thread.index}: tid = ${thread.id}"\ +// "{, ${frame.pc}}"\ +// MODULE_WITH_FUNC\ +// FILE_AND_LINE\ +// "{, stop reason = ${thread.stop-reason}}"\ +// "{, name = ${thread.name}}"\ +// "{, queue = ${thread.queue}}"\ +// "\\n" + #define DEFAULT_FRAME_FORMAT "frame #${frame.index}: ${frame.pc}"\ MODULE_WITH_FUNC\ FILE_AND_LINE\ From gclayton at apple.com Mon Nov 1 22:02:38 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 03:02:38 -0000 Subject: [Lldb-commits] [lldb] r118002 - in /lldb/trunk/source/Commands: CommandObjectBreakpoint.cpp CommandObjectBreakpoint.h Message-ID: <20101102030238.BFDC92A6C12C@llvm.org> Author: gclayton Date: Mon Nov 1 22:02:38 2010 New Revision: 118002 URL: http://llvm.org/viewvc/llvm-project?rev=118002&view=rev Log: Fixed the default file and line breakpoints to include inlined breakpoints. Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=118002&r1=118001&r2=118002&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Mon Nov 1 22:02:38 2010 @@ -52,7 +52,7 @@ m_filename (), m_line_num (0), m_column (0), - m_ignore_inlines (false), + m_check_inlines (true), m_func_name (), m_func_name_type_mask (0), m_func_regexp (), @@ -367,7 +367,7 @@ bp = target->CreateBreakpoint (&module_spec, file, m_options.m_line_num, - m_options.m_ignore_inlines).get(); + m_options.m_check_inlines).get(); if (bp) { StreamString &output_stream = result.GetOutputStream(); @@ -391,7 +391,7 @@ bp = target->CreateBreakpoint (NULL, file, m_options.m_line_num, - m_options.m_ignore_inlines).get(); + m_options.m_check_inlines).get(); } break; Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=118002&r1=118001&r2=118002&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Mon Nov 1 22:02:38 2010 @@ -99,7 +99,7 @@ std::string m_filename; uint32_t m_line_num; uint32_t m_column; - bool m_ignore_inlines; + bool m_check_inlines; std::string m_func_name; uint32_t m_func_name_type_mask; std::string m_func_regexp; From gclayton at apple.com Mon Nov 1 22:48:39 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 03:48:39 -0000 Subject: [Lldb-commits] [lldb] r118003 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20101102034839.CE3EE2A6C12C@llvm.org> Author: gclayton Date: Mon Nov 1 22:48:39 2010 New Revision: 118003 URL: http://llvm.org/viewvc/llvm-project?rev=118003&view=rev Log: Fixed cases where we were translating "long long" types to use the "long" types when they are the same size. The new code will use the correct type now when converting DWARF built-in types into clang types. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=118003&r1=118002&r2=118003&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Nov 1 22:48:39 2010 @@ -521,49 +521,40 @@ case DW_ATE_signed: if (type_name) { - if (streq(type_name, "int") || - streq(type_name, "signed int")) + if (strstr(type_name, "long long")) { - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->IntTy)) - return ast_context->IntTy.getAsOpaquePtr(); - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->Int128Ty)) - return ast_context->Int128Ty.getAsOpaquePtr(); + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongLongTy)) + return ast_context->LongLongTy.getAsOpaquePtr(); } - - if (streq(type_name, "long int") || - streq(type_name, "long long int") || - streq(type_name, "signed long long")) + else if (strstr(type_name, "long")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongTy)) return ast_context->LongTy.getAsOpaquePtr(); - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongLongTy)) - return ast_context->LongLongTy.getAsOpaquePtr(); } - - if (streq(type_name, "short") || - streq(type_name, "short int") || - streq(type_name, "signed short") || - streq(type_name, "short signed int")) + else if (strstr(type_name, "short")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->ShortTy)) return ast_context->ShortTy.getAsOpaquePtr(); } - - if (streq(type_name, "char") || - streq(type_name, "signed char")) + else if (strstr(type_name, "char")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->CharTy)) return ast_context->CharTy.getAsOpaquePtr(); if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->SignedCharTy)) return ast_context->SignedCharTy.getAsOpaquePtr(); } - - if (streq(type_name, "wchar_t")) + else if (strstr(type_name, "int")) + { + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->IntTy)) + return ast_context->IntTy.getAsOpaquePtr(); + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->Int128Ty)) + return ast_context->Int128Ty.getAsOpaquePtr(); + } + else if (streq(type_name, "wchar_t")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->WCharTy)) return ast_context->WCharTy.getAsOpaquePtr(); } - } // We weren't able to match up a type name, just search by size if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->CharTy)) @@ -598,36 +589,33 @@ case DW_ATE_unsigned: if (type_name) { - if (streq(type_name, "unsigned int")) + if (strstr(type_name, "long long")) { - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedIntTy)) - return ast_context->UnsignedIntTy.getAsOpaquePtr(); - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedInt128Ty)) - return ast_context->UnsignedInt128Ty.getAsOpaquePtr(); + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongLongTy)) + return ast_context->UnsignedLongLongTy.getAsOpaquePtr(); } - - if (streq(type_name, "unsigned int") || - streq(type_name, "long unsigned int") || - streq(type_name, "unsigned long long")) + else if (strstr(type_name, "long")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongTy)) return ast_context->UnsignedLongTy.getAsOpaquePtr(); - if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongLongTy)) - return ast_context->UnsignedLongLongTy.getAsOpaquePtr(); } - - if (streq(type_name, "unsigned short") || - streq(type_name, "short unsigned int")) + else if (strstr(type_name, "short")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedShortTy)) return ast_context->UnsignedShortTy.getAsOpaquePtr(); } - if (streq(type_name, "unsigned char")) + else if (strstr(type_name, "char")) { if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedCharTy)) return ast_context->UnsignedCharTy.getAsOpaquePtr(); } - + else if (strstr(type_name, "int")) + { + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedIntTy)) + return ast_context->UnsignedIntTy.getAsOpaquePtr(); + if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedInt128Ty)) + return ast_context->UnsignedInt128Ty.getAsOpaquePtr(); + } } // We weren't able to match up a type name, just search by size if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedCharTy)) From johnny.chen at apple.com Tue Nov 2 11:04:18 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 02 Nov 2010 16:04:18 -0000 Subject: [Lldb-commits] [lldb] r118017 - in /lldb/trunk/test/types: TestIntegerTypes.py TestIntegerTypesExpr.py Message-ID: <20101102160418.7A02C2A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 11:04:18 2010 New Revision: 118017 URL: http://llvm.org/viewvc/llvm-project?rev=118017&view=rev Log: Remove 8 @expectedFailure decorators, the following bug has been fixed: # rdar://problem/8482903 # test suite failure for types dir -- "long long" and "unsigned long long" Modified: lldb/trunk/test/types/TestIntegerTypes.py lldb/trunk/test/types/TestIntegerTypesExpr.py Modified: lldb/trunk/test/types/TestIntegerTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestIntegerTypes.py?rev=118017&r1=118016&r2=118017&view=diff ============================================================================== --- lldb/trunk/test/types/TestIntegerTypes.py (original) +++ lldb/trunk/test/types/TestIntegerTypes.py Tue Nov 2 11:04:18 2010 @@ -134,7 +134,6 @@ # rdar://problem/8482903 # test suite failure for types dir -- "long long" and "unsigned long long" - @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_long_long_type_with_dsym(self): """Test that 'long long'-type variables are displayed correctly.""" @@ -143,7 +142,6 @@ self.setTearDownCleanup(dictionary=d) self.long_long_type() - @unittest2.expectedFailure def test_long_long_type_with_dwarf(self): """Test that 'long long'-type variables are displayed correctly.""" d = {'CXX_SOURCES': 'long_long.cpp'} @@ -151,7 +149,6 @@ self.setTearDownCleanup(dictionary=d) self.long_long_type() - @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_unsigned_long_long_type_with_dsym(self): """Test that 'unsigned long long'-type variables are displayed correctly.""" @@ -160,7 +157,6 @@ self.setTearDownCleanup(dictionary=d) self.unsigned_long_long_type() - @unittest2.expectedFailure def test_unsigned_long_long_type_with_dwarf(self): """Test that 'unsigned long long'-type variables are displayed correctly.""" d = {'CXX_SOURCES': 'unsigned_long_long.cpp'} Modified: lldb/trunk/test/types/TestIntegerTypesExpr.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestIntegerTypesExpr.py?rev=118017&r1=118016&r2=118017&view=diff ============================================================================== --- lldb/trunk/test/types/TestIntegerTypesExpr.py (original) +++ lldb/trunk/test/types/TestIntegerTypesExpr.py Tue Nov 2 11:04:18 2010 @@ -134,7 +134,6 @@ # rdar://problem/8482903 # test suite failure for types dir -- "long long" and "unsigned long long" - @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_long_long_type_with_dsym(self): """Test that 'long long'-type variable expressions are evaluated correctly.""" @@ -143,7 +142,6 @@ self.setTearDownCleanup(dictionary=d) self.long_long_type_expr() - @unittest2.expectedFailure def test_long_long_type_with_dwarf(self): """Test that 'long long'-type variable expressions are evaluated correctly.""" d = {'CXX_SOURCES': 'long_long.cpp'} @@ -151,7 +149,6 @@ self.setTearDownCleanup(dictionary=d) self.long_long_type_expr() - @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_unsigned_long_long_type_with_dsym(self): """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" @@ -160,7 +157,6 @@ self.setTearDownCleanup(dictionary=d) self.unsigned_long_long_type_expr() - @unittest2.expectedFailure def test_unsigned_long_long_type_with_dwarf(self): """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" d = {'CXX_SOURCES': 'unsigned_long_long.cpp'} From ctice at apple.com Tue Nov 2 11:16:53 2010 From: ctice at apple.com (Caroline Tice) Date: Tue, 02 Nov 2010 16:16:53 -0000 Subject: [Lldb-commits] [lldb] r118018 - in /lldb/trunk: source/Commands/CommandObjectProcess.cpp tools/debugserver/source/MacOSX/MachProcess.cpp tools/debugserver/source/MacOSX/MachProcess.h Message-ID: <20101102161653.EF4C52A6C12C@llvm.org> Author: ctice Date: Tue Nov 2 11:16:53 2010 New Revision: 118018 URL: http://llvm.org/viewvc/llvm-project?rev=118018&view=rev Log: Fix problem where "process detach" was not working properly. The ptrace thread update that was replying to the SIGSTOP was also causing the process to not really be sigstop'd any more so then the call to ptrace detach was failing, and when debugserver exited the attached process was being killed. Now the ptrace thread update does not disturb the sigstop state of the thread, so the detach works properly. Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=118018&r1=118017&r2=118018&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Nov 2 11:16:53 2010 @@ -836,6 +836,7 @@ return false; } + result.AppendMessageWithFormat ("Detaching from process %i\n", process->GetID()); Error error (process->Detach()); if (error.Success()) { Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=118018&r1=118017&r2=118018&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Tue Nov 2 11:16:53 2010 @@ -359,7 +359,7 @@ } nub_state_t -MachProcess::DoSIGSTOP (bool clear_bps_and_wps) +MachProcess::DoSIGSTOP (bool clear_bps_and_wps, uint32_t *thread_idx_ptr) { nub_state_t state = GetState(); DNBLogThreadedIf(LOG_PROCESS, "MachProcess::DoSIGSTOP() state = %s", DNBStateAsString (state)); @@ -375,7 +375,10 @@ // If we already have a thread stopped due to a SIGSTOP, we don't have // to do anything... - if (m_thread_list.GetThreadIndexForThreadStoppedWithSignal (SIGSTOP) != UINT32_MAX) + uint32_t thread_idx = m_thread_list.GetThreadIndexForThreadStoppedWithSignal (SIGSTOP); + if (thread_idx_ptr) + *thread_idx_ptr = thread_idx; + if (thread_idx != UINT32_MAX) return GetState(); // No threads were stopped with a SIGSTOP, we need to run and halt the @@ -401,6 +404,9 @@ DisableAllWatchpoints (true); clear_bps_and_wps = false; } + uint32_t thread_idx = m_thread_list.GetThreadIndexForThreadStoppedWithSignal (SIGSTOP); + if (thread_idx_ptr) + *thread_idx_ptr = thread_idx; return GetState(); } @@ -409,11 +415,22 @@ { DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Detach()"); - nub_state_t state = DoSIGSTOP(true); + uint32_t thread_idx = UINT32_MAX; + nub_state_t state = DoSIGSTOP(true, &thread_idx); DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Detach() DoSIGSTOP() returned %s", DNBStateAsString(state)); { - DNBThreadResumeActions thread_actions (eStateRunning, 0); + DNBThreadResumeActions thread_actions; + DNBThreadResumeAction thread_action; + thread_action.tid = m_thread_list.ThreadIDAtIndex (thread_idx); + thread_action.state = eStateRunning; + thread_action.signal = -1; + thread_action.addr = INVALID_NUB_ADDRESS; + + thread_actions.Append (thread_action); + + thread_actions.SetDefaultThreadActionIfNeeded (eStateRunning, 0); + PTHREAD_MUTEX_LOCKER (locker, m_exception_messages_mutex); ReplyToAllExceptions (thread_actions); @@ -425,9 +442,9 @@ // Detach from our process errno = 0; nub_process_t pid = m_pid; - ::ptrace (PT_DETACH, pid, (caddr_t)1, 0); + int ret = ::ptrace (PT_DETACH, pid, (caddr_t)1, 0); DNBError err(errno, DNBError::POSIX); - if (DNBLogCheckLogBit(LOG_PROCESS) || err.Fail()) + if (DNBLogCheckLogBit(LOG_PROCESS) || err.Fail() || (ret != 0)) err.LogThreaded("::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid); // Resume our task @@ -1546,7 +1563,7 @@ SetState (eStateAttaching); errno = 0; - int err = ptrace (PT_ATTACHEXC, m_pid, 0, 0); + int err = ::ptrace (PT_ATTACHEXC, m_pid, 0, 0); if (err == 0) { m_flags |= eMachProcessFlagsAttached; @@ -1802,7 +1819,7 @@ StartSTDIOThread(); SetState (eStateAttaching); - int err = ptrace (PT_ATTACHEXC, m_pid, 0, 0); + int err = ::ptrace (PT_ATTACHEXC, m_pid, 0, 0); if (err == 0) { m_flags |= eMachProcessFlagsAttached; Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=118018&r1=118017&r2=118018&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Tue Nov 2 11:16:53 2010 @@ -224,7 +224,7 @@ nub_size_t RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, uint8_t *buf) const; uint32_t Flags () const { return m_flags; } - nub_state_t DoSIGSTOP (bool clear_bps_and_wps); + nub_state_t DoSIGSTOP (bool clear_bps_and_wps, uint32_t *thread_idx_ptr = NULL); pid_t m_pid; // Process ID of child process int m_child_stdin; From johnny.chen at apple.com Tue Nov 2 12:06:08 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 02 Nov 2010 17:06:08 -0000 Subject: [Lldb-commits] [lldb] r118021 - /lldb/trunk/test/types/AbstractBase.py Message-ID: <20101102170609.07AA02A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 12:06:08 2010 New Revision: 118021 URL: http://llvm.org/viewvc/llvm-project?rev=118021&view=rev Log: Remove the reference-related variable displays that now pass from the 'notnow' set. The failures that remain are: # rdar://problem/8620735 test/types: frame variable -t a_class_ref.m_b fails # The reference type related failures that remain are: notnow = set(['a_class_ref.m_b', 'a_struct_ref.b', 'a_union_nonzero_ref.u.a']) Modified: lldb/trunk/test/types/AbstractBase.py Modified: lldb/trunk/test/types/AbstractBase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=118021&r1=118020&r2=118021&view=diff ============================================================================== --- lldb/trunk/test/types/AbstractBase.py (original) +++ lldb/trunk/test/types/AbstractBase.py Tue Nov 2 12:06:08 2010 @@ -45,10 +45,17 @@ # # rdar://problem/8471016 frame variable a_ref should display the referenced value as well # rdar://problem/8470987 frame variable a_class_ref.m_a does not work - notnow = set(['a_ref', - 'a_class_ref.m_a', 'a_class_ref.m_b', - 'a_struct_ref.a', 'a_struct_ref.b', - 'a_union_zero_ref.a', 'a_union_nonzero_ref.u.a']) + # notnow = set(['a_ref', + # 'a_class_ref.m_a', 'a_class_ref.m_b', + # 'a_struct_ref.a', 'a_struct_ref.b', + # 'a_union_zero_ref.a', 'a_union_nonzero_ref.u.a']) + # + # rdar://problem/8620735 test/types: frame variable -t a_class_ref.m_b fails + # The reference type related failures that remain are: + notnow = set(['a_class_ref.m_b', + 'a_struct_ref.b', + 'a_union_nonzero_ref.u.a']) + for line in go.split(os.linesep): match = self.pattern.search(line) if match: @@ -93,7 +100,7 @@ substrs = list(atoms)) # The (var, val) pair must match, too. - nv = (" %s = '%s'" if quotedDisplay else " %s = %s") % (var, val) + nv = ("%s = '%s'" if quotedDisplay else "%s = %s") % (var, val) self.expect(output, Msg(var, val), exe=False, substrs = [nv]) From gclayton at apple.com Tue Nov 2 13:23:13 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 18:23:13 -0000 Subject: [Lldb-commits] [lldb] r118033 - /lldb/trunk/source/Commands/CommandObjectApropos.cpp Message-ID: <20101102182313.5C6262A6C12C@llvm.org> Author: gclayton Date: Tue Nov 2 13:23:13 2010 New Revision: 118033 URL: http://llvm.org/viewvc/llvm-project?rev=118033&view=rev Log: Fixed a missing newline when you type "apropos somethingthatdoesnotexist". Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=118033&r1=118032&r2=118033&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Nov 2 13:23:13 2010 @@ -73,7 +73,7 @@ m_interpreter.FindCommandsForApropos (search_word, commands_found, commands_help); if (commands_found.GetSize() == 0) { - result.AppendMessageWithFormat ("No commands found pertaining to '%s'. Try 'help' to see a complete list of debugger commands.", search_word); + result.AppendMessageWithFormat ("No commands found pertaining to '%s'. Try 'help' to see a complete list of debugger commands.\n", search_word); } else { From ctice at apple.com Tue Nov 2 14:00:04 2010 From: ctice at apple.com (Caroline Tice) Date: Tue, 02 Nov 2010 19:00:04 -0000 Subject: [Lldb-commits] [lldb] r118036 - /lldb/trunk/source/Commands/CommandObjectCommands.cpp Message-ID: <20101102190004.D96202A6C12C@llvm.org> Author: ctice Date: Tue Nov 2 14:00:04 2010 New Revision: 118036 URL: http://llvm.org/viewvc/llvm-project?rev=118036&view=rev Log: Fix error message when attempting to generate invalid alias. Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=118036&r1=118035&r2=118036&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Nov 2 14:00:04 2010 @@ -298,8 +298,9 @@ } else { - result.AppendErrorWithFormat ("Error occurred while attempting to look up command '%s %s'.\n", - alias_command.c_str(), sub_command.c_str()); + result.AppendErrorWithFormat("'%s' is not a valid sub-command of '%s'. " + "Unable to create alias.\n", + sub_command.c_str(), actual_command.c_str()); result.SetStatus (eReturnStatusFailed); return false; } @@ -310,18 +311,6 @@ if (args.GetArgumentCount () > 0) { - //if ((!use_subcommand && (cmd_obj->WantsRawCommandString())) - // || (use_subcommand && (sub_cmd_obj->WantsRawCommandString()))) - //{ - // result.AppendErrorWithFormat ("'%s' cannot be aliased with any options or arguments.\n", - // (use_subcommand ? sub_cmd_obj->GetCommandName() - // : cmd_obj->GetCommandName())); - // result.SetStatus (eReturnStatusFailed); - // return false; - //} - - // options or arguments have been passed to the alias command, and must be - // verified & processed here. if ((!use_subcommand && (cmd_obj->GetOptions() != NULL)) || (use_subcommand && (sub_cmd_obj->GetOptions() != NULL))) { From johnny.chen at apple.com Tue Nov 2 14:46:35 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 02 Nov 2010 19:46:35 -0000 Subject: [Lldb-commits] [lldb] r118038 - in /lldb/trunk/test/inlined_breakpoints: ./ Makefile TestInlinedBreakpoints.py basic_type.cpp int.cpp Message-ID: <20101102194635.8540A2A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 14:46:35 2010 New Revision: 118038 URL: http://llvm.org/viewvc/llvm-project?rev=118038&view=rev Log: Add a test case for a bug fixed: rdar://problem/8464339 test/types directory: b basic_type.cpp:171 does not work, while gdb does work It tests that 'breakpoint set -f basic_type.cpp:176' works when int.cpp #include's basic_type.cpp. Added: lldb/trunk/test/inlined_breakpoints/ lldb/trunk/test/inlined_breakpoints/Makefile lldb/trunk/test/inlined_breakpoints/TestInlinedBreakpoints.py lldb/trunk/test/inlined_breakpoints/basic_type.cpp lldb/trunk/test/inlined_breakpoints/int.cpp Added: lldb/trunk/test/inlined_breakpoints/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/inlined_breakpoints/Makefile?rev=118038&view=auto ============================================================================== --- lldb/trunk/test/inlined_breakpoints/Makefile (added) +++ lldb/trunk/test/inlined_breakpoints/Makefile Tue Nov 2 14:46:35 2010 @@ -0,0 +1,5 @@ +LEVEL = ../make + +CXX_SOURCES := int.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/inlined_breakpoints/TestInlinedBreakpoints.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/inlined_breakpoints/TestInlinedBreakpoints.py?rev=118038&view=auto ============================================================================== --- lldb/trunk/test/inlined_breakpoints/TestInlinedBreakpoints.py (added) +++ lldb/trunk/test/inlined_breakpoints/TestInlinedBreakpoints.py Tue Nov 2 14:46:35 2010 @@ -0,0 +1,57 @@ +""" +Test that inlined breakpoints (breakpoint set on a file/line included from +another source file) works correctly. +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class InlinedBreakpointsTestCase(TestBase): + """Bug fixed: rdar://problem/8464339""" + + mydir = "inlined_breakpoints" + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + def test_with_dsym_and_run_command(self): + """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp).""" + self.buildDsym() + self.inlined_breakpoints() + + def test_with_dwarf_and_run_command(self): + """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp).""" + self.buildDwarf() + self.inlined_breakpoints() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line number to break inside basic_type.cpp. + self.line = line_number('basic_type.cpp', '// Set break point at this line.') + + def inlined_breakpoints(self): + """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp).""" + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + self.expect("breakpoint set -f basic_type.cpp -l %d" % self.line, + BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" % + self.line) + + self.runCmd("run", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + # And it should break at basic_type.cpp:176. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['state is stopped', + 'stop reason = breakpoint', + 'basic_type.cpp:%d' % self.line]) + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Added: lldb/trunk/test/inlined_breakpoints/basic_type.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/inlined_breakpoints/basic_type.cpp?rev=118038&view=auto ============================================================================== --- lldb/trunk/test/inlined_breakpoints/basic_type.cpp (added) +++ lldb/trunk/test/inlined_breakpoints/basic_type.cpp Tue Nov 2 14:46:35 2010 @@ -0,0 +1,178 @@ +// This file must have the following defined before it is included: +// T defined to the type to test (int, float, etc) +// T_CSTR a C string representation of the type T ("int", "float") +// T_VALUE_1 defined to a valid initializer value for TEST_TYPE (7 for int, 2.0 for float) +// T_VALUE_2, T_VALUE_3, T_VALUE_4 defined to a valid initializer value for TEST_TYPE that is different from TEST_VALUE_1 +// T_PRINTF_FORMAT defined if T can be printed with printf +// +// An example for integers is below +#if 0 + +#define T int +#define T_CSTR "int" +#define T_VALUE_1 11001110 +#define T_VALUE_2 22002220 +#define T_VALUE_3 33003330 +#define T_VALUE_4 44044440 +#define T_PRINTF_FORMAT "%i" + +#include "basic_type.cpp" + +#endif + +class a_class +{ +public: + a_class (const T& a, const T& b) : + m_a (a), + m_b (b) + { + } + + ~a_class () + { + } + + const T& + get_a() + { + return m_a; + } + + void + set_a (const T& a) + { + m_a = a; + } + + const T& + get_b() + { + return m_b; + } + + void + set_b (const T& b) + { + m_b = b; + } + +protected: + T m_a; + T m_b; +}; + +typedef struct a_struct_tag { + T a; + T b; +} a_struct_t; + + +typedef union a_union_zero_tag { + T a; + double a_double; +} a_union_zero_t; + +typedef struct a_union_nonzero_tag { + double a_double; + a_union_zero_t u; +} a_union_nonzero_t; + + +#include +#include + +void Puts(char const *msg) +{ + puts(msg); +} + +int +main (int argc, char const *argv[]) +{ + T a = T_VALUE_1; + T* a_ptr = &a; + T& a_ref = a; + T a_array_bounded[2] = { T_VALUE_1, T_VALUE_2 }; + T a_array_unbounded[] = { T_VALUE_1, T_VALUE_2 }; + + a_class a_class_instance (T_VALUE_1, T_VALUE_2); + a_class *a_class_ptr = &a_class_instance; + a_class &a_class_ref = a_class_instance; + + a_struct_t a_struct = { T_VALUE_1, T_VALUE_2 }; + a_struct_t *a_struct_ptr = &a_struct; + a_struct_t &a_struct_ref = a_struct; + + // Create a union with type T at offset zero + a_union_zero_t a_union_zero; + a_union_zero.a = T_VALUE_1; + a_union_zero_t *a_union_zero_ptr = &a_union_zero; + a_union_zero_t &a_union_zero_ref = a_union_zero; + + // Create a union with type T at a non-zero offset + a_union_nonzero_t a_union_nonzero; + a_union_nonzero.u.a = T_VALUE_1; + a_union_nonzero_t *a_union_nonzero_ptr = &a_union_nonzero; + a_union_nonzero_t &a_union_nonzero_ref = a_union_nonzero; + + a_struct_t a_struct_array_bounded[2] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }}; + a_struct_t a_struct_array_unbounded[] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }}; + a_union_zero_t a_union_zero_array_bounded[2]; + a_union_zero_array_bounded[0].a = T_VALUE_1; + a_union_zero_array_bounded[1].a = T_VALUE_2; + a_union_zero_t a_union_zero_array_unbounded[] = {{ T_VALUE_1 }, { T_VALUE_2 }}; + +#ifdef T_PRINTF_FORMAT + printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a); + printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr); + printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref); + + printf ("%s[2]: a_array_bounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[0]); + printf ("%s[2]: a_array_bounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[1]); + + printf ("%s[]: a_array_unbounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[0]); + printf ("%s[]: a_array_unbounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[1]); + + printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a()); + printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b()); + printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a()); + printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b()); + printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a()); + printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b()); + + printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a); + printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b); + printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a); + printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b); + printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a); + printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b); + + printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a); + printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a); + printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a); + + printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a); + printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a); + printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a); + + printf ("(a_struct_t[2]) a_struct_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].a); + printf ("(a_struct_t[2]) a_struct_array_bounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].b); + printf ("(a_struct_t[2]) a_struct_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].a); + printf ("(a_struct_t[2]) a_struct_array_bounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].b); + + printf ("(a_struct_t[]) a_struct_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].a); + printf ("(a_struct_t[]) a_struct_array_unbounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].b); + printf ("(a_struct_t[]) a_struct_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].a); + printf ("(a_struct_t[]) a_struct_array_unbounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].b); + + printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[0].a); + printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[1].a); + + printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[0].a); + printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[1].a); + +#endif + Puts("About to exit, break here to check values..."); // Set break point at this line. + return 0; +} Added: lldb/trunk/test/inlined_breakpoints/int.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/inlined_breakpoints/int.cpp?rev=118038&view=auto ============================================================================== --- lldb/trunk/test/inlined_breakpoints/int.cpp (added) +++ lldb/trunk/test/inlined_breakpoints/int.cpp Tue Nov 2 14:46:35 2010 @@ -0,0 +1,9 @@ +#define T int +#define T_CSTR "int" +#define T_VALUE_1 11001110 +#define T_VALUE_2 22002220 +#define T_VALUE_3 33003330 +#define T_VALUE_4 44004440 +#define T_PRINTF_FORMAT "%i" + +#include "basic_type.cpp" From gclayton at apple.com Tue Nov 2 16:21:21 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 02 Nov 2010 21:21:21 -0000 Subject: [Lldb-commits] [lldb] r118070 - /lldb/trunk/source/Core/ValueObjectChild.cpp Message-ID: <20101102212121.1E9F92A6C12C@llvm.org> Author: gclayton Date: Tue Nov 2 16:21:20 2010 New Revision: 118070 URL: http://llvm.org/viewvc/llvm-project?rev=118070&view=rev Log: Fixed a case where children of pointers or references that had had multiple children always incorrectly displayed the child at offset zero. Modified: lldb/trunk/source/Core/ValueObjectChild.cpp Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=118070&r1=118069&r2=118070&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Tue Nov 2 16:21:20 2010 @@ -159,10 +159,7 @@ } else { - // For pointers, m_byte_offset should only ever be set if we - // ValueObject::GetSyntheticArrayMemberFromPointer() was called - if (ClangASTContext::IsPointerType (parent->GetClangType()) && m_byte_offset) - m_value.GetScalar() += m_byte_offset; + m_value.GetScalar() += m_byte_offset; if (value_type == Value::eValueTypeScalar || value_type == Value::eValueTypeFileAddress) m_value.SetValueType (Value::eValueTypeLoadAddress); From johnny.chen at apple.com Tue Nov 2 16:43:50 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 02 Nov 2010 21:43:50 -0000 Subject: [Lldb-commits] [lldb] r118081 - /lldb/trunk/test/types/AbstractBase.py Message-ID: <20101102214350.B60672A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 16:43:50 2010 New Revision: 118081 URL: http://llvm.org/viewvc/llvm-project?rev=118081&view=rev Log: The remaining reference-related variable display failures have been fixed. Comment out the filtering code. The next check in will clean up the test case by wiping off the filtering related logic. Modified: lldb/trunk/test/types/AbstractBase.py Modified: lldb/trunk/test/types/AbstractBase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=118081&r1=118080&r2=118081&view=diff ============================================================================== --- lldb/trunk/test/types/AbstractBase.py (original) +++ lldb/trunk/test/types/AbstractBase.py Tue Nov 2 16:43:50 2010 @@ -52,16 +52,16 @@ # # rdar://problem/8620735 test/types: frame variable -t a_class_ref.m_b fails # The reference type related failures that remain are: - notnow = set(['a_class_ref.m_b', - 'a_struct_ref.b', - 'a_union_nonzero_ref.u.a']) + # notnow = set(['a_class_ref.m_b', + # 'a_struct_ref.b', + # 'a_union_nonzero_ref.u.a']) for line in go.split(os.linesep): match = self.pattern.search(line) if match: var, val = match.group(1), match.group(2) - if var in notnow: - continue + # if var in notnow: + # continue gl.append((var, val)) #print "golden list:", gl @@ -80,7 +80,7 @@ self.runCmd("frame variable -t %s" % var) output = self.res.GetOutput() - # The input type is in a canonical form as a set named atoms. + # The input type is in a canonical form as a set of named atoms. # The display type string must conatin each and every element. # # Example: From johnny.chen at apple.com Tue Nov 2 17:01:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 02 Nov 2010 22:01:38 -0000 Subject: [Lldb-commits] [lldb] r118085 - /lldb/trunk/test/types/AbstractBase.py Message-ID: <20101102220138.160122A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 17:01:37 2010 New Revision: 118085 URL: http://llvm.org/viewvc/llvm-project?rev=118085&view=rev Log: Clean up the test case by removing the filtering code related to fixed radars. Also modify the: self.runCmd("expr %s" % var) to be: self.runCmd("expression %s" % var) since 'expr' is an alias of expression. And fix the assert message to be either 'frame variable -t %s' or 'expression %s'. Modified: lldb/trunk/test/types/AbstractBase.py Modified: lldb/trunk/test/types/AbstractBase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=118085&r1=118084&r2=118085&view=diff ============================================================================== --- lldb/trunk/test/types/AbstractBase.py (original) +++ lldb/trunk/test/types/AbstractBase.py Tue Nov 2 17:01:37 2010 @@ -7,8 +7,9 @@ import lldb from lldbtest import * -def Msg(var, val): - return "'frame variable -t %s' matches the output (from compiled code): %s" % (var, val) +def Msg(var, val, using_frame_variable): + return "'%s %s' matches the output (from compiled code): %s" % ( + 'frame variable -t' if using_frame_variable else 'expression' ,var, val) class GenericTester(TestBase): @@ -33,35 +34,10 @@ # # variable = 'value' # - # Filter out the following lines, for the time being: - # - # 'a_ref = ...' - # 'a_class_ref.m_a = ...' - # 'a_class_ref.m_b = ...' - # 'a_struct_ref.a = ...' - # 'a_struct_ref.b = ...' - # 'a_union_zero_ref.a = ...' - # 'a_union_nonzero_ref.u.a = ...' - # - # rdar://problem/8471016 frame variable a_ref should display the referenced value as well - # rdar://problem/8470987 frame variable a_class_ref.m_a does not work - # notnow = set(['a_ref', - # 'a_class_ref.m_a', 'a_class_ref.m_b', - # 'a_struct_ref.a', 'a_struct_ref.b', - # 'a_union_zero_ref.a', 'a_union_nonzero_ref.u.a']) - # - # rdar://problem/8620735 test/types: frame variable -t a_class_ref.m_b fails - # The reference type related failures that remain are: - # notnow = set(['a_class_ref.m_b', - # 'a_struct_ref.b', - # 'a_union_nonzero_ref.u.a']) - for line in go.split(os.linesep): match = self.pattern.search(line) if match: var, val = match.group(1), match.group(2) - # if var in notnow: - # continue gl.append((var, val)) #print "golden list:", gl @@ -101,7 +77,7 @@ # The (var, val) pair must match, too. nv = ("%s = '%s'" if quotedDisplay else "%s = %s") % (var, val) - self.expect(output, Msg(var, val), exe=False, + self.expect(output, Msg(var, val, True), exe=False, substrs = [nv]) def generic_type_expr_tester(self, atoms, quotedDisplay=False): @@ -137,7 +113,7 @@ # Now iterate through the golden list, comparing against the output from # 'expr var'. for var, val in gl: - self.runCmd("expr %s" % var) + self.runCmd("expression %s" % var) output = self.res.GetOutput() # The input type is in a canonical form as a set named atoms. @@ -161,5 +137,5 @@ # The val part must match, too. valPart = ("'%s'" if quotedDisplay else "%s") % val - self.expect(output, Msg(var, val), exe=False, + self.expect(output, Msg(var, val, False), exe=False, substrs = [valPart]) From scallanan at apple.com Tue Nov 2 18:20:01 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 02 Nov 2010 23:20:01 -0000 Subject: [Lldb-commits] [lldb] r118114 - /lldb/trunk/source/Expression/ClangExpressionParser.cpp Message-ID: <20101102232001.0CB882A6C12D@llvm.org> Author: spyffe Date: Tue Nov 2 18:20:00 2010 New Revision: 118114 URL: http://llvm.org/viewvc/llvm-project?rev=118114&view=rev Log: Fixed a bug that was confusing the code generator on i386 platforms, leading to crashes on simple expressions. Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=118114&r1=118113&r2=118114&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Nov 2 18:20:00 2010 @@ -471,9 +471,7 @@ m_jit_mm = new RecordingMemoryManager(); std::string error_string; - - llvm::Reloc::Model relocation_model = llvm::TargetMachine::getRelocationModel(); - + llvm::TargetMachine::setRelocationModel(llvm::Reloc::PIC_); m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, @@ -482,9 +480,7 @@ CodeGenOpt::Less, true, CodeModel::Small)); - - llvm::TargetMachine::setRelocationModel(relocation_model); - + if (!m_execution_engine.get()) { err.SetErrorToGenericError(); From scallanan at apple.com Tue Nov 2 18:51:18 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 02 Nov 2010 23:51:18 -0000 Subject: [Lldb-commits] [lldb] r118123 - /lldb/trunk/source/Expression/IRForTarget.cpp Message-ID: <20101102235118.1662C2A6C12C@llvm.org> Author: spyffe Date: Tue Nov 2 18:51:17 2010 New Revision: 118123 URL: http://llvm.org/viewvc/llvm-project?rev=118123&view=rev Log: Fixed a bug where we left a definition hanging for a global variable that we had replaced with a reference to a slot in the input array. Modified: lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=118123&r1=118122&r2=118123&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Nov 2 18:51:17 2010 @@ -1103,6 +1103,9 @@ UnfoldConstant(constant, bit_cast, first_entry_instruction); else value->replaceAllUsesWith(bit_cast); + + if (GlobalVariable *var = dyn_cast(value)) + var->eraseFromParent(); } if (log) From johnny.chen at apple.com Tue Nov 2 19:09:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 00:09:38 -0000 Subject: [Lldb-commits] [lldb] r118129 - /lldb/trunk/test/lldbtest.py Message-ID: <20101103000938.E0BF02A6C12C@llvm.org> Author: johnny Date: Tue Nov 2 19:09:38 2010 New Revision: 118129 URL: http://llvm.org/viewvc/llvm-project?rev=118129&view=rev Log: Add more comment for dumpSessionInfo(self) method. Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=118129&r1=118128&r2=118129&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Tue Nov 2 19:09:38 2010 @@ -517,6 +517,13 @@ Dump the debugger interactions leading to a test error/failure. This allows for more convenient postmortem analysis. """ + + # We are here because self.tearDown() detected that this test instance + # either errored or failed. The lldb.test_result singleton contains + # two lists (erros and failures) which get populated by the unittest + # framework. Look over there for stack trace information. + # + # See http://docs.python.org/library/unittest.html#unittest.TestResult. for test, err in lldb.test_result.errors: if test is self: print >> self.session, err From scallanan at apple.com Tue Nov 2 20:37:53 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 03 Nov 2010 01:37:53 -0000 Subject: [Lldb-commits] [lldb] r118142 - in /lldb/trunk: include/lldb/Target/ThreadPlanCallFunction.h source/Target/ThreadPlanCallFunction.cpp Message-ID: <20101103013753.25C492A6C12C@llvm.org> Author: spyffe Date: Tue Nov 2 20:37:52 2010 New Revision: 118142 URL: http://llvm.org/viewvc/llvm-project?rev=118142&view=rev Log: Modified the thread plan that calls functions to set breakpoints at the different locations where an exception could be thrown, so that exceptions thrown by expressions are properly caught. Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=118142&r1=118141&r2=118142&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Tue Nov 2 20:37:52 2010 @@ -77,6 +77,12 @@ protected: private: + void + SetBreakpoints (); + + void + ClearBreakpoints (); + bool m_use_abi; bool m_valid; bool m_stop_other_threads; @@ -88,6 +94,9 @@ Thread &m_thread; Thread::RegisterCheckpoint m_register_backup; lldb::ThreadPlanSP m_subplan_sp; + lldb::BreakpointSP m_cxx_exception_bp_sp; + lldb::BreakpointSP m_cxx_exception_alloc_bp_sp; + lldb::BreakpointSP m_objc_exception_bp_sp; DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction); }; Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118142&r1=118141&r2=118142&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Tue Nov 2 20:37:52 2010 @@ -12,6 +12,7 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "llvm/Support/MachO.h" // Project includes #include "lldb/lldb-private-log.h" #include "lldb/Breakpoint/Breakpoint.h" @@ -52,10 +53,12 @@ Process& process = thread.GetProcess(); Target& target = process.GetTarget(); const ABI *abi = process.GetABI(); - + if (!abi) return; - + + SetBreakpoints(); + lldb::addr_t spBelowRedZone = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); SymbolContextList contexts; @@ -111,6 +114,8 @@ if(!abi) return; + SetBreakpoints(); + lldb::addr_t spBelowRedZone = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); SymbolContextList contexts; @@ -173,7 +178,7 @@ bool ThreadPlanCallFunction::PlanExplainsStop () -{ +{ // If our subplan knows why we stopped, even if it's done (which would forward the question to us) // we answer yes. if(m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop()) @@ -186,6 +191,7 @@ // Otherwise, check the case where we stopped for an internal breakpoint, in that case, continue on. // If it is not an internal breakpoint, consult OkayToDiscard. lldb::StopInfoSP stop_info_sp = GetPrivateStopReason(); + if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint) { uint64_t break_site_id = stop_info_sp->GetValue(); @@ -196,7 +202,24 @@ bool is_internal = true; for (uint32_t i = 0; i < num_owners; i++) { - if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal()) + Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint(); + break_id_t bid = bp.GetID(); + + // Check if the breakpoint is one of ours. + + if (m_cxx_exception_bp_sp.get() && + bid == m_cxx_exception_bp_sp->GetID()) + return true; + + if (m_cxx_exception_alloc_bp_sp.get() && + bid == m_cxx_exception_alloc_bp_sp->GetID()) + return true; + + if (m_objc_exception_bp_sp.get() && + bid == m_objc_exception_bp_sp->GetID()) + return true; + + if (!bp.IsInternal()) { is_internal = false; break; @@ -242,6 +265,8 @@ m_thread.RestoreSaveFrameZero(m_register_backup); m_thread.ClearStackFrames(); SetPlanComplete(); + + ClearBreakpoints(); return true; } else @@ -309,3 +334,67 @@ return false; } } + +void +ThreadPlanCallFunction::SetBreakpoints () +{ + Target& target = m_process.GetTarget(); + + ArchSpec arch_spec = target.GetArchitecture(); + + // A temporary fix to set breakpoints at points where exceptions are being + // thrown. This functionality will migrate into the Target. + switch (arch_spec.GetCPUType()) + { + default: + break; + case llvm::MachO::CPUTypeI386: + m_cxx_exception_bp_sp = target.CreateBreakpoint (NULL, + "__cxa_throw", + eFunctionNameTypeBase, + true); + m_cxx_exception_alloc_bp_sp = target.CreateBreakpoint (NULL, + "__cxa_allocate", + eFunctionNameTypeBase, + true); + m_objc_exception_bp_sp = target.CreateBreakpoint (NULL, + "objc_exception_throw", + eFunctionNameTypeBase, + true); + break; + case llvm::MachO::CPUTypeX86_64: + m_cxx_exception_bp_sp = target.CreateBreakpoint (NULL, + "__cxa_throw", + eFunctionNameTypeBase, + true); + m_cxx_exception_alloc_bp_sp = target.CreateBreakpoint (NULL, + "__cxa_allocate", + eFunctionNameTypeBase, + true); + break; + } +} + +void +ThreadPlanCallFunction::ClearBreakpoints () +{ + Target& target = m_process.GetTarget(); + + if (m_cxx_exception_bp_sp.get()) + { + target.RemoveBreakpointByID(m_cxx_exception_bp_sp->GetID()); + m_cxx_exception_bp_sp.reset(); + } + + if (m_cxx_exception_alloc_bp_sp.get()) + { + target.RemoveBreakpointByID(m_cxx_exception_alloc_bp_sp->GetID()); + m_cxx_exception_bp_sp.reset(); + } + + if (m_objc_exception_bp_sp.get()) + { + target.RemoveBreakpointByID(m_objc_exception_bp_sp->GetID()); + m_cxx_exception_bp_sp.reset(); + } +} From gclayton at apple.com Tue Nov 2 23:08:06 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 03 Nov 2010 04:08:06 -0000 Subject: [Lldb-commits] [lldb] r118147 - in /lldb/trunk: include/lldb/lldb-private-log.h lldb.xcodeproj/project.pbxproj source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h source/lldb-log.cpp Message-ID: <20101103040807.088C72A6C12C@llvm.org> Author: gclayton Date: Tue Nov 2 23:08:06 2010 New Revision: 118147 URL: http://llvm.org/viewvc/llvm-project?rev=118147&view=rev Log: Fixed shared library unloads when the unloaded library doesn't come off the end of the list. We had an issue in the MacOSX dynamic loader where if we had shlibs: 1 - a.out 2 - a.dylib 3 - b.dylib And then a.dylib got unloaded, we would unload b.dylib due to the assumption that only shared libraries could come off the end of the list. We now properly search and find which ones get loaded. Added a new internal logging category for the "lldb" log channel named "dyld". This should allow all dynamic loaders to use this as a generic log channel so we can track shared library loads and unloads in the logs without having to have each plug-in make up its own logging channel. Removed: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h Modified: lldb/trunk/include/lldb/lldb-private-log.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=118147&r1=118146&r2=118147&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Tue Nov 2 23:08:06 2010 @@ -36,6 +36,7 @@ #define LIBLLDB_LOG_HOST (1u << 14) #define LIBLLDB_LOG_UNWIND (1u << 15) #define LIBLLDB_LOG_API (1u << 16) +#define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 17) #define LIBLLDB_LOG_ALL (UINT32_MAX) #define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ LIBLLDB_LOG_THREAD |\ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118147&r1=118146&r2=118147&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 2 23:08:06 2010 @@ -195,7 +195,6 @@ 26D5B0F211B07550009A862E /* ThreadPlanStepThrough.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */; }; 26D5B0F311B07550009A862E /* ThreadPlanStepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847610F50EFC00BB2B04 /* ThreadPlanStepRange.cpp */; }; 26D5B0F411B07550009A862E /* DynamicLoaderMacOSXDYLD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C897A10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.cpp */; }; - 26D5B0F511B07550009A862E /* DynamicLoaderMacOSXDYLDLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C897C10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLDLog.cpp */; }; 26D5B0F611B07550009A862E /* ObjectContainerUniversalMachO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C898010F57C5600BB2B04 /* ObjectContainerUniversalMachO.cpp */; }; 26D5B0F711B07550009A862E /* ObjectFileELF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */; }; 26D5B0F811B07550009A862E /* ObjectFileMachO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */; }; @@ -436,8 +435,6 @@ 260C897510F57C5600BB2B04 /* DisassemblerLLVM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisassemblerLLVM.h; sourceTree = ""; }; 260C897A10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLoaderMacOSXDYLD.cpp; sourceTree = ""; }; 260C897B10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderMacOSXDYLD.h; sourceTree = ""; }; - 260C897C10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLDLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLoaderMacOSXDYLDLog.cpp; sourceTree = ""; }; - 260C897D10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLDLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderMacOSXDYLDLog.h; sourceTree = ""; }; 260C898010F57C5600BB2B04 /* ObjectContainerUniversalMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectContainerUniversalMachO.cpp; sourceTree = ""; }; 260C898110F57C5600BB2B04 /* ObjectContainerUniversalMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectContainerUniversalMachO.h; sourceTree = ""; }; 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileELF.cpp; sourceTree = ""; }; @@ -1237,8 +1234,6 @@ children = ( 260C897B10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.h */, 260C897A10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.cpp */, - 260C897D10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLDLog.h */, - 260C897C10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLDLog.cpp */, ); path = "MacOSX-DYLD"; sourceTree = ""; @@ -2680,7 +2675,6 @@ 26D5B0F211B07550009A862E /* ThreadPlanStepThrough.cpp in Sources */, 26D5B0F311B07550009A862E /* ThreadPlanStepRange.cpp in Sources */, 26D5B0F411B07550009A862E /* DynamicLoaderMacOSXDYLD.cpp in Sources */, - 26D5B0F511B07550009A862E /* DynamicLoaderMacOSXDYLDLog.cpp in Sources */, 26D5B0F611B07550009A862E /* ObjectContainerUniversalMachO.cpp in Sources */, 26D5B0F711B07550009A862E /* ObjectFileELF.cpp in Sources */, 26D5B0F811B07550009A862E /* ObjectFileMachO.cpp in Sources */, Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=118147&r1=118146&r2=118147&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Nov 2 23:08:06 2010 @@ -23,7 +23,6 @@ #include "lldb/Target/StackFrame.h" #include "DynamicLoaderMacOSXDYLD.h" -#include "DynamicLoaderMacOSXDYLDLog.h" //#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN #ifdef ENABLE_DEBUG_PRINTF @@ -501,6 +500,7 @@ uint32_t DynamicLoaderMacOSXDYLD::UpdateAllImageInfos() { + Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER); if (ReadAllImageInfosStructure ()) { Mutex::Locker locker(m_mutex); @@ -566,18 +566,45 @@ if (m_dyld_image_infos.size() < old_dyld_all_image_infos.size()) { ModuleList unloaded_module_list; - for (idx = m_dyld_image_infos.size(); idx < old_dyld_all_image_infos.size(); ++idx) + uint32_t old_idx; + for (idx = 0; idx < old_dyld_all_image_infos.size(); ++idx) { - ModuleSP unload_image_module_sp(m_process->GetTarget().GetImages().FindFirstModuleForFileSpec (old_dyld_all_image_infos[idx].file_spec)); - if (unload_image_module_sp.get()) + for (old_idx = idx; old_idx < old_dyld_all_image_infos.size(); ++old_idx) { - if (UnloadImageLoadAddress (unload_image_module_sp.get(), old_dyld_all_image_infos[idx])) - unloaded_module_list.AppendInNeeded (unload_image_module_sp); + if (m_dyld_image_infos[idx].file_spec == old_dyld_all_image_infos[old_idx].file_spec) + { + old_dyld_all_image_infos[old_idx].address = LLDB_INVALID_ADDRESS; + break; + } + } + } + + if (log) + log->PutCString("Unloaded:"); + + for (old_idx = 0; old_idx < old_dyld_all_image_infos.size(); ++old_idx) + { + if (old_dyld_all_image_infos[old_idx].address != LLDB_INVALID_ADDRESS) + { + if (log) + old_dyld_all_image_infos[old_idx].PutToLog (log); + ModuleSP unload_image_module_sp(m_process->GetTarget().GetImages().FindFirstModuleForFileSpec (old_dyld_all_image_infos[old_idx].file_spec)); + if (unload_image_module_sp.get()) + { + if (UnloadImageLoadAddress (unload_image_module_sp.get(), old_dyld_all_image_infos[old_idx])) + unloaded_module_list.AppendInNeeded (unload_image_module_sp); + } } } + if (unloaded_module_list.GetSize() > 0) m_process->GetTarget().ModulesDidUnload (unloaded_module_list); } + else + { + if (log) + PutToLog(log); + } } else { @@ -640,7 +667,6 @@ } } } - PutToLog(DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (1)); if (loaded_module_list.GetSize() > 0) { // FIXME: This should really be in the Runtime handlers class, which should get @@ -960,7 +986,7 @@ const size_t count = m_dyld_image_infos.size(); if (count > 0) { - log->Printf("\tdyld_image_infos"); + log->PutCString("Loaded:"); for (i = 0; iGetMask().SetAllFlagBits(0xffffffffu); -// g_log->GetOptions().Set(LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_THREAD_NAME); -// } - } - else - { - if (g_log) - delete g_log; - g_log = log; - } - - return g_log; -} - -Log * -DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (uint32_t mask) -{ - Log *log = LogAccessor (true, NULL); - if (log && mask) - { - uint32_t log_mask = log->GetMask().Get(); - if ((log_mask & mask) != mask) - return NULL; - } - return log; -} - -void -DynamicLoaderMacOSXDYLDLog::SetLog (Log *log) -{ - LogAccessor (false, log); -} - - -void -DynamicLoaderMacOSXDYLDLog::LogIf (uint32_t mask, const char *format, ...) -{ - Log *log = DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (mask); - if (log) - { - va_list args; - va_start (args, format); - log->VAPrintf (format, args); - va_end (args); - } -} Removed: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h?rev=118146&view=auto ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.h (removed) @@ -1,34 +0,0 @@ -//===-- DynamicLoaderMacOSXDYLDLog.h ----------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_DynamicLoaderMacOSXDYLDLog_h_ -#define liblldb_DynamicLoaderMacOSXDYLDLog_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes - -#include "lldb/lldb-private.h" - -// Project includes - -class DynamicLoaderMacOSXDYLDLog -{ -public: - static lldb_private::Log * - GetLogIfAllCategoriesSet (uint32_t mask); - - static void - SetLog (lldb_private::Log *log); - - static void - LogIf (uint32_t mask, const char *format, ...); -}; - -#endif // liblldb_DynamicLoaderMacOSXDYLDLog_h_ Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=118147&r1=118146&r2=118147&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Tue Nov 2 23:08:06 2010 @@ -124,6 +124,7 @@ else if (strcasecmp(arg, "api") == 0) flag_bits &= ~LIBLLDB_LOG_API; else if (strcasestr(arg, "break") == arg) flag_bits &= ~LIBLLDB_LOG_BREAKPOINTS; else if (strcasecmp(arg, "default") == 0 ) flag_bits &= ~LIBLLDB_LOG_DEFAULT; + else if (strcasecmp(arg, "dyld") == 0 ) flag_bits &= ~LIBLLDB_LOG_DYNAMIC_LOADER; else if (strcasestr(arg, "event") == arg) flag_bits &= ~LIBLLDB_LOG_EVENTS; else if (strcasestr(arg, "expr") == arg) flag_bits &= ~LIBLLDB_LOG_EXPRESSIONS; else if (strcasestr(arg, "object") == arg) flag_bits &= ~LIBLLDB_LOG_OBJECT; @@ -182,6 +183,7 @@ else if (strcasecmp(arg, "api") == 0) flag_bits |= LIBLLDB_LOG_API; else if (strcasestr(arg, "break") == arg) flag_bits |= LIBLLDB_LOG_BREAKPOINTS; else if (strcasecmp(arg, "default") == 0 ) flag_bits |= LIBLLDB_LOG_DEFAULT; + else if (strcasecmp(arg, "dyld") == 0 ) flag_bits |= LIBLLDB_LOG_DYNAMIC_LOADER; else if (strcasestr(arg, "event") == arg) flag_bits |= LIBLLDB_LOG_EVENTS; else if (strcasestr(arg, "expr") == arg) flag_bits |= LIBLLDB_LOG_EXPRESSIONS; else if (strcasestr(arg, "object") == arg) flag_bits |= LIBLLDB_LOG_OBJECT; From johnny.chen at apple.com Wed Nov 3 12:05:35 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 17:05:35 -0000 Subject: [Lldb-commits] [lldb] r118179 - /lldb/trunk/test/load_unload/TestLoadUnload.py Message-ID: <20101103170535.26DFE2A6C12C@llvm.org> Author: johnny Date: Wed Nov 3 12:05:34 2010 New Revision: 118179 URL: http://llvm.org/viewvc/llvm-project?rev=118179&view=rev Log: Remove the @expectedFailure decorator. The bug rdar://problem/8508987 has been fixed. Modified: lldb/trunk/test/load_unload/TestLoadUnload.py Modified: lldb/trunk/test/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=118179&r1=118178&r2=118179&view=diff ============================================================================== --- lldb/trunk/test/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/test/load_unload/TestLoadUnload.py Wed Nov 3 12:05:34 2010 @@ -11,7 +11,6 @@ mydir = "load_unload" - # rdar://problem/8508987 @unittest2.expectedFailure def test_load_unload(self): """Test breakpoint by name works correctly with dlopen'ing.""" From johnny.chen at apple.com Wed Nov 3 12:12:54 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 17:12:54 -0000 Subject: [Lldb-commits] [lldb] r118180 - /lldb/trunk/test/load_unload/TestLoadUnload.py Message-ID: <20101103171254.C4A802A6C12C@llvm.org> Author: johnny Date: Wed Nov 3 12:12:54 2010 New Revision: 118180 URL: http://llvm.org/viewvc/llvm-project?rev=118180&view=rev Log: Really remove the @expectedFailure decorator this time. Modified: lldb/trunk/test/load_unload/TestLoadUnload.py Modified: lldb/trunk/test/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=118180&r1=118179&r2=118180&view=diff ============================================================================== --- lldb/trunk/test/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/test/load_unload/TestLoadUnload.py Wed Nov 3 12:12:54 2010 @@ -11,7 +11,6 @@ mydir = "load_unload" - @unittest2.expectedFailure def test_load_unload(self): """Test breakpoint by name works correctly with dlopen'ing.""" From johnny.chen at apple.com Wed Nov 3 13:17:03 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 18:17:03 -0000 Subject: [Lldb-commits] [lldb] r118185 - in /lldb/trunk/test: dotest.py lldbtest.py Message-ID: <20101103181703.2BFBC2A6C12E@llvm.org> Author: johnny Date: Wed Nov 3 13:17:03 2010 New Revision: 118185 URL: http://llvm.org/viewvc/llvm-project?rev=118185&view=rev Log: Now that the test suite has very few expected failures remaining (2), it is a good idea to also dump the session information for expected failures in addition to failures and errors (tests with unexpected exceptions). Modify the LLDBTestResult class which derives from unittest2.TextTestResult to intercept the addExpectedFailure() method in order to mark the test instance as needing its session information dumped. Modified: lldb/trunk/test/dotest.py lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=118185&r1=118184&r2=118185&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Wed Nov 3 13:17:03 2010 @@ -698,6 +698,14 @@ if method: method() + def addExpectedFailure(self, test, err): + global sdir_has_content + sdir_has_content = True + super(LLDBTestResult, self).addExpectedFailure(test, err) + method = getattr(test, "markExpectedFailure", None) + if method: + method() + result = unittest2.TextTestRunner(stream=sys.stderr, verbosity=verbose, resultclass=LLDBTestResult).run(suite) Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=118185&r1=118184&r2=118185&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Wed Nov 3 13:17:03 2010 @@ -485,12 +485,13 @@ # test case specific file if test failure is encountered. self.session = StringIO.StringIO() - # Optimistically set self.__errored__ and self.__failed__ to False + # Optimistically set __errored__, __failed__, __expected__ to False # initially. If the test errored/failed, the session info # (self.session) is then dumped into a session specific file for # diagnosis. self.__errored__ = False self.__failed__ = False + self.__expected__ = False # See addTearDownHook(self, hook) which allows the client to add a hook # function to be run during tearDown() time. @@ -512,10 +513,24 @@ # Once by the Python unittest framework, and a second time by us. print >> sbuf, "FAIL" + def markExpectedFailure(self): + """Callback invoked when an expected failure/error occurred.""" + self.__expected__ = True + with recording(self, False) as sbuf: + # False because there's no need to write "expected failure" to the + # stderr twice. + # Once by the Python unittest framework, and a second time by us. + print >> sbuf, "expected failure" + def dumpSessionInfo(self): """ Dump the debugger interactions leading to a test error/failure. This allows for more convenient postmortem analysis. + + See also LLDBTestResult (dotest.py) which is a singlton class derived + from TextTestResult and overwrites addError, addFailure, and + addExpectedFailure methods to allow us to to mark the test instance as + such. """ # We are here because self.tearDown() detected that this test instance @@ -523,13 +538,23 @@ # two lists (erros and failures) which get populated by the unittest # framework. Look over there for stack trace information. # + # The lists contain 2-tuples of TestCase instances and strings holding + # formatted tracebacks. + # # See http://docs.python.org/library/unittest.html#unittest.TestResult. - for test, err in lldb.test_result.errors: - if test is self: - print >> self.session, err - for test, err in lldb.test_result.failures: + if self.__errored__: + pairs = lldb.test_result.errors + elif self.__failed__: + pairs = lldb.test_result.failures + elif self.__expected__: + pairs = lldb.test_result.expectedFailures + else: + # Simply return, there's no session info to dump! + return + + for test, traceback in pairs: if test is self: - print >> self.session, err + print >> self.session, traceback dname = os.path.join(os.environ["LLDB_TEST"], os.environ["LLDB_SESSION_DIRNAME"]) @@ -584,11 +609,8 @@ if not module.cleanup(self, dictionary=self.dict): raise Exception("Don't know how to do cleanup") - # See also LLDBTestResult (dotest.py) which is a singlton class derived - # from TextTestResult and overwrites addError()/addFailure() methods to - # allow us to to check the error/failure status here. - if self.__errored__ or self.__failed__: - self.dumpSessionInfo() + # We always dump the session infos for failures/errors. + self.dumpSessionInfo() def runCmd(self, cmd, msg=None, check=True, trace=False, setCookie=True): """ From scallanan at apple.com Wed Nov 3 14:36:28 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 03 Nov 2010 19:36:28 -0000 Subject: [Lldb-commits] [lldb] r118189 - in /lldb/trunk: include/lldb/Target/ThreadPlan.h include/lldb/Target/ThreadPlanCallFunction.h source/Expression/ClangFunction.cpp source/Target/ThreadPlanCallFunction.cpp Message-ID: <20101103193628.E50D32A6C12C@llvm.org> Author: spyffe Date: Wed Nov 3 14:36:28 2010 New Revision: 118189 URL: http://llvm.org/viewvc/llvm-project?rev=118189&view=rev Log: Modified ThreadPlanCallFunction to perform the exception checks at the right time, and modified ClangFunction so that it doesn't misinterpret the stop as a timeout stop. Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=118189&r1=118188&r2=118189&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlan.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlan.h Wed Nov 3 14:36:28 2010 @@ -319,18 +319,18 @@ { return m_kind; } + + bool + IsPlanComplete(); + + void + SetPlanComplete (); protected: //------------------------------------------------------------------ // Classes that inherit from ThreadPlan can see and modify these //------------------------------------------------------------------ - bool - IsPlanComplete(); - - void - SetPlanComplete (); - // This gets the previous plan to the current plan (for forwarding requests). // This is mostly a formal requirement, it allows us to make the Thread's // GetPreviousPlan protected, but only friend ThreadPlan to thread. Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=118189&r1=118188&r2=118189&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Wed Nov 3 14:36:28 2010 @@ -83,6 +83,9 @@ void ClearBreakpoints (); + bool + BreakpointsExplainStop (); + bool m_use_abi; bool m_valid; bool m_stop_other_threads; Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=118189&r1=118188&r2=118189&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Wed Nov 3 14:36:28 2010 @@ -538,7 +538,7 @@ // Now wait for the process to stop again: bool got_event = listener.WaitForEvent (timeout_ptr, event_sp); - if (!got_event) + if (!got_event && !call_plan_sp->IsPlanComplete()) { // Right now this is the only way to tell we've timed out... // We should interrupt the process here... Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118189&r1=118188&r2=118189&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Nov 3 14:36:28 2010 @@ -184,6 +184,11 @@ if(m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop()) return true; + // Check if the breakpoint is one of ours. + + if (BreakpointsExplainStop()) + return true; + // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack. if (!OkayToDiscard()) return false; @@ -203,21 +208,6 @@ for (uint32_t i = 0; i < num_owners; i++) { Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint(); - break_id_t bid = bp.GetID(); - - // Check if the breakpoint is one of ours. - - if (m_cxx_exception_bp_sp.get() && - bid == m_cxx_exception_bp_sp->GetID()) - return true; - - if (m_cxx_exception_alloc_bp_sp.get() && - bid == m_cxx_exception_alloc_bp_sp->GetID()) - return true; - - if (m_objc_exception_bp_sp.get() && - bid == m_objc_exception_bp_sp->GetID()) - return true; if (!bp.IsInternal()) { @@ -342,8 +332,6 @@ ArchSpec arch_spec = target.GetArchitecture(); - // A temporary fix to set breakpoints at points where exceptions are being - // thrown. This functionality will migrate into the Target. switch (arch_spec.GetCPUType()) { default: @@ -398,3 +386,64 @@ m_cxx_exception_bp_sp.reset(); } } + +bool +ThreadPlanCallFunction::BreakpointsExplainStop() +{ + // A temporary fix to set breakpoints at points where exceptions are being + // thrown. This functionality will migrate into the Target. + + lldb::StopInfoSP stop_info_sp = GetPrivateStopReason(); + + if (!stop_info_sp || + stop_info_sp->GetStopReason() != eStopReasonBreakpoint) + return false; + + uint64_t break_site_id = stop_info_sp->GetValue(); + lldb::BreakpointSiteSP bp_site_sp = m_thread.GetProcess().GetBreakpointSiteList().FindByID(break_site_id); + + if (!bp_site_sp) + return false; + + uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); + + bool check_cxx_exception = false; + break_id_t cxx_exception_bid; + + bool check_cxx_exception_alloc = false; + break_id_t cxx_exception_alloc_bid; + + bool check_objc_exception = false; + break_id_t objc_exception_bid; + + if (m_cxx_exception_bp_sp.get()) + { + check_cxx_exception = true; + cxx_exception_bid = m_cxx_exception_bp_sp->GetID(); + } + + if (m_cxx_exception_bp_sp.get()) + { + check_cxx_exception_alloc = true; + cxx_exception_alloc_bid = m_cxx_exception_alloc_bp_sp->GetID(); + } + + if (m_cxx_exception_bp_sp.get()) + { + check_objc_exception = true; + objc_exception_bid = m_objc_exception_bp_sp->GetID(); + } + + + for (uint32_t i = 0; i < num_owners; i++) + { + break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); + + if ((check_cxx_exception && (bid == cxx_exception_bid)) || + (check_cxx_exception_alloc && (bid == cxx_exception_alloc_bid)) || + (check_objc_exception && (bid == objc_exception_bid))) + return true; + } + + return false; +} From johnny.chen at apple.com Wed Nov 3 16:10:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 21:10:38 -0000 Subject: [Lldb-commits] [lldb] r118196 - /lldb/trunk/include/lldb/lldb-enumerations.h Message-ID: <20101103211038.B659B2A6C12C@llvm.org> Author: johnny Date: Wed Nov 3 16:10:38 2010 New Revision: 118196 URL: http://llvm.org/viewvc/llvm-project?rev=118196&view=rev Log: Fix comment about eValueTypeConstResult. Modified: lldb/trunk/include/lldb/lldb-enumerations.h Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=118196&r1=118195&r2=118196&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Nov 3 16:10:38 2010 @@ -312,7 +312,7 @@ eValueTypeVariableLocal = 4, // function local variables eValueTypeRegister = 5, // stack frame register value eValueTypeRegisterSet = 6, // A collection of stack frame register values - eValueTypeConstResult = 7, // function local variables + eValueTypeConstResult = 7, // constant result variables } ValueType; //---------------------------------------------------------------------- From johnny.chen at apple.com Wed Nov 3 16:37:58 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 21:37:58 -0000 Subject: [Lldb-commits] [lldb] r118197 - in /lldb/trunk/test: array_types/TestArrayTypes.py lldbtest.py lldbutil.py Message-ID: <20101103213758.9FE0E2A6C12F@llvm.org> Author: johnny Date: Wed Nov 3 16:37:58 2010 New Revision: 118197 URL: http://llvm.org/viewvc/llvm-project?rev=118197&view=rev Log: Add a test for Python API SBValue.GetValueType() inside TestArrayTypes.py for a local variable and an argument variable. Add ValueTypeString() utility function into lldbutil.py which converts the enum into a human readable string. Modify TestBase.DebugSBValue() to also dump the value type of an SBValue object. Modified: lldb/trunk/test/array_types/TestArrayTypes.py lldb/trunk/test/lldbtest.py lldb/trunk/test/lldbutil.py Modified: lldb/trunk/test/array_types/TestArrayTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=118197&r1=118196&r2=118197&view=diff ============================================================================== --- lldb/trunk/test/array_types/TestArrayTypes.py (original) +++ lldb/trunk/test/array_types/TestArrayTypes.py Wed Nov 3 16:37:58 2010 @@ -195,6 +195,18 @@ self.assertTrue(long(child5.GetValue(frame), 0) == 6, "long_6[5] == 6") + # Last, check that "long_6" has a value type of eValueTypeVariableLocal + # and "argc" has eValueTypeVariableArgument. + from lldbutil import ValueTypeString + self.assertTrue(variable.GetValueType() == lldb.eValueTypeVariableLocal, + "Variable 'long_6' should have '%s' value type." % + ValueTypeString(lldb.eValueTypeVariableLocal)) + argc = frame.LookupVar("argc") + self.DebugSBValue(frame, argc) + self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument, + "Variable 'argc' should have '%s' value type." % + ValueTypeString(lldb.eValueTypeVariableArgument)) + if __name__ == '__main__': import atexit Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=118197&r1=118196&r2=118197&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Wed Nov 3 16:37:58 2010 @@ -814,6 +814,8 @@ def DebugSBValue(self, frame, val): """Debug print a SBValue object, if traceAlways is True.""" + from lldbutil import ValueTypeString + if not traceAlways: return @@ -823,6 +825,7 @@ err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n') err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n') err.write('\t' + "Value -> " + str(val.GetValue(frame)) + '\n') + err.write('\t' + "ValueType -> " + ValueTypeString(val.GetValueType()) + '\n') err.write('\t' + "Summary -> " + str(val.GetSummary(frame)) + '\n') err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n') err.write('\t' + "Location -> " + val.GetLocation(frame) + '\n') Modified: lldb/trunk/test/lldbutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=118197&r1=118196&r2=118197&view=diff ============================================================================== --- lldb/trunk/test/lldbutil.py (original) +++ lldb/trunk/test/lldbutil.py Wed Nov 3 16:37:58 2010 @@ -83,6 +83,27 @@ else: raise Exception("Unknown stopReason enum") +def ValueTypeString(enum): + """Returns the valueType string given an enum.""" + if enum == lldb.eValueTypeInvalid: + return "invalid" + elif enum == lldb.eValueTypeVariableGlobal: + return "global_variable" + elif enum == lldb.eValueTypeVariableStatic: + return "static_variable" + elif enum == lldb.eValueTypeVariableArgument: + return "argument_variable" + elif enum == lldb.eValueTypeVariableLocal: + return "local_variable" + elif enum == lldb.eValueTypeRegister: + return "register" + elif enum == lldb.eValueTypeRegisterSet: + return "register_set" + elif enum == lldb.eValueTypeConstResult: + return "constant_result" + else: + raise Exception("Unknown valueType enum") + # ================================================== # Utility functions related to Threads and Processes From johnny.chen at apple.com Wed Nov 3 17:00:28 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 03 Nov 2010 22:00:28 -0000 Subject: [Lldb-commits] [lldb] r118198 - in /lldb/trunk/test/conditional_break: TestConditionalBreak.py main.c Message-ID: <20101103220028.E67332A6C12C@llvm.org> Author: johnny Date: Wed Nov 3 17:00:28 2010 New Revision: 118198 URL: http://llvm.org/viewvc/llvm-project?rev=118198&view=rev Log: Fix an incorrect comment in main.c and TestConditionalBreak.py. It should be c's parent frame being a instead of the other way around. Modified: lldb/trunk/test/conditional_break/TestConditionalBreak.py lldb/trunk/test/conditional_break/main.c Modified: lldb/trunk/test/conditional_break/TestConditionalBreak.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/TestConditionalBreak.py?rev=118198&r1=118197&r2=118198&view=diff ============================================================================== --- lldb/trunk/test/conditional_break/TestConditionalBreak.py (original) +++ lldb/trunk/test/conditional_break/TestConditionalBreak.py Wed Nov 3 17:00:28 2010 @@ -61,7 +61,7 @@ # Find the line number where a's parent frame function is c. line = line_number('main.c', - "// Find the line number where a's parent frame function is c here.") + "// Find the line number where c's parent frame is a here.") # Suppose we are only interested in the call scenario where c()'s # immediate caller is a() and we want to find out the value passed from Modified: lldb/trunk/test/conditional_break/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/main.c?rev=118198&r1=118197&r2=118198&view=diff ============================================================================== --- lldb/trunk/test/conditional_break/main.c (original) +++ lldb/trunk/test/conditional_break/main.c Wed Nov 3 17:00:28 2010 @@ -24,7 +24,7 @@ if (val <= 1) return b(val); else if (val >= 3) - return c(val); // Find the line number where a's parent frame function is c here. + return c(val); // Find the line number where c's parent frame is a here. return val; } From scallanan at apple.com Wed Nov 3 17:19:38 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 03 Nov 2010 22:19:38 -0000 Subject: [Lldb-commits] [lldb] r118200 - in /lldb/trunk: include/lldb/Target/LanguageRuntime.h include/lldb/Target/ThreadPlanCallFunction.h source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h source/Target/ThreadPlanCallFunction.cpp Message-ID: <20101103221939.0552A2A6C12C@llvm.org> Author: spyffe Date: Wed Nov 3 17:19:38 2010 New Revision: 118200 URL: http://llvm.org/viewvc/llvm-project?rev=118200&view=rev Log: Factored the code that implements breakpoints on exceptions for different languages out of ThreadPlanCallFunction and put it into the appropriate language runtimes. Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Wed Nov 3 17:19:38 2010 @@ -45,6 +45,21 @@ virtual lldb::ValueObjectSP GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope) = 0; + virtual void + SetExceptionBreakpoints () + { + } + + virtual void + ClearExceptionBreakpoints () + { + } + + virtual bool + ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) + { + return false; + } protected: //------------------------------------------------------------------ // Classes that inherit from LanguageRuntime can see and modify these Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Wed Nov 3 17:19:38 2010 @@ -97,9 +97,8 @@ Thread &m_thread; Thread::RegisterCheckpoint m_register_backup; lldb::ThreadPlanSP m_subplan_sp; - lldb::BreakpointSP m_cxx_exception_bp_sp; - lldb::BreakpointSP m_cxx_exception_alloc_bp_sp; - lldb::BreakpointSP m_objc_exception_bp_sp; + LanguageRuntime *m_cxx_language_runtime; + LanguageRuntime *m_objc_language_runtime; DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction); }; Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Wed Nov 3 17:19:38 2010 @@ -9,6 +9,7 @@ #include "ItaniumABILanguageRuntime.h" +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" #include "lldb/Core/Module.h" @@ -17,6 +18,7 @@ #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" @@ -116,3 +118,89 @@ { return NULL; } + +void +ItaniumABILanguageRuntime::SetExceptionBreakpoints () +{ + if (!m_process) + return; + + if (!m_cxx_exception_bp_sp) + m_cxx_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "__cxa_throw", + eFunctionNameTypeBase, + true); + + if (!m_cxx_exception_alloc_bp_sp) + m_cxx_exception_alloc_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "__cxa_allocate", + eFunctionNameTypeBase, + true); +} + +void +ItaniumABILanguageRuntime::ClearExceptionBreakpoints () +{ + if (!m_process) + return; + + if (m_cxx_exception_bp_sp.get()) + { + m_process->GetTarget().RemoveBreakpointByID(m_cxx_exception_bp_sp->GetID()); + m_cxx_exception_bp_sp.reset(); + } + + if (m_cxx_exception_alloc_bp_sp.get()) + { + m_process->GetTarget().RemoveBreakpointByID(m_cxx_exception_alloc_bp_sp->GetID()); + m_cxx_exception_bp_sp.reset(); + } +} + +bool +ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) +{ + if (!m_process) + return false; + + if (!stop_reason || + stop_reason->GetStopReason() != eStopReasonBreakpoint) + return false; + + uint64_t break_site_id = stop_reason->GetValue(); + lldb::BreakpointSiteSP bp_site_sp = m_process->GetBreakpointSiteList().FindByID(break_site_id); + + if (!bp_site_sp) + return false; + + uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); + + bool check_cxx_exception = false; + break_id_t cxx_exception_bid; + + bool check_cxx_exception_alloc = false; + break_id_t cxx_exception_alloc_bid; + + if (m_cxx_exception_bp_sp) + { + check_cxx_exception = true; + cxx_exception_bid = m_cxx_exception_bp_sp->GetID(); + } + + if (m_cxx_exception_alloc_bp_sp) + { + check_cxx_exception_alloc = true; + cxx_exception_alloc_bid = m_cxx_exception_alloc_bp_sp->GetID(); + } + + for (uint32_t i = 0; i < num_owners; i++) + { + break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); + + if ((check_cxx_exception && (bid == cxx_exception_bid)) || + (check_cxx_exception_alloc && (bid == cxx_exception_alloc_bid))) + return true; + } + + return false; +} Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h Wed Nov 3 17:19:38 2010 @@ -65,9 +65,22 @@ virtual lldb_private::Log * EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); + + virtual void + SetExceptionBreakpoints (); + + virtual void + ClearExceptionBreakpoints (); + + virtual bool + ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); + protected: private: ItaniumABILanguageRuntime(Process *process) : lldb_private::CPPLanguageRuntime(process) { } // Call CreateInstance instead. + + lldb::BreakpointSP m_cxx_exception_bp_sp; + lldb::BreakpointSP m_cxx_exception_alloc_bp_sp; }; } // namespace lldb_private Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp Wed Nov 3 17:19:38 2010 @@ -10,8 +10,10 @@ #include "AppleObjCRuntimeV2.h" #include "AppleObjCTrampolineHandler.h" +#include "llvm/Support/MachO.h" #include "clang/AST/Type.h" +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" @@ -24,6 +26,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" @@ -286,3 +289,84 @@ { return NULL; } + +void +AppleObjCRuntimeV2::SetExceptionBreakpoints () +{ + if (!m_process) + return; + + if (!m_objc_exception_bp_sp) + { + ArchSpec arch_spec = m_process->GetTarget().GetArchitecture(); + + switch (arch_spec.GetCPUType()) + { + default: + break; + case llvm::MachO::CPUTypeI386: + m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "objc_exception_throw", + eFunctionNameTypeBase, + true); + break; + case llvm::MachO::CPUTypeX86_64: + m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "__cxa_throw", + eFunctionNameTypeBase, + true); + break; + } + } +} + +void +AppleObjCRuntimeV2::ClearExceptionBreakpoints () +{ + if (!m_process) + return; + + if (m_objc_exception_bp_sp.get()) + { + m_process->GetTarget().RemoveBreakpointByID(m_objc_exception_bp_sp->GetID()); + m_objc_exception_bp_sp.reset(); + } +} + +bool +AppleObjCRuntimeV2::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) +{ + if (!m_process) + return false; + + if (!stop_reason || + stop_reason->GetStopReason() != eStopReasonBreakpoint) + return false; + + uint64_t break_site_id = stop_reason->GetValue(); + lldb::BreakpointSiteSP bp_site_sp = m_process->GetBreakpointSiteList().FindByID(break_site_id); + + if (!bp_site_sp) + return false; + + uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); + + bool check_objc_exception = false; + break_id_t objc_exception_bid; + + if (m_objc_exception_bp_sp) + { + check_objc_exception = true; + objc_exception_bid = m_objc_exception_bp_sp->GetID(); + } + + for (uint32_t i = 0; i < num_owners; i++) + { + break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); + + if ((check_objc_exception && (bid == objc_exception_bid))) + return true; + } + + return false; +} Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h Wed Nov 3 17:19:38 2010 @@ -87,6 +87,15 @@ virtual lldb_private::Log * EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); + + virtual void + SetExceptionBreakpoints (); + + virtual void + ClearExceptionBreakpoints (); + + virtual bool + ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); protected: Address * GetPrintForDebuggerAddr(); @@ -95,6 +104,7 @@ std::auto_ptr
m_PrintForDebugger_addr; bool m_read_objc_library; std::auto_ptr m_objc_trampoline_handler_ap; + lldb::BreakpointSP m_objc_exception_bp_sp; AppleObjCRuntimeV2(Process *process) : lldb_private::ObjCLanguageRuntime(process), Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118200&r1=118199&r2=118200&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Nov 3 17:19:38 2010 @@ -20,6 +20,7 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" +#include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" @@ -328,122 +329,36 @@ void ThreadPlanCallFunction::SetBreakpoints () { - Target& target = m_process.GetTarget(); + m_cxx_language_runtime = m_process.GetLanguageRuntime(eLanguageTypeC_plus_plus); + m_objc_language_runtime = m_process.GetLanguageRuntime(eLanguageTypeObjC); - ArchSpec arch_spec = target.GetArchitecture(); - - switch (arch_spec.GetCPUType()) - { - default: - break; - case llvm::MachO::CPUTypeI386: - m_cxx_exception_bp_sp = target.CreateBreakpoint (NULL, - "__cxa_throw", - eFunctionNameTypeBase, - true); - m_cxx_exception_alloc_bp_sp = target.CreateBreakpoint (NULL, - "__cxa_allocate", - eFunctionNameTypeBase, - true); - m_objc_exception_bp_sp = target.CreateBreakpoint (NULL, - "objc_exception_throw", - eFunctionNameTypeBase, - true); - break; - case llvm::MachO::CPUTypeX86_64: - m_cxx_exception_bp_sp = target.CreateBreakpoint (NULL, - "__cxa_throw", - eFunctionNameTypeBase, - true); - m_cxx_exception_alloc_bp_sp = target.CreateBreakpoint (NULL, - "__cxa_allocate", - eFunctionNameTypeBase, - true); - break; - } + if (m_cxx_language_runtime) + m_cxx_language_runtime->SetExceptionBreakpoints(); + if (m_objc_language_runtime) + m_objc_language_runtime->SetExceptionBreakpoints(); } void ThreadPlanCallFunction::ClearBreakpoints () { - Target& target = m_process.GetTarget(); - - if (m_cxx_exception_bp_sp.get()) - { - target.RemoveBreakpointByID(m_cxx_exception_bp_sp->GetID()); - m_cxx_exception_bp_sp.reset(); - } - - if (m_cxx_exception_alloc_bp_sp.get()) - { - target.RemoveBreakpointByID(m_cxx_exception_alloc_bp_sp->GetID()); - m_cxx_exception_bp_sp.reset(); - } - - if (m_objc_exception_bp_sp.get()) - { - target.RemoveBreakpointByID(m_objc_exception_bp_sp->GetID()); - m_cxx_exception_bp_sp.reset(); - } + if (m_cxx_language_runtime) + m_cxx_language_runtime->ClearExceptionBreakpoints(); + if (m_objc_language_runtime) + m_objc_language_runtime->ClearExceptionBreakpoints(); } bool ThreadPlanCallFunction::BreakpointsExplainStop() { - // A temporary fix to set breakpoints at points where exceptions are being - // thrown. This functionality will migrate into the Target. - lldb::StopInfoSP stop_info_sp = GetPrivateStopReason(); - if (!stop_info_sp || - stop_info_sp->GetStopReason() != eStopReasonBreakpoint) - return false; - - uint64_t break_site_id = stop_info_sp->GetValue(); - lldb::BreakpointSiteSP bp_site_sp = m_thread.GetProcess().GetBreakpointSiteList().FindByID(break_site_id); - - if (!bp_site_sp) - return false; - - uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); - - bool check_cxx_exception = false; - break_id_t cxx_exception_bid; - - bool check_cxx_exception_alloc = false; - break_id_t cxx_exception_alloc_bid; - - bool check_objc_exception = false; - break_id_t objc_exception_bid; - - if (m_cxx_exception_bp_sp.get()) - { - check_cxx_exception = true; - cxx_exception_bid = m_cxx_exception_bp_sp->GetID(); - } - - if (m_cxx_exception_bp_sp.get()) - { - check_cxx_exception_alloc = true; - cxx_exception_alloc_bid = m_cxx_exception_alloc_bp_sp->GetID(); - } + if (m_cxx_language_runtime && + m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)) + return true; - if (m_cxx_exception_bp_sp.get()) - { - check_objc_exception = true; - objc_exception_bid = m_objc_exception_bp_sp->GetID(); - } - - - for (uint32_t i = 0; i < num_owners; i++) - { - break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); - - if ((check_cxx_exception && (bid == cxx_exception_bid)) || - (check_cxx_exception_alloc && (bid == cxx_exception_alloc_bid)) || - (check_objc_exception && (bid == objc_exception_bid))) - return true; - } + if (m_objc_language_runtime && + m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)) + return true; return false; } From jmolenda at apple.com Wed Nov 3 19:53:20 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 00:53:20 -0000 Subject: [Lldb-commits] [lldb] r118218 - in /lldb/trunk/source: Plugins/Process/Utility/RegisterContextLLDB.cpp Plugins/Process/Utility/RegisterContextLLDB.h Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Plugins/Process/Utility/UnwindLLDB.cpp Plugins/Process/Utility/UnwindLLDB.h Symbol/UnwindPlan.cpp Symbol/UnwindTable.cpp Message-ID: <20101104005320.87A522A6C12C@llvm.org> Author: jmolenda Date: Wed Nov 3 19:53:20 2010 New Revision: 118218 URL: http://llvm.org/viewvc/llvm-project?rev=118218&view=rev Log: Handle the case where no eh_frame section is present. RegisterContextLLDB holds a reference to the SymbolContext in the vector of Cursors that UnwindLLDB maintains. Switch UnwindLLDB to hold a vector of shared pointers of Cursors so this reference doesn't become invalid. Correctly falling back from the "fast" UnwindPlan to the "full" UnwindPlan when additional registers need to be retrieved. Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h lldb/trunk/source/Symbol/UnwindPlan.cpp lldb/trunk/source/Symbol/UnwindTable.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Nov 3 19:53:20 2010 @@ -33,9 +33,13 @@ int frame_number) : RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), - m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number) + m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number), + m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL) { + m_sym_ctx.Clear(); + m_sym_ctx_valid = false; m_base_reg_ctx = m_thread.GetRegisterContext(); + if (IsFrameZero ()) { InitializeZerothFrame (); @@ -77,13 +81,11 @@ m_frame_type = eNotAValidFrame; return; } - m_sym_ctx = frame_sp->GetSymbolContext (eSymbolContextEverything); - const AddressRange *addr_range_ptr; - if (m_sym_ctx.function) - addr_range_ptr = &m_sym_ctx.function->GetAddressRange(); - else if (m_sym_ctx.symbol) - addr_range_ptr = m_sym_ctx.symbol->GetAddressRangePtr(); - + m_sym_ctx = frame_sp->GetSymbolContext (eSymbolContextFunction | eSymbolContextSymbol); + m_sym_ctx_valid = true; + AddressRange addr_range; + m_sym_ctx.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, addr_range); + m_current_pc = frame_sp->GetFrameCodeAddress(); static ConstString sigtramp_name ("_sigtramp"); @@ -98,11 +100,11 @@ m_frame_type = eNormalFrame; } - // If we were able to find a symbol/function, set addr_range_ptr to the bounds of that symbol/function. + // If we were able to find a symbol/function, set addr_range to the bounds of that symbol/function. // else treat the current pc value as the start_pc and record no offset. - if (addr_range_ptr) + if (addr_range.GetBaseAddress().IsValid()) { - m_start_pc = addr_range_ptr->GetBaseAddress(); + m_start_pc = addr_range.GetBaseAddress(); m_current_offset = frame_sp->GetFrameCodeAddress().GetOffset() - m_start_pc.GetOffset(); } else @@ -261,14 +263,17 @@ return; } - // set up our m_sym_ctx SymbolContext - m_current_pc.GetModule()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction | eSymbolContextSymbol, m_sym_ctx); + // We require that eSymbolContextSymbol be successfully filled in or this context is of no use to us. + if ((m_current_pc.GetModule()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol) + { + m_sym_ctx_valid = true; + } - const AddressRange *addr_range_ptr; - if (m_sym_ctx.function) - addr_range_ptr = &m_sym_ctx.function->GetAddressRange(); - else if (m_sym_ctx.symbol) - addr_range_ptr = m_sym_ctx.symbol->GetAddressRangePtr(); + AddressRange addr_range; + if (!m_sym_ctx.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, addr_range)) + { + m_sym_ctx_valid = false; + } static ConstString sigtramp_name ("_sigtramp"); if ((m_sym_ctx.function && m_sym_ctx.function->GetMangled().GetMangledName() == sigtramp_name) @@ -284,9 +289,9 @@ // If we were able to find a symbol/function, set addr_range_ptr to the bounds of that symbol/function. // else treat the current pc value as the start_pc and record no offset. - if (addr_range_ptr) + if (addr_range.GetBaseAddress().IsValid()) { - m_start_pc = addr_range_ptr->GetBaseAddress(); + m_start_pc = addr_range.GetBaseAddress(); m_current_offset = m_current_pc.GetOffset() - m_start_pc.GetOffset(); } else @@ -458,6 +463,9 @@ { behaves_like_zeroth_frame = true; } + + // If this frame behaves like a 0th frame (currently executing or interrupted asynchronously), all registers + // can be retrieved. if (behaves_like_zeroth_frame) { m_all_registers_available = true; @@ -471,7 +479,10 @@ } FuncUnwindersSP fu; - fu = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx); + if (m_sym_ctx_valid) + { + fu = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx); + } // No FuncUnwinders available for this pc, try using architectural default unwind. if (fu.get() == NULL) @@ -718,9 +729,9 @@ { if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %d could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - lldb_regnum); + lldb_regnum, (int) unwindplan_registerkind); } return false; } @@ -735,9 +746,10 @@ have_unwindplan_regloc = true; } } - else + + if (!have_unwindplan_regloc) { - // m_full_unwind_plan being NULL probably means that we haven't tried to find a full UnwindPlan yet + // m_full_unwind_plan being NULL means that we haven't tried to find a full UnwindPlan yet if (m_full_unwind_plan == NULL) { m_full_unwind_plan = GetFullUnwindPlanForFrame (); @@ -751,9 +763,9 @@ { if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %d could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - lldb_regnum); + lldb_regnum, (int) unwindplan_registerkind); } return false; } @@ -770,6 +782,7 @@ } } } + if (have_unwindplan_regloc == false) { // If a volatile register is being requested, we don't want to forward m_next_frame's register contents Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Wed Nov 3 19:53:20 2010 @@ -163,14 +163,15 @@ // i.e. where THIS frame saved them /// - lldb_private::UnwindPlan *m_fast_unwind_plan; // may be NULL + lldb_private::UnwindPlan *m_fast_unwind_plan; // may be NULL lldb_private::UnwindPlan *m_full_unwind_plan; - bool m_all_registers_available; // Can we retrieve all regs or just nonvolatile regs? - int m_frame_type; // enum FrameType - int m_current_offset; // how far into the function we've executed; -1 if unknown + bool m_all_registers_available; // Can we retrieve all regs or just nonvolatile regs? + int m_frame_type; // enum FrameType + int m_current_offset; // how far into the function we've executed; -1 if unknown lldb_private::SymbolContext& m_sym_ctx; + bool m_sym_ctx_valid; // if ResolveSymbolContextForAddress fails, don't try to use m_sym_ctx - int m_frame_number; // What stack frame level this frame is - used for debug logging + int m_frame_number; // What stack frame level this frame is - used for debug logging lldb::addr_t m_cfa; lldb_private::Address m_start_pc; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Wed Nov 3 19:53:20 2010 @@ -478,6 +478,10 @@ AssemblyParse_x86::instruction_length (Address addr, int &length) { const char *triple; + + if (!addr.IsValid()) + return false; + // FIXME should probably pass down the ArchSpec and work from that to make a portable triple if (m_cpu == k_i386) triple = "i386-unknown-unknown"; @@ -512,11 +516,16 @@ UnwindPlan up; UnwindPlan::Row row; int non_prologue_insn_count = 0; - Address m_cur_insn = m_func_bounds.GetBaseAddress (); + m_cur_insn = m_func_bounds.GetBaseAddress (); int current_func_text_offset = 0; int current_sp_bytes_offset_from_cfa = 0; UnwindPlan::Row::RegisterLocation regloc; + if (!m_cur_insn.IsValid()) + { + return false; + } + unwind_plan.SetPlanValidAddressRange (m_func_bounds); unwind_plan.SetRegisterKind (eRegisterKindLLDB); @@ -725,6 +734,11 @@ AssemblyParse_x86::find_first_non_prologue_insn (Address &address) { m_cur_insn = m_func_bounds.GetBaseAddress (); + if (!m_cur_insn.IsValid()) + { + return false; + } + while (m_func_bounds.ContainsFileAddress (m_cur_insn)) { Error error; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Wed Nov 3 19:53:20 2010 @@ -35,20 +35,20 @@ if (m_frames.empty()) { // First, set up the 0th (initial) frame - Cursor first_cursor; + CursorSP first_cursor_sp(new Cursor); RegisterContextSP no_frame; // an empty shared pointer - RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor.sctx, 0); + RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0); if (!first_register_ctx->IsValid()) { delete first_register_ctx; return 0; } - if (!first_register_ctx->GetCFA (first_cursor.cfa)) + if (!first_register_ctx->GetCFA (first_cursor_sp->cfa)) { delete first_register_ctx; return 0; } - if (!first_register_ctx->GetPC (first_cursor.start_pc)) + if (!first_register_ctx->GetPC (first_cursor_sp->start_pc)) { delete first_register_ctx; return 0; @@ -56,16 +56,16 @@ // Reuse the StackFrame provided by the processor native machine context for the first frame first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get()); RegisterContextSP temp_rcs(first_register_ctx); - first_cursor.reg_ctx = temp_rcs; - m_frames.push_back (first_cursor); + first_cursor_sp->reg_ctx = temp_rcs; + m_frames.push_back (first_cursor_sp); // Now walk up the rest of the stack while (1) { - Cursor cursor; + CursorSP cursor_sp(new Cursor); RegisterContextLLDB *register_ctx; int cur_idx = m_frames.size (); - register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1].reg_ctx, cursor.sctx, cur_idx); + register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1]->reg_ctx, cursor_sp->sctx, cur_idx); if (!register_ctx->IsValid()) { delete register_ctx; @@ -76,7 +76,7 @@ } break; } - if (!register_ctx->GetCFA (cursor.cfa)) + if (!register_ctx->GetCFA (cursor_sp->cfa)) { delete register_ctx; if (log) @@ -86,7 +86,7 @@ } break; } - if (cursor.cfa == (addr_t) -1 || cursor.cfa == 1 || cursor.cfa == 0) + if (cursor_sp->cfa == (addr_t) -1 || cursor_sp->cfa == 1 || cursor_sp->cfa == 0) { delete register_ctx; if (log) @@ -96,7 +96,7 @@ } break; } - if (!register_ctx->GetPC (cursor.start_pc)) + if (!register_ctx->GetPC (cursor_sp->start_pc)) { delete register_ctx; if (log) @@ -107,10 +107,10 @@ break; } RegisterContextSP temp_rcs(register_ctx); - StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor.cfa, cursor.start_pc, &cursor.sctx); + StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); register_ctx->SetStackFrame (frame); - cursor.reg_ctx = temp_rcs; - m_frames.push_back (cursor); + cursor_sp->reg_ctx = temp_rcs; + m_frames.push_back (cursor_sp); } } return m_frames.size (); @@ -125,8 +125,8 @@ if (idx < m_frames.size ()) { - cfa = m_frames[idx].cfa; - pc = m_frames[idx].start_pc; + cfa = m_frames[idx]->cfa; + pc = m_frames[idx]->start_pc; return true; } return false; @@ -146,6 +146,6 @@ return m_thread.GetRegisterContext(); } if (idx < m_frames.size ()) - return m_frames[idx].reg_ctx.get(); + return m_frames[idx]->reg_ctx.get(); return NULL; } Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Wed Nov 3 19:53:20 2010 @@ -11,6 +11,7 @@ #define lldb_UnwindLLDB_h_ #include "lldb/lldb-private.h" +#include "lldb/lldb-types.h" #include "lldb/Target/Unwind.h" #include "lldb/Symbol/FuncUnwinders.h" #include "lldb/Symbol/UnwindPlan.h" @@ -57,7 +58,8 @@ Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { } }; - std::vector m_frames; + typedef lldb::SharedPtr::Type CursorSP; + std::vector m_frames; //------------------------------------------------------------------ // For UnwindLLDB only Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindPlan.cpp (original) +++ lldb/trunk/source/Symbol/UnwindPlan.cpp Wed Nov 3 19:53:20 2010 @@ -287,6 +287,9 @@ if (!m_plan_valid_address_range.GetBaseAddress().IsValid() || m_plan_valid_address_range.GetByteSize() == 0) return true; + if (!addr.IsValid()) + return true; + if (m_plan_valid_address_range.ContainsFileAddress (addr)) return true; Modified: lldb/trunk/source/Symbol/UnwindTable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=118218&r1=118217&r2=118218&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindTable.cpp (original) +++ lldb/trunk/source/Symbol/UnwindTable.cpp Wed Nov 3 19:53:20 2010 @@ -77,6 +77,11 @@ initialize(); + if (m_eh_frame == NULL) + { + return no_unwind_found; + } + // Create a FuncUnwinders object for the binary search below AddressRange search_range(addr, 1); FuncUnwindersSP search_unwind(new FuncUnwinders (*this, NULL, search_range)); @@ -103,26 +108,19 @@ } AddressRange range; - if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, range)) + if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, range) || !range.GetBaseAddress().IsValid()) { - FuncUnwindersSP unw(new FuncUnwinders(*this, m_assembly_profiler, range)); - m_unwinds.push_back (unw); - std::sort (m_unwinds.begin(), m_unwinds.end()); - return unw; - } - else - { - // Does the eh_frame unwind info has a function bounds defined for this addr? - if (m_eh_frame->GetAddressRange (addr, range)) + // Does the eh_frame unwind info has a function bounds for this addr? + if (!m_eh_frame->GetAddressRange (addr, range)) { - FuncUnwindersSP unw(new FuncUnwinders(*this, m_assembly_profiler, range)); - m_unwinds.push_back (unw); - std::sort (m_unwinds.begin(), m_unwinds.end()); - return unw; - // FIXME we should create a syntheic Symbol based on the address range with a synthesized symbol name + return no_unwind_found; } } - return no_unwind_found; + + FuncUnwindersSP unw(new FuncUnwinders(*this, m_assembly_profiler, range)); + m_unwinds.push_back (unw); + std::sort (m_unwinds.begin(), m_unwinds.end()); + return unw; } DWARFCallFrameInfo * From scallanan at apple.com Wed Nov 3 20:51:39 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 04 Nov 2010 01:51:39 -0000 Subject: [Lldb-commits] [lldb] r118226 - in /lldb/trunk: include/lldb/Target/ObjCLanguageRuntime.h include/lldb/Target/ThreadPlanCallFunction.h source/Expression/ClangExpressionParser.cpp source/Expression/IRDynamicChecks.cpp source/Target/ObjCLanguageRuntime.cpp source/Target/ThreadPlanCallFunction.cpp Message-ID: <20101104015139.1E7372A6C12C@llvm.org> Author: spyffe Date: Wed Nov 3 20:51:38 2010 New Revision: 118226 URL: http://llvm.org/viewvc/llvm-project?rev=118226&view=rev Log: Re-enabled LLDB's pointer checkers, and moved the implementation of the Objective-C object checkers into the Objective-C language runtime. Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/IRDynamicChecks.cpp lldb/trunk/source/Target/ObjCLanguageRuntime.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Wed Nov 3 20:51:38 2010 @@ -21,6 +21,8 @@ #include "lldb/Target/LanguageRuntime.h" namespace lldb_private { + +class ClangUtilityFunction; class ObjCLanguageRuntime : public LanguageRuntime @@ -53,6 +55,9 @@ void AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr); + ClangUtilityFunction * + CreateObjectChecker (const char *); + protected: //------------------------------------------------------------------ // Classes that inherit from ObjCLanguageRuntime can see and modify these Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Wed Nov 3 20:51:38 2010 @@ -78,6 +78,9 @@ protected: private: void + DoTakedown (); + + void SetBreakpoints (); void Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Wed Nov 3 20:51:38 2010 @@ -454,8 +454,6 @@ if (m_expr.NeedsValidation() && exe_ctx.process->GetDynamicCheckers()) { - /* - Disabled temporarily - TODO Centralize and re-enable this inside Process to avoid race conditions IRDynamicChecks ir_dynamic_checks(*exe_ctx.process->GetDynamicCheckers(), function_name.c_str()); if (!ir_dynamic_checks.runOnModule(*module)) @@ -464,7 +462,6 @@ err.SetErrorString("Couldn't add dynamic checks to the expression"); return err; } - */ } } Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original) +++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Wed Nov 3 20:51:38 2010 @@ -13,6 +13,8 @@ #include "lldb/Core/Log.h" #include "lldb/Expression/ClangUtilityFunction.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "llvm/Support/raw_ostream.h" @@ -36,52 +38,6 @@ " unsigned char $__lldb_local_val = *$__lldb_arg_ptr;\n" "}"; -static bool FunctionExists(const SymbolContext &sym_ctx, const char *name) -{ - ConstString name_cs(name); - - SymbolContextList sym_ctxs; - - sym_ctx.FindFunctionsByName(name_cs, false, sym_ctxs); - - return (sym_ctxs.GetSize() != 0); -} - -static const char *objc_object_check_text(ExecutionContext &exe_ctx) -{ - std::string ret; - - if (!exe_ctx.frame) - return "extern \"C\" void $__lldb_objc_object_check (unsigned char *obj) { }"; - - const SymbolContext &sym_ctx(exe_ctx.frame->GetSymbolContext(lldb::eSymbolContextEverything)); - - if (FunctionExists(sym_ctx, "gdb_object_getClass")) - { - return "extern \"C\" void " - "$__lldb_objc_object_check(uint8_t *$__lldb_arg_obj)" - "{" - "" - "}"; - } - else if (FunctionExists(sym_ctx, "gdb_class_getClass")) - { - return "extern \"C\" void " - "$__lldb_objc_object_check(uint8_t *$__lldb_arg_obj)" - "{" - "" - "}"; - } - else - { - return "extern \"C\" void " - "$__lldb_objc_object_check(uint8_t *$__lldb_arg_obj)" - "{" - "" - "}"; - } -} - DynamicCheckerFunctions::DynamicCheckerFunctions () { } @@ -96,9 +52,21 @@ { m_valid_pointer_check.reset(new ClangUtilityFunction(g_valid_pointer_check_text, VALID_POINTER_CHECK_NAME)); - if (!m_valid_pointer_check->Install(error_stream, exe_ctx)) return false; + + if (exe_ctx.process) + { + ObjCLanguageRuntime *objc_language_runtime = exe_ctx.process->GetObjCLanguageRuntime(); + + if (objc_language_runtime) + { + m_objc_object_check.reset(objc_language_runtime->CreateObjectChecker(VALID_OBJC_OBJECT_CHECK_NAME)); + + if (!m_objc_object_check->Install(error_stream, exe_ctx)) + return false; + } + } return true; } @@ -290,10 +258,7 @@ const IntegerType *intptr_ty = llvm::Type::getIntNTy(m_module.getContext(), (m_module.getPointerSize() == llvm::Module::Pointer64) ? 64 : 32); - if (!m_i8ptr_ty) - m_i8ptr_ty = llvm::Type::getInt8PtrTy(m_module.getContext()); - - params.push_back(m_i8ptr_ty); + params.push_back(GetI8PtrTy()); FunctionType *fun_ty = FunctionType::get(llvm::Type::getVoidTy(m_module.getContext()), params, true); PointerType *fun_ptr_ty = PointerType::getUnqual(fun_ty); @@ -301,13 +266,21 @@ return ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty); } + const PointerType *GetI8PtrTy() + { + if (!m_i8ptr_ty) + m_i8ptr_ty = llvm::Type::getInt8PtrTy(m_module.getContext()); + + return m_i8ptr_ty; + } + typedef std::vector InstVector; typedef InstVector::iterator InstIterator; InstVector m_to_instrument; ///< List of instructions the inspector found llvm::Module &m_module; ///< The module which is being instrumented DynamicCheckerFunctions &m_checker_functions; ///< The dynamic checker functions for the process - +private: const PointerType *m_i8ptr_ty; }; @@ -344,7 +317,7 @@ // Insert an instruction to cast the loaded value to int8_t* BitCastInst *bit_cast = new BitCastInst(dereferenced_ptr, - m_i8ptr_ty, + GetI8PtrTy(), "", inst); @@ -389,7 +362,7 @@ CallInst *call_inst = dyn_cast(inst); if (!call_inst) - return false; // this really should be true, because otherwise InspectInstruction wouldn't have registered it + return false; // call_inst really shouldn't be NULL, because otherwise InspectInstruction wouldn't have registered it if (!m_objc_object_check_func) m_objc_object_check_func = BuildPointerValidatorFunc(m_checker_functions.m_objc_object_check->StartAddress()); @@ -403,7 +376,7 @@ // Insert an instruction to cast the receiver id to int8_t* BitCastInst *bit_cast = new BitCastInst(target_object, - m_i8ptr_ty, + GetI8PtrTy(), "", inst); @@ -470,7 +443,6 @@ } llvm::Value *m_objc_object_check_func; - const PointerType *m_i8ptr_ty; }; IRDynamicChecks::IRDynamicChecks(DynamicCheckerFunctions &checker_functions, @@ -508,7 +480,6 @@ if (!vpc.Instrument()) return false; - /* ObjcObjectChecker ooc(M, m_checker_functions); if (!ooc.Inspect(*function)) @@ -516,7 +487,6 @@ if (!ooc.Instrument()) return false; - */ if (log) { Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Wed Nov 3 20:51:38 2010 @@ -11,6 +11,7 @@ #include "lldb/Core/Log.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Expression/ClangUtilityFunction.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -51,3 +52,21 @@ return LLDB_INVALID_ADDRESS; } +ClangUtilityFunction * +ObjCLanguageRuntime::CreateObjectChecker(const char *name) +{ + char buf[256]; + + assert(snprintf(&buf[0], sizeof(buf), + "extern \"C\" int gdb_object_getClass(void *);" + "extern \"C\" void " + "%s(void *$__lldb_arg_obj)" + "{" + " void **isa_ptr = (void **)$__lldb_arg_obj;" + " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" + " abort();" + "}", + name) < sizeof(buf)); + + return new ClangUtilityFunction(buf, name); +} Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118226&r1=118225&r2=118226&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Nov 3 20:51:38 2010 @@ -150,6 +150,17 @@ ThreadPlanCallFunction::~ThreadPlanCallFunction () { + if (m_valid && !IsPlanComplete()) + DoTakedown(); +} + +void +ThreadPlanCallFunction::DoTakedown () +{ + m_thread.RestoreSaveFrameZero(m_register_backup); + m_thread.ClearStackFrames(); + SetPlanComplete(); + ClearBreakpoints(); } void @@ -253,11 +264,8 @@ } } - m_thread.RestoreSaveFrameZero(m_register_backup); - m_thread.ClearStackFrames(); - SetPlanComplete(); + DoTakedown(); - ClearBreakpoints(); return true; } else From gclayton at apple.com Wed Nov 3 20:54:29 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 04 Nov 2010 01:54:29 -0000 Subject: [Lldb-commits] [lldb] r118227 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Target/ source/API/ source/Commands/ source/Core/ source/Expression/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Target/ Message-ID: <20101104015429.BA5122A6C12C@llvm.org> Author: gclayton Date: Wed Nov 3 20:54:29 2010 New Revision: 118227 URL: http://llvm.org/viewvc/llvm-project?rev=118227&view=rev Log: Added support for loading and unloading shared libraries. This was done by adding support into lldb_private::Process: virtual uint32_t lldb_private::Process::LoadImage (const FileSpec &image_spec, Error &error); virtual Error lldb_private::Process::UnloadImage (uint32_t image_token); There is a default implementation that should work for both linux and MacOSX. This ability has also been exported through the SBProcess API: uint32_t lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error); lldb::SBError lldb::SBProcess::UnloadImage (uint32_t image_token); Modified the DynamicLoader plug-in interface to require it to be able to tell us if it is currently possible to load/unload a shared library: virtual lldb_private::Error DynamicLoader::CanLoadImage () = 0; This way the dynamic loader plug-ins are allows to veto whether we can currently load a shared library since the dynamic loader might know if it is currenlty loading/unloading shared libraries. It might also know about the current host system and know where to check to make sure runtime or malloc locks are currently being held. Modified the expression parser to have ClangUserExpression::Evaluate() be the one that causes the dynamic checkers to be loaded instead of other code that shouldn't have to worry about it. Modified: lldb/trunk/include/lldb/API/SBError.h lldb/trunk/include/lldb/API/SBFileSpec.h lldb/trunk/include/lldb/API/SBProcess.h lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/include/lldb/Target/DynamicLoader.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/lldb-defines.h lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/API/SBError.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBError.h (original) +++ lldb/trunk/include/lldb/API/SBError.h Wed Nov 3 20:54:29 2010 @@ -92,6 +92,9 @@ const lldb_private::Error & operator*() const; + lldb_private::Error & + ref(); + #endif Modified: lldb/trunk/include/lldb/API/SBFileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFileSpec.h (original) +++ lldb/trunk/include/lldb/API/SBFileSpec.h Wed Nov 3 20:54:29 2010 @@ -62,6 +62,7 @@ friend class SBHostOS; friend class SBLineEntry; friend class SBModule; + friend class SBProcess; friend class SBSourceManager; friend class SBThread; friend class SBTarget; Modified: lldb/trunk/include/lldb/API/SBProcess.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBProcess.h (original) +++ lldb/trunk/include/lldb/API/SBProcess.h Wed Nov 3 20:54:29 2010 @@ -103,40 +103,40 @@ uint32_t GetAddressByteSize() const; - SBError + lldb::SBError Destroy (); lldb::pid_t AttachByPID (lldb::pid_t pid); // DEPRECATED - // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (lldb::pid_t pid, SBError& error)" - SBError + // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (lldb::pid_t pid, lldb::SBError& error)" + lldb::SBError Attach (lldb::pid_t pid); - // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (const char *name, bool wait_for_launch, SBError& error)" - SBError + // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (const char *name, bool wait_for_launch, lldb::SBError& error)" + lldb::SBError AttachByName (const char *name, bool wait_for_launch); - SBError + lldb::SBError Continue (); - SBError + lldb::SBError Stop (); - SBError + lldb::SBError Kill (); - SBError + lldb::SBError Detach (); - SBError + lldb::SBError Signal (int signal); size_t - ReadMemory (addr_t addr, void *buf, size_t size, SBError &error); + ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error); size_t - WriteMemory (addr_t addr, const void *buf, size_t size, SBError &error); + WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error); // Events static lldb::StateType @@ -154,6 +154,12 @@ bool GetDescription (lldb::SBStream &description); + uint32_t + LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error); + + lldb::SBError + UnloadImage (uint32_t image_token); + protected: friend class SBAddress; friend class SBBreakpoint; Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Nov 3 20:54:29 2010 @@ -147,6 +147,9 @@ Value & GetValue(); + bool + ResolveValue (ExecutionContextScope *exe_scope, Scalar &scalar); + const char * GetLocationAsCString (ExecutionContextScope *exe_scope); Modified: lldb/trunk/include/lldb/Target/DynamicLoader.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/DynamicLoader.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/DynamicLoader.h (original) +++ lldb/trunk/include/lldb/Target/DynamicLoader.h Wed Nov 3 20:54:29 2010 @@ -12,6 +12,7 @@ // Project includes #include "lldb/lldb-private.h" +#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" namespace lldb_private { @@ -138,6 +139,23 @@ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) = 0; + + //------------------------------------------------------------------ + /// Ask if it is ok to try and load or unload an shared library + /// (image). + /// + /// The dynamic loader often knows when it would be ok to try and + /// load or unload a shared library. This function call allows the + /// dynamic loader plug-ins to check any current dyld state to make + /// sure it is an ok time to load a shared library. + /// + /// @return + /// \b True if it is currently ok to try and load a shared + /// library into the process, \b false otherwise. + //------------------------------------------------------------------ + virtual Error + CanLoadImage () = 0; + protected: //------------------------------------------------------------------ // Member variables. Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Wed Nov 3 20:54:29 2010 @@ -615,6 +615,33 @@ GetImageInfoAddress (); //------------------------------------------------------------------ + /// Load a shared library into this process. + /// + /// Try and load a shared library into the current process. This + /// call might fail in the dynamic loader plug-in says it isn't safe + /// to try and load shared libraries at the moment. + /// + /// @param[in] image_spec + /// The image file spec that points to the shared library that + /// you want to load. + /// + /// @param[out] error + /// An error object that gets filled in with any errors that + /// might occur when trying to load the shared library. + /// + /// @return + /// A token that represents the shared library that can be + /// later used to unload the shared library. A value of + /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared + /// library can't be opened. + //------------------------------------------------------------------ + virtual uint32_t + LoadImage (const FileSpec &image_spec, Error &error); + + virtual Error + UnloadImage (uint32_t image_token); + + //------------------------------------------------------------------ /// Register for process and thread notifications. /// /// Clients can register nofication callbacks by filling out a @@ -1642,6 +1669,7 @@ std::string m_exit_string; ///< A textual description of why a process exited. ThreadList m_thread_list; ///< The threads for this process. std::vector m_notifications; ///< The list of notifications that this process can deliver. + std::vector m_image_tokens; Listener &m_listener; BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint locations we intend ///< to insert in the target. Modified: lldb/trunk/include/lldb/lldb-defines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-defines.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-defines.h (original) +++ lldb/trunk/include/lldb/lldb-defines.h Wed Nov 3 20:54:29 2010 @@ -55,6 +55,7 @@ //---------------------------------------------------------------------- #define LLDB_INVALID_ADDRESS UINT64_MAX #define LLDB_INVALID_INDEX32 UINT32_MAX +#define LLDB_INVALID_IMAGE_TOKEN UINT32_MAX #define LLDB_INVALID_REGNUM UINT32_MAX #define LLDB_INVALID_UID UINT32_MAX #define LLDB_INVALID_PROCESS_ID 0 Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Wed Nov 3 20:54:29 2010 @@ -199,6 +199,12 @@ return m_opaque_ap.get(); } +lldb_private::Error & +SBError::ref() +{ + CreateIfNeeded(); + return *m_opaque_ap; +} const lldb_private::Error & SBError::operator*() const Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Wed Nov 3 20:54:29 2010 @@ -703,3 +703,24 @@ return true; } + +uint32_t +SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error) +{ + if (m_opaque_sp) + m_opaque_sp->LoadImage (*sb_image_spec, sb_error.ref()); + return LLDB_INVALID_IMAGE_TOKEN; +} + +lldb::SBError +SBProcess::UnloadImage (uint32_t image_token) +{ + lldb::SBError sb_error; + if (m_opaque_sp) + sb_error.SetError (m_opaque_sp->UnloadImage (image_token)); + else + sb_error.SetErrorString("invalid process"); + return sb_error; +} + + Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Wed Nov 3 20:54:29 2010 @@ -218,21 +218,6 @@ return false; } - if (!m_exe_ctx.process->GetDynamicCheckers()) - { - DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions(); - - StreamString install_errors; - - if (!dynamic_checkers->Install(install_errors, m_exe_ctx)) - { - error_stream.Printf("Couldn't install dynamic checkers into the execution context: %s\n", install_errors.GetData()); - return false; - } - - m_exe_ctx.process->SetDynamicCheckers(dynamic_checkers); - } - const char *prefix = NULL; if (m_exe_ctx.target) Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Wed Nov 3 20:54:29 2010 @@ -853,6 +853,128 @@ }; //------------------------------------------------------------------------- +// CommandObjectProcessLoad +//------------------------------------------------------------------------- + +class CommandObjectProcessLoad : public CommandObject +{ +public: + + CommandObjectProcessLoad (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "process load", + "Load a shared library into the current process.", + "process load [ ...]", + eFlagProcessMustBeLaunched | eFlagProcessMustBePaused) + { + } + + ~CommandObjectProcessLoad () + { + } + + bool + Execute (Args& command, + CommandReturnObject &result) + { + Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; + if (process == NULL) + { + result.AppendError ("must have a valid process in order to load a shared library"); + result.SetStatus (eReturnStatusFailed); + return false; + } + + const uint32_t argc = command.GetArgumentCount(); + + for (uint32_t i=0; iLoadImage(image_spec, error); + if (image_token != LLDB_INVALID_IMAGE_TOKEN) + { + result.AppendMessageWithFormat ("Loading \"%s\"...ok\nImage %u loaded.\n", image_path, image_token); + result.SetStatus (eReturnStatusSuccessFinishResult); + } + else + { + result.AppendErrorWithFormat ("failed to load '%s': %s", image_path, error.AsCString()); + result.SetStatus (eReturnStatusFailed); + } + } + return result.Succeeded(); + } +}; + + +//------------------------------------------------------------------------- +// CommandObjectProcessUnload +//------------------------------------------------------------------------- + +class CommandObjectProcessUnload : public CommandObject +{ +public: + + CommandObjectProcessUnload (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "process unload", + "Unload a shared library from the current process using the index returned by a previous call to \"process load\".", + "process unload ", + eFlagProcessMustBeLaunched | eFlagProcessMustBePaused) + { + } + + ~CommandObjectProcessUnload () + { + } + + bool + Execute (Args& command, + CommandReturnObject &result) + { + Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; + if (process == NULL) + { + result.AppendError ("must have a valid process in order to load a shared library"); + result.SetStatus (eReturnStatusFailed); + return false; + } + + const uint32_t argc = command.GetArgumentCount(); + + for (uint32_t i=0; iUnloadImage(image_token)); + if (error.Success()) + { + result.AppendMessageWithFormat ("Unloading shared library with index %u...ok\n", image_token); + result.SetStatus (eReturnStatusSuccessFinishResult); + } + else + { + result.AppendErrorWithFormat ("failed to unload image: %s", error.AsCString()); + result.SetStatus (eReturnStatusFailed); + break; + } + } + } + return result.Succeeded(); + } +}; + +//------------------------------------------------------------------------- // CommandObjectProcessSignal //------------------------------------------------------------------------- @@ -1450,6 +1572,8 @@ LoadSubCommand ("launch", CommandObjectSP (new CommandObjectProcessLaunch (interpreter))); LoadSubCommand ("continue", CommandObjectSP (new CommandObjectProcessContinue (interpreter))); LoadSubCommand ("detach", CommandObjectSP (new CommandObjectProcessDetach (interpreter))); + LoadSubCommand ("load", CommandObjectSP (new CommandObjectProcessLoad (interpreter))); + LoadSubCommand ("unload", CommandObjectSP (new CommandObjectProcessUnload (interpreter))); LoadSubCommand ("signal", CommandObjectSP (new CommandObjectProcessSignal (interpreter))); LoadSubCommand ("handle", CommandObjectSP (new CommandObjectProcessHandle (interpreter))); LoadSubCommand ("status", CommandObjectSP (new CommandObjectProcessStatus (interpreter))); Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Wed Nov 3 20:54:29 2010 @@ -222,6 +222,15 @@ } bool +ValueObject::ResolveValue (ExecutionContextScope *exe_scope, Scalar &scalar) +{ + ExecutionContext exe_ctx; + exe_scope->CalculateExecutionContext(exe_ctx); + scalar = m_value.ResolveValue(&exe_ctx, GetClangAST ()); + return scalar.IsValid(); +} + +bool ValueObject::GetValueIsValid () const { return m_value_is_valid; Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Nov 3 20:54:29 2010 @@ -30,6 +30,7 @@ #include "lldb/Host/Host.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" @@ -437,6 +438,22 @@ { Error error; lldb::ValueObjectSP result_valobj_sp; + + if (exe_ctx.process == NULL) + return result_valobj_sp; + + if (!exe_ctx.process->GetDynamicCheckers()) + { + DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions(); + + StreamString install_errors; + + if (!dynamic_checkers->Install(install_errors, exe_ctx)) + return result_valobj_sp; + + exe_ctx.process->SetDynamicCheckers(dynamic_checkers); + } + ClangUserExpression user_expression (expr_cstr, expr_prefix); StreamString error_stream; Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed Nov 3 20:54:29 2010 @@ -1167,6 +1167,26 @@ return thread_plan_sp; } +Error +DynamicLoaderMacOSXDYLD::CanLoadImage () +{ + Error error; + // In order for us to tell if we can load a shared library we verify that + // the dylib_info_addr isn't zero (which means no shared libraries have + // been set yet, or dyld is currently mucking with the shared library list). + if (ReadAllImageInfosStructure ()) + { + // TODO: also check the _dyld_global_lock_held variable in libSystem.B.dylib? + // TODO: check the malloc lock? + // TODO: check the objective C lock? + if (m_dyld_all_image_infos.dylib_info_addr != 0) + return error; // Success + } + + error.SetErrorString("unsafe to load or unload shared libraries"); + return error; +} + void DynamicLoaderMacOSXDYLD::Initialize() { Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h Wed Nov 3 20:54:29 2010 @@ -78,6 +78,8 @@ GetStepThroughTrampolinePlan (lldb_private::Thread &thread, bool stop_others); + virtual lldb_private::Error + CanLoadImage (); //------------------------------------------------------------------ // PluginInterface protocol Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=118227&r1=118226&r2=118227&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Wed Nov 3 20:54:29 2010 @@ -21,6 +21,7 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Host/Host.h" #include "lldb/Target/ABI.h" +#include "lldb/Target/DynamicLoader.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -471,6 +472,141 @@ return LLDB_INVALID_ADDRESS; } +//---------------------------------------------------------------------- +// LoadImage +// +// This function provides a default implementation that works for most +// unix variants. Any Process subclasses that need to do shared library +// loading differently should override LoadImage and UnloadImage and +// do what is needed. +//---------------------------------------------------------------------- +uint32_t +Process::LoadImage (const FileSpec &image_spec, Error &error) +{ + DynamicLoader *loader = GetDynamicLoader(); + if (loader) + { + error = loader->CanLoadImage(); + if (error.Fail()) + return LLDB_INVALID_IMAGE_TOKEN; + } + + if (error.Success()) + { + ThreadSP thread_sp(GetThreadList ().GetSelectedThread()); + if (thread_sp == NULL) + thread_sp = GetThreadList ().GetThreadAtIndex(0, true); + + if (thread_sp) + { + StackFrameSP frame_sp (thread_sp->GetStackFrameAtIndex (0)); + + if (frame_sp) + { + ExecutionContext exe_ctx; + frame_sp->CalculateExecutionContext (exe_ctx); + + StreamString expr; + char path[PATH_MAX]; + image_spec.GetPath(path, sizeof(path)); + expr.Printf("dlopen (\"%s\", 2)", path); + const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n"; + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + if (result_valobj_sp->GetError().Success()) + { + Scalar scalar; + if (result_valobj_sp->ResolveValue (frame_sp.get(), scalar)) + { + addr_t image_ptr = scalar.ULongLong(LLDB_INVALID_ADDRESS); + if (image_ptr != 0 && image_ptr != LLDB_INVALID_ADDRESS) + { + uint32_t image_token = m_image_tokens.size(); + m_image_tokens.push_back (image_ptr); + return image_token; + } + } + } + } + } + } + return LLDB_INVALID_IMAGE_TOKEN; +} + +//---------------------------------------------------------------------- +// UnloadImage +// +// This function provides a default implementation that works for most +// unix variants. Any Process subclasses that need to do shared library +// loading differently should override LoadImage and UnloadImage and +// do what is needed. +//---------------------------------------------------------------------- +Error +Process::UnloadImage (uint32_t image_token) +{ + Error error; + if (image_token < m_image_tokens.size()) + { + const addr_t image_addr = m_image_tokens[image_token]; + if (image_addr == LLDB_INVALID_ADDRESS) + { + error.SetErrorString("image already unloaded"); + } + else + { + DynamicLoader *loader = GetDynamicLoader(); + if (loader) + error = loader->CanLoadImage(); + + if (error.Success()) + { + ThreadSP thread_sp(GetThreadList ().GetSelectedThread()); + if (thread_sp == NULL) + thread_sp = GetThreadList ().GetThreadAtIndex(0, true); + + if (thread_sp) + { + StackFrameSP frame_sp (thread_sp->GetStackFrameAtIndex (0)); + + if (frame_sp) + { + ExecutionContext exe_ctx; + frame_sp->CalculateExecutionContext (exe_ctx); + + StreamString expr; + expr.Printf("dlclose ((void *)0x%llx)", image_addr); + const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + if (result_valobj_sp->GetError().Success()) + { + Scalar scalar; + if (result_valobj_sp->ResolveValue (frame_sp.get(), scalar)) + { + if (scalar.UInt(1)) + { + error.SetErrorStringWithFormat("expression failed: \"%s\"", expr.GetData()); + } + else + { + m_image_tokens[image_token] = LLDB_INVALID_ADDRESS; + } + } + } + else + { + error = result_valobj_sp->GetError(); + } + } + } + } + } + } + else + { + error.SetErrorString("invalid image token"); + } + return error; +} + DynamicLoader * Process::GetDynamicLoader() { From gclayton at apple.com Wed Nov 3 20:56:14 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 04 Nov 2010 01:56:14 -0000 Subject: [Lldb-commits] [lldb] r118229 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20101104015614.4E54E2A6C12C@llvm.org> Author: gclayton Date: Wed Nov 3 20:56:14 2010 New Revision: 118229 URL: http://llvm.org/viewvc/llvm-project?rev=118229&view=rev Log: Bumped version for lldb-29 and debugserver-116 in the Xcode projects. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118229&r1=118228&r2=118229&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Nov 3 20:56:14 2010 @@ -2985,9 +2985,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 28; + DYLIB_CURRENT_VERSION = 29; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3039,11 +3039,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 28; + DYLIB_CURRENT_VERSION = 29; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3114,7 +3114,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3150,11 +3150,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 28; + DYLIB_CURRENT_VERSION = 29; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3204,7 +3204,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3244,7 +3244,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 28; + CURRENT_PROJECT_VERSION = 29; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=118229&r1=118228&r2=118229&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Wed Nov 3 20:56:14 2010 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 28 + 29 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=118229&r1=118228&r2=118229&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Nov 3 20:56:14 2010 @@ -456,7 +456,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -474,7 +474,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -511,7 +511,7 @@ buildSettings = { "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -552,7 +552,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -593,7 +593,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 115; + CURRENT_PROJECT_VERSION = 116; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From gclayton at apple.com Wed Nov 3 21:01:34 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 04 Nov 2010 02:01:34 -0000 Subject: [Lldb-commits] [lldb] r118231 - /lldb/trunk/lldb.xcodeproj/project.pbxproj Message-ID: <20101104020135.090C52A6C12C@llvm.org> Author: gclayton Date: Wed Nov 3 21:01:34 2010 New Revision: 118231 URL: http://llvm.org/viewvc/llvm-project?rev=118231&view=rev Log: Removed the hardcoding of the system compiler to gcc 4.2 Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118231&r1=118230&r2=118231&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Nov 3 21:01:34 2010 @@ -2998,7 +2998,6 @@ GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; @@ -3052,7 +3051,6 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; @@ -3124,7 +3122,6 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; @@ -3163,7 +3160,6 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; @@ -3214,7 +3210,6 @@ GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; @@ -3254,7 +3249,6 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; From jmolenda at apple.com Thu Nov 4 04:40:56 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 09:40:56 -0000 Subject: [Lldb-commits] [lldb] r118240 - in /lldb/trunk: include/lldb/Symbol/ source/Commands/ source/Plugins/Disassembler/llvm/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Symbol/ Message-ID: <20101104094056.78DBC2A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 04:40:56 2010 New Revision: 118240 URL: http://llvm.org/viewvc/llvm-project?rev=118240&view=rev Log: Built the native unwinder with all the warnings c++-4.2 could muster; fixed them. Added DISALLOW_COPY_AND_ASSIGN to classes that should not be bitwise copied. Added default initializers for member variables that weren't being initialized in the ctor. Fixed a few shadowed local variable mistakes. Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h lldb/trunk/include/lldb/Symbol/FuncUnwinders.h lldb/trunk/include/lldb/Symbol/UnwindPlan.h lldb/trunk/source/Commands/CommandObjectDisassemble.cpp lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp lldb/trunk/source/Symbol/FuncUnwinders.cpp Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original) +++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Thu Nov 4 04:40:56 2010 @@ -70,7 +70,9 @@ uint8_t ptr_encoding; lldb_private::UnwindPlan::Row initial_row; - CIE(dw_offset_t offset) : cie_offset(offset), initial_row() {} + CIE(dw_offset_t offset) : cie_offset(offset), initial_row(), version (-1), + code_align (0), data_align (0), return_addr_reg_num (-1), + inst_offset (0), inst_length (0), ptr_encoding (0) {} }; typedef lldb::SharedPtr::Type CIESP; @@ -80,6 +82,8 @@ AddressRange bounds; // function bounds dw_offset_t offset; // offset to this FDE within the Section + FDEEntry () : offset (0), bounds () { } + inline bool operator<(const DWARFCallFrameInfo::FDEEntry& b) const { Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original) +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Thu Nov 4 04:40:56 2010 @@ -74,6 +74,8 @@ Address m_first_non_prologue_insn; + DISALLOW_COPY_AND_ASSIGN (FuncUnwinders); + }; // class FuncUnwinders inline bool Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Thu Nov 4 04:40:56 2010 @@ -59,7 +59,7 @@ isDWARFExpression // reg = eval(dwarf_expr) }; - RegisterLocation() : m_type(unspecified) { } + RegisterLocation() : m_type(unspecified), m_location() { } bool operator == (const RegisterLocation& rhs) const; @@ -175,8 +175,8 @@ } // Return the number of registers we have locations for - int - GetRegisterCount () const + int + GetRegisterCount () const { return m_register_locations.size(); } Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Nov 4 04:40:56 2010 @@ -21,11 +21,19 @@ #include "lldb/Core/Disassembler.h" #include "lldb/Interpreter/Options.h" #include "lldb/Core/SourceManager.h" +#include "lldb/Core/Stream.h" #include "lldb/Target/StackFrame.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Target/StackFrame.h" +#include "lldb/Target/Thread.h" +#include "lldb/Symbol/FuncUnwinders.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Symbol/DWARFCallFrameInfo.h" +#include "lldb/Utility/ArchVolatileRegs.h" + #define DEFAULT_DISASM_BYTE_SIZE 32 using namespace lldb; @@ -252,7 +260,46 @@ // The default action is to disassemble the current frame function. if (exe_ctx.frame) { - SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); +// SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); + SymbolContext sc(exe_ctx.frame->GetSymbolContext (eSymbolContextEverything)); + + ArchVolatileRegs *vr = ArchVolatileRegs::FindPlugin (exe_ctx.target->GetArchitecture()); + Address pc = exe_ctx.frame->GetFrameCodeAddress(); + FuncUnwindersSP fu = pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (pc, sc); + if (fu != NULL) + { + + Address first_non_prologue_insn = fu->GetFirstNonPrologueInsn (*exe_ctx.target); + UnwindPlan *up = fu->GetUnwindPlanAtCallSite(); + Stream *s = &result.GetOutputStream(); + if (up) + { + s->Printf ("\nJSMDEBUG: unwind plan at call site (from eh_frame)\n"); + up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); + } + else + { + result.GetOutputStream().Printf("No UnwindPlanAtCallSite available.\n"); + } + up = fu->GetUnwindPlanAtNonCallSite(exe_ctx.frame->GetThread()); + s->Printf ("\nJSMDEBUG: unwind plan at non-call site (from disassembly)\n"); + up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); + + up = fu->GetUnwindPlanFastUnwind(exe_ctx.frame->GetThread()); + if (up) + { + s->Printf ("\nJSMDEBUG: fast unwind plan\n"); + up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); + } + + up = fu->GetUnwindPlanArchitectureDefault(exe_ctx.frame->GetThread()); + if (up) + { + s->Printf ("\nJSMDEBUG: architectural default unwind plan\n"); + up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); + } + } + if (sc.function) range = sc.function->GetAddressRange(); else if (sc.symbol && sc.symbol->GetAddressRangePtr()) Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original) +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Thu Nov 4 04:40:56 2010 @@ -362,6 +362,7 @@ ((strcasestr (arch_name, "i386") == arch_name) || (strcasestr (arch_name, "x86_64") == arch_name))) return kEDAssemblySyntaxX86ATT; +printf ("JSMDEBUG: Warning returning 'default' as the assembly syntax style\n"); return (EDAssemblySyntax_t)0; // default } @@ -382,6 +383,10 @@ char triple[256]; if (TripleForArchSpec (arch, triple, sizeof(triple))) { +printf ("JSMDEBUG: Getting disassembler for triple %s\n", triple); +if (strcmp (triple, "x86_64-unknown-unknown") == 0) + strcpy (triple, "x86_64-apple-darwin"); +printf ("JSMDEBUG: Getting disassembler for triple fixed %s\n", triple); assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!"); } } Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Thu Nov 4 04:40:56 2010 @@ -34,7 +34,8 @@ RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number), - m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL) + m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL), m_base_reg_ctx (), m_frame_type (-1), + m_current_offset (0), m_sym_ctx_valid (false) { m_sym_ctx.Clear(); m_sym_ctx_valid = false; @@ -498,7 +499,7 @@ if (m_frame_type == eSigtrampFrame) { m_fast_unwind_plan = NULL; - UnwindPlan *up = fu->GetUnwindPlanAtCallSite (); + up = fu->GetUnwindPlanAtCallSite (); if (up->PlanValidAtAddress (m_current_pc)) { return up; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Thu Nov 4 04:40:56 2010 @@ -162,10 +162,15 @@ int m_wordsize; int m_cpu; + + DISALLOW_COPY_AND_ASSIGN (AssemblyParse_x86); }; AssemblyParse_x86::AssemblyParse_x86 (Target& target, Thread* thread, int cpu, AddressRange func) : - m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func) + m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func), + m_machine_ip_regnum (-1), m_machine_sp_regnum (-1), m_machine_fp_regnum (-1), + m_lldb_ip_regnum (-1), m_lldb_sp_regnum (-1), m_lldb_fp_regnum (-1), + m_wordsize (-1), m_cur_insn () { int *initialized_flag = NULL; m_lldb_ip_regnum = m_lldb_sp_regnum = m_lldb_fp_regnum = -1; @@ -519,7 +524,7 @@ m_cur_insn = m_func_bounds.GetBaseAddress (); int current_func_text_offset = 0; int current_sp_bytes_offset_from_cfa = 0; - UnwindPlan::Row::RegisterLocation regloc; + UnwindPlan::Row::RegisterLocation initial_regloc; if (!m_cur_insn.IsValid()) { @@ -535,13 +540,13 @@ row.SetCFAOffset (m_wordsize); // caller's stack pointer value before the call insn is the CFA address - regloc.SetIsCFAPlusOffset (0); - row.SetRegisterInfo (m_lldb_sp_regnum, regloc); + initial_regloc.SetIsCFAPlusOffset (0); + row.SetRegisterInfo (m_lldb_sp_regnum, initial_regloc); // saved instruction pointer can be found at CFA - wordsize. current_sp_bytes_offset_from_cfa = m_wordsize; - regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa); - row.SetRegisterInfo (m_lldb_ip_regnum, regloc); + initial_regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa); + row.SetRegisterInfo (m_lldb_ip_regnum, initial_regloc); unwind_plan.AppendRow (row); Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Thu Nov 4 04:40:56 2010 @@ -35,7 +35,7 @@ if (m_frames.empty()) { // First, set up the 0th (initial) frame - CursorSP first_cursor_sp(new Cursor); + CursorSP first_cursor_sp(new Cursor ()); RegisterContextSP no_frame; // an empty shared pointer RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0); if (!first_register_ctx->IsValid()) @@ -55,16 +55,16 @@ } // Reuse the StackFrame provided by the processor native machine context for the first frame first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get()); - RegisterContextSP temp_rcs(first_register_ctx); - first_cursor_sp->reg_ctx = temp_rcs; + RegisterContextSP first_register_ctx_sp(first_register_ctx); + first_cursor_sp->reg_ctx = first_register_ctx_sp; m_frames.push_back (first_cursor_sp); // Now walk up the rest of the stack while (1) { - CursorSP cursor_sp(new Cursor); + CursorSP cursor_sp(new Cursor ()); RegisterContextLLDB *register_ctx; - int cur_idx = m_frames.size (); + uint32_t cur_idx = m_frames.size (); register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1]->reg_ctx, cursor_sp->sctx, cur_idx); if (!register_ctx->IsValid()) { @@ -106,10 +106,10 @@ } break; } - RegisterContextSP temp_rcs(register_ctx); - StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); + RegisterContextSP register_ctx_sp(register_ctx); + StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, register_ctx_sp, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); register_ctx->SetStackFrame (frame); - cursor_sp->reg_ctx = temp_rcs; + cursor_sp->reg_ctx = register_ctx_sp; m_frames.push_back (cursor_sp); } } Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Thu Nov 4 04:40:56 2010 @@ -56,6 +56,7 @@ lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { } + DISALLOW_COPY_AND_ASSIGN (Cursor); }; typedef lldb::SharedPtr::Type CursorSP; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Nov 4 04:40:56 2010 @@ -26,6 +26,8 @@ #include "Utility/StringExtractorGDBRemote.h" #include "UnwindLibUnwind.h" #include "UnwindMacOSXFrameBackchain.h" +#include "UnwindLLDB.h" +#include "RegisterContextLLDB.h" using namespace lldb; using namespace lldb_private; @@ -128,7 +130,7 @@ const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ()); if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386")) { - m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace())); + m_unwinder_ap.reset (new UnwindLLDB (*this)); } else { Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Thu Nov 4 04:40:56 2010 @@ -35,7 +35,8 @@ m_cfi_data_initialized (false), m_fde_index (), m_fde_index_initialized (false), - m_is_eh_frame (is_eh_frame) + m_is_eh_frame (is_eh_frame), + m_flags () { } Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=118240&r1=118239&r2=118240&view=diff ============================================================================== --- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original) +++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Thu Nov 4 04:40:56 2010 @@ -105,7 +105,6 @@ Address current_pc; Target *target = thread.CalculateTarget(); - ArchSpec arch; if (target) { ArchSpec arch = target->GetArchitecture (); From jmolenda at apple.com Thu Nov 4 04:43:27 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 09:43:27 -0000 Subject: [Lldb-commits] [lldb] r118241 - /lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Message-ID: <20101104094327.86BA32A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 04:43:27 2010 New Revision: 118241 URL: http://llvm.org/viewvc/llvm-project?rev=118241&view=rev Log: Revert last checking to CommandObjectDisassemble.cpp; that was some diagnostic test code I was using while debugging the native unwinder and didn't mean to check in. Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=118241&r1=118240&r2=118241&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Nov 4 04:43:27 2010 @@ -21,19 +21,11 @@ #include "lldb/Core/Disassembler.h" #include "lldb/Interpreter/Options.h" #include "lldb/Core/SourceManager.h" -#include "lldb/Core/Stream.h" #include "lldb/Target/StackFrame.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Target/StackFrame.h" -#include "lldb/Target/Thread.h" -#include "lldb/Symbol/FuncUnwinders.h" -#include "lldb/Symbol/UnwindPlan.h" -#include "lldb/Symbol/DWARFCallFrameInfo.h" -#include "lldb/Utility/ArchVolatileRegs.h" - #define DEFAULT_DISASM_BYTE_SIZE 32 using namespace lldb; @@ -260,46 +252,7 @@ // The default action is to disassemble the current frame function. if (exe_ctx.frame) { -// SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); - SymbolContext sc(exe_ctx.frame->GetSymbolContext (eSymbolContextEverything)); - - ArchVolatileRegs *vr = ArchVolatileRegs::FindPlugin (exe_ctx.target->GetArchitecture()); - Address pc = exe_ctx.frame->GetFrameCodeAddress(); - FuncUnwindersSP fu = pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (pc, sc); - if (fu != NULL) - { - - Address first_non_prologue_insn = fu->GetFirstNonPrologueInsn (*exe_ctx.target); - UnwindPlan *up = fu->GetUnwindPlanAtCallSite(); - Stream *s = &result.GetOutputStream(); - if (up) - { - s->Printf ("\nJSMDEBUG: unwind plan at call site (from eh_frame)\n"); - up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); - } - else - { - result.GetOutputStream().Printf("No UnwindPlanAtCallSite available.\n"); - } - up = fu->GetUnwindPlanAtNonCallSite(exe_ctx.frame->GetThread()); - s->Printf ("\nJSMDEBUG: unwind plan at non-call site (from disassembly)\n"); - up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); - - up = fu->GetUnwindPlanFastUnwind(exe_ctx.frame->GetThread()); - if (up) - { - s->Printf ("\nJSMDEBUG: fast unwind plan\n"); - up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); - } - - up = fu->GetUnwindPlanArchitectureDefault(exe_ctx.frame->GetThread()); - if (up) - { - s->Printf ("\nJSMDEBUG: architectural default unwind plan\n"); - up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread()); - } - } - + SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); if (sc.function) range = sc.function->GetAddressRange(); else if (sc.symbol && sc.symbol->GetAddressRangePtr()) From jmolenda at apple.com Thu Nov 4 04:46:43 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 09:46:43 -0000 Subject: [Lldb-commits] [lldb] r118242 - /lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Message-ID: <20101104094643.5BEC32A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 04:46:43 2010 New Revision: 118242 URL: http://llvm.org/viewvc/llvm-project?rev=118242&view=rev Log: Revert last checking to ThreadGDBRemote.cpp; I accidentally checked that in along with some cleanup work with the native unwinder code. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=118242&r1=118241&r2=118242&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Nov 4 04:46:43 2010 @@ -26,8 +26,6 @@ #include "Utility/StringExtractorGDBRemote.h" #include "UnwindLibUnwind.h" #include "UnwindMacOSXFrameBackchain.h" -#include "UnwindLLDB.h" -#include "RegisterContextLLDB.h" using namespace lldb; using namespace lldb_private; @@ -130,7 +128,7 @@ const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ()); if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386")) { - m_unwinder_ap.reset (new UnwindLLDB (*this)); + m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace())); } else { From jmolenda at apple.com Thu Nov 4 04:51:29 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 09:51:29 -0000 Subject: [Lldb-commits] [lldb] r118243 - /lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Message-ID: <20101104095129.63DE62A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 04:51:29 2010 New Revision: 118243 URL: http://llvm.org/viewvc/llvm-project?rev=118243&view=rev Log: Add #ifdef to easily switch between the current libunwind-remote based unwinder or the native unwinder (UnwindLLDB). I'll make the native unwinder the default once I check in with everyone tomorrow. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=118243&r1=118242&r2=118243&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Nov 4 04:51:29 2010 @@ -26,6 +26,7 @@ #include "Utility/StringExtractorGDBRemote.h" #include "UnwindLibUnwind.h" #include "UnwindMacOSXFrameBackchain.h" +#include "UnwindLLDB.h" using namespace lldb; using namespace lldb_private; @@ -120,6 +121,10 @@ GetRegisterContext()->Invalidate(); } +// Whether to use the new native unwinder (UnwindLLDB) or the libunwind-remote based unwinder for +// stack walks on i386/x86_64 +#undef USE_NATIVE_UNWINDER + Unwind * ThreadGDBRemote::GetUnwinder () { @@ -128,7 +133,11 @@ const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ()); if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386")) { +#if defined (USE_NATIVE_UNWINDER) + m_unwinder_ap.reset (new UnwindLLDB (*this)); +#else m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace())); +#endif } else { From jmolenda at apple.com Thu Nov 4 04:53:38 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 09:53:38 -0000 Subject: [Lldb-commits] [lldb] r118244 - /lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Message-ID: <20101104095338.40ED82A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 04:53:38 2010 New Revision: 118244 URL: http://llvm.org/viewvc/llvm-project?rev=118244&view=rev Log: Revert last checkin to DisassemblerLLVM.cpp; that was some temporary debug printfs that got left behind by accident. Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=118244&r1=118243&r2=118244&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original) +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Thu Nov 4 04:53:38 2010 @@ -362,7 +362,6 @@ ((strcasestr (arch_name, "i386") == arch_name) || (strcasestr (arch_name, "x86_64") == arch_name))) return kEDAssemblySyntaxX86ATT; -printf ("JSMDEBUG: Warning returning 'default' as the assembly syntax style\n"); return (EDAssemblySyntax_t)0; // default } @@ -383,10 +382,6 @@ char triple[256]; if (TripleForArchSpec (arch, triple, sizeof(triple))) { -printf ("JSMDEBUG: Getting disassembler for triple %s\n", triple); -if (strcmp (triple, "x86_64-unknown-unknown") == 0) - strcpy (triple, "x86_64-apple-darwin"); -printf ("JSMDEBUG: Getting disassembler for triple fixed %s\n", triple); assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!"); } } From johnny.chen at apple.com Thu Nov 4 12:26:50 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 04 Nov 2010 17:26:50 -0000 Subject: [Lldb-commits] [lldb] r118251 - /lldb/trunk/test/class_types/TestClassTypes.py Message-ID: <20101104172650.31B3D2A6C12C@llvm.org> Author: johnny Date: Thu Nov 4 12:26:50 2010 New Revision: 118251 URL: http://llvm.org/viewvc/llvm-project?rev=118251&view=rev Log: Add two @skip decorators for assertion abort: @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") Modified: lldb/trunk/test/class_types/TestClassTypes.py Modified: lldb/trunk/test/class_types/TestClassTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=118251&r1=118250&r2=118251&view=diff ============================================================================== --- lldb/trunk/test/class_types/TestClassTypes.py (original) +++ lldb/trunk/test/class_types/TestClassTypes.py Thu Nov 4 12:26:50 2010 @@ -36,6 +36,7 @@ self.breakpoint_creation_by_filespec_python() @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8557478 # test/class_types test failures: runCmd: expr this->m_c_int def test_with_dsym_and_expr_parser(self): @@ -43,6 +44,7 @@ self.buildDsym() self.class_types_expr_parser() + @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8557478 # test/class_types test failures: runCmd: expr this->m_c_int def test_with_dwarf_and_expr_parser(self): From johnny.chen at apple.com Thu Nov 4 12:37:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 04 Nov 2010 17:37:20 -0000 Subject: [Lldb-commits] [lldb] r118252 - /lldb/trunk/test/forward/TestForwardDeclaration.py Message-ID: <20101104173720.41FDF2A6C12C@llvm.org> Author: johnny Date: Thu Nov 4 12:37:20 2010 New Revision: 118252 URL: http://llvm.org/viewvc/llvm-project?rev=118252&view=rev Log: Add one @skip decorator for assertion abort: @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") Modified: lldb/trunk/test/forward/TestForwardDeclaration.py Modified: lldb/trunk/test/forward/TestForwardDeclaration.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/forward/TestForwardDeclaration.py?rev=118252&r1=118251&r2=118252&view=diff ============================================================================== --- lldb/trunk/test/forward/TestForwardDeclaration.py (original) +++ lldb/trunk/test/forward/TestForwardDeclaration.py Thu Nov 4 12:37:20 2010 @@ -9,12 +9,15 @@ mydir = "forward" + @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym_and_run_command(self): """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" self.buildDsym() self.forward_declaration() + # The expected failure happens before the assert, so there's no need to @skip. + #@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8546815 # './dotest.py -v -t forward' fails for test_with_dwarf_and_run_command @unittest2.expectedFailure From jingham at apple.com Thu Nov 4 13:30:59 2010 From: jingham at apple.com (Jim Ingham) Date: Thu, 04 Nov 2010 18:30:59 -0000 Subject: [Lldb-commits] [lldb] r118255 - in /lldb/trunk: include/lldb/Target/ lldb.xcodeproj/ source/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/ source/Target/ Message-ID: <20101104183059.6BD162A6C12C@llvm.org> Author: jingham Date: Thu Nov 4 13:30:59 2010 New Revision: 118255 URL: http://llvm.org/viewvc/llvm-project?rev=118255&view=rev Log: Add a ObjC V1 runtime, and a generic AppleObjCRuntime plugin. Also move the Checker creation into the Apple Runtime code. Added: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ - copied from r118216, lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Removed: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/ Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h lldb/trunk/source/Target/ObjCLanguageRuntime.cpp lldb/trunk/source/lldb.cpp Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=118255&r1=118254&r2=118255&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Thu Nov 4 13:30:59 2010 @@ -55,8 +55,8 @@ void AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr); - ClangUtilityFunction * - CreateObjectChecker (const char *); + virtual ClangUtilityFunction * + CreateObjectChecker (const char *) = 0; protected: //------------------------------------------------------------------ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118255&r1=118254&r2=118255&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 4 13:30:59 2010 @@ -334,6 +334,10 @@ 4C139EA5124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */; }; 4C1AB23B1263E5F400D0F04A /* ThreadPlanTestCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */; }; 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */; }; + 4C61978C12823D4300FAFFCC /* AppleObjCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */; }; + 4C61978D12823D4300FAFFCC /* AppleObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C61978912823D4300FAFFCC /* AppleObjCRuntime.h */; }; + 4C61978E12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */; }; + 4C61978F12823D4300FAFFCC /* AppleObjCRuntimeV1.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C61978B12823D4300FAFFCC /* AppleObjCRuntimeV1.h */; }; 4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C74CB6212288704006A8171 /* Carbon.framework */; }; 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; 4CB4430C12491DDA00C13DC2 /* LanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */; }; @@ -950,12 +954,12 @@ 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = ""; }; 4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = ""; }; 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = ""; }; - 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCTrampolineHandler.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.cpp; sourceTree = ""; }; - 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCTrampolineHandler.h; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.h; sourceTree = ""; }; - 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleThreadPlanStepThroughObjCTrampoline.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.cpp; sourceTree = ""; }; - 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleThreadPlanStepThroughObjCTrampoline.h; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = ""; }; - 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV2.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp; sourceTree = ""; }; - 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV2.h; path = LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h; sourceTree = ""; }; + 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCTrampolineHandler.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp; sourceTree = ""; }; + 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCTrampolineHandler.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h; sourceTree = ""; }; + 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleThreadPlanStepThroughObjCTrampoline.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp; sourceTree = ""; }; + 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleThreadPlanStepThroughObjCTrampoline.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = ""; }; + 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV2.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp; sourceTree = ""; }; + 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV2.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h; sourceTree = ""; }; 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTestCondition.cpp; path = source/Target/ThreadPlanTestCondition.cpp; sourceTree = ""; }; 4C1AB23E1263E61100D0F04A /* ThreadPlanTestCondition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTestCondition.h; path = include/lldb/Target/ThreadPlanTestCondition.h; sourceTree = ""; }; 4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanShouldStopHere.h; path = include/lldb/Target/ThreadPlanShouldStopHere.h; sourceTree = ""; }; @@ -966,6 +970,10 @@ 4C43DF8A11069C3200E55CBF /* ThreadPlanStepOverRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverRange.cpp; path = source/Target/ThreadPlanStepOverRange.cpp; sourceTree = ""; }; 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCommands.cpp; path = source/Commands/CommandObjectCommands.cpp; sourceTree = ""; }; 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectCommands.h; path = source/Commands/CommandObjectCommands.h; sourceTree = ""; }; + 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntime.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp; sourceTree = ""; }; + 4C61978912823D4300FAFFCC /* AppleObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntime.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h; sourceTree = ""; }; + 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV1.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp; sourceTree = ""; }; + 4C61978B12823D4300FAFFCC /* AppleObjCRuntimeV1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV1.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h; sourceTree = ""; }; 4C74CB6212288704006A8171 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 4C98D3DA118FB96F00E575D0 /* ClangFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangFunction.cpp; path = source/Expression/ClangFunction.cpp; sourceTree = ""; }; 4C98D3DB118FB96F00E575D0 /* RecordingMemoryManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecordingMemoryManager.cpp; path = source/Expression/RecordingMemoryManager.cpp; sourceTree = ""; }; @@ -2181,14 +2189,18 @@ 4C139EA1124A8AD5000BFF8D /* ObjC */ = { isa = PBXGroup; children = ( - 4C139EA2124A8AE5000BFF8D /* AppleRuntimeV2 */, + 4C139EA2124A8AE5000BFF8D /* AppleRuntime */, ); name = ObjC; sourceTree = ""; }; - 4C139EA2124A8AE5000BFF8D /* AppleRuntimeV2 */ = { + 4C139EA2124A8AE5000BFF8D /* AppleRuntime */ = { isa = PBXGroup; children = ( + 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */, + 4C61978912823D4300FAFFCC /* AppleObjCRuntime.h */, + 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */, + 4C61978B12823D4300FAFFCC /* AppleObjCRuntimeV1.h */, 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */, 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */, 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */, @@ -2196,7 +2208,7 @@ 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */, 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */, ); - name = AppleRuntimeV2; + name = AppleRuntime; sourceTree = ""; }; 4CB443651249446F00C13DC2 /* LanguageRuntime */ = { @@ -2353,6 +2365,8 @@ 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */, 9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */, 2635DA87127D0D0400675BC1 /* SharingPtr.h in Headers */, + 4C61978D12823D4300FAFFCC /* AppleObjCRuntime.h in Headers */, + 4C61978F12823D4300FAFFCC /* AppleObjCRuntimeV1.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2424,7 +2438,6 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, @@ -2853,6 +2866,8 @@ AF68D3311255A111002FF25B /* UnwindLLDB.cpp in Sources */, 26424E3D125986CB0016D82C /* ValueObjectConstResult.cpp in Sources */, 4C1AB23B1263E5F400D0F04A /* ThreadPlanTestCondition.cpp in Sources */, + 4C61978C12823D4300FAFFCC /* AppleObjCRuntime.cpp in Sources */, + 4C61978E12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=118255&view=auto ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (added) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Thu Nov 4 13:30:59 2010 @@ -0,0 +1,333 @@ +//===-- AppleObjCRuntime.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "AppleObjCRuntime.h" +#include "AppleObjCTrampolineHandler.h" + +#include "llvm/Support/MachO.h" +#include "clang/AST/Type.h" + +#include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleList.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Scalar.h" +#include "lldb/Core/Section.h" +#include "lldb/Core/StreamString.h" +#include "lldb/Expression/ClangFunction.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +#include + +using namespace lldb; +using namespace lldb_private; + +bool +AppleObjCRuntime::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope) +{ + + // ObjC objects can only be pointers: + if (!object.IsPointerType()) + return NULL; + + // Make the argument list: we pass one arg, the address of our pointer, to the print function. + Scalar scalar; + + if (!ClangASTType::GetValueAsScalar (object.GetClangAST(), + object.GetClangType(), + object.GetDataExtractor(), + 0, + object.GetByteSize(), + scalar)) + return NULL; + + Value val(scalar); + return GetObjectDescription(str, val, exe_scope); + +} +bool +AppleObjCRuntime::GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) +{ + if (!m_read_objc_library) + return false; + + ExecutionContext exe_ctx; + exe_scope->CalculateExecutionContext(exe_ctx); + + if (!exe_ctx.process) + return false; + + // We need other parts of the exe_ctx, but the processes have to match. + assert (m_process == exe_ctx.process); + + // Get the function address for the print function. + const Address *function_address = GetPrintForDebuggerAddr(); + if (!function_address) + return false; + + if (value.GetClangType()) + { + clang::QualType value_type = clang::QualType::getFromOpaquePtr (value.GetClangType()); + if (!value_type->isObjCObjectPointerType()) + { + str.Printf ("Value doesn't point to an ObjC object.\n"); + return false; + } + } + else + { + // If it is not a pointer, see if we can make it into a pointer. + ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext(); + void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id(); + if (opaque_type_ptr == NULL) + opaque_type_ptr = ast_context->GetVoidPtrType(false); + value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr); + } + + ValueList arg_value_list; + arg_value_list.PushValue(value); + + // This is the return value: + const char *target_triple = exe_ctx.process->GetTargetTriple().GetCString(); + ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext(); + + void *return_qualtype = ast_context->GetCStringType(true); + Value ret; + ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype); + + // Now we're ready to call the function: + ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list); + StreamString error_stream; + + lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; + func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream); + + ClangFunction::ExecutionResults results + = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, true, 1000, true, ret); + if (results != ClangFunction::eExecutionCompleted) + { + str.Printf("Error evaluating Print Object function: %d.\n", results); + return false; + } + + addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + + // FIXME: poor man's strcpy - we should have a "read memory as string interface... + + Error error; + std::vector desc; + while (1) + { + char byte = '\0'; + if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1) + break; + + desc.push_back(byte); + + if (byte == '\0') + break; + } + + if (!desc.empty()) + { + str.PutCString(&desc.front()); + return true; + } + return false; + +} + +Address * +AppleObjCRuntime::GetPrintForDebuggerAddr() +{ + if (!m_PrintForDebugger_addr.get()) + { + ModuleList &modules = m_process->GetTarget().GetImages(); + + SymbolContextList contexts; + SymbolContext context; + + if((!modules.FindSymbolsWithNameAndType(ConstString ("_NSPrintForDebugger"), eSymbolTypeCode, contexts)) && + (!modules.FindSymbolsWithNameAndType(ConstString ("_CFPrintForDebugger"), eSymbolTypeCode, contexts))) + return NULL; + + contexts.GetContextAtIndex(0, context); + + m_PrintForDebugger_addr.reset(new Address(context.symbol->GetValue())); + } + + return m_PrintForDebugger_addr.get(); +} + +lldb::ValueObjectSP +AppleObjCRuntime::GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope) +{ + lldb::ValueObjectSP ret_sp; + return ret_sp; +} + +bool +AppleObjCRuntime::AppleIsModuleObjCLibrary (const ModuleSP &module_sp) +{ + const FileSpec &module_file_spec = module_sp->GetFileSpec(); + static ConstString ObjCName ("libobjc.A.dylib"); + + if (module_file_spec) + { + if (module_file_spec.GetFilename() == ObjCName) + return true; + } + + return false; +} + +bool +AppleObjCRuntime::IsModuleObjCLibrary (const ModuleSP &module_sp) +{ + return AppleIsModuleObjCLibrary(module_sp); +} + +bool +AppleObjCRuntime::ReadObjCLibrary (const ModuleSP &module_sp) +{ + // Maybe check here and if we have a handler already, and the UUID of this module is the same as the one in the + // current module, then we don't have to reread it? + m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->GetSP(), module_sp)); + if (m_objc_trampoline_handler_ap.get() != NULL) + { + m_read_objc_library = true; + return true; + } + else + return false; +} + +ThreadPlanSP +AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) +{ + ThreadPlanSP thread_plan_sp; + if (m_objc_trampoline_handler_ap.get()) + thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others); + return thread_plan_sp; +} + +//------------------------------------------------------------------ +// Static Functions +//------------------------------------------------------------------ +enum AppleObjCRuntime::RuntimeVersions +AppleObjCRuntime::GetObjCVersion (Process *process) +{ + ModuleList &images = process->GetTarget().GetImages(); + size_t num_images = images.GetSize(); + for (size_t i = 0; i < num_images; i++) + { + ModuleSP module_sp = images.GetModuleAtIndex(i); + if (AppleIsModuleObjCLibrary (module_sp)) + { + ObjectFile *ofile = module_sp->GetObjectFile(); + if (!ofile) + return eObjC_VersionUnknown; + + SectionList *sections = ofile->GetSectionList(); + if (!sections) + return eObjC_VersionUnknown; + SectionSP v1_telltale_section_sp = sections->FindSectionByName(ConstString ("__OBJC")); + if (v1_telltale_section_sp) + { + return eObjC_V1; + } + return eObjC_V2; + } + } + + return eObjC_VersionUnknown; +} + +//------------------------------------------------------------------ +// PluginInterface protocol +//------------------------------------------------------------------ +void +AppleObjCRuntime::GetPluginCommandHelp (const char *command, Stream *strm) +{ +} + +Error +AppleObjCRuntime::ExecutePluginCommand (Args &command, Stream *strm) +{ + Error error; + error.SetErrorString("No plug-in command are currently supported."); + return error; +} + +Log * +AppleObjCRuntime::EnablePluginLogging (Stream *strm, Args &command) +{ + return NULL; +} + +void +AppleObjCRuntime::ClearExceptionBreakpoints () +{ + if (!m_process) + return; + + if (m_objc_exception_bp_sp.get()) + { + m_process->GetTarget().RemoveBreakpointByID(m_objc_exception_bp_sp->GetID()); + m_objc_exception_bp_sp.reset(); + } +} + +bool +AppleObjCRuntime::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) +{ + if (!m_process) + return false; + + if (!stop_reason || + stop_reason->GetStopReason() != eStopReasonBreakpoint) + return false; + + uint64_t break_site_id = stop_reason->GetValue(); + lldb::BreakpointSiteSP bp_site_sp = m_process->GetBreakpointSiteList().FindByID(break_site_id); + + if (!bp_site_sp) + return false; + + uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); + + bool check_objc_exception = false; + break_id_t objc_exception_bid; + + if (m_objc_exception_bp_sp) + { + check_objc_exception = true; + objc_exception_bid = m_objc_exception_bp_sp->GetID(); + } + + for (uint32_t i = 0; i < num_owners; i++) + { + break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); + + if ((check_objc_exception && (bid == objc_exception_bid))) + return true; + } + + return false; +} Added: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=118255&view=auto ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (added) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Thu Nov 4 13:30:59 2010 @@ -0,0 +1,115 @@ +//===-- AppleObjCRuntime.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_AppleObjCRuntime_h_ +#define liblldb_AppleObjCRuntime_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Core/ValueObject.h" +#include "AppleObjCTrampolineHandler.h" +#include "AppleThreadPlanStepThroughObjCTrampoline.h" + +namespace lldb_private { + +class AppleObjCRuntime : + public lldb_private::ObjCLanguageRuntime +{ +public: + + enum RuntimeVersions { + eObjC_VersionUnknown = 0, + eObjC_V1 = 1, + eObjC_V2 = 2 + }; + + ~AppleObjCRuntime() { } + + // These are generic runtime functions: + virtual bool + GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope); + + virtual bool + GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope); + + virtual lldb::ValueObjectSP + GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope); + + // These are the ObjC specific functions. + + virtual bool + IsModuleObjCLibrary (const lldb::ModuleSP &module_sp); + + virtual bool + ReadObjCLibrary (const lldb::ModuleSP &module_sp); + + virtual bool + HasReadObjCLibrary () + { + return m_read_objc_library; + } + + virtual lldb::ThreadPlanSP + GetStepThroughTrampolinePlan (Thread &thread, bool stop_others); + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + // Note there is no CreateInstance, Initialize & Terminate functions here, because + // you can't make an instance of this generic runtime. + +protected: + static bool + AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp); + + static enum AppleObjCRuntime::RuntimeVersions + GetObjCVersion (Process *process); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ +public: + virtual void + GetPluginCommandHelp (const char *command, lldb_private::Stream *strm); + + virtual lldb_private::Error + ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm); + + virtual lldb_private::Log * + EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); + + virtual void + ClearExceptionBreakpoints (); + + virtual bool + ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); +protected: + Address * + GetPrintForDebuggerAddr(); + + std::auto_ptr
m_PrintForDebugger_addr; + bool m_read_objc_library; + std::auto_ptr m_objc_trampoline_handler_ap; + lldb::BreakpointSP m_objc_exception_bp_sp; + + AppleObjCRuntime(Process *process) : + lldb_private::ObjCLanguageRuntime(process), + m_read_objc_library (false), + m_objc_trampoline_handler_ap(NULL) + { } // Call CreateInstance instead. +}; + +} // namespace lldb_private + +#endif // liblldb_AppleObjCRuntime_h_ Added: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=118255&view=auto ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (added) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Thu Nov 4 13:30:59 2010 @@ -0,0 +1,252 @@ +//===-- AppleObjCRuntimeV1.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "AppleObjCRuntimeV1.h" +#include "AppleObjCTrampolineHandler.h" + +#include "llvm/Support/MachO.h" +#include "clang/AST/Type.h" + +#include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Scalar.h" +#include "lldb/Core/StreamString.h" +#include "lldb/Expression/ClangFunction.h" +#include "lldb/Expression/ClangUtilityFunction.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +#include + +using namespace lldb; +using namespace lldb_private; + +static const char *pluginName = "AppleObjCRuntimeV1"; +static const char *pluginDesc = "Apple Objective C Language Runtime - Version 1"; +static const char *pluginShort = "language.apple.objc.v1"; + +bool +AppleObjCRuntimeV1::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope) +{ + + // ObjC objects can only be pointers: + if (!object.IsPointerType()) + return NULL; + + // Make the argument list: we pass one arg, the address of our pointer, to the print function. + Scalar scalar; + + if (!ClangASTType::GetValueAsScalar (object.GetClangAST(), + object.GetClangType(), + object.GetDataExtractor(), + 0, + object.GetByteSize(), + scalar)) + return NULL; + + Value val(scalar); + return GetObjectDescription(str, val, exe_scope); + +} +bool +AppleObjCRuntimeV1::GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) +{ + if (!m_read_objc_library) + return false; + + ExecutionContext exe_ctx; + exe_scope->CalculateExecutionContext(exe_ctx); + + if (!exe_ctx.process) + return false; + + // We need other parts of the exe_ctx, but the processes have to match. + assert (m_process == exe_ctx.process); + + // Get the function address for the print function. + const Address *function_address = GetPrintForDebuggerAddr(); + if (!function_address) + return false; + + if (value.GetClangType()) + { + clang::QualType value_type = clang::QualType::getFromOpaquePtr (value.GetClangType()); + if (!value_type->isObjCObjectPointerType()) + { + str.Printf ("Value doesn't point to an ObjC object.\n"); + return false; + } + } + else + { + // If it is not a pointer, see if we can make it into a pointer. + ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext(); + void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id(); + if (opaque_type_ptr == NULL) + opaque_type_ptr = ast_context->GetVoidPtrType(false); + value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr); + } + + ValueList arg_value_list; + arg_value_list.PushValue(value); + + // This is the return value: + const char *target_triple = exe_ctx.process->GetTargetTriple().GetCString(); + ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext(); + + void *return_qualtype = ast_context->GetCStringType(true); + Value ret; + ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype); + + // Now we're ready to call the function: + ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list); + StreamString error_stream; + + lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; + func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream); + + ClangFunction::ExecutionResults results + = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, true, 1000, true, ret); + if (results != ClangFunction::eExecutionCompleted) + { + str.Printf("Error evaluating Print Object function: %d.\n", results); + return false; + } + + addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + + // FIXME: poor man's strcpy - we should have a "read memory as string interface... + + Error error; + std::vector desc; + while (1) + { + char byte = '\0'; + if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1) + break; + + desc.push_back(byte); + + if (byte == '\0') + break; + } + + if (!desc.empty()) + { + str.PutCString(&desc.front()); + return true; + } + return false; + +} + +lldb::ValueObjectSP +AppleObjCRuntimeV1::GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope) +{ + lldb::ValueObjectSP ret_sp; + return ret_sp; +} + +//------------------------------------------------------------------ +// Static Functions +//------------------------------------------------------------------ +lldb_private::LanguageRuntime * +AppleObjCRuntimeV1::CreateInstance (Process *process, lldb::LanguageType language) +{ + // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make + // sure we aren't using the V1 runtime. + if (language == eLanguageTypeObjC) + { + if (AppleObjCRuntime::GetObjCVersion (process) == AppleObjCRuntime::eObjC_V1) + return new AppleObjCRuntimeV1 (process); + else + return NULL; + } + else + return NULL; +} + +void +AppleObjCRuntimeV1::Initialize() +{ + PluginManager::RegisterPlugin (pluginName, + pluginDesc, + CreateInstance); +} + +void +AppleObjCRuntimeV1::Terminate() +{ + PluginManager::UnregisterPlugin (CreateInstance); +} + +//------------------------------------------------------------------ +// PluginInterface protocol +//------------------------------------------------------------------ +const char * +AppleObjCRuntimeV1::GetPluginName() +{ + return pluginName; +} + +const char * +AppleObjCRuntimeV1::GetShortPluginName() +{ + return pluginShort; +} + +uint32_t +AppleObjCRuntimeV1::GetPluginVersion() +{ + return 1; +} + +void +AppleObjCRuntimeV1::SetExceptionBreakpoints () +{ + if (!m_process) + return; + + if (!m_objc_exception_bp_sp) + { + m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "objc_exception_throw", + eFunctionNameTypeBase, + true); + } +} + +ClangUtilityFunction * +AppleObjCRuntimeV1::CreateObjectChecker(const char *name) +{ +// char buf[256]; +// +// assert(snprintf(&buf[0], sizeof(buf), +// "extern \"C\" int gdb_object_getClass(void *);" +// "extern \"C\" void " +// "%s(void *$__lldb_arg_obj)" +// "{" +// " void **isa_ptr = (void **)$__lldb_arg_obj;" +// " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" +// " abort();" +// "}", +// name) < sizeof(buf)); +// +// return new ClangUtilityFunction(buf, name); + return NULL; +} Added: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=118255&view=auto ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (added) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Thu Nov 4 13:30:59 2010 @@ -0,0 +1,83 @@ +//===-- AppleObjCRuntimeV1.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_AppleObjCRuntimeV1_h_ +#define liblldb_AppleObjCRuntimeV1_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-private.h" +#include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Core/ValueObject.h" +#include "AppleObjCRuntime.h" +#include "AppleObjCTrampolineHandler.h" +#include "AppleThreadPlanStepThroughObjCTrampoline.h" + +namespace lldb_private { + +class AppleObjCRuntimeV1 : + public AppleObjCRuntime +{ +public: + ~AppleObjCRuntimeV1() { } + + // These are generic runtime functions: + virtual bool + GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope); + + virtual bool + GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope); + + virtual lldb::ValueObjectSP + GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope); + + virtual ClangUtilityFunction * + CreateObjectChecker (const char *); + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static lldb_private::LanguageRuntime * + CreateInstance (Process *process, lldb::LanguageType language); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + virtual const char * + GetPluginName(); + + virtual const char * + GetShortPluginName(); + + virtual uint32_t + GetPluginVersion(); + + virtual void + SetExceptionBreakpoints (); + +protected: + +private: + AppleObjCRuntimeV1(Process *process) : + lldb_private::AppleObjCRuntime (process) + { } // Call CreateInstance instead. +}; + +} // namespace lldb_private + +#endif // liblldb_AppleObjCRuntimeV1_h_ Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=118255&r1=118216&r2=118255&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Nov 4 13:30:59 2010 @@ -22,6 +22,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Core/StreamString.h" #include "lldb/Expression/ClangFunction.h" +#include "lldb/Expression/ClangUtilityFunction.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -154,28 +155,6 @@ } -Address * -AppleObjCRuntimeV2::GetPrintForDebuggerAddr() -{ - if (!m_PrintForDebugger_addr.get()) - { - ModuleList &modules = m_process->GetTarget().GetImages(); - - SymbolContextList contexts; - SymbolContext context; - - if((!modules.FindSymbolsWithNameAndType(ConstString ("_NSPrintForDebugger"), eSymbolTypeCode, contexts)) && - (!modules.FindSymbolsWithNameAndType(ConstString ("_CFPrintForDebugger"), eSymbolTypeCode, contexts))) - return NULL; - - contexts.GetContextAtIndex(0, context); - - m_PrintForDebugger_addr.reset(new Address(context.symbol->GetValue())); - } - - return m_PrintForDebugger_addr.get(); -} - lldb::ValueObjectSP AppleObjCRuntimeV2::GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope) { @@ -183,45 +162,6 @@ return ret_sp; } -bool -AppleObjCRuntimeV2::IsModuleObjCLibrary (const ModuleSP &module_sp) -{ - const FileSpec &module_file_spec = module_sp->GetFileSpec(); - static ConstString ObjCName ("libobjc.A.dylib"); - - if (module_file_spec) - { - if (module_file_spec.GetFilename() == ObjCName) - return true; - } - - return false; -} - -bool -AppleObjCRuntimeV2::ReadObjCLibrary (const ModuleSP &module_sp) -{ - // Maybe check here and if we have a handler already, and the UUID of this module is the same as the one in the - // current module, then we don't have to reread it? - m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->GetSP(), module_sp)); - if (m_objc_trampoline_handler_ap.get() != NULL) - { - m_read_objc_library = true; - return true; - } - else - return false; -} - -ThreadPlanSP -AppleObjCRuntimeV2::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) -{ - ThreadPlanSP thread_plan_sp; - if (m_objc_trampoline_handler_ap.get()) - thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others); - return thread_plan_sp; -} - //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -231,7 +171,12 @@ // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make // sure we aren't using the V1 runtime. if (language == eLanguageTypeObjC) - return new AppleObjCRuntimeV2 (process); + { + if (AppleObjCRuntime::GetObjCVersion (process) == AppleObjCRuntime::eObjC_V2) + return new AppleObjCRuntimeV2 (process); + else + return NULL; + } else return NULL; } @@ -272,25 +217,6 @@ } void -AppleObjCRuntimeV2::GetPluginCommandHelp (const char *command, Stream *strm) -{ -} - -Error -AppleObjCRuntimeV2::ExecutePluginCommand (Args &command, Stream *strm) -{ - Error error; - error.SetErrorString("No plug-in command are currently supported."); - return error; -} - -Log * -AppleObjCRuntimeV2::EnablePluginLogging (Stream *strm, Args &command) -{ - return NULL; -} - -void AppleObjCRuntimeV2::SetExceptionBreakpoints () { if (!m_process) @@ -298,75 +224,28 @@ if (!m_objc_exception_bp_sp) { - ArchSpec arch_spec = m_process->GetTarget().GetArchitecture(); - - switch (arch_spec.GetCPUType()) - { - default: - break; - case llvm::MachO::CPUTypeI386: - m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, - "objc_exception_throw", - eFunctionNameTypeBase, - true); - break; - case llvm::MachO::CPUTypeX86_64: - m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, - "__cxa_throw", - eFunctionNameTypeBase, - true); - break; - } + m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL, + "__cxa_throw", + eFunctionNameTypeBase, + true); } } -void -AppleObjCRuntimeV2::ClearExceptionBreakpoints () -{ - if (!m_process) - return; - - if (m_objc_exception_bp_sp.get()) - { - m_process->GetTarget().RemoveBreakpointByID(m_objc_exception_bp_sp->GetID()); - m_objc_exception_bp_sp.reset(); - } -} +ClangUtilityFunction * +AppleObjCRuntimeV2::CreateObjectChecker(const char *name) +{ + char buf[256]; + + assert(snprintf(&buf[0], sizeof(buf), + "extern \"C\" int gdb_object_getClass(void *);" + "extern \"C\" void " + "%s(void *$__lldb_arg_obj)" + "{" + " void **isa_ptr = (void **)$__lldb_arg_obj;" + " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" + " abort();" + "}", + name) < sizeof(buf)); -bool -AppleObjCRuntimeV2::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) -{ - if (!m_process) - return false; - - if (!stop_reason || - stop_reason->GetStopReason() != eStopReasonBreakpoint) - return false; - - uint64_t break_site_id = stop_reason->GetValue(); - lldb::BreakpointSiteSP bp_site_sp = m_process->GetBreakpointSiteList().FindByID(break_site_id); - - if (!bp_site_sp) - return false; - - uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); - - bool check_objc_exception = false; - break_id_t objc_exception_bid; - - if (m_objc_exception_bp_sp) - { - check_objc_exception = true; - objc_exception_bid = m_objc_exception_bp_sp->GetID(); - } - - for (uint32_t i = 0; i < num_owners; i++) - { - break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID(); - - if ((check_objc_exception && (bid == objc_exception_bid))) - return true; - } - - return false; + return new ClangUtilityFunction(buf, name); } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=118255&r1=118216&r2=118255&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Thu Nov 4 13:30:59 2010 @@ -18,13 +18,14 @@ #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Core/ValueObject.h" +#include "AppleObjCRuntime.h" #include "AppleObjCTrampolineHandler.h" #include "AppleThreadPlanStepThroughObjCTrampoline.h" namespace lldb_private { class AppleObjCRuntimeV2 : - public lldb_private::ObjCLanguageRuntime + public AppleObjCRuntime { public: ~AppleObjCRuntimeV2() { } @@ -38,23 +39,11 @@ virtual lldb::ValueObjectSP GetDynamicValue (lldb::ValueObjectSP in_value, ExecutionContextScope *exe_scope); - - // These are the ObjC specific functions. - virtual bool - IsModuleObjCLibrary (const lldb::ModuleSP &module_sp); - virtual bool - ReadObjCLibrary (const lldb::ModuleSP &module_sp); + virtual ClangUtilityFunction * + CreateObjectChecker (const char *); + - virtual bool - HasReadObjCLibrary () - { - return m_read_objc_library; - } - - virtual lldb::ThreadPlanSP - GetStepThroughTrampolinePlan (Thread &thread, bool stop_others); - //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -80,36 +69,13 @@ GetPluginVersion(); virtual void - GetPluginCommandHelp (const char *command, lldb_private::Stream *strm); - - virtual lldb_private::Error - ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm); - - virtual lldb_private::Log * - EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); - - virtual void SetExceptionBreakpoints (); - virtual void - ClearExceptionBreakpoints (); - - virtual bool - ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); protected: - Address * - GetPrintForDebuggerAddr(); private: - std::auto_ptr
m_PrintForDebugger_addr; - bool m_read_objc_library; - std::auto_ptr m_objc_trampoline_handler_ap; - lldb::BreakpointSP m_objc_exception_bp_sp; - AppleObjCRuntimeV2(Process *process) : - lldb_private::ObjCLanguageRuntime(process), - m_read_objc_library (false), - m_objc_trampoline_handler_ap(NULL) + lldb_private::AppleObjCRuntime (process) { } // Call CreateInstance instead. }; Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=118255&r1=118254&r2=118255&view=diff ============================================================================== --- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Thu Nov 4 13:30:59 2010 @@ -11,7 +11,6 @@ #include "lldb/Core/Log.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/ValueObject.h" -#include "lldb/Expression/ClangUtilityFunction.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -51,22 +50,3 @@ return (*pos).second; return LLDB_INVALID_ADDRESS; } - -ClangUtilityFunction * -ObjCLanguageRuntime::CreateObjectChecker(const char *name) -{ - char buf[256]; - - assert(snprintf(&buf[0], sizeof(buf), - "extern \"C\" int gdb_object_getClass(void *);" - "extern \"C\" void " - "%s(void *$__lldb_arg_obj)" - "{" - " void **isa_ptr = (void **)$__lldb_arg_obj;" - " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" - " abort();" - "}", - name) < sizeof(buf)); - - return new ClangUtilityFunction(buf, name); -} Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=118255&r1=118254&r2=118255&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Thu Nov 4 13:30:59 2010 @@ -31,7 +31,8 @@ #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" -#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.h" +#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h" +#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" #include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h" @@ -78,6 +79,7 @@ DynamicLoaderMacOSXDYLD::Initialize(); ItaniumABILanguageRuntime::Initialize(); AppleObjCRuntimeV2::Initialize(); + AppleObjCRuntimeV1::Initialize(); ObjectContainerUniversalMachO::Initialize(); ObjectFileMachO::Initialize(); ProcessGDBRemote::Initialize(); @@ -116,6 +118,9 @@ #ifdef __APPLE__ DynamicLoaderMacOSXDYLD::Terminate(); + ItaniumABILanguageRuntime::Terminate(); + AppleObjCRuntimeV2::Terminate(); + AppleObjCRuntimeV1::Terminate(); ObjectContainerUniversalMachO::Terminate(); ObjectFileMachO::Terminate(); ProcessGDBRemote::Terminate(); From jmolenda at apple.com Thu Nov 4 17:29:24 2010 From: jmolenda at apple.com (Jason Molenda) Date: Thu, 04 Nov 2010 22:29:24 -0000 Subject: [Lldb-commits] [lldb] r118264 - /lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Message-ID: <20101104222924.D84EB2A6C12C@llvm.org> Author: jmolenda Date: Thu Nov 4 17:29:24 2010 New Revision: 118264 URL: http://llvm.org/viewvc/llvm-project?rev=118264&view=rev Log: Use the new native unwinder by default. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=118264&r1=118263&r2=118264&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Nov 4 17:29:24 2010 @@ -123,7 +123,7 @@ // Whether to use the new native unwinder (UnwindLLDB) or the libunwind-remote based unwinder for // stack walks on i386/x86_64 -#undef USE_NATIVE_UNWINDER +#define USE_NATIVE_UNWINDER Unwind * ThreadGDBRemote::GetUnwinder () From johnny.chen at apple.com Thu Nov 4 17:49:00 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 04 Nov 2010 22:49:00 -0000 Subject: [Lldb-commits] [lldb] r118265 - in /lldb/trunk/test: class_types/TestClassTypes.py forward/TestForwardDeclaration.py Message-ID: <20101104224901.0A1F92A6C12C@llvm.org> Author: johnny Date: Thu Nov 4 17:49:00 2010 New Revision: 118265 URL: http://llvm.org/viewvc/llvm-project?rev=118265&view=rev Log: Remove the @skip decorators for assertion aborts. Jim fixed them in r118255. Modified: lldb/trunk/test/class_types/TestClassTypes.py lldb/trunk/test/forward/TestForwardDeclaration.py Modified: lldb/trunk/test/class_types/TestClassTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=118265&r1=118264&r2=118265&view=diff ============================================================================== --- lldb/trunk/test/class_types/TestClassTypes.py (original) +++ lldb/trunk/test/class_types/TestClassTypes.py Thu Nov 4 17:49:00 2010 @@ -36,7 +36,6 @@ self.breakpoint_creation_by_filespec_python() @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8557478 # test/class_types test failures: runCmd: expr this->m_c_int def test_with_dsym_and_expr_parser(self): @@ -44,7 +43,6 @@ self.buildDsym() self.class_types_expr_parser() - @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8557478 # test/class_types test failures: runCmd: expr this->m_c_int def test_with_dwarf_and_expr_parser(self): Modified: lldb/trunk/test/forward/TestForwardDeclaration.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/forward/TestForwardDeclaration.py?rev=118265&r1=118264&r2=118265&view=diff ============================================================================== --- lldb/trunk/test/forward/TestForwardDeclaration.py (original) +++ lldb/trunk/test/forward/TestForwardDeclaration.py Thu Nov 4 17:49:00 2010 @@ -9,15 +9,12 @@ mydir = "forward" - @unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym_and_run_command(self): """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" self.buildDsym() self.forward_declaration() - # The expected failure happens before the assert, so there's no need to @skip. - #@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.") # rdar://problem/8546815 # './dotest.py -v -t forward' fails for test_with_dwarf_and_run_command @unittest2.expectedFailure From jingham at apple.com Thu Nov 4 18:08:26 2010 From: jingham at apple.com (Jim Ingham) Date: Thu, 04 Nov 2010 23:08:26 -0000 Subject: [Lldb-commits] [lldb] r118266 - /lldb/trunk/source/Commands/CommandObjectLog.cpp Message-ID: <20101104230826.4DBBA2A6C12C@llvm.org> Author: jingham Date: Thu Nov 4 18:08:26 2010 New Revision: 118266 URL: http://llvm.org/viewvc/llvm-project?rev=118266&view=rev Log: Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with: log timer enable 1 log timer dump Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=118266&r1=118265&r2=118266&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Thu Nov 4 18:08:26 2010 @@ -413,7 +413,7 @@ CommandObject (interpreter, "log timers", "Enable, disable, dump, and reset LLDB internal performance timers.", - "log timers < enable | disable | dump | reset >") + "log timers < enable | disable | dump | reset >") { } @@ -456,6 +456,24 @@ } } + else if (argc == 2) + { + const char *sub_command = args.GetArgumentAtIndex(0); + + if (strcasecmp(sub_command, "enable") == 0) + { + bool success; + uint32_t depth = Args::StringToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success); + if (success) + { + Timer::SetDisplayDepth (depth); + result.SetStatus(eReturnStatusSuccessFinishNoResult); + } + else + result.AppendError("Could not convert enable depth to an unsigned integer."); + } + } + if (!result.Succeeded()) { result.AppendError("Missing subcommand"); From jingham at apple.com Thu Nov 4 18:08:45 2010 From: jingham at apple.com (Jim Ingham) Date: Thu, 04 Nov 2010 23:08:45 -0000 Subject: [Lldb-commits] [lldb] r118267 - /lldb/trunk/source/Interpreter/CommandInterpreter.cpp Message-ID: <20101104230845.6236B2A6C12C@llvm.org> Author: jingham Date: Thu Nov 4 18:08:45 2010 New Revision: 118267 URL: http://llvm.org/viewvc/llvm-project?rev=118267&view=rev Log: Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with: log timer enable 1 log timer dump Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=118267&r1=118266&r2=118267&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Nov 4 18:08:45 2010 @@ -510,6 +510,8 @@ // result.AppendMessageWithFormat ("Processing command: %s\n", command_line); // } + Timer scoped_timer (__PRETTY_FUNCTION__, "Handling command: %s.", command_line); + m_debugger.UpdateExecutionContext (override_context); if (command_line == NULL || command_line[0] == '\0') From jingham at apple.com Thu Nov 4 18:19:21 2010 From: jingham at apple.com (Jim Ingham) Date: Thu, 04 Nov 2010 23:19:21 -0000 Subject: [Lldb-commits] [lldb] r118268 - in /lldb/trunk: include/lldb/Core/Timer.h source/Commands/CommandObjectLog.cpp source/Core/Timer.cpp Message-ID: <20101104231921.B0E7D2A6C12C@llvm.org> Author: jingham Date: Thu Nov 4 18:19:21 2010 New Revision: 118268 URL: http://llvm.org/viewvc/llvm-project?rev=118268&view=rev Log: Added a setting to "log timer" so you can see the incremental timings as well: log timer increment true/false Modified: lldb/trunk/include/lldb/Core/Timer.h lldb/trunk/source/Commands/CommandObjectLog.cpp lldb/trunk/source/Core/Timer.cpp Modified: lldb/trunk/include/lldb/Core/Timer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Timer.h?rev=118268&r1=118267&r2=118268&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Timer.h (original) +++ lldb/trunk/include/lldb/Core/Timer.h Thu Nov 4 18:19:21 2010 @@ -51,6 +51,9 @@ static void SetDisplayDepth (uint32_t depth); + + static void + SetQuiet (bool value); static void DumpCategoryTimes (Stream *s); Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=118268&r1=118267&r2=118268&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Thu Nov 4 18:19:21 2010 @@ -413,7 +413,7 @@ CommandObject (interpreter, "log timers", "Enable, disable, dump, and reset LLDB internal performance timers.", - "log timers < enable | disable | dump | reset >") + "log timers < enable | disable | dump | increment | reset >") { } @@ -472,6 +472,18 @@ else result.AppendError("Could not convert enable depth to an unsigned integer."); } + if (strcasecmp(sub_command, "increment") == 0) + { + bool success; + bool increment = Args::StringToBoolean(args.GetArgumentAtIndex(1), false, &success); + if (success) + { + Timer::SetQuiet (!increment); + result.SetStatus(eReturnStatusSuccessFinishNoResult); + } + else + result.AppendError("Could not convert increment value to boolean."); + } } if (!result.Succeeded()) Modified: lldb/trunk/source/Core/Timer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Timer.cpp?rev=118268&r1=118267&r2=118268&view=diff ============================================================================== --- lldb/trunk/source/Core/Timer.cpp (original) +++ lldb/trunk/source/Core/Timer.cpp Thu Nov 4 18:19:21 2010 @@ -28,7 +28,6 @@ typedef std::map CategoryMap; static pthread_key_t g_key; - static Mutex & GetCategoryMutex() { @@ -63,6 +62,12 @@ } void +Timer::SetQuiet (bool value) +{ + g_quiet = value; +} + +void Timer::Initialize () { Timer::g_file = stdout; From jingham at apple.com Thu Nov 4 19:18:21 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 05 Nov 2010 00:18:21 -0000 Subject: [Lldb-commits] [lldb] r118270 - in /lldb/trunk/source: Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Target/ThreadPlanStepInRange.cpp Target/ThreadPlanStepOverRange.cpp Message-ID: <20101105001821.8EA152A6C12C@llvm.org> Author: jingham Date: Thu Nov 4 19:18:21 2010 New Revision: 118270 URL: http://llvm.org/viewvc/llvm-project?rev=118270&view=rev Log: Handle stepping through ObjC vtable trampoline code. Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=118270&r1=118269&r2=118270&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Thu Nov 4 19:18:21 2010 @@ -15,7 +15,9 @@ // Project includes #include "AppleThreadPlanStepThroughObjCTrampoline.h" +#include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/Debugger.h" #include "lldb/Core/FileSpec.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" @@ -33,6 +35,351 @@ using namespace lldb; using namespace lldb_private; + +AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr) : + m_valid (true), + m_owner(owner), + m_header_addr (header_addr), + m_code_start_addr(0), + m_code_end_addr (0), + m_next_region (0) +{ + SetUpRegion (); +} + +void +AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion() +{ + // The header looks like: + // + // uint16_t headerSize + // uint16_t descSize + // uint32_t descCount + // void * next + // + // First read in the header: + + char memory_buffer[16]; + Process *process = m_owner->GetProcess(); + DataExtractor data(memory_buffer, sizeof(memory_buffer), + process->GetByteOrder(), + process->GetAddressByteSize()); + size_t actual_size = 8 + process->GetAddressByteSize(); + Error error; + size_t bytes_read = process->ReadMemory (m_header_addr, memory_buffer, actual_size, error); + if (bytes_read != actual_size) + { + m_valid = false; + return; + } + + uint32_t offset_ptr = 0; + uint16_t header_size = data.GetU16(&offset_ptr); + uint16_t descriptor_size = data.GetU16(&offset_ptr); + size_t num_descriptors = data.GetU32(&offset_ptr); + + m_next_region = data.GetPointer(&offset_ptr); + + // If the header size is 0, that means we've come in too early before this data is set up. + // Set ourselves as not valid, and continue. + if (header_size == 0) + { + m_valid = false; + return; + } + + // Now read in all the descriptors: + // The descriptor looks like: + // + // uint32_t offset + // uint32_t flags + // + // Where offset is either 0 - in which case it is unused, or + // it is the offset of the vtable code from the beginning of the descriptor record. + // Below, we'll convert that into an absolute code address, since I don't want to have + // to compute it over and over. + + // Ingest the whole descriptor array: + lldb::addr_t desc_ptr = m_header_addr + header_size; + size_t desc_array_size = num_descriptors * descriptor_size; + DataBufferSP data_sp(new DataBufferHeap (desc_array_size, '\0')); + uint8_t* dst = (uint8_t*)data_sp->GetBytes(); + + DataExtractor desc_extractor (dst, desc_array_size, + process->GetByteOrder(), + process->GetAddressByteSize()); + bytes_read = process->ReadMemory(desc_ptr, dst, desc_array_size, error); + if (bytes_read != desc_array_size) + { + m_valid = false; + return; + } + + // The actual code for the vtables will be laid out consecutively, so I also + // compute the start and end of the whole code block. + + offset_ptr = 0; + m_code_start_addr = 0; + m_code_end_addr = 0; + + for (int i = 0; i < num_descriptors; i++) + { + lldb::addr_t start_offset = offset_ptr; + uint32_t offset = desc_extractor.GetU32 (&offset_ptr); + uint32_t flags = desc_extractor.GetU32 (&offset_ptr); + lldb:addr_t code_addr = desc_ptr + start_offset + offset; + m_descriptors.push_back (VTableDescriptor(flags, code_addr)); + + if (m_code_start_addr == 0 || code_addr < m_code_start_addr) + m_code_start_addr = code_addr; + if (code_addr > m_code_end_addr) + m_code_end_addr = code_addr; + + offset_ptr = start_offset + descriptor_size; + } + // Finally, a little bird told me that all the vtable code blocks are the same size. + // Let's compute the blocks and if they are all the same add the size to the code end address: + lldb::addr_t code_size = 0; + bool all_the_same = true; + for (int i = 0; i < num_descriptors - 1; i++) + { + lldb::addr_t this_size = m_descriptors[i + 1].code_start - m_descriptors[i].code_start; + if (code_size == 0) + code_size = this_size; + else + { + if (this_size != code_size) + all_the_same = false; + if (this_size > code_size) + code_size = this_size; + } + } + if (all_the_same) + m_code_end_addr += code_size; +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::AddressInRegion (lldb::addr_t addr, uint32_t &flags) +{ + if (!IsValid()) + return false; + + if (addr < m_code_start_addr || addr > m_code_end_addr) + return false; + + std::vector::iterator pos, end = m_descriptors.end(); + for (pos = m_descriptors.begin(); pos != end; pos++) + { + if (addr <= (*pos).code_start) + { + flags = (*pos).flags; + return true; + } + } + return false; +} + +void +AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::Dump (Stream &s) +{ + s.Printf ("Header addr: 0x%llx Code start: 0x%llx Code End: 0x%llx Next: 0x%llx\n", + m_header_addr, m_code_start_addr, m_code_end_addr, m_next_region); + size_t num_elements = m_descriptors.size(); + for (size_t i = 0; i < num_elements; i++) + { + s.Indent(); + s.Printf ("Code start: 0x%llx Flags: %d\n", m_descriptors[i].code_start, m_descriptors[i].flags); + } +} + +AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (ProcessSP &process_sp, ModuleSP &objc_module_sp) : + m_process_sp(process_sp), + m_trampoline_header(LLDB_INVALID_ADDRESS), + m_trampolines_changed_bp_id(LLDB_INVALID_BREAK_ID), + m_objc_module_sp(objc_module_sp) +{ + +} + +AppleObjCTrampolineHandler::AppleObjCVTables::~AppleObjCVTables() +{ + if (m_trampolines_changed_bp_id != LLDB_INVALID_BREAK_ID) + m_process_sp->GetTarget().RemoveBreakpointByID (m_trampolines_changed_bp_id); +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () +{ + if (m_trampoline_header != LLDB_INVALID_ADDRESS) + return true; + Target &target = m_process_sp->GetTarget(); + + ModuleList &modules = target.GetImages(); + size_t num_modules = modules.GetSize(); + if (!m_objc_module_sp) + { + for (size_t i = 0; i < num_modules; i++) + { + if (m_process_sp->GetObjCLanguageRuntime()->IsModuleObjCLibrary (modules.GetModuleAtIndex(i))) + { + m_objc_module_sp = modules.GetModuleAtIndex(i); + break; + } + } + } + + if (m_objc_module_sp) + { + ConstString trampoline_name ("gdb_objc_trampolines"); + const Symbol *trampoline_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType(trampoline_name, + eSymbolTypeData); + if (trampoline_symbol != NULL) + { + const Address &temp_address = trampoline_symbol->GetValue(); + if (!temp_address.IsValid()) + return false; + + m_trampoline_header = temp_address.GetLoadAddress(&target); + if (m_trampoline_header == LLDB_INVALID_ADDRESS) + return false; + + // Next look up the "changed" symbol and set a breakpoint on that... + ConstString changed_name ("gdb_objc_trampolines_changed"); + const Symbol *changed_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType(changed_name, + eSymbolTypeCode); + if (changed_symbol != NULL) + { + const Address &temp_address = changed_symbol->GetValue(); + if (!temp_address.IsValid()) + return false; + + lldb::addr_t changed_addr = temp_address.GetLoadAddress(&target); + if (changed_addr != LLDB_INVALID_ADDRESS) + { + BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, + true); + if (trampolines_changed_bp_sp != NULL) + { + m_trampolines_changed_bp_id = trampolines_changed_bp_sp->GetID(); + trampolines_changed_bp_sp->SetCallback (RefreshTrampolines, this, true); + return true; + } + } + } + } + } + + return false; +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines (void *baton, + StoppointCallbackContext *context, + lldb::user_id_t break_id, + lldb::user_id_t break_loc_id) +{ + AppleObjCVTables *vtable_handler = (AppleObjCVTables *) baton; + if (vtable_handler->InitializeVTableSymbols()) + { + // The Update function is called with the address of an added region. So we grab that address, and + // feed it into ReadRegions. Of course, our friend the ABI will get the values for us. + Process *process = context->exe_ctx.process; + const ABI *abi = process->GetABI(); + + ClangASTContext *clang_ast_context = process->GetTarget().GetScratchClangASTContext(); + ValueList argument_values; + Value input_value; + void *clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false); + input_value.SetValueType (Value::eValueTypeScalar); + input_value.SetContext (Value::eContextTypeOpaqueClangQualType, clang_void_ptr_type); + argument_values.PushValue(input_value); + + bool success = abi->GetArgumentValues (*(context->exe_ctx.thread), argument_values); + if (!success) + return false; + + // Now get a pointer value from the zeroth argument. + Error error; + DataExtractor data; + error = argument_values.GetValueAtIndex(0)->GetValueAsData(&(context->exe_ctx), clang_ast_context->getASTContext(), data, 0); + uint32_t offset_ptr = 0; + lldb::addr_t region_addr = data.GetPointer(&offset_ptr); + + if (region_addr != 0) + vtable_handler->ReadRegions(region_addr); + } + return false; +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions () +{ + // The no argument version reads the start region from the value of the gdb_regions_header, and + // gets started from there. + + m_regions.clear(); + if (!InitializeVTableSymbols()) + return false; + char memory_buffer[8]; + DataExtractor data(memory_buffer, sizeof(memory_buffer), + m_process_sp->GetByteOrder(), + m_process_sp->GetAddressByteSize()); + Error error; + size_t bytes_read = m_process_sp->ReadMemory (m_trampoline_header, memory_buffer, m_process_sp->GetAddressByteSize(), error); + if (bytes_read != m_process_sp->GetAddressByteSize()) + return false; + + uint32_t offset_ptr = 0; + lldb::addr_t region_addr = data.GetPointer(&offset_ptr); + return ReadRegions (region_addr); +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions (lldb::addr_t region_addr) +{ + if (!m_process_sp) + return false; + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + + // We aren't starting at the trampoline symbol. + InitializeVTableSymbols (); + lldb::addr_t next_region = region_addr; + + // Read in the sizes of the headers. + while (next_region != 0) + { + m_regions.push_back (VTableRegion(this, next_region)); + if (!m_regions.back().IsValid()) + { + m_regions.clear(); + return false; + } + if (log) + { + StreamString s; + m_regions.back().Dump(s); + log->Printf("Read vtable region: \n%s", s.GetData()); + } + + next_region = m_regions.back().GetNextRegionAddr(); + } + + return true; +} + +bool +AppleObjCTrampolineHandler::AppleObjCVTables::IsAddressInVTables (lldb::addr_t addr, uint32_t &flags) +{ + region_collection::iterator pos, end = m_regions.end(); + for (pos = m_regions.begin(); pos != end; pos++) + { + if ((*pos).AddressInRegion (addr, flags)) + return true; + } + return false; +} + const AppleObjCTrampolineHandler::DispatchFunction AppleObjCTrampolineHandler::g_dispatch_functions[] = { @@ -60,24 +407,9 @@ {NULL} }; -bool -AppleObjCTrampolineHandler::ModuleIsObjCLibrary (const ModuleSP &module_sp) -{ - const FileSpec &module_file_spec = module_sp->GetFileSpec(); - static ConstString ObjCName ("libobjc.A.dylib"); - - if (module_file_spec) - { - if (module_file_spec.GetFilename() == ObjCName) - return true; - } - - return false; -} - -AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module) : +AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp) : m_process_sp (process_sp), - m_objc_module_sp (objc_module), + m_objc_module_sp (objc_module_sp), m_impl_fn_addr (LLDB_INVALID_ADDRESS), m_impl_stret_fn_addr (LLDB_INVALID_ADDRESS) { @@ -119,6 +451,11 @@ m_msgSend_map.insert(std::pair(sym_addr, i)); } } + + // Build our vtable dispatch handler here: + m_vtables_ap.reset(new AppleObjCVTables(process_sp, m_objc_module_sp)); + if (m_vtables_ap.get()) + m_vtables_ap->ReadRegions(); } ThreadPlanSP @@ -127,13 +464,38 @@ ThreadPlanSP ret_plan_sp; lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC(); + DispatchFunction this_dispatch; + bool found_it = false; + MsgsendMap::iterator pos; pos = m_msgSend_map.find (curr_pc); if (pos != m_msgSend_map.end()) { + this_dispatch = g_dispatch_functions[(*pos).second]; + found_it = true; + } + + if (!found_it) + { + uint32_t flags; + if (m_vtables_ap.get()) + { + found_it = m_vtables_ap->IsAddressInVTables (curr_pc, flags); + if (found_it) + { + this_dispatch.name = "vtable"; + this_dispatch.stret_return + = (flags & AppleObjCVTables::eOBJC_TRAMPOLINE_STRET) == AppleObjCVTables::eOBJC_TRAMPOLINE_STRET; + this_dispatch.is_super = false; + this_dispatch.fixedup = DispatchFunction::eFixUpFixed; + } + } + } + + if (found_it) + { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); - const DispatchFunction *this_dispatch = &g_dispatch_functions[(*pos).second]; lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); @@ -161,7 +523,7 @@ // If this is a struct return dispatch, then the first argument is the // return struct pointer, and the object is the second, and the selector is the third. // Otherwise the object is the first and the selector the second. - if (this_dispatch->stret_return) + if (this_dispatch.stret_return) { obj_index = 1; sel_index = 2; @@ -197,7 +559,7 @@ isa_value.SetValueType(Value::eValueTypeLoadAddress); isa_value.ResolveValue(&exec_ctx, clang_ast_context->getASTContext()); - if (this_dispatch->fixedup == DispatchFunction::eFixUpFixed) + if (this_dispatch.fixedup == DispatchFunction::eFixUpFixed) { // For the FixedUp method the Selector is actually a pointer to a // structure, the second field of which is the selector number. @@ -206,7 +568,7 @@ sel_value->SetValueType(Value::eValueTypeLoadAddress); sel_value->ResolveValue(&exec_ctx, clang_ast_context->getASTContext()); } - else if (this_dispatch->fixedup == DispatchFunction::eFixUpToFix) + else if (this_dispatch.fixedup == DispatchFunction::eFixUpToFix) { // FIXME: If the method dispatch is not "fixed up" then the selector is actually a // pointer to the string name of the selector. We need to look that up... @@ -219,7 +581,7 @@ // FIXME: If this is a dispatch to the super-class, we need to get the super-class from // the class, and disaptch to that instead. // But for now I just punt and return no plan. - if (this_dispatch->is_super) + if (this_dispatch.is_super) { if (log) log->Printf ("Punting on stepping into super method dispatch."); @@ -244,7 +606,7 @@ if (impl_addr == LLDB_INVALID_ADDRESS) { - Address resolve_address(NULL, this_dispatch->stret_return ? m_impl_stret_fn_addr : m_impl_fn_addr); + Address resolve_address(NULL, this_dispatch.stret_return ? m_impl_stret_fn_addr : m_impl_fn_addr); StreamString errors; { @@ -289,6 +651,12 @@ dispatch_values.GetValueAtIndex(0)->GetScalar().ULongLong(), dispatch_values.GetValueAtIndex(1)->GetScalar().ULongLong(), stop_others)); + if (log) + { + StreamString s; + ret_plan_sp->GetDescription(&s, eDescriptionLevelFull); + log->Printf("Using ObjC step plan: %s.\n", s.GetData()); + } } else { Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=118270&r1=118269&r2=118270&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Thu Nov 4 19:18:21 2010 @@ -31,9 +31,7 @@ AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp); ~AppleObjCTrampolineHandler() {} - - static bool ModuleIsObjCLibrary (const ModuleSP &module_sp); - + ThreadPlanSP GetStepThroughDispatchPlan (Thread &thread, bool stop_others); @@ -57,6 +55,127 @@ }; private: + + class AppleObjCVTables + { + public: + // These come from objc-gdb.h. + enum VTableFlags + { + eOBJC_TRAMPOLINE_MESSAGE = (1<<0), // trampoline acts like objc_msgSend + eOBJC_TRAMPOLINE_STRET = (1<<1), // trampoline is struct-returning + eOBJC_TRAMPOLINE_VTABLE = (1<<2), // trampoline is vtable dispatcher + }; + + private: + struct VTableDescriptor + { + VTableDescriptor(uint32_t in_flags, addr_t in_code_start) : + flags(in_flags), + code_start(in_code_start) {} + + uint32_t flags; + lldb::addr_t code_start; + }; + + + class VTableRegion + { + public: + VTableRegion() : + m_valid (false), + m_owner (NULL), + m_header_addr (LLDB_INVALID_ADDRESS), + m_code_start_addr(0), + m_code_end_addr (0), + m_next_region (0) + {} + + VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr); + + void SetUpRegion(); + + lldb::addr_t GetNextRegionAddr () + { + return m_next_region; + } + + lldb::addr_t + GetCodeStart () + { + return m_code_start_addr; + } + + lldb::addr_t + GetCodeEnd () + { + return m_code_end_addr; + } + + uint32_t + GetFlagsForVTableAtAddress (lldb::addr_t address) + { + return 0; + } + + bool + IsValid () + { + return m_valid; + } + + bool + AddressInRegion (lldb::addr_t addr, uint32_t &flags); + + void + Dump (Stream &s); + + public: + bool m_valid; + AppleObjCVTables *m_owner; + lldb::addr_t m_header_addr; + lldb::addr_t m_code_start_addr; + lldb::addr_t m_code_end_addr; + std::vector m_descriptors; + lldb::addr_t m_next_region; + }; + + public: + AppleObjCVTables(ProcessSP &process_sp, ModuleSP &objc_module_sp); + + ~AppleObjCVTables(); + + bool + InitializeVTableSymbols (); + + static bool RefreshTrampolines (void *baton, + StoppointCallbackContext *context, + lldb::user_id_t break_id, + lldb::user_id_t break_loc_id); + bool + ReadRegions (); + + bool + ReadRegions (lldb::addr_t region_addr); + + bool + IsAddressInVTables (lldb::addr_t addr, uint32_t &flags); + + Process *GetProcess () + { + return m_process_sp.get(); + } + + private: + ProcessSP m_process_sp; + typedef std::vector region_collection; + lldb::addr_t m_trampoline_header; + lldb::break_id_t m_trampolines_changed_bp_id; + region_collection m_regions; + lldb::ModuleSP m_objc_module_sp; + + }; + static const DispatchFunction g_dispatch_functions[]; typedef std::map MsgsendMap; // This table maps an dispatch fn address to the index in g_dispatch_functions @@ -68,6 +187,7 @@ Mutex m_impl_function_mutex; lldb::addr_t m_impl_fn_addr; lldb::addr_t m_impl_stret_fn_addr; + std::auto_ptr m_vtables_ap; }; Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp?rev=118270&r1=118269&r2=118270&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Thu Nov 4 19:18:21 2010 @@ -115,6 +115,13 @@ lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong(); Address target_address(NULL, target_addr); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + if (target_addr == 0) + { + if (log) + log->Printf("Got target implementation of 0x0, stopping."); + SetPlanComplete(); + return true; + } if (log) log->Printf("Running to ObjC method implementation: 0x%llx", target_addr); Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=118270&r1=118269&r2=118270&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Thu Nov 4 19:18:21 2010 @@ -83,23 +83,6 @@ if (InRange()) return false; - // If we're in an older frame then we should stop. - if (FrameIsOlder()) - return true; - - // See if we are in a place we should step through (i.e. a trampoline of some sort): - // One tricky bit here is that some stubs don't push a frame, so we have to check - // both the case of a frame that is younger, or the same as this frame. - // However, if the frame is the same, and we are still in the symbol we started - // in, the we don't need to do this. This first check isn't strictly necessary, - // but it is more efficient. - - if (!FrameIsYounger() && InSymbol()) - { - SetPlanComplete(); - return true; - } - ThreadPlan* new_plan = NULL; // Stepping through should be done stopping other threads in general, since we're setting a breakpoint and @@ -111,7 +94,39 @@ else stop_others = false; - new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others); + if (FrameIsOlder()) + { + // If we're in an older frame then we should stop. + // + // A caveat to this is if we think the frame is older but we're actually in a trampoline. + // I'm going to make the assumption that you wouldn't RETURN to a trampoline. So if we are + // in a trampoline we think the frame is older because the trampoline confused the backtracer. + new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others); + if (new_plan == NULL) + return true; + else if (log) + { + log->Printf("Thought I stepped out, but in fact arrived at a trampoline."); + } + + } + else if (!FrameIsYounger() && InSymbol()) + { + // If we are not in a place we should step through, we're done. + // One tricky bit here is that some stubs don't push a frame, so we have to check + // both the case of a frame that is younger, or the same as this frame. + // However, if the frame is the same, and we are still in the symbol we started + // in, the we don't need to do this. This first check isn't strictly necessary, + // but it is more efficient. + + SetPlanComplete(); + return true; + } + + // We may have set the plan up above in the FrameIsOlder section: + + if (new_plan == NULL) + new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others); if (log) { Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=118270&r1=118269&r2=118270&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Thu Nov 4 19:18:21 2010 @@ -88,7 +88,19 @@ ThreadPlan* new_plan = NULL; if (FrameIsOlder()) - return true; + { + // If we're in an older frame then we should stop. + // + // A caveat to this is if we think the frame is older but we're actually in a trampoline. + // I'm going to make the assumption that you wouldn't RETURN to a trampoline. So if we are + // in a trampoline we think the frame is older because the trampoline confused the backtracer. + // As below, we step through first, and then try to figure out how to get back out again. + + new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others); + + if (new_plan != NULL && log) + log->Printf("Thought I stepped out, but in fact arrived at a trampoline."); + } else if (FrameIsYounger()) { new_plan = m_thread.QueueThreadPlanForStepOut (false, NULL, true, stop_others, lldb::eVoteNo, lldb::eVoteNoOpinion); From scallanan at apple.com Thu Nov 4 19:57:06 2010 From: scallanan at apple.com (Sean Callanan) Date: Fri, 05 Nov 2010 00:57:06 -0000 Subject: [Lldb-commits] [lldb] r118271 - in /lldb/trunk/source: Expression/ClangUserExpression.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Message-ID: <20101105005706.960B42A6C12C@llvm.org> Author: spyffe Date: Thu Nov 4 19:57:06 2010 New Revision: 118271 URL: http://llvm.org/viewvc/llvm-project?rev=118271&view=rev Log: Fixed error handling when the utility functions that check pointer validity fail to parse. Now lldb does not crash in that case. Also added support for checking Objective-C class validity in the Version 1 runtime as well as Version 2 runtimes with varying levels of available debug support. Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Thu Nov 4 19:57:06 2010 @@ -449,8 +449,16 @@ StreamString install_errors; if (!dynamic_checkers->Install(install_errors, exe_ctx)) + { + if (install_errors.GetString().empty()) + error.SetErrorString ("couldn't install checkers, unknown error"); + else + error.SetErrorString (install_errors.GetString().c_str()); + + result_valobj_sp.reset (new ValueObjectConstResult (error)); return result_valobj_sp; - + } + exe_ctx.process->SetDynamicCheckers(dynamic_checkers); } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Thu Nov 4 19:57:06 2010 @@ -231,7 +231,7 @@ // Static Functions //------------------------------------------------------------------ enum AppleObjCRuntime::RuntimeVersions -AppleObjCRuntime::GetObjCVersion (Process *process) +AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp) { ModuleList &images = process->GetTarget().GetImages(); size_t num_images = images.GetSize(); @@ -240,6 +240,7 @@ ModuleSP module_sp = images.GetModuleAtIndex(i); if (AppleIsModuleObjCLibrary (module_sp)) { + objc_module_sp = module_sp; ObjectFile *ofile = module_sp->GetObjectFile(); if (!ofile) return eObjC_VersionUnknown; Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Thu Nov 4 19:57:06 2010 @@ -74,7 +74,7 @@ AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp); static enum AppleObjCRuntime::RuntimeVersions - GetObjCVersion (Process *process); + GetObjCVersion (Process *process, ModuleSP &objc_module_sp); //------------------------------------------------------------------ // PluginInterface protocol Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Thu Nov 4 19:57:06 2010 @@ -172,7 +172,9 @@ // sure we aren't using the V1 runtime. if (language == eLanguageTypeObjC) { - if (AppleObjCRuntime::GetObjCVersion (process) == AppleObjCRuntime::eObjC_V1) + ModuleSP objc_module_sp; + + if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == AppleObjCRuntime::eObjC_V1) return new AppleObjCRuntimeV1 (process); else return NULL; @@ -231,22 +233,36 @@ } } +struct BufStruct { + char contents[2048]; +}; + ClangUtilityFunction * AppleObjCRuntimeV1::CreateObjectChecker(const char *name) { -// char buf[256]; -// -// assert(snprintf(&buf[0], sizeof(buf), -// "extern \"C\" int gdb_object_getClass(void *);" -// "extern \"C\" void " -// "%s(void *$__lldb_arg_obj)" -// "{" -// " void **isa_ptr = (void **)$__lldb_arg_obj;" -// " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" -// " abort();" -// "}", -// name) < sizeof(buf)); -// -// return new ClangUtilityFunction(buf, name); - return NULL; + std::auto_ptr buf(new BufStruct); + + assert(snprintf(&buf->contents[0], sizeof(buf->contents), + "struct __objc_class \n" + "{ \n" + " struct __objc_class *isa; \n" + " struct __objc_class *super_class; \n" + " const char *name; \n" + " // rest of struct elided because unused \n" + "}; \n" + " \n" + "struct __objc_object \n" + "{ \n" + " struct __objc_class *isa; \n" + "}; \n" + " \n" + "extern \"C\" void \n" + "%s(void *$__lldb_arg_obj) \n" + "{ \n" + " struct __objc_object *obj = (struct __objc_object*)$__lldb_arg_obj; \n" + " strlen(obj->isa->name); \n" + "} \n", + name) < sizeof(buf->contents)); + + return new ClangUtilityFunction(buf->contents, name); } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Nov 4 19:57:06 2010 @@ -40,6 +40,12 @@ static const char *pluginDesc = "Apple Objective C Language Runtime - Version 2"; static const char *pluginShort = "language.apple.objc.v2"; +AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process, ModuleSP &objc_module_sp) : + lldb_private::AppleObjCRuntime (process) +{ + m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(ConstString("gdb_object_getClass")) != NULL); +} + bool AppleObjCRuntimeV2::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope) { @@ -172,8 +178,10 @@ // sure we aren't using the V1 runtime. if (language == eLanguageTypeObjC) { - if (AppleObjCRuntime::GetObjCVersion (process) == AppleObjCRuntime::eObjC_V2) - return new AppleObjCRuntimeV2 (process); + ModuleSP objc_module_sp; + + if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == AppleObjCRuntime::eObjC_V2) + return new AppleObjCRuntimeV2 (process, objc_module_sp); else return NULL; } @@ -231,21 +239,40 @@ } } +struct BufStruct { + char contents[1024]; +}; + ClangUtilityFunction * AppleObjCRuntimeV2::CreateObjectChecker(const char *name) { - char buf[256]; + std::auto_ptr buf(new BufStruct); - assert(snprintf(&buf[0], sizeof(buf), - "extern \"C\" int gdb_object_getClass(void *);" - "extern \"C\" void " - "%s(void *$__lldb_arg_obj)" - "{" - " void **isa_ptr = (void **)$__lldb_arg_obj;" - " if (!isa_ptr || !gdb_class_getClass(*isa_ptr))" - " abort();" - "}", - name) < sizeof(buf)); - - return new ClangUtilityFunction(buf, name); + if (m_has_object_getClass) + { + assert(snprintf(&buf->contents[0], sizeof(buf->contents), + "extern \"C\" int gdb_object_getClass(void *); \n" + "extern \"C\" void \n" + "%s(void *$__lldb_arg_obj) \n" + "{ \n" + " if (!gdb_object_getClass($__lldb_arg_obj)) \n" + " abort(); \n" + "} \n", + name) < sizeof(buf->contents)); + } + else + { + assert(snprintf(&buf->contents[0], sizeof(buf->contents), + "extern \"C\" int gdb_class_getClass(void *); \n" + "extern \"C\" void \n" + "%s(void *$__lldb_arg_obj) \n" + "{ \n" + " void **isa_ptr = (void **)$__lldb_arg_obj; \n" + " if (!isa_ptr || !gdb_class_getClass(*isa_ptr)) \n" + " abort(); \n" + "} \n", + name) < sizeof(buf->contents)); + } + + return new ClangUtilityFunction(buf->contents, name); } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=118271&r1=118270&r2=118271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Thu Nov 4 19:57:06 2010 @@ -74,9 +74,9 @@ protected: private: - AppleObjCRuntimeV2(Process *process) : - lldb_private::AppleObjCRuntime (process) - { } // Call CreateInstance instead. + AppleObjCRuntimeV2(Process *process, ModuleSP &objc_module_sp); + + bool m_has_object_getClass; }; } // namespace lldb_private From johnny.chen at apple.com Fri Nov 5 11:51:44 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 05 Nov 2010 16:51:44 -0000 Subject: [Lldb-commits] [lldb] r118277 - in /lldb/trunk/utils/emacs: gud-diffs.txt gud.el Message-ID: <20101105165144.8C2CD2A6C12C@llvm.org> Author: johnny Date: Fri Nov 5 11:51:44 2010 New Revision: 118277 URL: http://llvm.org/viewvc/llvm-project?rev=118277&view=rev Log: Make lldb dump fullpath instead of just basename when printing out frame or thread descriptions. This allows for correctly finding and obeying the last filename-and-line marker from the debugger. Add a delay for gud-up and gud-down. This makes tracking filename-and-line more reliable when moving up/down the stack. Removed: lldb/trunk/utils/emacs/gud-diffs.txt Modified: lldb/trunk/utils/emacs/gud.el Removed: lldb/trunk/utils/emacs/gud-diffs.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud-diffs.txt?rev=118276&view=auto ============================================================================== --- lldb/trunk/utils/emacs/gud-diffs.txt (original) +++ lldb/trunk/utils/emacs/gud-diffs.txt (removed) @@ -1,255 +0,0 @@ ---- /tmp/gud.el 2009-05-06 05:16:32.000000000 -0700 -+++ utils/emacs/gud.el 2010-11-01 10:13:13.000000000 -0700 -@@ -144,12 +144,12 @@ - (display-graphic-p) - (fboundp 'x-show-tip)) - :visible (memq gud-minor-mode -- '(gdbmi gdba dbx sdb xdb pdb)) -+ '(lldb gdbmi gdba dbx sdb xdb pdb)) - :button (:toggle . gud-tooltip-mode)) - ([refresh] "Refresh" . gud-refresh) - ([run] menu-item "Run" gud-run - :enable (not gud-running) -- :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) -+ :visible (memq gud-minor-mode '(lldb gdbmi gdb dbx jdb))) - ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go - :visible (and (not gud-running) - (eq gud-minor-mode 'gdba))) -@@ -167,18 +167,18 @@ - ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak - :enable (not gud-running) - :visible (memq gud-minor-mode -- '(gdbmi gdba gdb sdb xdb))) -+ '(lldb gdbmi gdba gdb sdb xdb))) - ([break] menu-item "Set Breakpoint" gud-break - :enable (not gud-running) - :visible (gud-tool-bar-item-visible-no-fringe)) - ([up] menu-item "Up Stack" gud-up - :enable (not gud-running) - :visible (memq gud-minor-mode -- '(gdbmi gdba gdb dbx xdb jdb pdb))) -+ '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) - ([down] menu-item "Down Stack" gud-down - :enable (not gud-running) - :visible (memq gud-minor-mode -- '(gdbmi gdba gdb dbx xdb jdb pdb))) -+ '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) - ([pp] menu-item "Print S-expression" gud-pp - :enable (and (not gud-running) - gdb-active-process) -@@ -188,7 +188,7 @@ - (eq gud-minor-mode 'gdba))) - ([print*] menu-item "Print Dereference" gud-pstar - :enable (not gud-running) -- :visible (memq gud-minor-mode '(gdbmi gdba gdb))) -+ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb))) - ([print] menu-item "Print Expression" gud-print - :enable (not gud-running)) - ([watch] menu-item "Watch Expression" gud-watch -@@ -197,13 +197,13 @@ - ([finish] menu-item "Finish Function" gud-finish - :enable (not gud-running) - :visible (memq gud-minor-mode -- '(gdbmi gdba gdb xdb jdb pdb))) -+ '(lldb gdbmi gdba gdb xdb jdb pdb))) - ([stepi] menu-item "Step Instruction" gud-stepi - :enable (not gud-running) -- :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) -+ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) - ([nexti] menu-item "Next Instruction" gud-nexti - :enable (not gud-running) -- :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) -+ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) - ([step] menu-item "Step Line" gud-step - :enable (not gud-running)) - ([next] menu-item "Next Line" gud-next -@@ -350,6 +350,7 @@ - %l -- Number of current source line. - %e -- Text of the C lvalue or function-call expression surrounding point. - %a -- Text of the hexadecimal address surrounding point. -+ %b -- Text of the most recently created breakpoint id. - %p -- Prefix argument to the command (if any) as a number. - %c -- Fully qualified class name derived from the expression - surrounding point (jdb only). -@@ -930,6 +931,131 @@ - - - ;; ====================================================================== -+;; lldb functions -+ -+;; History of argument lists passed to lldb. -+(defvar gud-lldb-history nil) -+ -+;; Keeps track of breakpoint created. In the following case, the id is "1". -+;; It is used to implement temporary breakpoint. -+;; (lldb) b main.c:39 -+;; breakpoint set --file 'main.c' --line 39 -+;; Breakpoint created: 1: file ='main.c', line = 39, locations = 1 -+(defvar gud-breakpoint-id nil) -+ -+(defun lldb-extract-breakpoint-id (string) -+ ;; Search for "Breakpoint created: \\([^:\n]*\\):" pattern. -+ (if (string-match "Breakpoint created: \\([^:\n]*\\):" string) -+ (progn -+ (setq gud-breakpoint-id (match-string 1 string)) -+ (message "breakpoint id: %s" gud-breakpoint-id))) -+) -+ -+(defun gud-lldb-marker-filter (string) -+ (setq gud-marker-acc -+ (if gud-marker-acc (concat gud-marker-acc string) string)) -+ (lldb-extract-breakpoint-id gud-marker-acc) -+ (let (start) -+ ;; Process all complete markers in this chunk -+ (while (or -+ ;; (lldb) r -+ ;; Process 15408 launched: '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64) -+ ;; (lldb) Process 15408 stopped -+ ;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread -+ (string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n" -+ gud-marker-acc start) -+ ;; (lldb) frame select -r 1 -+ ;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44 -+ (string-match "\nframe.* at \\([^:\n]*\\):\\([0-9]*\\)\n" -+ gud-marker-acc start)) -+ (setq gud-last-frame -+ (cons (match-string 1 gud-marker-acc) -+ (string-to-number (match-string 2 gud-marker-acc))) -+ start (match-end 0))) -+ -+ ;; Search for the last incomplete line in this chunk -+ (while (string-match "\n" gud-marker-acc start) -+ (setq start (match-end 0))) -+ -+ ;; If we have an incomplete line, store it in gud-marker-acc. -+ (setq gud-marker-acc (substring gud-marker-acc (or start 0)))) -+ string) -+ -+;; Keeps track of whether the Python lldb_oneshot_break function definition has -+;; been exec'ed. -+(defvar lldb-oneshot-break-defined nil) -+ -+;;;###autoload -+(defun lldb (command-line) -+ "Run lldb on program FILE in buffer *gud-FILE*. -+The directory containing FILE becomes the initial working directory -+and source-file directory for your debugger." -+ (interactive (list (gud-query-cmdline 'lldb))) -+ -+ (gud-common-init command-line nil 'gud-lldb-marker-filter) -+ (set (make-local-variable 'gud-minor-mode) 'lldb) -+ (setq lldb-oneshot-break-defined nil) -+ -+ (gud-def gud-listb "breakpoint list" -+ "l" "List all breakpoints.") -+ (gud-def gud-bt "thread backtrace" -+ "b" "Show stack for the current thread.") -+ (gud-def gud-bt-all "thread backtrace all" -+ "B" "Show stacks for all the threads.") -+ -+ (gud-def gud-break "breakpoint set -f %f -l %l" -+ "\C-b" "Set breakpoint at current line.") -+ (gud-def gud-tbreak -+ (progn (gud-call "breakpoint set -f %f -l %l") -+ (sit-for 1) -+ (if (not lldb-oneshot-break-defined) -+ (progn -+ ;; The "\\n"'s are required to escape the newline chars -+ ;; passed to the lldb process. -+ (gud-call (concat "script exec \"def lldb_oneshot_break(frame, bp_loc):\\n" -+ " target=frame.GetThread().GetProcess().GetTarget()\\n" -+ " bp=bp_loc.GetBreakpoint()\\n" -+ " print 'Deleting oneshot breakpoint:', bp\\n" -+ " target.BreakpointDelete(bp.GetID())\"")) -+ (sit-for 1) -+ ;; Set the flag since Python knows about the function def now. -+ (setq lldb-oneshot-break-defined t))) -+ (gud-call "breakpoint command add -p %b -o 'lldb_oneshot_break(frame, bp_loc)'")) -+ "\C-t" "Set temporary breakpoint at current line.") -+ (gud-def gud-remove "breakpoint clear -f %f -l %l" -+ "\C-d" "Remove breakpoint at current line") -+ (gud-def gud-step "thread step-in" -+ "\C-s" "Step one source line with display.") -+ (gud-def gud-stepi "thread step-inst" -+ "\C-i" "Step one instruction with display.") -+ (gud-def gud-next "thread step-over" -+ "\C-n" "Step one line (skip functions).") -+ (gud-def gud-nexti "thread step-inst-over" -+ nil "Step one instruction (skip functions).") -+ (gud-def gud-cont "process continue" -+ "\C-r" "Continue with display.") -+ (gud-def gud-finish "thread step-out" -+ "\C-f" "Finish executing current function.") -+ (gud-def gud-up "frame select -r %p" -+ "<" "Up 1 stack frame.") -+ (gud-def gud-down "frame select -r -%p" -+ ">" "Down 1 stack frame.") -+ (gud-def gud-print "expression -- %e" -+ "\C-p" "Evaluate C expression at point.") -+ (gud-def gud-pstar "expression -- *%e" -+ nil "Evaluate C dereferenced pointer expression at point.") -+ (gud-def gud-run "run" -+ nil "Run the program.") -+ (gud-def gud-stop-subjob "process kill" -+ nil "Stop the program.") -+ -+ (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") -+ (setq paragraph-start comint-prompt-regexp) -+ (run-hooks 'lldb-mode-hook) -+ ) -+ -+ -+;; ====================================================================== - ;; sdb functions - - ;; History of argument lists passed to sdb. -@@ -2372,9 +2498,10 @@ - "Major mode for interacting with an inferior debugger process. - - You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx, --M-x perldb, M-x xdb, or M-x jdb. Each entry point finishes by executing a --hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook', --`perldb-mode-hook', `xdb-mode-hook', or `jdb-mode-hook' respectively. -+M-x perldb, M-x xdb, M-x jdb, or M-x lldb. Each entry point finishes by -+executing a hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook', -+`perldb-mode-hook', `xdb-mode-hook', `jdb-mode-hook', or `lldb-mode-hook' -+respectively. - - After startup, the following commands are available in both the GUD - interaction buffer and any source buffer GUD visits due to a breakpoint stop -@@ -2404,7 +2531,7 @@ - except that the breakpoint is temporary; that is, it is removed when - execution stops on it. - --Under gdb, dbx, and xdb, \\[gud-up] pops up through an enclosing stack -+Under gdb, dbx, xdb, and lldb, \\[gud-up] pops up through an enclosing stack - frame. \\[gud-down] drops back down through one. - - If you are using gdb or xdb, \\[gud-finish] runs execution to the return from -@@ -2724,7 +2851,7 @@ - result) - (while (and str - (let ((case-fold-search nil)) -- (string-match "\\([^%]*\\)%\\([adefFlpc]\\)" str))) -+ (string-match "\\([^%]*\\)%\\([abdefFlpc]\\)" str))) - (let ((key (string-to-char (match-string 2 str))) - subst) - (cond -@@ -2753,6 +2880,8 @@ - (setq subst (gud-find-expr))) - ((eq key ?a) - (setq subst (gud-read-address))) -+ ((eq key ?b) -+ (setq subst gud-breakpoint-id)) - ((eq key ?c) - (setq subst - (gud-find-class -@@ -3372,6 +3501,8 @@ - (defun gud-tooltip-print-command (expr) - "Return a suitable command to print the expression EXPR." - (case gud-minor-mode -+ ; '-o' to print the objc object description if available -+ (lldb (concat "expression -o -- " expr)) - (gdba (concat "server print " expr)) - ((dbx gdbmi) (concat "print " expr)) - ((xdb pdb) (concat "p " expr)) Modified: lldb/trunk/utils/emacs/gud.el URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud.el?rev=118277&r1=118276&r2=118277&view=diff ============================================================================== --- lldb/trunk/utils/emacs/gud.el (original) +++ lldb/trunk/utils/emacs/gud.el Fri Nov 5 11:51:44 2010 @@ -996,6 +996,14 @@ (set (make-local-variable 'gud-minor-mode) 'lldb) (setq lldb-oneshot-break-defined nil) + ;; Make lldb dump fullpath instead of basename for a file. + ;; See also gud-lldb-marker-filter where gud-last-frame is grokked from lldb output. + (progn + (gud-call "settings set frame-format 'frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}\\n'") + (sit-for 1) + (gud-call "settings set thread-format 'thread #${thread.index}: tid = ${thread.id}{, ${frame.pc}}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, stop reason = ${thread.stop-reason}}\\n'") + (sit-for 1)) + (gud-def gud-listb "breakpoint list" "l" "List all breakpoints.") (gud-def gud-bt "thread backtrace" @@ -1036,9 +1044,13 @@ "\C-r" "Continue with display.") (gud-def gud-finish "thread step-out" "\C-f" "Finish executing current function.") - (gud-def gud-up "frame select -r %p" + (gud-def gud-up + (progn (gud-call "frame select -r 1") + (sit-for 1)) "<" "Up 1 stack frame.") - (gud-def gud-down "frame select -r -%p" + (gud-def gud-down + (progn (gud-call "frame select -r -1") + (sit-for 1)) ">" "Down 1 stack frame.") (gud-def gud-print "expression -- %e" "\C-p" "Evaluate C expression at point.") From johnny.chen at apple.com Fri Nov 5 12:30:53 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 05 Nov 2010 17:30:53 -0000 Subject: [Lldb-commits] [lldb] r118279 - /lldb/trunk/test/dotest.py Message-ID: <20101105173053.D62EA2A6C12C@llvm.org> Author: johnny Date: Fri Nov 5 12:30:53 2010 New Revision: 118279 URL: http://llvm.org/viewvc/llvm-project?rev=118279&view=rev Log: Add comment about iterating over possible architecture and compiler combinations. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=118279&r1=118278&r2=118279&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Fri Nov 5 12:30:53 2010 @@ -508,11 +508,11 @@ raise Exception('log enable failed (check GDB_REMOTE_LOG env variable.') -############################################ +# ======================================== # # # # Execution of the test driver starts here # # # -############################################ +# ======================================== # # # Start the actions by first parsing the options while setting up the test @@ -600,6 +600,7 @@ new_stderr = None new_stdout = None +# Iterating over all possible architecture and compiler combinations. for ia in range(len(archs) if iterArchs else 1): archConfig = "" if iterArchs: From jingham at apple.com Fri Nov 5 12:59:19 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 05 Nov 2010 17:59:19 -0000 Subject: [Lldb-commits] [lldb] r118282 - /lldb/trunk/source/Target/SectionLoadList.cpp Message-ID: <20101105175919.9CC3E2A6C12C@llvm.org> Author: jingham Date: Fri Nov 5 12:59:19 2010 New Revision: 118282 URL: http://llvm.org/viewvc/llvm-project?rev=118282&view=rev Log: Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former. Modified: lldb/trunk/source/Target/SectionLoadList.cpp Modified: lldb/trunk/source/Target/SectionLoadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=118282&r1=118281&r2=118282&view=diff ============================================================================== --- lldb/trunk/source/Target/SectionLoadList.cpp (original) +++ lldb/trunk/source/Target/SectionLoadList.cpp Fri Nov 5 12:59:19 2010 @@ -50,7 +50,7 @@ bool SectionLoadList::SetSectionLoadAddress (const Section *section, addr_t load_addr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)", @@ -76,7 +76,7 @@ size_t SectionLoadList::SetSectionUnloaded (const Section *section) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s))", @@ -99,7 +99,7 @@ bool SectionLoadList::SetSectionUnloaded (const Section *section, addr_t load_addr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)", From jingham at apple.com Fri Nov 5 12:59:33 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 05 Nov 2010 17:59:33 -0000 Subject: [Lldb-commits] [lldb] r118283 - /lldb/trunk/source/lldb-log.cpp Message-ID: <20101105175933.D25892A6C12C@llvm.org> Author: jingham Date: Fri Nov 5 12:59:33 2010 New Revision: 118283 URL: http://llvm.org/viewvc/llvm-project?rev=118283&view=rev Log: Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former. Modified: lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=118283&r1=118282&r2=118283&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Fri Nov 5 12:59:33 2010 @@ -129,7 +129,6 @@ else if (strcasestr(arg, "expr") == arg) flag_bits &= ~LIBLLDB_LOG_EXPRESSIONS; else if (strcasestr(arg, "object") == arg) flag_bits &= ~LIBLLDB_LOG_OBJECT; else if (strcasecmp(arg, "process") == 0 ) flag_bits &= ~LIBLLDB_LOG_PROCESS; - else if (strcasecmp(arg, "shlib") == 0 ) flag_bits &= ~LIBLLDB_LOG_SHLIB; else if (strcasecmp(arg, "state") == 0 ) flag_bits &= ~LIBLLDB_LOG_STATE; else if (strcasecmp(arg, "step") == 0 ) flag_bits &= ~LIBLLDB_LOG_STEP; else if (strcasecmp(arg, "thread") == 0 ) flag_bits &= ~LIBLLDB_LOG_THREAD; @@ -188,7 +187,6 @@ else if (strcasestr(arg, "expr") == arg) flag_bits |= LIBLLDB_LOG_EXPRESSIONS; else if (strcasestr(arg, "object") == arg) flag_bits |= LIBLLDB_LOG_OBJECT; else if (strcasecmp(arg, "process") == 0 ) flag_bits |= LIBLLDB_LOG_PROCESS; - else if (strcasecmp(arg, "shlib") == 0 ) flag_bits |= LIBLLDB_LOG_SHLIB; else if (strcasecmp(arg, "state") == 0 ) flag_bits |= LIBLLDB_LOG_STATE; else if (strcasecmp(arg, "step") == 0 ) flag_bits |= LIBLLDB_LOG_STEP; else if (strcasecmp(arg, "thread") == 0 ) flag_bits |= LIBLLDB_LOG_THREAD; From jingham at apple.com Fri Nov 5 12:59:46 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 05 Nov 2010 17:59:46 -0000 Subject: [Lldb-commits] [lldb] r118284 - /lldb/trunk/include/lldb/lldb-private-log.h Message-ID: <20101105175946.CC5612A6C12C@llvm.org> Author: jingham Date: Fri Nov 5 12:59:46 2010 New Revision: 118284 URL: http://llvm.org/viewvc/llvm-project?rev=118284&view=rev Log: Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former. Modified: lldb/trunk/include/lldb/lldb-private-log.h Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=118284&r1=118283&r2=118284&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Fri Nov 5 12:59:46 2010 @@ -22,7 +22,7 @@ #define LIBLLDB_LOG_VERBOSE (1u << 0) #define LIBLLDB_LOG_PROCESS (1u << 1) #define LIBLLDB_LOG_THREAD (1u << 2) -#define LIBLLDB_LOG_SHLIB (1u << 3) +#define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 3) #define LIBLLDB_LOG_EVENTS (1u << 4) #define LIBLLDB_LOG_BREAKPOINTS (1u << 5) #define LIBLLDB_LOG_WATCHPOINTS (1u << 6) @@ -36,14 +36,13 @@ #define LIBLLDB_LOG_HOST (1u << 14) #define LIBLLDB_LOG_UNWIND (1u << 15) #define LIBLLDB_LOG_API (1u << 16) -#define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 17) #define LIBLLDB_LOG_ALL (UINT32_MAX) -#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ - LIBLLDB_LOG_THREAD |\ - LIBLLDB_LOG_SHLIB |\ - LIBLLDB_LOG_BREAKPOINTS |\ - LIBLLDB_LOG_WATCHPOINTS |\ - LIBLLDB_LOG_STEP |\ +#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ + LIBLLDB_LOG_THREAD |\ + LIBLLDB_LOG_DYNAMIC_LOADER |\ + LIBLLDB_LOG_BREAKPOINTS |\ + LIBLLDB_LOG_WATCHPOINTS |\ + LIBLLDB_LOG_STEP |\ LIBLLDB_LOG_STATE ) namespace lldb_private { From johnny.chen at apple.com Fri Nov 5 13:10:11 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 05 Nov 2010 18:10:11 -0000 Subject: [Lldb-commits] [lldb] r118285 - /lldb/trunk/test/lldbtest.py Message-ID: <20101105181011.9B5142A6C12C@llvm.org> Author: johnny Date: Fri Nov 5 13:10:11 2010 New Revision: 118285 URL: http://llvm.org/viewvc/llvm-project?rev=118285&view=rev Log: Fix comments. Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=118285&r1=118284&r2=118285&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Fri Nov 5 13:10:11 2010 @@ -498,7 +498,7 @@ self.hooks = [] def markError(self): - """Callback invoked when we (the test case instance) errored.""" + """Callback invoked when an error (unexpected exception) errored.""" self.__errored__ = True with recording(self, False) as sbuf: # False because there's no need to write "ERROR" to the stderr twice. @@ -506,7 +506,7 @@ print >> sbuf, "ERROR" def markFailure(self): - """Callback invoked when we (the test case instance) failed.""" + """Callback invoked when a failure (test assertion failure) occurred.""" self.__failed__ = True with recording(self, False) as sbuf: # False because there's no need to write "FAIL" to the stderr twice. @@ -609,7 +609,7 @@ if not module.cleanup(self, dictionary=self.dict): raise Exception("Don't know how to do cleanup") - # We always dump the session infos for failures/errors. + # Decide whether to dump the session info. self.dumpSessionInfo() def runCmd(self, cmd, msg=None, check=True, trace=False, setCookie=True): From jingham at apple.com Fri Nov 5 14:25:48 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 05 Nov 2010 19:25:48 -0000 Subject: [Lldb-commits] [lldb] r118290 - in /lldb/trunk: include/lldb/Expression/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Commands/ source/Expression/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Target/ Message-ID: <20101105192548.83E6B2A6C12C@llvm.org> Author: jingham Date: Fri Nov 5 14:25:48 2010 New Revision: 118290 URL: http://llvm.org/viewvc/llvm-project?rev=118290&view=rev Log: Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction. Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h lldb/trunk/include/lldb/Expression/ClangUserExpression.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectExpression.h lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangFunction.h (original) +++ lldb/trunk/include/lldb/Expression/ClangFunction.h Fri Nov 5 14:25:48 2010 @@ -256,6 +256,11 @@ /// If the timeout expires, true if other threads should run. If /// the function may try to take locks, this is useful. /// + /// @param[in] discard_on_error + /// If true, and the execution stops before completion, we unwind the + /// function call, and return the program state to what it was before the + /// execution. If false, we leave the program in the stopped state. + /// /// @param[in] single_thread_timeout_usec /// If stop_others is true, the length of time to wait before /// concluding that the system is deadlocked. @@ -274,7 +279,8 @@ lldb::addr_t function_address, lldb::addr_t &void_arg, bool stop_others, - bool try_all_threads, + bool try_all_threads, + bool discard_on_error, uint32_t single_thread_timeout_usec, Stream &errors, lldb::addr_t* this_arg = 0); @@ -396,7 +402,8 @@ Stream &errors, bool stop_others, uint32_t single_thread_timeout_usec, - bool try_all_threads, + bool try_all_threads, + bool discard_on_error, Value &results); //------------------------------------------------------------------ @@ -434,7 +441,7 @@ lldb::addr_t &args_addr_ref, Stream &errors, bool stop_others, - bool discard_on_error = true, + bool discard_on_error, lldb::addr_t *this_arg = 0); //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original) +++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Fri Nov 5 14:25:48 2010 @@ -89,6 +89,11 @@ /// The execution context to use when looking up entities that /// are needed for parsing (locations of variables, etc.) /// + /// @param[in] discard_on_error + /// If true, and the execution stops before completion, we unwind the + /// function call, and return the program state to what it was before the + /// execution. If false, we leave the program in the stopped state. + /// /// @param[in] result /// A pointer to direct at the persistent variable in which the /// expression's result is stored. @@ -99,6 +104,7 @@ bool Execute (Stream &error_stream, ExecutionContext &exe_ctx, + bool discard_on_error, ClangExpressionVariable *&result); ThreadPlan * @@ -212,6 +218,7 @@ //------------------------------------------------------------------ static lldb::ValueObjectSP Evaluate (ExecutionContext &exe_ctx, + bool discard_on_error, const char *expr_cstr, const char *expr_prefix); Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Fri Nov 5 14:25:48 2010 @@ -571,6 +571,16 @@ DiscardThreadPlans (bool force); //------------------------------------------------------------------ + /// Discards the plans queued on the plan stack of the current thread up to and + /// including up_to_plan_sp. + // + // @param[in] up_to_plan_sp + // Discard all plans up to and including this one. + //------------------------------------------------------------------ + void + DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp); + + //------------------------------------------------------------------ /// Prints the current plan stack. /// /// @param[in] s Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Nov 5 14:25:48 2010 @@ -2911,10 +2911,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = ( - x86_64, - i386, - ); + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Fri Nov 5 14:25:48 2010 @@ -560,11 +560,12 @@ m_opaque_sp->CalculateExecutionContext (exe_ctx); const char *prefix = NULL; + const bool discard_on_error = true; if (exe_ctx.target) prefix = exe_ctx.target->GetExpressionPrefixContentsAsCString(); - *expr_result = ClangUserExpression::Evaluate (exe_ctx, expr, prefix); + *expr_result = ClangUserExpression::Evaluate (exe_ctx, discard_on_error, expr, prefix); } if (log) Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Nov 5 14:25:48 2010 @@ -75,6 +75,13 @@ case 'o': print_object = true; break; + + case 'u': + bool success; + unwind_on_error = Args::StringToBoolean(option_arg, true, &success); + if (!success) + error.SetErrorStringWithFormat("Could not convert \"%s\" to a boolean value.", option_arg); + break; default: error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); @@ -92,6 +99,7 @@ debug = false; format = eFormatDefault; print_object = false; + unwind_on_error = true; show_types = true; show_summary = true; } @@ -223,7 +231,7 @@ if (m_exe_ctx.target) prefix = m_exe_ctx.target->GetExpressionPrefixContentsAsCString(); - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr, prefix)); + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, m_options.unwind_on_error, expr, prefix)); assert (result_valobj_sp.get()); if (result_valobj_sp->GetError().Success()) { @@ -347,7 +355,8 @@ //{ LLDB_OPT_SET_ALL, false, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."}, //{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."}, { LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, eArgTypeExprFormat, "Specify the format that the expression output should use."}, -{ LLDB_OPT_SET_2, false, "object-description", 'o', no_argument, NULL, 0, eArgTypeNone, "Print the object description of the value resulting from the expression"}, +{ LLDB_OPT_SET_2, false, "object-description", 'o', no_argument, NULL, 0, eArgTypeNone, "Print the object description of the value resulting from the expression."}, +{ LLDB_OPT_SET_ALL, false, "unwind-on-error", 'u', required_argument, NULL, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, breakpoint hit or signal."}, { LLDB_OPT_SET_ALL, false, "debug", 'g', no_argument, NULL, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."}, { LLDB_OPT_SET_ALL, false, "use-ir", 'i', no_argument, NULL, 0, eArgTypeNone, "[Temporary] Instructs the expression evaluator to use IR instead of ASTs."}, { 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL } Modified: lldb/trunk/source/Commands/CommandObjectExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.h (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Nov 5 14:25:48 2010 @@ -51,6 +51,7 @@ lldb::Format format; bool debug; bool print_object; + bool unwind_on_error; bool show_types; bool show_summary; }; Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Nov 5 14:25:48 2010 @@ -365,7 +365,13 @@ } ThreadPlan * -ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, lldb::addr_t func_addr, lldb::addr_t &args_addr, Stream &errors, bool stop_others, bool discard_on_error, lldb::addr_t *this_arg) +ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, + lldb::addr_t func_addr, + lldb::addr_t &args_addr, + Stream &errors, + bool stop_others, + bool discard_on_error, + lldb::addr_t *this_arg) { // FIXME: Use the errors Stream for better error reporting. @@ -441,7 +447,9 @@ ClangFunction::ExecutionResults ClangFunction::ExecuteFunction(ExecutionContext &exe_ctx, Stream &errors, bool stop_others, Value &results) { - return ExecuteFunction (exe_ctx, NULL, errors, stop_others, NULL, false, results); + const bool try_all_threads = false; + const bool discard_on_error = true; + return ExecuteFunction (exe_ctx, NULL, errors, stop_others, NULL, try_all_threads, discard_on_error, results); } ClangFunction::ExecutionResults @@ -452,7 +460,10 @@ bool try_all_threads, Value &results) { - return ExecuteFunction (exe_ctx, NULL, errors, true, single_thread_timeout_usec, try_all_threads, results); + const bool stop_others = true; + const bool discard_on_error = true; + return ExecuteFunction (exe_ctx, NULL, errors, stop_others, single_thread_timeout_usec, + try_all_threads, discard_on_error, results); } // This is the static function @@ -463,6 +474,7 @@ lldb::addr_t &void_arg, bool stop_others, bool try_all_threads, + bool discard_on_error, uint32_t single_thread_timeout_usec, Stream &errors, lldb::addr_t *this_arg) @@ -488,8 +500,9 @@ } ClangFunction::ExecutionResults return_value = eExecutionSetupError; - - lldb::ThreadPlanSP call_plan_sp(ClangFunction::GetThreadPlanToCallFunction(exe_ctx, function_address, void_arg, errors, stop_others, false, this_arg)); + lldb::ThreadPlanSP call_plan_sp(ClangFunction::GetThreadPlanToCallFunction(exe_ctx, function_address, void_arg, + errors, stop_others, discard_on_error, + this_arg)); ThreadPlanCallFunction *call_plan_ptr = static_cast (call_plan_sp.get()); @@ -682,6 +695,10 @@ log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation); } + if (discard_on_error && call_plan_sp) + { + exe_ctx.thread->DiscardThreadPlansUpToPlan (call_plan_sp); + } return_value = eExecutionInterrupted; break; } @@ -718,7 +735,8 @@ Stream &errors, bool stop_others, uint32_t single_thread_timeout_usec, - bool try_all_threads, + bool try_all_threads, + bool discard_on_error, Value &results) { using namespace clang; @@ -741,7 +759,7 @@ } return_value = ClangFunction::ExecuteFunction(exe_ctx, m_wrapper_function_addr, args_addr, stop_others, - try_all_threads, single_thread_timeout_usec, errors); + try_all_threads, discard_on_error, single_thread_timeout_usec, errors); if (args_addr_ptr != NULL) *args_addr_ptr = args_addr; Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Nov 5 14:25:48 2010 @@ -357,6 +357,7 @@ bool ClangUserExpression::Execute (Stream &error_stream, ExecutionContext &exe_ctx, + bool discard_on_error, ClangExpressionVariable *&result) { if (m_dwarf_opcodes.get()) @@ -375,12 +376,15 @@ PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr); + const bool stop_others = true; + const bool try_all_threads = true; ClangFunction::ExecutionResults execution_result = ClangFunction::ExecuteFunction (exe_ctx, m_jit_addr, struct_address, - true, - true, + stop_others, + try_all_threads, + discard_on_error, 10000000, error_stream, (m_needs_object_ptr ? &object_ptr : NULL)); @@ -430,9 +434,9 @@ return *m_dwarf_opcodes.get(); } - lldb::ValueObjectSP ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, + bool discard_on_error, const char *expr_cstr, const char *expr_prefix) { @@ -479,7 +483,7 @@ error_stream.GetString().clear(); - if (!user_expression.Execute (error_stream, exe_ctx, expr_result)) + if (!user_expression.Execute (error_stream, exe_ctx, discard_on_error, expr_result)) { if (error_stream.GetString().empty()) error.SetErrorString ("expression failed to execute, unknown error"); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Fri Nov 5 14:25:48 2010 @@ -118,8 +118,12 @@ lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream); + bool unwind_on_error = true; + bool try_all_threads = true; + bool stop_others = true; + ClangFunction::ExecutionResults results - = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, true, 1000, true, ret); + = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, stop_others, 1000, try_all_threads, unwind_on_error, ret); if (results != ClangFunction::eExecutionCompleted) { str.Printf("Error evaluating Print Object function: %d.\n", results); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Fri Nov 5 14:25:48 2010 @@ -120,8 +120,12 @@ lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream); + bool unwind_on_error = true; + bool try_all_threads = true; + bool stop_others = true; + ClangFunction::ExecutionResults results - = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, true, 1000, true, ret); + = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, stop_others, 1000, try_all_threads, unwind_on_error, ret); if (results != ClangFunction::eExecutionCompleted) { str.Printf("Error evaluating Print Object function: %d.\n", results); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Nov 5 14:25:48 2010 @@ -126,8 +126,13 @@ lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; func.InsertFunction(exe_ctx, wrapper_struct_addr, error_stream); + const bool stop_others = true; + const bool try_all_threads = true; + const bool discard_on_error = true; + ClangFunction::ExecutionResults results - = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, true, 1000, true, ret); + = func.ExecuteFunction(exe_ctx, &wrapper_struct_addr, error_stream, stop_others, 1000, + try_all_threads, discard_on_error, ret); if (results != ClangFunction::eExecutionCompleted) { str.Printf("Error evaluating Print Object function: %d.\n", results); Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Nov 5 14:25:48 2010 @@ -505,13 +505,13 @@ { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - + bool unwind_on_error = true; StreamString expr; char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); expr.Printf("dlopen (\"%s\", 2)", path); const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n"; - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, unwind_on_error, expr.GetData(), prefix)); if (result_valobj_sp->GetError().Success()) { Scalar scalar; @@ -571,11 +571,11 @@ { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - + bool unwind_on_error = true; StreamString expr; expr.Printf("dlclose ((void *)0x%llx)", image_addr); const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, unwind_on_error, expr.GetData(), prefix)); if (result_valobj_sp->GetError().Success()) { Scalar scalar; Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=118290&r1=118289&r2=118290&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Fri Nov 5 14:25:48 2010 @@ -490,14 +490,49 @@ } void -Thread::DiscardThreadPlans(bool force) +Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp) { - // FIXME: It is not always safe to just discard plans. Some, like the step over - // breakpoint trap can't be discarded in general (though you can if you plan to - // force a return from a function, for instance. - // For now I'm just not clearing immediate plans, but I need a way for plans to - // say they really need to be kept on, and then a way to override that. Humm... + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + if (log) + { + log->Printf("Discarding thread plans for thread tid = 0x%4.4x, up to %p", GetID(), up_to_plan_sp.get()); + } + int stack_size = m_plan_stack.size(); + + // If the input plan is NULL, discard all plans. Otherwise make sure this plan is in the + // stack, and if so discard up to and including it. + + if (up_to_plan_sp.get() == NULL) + { + for (int i = stack_size - 1; i > 0; i--) + DiscardPlan(); + } + else + { + bool found_it = false; + for (int i = stack_size - 1; i > 0; i--) + { + if (m_plan_stack[i] == up_to_plan_sp) + found_it = true; + } + if (found_it) + { + bool last_one = false; + for (int i = stack_size - 1; i > 0 && !last_one ; i--) + { + if (GetCurrentPlan() == up_to_plan_sp.get()) + last_one = true; + DiscardPlan(); + } + } + } + return; +} + +void +Thread::DiscardThreadPlans(bool force) +{ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) { From johnny.chen at apple.com Fri Nov 5 16:43:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 05 Nov 2010 21:43:20 -0000 Subject: [Lldb-commits] [lldb] r118299 - /lldb/trunk/source/Symbol/ObjectFile.cpp Message-ID: <20101105214320.263B32A6C12F@llvm.org> Author: johnny Date: Fri Nov 5 16:43:19 2010 New Revision: 118299 URL: http://llvm.org/viewvc/llvm-project?rev=118299&view=rev Log: Fix the infinite recursion crash reported by Antoine Missout: rdar://problem/8557095 lldb disas crashed (from lldb developer) Modified: lldb/trunk/source/Symbol/ObjectFile.cpp Modified: lldb/trunk/source/Symbol/ObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=118299&r1=118298&r2=118299&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp (original) +++ lldb/trunk/source/Symbol/ObjectFile.cpp Fri Nov 5 16:43:19 2010 @@ -59,6 +59,11 @@ } } + // No need to delegate further if (file_offset, file_size) exceeds the total file size. + // This is the base case. + if (file_offset + file_size > file->GetByteSize()) + return NULL; + DataBufferSP file_header_data_sp(file->ReadFileContents(file_offset, 512)); uint32_t idx; From ctice at apple.com Fri Nov 5 17:37:44 2010 From: ctice at apple.com (Caroline Tice) Date: Fri, 05 Nov 2010 22:37:44 -0000 Subject: [Lldb-commits] [lldb] r118308 - in /lldb/trunk: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp tools/debugserver/source/MacOSX/MachProcess.cpp tools/debugserver/source/debugserver.cpp Message-ID: <20101105223744.676832A6C12D@llvm.org> Author: ctice Date: Fri Nov 5 17:37:44 2010 New Revision: 118308 URL: http://llvm.org/viewvc/llvm-project?rev=118308&view=rev Log: If debugserver is running on the local machine, pass it a pseudoterminal to pass to the inferior for the inferior's I/O (to allow direct writing, rather than passing all the I/O around via packets). Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp lldb/trunk/tools/debugserver/source/debugserver.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=118308&r1=118307&r2=118308&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Nov 5 17:37:44 2010 @@ -1752,7 +1752,8 @@ lldb_utility::PseudoTerminal pty; if (stdio_path == NULL) { - pass_stdio_path_to_debugserver = false; + if (! m_local_debugserver) + pass_stdio_path_to_debugserver = false; if (pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, NULL, 0)) { struct termios stdin_termios; @@ -1785,7 +1786,7 @@ { debugserver_args.AppendArgument("-s"); // short for --stdio-path StreamString strm; - strm.Printf("'%s'", stdio_path); + strm.Printf("%s", stdio_path); debugserver_args.AppendArgument(strm.GetData()); // path to file to have inferior open as it's STDIO } } @@ -1880,19 +1881,19 @@ if (error.Fail() || log) error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp); -// if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) -// { -// std::auto_ptr conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true)); -// if (conn_ap.get()) -// { -// m_stdio_communication.SetConnection(conn_ap.release()); -// if (m_stdio_communication.IsConnected()) -// { -// m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this); -// m_stdio_communication.StartReadThread(); -// } -// } -// } + if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) + { + std::auto_ptr conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true)); + if (conn_ap.get()) + { + m_stdio_communication.SetConnection(conn_ap.release()); + if (m_stdio_communication.IsConnected()) + { + m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this); + m_stdio_communication.StartReadThread(); + } + } + } } else { Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=118308&r1=118307&r2=118308&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Fri Nov 5 17:37:44 2010 @@ -1662,17 +1662,21 @@ if (stdio_path != NULL) { - err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO, stdio_path, O_RDWR, 0), DNBError::POSIX); + int slave_fd_err = open (stdio_path, O_RDWR, 0); + int slave_fd_in = open (stdio_path, O_RDONLY, 0); + int slave_fd_out = open (stdio_path, O_WRONLY, 0); + + err.SetError( ::posix_spawn_file_actions_adddup2(&file_actions, slave_fd_err, STDERR_FILENO), DNBError::POSIX); if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS)) - err.LogThreaded("::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stdio_path); + err.LogThreaded("::posix_spawn_file_actions_adddup2 ( &file_actions, filedes = %d, newfiledes = STDERR_FILENO )", slave_fd_err); - err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, stdio_path, O_RDONLY, 0), DNBError::POSIX); + err.SetError( ::posix_spawn_file_actions_adddup2(&file_actions, slave_fd_in, STDIN_FILENO), DNBError::POSIX); if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS)) - err.LogThreaded("::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdio_path); + err.LogThreaded("::posix_spawn_file_actions_adddup2 ( &file_actions, filedes = %d, newfiledes = STDIN_FILENO )", slave_fd_in); - err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, stdio_path, O_WRONLY, 0), DNBError::POSIX); + err.SetError( ::posix_spawn_file_actions_adddup2(&file_actions, slave_fd_out, STDOUT_FILENO), DNBError::POSIX); if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS)) - err.LogThreaded("::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdio_path); + err.LogThreaded("::posix_spawn_file_actions_adddup2 ( &file_actions, filedes = %d, newfiledes = STDOUT_FILENO )", slave_fd_out); } err.SetError( ::posix_spawnp (&pid, path, &file_actions, &attr, (char * const*)argv, (char * const*)envp), DNBError::POSIX); if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS)) Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=118308&r1=118307&r2=118308&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/debugserver.cpp (original) +++ lldb/trunk/tools/debugserver/source/debugserver.cpp Fri Nov 5 17:37:44 2010 @@ -704,7 +704,7 @@ RNBRunLoopMode start_mode = eRNBRunLoopModeExit; - while ((ch = getopt_long(argc, argv, "a:d:gi:vktl:f:w:x:r", g_long_options, &long_option_index)) != -1) + while ((ch = getopt_long(argc, argv, "a:d:gi:vktl:f:w:x:rs:", g_long_options, &long_option_index)) != -1) { DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n", ch, (uint8_t)ch, From gclayton at apple.com Fri Nov 5 18:17:00 2010 From: gclayton at apple.com (Greg Clayton) Date: Fri, 05 Nov 2010 23:17:00 -0000 Subject: [Lldb-commits] [lldb] r118312 - in /lldb/trunk: include/lldb/API/ lldb.xcodeproj/ resources/ source/API/ tools/debugserver/debugserver.xcodeproj/ Message-ID: <20101105231701.17B6B2A6C12D@llvm.org> Author: gclayton Date: Fri Nov 5 18:17:00 2010 New Revision: 118312 URL: http://llvm.org/viewvc/llvm-project?rev=118312&view=rev Log: Added copy constructors and assignment operators to all lldb::SB* classes so we don't end up with weak exports with some compilers. Modified: lldb/trunk/include/lldb/API/SBAddress.h lldb/trunk/include/lldb/API/SBBlock.h lldb/trunk/include/lldb/API/SBBreakpoint.h lldb/trunk/include/lldb/API/SBBreakpointLocation.h lldb/trunk/include/lldb/API/SBBroadcaster.h lldb/trunk/include/lldb/API/SBCommandInterpreter.h lldb/trunk/include/lldb/API/SBCommandReturnObject.h lldb/trunk/include/lldb/API/SBCommunication.h lldb/trunk/include/lldb/API/SBCompileUnit.h lldb/trunk/include/lldb/API/SBDebugger.h lldb/trunk/include/lldb/API/SBError.h lldb/trunk/include/lldb/API/SBEvent.h lldb/trunk/include/lldb/API/SBFrame.h lldb/trunk/include/lldb/API/SBFunction.h lldb/trunk/include/lldb/API/SBInputReader.h lldb/trunk/include/lldb/API/SBInstruction.h lldb/trunk/include/lldb/API/SBInstructionList.h lldb/trunk/include/lldb/API/SBListener.h lldb/trunk/include/lldb/API/SBModule.h lldb/trunk/include/lldb/API/SBProcess.h lldb/trunk/include/lldb/API/SBSourceManager.h lldb/trunk/include/lldb/API/SBStringList.h lldb/trunk/include/lldb/API/SBSymbol.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/include/lldb/API/SBType.h lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist lldb/trunk/source/API/SBBlock.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBFunction.cpp lldb/trunk/source/API/SBInstruction.cpp lldb/trunk/source/API/SBInstructionList.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSourceManager.cpp lldb/trunk/source/API/SBStringList.cpp lldb/trunk/source/API/SBSymbol.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBType.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/include/lldb/API/SBAddress.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBAddress.h (original) +++ lldb/trunk/include/lldb/API/SBAddress.h Fri Nov 5 18:17:00 2010 @@ -25,8 +25,8 @@ ~SBAddress (); #ifndef SWIG - const SBAddress & - operator = (const SBAddress &rhs); + const lldb::SBAddress & + operator = (const lldb::SBAddress &rhs); #endif bool Modified: lldb/trunk/include/lldb/API/SBBlock.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBlock.h (original) +++ lldb/trunk/include/lldb/API/SBBlock.h Fri Nov 5 18:17:00 2010 @@ -20,8 +20,15 @@ SBBlock (); + SBBlock (const lldb::SBBlock &rhs); + ~SBBlock (); +#ifndef SWIG + const lldb::SBBlock & + operator = (const lldb::SBBlock &rhs); +#endif + bool IsInlined () const; Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpoint.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpoint.h Fri Nov 5 18:17:00 2010 @@ -31,8 +31,8 @@ ~SBBreakpoint(); #ifndef SWIG - const SBBreakpoint & - operator = (const SBBreakpoint& rhs); + const lldb::SBBreakpoint & + operator = (const lldb::SBBreakpoint& rhs); #endif break_id_t Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Fri Nov 5 18:17:00 2010 @@ -21,8 +21,15 @@ SBBreakpointLocation (); + SBBreakpointLocation (const lldb::SBBreakpointLocation &rhs); + ~SBBreakpointLocation (); +#ifndef SWIG + const lldb::SBBreakpointLocation & + operator = (const lldb::SBBreakpointLocation &rhs); +#endif + bool IsValid() const; Modified: lldb/trunk/include/lldb/API/SBBroadcaster.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBroadcaster.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBroadcaster.h (original) +++ lldb/trunk/include/lldb/API/SBBroadcaster.h Fri Nov 5 18:17:00 2010 @@ -21,6 +21,13 @@ SBBroadcaster (const char *name); + SBBroadcaster (const SBBroadcaster &rhs); + +#ifndef SWIG + const SBBroadcaster & + operator = (const SBBroadcaster &rhs); +#endif + ~SBBroadcaster(); bool @@ -77,9 +84,8 @@ #endif private: - - lldb_private::Broadcaster *m_opaque; - bool m_opaque_owned; + lldb::BroadcasterSP m_opaque_sp; + lldb_private::Broadcaster *m_opaque_ptr; }; } // namespace lldb Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original) +++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Fri Nov 5 18:17:00 2010 @@ -24,6 +24,12 @@ eBroadcastBitQuitCommandReceived = (1 << 2) // User entered quit }; + SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs); + +#ifndef SWIG + const lldb::SBCommandInterpreter & + operator = (const lldb::SBCommandInterpreter &rhs); +#endif ~SBCommandInterpreter (); Modified: lldb/trunk/include/lldb/API/SBCommandReturnObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBCommandReturnObject.h (original) +++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h Fri Nov 5 18:17:00 2010 @@ -20,6 +20,13 @@ SBCommandReturnObject (); + SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs); + +#ifndef SWIG + const lldb::SBCommandReturnObject & + operator = (const lldb::SBCommandReturnObject &rhs); +#endif + ~SBCommandReturnObject (); bool Modified: lldb/trunk/include/lldb/API/SBCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommunication.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBCommunication.h (original) +++ lldb/trunk/include/lldb/API/SBCommunication.h Fri Nov 5 18:17:00 2010 @@ -84,8 +84,8 @@ private: -// void -// CreateIfNeeded (); + + DISALLOW_COPY_AND_ASSIGN (SBCommunication); lldb_private::Communication *m_opaque; bool m_opaque_owned; Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBCompileUnit.h (original) +++ lldb/trunk/include/lldb/API/SBCompileUnit.h Fri Nov 5 18:17:00 2010 @@ -21,8 +21,15 @@ SBCompileUnit (); + SBCompileUnit (const lldb::SBCompileUnit &rhs); + ~SBCompileUnit (); +#ifndef SWIG + const lldb::SBCompileUnit & + operator = (const lldb::SBCompileUnit &rhs); +#endif + bool IsValid () const; Modified: lldb/trunk/include/lldb/API/SBDebugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBDebugger.h (original) +++ lldb/trunk/include/lldb/API/SBDebugger.h Fri Nov 5 18:17:00 2010 @@ -30,6 +30,13 @@ SBDebugger(); + SBDebugger(const lldb::SBDebugger &rhs); + +#ifndef SWIG + lldb::SBDebugger & + operator = (const lldb::SBDebugger &rhs); +#endif + ~SBDebugger(); bool Modified: lldb/trunk/include/lldb/API/SBError.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBError.h (original) +++ lldb/trunk/include/lldb/API/SBError.h Fri Nov 5 18:17:00 2010 @@ -18,14 +18,14 @@ public: SBError (); - SBError (const SBError &rhs); + SBError (const lldb::SBError &rhs); ~SBError(); #ifndef SWIG const SBError & - operator =(const SBError &rhs); + operator =(const lldb::SBError &rhs); #endif Modified: lldb/trunk/include/lldb/API/SBEvent.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBEvent.h (original) +++ lldb/trunk/include/lldb/API/SBEvent.h Fri Nov 5 18:17:00 2010 @@ -30,6 +30,13 @@ ~SBEvent(); + SBEvent (const lldb::SBEvent &rhs); + +#ifndef SWIG + const SBEvent & + operator = (const lldb::SBEvent &rhs); +#endif + bool IsValid() const; @@ -88,7 +95,7 @@ private: mutable lldb::EventSP m_event_sp; - mutable lldb_private::Event *m_opaque; + mutable lldb_private::Event *m_opaque_ptr; }; } // namespace lldb Modified: lldb/trunk/include/lldb/API/SBFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFrame.h (original) +++ lldb/trunk/include/lldb/API/SBFrame.h Fri Nov 5 18:17:00 2010 @@ -22,6 +22,13 @@ public: SBFrame (); + SBFrame (const lldb::SBFrame &rhs); + +#ifndef SWIG + const lldb::SBFrame & + operator =(const lldb::SBFrame &rhs); +#endif + ~SBFrame(); bool Modified: lldb/trunk/include/lldb/API/SBFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFunction.h (original) +++ lldb/trunk/include/lldb/API/SBFunction.h Fri Nov 5 18:17:00 2010 @@ -21,6 +21,14 @@ SBFunction (); + SBFunction (const lldb::SBFunction &rhs); + +#ifndef SWIG + const lldb::SBFunction & + operator = (const lldb::SBFunction &rhs); +#endif + + ~SBFunction (); bool Modified: lldb/trunk/include/lldb/API/SBInputReader.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInputReader.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBInputReader.h (original) +++ lldb/trunk/include/lldb/API/SBInputReader.h Fri Nov 5 18:17:00 2010 @@ -48,7 +48,7 @@ IsValid () const; #ifndef SWIG - const SBInputReader & + const lldb::SBInputReader & operator = (const lldb::SBInputReader &rhs); #endif Modified: lldb/trunk/include/lldb/API/SBInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBInstruction.h (original) +++ lldb/trunk/include/lldb/API/SBInstruction.h Fri Nov 5 18:17:00 2010 @@ -25,6 +25,13 @@ SBInstruction (); + SBInstruction (const SBInstruction &rhs); + +#ifndef SWIG + const SBInstruction & + operator = (const SBInstruction &rhs); +#endif + ~SBInstruction (); bool Modified: lldb/trunk/include/lldb/API/SBInstructionList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstructionList.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBInstructionList.h (original) +++ lldb/trunk/include/lldb/API/SBInstructionList.h Fri Nov 5 18:17:00 2010 @@ -22,6 +22,13 @@ SBInstructionList (); + SBInstructionList (const SBInstructionList &rhs); + +#ifndef SWIG + const SBInstructionList & + operator = (const SBInstructionList &rhs); +#endif + ~SBInstructionList (); size_t Modified: lldb/trunk/include/lldb/API/SBListener.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBListener.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBListener.h (original) +++ lldb/trunk/include/lldb/API/SBListener.h Fri Nov 5 18:17:00 2010 @@ -17,14 +17,19 @@ class SBListener { public: - SBListener (const char *name); + SBListener (); - SBListener (lldb_private::Listener &listener); + SBListener (const char *name); - SBListener (); + SBListener (const SBListener &rhs); ~SBListener (); +#ifndef SWIG + const lldb::SBListener & + operator = (const lldb::SBListener &rhs); +#endif + void AddEvent (const lldb::SBEvent &event); @@ -85,12 +90,16 @@ bool HandleBroadcastEvent (const lldb::SBEvent &event); -private: +protected: friend class SBBroadcaster; friend class SBCommandInterpreter; friend class SBDebugger; friend class SBTarget; + SBListener (lldb_private::Listener &listener); + +private: + #ifndef SWIG lldb_private::Listener * @@ -110,10 +119,8 @@ #endif - - + lldb::ListenerSP m_opaque_sp; lldb_private::Listener *m_opaque_ptr; - bool m_opaque_ptr_owned; }; } // namespace lldb Modified: lldb/trunk/include/lldb/API/SBModule.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBModule.h (original) +++ lldb/trunk/include/lldb/API/SBModule.h Fri Nov 5 18:17:00 2010 @@ -21,6 +21,13 @@ SBModule (); + SBModule (const SBModule &rhs); + +#ifndef SWIG + const SBModule & + operator = (const SBModule &rhs); +#endif + ~SBModule (); bool Modified: lldb/trunk/include/lldb/API/SBProcess.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBProcess.h (original) +++ lldb/trunk/include/lldb/API/SBProcess.h Fri Nov 5 18:17:00 2010 @@ -37,6 +37,11 @@ SBProcess (const lldb::SBProcess& rhs); +#ifndef SWIG + const lldb::SBProcess& + operator = (const lldb::SBProcess& rhs); +#endif + ~SBProcess(); void Modified: lldb/trunk/include/lldb/API/SBSourceManager.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSourceManager.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBSourceManager.h (original) +++ lldb/trunk/include/lldb/API/SBSourceManager.h Fri Nov 5 18:17:00 2010 @@ -19,8 +19,15 @@ class SBSourceManager { public: + SBSourceManager (const lldb::SBSourceManager &rhs); + ~SBSourceManager(); +#ifndef SWIG + const lldb::SBSourceManager & + operator = (const lldb::SBSourceManager &rhs); +#endif + size_t DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file, uint32_t line, @@ -34,14 +41,11 @@ friend class SBCommandInterpreter; friend class SBDebugger; - SBSourceManager(lldb_private::SourceManager &source_manager); - - lldb_private::SourceManager & - GetLLDBManager (); + SBSourceManager(lldb_private::SourceManager *source_manager); private: - lldb_private::SourceManager &m_opaque_ref; + lldb_private::SourceManager *m_opaque_ptr; }; } // namespace lldb Modified: lldb/trunk/include/lldb/API/SBStringList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStringList.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBStringList.h (original) +++ lldb/trunk/include/lldb/API/SBStringList.h Fri Nov 5 18:17:00 2010 @@ -20,9 +20,12 @@ SBStringList (); - SBStringList (const lldb_private::StringList *lldb_strings); - - SBStringList (const lldb::SBStringList &rhs); + SBStringList (const lldb::SBStringList &rhs); + +#ifndef SWIG + const SBStringList & + operator = (const SBStringList &rhs); +#endif ~SBStringList (); @@ -47,6 +50,11 @@ void Clear (); +protected: + friend class SBCommandInterpreter; + + SBStringList (const lldb_private::StringList *lldb_strings); + #ifndef SWIG const lldb_private::StringList * @@ -55,9 +63,6 @@ const lldb_private::StringList & operator*() const; - const lldb::SBStringList & - operator = (const lldb::SBStringList &rhs); - #endif private: Modified: lldb/trunk/include/lldb/API/SBSymbol.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBSymbol.h (original) +++ lldb/trunk/include/lldb/API/SBSymbol.h Fri Nov 5 18:17:00 2010 @@ -24,6 +24,13 @@ ~SBSymbol (); + SBSymbol (const lldb::SBSymbol &rhs); + +#ifndef SWIG + const lldb::SBSymbol & + operator = (const lldb::SBSymbol &rhs); +#endif + bool IsValid () const; Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Fri Nov 5 18:17:00 2010 @@ -32,11 +32,16 @@ }; //------------------------------------------------------------------ - // Constructors and Destructors + // Constructors //------------------------------------------------------------------ + SBTarget (); + SBTarget (const lldb::SBTarget& rhs); - SBTarget (); // Required for SWIG. +#ifndef SWIG + const lldb::SBTarget& + operator = (const lldb::SBTarget& rhs); +#endif //------------------------------------------------------------------ // Destructor Modified: lldb/trunk/include/lldb/API/SBType.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBType.h (original) +++ lldb/trunk/include/lldb/API/SBType.h Fri Nov 5 18:17:00 2010 @@ -22,8 +22,15 @@ SBType (void *ast = NULL, void *clang_type = NULL); + SBType (const SBType &rhs); + ~SBType (); +#ifndef SWIG + const SBType & + operator =(const SBType &rhs); +#endif + bool IsValid(); @@ -68,6 +75,13 @@ SBTypeMember (); + SBTypeMember (const SBTypeMember &rhs); + +#ifndef SWIG + const SBTypeMember& + operator =(const SBTypeMember &rhs); +#endif + ~SBTypeMember (); bool Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Fri Nov 5 18:17:00 2010 @@ -21,6 +21,13 @@ public: SBValue (); + SBValue (const SBValue &rhs); + +#ifndef SWIG + const SBValue & + operator =(const SBValue &rhs); +#endif + ~SBValue (); bool Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Nov 5 18:17:00 2010 @@ -2438,6 +2438,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, @@ -2997,9 +2998,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 29; + DYLIB_CURRENT_VERSION = 30; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3050,11 +3051,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 29; + DYLIB_CURRENT_VERSION = 30; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3124,7 +3125,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3159,11 +3160,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 29; + DYLIB_CURRENT_VERSION = 30; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3212,7 +3213,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3251,7 +3252,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Fri Nov 5 18:17:00 2010 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 29 + 30 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/trunk/source/API/SBBlock.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBBlock.cpp (original) +++ lldb/trunk/source/API/SBBlock.cpp Fri Nov 5 18:17:00 2010 @@ -28,6 +28,18 @@ { } +SBBlock::SBBlock(const SBBlock &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBBlock & +SBBlock::operator = (const SBBlock &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + SBBlock::~SBBlock () { m_opaque_ptr = NULL; Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Fri Nov 5 18:17:00 2010 @@ -25,7 +25,8 @@ using namespace lldb_private; -SBBreakpointLocation::SBBreakpointLocation () +SBBreakpointLocation::SBBreakpointLocation () : + m_opaque_sp () { } @@ -43,6 +44,20 @@ } } +SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBBreakpointLocation & +SBBreakpointLocation::operator = (const SBBreakpointLocation &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + + SBBreakpointLocation::~SBBreakpointLocation () { } Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Fri Nov 5 18:17:00 2010 @@ -20,36 +20,49 @@ SBBroadcaster::SBBroadcaster () : - m_opaque (NULL), - m_opaque_owned (false) + m_opaque_sp (), + m_opaque_ptr (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBBroadcastetr::SBBroadcaster () => SBBroadcaster(%p)", this); } - SBBroadcaster::SBBroadcaster (const char *name) : - m_opaque (new Broadcaster (name)), - m_opaque_owned (true) + m_opaque_sp (new Broadcaster (name)), + m_opaque_ptr (NULL) { + m_opaque_ptr = m_opaque_sp.get(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", - name, m_opaque); + name, m_opaque_ptr); } SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : - m_opaque (broadcaster), - m_opaque_owned (owns) + m_opaque_sp (owns ? broadcaster : NULL), + m_opaque_ptr (broadcaster) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) " - " => SBBroadcaster(%p)", broadcaster, owns, m_opaque); + log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)", + broadcaster, owns, m_opaque_ptr); +} + +SBBroadcaster::SBBroadcaster (const SBBroadcaster &rhs) : + m_opaque_sp (rhs.m_opaque_sp), + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBBroadcaster & +SBBroadcaster::operator = (const SBBroadcaster &rhs) +{ + if (this != &rhs) + { + m_opaque_sp = rhs.m_opaque_sp; + m_opaque_ptr = rhs.m_opaque_ptr; + } + return *this; } SBBroadcaster::~SBBroadcaster() @@ -63,15 +76,15 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque, event_type, unique); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique); - if (m_opaque == NULL) + if (m_opaque_ptr == NULL) return; if (unique) - m_opaque->BroadcastEventIfUnique (event_type); + m_opaque_ptr->BroadcastEventIfUnique (event_type); else - m_opaque->BroadcastEvent (event_type); + m_opaque_ptr->BroadcastEvent (event_type); } void @@ -80,16 +93,16 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque, event.get(), unique); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique); - if (m_opaque == NULL) + if (m_opaque_ptr == NULL) return; EventSP event_sp = event.GetSP (); if (unique) - m_opaque->BroadcastEventIfUnique (event_sp); + m_opaque_ptr->BroadcastEventIfUnique (event_sp); else - m_opaque->BroadcastEvent (event_sp); + m_opaque_ptr->BroadcastEvent (event_sp); } void @@ -97,74 +110,75 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque, listener.get(), requested_events); - if (m_opaque) - m_opaque->AddInitialEventsToListener (listener.get(), requested_events); + log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events); + if (m_opaque_ptr) + m_opaque_ptr->AddInitialEventsToListener (listener.get(), requested_events); } uint32_t SBBroadcaster::AddListener (const SBListener &listener, uint32_t event_mask) { - if (m_opaque) - return m_opaque->AddListener (listener.get(), event_mask); + if (m_opaque_ptr) + return m_opaque_ptr->AddListener (listener.get(), event_mask); return 0; } const char * SBBroadcaster::GetName () const { - if (m_opaque) - return m_opaque->GetBroadcasterName().GetCString(); + if (m_opaque_ptr) + return m_opaque_ptr->GetBroadcasterName().GetCString(); return NULL; } bool SBBroadcaster::EventTypeHasListeners (uint32_t event_type) { - if (m_opaque) - return m_opaque->EventTypeHasListeners (event_type); + if (m_opaque_ptr) + return m_opaque_ptr->EventTypeHasListeners (event_type); return false; } bool SBBroadcaster::RemoveListener (const SBListener &listener, uint32_t event_mask) { - if (m_opaque) - return m_opaque->RemoveListener (listener.get(), event_mask); + if (m_opaque_ptr) + return m_opaque_ptr->RemoveListener (listener.get(), event_mask); return false; } Broadcaster * SBBroadcaster::get () const { - return m_opaque; + return m_opaque_ptr; } void SBBroadcaster::reset (Broadcaster *broadcaster, bool owns) { - if (m_opaque && m_opaque_owned) - delete m_opaque; - m_opaque = broadcaster; - m_opaque_owned = owns; + if (owns) + m_opaque_sp.reset (broadcaster); + else + m_opaque_sp.reset (); + m_opaque_ptr = broadcaster; } bool SBBroadcaster::IsValid () const { - return m_opaque != NULL; + return m_opaque_ptr != NULL; } bool SBBroadcaster::operator == (const SBBroadcaster &rhs) const { - return m_opaque == rhs.m_opaque; + return m_opaque_ptr == rhs.m_opaque_ptr; } bool SBBroadcaster::operator != (const SBBroadcaster &rhs) const { - return m_opaque != rhs.m_opaque; + return m_opaque_ptr != rhs.m_opaque_ptr; } Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Nov 5 18:17:00 2010 @@ -40,6 +40,18 @@ " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr); } +SBCommandInterpreter::SBCommandInterpreter(const SBCommandInterpreter &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBCommandInterpreter & +SBCommandInterpreter::operator = (const SBCommandInterpreter &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + SBCommandInterpreter::~SBCommandInterpreter () { } Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Fri Nov 5 18:17:00 2010 @@ -21,6 +21,27 @@ { } +SBCommandReturnObject::SBCommandReturnObject (const SBCommandReturnObject &rhs): + m_opaque_ap () +{ + if (rhs.m_opaque_ap.get()) + m_opaque_ap.reset (new CommandReturnObject (*rhs.m_opaque_ap)); +} + +const SBCommandReturnObject & +SBCommandReturnObject::operator = (const SBCommandReturnObject &rhs) +{ + if (this != &rhs) + { + if (rhs.m_opaque_ap.get()) + m_opaque_ap.reset (new CommandReturnObject (*rhs.m_opaque_ap)); + else + m_opaque_ap.reset(); + } + return *this; +} + + SBCommandReturnObject::~SBCommandReturnObject () { // m_opaque_ap will automatically delete any pointer it owns Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Fri Nov 5 18:17:00 2010 @@ -29,6 +29,19 @@ { } +SBCompileUnit::SBCompileUnit(const SBCompileUnit &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBCompileUnit & +SBCompileUnit::operator = (const SBCompileUnit &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + + SBCompileUnit::~SBCompileUnit () { m_opaque_ptr = NULL; Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Fri Nov 5 18:17:00 2010 @@ -85,6 +85,21 @@ { } +SBDebugger::SBDebugger(const SBDebugger &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +SBDebugger & +SBDebugger::operator = (const SBDebugger &rhs) +{ + if (this != &rhs) + { + m_opaque_sp = rhs.m_opaque_sp; + } + return *this; +} + SBDebugger::~SBDebugger () { } @@ -355,7 +370,7 @@ SBDebugger::GetSourceManager () { static SourceManager g_lldb_source_manager; - static SBSourceManager g_sb_source_manager (g_lldb_source_manager); + static SBSourceManager g_sb_source_manager (&g_lldb_source_manager); return g_sb_source_manager; } Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Fri Nov 5 18:17:00 2010 @@ -25,22 +25,40 @@ SBEvent::SBEvent () : m_event_sp (), - m_opaque (NULL) + m_opaque_ptr (NULL) { } SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) : m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))), - m_opaque (m_event_sp.get()) + m_opaque_ptr (m_event_sp.get()) { } SBEvent::SBEvent (EventSP &event_sp) : m_event_sp (event_sp), - m_opaque (event_sp.get()) + m_opaque_ptr (event_sp.get()) { } +SBEvent::SBEvent (const SBEvent &rhs) : + m_event_sp (rhs.m_event_sp), + m_opaque_ptr (rhs.m_opaque_ptr) +{ + +} + +const SBEvent & +SBEvent::operator = (const SBEvent &rhs) +{ + if (this != &rhs) + { + m_event_sp = rhs.m_event_sp; + m_opaque_ptr = rhs.m_opaque_ptr; + } + return *this; +} + SBEvent::~SBEvent() { } @@ -136,31 +154,31 @@ // There is a dangerous accessor call GetSharedPtr which can be used, so if // we have anything valid in m_event_sp, we must use that since if it gets // used by a function that puts something in there, then it won't update - // m_opaque... + // m_opaque_ptr... if (m_event_sp) - m_opaque = m_event_sp.get(); + m_opaque_ptr = m_event_sp.get(); - return m_opaque; + return m_opaque_ptr; } void SBEvent::reset (EventSP &event_sp) { m_event_sp = event_sp; - m_opaque = m_event_sp.get(); + m_opaque_ptr = m_event_sp.get(); } void SBEvent::reset (Event* event_ptr) { - m_opaque = event_ptr; + m_opaque_ptr = event_ptr; m_event_sp.reset(); } bool SBEvent::IsValid() const { - // Do NOT use m_opaque directly!!! Must use the SBEvent::get() + // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() // accessor. See comments in SBEvent::get().... return SBEvent::get() != NULL; @@ -186,7 +204,7 @@ if (get()) { description.ref(); - m_opaque->Dump (description.get()); + m_opaque_ptr->Dump (description.get()); } else description.Printf ("No value"); @@ -200,7 +218,7 @@ if (get()) { description.ref(); - m_opaque->Dump (description.get()); + m_opaque_ptr->Dump (description.get()); } else description.Printf ("No value"); Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Fri Nov 5 18:17:00 2010 @@ -63,6 +63,19 @@ } } +SBFrame::SBFrame(const SBFrame &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBFrame & +SBFrame::operator = (const SBFrame &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + SBFrame::~SBFrame() { } Modified: lldb/trunk/source/API/SBFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBFunction.cpp (original) +++ lldb/trunk/source/API/SBFunction.cpp Fri Nov 5 18:17:00 2010 @@ -32,6 +32,18 @@ { } +SBFunction::SBFunction (const lldb::SBFunction &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBFunction & +SBFunction::operator = (const SBFunction &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + SBFunction::~SBFunction () { m_opaque_ptr = NULL; Modified: lldb/trunk/source/API/SBInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBInstruction.cpp (original) +++ lldb/trunk/source/API/SBInstruction.cpp Fri Nov 5 18:17:00 2010 @@ -28,6 +28,19 @@ { } +SBInstruction::SBInstruction(const SBInstruction &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBInstruction & +SBInstruction::operator = (const SBInstruction &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + SBInstruction::~SBInstruction () { } Modified: lldb/trunk/source/API/SBInstructionList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstructionList.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBInstructionList.cpp (original) +++ lldb/trunk/source/API/SBInstructionList.cpp Fri Nov 5 18:17:00 2010 @@ -22,6 +22,20 @@ { } +SBInstructionList::SBInstructionList(const SBInstructionList &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBInstructionList & +SBInstructionList::operator = (const SBInstructionList &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + + SBInstructionList::~SBInstructionList () { } Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Fri Nov 5 18:17:00 2010 @@ -23,15 +23,17 @@ SBListener::SBListener () : - m_opaque_ptr (NULL), - m_opaque_ptr_owned (false) + m_opaque_sp (), + m_opaque_ptr (NULL) { } SBListener::SBListener (const char *name) : - m_opaque_ptr (new Listener (name)), - m_opaque_ptr_owned (true) + m_opaque_sp (new Listener (name)), + m_opaque_ptr (NULL) { + m_opaque_ptr = m_opaque_sp.get(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) @@ -39,22 +41,32 @@ name, m_opaque_ptr); } -SBListener::SBListener (Listener &listener) : - m_opaque_ptr (&listener), - m_opaque_ptr_owned (false) + +SBListener::SBListener (const SBListener &rhs) : + m_opaque_sp (rhs.m_opaque_sp), + m_opaque_ptr (rhs.m_opaque_ptr) { } -SBListener::~SBListener () +const lldb::SBListener & +SBListener::operator = (const lldb::SBListener &rhs) { - if (m_opaque_ptr_owned) + if (this != &rhs) { - if (m_opaque_ptr) - { - delete m_opaque_ptr; - m_opaque_ptr = NULL; - } + m_opaque_sp = rhs.m_opaque_sp; + m_opaque_ptr = rhs.m_opaque_ptr; } + return *this; +} + +SBListener::SBListener (Listener &listener) : + m_opaque_sp (), + m_opaque_ptr (&listener) +{ +} + +SBListener::~SBListener () +{ } bool @@ -365,11 +377,12 @@ } void -SBListener::reset(Listener *listener, bool transfer_ownership) +SBListener::reset(Listener *listener, bool owns) { - if (m_opaque_ptr_owned && m_opaque_ptr) - delete m_opaque_ptr; - m_opaque_ptr_owned = transfer_ownership; + if (owns) + m_opaque_sp.reset (listener); + else + m_opaque_sp.reset (); m_opaque_ptr = listener; } Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Fri Nov 5 18:17:00 2010 @@ -30,6 +30,19 @@ { } +SBModule::SBModule(const SBModule &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBModule & +SBModule::operator = (const SBModule &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + SBModule::~SBModule () { } Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Fri Nov 5 18:17:00 2010 @@ -61,6 +61,14 @@ { } +const SBProcess& +SBProcess::operator = (const SBProcess& rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- Modified: lldb/trunk/source/API/SBSourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSourceManager.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBSourceManager.cpp (original) +++ lldb/trunk/source/API/SBSourceManager.cpp Fri Nov 5 18:17:00 2010 @@ -20,8 +20,8 @@ using namespace lldb_private; -SBSourceManager::SBSourceManager (SourceManager& source_manager) : - m_opaque_ref (source_manager) +SBSourceManager::SBSourceManager (SourceManager* source_manager) : + m_opaque_ptr (source_manager) { } @@ -29,6 +29,18 @@ { } +SBSourceManager::SBSourceManager(const SBSourceManager &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBSourceManager & +SBSourceManager::operator = (const SBSourceManager &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + size_t SBSourceManager::DisplaySourceLinesWithLineNumbers ( @@ -40,6 +52,9 @@ FILE *f ) { + if (m_opaque_ptr == NULL) + return 0; + if (f == NULL) return 0; @@ -48,18 +63,12 @@ StreamFile str (f); - return m_opaque_ref.DisplaySourceLinesWithLineNumbers (*file, - line, - context_before, - context_after, - current_line_cstr, - &str); + return m_opaque_ptr->DisplaySourceLinesWithLineNumbers (*file, + line, + context_before, + context_after, + current_line_cstr, + &str); } return 0; } - -SourceManager & -SBSourceManager::GetLLDBManager () -{ - return m_opaque_ref; -} Modified: lldb/trunk/source/API/SBStringList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStringList.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBStringList.cpp (original) +++ lldb/trunk/source/API/SBStringList.cpp Fri Nov 5 18:17:00 2010 @@ -34,21 +34,23 @@ } - -SBStringList::~SBStringList () -{ -} - - const SBStringList & SBStringList::operator = (const SBStringList &rhs) { - if (rhs.IsValid()) - m_opaque_ap.reset (new lldb_private::StringList(*rhs)); - + if (this != &rhs) + { + if (rhs.IsValid()) + m_opaque_ap.reset(new lldb_private::StringList(*rhs)); + else + m_opaque_ap.reset(); + } return *this; } +SBStringList::~SBStringList () +{ +} + const lldb_private::StringList * SBStringList::operator->() const { Modified: lldb/trunk/source/API/SBSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbol.cpp (original) +++ lldb/trunk/source/API/SBSymbol.cpp Fri Nov 5 18:17:00 2010 @@ -29,6 +29,19 @@ { } +SBSymbol::SBSymbol (const lldb::SBSymbol &rhs) : + m_opaque_ptr (rhs.m_opaque_ptr) +{ +} + +const SBSymbol & +SBSymbol::operator = (const SBSymbol &rhs) +{ + m_opaque_ptr = rhs.m_opaque_ptr; + return *this; +} + + SBSymbol::~SBSymbol () { m_opaque_ptr = NULL; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Nov 5 18:17:00 2010 @@ -64,6 +64,14 @@ { } +const SBTarget& +SBTarget::operator = (const SBTarget& rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- Modified: lldb/trunk/source/API/SBType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBType.cpp (original) +++ lldb/trunk/source/API/SBType.cpp Fri Nov 5 18:17:00 2010 @@ -40,7 +40,21 @@ m_type (clang_type) { } - + +SBType::SBType (const SBType &rhs) : + m_ast (rhs.m_ast), + m_type (rhs.m_type) +{ +} + +const SBType & +SBType::operator =(const SBType &rhs) +{ + m_ast = rhs.m_ast; + m_type = rhs.m_type; + return *this; +} + SBType::~SBType () { } @@ -212,6 +226,35 @@ { } +SBTypeMember::SBTypeMember (const SBTypeMember &rhs) : + m_ast (rhs.m_ast), + m_parent_type (rhs.m_parent_type), + m_member_type (rhs.m_member_type), + m_member_name (rhs.m_member_name), + m_offset (rhs.m_offset), + m_bit_size (rhs.m_bit_size), + m_bit_offset (rhs.m_bit_offset), + m_is_base_class (rhs.m_is_base_class) +{ +} + +const SBTypeMember& +SBTypeMember::operator =(const SBTypeMember &rhs) +{ + if (this != &rhs) + { + m_ast = rhs.m_ast; + m_parent_type = rhs.m_parent_type; + m_member_type = rhs.m_member_type; + m_member_name = rhs.m_member_name; + m_offset = rhs.m_offset; + m_bit_size = rhs.m_bit_size; + m_bit_offset = rhs.m_bit_offset; + m_is_base_class = rhs.m_is_base_class; + } + return *this; +} + SBTypeMember::~SBTypeMember () { SetName (NULL); Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Fri Nov 5 18:17:00 2010 @@ -44,6 +44,19 @@ { } +SBValue::SBValue(const SBValue &rhs) : + m_opaque_sp (rhs.m_opaque_sp) +{ +} + +const SBValue & +SBValue::operator = (const SBValue &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + SBValue::~SBValue() { } Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=118312&r1=118311&r2=118312&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Nov 5 18:17:00 2010 @@ -456,7 +456,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -474,7 +474,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -511,7 +511,7 @@ buildSettings = { "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -552,7 +552,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -593,7 +593,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 116; + CURRENT_PROJECT_VERSION = 117; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From johnny.chen at apple.com Fri Nov 5 19:07:07 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 06 Nov 2010 00:07:07 -0000 Subject: [Lldb-commits] [lldb] r118315 - /lldb/trunk/test/lldbtest.py Message-ID: <20101106000707.793CD2A6C12D@llvm.org> Author: johnny Date: Fri Nov 5 19:07:07 2010 New Revision: 118315 URL: http://llvm.org/viewvc/llvm-project?rev=118315&view=rev Log: Make the type of session log part of the filename itself. It allows for easier identification of the test failures/errors by human beings as well as automatic processings. The prefix which identifies the type can be: Error, Failure, or ExpectedFailure. Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=118315&r1=118314&r2=118315&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Fri Nov 5 19:07:07 2010 @@ -544,10 +544,13 @@ # See http://docs.python.org/library/unittest.html#unittest.TestResult. if self.__errored__: pairs = lldb.test_result.errors + prefix = 'Error' elif self.__failed__: pairs = lldb.test_result.failures + prefix = 'Failure' elif self.__expected__: pairs = lldb.test_result.expectedFailures + prefix = 'ExpectedFailure' else: # Simply return, there's no session info to dump! return @@ -560,7 +563,7 @@ os.environ["LLDB_SESSION_DIRNAME"]) if not os.path.isdir(dname): os.mkdir(dname) - fname = os.path.join(dname, "%s.log" % self.id()) + fname = os.path.join(dname, "%s-%s.log" % (prefix, self.id())) with open(fname, "w") as f: import datetime print >> f, "Session info generated @", datetime.datetime.now().ctime() From scallanan at apple.com Fri Nov 5 19:09:34 2010 From: scallanan at apple.com (Sean Callanan) Date: Sat, 06 Nov 2010 00:09:34 -0000 Subject: [Lldb-commits] [lldb] r118316 - /lldb/trunk/source/Expression/IRForTarget.cpp Message-ID: <20101106000934.6346E2A6C12D@llvm.org> Author: spyffe Date: Fri Nov 5 19:09:34 2010 New Revision: 118316 URL: http://llvm.org/viewvc/llvm-project?rev=118316&view=rev Log: Fixed a bug where variables in the source operands of store statements were not being marked for resolution. Modified: lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=118316&r1=118315&r2=118316&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Fri Nov 5 19:09:34 2010 @@ -794,7 +794,8 @@ return false; if (StoreInst *store = dyn_cast(&inst)) - if (!MaybeHandleVariable(M, store->getPointerOperand(), true)) + if (!MaybeHandleVariable(M, store->getValueOperand(), true) || + !MaybeHandleVariable(M, store->getPointerOperand(), true)) return false; } From gclayton at apple.com Fri Nov 5 19:12:48 2010 From: gclayton at apple.com (Greg Clayton) Date: Sat, 06 Nov 2010 00:12:48 -0000 Subject: [Lldb-commits] [lldb] r118317 - /lldb/trunk/include/lldb/Utility/SharingPtr.h Message-ID: <20101106001248.477BC2A6C12D@llvm.org> Author: gclayton Date: Fri Nov 5 19:12:48 2010 New Revision: 118317 URL: http://llvm.org/viewvc/llvm-project?rev=118317&view=rev Log: Howard Hinnant gave us changes for lldb_private::SharingPtr that gives us the ability have a single allocation contain both the class and the ref count without having to do intrusive pointer type stuff. They will intermingle correctly with other shared pointers as well. In order to take advantage of this you need to create your pointer in your class with the make_shared function: lldb_private::SharingPtr p = llvm::make_shared(i, j); Currently up to five constructor arguments are supported and each must be an LValue. Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=118317&r1=118316&r2=118317&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/SharingPtr.h (original) +++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Nov 5 19:12:48 2010 @@ -11,7 +11,6 @@ #define utility_SharingPtr_h_ #include -#include namespace lldb_private { @@ -57,6 +56,48 @@ delete data_; } +template +class shared_ptr_emplace + : public shared_count +{ + T data_; +public: + + shared_ptr_emplace() + : data_() {} + + template + shared_ptr_emplace(A0& a0) + : data_(a0) {} + + template + shared_ptr_emplace(A0& a0, A1& a1) + : data_(a0, a1) {} + + template + shared_ptr_emplace(A0& a0, A1& a1, A2& a2) + : data_(a0, a1, a2) {} + + template + shared_ptr_emplace(A0& a0, A1& a1, A2& a2, A3& a3) + : data_(a0, a1, a2, a3) {} + + template + shared_ptr_emplace(A0& a0, A1& a1, A2& a2, A3& a3, A4& a4) + : data_(a0, a1, a2, a3, a4) {} + +private: + virtual void on_zero_shared(); +public: + T* get() {return &data_;} +}; + +template +void +shared_ptr_emplace::on_zero_shared() +{ +} + } // namespace template @@ -94,6 +135,23 @@ bool empty() const {return cntrl_ == 0;} operator nat*() const {return (nat*)get();} + static SharingPtr make_shared(); + + template + static SharingPtr make_shared(A0&); + + template + static SharingPtr make_shared(A0&, A1&); + + template + static SharingPtr make_shared(A0&, A1&, A2&); + + template + static SharingPtr make_shared(A0&, A1&, A2&, A3&); + + template + static SharingPtr make_shared(A0&, A1&, A2&, A3&, A4&); + private: template friend class SharingPtr; @@ -202,6 +260,126 @@ SharingPtr(p).swap(*this); } +template +SharingPtr +SharingPtr::make_shared() +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(); + r.ptr_ = r.cntrl_->get(); + return r; +} + +template +template +SharingPtr +SharingPtr::make_shared(A0& a0) +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(a0); + r.ptr_ = static_cast(r.cntrl_)->get(); + return r; +} + +template +template +SharingPtr +SharingPtr::make_shared(A0& a0, A1& a1) +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(a0, a1); + r.ptr_ = static_cast(r.cntrl_)->get(); + return r; +} + +template +template +SharingPtr +SharingPtr::make_shared(A0& a0, A1& a1, A2& a2) +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(a0, a1, a2); + r.ptr_ = static_cast(r.cntrl_)->get(); + return r; +} + +template +template +SharingPtr +SharingPtr::make_shared(A0& a0, A1& a1, A2& a2, A3& a3) +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(a0, a1, a2, a3); + r.ptr_ = static_cast(r.cntrl_)->get(); + return r; +} + +template +template +SharingPtr +SharingPtr::make_shared(A0& a0, A1& a1, A2& a2, A3& a3, A4& a4) +{ + typedef imp::shared_ptr_emplace CntrlBlk; + SharingPtr r; + r.cntrl_ = new CntrlBlk(a0, a1, a2, a3, a4); + r.ptr_ = static_cast(r.cntrl_)->get(); + return r; +} + +template +inline +SharingPtr +make_shared() +{ + return SharingPtr::make_shared(); +} + +template +inline +SharingPtr +make_shared(A0& a0) +{ + return SharingPtr::make_shared(a0); +} + +template +inline +SharingPtr +make_shared(A0& a0, A1& a1) +{ + return SharingPtr::make_shared(a0, a1); +} + +template +inline +SharingPtr +make_shared(A0& a0, A1& a1, A2& a2) +{ + return SharingPtr::make_shared(a0, a1, a2); +} + +template +inline +SharingPtr +make_shared(A0& a0, A1& a1, A2& a2, A3& a3) +{ + return SharingPtr::make_shared(a0, a1, a2, a3); +} + +template +inline +SharingPtr +make_shared(A0& a0, A1& a1, A2& a2, A3& a3, A4& a4) +{ + return SharingPtr::make_shared(a0, a1, a2, a3, a4); +} + + template inline bool From gclayton at apple.com Fri Nov 5 20:53:31 2010 From: gclayton at apple.com (Greg Clayton) Date: Sat, 06 Nov 2010 01:53:31 -0000 Subject: [Lldb-commits] [lldb] r118319 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Utility/ source/ source/API/ source/Breakpoint/ source/Core/ source/Expression/ source/Host/common/ source/Host/macosx/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remot... Message-ID: <20101106015332.245E82A6C12D@llvm.org> Author: gclayton Date: Fri Nov 5 20:53:30 2010 New Revision: 118319 URL: http://llvm.org/viewvc/llvm-project?rev=118319&view=rev Log: Modified all logging calls to hand out shared pointers to make sure we don't crash if we disable logging when some code already has a copy of the logger. Prior to this fix, logs were handed out as pointers and if they were held onto while a log got disabled, then it could cause a crash. Now all logs are handed out as shared pointers so this problem shouldn't happen anymore. We are also using our new shared pointers that put the shared pointer count and the object into the same allocation for a tad better performance. Modified: lldb/trunk/include/lldb/Core/Log.h lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h lldb/trunk/include/lldb/Utility/SharingPtr.h lldb/trunk/include/lldb/lldb-private-log.h lldb/trunk/source/API/SBAddress.cpp lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBFunction.cpp lldb/trunk/source/API/SBHostOS.cpp lldb/trunk/source/API/SBInputReader.cpp lldb/trunk/source/API/SBLineEntry.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSymbol.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBType.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBValueList.cpp lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Core/AddressResolverFileLine.cpp lldb/trunk/source/Core/AddressResolverName.cpp lldb/trunk/source/Core/Broadcaster.cpp lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/ConnectionFileDescriptor.cpp lldb/trunk/source/Core/Listener.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Expression/ASTResultSynthesizer.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Expression/DWARFExpression.cpp lldb/trunk/source/Expression/IRDynamicChecks.cpp lldb/trunk/source/Expression/IRForTarget.cpp lldb/trunk/source/Expression/IRToDWARF.cpp lldb/trunk/source/Expression/RecordingMemoryManager.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp lldb/trunk/source/Target/ObjCLanguageRuntime.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/SectionLoadList.cpp lldb/trunk/source/Target/StopInfo.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadList.cpp lldb/trunk/source/Target/ThreadPlan.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp lldb/trunk/source/Target/ThreadPlanStepOut.cpp lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp lldb/trunk/source/Target/ThreadPlanStepRange.cpp lldb/trunk/source/Target/ThreadPlanStepThrough.cpp lldb/trunk/source/Target/ThreadPlanStepUntil.cpp lldb/trunk/source/Target/ThreadPlanTestCondition.cpp lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/include/lldb/Core/Log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Log.h (original) +++ lldb/trunk/include/lldb/Core/Log.h Fri Nov 5 20:53:30 2010 @@ -60,10 +60,10 @@ // Callback definitions for abstracted plug-in log access. //------------------------------------------------------------------ typedef void (*DisableCallback) (Args &args, Stream *feedback_strm); - typedef Log* (*EnableCallback) (lldb::StreamSP &log_stream_sp, - uint32_t log_options, - Args &args, - Stream *feedback_strm); + typedef lldb::LogSP (*EnableCallback) (lldb::StreamSP &log_stream_sp, + uint32_t log_options, + Args &args, + Stream *feedback_strm); typedef void (*ListCategoriesCallback) (Stream *strm); struct Callbacks Modified: lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h (original) +++ lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h Fri Nov 5 20:53:30 2010 @@ -285,7 +285,7 @@ std::map m_globals; ///< A map from the base addresses of globals to their sizes. std::map m_exception_tables; ///< A map from the base addresses of exception tables to their end addresses. - lldb_private::Log *m_log; ///< The log to use when printing log messages. May be NULL. + lldb::LogSP m_log; ///< The log to use when printing log messages. May be NULL. //---------------------------------------------------------------------- /// @class LocalToRemoteAddressRange RecordingMemoryManager.h "lldb/Expression/RecordingMemoryManager.h" Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/SharingPtr.h (original) +++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Nov 5 20:53:30 2010 @@ -267,7 +267,7 @@ typedef imp::shared_ptr_emplace CntrlBlk; SharingPtr r; r.cntrl_ = new CntrlBlk(); - r.ptr_ = r.cntrl_->get(); + r.ptr_ = static_cast(r.cntrl_)->get(); return r; } Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Fri Nov 5 20:53:30 2010 @@ -56,10 +56,10 @@ void LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...); -Log * +lldb::LogSP GetLogIfAllCategoriesSet (uint32_t mask); -Log * +lldb::LogSP GetLogIfAnyCategoriesSet (uint32_t mask); uint32_t @@ -71,7 +71,7 @@ void DisableLog (Args &args, Stream *feedback_strm); -Log * +lldb::LogSP EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm); void Modified: lldb/trunk/source/API/SBAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBAddress.cpp (original) +++ lldb/trunk/source/API/SBAddress.cpp Fri Nov 5 20:53:30 2010 @@ -87,7 +87,7 @@ lldb::addr_t SBAddress::GetLoadAddress (const SBTarget &target) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_ap.get()) { Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Fri Nov 5 20:53:30 2010 @@ -95,7 +95,7 @@ break_id_t SBBreakpoint::GetID () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_sp) { @@ -195,7 +195,7 @@ void SBBreakpoint::SetEnabled (bool enable) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); @@ -216,7 +216,7 @@ void SBBreakpoint::SetIgnoreCount (uint32_t count) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); @@ -244,7 +244,7 @@ if (m_opaque_sp) count = m_opaque_sp->GetHitCount(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); @@ -258,7 +258,7 @@ if (m_opaque_sp) count = m_opaque_sp->GetIgnoreCount(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); @@ -270,7 +270,7 @@ { if (m_opaque_sp) m_opaque_sp->SetThreadID (tid); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid); @@ -283,7 +283,7 @@ if (m_opaque_sp) tid = m_opaque_sp->GetThreadID(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid); return tid; @@ -292,7 +292,7 @@ void SBBreakpoint::SetThreadIndex (uint32_t index) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); if (m_opaque_sp) @@ -309,7 +309,7 @@ if (thread_spec == NULL) thread_idx = thread_spec->GetIndex(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), index); @@ -320,7 +320,7 @@ void SBBreakpoint::SetThreadName (const char *thread_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); @@ -338,7 +338,7 @@ if (thread_spec == NULL) name = thread_spec->GetName(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); @@ -348,7 +348,7 @@ void SBBreakpoint::SetQueueName (const char *queue_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); if (m_opaque_sp) @@ -364,7 +364,7 @@ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); name = thread_spec->GetQueueName(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); @@ -377,7 +377,7 @@ size_t num_resolved = 0; if (m_opaque_sp) num_resolved = m_opaque_sp->GetNumResolvedLocations(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved); return num_resolved; @@ -389,7 +389,7 @@ size_t num_locs = 0; if (m_opaque_sp) num_locs = m_opaque_sp->GetNumLocations(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs); return num_locs; @@ -450,7 +450,7 @@ void SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Fri Nov 5 20:53:30 2010 @@ -33,7 +33,7 @@ SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) : m_opaque_sp (break_loc_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { @@ -244,7 +244,7 @@ SBBreakpoint SBBreakpointLocation::GetBreakpoint () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); //if (log) // log->Printf ("SBBreakpointLocation::GetBreakpoint ()"); Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Fri Nov 5 20:53:30 2010 @@ -30,7 +30,7 @@ m_opaque_ptr (NULL) { m_opaque_ptr = m_opaque_sp.get(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", @@ -41,7 +41,7 @@ m_opaque_sp (owns ? broadcaster : NULL), m_opaque_ptr (broadcaster) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)", @@ -73,7 +73,7 @@ void SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique); @@ -90,7 +90,7 @@ void SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique); @@ -108,7 +108,7 @@ void SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events); if (m_opaque_ptr) Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Nov 5 20:53:30 2010 @@ -33,7 +33,7 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : m_opaque_ptr (interpreter) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)" @@ -82,7 +82,7 @@ lldb::ReturnStatus SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)", @@ -168,7 +168,7 @@ if (target) process.SetProcess(target->GetProcessSP()); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)", @@ -187,7 +187,7 @@ ssize_t SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ssize_t bytes_written = 0; if (m_opaque_ptr && src && src[0]) @@ -236,7 +236,7 @@ result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))", @@ -257,7 +257,7 @@ result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))", @@ -267,7 +267,7 @@ SBBroadcaster SBCommandInterpreter::GetBroadcaster () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBroadcaster broadcaster (m_opaque_ptr, false); Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Fri Nov 5 20:53:30 2010 @@ -57,7 +57,7 @@ const char * SBCommandReturnObject::GetOutput () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_ap.get()) { @@ -77,7 +77,7 @@ const char * SBCommandReturnObject::GetError () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_ap.get()) { Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Fri Nov 5 20:53:30 2010 @@ -28,7 +28,7 @@ m_opaque (new Communication (broadcaster_name)), m_opaque_owned (true) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => " @@ -82,7 +82,7 @@ ConnectionStatus SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ConnectionStatus status = eConnectionStatusNoConnection; if (m_opaque) @@ -110,7 +110,7 @@ ConnectionStatus SBCommunication::Disconnect () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ConnectionStatus status= eConnectionStatusNoConnection; if (m_opaque) @@ -126,7 +126,7 @@ bool SBCommunication::IsConnected () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool result = false; if (m_opaque) result = m_opaque->IsConnected (); @@ -140,7 +140,7 @@ size_t SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...", m_opaque, dst, dst_len, timeout_usec); @@ -167,7 +167,7 @@ else status = eConnectionStatusNoConnection; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu", m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written); @@ -178,7 +178,7 @@ bool SBCommunication::ReadThreadStart () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool success = false; if (m_opaque) @@ -195,7 +195,7 @@ bool SBCommunication::ReadThreadStop () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque); @@ -215,7 +215,7 @@ bool result = false; if (m_opaque) result = m_opaque->ReadThreadIsRunning (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result); return result; @@ -228,7 +228,7 @@ void *callback_baton ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool result = false; if (m_opaque) @@ -249,7 +249,7 @@ { SBBroadcaster broadcaster (m_opaque, false); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)", Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Fri Nov 5 20:53:30 2010 @@ -71,7 +71,7 @@ SBLineEntry SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBLineEntry sb_line_entry; if (m_opaque_ptr) @@ -99,7 +99,7 @@ uint32_t SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t index = UINT32_MAX; if (m_opaque_ptr) Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Fri Nov 5 20:53:30 2010 @@ -37,7 +37,7 @@ void SBDebugger::Initialize () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger::Initialize ()"); @@ -54,7 +54,7 @@ void SBDebugger::Clear () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get()); @@ -65,7 +65,7 @@ SBDebugger SBDebugger::Create() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBDebugger debugger; debugger.reset(Debugger::CreateInstance()); @@ -130,7 +130,7 @@ void SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), @@ -143,7 +143,7 @@ void SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) @@ -157,7 +157,7 @@ void SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) @@ -195,7 +195,7 @@ SBCommandInterpreter SBDebugger::GetCommandInterpreter () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBCommandInterpreter sb_interpreter; if (m_opaque_sp) @@ -243,7 +243,7 @@ SBListener SBDebugger::GetListener () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBListener sb_listener; if (m_opaque_sp) @@ -432,7 +432,7 @@ bool SBDebugger::StateIsRunningState (lldb::StateType state) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const bool result = lldb_private::StateIsRunningState (state); if (log) @@ -445,7 +445,7 @@ bool SBDebugger::StateIsStoppedState (lldb::StateType state) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const bool result = lldb_private::StateIsStoppedState (state); if (log) @@ -471,7 +471,7 @@ target.reset (target_sp); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)", @@ -484,7 +484,7 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBTarget target; if (m_opaque_sp) @@ -565,7 +565,7 @@ target.reset (target_sp); } } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", @@ -628,7 +628,7 @@ SBTarget SBDebugger::GetSelectedTarget () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBTarget sb_target; if (m_opaque_sp) @@ -648,7 +648,7 @@ void SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(), @@ -661,7 +661,7 @@ void SBDebugger::PushInputReader (SBInputReader &reader) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger(%p)::PushInputReader (SBInputReader(%p))", m_opaque_sp.get(), &reader); @@ -768,7 +768,7 @@ const char * SBDebugger::GetPrompt() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(), Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Fri Nov 5 20:53:30 2010 @@ -70,7 +70,7 @@ bool SBError::Fail () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool ret_value = false; if (m_opaque_ap.get()) @@ -85,7 +85,7 @@ bool SBError::Success () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool ret_value = false; if (m_opaque_ap.get()) ret_value = m_opaque_ap->Success(); @@ -99,7 +99,7 @@ uint32_t SBError::GetError () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t err = 0; if (m_opaque_ap.get()) @@ -115,7 +115,7 @@ ErrorType SBError::GetType () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ErrorType err_type = eErrorTypeInvalid; if (m_opaque_ap.get()) err_type = m_opaque_ap->GetType(); Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Fri Nov 5 20:53:30 2010 @@ -75,7 +75,7 @@ uint32_t SBEvent::GetType () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const Event *lldb_event = get(); uint32_t event_type = 0; @@ -123,7 +123,7 @@ success = lldb_event->BroadcasterIs (broadcaster.get()); // For logging, this gets a little chatty so only enable this when verbose logging is on - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i", get(), @@ -187,7 +187,7 @@ const char * SBEvent::GetCStringFromEvent (const SBEvent &event) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"", Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Fri Nov 5 20:53:30 2010 @@ -25,7 +25,7 @@ SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : m_opaque_ap() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (rhs.m_opaque_ap.get()) m_opaque_ap.reset (new FileSpec (rhs.get())); @@ -48,7 +48,7 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : m_opaque_ap(new FileSpec (path, resolve)) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path, @@ -79,7 +79,7 @@ bool SBFileSpec::Exists () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool result = false; if (m_opaque_ap.get()) @@ -112,7 +112,7 @@ if (m_opaque_ap.get()) s = m_opaque_ap->GetFilename().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (s) @@ -130,7 +130,7 @@ const char *s = NULL; if (m_opaque_ap.get()) s = m_opaque_ap->GetDirectory().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (s) @@ -144,7 +144,7 @@ uint32_t SBFileSpec::GetPath (char *dst_path, size_t dst_len) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t result = 0; if (m_opaque_ap.get()) Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Fri Nov 5 20:53:30 2010 @@ -51,7 +51,7 @@ SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) : m_opaque_sp (lldb_object_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { @@ -86,7 +86,7 @@ { void *old_ptr = m_opaque_sp.get(); m_opaque_sp = lldb_object_sp; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { @@ -111,7 +111,7 @@ if (m_opaque_sp) sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get()); @@ -123,7 +123,7 @@ SBFrame::GetModule () const { SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", m_opaque_sp.get(), sb_module.get()); @@ -136,7 +136,7 @@ { SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)", m_opaque_sp.get(), sb_comp_unit.get()); @@ -149,7 +149,7 @@ { SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", m_opaque_sp.get(), sb_function.get()); @@ -161,7 +161,7 @@ SBFrame::GetSymbol () const { SBSymbol sb_symbol(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", m_opaque_sp.get(), sb_symbol.get()); @@ -172,7 +172,7 @@ SBFrame::GetBlock () const { SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", m_opaque_sp.get(), sb_block.get()); @@ -183,7 +183,7 @@ SBFrame::GetFrameBlock () const { SBBlock sb_block(m_opaque_sp->GetFrameBlock ()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", m_opaque_sp.get(), sb_block.get()); @@ -194,7 +194,7 @@ SBFrame::GetLineEntry () const { SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", m_opaque_sp.get(), sb_line_entry.get()); @@ -206,7 +206,7 @@ { uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetFrameID () => %u", m_opaque_sp.get(), frame_idx); @@ -221,7 +221,7 @@ if (m_opaque_sp) addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", m_opaque_sp.get(), addr); @@ -236,7 +236,7 @@ if (m_opaque_sp) ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i", m_opaque_sp.get(), new_pc, ret_val); @@ -250,7 +250,7 @@ addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetRegisterContext()->GetSP(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", m_opaque_sp.get(), addr); @@ -265,7 +265,7 @@ if (m_opaque_sp) addr = m_opaque_sp->GetRegisterContext()->GetFP(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", m_opaque_sp.get(), addr); return addr; @@ -278,7 +278,7 @@ SBAddress sb_addr; if (m_opaque_sp) sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get()); return sb_addr; @@ -322,7 +322,7 @@ if (var_sp) *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::LookupVar (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), var_name, sb_value.get()); @@ -377,7 +377,7 @@ if (var_sp) *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::LookupVarInScope (name=\"%s\", scope=%s) => SBValue(%p)", m_opaque_sp.get(), var_name, scope, sb_value.get()); @@ -414,7 +414,7 @@ SBThread SBFrame::GetThread () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); //if (log) // log->Printf ("SBFrame::GetThread ()"); @@ -438,7 +438,7 @@ const char *disassembly = NULL; if (m_opaque_sp) disassembly = m_opaque_sp->Disassemble(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly); @@ -453,7 +453,7 @@ bool statics, bool in_scope_only) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", @@ -522,7 +522,7 @@ lldb::SBValueList SBFrame::GetRegisters () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBValueList value_list; if (m_opaque_sp) @@ -561,7 +561,7 @@ lldb::SBValue SBFrame::EvaluateExpression (const char *expr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); lldb::SBValue expr_result; if (log) Modified: lldb/trunk/source/API/SBFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBFunction.cpp (original) +++ lldb/trunk/source/API/SBFunction.cpp Fri Nov 5 20:53:30 2010 @@ -62,7 +62,7 @@ if (m_opaque_ptr) cstr = m_opaque_ptr->GetMangled().GetName().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -79,7 +79,7 @@ const char *cstr = NULL; if (m_opaque_ptr) cstr = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) Modified: lldb/trunk/source/API/SBHostOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBHostOS.cpp (original) +++ lldb/trunk/source/API/SBHostOS.cpp Fri Nov 5 20:53:30 2010 @@ -35,7 +35,7 @@ SBError *error_ptr ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, Modified: lldb/trunk/source/API/SBInputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBInputReader.cpp (original) +++ lldb/trunk/source/API/SBInputReader.cpp Fri Nov 5 20:53:30 2010 @@ -33,7 +33,7 @@ SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) : m_opaque_sp (reader_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => SBInputReader(%p)", reader_sp.get(), @@ -43,7 +43,7 @@ SBInputReader::SBInputReader (const SBInputReader &rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => SBInputReader(%p)", @@ -84,7 +84,7 @@ bool echo ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, " @@ -194,7 +194,7 @@ bool SBInputReader::IsActive () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool ret_value = false; if (m_opaque_sp) Modified: lldb/trunk/source/API/SBLineEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBLineEntry.cpp (original) +++ lldb/trunk/source/API/SBLineEntry.cpp Fri Nov 5 20:53:30 2010 @@ -69,7 +69,7 @@ if (m_opaque_ap.get()) sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { StreamString sstr; @@ -91,7 +91,7 @@ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize()); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { StreamString sstr; @@ -113,7 +113,7 @@ SBFileSpec SBLineEntry::GetFileSpec () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBFileSpec sb_file_spec; if (m_opaque_ap.get() && m_opaque_ap->file) @@ -133,7 +133,7 @@ uint32_t SBLineEntry::GetLine () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t line = 0; if (m_opaque_ap.get()) Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Fri Nov 5 20:53:30 2010 @@ -34,7 +34,7 @@ { m_opaque_ptr = m_opaque_sp.get(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)", @@ -93,7 +93,7 @@ uint32_t SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t acquired_event_mask = 0; if (m_opaque_ptr && broadcaster.IsValid()) @@ -152,7 +152,7 @@ bool SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (timeout_secs == UINT32_MAX) Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Fri Nov 5 20:53:30 2010 @@ -56,7 +56,7 @@ SBFileSpec SBModule::GetFileSpec () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBFileSpec file_spec; if (m_opaque_sp) @@ -74,7 +74,7 @@ const uint8_t * SBModule::GetUUIDBytes () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const uint8_t *uuid_bytes = NULL; if (m_opaque_sp) Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Fri Nov 5 20:53:30 2010 @@ -99,7 +99,7 @@ uint32_t SBProcess::GetNumThreads () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t num_threads = 0; if (m_opaque_sp) @@ -117,7 +117,7 @@ SBThread SBProcess::GetSelectedThread () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBThread sb_thread; if (m_opaque_sp) @@ -134,7 +134,7 @@ SBTarget SBProcess::GetTarget() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBTarget sb_target; if (m_opaque_sp) @@ -150,7 +150,7 @@ size_t SBProcess::PutSTDIN (const char *src, size_t src_len) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); size_t ret_val = 0; if (m_opaque_sp != NULL) @@ -179,7 +179,7 @@ bytes_read = m_opaque_sp->GetSTDOUT (dst, dst_len, error); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%zu) => %zu", m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read); @@ -197,7 +197,7 @@ bytes_read = m_opaque_sp->GetSTDERR (dst, dst_len, error); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%zu) => %zu", m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read); @@ -254,7 +254,7 @@ bool SBProcess::SetSelectedThreadByID (uint32_t tid) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool ret_val = false; if (m_opaque_sp != NULL) @@ -270,7 +270,7 @@ SBThread SBProcess::GetThreadAtIndex (size_t index) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBThread thread; if (m_opaque_sp) @@ -293,7 +293,7 @@ if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetState () => %s", m_opaque_sp.get(), @@ -309,7 +309,7 @@ int exit_status = 0; if (m_opaque_sp) exit_status = m_opaque_sp->GetExitStatus (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", m_opaque_sp.get(), exit_status, exit_status); @@ -323,7 +323,7 @@ const char *exit_desc = NULL; if (m_opaque_sp != NULL) exit_desc = m_opaque_sp->GetExitDescription (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetExitDescription () => %s", m_opaque_sp.get(), exit_desc); @@ -337,7 +337,7 @@ if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val); @@ -351,7 +351,7 @@ if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size); @@ -361,7 +361,7 @@ SBError SBProcess::Continue () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBProcess(%p)::Continue ()...", m_opaque_sp.get()); @@ -403,7 +403,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; @@ -425,7 +425,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; @@ -449,7 +449,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; @@ -514,7 +514,7 @@ sb_error.SetError (m_opaque_sp->Signal (signo)); else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; @@ -535,7 +535,7 @@ if (m_opaque_sp) sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)", @@ -550,7 +550,7 @@ StateType SBProcess::GetStateFromEvent (const SBEvent &event) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); @@ -578,7 +578,7 @@ SBBroadcaster SBProcess::GetBroadcaster () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBroadcaster broadcaster(m_opaque_sp.get(), false); @@ -598,7 +598,7 @@ size_t SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); size_t bytes_read = 0; @@ -645,7 +645,7 @@ { size_t bytes_written = 0; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...", Modified: lldb/trunk/source/API/SBSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbol.cpp (original) +++ lldb/trunk/source/API/SBSymbol.cpp Fri Nov 5 20:53:30 2010 @@ -60,7 +60,7 @@ if (m_opaque_ptr) name = m_opaque_ptr->GetMangled().GetName().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : ""); return name; @@ -72,7 +72,7 @@ const char *name = NULL; if (m_opaque_ptr) name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : ""); Modified: lldb/trunk/source/API/SBSymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbolContext.cpp (original) +++ lldb/trunk/source/API/SBSymbolContext.cpp Fri Nov 5 20:53:30 2010 @@ -86,7 +86,7 @@ SBModule SBSymbolContext::GetModule () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBModule sb_module; if (m_opaque_ap.get()) @@ -112,7 +112,7 @@ SBFunction SBSymbolContext::GetFunction () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Function *function = NULL; @@ -137,7 +137,7 @@ SBLineEntry SBSymbolContext::GetLineEntry () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBLineEntry sb_line_entry; if (m_opaque_ap.get()) @@ -155,7 +155,7 @@ SBSymbol SBSymbolContext::GetSymbol () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Symbol *symbol = NULL; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Nov 5 20:53:30 2010 @@ -93,7 +93,7 @@ if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->GetProcessSP()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", @@ -123,7 +123,7 @@ if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p)", @@ -144,7 +144,7 @@ bool stop_at_entry ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i)", @@ -174,7 +174,7 @@ SBError &error ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { @@ -333,7 +333,7 @@ exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec()); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", @@ -392,7 +392,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_bp; if (m_opaque_sp.get() && line != 0) @@ -418,7 +418,7 @@ SBBreakpoint SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name && symbol_name[0]) @@ -446,7 +446,7 @@ SBBreakpoint SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) @@ -479,7 +479,7 @@ SBBreakpoint SBTarget::BreakpointCreateByAddress (addr_t address) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_bp; if (m_opaque_sp.get()) @@ -496,7 +496,7 @@ SBBreakpoint SBTarget::FindBreakpointByID (break_id_t bp_id) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_breakpoint; if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) @@ -531,7 +531,7 @@ bool SBTarget::BreakpointDelete (break_id_t bp_id) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); bool result = false; if (m_opaque_sp) @@ -582,7 +582,7 @@ uint32_t SBTarget::GetNumModules () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t num = 0; if (m_opaque_sp) @@ -597,7 +597,7 @@ void SBTarget::Clear () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get()); @@ -618,7 +618,7 @@ SBModule SBTarget::GetModuleAtIndex (uint32_t idx) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBModule sb_module; if (m_opaque_sp) @@ -637,7 +637,7 @@ SBBroadcaster SBTarget::GetBroadcaster () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBroadcaster broadcaster(m_opaque_sp.get(), false); Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Nov 5 20:53:30 2010 @@ -91,7 +91,7 @@ StopReason SBThread::GetStopReason() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); StopReason reason = eStopReasonInvalid; if (m_opaque_sp) @@ -111,7 +111,7 @@ size_t SBThread::GetStopDescription (char *dst, size_t dst_len) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_sp) { @@ -218,7 +218,7 @@ lldb::tid_t SBThread::GetThreadID () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); lldb::tid_t id = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) @@ -244,7 +244,7 @@ if (m_opaque_sp) name = m_opaque_sp->GetName(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL"); @@ -258,7 +258,7 @@ if (m_opaque_sp) name = m_opaque_sp->GetQueueName(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL"); @@ -269,7 +269,7 @@ void SBThread::StepOver (lldb::RunMode stop_other_threads) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(), @@ -318,7 +318,7 @@ void SBThread::StepInto (lldb::RunMode stop_other_threads) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(), @@ -365,7 +365,7 @@ void SBThread::StepOut () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get()); @@ -393,7 +393,7 @@ void SBThread::StepInstruction (bool step_over) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over); @@ -417,7 +417,7 @@ void SBThread::RunToAddress (lldb::addr_t addr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr); @@ -455,7 +455,7 @@ process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP()); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { SBStream sstr; @@ -470,7 +470,7 @@ uint32_t SBThread::GetNumFrames () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); uint32_t num_frames = 0; if (m_opaque_sp) @@ -485,7 +485,7 @@ SBFrame SBThread::GetFrameAtIndex (uint32_t idx) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBFrame sb_frame; if (m_opaque_sp) Modified: lldb/trunk/source/API/SBType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBType.cpp (original) +++ lldb/trunk/source/API/SBType.cpp Fri Nov 5 20:53:30 2010 @@ -21,7 +21,7 @@ bool SBType::IsPointerType (void *opaque_type) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); //if (log) // log->Printf ("SBType::IsPointerType (%p)", opaque_type); Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Fri Nov 5 20:53:30 2010 @@ -89,7 +89,7 @@ if (m_opaque_sp) name = m_opaque_sp->GetName().GetCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (name) @@ -107,7 +107,7 @@ const char *name = NULL; if (m_opaque_sp) name = m_opaque_sp->GetTypeName().GetCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (name) @@ -127,7 +127,7 @@ if (m_opaque_sp) result = m_opaque_sp->GetByteSize(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result); @@ -142,7 +142,7 @@ if (m_opaque_sp) result = m_opaque_sp->IsInScope (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result); @@ -155,7 +155,7 @@ const char *cstr = NULL; if ( m_opaque_sp) cstr = m_opaque_sp->GetValueAsCString (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -173,7 +173,7 @@ ValueType result = eValueTypeInvalid; if (m_opaque_sp) result = m_opaque_sp->GetValueType(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { switch (result) @@ -198,7 +198,7 @@ const char *cstr = NULL; if ( m_opaque_sp) cstr = m_opaque_sp->GetObjectDescription (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -215,7 +215,7 @@ bool result = false; if (m_opaque_sp) result = m_opaque_sp->GetValueDidChange (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetValueDidChange (SBFrame(%p)) => %i", m_opaque_sp.get(), frame.get(), result); @@ -228,7 +228,7 @@ const char *cstr = NULL; if (m_opaque_sp) cstr = m_opaque_sp->GetSummaryAsCString(frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -245,7 +245,7 @@ const char *cstr = NULL; if (m_opaque_sp) cstr = m_opaque_sp->GetLocationAsCString(frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -276,7 +276,7 @@ } SBValue sb_value (child_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get()); @@ -289,7 +289,7 @@ uint32_t idx = UINT32_MAX; if (m_opaque_sp) idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (idx == UINT32_MAX) @@ -313,7 +313,7 @@ SBValue sb_value (child_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get()); @@ -329,7 +329,7 @@ if (m_opaque_sp) num_children = m_opaque_sp->GetNumChildren(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children); @@ -357,7 +357,7 @@ if (m_opaque_sp->IsPointerType()) sb_value = GetChildAtIndex(0); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get()); @@ -372,7 +372,7 @@ if (m_opaque_sp) is_ptr_type = m_opaque_sp->IsPointerType(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type); Modified: lldb/trunk/source/API/SBValueList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/API/SBValueList.cpp (original) +++ lldb/trunk/source/API/SBValueList.cpp Fri Nov 5 20:53:30 2010 @@ -27,7 +27,7 @@ SBValueList::SBValueList (const SBValueList &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (rhs.IsValid()) m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs)); @@ -51,7 +51,7 @@ SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr)); @@ -144,7 +144,7 @@ SBValue SBValueList::GetValueAtIndex (uint32_t idx) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); //if (log) // log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx); @@ -167,7 +167,7 @@ uint32_t SBValueList::GetSize () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); //if (log) // log->Printf ("SBValueList::GetSize ()"); Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Fri Nov 5 20:53:30 2010 @@ -304,7 +304,7 @@ if (!break_loc->ResolveBreakpointSite()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Warning: could not set breakpoint site for breakpoint location %d of breakpoint %d.\n", break_loc->GetID(), GetID()); Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Nov 5 20:53:30 2010 @@ -209,7 +209,7 @@ BreakpointLocation::ShouldStop (StoppointCallbackContext *context) { bool should_stop = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); m_hit_count++; @@ -287,7 +287,7 @@ if (new_id == LLDB_INVALID_BREAK_ID) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); if (log) log->Warning ("Tried to add breakpoint site at 0x%llx but it was already present.\n", m_address.GetLoadAddress(&m_owner.GetTarget())); Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Fri Nov 5 20:53:30 2010 @@ -83,7 +83,7 @@ { StreamString s; bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Added location: %s\n", s.GetData()); } Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Fri Nov 5 20:53:30 2010 @@ -56,7 +56,7 @@ CompileUnit *cu = context.comp_unit; assert (m_breakpoint != NULL); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list); for (uint32_t i = 0; i < sc_list_size; i++) Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Nov 5 20:53:30 2010 @@ -81,7 +81,7 @@ { if (!m_regex.Compile (m_func_name.AsCString())) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString()); @@ -146,7 +146,7 @@ Address break_addr; assert (m_breakpoint != NULL); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (m_class_name) { Modified: lldb/trunk/source/Core/AddressResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverFileLine.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverFileLine.cpp (original) +++ lldb/trunk/source/Core/AddressResolverFileLine.cpp Fri Nov 5 20:53:30 2010 @@ -50,7 +50,7 @@ uint32_t sc_list_size; CompileUnit *cu = context.comp_unit; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list); Modified: lldb/trunk/source/Core/AddressResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp (original) +++ lldb/trunk/source/Core/AddressResolverName.cpp Fri Nov 5 20:53:30 2010 @@ -32,7 +32,7 @@ { if (!m_regex.Compile (m_func_name.AsCString())) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString()); @@ -93,7 +93,7 @@ SymbolContext sc; Address func_addr; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (m_class_name) { Modified: lldb/trunk/source/Core/Broadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Broadcaster.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/Broadcaster.cpp (original) +++ lldb/trunk/source/Core/Broadcaster.cpp Fri Nov 5 20:53:30 2010 @@ -28,7 +28,7 @@ m_hijacking_listener(NULL), m_hijacking_mask(UINT32_MAX) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Broadcaster::Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString()); @@ -36,7 +36,7 @@ Broadcaster::~Broadcaster() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Broadcaster::~Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString()); @@ -210,7 +210,7 @@ const uint32_t event_type = event_sp->GetType(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) { StreamString event_description; Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Fri Nov 5 20:53:30 2010 @@ -301,7 +301,7 @@ { Communication *comm = (Communication *)p; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf ("%p Communication::ReadThread () thread starting...", p); @@ -334,7 +334,8 @@ default: case eConnectionStatusError: // Check GetError() for details case eConnectionStatusTimedOut: // Request timed out - error.LogIfError(log, "%p Communication::BytesAvailable () => status = %i", p, status); + if (log) + error.LogIfError(log.get(), "%p Communication::BytesAvailable () => status = %i", p, status); break; } } Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original) +++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Nov 5 20:53:30 2010 @@ -145,7 +145,7 @@ size_t ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &status, Error *error_ptr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %zu)...", this, m_fd, dst, dst_len); @@ -227,7 +227,7 @@ size_t ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStatus &status, Error *error_ptr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %zu)", this, src, src_len); @@ -297,7 +297,7 @@ ConnectionStatus ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_ptr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", this, timeout_usec); struct timeval *tv_ptr; Modified: lldb/trunk/source/Core/Listener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/Listener.cpp (original) +++ lldb/trunk/source/Core/Listener.cpp Fri Nov 5 20:53:30 2010 @@ -32,14 +32,14 @@ m_events_mutex (Mutex::eMutexTypeRecursive), m_cond_wait() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Listener::Listener('%s')", this, m_name.c_str()); } Listener::~Listener() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Listener::~Listener('%s')", this, m_name.c_str()); Clear(); @@ -75,7 +75,7 @@ { } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s", this, @@ -104,7 +104,7 @@ uint32_t acquired_mask = broadcaster->AddListener (this, event_mask); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x, callback = %p, user_data = %p) acquired_mask = 0x%8.8x for %s", this, broadcaster, event_mask, callback, callback_user_data, acquired_mask, m_name.c_str()); @@ -164,7 +164,7 @@ void Listener::AddEvent (EventSP &event_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); if (log) log->Printf ("%p Listener('%s')::AddEvent (event_sp = {%p})", this, m_name.c_str(), event_sp.get()); @@ -251,7 +251,7 @@ EventSP &event_sp, bool remove) { - //Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + //LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); Mutex::Locker lock(m_events_mutex); @@ -365,7 +365,7 @@ EventSP &event_sp ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS)); bool timed_out = false; if (log) Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Fri Nov 5 20:53:30 2010 @@ -36,7 +36,7 @@ { if (object_name) m_object_name = *object_name; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')", this, @@ -50,7 +50,7 @@ Module::~Module() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')", this, Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original) +++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Fri Nov 5 20:53:30 2010 @@ -99,7 +99,7 @@ { ASTContext &Ctx(*m_ast_context); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (!m_sema) return false; Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Nov 5 20:53:30 2010 @@ -151,7 +151,7 @@ off_t alignment ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); m_struct_laid_out = false; @@ -510,7 +510,7 @@ Error &err ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (!m_struct_laid_out) { @@ -675,7 +675,7 @@ Error &err ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (!exe_ctx.frame || !exe_ctx.process) return false; @@ -923,7 +923,7 @@ TypeFromUser *type ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); VariableList *var_list = frame.GetVariableList(true); @@ -961,7 +961,7 @@ const ConstString &name ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (log) log->Printf("Hunting for a definition for '%s'", name.GetCString()); @@ -1109,7 +1109,7 @@ TypeFromParser *parser_type ) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Type *var_type = var->GetType(); @@ -1216,7 +1216,7 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, Variable* var) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); TypeFromUser ut; TypeFromParser pt; @@ -1255,7 +1255,7 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, ClangExpressionVariable *pvar) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); TypeFromUser user_type = pvar->m_user_type; @@ -1288,7 +1288,7 @@ Function* fun, Symbol* symbol) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); NamedDecl *fun_decl; std::auto_ptr fun_location(new Value); Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Nov 5 20:53:30 2010 @@ -408,7 +408,7 @@ lldb::addr_t &func_end, ExecutionContext &exe_ctx) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Error err; @@ -578,7 +578,7 @@ Error ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &exe_ctx) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); const char *name = m_expr.FunctionName(); @@ -664,10 +664,10 @@ exe_ctx.process->GetByteOrder(), exe_ctx.target->GetArchitecture().GetAddressByteSize()); - if(log) + if (log) { log->Printf("Function data has contents:"); - extractor.PutToLog (log, + extractor.PutToLog (log.get(), 0, extractor.GetByteSize(), func_remote_addr, Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Nov 5 20:53:30 2010 @@ -207,7 +207,7 @@ m_wrapper_function_text.append (args_list_buffer); m_wrapper_function_text.append (");\n}\n"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf ("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str()); @@ -357,7 +357,7 @@ if (!WriteFunctionArguments(exe_ctx, args_addr_ref, errors)) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_function_addr, args_addr_ref); @@ -542,7 +542,7 @@ return eExecutionSetupError; } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); while (1) { Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Nov 5 20:53:30 2010 @@ -117,7 +117,7 @@ bool ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); ScanContext(exe_ctx); @@ -271,7 +271,7 @@ lldb::addr_t &struct_address, lldb::addr_t &object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (m_jit_addr != LLDB_INVALID_ADDRESS) { Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Nov 5 20:53:30 2010 @@ -864,7 +864,7 @@ error_ptr->SetErrorString ("Invalid offset and/or length for opcodes buffer."); return false; } - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); while (opcodes.ValidOffset(offset) && offset < end_offset) Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original) +++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Fri Nov 5 20:53:30 2010 @@ -296,7 +296,7 @@ private: bool InstrumentInstruction(llvm::Instruction *inst) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if(log) log->Printf("Instrumenting load/store instruction: %s\n", @@ -396,7 +396,7 @@ bool InspectInstruction(llvm::Instruction &i) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); CallInst *call_inst = dyn_cast(&i); @@ -460,7 +460,7 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str())); Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Fri Nov 5 20:53:30 2010 @@ -76,7 +76,7 @@ bool IRForTarget::createResultVariable (llvm::Module &llvm_module, llvm::Function &llvm_function) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (!m_resolve_vars) return true; @@ -270,7 +270,7 @@ IRForTarget::RewriteObjCSelector(Instruction* selector_load, Module &M) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); LoadInst *load = dyn_cast(selector_load); @@ -382,7 +382,7 @@ IRForTarget::rewriteObjCSelectors(Module &M, BasicBlock &BB) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); BasicBlock::iterator ii; @@ -481,7 +481,7 @@ if (!m_resolve_vars) return true; - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); BasicBlock::iterator ii; @@ -567,7 +567,7 @@ bool Store ) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (ConstantExpr *constant_expr = dyn_cast(llvm_value_ptr)) { @@ -641,7 +641,7 @@ IRForTarget::MaybeHandleCallArguments(Module &M, CallInst *C) { - // lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + // lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); for (unsigned op_index = 0, num_ops = C->getNumArgOperands(); op_index < num_ops; @@ -656,7 +656,7 @@ IRForTarget::MaybeHandleCall(Module &llvm_module, CallInst *llvm_call_inst) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Function *fun = llvm_call_inst->getCalledFunction(); @@ -924,7 +924,7 @@ static bool UnfoldConstant(Constant *C, Value *new_value, Instruction *first_entry_instruction) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Value::use_iterator ui; @@ -1028,7 +1028,7 @@ if (!m_resolve_vars) return true; - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); m_decl_map->DoStructLayout(); @@ -1118,7 +1118,7 @@ bool IRForTarget::runOnModule(Module &M) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Function* function = M.getFunction(StringRef(m_func_name.c_str())); Modified: lldb/trunk/source/Expression/IRToDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRToDWARF.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRToDWARF.cpp (original) +++ lldb/trunk/source/Expression/IRToDWARF.cpp Fri Nov 5 20:53:30 2010 @@ -171,7 +171,7 @@ bool IRToDWARF::runOnModule(Module &M) { - lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str())); Modified: lldb/trunk/source/Expression/RecordingMemoryManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/RecordingMemoryManager.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Expression/RecordingMemoryManager.cpp (original) +++ lldb/trunk/source/Expression/RecordingMemoryManager.cpp Fri Nov 5 20:53:30 2010 @@ -17,9 +17,9 @@ RecordingMemoryManager::RecordingMemoryManager () : llvm::JITMemoryManager(), - m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager()) + m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager()), + m_log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)) { - m_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); } RecordingMemoryManager::~RecordingMemoryManager () Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Fri Nov 5 20:53:30 2010 @@ -104,7 +104,7 @@ static void * MonitorChildProcessThreadFunction (void *arg) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); const char *function = __FUNCTION__; if (log) log->Printf ("%s (arg = %p) thread starting...", function, arg); @@ -426,7 +426,7 @@ thread_func_t thread_fptr = info->thread_fptr; thread_arg_t thread_arg = info->thread_arg; - Log * log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD)); if (log) log->Printf("thread created"); Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Fri Nov 5 20:53:30 2010 @@ -538,7 +538,7 @@ uint32_t reserved2; // must be zero } BabelAESelInfo; - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); char file_path[PATH_MAX]; file_spec.GetPath(file_path, PATH_MAX); CFCString file_cfstr (file_path, kCFStringEncodingUTF8); Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Fri Nov 5 20:53:30 2010 @@ -61,7 +61,7 @@ lldb::addr_t arg, lldb::addr_t *this_arg) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (log) log->Printf("ABISysV_x86_64::PrepareTrivialCall\n(\n thread = %p\n sp = 0x%llx\n functionAddress = 0x%llx\n returnAddress = 0x%llx\n arg = 0x%llx\n this_arg = %p(0x%llx)\n)", Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Nov 5 20:53:30 2010 @@ -500,7 +500,7 @@ uint32_t DynamicLoaderMacOSXDYLD::UpdateAllImageInfos() { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER)); if (ReadAllImageInfosStructure ()) { Mutex::Locker locker(m_mutex); @@ -587,7 +587,7 @@ if (old_dyld_all_image_infos[old_idx].address != LLDB_INVALID_ADDRESS) { if (log) - old_dyld_all_image_infos[old_idx].PutToLog (log); + old_dyld_all_image_infos[old_idx].PutToLog (log.get()); ModuleSP unload_image_module_sp(m_process->GetTarget().GetImages().FindFirstModuleForFileSpec (old_dyld_all_image_infos[old_idx].file_spec)); if (unload_image_module_sp.get()) { @@ -603,7 +603,7 @@ else { if (log) - PutToLog(log); + PutToLog(log.get()); } } else @@ -1094,7 +1094,7 @@ StackFrame *current_frame = thread.GetStackFrameAtIndex(0).get(); const SymbolContext ¤t_context = current_frame->GetSymbolContext(eSymbolContextSymbol); Symbol *current_symbol = current_context.symbol; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (current_symbol != NULL) { Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Fri Nov 5 20:53:30 2010 @@ -340,7 +340,7 @@ if (!m_process_sp) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); // We aren't starting at the trampoline symbol. InitializeVTableSymbols (); @@ -494,7 +494,7 @@ if (found_it) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Fri Nov 5 20:53:30 2010 @@ -114,7 +114,7 @@ m_impl_function->DeallocateFunctionResults(exc_context, m_args_addr); lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong(); Address target_address(NULL, target_addr); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (target_addr == 0) { if (log) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp Fri Nov 5 20:53:30 2010 @@ -18,6 +18,7 @@ #include "MachException.h" #include "ProcessMacOSXLog.h" +using namespace lldb; using namespace lldb_private; // Routine mach_exception_raise @@ -91,7 +92,7 @@ mach_msg_type_number_t * new_stateCnt ) { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); if (log) { log->Printf("::%s ( exc_port = 0x%4.4x, exc_type = %d ( %s ), exc_data = " MACH_EXCEPTION_DATA_FMT_HEX ", exc_data_count = %d)", @@ -122,7 +123,7 @@ ) { kern_return_t kret; - Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); if (log) { log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ", " MACH_EXCEPTION_DATA_FMT_HEX " })", @@ -152,7 +153,7 @@ mach_exception_data_t exc_data, mach_msg_type_number_t exc_data_count) { - Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); if (log) { log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ", " MACH_EXCEPTION_DATA_FMT_HEX " })", @@ -215,7 +216,7 @@ void MachException::Data::DumpStopReason() const { - Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet()); if (log) { int signal = SoftSignal(); @@ -236,7 +237,7 @@ MachException::Message::Receive(mach_port_t port, mach_msg_option_t options, mach_msg_timeout_t timeout, mach_port_t notify_port) { Error err; - Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); mach_msg_timeout_t mach_msg_timeout = options & MACH_RCV_TIMEOUT ? timeout : 0; if (log && ((options & MACH_RCV_TIMEOUT) == 0)) { @@ -313,7 +314,7 @@ } else { - Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); if (log) log->Printf ("mach_exc_server returned zero..."); } @@ -329,7 +330,7 @@ // Reply to the exception... Error err; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet()); if (log) log->Printf("MachException::Message::Reply (task = 0x%4.4x, pid = %i, signal = %i)", task, pid, signal); @@ -369,7 +370,7 @@ err.Clear(); if (log && log->GetMask().Test(PD_LOG_EXCEPTIONS) || err.Fail()) - err.PutToLog(log, "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal); + err.PutToLog(log.get(), "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal); } err = ::mach_msg ( &reply_msg.hdr, @@ -401,18 +402,18 @@ { if (err.GetError() == MACH_SEND_INTERRUPTED) { - err.PutToLog(log, "::mach_msg() - send interrupted"); + err.PutToLog(log.get(), "::mach_msg() - send interrupted"); } else { if (state.task_port == task) { - err.PutToLog(log, "::mach_msg() - failed (task)"); + err.PutToLog(log.get(), "::mach_msg() - failed (task)"); abort (); } else { - err.PutToLog(log, "::mach_msg() - failed (child of task)"); + err.PutToLog(log.get(), "::mach_msg() - failed (child of task)"); } } } @@ -465,7 +466,7 @@ MachException::PortInfo::Save (task_t task) { count = EXC_TYPES_COUNT; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS)); if (log) log->Printf ("MachException::PortInfo::Save (task = 0x%4.4x)", task); Error err; @@ -473,7 +474,7 @@ log->Printf("::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)...", task, EXC_MASK_ALL, count); err = ::task_get_exception_ports (task, EXC_MASK_ALL, masks, &count, ports, behaviors, flavors); if (log || err.Fail()) - err.PutToLog(log, "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count); + err.PutToLog(log.get(), "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count); if (log) { mach_msg_type_number_t i; @@ -490,7 +491,7 @@ kern_return_t MachException::PortInfo::Restore (task_t task) { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS)); if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf("MachException::PortInfo::Restore (task = 0x%4.4x)", task); uint32_t i = 0; @@ -501,7 +502,7 @@ { err = ::task_set_exception_ports (task, masks[i], ports[i], behaviors[i], flavors[i]); if (log || err.Fail()) - err.PutToLog(log, "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]); + err.PutToLog(log.get(), "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]); if (err.Fail()) break; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Fri Nov 5 20:53:30 2010 @@ -65,9 +65,9 @@ Error err; task_t task = GetTaskPort(); err = ::task_suspend (task); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK)); if (log || err.Fail()) - err.PutToLog(log, "::task_suspend ( target_task = 0x%4.4x )", task); + err.PutToLog(log.get(), "::task_suspend ( target_task = 0x%4.4x )", task); return err.GetError(); } @@ -81,9 +81,9 @@ Error err; task_t task = GetTaskPort(); err = ::task_resume (task); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK)); if (log || err.Fail()) - err.PutToLog(log, "::task_resume ( target_task = 0x%4.4x )", task); + err.PutToLog(log.get(), "::task_resume ( target_task = 0x%4.4x )", task); return err.GetError(); } @@ -159,14 +159,14 @@ if (task != TASK_NULL) { n = m_vm_memory.Read(task, addr, buf, size, error); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY)); if (log) { log->Printf ("MachTask::ReadMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n); if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); - data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); + data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8); } } } @@ -185,14 +185,14 @@ if (task != TASK_NULL) { n = m_vm_memory.Write(task, addr, buf, size, error); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY)); if (log) { log->Printf ("MachTask::WriteMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n); if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); - data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); + data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8); } } } @@ -212,7 +212,7 @@ kern_return_t kret; mach_vm_address_t addr; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY)); kret = ::mach_vm_allocate (GetTaskPort(), &addr, size, TRUE); if (kret == KERN_SUCCESS) @@ -295,10 +295,10 @@ { mach_port_t task_self = mach_task_self (); err = ::task_for_pid ( task_self, pid, &task); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK)); if (log || err.Fail()) { - err.PutToLog(log, "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid()); + err.PutToLog(log.get(), "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid()); } } return task; @@ -326,9 +326,9 @@ Error err; mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT; err = ::task_info (task, TASK_BASIC_INFO, (task_info_t)info, &count); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK)); if (log || err.Fail()) - err.PutToLog(log, "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count); + err.PutToLog(log.get(), "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count); if (log && log->GetMask().Test(PD_LOG_VERBOSE) && err.Success()) { float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f; @@ -371,7 +371,7 @@ bool MachTask::StartExceptionThread(Error &err) { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS)); if (log) log->Printf ("MachTask::%s ( )", __FUNCTION__); @@ -384,7 +384,7 @@ // Allocate an exception port that we will use to track our child process err = ::mach_port_allocate (task_self, MACH_PORT_RIGHT_RECEIVE, &m_exception_port); if (log || err.Fail()) - err.PutToLog(log, "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)", + err.PutToLog(log.get(), "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)", task_self, m_exception_port); if (err.Fail()) return false; @@ -392,7 +392,7 @@ // Add the ability to send messages on the new exception port err = ::mach_port_insert_right (task_self, m_exception_port, m_exception_port, MACH_MSG_TYPE_MAKE_SEND); if (log || err.Fail()) - err.PutToLog(log, "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)", + err.PutToLog(log.get(), "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)", task_self, m_exception_port, m_exception_port); if (err.Fail()) return false; @@ -403,7 +403,7 @@ // Set the ability to get all exceptions on this port err = ::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE); if (log || err.Fail()) - err.PutToLog(log, "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)"); + err.PutToLog(log.get(), "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)"); if (err.Fail()) return false; @@ -427,7 +427,7 @@ err = RestoreExceptionPortInfo(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS)); // NULL our our exception port and let our exception thread exit mach_port_t exception_port = m_exception_port; @@ -435,17 +435,17 @@ Host::ThreadCancel (m_exception_thread, &err); if (log || err.Fail()) - err.PutToLog(log, "Host::ThreadCancel ( thread = %p )", m_exception_thread); + err.PutToLog(log.get(), "Host::ThreadCancel ( thread = %p )", m_exception_thread); Host::ThreadJoin (m_exception_thread, NULL, &err); if (log || err.Fail()) - err.PutToLog(log, "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread); + err.PutToLog(log.get(), "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread); // Deallocate our exception port that we used to track our child process mach_port_t task_self = mach_task_self (); err = ::mach_port_deallocate (task_self, exception_port); if (log || err.Fail()) - err.PutToLog(log, "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port); + err.PutToLog(log.get(), "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port); exception_port = NULL; Clear(); @@ -461,7 +461,7 @@ MachTask *mach_task = (MachTask*) arg; ProcessMacOSX *mach_proc = mach_task->Process(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS)); if (log) log->Printf ("MachTask::%s (arg = %p) thread starting...", __FUNCTION__, arg); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp Fri Nov 5 20:53:30 2010 @@ -335,7 +335,7 @@ MachThreadContext_arm::EnableHardwareSingleStep (bool enable) { Error err; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP)); if (log) log->Printf("%s( enable = %d )", __FUNCTION__, enable); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp Fri Nov 5 20:53:30 2010 @@ -14,6 +14,7 @@ #include "MachVMRegion.h" #include "ProcessMacOSXLog.h" +using namespace lldb; using namespace lldb_private; MachVMMemory::MachVMMemory() : @@ -73,17 +74,17 @@ mach_msg_type_number_t curr_bytes_read = 0; vm_offset_t vm_memory = NULL; error = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE)); if (log || error.Fail()) - error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read); + error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read); if (error.Success()) { if (curr_bytes_read != curr_size) { if (log) - error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size); + error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size); } ::memcpy (curr_data, (void *)vm_memory, curr_bytes_read); ::vm_deallocate (mach_task_self (), vm_memory, curr_bytes_read); @@ -168,16 +169,16 @@ { mach_msg_type_number_t curr_data_count = MaxBytesLeftInPage(curr_addr, data_count - total_bytes_written); error = ::mach_vm_write (task, curr_addr, (pointer_t) curr_data, curr_data_count); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY)); if (log || error.Fail()) - error.PutToLog (log, "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count); + error.PutToLog (log.get(), "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count); #if defined (__powerpc__) || defined (__ppc__) vm_machine_attribute_val_t mattr_value = MATTR_VAL_CACHE_FLUSH; error = ::vm_machine_attribute (task, curr_addr, curr_data_count, MATTR_CACHE, &mattr_value); if (log || error.Fail()) - error.Log(log, "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count); + error.Log(log.get(), "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count); #endif if (error.Success()) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp Fri Nov 5 20:53:30 2010 @@ -12,6 +12,7 @@ #include "MachVMRegion.h" #include "ProcessMacOSXLog.h" +using namespace lldb; using namespace lldb_private; MachVMRegion::MachVMRegion(task_t task) : @@ -61,7 +62,7 @@ prot_size = end_addr - addr; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS)); if (prot_size > 0) { if (prot == (m_curr_protection & VM_PROT_ALL)) @@ -75,13 +76,13 @@ { m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot); if (log || m_err.Fail()) - m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot); + m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot); if (m_err.Fail()) { // Try again with the ability to create a copy on write region m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot | VM_PROT_COPY); if (log || m_err.Fail()) - m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY); + m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY); } if (m_err.Success()) { @@ -106,9 +107,9 @@ if (m_curr_protection != m_data.protection && m_protection_size > 0) { m_err = ::mach_vm_protect (m_task, m_protection_addr, m_protection_size, 0, m_data.protection); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS)); if (log || m_err.Fail()) - m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection); + m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection); if (m_err.Success()) { m_protection_size = 0; @@ -137,9 +138,9 @@ mach_msg_type_number_t info_size = kRegionInfoSize; assert(sizeof(info_size) == 4); m_err = ::mach_vm_region_recurse (m_task, &m_start, &m_size, &m_depth, (vm_region_recurse_info_t)&m_data, &info_size); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS)); if (log || m_err.Fail()) - m_err.PutToLog(log, "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr); + m_err.PutToLog(log.get(), "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr); if (m_err.Fail()) { return false; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Nov 5 20:53:30 2010 @@ -108,7 +108,7 @@ //{ // const lldb::pid_t pid = *((lldb::user_id_t *)pid_ptr); // -// Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); +// LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD)); // // if (log) // log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, pid_ptr); @@ -357,7 +357,7 @@ // figure out a good way to determine the arch of what we are attaching to m_arch_spec = m_target.GetArchitecture(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS)); if (attach_pid != LLDB_INVALID_PROCESS_ID) { SetID(attach_pid); @@ -583,7 +583,7 @@ ProcessMacOSX::UpdateThreadListIfNeeded () { // locker will keep a mutex locked until it goes out of scope - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD)); if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ProcessMacOSX::%s (pid = %4.4x)", __FUNCTION__, GetID()); @@ -597,7 +597,7 @@ Error err(::task_threads (task, &thread_list, &thread_list_count), eErrorTypeMachKernel); if (log || err.Fail()) - err.PutToLog(log, "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count); + err.PutToLog(log.get(), "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count); if (err.GetError() == KERN_SUCCESS && thread_list_count > 0) { @@ -651,7 +651,7 @@ m_thread_list.RefreshStateAfterStop(); // Let each thread know of any exceptions - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); task_t task = Task().GetTaskPort(); size_t i; for (i=0; iPrintf ("ProcessMacOSX::DoSIGSTOP()"); @@ -730,7 +730,7 @@ error.SetErrorToErrno(); if (error.Fail()) - error.PutToLog(log, "::kill (pid = %i, SIGSTOP)", pid); + error.PutToLog(log.get(), "::kill (pid = %i, SIGSTOP)", pid); timeout_time = TimeValue::Now(); timeout_time.OffsetWithSeconds(2); @@ -781,7 +781,7 @@ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); if (log || error.Fail()) - error.PutToLog(log, "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid); + error.PutToLog(log.get(), "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid); error = PrivateResume(LLDB_INVALID_THREAD_ID); @@ -823,7 +823,7 @@ ProcessMacOSX::DoDestroy () { Error error; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS)); if (log) log->Printf ("ProcessMacOSX::DoDestroy()"); @@ -863,7 +863,7 @@ error.SetErrorToErrno(); if (log || error.Fail()) - error.PutToLog (log, "::ptrace (PT_KILL, %u, 0, 0)", pid); + error.PutToLog (log.get(), "::ptrace (PT_KILL, %u, 0, 0)", pid); // Resume our task and let the SIGKILL do its thing. The thread named // "ProcessMacOSX::WaitForChildProcessToExit(void*)" will catch the @@ -1003,7 +1003,7 @@ const lldb::addr_t addr = bp_site->GetLoadAddress(); const lldb::user_id_t site_id = bp_site->GetID(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS)); if (log) log->Printf ("ProcessMacOSX::EnableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr); @@ -1044,7 +1044,7 @@ const lldb::addr_t addr = bp_site->GetLoadAddress(); const lldb::user_id_t site_id = bp_site->GetID(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS)); if (log) log->Printf ("ProcessMacOSX::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr); @@ -1066,7 +1066,7 @@ { lldb::user_id_t watchID = wp->GetID(); lldb::addr_t addr = wp->GetLoadAddress(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS)); if (log) log->Printf ("ProcessMacOSX::EnableWatchpoint(watchID = %d)", watchID); if (wp->IsEnabled()) @@ -1092,7 +1092,7 @@ { lldb::user_id_t watchID = wp->GetID(); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS)); lldb::addr_t addr = wp->GetLoadAddress(); if (log) @@ -1222,7 +1222,7 @@ { ProcessMacOSX *proc = (ProcessMacOSX*) arg; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS)); if (log) log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, arg); @@ -1270,7 +1270,7 @@ if (log) { err.SetError (select_errno, eErrorTypePOSIX); - err.LogIfError(log, "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds); + err.LogIfError(log.get(), "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds); } switch (select_errno) @@ -1359,13 +1359,13 @@ ProcessMacOSX::DoSignal (int signal) { Error error; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS)); if (log) log->Printf ("ProcessMacOSX::DoSignal (signal = %d)", signal); if (::kill (GetID(), signal) != 0) { error.SetErrorToErrno(); - error.LogIfError(log, "ProcessMacOSX::DoSignal (%d)", signal); + error.LogIfError(log.get(), "ProcessMacOSX::DoSignal (%d)", signal); } return error; } @@ -1374,7 +1374,7 @@ Error ProcessMacOSX::DoDetach() { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS)); if (log) log->Printf ("ProcessMacOSX::DoDetach()"); @@ -1404,7 +1404,7 @@ error.SetErrorToErrno(); if (log || error.Fail()) - error.PutToLog(log, "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid); + error.PutToLog(log.get(), "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid); // Resume our task Task().Resume(); @@ -1429,7 +1429,7 @@ Mutex::Locker locker(m_exception_messages_mutex); if (m_exception_messages.empty() == false) { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS)); MachException::Message::iterator pos; MachException::Message::iterator begin = m_exception_messages.begin(); @@ -1448,7 +1448,7 @@ if (curr_error.Fail() && error.Success()) error = curr_error; - error.LogIfError(log, "Error replying to exception"); + error.LogIfError(log.get(), "Error replying to exception"); } // Erase all exception message as we should have used and replied @@ -1577,7 +1577,7 @@ if (launch_type == eLaunchDefault) launch_type = eLaunchPosixSpawn; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS)); if (log) log->Printf ("%s( path = '%s', argv = %p, envp = %p, launch_type = %u, flags = %x )", __FUNCTION__, path, argv, envp, launch_type, flags); @@ -1655,7 +1655,7 @@ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); if (launch_err.Fail() || log) - launch_err.PutToLog(log, "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid); + launch_err.PutToLog(log.get(), "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid); if (launch_err.Success()) m_flags.Set (eFlagsAttached); @@ -1698,14 +1698,14 @@ { posix_spawnattr_t attr; short flags; - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS)); Error local_err; // Errors that don't affect the spawning. if (log) log->Printf ("%s ( path='%s', argv=%p, envp=%p, process )", __FUNCTION__, path, argv, envp); err.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX); if (err.Fail() || log) - err.PutToLog(log, "::posix_spawnattr_init ( &attr )"); + err.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )"); if (err.Fail()) return LLDB_INVALID_PROCESS_ID; @@ -1715,7 +1715,7 @@ err.SetError( ::posix_spawnattr_setflags (&attr, flags), eErrorTypePOSIX); if (err.Fail() || log) - err.PutToLog(log, "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : ""); + err.PutToLog(log.get(), "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : ""); if (err.Fail()) return LLDB_INVALID_PROCESS_ID; @@ -1732,7 +1732,7 @@ size_t ocount = 0; err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX); if (err.Fail() || log) - err.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); + err.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); if (err.Fail() != 0 || ocount != 1) return LLDB_INVALID_PROCESS_ID; @@ -1747,7 +1747,7 @@ err.SetError( ::posix_spawn_file_actions_init (&file_actions), eErrorTypePOSIX); int file_actions_valid = err.Success(); if (!file_actions_valid || log) - err.PutToLog(log, "::posix_spawn_file_actions_init ( &file_actions )"); + err.PutToLog(log.get(), "::posix_spawn_file_actions_init ( &file_actions )"); Error stdio_err; lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; if (file_actions_valid) @@ -1760,21 +1760,21 @@ { stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO, stderr_path, O_RDWR, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path); } if (stdin_path != NULL && stdin_path[0]) { stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, stdin_path, O_RDONLY, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path); } if (stdout_path != NULL && stdout_path[0]) { stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, stdout_path, O_WRONLY, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path); } } else @@ -1792,15 +1792,15 @@ slave_name = "/dev/null"; stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO, slave_name, O_RDWR|O_NOCTTY, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name); stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, slave_name, O_RDONLY|O_NOCTTY, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name); stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, slave_name, O_WRONLY|O_NOCTTY, 0), eErrorTypePOSIX); if (stdio_err.Fail() || log) - stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name); + stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name); } else { @@ -1813,7 +1813,7 @@ } err.SetError( ::posix_spawnp (&pid, path, &file_actions, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX); if (err.Fail() || log) - err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp); + err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp); if (stdio_err.Success()) { @@ -1831,7 +1831,7 @@ { err.SetError( ::posix_spawnp (&pid, path, NULL, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX); if (err.Fail() || log) - err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp); + err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp); } ::posix_spawnattr_destroy (&attr); @@ -1845,7 +1845,7 @@ { local_err.SetError( ::posix_spawn_file_actions_destroy (&file_actions), eErrorTypePOSIX); if (local_err.Fail() || log) - local_err.PutToLog(log, "::posix_spawn_file_actions_destroy ( &file_actions )"); + local_err.PutToLog(log.get(), "::posix_spawn_file_actions_destroy ( &file_actions )"); } return pid; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Fri Nov 5 20:53:30 2010 @@ -17,29 +17,38 @@ using namespace lldb; using namespace lldb_private; +// We want to avoid global constructors where code needs to be run so here we +// control access to our static g_log_sp by hiding it in a singleton function +// that will construct the static g_lob_sp the first time this function is +// called. +static LogSP & +GetLog () +{ + static LogSP g_log_sp; + return g_log_sp; +} -static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up - // by global constructors before other threads - // were done with it. -Log * +LogSP ProcessMacOSXLog::GetLogIfAllCategoriesSet (uint32_t mask) { - Log *log = g_log; + LogSP log(GetLog ()); if (log && mask) { uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) - return NULL; + return LogSP(); } return log; } + void ProcessMacOSXLog::DisableLog (Args &args, Stream *feedback_strm) { - if (g_log) + LogSP log (GetLog ()); + if (log) { - uint32_t flag_bits = g_log->GetMask().Get(); + uint32_t flag_bits = log->GetMask().Get(); const size_t argc = args.GetArgumentCount (); for (size_t i = 0; i < argc; ++i) { @@ -65,28 +74,32 @@ } } if (flag_bits == 0) - DeleteLog (); + GetLog().reset(); else - g_log->GetMask().Reset (flag_bits); + log->GetMask().Reset (flag_bits); } } -void -ProcessMacOSXLog::DeleteLog () +LogSP +ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) { - if (g_log) + // Try see if there already is a log - that way we can reuse its settings. + // We could reuse the log in toto, but we don't know that the stream is the same. + uint32_t flag_bits; + LogSP log(GetLog ()); + if (log) + flag_bits = log->GetMask().Get(); + else + flag_bits = 0; + + // Now make a new log with this stream if one was provided + if (log_stream_sp) { - delete g_log; - g_log = NULL; + log = make_shared(log_stream_sp); + GetLog () = log; } -} -Log * -ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) -{ - DeleteLog (); - g_log = new Log (log_stream_sp); - if (g_log) + if (log) { uint32_t flag_bits = 0; bool got_unknown_category = false; @@ -121,10 +134,10 @@ } if (flag_bits == 0) flag_bits = PD_LOG_DEFAULT; - g_log->GetMask().Reset(flag_bits); - g_log->GetOptions().Reset(log_options); + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); } - return g_log; + return log; } void @@ -150,7 +163,7 @@ void ProcessMacOSXLog::LogIf (uint32_t mask, const char *format, ...) { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask); + LogSP log(ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask)); if (log) { va_list args; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h Fri Nov 5 20:53:30 2010 @@ -43,7 +43,7 @@ class ProcessMacOSXLog { public: - static lldb_private::Log * + static lldb::LogSP GetLogIfAllCategoriesSet(uint32_t mask = 0); static void @@ -52,7 +52,7 @@ static void DeleteLog (); - static lldb_private::Log * + static lldb::LogSP EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); static void Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp Fri Nov 5 20:53:30 2010 @@ -450,7 +450,7 @@ { mach_msg_type_number_t count = GPRWordCount; SetError(set, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count)); - LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD), "RegisterContextMach_i386::ReadGPR()"); + LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD).get(), "RegisterContextMach_i386::ReadGPR()"); } return GetError(set, Read); } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp Fri Nov 5 20:53:30 2010 @@ -494,9 +494,9 @@ { mach_msg_type_number_t count = GPRWordCount; SetError(GPRRegSet, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count)); - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD)); if (log) - LogGPR (log, "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID()); + LogGPR (log.get(), "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID()); } return GetError(GPRRegSet, Read); } @@ -534,9 +534,9 @@ SetError (set, Write, -1); return KERN_INVALID_ARGUMENT; } - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD)); if (log) - LogGPR (log, "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID()); + LogGPR (log.get(), "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID()); SetError (set, Write, ::thread_set_state(GetThreadID(), set, (thread_state_t)&gpr, GPRWordCount)); SetError (set, Read, -1); return GetError (set, Write); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Fri Nov 5 20:53:30 2010 @@ -248,7 +248,7 @@ int32_t ThreadMacOSX::Suspend() { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD)); if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); lldb::tid_t tid = GetID (); @@ -259,7 +259,7 @@ m_suspend_count++; log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) - err.PutToLog(log, "::thread_suspend (%4.4x)", tid); + err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid); } return GetSuspendCount(); } @@ -267,7 +267,7 @@ int32_t ThreadMacOSX::Resume() { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD)); if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__); lldb::tid_t tid = GetID (); @@ -280,7 +280,7 @@ m_suspend_count--; log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) - err.PutToLog(log, "::thread_resume (%4.4x)", tid); + err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid); } } return GetSuspendCount(); @@ -289,7 +289,7 @@ bool ThreadMacOSX::RestoreSuspendCount() { - Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); + LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD)); if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); Error err; @@ -305,7 +305,7 @@ --m_suspend_count; log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) - err.PutToLog(log, "::thread_resume (%4.4x)", tid); + err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid); } } else if (m_suspend_count < m_basic_info.suspend_count) @@ -317,7 +317,7 @@ --m_suspend_count; log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) - err.PutToLog(log, "::thread_suspend (%4.4x)", tid); + err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid); } } return m_suspend_count == m_basic_info.suspend_count; Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Nov 5 20:53:30 2010 @@ -147,7 +147,7 @@ m_cfa = cfa_regval + cfa_offset; - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); // A couple of sanity checks.. if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1) @@ -176,7 +176,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); if (IsFrameZero ()) { m_frame_type = eNotAValidFrame; @@ -416,7 +416,7 @@ if (fu->GetUnwindPlanFastUnwind (m_thread) && fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (m_current_pc)) { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); if (log && IsLogVerbose()) { const char *has_fast = ""; @@ -441,7 +441,7 @@ UnwindPlan * RegisterContextLLDB::GetFullUnwindPlanForFrame () { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); UnwindPlan *up; UnwindPlan *arch_default_up = NULL; ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); @@ -687,7 +687,7 @@ bool RegisterContextLLDB::SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation ®loc) { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); // Have we already found this register location? std::map::const_iterator iterator; @@ -976,7 +976,7 @@ bool RegisterContextLLDB::ReadRegisterBytes (uint32_t lldb_reg, DataExtractor& data) { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); if (!IsValid()) return false; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Nov 5 20:53:30 2010 @@ -31,7 +31,7 @@ uint32_t UnwindLLDB::GetFrameCount() { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); if (m_frames.empty()) { // First, set up the 0th (initial) frame Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Nov 5 20:53:30 2010 @@ -193,8 +193,8 @@ StringExtractorGDBRemote &response ) { - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); - Log *async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + LogSP async_log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC)); if (log) log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Nov 5 20:53:30 2010 @@ -633,7 +633,7 @@ Clear(); ArchSpec arch_spec = GetTarget().GetArchitecture(); - //Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); + //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (attach_pid != LLDB_INVALID_PROCESS_ID) @@ -735,7 +735,7 @@ // HACK: require arch be set correctly at the target level until we can // figure out a good way to determine the arch of what we are attaching to - //Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); + //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (process_name && process_name[0]) { char host_port[128]; @@ -948,7 +948,7 @@ ProcessGDBRemote::UpdateThreadListIfNeeded () { // locker will keep a mutex locked until it goes out of scope - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD)); if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID()); @@ -1166,7 +1166,7 @@ ProcessGDBRemote::DoDetach() { Error error; - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoDetach()"); @@ -1199,7 +1199,7 @@ ProcessGDBRemote::DoDestroy () { Error error; - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoDestroy()"); @@ -1407,7 +1407,7 @@ Error error; assert (bp_site != NULL); - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); user_id_t site_id = bp_site->GetID(); const addr_t addr = bp_site->GetLoadAddress(); if (log) @@ -1483,7 +1483,7 @@ assert (bp_site != NULL); addr_t addr = bp_site->GetLoadAddress(); user_id_t site_id = bp_site->GetID(); - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); if (log) log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr); @@ -1550,7 +1550,7 @@ { user_id_t watchID = wp->GetID(); addr_t addr = wp->GetLoadAddress(); - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); if (log) log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %d)", watchID); if (wp->IsEnabled()) @@ -1582,7 +1582,7 @@ { user_id_t watchID = wp->GetID(); - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); addr_t addr = wp->GetLoadAddress(); if (log) @@ -1620,7 +1620,7 @@ ProcessGDBRemote::DoSignal (int signo) { Error error; - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoSignal (signal = %d)", signo); @@ -1706,14 +1706,14 @@ m_stdio_communication.Clear(); posix_spawnattr_t attr; - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); Error local_err; // Errors that don't affect the spawning. if (log) log->Printf ("%s ( path='%s', argv=%p, envp=%p, arch=%s )", __FUNCTION__, debugserver_path, inferior_argv, inferior_envp, inferior_arch.AsCString()); error.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX); if (error.Fail() || log) - error.PutToLog(log, "::posix_spawnattr_init ( &attr )"); + error.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )"); if (error.Fail()) return error;; @@ -1730,7 +1730,7 @@ size_t ocount = 0; error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX); if (error.Fail() || log) - error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); + error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); if (error.Fail() != 0 || ocount != 1) return error; @@ -1879,7 +1879,7 @@ m_debugserver_pid = LLDB_INVALID_PROCESS_ID; if (error.Fail() || log) - error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp); + error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp); if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) { @@ -2055,7 +2055,7 @@ { ResetGDBRemoteState (); - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); @@ -2069,7 +2069,7 @@ void ProcessGDBRemote::StopAsyncThread () { - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); @@ -2089,7 +2089,7 @@ { ProcessGDBRemote *process = (ProcessGDBRemote*) arg; - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID()); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri Nov 5 20:53:30 2010 @@ -18,38 +18,37 @@ using namespace lldb_private; -static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up - // by global constructors before other threads - // were done with it. -Log * +// We want to avoid global constructors where code needs to be run so here we +// control access to our static g_log_sp by hiding it in a singleton function +// that will construct the static g_lob_sp the first time this function is +// called. +static LogSP & +GetLog () +{ + static LogSP g_log_sp; + return g_log_sp; +} + +LogSP ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask) { - Log *log = g_log; + LogSP log(GetLog ()); if (log && mask) { uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) - return NULL; + return LogSP(); } return log; } void -ProcessGDBRemoteLog::DeleteLog () -{ - if (g_log) - { - delete g_log; - g_log = NULL; - } -} - -void ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm) { - if (g_log) + LogSP log (GetLog ()); + if (log) { - uint32_t flag_bits = g_log->GetMask().Get(); + uint32_t flag_bits = log->GetMask().Get(); const size_t argc = args.GetArgumentCount (); for (size_t i = 0; i < argc; ++i) { @@ -79,20 +78,34 @@ } if (flag_bits == 0) - DeleteLog(); + GetLog ().reset(); else - g_log->GetMask().Reset (flag_bits); + log->GetMask().Reset (flag_bits); } return; } -Log * +LogSP ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) { - DeleteLog (); - g_log = new Log (log_stream_sp); - if (g_log) + // Try see if there already is a log - that way we can reuse its settings. + // We could reuse the log in toto, but we don't know that the stream is the same. + uint32_t flag_bits; + LogSP log(GetLog ()); + if (log) + flag_bits = log->GetMask().Get(); + else + flag_bits = 0; + + // Now make a new log with this stream if one was provided + if (log_stream_sp) + { + log = make_shared(log_stream_sp); + GetLog () = log; + } + + if (log) { uint32_t flag_bits = 0; bool got_unknown_category = false; @@ -127,10 +140,10 @@ } if (flag_bits == 0) flag_bits = GDBR_LOG_DEFAULT; - g_log->GetMask().Reset(flag_bits); - g_log->GetOptions().Reset(log_options); + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); } - return g_log; + return log; } void @@ -157,7 +170,7 @@ void ProcessGDBRemoteLog::LogIf (uint32_t mask, const char *format, ...) { - Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask)); if (log) { va_list args; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Fri Nov 5 20:53:30 2010 @@ -35,16 +35,13 @@ class ProcessGDBRemoteLog { public: - static lldb_private::Log * + static lldb::LogSP GetLogIfAllCategoriesSet(uint32_t mask = 0); static void DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); - static void - DeleteLog (); - - static lldb_private::Log * + static lldb::LogSP EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); static void Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Nov 5 20:53:30 2010 @@ -718,7 +718,7 @@ } } private: - Log *m_log; + LogSP m_log; }; clang_type_t Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Fri Nov 5 20:53:30 2010 @@ -290,7 +290,7 @@ dw_offset_t offset = 0; if (m_cfi_data_initialized == false) { - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); if (log) { log->Printf ("Reading eh_frame information for %s", m_objfile.GetFileSpec().GetFilename().GetCString()); Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Fri Nov 5 20:53:30 2010 @@ -33,7 +33,7 @@ void ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { log->Printf ("Caching: class 0x%llx selector 0x%llx implementation 0x%llx.", class_addr, selector, impl_addr); Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Nov 5 20:53:30 2010 @@ -89,7 +89,7 @@ { UpdateInstanceName(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Process::Process()", this); @@ -118,7 +118,7 @@ //---------------------------------------------------------------------- Process::~Process() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Process::~Process()", this); StopPrivateStateThread(); @@ -243,7 +243,7 @@ StateType Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); @@ -267,7 +267,7 @@ Event * Process::PeekAtStateChangedEvents () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s...", __FUNCTION__); @@ -296,7 +296,7 @@ StateType Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &event_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); @@ -320,7 +320,7 @@ bool Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool control_only) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout); @@ -415,7 +415,7 @@ void Process::SetPublicState (StateType new_state) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); if (log) log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state)); m_public_state.SetValue (new_state); @@ -430,7 +430,7 @@ void Process::SetPrivateState (StateType new_state) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); bool state_changed = false; if (log) @@ -811,7 +811,7 @@ { Error error; assert (bp_site != NULL); - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); const addr_t bp_addr = bp_site->GetLoadAddress(); if (log) log->Printf ("Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%llx", bp_site->GetID(), (uint64_t)bp_addr); @@ -888,7 +888,7 @@ { Error error; assert (bp_site != NULL); - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); addr_t bp_addr = bp_site->GetLoadAddress(); lldb::user_id_t breakID = bp_site->GetID(); if (log) @@ -1389,7 +1389,7 @@ Error Process::Resume () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::Resume() m_stop_id = %u", m_stop_id); @@ -1513,7 +1513,7 @@ { const StateType state = Process::ProcessEventData::GetStateFromEvent (event_ptr); bool return_value = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); switch (state) { @@ -1632,7 +1632,7 @@ bool Process::StartPrivateStateThread () { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); if (log) log->Printf ("Process::%s ( )", __FUNCTION__); @@ -1664,7 +1664,7 @@ void Process::ControlPrivateStateThread (uint32_t signal) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); assert (signal == eBroadcastInternalStateControlStop || signal == eBroadcastInternalStateControlPause || @@ -1701,7 +1701,7 @@ void Process::HandlePrivateEvent (EventSP &event_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); const StateType internal_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); // See if we should broadcast this state to external clients? const bool should_broadcast = ShouldBroadcastEvent (event_sp.get()); @@ -1740,7 +1740,7 @@ bool control_only = false; m_private_state_control_wait.SetValue (false, eBroadcastNever); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, this, GetID()); Modified: lldb/trunk/source/Target/SectionLoadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/SectionLoadList.cpp (original) +++ lldb/trunk/source/Target/SectionLoadList.cpp Fri Nov 5 20:53:30 2010 @@ -50,7 +50,7 @@ bool SectionLoadList::SetSectionLoadAddress (const Section *section, addr_t load_addr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)", @@ -76,7 +76,7 @@ size_t SectionLoadList::SetSectionUnloaded (const Section *section) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s))", @@ -99,7 +99,7 @@ bool SectionLoadList::SetSectionUnloaded (const Section *section, addr_t load_addr) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE)); if (log) log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)", Modified: lldb/trunk/source/Target/StopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/StopInfo.cpp (original) +++ lldb/trunk/source/Target/StopInfo.cpp Fri Nov 5 20:53:30 2010 @@ -93,7 +93,7 @@ } else { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value); @@ -127,7 +127,7 @@ } else { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value); Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Fri Nov 5 20:53:30 2010 @@ -52,7 +52,7 @@ SetEventName (eBroadcastBitModulesLoaded, "modules-loaded"); SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Target::Target()", this); } @@ -62,7 +62,7 @@ //---------------------------------------------------------------------- Target::~Target() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Target::~Target()", this); DeleteCurrentProcess (); @@ -252,7 +252,7 @@ else m_breakpoint_list.Add (bp_sp, true); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) { StreamString s; @@ -274,7 +274,7 @@ void Target::RemoveAllBreakpoints (bool internal_also) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -288,7 +288,7 @@ void Target::DisableAllBreakpoints (bool internal_also) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -300,7 +300,7 @@ void Target::EnableAllBreakpoints (bool internal_also) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -312,7 +312,7 @@ bool Target::RemoveBreakpointByID (break_id_t break_id) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); @@ -334,7 +334,7 @@ bool Target::DisableBreakpointByID (break_id_t break_id) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); @@ -355,7 +355,7 @@ bool Target::EnableBreakpointByID (break_id_t break_id) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Fri Nov 5 20:53:30 2010 @@ -57,7 +57,7 @@ m_unwinder_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Thread::Thread(tid = 0x%4.4x)", this, GetID()); @@ -68,7 +68,7 @@ Thread::~Thread() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Thread::~Thread(tid = 0x%4.4x)", this, GetID()); } @@ -220,7 +220,7 @@ ThreadPlan *current_plan = GetCurrentPlan(); bool should_stop = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { StreamString s; @@ -291,7 +291,7 @@ Thread::ShouldReportStop (Event* event_ptr) { StateType thread_state = GetResumeState (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (thread_state == eStateSuspended || thread_state == eStateInvalid) { @@ -350,7 +350,7 @@ thread_plan_sp->DidPush(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { StreamString s; @@ -365,7 +365,7 @@ void Thread::PopPlan () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_plan_stack.empty()) return; @@ -492,7 +492,7 @@ void Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { log->Printf("Discarding thread plans for thread tid = 0x%4.4x, up to %p", GetID(), up_to_plan_sp.get()); @@ -533,7 +533,7 @@ void Thread::DiscardThreadPlans(bool force) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { log->Printf("Discarding thread plans for thread (tid = 0x%4.4x, force %d)", GetID(), force); Modified: lldb/trunk/source/Target/ThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadList.cpp (original) +++ lldb/trunk/source/Target/ThreadList.cpp Fri Nov 5 20:53:30 2010 @@ -179,7 +179,7 @@ // Running events should never stop, obviously... - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); bool should_stop = false; m_process->UpdateThreadListIfNeeded(); @@ -251,7 +251,7 @@ m_process->UpdateThreadListIfNeeded(); collection::iterator pos, end = m_threads.end(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size()); Modified: lldb/trunk/source/Target/ThreadPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlan.cpp (original) +++ lldb/trunk/source/Target/ThreadPlan.cpp Fri Nov 5 20:53:30 2010 @@ -89,7 +89,7 @@ Vote ThreadPlan::ShouldReportStop (Event *event_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_stop_vote == eVoteNoOpinion) { @@ -135,7 +135,7 @@ { if (current_plan) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Nov 5 20:53:30 2010 @@ -245,7 +245,7 @@ { if (PlanExplainsStop()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { @@ -320,7 +320,7 @@ { if (IsPlanComplete()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed call function plan."); Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Fri Nov 5 20:53:30 2010 @@ -215,7 +215,7 @@ bool ThreadPlanRunToAddress::MischiefManaged () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (AtOurAddress()) { Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Nov 5 20:53:30 2010 @@ -69,7 +69,7 @@ bool ThreadPlanStepInRange::ShouldStop (Event *event_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); m_no_more_plans = false; if (log) @@ -245,7 +245,7 @@ { bool should_step_out = false; StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (flags.Test(eAvoidNoDebug)) { Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Fri Nov 5 20:53:30 2010 @@ -101,7 +101,7 @@ { if (m_step_over) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_thread.GetStackFrameCount() <= m_stack_depth) { if (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr) @@ -178,7 +178,7 @@ { if (IsPlanComplete()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed single instruction step plan."); ThreadPlan::MischiefManaged (); Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Fri Nov 5 20:53:30 2010 @@ -207,7 +207,7 @@ // reason and we're now stopping for some other reason altogether, then we're done // with this step out operation. - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed step out plan."); m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_return_bp_id); Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Fri Nov 5 20:53:30 2010 @@ -118,7 +118,7 @@ } else { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed step over breakpoint plan."); // Otherwise, re-enable the breakpoint we were stepping over, and we're done. Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Fri Nov 5 20:53:30 2010 @@ -24,6 +24,7 @@ #include "lldb/Target/ThreadPlanStepThrough.h" using namespace lldb_private; +using namespace lldb; //---------------------------------------------------------------------- @@ -63,7 +64,7 @@ bool ThreadPlanStepOverRange::ShouldStop (Event *event_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Nov 5 20:53:30 2010 @@ -84,7 +84,7 @@ Vote ThreadPlanStepRange::ShouldReportStop (Event *event_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo; if (log) @@ -95,7 +95,7 @@ bool ThreadPlanStepRange::InRange () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); bool ret_value = false; lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC(); @@ -158,7 +158,7 @@ bool ThreadPlanStepRange::FrameIsYounger () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); // FIXME: Might be better to do this by storing the FrameID we started in and seeing if that is still above // us on the stack. Counting the whole stack could be expensive. @@ -187,7 +187,7 @@ bool ThreadPlanStepRange::FrameIsOlder () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); uint32_t current_depth = m_thread.GetStackFrameCount(); if (current_depth == m_stack_depth) { @@ -254,7 +254,7 @@ if (done) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed step through range plan."); ThreadPlan::MischiefManaged (); Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Fri Nov 5 20:53:30 2010 @@ -117,7 +117,7 @@ bool ThreadPlanStepThrough::MischiefManaged () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); // Stop if we're happy with the place we've landed... Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Fri Nov 5 20:53:30 2010 @@ -347,7 +347,7 @@ bool done = false; if (IsPlanComplete()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed step until plan."); Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Fri Nov 5 20:53:30 2010 @@ -70,7 +70,7 @@ bool ThreadPlanTestCondition::ShouldStop (Event *event_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_thread.IsThreadPlanDone(m_expression_plan_sp.get())) { ClangExpressionVariable *expr_result = NULL; @@ -89,13 +89,11 @@ else m_did_stop = true; } - log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false"); } else { - log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData()); m_did_stop = true; @@ -103,7 +101,6 @@ } else if (m_exe_ctx.thread->WasThreadPlanDiscarded (m_expression_plan_sp.get())) { - log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("ExecuteExpression thread plan was discarded.\n"); m_did_stop = true; Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=118319&r1=118318&r2=118319&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Fri Nov 5 20:53:30 2010 @@ -22,30 +22,21 @@ using namespace lldb_private; -static Log * -LogAccessor (bool get, StreamSP *stream_sp_ptr) +// We want to avoid global constructors where code needs to be run so here we +// control access to our static g_log_sp by hiding it in a singleton function +// that will construct the static g_lob_sp the first time this function is +// called. +static LogSP & +GetLog () { - static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up - // by global constructors before other threads - // were done with it. - if (!get) - { - if (g_log) - delete g_log; - if (stream_sp_ptr) - g_log = new Log (*stream_sp_ptr); - else - g_log = NULL; - } - - return g_log; - + static LogSP g_log_sp; + return g_log_sp; } uint32_t lldb_private::GetLogMask () { - Log *log = LogAccessor (true, NULL); + LogSP log(GetLog ()); if (log) return log->GetMask().Get(); return 0; @@ -58,15 +49,15 @@ return (mask & LIBLLDB_LOG_VERBOSE); } -Log * +LogSP lldb_private::GetLogIfAllCategoriesSet (uint32_t mask) { - Log *log = LogAccessor (true, NULL); + LogSP log(GetLog ()); if (log && mask) { uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) - return NULL; + return LogSP(); } return log; } @@ -74,7 +65,7 @@ void lldb_private::LogIfAllCategoriesSet (uint32_t mask, const char *format, ...) { - Log *log = GetLogIfAllCategoriesSet (mask); + LogSP log(GetLogIfAllCategoriesSet (mask)); if (log) { va_list args; @@ -87,7 +78,7 @@ void lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...) { - Log *log = GetLogIfAnyCategoriesSet (mask); + LogSP log(GetLogIfAnyCategoriesSet (mask)); if (log) { va_list args; @@ -97,19 +88,19 @@ } } -Log * +LogSP lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask) { - Log *log = LogAccessor (true, NULL); + LogSP log(GetLog ()); if (log && mask && (mask & log->GetMask().Get())) return log; - return NULL; + return LogSP(); } void lldb_private::DisableLog (Args &args, Stream *feedback_strm) { - Log *log = LogAccessor (true, NULL); + LogSP log(GetLog ()); uint32_t flag_bits; if (log) @@ -148,7 +139,7 @@ } if (flag_bits == 0) - LogAccessor (false, NULL); + GetLog ().reset(); else log->GetMask().Reset (flag_bits); } @@ -156,20 +147,25 @@ return; } -Log * +LogSP lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) { // Try see if there already is a log - that way we can reuse its settings. // We could reuse the log in toto, but we don't know that the stream is the same. uint32_t flag_bits; - Log* log = LogAccessor (true, NULL); + LogSP log(GetLog ()); if (log) flag_bits = log->GetMask().Get(); else flag_bits = 0; - // Now make a new log with this stream. - log = LogAccessor (false, &log_stream_sp); + // Now make a new log with this stream if one was provided + if (log_stream_sp) + { + log = make_shared(log_stream_sp); + GetLog () = log; + } + if (log) { bool got_unknown_category = false; From gclayton at apple.com Sun Nov 7 15:02:03 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 07 Nov 2010 21:02:03 -0000 Subject: [Lldb-commits] [lldb] r118383 - in /lldb/trunk: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h tools/driver/Driver.cpp Message-ID: <20101107210203.B59CB2A6C12C@llvm.org> Author: gclayton Date: Sun Nov 7 15:02:03 2010 New Revision: 118383 URL: http://llvm.org/viewvc/llvm-project?rev=118383&view=rev Log: Modified the DWARF parser for both the single DWARF file and for the case where the DWARF is in the .o files so they can track down the actual type for a forward declaration. This was working before for just DWARF files, but not for DWARF in .o files where the actual definition was in another .o file. Modified the main thread name in the driver to be more consistent with the other LLDB thread names. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/trunk/tools/driver/Driver.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=118383&r1=118382&r2=118383&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Nov 7 15:02:03 2010 @@ -2534,6 +2534,71 @@ return NULL; } +// This function can be used when a DIE is found that is a forward declaration +// DIE and we want to try and find a type that has the complete definition. +TypeSP +SymbolFileDWARF::FindDefinitionTypeForDIE ( + DWARFCompileUnit* cu, + const DWARFDebugInfoEntry *die, + const ConstString &type_name +) +{ + TypeSP type_sp; + + if (cu == NULL || die == NULL || !type_name) + return type_sp; + + const dw_tag_t type_tag = die->Tag(); + std::vector die_info_array; + const size_t num_matches = m_type_index.Find (type_name, die_info_array); + if (num_matches > 0) + { + DWARFCompileUnit* type_cu = NULL; + DWARFCompileUnit* curr_cu = cu; + DWARFDebugInfo *info = DebugInfo(); + for (size_t i=0; iGetCompileUnitAtIndex (die_info_array[i].cu_idx); + + if (type_cu != curr_cu) + { + type_cu->ExtractDIEsIfNeeded (false); + curr_cu = type_cu; + } + + DWARFDebugInfoEntry *type_die = type_cu->GetDIEAtIndexUnchecked (die_info_array[i].die_idx); + + if (type_die != die && type_die->Tag() == type_tag) + { + // Hold off on comparing parent DIE tags until + // we know what happens with stuff in namespaces + // for gcc and clang... + //DWARFDebugInfoEntry *parent_die = die->GetParent(); + //DWARFDebugInfoEntry *parent_type_die = type_die->GetParent(); + //if (parent_die->Tag() == parent_type_die->Tag()) + { + Type *resolved_type = ResolveType (type_cu, type_die, false); + if (resolved_type && resolved_type != DIE_IS_BEING_PARSED) + { + DEBUG_PRINTF ("resolved 0x%8.8x (cu 0x%8.8x) from %s to 0x%8.8x (cu 0x%8.8x)\n", + die->GetOffset(), + dwarf_cu->GetOffset(), + m_obj_file->GetFileSpec().GetFilename().AsCString(), + type_die->GetOffset(), + type_cu->GetOffset()); + + m_die_to_type[die] = resolved_type; + type_sp = m_obj_file->GetModule()->GetTypeList()->FindType(resolved_type->GetID()); + assert (type_sp.get()); + break; + } + } + } + } + } + return type_sp; +} + TypeSP SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new_ptr) { @@ -2786,50 +2851,24 @@ if (is_forward_declaration) { - // We have a forward declaration - std::vector die_info_array; - const size_t num_matches = m_type_index.Find (type_name_const_str, die_info_array); - DWARFCompileUnit* type_cu = NULL; - DWARFCompileUnit* curr_cu = dwarf_cu; - DWARFDebugInfo *info = DebugInfo(); - for (size_t i=0; iGetCompileUnitAtIndex (die_info_array[i].cu_idx); - - if (type_cu != curr_cu) - { - type_cu->ExtractDIEsIfNeeded (false); - curr_cu = type_cu; - } + // We have a forward declaration to a type and we need + // to try and find a full declaration. We look in the + // current type index just in case we have a forward + // declaration followed by an actual declarations in the + // DWARF. If this fails, we need to look elsewhere... + + type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); - DWARFDebugInfoEntry *type_die = type_cu->GetDIEAtIndexUnchecked (die_info_array[i].die_idx); - - if (type_die != die && type_die->Tag() == tag) - { - // Hold off on comparing parent DIE tags until - // we know what happens with stuff in namespaces - // for gcc and clang... -// DWARFDebugInfoEntry *parent_die = die->GetParent(); -// DWARFDebugInfoEntry *parent_type_die = type_die->GetParent(); -// if (parent_die->Tag() == parent_type_die->Tag()) - { - Type *resolved_type = ResolveType (type_cu, type_die, false); - if (resolved_type && resolved_type != DIE_IS_BEING_PARSED) - { - DEBUG_PRINTF ("resolved 0x%8.8x (cu 0x%8.8x) from %s to 0x%8.8x (cu 0x%8.8x)\n", - die->GetOffset(), - dwarf_cu->GetOffset(), - m_obj_file->GetFileSpec().GetFilename().AsCString(), - type_die->GetOffset(), - type_cu->GetOffset()); - - m_die_to_type[die] = resolved_type; - type_sp = m_obj_file->GetModule()->GetTypeList()->FindType(resolved_type->GetID()); - return type_sp; - } - } - } + if (!type_sp) + { + // We weren't able to find a full declaration in + // this DWARF, see if we have a declaration anywhere + // else... + if (m_debug_map_symfile) + type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); } + if (type_sp) + return type_sp; } assert (tag_decl_kind != -1); bool clang_type_was_created = false; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=118383&r1=118382&r2=118383&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Sun Nov 7 15:02:03 2010 @@ -279,6 +279,11 @@ const NameToDIE &name_to_die, lldb_private::SymbolContextList& sc_list); + lldb::TypeSP FindDefinitionTypeForDIE ( + DWARFCompileUnit* cu, + const DWARFDebugInfoEntry *die, + const lldb_private::ConstString &type_name); + lldb::TypeSP GetTypeForDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry* die); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=118383&r1=118382&r2=118383&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Sun Nov 7 15:02:03 2010 @@ -886,6 +886,23 @@ return sc_list.GetSize() - initial_size; } +TypeSP +SymbolFileDWARFDebugMap::FindDefinitionTypeForDIE ( + DWARFCompileUnit* cu, + const DWARFDebugInfoEntry *die, + const ConstString &type_name +) +{ + TypeSP type_sp; + SymbolFileDWARF *oso_dwarf; + for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) + { + type_sp = oso_dwarf->FindDefinitionTypeForDIE (cu, die, type_name); + if (type_sp) + break; + } + return type_sp; +} uint32_t SymbolFileDWARFDebugMap::FindTypes Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=118383&r1=118382&r2=118383&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Sun Nov 7 15:02:03 2010 @@ -16,6 +16,8 @@ #include "lldb/Symbol/SymbolFile.h" class SymbolFileDWARF; +class DWARFCompileUnit; +class DWARFDebugInfoEntry; class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile { @@ -190,6 +192,11 @@ void SetCompileUnit (SymbolFileDWARF *oso_dwarf, const lldb::CompUnitSP &cu_sp); + lldb::TypeSP + FindDefinitionTypeForDIE (DWARFCompileUnit* cu, + const DWARFDebugInfoEntry *die, + const lldb_private::ConstString &type_name); + //------------------------------------------------------------------ // Member Variables //------------------------------------------------------------------ Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=118383&r1=118382&r2=118383&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Sun Nov 7 15:02:03 2010 @@ -1375,7 +1375,7 @@ { SBDebugger::Initialize(); - SBHostOS::ThreadCreated ("[main]"); + SBHostOS::ThreadCreated (""); signal (SIGPIPE, SIG_IGN); signal (SIGWINCH, sigwinch_handler); From gclayton at apple.com Sun Nov 7 18:28:40 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 08 Nov 2010 00:28:40 -0000 Subject: [Lldb-commits] [lldb] r118387 - in /lldb/trunk: include/lldb/Core/FileSpec.h lldb.xcodeproj/project.pbxproj source/API/SBTarget.cpp source/Core/FileSpec.cpp Message-ID: <20101108002840.87D272A6C12C@llvm.org> Author: gclayton Date: Sun Nov 7 18:28:40 2010 New Revision: 118387 URL: http://llvm.org/viewvc/llvm-project?rev=118387&view=rev Log: Fixed FileSpec's operator == to deal with equivalent paths such as "/tmp/a.c" and "/private/tmp/a.c". This was done by adding a "mutable bool m_is_resolved;" member to FileSpec and then modifying the equal operator to check if the filenames are equal, and if they are, then check the directories. If they are not equal, then both paths are checked to see if they have been resolved. If they have been resolved, we resolve the paths in temporary FileSpec objects and set each of the m_is_resolved bools to try (for lhs and rhs) if the paths match what is contained in the path. This allows us to do more intelligent compares without having to resolve all paths found in the debug info (which can quickly get costly if the files are on remote NFS mounts). Modified: lldb/trunk/include/lldb/Core/FileSpec.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Core/FileSpec.cpp Modified: lldb/trunk/include/lldb/Core/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpec.h?rev=118387&r1=118386&r2=118387&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/FileSpec.h (original) +++ lldb/trunk/include/lldb/Core/FileSpec.h Sun Nov 7 18:28:40 2010 @@ -273,21 +273,20 @@ /// Call into the Host to see if it can help find the file (e.g. by /// searching paths set in the environment, etc.). /// - /// If found, sets the value of m_directory to the directory where the file was found. + /// If found, sets the value of m_directory to the directory where + /// the file was found. /// /// @return - /// \b true if was able to find the file using expanded search methods, \b false otherwise. + /// \b true if was able to find the file using expanded search + /// methods, \b false otherwise. //------------------------------------------------------------------ bool ResolveExecutableLocation (); - //------------------------------------------------------------------ - /// Canonicalize this file path (basically running the static Resolve method on it). - /// Useful if you asked us not to resolve the file path when you set the file. - /// - /// @return - /// None. + /// Canonicalize this file path (basically running the static + /// FileSpec::Resolve method on it). Useful if you asked us not to + /// resolve the file path when you set the file. //------------------------------------------------------------------ bool ResolvePath (); @@ -450,13 +449,37 @@ /// @param[in] path /// A full, partial, or relative path to a file. /// - /// @param[in] resolve + /// @param[in] resolve_path /// If \b true, then we will try to resolve links the path using /// the static FileSpec::Resolve. //------------------------------------------------------------------ void - SetFile (const char *path, bool resolve); + SetFile (const char *path, bool resolve_path); + bool + IsResolved () const + { + return m_is_resolved; + } + + //------------------------------------------------------------------ + /// Set if the file path has been resolved or not. + /// + /// If you know a file path is already resolved and avoided passing + /// a \b true parameter for any functions that take a "bool + /// resolve_path" parameter, you can set the value manually using + /// this call to make sure we don't try and resolve it later, or try + /// and resolve a path that has already been resolved. + /// + /// @param[in] is_resolved + /// A boolean value that will replace the current value that + /// indicates if the paths in this object have been resolved. + //------------------------------------------------------------------ + void + SetIsResolved (bool is_resolved) + { + m_is_resolved = is_resolved; + } //------------------------------------------------------------------ /// Read the file into an array of strings, one per line. /// @@ -527,6 +550,7 @@ //------------------------------------------------------------------ ConstString m_directory; ///< The uniqued directory path ConstString m_filename; ///< The uniqued filename path + mutable bool m_is_resolved; ///< True if this path has been resolved. }; //---------------------------------------------------------------------- Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118387&r1=118386&r2=118387&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Nov 7 18:28:40 2010 @@ -2912,7 +2912,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + ARCHS = ( + x86_64, + i386, + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -3021,7 +3024,6 @@ ); LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_CONFIGURATION = "Debug+Asserts"; - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=118387&r1=118386&r2=118387&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Sun Nov 7 18:28:40 2010 @@ -386,7 +386,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { - return SBBreakpoint(BreakpointCreateByLocation (SBFileSpec (file), line)); + return SBBreakpoint(BreakpointCreateByLocation (SBFileSpec (file, false), line)); } SBBreakpoint Modified: lldb/trunk/source/Core/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=118387&r1=118386&r2=118387&view=diff ============================================================================== --- lldb/trunk/source/Core/FileSpec.cpp (original) +++ lldb/trunk/source/Core/FileSpec.cpp Sun Nov 7 18:28:40 2010 @@ -176,7 +176,8 @@ //------------------------------------------------------------------ FileSpec::FileSpec(const char *pathname, bool resolve_path) : m_directory(), - m_filename() + m_filename(), + m_is_resolved(false) { if (pathname && pathname[0]) SetFile(pathname, resolve_path); @@ -187,7 +188,8 @@ //------------------------------------------------------------------ FileSpec::FileSpec(const FileSpec& rhs) : m_directory (rhs.m_directory), - m_filename (rhs.m_filename) + m_filename (rhs.m_filename), + m_is_resolved (rhs.m_is_resolved) { } @@ -219,6 +221,7 @@ { m_directory = rhs.m_directory; m_filename = rhs.m_filename; + m_is_resolved = rhs.m_is_resolved; } return *this; } @@ -229,10 +232,11 @@ // string values for quick comparison and efficient memory usage. //------------------------------------------------------------------ void -FileSpec::SetFile(const char *pathname, bool resolve) +FileSpec::SetFile (const char *pathname, bool resolve) { m_filename.Clear(); m_directory.Clear(); + m_is_resolved = false; if (pathname == NULL || pathname[0] == '\0') return; @@ -242,13 +246,16 @@ if (resolve) { path_fit = (FileSpec::Resolve (pathname, resolved_path, sizeof(resolved_path)) < sizeof(resolved_path) - 1); + m_is_resolved = path_fit; } else { - if (strlen (pathname) > sizeof(resolved_path) - 1) + // Copy the path because "basename" and "dirname" want to muck with the + // path buffer + if (::strlen (pathname) > sizeof(resolved_path) - 1) path_fit = false; else - strcpy (resolved_path, pathname); + ::strcpy (resolved_path, pathname); } @@ -317,7 +324,60 @@ bool FileSpec::operator== (const FileSpec& rhs) const { - return m_directory == rhs.m_directory && m_filename == rhs.m_filename; + if (m_filename == rhs.m_filename) + { + if (m_directory == rhs.m_directory) + return true; + + // TODO: determine if we want to keep this code in here. + // The code below was added to handle a case where we were + // trying to set a file and line breakpoint and one path + // was resolved, and the other not and the directory was + // in a mount point that resolved to a more complete path: + // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling + // this out... + if (IsResolved() && rhs.IsResolved()) + { + // Both paths are resolved, no need to look further... + return false; + } + + FileSpec resolved_lhs(*this); + + // If "this" isn't resolved, resolve it + if (!IsResolved()) + { + if (resolved_lhs.ResolvePath()) + { + // This path wasn't resolved but now it is. Check if the resolved + // directory is the same as our unresolved directory, and if so, + // we can mark this object as resolved to avoid more future resolves + m_is_resolved = (m_directory == resolved_lhs.m_directory); + } + else + return false; + } + + FileSpec resolved_rhs(rhs); + if (!rhs.IsResolved()) + { + if (resolved_rhs.ResolvePath()) + { + // rhs's path wasn't resolved but now it is. Check if the resolved + // directory is the same as rhs's unresolved directory, and if so, + // we can mark this object as resolved to avoid more future resolves + rhs.m_is_resolved = (m_directory == resolved_rhs.m_directory); + } + else + return false; + } + + // If we reach this point in the code we were able to resolve both paths + // and since we only resolve the paths if the basenames are equal, then + // we can just check if both directories are equal... + return resolved_lhs.GetDirectory() == resolved_rhs.GetDirectory(); + } + return false; } //------------------------------------------------------------------ @@ -326,7 +386,7 @@ bool FileSpec::operator!= (const FileSpec& rhs) const { - return m_filename != rhs.m_filename || m_directory != rhs.m_directory; + return !(*this == rhs); } //------------------------------------------------------------------ @@ -469,12 +529,15 @@ bool FileSpec::ResolvePath () { - char path_buf[PATH_MAX]; - + if (m_is_resolved) + return true; // We have already resolved this path + + char path_buf[PATH_MAX]; if (!GetPath (path_buf, PATH_MAX)) return false; + // SetFile(...) will set m_is_resolved correctly if it can resolve the path SetFile (path_buf, true); - return true; + return m_is_resolved; } uint64_t From scallanan at apple.com Sun Nov 7 18:31:32 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 08 Nov 2010 00:31:32 -0000 Subject: [Lldb-commits] [lldb] r118388 - in /lldb/trunk: include/lldb/Expression/IRForTarget.h source/Expression/IRForTarget.cpp Message-ID: <20101108003132.926A92A6C12C@llvm.org> Author: spyffe Date: Sun Nov 7 18:31:32 2010 New Revision: 118388 URL: http://llvm.org/viewvc/llvm-project?rev=118388&view=rev Log: Made variable resolution more robust by handling every external variable reference in the module, and returning a clean error (instead of letting LLVM issue a fatal error) if the variable could not be resolved. Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=118388&r1=118387&r2=118388&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/IRForTarget.h (original) +++ lldb/trunk/include/lldb/Expression/IRForTarget.h Sun Nov 7 18:31:32 2010 @@ -193,11 +193,11 @@ llvm::BasicBlock &BB); //------------------------------------------------------------------ - /// A basic block-level pass to find all external variables and - /// functions used in the IR. Each found external variable is added - /// to the struct, and each external function is resolved in place, - /// its call replaced with a call to a function pointer whose value - /// is the address of the function in the target process. + /// A function-level pass to find all external variables and functions + /// used in the IR. Each found external variable is added to the + /// struct, and each external function is resolved in place, its call + /// replaced with a call to a function pointer whose value is the + /// address of the function in the target process. //------------------------------------------------------------------ //------------------------------------------------------------------ @@ -216,8 +216,7 @@ /// True on success; false otherwise //------------------------------------------------------------------ bool MaybeHandleVariable(llvm::Module &M, - llvm::Value *V, - bool Store); + llvm::Value *V); //------------------------------------------------------------------ /// Handle all the arguments to a function call @@ -250,7 +249,7 @@ llvm::CallInst *C); //------------------------------------------------------------------ - /// The top-level pass implementation + /// Resolve calls to external functions /// /// @param[in] M /// The module currently being processed. @@ -261,8 +260,23 @@ /// @return /// True on success; false otherwise //------------------------------------------------------------------ + bool resolveCalls(llvm::Module &M, + llvm::BasicBlock &BB); + + //------------------------------------------------------------------ + /// The top-level pass implementation + /// + /// @param[in] M + /// The module currently being processed. + /// + /// @param[in] BB + /// The function currently being processed. + /// + /// @return + /// True on success; false otherwise + //------------------------------------------------------------------ bool resolveExternals(llvm::Module &M, - llvm::BasicBlock &BB); + llvm::Function &F); //------------------------------------------------------------------ /// A basic block-level pass to excise guard variables from the code. Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=118388&r1=118387&r2=118388&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Sun Nov 7 18:31:32 2010 @@ -563,8 +563,7 @@ IRForTarget::MaybeHandleVariable ( Module &llvm_module, - Value *llvm_value_ptr, - bool Store + Value *llvm_value_ptr ) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); @@ -578,7 +577,7 @@ case Instruction::GetElementPtr: case Instruction::BitCast: Value *s = constant_expr->getOperand(0); - MaybeHandleVariable(llvm_module, s, Store); + MaybeHandleVariable(llvm_module, s); } } if (GlobalVariable *global_variable = dyn_cast(llvm_value_ptr)) @@ -646,7 +645,7 @@ for (unsigned op_index = 0, num_ops = C->getNumArgOperands(); op_index < num_ops; ++op_index) - if (!MaybeHandleVariable(M, C->getArgOperand(op_index), true)) // conservatively believe that this is a store + if (!MaybeHandleVariable(M, C->getArgOperand(op_index))) // conservatively believe that this is a store return false; return true; @@ -773,7 +772,7 @@ } bool -IRForTarget::resolveExternals(Module &M, BasicBlock &BB) +IRForTarget::resolveCalls(Module &M, BasicBlock &BB) { ///////////////////////////////////////////////////////////////////////// // Prepare the current basic block for execution in the remote process @@ -787,31 +786,31 @@ { Instruction &inst = *ii; - if (m_resolve_vars) - { - if (LoadInst *load = dyn_cast(&inst)) - if (!MaybeHandleVariable(M, load->getPointerOperand(), false)) - return false; - - if (StoreInst *store = dyn_cast(&inst)) - if (!MaybeHandleVariable(M, store->getValueOperand(), true) || - !MaybeHandleVariable(M, store->getPointerOperand(), true)) - return false; - } + CallInst *call = dyn_cast(&inst); - if (CallInst *call = dyn_cast(&inst)) - { - if (!MaybeHandleCallArguments(M, call)) - return false; - - if (!MaybeHandleCall(M, call)) - return false; - } + if (call && !MaybeHandleCall(M, call)) + return false; } return true; } +bool +IRForTarget::resolveExternals(Module &M, + Function &F) +{ + for (Module::global_iterator global = M.global_begin(), end = M.global_end(); + global != end; + ++global) + { + if ((*global).hasExternalLinkage() && + !MaybeHandleVariable (M, global)) + return false; + } + + return true; +} + static bool isGuardVariableRef(Value *V) { Constant *C; @@ -1156,7 +1155,7 @@ if (!rewriteObjCSelectors(M, *bbi)) return false; - if (!resolveExternals(M, *bbi)) + if (!resolveCalls(M, *bbi)) return false; } @@ -1164,6 +1163,9 @@ // Run function-level passes // + if (!resolveExternals(M, *function)) + return false; + if (!replaceVariables(M, *function)) return false; From johnny.chen at apple.com Sun Nov 7 19:21:03 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 08 Nov 2010 01:21:03 -0000 Subject: [Lldb-commits] [lldb] r118392 - /lldb/trunk/test/dotest.py Message-ID: <20101108012103.83B682A6C12C@llvm.org> Author: johnny Date: Sun Nov 7 19:21:03 2010 New Revision: 118392 URL: http://llvm.org/viewvc/llvm-project?rev=118392&view=rev Log: Change the test driver so that simply specifying '-f testclass.testmethod' means that we want to run just the instance of testclass-testmethod combination and nothing else. Specifying '-g' now will admit the whole .py test module if it does not contain a matching testclass-testmethod combination at all. This option arrangement adheres to the RISC principle of making the common cases fast. :-) rdar://problem/8584914 Can the default for dotest.py's "-g" flag be switched? Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=118392&r1=118391&r2=118392&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Sun Nov 7 19:21:03 2010 @@ -54,11 +54,13 @@ # Delay startup in order for the debugger to attach. delay = False -# The filter (testcase.testmethod) used to admit tests into our test suite. +# The filter (testclass.testmethod) used to admit tests into our test suite. filterspec = None -# If '-g' is specified, the filterspec must be consulted for each test module, default to False. -fs4all = False +# If '-g' is specified, the filterspec is not exclusive. If a test module does +# not contain testclass.testmethod which matches the filterspec, the whole test +# module is still admitted into our test suite. fs4all flag defaults to True. +fs4all = True # Ignore the build search path relative to this script to locate the lldb.py module. ignore = False @@ -104,10 +106,9 @@ -f : specify a filter, which consists of the test class name, a dot, followed by the test method, to admit tests into the test suite e.g., -f 'ClassTypesTestCase.test_with_dwarf_and_python_api' --g : if specified, only the modules with the corect filter will be run - it has no effect if no '-f' option is present - '-f filterspec -g' can be used with '-p filename-regexp' to select only - the testfile.testclass.testmethod to run +-g : if specified, the filterspec by -f is not exclusive, i.e., if a test module + does not match the filterspec (testclass.testmethod), the whole module is + still admitted to the test suite -i : ignore (don't bailout) if 'lldb.py' module cannot be located in the build tree relative to this script; use PYTHONPATH to locate the module -l : don't skip long running test @@ -129,10 +130,10 @@ Examples: -This is an example of using the -f -g options to pinpoint to a specfic test -method to be run: +This is an example of using the -f option to pinpoint to a specfic test class +and test method to be run: -$ ./dotest.py -f ClassTypesTestCase.test_with_dsym_and_run_command -g +$ ./dotest.py -f ClassTypesTestCase.test_with_dsym_and_run_command ---------------------------------------------------------------------- Collected 1 test @@ -233,7 +234,7 @@ filterspec = sys.argv[index] index += 1 elif sys.argv[index].startswith('-g'): - fs4all = True + fs4all = False index += 1 elif sys.argv[index].startswith('-i'): ignore = True @@ -461,7 +462,7 @@ filtered = False break # Forgo this module if the (base, filterspec) combo is invalid - # and the '-g' option is present. + # and no '-g' option is specified if fs4all and not filtered: continue From gclayton at apple.com Sun Nov 7 20:05:09 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 08 Nov 2010 02:05:09 -0000 Subject: [Lldb-commits] [lldb] r118393 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20101108020509.179EC2A6C12C@llvm.org> Author: gclayton Date: Sun Nov 7 20:05:08 2010 New Revision: 118393 URL: http://llvm.org/viewvc/llvm-project?rev=118393&view=rev Log: Fixed some type parsing that was causing types to thing they were forward declarations when they should have been. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=118393&r1=118392&r2=118393&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Nov 7 20:05:08 2010 @@ -2589,7 +2589,10 @@ m_die_to_type[die] = resolved_type; type_sp = m_obj_file->GetModule()->GetTypeList()->FindType(resolved_type->GetID()); - assert (type_sp.get()); + if (!type_sp) + { + DEBUG_PRINTF("unable to resolve type '%s' from DIE 0x%8.8x\n", type_name.GetCString(), die->GetOffset()); + } break; } } @@ -2807,7 +2810,12 @@ break; case DW_AT_declaration: - is_forward_declaration = form_value.Unsigned() != 0; + // Make sure the declaration is from this DIE, and not from + // a DW_AT_specification or DW_AT_abstract_origin by checking + // this die and seeing if its abbreviations have the + // DW_AT_declaration attribute + if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX) + is_forward_declaration = form_value.Unsigned() != 0; break; case DW_AT_APPLE_runtime_class: @@ -2849,27 +2857,27 @@ } - if (is_forward_declaration) - { - // We have a forward declaration to a type and we need - // to try and find a full declaration. We look in the - // current type index just in case we have a forward - // declaration followed by an actual declarations in the - // DWARF. If this fails, we need to look elsewhere... - - type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); - - if (!type_sp) - { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... - if (m_debug_map_symfile) - type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); - } - if (type_sp) - return type_sp; - } +// if (is_forward_declaration) +// { +// // We have a forward declaration to a type and we need +// // to try and find a full declaration. We look in the +// // current type index just in case we have a forward +// // declaration followed by an actual declarations in the +// // DWARF. If this fails, we need to look elsewhere... +// +// type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); +// +// if (!type_sp) +// { +// // We weren't able to find a full declaration in +// // this DWARF, see if we have a declaration anywhere +// // else... +// if (m_debug_map_symfile) +// type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); +// } +// if (type_sp) +// return type_sp; +// } assert (tag_decl_kind != -1); bool clang_type_was_created = false; clang_type = m_forward_decl_die_to_clang_type.lookup (die); @@ -2888,7 +2896,7 @@ m_die_to_type[die] = type_sp.get(); - if (die->HasChildren() == false) + if (die->HasChildren() == false && is_forward_declaration == false) { // No children for this struct/union/class, lets finish it type_list->GetClangASTContext().StartTagDeclarationDefinition (clang_type); @@ -2940,7 +2948,14 @@ case DW_AT_type: encoding_uid = form_value.Reference(dwarf_cu); break; case DW_AT_byte_size: byte_size = form_value.Unsigned(); break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_declaration: + // Make sure the declaration is from this DIE, and not from + // a DW_AT_specification or DW_AT_abstract_origin by checking + // this die and seeing if its abbreviations have the + // DW_AT_declaration attribute + if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX) + is_forward_declaration = form_value.Unsigned() != 0; + break; case DW_AT_allocated: case DW_AT_associated: case DW_AT_bit_stride: @@ -3032,7 +3047,14 @@ case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(&get_debug_str_data()); break; case DW_AT_type: type_die_offset = form_value.Reference(dwarf_cu); break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_declaration: + // Make sure the declaration is from this DIE, and not from + // a DW_AT_specification or DW_AT_abstract_origin by checking + // this die and seeing if its abbreviations have the + // DW_AT_declaration attribute + if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX) + is_forward_declaration = form_value.Unsigned() != 0; + break; case DW_AT_inline: is_inline = form_value.Unsigned() != 0; break; case DW_AT_virtuality: is_virtual = form_value.Unsigned() != 0; break; case DW_AT_explicit: is_explicit = form_value.Unsigned() != 0; break; @@ -3245,7 +3267,14 @@ case DW_AT_byte_stride: byte_stride = form_value.Unsigned(); break; case DW_AT_bit_stride: bit_stride = form_value.Unsigned(); break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_declaration: + // Make sure the declaration is from this DIE, and not from + // a DW_AT_specification or DW_AT_abstract_origin by checking + // this die and seeing if its abbreviations have the + // DW_AT_declaration attribute + if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX) + is_forward_declaration = form_value.Unsigned() != 0; + break; case DW_AT_allocated: case DW_AT_associated: case DW_AT_data_location: From gclayton at apple.com Sun Nov 7 21:06:10 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 08 Nov 2010 03:06:10 -0000 Subject: [Lldb-commits] [lldb] r118399 - /lldb/trunk/source/Host/macosx/Host.mm Message-ID: <20101108030610.D6E552A6C12D@llvm.org> Author: gclayton Date: Sun Nov 7 21:06:10 2010 New Revision: 118399 URL: http://llvm.org/viewvc/llvm-project?rev=118399&view=rev Log: Fixed an issue where if you try and run something in a TTY that isn't the same architecture as a default program, the attach architecture auto detection would change the architecture to the architecture of the darwin-debug (which was always x86_64) and hose up your debug session. Modified: lldb/trunk/source/Host/macosx/Host.mm Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=118399&r1=118398&r2=118399&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Sun Nov 7 21:06:10 2010 @@ -428,6 +428,9 @@ char launcher_path[PATH_MAX]; darwin_debug_file_spec.GetPath(launcher_path, sizeof(launcher_path)); + if (arch_spec) + command.Printf("arch -arch %s ", arch_spec->AsCString()); + command.Printf("'%s' --unix-socket=%s", launcher_path, unix_socket_name.c_str()); if (arch_spec && arch_spec->IsValid()) @@ -449,16 +452,17 @@ StreamString applescript_source; + const char *tty_command = command.GetString().c_str(); if (tty_name && tty_name[0]) { applescript_source.Printf (applscript_in_existing_tty, - command.GetString().c_str(), + tty_command, tty_name); } else { applescript_source.Printf (applscript_in_new_tty, - command.GetString().c_str()); + tty_command); } From scallanan at apple.com Sun Nov 7 21:49:50 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 08 Nov 2010 03:49:50 -0000 Subject: [Lldb-commits] [lldb] r118401 - in /lldb/trunk/source: Expression/ClangExpressionParser.cpp Expression/ClangUserExpression.cpp Target/ThreadPlanCallFunction.cpp Message-ID: <20101108034950.4034F2A6C12C@llvm.org> Author: spyffe Date: Sun Nov 7 21:49:50 2010 New Revision: 118401 URL: http://llvm.org/viewvc/llvm-project?rev=118401&view=rev Log: Added more logging so we see the register state when a function starts and ends, and also the disassembly for anything that is a client of ClangExpressionParser after it has been JIT compiled. Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=118401&r1=118400&r2=118401&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Sun Nov 7 21:49:50 2010 @@ -571,6 +571,24 @@ } } + if (log) + { + log->Printf("Code can be run in the target."); + + StreamString disassembly_stream; + + Error err = DisassembleFunction(disassembly_stream, exe_ctx); + + if (!err.Success()) + { + log->Printf("Couldn't disassemble function : %s", err.AsCString("unknown error")); + } + else + { + log->Printf("Function disassembly:\n%s", disassembly_stream.GetData()); + } + } + err.Clear(); return err; } Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118401&r1=118400&r2=118401&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Sun Nov 7 21:49:50 2010 @@ -238,24 +238,6 @@ if (jit_error.Success()) { - if (log) - { - log->Printf("Code can be run in the target."); - - StreamString disassembly_stream; - - Error err = parser.DisassembleFunction(disassembly_stream, exe_ctx); - - if (!err.Success()) - { - log->Printf("Couldn't disassemble function : %s", err.AsCString("unknown error")); - } - else - { - log->Printf("Function disassembly:\n%s", disassembly_stream.GetData()); - } - } - return true; } else Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118401&r1=118400&r2=118401&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Sun Nov 7 21:49:50 2010 @@ -89,6 +89,25 @@ this_arg)) return; + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + + if (log) + { + RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + + log->PutCString("Function call was set up. Register state was:"); + + for (uint32_t register_index = 0, num_registers = reg_ctx->GetRegisterCount(); + register_index < num_registers; + ++register_index) + { + const char *register_name = reg_ctx->GetRegisterName(register_index); + uint64_t register_value = reg_ctx->ReadRegisterAsUnsigned(register_index, LLDB_INVALID_ADDRESS); + + log->Printf(" %s = 0x%llx", register_name, register_value); + } + } + m_valid = true; } @@ -145,6 +164,25 @@ *m_args)) return; + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + + if (log) + { + RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + + log->PutCString("Function call was set up. Register state was:"); + + for (uint32_t register_index = 0, num_registers = reg_ctx->GetRegisterCount(); + register_index < num_registers; + ++register_index) + { + const char *register_name = reg_ctx->GetRegisterName(register_index); + uint64_t register_value = reg_ctx->ReadRegisterAsUnsigned(register_index, LLDB_INVALID_ADDRESS); + + log->Printf(" %s = 0x%llx", register_name, register_value); + } + } + m_valid = true; } From gclayton at apple.com Sun Nov 7 22:29:11 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 08 Nov 2010 04:29:11 -0000 Subject: [Lldb-commits] [lldb] r118404 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.h source/Symbol/ClangASTContext.cpp Message-ID: <20101108042911.A3B442A6C12C@llvm.org> Author: gclayton Date: Sun Nov 7 22:29:11 2010 New Revision: 118404 URL: http://llvm.org/viewvc/llvm-project?rev=118404&view=rev Log: Cleaned up the pseudo terminal code in ProcessGDBRemote as it was spawning a pseudo terminal even when the process being attached to. Fixed a possible crasher in the in: bool ClangASTContext::IsAggregateType (clang_type_t clang_type); It seems that if you pass in a record decl, enum decl, or objc class decl and ask it if it is an aggregate type, clang will crash. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=118404&r1=118403&r2=118404&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Nov 7 22:29:11 2010 @@ -3229,7 +3229,6 @@ INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=118404&r1=118403&r2=118404&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sun Nov 7 22:29:11 2010 @@ -393,6 +393,7 @@ char host_port[128]; snprintf (host_port, sizeof(host_port), "localhost:%u", get_random_port ()); + const bool launch_process = true; bool start_debugserver_with_inferior_args = false; if (start_debugserver_with_inferior_args) { @@ -403,6 +404,7 @@ argv, envp, NULL, //stdin_path, + launch_process, LLDB_INVALID_PROCESS_ID, NULL, false, (launch_flags & eLaunchFlagDisableASLR) != 0, @@ -421,7 +423,8 @@ error = StartDebugserverProcess (host_port, NULL, NULL, - NULL, //stdin_path, + NULL, //stdin_path + launch_process, LLDB_INVALID_PROCESS_ID, NULL, false, (launch_flags & eLaunchFlagDisableASLR) != 0, @@ -644,9 +647,10 @@ NULL, // inferior_argv NULL, // inferior_envp NULL, // stdin_path - LLDB_INVALID_PROCESS_ID, // attach_pid - NULL, // attach_pid_name - false, // wait_for_launch + false, // launch_process == false (we are attaching) + LLDB_INVALID_PROCESS_ID, // Don't send any attach to pid options to debugserver + NULL, // Don't send any attach by process name option to debugserver + false, // Don't send any attach wait_for_launch flag as an option to debugserver false, // disable_aslr arch_spec); @@ -745,9 +749,10 @@ NULL, // inferior_argv NULL, // inferior_envp NULL, // stdin_path - LLDB_INVALID_PROCESS_ID, // attach_pid - NULL, // attach_pid_name - false, // wait_for_launch + false, // launch_process == false (we are attaching) + LLDB_INVALID_PROCESS_ID, // Don't send any attach to pid options to debugserver + NULL, // Don't send any attach by process name option to debugserver + false, // Don't send any attach wait_for_launch flag as an option to debugserver false, // disable_aslr arch_spec); if (error.Fail()) @@ -1655,10 +1660,11 @@ char const *inferior_argv[], // Arguments for the inferior program including the path to the inferior itself as the first argument char const *inferior_envp[], // Environment to pass along to the inferior program char const *stdio_path, - lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, and attach_pid != LLDB_INVALID_PROCESS_ID then attach to this attach_pid + bool launch_process, // Set to true if we are going to be launching a the process + lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, and attach_pid != LLDB_INVALID_PROCESS_ID send this pid as an argument to debugserver const char *attach_name, // Wait for the next process to launch whose basename matches "attach_name" bool wait_for_launch, // Wait for the process named "attach_name" to launch - bool disable_aslr, // Disable ASLR + bool disable_aslr, // Disable ASLR ArchSpec& inferior_arch // The arch of the inferior that we will launch ) { @@ -1741,30 +1747,12 @@ Args debugserver_args; char arg_cstr[PATH_MAX]; - bool launch_process = true; - - if (inferior_argv == NULL && attach_pid != LLDB_INVALID_PROCESS_ID) - launch_process = false; - else if (attach_name) - launch_process = false; // Wait for a process whose basename matches that in inferior_argv[0] - bool pass_stdio_path_to_debugserver = true; lldb_utility::PseudoTerminal pty; - if (stdio_path == NULL) + if (launch_process && stdio_path == NULL && m_local_debugserver) { - if (! m_local_debugserver) - pass_stdio_path_to_debugserver = false; if (pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, NULL, 0)) - { - struct termios stdin_termios; - if (::tcgetattr (pty.GetMasterFileDescriptor(), &stdin_termios) == 0) - { - stdin_termios.c_lflag &= ~ECHO; // Turn off echoing - stdin_termios.c_lflag &= ~ICANON; // Get one char at a time - ::tcsetattr (pty.GetMasterFileDescriptor(), TCSANOW, &stdin_termios); - } stdio_path = pty.GetSlaveName (NULL, 0); - } } // Start args with "debugserver /file/path -r --" @@ -1780,15 +1768,10 @@ debugserver_args.AppendArguments("--disable-aslr"); // Only set the inferior - if (launch_process) + if (launch_process && stdio_path) { - if (stdio_path && pass_stdio_path_to_debugserver) - { - debugserver_args.AppendArgument("-s"); // short for --stdio-path - StreamString strm; - strm.Printf("%s", stdio_path); - debugserver_args.AppendArgument(strm.GetData()); // path to file to have inferior open as it's STDIO - } + debugserver_args.AppendArgument("--stdio-path"); + debugserver_args.AppendArgument(stdio_path); } const char *env_debugserver_log_file = getenv("LLDB_DEBUGSERVER_LOG_FILE"); @@ -1883,14 +1866,17 @@ if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) { - std::auto_ptr conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true)); - if (conn_ap.get()) + if (pty.GetMasterFileDescriptor() != lldb_utility::PseudoTerminal::invalid_fd) { - m_stdio_communication.SetConnection(conn_ap.release()); - if (m_stdio_communication.IsConnected()) + std::auto_ptr conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true)); + if (conn_ap.get()) { - m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this); - m_stdio_communication.StartReadThread(); + m_stdio_communication.SetConnection(conn_ap.release()); + if (m_stdio_communication.IsConnected()) + { + m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this); + m_stdio_communication.StartReadThread(); + } } } } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=118404&r1=118403&r2=118404&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Sun Nov 7 22:29:11 2010 @@ -286,14 +286,15 @@ UpdateThreadListIfNeeded (); lldb_private::Error - StartDebugserverProcess (const char *debugserver_url, // The connection string to use in the spawned debugserver ("localhost:1234" or "/dev/tty...") + StartDebugserverProcess (const char *debugserver_url, // The connection string to use in the spawned debugserver ("localhost:1234" or "/dev/tty...") char const *inferior_argv[], char const *inferior_envp[], const char *stdin_path, - lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, then attach to this pid - const char *attach_pid_name, // Wait for the next process to launch whose basename matches "attach_wait_name" - bool wait_for_launch, // Wait for the process named "attach_wait_name" to launch - bool disable_aslr, // Disable ASLR + bool launch_process, // Set to true if we are going to be launching a the process + lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, then attach to this pid + const char *attach_pid_name, // Wait for the next process to launch whose basename matches "attach_wait_name" + bool wait_for_launch, // Wait for the process named "attach_wait_name" to launch + bool disable_aslr, // Disable ASLR lldb_private::ArchSpec& arch_spec); void Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=118404&r1=118403&r2=118404&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sun Nov 7 22:29:11 2010 @@ -1785,9 +1785,6 @@ QualType qual_type (QualType::getFromOpaquePtr(clang_type)); - if (qual_type->isAggregateType ()) - return true; - const clang::Type::TypeClass type_class = qual_type->getTypeClass(); switch (type_class) {