From johnny.chen at apple.com Mon Jan 23 13:37:53 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 23 Jan 2012 19:37:53 -0000 Subject: [Lldb-commits] [lldb] r148717 - /lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py Message-ID: <20120123193753.DFF782A6C12C@llvm.org> Author: johnny Date: Mon Jan 23 13:37:53 2012 New Revision: 148717 URL: http://llvm.org/viewvc/llvm-project?rev=148717&view=rev Log: Dump the raw bytes and the disassembled instruction before calling self.assertTrue() instead of after, in case the assert fails for any reason. Modified: lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py Modified: lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=148717&r1=148716&r2=148717&view=diff ============================================================================== --- lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py (original) +++ lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py Mon Jan 23 13:37:53 2012 @@ -30,14 +30,14 @@ inst = insts.GetInstructionAtIndex(0) - self.assertTrue (inst.GetMnemonic(target) == "movq") - self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp") - if self.TraceOn(): print print "Raw bytes: ", [hex(x) for x in raw_bytes] print "Disassembled:", inst + self.assertTrue (inst.GetMnemonic(target) == "movq") + self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp") + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() From johnny.chen at apple.com Mon Jan 23 13:49:28 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 23 Jan 2012 19:49:28 -0000 Subject: [Lldb-commits] [lldb] r148719 - in /lldb/trunk: source/Commands/CommandObjectSettings.cpp source/Commands/CommandObjectSettings.h test/functionalities/completion/TestCompletion.py test/settings/TestSettings.py Message-ID: <20120123194928.9B0082A6C12C@llvm.org> Author: johnny Date: Mon Jan 23 13:49:28 2012 New Revision: 148719 URL: http://llvm.org/viewvc/llvm-project?rev=148719&view=rev Log: Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev, where we changed the CommandObjectSettingsSet object impl to require raw command string. Do the same for CommandObjectSettingsAppend/InsertBefore/InsertAfter classes and add test cases for basic functionalities as well as for variable name completion. Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp lldb/trunk/source/Commands/CommandObjectSettings.h lldb/trunk/test/functionalities/completion/TestCompletion.py lldb/trunk/test/settings/TestSettings.py Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=148719&r1=148718&r2=148719&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Mon Jan 23 13:49:28 2012 @@ -144,12 +144,12 @@ // Split the raw command into var_name and value pair. std::string var_name_string = var_name; llvm::StringRef raw_str(raw_command); - llvm::StringRef value_str = raw_str.split(var_name_string).second; - StripLeadingSpaces(value_str); - std::string value_string = value_str.str(); + llvm::StringRef var_value_str = raw_str.split(var_name).second; + StripLeadingSpaces(var_value_str); + std::string var_value_string = var_value_str.str(); if (!m_options.m_reset - && value_string.empty()) + && var_value_string.empty()) { result.AppendError ("'settings set' command requires a valid variable value unless using '--reset' option;" " No value supplied"); @@ -158,7 +158,7 @@ else { Error err = usc_sp->SetVariable (var_name_string.c_str(), - value_string.c_str(), + var_value_string.c_str(), eVarSetOperationAssign, m_options.m_override, m_interpreter.GetDebugger().GetInstanceName().AsCString()); @@ -835,11 +835,12 @@ } bool -CommandObjectSettingsInsertBefore::Execute (Args& command, CommandReturnObject &result) +CommandObjectSettingsInsertBefore::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result) { UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ()); - const int argc = command.GetArgumentCount (); + Args cmd_args(raw_command); + const int argc = cmd_args.GetArgumentCount (); if (argc < 3) { @@ -848,7 +849,7 @@ return false; } - const char *var_name = command.GetArgumentAtIndex (0); + const char *var_name = cmd_args.GetArgumentAtIndex (0); std::string var_name_string; if ((var_name == NULL) || (var_name[0] == '\0')) { @@ -858,9 +859,9 @@ } var_name_string = var_name; - command.Shift(); + cmd_args.Shift(); - const char *index_value = command.GetArgumentAtIndex (0); + const char *index_value = cmd_args.GetArgumentAtIndex (0); std::string index_value_string; if ((index_value == NULL) || (index_value[0] == '\0')) { @@ -870,15 +871,15 @@ } index_value_string = index_value; - command.Shift(); - - const char *var_value; - std::string value_string; + cmd_args.Shift(); - command.GetQuotedCommandString (value_string); - var_value = value_string.c_str(); + // Split the raw command into var_name, index_value, and value triple. + llvm::StringRef raw_str(raw_command); + llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second; + StripLeadingSpaces(var_value_str); + std::string var_value_string = var_value_str.str(); - if ((var_value == NULL) || (var_value[0] == '\0')) + if (var_value_string.empty()) { result.AppendError ("'settings insert-before' command requires a valid variable value;" " No value supplied"); @@ -887,7 +888,7 @@ else { Error err = usc_sp->SetVariable (var_name_string.c_str(), - var_value, + var_value_string.c_str(), eVarSetOperationInsertBefore, true, m_interpreter.GetDebugger().GetInstanceName().AsCString(), @@ -981,11 +982,12 @@ } bool -CommandObjectSettingsInsertAfter::Execute (Args& command, CommandReturnObject &result) +CommandObjectSettingsInsertAfter::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result) { UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ()); - const int argc = command.GetArgumentCount (); + Args cmd_args(raw_command); + const int argc = cmd_args.GetArgumentCount (); if (argc < 3) { @@ -994,7 +996,7 @@ return false; } - const char *var_name = command.GetArgumentAtIndex (0); + const char *var_name = cmd_args.GetArgumentAtIndex (0); std::string var_name_string; if ((var_name == NULL) || (var_name[0] == '\0')) { @@ -1004,9 +1006,9 @@ } var_name_string = var_name; - command.Shift(); + cmd_args.Shift(); - const char *index_value = command.GetArgumentAtIndex (0); + const char *index_value = cmd_args.GetArgumentAtIndex (0); std::string index_value_string; if ((index_value == NULL) || (index_value[0] == '\0')) { @@ -1016,15 +1018,15 @@ } index_value_string = index_value; - command.Shift(); - - const char *var_value; - std::string value_string; + cmd_args.Shift(); - command.GetQuotedCommandString (value_string); - var_value = value_string.c_str(); + // Split the raw command into var_name, index_value, and value triple. + llvm::StringRef raw_str(raw_command); + llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second; + StripLeadingSpaces(var_value_str); + std::string var_value_string = var_value_str.str(); - if ((var_value == NULL) || (var_value[0] == '\0')) + if (var_value_string.empty()) { result.AppendError ("'settings insert-after' command requires a valid variable value;" " No value supplied"); @@ -1033,7 +1035,7 @@ else { Error err = usc_sp->SetVariable (var_name_string.c_str(), - var_value, + var_value_string.c_str(), eVarSetOperationInsertAfter, true, m_interpreter.GetDebugger().GetInstanceName().AsCString(), @@ -1117,11 +1119,12 @@ } bool -CommandObjectSettingsAppend::Execute (Args& command, CommandReturnObject &result) +CommandObjectSettingsAppend::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result) { UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ()); - const int argc = command.GetArgumentCount (); + Args cmd_args(raw_command); + const int argc = cmd_args.GetArgumentCount (); if (argc < 2) { @@ -1130,7 +1133,7 @@ return false; } - const char *var_name = command.GetArgumentAtIndex (0); + const char *var_name = cmd_args.GetArgumentAtIndex (0); std::string var_name_string; if ((var_name == NULL) || (var_name[0] == '\0')) { @@ -1140,15 +1143,15 @@ } var_name_string = var_name; - command.Shift(); - - const char *var_value; - std::string value_string; + cmd_args.Shift(); - command.GetQuotedCommandString (value_string); - var_value = value_string.c_str(); + // Split the raw command into var_name and value pair. + llvm::StringRef raw_str(raw_command); + llvm::StringRef var_value_str = raw_str.split(var_name).second; + StripLeadingSpaces(var_value_str); + std::string var_value_string = var_value_str.str(); - if ((var_value == NULL) || (var_value[0] == '\0')) + if (var_value_string.empty()) { result.AppendError ("'settings append' command requires a valid variable value;" " No value supplied"); @@ -1157,7 +1160,7 @@ else { Error err = usc_sp->SetVariable (var_name_string.c_str(), - var_value, + var_value_string.c_str(), eVarSetOperationAppend, true, m_interpreter.GetDebugger().GetInstanceName().AsCString()); Modified: lldb/trunk/source/Commands/CommandObjectSettings.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.h?rev=148719&r1=148718&r2=148719&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSettings.h (original) +++ lldb/trunk/source/Commands/CommandObjectSettings.h Mon Jan 23 13:49:28 2012 @@ -253,7 +253,19 @@ virtual bool Execute (Args& command, - CommandReturnObject &result); + CommandReturnObject &result) + { return false; } + + virtual bool + WantsRawCommandString() { return true; } + + // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. + virtual bool + WantsCompletion() { return true; } + + virtual bool + ExecuteRawCommandString (const char *raw_command, + CommandReturnObject &result); virtual int HandleArgumentCompletion (Args &input, @@ -282,7 +294,19 @@ virtual bool Execute (Args& command, - CommandReturnObject &result); + CommandReturnObject &result) + { return false; } + + virtual bool + WantsRawCommandString() { return true; } + + // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. + virtual bool + WantsCompletion() { return true; } + + virtual bool + ExecuteRawCommandString (const char *raw_command, + CommandReturnObject &result); virtual int HandleArgumentCompletion (Args &input, @@ -311,7 +335,19 @@ virtual bool Execute (Args& command, - CommandReturnObject &result); + CommandReturnObject &result) + { return false; } + + virtual bool + WantsRawCommandString() { return true; } + + // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. + virtual bool + WantsCompletion() { return true; } + + virtual bool + ExecuteRawCommandString (const char *raw_command, + CommandReturnObject &result); virtual int HandleArgumentCompletion (Args &input, Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148719&r1=148718&r2=148719&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Mon Jan 23 13:49:28 2012 @@ -18,6 +18,18 @@ system(["/bin/sh", "-c", "rm -f child_send.txt"]) system(["/bin/sh", "-c", "rm -f child_read.txt"]) + def test_settings_append_target_er(self): + """Test that 'settings append target.er' completes to 'settings append target.error-path'.""" + self.complete_from_to('settings append target.er', 'settings append target.error-path') + + def test_settings_insert_after_target_en(self): + """Test that 'settings insert-after target.en' completes to 'settings insert-after target.env-vars'.""" + self.complete_from_to('settings insert-after target.en', 'settings insert-after target.env-vars') + + def test_settings_insert_before_target_en(self): + """Test that 'settings insert-before target.en' completes to 'settings insert-before target.env-vars'.""" + self.complete_from_to('settings insert-before target.en', 'settings insert-before target.env-vars') + def test_settings_replace_target_ru(self): """Test that 'settings replace target.ru' completes to 'settings replace target.run-args'.""" self.complete_from_to('settings replace target.ru', 'settings replace target.run-args') Modified: lldb/trunk/test/settings/TestSettings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=148719&r1=148718&r2=148719&view=diff ============================================================================== --- lldb/trunk/test/settings/TestSettings.py (original) +++ lldb/trunk/test/settings/TestSettings.py Mon Jan 23 13:49:28 2012 @@ -27,6 +27,39 @@ "environment variables", "executable's environment"]) + def test_append_target_env_vars(self): + """Test that 'replace target.run-args' works.""" + # Append the env-vars. + self.runCmd('settings append target.env-vars MY_ENV_VAR=YES') + # And add hooks to restore the settings during tearDown(). + self.addTearDownHook( + lambda: self.runCmd("settings set -r target.env-vars")) + + # Check it immediately! + self.expect('settings show target.env-vars', + substrs = ['MY_ENV_VAR=YES']) + + def test_insert_before_and_after_target_run_args(self): + """Test that 'insert-before/after target.run-args' works.""" + # Set the run-args first. + self.runCmd('settings set target.run-args a b c') + # And add hooks to restore the settings during tearDown(). + self.addTearDownHook( + lambda: self.runCmd("settings set -r target.run-args")) + + # Now insert-before the index-0 element with '__a__'. + self.runCmd('settings insert-before target.run-args 0 __a__') + # And insert-after the index-1 element with '__A__'. + self.runCmd('settings insert-after target.run-args 1 __A__') + # Check it immediately! + self.expect('settings show target.run-args', + substrs = ['target.run-args (array) = ', + '[0]: "__a__"', + '[1]: "a"', + '[2]: "__A__"', + '[3]: "b"', + '[4]: "c"']) + def test_replace_target_run_args(self): """Test that 'replace target.run-args' works.""" # Set the run-args and then replace the index-0 element. From johnny.chen at apple.com Mon Jan 23 17:04:00 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 23 Jan 2012 23:04:00 -0000 Subject: [Lldb-commits] [lldb] r148743 - in /lldb/trunk: include/lldb/Breakpoint/StoppointLocation.h source/Breakpoint/BreakpointLocation.cpp source/Breakpoint/BreakpointSite.cpp source/Breakpoint/Watchpoint.cpp Message-ID: <20120123230400.40EB72A6C12C@llvm.org> Author: johnny Date: Mon Jan 23 17:03:59 2012 New Revision: 148743 URL: http://llvm.org/viewvc/llvm-project?rev=148743&view=rev Log: Tiny refactoring to use member functions instead of directly accessing member fields. Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointSite.cpp lldb/trunk/source/Breakpoint/Watchpoint.cpp Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=148743&r1=148742&r2=148743&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Mon Jan 23 17:03:59 2012 @@ -70,7 +70,10 @@ } void - IncrementHitCount (); + IncrementHitCount () + { + ++m_hit_count; + } uint32_t GetHardwareIndex () const Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=148743&r1=148742&r2=148743&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Mon Jan 23 17:03:59 2012 @@ -212,12 +212,12 @@ bool should_stop = true; LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); - m_hit_count++; + IncrementHitCount(); if (!IsEnabled()) return false; - if (m_hit_count <= GetIgnoreCount()) + if (GetHitCount() <= GetIgnoreCount()) return false; // We only run synchronous callbacks in ShouldStop: Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=148743&r1=148742&r2=148743&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Mon Jan 23 17:03:59 2012 @@ -61,7 +61,7 @@ bool BreakpointSite::ShouldStop (StoppointCallbackContext *context) { - m_hit_count++; + IncrementHitCount(); return m_owners.ShouldStop (context); } Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=148743&r1=148742&r2=148743&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Mon Jan 23 17:03:59 2012 @@ -66,7 +66,8 @@ return; } - +// Override default impl of StoppointLocation::IsHardware() since m_is_hardware +// member field is more accurate. bool Watchpoint::IsHardware () const { @@ -79,12 +80,12 @@ bool Watchpoint::ShouldStop (StoppointCallbackContext *context) { - ++m_hit_count; + IncrementHitCount(); if (!IsEnabled()) return false; - if (m_hit_count <= GetIgnoreCount()) + if (GetHitCount() <= GetIgnoreCount()) return false; return true; From johnny.chen at apple.com Mon Jan 23 18:11:02 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 24 Jan 2012 00:11:02 -0000 Subject: [Lldb-commits] [lldb] r148756 - in /lldb/trunk: include/lldb/Breakpoint/StoppointLocation.h source/Breakpoint/Watchpoint.cpp Message-ID: <20120124001102.A1C672A6C12C@llvm.org> Author: johnny Date: Mon Jan 23 18:11:02 2012 New Revision: 148756 URL: http://llvm.org/viewvc/llvm-project?rev=148756&view=rev Log: Minor comment change. Plus use member function instead of directly accessing member field. Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h lldb/trunk/source/Breakpoint/Watchpoint.cpp Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=148756&r1=148755&r2=148756&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Mon Jan 23 18:11:02 2012 @@ -123,7 +123,7 @@ //------------------------------------------------------------------ // Classes that inherit from StoppointLocation can see and modify these //------------------------------------------------------------------ - lldb::break_id_t m_loc_id; // Break ID + lldb::break_id_t m_loc_id; // Stoppoint location ID lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't // store a full Address since that's not needed for the breakpoint sites. bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources) @@ -131,7 +131,7 @@ uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for // software breakpoints, or the optional length in bytes for // hardware breakpoints, or the length of the watchpoint. - uint32_t m_hit_count; // Number of times this breakpoint has been hit + uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit private: //------------------------------------------------------------------ Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=148756&r1=148755&r2=148756&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Mon Jan 23 18:11:02 2012 @@ -115,7 +115,7 @@ s->Printf("Watchpoint %u: addr = 0x%8.8llx size = %u state = %s type = %s%s", GetID(), - (uint64_t)m_addr, + GetLoadAddress(), m_byte_size, m_enabled ? "enabled" : "disabled", m_watch_read ? "r" : "", From johnny.chen at apple.com Mon Jan 23 19:53:02 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 24 Jan 2012 01:53:02 -0000 Subject: [Lldb-commits] [lldb] r148766 - /lldb/trunk/test/redo.py Message-ID: <20120124015302.A7D8E2A6C12C@llvm.org> Author: johnny Date: Mon Jan 23 19:53:02 2012 New Revision: 148766 URL: http://llvm.org/viewvc/llvm-project?rev=148766&view=rev Log: Modify redo.py script so that if sessin_dir is left unspecified, it uses the heuristic to find the possible session directories with names starting with %Y-%m-%d- (for example, 2012-01-23-) and employs the one with the latest timestamp. For example: johnny:/Volumes/data/lldb/svn/latest/test $ ./redo.py Using session dir path: /Volumes/data/lldb/svn/latest/test/2012-01-23-11_28_30 adding filterspec: DisassembleRawDataTestCase.test_disassemble_raw_data Running ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data LLDB build dir: /Volumes/data/lldb/svn/latest/build/Debug LLDB-108 Path: /Volumes/data/lldb/svn/latest URL: https://johnny at llvm.org/svn/llvm-project/lldb/trunk Repository Root: https://johnny at llvm.org/svn/llvm-project Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8 Revision: 148710 Node Kind: directory Schedule: normal Last Changed Author: gclayton Last Changed Rev: 148650 Last Changed Date: 2012-01-21 18:55:08 -0800 (Sat, 21 Jan 2012) Session logs for test failures/errors/unexpected successes will go into directory '2012-01-23-17_04_48' Command invoked: python ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data Configuration: compiler=clang ---------------------------------------------------------------------- Collected 1 test Change dir to: /Volumes/data/lldb/svn/latest/test/python_api/disassemble-raw-data 1: test_disassemble_raw_data (TestDisassembleRawData.DisassembleRawDataTestCase) Test disassembling raw bytes with the API. ... Raw bytes: ['0x48', '0x89', '0xe5'] Disassembled: movq %rsp, %rbp ok Restore dir to: /Volumes/data/lldb/svn/latest/test ---------------------------------------------------------------------- Ran 1 test in 0.233s OK Modified: lldb/trunk/test/redo.py Modified: lldb/trunk/test/redo.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/redo.py?rev=148766&r1=148765&r2=148766&view=diff ============================================================================== --- lldb/trunk/test/redo.py (original) +++ lldb/trunk/test/redo.py Mon Jan 23 19:53:02 2012 @@ -15,7 +15,7 @@ for help. """ -import os, sys +import os, sys, datetime import re # If True, redo with no '-t' option for the test driver. @@ -36,13 +36,17 @@ def usage(): print"""\ -Usage: redo.py [-n] session_dir +Usage: redo.py [-n] [session_dir] where options: -n : when running the tests, do not turn on trace mode, i.e, no '-t' option is passed to the test driver (this will run the tests faster) and session_dir specifies the session directory which contains previously -recorded session infos for all the test cases which either failed or errored.""" +recorded session infos for all the test cases which either failed or errored. + +If sessin_dir is left unspecified, this script uses the heuristic to find the +possible session directories with names starting with %Y-%m-%d- (for example, +2012-01-23-) and employs the one with the latest timestamp.""" sys.exit(0) def where(session_dir, test_dir): @@ -97,7 +101,12 @@ global no_trace global redo_specs - if len(sys.argv) < 2 or len(sys.argv) > 3: + test_dir = sys.path[0] + if not test_dir.endswith('test'): + print "This script expects to reside in lldb's test directory." + sys.exit(-1) + + if len(sys.argv) > 3: usage() index = 1 @@ -116,20 +125,29 @@ no_trace = True index += 1 - session_dir = sys.argv[index] - - test_dir = sys.path[0] - if not test_dir.endswith('test'): - print "This script expects to reside in lldb's test directory." - sys.exit(-1) + if index < len(sys.argv): + # Get the specified session directory. + session_dir = sys.argv[index] + else: + # Use heuristic to find the latest session directory. + name = datetime.datetime.now().strftime("%Y-%m-%d-") + dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)] + session_dir = max(dirs, key=os.path.getmtime) + if not session_dir or not os.path.exists(session_dir): + print "No default session directory found, please specify it explicitly." + usage() #print "The test directory:", test_dir session_dir_path = where(session_dir, test_dir) - #print "Session dir path:", session_dir_path + print "Using session dir path:", session_dir_path os.chdir(test_dir) os.path.walk(session_dir_path, redo, ".log") + if not redo_specs: + print "No failures/errors recorded within the session directory, please specify a different session directory." + usage() + filters = " -f ".join(redo_specs) compilers = (" -C %s" % "^".join(comp_specs)) if comp_specs else None archs = (" -A %s" % "^".join(arch_specs)) if arch_specs else None From jingham at apple.com Mon Jan 23 20:40:43 2012 From: jingham at apple.com (Jim Ingham) Date: Tue, 24 Jan 2012 02:40:43 -0000 Subject: [Lldb-commits] [lldb] r148768 - in /lldb/trunk: examples/python/cmdtemplate.py www/python-faq.html Message-ID: <20120124024043.53A1F2A6C12C@llvm.org> Author: jingham Date: Mon Jan 23 20:40:42 2012 New Revision: 148768 URL: http://llvm.org/viewvc/llvm-project?rev=148768&view=rev Log: Proof-reading the python docs. Modified: lldb/trunk/examples/python/cmdtemplate.py lldb/trunk/www/python-faq.html Modified: lldb/trunk/examples/python/cmdtemplate.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/cmdtemplate.py?rev=148768&r1=148767&r2=148768&view=diff ============================================================================== --- lldb/trunk/examples/python/cmdtemplate.py (original) +++ lldb/trunk/examples/python/cmdtemplate.py Mon Jan 23 20:40:42 2012 @@ -33,17 +33,18 @@ for arg in args: if options.verbose: - print commands.getoutput('/bin/ls "%s"' % arg) + result.PutCString(commands.getoutput('/bin/ls "%s"' % arg)) else: - print commands.getoutput('/bin/ls -lAF "%s"' % arg) + result.PutCString(commands.getoutput('/bin/ls -lAF "%s"' % arg)) if __name__ == '__main__': # This script is being run from the command line, create a debugger in case we are # going to use any debugger functions in our function. lldb.debugger = lldb.SBDebugger.Create() ls (sys.argv) -elif lldb.debugger: - # This script is being run from LLDB in the emabedded command interpreter + +def __lldb_init_module (debugger, dict): + # This initializer is being run from LLDB in the embedded command interpreter # Add any commands contained in this module to LLDB - lldb.debugger.HandleCommand('command script add -f cmdtemplate.ls ls') + debugger.HandleCommand('command script add -f cmdtemplate.ls ls') print '"ls" command installed, type "ls --help" for detailed help' Modified: lldb/trunk/www/python-faq.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-faq.html?rev=148768&r1=148767&r2=148768&view=diff ============================================================================== --- lldb/trunk/www/python-faq.html (original) +++ lldb/trunk/www/python-faq.html Mon Jan 23 20:40:42 2012 @@ -19,8 +19,13 @@

Introduction

-

The entire LLDB API is available through a script bridging interface in Python. Python can be used - as an embedded script interpreter, or it can be used directly from python at the command line.

+

The entire LLDB API is available as Python functions through a script bridging interface. + This means the LLDB API's can be used directly from python either interactively or to build python apps that + provide debugger features.

+

Additionally, Python can be used as a programmatic interface within the + lldb command interpreter (we refer to this for brevity as the embedded interpreter). Of course, + in this context it has full access to the LLDB API - with some additional conveniences we will + call out in the FAQ.

@@ -29,8 +34,8 @@

Embedded Python Interpreter

-

The embedded python interpreter can be accessed in a variety of way from within LLDB. The - easiest way is to type script command prompt:

+

The embedded python interpreter can be accessed in a variety of ways from within LLDB. The + easiest way is to use the lldb command script with no arguments at the lldb command prompt:

(lldb) script
 Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
 >>> 2+3
@@ -40,9 +45,14 @@
 >>> 
 
-

This drops you into the embedded python interpreter. There are a some convenience variables - that are set for you in the lldb python module that refer to the current program - and debugger state:

+

This drops you into the embedded python interpreter. When running under the script command, + lldb sets some convenience variables that give you quick access to the currently selected entities that characterize + the program and debugger state. In each case, if there is no currently selected entity of the appropriate + type, the variable's IsValid method will return false. +

Note also, these variables hold the values + of the selected objects on entry to the embedded interpreter. They do not update as you use the LLDB + API's to change, for example, the currently selected stack frame or thread.

+ These are all global variables contained in the lldb python namespace :

@@ -58,9 +68,10 @@ lldb.SBDebugger @@ -71,10 +82,10 @@ lldb.SBTarget @@ -85,9 +96,9 @@ lldb.SBProcess @@ -98,12 +109,12 @@ lldb.SBThread @@ -114,18 +125,20 @@ lldb.SBFrame
Variable - A module global variable containing the current debugger object. - The type is a lldb.SBDebugger object and it contains a reference to the debegger - object that owns the command interpreter and all targets in your debug session. + Contains the debugger object whose script command was invoked. + The lldb.SBDebugger object owns the command interpreter + and all the targets in your debug session. There will always be a + Debugger in the embedded interpreter.
- A module global variable containing the currently selected target. - The type is a lldb.SBTarget object and the object will only be valid if there is a current target. - The target select <target-index> commmand can be used to change the - currently selected target. + Contains the currently selected target - for instance the one made with the + file or selected by the target select <target-index> command. + The lldb.SBTarget manages one running process, and all the executable + and debug files for the process.
- A module global variable containing the current process. - The type is a lldb.SBProcess object and the object will only be - valid if there is a current target and that target has a process. + Contains the process of the currently selected target. + The lldb.SBProcess object manages the threads and allows access to + memory for the process.
- A module global variable containing the current thread. - The type is a lldb.SBThread object and the object will only be valid if - the process has threads, and if the process has a thread selected. + Contains the currently selected thread. + The lldb.SBThread object manages the stack frames in that thread. A thread is always selected in the command interpreter when a target stops. The thread select <thread-index> commmand can be used to change the - currently selected thread. + currently selected thread. So as long as you have a stopped process, there will be + some selected thread.
- A module global variable containing the current stack frame. - The type is a lldb.SBFrame object and the object will only be valid if - the thread is stopped and has a frame selected. + Contains the currently selected stack frame. + The lldb.SBFrame object manage the stack locals and the register set for + that stack. A stack frame is always selected in the command interpreter when a target stops. The frame select <frame-index> commmand can be used to change the - currently selected thread. + currently selected frame. So as long as you have a stopped process, there will + be some selected frame.
-

One in the embedded interpreter, these objects can be used. Almost all of the lldb.SB objects - are able to briefly describe themselves by printing them: +

Once in the embedded interpreter, these objects can be used. To get started, note that almost + all of the lldb Python objects are able to briefly describe themselves when you pass them + to the Python print function:

(lldb) script
 Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
 >>> print lldb.debugger
@@ -148,13 +161,13 @@
 			

Running a Python script when a breakpoint gets hit

-

A python script can be run when a breakpoint gets hit. Adding python +

One very powerful use of the lldb Python API is to have a python script run when a breakpoint gets hit. Adding python scripts to breakpoints provides a way to create complex breakpoint conditions and also allows for smart logging and data gathering.

-

A python function gets run when a breakpoint, and this function has - two arguments:

+

When your process hits a breakpoint to which you have attached some python code, the code is executed as the + body of a function which takes two arguments:

-

def breakpoint_function(frame, bp_loc):
+
def breakpoint_function_wrapper(frame, bp_loc):
   # Your code goes here
 

@@ -173,7 +186,7 @@ @@ -191,25 +204,34 @@
The current stack frame where the breakpoint got hit. - The type is a lldb.SBFrame object and the object will always be valid. + The object will always be valid. This frame argument might not match the currently selected stack frame found in the lldb module global variable lldb.frame.
-

Now we are ready to create a python function and attach it to a breakpoint. The following example will wllow you to - create an order file for a shared library. We do this by setting a regular exprsssion breakpoint - at every function in a shared library. The regular expression we will use is '.' which will match - any function that has at least any character in the function name. +

An example will show how simple it is to write some python code and attach it to a breakpoint. + The following example will allow you to track the order in which the functions in a given shared library + are first executed during one run of your program. This is a simple method to gather an order file which + can be used to optimize function placement within a binary for execution locality.

+

We do this by setting a regular expression breakpoint + that will match every function in the shared library. The regular expression '.' will match + any string that has at least one character in it, so we will use that. This will result in one lldb.SBBreakpoint object - that contains many lldb.SBBreakpointLocation objects. As the breakpoint continually gets - hit, we use the hit count on the main lldb.SBBreakpoint to tell us the breakpoint hit - number, and we disable the location (not the main breakpoint) on the lldb.SBBreakpointLocation - object. Then we log some info and continue the process. + that contains an lldb.SBBreakpointLocation object for each function. As the breakpoint gets + hit, we use a counter to track the order in which the function at this particular breakpoint location got hit. + Since our code is passed the location that was hit, we can get the name of the function from the location, + disable the location so we won't count this function again; then log some info and continue the process.

+

Note we also have to initialize our counter, which we do with the simple one-line version of the script + command. +

Here is the code: +

(lldb) breakpoint set --func-regex=. --shlib=libfoo.dylib
 Breakpoint created: 1: regex = '.', module = libfoo.dylib, locations = 223
+(lldb) script counter = 0
 (lldb) breakpoint command add --script-type python 1
 Enter your Python command(s). Type 'DONE' to end.
-> # Get the hit count of the main breakpoint
-> hit_count = bp_loc.GetBreakpoint().GetHitCount()
+> # Increment our counter.  Since we are in a function, this must be a global python variable
+> global counter 
+> counter += 1
 > # Get the name of the function
 > name = frame.GetFunctionName()
 > # Print the order and the function name
-> print '[%i] %s' % (hit_count, name)
+> print '[%i] %s' % (counter, name)
 > # Disable the current breakpoint location so it doesn't get hit again
 > bp_loc.SetEnabled(False)
 > # How continue the process
@@ -225,13 +247,10 @@
 			

Create a new LLDB command using a python function

-

Python functions can be used to create new commands that the LLDB command interpreter - doesn't have. This provides a very flexible and easy way to extend LLDB to meet your +

Python functions can be used to create new LLDB command interpreter commands, which will work + like all the natively defined lldb commands. This provides a very flexible and easy way to extend LLDB to meet your debugging requirements.

-

A python function that implements a new LDB command has four arguments:

-

- def Symbolicate(debugger, command, result, dict): - SymbolicateCrashLog (command.split()) +

To write a python function that implements a new LDB command define the function to take four arguments as follows:

def command_function(debugger, command, result, dict):
           # Your code goes here
@@ -277,7 +296,8 @@
             
                 A return object where you can indicate the success or failure of your command. You can also
                 provide information for the command result by printing data into it. You can also just print
-                data as you normally would in a python script and the outout will show up.
+                data as you normally would in a python script and the output will show up; this is useful for
+                logging, but the real output for your command should go in the result object.
             
         
         
@@ -293,8 +313,19 @@
             
         
         
+        

One other handy convenience when defining lldb command-line commands is the command + command script import which will import a module specified by file path - so you + don't have to change your PYTHONPATH for temporary scripts. It also has another convenience + that if your new script module has a function of the form:

+ +
def __lldb_module_init(debugger, dict):
+          # Command Initialization code goes here
+          
+ +

where debugger and dict are as above, that function will get run when the module is loaded + allowing you to add whatever commands you want into the current debugger.

Now we can create a module called ls.py that will implement a function that - can be used by LLDB's python command code:

+ can be used by LLDB's python command code:

#!/usr/bin/python
 
@@ -304,18 +335,16 @@
 import shlex
 
 def ls(debugger, command, result, dict):
-    print commands.getoutput('/bin/ls %s' % command)
+    result.PutCString(commands.getoutput('/bin/ls %s' % command))
 
-# Any code that isn't in a function in python gets run when the module is loaded
-if lldb.debugger:
-    # This script is being run from LLDB in the emabedded command interpreter
-    # lets register the 'ls' command with the command interpreter automatically!
-    lldb.debugger.HandleCommand('command script add -f ls.ls ls')
+# And the initialization code to add your commands 
+def __lldb_module_init(debugger, dict):
+    debugger.HandleCommand('command script add -f ls.ls ls')
     print 'The "ls" python command has been installed and is ready for use.'
 

Now we can load the module into LLDB and use it

% lldb
-(lldb) script import ls
+(lldb) command script import ls
 The "ls" python command has been installed and is ready for use.
 (lldb) ls -l /tmp/
 total 365848
@@ -333,17 +362,23 @@
                 

LLDB has all of its core code build into a shared library which gets used by the lldb command line application. On Mac OS X this shared library is a framework: LLDB.framework and on other - unix variants the program is a shared library lldb.so. The - LLDB.framework contains the lldb.py module and you will + unix variants the program is a shared library: lldb.so. LLDB also + provides an lldb.py module that contains the bindings from LLDB into Python. + To use the + LLDB.framework to create your own stand-alone python programs, you will need to tell python where to look in order to find this module. This - is done by setting the PYTHONPATH environment variable contain - a path to the directory that contains the lldb.py python module: + is done by setting the PYTHONPATH environment variable, adding + a path to the directory that contains the lldb.py python module. On + Mac OS X, this is contained inside the LLDB.framework, so you would do:

For csh and tcsh:

% setenv PYTHONPATH /Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python

For sh and bash:

% export PYTHONPATH=/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python

+

Alternately, you can append the LLDB Python directory to the sys.path list directly in + your Python code before importing the lldb module.

+

Now your python scripts are ready to import the lldb module. Below is a python script that will launch a program from the current working directory @@ -362,7 +397,8 @@ debugger = lldb.SBDebugger.Create() # When we step or continue, don't return from the function until the process -# stops. We do this by setting the async mode to false. +# stops. Otherwise we would have to handle the process events ourselves which, while doable is +#a little tricky. We do this by setting the async mode to false. debugger.SetAsync (False) # Create a target from a file and arch From jingham at apple.com Mon Jan 23 20:44:08 2012 From: jingham at apple.com (Jim Ingham) Date: Tue, 24 Jan 2012 02:44:08 -0000 Subject: [Lldb-commits] [lldb] r148769 - in /lldb/trunk/www: python-faq.html python-reference.html sidebar.incl Message-ID: <20120124024408.357012A6C12C@llvm.org> Author: jingham Date: Mon Jan 23 20:44:07 2012 New Revision: 148769 URL: http://llvm.org/viewvc/llvm-project?rev=148769&view=rev Log: Better name for the python reference. Added: lldb/trunk/www/python-reference.html - copied unchanged from r148768, lldb/trunk/www/python-faq.html Removed: lldb/trunk/www/python-faq.html Modified: lldb/trunk/www/sidebar.incl Removed: lldb/trunk/www/python-faq.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-faq.html?rev=148768&view=auto ============================================================================== --- lldb/trunk/www/python-faq.html (original) +++ lldb/trunk/www/python-faq.html (removed) @@ -1,457 +0,0 @@ - - - - - -LLDB Python FAQ - - - -

- LLDB Python FAQ -
- -
-
- -
-
-

Introduction

-
- -

The entire LLDB API is available as Python functions through a script bridging interface. - This means the LLDB API's can be used directly from python either interactively or to build python apps that - provide debugger features.

-

Additionally, Python can be used as a programmatic interface within the - lldb command interpreter (we refer to this for brevity as the embedded interpreter). Of course, - in this context it has full access to the LLDB API - with some additional conveniences we will - call out in the FAQ.

- -
- - -
-

Embedded Python Interpreter

-
- -

The embedded python interpreter can be accessed in a variety of ways from within LLDB. The - easiest way is to use the lldb command script with no arguments at the lldb command prompt:

-
(lldb) script
-Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
->>> 2+3
-5
->>> hex(12345)
-'0x3039'
->>> 
-
- -

This drops you into the embedded python interpreter. When running under the script command, - lldb sets some convenience variables that give you quick access to the currently selected entities that characterize - the program and debugger state. In each case, if there is no currently selected entity of the appropriate - type, the variable's IsValid method will return false. -

Note also, these variables hold the values - of the selected objects on entry to the embedded interpreter. They do not update as you use the LLDB - API's to change, for example, the currently selected stack frame or thread.

- These are all global variables contained in the lldb python namespace :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableTypeDescription
- lldb.debugger - - lldb.SBDebugger - - Contains the debugger object whose script command was invoked. - The lldb.SBDebugger object owns the command interpreter - and all the targets in your debug session. There will always be a - Debugger in the embedded interpreter. -
- lldb.target - - lldb.SBTarget - - Contains the currently selected target - for instance the one made with the - file or selected by the target select <target-index> command. - The lldb.SBTarget manages one running process, and all the executable - and debug files for the process. -
- lldb.process - - lldb.SBProcess - - Contains the process of the currently selected target. - The lldb.SBProcess object manages the threads and allows access to - memory for the process. -
- lldb.thread - - lldb.SBThread - - Contains the currently selected thread. - The lldb.SBThread object manages the stack frames in that thread. - A thread is always selected in the command interpreter when a target stops. - The thread select <thread-index> commmand can be used to change the - currently selected thread. So as long as you have a stopped process, there will be - some selected thread. -
- lldb.frame - - lldb.SBFrame - - Contains the currently selected stack frame. - The lldb.SBFrame object manage the stack locals and the register set for - that stack. - A stack frame is always selected in the command interpreter when a target stops. - The frame select <frame-index> commmand can be used to change the - currently selected frame. So as long as you have a stopped process, there will - be some selected frame. -
- -

Once in the embedded interpreter, these objects can be used. To get started, note that almost - all of the lldb Python objects are able to briefly describe themselves when you pass them - to the Python print function: -

(lldb) script
-Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
->>> print lldb.debugger
-Debugger (instance: "debugger_1", id: 1)
->>> print lldb.target
-a.out
->>> print lldb.process
-SBProcess: pid = 59289, state = stopped, threads = 1, executable = a.out
->>> print lldb.thread
-SBThread: tid = 0x1f03
->>> print lldb.frame
-frame #0: 0x0000000100000bb6 a.out main + 54 at main.c:16
-
- -
- - -
-
-

Running a Python script when a breakpoint gets hit

-
- -

One very powerful use of the lldb Python API is to have a python script run when a breakpoint gets hit. Adding python - scripts to breakpoints provides a way to create complex breakpoint - conditions and also allows for smart logging and data gathering.

-

When your process hits a breakpoint to which you have attached some python code, the code is executed as the - body of a function which takes two arguments:

-

-

def breakpoint_function_wrapper(frame, bp_loc):
-  # Your code goes here
-
-

- - - - - - - - - - - - - - - - -
ArgumentTypeDescription
- frame - - lldb.SBFrame - - The current stack frame where the breakpoint got hit. - The object will always be valid. - This frame argument might not match the currently selected stack frame found in the lldb module global variable lldb.frame. -
- bp_loc - - lldb.SBBreakpointLocation - - The breakpoint location that just got hit. Breakpoints are represented by lldb.SBBreakpoint - objects. These breakpoint objects can have one or more locations. These locations - are represented by lldb.SBBreakpointLocation objects. -
-

An example will show how simple it is to write some python code and attach it to a breakpoint. - The following example will allow you to track the order in which the functions in a given shared library - are first executed during one run of your program. This is a simple method to gather an order file which - can be used to optimize function placement within a binary for execution locality.

-

We do this by setting a regular expression breakpoint - that will match every function in the shared library. The regular expression '.' will match - any string that has at least one character in it, so we will use that. - This will result in one lldb.SBBreakpoint object - that contains an lldb.SBBreakpointLocation object for each function. As the breakpoint gets - hit, we use a counter to track the order in which the function at this particular breakpoint location got hit. - Since our code is passed the location that was hit, we can get the name of the function from the location, - disable the location so we won't count this function again; then log some info and continue the process.

-

Note we also have to initialize our counter, which we do with the simple one-line version of the script - command. -

Here is the code: - -

(lldb) breakpoint set --func-regex=. --shlib=libfoo.dylib
-Breakpoint created: 1: regex = '.', module = libfoo.dylib, locations = 223
-(lldb) script counter = 0
-(lldb) breakpoint command add --script-type python 1
-Enter your Python command(s). Type 'DONE' to end.
-> # Increment our counter.  Since we are in a function, this must be a global python variable
-> global counter 
-> counter += 1
-> # Get the name of the function
-> name = frame.GetFunctionName()
-> # Print the order and the function name
-> print '[%i] %s' % (counter, name)
-> # Disable the current breakpoint location so it doesn't get hit again
-> bp_loc.SetEnabled(False)
-> # How continue the process
-> frame.GetThread().GetProcess().Continue()
-> DONE
-
-

The breakpoint command add command above attaches a python script to breakpoint 1. - To remove the breakpoint command: -

(lldb) breakpoint command delete 1 -

-
-
-

Create a new LLDB command using a python function

-
- -

Python functions can be used to create new LLDB command interpreter commands, which will work - like all the natively defined lldb commands. This provides a very flexible and easy way to extend LLDB to meet your - debugging requirements.

-

To write a python function that implements a new LDB command define the function to take four arguments as follows:

- -
def command_function(debugger, command, result, dict):
-          # Your code goes here
-        
-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
ArgumentTypeDescription
- debugger - - lldb.SBDebugger - - The current debugger object. -
- command - - python string - - A python string containing all arguments for your command. If you need to chop up the arguments - try using the shlex module's shlex.split(command) to properly extract the - arguments. -
- result - - lldb.SBCommandReturnObject - - A return object where you can indicate the success or failure of your command. You can also - provide information for the command result by printing data into it. You can also just print - data as you normally would in a python script and the output will show up; this is useful for - logging, but the real output for your command should go in the result object. -
- dict - - python dict object - - The dictionary for the current embedded script session which contains all variables - and functions. -
-

One other handy convenience when defining lldb command-line commands is the command - command script import which will import a module specified by file path - so you - don't have to change your PYTHONPATH for temporary scripts. It also has another convenience - that if your new script module has a function of the form:

- -
def __lldb_module_init(debugger, dict):
-          # Command Initialization code goes here
-          
- -

where debugger and dict are as above, that function will get run when the module is loaded - allowing you to add whatever commands you want into the current debugger.

-

Now we can create a module called ls.py that will implement a function that - can be used by LLDB's python command code:

- -
#!/usr/bin/python
-
-import lldb
-import commands
-import optparse
-import shlex
-
-def ls(debugger, command, result, dict):
-    result.PutCString(commands.getoutput('/bin/ls %s' % command))
-
-# And the initialization code to add your commands 
-def __lldb_module_init(debugger, dict):
-    debugger.HandleCommand('command script add -f ls.ls ls')
-    print 'The "ls" python command has been installed and is ready for use.'
-
-

Now we can load the module into LLDB and use it

-
% lldb
-(lldb) command script import ls
-The "ls" python command has been installed and is ready for use.
-(lldb) ls -l /tmp/
-total 365848
--rw-r--r--@  1 someuser  wheel         6148 Jan 19 17:27 .DS_Store
--rw-------   1 someuser  wheel         7331 Jan 19 15:37 crash.log
-
-

A template has been created in the source repository that can help you to create - lldb command quickly:

- cmdtemplate.py -
-
-

Using the lldb.py module in python

-
- -

LLDB has all of its core code build into a shared library which gets - used by the lldb command line application. On Mac OS X this - shared library is a framework: LLDB.framework and on other - unix variants the program is a shared library: lldb.so. LLDB also - provides an lldb.py module that contains the bindings from LLDB into Python. - To use the - LLDB.framework to create your own stand-alone python programs, you will - need to tell python where to look in order to find this module. This - is done by setting the PYTHONPATH environment variable, adding - a path to the directory that contains the lldb.py python module. On - Mac OS X, this is contained inside the LLDB.framework, so you would do: - -

For csh and tcsh:

-

% setenv PYTHONPATH /Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python

-

For sh and bash: -

% export PYTHONPATH=/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python

- -

Alternately, you can append the LLDB Python directory to the sys.path list directly in - your Python code before importing the lldb module.

- -

- Now your python scripts are ready to import the lldb module. Below is a - python script that will launch a program from the current working directory - called "a.out", set a breakpoint at "main", and then run and hit the breakpoint, - and print the process, thread and frame objects if the process stopped: - -

-
#!/usr/bin/python
-
-import lldb
-
-# Set the path to the executable to debug
-exe = "./a.out"
-
-# Create a new debugger instance
-debugger = lldb.SBDebugger.Create()
-
-# When we step or continue, don't return from the function until the process 
-# stops. Otherwise we would have to handle the process events ourselves which, while doable is
-#a little tricky.  We do this by setting the async mode to false.
-debugger.SetAsync (False)
-
-# Create a target from a file and arch
-print "Creating a target for '%s'" % exe
-
-target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)
-
-if target:
-    # If the target is valid set a breakpoint at main
-    main_bp = target.BreakpointCreateByName ("main", target.GetExecutable().GetFilename());
-
-    print main_bp
-
-    # Launch the process. Since we specified synchronous mode, we won't return
-    # from this function until we hit the breakpoint at main
-    process = target.LaunchSimple (None, None, os.getcwd())
-    
-    # Make sure the launch went ok
-    if process:
-        # Print some simple process info
-        state = process.GetState ()
-        print process
-        if state == lldb.eStateStopped:
-        # Get the first thread
-        thread = process.GetThreadAtIndex (0)
-        if thread:
-            # Print some simple thread info
-            print thread
-            # Get the first frame
-            frame = thread.GetFrameAtIndex (0)
-            if frame:
-                # Print some simple frame info
-                print frame
-                function = frame.GetFunction()
-                # See if we have debug info (a function)
-                if function:
-                    # We do have a function, print some info for the function
-                    print function
-                    # Now get all instructions for this function and print them
-                    insts = function.GetInstructions(target)
-                    disassemble_instructions (insts)
-                else:
-                    # See if we have a symbol in the symbol table for where we stopped
-                    symbol = frame.GetSymbol();
-                    if symbol:
-                        # We do have a symbol, print some info for the symbol
-                        print symbol
-
-
- - -
-
-
- - Modified: lldb/trunk/www/sidebar.incl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=148769&r1=148768&r2=148769&view=diff ============================================================================== --- lldb/trunk/www/sidebar.incl (original) +++ lldb/trunk/www/sidebar.incl Mon Jan 23 20:44:07 2012 @@ -20,7 +20,7 @@
  • FAQ
  • Frame and Thread Formatting
  • LLDB and GDB
  • -
  • Python FAQ
  • +
  • Python Reference
  • Python Scripting
  • Tutorial
  • Variable Formatting
  • From jingham at apple.com Mon Jan 23 20:44:55 2012 From: jingham at apple.com (Jim Ingham) Date: Tue, 24 Jan 2012 02:44:55 -0000 Subject: [Lldb-commits] [lldb] r148770 - /lldb/trunk/www/sidebar.incl Message-ID: <20120124024455.D96382A6C12C@llvm.org> Author: jingham Date: Mon Jan 23 20:44:55 2012 New Revision: 148770 URL: http://llvm.org/viewvc/llvm-project?rev=148770&view=rev Log: Better name for the Python Scripting. Modified: lldb/trunk/www/sidebar.incl Modified: lldb/trunk/www/sidebar.incl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=148770&r1=148769&r2=148770&view=diff ============================================================================== --- lldb/trunk/www/sidebar.incl (original) +++ lldb/trunk/www/sidebar.incl Mon Jan 23 20:44:55 2012 @@ -21,7 +21,7 @@
  • Frame and Thread Formatting
  • LLDB and GDB
  • Python Reference
  • -
  • Python Scripting
  • +
  • Python Example
  • Tutorial
  • Variable Formatting
  • From scallanan at apple.com Tue Jan 24 16:06:48 2012 From: scallanan at apple.com (Sean Callanan) Date: Tue, 24 Jan 2012 22:06:48 -0000 Subject: [Lldb-commits] [lldb] r148870 - in /lldb/trunk: include/lldb/Expression/ClangExpressionParser.h include/lldb/Expression/IRForTarget.h include/lldb/Expression/IRInterpreter.h source/Expression/ClangExpressionParser.cpp source/Expression/IRForTarget.cpp source/Expression/IRInterpreter.cpp Message-ID: <20120124220648.EAA462A6C12C@llvm.org> Author: spyffe Date: Tue Jan 24 16:06:48 2012 New Revision: 148870 URL: http://llvm.org/viewvc/llvm-project?rev=148870&view=rev Log: Added a mechanism for the IR interpreter to return an error along with its boolean result. The expression parser reports this error if the interpreter fails and the expression could not be run in the target. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionParser.h lldb/trunk/include/lldb/Expression/IRForTarget.h lldb/trunk/include/lldb/Expression/IRInterpreter.h lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/IRForTarget.cpp lldb/trunk/source/Expression/IRInterpreter.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionParser.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionParser.h?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionParser.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionParser.h Tue Jan 24 16:06:48 2012 @@ -189,7 +189,6 @@ std::auto_ptr m_selector_table; ///< Selector table for Objective-C methods std::auto_ptr m_ast_context; ///< The AST context used to hold types and names for the parser std::auto_ptr m_code_generator; ///< [owned by the Execution Engine] The Clang object that generates IR - std::auto_ptr m_execution_engine; ///< The LLVM JIT std::vector m_jitted_functions; ///< A vector of all functions that have been JITted into machine code (just one, if ParseExpression() was called) }; Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/IRForTarget.h (original) +++ lldb/trunk/include/lldb/Expression/IRForTarget.h Tue Jan 24 16:06:48 2012 @@ -12,6 +12,7 @@ #include "lldb/lldb-public.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" #include "lldb/Core/Stream.h" #include "lldb/Symbol/TaggedASTType.h" #include "llvm/Pass.h" @@ -115,6 +116,10 @@ /// $__lldb_expr, and that function is passed to the passes one by /// one. /// + /// @param[in] interpreter_error + /// An error. If the expression fails to be interpreted, this error + /// is set to a reason why. + /// /// @return /// True on success; false otherwise //------------------------------------------------------------------ @@ -146,10 +151,10 @@ /// /// Returns true if it did; false otherwise. //------------------------------------------------------------------ - bool - interpretSuccess () + lldb_private::Error & + getInterpreterError () { - return m_interpret_success; + return m_interpreter_error; } private: @@ -632,6 +637,7 @@ llvm::Constant *m_sel_registerName; ///< The address of the function sel_registerName, cast to the appropriate function pointer type lldb::ClangExpressionVariableSP &m_const_result; ///< This value should be set to the return value of the expression if it is constant and the expression has no side effects lldb_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed + lldb_private::Error m_interpreter_error; ///< The error result from the IR interpreter bool m_has_side_effects; ///< True if the function's result cannot be simply determined statically llvm::StoreInst *m_result_store; ///< If non-NULL, the store instruction that writes to the result variable. If m_has_side_effects is true, this is NULL. Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original) +++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Jan 24 16:06:48 2012 @@ -79,6 +79,9 @@ /// @param[in] llvm_module /// The module containing the function. /// + /// @param[in] error + /// If the expression fails to interpret, a reason why. + /// /// @return /// True on success; false otherwise //------------------------------------------------------------------ @@ -87,21 +90,24 @@ const lldb_private::ConstString &result_name, lldb_private::TypeFromParser result_type, llvm::Function &llvm_function, - llvm::Module &llvm_module); + llvm::Module &llvm_module, + lldb_private::Error &err); private: /// Flags lldb_private::ClangExpressionDeclMap &m_decl_map; ///< The DeclMap containing the Decls lldb_private::Stream *m_error_stream; bool - supportsFunction (llvm::Function &llvm_function); + supportsFunction (llvm::Function &llvm_function, + lldb_private::Error &err); bool runOnFunction (lldb::ClangExpressionVariableSP &result, const lldb_private::ConstString &result_name, lldb_private::TypeFromParser result_type, llvm::Function &llvm_function, - llvm::Module &llvm_module); + llvm::Module &llvm_module, + lldb_private::Error &err); }; #endif Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Jan 24 16:06:48 2012 @@ -187,7 +187,6 @@ m_expr (expr), m_compiler (), m_code_generator (NULL), - m_execution_engine (), m_jitted_functions () { // Initialize targets first, so that --version shows registered targets. @@ -447,6 +446,8 @@ func_end = LLDB_INVALID_ADDRESS; lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + std::auto_ptr execution_engine; + Error err; llvm::Module *module = m_code_generator->ReleaseModule(); @@ -498,7 +499,9 @@ return err; } - if (execution_policy != eExecutionPolicyAlways && ir_for_target.interpretSuccess()) + Error &interpreter_error(ir_for_target.getInterpreterError()); + + if (execution_policy != eExecutionPolicyAlways && interpreter_error.Success()) { if (const_result) const_result->TransferAddress(); @@ -512,7 +515,10 @@ if (!process || execution_policy == eExecutionPolicyNever) { err.SetErrorToGenericError(); - err.SetErrorString("Execution needed to run in the target, but the target can't be run"); + if (execution_policy == eExecutionPolicyAlways) + err.SetErrorString("Execution needed to run in the target, but the target can't be run"); + else + err.SetErrorStringWithFormat("Interpreting the expression locally failed: %s", interpreter_error.AsCString()); return err; } @@ -571,15 +577,6 @@ log->Printf ("Module being sent to JIT: \n%s", s.c_str()); } -#if defined (USE_STANDARD_JIT) - m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, - &error_string, - jit_memory_manager, - CodeGenOpt::Less, - true, - Reloc::Default, - CodeModel::Small)); -#else EngineBuilder builder(module); builder.setEngineKind(EngineKind::JIT) .setErrorStr(&error_string) @@ -589,24 +586,23 @@ .setAllocateGVsWithCode(true) .setCodeModel(CodeModel::Small) .setUseMCJIT(true); - m_execution_engine.reset(builder.create()); -#endif + execution_engine.reset(builder.create()); - if (!m_execution_engine.get()) + if (!execution_engine.get()) { err.SetErrorToGenericError(); err.SetErrorStringWithFormat("Couldn't JIT the function: %s", error_string.c_str()); return err; } - m_execution_engine->DisableLazyCompilation(); + execution_engine->DisableLazyCompilation(); llvm::Function *function = module->getFunction (function_name.c_str()); // We don't actually need the function pointer here, this just forces it to get resolved. - void *fun_ptr = m_execution_engine->getPointerToFunction(function); - + void *fun_ptr = execution_engine->getPointerToFunction(function); + // Errors usually cause failures in the JIT, but if we're lucky we get here. if (!function) @@ -717,6 +713,8 @@ } } + execution_engine.reset(); + err.Clear(); return err; } Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Jan 24 16:06:48 2012 @@ -2663,11 +2663,10 @@ IRInterpreter interpreter (*m_decl_map, m_error_stream); - if (interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module)) - { - m_interpret_success = true; + interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module, m_interpreter_error); + + if (m_interpreter_error.Success()) return true; - } } if (log && log->GetVerbose()) Modified: lldb/trunk/source/Expression/IRInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=148870&r1=148869&r2=148870&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRInterpreter.cpp (original) +++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Jan 24 16:06:48 2012 @@ -851,20 +851,32 @@ const lldb_private::ConstString &result_name, lldb_private::TypeFromParser result_type, Function &llvm_function, - Module &llvm_module) + Module &llvm_module, + lldb_private::Error &err) { - if (supportsFunction (llvm_function)) + if (supportsFunction (llvm_function, err)) return runOnFunction(result, result_name, result_type, llvm_function, - llvm_module); + llvm_module, + err); else return false; } +static const char *unsupported_opcode_error = "Interpreter doesn't handle one of the expression's opcodes"; +static const char *interpreter_initialization_error = "Interpreter couldn't be initialized"; +static const char *interpreter_internal_error = "Interpreter encountered an internal error"; +static const char *bad_value_error = "Interpreter couldn't resolve a value during execution"; +static const char *memory_allocation_error = "Interpreter couldn't allocate memory"; +static const char *memory_write_error = "Interpreter couldn't write to memory"; +static const char *memory_read_error = "Interpreter couldn't read from memory"; +static const char *infinite_loop_error = "Interpreter ran for too many cycles"; + bool -IRInterpreter::supportsFunction (Function &llvm_function) +IRInterpreter::supportsFunction (Function &llvm_function, + lldb_private::Error &err) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); @@ -882,6 +894,8 @@ { if (log) log->Printf("Unsupported instruction: %s", PrintValue(ii).c_str()); + err.SetErrorToGenericError(); + err.SetErrorString(unsupported_opcode_error); return false; } case Instruction::Add: @@ -895,7 +909,11 @@ ICmpInst *icmp_inst = dyn_cast(ii); if (!icmp_inst) + { + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; + } switch (icmp_inst->getPredicate()) { @@ -903,6 +921,9 @@ { if (log) log->Printf("Unsupported ICmp predicate: %s", PrintValue(ii).c_str()); + + err.SetErrorToGenericError(); + err.SetErrorString(unsupported_opcode_error); return false; } case CmpInst::ICMP_EQ: @@ -940,14 +961,19 @@ const lldb_private::ConstString &result_name, lldb_private::TypeFromParser result_type, Function &llvm_function, - Module &llvm_module) + Module &llvm_module, + lldb_private::Error &err) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); lldb_private::ClangExpressionDeclMap::TargetInfo target_info = m_decl_map.GetTargetInfo(); if (!target_info.IsValid()) + { + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_initialization_error); return false; + } lldb::addr_t alloc_min; lldb::addr_t alloc_max; @@ -955,7 +981,9 @@ switch (target_info.address_byte_size) { default: - return false; + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_initialization_error); + return false; case 4: alloc_min = 0x00001000llu; alloc_max = 0x0000ffffllu; @@ -968,9 +996,17 @@ TargetData target_data(&llvm_module); if (target_data.getPointerSize() != target_info.address_byte_size) + { + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_initialization_error); return false; + } if (target_data.isLittleEndian() != (target_info.byte_order == lldb::eByteOrderLittle)) + { + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_initialization_error); return false; + } Memory memory(target_data, m_decl_map, alloc_min, alloc_max); InterpreterStackFrame frame(target_data, memory, m_decl_map); @@ -1002,8 +1038,9 @@ { if (log) log->Printf("getOpcode() returns %s, but instruction is not a BinaryOperator", inst->getOpcodeName()); - - return false; + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); + return false; } Value *lhs = inst->getOperand(0); @@ -1016,7 +1053,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1024,7 +1062,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1070,7 +1109,8 @@ { if (log) log->Printf("getOpcode() returns Alloca, but instruction is not an AllocaInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1078,7 +1118,8 @@ { if (log) log->Printf("AllocaInsts are not handled if isArrayAllocation() is true"); - + err.SetErrorToGenericError(); + err.SetErrorString(unsupported_opcode_error); return false; } @@ -1096,7 +1137,8 @@ { if (log) log->Printf("Couldn't allocate memory for an AllocaInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_allocation_error); return false; } @@ -1106,7 +1148,8 @@ { if (log) log->Printf("Couldn't allocate the result pointer for an AllocaInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_allocation_error); return false; } @@ -1115,8 +1158,9 @@ if (P_encoder->PutAddress(0, R.m_base) == UINT32_MAX) { if (log) - log->Printf("Couldn't write the reseult pointer for an AllocaInst"); - + log->Printf("Couldn't write the result pointer for an AllocaInst"); + err.SetErrorToGenericError(); + err.SetErrorString(memory_write_error); return false; } @@ -1138,7 +1182,8 @@ { if (log) log->Printf("getOpcode() returns BitCast, but instruction is not a BitCastInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1150,7 +1195,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(source).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1165,7 +1211,8 @@ { if (log) log->Printf("getOpcode() returns Br, but instruction is not a BranchInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1179,7 +1226,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(condition).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1213,7 +1261,8 @@ { if (log) log->Printf("getOpcode() returns GetElementPtr, but instruction is not a GetElementPtrInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1223,8 +1272,14 @@ lldb_private::Scalar P; if (!frame.EvaluateValue(P, pointer_operand, llvm_module)) + { + if (log) + log->Printf("Couldn't evaluate %s", PrintValue(pointer_operand).c_str()); + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; - + } + SmallVector indices (gep_inst->idx_begin(), gep_inst->idx_end()); @@ -1250,7 +1305,8 @@ { if (log) log->Printf("getOpcode() returns ICmp, but instruction is not an ICmpInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1266,7 +1322,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1274,7 +1331,8 @@ { if (log) log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str()); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1335,7 +1393,8 @@ { if (log) log->Printf("getOpcode() returns IntToPtr, but instruction is not an IntToPtrInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1344,7 +1403,13 @@ lldb_private::Scalar I; if (!frame.EvaluateValue(I, src_operand, llvm_module)) + { + if (log) + log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str()); + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; + } frame.AssignValue(inst, I, llvm_module); @@ -1364,7 +1429,8 @@ { if (log) log->Printf("getOpcode() returns Load, but instruction is not a LoadInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1379,7 +1445,13 @@ Type *pointer_ty = pointer_operand->getType(); PointerType *pointer_ptr_ty = dyn_cast(pointer_ty); if (!pointer_ptr_ty) + { + if (log) + log->Printf("getPointerOperand()->getType() is not a PointerType"); + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; + } Type *target_ty = pointer_ptr_ty->getElementType(); Memory::Region D = frame.ResolveValue(load_inst, llvm_module); @@ -1389,7 +1461,8 @@ { if (log) log->Printf("LoadInst's value doesn't resolve to anything"); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1397,7 +1470,8 @@ { if (log) log->Printf("LoadInst's pointer doesn't resolve to anything"); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1415,7 +1489,8 @@ { if (log) log->Printf("Couldn't read from a region on behalf of a LoadInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_read_error); return false; } } @@ -1425,7 +1500,8 @@ { if (log) log->Printf("Couldn't read from a raw pointer on behalf of a LoadInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_read_error); return false; } } @@ -1458,7 +1534,8 @@ { if (log) log->Printf("getOpcode() returns Store, but instruction is not a StoreInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(interpreter_internal_error); return false; } @@ -1484,7 +1561,8 @@ { if (log) log->Printf("StoreInst's value doesn't resolve to anything"); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1492,7 +1570,8 @@ { if (log) log->Printf("StoreInst's pointer doesn't resolve to anything"); - + err.SetErrorToGenericError(); + err.SetErrorString(bad_value_error); return false; } @@ -1513,7 +1592,8 @@ { if (log) log->Printf("Couldn't write to a region on behalf of a LoadInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_write_error); return false; } } @@ -1523,7 +1603,8 @@ { if (log) log->Printf("Couldn't write to a raw pointer on behalf of a LoadInst"); - + err.SetErrorToGenericError(); + err.SetErrorString(memory_write_error); return false; } } @@ -1544,7 +1625,11 @@ } if (num_insts >= 4096) + { + err.SetErrorToGenericError(); + err.SetErrorString(infinite_loop_error); return false; - + } + return false; } From johnny.chen at apple.com Tue Jan 24 17:19:26 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 24 Jan 2012 23:19:26 -0000 Subject: [Lldb-commits] [lldb] r148876 - /lldb/trunk/source/Target/StopInfo.cpp Message-ID: <20120124231926.2F5712A6C12C@llvm.org> Author: johnny Date: Tue Jan 24 17:19:25 2012 New Revision: 148876 URL: http://llvm.org/viewvc/llvm-project?rev=148876&view=rev Log: Fix a typo in the error message of the StopInfoWatchpoint class. Modified: lldb/trunk/source/Target/StopInfo.cpp Modified: lldb/trunk/source/Target/StopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=148876&r1=148875&r2=148876&view=diff ============================================================================== --- lldb/trunk/source/Target/StopInfo.cpp (original) +++ lldb/trunk/source/Target/StopInfo.cpp Tue Jan 24 17:19:25 2012 @@ -534,7 +534,7 @@ { Debugger &debugger = context.exe_ctx.GetTargetRef().GetDebugger(); StreamSP error_sp = debugger.GetAsyncErrorStream (); - error_sp->Printf ("Stopped due to an error evaluating condition of breakpoint "); + error_sp->Printf ("Stopped due to an error evaluating condition of watchpoint "); wp_sp->GetDescription (error_sp.get(), eDescriptionLevelBrief); error_sp->Printf (": \"%s\"", wp_sp->GetConditionText()); From johnny.chen at apple.com Tue Jan 24 19:37:36 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 25 Jan 2012 01:37:36 -0000 Subject: [Lldb-commits] [lldb] r148899 - /lldb/trunk/test/functionalities/completion/TestCompletion.py Message-ID: <20120125013736.4B1822A6C12C@llvm.org> Author: johnny Date: Tue Jan 24 19:37:36 2012 New Revision: 148899 URL: http://llvm.org/viewvc/llvm-project?rev=148899&view=rev Log: Add some more test cases for command completion: o complete an unambiguous option o complete/list the available option values o complete/list the candidate command names Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148899&r1=148898&r2=148899&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Tue Jan 24 19:37:36 2012 @@ -18,6 +18,18 @@ system(["/bin/sh", "-c", "rm -f child_send.txt"]) system(["/bin/sh", "-c", "rm -f child_read.txt"]) + def test_frame_variable_dash_w(self): + """Test that 'frame variable -w' completes to 'frame variable -w '.""" + self.complete_from_to('frame variable -w', 'frame variable -w ') + + def test_frame_variable_dash_w_space(self): + """Test that 'frame variable -w ' completes to ['Available completions:', 'read', 'write', 'read_write'].""" + self.complete_from_to('frame variable -w ', ['Available completions:', 'read', 'write', 'read_write']) + + def test_help_fi(self): + """Test that 'help fi' completes to ['Available completions:', 'file', 'finish'].""" + self.complete_from_to('help fi', ['Available completions:', 'file', 'finish']) + def test_settings_append_target_er(self): """Test that 'settings append target.er' completes to 'settings append target.error-path'.""" self.complete_from_to('settings append target.er', 'settings append target.error-path') From gclayton at apple.com Tue Jan 24 21:20:34 2012 From: gclayton at apple.com (Greg Clayton) Date: Wed, 25 Jan 2012 03:20:34 -0000 Subject: [Lldb-commits] [lldb] r148911 - /lldb/trunk/scripts/disasm-gdb-remote.pl Message-ID: <20120125032035.063EE2A6C12C@llvm.org> Author: gclayton Date: Tue Jan 24 21:20:34 2012 New Revision: 148911 URL: http://llvm.org/viewvc/llvm-project?rev=148911&view=rev Log: Handle 's' packets correctly when disassembling GDB packet output. Modified: lldb/trunk/scripts/disasm-gdb-remote.pl Modified: lldb/trunk/scripts/disasm-gdb-remote.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/disasm-gdb-remote.pl?rev=148911&r1=148910&r2=148911&view=diff ============================================================================== --- lldb/trunk/scripts/disasm-gdb-remote.pl (original) +++ lldb/trunk/scripts/disasm-gdb-remote.pl Tue Jan 24 21:20:34 2012 @@ -506,7 +506,9 @@ 'k' => \&dump_kill_cmd, 'A' => \&dump_A_command, 'c' => \&dump_continue_cmd, + 's' => \&dump_continue_cmd, 'C' => \&dump_continue_with_signal_cmd, + 'S' => \&dump_continue_with_signal_cmd, '_M' => \&dump_allocate_memory_cmd, '_m' => \&dump_deallocate_memory_cmd, # extended commands @@ -521,6 +523,7 @@ our %rsp_callbacks = ( 'c' => \&dump_stop_reply_packet, + 's' => \&dump_stop_reply_packet, 'C' => \&dump_stop_reply_packet, '?' => \&dump_stop_reply_packet, 'T' => \&dump_thread_is_alive_rsp, @@ -1060,30 +1063,37 @@ } #---------------------------------------------------------------------- -# 'c' command +# 'c' or 's' command #---------------------------------------------------------------------- sub dump_continue_cmd { my $cmd = shift; + my $cmd_str; + $cmd eq 'c' and $cmd_str = 'continue'; + $cmd eq 's' and $cmd_str = 'step'; my $address = -1; if (@_) { my $address = get_addr(\@_); - printf("continue ($addr_format)\n", $address); + printf("%s ($addr_format)\n", $cmd_str, $address); } else { - printf("continue ()\n"); + printf("%s ()\n", $cmd_str); } } #---------------------------------------------------------------------- # 'Css' continue (C) with signal (ss where 'ss' is two hex digits) +# 'Sss' step (S) with signal (ss where 'ss' is two hex digits) #---------------------------------------------------------------------- sub dump_continue_with_signal_cmd { my $cmd = shift; my $address = -1; + my $cmd_str; + $cmd eq 'c' and $cmd_str = 'continue'; + $cmd eq 's' and $cmd_str = 'step'; my $signal = get_hex(\@_); if (@_) { @@ -1097,11 +1107,11 @@ if ($address != -1) { - printf("continue_with_signal (signal = 0x%2.2x, address = $addr_format)\n", $signal, $address); + printf("%s_with_signal (signal = 0x%2.2x, address = $addr_format)\n", $cmd_str, $signal, $address); } else { - printf("continue_with_signal (signal = 0x%2.2x)\n", $signal); + printf("%s_with_signal (signal = 0x%2.2x)\n", $cmd_str, $signal); } } From johnny.chen at apple.com Wed Jan 25 14:25:39 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 25 Jan 2012 20:25:39 -0000 Subject: [Lldb-commits] [lldb] r148971 - /lldb/trunk/test/functionalities/completion/TestCompletion.py Message-ID: <20120125202539.2989D2A6C12C@llvm.org> Author: johnny Date: Wed Jan 25 14:25:38 2012 New Revision: 148971 URL: http://llvm.org/viewvc/llvm-project?rev=148971&view=rev Log: Cleanup docstring and remove dead code. Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148971&r1=148970&r2=148971&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:25:38 2012 @@ -91,11 +91,10 @@ 'target.process.thread.trace-thread']) def complete_from_to(self, str_input, patterns): - """Test the completion mechanism completes str_input to pattern, where - patterns could be a pattern-string or a list of pattern-strings""" + """Test that the completion mechanism completes str_input to patterns, + where patterns could be a pattern-string or a list of pattern-strings""" + # The default lldb prompt. prompt = "(lldb) " - add_prompt = "Enter your stop hook command(s). Type 'DONE' to end.\r\n> " - add_prompt1 = "\r\n> " # So that the child gets torn down after the test. self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption)) From johnny.chen at apple.com Wed Jan 25 14:29:26 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 25 Jan 2012 20:29:26 -0000 Subject: [Lldb-commits] [lldb] r148972 - /lldb/trunk/test/functionalities/completion/TestCompletion.py Message-ID: <20120125202926.F14D62A6C12C@llvm.org> Author: johnny Date: Wed Jan 25 14:29:26 2012 New Revision: 148972 URL: http://llvm.org/viewvc/llvm-project?rev=148972&view=rev Log: Clearify some comment. Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148972&r1=148971&r2=148972&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:29:26 2012 @@ -112,7 +112,8 @@ child.sendline('') child.expect_exact(prompt) - # Set logfile to None to stop logging. + # Now that the necessary logging is done, restore logfile to None to + # stop further logging. child.logfile_send = None child.logfile_read = None From johnny.chen at apple.com Wed Jan 25 14:50:22 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 25 Jan 2012 20:50:22 -0000 Subject: [Lldb-commits] [lldb] r148974 - /lldb/trunk/test/functionalities/completion/TestCompletion.py Message-ID: <20120125205022.320B72A6C12C@llvm.org> Author: johnny Date: Wed Jan 25 14:50:21 2012 New Revision: 148974 URL: http://llvm.org/viewvc/llvm-project?rev=148974&view=rev Log: Move argument checking/manipulation into the front of the function. Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148974&r1=148973&r2=148974&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:50:21 2012 @@ -93,6 +93,15 @@ def complete_from_to(self, str_input, patterns): """Test that the completion mechanism completes str_input to patterns, where patterns could be a pattern-string or a list of pattern-strings""" + # Patterns should not be None in order to proceed. + self.assertFalse(patterns is None) + # And should be either a string or list of strings. Check for list type + # below, if not, make a list out of the singleton string. If patterns + # is not a string or not a list of strings, there'll be runtime errors + # later on. + if not isinstance(patterns, list): + patterns = [patterns] + # The default lldb prompt. prompt = "(lldb) " @@ -127,10 +136,6 @@ print "\n\nContents of child_read.txt:" print from_child - self.assertFalse(patterns is None) - if type(patterns) is not types.ListType: - patterns = [patterns] - # Test that str_input completes to our patterns. # If each pattern matches from_child, the completion mechanism works! for p in patterns: From gclayton at apple.com Wed Jan 25 15:52:15 2012 From: gclayton at apple.com (Greg Clayton) Date: Wed, 25 Jan 2012 21:52:15 -0000 Subject: [Lldb-commits] [lldb] r148983 - /lldb/trunk/scripts/disasm-gdb-remote.pl Message-ID: <20120125215215.661DE2A6C12C@llvm.org> Author: gclayton Date: Wed Jan 25 15:52:15 2012 New Revision: 148983 URL: http://llvm.org/viewvc/llvm-project?rev=148983&view=rev Log: If timestamps are enabled when logging GDB remote packets ("log enable -T -f /tmp/packets.log gdb-remote logs") then get the amount of time spent executing each packet and summarize at the end of a dump. Sample timing output looks like: ---------------------------------------------------------------------- Packet timing summary: ---------------------------------------------------------------------- Packet Time % ---------------------- -------- ------ qThreadStopInfo 0.363844 35.35 m 0.281967 27.39 s 0.147160 14.30 qfThreadInfo 0.070865 6.88 qsThreadInfo 0.061608 5.99 z 0.036796 3.57 Z 0.036271 3.52 c 0.018410 1.79 H 0.012418 1.21 ---------------------- -------- ------ Total 1.029339 100.00 Modified: lldb/trunk/scripts/disasm-gdb-remote.pl Modified: lldb/trunk/scripts/disasm-gdb-remote.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/disasm-gdb-remote.pl?rev=148983&r1=148982&r2=148983&view=diff ============================================================================== --- lldb/trunk/scripts/disasm-gdb-remote.pl (original) +++ lldb/trunk/scripts/disasm-gdb-remote.pl Wed Jan 25 15:52:15 2012 @@ -25,6 +25,12 @@ our $float64_href = { extract => \&get64, format => "0x%s" }; our $float96_href = { extract => \&get96, format => "0x%s" }; our $curr_cmd = undef; +our $curr_full_cmd = undef; +our %packet_times; +our $curr_time = 0.0; +our $last_time = 0.0; +our $base_time = 0.0; +our $packet_start_time = 0.0; our $reg_cmd_reg; our %reg_map = ( 'i386-gdb' => [ @@ -1829,8 +1835,22 @@ my $cmd_aref = shift; my $callback_ref; $curr_cmd = $$cmd_aref[0]; - $curr_cmd eq '_' and $curr_cmd .= $$cmd_aref[1]; - + + if ($curr_cmd eq 'q' or $curr_cmd eq 'Q' or $curr_cmd eq '_') + { + $curr_full_cmd = ''; + foreach my $ch (@$cmd_aref) + { + $ch !~ /[A-Za-z_]/ and last; + $curr_full_cmd .= $ch; + } + } + else + { + $curr_full_cmd = $curr_cmd; + } + + $curr_cmd eq '_' and $curr_cmd .= $$cmd_aref[1]; $callback_ref = $cmd_callbacks{$curr_cmd}; if ($callback_ref) { @@ -1874,6 +1894,19 @@ my $cmd_aref = shift; my $callback_ref; + if ($packet_start_time != 0.0) + { + if (length($curr_full_cmd) > 0) + { + $packet_times{$curr_full_cmd} += $curr_time - $packet_start_time; + } + else + { + $packet_times{$curr_cmd} += $curr_time - $packet_start_time; + } + $packet_start_time = 0.0; + } + $callback_ref = $rsp_callbacks{$curr_cmd}; if ($callback_ref) @@ -1956,16 +1989,41 @@ #---------------------------------------------------------------------- # Process a gdbserver log line by looking for getpkt and putkpt and # tossing any other lines. + #---------------------------------------------------------------------- sub process_log_line { my $line = shift; #($opt_v and $opt_g) and print "# $line"; + my $extract_cmd = 0; + my $delta_time = 0.0; + if ($line =~ /^(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$/) + { + my $leading_space = $1; + $curr_time = $2; + $line = $3; + if ($base_time == 0.0) + { + $base_time = $curr_time; + } + else + { + $delta_time = $curr_time - $last_time; + } + printf ("(%.6f, %+.6f): ", $curr_time - $base_time, $delta_time); + $last_time = $curr_time; + } + else + { + $curr_time = 0.0 + } + if ($line =~ /getpkt /) { $extract_cmd = 1; print "\n--> "; + $packet_start_time = $curr_time; } elsif ($line =~ /putpkt /) { @@ -1976,6 +2034,7 @@ { $opt_g and print "maintenance dump-packets command: $1\n"; my @raw_cmd_bytes = split(/ */, $1); + $packet_start_time = $curr_time; print "\n--> "; dump_raw_command(\@raw_cmd_bytes); process_log_line($2); @@ -1995,6 +2054,7 @@ $opt_g and print "command: $1\n"; my @raw_cmd_bytes = split(/ */, $1); print "--> "; + $packet_start_time = $curr_time; dump_raw_command(\@raw_cmd_bytes); } elsif ($1 =~ /\+/) @@ -2032,6 +2092,7 @@ $opt_g and print "command: $1\n"; my @raw_cmd_bytes = split(/ */, $1); print "--> "; + $packet_start_time = $curr_time; dump_raw_command(\@raw_cmd_bytes); } elsif ($1 =~ /\+/) @@ -2067,6 +2128,7 @@ $opt_g and print "command: $1\n"; my @raw_cmd_bytes = split(/ */, $1); print "\n--> "; + $packet_start_time = $curr_time; dump_raw_command(\@raw_cmd_bytes); process_log_line($2); } @@ -2083,6 +2145,7 @@ { my $beg = index($line, '("') + 2; my $end = rindex($line, '");'); + $packet_start_time = $curr_time; dump_command(substr($line, $beg, $end - $beg)); } } @@ -2096,6 +2159,38 @@ process_log_line($_); } +if (%packet_times) +{ + print "----------------------------------------------------------------------\n"; + print "Packet timing summary:\n"; + print "----------------------------------------------------------------------\n"; + print "Packet Time %\n"; + print "---------------------- -------- ------\n"; + my @packet_names = keys %packet_times; + my $total_packet_times = 0.0; + foreach my $key (@packet_names) + { + $total_packet_times += $packet_times{$key}; + } + + foreach my $value (sort {$packet_times{$b} cmp $packet_times{$a}} @packet_names) + { + my $percent = ($packet_times{$value} / $total_packet_times) * 100.0; + if ($percent < 10.0) + { + printf("%22s %1.6f %2.2f\n", $value, $packet_times{$value}, $percent); + + } + else + { + printf("%22s %1.6f %2.2f\n", $value, $packet_times{$value}, $percent); + } + } + print "---------------------- -------- ------\n"; + printf (" Total %1.6f 100.00\n", $total_packet_times); +} + + From johnny.chen at apple.com Wed Jan 25 17:08:23 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 25 Jan 2012 23:08:23 -0000 Subject: [Lldb-commits] [lldb] r148994 - /lldb/trunk/source/Breakpoint/Breakpoint.cpp Message-ID: <20120125230823.97A5E2A6C12C@llvm.org> Author: johnny Date: Wed Jan 25 17:08:23 2012 New Revision: 148994 URL: http://llvm.org/viewvc/llvm-project?rev=148994&view=rev Log: Typo. Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=148994&r1=148993&r2=148994&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed Jan 25 17:08:23 2012 @@ -126,7 +126,7 @@ // For each of the overall options we need to decide how they propagate to // the location options. This will determine the precedence of options on -// the breakpoint vrs. its locations. +// the breakpoint vs. its locations. // Disable at the breakpoint level should override the location settings. // That way you can conveniently turn off a whole breakpoint without messing From johnny.chen at apple.com Wed Jan 25 18:08:14 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 26 Jan 2012 00:08:14 -0000 Subject: [Lldb-commits] [lldb] r149002 - /lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Message-ID: <20120126000814.42C4C2A6C12C@llvm.org> Author: johnny Date: Wed Jan 25 18:08:14 2012 New Revision: 149002 URL: http://llvm.org/viewvc/llvm-project?rev=149002&view=rev Log: For Dump(Stream *s), use GetOptionsNoCreate()->GetIgnoreCount() and fix the indentation. Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=149002&r1=149001&r2=149002&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Jan 25 18:08:14 2012 @@ -414,12 +414,12 @@ s->Printf("BreakpointLocation %u: tid = %4.4llx load addr = 0x%8.8llx state = %s type = %s breakpoint " "hw_index = %i hit_count = %-4u ignore_count = %-4u", - GetID(), - GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(), - (uint64_t) m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()), - (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled", - IsHardware() ? "hardware" : "software", - GetHardwareIndex(), - GetHitCount(), - m_options_ap.get() ? m_options_ap->GetIgnoreCount() : m_owner.GetIgnoreCount()); + GetID(), + GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(), + (uint64_t) m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()), + (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled", + IsHardware() ? "hardware" : "software", + GetHardwareIndex(), + GetHitCount(), + GetOptionsNoCreate()->GetIgnoreCount()); } From gclayton at apple.com Wed Jan 25 18:32:22 2012 From: gclayton at apple.com (Greg Clayton) Date: Thu, 26 Jan 2012 00:32:22 -0000 Subject: [Lldb-commits] [lldb] r149004 - /lldb/trunk/www/python-reference.html Message-ID: <20120126003222.BAF802A6C12C@llvm.org> Author: gclayton Date: Wed Jan 25 18:32:22 2012 New Revision: 149004 URL: http://llvm.org/viewvc/llvm-project?rev=149004&view=rev Log: Fix page title. Modified: lldb/trunk/www/python-reference.html Modified: lldb/trunk/www/python-reference.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=149004&r1=149003&r2=149004&view=diff ============================================================================== --- lldb/trunk/www/python-reference.html (original) +++ lldb/trunk/www/python-reference.html Wed Jan 25 18:32:22 2012 @@ -3,12 +3,12 @@ -LLDB Python FAQ +LLDB Python Reference
    - LLDB Python FAQ + LLDB Python Reference
    From gclayton at apple.com Wed Jan 25 20:56:25 2012 From: gclayton at apple.com (Greg Clayton) Date: Thu, 26 Jan 2012 02:56:25 -0000 Subject: [Lldb-commits] [lldb] r149030 - in /lldb/trunk/examples/python: cmdtemplate.py gdbremote.py Message-ID: <20120126025625.1B5442A6C12C@llvm.org> Author: gclayton Date: Wed Jan 25 20:56:24 2012 New Revision: 149030 URL: http://llvm.org/viewvc/llvm-project?rev=149030&view=rev Log: Added a 'gdbremote' python module that adds two commands: start_gdb_log and end_gdb_log. When this is imported into your lldb using the "command script import /path/to/gdbremote.py" these new commands are available within LLDB. 'start_gdb_log' will enable logging with timestamps for GDB remote packets, and 'stop_gdb_log' will then dump the details and also a lot of packet timing data. This allows us to accurately track what packets are taking up the most time when debugging (when using the ProcessGDBRemote debugging plug-in). Also udpated the comments at the top of the cmdtemplate.py to show how to correctly import the module from within LLDB. Added: lldb/trunk/examples/python/gdbremote.py (with props) Modified: lldb/trunk/examples/python/cmdtemplate.py Modified: lldb/trunk/examples/python/cmdtemplate.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/cmdtemplate.py?rev=149030&r1=149029&r2=149030&view=diff ============================================================================== --- lldb/trunk/examples/python/cmdtemplate.py (original) +++ lldb/trunk/examples/python/cmdtemplate.py Wed Jan 25 20:56:24 2012 @@ -3,10 +3,10 @@ #---------------------------------------------------------------------- # Be sure to add the python path that points to the LLDB shared library. # -# To use this in the embedded python interpreter using "lldb": -# % cd /path/containing/cmdtemplate.py -# % lldb -# (lldb) script import cmdtemplate +# # To use this in the embedded python interpreter using "lldb" just +# import it with the full path using the "command script import" +# command +# (lldb) command script import /path/to/cmdtemplate.py # # For the shells csh, tcsh: # ( setenv PYTHONPATH /path/to/LLDB.framework/Resources/Python ; ./cmdtemplate.py ) Added: lldb/trunk/examples/python/gdbremote.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=149030&view=auto ============================================================================== --- lldb/trunk/examples/python/gdbremote.py (added) +++ lldb/trunk/examples/python/gdbremote.py Wed Jan 25 20:56:24 2012 @@ -0,0 +1,184 @@ +#!/usr/bin/python + +#---------------------------------------------------------------------- +# This module will enable GDB remote packet logging when the +# 'start_gdb_log' command is called with a filename to log to. When the +# 'stop_gdb_log' command is called, it will disable the logging and +# print out statistics about how long commands took to execute and also +# will primnt ou +# Be sure to add the python path that points to the LLDB shared library. +# +# To use this in the embedded python interpreter using "lldb" just +# import it with the full path using the "command script import" +# command. This can be done from the LLDB command line: +# (lldb) command script import /path/to/gdbremote.py +# Or it can be added to your ~/.lldbinit file so this module is always +# available. +#---------------------------------------------------------------------- + +import commands +import optparse +import os +import shlex +import re +import tempfile + +log_file = '' + +def start_gdb_log(debugger, command, result, dict): + '''Start logging GDB remote packets by enabling logging with timestamps and + thread safe logging. Follow a call to this function with a call to "stop_gdb_log" + in order to dump out the commands.''' + global log_file + command_args = shlex.split(command) + usage = "usage: start_gdb_log [options] []" + description='''The command enables GDB remote packet logging with timestamps. The packets will be logged to if supplied, or a temporary file will be used. Logging stops when stop_gdb_log is called and the packet times will + be aggregated and displayed.''' + parser = optparse.OptionParser(description=description, prog='start_gdb_log',usage=usage) + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False) + try: + (options, args) = parser.parse_args(command_args) + except: + return + + if log_file: + result.PutCString ('error: logging is already in progress with file "%s"', log_file) + else: + args_len = len(args) + if args_len == 0: + log_file = tempfile.mktemp() + elif len(args) == 1: + log_file = args[0] + + if log_file: + debugger.HandleCommand('log enable --threadsafe --timestamp --file "%s" gdb-remote packets' % log_file); + result.PutCString ("GDB packet logging enable with log file '%s'\nUse the 'stop_gdb_log' command to stop logging and show packet statistics." % log_file) + return + + result.PutCString ('error: invalid log file path') + result.PutCString (usage) + +def stop_gdb_log(debugger, command, result, dict): + '''Stop logging GDB remote packets to the file that was specified in a call + to "start_gdb_log" and normalize the timestamps to be relative to the first + timestamp in the log file. Also print out statistics for how long each + command took to allow performance bottlenecks to be determined.''' + global log_file + # Any commands whose names might be followed by more valid C identifier + # characters must be listed here + command_args = shlex.split(command) + usage = "usage: stop_gdb_log [options]" + description='''The command stops a previously enabled GDB remote packet logging command. Packet logging must have been previously enabled with a call to start_gdb_log.''' + parser = optparse.OptionParser(description=description, prog='stop_gdb_log',usage=usage) + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False) + parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='display verbose debug info', default=False) + try: + (options, args) = parser.parse_args(command_args) + except: + return + + if not log_file: + result.PutCString ('error: logging must have been previously enabled with a call to "stop_gdb_log"') + elif os.path.exists (log_file): + if len(args) == 0: + debugger.HandleCommand('log disable gdb-remote packets'); + result.PutCString ("GDB packet logging disabled. Logged packets are in '%s'" % log_file) + parse_gdb_log_file (log_file, options) + log_file = None + else: + result.PutCString (usage) + else: + print 'error: the GDB packet log file "%s" does not exist' % log_file + +def parse_gdb_log_file(file, options): + '''Parse a GDB log file that was generated by enabling logging with: + (lldb) log enable --threadsafe --timestamp --file gdb-remote packets + This log file will contain timestamps and this fucntion will then normalize + those packets to be relative to the first value timestamp that is found and + show delta times between log lines and also keep track of how long it takes + for GDB remote commands to make a send/receive round trip. This can be + handy when trying to figure out why some operation in the debugger is taking + a long time during a preset set of debugger commands.''' + + tricky_commands = [ 'qRegisterInfo' ] + timestamp_regex = re.compile('(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$') + packet_name_regex = re.compile('([A-Za-z_]+)[^a-z]') + base_time = 0.0 + last_time = 0.0 + packet_send_time = 0.0 + packet_name = None + packet_total_times = {} + file = open(file) + lines = file.read().splitlines() + for line in lines: + match = timestamp_regex.match (line) + if match: + curr_time = float (match.group(2)) + delta = 0.0 + if base_time: + delta = curr_time - last_time + else: + base_time = curr_time + idx = line.find('send packet: $') + if idx >= 0: + packet_send_time = curr_time + packet_match = packet_name_regex.match (line[idx+14:]) + if packet_match: + packet_name = packet_match.group(1) + for tricky_cmd in tricky_commands: + if packet_name.find (tricky_cmd) == 0: + packet_name = tricky_cmd + elif line.find('read packet: $') >= 0 and packet_name: + if packet_name in packet_total_times: + packet_total_times[packet_name] += delta + else: + packet_total_times[packet_name] = delta + packet_name = None + + if not options or not options.quiet: + print '%s%.6f %+.6f%s' % (match.group(1), curr_time - base_time, delta, match.group(3)) + last_time = curr_time + else: + print line + if packet_total_times: + total_packet_time = 0.0 + for key, vvv in packet_total_times.items(): + # print ' key = (%s) "%s"' % (type(key), key) + # print 'value = (%s) %s' % (type(vvv), vvv) + # if type(vvv) == 'float': + total_packet_time += vvv + print '#--------------------------------------------' + print '# Packet timing summary:' + print '#--------------------------------------------' + print '# Packet Time (sec) Percent' + print '#------------------------- ---------- -------' + res = sorted(packet_total_times, key=packet_total_times.__getitem__, reverse=True) + if last_time > 0.0: + for item in res: + packet_total_time = packet_total_times[item] + packet_percent = (packet_total_time / total_packet_time)*100.0 + if packet_percent >= 10.0: + print " %24s %.6f %.2f%%" % (item, packet_total_time, packet_percent) + else: + print " %24s %.6f %.2f%%" % (item, packet_total_time, packet_percent) + + + +if __name__ == '__main__': + import sys + # This script is being run from the command line, create a debugger in case we are + # going to use any debugger functions in our function. + for file in sys.argv: + print '#----------------------------------------------------------------------' + print "# GDB remote log file: '%s'" % file + print '#----------------------------------------------------------------------' + parse_gdb_log_file (file, None) + +else: + import lldb + if lldb.debugger: + # This initializer is being run from LLDB in the embedded command interpreter + # Add any commands contained in this module to LLDB + lldb.debugger.HandleCommand('command script add -f gdbremote.start_gdb_log start_gdb_log') + lldb.debugger.HandleCommand('command script add -f gdbremote.stop_gdb_log stop_gdb_log') + print 'The "start_gdb_log" and "stop_gdb_log" commands are now installed and ready for use, type "start_gdb_log --help" or "stop_gdb_log --help" for more information' Propchange: lldb/trunk/examples/python/gdbremote.py ------------------------------------------------------------------------------ svn:executable = * From gclayton at apple.com Wed Jan 25 23:36:07 2012 From: gclayton at apple.com (Greg Clayton) Date: Thu, 26 Jan 2012 05:36:07 -0000 Subject: [Lldb-commits] [lldb] r149046 - /lldb/trunk/www/python-reference.html Message-ID: <20120126053607.D90092A6C12C@llvm.org> Author: gclayton Date: Wed Jan 25 23:36:07 2012 New Revision: 149046 URL: http://llvm.org/viewvc/llvm-project?rev=149046&view=rev Log: Added some clarifications about when the __lldb_init_module would be called and showed a work around for when this won't. Modified: lldb/trunk/www/python-reference.html Modified: lldb/trunk/www/python-reference.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=149046&r1=149045&r2=149046&view=diff ============================================================================== --- lldb/trunk/www/python-reference.html (original) +++ lldb/trunk/www/python-reference.html Wed Jan 25 23:36:07 2012 @@ -318,13 +318,34 @@ don't have to change your PYTHONPATH for temporary scripts. It also has another convenience that if your new script module has a function of the form:

    -
    def __lldb_module_init(debugger, dict):
    -          # Command Initialization code goes here
    -          
    +
    def __lldb_module_init(debugger, dict):
    +    # Command Initialization code goes here
    +

    where debugger and dict are as above, that function will get run when the module is loaded - allowing you to add whatever commands you want into the current debugger.

    -

    Now we can create a module called ls.py that will implement a function that + allowing you to add whatever commands you want into the current debugger. Note that + this function will only be run when using the LLDB comand command script import, + it will not get run if anyone imports your module from another module. + If you want to always run code when your module is loaded from LLDB + or when loaded via an import statement in python code + you can test the lldb.debugger object, since you imported the + module at the top of the python ls.py module. This test + must be in code that isn't contained inside of any function or class, + just like the standard test for __main__ like all python modules + usally do. Sample code would look like: + +

    if __name__ == '__main__':
    +    # Create a new debugger instance in your module if your module 
    +    # can be run from the command line. When we run a script from
    +    # the command line, we won't have any debugger object in
    +    # lldb.debugger, so we can just create it if it will be needed
    +    lldb.debugger = lldb.SBDebugger.Create()
    +elif lldb.debugger:
    +    # Module is being run inside the LLDB interpreter
    +    lldb.debugger.HandleCommand('command script add -f ls.ls ls')
    +    print 'The "ls" python command has been installed and is ready for use.'
    +
    +

    Now we can create a module called ls.py in the file ~/ls.py that will implement a function that can be used by LLDB's python command code:

    #!/usr/bin/python
    @@ -344,7 +365,7 @@
     

    Now we can load the module into LLDB and use it

    % lldb
    -(lldb) command script import ls
    +(lldb) command script import ~/ls.py
     The "ls" python command has been installed and is ready for use.
     (lldb) ls -l /tmp/
     total 365848
    
    
    
    From gclayton at apple.com  Thu Jan 26 15:08:31 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Thu, 26 Jan 2012 21:08:31 -0000
    Subject: [Lldb-commits] [lldb] r149080 - in /lldb/trunk:
     include/lldb/Core/ValueObject.h source/Commands/CommandObjectExpression.cpp
     source/Commands/CommandObjectFrame.cpp
     source/Commands/CommandObjectMemory.cpp
     source/Commands/CommandObjectTarget.cpp source/Core/ValueObject.cpp
    Message-ID: <20120126210831.33D6C2A6C12C@llvm.org>
    
    Author: gclayton
    Date: Thu Jan 26 15:08:30 2012
    New Revision: 149080
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149080&view=rev
    Log:
    Fixed formats being able to be applied recursively when using:
    target variable -f  [args]
    frame variable -f  [args]
    expression -f  -- expr
    
    
    Modified:
        lldb/trunk/include/lldb/Core/ValueObject.h
        lldb/trunk/source/Commands/CommandObjectExpression.cpp
        lldb/trunk/source/Commands/CommandObjectFrame.cpp
        lldb/trunk/source/Commands/CommandObjectMemory.cpp
        lldb/trunk/source/Commands/CommandObjectTarget.cpp
        lldb/trunk/source/Core/ValueObject.cpp
    
    Modified: lldb/trunk/include/lldb/Core/ValueObject.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/ValueObject.h (original)
    +++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Jan 26 15:08:30 2012
    @@ -216,19 +216,21 @@
             bool m_flat_output;
             uint32_t m_omit_summary_depth;
             bool m_ignore_cap;
    +        lldb::Format m_override_format;
             
             DumpValueObjectOptions() :
    -        m_ptr_depth(0),
    -        m_max_depth(UINT32_MAX),
    -        m_show_types(false),
    -        m_show_location(false),
    -        m_use_objc(false),
    -        m_use_dynamic(lldb::eNoDynamicValues),
    -        m_use_synthetic(lldb::eUseSyntheticFilter),
    -        m_scope_already_checked(false),
    -        m_flat_output(false),
    -        m_omit_summary_depth(0),
    -        m_ignore_cap(false)
    +            m_ptr_depth(0),
    +            m_max_depth(UINT32_MAX),
    +            m_show_types(false),
    +            m_show_location(false),
    +            m_use_objc(false),
    +            m_use_dynamic(lldb::eNoDynamicValues),
    +            m_use_synthetic(lldb::eUseSyntheticFilter),
    +            m_scope_already_checked(false),
    +            m_flat_output(false),
    +            m_omit_summary_depth(0),
    +            m_ignore_cap(false), 
    +            m_override_format (lldb::eFormatDefault)
             {}
             
             static const DumpValueObjectOptions
    @@ -829,7 +831,8 @@
         static void
         DumpValueObject (Stream &s,
                          ValueObject *valobj,
    -                     const DumpValueObjectOptions& options)
    +                     const DumpValueObjectOptions& options,
    +                     lldb::Format format = lldb::eFormatDefault)
         {
             
             if (!valobj)
    @@ -849,14 +852,16 @@
                                          options.m_scope_already_checked,
                                          options.m_flat_output,
                                          options.m_omit_summary_depth,
    -                                     options.m_ignore_cap);
    +                                     options.m_ignore_cap,
    +                                     format);
         }
                          
         static void
         DumpValueObject (Stream &s,
                          ValueObject *valobj,
                          const char *root_valobj_name,
    -                     const DumpValueObjectOptions& options)
    +                     const DumpValueObjectOptions& options,
    +                     lldb::Format format = lldb::eFormatDefault)
         {
             
             if (!valobj)
    @@ -876,7 +881,8 @@
                                          options.m_scope_already_checked,
                                          options.m_flat_output,
                                          options.m_omit_summary_depth,
    -                                     options.m_ignore_cap);
    +                                     options.m_ignore_cap,
    +                                     format);
         }
         
         static void
    @@ -894,7 +900,8 @@
                          bool scope_already_checked,
                          bool flat_output,
                          uint32_t omit_summary_depth,
    -                     bool ignore_cap);
    +                     bool ignore_cap,
    +                     lldb::Format format = lldb::eFormatDefault);
         
         // returns true if this is a char* or a char[]
         // if it is a char* and check_pointer is true,
    
    Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Jan 26 15:08:30 2012
    @@ -368,7 +368,8 @@
                                                   true,                     // Scope is already checked. Const results are always in scope.
                                                   false,                    // Don't flatten output
                                                   0,                        // Always use summaries (you might want an option --no-summary like there is for frame variable)
    -                                              false);                   // Do not show more children than settings allow
    +                                              false,                    // Do not show more children than settings allow
    +                                              format);                  // Format override
                     if (result)
                         result->SetStatus (eReturnStatusSuccessFinishResult);
                 }
    
    Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jan 26 15:08:30 2012
    @@ -476,8 +476,8 @@
                                             valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
                                             if (valobj_sp)
                                             {
    -                                            if (format != eFormatDefault)
    -                                                valobj_sp->SetFormat (format);
    +//                                            if (format != eFormatDefault)
    +//                                                valobj_sp->SetFormat (format);
                                                 
                                                 if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
                                                 {
    @@ -490,7 +490,8 @@
                                                     valobj_sp->SetCustomSummaryFormat(summary_format_sp);
                                                 ValueObject::DumpValueObject (result.GetOutputStream(), 
                                                                               valobj_sp.get(),
    -                                                                          options);
    +                                                                          options,
    +                                                                          format);
                                             }
                                         }
                                     }
    @@ -521,8 +522,8 @@
                                                                                   error);
                             if (valobj_sp)
                             {
    -                            if (format != eFormatDefault)
    -                                valobj_sp->SetFormat (format);
    +//                            if (format != eFormatDefault)
    +//                                valobj_sp->SetFormat (format);
                                 if (m_option_variable.show_decl && var_sp && var_sp->GetDeclaration ().GetFile())
                                 {
                                     var_sp->GetDeclaration ().DumpStopContext (&s, false);
    @@ -535,7 +536,8 @@
                                 ValueObject::DumpValueObject (output_stream, 
                                                               valobj_sp.get(), 
                                                               valobj_sp->GetParent() ? name_cstr : NULL,
    -                                                          options);
    +                                                          options,
    +                                                          format);
                                 // Process watchpoint if necessary.
                                 if (m_option_watchpoint.watch_variable)
                                 {
    @@ -639,8 +641,8 @@
                                                                                    m_varobj_options.use_dynamic);
                                 if (valobj_sp)
                                 {
    -                                if (format != eFormatDefault)
    -                                    valobj_sp->SetFormat (format);
    +//                                if (format != eFormatDefault)
    +//                                    valobj_sp->SetFormat (format);
     
                                     // When dumping all variables, don't print any variables
                                     // that are not in scope to avoid extra unneeded output
    @@ -656,7 +658,8 @@
                                         ValueObject::DumpValueObject (result.GetOutputStream(), 
                                                                       valobj_sp.get(), 
                                                                       name_cstr,
    -                                                                  options);
    +                                                                  options,
    +                                                                  format);
                                     }
                                 }
                             }
    
    Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Thu Jan 26 15:08:30 2012
    @@ -705,7 +705,8 @@
                                                       scope_already_checked,
                                                       m_varobj_options.flat_output,
                                                       m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth,
    -                                                  m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap);
    +                                                  m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap,
    +                                                  format);
                     }
                     else
                     {
    
    Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Jan 26 15:08:30 2012
    @@ -593,7 +593,8 @@
             ValueObject::DumpValueObject (s, 
                                           valobj_sp.get(), 
                                           root_name,
    -                                      options);                                        
    +                                      options,
    +                                      format);                                        
     
         }
         
    
    Modified: lldb/trunk/source/Core/ValueObject.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=149080&r1=149079&r2=149080&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ValueObject.cpp (original)
    +++ lldb/trunk/source/Core/ValueObject.cpp Thu Jan 26 15:08:30 2012
    @@ -2979,7 +2979,8 @@
         bool scope_already_checked,
         bool flat_output,
         uint32_t omit_summary_depth,
    -    bool ignore_cap
    +    bool ignore_cap,
    +    Format format_override       // Normally the format is in the valobj, but we might want to override this
     )
     {
         if (valobj)
    @@ -3064,6 +3065,7 @@
                 }
             }
             
    +        std::string value_str;
             const char *val_cstr = NULL;
             const char *sum_cstr = NULL;
             SummaryFormat* entry = valobj->GetSummaryFormat().get();
    @@ -3071,9 +3073,26 @@
             if (omit_summary_depth > 0)
                 entry = NULL;
             
    +        Format orig_format = kNumFormats;
             if (err_cstr == NULL)
             {
    +            if (format_override != eFormatDefault)
    +            {
    +                orig_format = valobj->GetFormat();
    +                valobj->SetFormat (format_override);
    +            }
                 val_cstr = valobj->GetValueAsCString();
    +            if (val_cstr)
    +            {
    +                // Cache the value in our own storage as running summaries might
    +                // change our value from underneath us
    +                value_str = val_cstr;
    +            }
    +            if (orig_format != kNumFormats && orig_format != format_override)
    +            {
    +                valobj->SetFormat (orig_format);
    +                orig_format = kNumFormats;
    +            }
                 err_cstr = valobj->GetError().AsCString();
             }
     
    @@ -3086,13 +3105,13 @@
                 const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference);
                 if (print_valobj)
                 {
    -                
    -                sum_cstr = (omit_summary_depth == 0) ? valobj->GetSummaryAsCString() : NULL;
    +                if (omit_summary_depth == 0)
    +                    sum_cstr = valobj->GetSummaryAsCString();
     
    -                // We must calculate this value in realtime because entry might alter this variable's value
    -                // (e.g. by saying ${var%fmt}) and render precached values useless
    -                if (val_cstr && (!entry || entry->DoesPrintValue() || !sum_cstr))
    -                    s.Printf(" %s", valobj->GetValueAsCString());
    +                // Make sure we have a value and make sure the summary didn't
    +                // specify that the value should not be printed
    +                if (!value_str.empty() && (entry == NULL || entry->DoesPrintValue() || sum_cstr == NULL))
    +                    s.Printf(" %s", value_str.c_str());
     
                     if (sum_cstr)
                     {
    @@ -3199,7 +3218,8 @@
                                                      true,
                                                      flat_output,
                                                      omit_summary_depth > 1 ? omit_summary_depth - 1 : 0,
    -                                                 ignore_cap);
    +                                                 ignore_cap,
    +                                                 format_override);
                                 }
                             }
     
    
    
    
    From gclayton at apple.com  Thu Jan 26 18:13:27 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 00:13:27 -0000
    Subject: [Lldb-commits] [lldb] r149098 - in /lldb/trunk:
     include/lldb/API/SBCommandInterpreter.h
     include/lldb/Interpreter/ScriptInterpreter.h
     scripts/Python/interface/SBCommandInterpreter.i
     source/API/SBCommandInterpreter.cpp
     source/Interpreter/ScriptInterpreter.cpp
     source/Interpreter/ScriptInterpreterPython.cpp
    Message-ID: <20120127001327.D3CA12A6C12C@llvm.org>
    
    Author: gclayton
    Date: Thu Jan 26 18:13:27 2012
    New Revision: 149098
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149098&view=rev
    Log:
    
    
    Remove a pseudo terminal master open and slave file descriptor that was being
    used for pythong stdin. It was not hooked up correctly and was causing file
    descriptor leaks.
    
    
    Modified:
        lldb/trunk/include/lldb/API/SBCommandInterpreter.h
        lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
        lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
        lldb/trunk/source/API/SBCommandInterpreter.cpp
        lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
        lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    
    Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
    +++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Thu Jan 26 18:13:27 2012
    @@ -65,12 +65,6 @@
         lldb::SBProcess
         GetProcess ();
     
    -    ssize_t
    -    WriteToScriptInterpreter (const char *src);
    -
    -    ssize_t
    -    WriteToScriptInterpreter (const char *src, size_t src_len);
    -
         void
         SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
     
    
    Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
    +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Thu Jan 26 18:13:27 2012
    @@ -240,18 +240,6 @@
     protected:
         CommandInterpreter &m_interpreter;
         lldb::ScriptLanguage m_script_lang;
    -
    -    // Scripting languages may need to use stdin for their interactive loops;
    -    // however we don't want them to grab the real system stdin because that
    -    // resource needs to be shared among the debugger UI, the inferior process and these
    -    // embedded scripting loops.  Therefore we need to set up a pseudoterminal and use that
    -    // as stdin for the script interpreter interactive loops/prompts.
    -
    -    lldb_utility::PseudoTerminal m_interpreter_pty; // m_session_pty
    -    std::string m_pty_slave_name;                   //m_session_pty_slave_name
    -
    -private:
    -
     };
     
     } // namespace lldb_private
    
    Modified: lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i Thu Jan 26 18:13:27 2012
    @@ -99,14 +99,6 @@
         lldb::SBProcess
         GetProcess ();
     
    -#if 0
    -    ssize_t
    -    WriteToScriptInterpreter (const char *src);
    -#endif
    -
    -    ssize_t
    -    WriteToScriptInterpreter (const char *src, size_t src_len);
    -
         void
         SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
     
    
    Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
    +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu Jan 26 18:13:27 2012
    @@ -208,32 +208,6 @@
         return process;
     }
     
    -ssize_t
    -SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
    -{
    -    return WriteToScriptInterpreter (src, strlen(src));
    -}
    -
    -ssize_t
    -SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
    -{
    -    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    -
    -    ssize_t bytes_written = 0;
    -    if (m_opaque_ptr && src && src[0])
    -    {
    -        ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter();
    -        if (script_interpreter)
    -            bytes_written = ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len);
    -    }
    -    if (log)
    -        log->Printf ("SBCommandInterpreter(%p)::WriteToScriptInterpreter (src=\"%s\", src_len=%zu) => %zi", 
    -                     m_opaque_ptr, src, src_len, bytes_written);
    -
    -    return bytes_written;
    -}
    -
    -
     CommandInterpreter *
     SBCommandInterpreter::get ()
     {
    
    Modified: lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreter.cpp?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/source/Interpreter/ScriptInterpreter.cpp (original)
    +++ lldb/trunk/source/Interpreter/ScriptInterpreter.cpp Thu Jan 26 18:13:27 2012
    @@ -25,21 +25,12 @@
     
     ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
         m_interpreter (interpreter),
    -    m_script_lang (script_lang),
    -    m_interpreter_pty (),
    -    m_pty_slave_name ()
    +    m_script_lang (script_lang)
     {
    -    if (m_interpreter_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0))
    -    {
    -        const char *slave_name = m_interpreter_pty.GetSlaveName(NULL, 0);
    -        if (slave_name)
    -            m_pty_slave_name.assign(slave_name);
    -    }
     }
     
     ScriptInterpreter::~ScriptInterpreter ()
     {
    -    m_interpreter_pty.CloseMasterFileDescriptor();
     }
     
     CommandInterpreter &
    @@ -48,18 +39,6 @@
         return m_interpreter;
     }
     
    -const char *
    -ScriptInterpreter::GetScriptInterpreterPtyName ()
    -{
    -    return m_pty_slave_name.c_str();
    -}
    -
    -int
    -ScriptInterpreter::GetMasterFileDescriptor ()
    -{
    -    return m_interpreter_pty.GetMasterFileDescriptor();
    -}
    -
     void 
     ScriptInterpreter::CollectDataForBreakpointCommandCallback 
     (
    
    Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149098&r1=149097&r2=149098&view=diff
    ==============================================================================
    --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
    +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Thu Jan 26 18:13:27 2012
    @@ -187,7 +187,6 @@
         m_dictionary_name (interpreter.GetDebugger().GetInstanceName().AsCString()),
         m_terminal_state (),
         m_session_is_active (false),
    -    m_pty_slave_is_open (false),
         m_valid_session (true)
     {
     
    @@ -262,7 +261,6 @@
         {
             m_embedded_thread_input_reader_sp->SetIsDone (true);
             m_embedded_python_pty.CloseSlaveFileDescriptor();
    -        m_pty_slave_is_open = false;
             const InputReaderSP reader_sp = m_embedded_thread_input_reader_sp;
             m_embedded_thread_input_reader_sp.reset();
             debugger.PopInputReader (reader_sp);
    @@ -348,14 +346,14 @@
             run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')", 
                                m_dictionary_name.c_str());
         else
    -        run_string.Printf ("run_one_line (%s, 'lldb.target = None')", m_dictionary_name.c_str());
    +        run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.SBTarget()')", m_dictionary_name.c_str());
         PyRun_SimpleString (run_string.GetData());
         run_string.Clear();
     
         if (exe_ctx.GetProcessPtr())
             run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
         else
    -        run_string.Printf ("run_one_line (%s, 'lldb.process = None')", m_dictionary_name.c_str());
    +        run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.SBProcess()')", m_dictionary_name.c_str());
         PyRun_SimpleString (run_string.GetData());
         run_string.Clear();
     
    @@ -363,7 +361,7 @@
             run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')", 
                                m_dictionary_name.c_str());
         else
    -        run_string.Printf ("run_one_line (%s, 'lldb.thread = None')", m_dictionary_name.c_str());
    +        run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.SBThread()')", m_dictionary_name.c_str());
         PyRun_SimpleString (run_string.GetData());
         run_string.Clear();
         
    @@ -371,7 +369,7 @@
             run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')", 
                                m_dictionary_name.c_str());
         else
    -        run_string.Printf ("run_one_line (%s, 'lldb.frame = None')", m_dictionary_name.c_str());
    +        run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.SBFrame()')", m_dictionary_name.c_str());
         PyRun_SimpleString (run_string.GetData());
         run_string.Clear();
         
    @@ -385,19 +383,6 @@
                 
         if (PyErr_Occurred())
             PyErr_Clear ();
    -        
    -    if (!m_pty_slave_is_open)
    -    {
    -        run_string.Clear();
    -        run_string.Printf ("run_one_line (%s, \"new_stdin = open('%s', 'r')\")", m_dictionary_name.c_str(),
    -                           m_pty_slave_name.c_str());
    -        PyRun_SimpleString (run_string.GetData());
    -        m_pty_slave_is_open = true;
    -        
    -        run_string.Clear();
    -        run_string.Printf ("run_one_line (%s, 'sys.stdin = new_stdin')", m_dictionary_name.c_str());
    -        PyRun_SimpleString (run_string.GetData());
    -    }
     }   
     
     
    @@ -1651,8 +1636,6 @@
         
         script_interpreter->m_embedded_python_pty.CloseSlaveFileDescriptor();
     
    -    script_interpreter->m_pty_slave_is_open = false;
    -    
         log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SCRIPT);
         if (log)
             log->Printf ("%p ScriptInterpreterPython::RunEmbeddedPythonInterpreter () thread exiting...", baton);
    
    
    
    From gclayton at apple.com  Thu Jan 26 18:46:15 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 00:46:15 -0000
    Subject: [Lldb-commits] [lldb] r149103 - in /lldb/trunk:
     include/lldb/Core/ConnectionFileDescriptor.h
     source/Core/ConnectionFileDescriptor.cpp
    Message-ID: <20120127004615.8311B2A6C12C@llvm.org>
    
    Author: gclayton
    Date: Thu Jan 26 18:46:15 2012
    New Revision: 149103
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149103&view=rev
    Log:
    
    
    Fixed another double file descriptor close issue that could occur when destroying a ProcessGDBRemote() object. There was a race which was detected by our fd_interposing library:
    
    error: /Applications/Xcode.app/Contents/MacOS/Xcode (pid=55222): close (fd=60) resulted in EBADF:
    0   libFDInterposing.dylib              0x00000001082be8ca close$__interposed__ + 666
    1   LLDB                                0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
    2   LLDB                                0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
    3   LLDB                                0x00000001194fe249 lldb_private::ConnectionFileDescriptor::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 835
    4   LLDB                                0x00000001194fc320 lldb_private::Communication::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 634
    5   LLDB                                0x000000011959c7f4 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(StringExtractorGDBRemote&, unsigned int) + 228
    6   LLDB                                0x000000011959c6b5 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSeconds(StringExtractorGDBRemote&, unsigned int) + 49
    7   LLDB                                0x0000000119629a71 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse(ProcessGDBRemote*, char const*, unsigned long, StringExtractorGDBRemote&) + 509
    8   LLDB                                0x00000001195a4076 ProcessGDBRemote::AsyncThread(void*) + 514
    9   LLDB                                0x0000000119568094 ThreadCreateTrampoline(void*) + 91
    10  libsystem_c.dylib                   0x00007fff8ca028bf _pthread_start + 335
    11  libsystem_c.dylib                   0x00007fff8ca05b75 thread_start + 13
    
    fd=60 was previously closed with this event:
    pid=55222: close (fd=60) => 0
    0   libFDInterposing.dylib              0x00000001082be870 close$__interposed__ + 576
    1   LLDB                                0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
    2   LLDB                                0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
    3   LLDB                                0x00000001194fbf00 lldb_private::Communication::Disconnect(lldb_private::Error*) + 92
    4   LLDB                                0x00000001195a2a77 ProcessGDBRemote::StopAsyncThread() + 89
    5   LLDB                                0x00000001195a2bf6 ProcessGDBRemote::DoDestroy() + 310
    6   LLDB                                0x00000001195f938d lldb_private::Process::Destroy() + 85
    7   LLDB                                0x0000000118819b48 lldb::SBProcess::Kill() + 72
    8   DebuggerLLDB                        0x0000000117264358 DBGLLDBSessionThread(void*) + 4450
    9   LLDB                                0x0000000119568094 ThreadCreateTrampoline(void*) + 91
    10  libsystem_c.dylib                   0x00007fff8ca028bf _pthread_start + 335
    11  libsystem_c.dylib                   0x00007fff8ca05b75 thread_start + 13
    
    fd=60 was created with this event:
    pid=55222: socket (domain = 2, type = 1, protocol = 6) => fd=60
    0   libFDInterposing.dylib              0x00000001082bc968 socket$__interposed__ + 600
    1   LLDB                                0x00000001194fd75f lldb_private::ConnectionFileDescriptor::ConnectTCP(char const*, lldb_private::Error*) + 179
    .....
    
    
    
    
    
    
    Modified:
        lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
        lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
    
    Modified: lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h?rev=149103&r1=149102&r2=149103&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h (original)
    +++ lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h Thu Jan 26 18:46:15 2012
    @@ -19,6 +19,7 @@
     // Other libraries and framework includes
     // Project includes
     #include "lldb/Core/Connection.h"
    +#include "lldb/Host/Mutex.h"
     #include "lldb/Host/SocketAddress.h"
     
     namespace lldb_private {
    @@ -104,6 +105,7 @@
         SocketAddress m_udp_send_sockaddr;
         bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
         uint32_t m_socket_timeout_usec;
    +    Mutex m_mutex;
         
         static in_port_t
         GetSocketPort (int fd);
    
    Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=149103&r1=149102&r2=149103&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
    +++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Thu Jan 26 18:46:15 2012
    @@ -73,7 +73,8 @@
         m_fd_recv_type (eFDTypeFile),
         m_udp_send_sockaddr (),
         m_should_close_fd (false), 
    -    m_socket_timeout_usec(0)
    +    m_socket_timeout_usec(0),
    +    m_mutex (Mutex::eMutexTypeRecursive)
     {
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION |  LIBLLDB_LOG_OBJECT));
         if (log)
    @@ -113,6 +114,7 @@
     ConnectionStatus
     ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
     {
    +    Mutex::Locker locker (m_mutex);
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
         if (log)
             log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s);
    @@ -232,6 +234,7 @@
     ConnectionStatus
     ConnectionFileDescriptor::Disconnect (Error *error_ptr)
     {
    +    Mutex::Locker locker (m_mutex);
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
         if (log)
             log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this);
    @@ -599,6 +602,7 @@
     ConnectionStatus
     ConnectionFileDescriptor::Close (int& fd, Error *error_ptr)
     {
    +    Mutex::Locker locker (m_mutex);
         if (error_ptr)
             error_ptr->Clear();
         bool success = true;
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:08:35 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:08:35 -0000
    Subject: [Lldb-commits] [lldb] r149131 - in /lldb/trunk:
     include/lldb/Core/Module.h source/Commands/CommandObjectTarget.cpp
     source/Core/Module.cpp
    Message-ID: <20120127180835.77B022A6C12C@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:08:35 2012
    New Revision: 149131
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149131&view=rev
    Log:
    Fixed an issue that could happen during global object destruction in our
    map that tracks all live Module classes. We must leak our mutex for our
    collection class as it might be destroyed in an order we can't control.
    
    
    Modified:
        lldb/trunk/include/lldb/Core/Module.h
        lldb/trunk/source/Commands/CommandObjectTarget.cpp
        lldb/trunk/source/Core/Module.cpp
    
    Modified: lldb/trunk/include/lldb/Core/Module.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=149131&r1=149130&r2=149131&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/Module.h (original)
    +++ lldb/trunk/include/lldb/Core/Module.h Fri Jan 27 12:08:35 2012
    @@ -64,7 +64,7 @@
         static Module *
         GetAllocatedModuleAtIndex (size_t idx);
     
    -    static Mutex &
    +    static Mutex *
         GetAllocationModuleCollectionMutex();
     
         //------------------------------------------------------------------
    
    Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149131&r1=149130&r2=149131&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Jan 27 12:08:35 2012
    @@ -1632,7 +1632,7 @@
         if (check_global_list && num_matches == 0)
         {
             // Check the global list
    -        Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex().GetMutex());
    +        Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
             const uint32_t num_modules = Module::GetNumberAllocatedModules();
             ModuleSP module_sp;
             for (uint32_t image_idx = 0; image_idxGetMutex());
                     num_modules = Module::GetNumberAllocatedModules();
                 }
                 else
    
    Modified: lldb/trunk/source/Core/Module.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149131&r1=149130&r2=149131&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Module.cpp (original)
    +++ lldb/trunk/source/Core/Module.cpp Fri Jan 27 12:08:35 2012
    @@ -43,11 +43,18 @@
         return *g_module_collection;
     }
     
    -Mutex &
    +Mutex *
     Module::GetAllocationModuleCollectionMutex()
     {
    -    static Mutex g_module_collection_mutex(Mutex::eMutexTypeRecursive);
    -    return g_module_collection_mutex;    
    +    // NOTE: The mutex below must be leaked since the global module list in
    +    // the ModuleList class will get torn at some point, and we can't know
    +    // if it will tear itself down before the "g_module_collection_mutex" below
    +    // will. So we leak a Mutex object below to safeguard against that
    +
    +    static Mutex *g_module_collection_mutex = NULL;
    +    if (g_module_collection_mutex == NULL)
    +        g_module_collection_mutex = new Mutex (Mutex::eMutexTypeRecursive); // NOTE: known leak
    +    return g_module_collection_mutex;
     }
     
     size_t
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:14:52 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:14:52 -0000
    Subject: [Lldb-commits] [lldb] r149132 -
    	/lldb/trunk/include/lldb/Utility/SharedCluster.h
    Message-ID: <20120127181452.282E72A6C12C@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:14:51 2012
    New Revision: 149132
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149132&view=rev
    Log:
    Fixed a location where we would never end up unlocking our mutex in
    the ClusterManager. Also switched to using Mutex::Locker where we can.
    
    
    Modified:
        lldb/trunk/include/lldb/Utility/SharedCluster.h
    
    Modified: lldb/trunk/include/lldb/Utility/SharedCluster.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharedCluster.h?rev=149132&r1=149131&r2=149132&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Utility/SharedCluster.h (original)
    +++ lldb/trunk/include/lldb/Utility/SharedCluster.h Fri Jan 27 12:14:51 2012
    @@ -55,23 +55,26 @@
             {
                 delete m_objects[i];
             }
    +        // Decrement refcount should have been called on this ClusterManager,
    +        // and it should have locked the mutex, now we will unlock it before
    +        // we destroy it...
    +        m_mutex.Unlock();
         }
         
         void ManageObject (T *new_object)
         {
    -        m_mutex.Lock();
    +        Mutex::Locker locker (m_mutex);
             if (!ContainsObject(new_object))
                 m_objects.push_back (new_object);
    -        m_mutex.Unlock();
         }
         
         typename lldb_private::SharingPtr GetSharedPointer(T *desired_object)
         {
    -        m_mutex.Lock();
    -        m_external_ref++;
    -        assert (ContainsObject(desired_object));
    -        m_mutex.Unlock();
    -        
    +        {
    +            Mutex::Locker locker (m_mutex);
    +            m_external_ref++;
    +            assert (ContainsObject(desired_object));
    +        }
             return typename lldb_private::SharingPtr (desired_object, new imp::shared_ptr_refcount (this));
         }
         
    @@ -79,10 +82,9 @@
         
         bool ContainsObject (const T *desired_object)
         {
    -        typename std::vector::iterator pos;
    -        pos = std::find(m_objects.begin(), m_objects.end(), desired_object);
    -        
    -        return pos < m_objects.end();
    +        typename std::vector::iterator pos, end = m_objects.end();
    +        pos = std::find(m_objects.begin(), end, desired_object);
    +        return pos != end;
         }
         
         void DecrementRefCount () 
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:18:23 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:18:23 -0000
    Subject: [Lldb-commits] [lldb] r149133 - in /lldb/trunk/source/Commands:
     CommandObjectExpression.cpp CommandObjectExpression.h
    Message-ID: <20120127181824.04B9B2A6C12C@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:18:23 2012
    New Revision: 149133
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149133&view=rev
    Log:
    There is no need to hold onto an ExecutionContext as a member variable. 
    ExecutionContext objects have shared pointers to Target, Process, Thread
    and Frame objects and they can end up being held onto for too long.
    
    
    Modified:
        lldb/trunk/source/Commands/CommandObjectExpression.cpp
        lldb/trunk/source/Commands/CommandObjectExpression.h
    
    Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=149133&r1=149132&r2=149133&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jan 27 12:18:23 2012
    @@ -282,7 +282,7 @@
         CommandReturnObject *result
     )
     {
    -    Target *target = m_exe_ctx.GetTargetPtr();
    +    Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
         
         if (!target)
             target = Host::GetDummyTarget(m_interpreter.GetDebugger()).get();
    @@ -310,7 +310,7 @@
             }
             
             exe_results = target->EvaluateExpression (expr, 
    -                                                  m_exe_ctx.GetFramePtr(),
    +                                                  m_interpreter.GetExecutionContext().GetFramePtr(),
                                                       eExecutionPolicyOnlyWhenNeeded,
                                                       m_command_options.print_object,
                                                       m_command_options.unwind_on_error,
    @@ -323,7 +323,7 @@
                 uint32_t start_frame = 0;
                 uint32_t num_frames = 1;
                 uint32_t num_frames_with_source = 0;
    -            Thread *thread = m_exe_ctx.GetThreadPtr();
    +            Thread *thread = m_interpreter.GetExecutionContext().GetThreadPtr();
                 if (thread)
                 {
                     thread->GetStatus (result->GetOutputStream(), 
    @@ -333,7 +333,7 @@
                 }
                 else 
                 {
    -                Process *process = m_exe_ctx.GetProcessPtr();
    +                Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
                     if (process)
                     {
                         bool only_threads_with_stop_reason = true;
    @@ -422,8 +422,6 @@
         CommandReturnObject &result
     )
     {
    -    m_exe_ctx = m_interpreter.GetExecutionContext();
    -
         m_option_group.NotifyOptionParsingStarting();
     
         const char * expr = NULL;
    
    Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=149133&r1=149132&r2=149133&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
    +++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Jan 27 12:18:23 2012
    @@ -96,7 +96,6 @@
         OptionGroupOptions m_option_group;
         OptionGroupFormat m_format_options;
         CommandOptions m_command_options;
    -    ExecutionContext m_exe_ctx;
         uint32_t m_expr_line_count;
         std::string m_expr_lines; // Multi-line expression support
     };
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:29:47 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:29:47 -0000
    Subject: [Lldb-commits] [lldb] r149135 -
    	/lldb/trunk/source/Host/common/Mutex.cpp
    Message-ID: <20120127182947.9E1E01BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:29:47 2012
    New Revision: 149135
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149135&view=rev
    Log:
    Enable extra error checking for debug builds in our mutexes by
    watching for errors from pthread_mutex_destroy () (usually "Resource
    busy" errors for when you have a mutex locked and try to destroy
    it), and pthread_mutex_lock, and pthread_mutex_unlock (usually for
    trying to lock an invalid mutex that might have possible already
    been freed).
    
    
    Modified:
        lldb/trunk/source/Host/common/Mutex.cpp
    
    Modified: lldb/trunk/source/Host/common/Mutex.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=149135&r1=149134&r2=149135&view=diff
    ==============================================================================
    --- lldb/trunk/source/Host/common/Mutex.cpp (original)
    +++ lldb/trunk/source/Host/common/Mutex.cpp Fri Jan 27 12:29:47 2012
    @@ -8,6 +8,11 @@
     //===----------------------------------------------------------------------===//
     
     #include "lldb/Host/Mutex.h"
    +#include "lldb/Host/Host.h"
    +
    +#include 
    +#include 
    +#include 
     
     #if 0
     // This logging is way too verbose to enable even for a log channel. 
    @@ -19,6 +24,11 @@
     #define DEBUG_LOG(fmt, ...)
     #endif
     
    +// Enable extra mutex error checking
    +#ifdef LLDB_CONFIGURATION_DEBUG
    +#define ENABLE_MUTEX_ERROR_CHECKING 1
    +#endif
    +
     using namespace lldb_private;
     
     //----------------------------------------------------------------------
    @@ -145,7 +155,11 @@
         switch (type)
         {
         case eMutexTypeNormal:
    +#if ENABLE_MUTEX_ERROR_CHECKING
    +        err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ERRORCHECK);
    +#else
             err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL);
    +#endif
             break;
     
         case eMutexTypeRecursive:
    @@ -172,6 +186,14 @@
     {
         int err;
         err = ::pthread_mutex_destroy (&m_mutex);
    +#if ENABLE_MUTEX_ERROR_CHECKING
    +    if (err)
    +    {
    +        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy() => err = %i (%s)", __PRETTY_FUNCTION__, err, strerror(err));
    +        assert(err == 0);
    +    }
    +    memset (&m_mutex, '\xba', sizeof(m_mutex));
    +#endif
     }
     
     //----------------------------------------------------------------------
    @@ -188,6 +210,13 @@
     {
         DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_lock (%p)...\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr);
         int err = ::pthread_mutex_lock (mutex_ptr);
    +#if ENABLE_MUTEX_ERROR_CHECKING
    +    if (err)
    +    {
    +        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
    +        assert(err == 0);
    +    }
    +#endif
         DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_lock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr, err);
         return err;
     }
    @@ -204,6 +233,13 @@
     Mutex::Unlock (pthread_mutex_t *mutex_ptr)
     {
         int err = ::pthread_mutex_unlock (mutex_ptr);
    +#if ENABLE_MUTEX_ERROR_CHECKING
    +    if (err)
    +    {
    +        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_unlock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
    +        assert(err == 0);
    +    }
    +#endif
         DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_unlock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr, err);
         return err;
     }
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:33:53 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:33:53 -0000
    Subject: [Lldb-commits] [lldb] r149136 -
    	/lldb/trunk/include/lldb/Utility/SharingPtr.h
    Message-ID: <20120127183353.87E971BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:33:53 2012
    New Revision: 149136
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149136&view=rev
    Log:
    NULL out the "ptr_" member of shared pointers for debug and release
    builds (not build and integration builds) to help catch when a shared pointer
    that might be in a collection class is used after the collection
    has been freed.
    
    
    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=149136&r1=149135&r2=149136&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
    +++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Jan 27 12:33:53 2012
    @@ -684,6 +684,15 @@
         ~IntrusiveSharingPtr() 
         {
             release_shared(); 
    +#if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
    +        // NULL out the pointer in objects which can help with leaks detection.
    +        // We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or
    +        // when none of the LLDB_CONFIGURATION_XXX macros are defined since
    +        // those would be builds for release. But for debug and release builds
    +        // that are for development, we NULL out the pointers to catch potential
    +        // issues.
    +        ptr_ = NULL; 
    +#endif  // #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
         }
         
         T& 
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:45:39 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:45:39 -0000
    Subject: [Lldb-commits] [lldb] r149138 - in /lldb/trunk:
     include/lldb/Core/ModuleList.h source/Core/Module.cpp
     source/Core/ModuleList.cpp source/Utility/SharingPtr.cpp
    Message-ID: <20120127184539.AB9202A6C12C@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:45:39 2012
    New Revision: 149138
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149138&view=rev
    Log:
    Added a ModuleList::Destroy() method which will reclaim the std::vector
    memory by doing a swap.
    
    Also added a few utilty functions that can be enabled for debugging issues
    with modules staying around too long when external clients still have references
    to them.
    
    
    
    Modified:
        lldb/trunk/include/lldb/Core/ModuleList.h
        lldb/trunk/source/Core/Module.cpp
        lldb/trunk/source/Core/ModuleList.cpp
        lldb/trunk/source/Utility/SharingPtr.cpp
    
    Modified: lldb/trunk/include/lldb/Core/ModuleList.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=149138&r1=149137&r2=149138&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/ModuleList.h (original)
    +++ lldb/trunk/include/lldb/Core/ModuleList.h Fri Jan 27 12:45:39 2012
    @@ -89,6 +89,16 @@
         Clear ();
     
         //------------------------------------------------------------------
    +    /// Clear the object's state.
    +    ///
    +    /// Clears the list of modules and releases a reference to each
    +    /// module object and if the reference count goes to zero, the
    +    /// module will be deleted. Also relese all memory that might be
    +    /// held by any collection classes (like std::vector)
    +    //------------------------------------------------------------------
    +    void
    +    Destroy();
    +    //------------------------------------------------------------------
         /// Dump the description of each module contained in this list.
         ///
         /// Dump the description of each module contained in this list to
    @@ -395,8 +405,8 @@
         size_t
         GetSize () const;
     
    -    static const lldb::ModuleSP
    -    GetModuleSP (const Module *module_ptr);
    +    static bool
    +    ModuleIsInCache (const Module *module_ptr);
     
         static Error
         GetSharedModule (const FileSpec& file_spec,
    
    Modified: lldb/trunk/source/Core/Module.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149138&r1=149137&r2=149138&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Module.cpp (original)
    +++ lldb/trunk/source/Core/Module.cpp Fri Jan 27 12:45:39 2012
    @@ -73,8 +73,42 @@
             return modules[idx];
         return NULL;
     }
    +#if 0
     
    +// These functions help us to determine if modules are still loaded, yet don't require that
    +// you have a command interpreter and can easily be called from an external debugger.
    +namespace lldb {
     
    +    void
    +    ClearModuleInfo (void)
    +    {
    +        ModuleList::RemoveOrphanSharedModules();
    +    }
    +    
    +    void
    +    DumpModuleInfo (void)
    +    {
    +        Mutex::Locker locker (Module::GetAllocationModuleCollectionMutex());
    +        ModuleCollection &modules = GetModuleCollection();
    +        const size_t count = modules.size();
    +        printf ("%s: %zu modules:\n", __PRETTY_FUNCTION__, count);
    +        for (size_t i=0; iGetDescription(&strm, eDescriptionLevelFull);
    +            printf ("%p: shared = %i, ref_count = %3u, module = %s\n", 
    +                    module, 
    +                    in_shared_module_list,
    +                    (uint32_t)module->use_count(), 
    +                    strm.GetString().c_str());
    +        }
    +    }
    +}
    +
    +#endif
         
     
     Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name, off_t object_offset) :
    
    Modified: lldb/trunk/source/Core/ModuleList.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=149138&r1=149137&r2=149138&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ModuleList.cpp (original)
    +++ lldb/trunk/source/Core/ModuleList.cpp Fri Jan 27 12:45:39 2012
    @@ -155,6 +155,14 @@
         m_modules.clear();
     }
     
    +void
    +ModuleList::Destroy()
    +{
    +    Mutex::Locker locker(m_modules_mutex);
    +    collection empty;
    +    m_modules.swap(empty);
    +}
    +
     Module*
     ModuleList::GetModulePointerAtIndex (uint32_t idx) const
     {
    @@ -653,28 +661,15 @@
         return g_shared_module_list;
     }
     
    -const lldb::ModuleSP
    -ModuleList::GetModuleSP (const Module *module_ptr)
    +bool
    +ModuleList::ModuleIsInCache (const Module *module_ptr)
     {
    -    lldb::ModuleSP module_sp;
         if (module_ptr)
         {
             ModuleList &shared_module_list = GetSharedModuleList ();
    -        module_sp = shared_module_list.FindModule (module_ptr);
    -        if (module_sp.get() == NULL)
    -        {
    -            char uuid_cstr[256];
    -            const_cast(module_ptr)->GetUUID().GetAsCString (uuid_cstr, sizeof(uuid_cstr));
    -            const FileSpec &module_file_spec = module_ptr->GetFileSpec();
    -            Host::SystemLog (Host::eSystemLogWarning, 
    -                             "warning: module not in shared module list: %s (%s) \"%s/%s\"\n", 
    -                             uuid_cstr,
    -                             module_ptr->GetArchitecture().GetArchitectureName(),
    -                             module_file_spec.GetDirectory().GetCString(),
    -                             module_file_spec.GetFilename().GetCString());
    -        }
    +        return shared_module_list.FindModule (module_ptr).get() != NULL;
         }
    -    return module_sp;
    +    return false;
     }
     
     size_t
    
    Modified: lldb/trunk/source/Utility/SharingPtr.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SharingPtr.cpp?rev=149138&r1=149137&r2=149138&view=diff
    ==============================================================================
    --- lldb/trunk/source/Utility/SharingPtr.cpp (original)
    +++ lldb/trunk/source/Utility/SharingPtr.cpp Fri Jan 27 12:45:39 2012
    @@ -111,11 +111,16 @@
             }
         }
     }
    -extern "C" void dump_sp_refs (void *ptr)
    -{
    -    // Use a specially crafted call to "track_sp" which will
    -    // dump info on all live shared pointers that reference "ptr"
    -    track_sp (NULL, ptr, 0);
    +// Put dump_sp_refs in the lldb namespace to it gets through our exports lists filter in the LLDB.framework or lldb.so
    +namespace lldb {
    +    
    +    void dump_sp_refs (void *ptr)
    +    {
    +        // Use a specially crafted call to "track_sp" which will
    +        // dump info on all live shared pointers that reference "ptr"
    +        track_sp (NULL, ptr, 0);
    +    }
    +    
     }
     
     #endif
    
    
    
    From johnny.chen at apple.com  Fri Jan 27 12:49:33 2012
    From: johnny.chen at apple.com (Johnny Chen)
    Date: Fri, 27 Jan 2012 18:49:33 -0000
    Subject: [Lldb-commits] [lldb] r149139 -
    	/lldb/trunk/source/Commands/CommandObjectHelp.cpp
    Message-ID: <20120127184933.BDFC51BE003@llvm.org>
    
    Author: johnny
    Date: Fri Jan 27 12:49:33 2012
    New Revision: 149139
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149139&view=rev
    Log:
    Emit the message about putting ' -- ' between the end of command options and the raw input conditionally,
    that is, only if the command object does not want completion.  An example is the "settings set" command.
    
    Modified:
        lldb/trunk/source/Commands/CommandObjectHelp.cpp
    
    Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=149139&r1=149138&r2=149139&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Fri Jan 27 12:49:33 2012
    @@ -158,11 +158,13 @@
                         if ((long_help != NULL)
                             && (strlen (long_help) > 0))
                             output_strm.Printf ("\n%s", long_help);
    -                    // Mark this help command with a success status.
    -                    if (sub_cmd_obj->WantsRawCommandString())
    +                    // Emit the message about using ' -- ' between the end of the command options and the raw input
    +                    // conditionally, i.e., only if the command object does not want completion.
    +                    if (sub_cmd_obj->WantsRawCommandString() && !sub_cmd_obj->WantsCompletion())
                         {
                             m_interpreter.OutputFormattedHelpText (output_strm, "", "", "\nIMPORTANT NOTE:  Because this command takes 'raw' input, if you use any command options you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
                         }
    +                    // Mark this help command with a success status.
                         result.SetStatus (eReturnStatusSuccessFinishNoResult);
                     }
                     else if (sub_cmd_obj->IsMultiwordObject())
    
    
    
    From johnny.chen at apple.com  Fri Jan 27 12:53:22 2012
    From: johnny.chen at apple.com (Johnny Chen)
    Date: Fri, 27 Jan 2012 18:53:22 -0000
    Subject: [Lldb-commits] [lldb] r149140 -
    	/lldb/trunk/source/Host/common/Mutex.cpp
    Message-ID: <20120127185322.3C97F1BE003@llvm.org>
    
    Author: johnny
    Date: Fri Jan 27 12:53:22 2012
    New Revision: 149140
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149140&view=rev
    Log:
    Fix typo.
    
    Modified:
        lldb/trunk/source/Host/common/Mutex.cpp
    
    Modified: lldb/trunk/source/Host/common/Mutex.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=149140&r1=149139&r2=149140&view=diff
    ==============================================================================
    --- lldb/trunk/source/Host/common/Mutex.cpp (original)
    +++ lldb/trunk/source/Host/common/Mutex.cpp Fri Jan 27 12:53:22 2012
    @@ -213,7 +213,7 @@
     #if ENABLE_MUTEX_ERROR_CHECKING
         if (err)
         {
    -        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
    +        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_lock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
             assert(err == 0);
         }
     #endif
    
    
    
    From gclayton at apple.com  Fri Jan 27 12:57:04 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Fri, 27 Jan 2012 18:57:04 -0000
    Subject: [Lldb-commits] [lldb] r149141 - in /lldb/trunk:
     include/lldb/Core/ConnectionFileDescriptor.h
     source/Core/ConnectionFileDescriptor.cpp
    Message-ID: <20120127185704.711BE1BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 12:57:04 2012
    New Revision: 149141
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149141&view=rev
    Log:
    Disable the ConnectionFileDescriptor mutex for now as it is deadlocking our
    test suite and I need to investigate this.
    
    
    Modified:
        lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
        lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
    
    Modified: lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h?rev=149141&r1=149140&r2=149141&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h (original)
    +++ lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h Fri Jan 27 12:57:04 2012
    @@ -105,7 +105,7 @@
         SocketAddress m_udp_send_sockaddr;
         bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
         uint32_t m_socket_timeout_usec;
    -    Mutex m_mutex;
    +    //Mutex m_mutex;
         
         static in_port_t
         GetSocketPort (int fd);
    
    Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=149141&r1=149140&r2=149141&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
    +++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Jan 27 12:57:04 2012
    @@ -73,8 +73,8 @@
         m_fd_recv_type (eFDTypeFile),
         m_udp_send_sockaddr (),
         m_should_close_fd (false), 
    -    m_socket_timeout_usec(0),
    -    m_mutex (Mutex::eMutexTypeRecursive)
    +    m_socket_timeout_usec(0)//,
    +    //m_mutex (Mutex::eMutexTypeRecursive)
     {
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION |  LIBLLDB_LOG_OBJECT));
         if (log)
    @@ -114,7 +114,7 @@
     ConnectionStatus
     ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
     {
    -    Mutex::Locker locker (m_mutex);
    +    //Mutex::Locker locker (m_mutex);
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
         if (log)
             log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s);
    @@ -234,7 +234,6 @@
     ConnectionStatus
     ConnectionFileDescriptor::Disconnect (Error *error_ptr)
     {
    -    Mutex::Locker locker (m_mutex);
         LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
         if (log)
             log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this);
    @@ -389,7 +388,7 @@
                 return 0;
             }
     
    -        Disconnect (NULL);
    +        //Disconnect (NULL);
             return 0;
         }
         return bytes_read;
    @@ -508,7 +507,7 @@
                 break;  // Break to close....
             }
     
    -        Disconnect (NULL);
    +        //Disconnect (NULL);
             return 0;
         }
     
    @@ -602,7 +601,7 @@
     ConnectionStatus
     ConnectionFileDescriptor::Close (int& fd, Error *error_ptr)
     {
    -    Mutex::Locker locker (m_mutex);
    +    //Mutex::Locker locker (m_mutex);
         if (error_ptr)
             error_ptr->Clear();
         bool success = true;
    
    
    
    From johnny.chen at apple.com  Fri Jan 27 15:27:40 2012
    From: johnny.chen at apple.com (Johnny Chen)
    Date: Fri, 27 Jan 2012 21:27:40 -0000
    Subject: [Lldb-commits] [lldb] r149145 - in /lldb/trunk:
     include/lldb/Core/UserSettingsController.h
     source/Core/UserSettingsController.cpp
    Message-ID: <20120127212740.47F011BE003@llvm.org>
    
    Author: johnny
    Date: Fri Jan 27 15:27:39 2012
    New Revision: 149145
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149145&view=rev
    Log:
    Add an InstanceSettings::NotifyOwnerIsShuttingDown() method so that the owner can notify InstanceSettings instances
    that their owner reference is no longer valid.
    
    Modified:
        lldb/trunk/include/lldb/Core/UserSettingsController.h
        lldb/trunk/source/Core/UserSettingsController.cpp
    
    Modified: lldb/trunk/include/lldb/Core/UserSettingsController.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UserSettingsController.h?rev=149145&r1=149144&r2=149145&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/UserSettingsController.h (original)
    +++ lldb/trunk/include/lldb/Core/UserSettingsController.h Fri Jan 27 15:27:39 2012
    @@ -400,6 +400,9 @@
         // Begin Pure Virtual Functions
     
         virtual void
    +    NotifyOwnerIsShuttingDown ();
    +
    +    virtual void
         UpdateInstanceSettingsVariable (const ConstString &var_name,
                                         const char *index_value,
                                         const char *value,
    @@ -440,6 +443,7 @@
     protected:
     
         UserSettingsController &m_owner;
    +    bool m_owner_is_live;
         ConstString m_instance_name;
     };
     
    
    Modified: lldb/trunk/source/Core/UserSettingsController.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=149145&r1=149144&r2=149145&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/UserSettingsController.cpp (original)
    +++ lldb/trunk/source/Core/UserSettingsController.cpp Fri Jan 27 15:27:39 2012
    @@ -83,6 +83,10 @@
     UserSettingsController::~UserSettingsController ()
     {
         Mutex::Locker locker (m_live_settings_mutex);
    +
    +    // Notify all instance settings that their owner is shutting down, first.
    +    for (InstanceSettingsMap::iterator pos = m_live_settings.begin(); pos != m_live_settings.end(); ++pos)
    +        pos->second->NotifyOwnerIsShuttingDown();
         m_live_settings.clear();
     }
     
    @@ -2458,7 +2462,8 @@
     
     InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *instance_name, bool live_instance) :
         m_owner (owner),
    -    m_instance_name (instance_name)
    +    m_instance_name (instance_name),
    +    m_owner_is_live (true)
     {
         if ((m_instance_name != InstanceSettings::GetDefaultName())
             && (m_instance_name !=  InstanceSettings::InvalidName())
    @@ -2468,10 +2473,16 @@
     
     InstanceSettings::~InstanceSettings ()
     {
    -    if (m_instance_name != InstanceSettings::GetDefaultName())
    +    if (m_instance_name != InstanceSettings::GetDefaultName() && m_owner_is_live)
             m_owner.UnregisterInstanceSettings (this);
     }
     
    +void
    +InstanceSettings::NotifyOwnerIsShuttingDown()
    +{
    +    m_owner_is_live = false;
    +}
    +
     const ConstString &
     InstanceSettings::GetDefaultName ()
     {
    
    
    
    From gclayton at apple.com  Fri Jan 27 18:48:57 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 00:48:57 -0000
    Subject: [Lldb-commits] [lldb] r149160 - in /lldb/trunk:
     include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
     source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
     source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
     source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
     source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    Message-ID: <20120128004857.D89B71BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 18:48:57 2012
    New Revision: 149160
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149160&view=rev
    Log:
    Adding the DWARF parser side for assited layout where the AST context
    will ask ExternalASTSource objects to help laying out a type. This is needed
    because the DWARF typically doesn't contain alignement or packing attribute
    values, and we need to be able to match up types that the compiler uses
    in expressions.
    
    
    Modified:
        lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
        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
    
    Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=149160&r1=149159&r2=149160&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
    +++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Fri Jan 27 18:48:57 2012
    @@ -18,6 +18,7 @@
     #include 
     
     // Other libraries and framework includes
    +#include "clang/AST/CharUnits.h"
     
     // Project includes
     #include "lldb/lldb-enumerations.h"
    @@ -34,14 +35,23 @@
         typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
         typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
         typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl  *results);
    +    typedef bool (*LayoutRecordTypeCallback)(void *baton, 
    +                                             const clang::RecordDecl *Record,
    +                                             uint64_t &Size, 
    +                                             uint64_t &Alignment,
    +                                             llvm::DenseMap  &FieldOffsets,
    +                                             llvm::DenseMap  &BaseOffsets,
    +                                             llvm::DenseMap  &VirtualBaseOffsets);
     
         ClangExternalASTSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
                                          CompleteObjCInterfaceDeclCallback objc_decl_callback,
                                          FindExternalVisibleDeclsByNameCallback find_by_name_callback,
    +                                     LayoutRecordTypeCallback layout_record_type_callback,
                                          void *callback_baton) :
             m_callback_tag_decl (tag_decl_callback),
             m_callback_objc_decl (objc_decl_callback),
             m_callback_find_by_name (find_by_name_callback),
    +        m_callback_layout_record_type (layout_record_type_callback),
             m_callback_baton (callback_baton)
         {
         }
    @@ -117,11 +127,13 @@
         SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
                                     CompleteObjCInterfaceDeclCallback objc_decl_callback,
                                     FindExternalVisibleDeclsByNameCallback find_by_name_callback,
    +                                LayoutRecordTypeCallback layout_record_type_callback,
                                     void *callback_baton)
         {
             m_callback_tag_decl = tag_decl_callback;
             m_callback_objc_decl = objc_decl_callback;
             m_callback_find_by_name = find_by_name_callback;
    +        m_callback_layout_record_type = layout_record_type_callback;
             m_callback_baton = callback_baton;    
         }
     
    @@ -133,6 +145,7 @@
                 m_callback_tag_decl = NULL;
                 m_callback_objc_decl = NULL;
                 m_callback_find_by_name = NULL;
    +            m_callback_layout_record_type = NULL;
             }
         }
     
    @@ -143,6 +156,7 @@
         CompleteTagDeclCallback                 m_callback_tag_decl;
         CompleteObjCInterfaceDeclCallback       m_callback_objc_decl;
         FindExternalVisibleDeclsByNameCallback  m_callback_find_by_name;
    +    LayoutRecordTypeCallback                m_callback_layout_record_type;
         void *                                  m_callback_baton;
     };
     
    
    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=149160&r1=149159&r2=149160&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jan 27 18:48:57 2012
    @@ -243,8 +243,8 @@
                 new ClangExternalASTSourceCallbacks (SymbolFileDWARF::CompleteTagDecl,
                                                      SymbolFileDWARF::CompleteObjCInterfaceDecl,
                                                      SymbolFileDWARF::FindExternalVisibleDeclsByName,
    +                                                 SymbolFileDWARF::LayoutRecordType,
                                                      this));
    -
             ast.SetExternalSource (ast_source_ap);
         }
         return ast;
    @@ -1305,7 +1305,8 @@
         std::vector& member_accessibilities,
         DWARFDIECollection& member_function_dies,
         AccessType& default_accessibility,
    -    bool &is_a_class
    +    bool &is_a_class,
    +    LayoutInfo &layout_info
     )
     {
         if (parent_die == NULL)
    @@ -1343,7 +1344,7 @@
                         bool is_artificial = false;
                         lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
                         AccessType accessibility = eAccessNone;
    -                    //off_t member_offset = 0;
    +                    uint32_t member_byte_offset = UINT32_MAX;
                         size_t byte_size = 0;
                         size_t bit_offset = 0;
                         size_t bit_size = 0;
    @@ -1365,18 +1366,29 @@
                                 case DW_AT_bit_size:    bit_size = form_value.Unsigned(); break;
                                 case DW_AT_byte_size:   byte_size = form_value.Unsigned(); break;
                                 case DW_AT_data_member_location:
    -//                                if (form_value.BlockData())
    -//                                {
    -//                                    Value initialValue(0);
    -//                                    Value memberOffset(0);
    -//                                    const DataExtractor& debug_info_data = get_debug_info_data();
    -//                                    uint32_t block_length = form_value.Unsigned();
    -//                                    uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
    -//                                    if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL))
    -//                                    {
    -//                                        member_offset = memberOffset.ResolveValue(NULL, NULL).UInt();
    -//                                    }
    -//                                }
    +                                if (form_value.BlockData())
    +                                {
    +                                    Value initialValue(0);
    +                                    Value memberOffset(0);
    +                                    const DataExtractor& debug_info_data = get_debug_info_data();
    +                                    uint32_t block_length = form_value.Unsigned();
    +                                    uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
    +                                    if (DWARFExpression::Evaluate(NULL, // ExecutionContext *
    +                                                                  NULL, // clang::ASTContext *
    +                                                                  NULL, // ClangExpressionVariableList *
    +                                                                  NULL, // ClangExpressionDeclMap *
    +                                                                  NULL, // RegisterContext *
    +                                                                  debug_info_data, 
    +                                                                  block_offset, 
    +                                                                  block_length, 
    +                                                                  eRegisterKindDWARF, 
    +                                                                  &initialValue, 
    +                                                                  memberOffset, 
    +                                                                  NULL))
    +                                    {
    +                                        member_byte_offset = memberOffset.ResolveValue(NULL, NULL).UInt();
    +                                    }
    +                                }
                                     break;
     
                                 case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break;
    @@ -1463,6 +1475,11 @@
                                                                                encoding_uid);
                             }
     
    +                        if (member_byte_offset != UINT32_MAX)
    +                        {
    +                            // Set the field offset in bits
    +                            layout_info.field_offsets.insert(std::make_pair(field_decl, member_byte_offset * 8));
    +                        }
                             if (prop_name != NULL)
                             {
                                 
    @@ -1745,146 +1762,179 @@
         case DW_TAG_union_type:
         case DW_TAG_class_type:
             ast.StartTagDeclarationDefinition (clang_type);
    -        if (die->HasChildren())
             {
    -            LanguageType class_language = eLanguageTypeUnknown;
    -            bool is_objc_class = ClangASTContext::IsObjCClassType (clang_type);
    -            if (is_objc_class)
    -                class_language = eLanguageTypeObjC;
    -
    -            int tag_decl_kind = -1;
    -            AccessType default_accessibility = eAccessNone;
    -            if (tag == DW_TAG_structure_type)
    +            LayoutInfo layout_info;
    +            if (die->HasChildren())
                 {
    -                tag_decl_kind = clang::TTK_Struct;
    -                default_accessibility = eAccessPublic;
    -            }
    -            else if (tag == DW_TAG_union_type)
    -            {
    -                tag_decl_kind = clang::TTK_Union;
    -                default_accessibility = eAccessPublic;
    -            }
    -            else if (tag == DW_TAG_class_type)
    -            {
    -                tag_decl_kind = clang::TTK_Class;
    -                default_accessibility = eAccessPrivate;
    -            }
     
    -            SymbolContext sc(GetCompUnitForDWARFCompUnit(curr_cu));
    -            std::vector base_classes;
    -            std::vector member_accessibilities;
    -            bool is_a_class = false;
    -            // Parse members and base classes first
    -            DWARFDIECollection member_function_dies;
    -
    -            ParseChildMembers (sc, 
    -                               curr_cu, 
    -                               die, 
    -                               clang_type,
    -                               class_language,
    -                               base_classes, 
    -                               member_accessibilities,
    -                               member_function_dies,
    -                               default_accessibility, 
    -                               is_a_class);
    -
    -            // Now parse any methods if there were any...
    -            size_t num_functions = member_function_dies.Size();                
    -            if (num_functions > 0)
    -            {
    -                for (size_t i=0; iFindByName(class_str.c_str(), method_die_offsets);
    -                    }
    -                    else
    +                    tag_decl_kind = clang::TTK_Union;
    +                    default_accessibility = eAccessPublic;
    +                }
    +                else if (tag == DW_TAG_class_type)
    +                {
    +                    tag_decl_kind = clang::TTK_Class;
    +                    default_accessibility = eAccessPrivate;
    +                }
    +
    +                SymbolContext sc(GetCompUnitForDWARFCompUnit(curr_cu));
    +                std::vector base_classes;
    +                std::vector member_accessibilities;
    +                bool is_a_class = false;
    +                // Parse members and base classes first
    +                DWARFDIECollection member_function_dies;
    +
    +                ParseChildMembers (sc, 
    +                                   curr_cu, 
    +                                   die, 
    +                                   clang_type,
    +                                   class_language,
    +                                   base_classes, 
    +                                   member_accessibilities,
    +                                   member_function_dies,
    +                                   default_accessibility, 
    +                                   is_a_class,
    +                                   layout_info);
    +
    +                // Now parse any methods if there were any...
    +                size_t num_functions = member_function_dies.Size();                
    +                if (num_functions > 0)
    +                {
    +                    for (size_t i=0; iFindByName(class_str.c_str(), method_die_offsets);
    +                        }
    +                        else
                             {
    -                            const dw_offset_t die_offset = method_die_offsets[i];
    -                            DWARFDebugInfoEntry *method_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &method_cu);
    +                            if (!m_indexed)
    +                                Index ();
                                 
    -                            if (method_die)
    -                                ResolveType (method_cu, method_die);
    -                            else
    +                            ConstString class_name (class_str.c_str());
    +                            m_objc_class_selectors_index.Find (class_name, method_die_offsets);
    +                        }
    +
    +                        if (!method_die_offsets.empty())
    +                        {
    +                            DWARFDebugInfo* debug_info = DebugInfo();
    +
    +                            DWARFCompileUnit* method_cu = NULL;
    +                            const size_t num_matches = method_die_offsets.size();
    +                            for (size_t i=0; iGetDIEPtrWithCompileUnitHint (die_offset, &method_cu);
    +                                
    +                                if (method_die)
    +                                    ResolveType (method_cu, method_die);
    +                                else
                                     {
    -                                    GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n",
    -                                                                                               die_offset, class_str.c_str());
    -                                }
    -                            }            
    +                                    if (m_using_apple_tables)
    +                                    {
    +                                        GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n",
    +                                                                                                   die_offset, class_str.c_str());
    +                                    }
    +                                }            
    +                            }
                             }
                         }
                     }
    +                
    +                // If we have a DW_TAG_structure_type instead of a DW_TAG_class_type we
    +                // need to tell the clang type it is actually a class.
    +                if (class_language != eLanguageTypeObjC)
    +                {
    +                    if (is_a_class && tag_decl_kind != clang::TTK_Class)
    +                        ast.SetTagTypeKind (clang_type, clang::TTK_Class);
    +                }
    +
    +                // Since DW_TAG_structure_type gets used for both classes
    +                // and structures, we may need to set any DW_TAG_member
    +                // fields to have a "private" access if none was specified.
    +                // When we parsed the child members we tracked that actual
    +                // accessibility value for each DW_TAG_member in the
    +                // "member_accessibilities" array. If the value for the
    +                // member is zero, then it was set to the "default_accessibility"
    +                // which for structs was "public". Below we correct this
    +                // by setting any fields to "private" that weren't correctly
    +                // set.
    +                if (is_a_class && !member_accessibilities.empty())
    +                {
    +                    // This is a class and all members that didn't have
    +                    // their access specified are private.
    +                    ast.SetDefaultAccessForRecordFields (clang_type, 
    +                                                         eAccessPrivate, 
    +                                                         &member_accessibilities.front(), 
    +                                                         member_accessibilities.size());
    +                }
    +
    +                if (!base_classes.empty())
    +                {
    +                    ast.SetBaseClassesForClassType (clang_type, 
    +                                                    &base_classes.front(), 
    +                                                    base_classes.size());
    +
    +                    // Clang will copy each CXXBaseSpecifier in "base_classes"
    +                    // so we have to free them all.
    +                    ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(), 
    +                                                                base_classes.size());
    +                }
    +                
                 }
    -            
    -            // If we have a DW_TAG_structure_type instead of a DW_TAG_class_type we
    -            // need to tell the clang type it is actually a class.
    -            if (class_language != eLanguageTypeObjC)
    -            {
    -                if (is_a_class && tag_decl_kind != clang::TTK_Class)
    -                    ast.SetTagTypeKind (clang_type, clang::TTK_Class);
    -            }
    -
    -            // Since DW_TAG_structure_type gets used for both classes
    -            // and structures, we may need to set any DW_TAG_member
    -            // fields to have a "private" access if none was specified.
    -            // When we parsed the child members we tracked that actual
    -            // accessibility value for each DW_TAG_member in the
    -            // "member_accessibilities" array. If the value for the
    -            // member is zero, then it was set to the "default_accessibility"
    -            // which for structs was "public". Below we correct this
    -            // by setting any fields to "private" that weren't correctly
    -            // set.
    -            if (is_a_class && !member_accessibilities.empty())
    -            {
    -                // This is a class and all members that didn't have
    -                // their access specified are private.
    -                ast.SetDefaultAccessForRecordFields (clang_type, 
    -                                                     eAccessPrivate, 
    -                                                     &member_accessibilities.front(), 
    -                                                     member_accessibilities.size());
    -            }
    -
    -            if (!base_classes.empty())
    -            {
    -                ast.SetBaseClassesForClassType (clang_type, 
    -                                                &base_classes.front(), 
    -                                                base_classes.size());
    -
    -                // Clang will copy each CXXBaseSpecifier in "base_classes"
    -                // so we have to free them all.
    -                ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(), 
    -                                                            base_classes.size());
    +#if 0
    +            // Disable assisted layout until we get the clang side hooked up
    +            if (!layout_info.field_offsets.empty())
    +            {
    +                if (type)
    +                    layout_info.bit_size = type->GetByteSize() * 8;
    +                if (layout_info.bit_size == 0)
    +                    layout_info.bit_size = die->GetAttributeValueAsUnsigned(this, curr_cu, DW_AT_byte_size, 0) * 8;
    +                clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
    +                const clang::RecordType *record_type = clang::dyn_cast(qual_type.getTypePtr());
    +                if (record_type)
    +                {
    +                    const clang::RecordDecl *record_decl = record_type->getDecl();
    +                    
    +                    if (log)
    +                        GetObjectFile()->GetModule()->LogMessage (log.get(), 
    +                                                                  "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[0], vbase_offsets[0])",
    +                                                                  clang_type,
    +                                                                  record_decl,
    +                                                                  layout_info.bit_size,
    +                                                                  layout_info.alignment,
    +                                                                  (uint32_t)layout_info.field_offsets.size());
    +                    
    +
    +                    m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
    +                }
                 }
    -            
    +#endif
             }
             ast.CompleteTagDeclarationDefinition (clang_type);
             return clang_type;
    @@ -6099,3 +6149,61 @@
             break;
         }
     }
    +
    +bool 
    +SymbolFileDWARF::LayoutRecordType (void *baton, 
    +                                   const clang::RecordDecl *record_decl,
    +                                   uint64_t &size, 
    +                                   uint64_t &alignment,
    +                                   llvm::DenseMap  &field_offsets,
    +                                   llvm::DenseMap  &base_offsets,
    +                                   llvm::DenseMap  &vbase_offsets)
    +{
    +    SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
    +    return symbol_file_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets);
    +}
    +
    +
    +bool 
    +SymbolFileDWARF::LayoutRecordType (const clang::RecordDecl *record_decl,
    +                                   uint64_t &bit_size, 
    +                                   uint64_t &alignment,
    +                                   llvm::DenseMap  &field_offsets,
    +                                   llvm::DenseMap  &base_offsets,
    +                                   llvm::DenseMap  &vbase_offsets)
    +{
    +    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
    +    RecordDeclToLayoutMap::iterator pos = m_record_decl_to_layout_map.find (record_decl);
    +    bool success = false;
    +    base_offsets.clear();
    +    vbase_offsets.clear();
    +    if (pos != m_record_decl_to_layout_map.end())
    +    {
    +        bit_size = pos->second.bit_size;
    +        alignment = pos->second.alignment;
    +        field_offsets.swap(pos->second.field_offsets);
    +        m_record_decl_to_layout_map.erase(pos);
    +        success = true;
    +    }
    +    else
    +    {
    +        bit_size = 0;
    +        alignment = 0;
    +        field_offsets.clear();
    +    }
    +    
    +    if (log)
    +        GetObjectFile()->GetModule()->LogMessage (log.get(), 
    +                                                  "SymbolFileDWARF::LayoutRecordType (record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[%u], vbase_offsets[%u]) success = %i",
    +                                                  record_decl,
    +                                                  bit_size,
    +                                                  alignment,
    +                                                  (uint32_t)field_offsets.size(),
    +                                                  (uint32_t)base_offsets.size(),
    +                                                  (uint32_t)vbase_offsets.size(),
    +                                                  success);
    +    return success;
    +}
    +
    +
    +
    
    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=149160&r1=149159&r2=149160&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Jan 27 18:48:57 2012
    @@ -18,6 +18,7 @@
     #include 
     
     // Other libraries and framework includes
    +#include "clang/AST/CharUnits.h"
     #include "clang/AST/ExternalASTSource.h"
     #include "llvm/ADT/DenseMap.h"
     #include "llvm/ADT/SmallPtrSet.h"
    @@ -141,6 +142,39 @@
                                         clang::DeclarationName Name,
                                         llvm::SmallVectorImpl  *results);
     
    +    static bool 
    +    LayoutRecordType (void *baton, 
    +                      const clang::RecordDecl *record_decl,
    +                      uint64_t &size, 
    +                      uint64_t &alignment,
    +                      llvm::DenseMap  &field_offsets,
    +                      llvm::DenseMap  &base_offsets,
    +                      llvm::DenseMap  &vbase_offsets);
    +
    +    bool 
    +    LayoutRecordType (const clang::RecordDecl *record_decl,
    +                      uint64_t &size, 
    +                      uint64_t &alignment,
    +                      llvm::DenseMap  &field_offsets,
    +                      llvm::DenseMap  &base_offsets,
    +                      llvm::DenseMap  &vbase_offsets);
    +
    +    struct LayoutInfo
    +    {
    +        LayoutInfo () :
    +            bit_size(0),
    +            alignment(0),
    +            field_offsets()//,
    +            //base_offsets(), // We don't need to fill in the base classes, this can be done automatically
    +            //vbase_offsets() // We don't need to fill in the virtual base classes, this can be done automatically
    +        {
    +        }
    +        uint64_t bit_size;
    +        uint64_t alignment;
    +        llvm::DenseMap  field_offsets;
    +//        llvm::DenseMap  base_offsets;
    +//        llvm::DenseMap  vbase_offsets;
    +    };
         //------------------------------------------------------------------
         // PluginInterface protocol
         //------------------------------------------------------------------
    @@ -307,7 +341,8 @@
                                     std::vector& member_accessibilities,
                                     DWARFDIECollection& member_function_dies,
                                     lldb::AccessType &default_accessibility,
    -                                bool &is_a_class);
    +                                bool &is_a_class,
    +                                LayoutInfo &layout_info);
     
         size_t                  ParseChildParameters(
                                     const lldb_private::SymbolContext& sc,
    @@ -518,12 +553,14 @@
         typedef llvm::DenseMap DIEToVariableSP;
         typedef llvm::DenseMap DIEToClangType;
         typedef llvm::DenseMap ClangTypeToDIE;
    +    typedef llvm::DenseMap RecordDeclToLayoutMap;
         DIEToDeclContextMap m_die_to_decl_ctx;
         DeclContextToDIEMap m_decl_ctx_to_die;
         DIEToTypePtr m_die_to_type;
         DIEToVariableSP m_die_to_variable_sp;
         DIEToClangType m_forward_decl_die_to_clang_type;
         ClangTypeToDIE m_forward_decl_clang_type_to_die;
    +    RecordDeclToLayoutMap m_record_decl_to_layout_map;
     };
     
     #endif  // SymbolFileDWARF_SymbolFileDWARF_h_
    
    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=149160&r1=149159&r2=149160&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Jan 27 18:48:57 2012
    @@ -83,6 +83,7 @@
             new ClangExternalASTSourceCallbacks (SymbolFileDWARFDebugMap::CompleteTagDecl,
                                                  SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl,
                                                  NULL,
    +                                             SymbolFileDWARFDebugMap::LayoutRecordType,
                                                  this));
     
         GetClangASTContext().SetExternalSource (ast_source_ap);
    @@ -1146,6 +1147,27 @@
         }
     }
     
    +bool 
    +SymbolFileDWARFDebugMap::LayoutRecordType (void *baton, 
    +                                           const clang::RecordDecl *record_decl,
    +                                           uint64_t &size, 
    +                                           uint64_t &alignment,
    +                                           llvm::DenseMap  &field_offsets,
    +                                           llvm::DenseMap  &base_offsets,
    +                                           llvm::DenseMap  &vbase_offsets)
    +{
    +    SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton;
    +    SymbolFileDWARF *oso_dwarf;
    +    for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
    +    {
    +        if (oso_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets))
    +            return true;
    +    }
    +    return false;
    +}
    +
    +
    +
     clang::DeclContext*
     SymbolFileDWARFDebugMap::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
     {
    
    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=149160&r1=149159&r2=149160&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Jan 27 18:48:57 2012
    @@ -13,6 +13,9 @@
     
     #include 
     #include 
    +
    +#include "clang/AST/CharUnits.h"
    +
     #include "lldb/Symbol/SymbolFile.h"
     
     #include "UniqueDWARFASTType.h"
    @@ -90,6 +93,16 @@
         
         static void
         CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
    +    
    +    static bool 
    +    LayoutRecordType (void *baton, 
    +                      const clang::RecordDecl *record_decl,
    +                      uint64_t &size, 
    +                      uint64_t &alignment,
    +                      llvm::DenseMap  &field_offsets,
    +                      llvm::DenseMap  &base_offsets,
    +                      llvm::DenseMap  &vbase_offsets);
    +
     
         //------------------------------------------------------------------
         // PluginInterface protocol
    
    
    
    From gclayton at apple.com  Fri Jan 27 19:40:47 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 01:40:47 -0000
    Subject: [Lldb-commits] [lldb] r149165 - in /lldb/trunk:
     lldb.xcodeproj/project.pbxproj
     tools/debugserver/debugserver.xcodeproj/project.pbxproj
    Message-ID: <20120128014047.5CC2E1BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 19:40:47 2012
    New Revision: 149165
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149165&view=rev
    Log:
    Xcode codesigning is broken. Work around this by doing code signing in a shell script build phase.
    
    
    Modified:
        lldb/trunk/lldb.xcodeproj/project.pbxproj
        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=149165&r1=149164&r2=149165&view=diff
    ==============================================================================
    --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 19:40:47 2012
    @@ -2947,6 +2947,7 @@
     			buildPhases = (
     				26DC6A0D1337FE6900FF7998 /* Sources */,
     				26DC6A0E1337FE6900FF7998 /* Frameworks */,
    +				261CE9C014D327DE006D8EFE /* Codesign */,
     			);
     			buildRules = (
     			);
    @@ -3078,6 +3079,20 @@
     			shellPath = /bin/sh;
     			shellScript = "cd \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nfor file in *.h\ndo\n\t/usr/bin/sed -i '' 's/\\(#include\\)[ ]*\"lldb\\/\\(API\\/\\)\\{0,1\\}\\(.*\\)\"/\\1 /1' \"$file\"\n\t/usr/bin/sed -i '' 's|
    
    Author: gclayton
    Date: Fri Jan 27 20:11:02 2012
    New Revision: 149166
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149166&view=rev
    Log:
    Stop running so many individual commands when going into the script interpreter.
    All of the commands now get globbed into a single line.
    
    lldb.target, lldb.process, lldb.thread and lldb.frame now get initialized with
    empty SBTarget, SBProcess, SBThread and SBFrame objects when they don't contain
    anything. 
    
    
    Modified:
        lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    
    Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149166&r1=149165&r2=149166&view=diff
    ==============================================================================
    --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
    +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri Jan 27 20:11:02 2012
    @@ -327,64 +327,36 @@
     
         StreamString run_string;
     
    -    run_string.Printf ("run_one_line (%s, 'lldb.debugger_unique_id = %llu')", m_dictionary_name.c_str(),
    -                       GetCommandInterpreter().GetDebugger().GetID());
    -    PyRun_SimpleString (run_string.GetData());
    -    run_string.Clear();
    -    
    +    run_string.Printf (    "run_one_line (%s, 'lldb.debugger_unique_id = %llu", m_dictionary_name.c_str(), GetCommandInterpreter().GetDebugger().GetID());
    +    run_string.Printf (    "; lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%llu)", GetCommandInterpreter().GetDebugger().GetID());
    +    run_string.PutCString ("; lldb.target = lldb.debugger.GetSelectedTarget()");
    +    run_string.PutCString ("; lldb.process = lldb.target.GetProcess()");
    +    run_string.PutCString ("; lldb.thread = lldb.process.GetSelectedThread ()");
    +    run_string.PutCString ("; lldb.frame = lldb.thread.GetSelectedFrame ()");
    +    // Make sure STDIN is closed since when we run this as an embedded 
    +    // interpreter we don't want someone to call "line = sys.stdin.readline()"
    +    // and lock up. We don't have multiple windows and when the interpreter is
    +    // embedded we don't know we should be feeding input to the embedded 
    +    // interpreter or to the python sys.stdin. We also don't want to let python
    +    // play with the real stdin from this process, so we need to close it...
    +    run_string.PutCString ("; sys.stdin.close()");
    +    run_string.PutCString ("')");
     
    -    run_string.Printf ("run_one_line (%s, 'lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%llu)')", 
    -                       m_dictionary_name.c_str(),
    -                       GetCommandInterpreter().GetDebugger().GetID());
    -    PyRun_SimpleString (run_string.GetData());
    -    run_string.Clear();
    -    
    -
    -    ExecutionContext exe_ctx (m_interpreter.GetDebugger().GetSelectedExecutionContext());
    -
    -    if (exe_ctx.GetTargetPtr())
    -        run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')", 
    -                           m_dictionary_name.c_str());
    -    else
    -        run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.SBTarget()')", m_dictionary_name.c_str());
    -    PyRun_SimpleString (run_string.GetData());
    -    run_string.Clear();
    -
    -    if (exe_ctx.GetProcessPtr())
    -        run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
    -    else
    -        run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.SBProcess()')", m_dictionary_name.c_str());
    -    PyRun_SimpleString (run_string.GetData());
    -    run_string.Clear();
    -
    -    if (exe_ctx.GetThreadPtr())
    -        run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')", 
    -                           m_dictionary_name.c_str());
    -    else
    -        run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.SBThread()')", m_dictionary_name.c_str());
    -    PyRun_SimpleString (run_string.GetData());
    -    run_string.Clear();
    -    
    -    if (exe_ctx.GetFramePtr())
    -        run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')", 
    -                           m_dictionary_name.c_str());
    -    else
    -        run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.SBFrame()')", m_dictionary_name.c_str());
         PyRun_SimpleString (run_string.GetData());
         run_string.Clear();
         
         PyObject *sysmod = PyImport_AddModule ("sys");
         PyObject *sysdict = PyModule_GetDict (sysmod);
         
    -    if ((m_new_sysout != NULL)
    -        && (sysmod != NULL)
    -        && (sysdict != NULL))
    -            PyDict_SetItemString (sysdict, "stdout", (PyObject*)m_new_sysout);
    +    if (m_new_sysout && sysmod && sysdict)
    +    {
    +        PyDict_SetItemString (sysdict, "stdout", (PyObject*)m_new_sysout);
    +        PyDict_SetItemString (sysdict, "stderr", (PyObject*)m_new_sysout);
    +    }
                 
         if (PyErr_Occurred())
             PyErr_Clear ();
    -}   
    -
    +}
     
     bool
     ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObject *result)
    
    
    
    From gclayton at apple.com  Fri Jan 27 20:22:27 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 02:22:27 -0000
    Subject: [Lldb-commits] [lldb] r149167 -
     /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    Message-ID: <20120128022227.B92A42A6C12C@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 20:22:27 2012
    New Revision: 149167
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149167&view=rev
    Log:
    Added logging so we can see the field names and offsets of any structures 
    for when we enable the assisted layout.
    
    
    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=149167&r1=149166&r2=149167&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jan 27 20:22:27 2012
    @@ -1922,15 +1922,25 @@
                         const clang::RecordDecl *record_decl = record_type->getDecl();
                         
                         if (log)
    +                    {
                             GetObjectFile()->GetModule()->LogMessage (log.get(), 
    -                                                                  "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[0], vbase_offsets[0])",
    +                                                                  "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) caching layout info for record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u], base_offsets[0], vbase_offsets[0])",
                                                                       clang_type,
                                                                       record_decl,
                                                                       layout_info.bit_size,
                                                                       layout_info.alignment,
                                                                       (uint32_t)layout_info.field_offsets.size());
                         
    -
    +                        llvm::DenseMap ::const_iterator pos, end = layout_info.field_offsets.end();
    +                        for (pos = layout_info.field_offsets.begin(); pos != end; ++pos)
    +                        {
    +                            GetObjectFile()->GetModule()->LogMessage (log.get(), 
    +                                                                      "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) field = { bit_offset=%u, name='%s' }",
    +                                                                      clang_type,
    +                                                                      (uint32_t)pos->second,
    +                                                                      pos->first->getNameAsString().c_str());
    +                        }
    +                    }
                         m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
                     }
                 }
    
    
    
    From gclayton at apple.com  Fri Jan 27 20:48:10 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 02:48:10 -0000
    Subject: [Lldb-commits] [lldb] r149168 - in /lldb/trunk:
     lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
     tools/debugserver/debugserver.xcodeproj/project.pbxproj
    Message-ID: <20120128024810.E53461BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 20:48:10 2012
    New Revision: 149168
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149168&view=rev
    Log:
    Bumping Xcode project versions for lldb-109 and debugserver-167.
    
    
    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=149168&r1=149167&r2=149168&view=diff
    ==============================================================================
    --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 20:48:10 2012
    @@ -3748,9 +3748,9 @@
     			isa = XCBuildConfiguration;
     			buildSettings = {
     				ALWAYS_SEARCH_USER_PATHS = NO;
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				DYLIB_COMPATIBILITY_VERSION = 1;
    -				DYLIB_CURRENT_VERSION = 108;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -3808,10 +3808,10 @@
     			isa = XCBuildConfiguration;
     			buildSettings = {
     				ALWAYS_SEARCH_USER_PATHS = NO;
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				DEAD_CODE_STRIPPING = YES;
     				DYLIB_COMPATIBILITY_VERSION = 1;
    -				DYLIB_CURRENT_VERSION = 108;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -3867,8 +3867,8 @@
     		2689FFD513353D7A00698AC0 /* Debug */ = {
     			isa = XCBuildConfiguration;
     			buildSettings = {
    -				CURRENT_PROJECT_VERSION = 108;
    -				DYLIB_CURRENT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXECUTABLE_EXTENSION = a;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -3896,8 +3896,8 @@
     		2689FFD613353D7A00698AC0 /* Release */ = {
     			isa = XCBuildConfiguration;
     			buildSettings = {
    -				CURRENT_PROJECT_VERSION = 108;
    -				DYLIB_CURRENT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXECUTABLE_EXTENSION = a;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -3925,8 +3925,8 @@
     		2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = {
     			isa = XCBuildConfiguration;
     			buildSettings = {
    -				CURRENT_PROJECT_VERSION = 108;
    -				DYLIB_CURRENT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXECUTABLE_EXTENSION = a;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -4006,7 +4006,7 @@
     			isa = XCBuildConfiguration;
     			buildSettings = {
     				COPY_PHASE_STRIP = YES;
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
     					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
    @@ -4037,10 +4037,10 @@
     			buildSettings = {
     				ALWAYS_SEARCH_USER_PATHS = NO;
     				COPY_PHASE_STRIP = YES;
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				DEAD_CODE_STRIPPING = YES;
     				DYLIB_COMPATIBILITY_VERSION = 1;
    -				DYLIB_CURRENT_VERSION = 108;
    +				DYLIB_CURRENT_VERSION = 109;
     				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
    @@ -4278,7 +4278,7 @@
     		26F5C26C10F3D9A5009D5894 /* Debug */ = {
     			isa = XCBuildConfiguration;
     			buildSettings = {
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
     					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
    @@ -4308,7 +4308,7 @@
     		26F5C26D10F3D9A5009D5894 /* Release */ = {
     			isa = XCBuildConfiguration;
     			buildSettings = {
    -				CURRENT_PROJECT_VERSION = 108;
    +				CURRENT_PROJECT_VERSION = 109;
     				FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
     					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
    
    Modified: lldb/trunk/resources/LLDB-Info.plist
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=149168&r1=149167&r2=149168&view=diff
    ==============================================================================
    --- lldb/trunk/resources/LLDB-Info.plist (original)
    +++ lldb/trunk/resources/LLDB-Info.plist Fri Jan 27 20:48:10 2012
    @@ -17,7 +17,7 @@
     	CFBundleSignature
     	????
     	CFBundleVersion
    -	108
    +	109
     	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=149168&r1=149167&r2=149168&view=diff
    ==============================================================================
    --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jan 27 20:48:10 2012
    @@ -490,7 +490,7 @@
     					i386,
     				);
     				COPY_PHASE_STRIP = NO;
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				GCC_WARN_ABOUT_RETURN_TYPE = YES;
     				GCC_WARN_UNUSED_VARIABLE = YES;
     				SDKROOT = "";
    @@ -509,7 +509,7 @@
     					x86_64,
     					i386,
     				);
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				DEAD_CODE_STRIPPING = YES;
     				GCC_WARN_ABOUT_RETURN_TYPE = YES;
     				GCC_WARN_UNUSED_VARIABLE = YES;
    @@ -530,7 +530,7 @@
     					x86_64,
     					i386,
     				);
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				DEAD_CODE_STRIPPING = YES;
     				GCC_WARN_ABOUT_RETURN_TYPE = YES;
     				GCC_WARN_UNUSED_VARIABLE = YES;
    @@ -549,7 +549,7 @@
     				"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
     				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
     				COPY_PHASE_STRIP = YES;
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
     				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
     				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
    @@ -589,7 +589,7 @@
     				"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
     				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
     				COPY_PHASE_STRIP = YES;
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
     				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
     					"$(SDKROOT)/System/Library/PrivateFrameworks",
    @@ -628,7 +628,7 @@
     				"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
     				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
     				COPY_PHASE_STRIP = YES;
    -				CURRENT_PROJECT_VERSION = 166;
    +				CURRENT_PROJECT_VERSION = 167;
     				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
     				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
     				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
    
    
    
    From gclayton at apple.com  Fri Jan 27 20:51:43 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 02:51:43 -0000
    Subject: [Lldb-commits] [lldb] r149169 - /lldb/tags/lldb-109/
    Message-ID: <20120128025143.B61F81BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 20:51:43 2012
    New Revision: 149169
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149169&view=rev
    Log:
    lldb-109
    
    
    Added:
        lldb/tags/lldb-109/
          - copied from r149168, lldb/trunk/
    
    
    From gclayton at apple.com  Fri Jan 27 21:14:56 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sat, 28 Jan 2012 03:14:56 -0000
    Subject: [Lldb-commits] [lldb] r149170 - in /lldb/tags/lldb-109:
     lldb.xcodeproj/project.pbxproj
     tools/debugserver/debugserver.xcodeproj/project.pbxproj
    Message-ID: <20120128031456.9F4E71BE003@llvm.org>
    
    Author: gclayton
    Date: Fri Jan 27 21:14:56 2012
    New Revision: 149170
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149170&view=rev
    Log:
    Removing the code signing shell script build phase as it isn't properly detecting
    BuildAndIntegration builds.
    
    
    Modified:
        lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj
        lldb/tags/lldb-109/tools/debugserver/debugserver.xcodeproj/project.pbxproj
    
    Modified: lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj
    URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj?rev=149170&r1=149169&r2=149170&view=diff
    ==============================================================================
    --- lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj (original)
    +++ lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj Fri Jan 27 21:14:56 2012
    @@ -2947,7 +2947,6 @@
     			buildPhases = (
     				26DC6A0D1337FE6900FF7998 /* Sources */,
     				26DC6A0E1337FE6900FF7998 /* Frameworks */,
    -				261CE9C014D327DE006D8EFE /* Codesign */,
     			);
     			buildRules = (
     			);
    @@ -3079,20 +3078,6 @@
     			shellPath = /bin/sh;
     			shellScript = "cd \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nfor file in *.h\ndo\n\t/usr/bin/sed -i '' 's/\\(#include\\)[ ]*\"lldb\\/\\(API\\/\\)\\{0,1\\}\\(.*\\)\"/\\1 /1' \"$file\"\n\t/usr/bin/sed -i '' 's|
    
    Author: jmolenda
    Date: Fri Jan 27 22:19:15 2012
    New Revision: 149171
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149171&view=rev
    Log:
    Fix shell commands that do code signing.
    
    Modified:
        lldb/trunk/lldb.xcodeproj/project.pbxproj
        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=149171&r1=149170&r2=149171&view=diff
    ==============================================================================
    --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 22:19:15 2012
    @@ -3091,7 +3091,7 @@
     			);
     			runOnlyForDeploymentPostprocessing = 0;
     			shellPath = "/bin/sh -x";
    -			shellScript = "if [ $CONFIGURATION!=\"BuildAndIntegration\" ]; then\n  if [ $PLATFORM_NAME=\"macosx\" ]; then\n    /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\n  fi\nfi";
    +			shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
     		};
     		261EECA21337D399001D193C /* Build llvm and clang */ = {
     			isa = PBXShellScriptBuildPhase;
    
    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=149171&r1=149170&r2=149171&view=diff
    ==============================================================================
    --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jan 27 22:19:15 2012
    @@ -417,7 +417,7 @@
     			);
     			runOnlyForDeploymentPostprocessing = 0;
     			shellPath = "/bin/sh -x";
    -			shellScript = "if [ $CONFIGURATION!=\"BuildAndIntegration\" ]; then\n  if [ $PLATFORM_NAME=\"macosx\" ]; then\n    /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\n  fi\nfi";
    +			shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
     		};
     		26CE05C7115C36870022F371 /* ShellScript */ = {
     			isa = PBXShellScriptBuildPhase;
    
    
    
    From gclayton at apple.com  Sun Jan 29 00:07:39 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sun, 29 Jan 2012 06:07:39 -0000
    Subject: [Lldb-commits] [lldb] r149191 - in /lldb/trunk: include/lldb/API/
     scripts/Python/interface/ source/API/
    Message-ID: <20120129060740.040F32A6C12C@llvm.org>
    
    Author: gclayton
    Date: Sun Jan 29 00:07:39 2012
    New Revision: 149191
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149191&view=rev
    Log:
    Added the ability to get the target triple, byte order and address byte size
    from the SBTarget and SBModule interfaces. Also added many python properties
    for easier access to many things from many SB objects.
    
    
    Modified:
        lldb/trunk/include/lldb/API/SBAddress.h
        lldb/trunk/include/lldb/API/SBModule.h
        lldb/trunk/include/lldb/API/SBTarget.h
        lldb/trunk/scripts/Python/interface/SBAddress.i
        lldb/trunk/scripts/Python/interface/SBCompileUnit.i
        lldb/trunk/scripts/Python/interface/SBData.i
        lldb/trunk/scripts/Python/interface/SBError.i
        lldb/trunk/scripts/Python/interface/SBFileSpec.i
        lldb/trunk/scripts/Python/interface/SBFrame.i
        lldb/trunk/scripts/Python/interface/SBFunction.i
        lldb/trunk/scripts/Python/interface/SBInstruction.i
        lldb/trunk/scripts/Python/interface/SBLineEntry.i
        lldb/trunk/scripts/Python/interface/SBModule.i
        lldb/trunk/scripts/Python/interface/SBProcess.i
        lldb/trunk/scripts/Python/interface/SBSection.i
        lldb/trunk/scripts/Python/interface/SBTarget.i
        lldb/trunk/scripts/Python/interface/SBThread.i
        lldb/trunk/scripts/Python/interface/SBType.i
        lldb/trunk/scripts/Python/interface/SBValue.i
        lldb/trunk/source/API/SBAddress.cpp
        lldb/trunk/source/API/SBModule.cpp
        lldb/trunk/source/API/SBTarget.cpp
    
    Modified: lldb/trunk/include/lldb/API/SBAddress.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBAddress.h (original)
    +++ lldb/trunk/include/lldb/API/SBAddress.h Sun Jan 29 00:07:39 2012
    @@ -76,6 +76,9 @@
         lldb::SBSection
         GetSection ();
     
    +    lldb::addr_t
    +    GetOffset ();
    +
         lldb::SBModule
         GetModule ();
         
    
    Modified: lldb/trunk/include/lldb/API/SBModule.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBModule.h (original)
    +++ lldb/trunk/include/lldb/API/SBModule.h Sun Jan 29 00:07:39 2012
    @@ -73,6 +73,15 @@
         bool
         SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
     
    +    lldb::ByteOrder
    +    GetByteOrder ();
    +    
    +    uint32_t
    +    GetAddressByteSize();
    +    
    +    const char *
    +    GetTriple ();
    +
     #ifndef SWIG
         const uint8_t *
         GetUUIDBytes () const;
    
    Modified: lldb/trunk/include/lldb/API/SBTarget.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBTarget.h (original)
    +++ lldb/trunk/include/lldb/API/SBTarget.h Sun Jan 29 00:07:39 2012
    @@ -269,6 +269,15 @@
         lldb::SBModule
         FindModule (const lldb::SBFileSpec &file_spec);
     
    +    lldb::ByteOrder
    +    GetByteOrder ();
    +
    +    uint32_t
    +    GetAddressByteSize();
    +
    +    const char *
    +    GetTriple ();
    +
         //------------------------------------------------------------------
         /// Set the base load address for a module section.
         ///
    
    Modified: lldb/trunk/scripts/Python/interface/SBAddress.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBAddress.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBAddress.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBAddress.i Sun Jan 29 00:07:39 2012
    @@ -82,6 +82,9 @@
         lldb::SBSection
         GetSection ();
     
    +    lldb::addr_t
    +    SBAddress::GetOffset ();
    +
         %feature("docstring", "
         //------------------------------------------------------------------
         /// GetSymbolContext() and the following can lookup symbol information for a given address.
    @@ -124,6 +127,37 @@
     
         lldb::SBLineEntry
         GetLineEntry ();
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["module"] = GetModule
    +        if _newclass: x = property(GetModule, None)
    +
    +        __swig_getmethods__["compile_unit"] = GetCompileUnit
    +        if _newclass: x = property(GetCompileUnit, None)
    +
    +        __swig_getmethods__["line_entry"] = GetLineEntry
    +        if _newclass: x = property(GetLineEntry, None)
    +
    +        __swig_getmethods__["function"] = GetFunction
    +        if _newclass: x = property(GetFunction, None)
    +
    +        __swig_getmethods__["block"] = GetBlock
    +        if _newclass: x = property(GetBlock, None)
    +
    +        __swig_getmethods__["symbol"] = GetSymbol
    +        if _newclass: x = property(GetSymbol, None)
    +
    +        __swig_getmethods__["offset"] = GetOffset
    +        if _newclass: x = property(GetOffset, None)
    +
    +        __swig_getmethods__["section"] = GetSection
    +        if _newclass: x = property(GetSection, None)
    +
    +        __swig_getmethods__["file_addr"] = GetFileAddress
    +        if _newclass: x = property(GetFileAddress, None)
    +
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBCompileUnit.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCompileUnit.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBCompileUnit.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBCompileUnit.i Sun Jan 29 00:07:39 2012
    @@ -79,6 +79,14 @@
     
         bool
         GetDescription (lldb::SBStream &description);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["file"] = GetFileSpec
    +        if _newclass: x = property(GetFileSpec, None)
    +        
    +        __swig_getmethods__["num_line_entries"] = GetNumLineEntries
    +        if _newclass: x = property(GetNumLineEntries, None)
    +    %}
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBData.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBData.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBData.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBData.i Sun Jan 29 00:07:39 2012
    @@ -133,6 +133,16 @@
         bool
         SetDataFromDoubleArray (double* array, size_t array_len);
     
    +    %pythoncode %{
    +        __swig_getmethods__["byte_order"] = GetByteOrder
    +        __swig_setmethods__["byte_order"] = SetByteOrder
    +        if _newclass: x = property(GetByteOrder, SetByteOrder)
    +        
    +        __swig_getmethods__["size"] = GetByteSize
    +        if _newclass: x = property(GetByteSize, None)
    +        
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBError.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBError.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBError.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBError.i Sun Jan 29 00:07:39 2012
    @@ -102,6 +102,25 @@
     
         bool
         GetDescription (lldb::SBStream &description);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["value"] = GetError
    +        if _newclass: x = property(GetError, None)
    +        
    +        __swig_getmethods__["fail"] = Fail
    +        if _newclass: x = property(Fail, None)
    +        
    +        __swig_getmethods__["success"] = Success
    +        if _newclass: x = property(Success, None)
    +        
    +        __swig_getmethods__["description"] = GetCString
    +        if _newclass: x = property(GetCString, None)
    +        
    +        __swig_getmethods__["type"] = GetType
    +        if _newclass: x = property(GetType, None)
    +        
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBFileSpec.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFileSpec.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBFileSpec.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBFileSpec.i Sun Jan 29 00:07:39 2012
    @@ -66,6 +66,18 @@
     
         bool
         GetDescription (lldb::SBStream &description) const;
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["basename"] = GetFilename
    +        if _newclass: x = property(GetFilename, None)
    +        
    +        __swig_getmethods__["dirname"] = GetDirectory
    +        if _newclass: x = property(GetDirectory, None)
    +        
    +        __swig_getmethods__["exists"] = Exists
    +        if _newclass: x = property(Exists, None)
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBFrame.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFrame.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBFrame.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBFrame.i Sun Jan 29 00:07:39 2012
    @@ -217,7 +217,52 @@
     
         bool
         GetDescription (lldb::SBStream &description);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["pc"] = GetPC
    +        __swig_setmethods__["pc"] = SetPC
    +        if _newclass: x = property(GetPC, SetPC)
     
    +        __swig_getmethods__["fp"] = GetFP
    +        if _newclass: x = property(GetFP, None)
    +
    +        __swig_getmethods__["sp"] = GetSP
    +        if _newclass: x = property(GetSP, None)
    +
    +        __swig_getmethods__["module"] = GetModule
    +        if _newclass: x = property(GetModule, None)
    +
    +        __swig_getmethods__["compile_unit"] = GetCompileUnit
    +        if _newclass: x = property(GetCompileUnit, None)
    +
    +        __swig_getmethods__["function"] = GetFunction
    +        if _newclass: x = property(GetFunction, None)
    +
    +        __swig_getmethods__["symbol"] = GetSymbol
    +        if _newclass: x = property(GetSymbol, None)
    +
    +        __swig_getmethods__["block"] = GetBlock
    +        if _newclass: x = property(GetBlock, None)
    +
    +        __swig_getmethods__["is_inlined"] = IsInlined
    +        if _newclass: x = property(IsInlined, None)
    +
    +        __swig_getmethods__["name"] = GetFunctionName
    +        if _newclass: x = property(GetFunctionName, None)
    +
    +        __swig_getmethods__["line_entry"] = GetLineEntry
    +        if _newclass: x = property(GetLineEntry, None)
    +
    +        __swig_getmethods__["thread"] = GetThread
    +        if _newclass: x = property(GetThread, None)
    +
    +        __swig_getmethods__["disassembly"] = Disassemble
    +        if _newclass: x = property(Disassemble, None)
    +
    +        __swig_getmethods__["idx"] = GetFrameID
    +        if _newclass: x = property(GetFrameID, None)
    +
    +    %}
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBFunction.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFunction.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBFunction.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBFunction.i Sun Jan 29 00:07:39 2012
    @@ -76,6 +76,25 @@
     
         bool
         GetDescription (lldb::SBStream &description);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +        
    +        __swig_getmethods__["mangled"] = GetMangledName
    +        if _newclass: x = property(GetMangledName, None)
    +        
    +        __swig_getmethods__["start_addr"] = GetStartAddress
    +        if _newclass: x = property(GetStartAddress, None)
    +        
    +        __swig_getmethods__["end_addr"] = GetEndAddress
    +        if _newclass: x = property(GetEndAddress, None)
    +        
    +        __swig_getmethods__["prologue_size"] = GetPrologueByteSize
    +        if _newclass: x = property(GetPrologueByteSize, None)
    +        
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBInstruction.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBInstruction.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBInstruction.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBInstruction.i Sun Jan 29 00:07:39 2012
    @@ -62,6 +62,19 @@
         
         bool
         TestEmulation (lldb::SBStream &output_stream, const char *test_file);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["addr"] = GetAddress
    +        if _newclass: x = property(GetAddress, None)
    +        
    +        __swig_getmethods__["size"] = GetByteSize
    +        if _newclass: x = property(GetByteSize, None)
    +
    +        __swig_getmethods__["is_branch"] = DoesBranch
    +        if _newclass: x = property(DoesBranch, None)
    +    %}
    +    
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBLineEntry.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBLineEntry.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBLineEntry.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBLineEntry.i Sun Jan 29 00:07:39 2012
    @@ -77,6 +77,24 @@
         void
         SetColumn (uint32_t column);
     
    +    %pythoncode %{
    +        __swig_getmethods__["file"] = GetFileSpec
    +        if _newclass: x = property(GetFileSpec, None)
    +        
    +        __swig_getmethods__["line"] = GetLine
    +        if _newclass: x = property(GetLine, None)
    +        
    +        __swig_getmethods__["column"] = GetColumn
    +        if _newclass: x = property(GetColumn, None)
    +        
    +        __swig_getmethods__["start_addr"] = GetStartAddress
    +        if _newclass: x = property(GetStartAddress, None)
    +        
    +        __swig_getmethods__["end_addr"] = GetEndAddress
    +        if _newclass: x = property(GetEndAddress, None)
    +        
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBModule.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBModule.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBModule.i Sun Jan 29 00:07:39 2012
    @@ -236,6 +236,43 @@
         FindGlobalVariables (lldb::SBTarget &target, 
                              const char *name, 
                              uint32_t max_matches);
    +    
    +    lldb::ByteOrder
    +    GetByteOrder ();
    +    
    +    uint32_t
    +    GetAddressByteSize();
    +    
    +    const char *
    +    GetTriple ();
    +
    +    %pythoncode %{
    +        __swig_getmethods__["file"] = GetFileSpec
    +        if _newclass: x = property(GetFileSpec, None)
    +        
    +        __swig_getmethods__["platform_file"] = GetPlatformFileSpec
    +        if _newclass: x = property(GetPlatformFileSpec, None)
    +        
    +        __swig_getmethods__["uuid"] = GetUUIDString
    +        if _newclass: x = property(GetUUIDString, None)
    +        
    +        __swig_getmethods__["byte_order"] = GetByteOrder
    +        if _newclass: x = property(GetByteOrder, None)
    +        
    +        __swig_getmethods__["addr_size"] = GetAddressByteSize
    +        if _newclass: x = property(GetAddressByteSize, None)
    +        
    +        __swig_getmethods__["triple"] = GetTriple
    +        if _newclass: x = property(GetTriple, None)
    +
    +        __swig_getmethods__["num_symbols"] = GetNumSymbols
    +        if _newclass: x = property(GetNumSymbols, None)
    +        
    +        __swig_getmethods__["num_sections"] = GetNumSections
    +        if _newclass: x = property(GetNumSections, None)
    +        
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBProcess.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBProcess.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBProcess.i Sun Jan 29 00:07:39 2012
    @@ -281,6 +281,33 @@
         lldb::SBError
         UnloadImage (uint32_t image_token);
     
    +    %pythoncode %{
    +        __swig_getmethods__["id"] = GetProcessID
    +        if _newclass: x = property(GetProcessID, None)
    +        
    +        __swig_getmethods__["target"] = GetTarget
    +        if _newclass: x = property(GetTarget, None)
    +        
    +        __swig_getmethods__["num_threads"] = GetNumThreads
    +        if _newclass: x = property(GetNumThreads, None)
    +        
    +        __swig_getmethods__["selected_thread"] = GetSelectedThread
    +        __swig_setmethods__["selected_thread"] = SetSelectedThread
    +        if _newclass: x = property(GetSelectedThread, SetSelectedThread)
    +        
    +        __swig_getmethods__["state"] = GetState
    +        if _newclass: x = property(GetState, None)
    +        
    +        __swig_getmethods__["exit_state"] = GetExitStatus
    +        if _newclass: x = property(GetExitStatus, None)
    +        
    +        __swig_getmethods__["exit_description"] = GetExitDescription
    +        if _newclass: x = property(GetExitDescription, None)
    +        
    +        __swig_getmethods__["broadcaster"] = GetBroadcaster
    +        if _newclass: x = property(GetBroadcaster, None)
    +    %}
    +
     };
     
     }  // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBSection.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSection.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBSection.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBSection.i Sun Jan 29 00:07:39 2012
    @@ -87,6 +87,30 @@
         bool
         GetDescription (lldb::SBStream &description);
         
    +    %pythoncode %{
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +
    +        __swig_getmethods__["file_addr"] = GetFileAddress
    +        if _newclass: x = property(GetFileAddress, None)
    +
    +        __swig_getmethods__["size"] = GetByteSize
    +        if _newclass: x = property(GetByteSize, None)
    +
    +        __swig_getmethods__["file_offset"] = GetFileOffset
    +        if _newclass: x = property(GetFileOffset, None)
    +
    +        __swig_getmethods__["file_size"] = GetFileByteSize
    +        if _newclass: x = property(GetFileByteSize, None)
    +
    +        __swig_getmethods__["data"] = GetSectionData
    +        if _newclass: x = property(GetSectionData, None)
    +
    +        __swig_getmethods__["type"] = GetSectionType
    +        if _newclass: x = property(GetSectionType, None)
    +
    +    %}
    +
     private:
     
         std::auto_ptr m_opaque_ap;
    
    Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBTarget.i Sun Jan 29 00:07:39 2012
    @@ -311,6 +311,15 @@
         lldb::SBModule
         FindModule (const lldb::SBFileSpec &file_spec);
     
    +    lldb::ByteOrder
    +    GetByteOrder ();
    +    
    +    uint32_t
    +    GetAddressByteSize();
    +    
    +    const char *
    +    GetTriple ();
    +
         lldb::SBError
         SetSectionLoadAddress (lldb::SBSection section,
                                lldb::addr_t section_base_addr);
    @@ -476,6 +485,39 @@
         
         bool
         GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["process"] = GetProcess
    +        if _newclass: x = property(GetProcess, None)
    +
    +        __swig_getmethods__["executable"] = GetExecutable
    +        if _newclass: x = property(GetExecutable, None)
    +
    +        __swig_getmethods__["debugger"] = GetDebugger
    +        if _newclass: x = property(GetDebugger, None)
    +
    +        __swig_getmethods__["file_offset"] = GetFileOffset
    +        if _newclass: x = property(GetFileOffset, None)
    +
    +        __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
    +        if _newclass: x = property(GetNumBreakpoints, None)
    +
    +        __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
    +        if _newclass: x = property(GetNumWatchpoints, None)
    +
    +        __swig_getmethods__["broadcaster"] = GetBroadcaster
    +        if _newclass: x = property(GetBroadcaster, None)
    +        
    +        __swig_getmethods__["byte_order"] = GetByteOrder
    +        if _newclass: x = property(GetByteOrder, None)
    +        
    +        __swig_getmethods__["addr_size"] = GetAddressByteSize
    +        if _newclass: x = property(GetAddressByteSize, None)
    +        
    +        __swig_getmethods__["triple"] = GetTriple
    +        if _newclass: x = property(GetTriple, None)
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBThread.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBThread.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBThread.i Sun Jan 29 00:07:39 2012
    @@ -173,6 +173,36 @@
     
         bool
         GetDescription (lldb::SBStream &description) const;
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["id"] = GetThreadID
    +        if _newclass: x = property(GetThreadID, None)
    +
    +        __swig_getmethods__["idx"] = GetIndexID
    +        if _newclass: x = property(GetIndexID, None)
    +
    +        __swig_getmethods__["return_value"] = GetStopReturnValue
    +        if _newclass: x = property(GetStopReturnValue, None)
    +
    +        __swig_getmethods__["process"] = GetProcess
    +        if _newclass: x = property(GetProcess, None)
    +
    +        __swig_getmethods__["num_frames"] = GetNumFrames
    +        if _newclass: x = property(GetNumFrames, None)
    +
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +
    +        __swig_getmethods__["queue"] = GetQueueName
    +        if _newclass: x = property(GetQueueName, None)
    +
    +        __swig_getmethods__["stop_reason"] = GetStopReason
    +        if _newclass: x = property(GetStopReason, None)
    +
    +        __swig_getmethods__["is_suspended"] = IsSuspended
    +        if _newclass: x = property(IsSuspended, None)
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/scripts/Python/interface/SBType.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBType.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBType.i Sun Jan 29 00:07:39 2012
    @@ -37,6 +37,20 @@
         uint64_t
         GetOffsetInBits();
         
    +    %pythoncode %{
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +        
    +        __swig_getmethods__["type"] = GetType
    +        if _newclass: x = property(GetType, None)
    +        
    +        __swig_getmethods__["byte_offset"] = GetOffsetInBytes
    +        if _newclass: x = property(GetOffsetInBytes, None)
    +        
    +        __swig_getmethods__["bit_offset"] = GetOffsetInBits
    +        if _newclass: x = property(GetOffsetInBits, None)
    +    %}    
    +
     protected:
         std::auto_ptr m_opaque_ap;
     };
    @@ -174,6 +188,33 @@
         
         lldb::TypeClass
         GetTypeClass ();
    +    
    +    %pythoncode %{
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +        
    +        __swig_getmethods__["size"] = GetByteSize
    +        if _newclass: x = property(GetByteSize, None)
    +        
    +        __swig_getmethods__["is_pointer"] = IsPointerType
    +        if _newclass: x = property(IsPointerType, None)
    +        
    +        __swig_getmethods__["is_reference"] = IsReferenceType
    +        if _newclass: x = property(IsReferenceType, None)
    +
    +        __swig_getmethods__["num_fields"] = GetNumberOfFields
    +        if _newclass: x = property(GetNumberOfFields, None)
    +        
    +        __swig_getmethods__["num_bases"] = GetNumberOfDirectBaseClasses
    +        if _newclass: x = property(GetNumberOfDirectBaseClasses, None)
    +        
    +        __swig_getmethods__["num_vbases"] = GetNumberOfVirtualBaseClasses
    +        if _newclass: x = property(GetNumberOfVirtualBaseClasses, None)
    +        
    +        __swig_getmethods__["class"] = GetTypeClass
    +        if _newclass: x = property(GetTypeClass, None)
    +    %}
    +
     };
     
     %feature("docstring",
    
    Modified: lldb/trunk/scripts/Python/interface/SBValue.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBValue.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBValue.i Sun Jan 29 00:07:39 2012
    @@ -362,6 +362,82 @@
         ) GetExpressionPath;
         bool
         GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
    +    
    +    %pythoncode %{
    +
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +
    +        __swig_getmethods__["type"] = GetType
    +        if _newclass: x = property(GetType, None)
    +
    +        __swig_getmethods__["size"] = GetByteSize
    +        if _newclass: x = property(GetByteSize, None)
    +
    +        __swig_getmethods__["name"] = GetName
    +        if _newclass: x = property(GetName, None)
    +
    +        __swig_getmethods__["is_in_scope"] = IsInScope
    +        if _newclass: x = property(IsInScope, None)
    +
    +        __swig_getmethods__["format"] = GetFormat
    +        __swig_setmethods__["format"] = SetFormat
    +        if _newclass: x = property(GetName, SetFormat)
    +
    +        __swig_getmethods__["value"] = GetValue
    +        __swig_setmethods__["value"] = SetValueFromCString
    +        if _newclass: x = property(GetValue, SetValueFromCString)
    +
    +        __swig_getmethods__["value_type"] = GetValueType
    +        if _newclass: x = property(GetValueType, None)
    +
    +        __swig_getmethods__["changed"] = GetValueDidChange
    +        if _newclass: x = property(GetValueDidChange, None)
    +
    +        __swig_getmethods__["data"] = GetData
    +        if _newclass: x = property(GetData, None)
    +
    +        __swig_getmethods__["load_addr"] = GetLoadAddress
    +        if _newclass: x = property(GetLoadAddress, None)
    +
    +        __swig_getmethods__["addr"] = GetAddress
    +        if _newclass: x = property(GetAddress, None)
    +
    +        __swig_getmethods__["deref"] = Dereference
    +        if _newclass: x = property(Dereference, None)
    +
    +        __swig_getmethods__["address_of"] = AddressOf
    +        if _newclass: x = property(AddressOf, None)
    +
    +        __swig_getmethods__["error"] = GetError
    +        if _newclass: x = property(GetError, None)
    +    
    +        __swig_getmethods__["summary"] = GetSummary
    +        if _newclass: x = property(GetSummary, None)
    +
    +        __swig_getmethods__["description"] = GetObjectDescription
    +        if _newclass: x = property(GetObjectDescription, None)
    +
    +        __swig_getmethods__["location"] = GetLocation
    +        if _newclass: x = property(GetLocation, None)
    +
    +        __swig_getmethods__["target"] = GetTarget
    +        if _newclass: x = property(GetTarget, None)
    +
    +        __swig_getmethods__["process"] = GetProcess
    +        if _newclass: x = property(GetProcess, None)
    +
    +        __swig_getmethods__["thread"] = GetThread
    +        if _newclass: x = property(GetThread, None)
    +
    +        __swig_getmethods__["frame"] = GetFrame
    +        if _newclass: x = property(GetFrame, None)
    +
    +        __swig_getmethods__["num_children"] = GetNumChildren
    +        if _newclass: x = property(GetNumChildren, None)
    +
    +    %}
    +
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/source/API/SBAddress.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBAddress.cpp (original)
    +++ lldb/trunk/source/API/SBAddress.cpp Sun Jan 29 00:07:39 2012
    @@ -229,6 +229,13 @@
         return sb_section;
     }
     
    +lldb::addr_t
    +SBAddress::GetOffset ()
    +{
    +    if (m_opaque_ap.get())
    +        m_opaque_ap->GetAddress().GetOffset();
    +    return 0;
    +}
     
     Address *
     SBAddress::operator->()
    
    Modified: lldb/trunk/source/API/SBModule.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBModule.cpp (original)
    +++ lldb/trunk/source/API/SBModule.cpp Sun Jan 29 00:07:39 2012
    @@ -475,3 +475,34 @@
         return sb_section;
     }
     
    +lldb::ByteOrder
    +SBModule::GetByteOrder ()
    +{
    +    if (m_opaque_sp)
    +        return m_opaque_sp->GetArchitecture().GetByteOrder();
    +    return eByteOrderInvalid;
    +}
    +
    +const char *
    +SBModule::GetTriple ()
    +{
    +    if (m_opaque_sp)
    +    {
    +        std::string triple (m_opaque_sp->GetArchitecture().GetTriple().str());
    +        // Unique the string so we don't run into ownership issues since
    +        // the const strings put the string into the string pool once and
    +        // the strings never comes out
    +        ConstString const_triple (triple.c_str());
    +        return const_triple.GetCString();
    +    }
    +    return NULL;
    +}
    +
    +uint32_t
    +SBModule::GetAddressByteSize()
    +{
    +    if (m_opaque_sp)
    +        return m_opaque_sp->GetArchitecture().GetAddressByteSize();
    +    return sizeof(void*);
    +}
    +
    
    Modified: lldb/trunk/source/API/SBTarget.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=149191&r1=149190&r2=149191&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBTarget.cpp (original)
    +++ lldb/trunk/source/API/SBTarget.cpp Sun Jan 29 00:07:39 2012
    @@ -1113,6 +1113,38 @@
         return sb_module;
     }
     
    +lldb::ByteOrder
    +SBTarget::GetByteOrder ()
    +{
    +    if (m_opaque_sp)
    +        return m_opaque_sp->GetArchitecture().GetByteOrder();
    +    return eByteOrderInvalid;
    +}
    +
    +const char *
    +SBTarget::GetTriple ()
    +{
    +    if (m_opaque_sp)
    +    {
    +        std::string triple (m_opaque_sp->GetArchitecture().GetTriple().str());
    +        // Unique the string so we don't run into ownership issues since
    +        // the const strings put the string into the string pool once and
    +        // the strings never comes out
    +        ConstString const_triple (triple.c_str());
    +        return const_triple.GetCString();
    +    }
    +    return NULL;
    +}
    +
    +uint32_t
    +SBTarget::GetAddressByteSize()
    +{
    +    if (m_opaque_sp)
    +        return m_opaque_sp->GetArchitecture().GetAddressByteSize();
    +    return sizeof(void*);
    +}
    +
    +
     SBModule
     SBTarget::GetModuleAtIndex (uint32_t idx)
     {
    
    
    
    From gclayton at apple.com  Sun Jan 29 01:09:30 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sun, 29 Jan 2012 07:09:30 -0000
    Subject: [Lldb-commits] [lldb] r149192 -
    	/lldb/trunk/scripts/Python/interface/SBTarget.i
    Message-ID: <20120129070930.53C642A6C12C@llvm.org>
    
    Author: gclayton
    Date: Sun Jan 29 01:09:30 2012
    New Revision: 149192
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149192&view=rev
    Log:
    Removed an incorrectly added property from SBTarget.i
    
    
    Modified:
        lldb/trunk/scripts/Python/interface/SBTarget.i
    
    Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=149192&r1=149191&r2=149192&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
    +++ lldb/trunk/scripts/Python/interface/SBTarget.i Sun Jan 29 01:09:30 2012
    @@ -496,9 +496,6 @@
             __swig_getmethods__["debugger"] = GetDebugger
             if _newclass: x = property(GetDebugger, None)
     
    -        __swig_getmethods__["file_offset"] = GetFileOffset
    -        if _newclass: x = property(GetFileOffset, None)
    -
             __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
             if _newclass: x = property(GetNumBreakpoints, None)
     
    
    
    
    From gclayton at apple.com  Sun Jan 29 14:56:32 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Sun, 29 Jan 2012 20:56:32 -0000
    Subject: [Lldb-commits] [lldb] r149207 - in /lldb/trunk: include/lldb/
     include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/
     include/lldb/Interpreter/ include/lldb/Symbol/ include/lldb/Target/
     include/lldb/Utility/ lldb.xcodeproj/xcshareddata/xcschemes/ source/
     source/API/ source/Breakpoint/ source/Commands/ source/Core/
     source/Expression/ source/Interpreter/ source/Plugins/Disassembler/llvm/
     source/Plugins/DynamicLoader/MacOSX-DYLD/
     source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/
     source/Plugins/ObjectConta...
    Message-ID: <20120129205633.2020D2A6C12C@llvm.org>
    
    Author: gclayton
    Date: Sun Jan 29 14:56:30 2012
    New Revision: 149207
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149207&view=rev
    Log:
    Switching back to using std::tr1::shared_ptr. We originally switched away
    due to RTTI worries since llvm and clang don't use RTTI, but I was able to 
    switch back with no issues as far as I can tell. Once the RTTI issue wasn't
    an issue, we were looking for a way to properly track weak pointers to objects
    to solve some of the threading issues we have been running into which naturally
    led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared 
    pointer from just a pointer, which is also easily solved using the 
    std::tr1::enable_shared_from_this class. 
    
    The main reason for this move back is so we can start properly having weak
    references to objects. Currently a lldb_private::Thread class has a refrence
    to its parent lldb_private::Process. This doesn't work well when we now hand
    out a SBThread object that contains a shared pointer to a lldb_private::Thread
    as this SBThread can be held onto by external clients and if they end up
    using one of these objects we can easily crash.
    
    So the next task is to start adopting std::tr1::weak_ptr where ever it makes
    sense which we can do with lldb_private::Debugger, lldb_private::Target,
    lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
    many more objects now that they are no longer using intrusive ref counted
    pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
    pointers).
    
    
    Modified:
        lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
        lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
        lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
        lldb/trunk/include/lldb/Core/Address.h
        lldb/trunk/include/lldb/Core/Debugger.h
        lldb/trunk/include/lldb/Core/FormatClasses.h
        lldb/trunk/include/lldb/Core/FormatManager.h
        lldb/trunk/include/lldb/Core/FormatNavigator.h
        lldb/trunk/include/lldb/Core/Module.h
        lldb/trunk/include/lldb/Core/SearchFilter.h
        lldb/trunk/include/lldb/Core/SourceManager.h
        lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
        lldb/trunk/include/lldb/Expression/ClangUserExpression.h
        lldb/trunk/include/lldb/Interpreter/Args.h
        lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
        lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
        lldb/trunk/include/lldb/Symbol/ObjectFile.h
        lldb/trunk/include/lldb/Symbol/Type.h
        lldb/trunk/include/lldb/Target/Memory.h
        lldb/trunk/include/lldb/Target/Process.h
        lldb/trunk/include/lldb/Target/RegisterContext.h
        lldb/trunk/include/lldb/Target/StackFrame.h
        lldb/trunk/include/lldb/Target/Target.h
        lldb/trunk/include/lldb/Target/Thread.h
        lldb/trunk/include/lldb/Target/ThreadList.h
        lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
        lldb/trunk/include/lldb/lldb-forward-rtti.h
        lldb/trunk/include/lldb/lldb-types.h
        lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
        lldb/trunk/source/API/SBAddress.cpp
        lldb/trunk/source/API/SBBreakpoint.cpp
        lldb/trunk/source/API/SBBreakpointLocation.cpp
        lldb/trunk/source/API/SBFrame.cpp
        lldb/trunk/source/API/SBFunction.cpp
        lldb/trunk/source/API/SBProcess.cpp
        lldb/trunk/source/API/SBSection.cpp
        lldb/trunk/source/API/SBSymbol.cpp
        lldb/trunk/source/API/SBTarget.cpp
        lldb/trunk/source/API/SBValue.cpp
        lldb/trunk/source/Breakpoint/Breakpoint.cpp
        lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
        lldb/trunk/source/Breakpoint/BreakpointSite.cpp
        lldb/trunk/source/Commands/CommandObjectArgs.cpp
        lldb/trunk/source/Commands/CommandObjectSource.cpp
        lldb/trunk/source/Commands/CommandObjectTarget.cpp
        lldb/trunk/source/Commands/CommandObjectType.cpp
        lldb/trunk/source/Core/Address.cpp
        lldb/trunk/source/Core/AddressRange.cpp
        lldb/trunk/source/Core/Debugger.cpp
        lldb/trunk/source/Core/Disassembler.cpp
        lldb/trunk/source/Core/Module.cpp
        lldb/trunk/source/Core/ModuleList.cpp
        lldb/trunk/source/Core/SearchFilter.cpp
        lldb/trunk/source/Core/ValueObject.cpp
        lldb/trunk/source/Core/ValueObjectMemory.cpp
        lldb/trunk/source/Expression/ClangASTSource.cpp
        lldb/trunk/source/Expression/ClangFunction.cpp
        lldb/trunk/source/Expression/ClangUserExpression.cpp
        lldb/trunk/source/Expression/ClangUtilityFunction.cpp
        lldb/trunk/source/Expression/IRInterpreter.cpp
        lldb/trunk/source/Interpreter/CommandInterpreter.cpp
        lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
        lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
        lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
        lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
        lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
        lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
        lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
        lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
        lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
        lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
        lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
        lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
        lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
        lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
        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/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
        lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
        lldb/trunk/source/Symbol/ObjectFile.cpp
        lldb/trunk/source/Symbol/Symbol.cpp
        lldb/trunk/source/Symbol/SymbolVendor.cpp
        lldb/trunk/source/Symbol/Type.cpp
        lldb/trunk/source/Symbol/Variable.cpp
        lldb/trunk/source/Target/ExecutionContext.cpp
        lldb/trunk/source/Target/Process.cpp
        lldb/trunk/source/Target/StackFrame.cpp
        lldb/trunk/source/Target/Target.cpp
        lldb/trunk/source/Target/Thread.cpp
        lldb/trunk/source/Target/ThreadList.cpp
        lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
        lldb/trunk/source/lldb-log.cpp
    
    Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
    +++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Sun Jan 29 14:56:30 2012
    @@ -74,7 +74,7 @@
     /// not by the breakpoint.
     //----------------------------------------------------------------------
     class Breakpoint:
    -    public ReferenceCountedBase,
    +    public std::tr1::enable_shared_from_this,
         public Stoppoint
     {
     public:
    @@ -286,10 +286,6 @@
         lldb::BreakpointLocationSP
         GetLocationAtIndex (uint32_t index);
     
    -
    -    const lldb::BreakpointSP
    -    GetSP ();
    -
         //------------------------------------------------------------------
         // The next section deals with various breakpoint options.
         //------------------------------------------------------------------
    
    Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
    +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Sun Jan 29 14:56:30 2012
    @@ -47,7 +47,7 @@
     //----------------------------------------------------------------------
     
     class BreakpointLocation : 
    -    public ReferenceCountedBase,
    +    public std::tr1::enable_shared_from_this,
         public StoppointLocation
     {
     public:
    
    Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
    +++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Sun Jan 29 14:56:30 2012
    @@ -39,7 +39,7 @@
     //----------------------------------------------------------------------
     
     class BreakpointSite : 
    -    public ReferenceCountedBase,
    +    public std::tr1::enable_shared_from_this,
         public StoppointLocation
     {
     public:
    @@ -159,7 +159,7 @@
         ///    \a owner is the Breakpoint Location to add.
         //------------------------------------------------------------------
         void
    -    AddOwner (lldb::BreakpointLocationSP &owner);
    +    AddOwner (const lldb::BreakpointLocationSP &owner);
     
         //------------------------------------------------------------------
         /// This method returns the number of breakpoint locations currently
    @@ -263,7 +263,7 @@
         // Only the Process can create breakpoint sites in
         // Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
         BreakpointSite (BreakpointSiteList *list,
    -                    lldb::BreakpointLocationSP& owner,
    +                    const lldb::BreakpointLocationSP& owner,
                         lldb::addr_t m_addr,
                         lldb::tid_t tid,
                         bool use_hardware);
    
    Modified: lldb/trunk/include/lldb/Core/Address.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/Address.h (original)
    +++ lldb/trunk/include/lldb/Core/Address.h Sun Jan 29 14:56:30 2012
    @@ -435,7 +435,10 @@
         ///     isn't resolved yet.
         //------------------------------------------------------------------
         Module *
    -    GetModule () const;
    +    GetModulePtr () const;
    +
    +    lldb::ModuleSP
    +    GetModuleSP () const;
     
         //------------------------------------------------------------------
         /// Get const accessor for the section.
    
    Modified: lldb/trunk/include/lldb/Core/Debugger.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/Debugger.h (original)
    +++ lldb/trunk/include/lldb/Core/Debugger.h Sun Jan 29 14:56:30 2012
    @@ -251,7 +251,7 @@
     
     
     class Debugger :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public UserID,
         public DebuggerInstanceSettings
     {
    @@ -315,9 +315,6 @@
         
         void Clear();
     
    -    lldb::DebuggerSP
    -    GetSP ();
    -
         bool
         GetAsyncExecution ();
     
    
    Modified: lldb/trunk/include/lldb/Core/FormatClasses.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatClasses.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/FormatClasses.h (original)
    +++ lldb/trunk/include/lldb/Core/FormatClasses.h Sun Jan 29 14:56:30 2012
    @@ -57,7 +57,7 @@
                      bool skipptr = false,
                      bool skipref = false);
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(ValueFormat) SharedPointer;
         typedef bool(*ValueCallback)(void*, ConstString, const lldb::ValueFormatSP&);
         
         ~ValueFormat()
    @@ -115,7 +115,7 @@
         virtual void
         Update() = 0;
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
     
     };
         
    @@ -166,7 +166,7 @@
         virtual SyntheticChildrenFrontEnd::SharedPointer
         GetFrontEnd(lldb::ValueObjectSP backend) = 0;
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(SyntheticChildren) SharedPointer;
         typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
         
     };
    @@ -266,7 +266,7 @@
                 return UINT32_MAX;
             }
             
    -        typedef lldb::SharedPtr::Type SharedPointer;
    +        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
             
         };
         
    @@ -351,7 +351,7 @@
                 return m_interpreter->GetIndexOfChildWithName(m_wrapper, name.GetCString());
             }
             
    -        typedef lldb::SharedPtr::Type SharedPointer;
    +        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
             
         };
         
    @@ -550,7 +550,7 @@
             virtual uint32_t
             GetIndexOfChildWithName (const ConstString &name_cs);
             
    -        typedef lldb::SharedPtr::Type SharedPointer;
    +        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
             
         };
         
    @@ -628,7 +628,7 @@
         virtual std::string
         GetDescription() = 0;
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(SummaryFormat) SharedPointer;
         typedef bool(*SummaryCallback)(void*, ConstString, const lldb::SummaryFormatSP&);
         typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::SummaryFormatSP&);
         
    @@ -706,7 +706,7 @@
         virtual std::string
         GetDescription();
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(ScriptSummaryFormat) SharedPointer;
     
     };
     
    
    Modified: lldb/trunk/include/lldb/Core/FormatManager.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/FormatManager.h (original)
    +++ lldb/trunk/include/lldb/Core/FormatManager.h Sun Jan 29 14:56:30 2012
    @@ -154,7 +154,7 @@
                     const char** matching_category = NULL,
                     FormatCategoryItems* matching_type = NULL);
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(FormatCategory) SharedPointer;
         
     private:
         SummaryNavigator::SharedPointer m_summary_nav;
    
    Modified: lldb/trunk/include/lldb/Core/FormatNavigator.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatNavigator.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/FormatNavigator.h (original)
    +++ lldb/trunk/include/lldb/Core/FormatNavigator.h Sun Jan 29 14:56:30 2012
    @@ -232,7 +232,7 @@
         typedef typename MapType::mapped_type MapValueType;
         typedef typename BackEndType::CallbackType CallbackType;
             
    -    typedef typename lldb::SharedPtr >::Type SharedPointer;
    +    typedef typename std::tr1::shared_ptr > SharedPointer;
         
         friend class FormatCategory;
     
    
    Modified: lldb/trunk/include/lldb/Core/Module.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/Module.h (original)
    +++ lldb/trunk/include/lldb/Core/Module.h Sun Jan 29 14:56:30 2012
    @@ -44,7 +44,7 @@
     namespace lldb_private {
     
     class Module :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public SymbolContextScope
     {
     public:
    
    Modified: lldb/trunk/include/lldb/Core/SearchFilter.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/SearchFilter.h (original)
    +++ lldb/trunk/include/lldb/Core/SearchFilter.h Sun Jan 29 14:56:30 2012
    @@ -281,7 +281,7 @@
         public SearchFilter
     {
     public:
    -    SearchFilterForNonModuleSpecificSearches (lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
    +    SearchFilterForNonModuleSpecificSearches (const lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
         ~SearchFilterForNonModuleSpecificSearches () {}
         
         virtual bool 
    @@ -311,7 +311,7 @@
         /// @param[in] module
         ///    The Module that limits the search.
         //------------------------------------------------------------------
    -    SearchFilterByModule (lldb::TargetSP &targetSP,
    +    SearchFilterByModule (const lldb::TargetSP &targetSP,
                               const FileSpec &module);
     
         SearchFilterByModule (const SearchFilterByModule& rhs);
    @@ -372,8 +372,8 @@
         /// @param[in] module
         ///    The Module that limits the search.
         //------------------------------------------------------------------
    -    SearchFilterByModuleList (lldb::TargetSP &targetSP,
    -                          const FileSpecList &module_list);
    +    SearchFilterByModuleList (const lldb::TargetSP &targetSP,
    +                              const FileSpecList &module_list);
     
         SearchFilterByModuleList (const SearchFilterByModuleList& rhs);
     
    @@ -433,9 +433,9 @@
         /// @param[in] module
         ///    The Module that limits the search.
         //------------------------------------------------------------------
    -    SearchFilterByModuleListAndCU (lldb::TargetSP &targetSP,
    -                          const FileSpecList &module_list,
    -                          const FileSpecList &cu_list);
    +    SearchFilterByModuleListAndCU (const lldb::TargetSP &targetSP,
    +                                   const FileSpecList &module_list,
    +                                   const FileSpecList &cu_list);
     
         SearchFilterByModuleListAndCU (const SearchFilterByModuleListAndCU& rhs);
     
    
    Modified: lldb/trunk/include/lldb/Core/SourceManager.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/SourceManager.h (original)
    +++ lldb/trunk/include/lldb/Core/SourceManager.h Sun Jan 29 14:56:30 2012
    @@ -79,7 +79,7 @@
     
     #endif // SWIG
     
    -    typedef lldb::SharedPtr::Type FileSP;
    +    typedef std::tr1::shared_ptr FileSP;
     
     #ifndef SWIG
     
    
    Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original)
    +++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Sun Jan 29 14:56:30 2012
    @@ -216,7 +216,7 @@
         void
         TransferAddress (bool force = false);
     
    -    typedef lldb::SharedPtr::Type ValueObjectConstResultSP;
    +    typedef SHARED_PTR(ValueObjectConstResult) ValueObjectConstResultSP;
     
         //----------------------------------------------------------------------
         /// Members
    
    Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
    +++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Sun Jan 29 14:56:30 2012
    @@ -47,7 +47,7 @@
     class ClangUserExpression : public ClangExpression
     {
     public:
    -    typedef lldb::SharedPtr::Type ClangUserExpressionSP;
    +    typedef SHARED_PTR(ClangUserExpression) ClangUserExpressionSP;
         
         //------------------------------------------------------------------
         /// Constructor
    
    Modified: lldb/trunk/include/lldb/Interpreter/Args.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Interpreter/Args.h (original)
    +++ lldb/trunk/include/lldb/Interpreter/Args.h Sun Jan 29 14:56:30 2012
    @@ -30,7 +30,7 @@
     typedef std::pair OptionArgValue;
     typedef std::pair OptionArgPair;
     typedef std::vector OptionArgVector;
    -typedef lldb::SharedPtr::Type OptionArgVectorSP;
    +typedef SHARED_PTR(OptionArgVector) OptionArgVectorSP;
     
     struct OptionArgElement
     {
    
    Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
    +++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Sun Jan 29 14:56:30 2012
    @@ -86,7 +86,7 @@
         //
         
         typedef std::vector < std::pair > NamespaceMap;
    -    typedef lldb::SharedPtr::Type NamespaceMapSP;
    +    typedef SHARED_PTR(NamespaceMap) NamespaceMapSP;
         
         void RegisterNamespaceMap (const clang::NamespaceDecl *decl, 
                                    NamespaceMapSP &namespace_map);
    @@ -193,9 +193,9 @@
             clang::ASTContext  *m_source_ctx;
         };
         
    -    typedef lldb::SharedPtr::Type                                   MinionSP;
    -    typedef std::map                         MinionMap;
    -    typedef std::map          NamespaceMetaMap;
    +    typedef SHARED_PTR(Minion) MinionSP;
    +    typedef std::map MinionMap;
    +    typedef std::map NamespaceMetaMap;
         
         struct ASTContextMetadata
         {
    @@ -216,11 +216,10 @@
             MapCompleter           *m_map_completer;
         };
         
    -    typedef lldb::SharedPtr::Type               ASTContextMetadataSP;
    -    
    +    typedef SHARED_PTR(ASTContextMetadata) ASTContextMetadataSP;    
         typedef std::map ContextMetadataMap;
         
    -    ContextMetadataMap      m_metadata_map;
    +    ContextMetadataMap m_metadata_map;
         
         ASTContextMetadataSP
         GetContextMetadata (clang::ASTContext *dst_ctx)
    
    Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
    +++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Sun Jan 29 14:56:30 2012
    @@ -78,7 +78,7 @@
                                       inst_length (0), ptr_encoding (0), initial_row() {}
         };
     
    -    typedef lldb::SharedPtr::Type CIESP;
    +    typedef SHARED_PTR(CIE) CIESP;
     
         struct FDEEntry
         {
    
    Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
    +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Sun Jan 29 14:56:30 2012
    @@ -50,7 +50,7 @@
     /// this abstract class.
     //----------------------------------------------------------------------
     class ObjectFile:
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public PluginInterface,
         public ModuleChild
     {
    @@ -100,9 +100,6 @@
         virtual
         ~ObjectFile();
         
    -    lldb::ObjectFileSP
    -    GetSP ();
    -
         //------------------------------------------------------------------
         /// Dump a description of this object to a Stream.
         ///
    
    Modified: lldb/trunk/include/lldb/Symbol/Type.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Symbol/Type.h (original)
    +++ lldb/trunk/include/lldb/Symbol/Type.h Sun Jan 29 14:56:30 2012
    @@ -21,7 +21,7 @@
     namespace lldb_private {
     
     class SymbolFileType :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public UserID
         {
         public:
    @@ -50,7 +50,7 @@
         };
         
     class Type :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public UserID
     {
     public:
    
    Modified: lldb/trunk/include/lldb/Target/Memory.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/Memory.h (original)
    +++ lldb/trunk/include/lldb/Target/Memory.h Sun Jan 29 14:56:30 2012
    @@ -163,7 +163,7 @@
             DeallocateMemory (lldb::addr_t ptr);
             
         protected:
    -        typedef lldb::SharedPtr::Type AllocatedBlockSP;
    +        typedef std::tr1::shared_ptr AllocatedBlockSP;
     
             AllocatedBlockSP
             AllocatePage (uint32_t byte_size, 
    
    Modified: lldb/trunk/include/lldb/Target/Process.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/Process.h (original)
    +++ lldb/trunk/include/lldb/Target/Process.h Sun Jan 29 14:56:30 2012
    @@ -1263,7 +1263,7 @@
     /// @brief A plug-in interface definition class for debugging a process.
     //----------------------------------------------------------------------
     class Process :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public UserID,
         public Broadcaster,
         public ExecutionContextScope,
    @@ -2769,7 +2769,7 @@
         ClearBreakpointSiteByID (lldb::user_id_t break_id);
     
         lldb::break_id_t
    -    CreateBreakpointSite (lldb::BreakpointLocationSP &owner,
    +    CreateBreakpointSite (const lldb::BreakpointLocationSP &owner,
                               bool use_hardware);
     
         Error
    @@ -2997,9 +2997,6 @@
         virtual void
         CalculateExecutionContext (ExecutionContext &exe_ctx);
         
    -    lldb::ProcessSP
    -    GetSP ();
    -    
         void
         SetSTDIOFileDescriptor (int file_descriptor);
     
    
    Modified: lldb/trunk/include/lldb/Target/RegisterContext.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/RegisterContext.h (original)
    +++ lldb/trunk/include/lldb/Target/RegisterContext.h Sun Jan 29 14:56:30 2012
    @@ -20,6 +20,7 @@
     namespace lldb_private {
     
     class RegisterContext :
    +    public std::tr1::enable_shared_from_this,
         public ExecutionContextScope
     {
     public:
    
    Modified: lldb/trunk/include/lldb/Target/StackFrame.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/StackFrame.h (original)
    +++ lldb/trunk/include/lldb/Target/StackFrame.h Sun Jan 29 14:56:30 2012
    @@ -27,7 +27,7 @@
     namespace lldb_private {
     
     class StackFrame :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public ExecutionContextScope
     {
     public:
    @@ -166,9 +166,6 @@
         virtual void
         CalculateExecutionContext (ExecutionContext &exe_ctx);
         
    -    lldb::StackFrameSP
    -    GetSP ();
    -
         bool
         GetStatus (Stream &strm,
                    bool show_frame_info,
    
    Modified: lldb/trunk/include/lldb/Target/Target.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/Target.h (original)
    +++ lldb/trunk/include/lldb/Target/Target.h Sun Jan 29 14:56:30 2012
    @@ -246,7 +246,7 @@
     // Target
     //----------------------------------------------------------------------
     class Target :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public Broadcaster,
         public ExecutionContextScope,
         public TargetInstanceSettings
    @@ -340,9 +340,6 @@
         const lldb::ProcessSP &
         GetProcessSP () const;
     
    -    lldb::TargetSP
    -    GetSP();
    -    
         void
         Destroy();
     
    @@ -912,7 +909,7 @@
             StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
             friend class Target;
         };
    -    typedef lldb::SharedPtr::Type StopHookSP;
    +    typedef SHARED_PTR(StopHook) StopHookSP;
         
         // Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook.  
         // Returns the id of the new hook.        
    
    Modified: lldb/trunk/include/lldb/Target/Thread.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/Thread.h (original)
    +++ lldb/trunk/include/lldb/Target/Thread.h Sun Jan 29 14:56:30 2012
    @@ -85,7 +85,7 @@
     };
     
     class Thread :
    -    public ReferenceCountedBaseVirtual,
    +    public std::tr1::enable_shared_from_this,
         public UserID,
         public ExecutionContextScope,
         public ThreadInstanceSettings
    @@ -233,9 +233,6 @@
         lldb::StateType
         GetState() const;
     
    -    lldb::ThreadSP
    -    GetSP ();
    -
         void
         SetState (lldb::StateType state);
     
    @@ -769,6 +766,7 @@
     protected:
     
         friend class ThreadPlan;
    +    friend class ThreadList;
         friend class StackFrameList;
         
         // This is necessary to make sure thread assets get destroyed while the thread is still in good shape
    
    Modified: lldb/trunk/include/lldb/Target/ThreadList.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Target/ThreadList.h (original)
    +++ lldb/trunk/include/lldb/Target/ThreadList.h Sun Jan 29 14:56:30 2012
    @@ -59,6 +59,9 @@
         void
         Clear();
     
    +    void
    +    Destroy();
    +
         // Note that "idx" is not the same as the "thread_index". It is a zero
         // based index to accessing the current threads, whereas "thread_index"
         // is a unique index assigned
    
    Modified: lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/PriorityPointerPair.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Utility/PriorityPointerPair.h (original)
    +++ lldb/trunk/include/lldb/Utility/PriorityPointerPair.h Sun Jan 29 14:56:30 2012
    @@ -30,7 +30,7 @@
         typedef T& reference_type;
         typedef T* pointer_type;
         
    -    typedef typename lldb::SharedPtr::Type T_SP;
    +    typedef typename SHARED_PTR(T) T_SP;
         
         PriorityPointerPair() : 
         m_high(),
    
    Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
    +++ lldb/trunk/include/lldb/lldb-forward-rtti.h Sun Jan 29 14:56:30 2012
    @@ -13,84 +13,84 @@
     #if defined(__cplusplus)
     
     #include "lldb/lldb-types.h"
    +#include  // for std::tr1::shared_ptr
     
     //----------------------------------------------------------------------
     // lldb forward declarations
     //----------------------------------------------------------------------
     namespace lldb {
     
    -    typedef SharedPtr::Type ABISP;
    -    typedef SharedPtr::Type AddressResolverSP;
    -    typedef SharedPtr::Type BatonSP;
    -    typedef SharedPtr::Type BlockSP;
    -    typedef IntrusiveSharedPtr::Type BreakpointSP;
    -    typedef IntrusiveSharedPtr::Type BreakpointSiteSP;
    -    typedef IntrusiveSharedPtr::Type BreakpointLocationSP;
    -    typedef SharedPtr::Type BreakpointResolverSP;
    -    typedef SharedPtr::Type BroadcasterSP;
    -    typedef SharedPtr::Type ClangExpressionVariableSP;
    -    typedef SharedPtr::Type CommandObjectSP;
    -    typedef SharedPtr::Type CommunicationSP;
    -    typedef SharedPtr::Type ConnectionSP;
    -    typedef SharedPtr::Type CompUnitSP;
    -    typedef SharedPtr::Type DataBufferSP;
    -    typedef SharedPtr::Type DataExtractorSP;
    -    typedef IntrusiveSharedPtr::Type DebuggerSP;
    -    typedef SharedPtr::Type DisassemblerSP;
    -    typedef SharedPtr::Type DynamicLoaderSP;
    -    typedef SharedPtr::Type EventSP;
    -    typedef SharedPtr::Type FormatCategorySP;
    -    typedef SharedPtr::Type FunctionSP;
    -    typedef SharedPtr::Type InlineFunctionInfoSP;
    -    typedef SharedPtr::Type InputReaderSP;
    -    typedef SharedPtr::Type InstanceSettingsSP;
    -    typedef SharedPtr::Type InstructionSP;
    -    typedef SharedPtr::Type LanguageRuntimeSP;
    -    typedef SharedPtr::Type LineTableSP;
    -    typedef SharedPtr::Type ListenerSP;
    -    typedef SharedPtr::Type LogSP;
    -    typedef SharedPtr::Type LogChannelSP;
    -    typedef IntrusiveSharedPtr::Type ModuleSP;
    -    typedef IntrusiveSharedPtr::Type ObjectFileSP;
    -    typedef SharedPtr::Type OptionValueSP;
    -    typedef SharedPtr::Type PlatformSP;
    -    typedef IntrusiveSharedPtr::Type ProcessSP;
    -    typedef SharedPtr::Type RegisterContextSP;
    -    typedef SharedPtr::Type RegularExpressionSP;
    -    typedef SharedPtr::Type SectionSP;
    -    typedef SharedPtr::Type SearchFilterSP;
    +    typedef std::tr1::shared_ptr ABISP;
    +    typedef std::tr1::shared_ptr BatonSP;
    +    typedef std::tr1::shared_ptr BlockSP;
    +    typedef std::tr1::shared_ptr BreakpointSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr BreakpointSiteSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr BreakpointLocationSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr BreakpointResolverSP;
    +    typedef std::tr1::shared_ptr BroadcasterSP;
    +    typedef std::tr1::shared_ptr ClangExpressionVariableSP;
    +    typedef std::tr1::shared_ptr CommandObjectSP;
    +    typedef std::tr1::shared_ptr CommunicationSP;
    +    typedef std::tr1::shared_ptr ConnectionSP;
    +    typedef std::tr1::shared_ptr CompUnitSP;
    +    typedef std::tr1::shared_ptr DataBufferSP;
    +    typedef std::tr1::shared_ptr DataExtractorSP;
    +    typedef std::tr1::shared_ptr DebuggerSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr DisassemblerSP;
    +    typedef std::tr1::shared_ptr DynamicLoaderSP;
    +    typedef std::tr1::shared_ptr EventSP;
    +    typedef std::tr1::shared_ptr FormatCategorySP;
    +    typedef std::tr1::shared_ptr FunctionSP;
    +    typedef std::tr1::shared_ptr InlineFunctionInfoSP;
    +    typedef std::tr1::shared_ptr InputReaderSP;
    +    typedef std::tr1::shared_ptr InstanceSettingsSP;
    +    typedef std::tr1::shared_ptr InstructionSP;
    +    typedef std::tr1::shared_ptr LanguageRuntimeSP;
    +    typedef std::tr1::shared_ptr LineTableSP;
    +    typedef std::tr1::shared_ptr ListenerSP;
    +    typedef std::tr1::shared_ptr LogSP;
    +    typedef std::tr1::shared_ptr LogChannelSP;
    +    typedef std::tr1::shared_ptr ModuleSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr ObjectFileSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr OptionValueSP;
    +    typedef std::tr1::shared_ptr PlatformSP;
    +    typedef std::tr1::shared_ptr ProcessSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr RegisterContextSP;
    +    typedef std::tr1::shared_ptr RegularExpressionSP;
    +    typedef std::tr1::shared_ptr SectionSP;
    +    typedef std::tr1::shared_ptr SearchFilterSP;
     #ifndef LLDB_DISABLE_PYTHON
    -    typedef SharedPtr::Type ScriptFormatSP;
    +    typedef std::tr1::shared_ptr ScriptFormatSP;
     #endif // #ifndef LLDB_DISABLE_PYTHON
    -    typedef IntrusiveSharedPtr::Type StackFrameSP;
    -    typedef SharedPtr::Type StackFrameListSP;
    -    typedef SharedPtr::Type StopInfoSP;
    -    typedef SharedPtr::Type StoppointLocationSP;
    -    typedef SharedPtr::Type StreamSP;
    -    typedef SharedPtr::Type StringSummaryFormatSP;
    -    typedef SharedPtr::Type SummaryFormatSP;
    -    typedef SharedPtr::Type SymbolFileSP;
    -    typedef IntrusiveSharedPtr::Type SymbolFileTypeSP;
    -    typedef SharedPtr::Type SymbolContextSpecifierSP;
    -    typedef SharedPtr::Type SyntheticChildrenSP;
    -    typedef SharedPtr::Type SyntheticChildrenFrontEndSP;
    -    typedef IntrusiveSharedPtr::Type TargetSP;
    -    typedef IntrusiveSharedPtr::Type ThreadSP;
    -    typedef SharedPtr::Type ThreadPlanSP;
    -    typedef SharedPtr::Type ThreadPlanTracerSP;
    -    typedef IntrusiveSharedPtr::Type TypeSP;
    -    typedef SharedPtr::Type TypeImplSP;
    -    typedef SharedPtr::Type FuncUnwindersSP;
    -    typedef SharedPtr::Type UserSettingsControllerSP;
    -    typedef SharedPtr::Type UnwindPlanSP;
    +    typedef std::tr1::shared_ptr StackFrameSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr StackFrameListSP;
    +    typedef std::tr1::shared_ptr StopInfoSP;
    +    typedef std::tr1::shared_ptr StoppointLocationSP;
    +    typedef std::tr1::shared_ptr StreamSP;
    +    typedef std::tr1::shared_ptr StringSummaryFormatSP;
    +    typedef std::tr1::shared_ptr SummaryFormatSP;
    +    typedef std::tr1::shared_ptr SymbolFileSP;
    +    typedef std::tr1::shared_ptr SymbolFileTypeSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr SymbolContextSpecifierSP;
    +    typedef std::tr1::shared_ptr SyntheticChildrenSP;
    +    typedef std::tr1::shared_ptr SyntheticChildrenFrontEndSP;
    +    typedef std::tr1::shared_ptr TargetSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr ThreadSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr ThreadPlanSP;
    +    typedef std::tr1::shared_ptr ThreadPlanTracerSP;
    +    typedef std::tr1::shared_ptr TypeSP; // make_shared_from_this
    +    typedef std::tr1::shared_ptr TypeImplSP;
    +    typedef std::tr1::shared_ptr FuncUnwindersSP;
    +    typedef std::tr1::shared_ptr UserSettingsControllerSP;
    +    typedef std::tr1::shared_ptr UnwindPlanSP;
         typedef SharedPtr::Type ValueObjectSP;
    -    typedef SharedPtr::Type ValueSP;
    -    typedef SharedPtr::Type ValueFormatSP;
    -    typedef SharedPtr::Type ValueListSP;
    -    typedef SharedPtr::Type VariableSP;
    -    typedef SharedPtr::Type VariableListSP;
    -    typedef SharedPtr::Type ValueObjectListSP;
    -    typedef SharedPtr::Type WatchpointSP;
    +    typedef std::tr1::shared_ptr ValueSP;
    +    typedef std::tr1::shared_ptr ValueFormatSP;
    +    typedef std::tr1::shared_ptr ValueListSP;
    +    typedef std::tr1::shared_ptr VariableSP;
    +    typedef std::tr1::shared_ptr VariableListSP;
    +    typedef std::tr1::shared_ptr ValueObjectListSP;
    +    typedef std::tr1::shared_ptr WatchpointSP;
     
     } // namespace lldb
     
    
    Modified: lldb/trunk/include/lldb/lldb-types.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-types.h (original)
    +++ lldb/trunk/include/lldb/lldb-types.h Sun Jan 29 14:56:30 2012
    @@ -23,13 +23,13 @@
     
     //----------------------------------------------------------------------
     // All host systems must define:
    -//  liblldb::condition_t       The native condition type (or a substitute class) for conditions on the host system.
    -//  liblldb::mutex_t           The native mutex type for mutex objects on the host system.
    -//  liblldb::thread_t          The native thread type for spawned threads on the system
    -//  liblldb::thread_arg_t      The type of the one any only thread creation argument for the host system
    -//  liblldb::thread_result_t   The return type that gets returned when a thread finishes.
    -//  liblldb::thread_func_t     The function prototype used to spawn a thread on the host system.
    -//  liblldb::SharedPtr         The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr)
    +//  lldb::condition_t       The native condition type (or a substitute class) for conditions on the host system.
    +//  lldb::mutex_t           The native mutex type for mutex objects on the host system.
    +//  lldb::thread_t          The native thread type for spawned threads on the system
    +//  lldb::thread_arg_t      The type of the one any only thread creation argument for the host system
    +//  lldb::thread_result_t   The return type that gets returned when a thread finishes.
    +//  lldb::thread_func_t     The function prototype used to spawn a thread on the host system.
    +//  lldb::SharedPtr         The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr)
     //  #define LLDB_INVALID_PROCESS_ID ...
     //  #define LLDB_INVALID_THREAD_ID ...
     //  #define LLDB_INVALID_HOST_THREAD ...
    @@ -64,17 +64,17 @@
             {
                 typedef lldb_private::SharingPtr<_Tp> Type;
             };
    -        template
    -        struct LoggingSharedPtr
    -        {
    -            typedef lldb_private::LoggingSharingPtr<_Tp> Type;
    -        };
    -    
    -        template 
    -        struct IntrusiveSharedPtr 
    -        {
    -            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
    -        };
    +//        template
    +//        struct LoggingSharedPtr
    +//        {
    +//            typedef lldb_private::LoggingSharingPtr<_Tp> Type;
    +//        };
    +//    
    +//        template 
    +//        struct IntrusiveSharedPtr 
    +//        {
    +//            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
    +//        };
     
     } // namespace lldb
     
    @@ -91,6 +91,7 @@
     
     #endif
     
    +#define SHARED_PTR(T)   std::tr1::shared_ptr
     #define LLDB_INVALID_HOST_TIME           { 0, 0 }
     
     namespace lldb 
    
    Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
    +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Sun Jan 29 14:56:30 2012
    @@ -99,6 +99,12 @@
                 ReferencedContainer = "container:lldb.xcodeproj">
              
           
    +      
    +         
    +         
    +      
           
              
           
           
    +         
    +         
           
        
        GetModule();
             if (module)
    -            *sb_module = module;
    +            *sb_module = module->shared_from_this();
         }
         return sb_module;
     }
    
    Modified: lldb/trunk/source/API/SBBreakpoint.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBBreakpoint.cpp (original)
    +++ lldb/trunk/source/API/SBBreakpoint.cpp Sun Jan 29 14:56:30 2012
    @@ -497,14 +497,14 @@
                 Process *process = ctx->exe_ctx.GetProcessPtr();
                 if (process)
                 {
    -                SBProcess sb_process (process->GetSP());
    +                SBProcess sb_process (process->shared_from_this());
                     SBThread sb_thread;
                     SBBreakpointLocation sb_location;
                     assert (bp_sp);
                     sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
                     Thread *thread = ctx->exe_ctx.GetThreadPtr();
                     if (thread)
    -                    sb_thread.SetThread(thread->GetSP());
    +                    sb_thread.SetThread(thread->shared_from_this());
     
                     return data->callback (data->callback_baton, 
                                               sb_process, 
    
    Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
    +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Sun Jan 29 14:56:30 2012
    @@ -301,7 +301,7 @@
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
    -        *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
    +        *sb_bp = m_opaque_sp->GetBreakpoint ().shared_from_this();
         }
     
         if (log)
    
    Modified: lldb/trunk/source/API/SBFrame.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBFrame.cpp (original)
    +++ lldb/trunk/source/API/SBFrame.cpp Sun Jan 29 14:56:30 2012
    @@ -553,7 +553,7 @@
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
    -        sb_thread.SetThread (m_opaque_sp->GetThread().GetSP());
    +        sb_thread.SetThread (m_opaque_sp->GetThread().shared_from_this());
         }
     
         if (log)
    
    Modified: lldb/trunk/source/API/SBFunction.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBFunction.cpp (original)
    +++ lldb/trunk/source/API/SBFunction.cpp Sun Jan 29 14:56:30 2012
    @@ -133,10 +133,10 @@
                 target->CalculateExecutionContext (exe_ctx);
                 exe_ctx.SetProcessSP(target->GetProcessSP());
             }
    -        Module *module = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule();
    -        if (module)
    +        ModuleSP module_sp = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModuleSP();
    +        if (module_sp)
             {
    -            sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture(),
    +            sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture(),
                                                                                  NULL,
                                                                                  exe_ctx,
                                                                                  m_opaque_ptr->GetAddressRange()));
    
    Modified: lldb/trunk/source/API/SBProcess.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBProcess.cpp (original)
    +++ lldb/trunk/source/API/SBProcess.cpp Sun Jan 29 14:56:30 2012
    @@ -238,7 +238,7 @@
     
         SBTarget sb_target;
         if (m_opaque_sp)
    -        sb_target = m_opaque_sp->GetTarget().GetSP();
    +        sb_target = m_opaque_sp->GetTarget().shared_from_this();
         
         if (log)
             log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", m_opaque_sp.get(), sb_target.get());
    
    Modified: lldb/trunk/source/API/SBSection.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBSection.cpp (original)
    +++ lldb/trunk/source/API/SBSection.cpp Sun Jan 29 14:56:30 2012
    @@ -29,7 +29,7 @@
                 m_section (section)
             {
                 if (section)
    -                m_module_sp = section->GetModule();
    +                m_module_sp = section->GetModule()->shared_from_this();
             }
             
             SectionImpl (const SectionImpl &rhs) :
    
    Modified: lldb/trunk/source/API/SBSymbol.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBSymbol.cpp (original)
    +++ lldb/trunk/source/API/SBSymbol.cpp Sun Jan 29 14:56:30 2012
    @@ -131,10 +131,10 @@
             const AddressRange *symbol_range = m_opaque_ptr->GetAddressRangePtr();
             if (symbol_range)
             {
    -            Module *module = symbol_range->GetBaseAddress().GetModule();
    -            if (module)
    +            ModuleSP module_sp = symbol_range->GetBaseAddress().GetModuleSP();
    +            if (module_sp)
                 {
    -                sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture (),
    +                sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (),
                                                                                      NULL,
                                                                                      exe_ctx,
                                                                                      *symbol_range));
    
    Modified: lldb/trunk/source/API/SBTarget.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBTarget.cpp (original)
    +++ lldb/trunk/source/API/SBTarget.cpp Sun Jan 29 14:56:30 2012
    @@ -119,7 +119,7 @@
     {
         SBDebugger debugger;
         if (m_opaque_sp)
    -        debugger.reset (m_opaque_sp->GetDebugger().GetSP());
    +        debugger.reset (m_opaque_sp->GetDebugger().shared_from_this());
         return debugger;
     }
     
    
    Modified: lldb/trunk/source/API/SBValue.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBValue.cpp (original)
    +++ lldb/trunk/source/API/SBValue.cpp Sun Jan 29 14:56:30 2012
    @@ -883,7 +883,7 @@
         {
             if (m_opaque_sp->GetExecutionContextScope())
             {
    -            result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->GetSP());
    +            result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this());
             }
         }
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    @@ -905,7 +905,7 @@
         {
             if (m_opaque_sp->GetExecutionContextScope())
             {
    -            result.SetFrame (m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->GetSP());
    +            result.SetFrame (m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->shared_from_this());
             }
         }
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    
    Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
    +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Sun Jan 29 14:56:30 2012
    @@ -556,11 +556,3 @@
     {
         m_filter_sp->GetDescription (s);
     }
    -
    -const BreakpointSP
    -Breakpoint::GetSP ()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return BreakpointSP (this);
    -}
    
    Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
    +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Sun Jan 29 14:56:30 2012
    @@ -149,11 +149,10 @@
     ThreadPlan *
     BreakpointLocation::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error)
     {
    -    lldb::BreakpointLocationSP this_sp(this);
         if (m_options_ap.get())
    -        return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
    +        return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
         else
    -        return m_owner.GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
    +        return m_owner.GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
     }
     
     const char *
    @@ -259,9 +258,7 @@
         if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
             return false;
     
    -    BreakpointLocationSP this_sp(this);
    -
    -    lldb::break_id_t new_id = process->CreateBreakpointSite (this_sp, false);
    +    lldb::break_id_t new_id = process->CreateBreakpointSite (shared_from_this(), false);
     
         if (new_id == LLDB_INVALID_BREAK_ID)
         {
    
    Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
    +++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Sun Jan 29 14:56:30 2012
    @@ -23,7 +23,7 @@
     BreakpointSite::BreakpointSite
     (
         BreakpointSiteList *list,
    -    BreakpointLocationSP& owner,
    +    const BreakpointLocationSP& owner,
         lldb::addr_t addr,
         lldb::tid_t tid,
         bool use_hardware
    @@ -155,7 +155,7 @@
     }
     
     void
    -BreakpointSite::AddOwner (BreakpointLocationSP &owner)
    +BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
     {
         m_owners.Add(owner);
     }
    
    Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Sun Jan 29 14:56:30 2012
    @@ -148,7 +148,7 @@
             return false;
         }
         
    -    Module *thread_module = thread_cur_frame->GetFrameCodeAddress ().GetModule ();
    +    Module *thread_module = thread_cur_frame->GetFrameCodeAddress ().GetModulePtr ();
         if (!thread_module)
         {
             result.AppendError ("The PC has no associated module.");
    
    Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Sun Jan 29 14:56:30 2012
    @@ -468,7 +468,7 @@
                         {
                             const bool show_inlines = true;
                             m_breakpoint_locations.Reset (last_file_sp->GetFileSpec(), 0, show_inlines);
    -                        SearchFilter target_search_filter (target->GetSP());
    +                        SearchFilter target_search_filter (target->shared_from_this());
                             target_search_filter.Search (m_breakpoint_locations);
                         }
                     }
    @@ -570,7 +570,7 @@
                         {
                             const bool show_inlines = true;
                             m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
    -                        SearchFilter target_search_filter (target->GetSP());
    +                        SearchFilter target_search_filter (target->shared_from_this());
                             target_search_filter.Search (m_breakpoint_locations);
                         }
                         else
    
    Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Sun Jan 29 14:56:30 2012
    @@ -1329,7 +1329,7 @@
             {
                 if (!target->GetSectionLoadList().ResolveLoadAddress (addr, so_addr))
                     return false;
    -            else if (so_addr.GetModule() != module)
    +            else if (so_addr.GetModulePtr() != module)
                     return false;
             }
             else
    @@ -1643,7 +1643,7 @@
                 {
                     if (FileSpec::Equal(module->GetFileSpec(), module_file_spec, true))
                     {
    -                    module_sp = module;
    +                    module_sp = module->shared_from_this();
                         module_list.AppendIfNeeded(module_sp);
                     }
                 }
    @@ -2757,7 +2757,7 @@
                         Address module_address;
                         if (module_address.SetLoadAddress(m_options.m_module_addr, target))
                         {
    -                        Module *module = module_address.GetModule();
    +                        Module *module = module_address.GetModulePtr();
                             if (module)
                             {
                                 PrintModule (strm, module);
    @@ -2800,7 +2800,7 @@
                         if (use_global_module_list)
                         {
                             module = Module::GetAllocatedModuleAtIndex(image_idx);
    -                        module_sp = module;
    +                        module_sp = module->shared_from_this();
                         }
                         else
                         {
    @@ -2874,7 +2874,7 @@
                         case 'r':
                             {
                                 uint32_t ref_count = 0;
    -                            ModuleSP module_sp (module);
    +                            ModuleSP module_sp (module->shared_from_this());
                                 if (module_sp)
                                 {
                                     // Take one away to make sure we don't count our local "module_sp"
    
    Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
    +++ lldb/trunk/source/Commands/CommandObjectType.cpp Sun Jan 29 14:56:30 2012
    @@ -75,7 +75,7 @@
         {
         }
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(ScriptAddOptions) SharedPointer;
         
     };
     
    @@ -108,7 +108,7 @@
         {
         }
         
    -    typedef lldb::SharedPtr::Type SharedPointer;
    +    typedef SHARED_PTR(SynthAddOptions) SharedPointer;
         
     };
     
    
    Modified: lldb/trunk/source/Core/Address.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Address.cpp (original)
    +++ lldb/trunk/source/Core/Address.cpp Sun Jan 29 14:56:30 2012
    @@ -55,7 +55,7 @@
     
         if (byte_order == eByteOrderInvalid || addr_size == 0)
         {
    -        Module *module = address.GetModule();
    +        Module *module = address.GetModulePtr();
             if (module)
             {
                 byte_order = module->GetArchitecture().GetByteOrder();
    @@ -118,7 +118,7 @@
             {
                 // If we were not running, yet able to read an integer, we must
                 // have a module
    -            Module *module = address.GetModule();
    +            Module *module = address.GetModulePtr();
                 assert (module);
                 if (module->ResolveFileAddress(deref_addr, deref_so_addr))
                     return true;
    @@ -248,13 +248,26 @@
     }
     
     Module *
    -Address::GetModule () const
    +Address::GetModulePtr () const
     {
         if (m_section)
             return m_section->GetModule();
         return NULL;
     }
     
    +ModuleSP
    +Address::GetModuleSP () const
    +{
    +    lldb::ModuleSP module_sp;
    +    if (m_section)
    +    {
    +        Module *module = m_section->GetModule();
    +        if (module)
    +            module_sp = module->shared_from_this();
    +    }
    +    return module_sp;
    +}
    +
     addr_t
     Address::GetFileAddress () const
     {
    @@ -434,7 +447,7 @@
                 }
     
                 uint32_t pointer_size = 4;
    -            Module *module = GetModule();
    +            Module *module = GetModulePtr();
                 if (target)
                     pointer_size = target->GetArchitecture().GetAddressByteSize();
                 else if (module)
    @@ -670,7 +683,7 @@
         case DumpStyleDetailedSymbolContext:
             if (IsSectionOffset())
             {
    -            Module *module = GetModule();
    +            Module *module = GetModulePtr();
                 if (module)
                 {
                     SymbolContext sc;
    @@ -738,7 +751,7 @@
             Module *address_module = m_section->GetModule();
             if (address_module)
             {
    -            sc->module_sp = address_module;
    +            sc->module_sp = address_module->shared_from_this();
                 if (sc->module_sp)
                     return sc->module_sp->ResolveSymbolContextForAddress (*this, resolve_scope, *sc);
             }
    @@ -760,7 +773,7 @@
         if (m_section)
         {
             SymbolContext sc;
    -        sc.module_sp = m_section->GetModule();
    +        sc.module_sp = m_section->GetModule()->shared_from_this();
             if (sc.module_sp)
             {
                 sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextCompUnit, sc);
    @@ -776,7 +789,7 @@
         if (m_section)
         {
             SymbolContext sc;
    -        sc.module_sp = m_section->GetModule();
    +        sc.module_sp = m_section->GetModule()->shared_from_this();
             if (sc.module_sp)
             {
                 sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextFunction, sc);
    @@ -792,7 +805,7 @@
         if (m_section)
         {
             SymbolContext sc;
    -        sc.module_sp = m_section->GetModule();
    +        sc.module_sp = m_section->GetModule()->shared_from_this();
             if (sc.module_sp)
             {
                 sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextBlock, sc);
    @@ -808,7 +821,7 @@
         if (m_section)
         {
             SymbolContext sc;
    -        sc.module_sp = m_section->GetModule();
    +        sc.module_sp = m_section->GetModule()->shared_from_this();
             if (sc.module_sp)
             {
                 sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextSymbol, sc);
    @@ -824,7 +837,7 @@
         if (m_section)
         {
             SymbolContext sc;
    -        sc.module_sp = m_section->GetModule();
    +        sc.module_sp = m_section->GetModule()->shared_from_this();
             if (sc.module_sp)
             {
                 sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextLineEntry, sc);
    @@ -868,8 +881,8 @@
     int
     Address::CompareModulePointerAndOffset (const Address& a, const Address& b)
     {
    -    Module *a_module = a.GetModule ();
    -    Module *b_module = b.GetModule ();
    +    Module *a_module = a.GetModulePtr ();
    +    Module *b_module = b.GetModulePtr ();
         if (a_module < b_module)
             return -1;
         if (a_module > b_module)
    @@ -913,8 +926,8 @@
     bool
     lldb_private::operator< (const Address& lhs, const Address& rhs)
     {
    -    Module *lhs_module = lhs.GetModule();
    -    Module *rhs_module = rhs.GetModule();    
    +    Module *lhs_module = lhs.GetModulePtr();
    +    Module *rhs_module = rhs.GetModulePtr();    
         if (lhs_module == rhs_module)
         {
             // Addresses are in the same module, just compare the file addresses
    @@ -931,8 +944,8 @@
     bool
     lldb_private::operator> (const Address& lhs, const Address& rhs)
     {
    -    Module *lhs_module = lhs.GetModule();
    -    Module *rhs_module = rhs.GetModule();    
    +    Module *lhs_module = lhs.GetModulePtr();
    +    Module *rhs_module = rhs.GetModulePtr();    
         if (lhs_module == rhs_module)
         {
             // Addresses are in the same module, just compare the file addresses
    @@ -987,7 +1000,7 @@
     AddressClass
     Address::GetAddressClass () const
     {
    -    Module *module = GetModule();
    +    Module *module = GetModulePtr();
         if (module)
         {
             ObjectFile *obj_file = module->GetObjectFile();
    
    Modified: lldb/trunk/source/Core/AddressRange.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressRange.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/AddressRange.cpp (original)
    +++ lldb/trunk/source/Core/AddressRange.cpp Sun Jan 29 14:56:30 2012
    @@ -177,7 +177,7 @@
         {
             if (show_module)
             {
    -            Module *module = GetBaseAddress().GetModule();
    +            Module *module = GetBaseAddress().GetModulePtr();
                 if (module)
                     s->Printf("%s", module->GetFileSpec().GetFilename().AsCString());
             }
    
    Modified: lldb/trunk/source/Core/Debugger.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Debugger.cpp (original)
    +++ lldb/trunk/source/Core/Debugger.cpp Sun Jan 29 14:56:30 2012
    @@ -263,14 +263,6 @@
     }
     
     DebuggerSP
    -Debugger::GetSP ()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return DebuggerSP (this);
    -}
    -
    -DebuggerSP
     Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name)
     {
         DebuggerSP debugger_sp;
    
    Modified: lldb/trunk/source/Core/Disassembler.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Disassembler.cpp (original)
    +++ lldb/trunk/source/Core/Disassembler.cpp Sun Jan 29 14:56:30 2012
    @@ -383,7 +383,7 @@
     
                 prev_sc = sc;
     
    -            Module *module = addr.GetModule();
    +            Module *module = addr.GetModulePtr();
                 if (module)
                 {
                     uint32_t resolved_mask = module->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
    
    Modified: lldb/trunk/source/Core/Module.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/Module.cpp (original)
    +++ lldb/trunk/source/Core/Module.cpp Sun Jan 29 14:56:30 2012
    @@ -224,7 +224,7 @@
             return;
     
         SymbolContext sc;
    -    sc.module_sp = this;
    +    sc.module_sp = shared_from_this();
         uint32_t cu_idx;
         SymbolVendor *symbols = GetSymbolVendor ();
     
    @@ -258,7 +258,7 @@
     void
     Module::CalculateSymbolContext(SymbolContext* sc)
     {
    -    sc->module_sp = this;
    +    sc->module_sp = shared_from_this();
     }
     
     Module *
    @@ -328,7 +328,7 @@
         {
             // If the section offset based address resolved itself, then this
             // is the right module.
    -        sc.module_sp = this;
    +        sc.module_sp = shared_from_this();
             resolved_flags |= eSymbolContextModule;
     
             // Resolve the compile unit, function, block, line table or line
    @@ -430,7 +430,7 @@
         const uint32_t start_size = sc_list.GetSize();
         const uint32_t num_compile_units = GetNumCompileUnits();
         SymbolContext sc;
    -    sc.module_sp = this;
    +    sc.module_sp = shared_from_this();
         const bool compare_directory = path.GetDirectory();
         for (uint32_t i=0; iResolveSymbolContextForAddress (so_addr,
    
    Modified: lldb/trunk/source/Core/SearchFilter.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/SearchFilter.cpp (original)
    +++ lldb/trunk/source/Core/SearchFilter.cpp Sun Jan 29 14:56:30 2012
    @@ -318,7 +318,7 @@
     // SearchFilterByModule constructors
     //----------------------------------------------------------------------
     
    -SearchFilterByModule::SearchFilterByModule (lldb::TargetSP &target_sp, const FileSpec &module) :
    +SearchFilterByModule::SearchFilterByModule (const lldb::TargetSP &target_sp, const FileSpec &module) :
         SearchFilter (target_sp),
         m_module_spec (module)
     {
    @@ -430,7 +430,7 @@
             Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
             if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
             {
    -            SymbolContext matchingContext(m_target_sp, ModuleSP(module));
    +            SymbolContext matchingContext(m_target_sp, module->shared_from_this());
                 Searcher::CallbackReturn shouldContinue;
     
                 shouldContinue = DoModuleIteration(matchingContext, searcher);
    @@ -476,7 +476,7 @@
     // SearchFilterByModuleList constructors
     //----------------------------------------------------------------------
     
    -SearchFilterByModuleList::SearchFilterByModuleList (lldb::TargetSP &target_sp, const FileSpecList &module_list) :
    +SearchFilterByModuleList::SearchFilterByModuleList (const lldb::TargetSP &target_sp, const FileSpecList &module_list) :
         SearchFilter (target_sp),
         m_module_spec_list (module_list)
     {
    @@ -594,7 +594,7 @@
             Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
             if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) != UINT32_MAX)
             {
    -            SymbolContext matchingContext(m_target_sp, ModuleSP(module));
    +            SymbolContext matchingContext(m_target_sp, module->shared_from_this());
                 Searcher::CallbackReturn shouldContinue;
     
                 shouldContinue = DoModuleIteration(matchingContext, searcher);
    @@ -664,7 +664,7 @@
     // SearchFilterByModuleListAndCU constructors
     //----------------------------------------------------------------------
     
    -SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU (lldb::TargetSP &target_sp, 
    +SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU (const lldb::TargetSP &target_sp, 
                                                                   const FileSpecList &module_list,
                                                                   const FileSpecList &cu_list) :
         SearchFilterByModuleList (target_sp, module_list),
    
    Modified: lldb/trunk/source/Core/ValueObject.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ValueObject.cpp (original)
    +++ lldb/trunk/source/Core/ValueObject.cpp Sun Jan 29 14:56:30 2012
    @@ -3490,7 +3490,7 @@
         Target *target = exe_ctx.GetTargetPtr();
         if (target != NULL)
         {
    -        m_target_sp = target;
    +        m_target_sp = target->shared_from_this();
             m_process_sp = exe_ctx.GetProcessSP();
             if (!m_process_sp)
                 m_process_sp = target->GetProcessSP();
    
    Modified: lldb/trunk/source/Core/ValueObjectMemory.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectMemory.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Core/ValueObjectMemory.cpp (original)
    +++ lldb/trunk/source/Core/ValueObjectMemory.cpp Sun Jan 29 14:56:30 2012
    @@ -272,7 +272,7 @@
     Module *
     ValueObjectMemory::GetModule()
     {
    -    return m_address.GetModule();
    +    return m_address.GetModulePtr();
     }
     
     
    
    Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
    +++ lldb/trunk/source/Expression/ClangASTSource.cpp Sun Jan 29 14:56:30 2012
    @@ -946,7 +946,7 @@
     NamespaceDecl *
     ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::NamespaceMapSP &namespace_decls)
     {
    -    if (namespace_decls.empty())
    +    if (!namespace_decls)
             return NULL;
         
         lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
    
    Modified: lldb/trunk/source/Expression/ClangFunction.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Expression/ClangFunction.cpp (original)
    +++ lldb/trunk/source/Expression/ClangFunction.cpp Sun Jan 29 14:56:30 2012
    @@ -70,7 +70,7 @@
         // Can't make a ClangFunction without a process.
         assert (process != NULL);
             
    -    m_jit_process_sp = process->GetSP();
    +    m_jit_process_sp = process->shared_from_this();
     }
     
     ClangFunction::ClangFunction
    @@ -95,7 +95,7 @@
         // Can't make a ClangFunction without a process.
         assert (process != NULL);
             
    -    m_jit_process_sp = process->GetSP();
    +    m_jit_process_sp = process->shared_from_this();
     
         m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
         m_function_return_qual_type = m_function_ptr->GetReturnClangType();
    @@ -266,7 +266,7 @@
         if (!jit_error.Success())
             return false;
         if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
    -        m_jit_process_sp = process->GetSP();
    +        m_jit_process_sp = process->shared_from_this();
     
         return true;
     }
    
    Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
    +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Sun Jan 29 14:56:30 2012
    @@ -357,7 +357,7 @@
         if (jit_error.Success())
         {
             if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
    -            m_jit_process_sp = process->GetSP();        
    +            m_jit_process_sp = process->shared_from_this();        
             return true;
         }
         else
    
    Modified: lldb/trunk/source/Expression/ClangUtilityFunction.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUtilityFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Expression/ClangUtilityFunction.cpp (original)
    +++ lldb/trunk/source/Expression/ClangUtilityFunction.cpp Sun Jan 29 14:56:30 2012
    @@ -148,7 +148,7 @@
         }
         
         if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
    -        m_jit_process_sp = process->GetSP();
    +        m_jit_process_sp = process->shared_from_this();
         
     #if 0
     	// jingham: look here
    
    Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
    +++ lldb/trunk/source/Expression/IRInterpreter.cpp Sun Jan 29 14:56:30 2012
    @@ -69,8 +69,8 @@
         return s;
     }
     
    -typedef lldb::SharedPtr ::Type DataEncoderSP;
    -typedef lldb::SharedPtr ::Type DataExtractorSP;
    +typedef SHARED_PTR(lldb_private::DataEncoder) DataEncoderSP;
    +typedef SHARED_PTR(lldb_private::DataExtractor) DataExtractorSP;
     
     class Memory
     {
    @@ -127,7 +127,7 @@
             }
         };
         
    -    typedef lldb::SharedPtr ::Type  AllocationSP;
    +    typedef SHARED_PTR(Allocation)  AllocationSP;
         
         struct Region
         {
    
    Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
    +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sun Jan 29 14:56:30 2012
    @@ -2559,7 +2559,7 @@
                 m_exe_ctx.SetProcessSP (process_sp);
                 if (process_sp && process_sp->IsAlive() && !process_sp->IsRunning())
                 {
    -                ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread().get());
    +                ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread());
                     if (thread_sp)
                     {
                         m_exe_ctx.SetThreadSP (thread_sp);
    
    Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
    +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Sun Jan 29 14:56:30 2012
    @@ -1727,7 +1727,7 @@
             return false;
         }
         
    -    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().GetSP();
    +    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
     
         {
             Locker py_lock(this);
    @@ -1837,7 +1837,7 @@
             return false;
         }
         
    -    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().GetSP();
    +    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
     
         if (!debugger_sp.get())
         {
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
    +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Sun Jan 29 14:56:30 2012
    @@ -122,7 +122,7 @@
         }
         else
         {
    -        Module *module = inst_addr.GetModule();
    +        Module *module = inst_addr.GetModulePtr();
             if (module)
             {
                 if (module->ResolveFileAddress(operand_value, so_addr))
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
    +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Sun Jan 29 14:56:30 2012
    @@ -1255,12 +1255,12 @@
             AddressRange *ar = sym_ctx.symbol->GetAddressRangePtr();
             if (ar)
             {
    -            module_sp = ar->GetBaseAddress().GetModule();
    +            module_sp = ar->GetBaseAddress().GetModuleSP();
             }
         }
         if (module_sp.get() == NULL && sym_ctx.function)
         {
    -        module_sp = sym_ctx.function->GetAddressRange().GetBaseAddress().GetModule();
    +        module_sp = sym_ctx.function->GetAddressRange().GetBaseAddress().GetModuleSP();
         }
         if (module_sp.get() == NULL)
             return false;
    @@ -1522,7 +1522,7 @@
                             
                             Module* module_to_add = sc.symbol->CalculateSymbolContextModule();
                             if (module_to_add)
    -                             modules_to_search.AppendIfNeeded(static_cast(module_to_add));
    +                             modules_to_search.AppendIfNeeded(module_to_add->shared_from_this());
                         }
                         
                         // If the original stub symbol is a resolver, then we don't want to break on the symbol with the
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
    +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Sun Jan 29 14:56:30 2012
    @@ -220,7 +220,7 @@
     {
         // 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));
    +    m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->shared_from_this(), module_sp));
         if (m_objc_trampoline_handler_ap.get() != NULL)
         {
             m_read_objc_library = true;
    
    Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp (original)
    +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp Sun Jan 29 14:56:30 2012
    @@ -19,7 +19,7 @@
     
     AppleObjCSymbolVendor::AppleObjCSymbolVendor(Process *process) :
         SymbolVendor(NULL),
    -    m_process(process->GetSP()),
    +    m_process(process->shared_from_this()),
         m_ast_ctx(process->GetTarget().GetArchitecture().GetTriple().getTriple().c_str())
     {
     }
    
    Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
    +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Sun Jan 29 14:56:30 2012
    @@ -118,7 +118,7 @@
         class Archive
         {
         public:
    -        typedef lldb::SharedPtr::Type shared_ptr;
    +        typedef SHARED_PTR(Archive) shared_ptr;
             typedef std::multimap Map;
     
             static Map &
    
    Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp (original)
    +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp Sun Jan 29 14:56:30 2012
    @@ -104,7 +104,7 @@
         // Now make a new log with this stream if one was provided
         if (log_stream_sp)
         {
    -        log = make_shared(log_stream_sp);
    +        log.reset (new Log(log_stream_sp));
             GetLog () = log;
         }
     
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
    +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sun Jan 29 14:56:30 2012
    @@ -126,7 +126,7 @@
             {
                 m_current_offset = frame_sp->GetFrameCodeAddress().GetOffset() - m_start_pc.GetOffset();
             }
    -        else if (frame_sp->GetFrameCodeAddress().GetModule() == m_start_pc.GetModule())
    +        else if (frame_sp->GetFrameCodeAddress().GetModulePtr() == m_start_pc.GetModulePtr())
             {
                 // This means that whatever symbol we kicked up isn't really correct
                 // as no should cross section boundaries... We really should NULL out
    @@ -284,7 +284,7 @@
     
         // If we don't have a Module for some reason, we're not going to find symbol/function information - just
         // stick in some reasonable defaults and hope we can unwind past this frame.
    -    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL)
    +    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL)
         {
             if (log)
             {
    @@ -397,7 +397,7 @@
         }
     
         // 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)
    +    if ((m_current_pc.GetModulePtr()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
         {
             m_sym_ctx_valid = true;
         }
    @@ -436,7 +436,7 @@
             temporary_pc.SetOffset(m_current_pc.GetOffset() - 1);
             m_sym_ctx.Clear();
             m_sym_ctx_valid = false;
    -        if ((m_current_pc.GetModule()->ResolveSymbolContextForAddress (temporary_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
    +        if ((m_current_pc.GetModulePtr()->ResolveSymbolContextForAddress (temporary_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
             {
                 m_sym_ctx_valid = true;
             }
    @@ -619,13 +619,13 @@
     RegisterContextLLDB::GetFastUnwindPlanForFrame ()
     {
         UnwindPlanSP unwind_plan_sp;
    -    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL)
    +    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL || m_current_pc.GetModulePtr()->GetObjectFile() == NULL)
             return unwind_plan_sp;
     
         if (IsFrameZero ())
             return unwind_plan_sp;
     
    -    FuncUnwindersSP func_unwinders_sp (m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx));
    +    FuncUnwindersSP func_unwinders_sp (m_current_pc.GetModulePtr()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx));
         if (!func_unwinders_sp)
             return unwind_plan_sp;
     
    @@ -712,7 +712,7 @@
         }
     
         // No Module for the current pc, try using the architecture default unwind.
    -    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL)
    +    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL || m_current_pc.GetModulePtr()->GetObjectFile() == NULL)
         {
             m_frame_type = eNormalFrame;
             return arch_default_unwind_plan_sp;
    @@ -721,7 +721,7 @@
         FuncUnwindersSP func_unwinders_sp;
         if (m_sym_ctx_valid)
         {
    -        func_unwinders_sp = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx);
    +        func_unwinders_sp = m_current_pc.GetModulePtr()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx);
         }
     
         // No FuncUnwinders available for this pc, try using architectural default unwind.
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original)
    +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Sun Jan 29 14:56:30 2012
    @@ -25,7 +25,7 @@
     class RegisterContextLLDB : public lldb_private::RegisterContext
     {
     public:
    -    typedef lldb::SharedPtr::Type SharedPtr;
    +    typedef SHARED_PTR(RegisterContextLLDB) SharedPtr;
     
         RegisterContextLLDB (lldb_private::Thread &thread,
                              const SharedPtr& next_frame,
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
    +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Sun Jan 29 14:56:30 2012
    @@ -69,10 +69,10 @@
     {
         // First, set up the 0th (initial) frame
         CursorSP first_cursor_sp(new Cursor ());
    -    RegisterContextLLDBSharedPtr reg_ctx_sp (new RegisterContextLLDB (m_thread, 
    -                                                                        RegisterContextLLDBSharedPtr(), 
    -                                                                        first_cursor_sp->sctx, 
    -                                                                        0, *this));
    +    RegisterContextLLDBSP reg_ctx_sp (new RegisterContextLLDB (m_thread, 
    +                                                               RegisterContextLLDBSP(), 
    +                                                               first_cursor_sp->sctx, 
    +                                                               0, *this));
         if (reg_ctx_sp.get() == NULL)
             return false;
         
    @@ -87,7 +87,7 @@
     
         // Everything checks out, so release the auto pointer value and let the
         // cursor own it in its shared pointer
    -    first_cursor_sp->reg_ctx = reg_ctx_sp;
    +    first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
         m_frames.push_back (first_cursor_sp);
         return true;
     }
    @@ -104,10 +104,11 @@
             return false;
     
         uint32_t cur_idx = m_frames.size ();
    -    RegisterContextLLDBSharedPtr reg_ctx_sp(new RegisterContextLLDB (m_thread, 
    -                                                                       m_frames[cur_idx - 1]->reg_ctx, 
    -                                                                       cursor_sp->sctx, 
    -                                                                       cur_idx, *this));
    +    RegisterContextLLDBSP reg_ctx_sp(new RegisterContextLLDB (m_thread, 
    +                                                              m_frames[cur_idx - 1]->reg_ctx_lldb_sp, 
    +                                                              cursor_sp->sctx, 
    +                                                              cur_idx, 
    +                                                              *this));
         if (reg_ctx_sp.get() == NULL)
             return false;
     
    @@ -171,7 +172,7 @@
                 }
             }
         }
    -    cursor_sp->reg_ctx = reg_ctx_sp;
    +    cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
         m_frames.push_back (cursor_sp);
         return true;
     }
    @@ -218,21 +219,27 @@
     
         ABI *abi = m_thread.GetProcess().GetABI().get();
     
    -    while (idx >= m_frames.size() && AddOneMoreFrame (abi))
    -        ;
    +    while (idx >= m_frames.size())
    +    {
    +        if (!AddOneMoreFrame (abi))
    +            break;
    +    }
     
    -    if (idx < m_frames.size ())
    -        reg_ctx_sp = m_frames[idx]->reg_ctx;
    +    const uint32_t num_frames = m_frames.size();
    +    if (idx < num_frames)
    +    {
    +        Cursor *frame_cursor = m_frames[idx].get();
    +        reg_ctx_sp = frame_cursor->reg_ctx_lldb_sp->shared_from_this();
    +    }
         return reg_ctx_sp;
     }
     
    -UnwindLLDB::RegisterContextLLDBSharedPtr
    +UnwindLLDB::RegisterContextLLDBSP
     UnwindLLDB::GetRegisterContextForFrameNum (uint32_t frame_num)
     {
    -    RegisterContextLLDBSharedPtr reg_ctx_sp;
    -    if (frame_num >= m_frames.size())
    -        return reg_ctx_sp;
    -    reg_ctx_sp = m_frames[frame_num]->reg_ctx;
    +    RegisterContextLLDBSP reg_ctx_sp;
    +    if (frame_num < m_frames.size())
    +        reg_ctx_sp = m_frames[frame_num]->reg_ctx_lldb_sp;
         return reg_ctx_sp;
     }
     
    @@ -244,7 +251,7 @@
             return false;
         while (frame_num >= 0)
         {
    -        if (m_frames[frame_num]->reg_ctx->SavedLocationForRegister (lldb_regnum, regloc, false))
    +        if (m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc, false))
                 return true;
             frame_num--;
         }
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original)
    +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Sun Jan 29 14:56:30 2012
    @@ -69,11 +69,11 @@
         lldb::RegisterContextSP
         DoCreateRegisterContextForFrame (lldb_private::StackFrame *frame);
     
    -    typedef lldb::SharedPtr::Type RegisterContextLLDBSharedPtr;
    +    typedef SHARED_PTR(RegisterContextLLDB) RegisterContextLLDBSP;
     
         // Needed to retrieve the "next" frame (e.g. frame 2 needs to retrieve frame 1's RegisterContextLLDB)
         // The RegisterContext for frame_num must already exist or this returns an empty shared pointer.
    -    RegisterContextLLDBSharedPtr
    +    RegisterContextLLDBSP
         GetRegisterContextForFrameNum (uint32_t frame_num);
     
         // Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that
    @@ -89,14 +89,14 @@
             lldb::addr_t start_pc;  // The start address of the function/symbol for this frame - current pc if unknown
             lldb::addr_t cfa;       // The canonical frame address for this stack frame
             lldb_private::SymbolContext sctx;  // A symbol context we'll contribute to & provide to the StackFrame creation
    -        RegisterContextLLDBSharedPtr reg_ctx; // These are all RegisterContextLLDB's
    +        RegisterContextLLDBSP reg_ctx_lldb_sp; // These are all RegisterContextLLDB's
     
    -        Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { }
    +        Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx_lldb_sp() { }
         private:
             DISALLOW_COPY_AND_ASSIGN (Cursor);
         };
     
    -    typedef lldb::SharedPtr::Type CursorSP;
    +    typedef SHARED_PTR(Cursor) CursorSP;
         std::vector m_frames;
     
         bool AddOneMoreFrame (ABI *abi);
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
    +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Sun Jan 29 14:56:30 2012
    @@ -104,7 +104,7 @@
         // Now make a new log with this stream if one was provided
         if (log_stream_sp)
         {
    -        log = make_shared(log_stream_sp);
    +        log.reset (new Log(log_stream_sp));
             GetLog () = log;
         }
     
    
    Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Sun Jan 29 14:56:30 2012
    @@ -21,7 +21,7 @@
     typedef CStringToDIEMap::iterator CStringToDIEMapIter;
     typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
     
    -typedef lldb::SharedPtr::Type DWARFCompileUnitSP;
    +typedef SHARED_PTR(DWARFCompileUnit) DWARFCompileUnitSP;
     
     class DWARFDebugInfo
     {
    
    Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Sun Jan 29 14:56:30 2012
    @@ -68,7 +68,7 @@
             {
             }
     
    -        typedef lldb::SharedPtr::Type shared_ptr;
    +        typedef SHARED_PTR(Prologue) shared_ptr;
     
             uint32_t    total_length;   // The size in bytes of the statement information for this compilation unit (not including the total_length field itself).
             uint16_t    version;        // Version identifier for the statement information format.
    @@ -135,7 +135,7 @@
         //------------------------------------------------------------------
         struct LineTable
         {
    -        typedef lldb::SharedPtr::Type shared_ptr;
    +        typedef SHARED_PTR(LineTable) shared_ptr;
     
             LineTable() :
                 prologue(),
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Jan 29 14:56:30 2012
    @@ -2031,7 +2031,7 @@
             
         if (sc.function)
         {        
    -        sc.module_sp = sc.function->CalculateSymbolContextModule();
    +        sc.module_sp = sc.function->CalculateSymbolContextModule()->shared_from_this();
             return true;
         }
         
    @@ -2449,7 +2449,7 @@
         if (num_matches)
         {
             SymbolContext sc;
    -        sc.module_sp = m_obj_file->GetModule();
    +        sc.module_sp = m_obj_file->GetModule()->shared_from_this();
             assert (sc.module_sp);
             
             DWARFDebugInfo* debug_info = DebugInfo();
    @@ -2535,7 +2535,7 @@
         }
     
         SymbolContext sc;
    -    sc.module_sp = m_obj_file->GetModule();
    +    sc.module_sp = m_obj_file->GetModule()->shared_from_this();
         assert (sc.module_sp);
         
         DWARFCompileUnit* dwarf_cu = NULL;
    @@ -3149,7 +3149,7 @@
                     if (matching_type)
                     {
                         // We found a type pointer, now find the shared pointer form our type list
    -                    types.InsertUnique (TypeSP (matching_type));
    +                    types.InsertUnique (matching_type->shared_from_this());
                         if (types.GetSize() >= max_matches)
                             break;
                     }
    @@ -3267,7 +3267,7 @@
             if (matching_type)
             {
                 // We found a type pointer, now find the shared pointer form our type list
    -            types.InsertUnique (TypeSP (matching_type));
    +            types.InsertUnique (matching_type->shared_from_this());
                 ++num_matches;
                 if (num_matches >= max_matches)
                     break;
    @@ -3282,7 +3282,6 @@
     size_t
     SymbolFileDWARF::ParseChildParameters (const SymbolContext& sc,
                                            clang::DeclContext *containing_decl_ctx,
    -                                       TypeSP& type_sp,
                                            DWARFCompileUnit* dwarf_cu,
                                            const DWARFDebugInfoEntry *parent_die,
                                            bool skip_artificial,
    @@ -3676,7 +3675,7 @@
             else if (type_ptr != DIE_IS_BEING_PARSED)
             {
                 // Grab the existing type from the master types lists
    -            type_sp = type_ptr;
    +            type_sp = type_ptr->shared_from_this();
             }
     
         }
    @@ -4026,7 +4025,7 @@
                                 
                                 if (die)
                                     m_die_to_type[die] = resolved_type;
    -                            type_sp = resolved_type;
    +                            type_sp = resolved_type->shared_from_this();
                                 break;
                             }
                         }
    @@ -4148,7 +4147,7 @@
                                           MakeUserID(type_cu->GetOffset()));
                             
                             m_die_to_type[die] = resolved_type;
    -                        type_sp = resolved_type;
    +                        type_sp = resolved_type->shared_from_this();
                             break;
                         }
                     }
    @@ -4934,7 +4933,6 @@
                             bool skip_artificial = true;
                             ParseChildParameters (sc, 
                                                   containing_decl_ctx,
    -                                              type_sp, 
                                                   dwarf_cu, 
                                                   die, 
                                                   skip_artificial,
    @@ -5120,7 +5118,7 @@
                                                     type_ptr = m_die_to_type[die];
                                                     if (type_ptr)
                                                     {
    -                                                    type_sp = type_ptr;
    +                                                    type_sp = type_ptr->shared_from_this();
                                                         break;
                                                     }
                                                 }
    @@ -5343,7 +5341,7 @@
             }
             else if (type_ptr != DIE_IS_BEING_PARSED)
             {
    -            type_sp = type_ptr;
    +            type_sp = type_ptr->shared_from_this();
             }
         }
         return type_sp;
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Sun Jan 29 14:56:30 2012
    @@ -347,7 +347,6 @@
         size_t                  ParseChildParameters(
                                     const lldb_private::SymbolContext& sc,
                                     clang::DeclContext *containing_decl_ctx,
    -                                lldb::TypeSP& type_sp,
                                     DWARFCompileUnit* dwarf_cu,
                                     const DWARFDebugInfoEntry *parent_die,
                                     bool skip_artificial,
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Sun Jan 29 14:56:30 2012
    @@ -172,10 +172,10 @@
                 // use the debug map, to add new sections to each .o file and
                 // even though a .o file might not have changed, the sections
                 // that get added to the .o file can change.
    -            comp_unit_info->oso_module_sp = new Module (oso_file_spec, 
    -                                                        m_obj_file->GetModule()->GetArchitecture(),
    -                                                        NULL, 
    -                                                        0);
    +            comp_unit_info->oso_module_sp.reset (new Module (oso_file_spec, 
    +                                                             m_obj_file->GetModule()->GetArchitecture(),
    +                                                             NULL, 
    +                                                             0));
             }
         }
         return comp_unit_info->oso_module_sp.get();
    
    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=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Sun Jan 29 14:56:30 2012
    @@ -141,7 +141,7 @@
             lldb_private::SymbolVendor *oso_symbol_vendor;
             std::vector function_indexes;
             std::vector static_indexes;
    -        lldb::SharedPtr::Type debug_map_sections_sp;
    +        SHARED_PTR(lldb_private::SectionList) debug_map_sections_sp;
     
             CompileUnitInfo() :
                 so_file (),
    
    Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Sun Jan 29 14:56:30 2012
    @@ -411,7 +411,7 @@
             
             Declaration decl;
             
    -        lldb::TypeSP type(new Type (iter->second,
    +        lldb::TypeSP type(new Type (match->value,
                                         this,
                                         name,
                                         0,      // byte_size - don't change this from 0, we currently use that to identify these "synthetic" ObjC class types.
    
    Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
    +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Sun Jan 29 14:56:30 2012
    @@ -162,7 +162,7 @@
                 // Just create our symbol vendor using the current objfile as this is either
                 // an executable with no dSYM (that we could locate), an executable with
                 // a dSYM that has a UUID that doesn't match.
    -            symbol_vendor->AddSymbolFileRepresentation(obj_file->GetSP());
    +            symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this());
             }
         }
         return symbol_vendor;
    
    Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
    +++ lldb/trunk/source/Symbol/ObjectFile.cpp Sun Jan 29 14:56:30 2012
    @@ -276,14 +276,6 @@
         return eAddressClassUnknown;
     }
     
    -ObjectFileSP
    -ObjectFile::GetSP ()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return ObjectFileSP (this);
    -}
    -
     size_t
     ObjectFile::GetData (off_t offset, size_t length, DataExtractor &data) const
     {
    
    Modified: lldb/trunk/source/Symbol/Symbol.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Symbol/Symbol.cpp (original)
    +++ lldb/trunk/source/Symbol/Symbol.cpp Sun Jan 29 14:56:30 2012
    @@ -267,7 +267,7 @@
             if (!m_type_data_resolved)
             {
                 m_type_data_resolved = true;
    -            Module *module = m_addr_range.GetBaseAddress().GetModule();
    +            Module *module = m_addr_range.GetBaseAddress().GetModulePtr();
                 SymbolContext sc;
                 if (module && module->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
                                                                       eSymbolContextLineEntry,
    @@ -350,15 +350,9 @@
         sc->symbol = this;
         const AddressRange *range = GetAddressRangePtr();
         if (range)
    -    {   
    -        Module *module = range->GetBaseAddress().GetModule ();
    -        if (module)
    -        {
    -            sc->module_sp = module;
    -            return;
    -        }
    -    }
    -    sc->module_sp.reset();
    +        sc->module_sp = range->GetBaseAddress().GetModuleSP ();
    +    else
    +        sc->module_sp.reset();
     }
     
     Module *
    @@ -366,7 +360,7 @@
     {
         const AddressRange *range = GetAddressRangePtr();
         if (range)
    -        return range->GetBaseAddress().GetModule ();
    +        return range->GetBaseAddress().GetModulePtr ();
         return NULL;
     }
     
    @@ -384,7 +378,7 @@
         const AddressRange *range = GetAddressRangePtr();
         if (range)
         {   
    -        Module *module = range->GetBaseAddress().GetModule ();
    +        Module *module = range->GetBaseAddress().GetModulePtr ();
             if (module)
             {
                 dumped_module = true;
    
    Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
    +++ lldb/trunk/source/Symbol/SymbolVendor.cpp Sun Jan 29 14:56:30 2012
    @@ -58,7 +58,7 @@
         {
             ObjectFile *objfile = module->GetObjectFile();
             if (objfile)
    -            instance_ap->AddSymbolFileRepresentation(objfile->GetSP());
    +            instance_ap->AddSymbolFileRepresentation(objfile->shared_from_this());
         }
         return instance_ap.release();
     }
    
    Modified: lldb/trunk/source/Symbol/Type.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Symbol/Type.cpp (original)
    +++ lldb/trunk/source/Symbol/Type.cpp Sun Jan 29 14:56:30 2012
    @@ -34,7 +34,7 @@
     SymbolFileType::GetType ()
     {
         if (!m_type_sp)
    -        m_type_sp = m_symbol_file.ResolveTypeUID (GetID());
    +        m_type_sp = m_symbol_file.ResolveTypeUID (GetID())->shared_from_this();
         return m_type_sp.get();
     }
     
    
    Modified: lldb/trunk/source/Symbol/Variable.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Symbol/Variable.cpp (original)
    +++ lldb/trunk/source/Symbol/Variable.cpp Sun Jan 29 14:56:30 2012
    @@ -243,7 +243,7 @@
         {
             SymbolContext sc;
             CalculateSymbolContext(&sc);
    -        if (sc.module_sp.get() == address.GetModule())
    +        if (sc.module_sp.get() == address.GetModulePtr())
             {
                 // Is the variable is described by a single location?
                 if (!m_location.IsLocationList())
    @@ -480,7 +480,7 @@
         {
             SymbolContext sc;
             CalculateSymbolContext(&sc);
    -        if (sc.module_sp.get() == address.GetModule())
    +        if (sc.module_sp.get() == address.GetModulePtr())
             {
                 ABI *abi = NULL;
                 if (m_owner_scope)
    
    Modified: lldb/trunk/source/Target/ExecutionContext.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/ExecutionContext.cpp (original)
    +++ lldb/trunk/source/Target/ExecutionContext.cpp Sun Jan 29 14:56:30 2012
    @@ -46,7 +46,7 @@
     }
     
     ExecutionContext::ExecutionContext (Target* t, bool fill_current_process_thread_frame) :
    -    m_target_sp (t),
    +    m_target_sp (t->shared_from_this()),
         m_process_sp (),
         m_thread_sp (),
         m_frame_sp ()
    @@ -58,17 +58,19 @@
             {
                 m_thread_sp = m_process_sp->GetThreadList().GetSelectedThread();
                 if (m_thread_sp)
    -                m_frame_sp = m_thread_sp->GetSelectedFrame().get();
    +                m_frame_sp = m_thread_sp->GetSelectedFrame();
             }
         }
     }
     
     ExecutionContext::ExecutionContext(Process* process, Thread *thread, StackFrame *frame) :
    -    m_target_sp (process ? &process->GetTarget() : NULL),
    -    m_process_sp (process),
    -    m_thread_sp (thread),
    -    m_frame_sp (frame)
    +    m_target_sp (),
    +    m_process_sp (process->shared_from_this()),
    +    m_thread_sp (thread->shared_from_this()),
    +    m_frame_sp (frame->shared_from_this())
     {
    +    if (process)
    +        m_target_sp = process->GetTarget().shared_from_this();
     }
     
     ExecutionContext::ExecutionContext (ExecutionContextScope *exe_scope_ptr)
    @@ -200,24 +202,36 @@
     void
     ExecutionContext::SetTargetPtr (Target* target)
     {
    -    m_target_sp = target;
    +    if (target)
    +        m_target_sp = target->shared_from_this();
    +    else
    +        m_target_sp.reset();
     }
     
     void
     ExecutionContext::SetProcessPtr (Process *process)
     {
    -    m_process_sp = process;
    +    if (process)
    +        m_process_sp = process->shared_from_this();
    +    else
    +        m_process_sp.reset();
     }
     
     void
     ExecutionContext::SetThreadPtr (Thread *thread)
     {
    -    m_thread_sp = thread;
    +    if (thread)
    +        m_thread_sp = thread->shared_from_this();
    +    else
    +        m_thread_sp.reset();
     }
     
     void
     ExecutionContext::SetFramePtr (StackFrame *frame)
     {
    -    m_frame_sp = frame;
    +    if (frame)
    +        m_frame_sp = frame->shared_from_this();
    +    else
    +        m_frame_sp.reset();
     }
     
    
    Modified: lldb/trunk/source/Target/Process.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/Process.cpp (original)
    +++ lldb/trunk/source/Target/Process.cpp Sun Jan 29 14:56:30 2012
    @@ -848,7 +848,7 @@
         m_abi_sp.reset();
         m_os_ap.reset();
         m_dyld_ap.reset();
    -    m_thread_list.Clear();
    +    m_thread_list.Destroy();
         std::vector empty_notifications;
         m_notifications.swap(empty_notifications);
         m_image_tokens.clear();
    @@ -1543,7 +1543,7 @@
     }
     
     lldb::break_id_t
    -Process::CreateBreakpointSite (BreakpointLocationSP &owner, bool use_hardware)
    +Process::CreateBreakpointSite (const BreakpointLocationSP &owner, bool use_hardware)
     {
         const addr_t load_addr = owner->GetAddress().GetOpcodeLoadAddress (&m_target);
         if (load_addr != LLDB_INVALID_ADDRESS)
    @@ -3410,12 +3410,6 @@
         exe_ctx.SetFramePtr (NULL);
     }
     
    -lldb::ProcessSP
    -Process::GetSP ()
    -{
    -    return GetTarget().GetProcessSP();
    -}
    -
     //uint32_t
     //Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector &pids)
     //{
    @@ -3680,13 +3674,10 @@
     Process::UpdateInstanceName ()
     {
         Module *module = GetTarget().GetExecutableModulePointer();
    -    if (module)
    +    if (module && module->GetFileSpec().GetFilename())
         {
    -        StreamString sstr;
    -        sstr.Printf ("%s", module->GetFileSpec().GetFilename().AsCString());
    -                    
             GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
    -                                                         sstr.GetData());
    +                                                         module->GetFileSpec().GetFilename().AsCString());
         }
     }
     
    
    Modified: lldb/trunk/source/Target/StackFrame.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/StackFrame.cpp (original)
    +++ lldb/trunk/source/Target/StackFrame.cpp Sun Jan 29 14:56:30 2012
    @@ -95,7 +95,7 @@
         
         if (reg_context_sp && !m_sc.target_sp)
         {
    -        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
    +        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().shared_from_this();
             m_flags.Set (eSymbolContextTarget);
         }
     }
    @@ -129,16 +129,16 @@
         
         if (m_sc.target_sp.get() == NULL && reg_context_sp)
         {
    -        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
    +        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().shared_from_this();
             m_flags.Set (eSymbolContextTarget);
         }
         
    -    Module *pc_module = pc_addr.GetModule();
    +    Module *pc_module = pc_addr.GetModulePtr();
         if (m_sc.module_sp.get() == NULL || m_sc.module_sp.get() != pc_module)
         {
             if (pc_module)
             {
    -            m_sc.module_sp = pc_module;
    +            m_sc.module_sp = pc_module->shared_from_this();
                 m_flags.Set (eSymbolContextModule);
             }
             else
    @@ -218,7 +218,7 @@
                     Module *module = section->GetModule();
                     if (module)
                     {
    -                    m_sc.module_sp = module;
    +                    m_sc.module_sp = module->shared_from_this();
                         if (m_sc.module_sp)
                             m_flags.Set(eSymbolContextModule);
                     }
    @@ -417,7 +417,7 @@
             // If the target was requested add that:
             if (m_sc.target_sp.get() == NULL)
             {
    -            m_sc.target_sp = CalculateProcess()->GetTarget().GetSP();
    +            m_sc.target_sp = CalculateProcess()->GetTarget().shared_from_this();
                 if (m_sc.target_sp)
                     resolved |= eSymbolContextTarget;
             }
    @@ -1245,16 +1245,6 @@
         return false;
     }
     
    -StackFrameSP
    -StackFrame::GetSP ()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return StackFrameSP (this);
    -}
    -
    -
    -
     bool
     StackFrame::GetStatus (Stream& strm,
                            bool show_frame_info,
    
    Modified: lldb/trunk/source/Target/Target.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/Target.cpp (original)
    +++ lldb/trunk/source/Target/Target.cpp Sun Jan 29 14:56:30 2012
    @@ -149,14 +149,6 @@
         return m_process_sp;
     }
     
    -lldb::TargetSP
    -Target::GetSP()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return TargetSP(this);
    -}
    -
     void
     Target::Destroy()
     {
    @@ -256,8 +248,7 @@
     BreakpointSP
     Target::CreateBreakpoint (Address &addr, bool internal)
     {
    -    TargetSP target_sp = this->GetSP();
    -    SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (target_sp));
    +    SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
         BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr));
         return CreateBreakpoint (filter_sp, resolver_sp, internal);
     }
    @@ -290,17 +281,16 @@
     Target::GetSearchFilterForModule (const FileSpec *containingModule)
     {
         SearchFilterSP filter_sp;
    -    lldb::TargetSP target_sp = this->GetSP();
         if (containingModule != NULL)
         {
             // TODO: We should look into sharing module based search filters
             // across many breakpoints like we do for the simple target based one
    -        filter_sp.reset (new SearchFilterByModule (target_sp, *containingModule));
    +        filter_sp.reset (new SearchFilterByModule (shared_from_this(), *containingModule));
         }
         else
         {
             if (m_search_filter_sp.get() == NULL)
    -            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
    +            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
             filter_sp = m_search_filter_sp;
         }
         return filter_sp;
    @@ -310,17 +300,16 @@
     Target::GetSearchFilterForModuleList (const FileSpecList *containingModules)
     {
         SearchFilterSP filter_sp;
    -    lldb::TargetSP target_sp = this->GetSP();
         if (containingModules && containingModules->GetSize() != 0)
         {
             // TODO: We should look into sharing module based search filters
             // across many breakpoints like we do for the simple target based one
    -        filter_sp.reset (new SearchFilterByModuleList (target_sp, *containingModules));
    +        filter_sp.reset (new SearchFilterByModuleList (shared_from_this(), *containingModules));
         }
         else
         {
             if (m_search_filter_sp.get() == NULL)
    -            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
    +            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
             filter_sp = m_search_filter_sp;
         }
         return filter_sp;
    @@ -333,17 +322,16 @@
             return GetSearchFilterForModuleList(containingModules);
             
         SearchFilterSP filter_sp;
    -    lldb::TargetSP target_sp = this->GetSP();
         if (containingModules == NULL)
         {
             // We could make a special "CU List only SearchFilter".  Better yet was if these could be composable, 
             // but that will take a little reworking.
             
    -        filter_sp.reset (new SearchFilterByModuleListAndCU (target_sp, FileSpecList(), *containingSourceFiles));
    +        filter_sp.reset (new SearchFilterByModuleListAndCU (shared_from_this(), FileSpecList(), *containingSourceFiles));
         }
         else
         {
    -        filter_sp.reset (new SearchFilterByModuleListAndCU (target_sp, *containingModules, *containingSourceFiles));
    +        filter_sp.reset (new SearchFilterByModuleListAndCU (shared_from_this(), *containingModules, *containingSourceFiles));
         }
         return filter_sp;
     }
    @@ -1073,11 +1061,12 @@
     
             if (load_addr == LLDB_INVALID_ADDRESS)
             {
    -            if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec())
    +            Module *addr_module = resolved_addr.GetModulePtr();
    +            if (addr_module && addr_module->GetFileSpec())
                     error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded", 
    -                                               resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString(), 
    +                                               addr_module->GetFileSpec().GetFilename().AsCString(), 
                                                    resolved_addr.GetFileAddress(),
    -                                               resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString());
    +                                               addr_module->GetFileSpec().GetFilename().AsCString());
                 else
                     error.SetErrorStringWithFormat("0x%llx can't be resolved", resolved_addr.GetFileAddress());
             }
    @@ -1339,7 +1328,7 @@
         if (m_scratch_ast_context_ap.get() == NULL && m_arch.IsValid() && create_on_demand)
         {
             m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
    -        m_scratch_ast_source_ap.reset (new ClangASTSource(GetSP()));
    +        m_scratch_ast_source_ap.reset (new ClangASTSource(shared_from_this()));
             m_scratch_ast_source_ap->InstallASTContext(m_scratch_ast_context_ap->getASTContext());
             llvm::OwningPtr proxy_ast_source(m_scratch_ast_source_ap->CreateProxy());
             m_scratch_ast_context_ap->SetExternalSource(proxy_ast_source);
    @@ -1678,7 +1667,7 @@
     Target::AddStopHook (Target::StopHookSP &new_hook_sp)
     {
         lldb::user_id_t new_uid = ++m_stop_hook_next_id;
    -    new_hook_sp.reset (new StopHook(GetSP(), new_uid));
    +    new_hook_sp.reset (new StopHook(shared_from_this(), new_uid));
         m_stop_hooks[new_uid] = new_hook_sp;
         return new_uid;
     }
    
    Modified: lldb/trunk/source/Target/Thread.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/Thread.cpp (original)
    +++ lldb/trunk/source/Target/Thread.cpp Sun Jan 29 14:56:30 2012
    @@ -1030,15 +1030,6 @@
                                 &end);
     }
     
    -lldb::ThreadSP
    -Thread::GetSP ()
    -{
    -    // This object contains an instrusive ref count base class so we can
    -    // easily make a shared pointer to this object
    -    return ThreadSP(this);
    -}
    -
    -
     void
     Thread::SettingsInitialize ()
     {
    
    Modified: lldb/trunk/source/Target/ThreadList.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/ThreadList.cpp (original)
    +++ lldb/trunk/source/Target/ThreadList.cpp Sun Jan 29 14:56:30 2012
    @@ -355,6 +355,17 @@
     }
     
     void
    +ThreadList::Destroy()
    +{
    +    Mutex::Locker locker(m_threads_mutex);
    +    const uint32_t num_threads = m_threads.size();
    +    for (uint32_t idx = 0; idx < num_threads; ++idx)
    +    {
    +        m_threads[idx]->DestroyThread();
    +    }
    +}
    +
    +void
     ThreadList::RefreshStateAfterStop ()
     {
         Mutex::Locker locker(m_threads_mutex);
    @@ -603,6 +614,32 @@
             m_stop_id = rhs.m_stop_id;
             m_threads.swap(rhs.m_threads);
             m_selected_tid = rhs.m_selected_tid;
    +        
    +        
    +        // Now we look for threads that we are done with and
    +        // make sure to clear them up as much as possible so 
    +        // anyone with a shared pointer will still have a reference,
    +        // but the thread won't be of much use. Using std::weak_ptr
    +        // for all backward references (such as a thread to a process)
    +        // will eventually solve this issue for us, but for now, we
    +        // need to work around the issue
    +        collection::iterator rhs_pos, rhs_end = rhs.m_threads.end();
    +        for (rhs_pos = rhs.m_threads.begin(); rhs_pos != rhs_end; ++rhs_pos)
    +        {
    +            const lldb::tid_t tid = (*rhs_pos)->GetID();
    +            bool thread_is_alive = false;
    +            const uint32_t num_threads = m_threads.size();
    +            for (uint32_t idx = 0; idx < num_threads; ++idx)
    +            {
    +                if (m_threads[idx]->GetID() == tid)
    +                {
    +                    thread_is_alive = true;
    +                    break;
    +                }
    +            }
    +            if (!thread_is_alive)
    +                (*rhs_pos)->DestroyThread();
    +        }        
         }
     }
     
    
    Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original)
    +++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Sun Jan 29 14:56:30 2012
    @@ -119,7 +119,7 @@
         else
         {
             // Now we have to change the event to a breakpoint event and mark it up appropriately:
    -        Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess().GetSP(), eStateStopped);
    +        Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess().shared_from_this(), eStateStopped);
             event_ptr->SetData(new_data);
             event_ptr->SetType(Process::eBroadcastBitStateChanged);
             SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID (m_thread, 
    
    Modified: lldb/trunk/source/lldb-log.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=149207&r1=149206&r2=149207&view=diff
    ==============================================================================
    --- lldb/trunk/source/lldb-log.cpp (original)
    +++ lldb/trunk/source/lldb-log.cpp Sun Jan 29 14:56:30 2012
    @@ -169,7 +169,7 @@
         // Now make a new log with this stream if one was provided
         if (log_stream_sp)
         {
    -        log = make_shared(log_stream_sp);
    +        log.reset (new Log(log_stream_sp));
             GetLog () = log;
         }
     
    
    
    
    From gclayton at apple.com  Sun Jan 29 20:53:15 2012
    From: gclayton at apple.com (Greg Clayton)
    Date: Mon, 30 Jan 2012 02:53:15 -0000
    Subject: [Lldb-commits] [lldb] r149218 - in /lldb/trunk:
     include/lldb/API/SBDefines.h include/lldb/API/SBThread.h
     include/lldb/Core/DataVisualization.h include/lldb/lldb-forward-rtti.h
     include/lldb/lldb-forward.h include/lldb/lldb-public.h
     include/lldb/lldb-types.h lldb.xcodeproj/project.pbxproj scripts/lldb.swig
     source/API/SBBroadcaster.cpp source/API/SBFrame.cpp
     source/API/SBProcess.cpp source/API/SBThread.cpp source/API/SBValue.cpp
    Message-ID: <20120130025315.D9AB62A6C12C@llvm.org>
    
    Author: gclayton
    Date: Sun Jan 29 20:53:15 2012
    New Revision: 149218
    
    URL: http://llvm.org/viewvc/llvm-project?rev=149218&view=rev
    Log:
    Removed the "lldb-forward-rtti.h" header file as it was designed to contain
    all RTTI types, and since we don't use RTTI anymore since clang and llvm don't
    we don't really need this header file. All shared pointer definitions have
    been moved into "lldb-forward.h".
    
    Defined std::tr1::weak_ptr definitions for all of the types that inherit from
    enable_shared_from_this() in "lldb-forward.h" in preparation for thread
    hardening our public API.
    
    The first in the thread hardening check-ins. First we start with SBThread.
    We have issues in our lldb::SB API right now where if you have one object
    that is being used by two threads we have a race condition. Consider the
    following code:
    
     1    int
     2    SBThread::SomeFunction()
     3    {
     4        int result = -1;
     5        if (m_opaque_sp)
     6        {
     7            result = m_opaque_sp->DoSomething();
     8        }
     9        return result;
    10    }
    
    And now this happens:
    
    Thread 1 enters any SBThread function and checks its m_opaque_sp and is about
    to execute the code on line 7 but hasn't yet
    Thread 2 gets to run and class sb_thread.Clear() which calls m_opaque_sp.clear()
    and clears the contents of the shared pointer member
    Thread 1 now crashes when it resumes.
    
    The solution is to use std::tr1::weak_ptr. Now the SBThread class contains a
    lldb::ThreadWP (weak pointer to our lldb_private::Thread class) and this 
    function would look like:
    
     1    int
     2    SBThread::SomeFunction()
     3    {
     4        int result = -1;
     5        ThreadSP thread_sp(m_opaque_wp.lock());
     6        if (thread_sp)
     7        {
     8            result = m_opaque_sp->DoSomething();
     9        }
    10        return result;
    11    }
    
    Now we have a solid thread safe API where we get a local copy of our thread
    shared pointer from our weak_ptr and then we are guaranteed it can't go away
    during our function.
    
    So lldb::SBThread has been thread hardened, more checkins to follow shortly.
    
    
    Removed:
        lldb/trunk/include/lldb/lldb-forward-rtti.h
    Modified:
        lldb/trunk/include/lldb/API/SBDefines.h
        lldb/trunk/include/lldb/API/SBThread.h
        lldb/trunk/include/lldb/Core/DataVisualization.h
        lldb/trunk/include/lldb/lldb-forward.h
        lldb/trunk/include/lldb/lldb-public.h
        lldb/trunk/include/lldb/lldb-types.h
        lldb/trunk/lldb.xcodeproj/project.pbxproj
        lldb/trunk/scripts/lldb.swig
        lldb/trunk/source/API/SBBroadcaster.cpp
        lldb/trunk/source/API/SBFrame.cpp
        lldb/trunk/source/API/SBProcess.cpp
        lldb/trunk/source/API/SBThread.cpp
        lldb/trunk/source/API/SBValue.cpp
    
    Modified: lldb/trunk/include/lldb/API/SBDefines.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBDefines.h (original)
    +++ lldb/trunk/include/lldb/API/SBDefines.h Sun Jan 29 20:53:15 2012
    @@ -18,7 +18,6 @@
     #include "lldb/lldb-defines.h"
     #include "lldb/lldb-enumerations.h"
     #include "lldb/lldb-forward.h"
    -#include "lldb/lldb-forward-rtti.h"
     #include "lldb/lldb-types.h"
     
     // Forward Declarations
    
    Modified: lldb/trunk/include/lldb/API/SBThread.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/API/SBThread.h (original)
    +++ lldb/trunk/include/lldb/API/SBThread.h Sun Jan 29 20:53:15 2012
    @@ -171,27 +171,6 @@
         friend class SBDebugger;
         friend class SBValue;
     
    -
    -#ifndef SWIG
    -
    -    lldb_private::Thread *
    -    get ();
    -
    -    const lldb_private::Thread *
    -    operator->() const;
    -
    -    const lldb_private::Thread &
    -    operator*() const;
    -
    -
    -    lldb_private::Thread *
    -    operator->();
    -
    -    lldb_private::Thread &
    -    operator*();
    -
    -#endif
    -
         SBThread (const lldb::ThreadSP& lldb_object_sp);
     
         void
    @@ -202,7 +181,7 @@
         // Classes that inherit from Thread can see and modify these
         //------------------------------------------------------------------
     
    -    lldb::ThreadSP m_opaque_sp;
    +    lldb::ThreadWP m_opaque_wp;
     };
     
     } // namespace lldb
    
    Modified: lldb/trunk/include/lldb/Core/DataVisualization.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataVisualization.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/Core/DataVisualization.h (original)
    +++ lldb/trunk/include/lldb/Core/DataVisualization.h Sun Jan 29 20:53:15 2012
    @@ -23,7 +23,6 @@
     
     // Other libraries and framework includes
     // Project includes
    -#include "lldb/lldb-forward-rtti.h"
     #include "lldb/Core/ConstString.h"
     #include "lldb/Core/FormatClasses.h"
     #include "lldb/Core/FormatManager.h"
    
    Removed: lldb/trunk/include/lldb/lldb-forward-rtti.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=149217&view=auto
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
    +++ lldb/trunk/include/lldb/lldb-forward-rtti.h (removed)
    @@ -1,99 +0,0 @@
    -//===-- lldb-forward-rtti.h -------------------------------------*- C++ -*-===//
    -//
    -//                     The LLVM Compiler Infrastructure
    -//
    -// This file is distributed under the University of Illinois Open Source
    -// License. See LICENSE.TXT for details.
    -//
    -//===----------------------------------------------------------------------===//
    -
    -#ifndef LLDB_lldb_forward_rtti_h_
    -#define LLDB_lldb_forward_rtti_h_
    -
    -#if defined(__cplusplus)
    -
    -#include "lldb/lldb-types.h"
    -#include  // for std::tr1::shared_ptr
    -
    -//----------------------------------------------------------------------
    -// lldb forward declarations
    -//----------------------------------------------------------------------
    -namespace lldb {
    -
    -    typedef std::tr1::shared_ptr ABISP;
    -    typedef std::tr1::shared_ptr BatonSP;
    -    typedef std::tr1::shared_ptr BlockSP;
    -    typedef std::tr1::shared_ptr BreakpointSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr BreakpointSiteSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr BreakpointLocationSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr BreakpointResolverSP;
    -    typedef std::tr1::shared_ptr BroadcasterSP;
    -    typedef std::tr1::shared_ptr ClangExpressionVariableSP;
    -    typedef std::tr1::shared_ptr CommandObjectSP;
    -    typedef std::tr1::shared_ptr CommunicationSP;
    -    typedef std::tr1::shared_ptr ConnectionSP;
    -    typedef std::tr1::shared_ptr CompUnitSP;
    -    typedef std::tr1::shared_ptr DataBufferSP;
    -    typedef std::tr1::shared_ptr DataExtractorSP;
    -    typedef std::tr1::shared_ptr DebuggerSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr DisassemblerSP;
    -    typedef std::tr1::shared_ptr DynamicLoaderSP;
    -    typedef std::tr1::shared_ptr EventSP;
    -    typedef std::tr1::shared_ptr FormatCategorySP;
    -    typedef std::tr1::shared_ptr FunctionSP;
    -    typedef std::tr1::shared_ptr InlineFunctionInfoSP;
    -    typedef std::tr1::shared_ptr InputReaderSP;
    -    typedef std::tr1::shared_ptr InstanceSettingsSP;
    -    typedef std::tr1::shared_ptr InstructionSP;
    -    typedef std::tr1::shared_ptr LanguageRuntimeSP;
    -    typedef std::tr1::shared_ptr LineTableSP;
    -    typedef std::tr1::shared_ptr ListenerSP;
    -    typedef std::tr1::shared_ptr LogSP;
    -    typedef std::tr1::shared_ptr LogChannelSP;
    -    typedef std::tr1::shared_ptr ModuleSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr ObjectFileSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr OptionValueSP;
    -    typedef std::tr1::shared_ptr PlatformSP;
    -    typedef std::tr1::shared_ptr ProcessSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr RegisterContextSP;
    -    typedef std::tr1::shared_ptr RegularExpressionSP;
    -    typedef std::tr1::shared_ptr SectionSP;
    -    typedef std::tr1::shared_ptr SearchFilterSP;
    -#ifndef LLDB_DISABLE_PYTHON
    -    typedef std::tr1::shared_ptr ScriptFormatSP;
    -#endif // #ifndef LLDB_DISABLE_PYTHON
    -    typedef std::tr1::shared_ptr StackFrameSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr StackFrameListSP;
    -    typedef std::tr1::shared_ptr StopInfoSP;
    -    typedef std::tr1::shared_ptr StoppointLocationSP;
    -    typedef std::tr1::shared_ptr StreamSP;
    -    typedef std::tr1::shared_ptr StringSummaryFormatSP;
    -    typedef std::tr1::shared_ptr SummaryFormatSP;
    -    typedef std::tr1::shared_ptr SymbolFileSP;
    -    typedef std::tr1::shared_ptr SymbolFileTypeSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr SymbolContextSpecifierSP;
    -    typedef std::tr1::shared_ptr SyntheticChildrenSP;
    -    typedef std::tr1::shared_ptr SyntheticChildrenFrontEndSP;
    -    typedef std::tr1::shared_ptr TargetSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr ThreadSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr ThreadPlanSP;
    -    typedef std::tr1::shared_ptr ThreadPlanTracerSP;
    -    typedef std::tr1::shared_ptr TypeSP; // make_shared_from_this
    -    typedef std::tr1::shared_ptr TypeImplSP;
    -    typedef std::tr1::shared_ptr FuncUnwindersSP;
    -    typedef std::tr1::shared_ptr UserSettingsControllerSP;
    -    typedef std::tr1::shared_ptr UnwindPlanSP;
    -    typedef SharedPtr::Type ValueObjectSP;
    -    typedef std::tr1::shared_ptr ValueSP;
    -    typedef std::tr1::shared_ptr ValueFormatSP;
    -    typedef std::tr1::shared_ptr ValueListSP;
    -    typedef std::tr1::shared_ptr VariableSP;
    -    typedef std::tr1::shared_ptr VariableListSP;
    -    typedef std::tr1::shared_ptr ValueObjectListSP;
    -    typedef std::tr1::shared_ptr WatchpointSP;
    -
    -} // namespace lldb
    -
    -#endif  // #if defined(__cplusplus)
    -
    -#endif  // LLDB_lldb_forward_rtti_h_
    
    Modified: lldb/trunk/include/lldb/lldb-forward.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-forward.h (original)
    +++ lldb/trunk/include/lldb/lldb-forward.h Sun Jan 29 20:53:15 2012
    @@ -12,6 +12,9 @@
     
     #if defined(__cplusplus)
     
    +#include  // for std::tr1::shared_ptr, std::tr1::weak_ptr
    +#include "lldb/Utility/SharingPtr.h"
    +
     //----------------------------------------------------------------------
     // lldb forward declarations
     //----------------------------------------------------------------------
    @@ -211,5 +214,97 @@
     
     } // namespace lldb_private
     
    +//----------------------------------------------------------------------
    +// lldb forward declarations
    +//----------------------------------------------------------------------
    +namespace lldb {
    +    
    +    typedef std::tr1::shared_ptr ABISP;
    +    typedef std::tr1::shared_ptr BatonSP;
    +    typedef std::tr1::shared_ptr BlockSP;
    +    typedef std::tr1::shared_ptr BreakpointSP;
    +    typedef std::tr1::weak_ptr BreakpointWP;
    +    typedef std::tr1::shared_ptr BreakpointSiteSP;
    +    typedef std::tr1::weak_ptr BreakpointSiteWP;
    +    typedef std::tr1::shared_ptr BreakpointLocationSP;
    +    typedef std::tr1::weak_ptr BreakpointLocationWP;
    +    typedef std::tr1::shared_ptr BreakpointResolverSP;
    +    typedef std::tr1::shared_ptr BroadcasterSP;
    +    typedef std::tr1::shared_ptr ClangExpressionVariableSP;
    +    typedef std::tr1::shared_ptr CommandObjectSP;
    +    typedef std::tr1::shared_ptr CommunicationSP;
    +    typedef std::tr1::shared_ptr ConnectionSP;
    +    typedef std::tr1::shared_ptr CompUnitSP;
    +    typedef std::tr1::shared_ptr DataBufferSP;
    +    typedef std::tr1::shared_ptr DataExtractorSP;
    +    typedef std::tr1::shared_ptr DebuggerSP;
    +    typedef std::tr1::weak_ptr DebuggerWP;
    +    typedef std::tr1::shared_ptr DisassemblerSP;
    +    typedef std::tr1::shared_ptr DynamicLoaderSP;
    +    typedef std::tr1::shared_ptr EventSP;
    +    typedef std::tr1::shared_ptr FormatCategorySP;
    +    typedef std::tr1::shared_ptr FunctionSP;
    +    typedef std::tr1::shared_ptr InlineFunctionInfoSP;
    +    typedef std::tr1::shared_ptr InputReaderSP;
    +    typedef std::tr1::shared_ptr InstanceSettingsSP;
    +    typedef std::tr1::shared_ptr InstructionSP;
    +    typedef std::tr1::shared_ptr LanguageRuntimeSP;
    +    typedef std::tr1::shared_ptr LineTableSP;
    +    typedef std::tr1::shared_ptr ListenerSP;
    +    typedef std::tr1::shared_ptr LogSP;
    +    typedef std::tr1::shared_ptr LogChannelSP;
    +    typedef std::tr1::shared_ptr ModuleSP;
    +    typedef std::tr1::weak_ptr ModuleWP;
    +    typedef std::tr1::shared_ptr ObjectFileSP;
    +    typedef std::tr1::weak_ptr ObjectFileWP;
    +    typedef std::tr1::shared_ptr OptionValueSP;
    +    typedef std::tr1::shared_ptr PlatformSP;
    +    typedef std::tr1::shared_ptr ProcessSP;
    +    typedef std::tr1::weak_ptr ProcessWP;
    +    typedef std::tr1::shared_ptr RegisterContextSP;
    +    typedef std::tr1::shared_ptr RegularExpressionSP;
    +    typedef std::tr1::shared_ptr SectionSP;
    +    typedef std::tr1::shared_ptr SearchFilterSP;
    +#ifndef LLDB_DISABLE_PYTHON
    +    typedef std::tr1::shared_ptr ScriptFormatSP;
    +#endif // #ifndef LLDB_DISABLE_PYTHON
    +    typedef std::tr1::shared_ptr StackFrameSP;
    +    typedef std::tr1::weak_ptr StackFrameWP;
    +    typedef std::tr1::shared_ptr StackFrameListSP;
    +    typedef std::tr1::shared_ptr StopInfoSP;
    +    typedef std::tr1::shared_ptr StoppointLocationSP;
    +    typedef std::tr1::shared_ptr StreamSP;
    +    typedef std::tr1::shared_ptr StringSummaryFormatSP;
    +    typedef std::tr1::shared_ptr SummaryFormatSP;
    +    typedef std::tr1::shared_ptr SymbolFileSP;
    +    typedef std::tr1::shared_ptr SymbolFileTypeSP;
    +    typedef std::tr1::weak_ptr SymbolFileTypeWP;
    +    typedef std::tr1::shared_ptr SymbolContextSpecifierSP;
    +    typedef std::tr1::shared_ptr SyntheticChildrenSP;
    +    typedef std::tr1::shared_ptr SyntheticChildrenFrontEndSP;
    +    typedef std::tr1::shared_ptr TargetSP;
    +    typedef std::tr1::weak_ptr TargetWP;
    +    typedef std::tr1::shared_ptr ThreadSP;
    +    typedef std::tr1::weak_ptr ThreadWP;
    +    typedef std::tr1::shared_ptr ThreadPlanSP;
    +    typedef std::tr1::shared_ptr ThreadPlanTracerSP;
    +    typedef std::tr1::shared_ptr TypeSP;
    +    typedef std::tr1::weak_ptr TypeWP;
    +    typedef std::tr1::shared_ptr TypeImplSP;
    +    typedef std::tr1::shared_ptr FuncUnwindersSP;
    +    typedef std::tr1::shared_ptr UserSettingsControllerSP;
    +    typedef std::tr1::shared_ptr UnwindPlanSP;
    +    typedef lldb_private::SharingPtr ValueObjectSP;
    +    typedef std::tr1::shared_ptr ValueSP;
    +    typedef std::tr1::shared_ptr ValueFormatSP;
    +    typedef std::tr1::shared_ptr ValueListSP;
    +    typedef std::tr1::shared_ptr VariableSP;
    +    typedef std::tr1::shared_ptr VariableListSP;
    +    typedef std::tr1::shared_ptr ValueObjectListSP;
    +    typedef std::tr1::shared_ptr WatchpointSP;
    +    
    +} // namespace lldb
    +
    +
     #endif  // #if defined(__cplusplus)
     #endif  // LLDB_lldb_forward_h_
    
    Modified: lldb/trunk/include/lldb/lldb-public.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-public.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-public.h (original)
    +++ lldb/trunk/include/lldb/lldb-public.h Sun Jan 29 20:53:15 2012
    @@ -13,7 +13,6 @@
     #include "lldb/lldb-defines.h"
     #include "lldb/lldb-enumerations.h"
     #include "lldb/lldb-forward.h"
    -#include "lldb/lldb-forward-rtti.h"
     #include "lldb/lldb-types.h"
     
     #endif  // LLDB_lldb_h_
    
    Modified: lldb/trunk/include/lldb/lldb-types.h
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/include/lldb/lldb-types.h (original)
    +++ lldb/trunk/include/lldb/lldb-types.h Sun Jan 29 20:53:15 2012
    @@ -12,7 +12,6 @@
     
     #include "lldb/lldb-enumerations.h"
     #include "lldb/lldb-forward.h"
    -#include "lldb/Utility/SharingPtr.h"
     
     #include 
     #include 
    @@ -59,11 +58,11 @@
             //      // Make a typedef to a Foo shared pointer
             //      typedef lldb::SharePtr::Type FooSP;
             //
    -        template
    -        struct SharedPtr
    -        {
    -            typedef lldb_private::SharingPtr<_Tp> Type;
    -        };
    +//        template
    +//        struct SharedPtr
    +//        {
    +//            typedef lldb_private::SharingPtr<_Tp> Type;
    +//        };
     //        template
     //        struct LoggingSharedPtr
     //        {
    
    Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
    +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Jan 29 20:53:15 2012
    @@ -356,7 +356,6 @@
     		26DB3E1F1379E7AD0080DC73 /* ABISysV_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DB3E131379E7AD0080DC73 /* ABISysV_x86_64.cpp */; };
     		26DC6A171337FE8000FF7998 /* liblldb-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2689FFCA13353D7A00698AC0 /* liblldb-core.a */; };
     		26DC6A1D1337FECA00FF7998 /* lldb-platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DC6A1C1337FECA00FF7998 /* lldb-platform.cpp */; };
    -		26DE1E6B11616C2E00A093E2 /* lldb-forward-rtti.h in Headers */ = {isa = PBXBuildFile; fileRef = 26DE1E6911616C2E00A093E2 /* lldb-forward-rtti.h */; settings = {ATTRIBUTES = (Public, ); }; };
     		26DE1E6C11616C2E00A093E2 /* lldb-forward.h in Headers */ = {isa = PBXBuildFile; fileRef = 26DE1E6A11616C2E00A093E2 /* lldb-forward.h */; settings = {ATTRIBUTES = (Public, ); }; };
     		26DE204111618AB900A093E2 /* SBSymbolContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 26DE204011618AB900A093E2 /* SBSymbolContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
     		26DE204311618ACA00A093E2 /* SBAddress.h in Headers */ = {isa = PBXBuildFile; fileRef = 26DE204211618ACA00A093E2 /* SBAddress.h */; settings = {ATTRIBUTES = (Public, ); }; };
    @@ -1078,7 +1077,6 @@
     		26DB3E141379E7AD0080DC73 /* ABISysV_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABISysV_x86_64.h; sourceTree = ""; };
     		26DC6A101337FE6900FF7998 /* lldb-platform */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "lldb-platform"; sourceTree = BUILT_PRODUCTS_DIR; };
     		26DC6A1C1337FECA00FF7998 /* lldb-platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "lldb-platform.cpp"; path = "tools/lldb-platform/lldb-platform.cpp"; sourceTree = ""; };
    -		26DE1E6911616C2E00A093E2 /* lldb-forward-rtti.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = "lldb-forward-rtti.h"; path = "include/lldb/lldb-forward-rtti.h"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
     		26DE1E6A11616C2E00A093E2 /* lldb-forward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = "lldb-forward.h"; path = "include/lldb/lldb-forward.h"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
     		26DE204011618AB900A093E2 /* SBSymbolContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBSymbolContext.h; path = include/lldb/API/SBSymbolContext.h; sourceTree = ""; };
     		26DE204211618ACA00A093E2 /* SBAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBAddress.h; path = include/lldb/API/SBAddress.h; sourceTree = ""; };
    @@ -1741,7 +1739,6 @@
     				26BC7C2510F1B3BC00F91463 /* lldb-defines.h */,
     				26BC7C2610F1B3BC00F91463 /* lldb-enumerations.h */,
     				26DE1E6A11616C2E00A093E2 /* lldb-forward.h */,
    -				26DE1E6911616C2E00A093E2 /* lldb-forward-rtti.h */,
     				26651A14133BEC76005B64B7 /* lldb-public.h */,
     				26BC7C2910F1B3BC00F91463 /* lldb-types.h */,
     				26B42C4C1187ABA50079C8C8 /* LLDB.h */,
    @@ -2823,7 +2820,6 @@
     				2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */,
     				2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */,
     				26DE1E6C11616C2E00A093E2 /* lldb-forward.h in Headers */,
    -				26DE1E6B11616C2E00A093E2 /* lldb-forward-rtti.h in Headers */,
     				26680214115FD12C008E1FE4 /* lldb-types.h in Headers */,
     				26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */,
     				26DE204311618ACA00A093E2 /* SBAddress.h in Headers */,
    
    Modified: lldb/trunk/scripts/lldb.swig
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/scripts/lldb.swig (original)
    +++ lldb/trunk/scripts/lldb.swig Sun Jan 29 20:53:15 2012
    @@ -88,7 +88,6 @@
     %include "lldb/lldb-defines.h"
     %include "lldb/lldb-enumerations.h"
     %include "lldb/lldb-forward.h"
    -%include "lldb/lldb-forward-rtti.h"
     %include "lldb/lldb-types.h"
     
     /* Forward declaration of SB classes. */
    
    Modified: lldb/trunk/source/API/SBBroadcaster.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBBroadcaster.cpp (original)
    +++ lldb/trunk/source/API/SBBroadcaster.cpp Sun Jan 29 20:53:15 2012
    @@ -9,7 +9,6 @@
     
     #include "lldb/Core/Broadcaster.h"
     #include "lldb/Core/Log.h"
    -#include "lldb/lldb-forward-rtti.h"
     
     #include "lldb/API/SBBroadcaster.h"
     #include "lldb/API/SBListener.h"
    
    Modified: lldb/trunk/source/API/SBFrame.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBFrame.cpp (original)
    +++ lldb/trunk/source/API/SBFrame.cpp Sun Jan 29 20:53:15 2012
    @@ -550,10 +550,12 @@
         LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         SBThread sb_thread;
    +    ThreadSP thread_sp;
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
    -        sb_thread.SetThread (m_opaque_sp->GetThread().shared_from_this());
    +        thread_sp = m_opaque_sp->GetThread().shared_from_this();
    +        sb_thread.SetThread (thread_sp);
         }
     
         if (log)
    @@ -561,7 +563,7 @@
             SBStream sstr;
             sb_thread.GetDescription (sstr);
             log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", m_opaque_sp.get(), 
    -                     sb_thread.get(), sstr.GetData());
    +                     thread_sp.get(), sstr.GetData());
         }
     
         return sb_thread;
    
    Modified: lldb/trunk/source/API/SBProcess.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBProcess.cpp (original)
    +++ lldb/trunk/source/API/SBProcess.cpp Sun Jan 29 20:53:15 2012
    @@ -217,15 +217,17 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         SBThread sb_thread;
    +    ThreadSP thread_sp;
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
    -        sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread());
    +        thread_sp = m_opaque_sp->GetThreadList().GetSelectedThread();
    +        sb_thread.SetThread (thread_sp);
         }
     
         if (log)
         {
    -        log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.get());
    +        log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), thread_sp.get());
         }
     
         return sb_thread;
    @@ -378,20 +380,22 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    -    SBThread thread;
    +    SBThread sb_thread;
    +    ThreadSP thread_sp;
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
    -        thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index));
    +        thread_sp = m_opaque_sp->GetThreadList().GetThreadAtIndex(index);
    +        sb_thread.SetThread (thread_sp);
         }
     
         if (log)
         {
             log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)",
    -                     m_opaque_sp.get(), (uint32_t) index, thread.get());
    +                     m_opaque_sp.get(), (uint32_t) index, thread_sp.get());
         }
     
    -    return thread;
    +    return sb_thread;
     }
     
     StateType
    @@ -651,10 +655,12 @@
     SBProcess::GetThreadByID (tid_t tid)
     {
         SBThread sb_thread;
    +    ThreadSP thread_sp;
         if (m_opaque_sp)
         {
             Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
    -        sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid));
    +        thread_sp = m_opaque_sp->GetThreadList().FindThreadByID (tid);
    +        sb_thread.SetThread (thread_sp);
         }
     
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    @@ -663,7 +669,7 @@
             log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4llx) => SBThread (%p)", 
                          m_opaque_sp.get(), 
                          tid,
    -                     sb_thread.get());
    +                     thread_sp.get());
         }
     
         return sb_thread;
    
    Modified: lldb/trunk/source/API/SBThread.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBThread.cpp (original)
    +++ lldb/trunk/source/API/SBThread.cpp Sun Jan 29 20:53:15 2012
    @@ -43,17 +43,17 @@
     // Constructors
     //----------------------------------------------------------------------
     SBThread::SBThread () :
    -    m_opaque_sp ()
    +    m_opaque_wp ()
     {
     }
     
     SBThread::SBThread (const ThreadSP& lldb_object_sp) :
    -    m_opaque_sp (lldb_object_sp)
    +    m_opaque_wp (lldb_object_sp)
     {
     }
     
     SBThread::SBThread (const SBThread &rhs) :
    -    m_opaque_sp (rhs.m_opaque_sp)
    +    m_opaque_wp (rhs.m_opaque_wp)
     {
     }
     
    @@ -65,7 +65,7 @@
     SBThread::operator = (const SBThread &rhs)
     {
         if (this != &rhs)
    -        m_opaque_sp = rhs.m_opaque_sp;
    +        m_opaque_wp = rhs.m_opaque_wp;
         return *this;
     }
     
    @@ -79,13 +79,13 @@
     bool
     SBThread::IsValid() const
     {
    -    return m_opaque_sp;
    +    return !m_opaque_wp.expired();
     }
     
     void
     SBThread::Clear ()
     {
    -    m_opaque_sp.reset();
    +    m_opaque_wp.reset();
     }
     
     
    @@ -95,16 +95,17 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         StopReason reason = eStopReasonInvalid;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp)
                 reason =  stop_info_sp->GetStopReason();
         }
     
         if (log)
    -        log->Printf ("SBThread(%p)::GetStopReason () => %s", m_opaque_sp.get(), 
    +        log->Printf ("SBThread(%p)::GetStopReason () => %s", thread_sp.get(), 
                          Thread::StopReasonAsCString (reason));
     
         return reason;
    @@ -113,10 +114,11 @@
     size_t
     SBThread::GetStopReasonDataCount ()
     {
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp)
             {
                 StopReason reason = stop_info_sp->GetStopReason();
    @@ -132,7 +134,7 @@
                 case eStopReasonBreakpoint:
                     {
                         break_id_t site_id = stop_info_sp->GetValue();
    -                    lldb::BreakpointSiteSP bp_site_sp (m_opaque_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
    +                    lldb::BreakpointSiteSP bp_site_sp (thread_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
                         if (bp_site_sp)
                             return bp_site_sp->GetNumberOfOwners () * 2;
                         else
    @@ -157,10 +159,11 @@
     uint64_t
     SBThread::GetStopReasonDataAtIndex (uint32_t idx)
     {
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp)
             {
                 StopReason reason = stop_info_sp->GetStopReason();
    @@ -176,7 +179,7 @@
                 case eStopReasonBreakpoint:
                     {
                         break_id_t site_id = stop_info_sp->GetValue();
    -                    lldb::BreakpointSiteSP bp_site_sp (m_opaque_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
    +                    lldb::BreakpointSiteSP bp_site_sp (thread_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
                         if (bp_site_sp)
                         {
                             uint32_t bp_index = idx / 2;
    @@ -218,10 +221,11 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp)
             {
                 const char *stop_desc = stop_info_sp->GetDescription();
    @@ -229,7 +233,7 @@
                 {
                     if (log)
                         log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", 
    -                                 m_opaque_sp.get(), stop_desc);
    +                                 thread_sp.get(), stop_desc);
                     if (dst)
                         return ::snprintf (dst, dst_len, "%s", stop_desc);
                     else
    @@ -270,7 +274,7 @@
     
                     case eStopReasonSignal:
                         {
    -                        stop_desc = m_opaque_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (stop_info_sp->GetValue());
    +                        stop_desc = thread_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (stop_info_sp->GetValue());
                             if (stop_desc == NULL || stop_desc[0] == '\0')
                             {
                                 static char signal_desc[] = "signal";
    @@ -296,7 +300,7 @@
                     {
                         if (log)
                             log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", 
    -                                     m_opaque_sp.get(), stop_desc);
    +                                     thread_sp.get(), stop_desc);
     
                         if (dst)
                             return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte
    @@ -318,10 +322,11 @@
     SBThread::GetStopReturnValue ()
     {
         ValueObjectSP return_valobj_sp;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp)
             {
                 return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp);
    @@ -330,7 +335,7 @@
         
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         if (log)
    -        log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", m_opaque_sp.get(), 
    +        log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", thread_sp.get(), 
                                                                       return_valobj_sp.get() 
                                                                           ? return_valobj_sp->GetValueAsCString() 
                                                                             : "");
    @@ -341,7 +346,7 @@
     void
     SBThread::SetThread (const ThreadSP& lldb_object_sp)
     {
    -    m_opaque_sp = lldb_object_sp;
    +    m_opaque_wp = lldb_object_sp;
     }
     
     
    @@ -351,11 +356,12 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
    -    if (m_opaque_sp)
    -        tid = m_opaque_sp->GetID();
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
    +        tid = thread_sp->GetID();
     
         if (log)
    -        log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4llx", m_opaque_sp.get(), tid);
    +        log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4llx", thread_sp.get(), tid);
     
         return tid;
     }
    @@ -363,23 +369,25 @@
     uint32_t
     SBThread::GetIndexID () const
     {
    -    if (m_opaque_sp)
    -        return m_opaque_sp->GetIndexID();
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
    +        return thread_sp->GetIndexID();
         return LLDB_INVALID_INDEX32;
     }
     const char *
     SBThread::GetName () const
     {
         const char *name = NULL;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        name = m_opaque_sp->GetName();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        name = thread_sp->GetName();
         }
         
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         if (log)
    -        log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL");
    +        log->Printf ("SBThread(%p)::GetName () => %s", thread_sp.get(), name ? name : "NULL");
     
         return name;
     }
    @@ -388,15 +396,16 @@
     SBThread::GetQueueName () const
     {
         const char *name = NULL;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        name = m_opaque_sp->GetQueueName();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        name = thread_sp->GetQueueName();
         }
         
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         if (log)
    -        log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL");
    +        log->Printf ("SBThread(%p)::GetQueueName () => %s", thread_sp.get(), name ? name : "NULL");
     
         return name;
     }
    @@ -407,40 +416,42 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +
         if (log)
    -        log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(), 
    +        log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", thread_sp.get(), 
                          Thread::RunModeAsCString (stop_other_threads));
    -
    -    if (m_opaque_sp)
    +    
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
             bool abort_other_plans = true;
    -        StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
    +        StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex (0));
     
             if (frame_sp)
             {
                 if (frame_sp->HasDebugInformation ())
                 {
                     SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
    -                m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans, 
    -                                                          eStepTypeOver,
    -                                                          sc.line_entry.range, 
    -                                                          sc,
    -                                                          stop_other_threads,
    -                                                          false);
    +                thread_sp->QueueThreadPlanForStepRange (abort_other_plans, 
    +                                                        eStepTypeOver,
    +                                                        sc.line_entry.range, 
    +                                                        sc,
    +                                                        stop_other_threads,
    +                                                        false);
                     
                 }
                 else
                 {
    -                m_opaque_sp->QueueThreadPlanForStepSingleInstruction (true, 
    -                                                                      abort_other_plans, 
    -                                                                      stop_other_threads);
    +                thread_sp->QueueThreadPlanForStepSingleInstruction (true, 
    +                                                                    abort_other_plans, 
    +                                                                    stop_other_threads);
                 }
             }
     
    -        Process &process = m_opaque_sp->GetProcess();
    +        Process &process = thread_sp->GetProcess();
             // Why do we need to set the current thread by ID here???
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -457,38 +468,40 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    +
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +
         if (log)
    -        log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(),
    +        log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", thread_sp.get(),
                          Thread::RunModeAsCString (stop_other_threads));
    -
    -    if (m_opaque_sp)
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
             bool abort_other_plans = true;
     
    -        StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
    +        StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex (0));
     
             if (frame_sp && frame_sp->HasDebugInformation ())
             {
                 bool avoid_code_without_debug_info = true;
                 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
    -            m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans, 
    -                                                      eStepTypeInto, 
    -                                                      sc.line_entry.range, 
    -                                                      sc, 
    -                                                      stop_other_threads,
    -                                                      avoid_code_without_debug_info);
    +            thread_sp->QueueThreadPlanForStepRange (abort_other_plans, 
    +                                                    eStepTypeInto, 
    +                                                    sc.line_entry.range, 
    +                                                    sc, 
    +                                                    stop_other_threads,
    +                                                    avoid_code_without_debug_info);
             }
             else
             {
    -            m_opaque_sp->QueueThreadPlanForStepSingleInstruction (false, 
    -                                                                  abort_other_plans, 
    -                                                                  stop_other_threads);
    +            thread_sp->QueueThreadPlanForStepSingleInstruction (false, 
    +                                                                abort_other_plans, 
    +                                                                stop_other_threads);
             }
     
    -        Process &process = m_opaque_sp->GetProcess();
    +        Process &process = thread_sp->GetProcess();
             // Why do we need to set the current thread by ID here???
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -505,25 +518,27 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    -    if (log)
    -        log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get());
    +    ThreadSP thread_sp(m_opaque_wp.lock());
     
    -    if (m_opaque_sp)
    +    if (log)
    +        log->Printf ("SBThread(%p)::StepOut ()", thread_sp.get());
    +    
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
             bool abort_other_plans = true;
             bool stop_other_threads = true;
     
    -        m_opaque_sp->QueueThreadPlanForStepOut (abort_other_plans, 
    -                                                NULL, 
    -                                                false, 
    -                                                stop_other_threads, 
    -                                                eVoteYes, 
    -                                                eVoteNoOpinion,
    -                                                0);
    +        thread_sp->QueueThreadPlanForStepOut (abort_other_plans, 
    +                                              NULL, 
    +                                              false, 
    +                                              stop_other_threads, 
    +                                              eVoteYes, 
    +                                              eVoteNoOpinion,
    +                                              0);
             
    -        Process &process = m_opaque_sp->GetProcess();
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        Process &process = thread_sp->GetProcess();
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -540,29 +555,31 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +
         if (log)
         {
             SBStream frame_desc_strm;
             sb_frame.GetDescription (frame_desc_strm);
    -        log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", m_opaque_sp.get(), sb_frame.get(), frame_desc_strm.GetData());
    +        log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", thread_sp.get(), sb_frame.get(), frame_desc_strm.GetData());
         }
     
    -    if (m_opaque_sp)
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
             bool abort_other_plans = true;
             bool stop_other_threads = true;
     
    -        m_opaque_sp->QueueThreadPlanForStepOut (abort_other_plans, 
    -                                                NULL, 
    -                                                false, 
    -                                                stop_other_threads, 
    -                                                eVoteYes, 
    -                                                eVoteNoOpinion,
    -                                                sb_frame->GetFrameIndex());
    +        thread_sp->QueueThreadPlanForStepOut (abort_other_plans, 
    +                                              NULL, 
    +                                              false, 
    +                                              stop_other_threads, 
    +                                              eVoteYes, 
    +                                              eVoteNoOpinion,
    +                                              sb_frame->GetFrameIndex());
             
    -        Process &process = m_opaque_sp->GetProcess();
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        Process &process = thread_sp->GetProcess();
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -579,15 +596,17 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    -    if (log)
    -        log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over);
    +    ThreadSP thread_sp(m_opaque_wp.lock());
     
    -    if (m_opaque_sp)
    +    if (log)
    +        log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", thread_sp.get(), step_over);
    +    
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
    -        Process &process = m_opaque_sp->GetProcess();
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        thread_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
    +        Process &process = thread_sp->GetProcess();
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -604,19 +623,21 @@
     {
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
    -    if (log)
    -        log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr);
    +    ThreadSP thread_sp(m_opaque_wp.lock());
     
    -    if (m_opaque_sp)
    +    if (log)
    +        log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", thread_sp.get(), addr);
    +    
    +    if (thread_sp)
         {
             bool abort_other_plans = true;
             bool stop_other_threads = true;
     
             Address target_addr (NULL, addr);
     
    -        m_opaque_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
    -        Process &process = m_opaque_sp->GetProcess();
    -        process.GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    +        thread_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
    +        Process &process = thread_sp->GetProcess();
    +        process.GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
             Error error (process.Resume());
             if (error.Success())
             {
    @@ -636,22 +657,24 @@
         SBError sb_error;
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         char path[PATH_MAX];
    -
    +    
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    
         if (log)
         {
             SBStream frame_desc_strm;
             sb_frame.GetDescription (frame_desc_strm);
             sb_file_spec->GetPath (path, sizeof(path));
             log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)", 
    -                     m_opaque_sp.get(), 
    +                     thread_sp.get(), 
                          sb_frame.get(), 
                          frame_desc_strm.GetData(),
                          path, line);
         }
    -    
    -    if (m_opaque_sp)
    +
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
     
             if (line == 0)
             {
    @@ -664,9 +687,9 @@
                 frame_sp = sb_frame.get_sp();
             else
             {
    -            frame_sp = m_opaque_sp->GetSelectedFrame ();
    +            frame_sp = thread_sp->GetSelectedFrame ();
                 if (!frame_sp)
    -                frame_sp = m_opaque_sp->GetStackFrameAtIndex (0);
    +                frame_sp = thread_sp->GetStackFrameAtIndex (0);
             }
         
             SymbolContext frame_sc;
    @@ -718,7 +741,7 @@
             const bool stop_other_threads = true;
             const bool check_inlines = true;
             const bool exact = false;
    -        Target *target = &m_opaque_sp->GetProcess().GetTarget();
    +        Target *target = &thread_sp->GetProcess().GetTarget();
     
             SymbolContextList sc_list;
             const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext (step_file_spec, 
    @@ -758,20 +781,20 @@
             }
             else
             {
    -            m_opaque_sp->QueueThreadPlanForStepUntil (abort_other_plans, 
    -                                                      &step_over_until_addrs[0],
    -                                                      step_over_until_addrs.size(),
    -                                                      stop_other_threads,
    -                                                      frame_sp->GetFrameIndex());      
    +            thread_sp->QueueThreadPlanForStepUntil (abort_other_plans, 
    +                                                    &step_over_until_addrs[0],
    +                                                    step_over_until_addrs.size(),
    +                                                    stop_other_threads,
    +                                                    frame_sp->GetFrameIndex());      
     
    -            m_opaque_sp->GetProcess().GetThreadList().SetSelectedThreadByID (m_opaque_sp->GetID());
    -            sb_error.ref() = m_opaque_sp->GetProcess().Resume();
    +            thread_sp->GetProcess().GetThreadList().SetSelectedThreadByID (thread_sp->GetID());
    +            sb_error.ref() = thread_sp->GetProcess().Resume();
                 if (sb_error->Success())
                 {
                     // If we are doing synchronous mode, then wait for the
                     // process to stop yet again!
    -                if (m_opaque_sp->GetProcess().GetTarget().GetDebugger().GetAsyncExecution () == false)
    -                    m_opaque_sp->GetProcess().WaitForProcessToStop (NULL);
    +                if (thread_sp->GetProcess().GetTarget().GetDebugger().GetAsyncExecution () == false)
    +                    thread_sp->GetProcess().WaitForProcessToStop (NULL);
                 }
             }
         }
    @@ -786,9 +809,10 @@
     bool
     SBThread::Suspend()
     {
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        m_opaque_sp->SetResumeState (eStateSuspended);
    +        thread_sp->SetResumeState (eStateSuspended);
             return true;
         }
         return false;
    @@ -797,9 +821,10 @@
     bool
     SBThread::Resume ()
     {
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        m_opaque_sp->SetResumeState (eStateRunning);
    +        thread_sp->SetResumeState (eStateRunning);
             return true;
         }
         return false;
    @@ -808,8 +833,9 @@
     bool
     SBThread::IsSuspended()
     {
    -    if (m_opaque_sp)
    -        return m_opaque_sp->GetResumeState () == eStateSuspended;
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
    +        return thread_sp->GetResumeState () == eStateSuspended;
         return false;
     }
     
    @@ -818,10 +844,11 @@
     {
     
         SBProcess process;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
             // Have to go up to the target so we can get a shared pointer to our process...
    -        process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
    +        process.SetProcess(thread_sp->GetProcess().GetTarget().GetProcessSP());
         }
     
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    @@ -829,7 +856,7 @@
         {
             SBStream frame_desc_strm;
             process.GetDescription (frame_desc_strm);
    -        log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(),
    +        log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", thread_sp.get(),
                          process.get(), frame_desc_strm.GetData());
         }
     
    @@ -842,14 +869,15 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         uint32_t num_frames = 0;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        num_frames = m_opaque_sp->GetStackFrameCount();
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        num_frames = thread_sp->GetStackFrameCount();
         }
     
         if (log)
    -        log->Printf ("SBThread(%p)::GetNumFrames () => %u", m_opaque_sp.get(), num_frames);
    +        log->Printf ("SBThread(%p)::GetNumFrames () => %u", thread_sp.get(), num_frames);
     
         return num_frames;
     }
    @@ -860,10 +888,11 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         SBFrame sb_frame;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx));
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        sb_frame.SetFrame (thread_sp->GetStackFrameAtIndex (idx));
         }
     
         if (log)
    @@ -871,7 +900,7 @@
             SBStream frame_desc_strm;
             sb_frame.GetDescription (frame_desc_strm);
             log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", 
    -                     m_opaque_sp.get(), idx, sb_frame.get(), frame_desc_strm.GetData());
    +                     thread_sp.get(), idx, sb_frame.get(), frame_desc_strm.GetData());
         }
     
         return sb_frame;
    @@ -883,10 +912,11 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         SBFrame sb_frame;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        sb_frame.SetFrame (m_opaque_sp->GetSelectedFrame ());
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        sb_frame.SetFrame (thread_sp->GetSelectedFrame ());
         }
     
         if (log)
    @@ -894,7 +924,7 @@
             SBStream frame_desc_strm;
             sb_frame.GetDescription (frame_desc_strm);
             log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s", 
    -                     m_opaque_sp.get(), sb_frame.get(), frame_desc_strm.GetData());
    +                     thread_sp.get(), sb_frame.get(), frame_desc_strm.GetData());
         }
     
         return sb_frame;
    @@ -906,13 +936,14 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
         SBFrame sb_frame;
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
    -        lldb::StackFrameSP frame_sp (m_opaque_sp->GetStackFrameAtIndex (idx));
    +        Mutex::Locker api_locker (thread_sp->GetProcess().GetTarget().GetAPIMutex());
    +        lldb::StackFrameSP frame_sp (thread_sp->GetStackFrameAtIndex (idx));
             if (frame_sp)
             {
    -            m_opaque_sp->SetSelectedFrame (frame_sp.get());
    +            thread_sp->SetSelectedFrame (frame_sp.get());
                 sb_frame.SetFrame (frame_sp);
             }
         }
    @@ -922,7 +953,7 @@
             SBStream frame_desc_strm;
             sb_frame.GetDescription (frame_desc_strm);
             log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s", 
    -                     m_opaque_sp.get(), idx, sb_frame.get(), frame_desc_strm.GetData());
    +                     thread_sp.get(), idx, sb_frame.get(), frame_desc_strm.GetData());
         }
         return sb_frame;
     }
    @@ -931,43 +962,13 @@
     bool
     SBThread::operator == (const SBThread &rhs) const
     {
    -    return m_opaque_sp.get() == rhs.m_opaque_sp.get();
    +    return m_opaque_wp.lock().get() == rhs.m_opaque_wp.lock().get();
     }
     
     bool
     SBThread::operator != (const SBThread &rhs) const
     {
    -    return m_opaque_sp.get() != rhs.m_opaque_sp.get();
    -}
    -
    -lldb_private::Thread *
    -SBThread::get ()
    -{
    -    return m_opaque_sp.get();
    -}
    -
    -const lldb_private::Thread *
    -SBThread::operator->() const
    -{
    -    return m_opaque_sp.get();
    -}
    -
    -const lldb_private::Thread &
    -SBThread::operator*() const
    -{
    -    return *m_opaque_sp;
    -}
    -
    -lldb_private::Thread *
    -SBThread::operator->()
    -{
    -    return m_opaque_sp.get();
    -}
    -
    -lldb_private::Thread &
    -SBThread::operator*()
    -{
    -    return *m_opaque_sp;
    +    return m_opaque_wp.lock().get() != rhs.m_opaque_wp.lock().get();
     }
     
     bool
    @@ -975,9 +976,10 @@
     {
         Stream &strm = description.ref();
     
    -    if (m_opaque_sp)
    +    ThreadSP thread_sp(m_opaque_wp.lock());
    +    if (thread_sp)
         {
    -        strm.Printf("SBThread: tid = 0x%4.4llx", m_opaque_sp->GetID());
    +        strm.Printf("SBThread: tid = 0x%4.4llx", thread_sp->GetID());
         }
         else
             strm.PutCString ("No value");
    
    Modified: lldb/trunk/source/API/SBValue.cpp
    URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=149218&r1=149217&r2=149218&view=diff
    ==============================================================================
    --- lldb/trunk/source/API/SBValue.cpp (original)
    +++ lldb/trunk/source/API/SBValue.cpp Sun Jan 29 20:53:15 2012
    @@ -878,23 +878,25 @@
     lldb::SBThread
     SBValue::GetThread()
     {
    -    SBThread result;
    +    SBThread sb_thread;
    +    ThreadSP thread_sp;
         if (m_opaque_sp)
         {
             if (m_opaque_sp->GetExecutionContextScope())
             {
    -            result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this());
    +            thread_sp = m_opaque_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this();
    +            sb_thread.SetThread(thread_sp);
             }
         }
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         if (log)
         {
    -        if (result.get() == NULL)
    +        if (thread_sp.get() == NULL)
                 log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
             else
    -            log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), result.get());
    +            log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get());
         }
    -    return result;
    +    return sb_thread;
     }
     
     lldb::SBFrame