From johnny.chen at apple.com Mon Jan 3 13:55:37 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 03 Jan 2011 19:55:37 -0000 Subject: [Lldb-commits] [lldb] r122767 - /lldb/trunk/test/foundation/TestObjCMethods.py Message-ID: <20110103195537.ACFE82A6C12C@llvm.org> Author: johnny Date: Mon Jan 3 13:55:37 2011 New Revision: 122767 URL: http://llvm.org/viewvc/llvm-project?rev=122767&view=rev Log: Updated comment. Modified: lldb/trunk/test/foundation/TestObjCMethods.py Modified: lldb/trunk/test/foundation/TestObjCMethods.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/foundation/TestObjCMethods.py?rev=122767&r1=122766&r2=122767&view=diff ============================================================================== --- lldb/trunk/test/foundation/TestObjCMethods.py (original) +++ lldb/trunk/test/foundation/TestObjCMethods.py Mon Jan 3 13:55:37 2011 @@ -191,7 +191,6 @@ self.line) self.runCmd("process continue") - # This currently fails. # rdar://problem/8542091 # test/foundation: expr -o -- my not working? # From johnny.chen at apple.com Mon Jan 3 14:40:08 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 03 Jan 2011 20:40:08 -0000 Subject: [Lldb-commits] [lldb] r122770 - /lldb/trunk/test/objc-stepping/TestObjCStepping.py Message-ID: <20110103204008.2D2752A6C12C@llvm.org> Author: johnny Date: Mon Jan 3 14:40:08 2011 New Revision: 122770 URL: http://llvm.org/viewvc/llvm-project?rev=122770&view=rev Log: Fix typo of the test method name. Modified: lldb/trunk/test/objc-stepping/TestObjCStepping.py Modified: lldb/trunk/test/objc-stepping/TestObjCStepping.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-stepping/TestObjCStepping.py?rev=122770&r1=122769&r2=122770&view=diff ============================================================================== --- lldb/trunk/test/objc-stepping/TestObjCStepping.py (original) +++ lldb/trunk/test/objc-stepping/TestObjCStepping.py Mon Jan 3 14:40:08 2011 @@ -17,7 +17,7 @@ self.objc_stepping() @python_api_test - def test_with_dward_and_python_api(self): + def test_with_dwarf_and_python_api(self): """Test stepping through ObjC method dispatch in various forms.""" self.buildDwarf() self.objc_stepping() From gclayton at apple.com Mon Jan 3 19:17:46 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 04 Jan 2011 01:17:46 -0000 Subject: [Lldb-commits] [lldb] r122797 - /lldb/trunk/lldb.xcodeproj/project.pbxproj Message-ID: <20110104011746.384C62A6C12C@llvm.org> Author: gclayton Date: Mon Jan 3 19:17:46 2011 New Revision: 122797 URL: http://llvm.org/viewvc/llvm-project?rev=122797&view=rev Log: Fixed the file ordering (alphabetic) in the Commands folder. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=122797&r1=122796&r2=122797&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jan 3 19:17:46 2011 @@ -1843,8 +1843,6 @@ 26BC7D0D10F1B71D00F91463 /* Commands */ = { isa = PBXGroup; children = ( - B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */, - B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */, 4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */, 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */, 499F381E11A5B3F300F5CE02 /* CommandObjectArgs.h */, @@ -1889,6 +1887,8 @@ 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */, 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */, 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */, + B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */, + B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */, ); name = Commands; sourceTree = ""; @@ -2363,6 +2363,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, From scallanan at apple.com Mon Jan 3 20:41:41 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 04 Jan 2011 02:41:41 -0000 Subject: [Lldb-commits] [lldb] r122800 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20110104024141.331E62A6C12C@llvm.org> Author: spyffe Date: Mon Jan 3 20:41:41 2011 New Revision: 122800 URL: http://llvm.org/viewvc/llvm-project?rev=122800&view=rev Log: Fixed a problem where constant results of expressions were not being created in the proper way, meaning results were getting lost. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=122800&r1=122799&r2=122800&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Jan 3 20:41:41 2011 @@ -129,7 +129,6 @@ { assert (m_parser_vars.get()); - clang::ASTContext *context(m_parser_vars->m_exe_ctx->target->GetScratchClangASTContext()->getASTContext()); TypeFromUser user_type(ClangASTContext::CopyType(context, @@ -137,25 +136,32 @@ type.GetOpaqueQualType()), context); - DataBufferHeap *heap_data_buf = new DataBufferHeap(ClangASTType::GetClangTypeBitWidth(user_type.GetASTContext(), - user_type.GetOpaqueQualType()) / 8, - '\0'); + if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (name, + user_type, + m_parser_vars->m_exe_ctx->process->GetByteOrder(), + m_parser_vars->m_exe_ctx->process->GetAddressByteSize())) + return lldb::ClangExpressionVariableSP(); + + ClangExpressionVariableSP pvar_sp (m_parser_vars->m_persistent_vars->GetVariable(name)); - DataBufferSP data_sp(heap_data_buf); + if (!pvar_sp) + return lldb::ClangExpressionVariableSP(); + + uint8_t *pvar_data = pvar_sp->GetValueBytes(); + if (pvar_data == NULL) + return lldb::ClangExpressionVariableSP(); uint64_t value64 = value.getLimitedValue(); ByteOrder byte_order = m_parser_vars->m_exe_ctx->process->GetByteOrder(); size_t num_val_bytes = sizeof(value64); - size_t num_data_bytes = heap_data_buf->GetByteSize(); + size_t num_data_bytes = pvar_sp->GetByteSize(); size_t num_bytes = num_val_bytes; if (num_bytes > num_data_bytes) num_bytes = num_data_bytes; - uint8_t *data_bytes = heap_data_buf->GetBytes(); - for (off_t byte_idx = 0; byte_idx < num_bytes; ++byte_idx) @@ -166,32 +172,23 @@ switch (byte_order) { - case eByteOrderBig: - // High Low - // Original: |AABBCCDDEEFFGGHH| - // Target: |EEFFGGHH| - - data_bytes[num_data_bytes - (1 + byte_idx)] = cur_byte; - break; - case eByteOrderLittle: - // Target: |HHGGFFEE| - data_bytes[byte_idx] = cur_byte; - break; - default: - return lldb::ClangExpressionVariableSP(); + case eByteOrderBig: + // High Low + // Original: |AABBCCDDEEFFGGHH| + // Target: |EEFFGGHH| + + pvar_data[num_data_bytes - (1 + byte_idx)] = cur_byte; + break; + case eByteOrderLittle: + // Target: |HHGGFFEE| + pvar_data[byte_idx] = cur_byte; + break; + default: + return lldb::ClangExpressionVariableSP(); } } - - ValueObjectSP valobj_sp(new ValueObjectConstResult(user_type.GetASTContext(), - user_type.GetOpaqueQualType(), - name, - data_sp, - m_parser_vars->m_exe_ctx->process->GetByteOrder(), - m_parser_vars->m_exe_ctx->process->GetAddressByteSize())); - - ClangExpressionVariableSP var_sp(new ClangExpressionVariable(valobj_sp)); - - return var_sp; + + return pvar_sp; } bool From wilsons at start.ca Tue Jan 4 14:54:08 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:08 -0500 Subject: [Lldb-commits] [PATCH 0/9] linux: process plugin updates Message-ID: <1294174457-8635-1-git-send-email-wilsons@start.ca> This patch series updates the ProcessLinux plugin so that it builds again under linux. The ProcessLinux plugin has always been incomplete. This patch series does not add any new functionality. A vital component which the Linux platform has always lacked is a DynamicLoader plugin. Previously we worked around this limitation by simply marking the sections of the executable we were debugging as loaded. This allowed LLDB to work with static executables. However, this was simply a hack and does not work with the current code base. This functionality is therefore removed in patch 4 of this series. The net result is that there is essentially zero functionality under Linux at this time. From wilsons at start.ca Tue Jan 4 14:54:09 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:09 -0500 Subject: [Lldb-commits] [PATCH 1/9] Replace old "CurrentThread" calls with equivalent "SelectedThread" calls. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-2-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/ProcessMonitor.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source/Plugins/Process/Linux/ProcessMonitor.cpp b/source/Plugins/Process/Linux/ProcessMonitor.cpp index 22b65e1..0b47fc7 100644 --- a/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -651,7 +651,7 @@ ProcessMonitor::Launch(LaunchArgs *args) // current. inferior.reset(new LinuxThread(process, pid)); process.GetThreadList().AddThread(inferior); - process.GetThreadList().SetCurrentThreadByID(pid); + process.GetThreadList().SetSelectedThreadByID(pid); // Let our process instance know the thread has stopped. process.SendMessage(ProcessMessage::Trace(pid)); -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:10 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:10 -0500 Subject: [Lldb-commits] [PATCH 2/9] Host::StopMonitoringChildProcess has been removed. Provide a substitute. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-3-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/ProcessMonitor.cpp | 19 ++++++++++++++++--- source/Plugins/Process/Linux/ProcessMonitor.h | 5 ++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/source/Plugins/Process/Linux/ProcessMonitor.cpp b/source/Plugins/Process/Linux/ProcessMonitor.cpp index 0b47fc7..e6a7d6f 100644 --- a/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -459,7 +459,7 @@ ProcessMonitor::ProcessMonitor(ProcessLinux *process, m_operation_thread(LLDB_INVALID_HOST_THREAD), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), - m_monitor_handle(0), + m_monitor_thread(LLDB_INVALID_HOST_THREAD), m_client_fd(-1), m_server_fd(-1) { @@ -499,7 +499,7 @@ WAIT_AGAIN: } // Finally, start monitoring the child process for change in state. - if (!(m_monitor_handle = Host::StartMonitoringChildProcess( + if (!(m_monitor_thread = Host::StartMonitoringChildProcess( ProcessMonitor::MonitorCallback, this, GetPID(), true))) { error.SetErrorToGenericError(); @@ -510,7 +510,7 @@ WAIT_AGAIN: ProcessMonitor::~ProcessMonitor() { - Host::StopMonitoringChildProcess(m_monitor_handle); + StopMonitoringChildProcess(); StopOperationThread(); close(m_terminal_fd); @@ -923,3 +923,16 @@ ProcessMonitor::DupDescriptor(const char *path, int fd, int flags) return (dup2(fd, target_fd) == -1) ? false : true; } + +void +ProcessMonitor::StopMonitoringChildProcess() +{ + lldb::thread_result_t thread_result; + + if (m_monitor_thread != LLDB_INVALID_HOST_THREAD) + { + Host::ThreadCancel(m_monitor_thread, NULL); + Host::ThreadJoin(m_monitor_thread, &thread_result, NULL); + m_monitor_thread = LLDB_INVALID_HOST_THREAD; + } +} diff --git a/source/Plugins/Process/Linux/ProcessMonitor.h b/source/Plugins/Process/Linux/ProcessMonitor.h index cd23d98..a4719c0 100644 --- a/source/Plugins/Process/Linux/ProcessMonitor.h +++ b/source/Plugins/Process/Linux/ProcessMonitor.h @@ -140,7 +140,7 @@ private: lldb::pid_t m_pid; int m_terminal_fd; - uint32_t m_monitor_handle; + uint32_t m_monitor_thread; lldb_private::Mutex m_server_mutex; int m_client_fd; @@ -203,6 +203,9 @@ private: void DoOperation(Operation *op); + + /// Stops the child monitor thread. + void StopMonitoringChildProcess(); }; #endif // #ifndef liblldb_ProcessMonitor_H_ -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:11 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:11 -0500 Subject: [Lldb-commits] [PATCH 3/9] Update ProcessLinux method signatures to be in line with LLDB's current API. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-4-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/ProcessLinux.cpp | 3 ++- source/Plugins/Process/Linux/ProcessLinux.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/Plugins/Process/Linux/ProcessLinux.cpp b/source/Plugins/Process/Linux/ProcessLinux.cpp index ce12ee9..6d7b5cf 100644 --- a/source/Plugins/Process/Linux/ProcessLinux.cpp +++ b/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -105,6 +105,7 @@ Error ProcessLinux::DoLaunch(Module *module, char const *argv[], char const *envp[], + uint32_t launch_flags, const char *stdin_path, const char *stdout_path, const char *stderr_path) @@ -155,7 +156,7 @@ ProcessLinux::DoResume() } Error -ProcessLinux::DoHalt() +ProcessLinux::DoHalt(bool &caused_stop) { return Error(1, eErrorTypeGeneric); } diff --git a/source/Plugins/Process/Linux/ProcessLinux.h b/source/Plugins/Process/Linux/ProcessLinux.h index 522cc4b..536dd9b 100644 --- a/source/Plugins/Process/Linux/ProcessLinux.h +++ b/source/Plugins/Process/Linux/ProcessLinux.h @@ -66,6 +66,7 @@ public: DoLaunch(lldb_private::Module *module, char const *argv[], char const *envp[], + uint32_t launch_flags, const char *stdin_path, const char *stdout_path, const char *stderr_path); @@ -77,7 +78,7 @@ public: DoResume(); virtual lldb_private::Error - DoHalt(); + DoHalt(bool &caused_stop); virtual lldb_private::Error DoDetach(); -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:12 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:12 -0500 Subject: [Lldb-commits] [PATCH 4/9] Do not load sections manually when launching a Linux process. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-5-git-send-email-wilsons@start.ca> This code was a temporary workaround due to the lack of a dynamic loader plugin for the Linux platform that has bit rotted over time. Instead of replacing this hack with another a proper plugin will be developed instead. --- source/Plugins/Process/Linux/ProcessLinux.cpp | 27 ------------------------- source/Plugins/Process/Linux/ProcessLinux.h | 3 -- 2 files changed, 0 insertions(+), 30 deletions(-) diff --git a/source/Plugins/Process/Linux/ProcessLinux.cpp b/source/Plugins/Process/Linux/ProcessLinux.cpp index 6d7b5cf..acaff50 100644 --- a/source/Plugins/Process/Linux/ProcessLinux.cpp +++ b/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -127,12 +127,6 @@ ProcessLinux::DoLaunch(Module *module, return error; } -void -ProcessLinux::DidLaunch() -{ - UpdateLoadedSections(); -} - Error ProcessLinux::DoResume() { @@ -404,27 +398,6 @@ ProcessLinux::EnablePluginLogging(Stream *strm, Args &command) //------------------------------------------------------------------------------ // Utility functions. -void -ProcessLinux::UpdateLoadedSections() -{ - ObjectFile *obj_file = m_module->GetObjectFile(); - SectionList *sections = obj_file->GetSectionList(); - - // FIXME: SectionList provides iterator types, but no begin/end methods. - size_t num_sections = sections->GetSize(); - for (unsigned i = 0; i < num_sections; ++i) - { - Section *section = sections->GetSectionAtIndex(i).get(); - - lldb::addr_t new_load_addr = section->GetFileAddress(); - lldb::addr_t old_load_addr = GetSectionLoadAddress(section); - - if (old_load_addr == LLDB_INVALID_ADDRESS || - old_load_addr != new_load_addr) - SectionLoaded(section, new_load_addr); - } -} - bool ProcessLinux::HasExited() { diff --git a/source/Plugins/Process/Linux/ProcessLinux.h b/source/Plugins/Process/Linux/ProcessLinux.h index 536dd9b..16c2bec 100644 --- a/source/Plugins/Process/Linux/ProcessLinux.h +++ b/source/Plugins/Process/Linux/ProcessLinux.h @@ -71,9 +71,6 @@ public: const char *stdout_path, const char *stderr_path); - virtual void - DidLaunch(); - virtual lldb_private::Error DoResume(); -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:13 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:13 -0500 Subject: [Lldb-commits] [PATCH 5/9] Use default implementation of Thread::GetStackFrameCount and Thread::GetStackFrameAtIndex. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-6-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/LinuxThread.cpp | 21 +-------------------- source/Plugins/Process/Linux/LinuxThread.h | 6 ------ 2 files changed, 1 insertions(+), 26 deletions(-) diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp index 6d4733a..4994d64 100644 --- a/source/Plugins/Process/Linux/LinuxThread.cpp +++ b/source/Plugins/Process/Linux/LinuxThread.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes #include "lldb/Target/Process.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "LinuxThread.h" @@ -60,26 +61,6 @@ LinuxThread::GetInfo() return NULL; } -uint32_t -LinuxThread::GetStackFrameCount() -{ - return 0; -} - -lldb::StackFrameSP -LinuxThread::GetStackFrameAtIndex(uint32_t idx) -{ - if (idx == 0) - { - RegisterContextLinux *regs = GetRegisterContext(); - StackFrame *frame = new StackFrame( - idx, *this, regs->GetFP(), regs->GetPC()); - return lldb::StackFrameSP(frame); - } - else - return lldb::StackFrameSP(); -} - RegisterContextLinux * LinuxThread::GetRegisterContext() { diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h index 79ccd0a..5ec0d43 100644 --- a/source/Plugins/Process/Linux/LinuxThread.h +++ b/source/Plugins/Process/Linux/LinuxThread.h @@ -38,12 +38,6 @@ public: const char * GetInfo(); - uint32_t - GetStackFrameCount(); - - lldb::StackFrameSP - GetStackFrameAtIndex(uint32_t idx); - RegisterContextLinux * GetRegisterContext(); -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:14 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:14 -0500 Subject: [Lldb-commits] [PATCH 6/9] StopInfo now lives in the lldb_private namespace. Qualify. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-7-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/LinuxThread.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h index 5ec0d43..8ef3125 100644 --- a/source/Plugins/Process/Linux/LinuxThread.h +++ b/source/Plugins/Process/Linux/LinuxThread.h @@ -51,7 +51,7 @@ public: CreateRegisterContextForFrame(lldb_private::StackFrame *frame); bool - GetRawStopReason(StopInfo *stop_info); + GetRawStopReason(lldb_private::StopInfo *stop_info); //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:15 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:15 -0500 Subject: [Lldb-commits] [PATCH 7/9] Remove LinuxThread::GetRawStopReason and implement Thread::GetPrivateStopReason. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-8-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/LinuxThread.cpp | 15 ++++++++------- source/Plugins/Process/Linux/LinuxThread.h | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp index 4994d64..b5d3b64 100644 --- a/source/Plugins/Process/Linux/LinuxThread.cpp +++ b/source/Plugins/Process/Linux/LinuxThread.cpp @@ -85,26 +85,27 @@ LinuxThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) return new RegisterContextLinux_x86_64(*this, frame); } -bool -LinuxThread::GetRawStopReason(StopInfo *stop_info) +lldb::StopInfoSP +LinuxThread::GetPrivateStopReason() { - stop_info->Clear(); + lldb::StopInfoSP stop_info; switch (m_note) { default: - stop_info->SetStopReasonToNone(); break; case eBreak: - stop_info->SetStopReasonWithBreakpointSiteID(m_breakpoint->GetID()); + stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID( + *this, m_breakpoint->GetID()); break; case eTrace: - stop_info->SetStopReasonToTrace(); + stop_info = StopInfo::CreateStopReasonToTrace(*this); + break; } - return true; + return stop_info; } bool diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h index 8ef3125..afa1548 100644 --- a/source/Plugins/Process/Linux/LinuxThread.h +++ b/source/Plugins/Process/Linux/LinuxThread.h @@ -50,9 +50,6 @@ public: RegisterContextLinux * CreateRegisterContextForFrame(lldb_private::StackFrame *frame); - bool - GetRawStopReason(lldb_private::StopInfo *stop_info); - //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. // @@ -78,6 +75,9 @@ private: Notification m_note; ProcessMonitor &GetMonitor(); + + lldb::StopInfoSP + GetPrivateStopReason(); }; #endif // #ifndef liblldb_LinuxThread_H_ -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:16 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:16 -0500 Subject: [Lldb-commits] [PATCH 8/9] Provide LinuxThread with an implementation of Thread::GetUnwinder. In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-9-git-send-email-wilsons@start.ca> --- source/Plugins/Process/Linux/LinuxThread.cpp | 6 ++++++ source/Plugins/Process/Linux/LinuxThread.h | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp index b5d3b64..c4c8bf5 100644 --- a/source/Plugins/Process/Linux/LinuxThread.cpp +++ b/source/Plugins/Process/Linux/LinuxThread.cpp @@ -108,6 +108,12 @@ LinuxThread::GetPrivateStopReason() return stop_info; } +Unwind * +LinuxThread::GetUnwinder() +{ + return m_unwinder_ap.get(); +} + bool LinuxThread::WillResume(lldb::StateType resume_state) { diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h index afa1548..0e7f89d 100644 --- a/source/Plugins/Process/Linux/LinuxThread.h +++ b/source/Plugins/Process/Linux/LinuxThread.h @@ -78,6 +78,9 @@ private: lldb::StopInfoSP GetPrivateStopReason(); + + lldb_private::Unwind * + GetUnwinder(); }; #endif // #ifndef liblldb_LinuxThread_H_ -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:54:17 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:54:17 -0500 Subject: [Lldb-commits] [PATCH 9/9] Fix typo (presumably carried over from the MacOSX plugin). In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: <1294174457-8635-10-git-send-email-wilsons@start.ca> --- .../Process/Linux/RegisterContextLinux_x86_64.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp index 8994e77..4c78a25 100644 --- a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp +++ b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp @@ -644,7 +644,7 @@ RegisterContextLinux_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind, } else if (kind == eRegisterKindLLDB) { - return reg; + return num; } return LLDB_INVALID_REGNUM; -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:55:32 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:55:32 -0500 Subject: [Lldb-commits] [PATCH 0/2] linux: makefile system updates Message-ID: <1294174534-8666-1-git-send-email-wilsons@start.ca> This series updates the Makefile based build system. In particular, it adds the Process/Utility component to the Linux build, adds some missing/renamed Clang/LLVM components, and quites warnings generated by GCC when encountering unknown pragmas (in particular the #pragma mark construct). From wilsons at start.ca Tue Jan 4 14:55:33 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:55:33 -0500 Subject: [Lldb-commits] [PATCH 1/2] Ignore unknown pragmas. In-Reply-To: <1294174534-8666-1-git-send-email-wilsons@start.ca> References: <1294174534-8666-1-git-send-email-wilsons@start.ca> Message-ID: <1294174534-8666-2-git-send-email-wilsons@start.ca> In particular, we are looking to ignore the "#pragma mark" construct which GCC warns about on platforms other than Darwin. This cleans up diagnostic output significantly. --- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index 70c4801..abe694b 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,10 @@ endif # We can revisit this when LLVM/Clang support it. CXX.Flags += -fno-strict-aliasing +# Do not warn about pragmas. In particular, we are looking to ignore the +# "#pragma mark" construct which GCC warns about on platforms other than Darwin. +EXTRA_OPTIONS += -Wno-unknown-pragmas + ### # LLDB Top Level specific stuff. -- 1.7.3.2 From wilsons at start.ca Tue Jan 4 14:55:34 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 4 Jan 2011 15:55:34 -0500 Subject: [Lldb-commits] [PATCH 2/2] Makefile updates. In-Reply-To: <1294174534-8666-1-git-send-email-wilsons@start.ca> References: <1294174534-8666-1-git-send-email-wilsons@start.ca> Message-ID: <1294174534-8666-3-git-send-email-wilsons@start.ca> Update lib/Makefile to use current LLVM and Clang components and add the PluginUtility library to the build. --- lib/Makefile | 8 +++----- source/Plugins/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 454e89b..881b23c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -33,11 +33,10 @@ USEDLIBS = lldbAPI.a \ lldbPluginObjectFileELF.a \ lldbPluginSymbolFileDWARF.a \ lldbPluginSymbolFileSymtab.a \ + lldbPluginUtility.a \ lldbSymbol.a \ lldbTarget.a \ lldbUtility.a \ - plugin_llvmc_Base.a \ - plugin_llvmc_Clang.a \ clangAnalysis.a \ clangAST.a \ clangBasic.a \ @@ -49,14 +48,14 @@ USEDLIBS = lldbAPI.a \ clangRewrite.a \ clangParse.a \ clangSema.a \ - CompilerDriver.a \ + clangSerialization.a \ EnhancedDisassembly.a \ clangChecker.a include $(LLDB_LEVEL)/../../Makefile.config LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \ - ipo selectiondag jit + ipo selectiondag jit mc ifeq ($(HOST_OS),Darwin) USEDLIBS += lldbHostMacOSX.a \ @@ -64,7 +63,6 @@ ifeq ($(HOST_OS),Darwin) lldbPluginObjectContainerUniversalMachO.a \ lldbPluginObjectFileMachO.a \ lldbPluginProcessGDBRemote.a \ - lldbPluginUtility.a \ lldbPluginSymbolVendorMacOSX.a endif diff --git a/source/Plugins/Makefile b/source/Plugins/Makefile index 28c7c1e..14eed8a 100644 --- a/source/Plugins/Makefile +++ b/source/Plugins/Makefile @@ -14,11 +14,11 @@ include $(LLDB_LEVEL)/../../Makefile.config DIRS := ABI/MacOSX-i386 ABI/SysV-x86_64 Disassembler/llvm \ ObjectContainer/BSD-Archive ObjectFile/ELF SymbolFile/DWARF \ - SymbolFile/Symtab + SymbolFile/Symtab Process/Utility ifeq ($(HOST_OS),Darwin) DIRS += DynamicLoader/MacOSX-DYLD ObjectContainer/Universal-Mach-O \ - ObjectFile/Mach-O Process/gdb-remote Process/Utility \ + ObjectFile/Mach-O Process/gdb-remote \ SymbolVendor/MacOSX Process/MacOSX-User endif -- 1.7.3.2 From gclayton at apple.com Tue Jan 4 15:28:37 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 4 Jan 2011 13:28:37 -0800 Subject: [Lldb-commits] [PATCH 0/9] linux: process plugin updates In-Reply-To: <1294174457-8635-1-git-send-email-wilsons@start.ca> References: <1294174457-8635-1-git-send-email-wilsons@start.ca> Message-ID: These look fine, feel free to commit them when you can. Greg Clayton On Jan 4, 2011, at 12:54 PM, Stephen Wilson wrote: > This patch series updates the ProcessLinux plugin so that it builds again under > linux. > > The ProcessLinux plugin has always been incomplete. This patch series does not > add any new functionality. > > A vital component which the Linux platform has always lacked is a DynamicLoader > plugin. Previously we worked around this limitation by simply marking the > sections of the executable we were debugging as loaded. This allowed LLDB to > work with static executables. However, this was simply a hack and does not work > with the current code base. This functionality is therefore removed in patch 4 > of this series. > > The net result is that there is essentially zero functionality under Linux at > this time. > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From wilsons at start.ca Tue Jan 4 15:39:27 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:39:27 -0000 Subject: [Lldb-commits] [lldb] r122834 - /lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Message-ID: <20110104213927.3F8AB2A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:39:27 2011 New Revision: 122834 URL: http://llvm.org/viewvc/llvm-project?rev=122834&view=rev Log: Replace old "CurrentThread" calls with equivalent "SelectedThread" calls. Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=122834&r1=122833&r2=122834&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue Jan 4 15:39:27 2011 @@ -651,7 +651,7 @@ // current. inferior.reset(new LinuxThread(process, pid)); process.GetThreadList().AddThread(inferior); - process.GetThreadList().SetCurrentThreadByID(pid); + process.GetThreadList().SetSelectedThreadByID(pid); // Let our process instance know the thread has stopped. process.SendMessage(ProcessMessage::Trace(pid)); From wilsons at start.ca Tue Jan 4 15:40:25 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:40:25 -0000 Subject: [Lldb-commits] [lldb] r122835 - in /lldb/trunk/source/Plugins/Process/Linux: ProcessMonitor.cpp ProcessMonitor.h Message-ID: <20110104214025.809B12A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:40:25 2011 New Revision: 122835 URL: http://llvm.org/viewvc/llvm-project?rev=122835&view=rev Log: Host::StopMonitoringChildProcess has been removed. Provide a substitute. Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=122835&r1=122834&r2=122835&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Tue Jan 4 15:40:25 2011 @@ -459,7 +459,7 @@ m_operation_thread(LLDB_INVALID_HOST_THREAD), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), - m_monitor_handle(0), + m_monitor_thread(LLDB_INVALID_HOST_THREAD), m_client_fd(-1), m_server_fd(-1) { @@ -499,7 +499,7 @@ } // Finally, start monitoring the child process for change in state. - if (!(m_monitor_handle = Host::StartMonitoringChildProcess( + if (!(m_monitor_thread = Host::StartMonitoringChildProcess( ProcessMonitor::MonitorCallback, this, GetPID(), true))) { error.SetErrorToGenericError(); @@ -510,7 +510,7 @@ ProcessMonitor::~ProcessMonitor() { - Host::StopMonitoringChildProcess(m_monitor_handle); + StopMonitoringChildProcess(); StopOperationThread(); close(m_terminal_fd); @@ -923,3 +923,16 @@ return (dup2(fd, target_fd) == -1) ? false : true; } + +void +ProcessMonitor::StopMonitoringChildProcess() +{ + lldb::thread_result_t thread_result; + + if (m_monitor_thread != LLDB_INVALID_HOST_THREAD) + { + Host::ThreadCancel(m_monitor_thread, NULL); + Host::ThreadJoin(m_monitor_thread, &thread_result, NULL); + m_monitor_thread = LLDB_INVALID_HOST_THREAD; + } +} Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h?rev=122835&r1=122834&r2=122835&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h Tue Jan 4 15:40:25 2011 @@ -140,7 +140,7 @@ lldb::pid_t m_pid; int m_terminal_fd; - uint32_t m_monitor_handle; + uint32_t m_monitor_thread; lldb_private::Mutex m_server_mutex; int m_client_fd; @@ -203,6 +203,9 @@ void DoOperation(Operation *op); + + /// Stops the child monitor thread. + void StopMonitoringChildProcess(); }; #endif // #ifndef liblldb_ProcessMonitor_H_ From wilsons at start.ca Tue Jan 4 15:41:32 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:41:32 -0000 Subject: [Lldb-commits] [lldb] r122836 - in /lldb/trunk/source/Plugins/Process/Linux: ProcessLinux.cpp ProcessLinux.h Message-ID: <20110104214132.259CB2A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:41:31 2011 New Revision: 122836 URL: http://llvm.org/viewvc/llvm-project?rev=122836&view=rev Log: Update ProcessLinux method signatures to be in line with LLDB's current API. Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=122836&r1=122835&r2=122836&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Tue Jan 4 15:41:31 2011 @@ -105,6 +105,7 @@ ProcessLinux::DoLaunch(Module *module, char const *argv[], char const *envp[], + uint32_t launch_flags, const char *stdin_path, const char *stdout_path, const char *stderr_path) @@ -155,7 +156,7 @@ } Error -ProcessLinux::DoHalt() +ProcessLinux::DoHalt(bool &caused_stop) { return Error(1, eErrorTypeGeneric); } Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h?rev=122836&r1=122835&r2=122836&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Tue Jan 4 15:41:31 2011 @@ -66,6 +66,7 @@ DoLaunch(lldb_private::Module *module, char const *argv[], char const *envp[], + uint32_t launch_flags, const char *stdin_path, const char *stdout_path, const char *stderr_path); @@ -77,7 +78,7 @@ DoResume(); virtual lldb_private::Error - DoHalt(); + DoHalt(bool &caused_stop); virtual lldb_private::Error DoDetach(); From wilsons at start.ca Tue Jan 4 15:42:31 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:42:31 -0000 Subject: [Lldb-commits] [lldb] r122837 - in /lldb/trunk/source/Plugins/Process/Linux: ProcessLinux.cpp ProcessLinux.h Message-ID: <20110104214232.0004B2A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:42:31 2011 New Revision: 122837 URL: http://llvm.org/viewvc/llvm-project?rev=122837&view=rev Log: Do not load sections manually when launching a Linux process. This code was a temporary workaround due to the lack of a dynamic loader plugin for the Linux platform that has bit rotted over time. Instead of replacing this hack with another a proper plugin will be developed instead. Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=122837&r1=122836&r2=122837&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Tue Jan 4 15:42:31 2011 @@ -127,12 +127,6 @@ return error; } -void -ProcessLinux::DidLaunch() -{ - UpdateLoadedSections(); -} - Error ProcessLinux::DoResume() { @@ -404,27 +398,6 @@ //------------------------------------------------------------------------------ // Utility functions. -void -ProcessLinux::UpdateLoadedSections() -{ - ObjectFile *obj_file = m_module->GetObjectFile(); - SectionList *sections = obj_file->GetSectionList(); - - // FIXME: SectionList provides iterator types, but no begin/end methods. - size_t num_sections = sections->GetSize(); - for (unsigned i = 0; i < num_sections; ++i) - { - Section *section = sections->GetSectionAtIndex(i).get(); - - lldb::addr_t new_load_addr = section->GetFileAddress(); - lldb::addr_t old_load_addr = GetSectionLoadAddress(section); - - if (old_load_addr == LLDB_INVALID_ADDRESS || - old_load_addr != new_load_addr) - SectionLoaded(section, new_load_addr); - } -} - bool ProcessLinux::HasExited() { Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h?rev=122837&r1=122836&r2=122837&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Tue Jan 4 15:42:31 2011 @@ -71,9 +71,6 @@ const char *stdout_path, const char *stderr_path); - virtual void - DidLaunch(); - virtual lldb_private::Error DoResume(); From wilsons at start.ca Tue Jan 4 15:43:20 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:43:20 -0000 Subject: [Lldb-commits] [lldb] r122838 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h Message-ID: <20110104214320.1F6512A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:43:19 2011 New Revision: 122838 URL: http://llvm.org/viewvc/llvm-project?rev=122838&view=rev Log: Use default implementation of Thread::GetStackFrameCount and Thread::GetStackFrameAtIndex. Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=122838&r1=122837&r2=122838&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Tue Jan 4 15:43:19 2011 @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes #include "lldb/Target/Process.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "LinuxThread.h" @@ -60,26 +61,6 @@ return NULL; } -uint32_t -LinuxThread::GetStackFrameCount() -{ - return 0; -} - -lldb::StackFrameSP -LinuxThread::GetStackFrameAtIndex(uint32_t idx) -{ - if (idx == 0) - { - RegisterContextLinux *regs = GetRegisterContext(); - StackFrame *frame = new StackFrame( - idx, *this, regs->GetFP(), regs->GetPC()); - return lldb::StackFrameSP(frame); - } - else - return lldb::StackFrameSP(); -} - RegisterContextLinux * LinuxThread::GetRegisterContext() { Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122838&r1=122837&r2=122838&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Tue Jan 4 15:43:19 2011 @@ -38,12 +38,6 @@ const char * GetInfo(); - uint32_t - GetStackFrameCount(); - - lldb::StackFrameSP - GetStackFrameAtIndex(uint32_t idx); - RegisterContextLinux * GetRegisterContext(); From wilsons at start.ca Tue Jan 4 15:44:13 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:44:13 -0000 Subject: [Lldb-commits] [lldb] r122839 - /lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Message-ID: <20110104214413.D3C6D2A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:44:13 2011 New Revision: 122839 URL: http://llvm.org/viewvc/llvm-project?rev=122839&view=rev Log: StopInfo now lives in the lldb_private namespace. Qualify. Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122839&r1=122838&r2=122839&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Tue Jan 4 15:44:13 2011 @@ -51,7 +51,7 @@ CreateRegisterContextForFrame(lldb_private::StackFrame *frame); bool - GetRawStopReason(StopInfo *stop_info); + GetRawStopReason(lldb_private::StopInfo *stop_info); //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. From wilsons at start.ca Tue Jan 4 15:45:02 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:45:02 -0000 Subject: [Lldb-commits] [lldb] r122840 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h Message-ID: <20110104214502.A97A62A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:45:02 2011 New Revision: 122840 URL: http://llvm.org/viewvc/llvm-project?rev=122840&view=rev Log: Remove LinuxThread::GetRawStopReason and implement Thread::GetPrivateStopReason. Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=122840&r1=122839&r2=122840&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Tue Jan 4 15:45:02 2011 @@ -85,26 +85,27 @@ return new RegisterContextLinux_x86_64(*this, frame); } -bool -LinuxThread::GetRawStopReason(StopInfo *stop_info) +lldb::StopInfoSP +LinuxThread::GetPrivateStopReason() { - stop_info->Clear(); + lldb::StopInfoSP stop_info; switch (m_note) { default: - stop_info->SetStopReasonToNone(); break; case eBreak: - stop_info->SetStopReasonWithBreakpointSiteID(m_breakpoint->GetID()); + stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID( + *this, m_breakpoint->GetID()); break; case eTrace: - stop_info->SetStopReasonToTrace(); + stop_info = StopInfo::CreateStopReasonToTrace(*this); + break; } - return true; + return stop_info; } bool Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122840&r1=122839&r2=122840&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Tue Jan 4 15:45:02 2011 @@ -50,9 +50,6 @@ RegisterContextLinux * CreateRegisterContextForFrame(lldb_private::StackFrame *frame); - bool - GetRawStopReason(lldb_private::StopInfo *stop_info); - //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. // @@ -78,6 +75,9 @@ Notification m_note; ProcessMonitor &GetMonitor(); + + lldb::StopInfoSP + GetPrivateStopReason(); }; #endif // #ifndef liblldb_LinuxThread_H_ From wilsons at start.ca Tue Jan 4 15:45:57 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:45:57 -0000 Subject: [Lldb-commits] [lldb] r122841 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h Message-ID: <20110104214557.A8EC22A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:45:57 2011 New Revision: 122841 URL: http://llvm.org/viewvc/llvm-project?rev=122841&view=rev Log: Provide LinuxThread with an implementation of Thread::GetUnwinder. Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=122841&r1=122840&r2=122841&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Tue Jan 4 15:45:57 2011 @@ -108,6 +108,12 @@ return stop_info; } +Unwind * +LinuxThread::GetUnwinder() +{ + return m_unwinder_ap.get(); +} + bool LinuxThread::WillResume(lldb::StateType resume_state) { Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122841&r1=122840&r2=122841&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Tue Jan 4 15:45:57 2011 @@ -78,6 +78,9 @@ lldb::StopInfoSP GetPrivateStopReason(); + + lldb_private::Unwind * + GetUnwinder(); }; #endif // #ifndef liblldb_LinuxThread_H_ From wilsons at start.ca Tue Jan 4 15:46:35 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 04 Jan 2011 21:46:35 -0000 Subject: [Lldb-commits] [lldb] r122842 - /lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Message-ID: <20110104214635.7E4EE2A6C12C@llvm.org> Author: wilsons Date: Tue Jan 4 15:46:35 2011 New Revision: 122842 URL: http://llvm.org/viewvc/llvm-project?rev=122842&view=rev Log: Fix typo (presumably carried over from the MacOSX plugin). Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=122842&r1=122841&r2=122842&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Tue Jan 4 15:46:35 2011 @@ -644,7 +644,7 @@ } else if (kind == eRegisterKindLLDB) { - return reg; + return num; } return LLDB_INVALID_REGNUM; From gclayton at apple.com Wed Jan 5 12:43:15 2011 From: gclayton at apple.com (Greg Clayton) Date: Wed, 05 Jan 2011 18:43:15 -0000 Subject: [Lldb-commits] [lldb] r122895 - in /lldb/trunk: include/lldb/API/SBValue.h include/lldb/Core/ValueObject.h include/lldb/lldb-enumerations.h source/API/SBValue.cpp source/Core/DataExtractor.cpp source/Symbol/ClangASTType.cpp Message-ID: <20110105184316.0F0FF2A6C12C@llvm.org> Author: gclayton Date: Wed Jan 5 12:43:15 2011 New Revision: 122895 URL: http://llvm.org/viewvc/llvm-project?rev=122895&view=rev Log: Added the ability to get an set the desired format for SBValue objects. Fixed the display of complex numbers in lldb_private::DataExtractor::Dump(...) and also fixed other edge display cases in lldb_private::ClangASTType::DumpTypeValue(...). Modified: lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Symbol/ClangASTType.cpp Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Wed Jan 5 12:43:15 2011 @@ -48,6 +48,12 @@ bool IsInScope (const lldb::SBFrame &frame); + lldb::Format + GetFormat () const; + + void + SetFormat (lldb::Format format); + const char * GetValue (const lldb::SBFrame &frame); Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Jan 5 12:43:15 2011 @@ -260,6 +260,8 @@ void SetFormat (lldb::Format format) { + if (format != m_format) + m_value_str.clear(); m_format = format; } Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Jan 5 12:43:15 2011 @@ -155,6 +155,7 @@ eFormatHex, eFormatFloat, eFormatOctal, + eFormatOSType, // OS character codes encoded into an integer 'PICT' 'text' etc... eFormatUnicode16, eFormatUnicode32, eFormatUnsigned, Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Wed Jan 5 12:43:15 2011 @@ -489,3 +489,19 @@ return true; } + +lldb::Format +SBValue::GetFormat () const +{ + if (m_opaque_sp) + return m_opaque_sp->GetFormat(); + return eFormatDefault; +} + +void +SBValue::SetFormat (lldb::Format format) +{ + if (m_opaque_sp) + m_opaque_sp->SetFormat(format); +} + Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Wed Jan 5 12:43:15 2011 @@ -1210,6 +1210,9 @@ if (item_byte_size != 4 && item_byte_size != 8) item_byte_size = s->GetAddressByteSize(); } + + if (item_format == eFormatOSType && item_byte_size > 8) + item_format = eFormatHex; for (offset = start_offset, line_start_offset = start_offset, count = 0; ValidOffset(offset) && count < item_count; ++count) { @@ -1280,7 +1283,7 @@ if (item_count == 1 && item_format == eFormatChar) s->PutChar('\''); - uint8_t ch = GetU8(&offset); + uint32_t ch = GetMaxU64(&offset, item_byte_size); if (isprint(ch)) s->Printf ("%c", ch); else if (item_format == eFormatChar) @@ -1296,7 +1299,12 @@ case '\t': s->Printf ("\\t", ch); break; case '\v': s->Printf ("\\v", ch); break; case '\0': s->Printf ("\\0", ch); break; - default: s->Printf ("\\x%2.2x", ch); break; + default: + if (item_byte_size == 1) + s->Printf ("\\x%2.2x", ch); + else + s->Printf ("\\u%x", ch); + break; } } else @@ -1310,29 +1318,6 @@ } break; - case eFormatComplex: - if (sizeof(float) * 2 == item_byte_size) - { - uint32_t a32 = GetU32(&offset); - uint32_t b32 = GetU32(&offset); - - s->Printf ("%g + %gi", a32, b32); - } - else if (sizeof(double) * 2 == item_byte_size) - { - uint64_t a64 = GetU64(&offset); - uint64_t b64 = GetU64(&offset); - - s->Printf ("%lg + %lgi", a64, b64); - } - else if (sizeof(long double) * 2 == item_byte_size && sizeof(long double) <= sizeof(uint64_t)) - { - uint64_t a64 = GetU64(&offset); - uint64_t b64 = GetU64(&offset); - s->Printf ("%Lg + %Lgi", a64, b64); - } - break; - case eFormatDecimal: if (item_byte_size <= 8) s->Printf ("%lld", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); @@ -1348,6 +1333,40 @@ s->Printf ("0%llo", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); break; + case eFormatOSType: + { + uint64_t uval64 = GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset); + s->PutChar('\''); + for (i=0; i 0) + ch = (uint8_t)(uval64 >> ((item_byte_size - i - 1) * 8)); + else + ch = (uint8_t)uval64; + if (isprint(ch)) + s->Printf ("%c", ch); + else + { + switch (ch) + { + case '\e': s->Printf ("\\e", (uint8_t)ch); break; + case '\a': s->Printf ("\\a", ch); break; + case '\b': s->Printf ("\\b", ch); break; + case '\f': s->Printf ("\\f", ch); break; + case '\n': s->Printf ("\\n", ch); break; + case '\r': s->Printf ("\\r", ch); break; + case '\t': s->Printf ("\\t", ch); break; + case '\v': s->Printf ("\\v", ch); break; + case '\0': s->Printf ("\\0", ch); break; + default: s->Printf ("\\x%2.2x", ch); break; + } + } + } + s->PutChar('\''); + } + break; + case eFormatEnum: // Print enum value as a signed integer when we don't get the enum type s->Printf ("%lld", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); @@ -1371,6 +1390,34 @@ s->Address(GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset), sizeof (addr_t)); break; + case eFormatComplex: + if (sizeof(float) * 2 == item_byte_size) + { + float f32_1 = GetFloat (&offset); + float f32_2 = GetFloat (&offset); + + s->Printf ("%g + %gi", f32_1, f32_2); + break; + } + else if (sizeof(double) * 2 == item_byte_size) + { + double d64_1 = GetDouble (&offset); + double d64_2 = GetDouble (&offset); + + s->Printf ("%lg + %lgi", d64_1, d64_2); + break; + } + else if (sizeof(long double) * 2 == item_byte_size) + { + long double ld64_1 = GetLongDouble (&offset); + long double ld64_2 = GetLongDouble (&offset); + s->Printf ("%Lg + %Lgi", ld64_1, ld64_2); + break; + } + + // Fall through to hex for any other sizes + item_format = eFormatHex; + default: case eFormatDefault: case eFormatHex: Modified: lldb/trunk/source/Symbol/ClangASTType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=122895&r1=122894&r2=122895&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTType.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTType.cpp Wed Jan 5 12:43:15 2011 @@ -646,9 +646,33 @@ else { const clang::Type::TypeClass type_class = qual_type->getTypeClass(); + switch (type_class) { + case clang::Type::Typedef: + { + clang::QualType typedef_qual_type = cast(qual_type)->getDecl()->getUnderlyingType(); + if (format == eFormatDefault) + format = ClangASTType::GetFormat(typedef_qual_type.getAsOpaquePtr()); + std::pair typedef_type_info = ast_context->getTypeInfo(typedef_qual_type); + uint64_t typedef_byte_size = typedef_type_info.first / 8; + + return ClangASTType::DumpTypeValue (ast_context, // The clang AST context for this type + typedef_qual_type.getAsOpaquePtr(), // The clang type we want to dump + s, + format, // The format with which to display the element + data, // Data buffer containing all bytes for this type + byte_offset, // Offset into "data" where to grab value from + typedef_byte_size, // Size of this type in bytes + bitfield_bit_size, // Size in bits of a bitfield value, if zero don't treat as a bitfield + bitfield_bit_offset); // Offset in bits of a bitfield value if bitfield_bit_size != 0 + } + break; + case clang::Type::Enum: + // If our format is enum or default, show the enumeration value as + // its enumeration string value, else just display it as requested. + if (format == eFormatEnum || format == eFormatDefault) { const clang::EnumType *enum_type = cast(qual_type.getTypePtr()); const clang::EnumDecl *enum_decl = enum_type->getDecl(); @@ -666,43 +690,75 @@ } // If we have gotten here we didn't get find the enumerator in the // enum decl, so just print the integer. - + s->Printf("%lli", enum_value); return true; } - break; - - case clang::Type::Typedef: - { - clang::QualType typedef_qual_type = cast(qual_type)->getDecl()->getUnderlyingType(); - lldb::Format typedef_format = ClangASTType::GetFormat(typedef_qual_type.getAsOpaquePtr()); - std::pair typedef_type_info = ast_context->getTypeInfo(typedef_qual_type); - uint64_t typedef_byte_size = typedef_type_info.first / 8; - - return ClangASTType::DumpTypeValue( - ast_context, // The clang AST context for this type - typedef_qual_type.getAsOpaquePtr(), // The clang type we want to dump - s, - typedef_format, // The format with which to display the element - data, // Data buffer containing all bytes for this type - byte_offset, // Offset into "data" where to grab value from - typedef_byte_size, // Size of this type in bytes - bitfield_bit_size, // Size in bits of a bitfield value, if zero don't treat as a bitfield - bitfield_bit_offset); // Offset in bits of a bitfield value if bitfield_bit_size != 0 - } - break; - + // format was not enum, just fall through and dump the value as requested.... + default: // We are down the a scalar type that we just need to display. - return data.Dump(s, - byte_offset, - format, - byte_size, - 1, - UINT32_MAX, - LLDB_INVALID_ADDRESS, - bitfield_bit_size, - bitfield_bit_offset); + { + uint32_t item_count = 1; + // A few formats, we might need to modify our size and count for depending + // on how we are trying to display the value... + switch (format) + { + default: + case eFormatBoolean: + case eFormatBinary: + case eFormatComplex: + case eFormatCString: // NULL terminated C strings + case eFormatDecimal: + case eFormatEnum: + case eFormatHex: + case eFormatFloat: + case eFormatOctal: + case eFormatOSType: + case eFormatUnsigned: + case eFormatPointer: + case eFormatVectorOfChar: + case eFormatVectorOfSInt8: + case eFormatVectorOfUInt8: + case eFormatVectorOfSInt16: + case eFormatVectorOfUInt16: + case eFormatVectorOfSInt32: + case eFormatVectorOfUInt32: + case eFormatVectorOfSInt64: + case eFormatVectorOfUInt64: + case eFormatVectorOfFloat32: + case eFormatVectorOfFloat64: + case eFormatVectorOfUInt128: + break; + + case eFormatChar: + case eFormatCharPrintable: + case eFormatBytes: + case eFormatBytesWithASCII: + item_count = (byte_size * item_count); + byte_size = 1; + break; + + case eFormatUnicode16: + item_count = (byte_size * item_count) / 2; + byte_size = 2; + break; + + case eFormatUnicode32: + item_count = (byte_size * item_count) / 4; + byte_size = 4; + break; + } + return data.Dump (s, + byte_offset, + format, + byte_size, + item_count, + UINT32_MAX, + LLDB_INVALID_ADDRESS, + bitfield_bit_size, + bitfield_bit_offset); + } break; } } From gclayton at apple.com Wed Jan 5 13:02:52 2011 From: gclayton at apple.com (Greg Clayton) Date: Wed, 05 Jan 2011 19:02:52 -0000 Subject: [Lldb-commits] [lldb] r122897 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110105190252.681AE2A6C12C@llvm.org> Author: gclayton Date: Wed Jan 5 13:02:52 2011 New Revision: 122897 URL: http://llvm.org/viewvc/llvm-project?rev=122897&view=rev Log: Bumped versions in Xcode projects: lldb is now at lldb-38, debugserver is now at debugserver-124. 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=122897&r1=122896&r2=122897&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jan 5 13:02:52 2011 @@ -2926,9 +2926,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 37; + DYLIB_CURRENT_VERSION = 38; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2978,11 +2978,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 37; + DYLIB_CURRENT_VERSION = 38; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3052,7 +3052,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3087,11 +3087,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 37; + DYLIB_CURRENT_VERSION = 38; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3140,7 +3140,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3178,7 +3178,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=122897&r1=122896&r2=122897&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Wed Jan 5 13:02:52 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 37 + 38 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=122897&r1=122896&r2=122897&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Jan 5 13:02:52 2011 @@ -460,7 +460,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -478,7 +478,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -498,7 +498,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -515,7 +515,7 @@ buildSettings = { "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -556,7 +556,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -597,7 +597,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From johnny.chen at apple.com Wed Jan 5 14:24:11 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 05 Jan 2011 20:24:11 -0000 Subject: [Lldb-commits] [lldb] r122901 - /lldb/trunk/test/dotest.py Message-ID: <20110105202411.94B612A6C12C@llvm.org> Author: johnny Date: Wed Jan 5 14:24:11 2011 New Revision: 122901 URL: http://llvm.org/viewvc/llvm-project?rev=122901&view=rev Log: Enhance the test framework to be able to emit a counter value in verbose mode describing the ordinal number of the currently running test case. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=122901&r1=122900&r2=122901&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Wed Jan 5 14:24:11 2011 @@ -792,6 +792,18 @@ LLDBTestResult.__singleton__ = self # Now put this singleton into the lldb module namespace. lldb.test_result = self + # Computes the format string for displaying the counter. + global suite + counterWidth = len(str(suite.countTestCases())) + self.fmt = "%" + str(counterWidth) + "d: " + # This counts from 1 .. suite.countTestCases(). + self.counter = 0 + + def startTest(self, test): + self.counter += 1 + if self.showAll: + self.stream.write(self.fmt % self.counter) + super(LLDBTestResult, self).startTest(test) def addError(self, test, err): global sdir_has_content From johnny.chen at apple.com Wed Jan 5 16:50:11 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 05 Jan 2011 22:50:11 -0000 Subject: [Lldb-commits] [lldb] r122922 - /lldb/trunk/test/dotest.py Message-ID: <20110105225011.558582A6C12C@llvm.org> Author: johnny Date: Wed Jan 5 16:50:11 2011 New Revision: 122922 URL: http://llvm.org/viewvc/llvm-project?rev=122922&view=rev Log: Properly indent the short description of the test case to make it align with the previously added ordinal number of the currently running test case. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=122922&r1=122921&r2=122922&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Wed Jan 5 16:50:11 2011 @@ -796,9 +796,17 @@ global suite counterWidth = len(str(suite.countTestCases())) self.fmt = "%" + str(counterWidth) + "d: " + self.indentation = ' ' * (counterWidth + 2) # This counts from 1 .. suite.countTestCases(). self.counter = 0 + def getDescription(self, test): + doc_first_line = test.shortDescription() + if self.descriptions and doc_first_line: + return '\n'.join((str(test), self.indentation + doc_first_line)) + else: + return str(test) + def startTest(self, test): self.counter += 1 if self.showAll: From johnny.chen at apple.com Wed Jan 5 18:03:01 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 06 Jan 2011 00:03:01 -0000 Subject: [Lldb-commits] [lldb] r122930 - /lldb/trunk/test/help/TestHelp.py Message-ID: <20110106000301.448912A6C12C@llvm.org> Author: johnny Date: Wed Jan 5 18:03:01 2011 New Revision: 122930 URL: http://llvm.org/viewvc/llvm-project?rev=122930&view=rev Log: Modify test_help_version() test case to be more precise in matching the version number string as found in the resources/LLDB-info.plist file. Modified: lldb/trunk/test/help/TestHelp.py Modified: lldb/trunk/test/help/TestHelp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=122930&r1=122929&r2=122930&view=diff ============================================================================== --- lldb/trunk/test/help/TestHelp.py (original) +++ lldb/trunk/test/help/TestHelp.py Wed Jan 5 18:03:01 2011 @@ -18,12 +18,47 @@ self.expect("help", startstr = 'The following is a list of built-in, permanent debugger commands') + def version_number_string(self): + """Helper function to find the version number string of lldb.""" + plist = os.path.join(os.getcwd(), os.pardir, os.pardir, "resources", "LLDB-info.plist") + try: + CFBundleVersionSegFound = False + with open(plist, 'r') as f: + for line in f: + if CFBundleVersionSegFound: + version_line = line.strip() + import re + m = re.match("(.*)", version_line) + if m: + version = m.group(1) + return version + else: + # Unsuccessful, let's juts break out of the for loop. + break + + if line.find("CFBundleVersion") != -1: + # Found our match. The next line contains our version + # string, for example: + # + # 38 + CFBundleVersionSegFound = True + + except: + # Just fallthrough... + print "Unexpected error:", sys.exc_info()[0] + pass + + # Use None to signify that we are not able to grok the version number. + return None + + def test_help_version(self): """Test 'help version' and 'version' commands.""" self.expect("help version", substrs = ['Show version of LLDB debugger.']) + version_str = self.version_number_string() self.expect("version", - patterns = ['LLDB-[0-9]+']) + patterns = ['LLDB-' + (version_str if version_str else '[0-9]+')]) def test_help_should_not_hang_emacsshell(self): """Command 'settings set term-width 0' should not hang the help command.""" From wilsons at start.ca Thu Jan 6 15:57:38 2011 From: wilsons at start.ca (Stephen Wilson) Date: Thu, 06 Jan 2011 16:57:38 -0500 Subject: [Lldb-commits] [PATCH 0/2] linux: makefile system updates In-Reply-To: <1294174534-8666-1-git-send-email-wilsons@start.ca> (Stephen Wilson's message of "Tue, 4 Jan 2011 15:55:32 -0500") References: <1294174534-8666-1-git-send-email-wilsons@start.ca> Message-ID: Hi Greg, *, Stephen Wilson writes: > This series updates the Makefile based build system. > > In particular, it adds the Process/Utility component to the Linux build, adds > some missing/renamed Clang/LLVM components, and quites warnings generated by GCC > when encountering unknown pragmas (in particular the #pragma mark construct). Are these makefile patches OK to commit (am not sure if your last thumbs up applied to this series as well)? Take care, -- steve From wilsons at start.ca Thu Jan 6 16:10:24 2011 From: wilsons at start.ca (Stephen Wilson) Date: Thu, 06 Jan 2011 22:10:24 -0000 Subject: [Lldb-commits] [lldb] r122974 - /lldb/trunk/Makefile Message-ID: <20110106221024.54A4B2A6C12C@llvm.org> Author: wilsons Date: Thu Jan 6 16:10:24 2011 New Revision: 122974 URL: http://llvm.org/viewvc/llvm-project?rev=122974&view=rev Log: Ignore unknown pragmas. In particular, we are looking to ignore the "#pragma mark" construct which GCC warns about on platforms other than Darwin. This cleans up diagnostic output significantly. Modified: lldb/trunk/Makefile Modified: lldb/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=122974&r1=122973&r2=122974&view=diff ============================================================================== --- lldb/trunk/Makefile (original) +++ lldb/trunk/Makefile Thu Jan 6 16:10:24 2011 @@ -53,6 +53,10 @@ # We can revisit this when LLVM/Clang support it. CXX.Flags += -fno-strict-aliasing +# Do not warn about pragmas. In particular, we are looking to ignore the +# "#pragma mark" construct which GCC warns about on platforms other than Darwin. +EXTRA_OPTIONS += -Wno-unknown-pragmas + ### # LLDB Top Level specific stuff. From wilsons at start.ca Thu Jan 6 16:11:47 2011 From: wilsons at start.ca (Stephen Wilson) Date: Thu, 06 Jan 2011 22:11:47 -0000 Subject: [Lldb-commits] [lldb] r122975 - in /lldb/trunk: lib/Makefile source/Plugins/Makefile Message-ID: <20110106221147.9AF152A6C12C@llvm.org> Author: wilsons Date: Thu Jan 6 16:11:47 2011 New Revision: 122975 URL: http://llvm.org/viewvc/llvm-project?rev=122975&view=rev Log: Makefile updates. Update lib/Makefile to use current LLVM and Clang components and add the PluginUtility library to the build. Modified: lldb/trunk/lib/Makefile lldb/trunk/source/Plugins/Makefile Modified: lldb/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=122975&r1=122974&r2=122975&view=diff ============================================================================== --- lldb/trunk/lib/Makefile (original) +++ lldb/trunk/lib/Makefile Thu Jan 6 16:11:47 2011 @@ -33,11 +33,10 @@ lldbPluginObjectFileELF.a \ lldbPluginSymbolFileDWARF.a \ lldbPluginSymbolFileSymtab.a \ + lldbPluginUtility.a \ lldbSymbol.a \ lldbTarget.a \ lldbUtility.a \ - plugin_llvmc_Base.a \ - plugin_llvmc_Clang.a \ clangAnalysis.a \ clangAST.a \ clangBasic.a \ @@ -49,14 +48,14 @@ clangRewrite.a \ clangParse.a \ clangSema.a \ - CompilerDriver.a \ + clangSerialization.a \ EnhancedDisassembly.a \ clangChecker.a include $(LLDB_LEVEL)/../../Makefile.config LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \ - ipo selectiondag jit + ipo selectiondag jit mc ifeq ($(HOST_OS),Darwin) USEDLIBS += lldbHostMacOSX.a \ @@ -64,7 +63,6 @@ lldbPluginObjectContainerUniversalMachO.a \ lldbPluginObjectFileMachO.a \ lldbPluginProcessGDBRemote.a \ - lldbPluginUtility.a \ lldbPluginSymbolVendorMacOSX.a endif Modified: lldb/trunk/source/Plugins/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=122975&r1=122974&r2=122975&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Makefile (original) +++ lldb/trunk/source/Plugins/Makefile Thu Jan 6 16:11:47 2011 @@ -14,11 +14,11 @@ DIRS := ABI/MacOSX-i386 ABI/SysV-x86_64 Disassembler/llvm \ ObjectContainer/BSD-Archive ObjectFile/ELF SymbolFile/DWARF \ - SymbolFile/Symtab + SymbolFile/Symtab Process/Utility ifeq ($(HOST_OS),Darwin) DIRS += DynamicLoader/MacOSX-DYLD ObjectContainer/Universal-Mach-O \ - ObjectFile/Mach-O Process/gdb-remote Process/Utility \ + ObjectFile/Mach-O Process/gdb-remote \ SymbolVendor/MacOSX Process/MacOSX-User endif From gclayton at apple.com Thu Jan 6 16:15:07 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 06 Jan 2011 22:15:07 -0000 Subject: [Lldb-commits] [lldb] r122976 - in /lldb/trunk: include/lldb/Core/ include/lldb/Target/ source/API/ source/Core/ source/Expression/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Symbol/ source/Target/ Message-ID: <20110106221507.6A8F22A6C12C@llvm.org> Author: gclayton Date: Thu Jan 6 16:15:06 2011 New Revision: 122976 URL: http://llvm.org/viewvc/llvm-project?rev=122976&view=rev Log: Fixed issues with RegisterContext classes and the subclasses. There was an issue with the way the UnwindLLDB was handing out RegisterContexts: it was making shared pointers to register contexts and then handing out just the pointers (which would get put into shared pointers in the thread and stack frame classes) and cause double free issues. MallocScribble helped to find these issues after I did some other cleanup. To help avoid any RegisterContext issue in the future, all code that deals with them now returns shared pointers to the register contexts so we don't end up with multiple deletions. Also now that the RegisterContext class doesn't require a stack frame, we patched a memory leak where a StackFrame object was being created and leaked. Made the RegisterContext class not have a pointer to a StackFrame object as one register context class can be used for N inlined stack frames so there is not a 1 - 1 mapping. Updates the ExecutionContextScope part of the RegisterContext class to never return a stack frame to indicate this when it is asked to recreate the execution context. Now register contexts point to the concrete frame using a concrete frame index. Concrete frames are all of the frames that are actually formed on the stack of a thread. These concrete frames can be turned into one or more user visible frames due to inlining. Each inlined stack frame has the exact same register context (shared via shared pointers) as any parent inlined stack frames all the way up to the concrete frame itself. So now the stack frames and the register contexts should behave much better. Modified: lldb/trunk/include/lldb/Core/ValueObjectRegister.h lldb/trunk/include/lldb/Target/RegisterContext.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/Target/StackFrameList.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/Target/Unwind.h lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/ValueObjectRegister.cpp lldb/trunk/source/Expression/DWARFExpression.cpp lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h lldb/trunk/source/Symbol/UnwindPlan.cpp lldb/trunk/source/Target/ExecutionContext.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/RegisterContext.cpp lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/source/Target/StackFrameList.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlan.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp lldb/trunk/source/Target/ThreadPlanTracer.cpp Modified: lldb/trunk/include/lldb/Core/ValueObjectRegister.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectRegister.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObjectRegister.h (original) +++ lldb/trunk/include/lldb/Core/ValueObjectRegister.h Thu Jan 6 16:15:06 2011 @@ -26,7 +26,7 @@ class ValueObjectRegisterContext : public ValueObject { public: - ValueObjectRegisterContext (ValueObject *parent, RegisterContext *reg_ctx); + ValueObjectRegisterContext (ValueObject *parent, lldb::RegisterContextSP ®_ctx_sp); virtual ~ValueObjectRegisterContext(); @@ -59,7 +59,7 @@ CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); protected: - RegisterContext *m_reg_ctx; + lldb::RegisterContextSP m_reg_ctx; private: //------------------------------------------------------------------ @@ -71,7 +71,7 @@ class ValueObjectRegisterSet : public ValueObject { public: - ValueObjectRegisterSet (ValueObject *parent, RegisterContext *reg_ctx, uint32_t set_idx); + ValueObjectRegisterSet (ValueObject *parent, lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); virtual ~ValueObjectRegisterSet(); @@ -105,7 +105,7 @@ protected: - RegisterContext *m_reg_ctx; + lldb::RegisterContextSP m_reg_ctx; const lldb::RegisterSet *m_reg_set; uint32_t m_reg_set_idx; @@ -119,7 +119,7 @@ class ValueObjectRegister : public ValueObject { public: - ValueObjectRegister (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_num); + ValueObjectRegister (ValueObject *parent, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); virtual ~ValueObjectRegister(); @@ -150,7 +150,7 @@ protected: - RegisterContext *m_reg_ctx; + lldb::RegisterContextSP m_reg_ctx; const lldb::RegisterInfo *m_reg_info; uint32_t m_reg_num; ConstString m_type_name; Modified: lldb/trunk/include/lldb/Target/RegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/RegisterContext.h (original) +++ lldb/trunk/include/lldb/Target/RegisterContext.h Thu Jan 6 16:15:06 2011 @@ -26,9 +26,7 @@ //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - RegisterContext (Thread &thread, StackFrame *frame); - - RegisterContext (Thread &thread); + RegisterContext (Thread &thread, uint32_t concrete_frame_idx); virtual ~RegisterContext (); @@ -147,9 +145,6 @@ bool ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t& target_regnum); - void - SetStackFrame (StackFrame *frame); - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions //------------------------------------------------------------------ @@ -172,8 +167,8 @@ //------------------------------------------------------------------ // Classes that inherit from RegisterContext can see and modify these //------------------------------------------------------------------ - Thread &m_thread; // The thread that this register context belongs to. - StackFrame *m_frame; // The stack frame for this context, or NULL if this is the root context + Thread &m_thread; // The thread that this register context belongs to. + uint32_t m_concrete_frame_idx; // The concrete frame index for this register context private: //------------------------------------------------------------------ // For RegisterContext only Modified: lldb/trunk/include/lldb/Target/StackFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/StackFrame.h (original) +++ lldb/trunk/include/lldb/Target/StackFrame.h Thu Jan 6 16:15:06 2011 @@ -34,14 +34,14 @@ // Constructors and Destructors //------------------------------------------------------------------ StackFrame (lldb::user_id_t frame_idx, - lldb::user_id_t unwind_frame_idx, + lldb::user_id_t concrete_frame_idx, Thread &thread, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr); StackFrame (lldb::user_id_t frame_idx, - lldb::user_id_t unwind_frame_idx, + lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, @@ -49,7 +49,7 @@ const SymbolContext *sc_ptr); StackFrame (lldb::user_id_t frame_idx, - lldb::user_id_t unwind_frame_idx, + lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, @@ -84,7 +84,7 @@ Block * GetFrameBlock (); - RegisterContext * + lldb::RegisterContextSP GetRegisterContext (); const lldb::RegisterContextSP & @@ -121,9 +121,9 @@ } uint32_t - GetUnwindFrameIndex () const + GetConcreteFrameIndex () const { - return m_unwind_frame_index; + return m_concrete_frame_index; } lldb::ValueObjectSP @@ -173,7 +173,7 @@ //------------------------------------------------------------------ Thread &m_thread; uint32_t m_frame_index; - uint32_t m_unwind_frame_index; + uint32_t m_concrete_frame_index; lldb::RegisterContextSP m_reg_context_sp; StackID m_id; Address m_frame_code_addr; // The frame code address (might not be the same as the actual PC for inlined frames) as a section/offset address Modified: lldb/trunk/include/lldb/Target/StackFrameList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameList.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/StackFrameList.h (original) +++ lldb/trunk/include/lldb/Target/StackFrameList.h Thu Jan 6 16:15:06 2011 @@ -39,6 +39,9 @@ lldb::StackFrameSP GetFrameAtIndex (uint32_t idx); + lldb::StackFrameSP + GetFrameWithConcreteFrameIndex (uint32_t unwind_idx); + // Mark a stack frame as the current frame uint32_t SetSelectedFrame (lldb_private::StackFrame *frame); Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Thu Jan 6 16:15:06 2011 @@ -278,6 +278,9 @@ virtual lldb::StackFrameSP GetStackFrameAtIndex (uint32_t idx); + + virtual lldb::StackFrameSP + GetFrameWithConcreteFrameIndex (uint32_t unwind_idx); uint32_t GetSelectedFrameIndex (); @@ -291,7 +294,7 @@ void SetSelectedFrameByIndex (uint32_t frame_idx); - virtual RegisterContext * + virtual lldb::RegisterContextSP GetRegisterContext () = 0; virtual bool @@ -300,7 +303,7 @@ virtual bool RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint) = 0; - virtual RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContextForFrame (StackFrame *frame) = 0; virtual void Modified: lldb/trunk/include/lldb/Target/Unwind.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Unwind.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Unwind.h (original) +++ lldb/trunk/include/lldb/Target/Unwind.h Thu Jan 6 16:15:06 2011 @@ -46,7 +46,7 @@ lldb::addr_t& cfa, lldb::addr_t& pc) = 0; - virtual RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContextForFrame (StackFrame *frame) = 0; Thread & Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Thu Jan 6 16:15:06 2011 @@ -426,7 +426,7 @@ case eValueTypeRegister: // stack frame register value { - RegisterContext *reg_ctx = m_opaque_sp->GetRegisterContext(); + RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext()); if (reg_ctx) { const uint32_t num_regs = reg_ctx->GetRegisterCount(); @@ -446,7 +446,7 @@ case eValueTypeRegisterSet: // A collection of stack frame register values { - RegisterContext *reg_ctx = m_opaque_sp->GetRegisterContext(); + RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext()); if (reg_ctx) { const uint32_t num_sets = reg_ctx->GetRegisterSetCount(); @@ -640,7 +640,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex()); - RegisterContext *reg_ctx = m_opaque_sp->GetRegisterContext(); + RegisterContextSP reg_ctx (m_opaque_sp->GetRegisterContext()); if (reg_ctx) { const uint32_t num_sets = reg_ctx->GetRegisterSetCount(); Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Thu Jan 6 16:15:06 2011 @@ -959,7 +959,7 @@ } else if (::strncmp (var_name_begin, "reg.", strlen ("reg.")) == 0) { - reg_ctx = exe_ctx->frame->GetRegisterContext(); + reg_ctx = exe_ctx->frame->GetRegisterContext().get(); if (reg_ctx) { var_name_begin += ::strlen ("reg."); @@ -1100,7 +1100,7 @@ else { if (reg_ctx == NULL) - reg_ctx = exe_ctx->frame->GetRegisterContext(); + reg_ctx = exe_ctx->frame->GetRegisterContext().get(); if (reg_ctx) { Modified: lldb/trunk/source/Core/ValueObjectRegister.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectRegister.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectRegister.cpp (original) +++ lldb/trunk/source/Core/ValueObjectRegister.cpp Thu Jan 6 16:15:06 2011 @@ -29,7 +29,7 @@ #pragma mark ValueObjectRegisterContext -ValueObjectRegisterContext::ValueObjectRegisterContext (ValueObject *parent, RegisterContext *reg_ctx) : +ValueObjectRegisterContext::ValueObjectRegisterContext (ValueObject *parent, RegisterContextSP ®_ctx) : ValueObject (parent), m_reg_ctx (reg_ctx) { @@ -81,9 +81,9 @@ if (frame) m_reg_ctx = frame->GetRegisterContext(); else - m_reg_ctx = NULL; + m_reg_ctx.reset(); - SetValueIsValid (m_reg_ctx != NULL); + SetValueIsValid (m_reg_ctx.get() != NULL); } ValueObjectSP @@ -101,7 +101,7 @@ #pragma mark - #pragma mark ValueObjectRegisterSet -ValueObjectRegisterSet::ValueObjectRegisterSet (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_set_idx) : +ValueObjectRegisterSet::ValueObjectRegisterSet (ValueObject *parent, lldb::RegisterContextSP ®_ctx, uint32_t reg_set_idx) : ValueObject (parent), m_reg_ctx (reg_ctx), m_reg_set (NULL), @@ -159,7 +159,7 @@ SetValueDidChange (false); StackFrame *frame = exe_scope->CalculateStackFrame(); if (frame == NULL) - m_reg_ctx = NULL; + m_reg_ctx.reset(); else { m_reg_ctx = frame->GetRegisterContext (); @@ -167,7 +167,7 @@ { const RegisterSet *reg_set = m_reg_ctx->GetRegisterSet (m_reg_set_idx); if (reg_set == NULL) - m_reg_ctx = NULL; + m_reg_ctx.reset(); else if (m_reg_set != reg_set) { SetValueDidChange (true); @@ -204,7 +204,7 @@ #pragma mark - #pragma mark ValueObjectRegister -ValueObjectRegister::ValueObjectRegister (ValueObject *parent, RegisterContext *reg_ctx, uint32_t reg_num) : +ValueObjectRegister::ValueObjectRegister (ValueObject *parent, lldb::RegisterContextSP ®_ctx, uint32_t reg_num) : ValueObject (parent), m_reg_ctx (reg_ctx), m_reg_info (NULL), @@ -310,7 +310,7 @@ } else { - m_reg_ctx = NULL; + m_reg_ctx.reset(); m_reg_info = NULL; } Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Thu Jan 6 16:15:06 2011 @@ -846,7 +846,7 @@ std::vector stack; if (reg_ctx == NULL && exe_ctx && exe_ctx->frame) - reg_ctx = exe_ctx->frame->GetRegisterContext(); + reg_ctx = exe_ctx->frame->GetRegisterContext().get(); if (initial_value_ptr) stack.push_back(*initial_value_ptr); Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Thu Jan 6 16:15:06 2011 @@ -61,7 +61,7 @@ lldb::addr_t *this_arg, lldb::addr_t *cmd_arg) const { - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; #define CHAIN_EBP @@ -154,7 +154,7 @@ lldb::addr_t returnAddress, ValueList &args) const { - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; Error error; @@ -422,7 +422,7 @@ // Get the pointer to the first stack argument so we have a place to start // when reading data - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; @@ -498,7 +498,7 @@ // Get the pointer to the first stack argument so we have a place to start // when reading data - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); void *value_type = value.GetClangType(); bool is_signed; Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Thu Jan 6 16:15:06 2011 @@ -76,7 +76,7 @@ cmd_arg, cmd_arg ? (uint64_t)*cmd_arg : (uint64_t)0); - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; @@ -293,7 +293,7 @@ // Extract the register context so we can read arguments from registers - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; @@ -382,7 +382,7 @@ void *value_type = value.GetClangType(); bool is_signed; - RegisterContext *reg_ctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) return false; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext.h Thu Jan 6 16:15:06 2011 @@ -28,7 +28,7 @@ { } - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContext (lldb_private::StackFrame *frame) const = 0; virtual void InitializeInstance() = 0; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp Thu Jan 6 16:15:06 2011 @@ -71,17 +71,18 @@ { } -RegisterContext * +lldb::RegisterContextSP MachThreadContext_arm::CreateRegisterContext (StackFrame *frame) const { - return new RegisterContextMach_arm(m_thread, frame); + lldb::RegisterContextSP reg_ctx_sp (new RegisterContextMach_arm(m_thread, frame->GetConcreteFrameIndex())); + return reg_ctx_sp; } // Instance init function void MachThreadContext_arm::InitializeInstance() { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx != NULL); const RegisterInfo * reg_info; reg_info = reg_ctx->GetRegisterInfoByName ("bvr0"); @@ -342,7 +343,7 @@ if (m_bvr0_reg == LLDB_INVALID_REGNUM || m_bcr0_reg == LLDB_INVALID_REGNUM) return KERN_INVALID_ARGUMENT; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); uint32_t bvr = 0; uint32_t bcr = 0; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.h Thu Jan 6 16:15:06 2011 @@ -31,7 +31,7 @@ virtual ~MachThreadContext_arm(); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContext (lldb_private::StackFrame *frame) const; virtual void Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp Thu Jan 6 16:15:06 2011 @@ -50,7 +50,7 @@ void MachThreadContext_i386::InitializeInstance() { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx != NULL); m_flags_reg = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS); } @@ -91,7 +91,7 @@ case EXC_BREAKPOINT: if (exc.exc_data.size() >= 2 && exc.exc_data[0] == 2) { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); lldb::addr_t pc = reg_ctx->GetPC(LLDB_INVALID_ADDRESS); if (pc != LLDB_INVALID_ADDRESS && pc > 0) @@ -152,10 +152,11 @@ // return KERN_INVALID_ARGUMENT; //} -RegisterContext * +RegisterContextSP MachThreadContext_i386::CreateRegisterContext (StackFrame *frame) const { - return new RegisterContextMach_i386(m_thread, frame); + lldb::RegisterContextSP reg_ctx_sp (new RegisterContextMach_i386(m_thread, frame->GetConcreteFrameIndex())); + return reg_ctx_sp; } @@ -172,7 +173,7 @@ uint32_t pc; }; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); Frame_i386 frame = { reg_ctx->GetFP(0), reg_ctx->GetPC(LLDB_INVALID_ADDRESS) }; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.h Thu Jan 6 16:15:06 2011 @@ -30,7 +30,7 @@ virtual ~MachThreadContext_i386(); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContext (lldb_private::StackFrame *frame) const; virtual void InitializeInstance(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp Thu Jan 6 16:15:06 2011 @@ -49,7 +49,7 @@ void MachThreadContext_x86_64::InitializeInstance() { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx != NULL); m_flags_reg = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS); } @@ -90,7 +90,7 @@ case EXC_BREAKPOINT: if (exc.exc_data.size() >= 2 && exc.exc_data[0] == 2) { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); lldb::addr_t pc = reg_ctx->GetPC(LLDB_INVALID_ADDRESS); if (pc != LLDB_INVALID_ADDRESS && pc > 0) @@ -158,10 +158,11 @@ -RegisterContext * +RegisterContextSP MachThreadContext_x86_64::CreateRegisterContext (StackFrame *frame) const { - return new RegisterContextMach_x86_64(m_thread, frame); + lldb::RegisterContextSP reg_ctx_sp (new RegisterContextMach_x86_64(m_thread, frame->GetConcreteFrameIndex())); + return reg_ctx_sp; } @@ -185,7 +186,7 @@ uint64_t pc; }; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); Frame_x86_64 frame = { reg_ctx->GetFP(0), reg_ctx->GetPC(LLDB_INVALID_ADDRESS) }; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.h Thu Jan 6 16:15:06 2011 @@ -36,7 +36,7 @@ virtual ~MachThreadContext_x86_64(); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContext (lldb_private::StackFrame *frame) const; virtual void Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp Thu Jan 6 16:15:06 2011 @@ -157,8 +157,8 @@ }; -RegisterContextMach_arm::RegisterContextMach_arm(Thread &thread, StackFrame *frame) : - RegisterContext(thread, frame), +RegisterContextMach_arm::RegisterContextMach_arm(Thread &thread, uint32_t concrete_frame_idx) : + RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc() Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h Thu Jan 6 16:15:06 2011 @@ -54,7 +54,7 @@ { public: - RegisterContextMach_arm(lldb_private::Thread &thread, lldb_private::StackFrame *frame); + RegisterContextMach_arm(lldb_private::Thread &thread, uint32_t concrete_frame_idx); virtual ~RegisterContextMach_arm(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp Thu Jan 6 16:15:06 2011 @@ -183,8 +183,8 @@ gdb_mm7 = 48 }; -RegisterContextMach_i386::RegisterContextMach_i386 (Thread &thread, StackFrame *frame) : - RegisterContext(thread, frame), +RegisterContextMach_i386::RegisterContextMach_i386 (Thread &thread, uint32_t concrete_frame_idx) : + RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc() Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h Thu Jan 6 16:15:06 2011 @@ -22,7 +22,7 @@ public: RegisterContextMach_i386(lldb_private::Thread &thread, - lldb_private::StackFrame *frame); + uint32_t concrete_frame_idx); virtual ~RegisterContextMach_i386(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp Thu Jan 6 16:15:06 2011 @@ -206,8 +206,8 @@ gdb_fpu_mxcsr = 56, }; -RegisterContextMach_x86_64::RegisterContextMach_x86_64 (Thread &thread, StackFrame *frame) : - RegisterContext (thread, frame), +RegisterContextMach_x86_64::RegisterContextMach_x86_64 (Thread &thread, uint32_t concrete_frame_idx) : + RegisterContext (thread, concrete_frame_idx), gpr(), fpu(), exc() Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h Thu Jan 6 16:15:06 2011 @@ -21,7 +21,7 @@ { public: RegisterContextMach_x86_64 (lldb_private::Thread &thread, - lldb_private::StackFrame *frame); + uint32_t concrete_frame_idx); virtual ~RegisterContextMach_x86_64(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Thu Jan 6 16:15:06 2011 @@ -444,7 +444,7 @@ default: thread_run_state = "???"; break; } - RegisterContext *reg_context = GetRegisterContext(); + RegisterContext *reg_context = GetRegisterContext().get(); log->Printf ("thread[%u] %4.4x (%u): pc: 0x%8.8llx sp: 0x%8.8llx breakID: %d user: %d.%06.6d system: %d.%06.6d cpu: %d policy: %d run_state: %d (%s) flags: %d suspend_count: %d (current %d) sleep_time: %d", index, GetID (), @@ -597,15 +597,15 @@ return true; } -RegisterContext * +RegisterContextSP ThreadMacOSX::GetRegisterContext () { if (m_reg_context_sp.get() == NULL) - m_reg_context_sp.reset (CreateRegisterContextForFrame (NULL)); - return m_reg_context_sp.get(); + m_reg_context_sp = CreateRegisterContextForFrame (NULL); + return m_reg_context_sp; } -RegisterContext * +RegisterContextSP ThreadMacOSX::CreateRegisterContextForFrame (StackFrame *frame) { return m_context->CreateRegisterContext (frame); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.h Thu Jan 6 16:15:06 2011 @@ -39,10 +39,10 @@ virtual const char * GetName (); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP GetRegisterContext (); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContextForFrame (lldb_private::StackFrame *frame); virtual bool Modified: lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp Thu Jan 6 16:15:06 2011 @@ -56,7 +56,7 @@ return; - RegisterContext *rctx = thread.GetRegisterContext(); + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); const RegisterInfo *ri; const char *x86_64_regnames[] = { "rbx", @@ -91,7 +91,7 @@ for (int i = 0; i < namecount; i++) { - ri = rctx->GetRegisterInfoByName (names[i]); + ri = reg_ctx->GetRegisterInfoByName (names[i]); if (ri) m_non_volatile_regs.insert (ri->kinds[eRegisterKindLLDB]); } 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=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Thu Jan 6 16:15:06 2011 @@ -31,19 +31,32 @@ using namespace lldb_private; -RegisterContextLLDB::RegisterContextLLDB (Thread& thread, - const RegisterContextSP &next_frame, - SymbolContext& sym_ctx, - int frame_number) : - RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), - m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), - m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number), - m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL), m_base_reg_ctx (), m_frame_type (-1), - m_current_offset (0), m_current_offset_backed_up_one (0), m_sym_ctx_valid (false) +RegisterContextLLDB::RegisterContextLLDB +( + Thread& thread, + const RegisterContextSP &next_frame, + SymbolContext& sym_ctx, + uint32_t frame_number +) : + RegisterContext (thread, frame_number), + m_thread(thread), + m_next_frame(next_frame), + m_sym_ctx(sym_ctx), + m_all_registers_available(false), + m_registers(), + m_cfa (LLDB_INVALID_ADDRESS), + m_start_pc (), + m_current_pc (), + m_frame_number (frame_number), + m_full_unwind_plan(NULL), + m_fast_unwind_plan(NULL), + m_frame_type (-1), + m_current_offset (0), + m_current_offset_backed_up_one (0), + m_sym_ctx_valid (false) { m_sym_ctx.Clear(); m_sym_ctx_valid = false; - m_base_reg_ctx = m_thread.GetRegisterContext(); if (IsFrameZero ()) { @@ -81,7 +94,8 @@ RegisterContextLLDB::InitializeZerothFrame() { StackFrameSP frame_sp (m_thread.GetStackFrameAtIndex (0)); - if (m_base_reg_ctx == NULL) + + if (m_thread.GetRegisterContext() == NULL) { m_frame_type = eNotAValidFrame; return; @@ -160,7 +174,7 @@ { if (log) { - log->Printf("%*sFrame %d could not find a valid cfa address", + log->Printf("%*sFrame %u could not find a valid cfa address", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; @@ -169,7 +183,7 @@ if (log) { - log->Printf("%*sThread %d Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx using %s UnwindPlan", + log->Printf("%*sThread %d Frame %u initialized frame current pc is 0x%llx cfa is 0x%llx using %s UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_thread.GetIndexID(), m_frame_number, (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa, m_full_unwind_plan->GetSourceName().GetCString()); @@ -193,7 +207,7 @@ m_frame_type = eNotAValidFrame; return; } - if (m_base_reg_ctx == NULL) + if (m_thread.GetRegisterContext() == NULL) { m_frame_type = eNotAValidFrame; return; @@ -204,7 +218,7 @@ { if (log) { - log->Printf("%*sFrame %d could not get pc value", + log->Printf("%*sFrame %u could not get pc value", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; @@ -224,7 +238,7 @@ { if (log) { - log->Printf("%*sFrame %d using architectural default unwind method", + log->Printf("%*sFrame %u using architectural default unwind method", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); @@ -245,7 +259,7 @@ { if (log) { - log->Printf("%*sFrame %d failed to get cfa value", + log->Printf("%*sFrame %u failed to get cfa value", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNormalFrame; @@ -258,7 +272,7 @@ { if (log) { - log->Printf("%*sFrame %d could not find a valid cfa address", + log->Printf("%*sFrame %u could not find a valid cfa address", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; @@ -267,7 +281,7 @@ if (log) { - log->Printf("%*sFrame %d initialized frame cfa is 0x%llx", + log->Printf("%*sFrame %u initialized frame cfa is 0x%llx", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, (uint64_t) m_cfa); } @@ -392,7 +406,7 @@ { if (log) { - log->Printf("%*sFrame %d failed to get cfa reg %d/%d", + log->Printf("%*sFrame %u failed to get cfa reg %d/%d", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, row_register_kind, active_row->GetCFARegister()); } @@ -408,7 +422,7 @@ { if (log) { - log->Printf("%*sFrame %d could not find a valid cfa address", + log->Printf("%*sFrame %u could not find a valid cfa address", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; @@ -417,7 +431,7 @@ if (log) { - log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + log->Printf("%*sFrame %u initialized frame current pc is 0x%llx cfa is 0x%llx", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); } @@ -478,7 +492,7 @@ const char *has_fast = ""; if (m_fast_unwind_plan) has_fast = ", and has a fast UnwindPlan"; - log->Printf("%*sFrame %d frame has a fast UnwindPlan", + log->Printf("%*sFrame %u frame has a fast UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNormalFrame; @@ -570,7 +584,7 @@ { if (log && IsLogVerbose()) { - log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + log->Printf("%*sFrame %u frame uses %s for full UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, up->GetSourceName().GetCString()); } @@ -583,7 +597,7 @@ { if (log && IsLogVerbose()) { - log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + log->Printf("%*sFrame %u frame uses %s for full UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, up->GetSourceName().GetCString()); } @@ -597,7 +611,7 @@ { if (log && IsLogVerbose()) { - log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + log->Printf("%*sFrame %u frame uses %s for full UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, up->GetSourceName().GetCString()); } @@ -607,7 +621,7 @@ // If nothing else, use the architectural default UnwindPlan and hope that does the job. if (log && IsLogVerbose()) { - log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + log->Printf("%*sFrame %u frame uses %s for full UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, arch_default_up->GetSourceName().GetCString()); } @@ -624,31 +638,31 @@ size_t RegisterContextLLDB::GetRegisterCount () { - return m_base_reg_ctx->GetRegisterCount(); + return m_thread.GetRegisterContext()->GetRegisterCount(); } const RegisterInfo * RegisterContextLLDB::GetRegisterInfoAtIndex (uint32_t reg) { - return m_base_reg_ctx->GetRegisterInfoAtIndex (reg); + return m_thread.GetRegisterContext()->GetRegisterInfoAtIndex (reg); } size_t RegisterContextLLDB::GetRegisterSetCount () { - return m_base_reg_ctx->GetRegisterSetCount (); + return m_thread.GetRegisterContext()->GetRegisterSetCount (); } const RegisterSet * RegisterContextLLDB::GetRegisterSet (uint32_t reg_set) { - return m_base_reg_ctx->GetRegisterSet (reg_set); + return m_thread.GetRegisterContext()->GetRegisterSet (reg_set); } uint32_t RegisterContextLLDB::ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) { - return m_base_reg_ctx->ConvertRegisterKindToRegisterNumber (kind, num); + return m_thread.GetRegisterContext()->ConvertRegisterKindToRegisterNumber (kind, num); } bool @@ -663,7 +677,7 @@ data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); if (IsFrameZero ()) { - return m_base_reg_ctx->ReadRegisterBytes (regloc.location.register_number, data); + return m_thread.GetRegisterContext()->ReadRegisterBytes (regloc.location.register_number, data); } else { @@ -683,7 +697,7 @@ assert ("Unknown RegisterLocation type."); } - const RegisterInfo *reg_info = m_base_reg_ctx->GetRegisterInfoAtIndex (regnum); + const RegisterInfo *reg_info = m_thread.GetRegisterContext()->GetRegisterInfoAtIndex (regnum); DataBufferSP data_sp (new DataBufferHeap (reg_info->byte_size, 0)); data.SetData (data_sp, 0, reg_info->byte_size); data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); @@ -743,7 +757,7 @@ { if (IsFrameZero ()) { - return m_base_reg_ctx->WriteRegisterBytes (regloc.location.register_number, data, data_offset); + return m_thread.GetRegisterContext()->WriteRegisterBytes (regloc.location.register_number, data, data_offset); } else { @@ -768,7 +782,7 @@ } Error error; - const RegisterInfo *reg_info = m_base_reg_ctx->GetRegisterInfoAtIndex (regnum); + const RegisterInfo *reg_info = m_thread.GetRegisterContext()->GetRegisterInfoAtIndex (regnum); if (reg_info->byte_size == 0) return false; uint8_t *buf = (uint8_t*) alloca (reg_info->byte_size); @@ -809,7 +823,7 @@ // Are we looking for the CALLER's stack pointer? The stack pointer is defined to be the same as THIS frame's // CFA so just return the CFA value. This is true on x86-32/x86-64 at least. uint32_t sp_regnum; - if (m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, eRegisterKindLLDB, sp_regnum) + if (m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, eRegisterKindLLDB, sp_regnum) && sp_regnum == lldb_regnum) { // make sure we won't lose precision copying an addr_t (m_cfa) into a uint64_t (.register_value) @@ -831,11 +845,11 @@ const UnwindPlan::Row *active_row = m_fast_unwind_plan->GetRowForFunctionOffset (m_current_offset); unwindplan_registerkind = m_fast_unwind_plan->GetRegisterKind (); uint32_t row_regnum; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) + if (!m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) { if (log) { - log->Printf("%*sFrame %d could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", + log->Printf("%*sFrame %u could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum, (int) unwindplan_registerkind); } @@ -845,7 +859,7 @@ { if (log) { - log->Printf("%*sFrame %d supplying caller's saved reg %d's location using FastUnwindPlan", + log->Printf("%*sFrame %u supplying caller's saved reg %d's location using FastUnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -865,16 +879,16 @@ const UnwindPlan::Row *active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); unwindplan_registerkind = m_full_unwind_plan->GetRegisterKind (); uint32_t row_regnum; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) + if (!m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) { if (log) { if (unwindplan_registerkind == eRegisterKindGeneric) - log->Printf("%*sFrame %d could not convert lldb regnum %d into eRegisterKindGeneric reg numbering scheme", + log->Printf("%*sFrame %u could not convert lldb regnum %d into eRegisterKindGeneric reg numbering scheme", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); else - log->Printf("%*sFrame %d could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", + log->Printf("%*sFrame %u could not convert lldb regnum %d into %d RegisterKind reg numbering scheme", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum, (int) unwindplan_registerkind); } @@ -886,7 +900,7 @@ have_unwindplan_regloc = true; if (log && IsLogVerbose ()) { - log->Printf("%*sFrame %d supplying caller's saved reg %d's location using %s UnwindPlan", + log->Printf("%*sFrame %u supplying caller's saved reg %d's location using %s UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); } @@ -904,7 +918,7 @@ { if (log) { - log->Printf("%*sFrame %d did not supply reg location for %d because it is volatile", + log->Printf("%*sFrame %u did not supply reg location for %d because it is volatile", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -927,7 +941,7 @@ } if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %u could not supply caller's reg %d location", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -942,7 +956,7 @@ m_registers[lldb_regnum] = new_regloc; if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %u could not supply caller's reg %d location", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -959,7 +973,7 @@ { if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %u could not supply caller's reg %d location", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -989,11 +1003,11 @@ { uint32_t unwindplan_regnum = unwindplan_regloc.GetRegisterNumber(); uint32_t row_regnum_in_lldb; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (unwindplan_registerkind, unwindplan_regnum, eRegisterKindLLDB, row_regnum_in_lldb)) + if (!m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (unwindplan_registerkind, unwindplan_regnum, eRegisterKindLLDB, row_regnum_in_lldb)) { if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %u could not supply caller's reg %d location", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -1036,7 +1050,7 @@ } if (log) { - log->Printf("%*sFrame %d tried to use IsDWARFExpression or IsAtDWARFExpression for reg %d but failed", + log->Printf("%*sFrame %u tried to use IsDWARFExpression or IsAtDWARFExpression for reg %d but failed", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -1045,7 +1059,7 @@ if (log) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", + log->Printf("%*sFrame %u could not supply caller's reg %d location", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -1069,7 +1083,6 @@ // and this RegisterContext is for frame 1 (bar) - if we want to get the pc value for frame 1, we need to ask // where frame 0 (the "next" frame) saved that and retrieve the value. -// Assumes m_base_reg_ctx has been set bool RegisterContextLLDB::ReadGPRValue (int register_kind, uint32_t regnum, addr_t &value) { @@ -1081,7 +1094,7 @@ { lldb_regnum = regnum; } - else if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindLLDB, lldb_regnum)) + else if (!m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindLLDB, lldb_regnum)) { return false; } @@ -1094,7 +1107,7 @@ // if this is frame 0 (currently executing frame), get the requested reg contents from the actual thread registers if (IsFrameZero ()) { - if (m_base_reg_ctx->ReadRegisterBytes (lldb_regnum, data)) + if (m_thread.GetRegisterContext()->ReadRegisterBytes (lldb_regnum, data)) { data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); value = data.GetAddress (&offset); @@ -1131,7 +1144,7 @@ if (log && IsLogVerbose ()) { - log->Printf("%*sFrame %d looking for register saved location for reg %d", + log->Printf("%*sFrame %u looking for register saved location for reg %d", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } @@ -1141,11 +1154,11 @@ { if (log) { - log->Printf("%*sFrame %d passing along to the live register context for reg %d", + log->Printf("%*sFrame %u passing along to the live register context for reg %d", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } - return m_base_reg_ctx->ReadRegisterBytes (lldb_reg, data); + return m_thread.GetRegisterContext()->ReadRegisterBytes (lldb_reg, data); } RegisterLocation regloc; @@ -1165,7 +1178,7 @@ if (log && IsLogVerbose ()) { - log->Printf("%*sFrame %d looking for register saved location for reg %d", + log->Printf("%*sFrame %u looking for register saved location for reg %d", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } @@ -1175,11 +1188,11 @@ { if (log) { - log->Printf("%*sFrame %d passing along to the live register context for reg %d", + log->Printf("%*sFrame %u passing along to the live register context for reg %d", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } - return m_base_reg_ctx->WriteRegisterBytes (lldb_reg, data, data_offset); + return m_thread.GetRegisterContext()->WriteRegisterBytes (lldb_reg, data, data_offset); } RegisterLocation regloc; 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=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Thu Jan 6 16:15:06 2011 @@ -23,7 +23,7 @@ RegisterContextLLDB (lldb_private::Thread &thread, const lldb::RegisterContextSP& next_frame, lldb_private::SymbolContext& sym_ctx, - int frame_number); + uint32_t frame_number); /// // pure virtual functions from the base class that we must implement @@ -156,8 +156,6 @@ lldb_private::Thread& m_thread; lldb::RegisterContextSP m_next_frame; - lldb_private::RegisterContext *m_base_reg_ctx; // RegisterContext of frame 0 (live register values only) - /// // The following tell us how to retrieve the CALLER's register values (ie the "previous" frame, aka the frame above) // i.e. where THIS frame saved them @@ -186,7 +184,7 @@ lldb_private::SymbolContext& m_sym_ctx; bool m_sym_ctx_valid; // if ResolveSymbolContextForAddress fails, don't try to use m_sym_ctx - int m_frame_number; // What stack frame level this frame is - used for debug logging + uint32_t m_frame_number; // What stack frame level this frame is - used for debug logging std::map m_registers; // where to find reg values for this frame Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp Thu Jan 6 16:15:06 2011 @@ -29,10 +29,10 @@ RegisterContextMacOSXFrameBackchain::RegisterContextMacOSXFrameBackchain ( Thread &thread, - StackFrame *frame, + uint32_t concrete_frame_idx, const UnwindMacOSXFrameBackchain::Cursor &cursor ) : - RegisterContext (thread, frame), + RegisterContext (thread, concrete_frame_idx), m_cursor (cursor), m_cursor_is_valid (true) { Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h Thu Jan 6 16:15:06 2011 @@ -26,7 +26,7 @@ // Constructors and Destructors //------------------------------------------------------------------ RegisterContextMacOSXFrameBackchain (lldb_private::Thread &thread, - lldb_private::StackFrame *frame, + uint32_t concrete_frame_idx, const UnwindMacOSXFrameBackchain::Cursor &cursor); virtual Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Thu Jan 6 16:15:06 2011 @@ -197,8 +197,8 @@ if (m_thread && *initialized_flag == 0) { - RegisterContext *rctx = m_thread->GetRegisterContext(); - if (rctx) + RegisterContext *reg_ctx = m_thread->GetRegisterContext().get(); + if (reg_ctx) { struct regmap_ent *ent; int count, i; @@ -214,7 +214,7 @@ } for (i = 0; i < count; i++, ent++) { - const RegisterInfo *ri = rctx->GetRegisterInfoByName (ent->name); + const RegisterInfo *ri = reg_ctx->GetRegisterInfoByName (ent->name); if (ri) ent->lldb_regno = ri->kinds[eRegisterKindLLDB]; } 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=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Thu Jan 6 16:15:06 2011 @@ -47,26 +47,22 @@ // First, set up the 0th (initial) frame CursorSP first_cursor_sp(new Cursor ()); RegisterContextSP no_frame; - RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0); - if (!first_register_ctx->IsValid()) - { - delete first_register_ctx; + std::auto_ptr first_register_ctx_ap (new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0)); + if (first_register_ctx_ap.get() == NULL) return false; - } - if (!first_register_ctx->GetCFA (first_cursor_sp->cfa)) - { - delete first_register_ctx; + + if (!first_register_ctx_ap->IsValid()) return false; - } - if (!first_register_ctx->GetPC (first_cursor_sp->start_pc)) - { - delete first_register_ctx; + + if (!first_register_ctx_ap->GetCFA (first_cursor_sp->cfa)) return false; - } - // Reuse the StackFrame provided by the processor native machine context for the first frame - first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get()); - RegisterContextSP first_register_ctx_sp(first_register_ctx); - first_cursor_sp->reg_ctx = first_register_ctx_sp; + + if (!first_register_ctx_ap->GetPC (first_cursor_sp->start_pc)) + return false; + + // Everything checks out, so release the auto pointer value and let the + // cursor own it in its shared pointer + first_cursor_sp->reg_ctx.reset(first_register_ctx_ap.release()); m_frames.push_back (first_cursor_sp); return true; } @@ -77,18 +73,21 @@ { LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); CursorSP cursor_sp(new Cursor ()); - RegisterContextLLDB *register_ctx; // Frame zero is a little different if (m_frames.size() == 0) return false; uint32_t cur_idx = m_frames.size (); - register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1]->reg_ctx, cursor_sp->sctx, cur_idx); + std::auto_ptr register_ctx_ap(new RegisterContextLLDB (m_thread, + m_frames[cur_idx - 1]->reg_ctx, + cursor_sp->sctx, + cur_idx)); + if (register_ctx_ap.get() == NULL) + return false; - if (!register_ctx->IsValid()) + if (!register_ctx_ap->IsValid()) { - delete register_ctx; if (log) { log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", @@ -96,9 +95,8 @@ } return false; } - if (!register_ctx->GetCFA (cursor_sp->cfa)) + if (!register_ctx_ap->GetCFA (cursor_sp->cfa)) { - delete register_ctx; if (log) { log->Printf("%*sFrame %d did not get CFA for this frame, stopping stack walk", @@ -108,7 +106,6 @@ } if (cursor_sp->cfa == (addr_t) -1 || cursor_sp->cfa == 1 || cursor_sp->cfa == 0) { - delete register_ctx; if (log) { log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk", @@ -116,9 +113,8 @@ } return false; } - if (!register_ctx->GetPC (cursor_sp->start_pc)) + if (!register_ctx_ap->GetPC (cursor_sp->start_pc)) { - delete register_ctx; if (log) { log->Printf("%*sFrame %d did not get PC for this frame, stopping stack walk", @@ -126,9 +122,7 @@ } return false; } - RegisterContextSP register_ctx_sp(register_ctx); - StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, register_ctx_sp, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); - register_ctx->SetStackFrame (frame); + RegisterContextSP register_ctx_sp(register_ctx_ap.release()); cursor_sp->reg_ctx = register_ctx_sp; m_frames.push_back (cursor_sp); return true; @@ -155,9 +149,10 @@ return false; } -RegisterContext * +lldb::RegisterContextSP UnwindLLDB::CreateRegisterContextForFrame (StackFrame *frame) { + lldb::RegisterContextSP reg_ctx_sp; uint32_t idx = frame->GetFrameIndex (); if (idx == 0) @@ -168,13 +163,13 @@ if (m_frames.size() == 0) { if (!AddFirstFrame()) - return NULL; + return reg_ctx_sp; } while (idx >= m_frames.size() && AddOneMoreFrame ()) ; if (idx < m_frames.size ()) - return m_frames[idx]->reg_ctx.get(); - return NULL; + reg_ctx_sp = m_frames[idx]->reg_ctx; + return reg_ctx_sp; } Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Thu Jan 6 16:15:06 2011 @@ -44,7 +44,7 @@ lldb::addr_t& cfa, lldb::addr_t& start_pc); - lldb_private::RegisterContext * + lldb::RegisterContextSP CreateRegisterContextForFrame (lldb_private::StackFrame *frame); private: Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp Thu Jan 6 16:15:06 2011 @@ -63,14 +63,15 @@ return false; } -RegisterContext * +lldb::RegisterContextSP UnwindMacOSXFrameBackchain::CreateRegisterContextForFrame (StackFrame *frame) { - uint32_t idx = frame->GetUnwindFrameIndex (); + lldb::RegisterContextSP reg_ctx_sp; + uint32_t concrete_idx = frame->GetConcreteFrameIndex (); const uint32_t frame_count = GetFrameCount(); - if (idx < frame_count) - return new RegisterContextMacOSXFrameBackchain (m_thread, frame, m_cursors[idx]); - return NULL; + if (concrete_idx < frame_count) + reg_ctx_sp.reset (new RegisterContextMacOSXFrameBackchain (m_thread, concrete_idx, m_cursors[concrete_idx])); + return reg_ctx_sp; } size_t @@ -86,7 +87,7 @@ uint32_t pc; }; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); Cursor cursor; @@ -174,7 +175,7 @@ uint64_t pc; }; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); assert (reg_ctx); Cursor cursor; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h Thu Jan 6 16:15:06 2011 @@ -44,7 +44,7 @@ lldb::addr_t& cfa, lldb::addr_t& pc); - lldb_private::RegisterContext * + lldb::RegisterContextSP CreateRegisterContextForFrame (lldb_private::StackFrame *frame); lldb_private::Thread & Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Thu Jan 6 16:15:06 2011 @@ -32,11 +32,11 @@ GDBRemoteRegisterContext::GDBRemoteRegisterContext ( ThreadGDBRemote &thread, - StackFrame *frame, + uint32_t concrete_frame_idx, GDBRemoteDynamicRegisterInfo ®_info, bool read_all_at_once ) : - RegisterContext (thread, frame), + RegisterContext (thread, concrete_frame_idx), m_reg_info (reg_info), m_reg_valid (), m_reg_valid_stop_id (), Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h Thu Jan 6 16:15:06 2011 @@ -178,7 +178,7 @@ // Constructors and Destructors //------------------------------------------------------------------ GDBRemoteRegisterContext (ThreadGDBRemote &thread, - lldb_private::StackFrame *frame, + uint32_t concrete_frame_idx, GDBRemoteDynamicRegisterInfo ®_info, bool read_all_at_once); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Jan 6 16:15:06 2011 @@ -173,28 +173,29 @@ { return true; } -RegisterContext * +lldb::RegisterContextSP ThreadGDBRemote::GetRegisterContext () { if (m_reg_context_sp.get() == NULL) - m_reg_context_sp.reset (CreateRegisterContextForFrame (NULL)); - return m_reg_context_sp.get(); + m_reg_context_sp = CreateRegisterContextForFrame (NULL); + return m_reg_context_sp; } -RegisterContext * +lldb::RegisterContextSP ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame) { + lldb::RegisterContextSP reg_ctx_sp; const bool read_all_registers_at_once = false; - uint32_t frame_idx = 0; + uint32_t concrete_frame_idx = 0; if (frame) - frame_idx = frame->GetFrameIndex (); + concrete_frame_idx = frame->GetConcreteFrameIndex (); - if (frame_idx == 0) - return new GDBRemoteRegisterContext (*this, frame, GetGDBProcess().m_register_info, read_all_registers_at_once); + if (concrete_frame_idx == 0) + reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, GetGDBProcess().m_register_info, read_all_registers_at_once)); else if (m_unwinder_ap.get()) - return m_unwinder_ap->CreateRegisterContextForFrame (frame); - return NULL; + reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame); + return reg_ctx_sp; } bool Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h Thu Jan 6 16:15:06 2011 @@ -41,10 +41,10 @@ virtual const char * GetQueueName (); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP GetRegisterContext (); - virtual lldb_private::RegisterContext * + virtual lldb::RegisterContextSP CreateRegisterContextForFrame (lldb_private::StackFrame *frame); virtual bool Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindPlan.cpp (original) +++ lldb/trunk/source/Symbol/UnwindPlan.cpp Thu Jan 6 16:15:06 2011 @@ -135,17 +135,16 @@ void UnwindPlan::Row::Dump (Stream& s, int register_kind, Thread* thread) const { - RegisterContext *rctx = NULL; + RegisterContext *reg_ctx = NULL; const RegisterInfo *rinfo = NULL; int translated_regnum; if (thread && thread->GetRegisterContext()) - { - rctx = thread->GetRegisterContext(); - } + reg_ctx = thread->GetRegisterContext().get(); + s.Printf ("offset %ld, CFA reg ", (long) GetOffset()); - if (rctx - && (translated_regnum = rctx->ConvertRegisterKindToRegisterNumber (register_kind, GetCFARegister())) != -1 - && (rinfo = rctx->GetRegisterInfoAtIndex (translated_regnum)) != NULL + if (reg_ctx + && (translated_regnum = reg_ctx->ConvertRegisterKindToRegisterNumber (register_kind, GetCFARegister())) != -1 + && (rinfo = reg_ctx->GetRegisterInfoAtIndex (translated_regnum)) != NULL && rinfo->name != NULL && rinfo->name[0] != '\0') { @@ -160,11 +159,10 @@ { s.Printf (" ["); bool printed_name = false; - if (thread && thread->GetRegisterContext()) + if (reg_ctx) { - rctx = thread->GetRegisterContext(); - translated_regnum = rctx->ConvertRegisterKindToRegisterNumber (register_kind, idx->first); - rinfo = rctx->GetRegisterInfoAtIndex (translated_regnum); + translated_regnum = reg_ctx->ConvertRegisterKindToRegisterNumber (register_kind, idx->first); + rinfo = reg_ctx->GetRegisterInfoAtIndex (translated_regnum); if (rinfo && rinfo->name) { s.Printf ("%s ", rinfo->name); Modified: lldb/trunk/source/Target/ExecutionContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/ExecutionContext.cpp (original) +++ lldb/trunk/source/Target/ExecutionContext.cpp Thu Jan 6 16:15:06 2011 @@ -88,9 +88,9 @@ ExecutionContext::GetRegisterContext () const { if (frame) - return frame->GetRegisterContext(); + return frame->GetRegisterContext().get(); else if (thread) - return thread->GetRegisterContext(); + return thread->GetRegisterContext().get(); return NULL; } Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Jan 6 16:15:06 2011 @@ -2545,7 +2545,7 @@ } ts.Printf("<"); - RegisterContext *register_context = thread->GetRegisterContext(); + RegisterContext *register_context = thread->GetRegisterContext().get(); if (register_context) ts.Printf("[ip 0x%llx] ", register_context->GetPC()); Modified: lldb/trunk/source/Target/RegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/RegisterContext.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/RegisterContext.cpp (original) +++ lldb/trunk/source/Target/RegisterContext.cpp Thu Jan 6 16:15:06 2011 @@ -21,18 +21,9 @@ using namespace lldb; using namespace lldb_private; -//---------------------------------------------------------------------- -// RegisterContext constructors -//---------------------------------------------------------------------- -RegisterContext::RegisterContext (Thread &thread, StackFrame *frame) : - m_thread (thread), - m_frame (frame) -{ -} - -RegisterContext::RegisterContext (Thread &thread) : +RegisterContext::RegisterContext (Thread &thread, uint32_t concrete_frame_idx) : m_thread (thread), - m_frame (NULL) + m_concrete_frame_idx (concrete_frame_idx) { } @@ -86,8 +77,9 @@ bool success = WriteRegisterFromUnsigned (reg, pc); if (success) { - if (m_frame) - m_frame->ChangePC(pc); + StackFrameSP frame_sp(m_thread.GetFrameWithConcreteFrameIndex (m_concrete_frame_idx)); + if (frame_sp) + frame_sp->ChangePC(pc); else m_thread.ClearStackFrames (); } @@ -207,12 +199,6 @@ return false; } -void -RegisterContext::SetStackFrame (StackFrame *frame) -{ - m_frame = frame; -} - Target * RegisterContext::CalculateTarget () { @@ -235,16 +221,16 @@ StackFrame * RegisterContext::CalculateStackFrame () { - return m_frame; + // Register contexts might belong to many frames if we have inlined + // functions inside a frame since all inlined functions share the + // same registers, so we can't definitively say which frame we come from... + return NULL; } void RegisterContext::CalculateExecutionContext (ExecutionContext &exe_ctx) { - if (m_frame) - m_frame->CalculateExecutionContext (exe_ctx); - else - m_thread.CalculateExecutionContext (exe_ctx); + m_thread.CalculateExecutionContext (exe_ctx); } Modified: lldb/trunk/source/Target/StackFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/StackFrame.cpp (original) +++ lldb/trunk/source/Target/StackFrame.cpp Thu Jan 6 16:15:06 2011 @@ -49,7 +49,7 @@ const SymbolContext *sc_ptr ) : m_frame_index (frame_idx), - m_unwind_frame_index (unwind_frame_index), + m_concrete_frame_index (unwind_frame_index), m_thread (thread), m_reg_context_sp (), m_id (pc, cfa, NULL), @@ -79,7 +79,7 @@ const SymbolContext *sc_ptr ) : m_frame_index (frame_idx), - m_unwind_frame_index (unwind_frame_index), + m_concrete_frame_index (unwind_frame_index), m_thread (thread), m_reg_context_sp (reg_context_sp), m_id (pc, cfa, NULL), @@ -115,7 +115,7 @@ const SymbolContext *sc_ptr ) : m_frame_index (frame_idx), - m_unwind_frame_index (unwind_frame_index), + m_concrete_frame_index (unwind_frame_index), m_thread (thread), m_reg_context_sp (reg_context_sp), m_id (pc_addr.GetLoadAddress (&thread.GetProcess().GetTarget()), cfa, NULL), @@ -755,12 +755,12 @@ return m_frame_base_error.Success(); } -RegisterContext * +RegisterContextSP StackFrame::GetRegisterContext () { - if (m_reg_context_sp.get() == NULL) - m_reg_context_sp.reset (m_thread.CreateRegisterContextForFrame (this)); - return m_reg_context_sp.get(); + if (!m_reg_context_sp) + m_reg_context_sp = m_thread.CreateRegisterContextForFrame (this); + return m_reg_context_sp; } bool @@ -916,7 +916,7 @@ m_id.SetPC (curr_frame.m_id.GetPC()); // Update the Stack ID PC value assert (&m_thread == &curr_frame.m_thread); m_frame_index = curr_frame.m_frame_index; - m_unwind_frame_index = curr_frame.m_unwind_frame_index; + m_concrete_frame_index = curr_frame.m_concrete_frame_index; m_reg_context_sp = curr_frame.m_reg_context_sp; m_frame_code_addr = curr_frame.m_frame_code_addr; assert (m_sc.target_sp.get() == NULL || curr_frame.m_sc.target_sp.get() == NULL || m_sc.target_sp.get() == curr_frame.m_sc.target_sp.get()); Modified: lldb/trunk/source/Target/StackFrameList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/StackFrameList.cpp (original) +++ lldb/trunk/source/Target/StackFrameList.cpp Thu Jan 6 16:15:06 2011 @@ -336,6 +336,27 @@ return frame_sp; } +StackFrameSP +StackFrameList::GetFrameWithConcreteFrameIndex (uint32_t unwind_idx) +{ + // First try assuming the unwind index is the same as the frame index. The + // unwind index is always greater than or equal to the frame index, so it + // is a good place to start. If we have inlined frames we might have 5 + // concrete frames (frame unwind indexes go from 0-4), but we might have 15 + // frames after we make all the inlined frames. Most of the time the unwind + // frame index (or the concrete frame index) is the same as the frame index. + uint32_t frame_idx = unwind_idx; + StackFrameSP frame_sp (GetFrameAtIndex (frame_idx)); + while (frame_sp) + { + if (frame_sp->GetFrameIndex() == unwind_idx) + break; + frame_sp = GetFrameAtIndex (++frame_idx); + } + return frame_sp; +} + + bool StackFrameList::SetFrameAtIndex (uint32_t idx, StackFrameSP &frame_sp) { Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Thu Jan 6 16:15:06 2011 @@ -877,6 +877,13 @@ return GetStackFrameList().GetSelectedFrameIndex(); } +lldb::StackFrameSP +Thread::GetFrameWithConcreteFrameIndex (uint32_t unwind_idx) +{ + return GetStackFrameList().GetFrameWithConcreteFrameIndex (unwind_idx); +} + + lldb::StackFrameSP Thread::GetSelectedFrame () Modified: lldb/trunk/source/Target/ThreadPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlan.cpp (original) +++ lldb/trunk/source/Target/ThreadPlan.cpp Thu Jan 6 16:15:06 2011 @@ -149,7 +149,7 @@ if (log) { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); addr_t pc = reg_ctx->GetPC(); addr_t sp = reg_ctx->GetSP(); addr_t fp = reg_ctx->GetFP(); Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Thu Jan 6 16:15:06 2011 @@ -95,7 +95,7 @@ if (log) { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); log->PutCString("Function call was set up. Register state was:"); @@ -214,7 +214,7 @@ if (log) { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); log->PutCString("Function completed. Register state was:"); Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=122976&r1=122975&r2=122976&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Thu Jan 6 16:15:06 2011 @@ -132,9 +132,10 @@ { } -void ThreadPlanAssemblyTracer::TracingStarted () +void +ThreadPlanAssemblyTracer::TracingStarted () { - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); if (m_register_values.size() == 0) { @@ -145,7 +146,8 @@ } } -void ThreadPlanAssemblyTracer::TracingEnded () +void +ThreadPlanAssemblyTracer::TracingEnded () { for (uint32_t reg_index = 0, num_registers = m_register_values.size(); reg_index < num_registers; @@ -153,51 +155,26 @@ m_register_values[reg_index] = 0; } -static const char *Padding(int length) -{ - const int padding_size = 256; - - static char* padding = NULL; - static int prev_length = 256; - - if (!padding) { - padding = new char[padding_size]; - memset(padding, ' ', padding_size); - } - - if (length > 255) - length = 255; - - if (prev_length < 256) - padding[prev_length] = ' '; - - padding[length] = '\0'; - - prev_length = length; - - return padding; -} - -static void PadOutTo(StreamString &stream, int target) +static void +PadOutTo (StreamString &stream, int target) { stream.Flush(); int length = stream.GetString().length(); if (length + 1 < target) - stream.PutCString(Padding(target - (length + 1))); - - stream.PutCString(" "); + stream.Printf("%*s", target - (length + 1) + 1, ""); } -void ThreadPlanAssemblyTracer::Log () +void +ThreadPlanAssemblyTracer::Log () { Stream *stream = GetLogStream (); if (!stream) return; - RegisterContext *reg_ctx = m_thread.GetRegisterContext(); + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); lldb::addr_t pc = reg_ctx->GetPC(); Address pc_addr; From gclayton at apple.com Thu Jan 6 16:35:55 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 06 Jan 2011 22:35:55 -0000 Subject: [Lldb-commits] [lldb] r122981 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h RegisterContextLinux.h RegisterContextLinux_x86_64.cpp RegisterContextLinux_x86_64.h Message-ID: <20110106223555.BA9DC2A6C12C@llvm.org> Author: gclayton Date: Thu Jan 6 16:35:55 2011 New Revision: 122981 URL: http://llvm.org/viewvc/llvm-project?rev=122981&view=rev Log: First try at patching linux for the recent RegisterContext patch. Can someone try and build this and let me know how it goes? Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=122981&r1=122980&r2=122981&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Thu Jan 6 16:35:55 2011 @@ -26,21 +26,8 @@ LinuxThread::LinuxThread(Process &process, lldb::tid_t tid) : Thread(process, tid), m_frame_ap(0), - m_register_ap(0), m_note(eNone) { - ArchSpec arch = process.GetTarget().GetArchitecture(); - - switch (arch.GetGenericCPUType()) - { - default: - assert(false && "CPU type not supported!"); - break; - - case ArchSpec::eCPU_x86_64: - m_register_ap.reset(new RegisterContextLinux_x86_64(*this, NULL)); - break; - } } ProcessMonitor & @@ -61,10 +48,25 @@ return NULL; } -RegisterContextLinux * +lldb::RegisterContextSP LinuxThread::GetRegisterContext() { - return m_register_ap.get(); + if (!m_reg_context_sp) + { + ArchSpec arch = process.GetTarget().GetArchitecture(); + + switch (arch.GetGenericCPUType()) + { + default: + assert(false && "CPU type not supported!"); + break; + + case ArchSpec::eCPU_x86_64: + m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0)); + break; + } + } + return m_reg_context_sp } bool @@ -79,10 +81,19 @@ return false; } -RegisterContextLinux * -LinuxThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) +lldb::RegisterContextSP +LinuxThread::CreateRegisterContextForFrame (lldb_private::StackFrame *frame) { - return new RegisterContextLinux_x86_64(*this, frame); + lldb::RegisterContextSP reg_ctx_sp; + uint32_t concrete_frame_idx = 0; + if (frame) + concrete_frame_idx = frame->GetConcreteFrameIndex(); + + if (concrete_frame_idx == 0) + reg_ctx_sp = GetRegisterContext(); + else + reg_ctx_sp.reset (new RegisterContextLinux_x86_64(*this, frame->GetConcreteFrameIndex())); + return reg_ctx_sp; } lldb::StopInfoSP @@ -159,14 +170,13 @@ { bool status; - status = GetRegisterContext()->UpdateAfterBreakpoint(); + status = GetRegisterContextLinux()->UpdateAfterBreakpoint(); assert(status && "Breakpoint update failed!"); // With our register state restored, resolve the breakpoint object // corresponding to our current PC. lldb::addr_t pc = GetRegisterContext()->GetPC(); - lldb::BreakpointSiteSP bp_site = - GetProcess().GetBreakpointSiteList().FindByAddress(pc); + lldb::BreakpointSiteSP bp_site(GetProcess().GetBreakpointSiteList().FindByAddress(pc)); assert(bp_site && bp_site->ValidForThisThread(this)); m_note = eBreak; Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122981&r1=122980&r2=122981&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Thu Jan 6 16:35:55 2011 @@ -16,9 +16,9 @@ // Other libraries and framework includes #include "lldb/Target/Thread.h" -#include "RegisterContextLinux.h" class ProcessMonitor; +class RegisterContextLinux; //------------------------------------------------------------------------------ // @class LinuxThread @@ -38,17 +38,17 @@ const char * GetInfo(); - RegisterContextLinux * + virtual lldb::RegisterContextSP GetRegisterContext(); - bool + virtual bool SaveFrameZeroState(RegisterCheckpoint &checkpoint); - bool + virtual bool RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); - RegisterContextLinux * - CreateRegisterContextForFrame(lldb_private::StackFrame *frame); + virtual lldb::RegisterContextSP + CreateRegisterContextForFrame (StackFrame *frame); //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. @@ -60,8 +60,16 @@ void ExitNotify(); private: + + RegisterContextLinux * + GetRegisterContextLinux () + { + if (!m_reg_context_sp) + GetRegisterContext(); + return (RegisterContextLinux *)m_reg_context_sp.get() + } + std::auto_ptr m_frame_ap; - std::auto_ptr m_register_ap; lldb::BreakpointSiteSP m_breakpoint; Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h?rev=122981&r1=122980&r2=122981&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h Thu Jan 6 16:35:55 2011 @@ -24,8 +24,8 @@ { public: RegisterContextLinux(lldb_private::Thread &thread, - lldb_private::StackFrame *frame) - : RegisterContext(thread, frame) { } + uint32_t concrete_frame_idx) + : RegisterContext(thread, concrete_frame_idx) { } /// Updates the register state of the associated thread after hitting a /// breakpoint (if that make sense for the architecture). Default Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=122981&r1=122980&r2=122981&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Thu Jan 6 16:35:55 2011 @@ -402,8 +402,8 @@ } RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(Thread &thread, - StackFrame *frame) - : RegisterContextLinux(thread, frame) + uint32_t concrete_frame_idx) + : RegisterContextLinux(thread, concrete_frame_idx) { } Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h?rev=122981&r1=122980&r2=122981&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h Thu Jan 6 16:35:55 2011 @@ -18,8 +18,8 @@ : public RegisterContextLinux { public: - RegisterContextLinux_x86_64(lldb_private::Thread &thread, - lldb_private::StackFrame *frame); + RegisterContextLinux_x86_64 (lldb_private::Thread &thread, + uint32_t concrete_frame_idx); ~RegisterContextLinux_x86_64(); From wilsons at start.ca Thu Jan 6 17:19:12 2011 From: wilsons at start.ca (Stephen Wilson) Date: Thu, 06 Jan 2011 18:19:12 -0500 Subject: [Lldb-commits] [lldb] r122981 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h RegisterContextLinux.h RegisterContextLinux_x86_64.cpp RegisterContextLinux_x86_64.h In-Reply-To: <20110106223555.BA9DC2A6C12C@llvm.org> (Greg Clayton's message of "Thu, 06 Jan 2011 22:35:55 -0000") References: <20110106223555.BA9DC2A6C12C@llvm.org> Message-ID: Hi Greg, Greg Clayton writes: > First try at patching linux for the recent RegisterContext patch. Can someone > try and build this and let me know how it goes? I think we need the following as well. Note that I changed a CalculateProcess() call to GetProcess() as I think that is the standard access API (as opposed to using the inherited m_process member directly)? diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp index 725cc5a..e189064 100644 --- a/source/Plugins/Process/Linux/LinuxThread.cpp +++ b/source/Plugins/Process/Linux/LinuxThread.cpp @@ -33,8 +33,8 @@ LinuxThread::LinuxThread(Process &process, lldb::tid_t tid) ProcessMonitor & LinuxThread::GetMonitor() { - ProcessLinux *process = static_cast(CalculateProcess()); - return process->GetMonitor(); + ProcessLinux &process = static_cast(GetProcess()); + return process.GetMonitor(); } void @@ -51,6 +51,8 @@ LinuxThread::GetInfo() lldb::RegisterContextSP LinuxThread::GetRegisterContext() { + ProcessLinux &process = static_cast(GetProcess()); + if (!m_reg_context_sp) { ArchSpec arch = process.GetTarget().GetArchitecture(); @@ -66,7 +68,7 @@ LinuxThread::GetRegisterContext() break; } } - return m_reg_context_sp + return m_reg_context_sp; } bool diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h index a87e5ca..4dcdbb3 100644 --- a/source/Plugins/Process/Linux/LinuxThread.h +++ b/source/Plugins/Process/Linux/LinuxThread.h @@ -48,7 +48,7 @@ public: RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); virtual lldb::RegisterContextSP - CreateRegisterContextForFrame (StackFrame *frame); + CreateRegisterContextForFrame (lldb_private::StackFrame *frame); //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. @@ -66,7 +66,7 @@ private: { if (!m_reg_context_sp) GetRegisterContext(); - return (RegisterContextLinux *)m_reg_context_sp.get() + return (RegisterContextLinux *)m_reg_context_sp.get(); } std::auto_ptr m_frame_ap; From gclayton at apple.com Thu Jan 6 17:34:44 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 6 Jan 2011 15:34:44 -0800 Subject: [Lldb-commits] [lldb] r122981 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h RegisterContextLinux.h RegisterContextLinux_x86_64.cpp RegisterContextLinux_x86_64.h In-Reply-To: References: <20110106223555.BA9DC2A6C12C@llvm.org> Message-ID: <81893D96-DD15-4C62-B2A8-2F74D34664A9@apple.com> The CalculateProcess is part of the ExecutionContextScope. Anyone who inherits from this class must implement the 5 functions it requires, but basically it allows you to pass one pointer around that knows how to reconstruct any of the target, process, thread, and frame. In the "lldb_private::Thread" case, it knows how to reconstruct an "ExecutionContext" that contains a target, process and thread. Using GetProcess is fine where you have done so. The changes look good. On Jan 6, 2011, at 3:19 PM, Stephen Wilson wrote: > > Hi Greg, > > Greg Clayton writes: >> First try at patching linux for the recent RegisterContext patch. Can someone >> try and build this and let me know how it goes? > > I think we need the following as well. Note that I changed a > CalculateProcess() call to GetProcess() as I think that is the standard > access API (as opposed to using the inherited m_process member > directly)? > > > > diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp > index 725cc5a..e189064 100644 > --- a/source/Plugins/Process/Linux/LinuxThread.cpp > +++ b/source/Plugins/Process/Linux/LinuxThread.cpp > @@ -33,8 +33,8 @@ LinuxThread::LinuxThread(Process &process, lldb::tid_t tid) > ProcessMonitor & > LinuxThread::GetMonitor() > { > - ProcessLinux *process = static_cast(CalculateProcess()); > - return process->GetMonitor(); > + ProcessLinux &process = static_cast(GetProcess()); > + return process.GetMonitor(); > } > > void > @@ -51,6 +51,8 @@ LinuxThread::GetInfo() > lldb::RegisterContextSP > LinuxThread::GetRegisterContext() > { > + ProcessLinux &process = static_cast(GetProcess()); > + > if (!m_reg_context_sp) > { > ArchSpec arch = process.GetTarget().GetArchitecture(); > @@ -66,7 +68,7 @@ LinuxThread::GetRegisterContext() > break; > } > } > - return m_reg_context_sp > + return m_reg_context_sp; > } > > bool > diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h > index a87e5ca..4dcdbb3 100644 > --- a/source/Plugins/Process/Linux/LinuxThread.h > +++ b/source/Plugins/Process/Linux/LinuxThread.h > @@ -48,7 +48,7 @@ public: > RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); > > virtual lldb::RegisterContextSP > - CreateRegisterContextForFrame (StackFrame *frame); > + CreateRegisterContextForFrame (lldb_private::StackFrame *frame); > > //-------------------------------------------------------------------------- > // These methods form a specialized interface to linux threads. > @@ -66,7 +66,7 @@ private: > { > if (!m_reg_context_sp) > GetRegisterContext(); > - return (RegisterContextLinux *)m_reg_context_sp.get() > + return (RegisterContextLinux *)m_reg_context_sp.get(); > } > > std::auto_ptr m_frame_ap; From wilsons at start.ca Thu Jan 6 18:10:43 2011 From: wilsons at start.ca (Stephen Wilson) Date: Fri, 07 Jan 2011 00:10:43 -0000 Subject: [Lldb-commits] [lldb] r122984 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h Message-ID: <20110107001043.9BC292A6C12C@llvm.org> Author: wilsons Date: Thu Jan 6 18:10:43 2011 New Revision: 122984 URL: http://llvm.org/viewvc/llvm-project?rev=122984&view=rev Log: Fix a few small issues in r122981 to ensure compilation on Linux. Also, call GetProcess instead of CalculateProcess as the latter is morally part of the ExecutionContextScope API. Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=122984&r1=122983&r2=122984&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Thu Jan 6 18:10:43 2011 @@ -33,8 +33,8 @@ ProcessMonitor & LinuxThread::GetMonitor() { - ProcessLinux *process = static_cast(CalculateProcess()); - return process->GetMonitor(); + ProcessLinux &process = static_cast(GetProcess()); + return process.GetMonitor(); } void @@ -51,6 +51,8 @@ lldb::RegisterContextSP LinuxThread::GetRegisterContext() { + ProcessLinux &process = static_cast(GetProcess()); + if (!m_reg_context_sp) { ArchSpec arch = process.GetTarget().GetArchitecture(); @@ -66,7 +68,7 @@ break; } } - return m_reg_context_sp + return m_reg_context_sp; } bool Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=122984&r1=122983&r2=122984&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Thu Jan 6 18:10:43 2011 @@ -48,7 +48,7 @@ RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); virtual lldb::RegisterContextSP - CreateRegisterContextForFrame (StackFrame *frame); + CreateRegisterContextForFrame (lldb_private::StackFrame *frame); //-------------------------------------------------------------------------- // These methods form a specialized interface to linux threads. @@ -66,7 +66,7 @@ { if (!m_reg_context_sp) GetRegisterContext(); - return (RegisterContextLinux *)m_reg_context_sp.get() + return (RegisterContextLinux *)m_reg_context_sp.get(); } std::auto_ptr m_frame_ap; From johnny.chen at apple.com Thu Jan 6 18:17:44 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 07 Jan 2011 00:17:44 -0000 Subject: [Lldb-commits] [lldb] r122985 - /lldb/trunk/test/help/TestHelp.py Message-ID: <20110107001744.2EEB22A6C12C@llvm.org> Author: johnny Date: Thu Jan 6 18:17:44 2011 New Revision: 122985 URL: http://llvm.org/viewvc/llvm-project?rev=122985&view=rev Log: Print out a more meaningful exception message when/if CFBundleVersion matching failed. Modified: lldb/trunk/test/help/TestHelp.py Modified: lldb/trunk/test/help/TestHelp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=122985&r1=122984&r2=122985&view=diff ============================================================================== --- lldb/trunk/test/help/TestHelp.py (original) +++ lldb/trunk/test/help/TestHelp.py Thu Jan 6 18:17:44 2011 @@ -45,7 +45,8 @@ except: # Just fallthrough... - print "Unexpected error:", sys.exc_info()[0] + import traceback + traceback.print_exc() pass # Use None to signify that we are not able to grok the version number. From gclayton at apple.com Thu Jan 6 19:57:07 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 07 Jan 2011 01:57:07 -0000 Subject: [Lldb-commits] [lldb] r122989 - in /lldb/trunk: include/lldb/Target/Target.h source/Core/Address.cpp source/Core/Disassembler.cpp source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp source/Target/Target.cpp Message-ID: <20110107015707.98B622A6C12C@llvm.org> Author: gclayton Date: Thu Jan 6 19:57:07 2011 New Revision: 122989 URL: http://llvm.org/viewvc/llvm-project?rev=122989&view=rev Log: Added the ability for Target::ReadMemory to prefer to read from the file cache even when a valid process exists. Previously, Target::ReadMemory would read from the process if there was a valid one and then fallback to the object file cache. Modified: lldb/trunk/include/lldb/Target/Target.h lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=122989&r1=122988&r2=122989&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Thu Jan 6 19:57:07 2011 @@ -401,12 +401,27 @@ GetTargetTriple (ConstString &target_triple); size_t + ReadMemoryFromFileCache (const Address& addr, + void *dst, + size_t dst_len, + Error &error); + + // Reading memory through the target allows us to skip going to the process + // for reading memory if possible and it allows us to try and read from + // any constant sections in our object files on disk. If you always want + // live program memory, read straight from the process. If you possibly + // want to read from const sections in object files, read from the target. + // This version of ReadMemory will try and read memory from the process + // if the process is alive. The order is: + // 1 - if (prefer_file_cache == true) then read from object file cache + // 2 - if there is a valid process, try and read from its memory + // 3 - if (prefer_file_cache == false) then read from object file cache + size_t ReadMemory (const Address& addr, + bool prefer_file_cache, void *dst, size_t dst_len, Error &error); - - SectionLoadList& GetSectionLoadList() Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=122989&r1=122988&r2=122989&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Thu Jan 6 19:57:07 2011 @@ -68,7 +68,8 @@ if (target) { Error error; - return target->ReadMemory (address, dst, dst_len, error); + bool prefer_file_cache = false; + return target->ReadMemory (address, prefer_file_cache, dst, dst_len, error); } return 0; } Modified: lldb/trunk/source/Core/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=122989&r1=122988&r2=122989&view=diff ============================================================================== --- lldb/trunk/source/Core/Disassembler.cpp (original) +++ lldb/trunk/source/Core/Disassembler.cpp Thu Jan 6 19:57:07 2011 @@ -422,7 +422,8 @@ DataBufferSP data_sp(heap_buffer); Error error; - const size_t bytes_read = target->ReadMemory (range.GetBaseAddress(), heap_buffer->GetBytes(), heap_buffer->GetByteSize(), error); + bool prefer_file_cache = true; + const size_t bytes_read = target->ReadMemory (range.GetBaseAddress(), prefer_file_cache, heap_buffer->GetBytes(), heap_buffer->GetByteSize(), error); if (bytes_read > 0) { Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=122989&r1=122988&r2=122989&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Thu Jan 6 19:57:07 2011 @@ -470,7 +470,8 @@ uint8_t onebyte_buf[1]; Error error; - if (target->ReadMemory (read_addr, onebyte_buf, 1, error) != -1) + const bool prefer_file_cache = true; + if (target->ReadMemory (read_addr, prefer_file_cache, onebyte_buf, 1, error) != -1) { *buf = onebyte_buf[0]; return 0; @@ -550,6 +551,7 @@ row.SetRegisterInfo (m_lldb_ip_regnum, initial_regloc); unwind_plan.AppendRow (row); + const bool prefer_file_cache = true; while (m_func_bounds.ContainsFileAddress (m_cur_insn) && non_prologue_insn_count < 10) { @@ -562,7 +564,7 @@ // An unrecognized/junk instruction break; } - if (m_target.ReadMemory (m_cur_insn, m_cur_insn_bytes, insn_len, error) == -1) + if (m_target.ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1) { // Error reading the instruction out of the file, stop scanning break; @@ -672,7 +674,7 @@ Address last_insn (m_func_bounds.GetBaseAddress()); last_insn.SetOffset (last_insn.GetOffset() + m_func_bounds.GetByteSize() - 1); uint8_t bytebuf[1]; - if (m_target.ReadMemory (last_insn, bytebuf, 1, error) != -1) + if (m_target.ReadMemory (last_insn, prefer_file_cache, bytebuf, 1, error) != -1) { if (bytebuf[0] == 0xc3) // ret aka retq { @@ -723,7 +725,8 @@ uint8_t bytebuf[4]; Error error; - if (m_target.ReadMemory (func.GetBaseAddress(), bytebuf, sizeof (bytebuf), error) == -1) + const bool prefer_file_cache = true; + if (m_target.ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, sizeof (bytebuf), error) == -1) return false; uint8_t i386_prologue[] = {0x55, 0x89, 0xe5}; @@ -781,6 +784,7 @@ return false; } + const bool prefer_file_cache = true; while (m_func_bounds.ContainsFileAddress (m_cur_insn)) { Error error; @@ -790,7 +794,7 @@ // An error parsing the instruction, i.e. probably data/garbage - stop scanning break; } - if (m_target.ReadMemory (m_cur_insn, m_cur_insn_bytes, insn_len, error) == -1) + if (m_target.ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1) { // Error reading the instruction out of the file, stop scanning break; Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=122989&r1=122988&r2=122989&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Jan 6 19:57:07 2011 @@ -589,12 +589,43 @@ } size_t -Target::ReadMemory (const Address& addr, void *dst, size_t dst_len, Error &error) +Target::ReadMemoryFromFileCache (const Address& addr, void *dst, size_t dst_len, Error &error) { - error.Clear(); + const Section *section = addr.GetSection(); + if (section && section->GetModule()) + { + ObjectFile *objfile = section->GetModule()->GetObjectFile(); + if (objfile) + { + size_t bytes_read = section->ReadSectionDataFromObjectFile (objfile, + addr.GetOffset(), + dst, + dst_len); + if (bytes_read > 0) + return bytes_read; + else + error.SetErrorStringWithFormat("error reading data from section %s", section->GetName().GetCString()); + } + else + { + error.SetErrorString("address isn't from a object file"); + } + } + else + { + error.SetErrorString("address doesn't contain a section that points to a section in a object file"); + } + return 0; +} +size_t +Target::ReadMemory (const Address& addr, bool prefer_file_cache, void *dst, size_t dst_len, Error &error) +{ + error.Clear(); + bool process_is_valid = m_process_sp && m_process_sp->IsAlive(); + size_t bytes_read = 0; Address resolved_addr(addr); if (!resolved_addr.IsSectionOffset()) { @@ -608,6 +639,12 @@ } } + if (prefer_file_cache) + { + bytes_read = ReadMemoryFromFileCache (resolved_addr, dst, dst_len, error); + if (bytes_read > 0) + return bytes_read; + } if (process_is_valid) { @@ -623,7 +660,7 @@ } else { - size_t bytes_read = m_process_sp->ReadMemory(load_addr, dst, dst_len, error); + bytes_read = m_process_sp->ReadMemory(load_addr, dst, dst_len, error); if (bytes_read != dst_len) { if (error.Success()) @@ -646,14 +683,11 @@ } } - const Section *section = resolved_addr.GetSection(); - if (section && section->GetModule()) + if (!prefer_file_cache) { - ObjectFile *objfile = section->GetModule()->GetObjectFile(); - return section->ReadSectionDataFromObjectFile (objfile, - resolved_addr.GetOffset(), - dst, - dst_len); + // If we didn't already try and read from the object file cache, then + // try it after failing to read from the process. + return ReadMemoryFromFileCache (resolved_addr, dst, dst_len, error); } return 0; } From bruce.mitchener at gmail.com Thu Jan 6 23:58:51 2011 From: bruce.mitchener at gmail.com (Bruce Mitchener) Date: Fri, 7 Jan 2011 12:58:51 +0700 Subject: [Lldb-commits] [Patch] fix typos on website Message-ID: Minor patch, but this fixes a couple of spelling errors on the website. Cheers! - Bruce -------------- next part -------------- A non-text attachment was scrubbed... Name: lldb_www.diff Type: application/octet-stream Size: 1570 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20110107/6b6a47f9/attachment.obj From gclayton at apple.com Fri Jan 7 00:08:19 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 07 Jan 2011 06:08:19 -0000 Subject: [Lldb-commits] [lldb] r122996 - in /lldb/trunk: include/lldb/Target/Process.h source/Plugins/Process/Utility/UnwindLLDB.cpp source/Plugins/Process/Utility/UnwindLLDB.h source/Target/Process.cpp Message-ID: <20110107060819.84D0F2A6C12C@llvm.org> Author: gclayton Date: Fri Jan 7 00:08:19 2011 New Revision: 122996 URL: http://llvm.org/viewvc/llvm-project?rev=122996&view=rev Log: Added memory caching to lldb_private::Process. All lldb_private::Process subclasses will automatically be able to take advantage of caching. The cache line size is set to 512 by default. This greatly speeds up stack backtraces on MacOSX when using the ProcessGDBRemote process plug-in since only about 6300 packets per second can be sent. Initial speedups show: Prior to caching: 10,000 stack frames took 5.2 seconds After caching: 10,000 stack frames in 240 ms! About a 20x speedup! Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=122996&r1=122995&r2=122996&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Fri Jan 7 00:08:19 2011 @@ -1336,6 +1336,12 @@ size_t size, Error &error); + size_t + ReadMemoryFromInferior (lldb::addr_t vm_addr, + void *buf, + size_t size, + Error &error); + //------------------------------------------------------------------ /// Reads an unsigned integer of the specified byte size from /// process memory. @@ -1769,6 +1775,43 @@ GetSP (); protected: + class MemoryCache + { + public: + //------------------------------------------------------------------ + // Constructors and Destructors + //------------------------------------------------------------------ + MemoryCache (); + + ~MemoryCache (); + + void + Clear(); + + void + Flush (lldb::addr_t addr, size_t size); + + size_t + Read (Process *process, + lldb::addr_t addr, + void *dst, + size_t dst_len, + Error &error); + + protected: + typedef std::map collection; + //------------------------------------------------------------------ + // Classes that inherit from MemoryCache can see and modify these + //------------------------------------------------------------------ + uint32_t m_cache_line_byte_size; + Mutex m_cache_mutex; + collection m_cache; + + private: + DISALLOW_COPY_AND_ASSIGN (MemoryCache); + }; + + //------------------------------------------------------------------ // Member variables //------------------------------------------------------------------ @@ -1800,7 +1843,8 @@ lldb_private::Communication m_stdio_communication; lldb_private::Mutex m_stdio_communication_mutex; std::string m_stdout_data; - + MemoryCache m_memory_cache; + typedef std::map LanguageRuntimeCollection; LanguageRuntimeCollection m_language_runtimes; 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=122996&r1=122995&r2=122996&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Jan 7 00:08:19 2011 @@ -33,10 +33,24 @@ { if (m_frames.empty()) { +//#define DEBUG_FRAME_SPEED 1 +#if DEBUG_FRAME_SPEED + TimeValue time_value (TimeValue::Now()); +#endif if (!AddFirstFrame ()) return 0; while (AddOneMoreFrame ()) - ; + { +#if DEBUG_FRAME_SPEED + if ((m_frames.size() % 10000) == 0) + { + TimeValue now(TimeValue::Now()); + uint64_t delta_t = now - time_value; + printf ("10000 frames in %llu.%09llu ms\n", delta_t / NSEC_PER_SEC, delta_t % NSEC_PER_SEC); + time_value = now; + } +#endif + } } return m_frames.size (); } 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=122996&r1=122995&r2=122996&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Fri Jan 7 00:08:19 2011 @@ -72,6 +72,6 @@ DISALLOW_COPY_AND_ASSIGN (UnwindLLDB); }; -} +} // namespace lldb_private #endif // lldb_UnwindLLDB_h_ Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=122996&r1=122995&r2=122996&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jan 7 00:08:19 2011 @@ -37,6 +37,145 @@ using namespace lldb; using namespace lldb_private; + +//---------------------------------------------------------------------- +// MemoryCache constructor +//---------------------------------------------------------------------- +Process::MemoryCache::MemoryCache() : + m_cache_line_byte_size (512), + m_cache_mutex (Mutex::eMutexTypeRecursive), + m_cache () +{ +} + +//---------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------- +Process::MemoryCache::~MemoryCache() +{ +} + +void +Process::MemoryCache::Clear() +{ + Mutex::Locker locker (m_cache_mutex); + m_cache.clear(); +} + +void +Process::MemoryCache::Flush (addr_t addr, size_t size) +{ + if (size == 0) + return; + + const uint32_t cache_line_byte_size = m_cache_line_byte_size; + const addr_t end_addr = (addr + size - 1); + const addr_t flush_start_addr = addr - (addr % cache_line_byte_size); + const addr_t flush_end_addr = end_addr - (end_addr % cache_line_byte_size); + + Mutex::Locker locker (m_cache_mutex); + if (m_cache.empty()) + return; + + assert ((flush_start_addr % cache_line_byte_size) == 0); + + for (addr_t curr_addr = flush_start_addr; curr_addr <= flush_end_addr; curr_addr += cache_line_byte_size) + { + collection::iterator pos = m_cache.find (curr_addr); + if (pos != m_cache.end()) + m_cache.erase(pos); + } +} + +size_t +Process::MemoryCache::Read +( + Process *process, + addr_t addr, + void *dst, + size_t dst_len, + Error &error +) +{ + size_t bytes_left = dst_len; + if (dst && bytes_left > 0) + { + const uint32_t cache_line_byte_size = m_cache_line_byte_size; + uint8_t *dst_buf = (uint8_t *)dst; + addr_t curr_addr = addr - (addr % cache_line_byte_size); + addr_t cache_offset = addr - curr_addr; + Mutex::Locker locker (m_cache_mutex); + + while (bytes_left > 0) + { + collection::const_iterator pos = m_cache.find (curr_addr); + collection::const_iterator end = m_cache.end (); + + if (pos != end) + { + size_t curr_read_size = cache_line_byte_size - cache_offset; + if (curr_read_size > bytes_left) + curr_read_size = bytes_left; + + memcpy (dst_buf + dst_len - bytes_left, pos->second->GetBytes() + cache_offset, curr_read_size); + + bytes_left -= curr_read_size; + curr_addr += curr_read_size + cache_offset; + cache_offset = 0; + + if (bytes_left > 0) + { + // Get sequential cache page hits + for (++pos; (pos != end) && (bytes_left > 0); ++pos) + { + assert ((curr_addr % cache_line_byte_size) == 0); + + if (pos->first != curr_addr) + break; + + curr_read_size = pos->second->GetByteSize(); + if (curr_read_size > bytes_left) + curr_read_size = bytes_left; + + memcpy (dst_buf + dst_len - bytes_left, pos->second->GetBytes(), curr_read_size); + + bytes_left -= curr_read_size; + curr_addr += curr_read_size; + + // We have a cache page that succeeded to read some bytes + // but not an entire page. If this happens, we must cap + // off how much data we are able to read... + if (pos->second->GetByteSize() != cache_line_byte_size) + return dst_len - bytes_left; + } + } + } + + // We need to read from the process + + if (bytes_left > 0) + { + assert ((curr_addr % cache_line_byte_size) == 0); + std::auto_ptr data_buffer_heap_ap(new DataBufferHeap (cache_line_byte_size, 0)); + size_t process_bytes_read = process->ReadMemoryFromInferior (curr_addr, + data_buffer_heap_ap->GetBytes(), + data_buffer_heap_ap->GetByteSize(), + error); + if (process_bytes_read == 0) + return dst_len - bytes_left; + + if (process_bytes_read != cache_line_byte_size) + data_buffer_heap_ap->SetByteSize (process_bytes_read); + m_cache[curr_addr] = DataBufferSP (data_buffer_heap_ap.release()); + // We have read data and put it into the cache, continue through the + // loop again to get the data out of the cache... + } + } + } + + return dst_len - bytes_left; +} + Process* Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener) { @@ -97,7 +236,8 @@ m_process_input_reader (), m_stdio_communication ("lldb.process.stdio"), m_stdio_communication_mutex (Mutex::eMutexTypeRecursive), - m_stdout_data () + m_stdout_data (), + m_memory_cache () { UpdateInstanceName(); @@ -508,6 +648,7 @@ if (StateIsStoppedState(new_state)) { m_stop_id++; + m_memory_cache.Clear(); if (log) log->Printf("Process::SetPrivateState (%s) stop_id = %u", StateAsCString(new_state), m_stop_id); } @@ -1043,10 +1184,68 @@ } +// Comment out line below to disable memory caching +#define ENABLE_MEMORY_CACHING +// Uncomment to verify memory caching works after making changes to caching code +//#define VERIFY_MEMORY_READS + +#if defined (ENABLE_MEMORY_CACHING) + +#if defined (VERIFY_MEMORY_READS) size_t Process::ReadMemory (addr_t addr, void *buf, size_t size, Error &error) { + // Memory caching is enabled, with debug verification + if (buf && size) + { + // Uncomment the line below to make sure memory caching is working. + // I ran this through the test suite and got no assertions, so I am + // pretty confident this is working well. If any changes are made to + // memory caching, uncomment the line below and test your changes! + + // Verify all memory reads by using the cache first, then redundantly + // reading the same memory from the inferior and comparing to make sure + // everything is exactly the same. + std::string verify_buf (size, '\0'); + assert (verify_buf.size() == size); + const size_t cache_bytes_read = m_memory_cache.Read (this, addr, buf, size, error); + Error verify_error; + const size_t verify_bytes_read = ReadMemoryFromInferior (addr, const_cast(verify_buf.data()), verify_buf.size(), verify_error); + assert (cache_bytes_read == verify_bytes_read); + assert (memcmp(buf, verify_buf.data(), verify_buf.size()) == 0); + assert (verify_error.Success() == error.Success()); + return cache_bytes_read; + } + return 0; +} + +#else // #if defined (VERIFY_MEMORY_READS) + +size_t +Process::ReadMemory (addr_t addr, void *buf, size_t size, Error &error) +{ + // Memory caching enabled, no verification + return m_memory_cache.Read (this, addr, buf, size, error); +} + +#endif // #else for #if defined (VERIFY_MEMORY_READS) + +#else // #if defined (ENABLE_MEMORY_CACHING) + +size_t +Process::ReadMemory (addr_t addr, void *buf, size_t size, Error &error) +{ + // Memory caching is disabled + return ReadMemoryFromInferior (addr, buf, size, error); +} + +#endif // #else for #if defined (ENABLE_MEMORY_CACHING) + + +size_t +Process::ReadMemoryFromInferior (addr_t addr, void *buf, size_t size, Error &error) +{ if (buf == NULL || size == 0) return 0; @@ -1118,6 +1317,10 @@ size_t Process::WriteMemory (addr_t addr, const void *buf, size_t size, Error &error) { +#if defined (ENABLE_MEMORY_CACHING) + m_memory_cache.Flush (addr, size); +#endif + if (buf == NULL || size == 0) return 0; // We need to write any data that would go where any current software traps From ctice at apple.com Fri Jan 7 11:16:03 2011 From: ctice at apple.com (Caroline Tice) Date: Fri, 07 Jan 2011 17:16:03 -0000 Subject: [Lldb-commits] [lldb] r123002 - /lldb/trunk/www/architecture.html Message-ID: <20110107171604.0BD582A6C12C@llvm.org> Author: ctice Date: Fri Jan 7 11:16:03 2011 New Revision: 123002 URL: http://llvm.org/viewvc/llvm-project?rev=123002&view=rev Log: Apply patch from Bruce Mitchener to fix spelling errors. Modified: lldb/trunk/www/architecture.html Modified: lldb/trunk/www/architecture.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/architecture.html?rev=123002&r1=123001&r2=123002&view=diff ============================================================================== --- lldb/trunk/www/architecture.html (original) +++ lldb/trunk/www/architecture.html Fri Jan 7 11:16:03 2011 @@ -59,7 +59,7 @@
  • Classes can't inherit from any other classes.
  • Classes can't contain virtual methods.
  • Classes should be compatible with script bridging utilities like swig.
  • -
  • Classes should be lighweight and be backed by a single object pointer, shared pointer or global variable in the lldb_private.
  • +
  • Classes should be lightweight and be backed by a single object pointer, shared pointer or global variable in the lldb_private.
  • The interface should be as minimal as possible in order to give a complete API.
  • By adhering to these rules we should be able to continue to @@ -104,7 +104,7 @@ or lldb_private::CommandObjectMultiword object.

    lldb_private::CommandObjectMultiword are commands that have subcommands and allow command line commands to be - logically grouped into a hiearchy.

    + logically grouped into a hierarchy.

    lldb_private::CommandObject command line commands are the objects that implement the functionality of the command. They can optionally define From johnny.chen at apple.com Fri Jan 7 14:34:32 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 07 Jan 2011 20:34:32 -0000 Subject: [Lldb-commits] [lldb] r123029 - /lldb/trunk/test/class_types/TestClassTypesDisassembly.py Message-ID: <20110107203432.96D592A6C12C@llvm.org> Author: johnny Date: Fri Jan 7 14:34:32 2011 New Revision: 123029 URL: http://llvm.org/viewvc/llvm-project?rev=123029&view=rev Log: Modify disassemble_call_stack_python() to not rely on the "disassemble -n function_name" command to do the disassembly. Instead, use the Python API. Modified: lldb/trunk/test/class_types/TestClassTypesDisassembly.py Modified: lldb/trunk/test/class_types/TestClassTypesDisassembly.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypesDisassembly.py?rev=123029&r1=123028&r2=123029&view=diff ============================================================================== --- lldb/trunk/test/class_types/TestClassTypesDisassembly.py (original) +++ lldb/trunk/test/class_types/TestClassTypesDisassembly.py Fri Jan 7 14:34:32 2011 @@ -96,7 +96,15 @@ for i in range(depth - 1): frame = thread.GetFrameAtIndex(i) function = frame.GetFunction() - self.runCmd("disassemble -n '%s'" % function.GetName()) + # Print the function header. + print + print function + if function.IsValid(): + # Get all instructions for this function and print them out. + insts = function.GetInstructions(target) + from lldbutil import lldb_iter + for i in lldb_iter(insts, 'GetSize', 'GetInstructionAtIndex'): + print i if __name__ == '__main__': From gclayton at apple.com Fri Jan 7 16:10:25 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 07 Jan 2011 22:10:25 -0000 Subject: [Lldb-commits] [lldb] r123037 - in /lldb/trunk/test/recurse: ./ Makefile main.c Message-ID: <20110107221025.EA7772A6C12C@llvm.org> Author: gclayton Date: Fri Jan 7 16:10:25 2011 New Revision: 123037 URL: http://llvm.org/viewvc/llvm-project?rev=123037&view=rev Log: Added a recursive loop stress test for the unwinder. Not a real world test by any means, but something to stress test our unwinder with 260,000+ frames on a standard darwin thread. Added: lldb/trunk/test/recurse/ lldb/trunk/test/recurse/Makefile lldb/trunk/test/recurse/main.c Added: lldb/trunk/test/recurse/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/recurse/Makefile?rev=123037&view=auto ============================================================================== --- lldb/trunk/test/recurse/Makefile (added) +++ lldb/trunk/test/recurse/Makefile Fri Jan 7 16:10:25 2011 @@ -0,0 +1,5 @@ +LEVEL = ../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/recurse/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/recurse/main.c?rev=123037&view=auto ============================================================================== --- lldb/trunk/test/recurse/main.c (added) +++ lldb/trunk/test/recurse/main.c Fri Jan 7 16:10:25 2011 @@ -0,0 +1,28 @@ +#include +#include + +uint32_t +recurse_crash (uint32_t depth) +{ + if (depth > 0) + return recurse_crash (depth - 1); + return 0; +} + +int +main (int argc, char const *argv[]) +{ + // If we have more than one argument, then it should a depth to recurse to. + // If we have just the program name as an argument, use UINT32_MAX so we + // eventually crash the program by overflowing the stack + uint32_t depth = UINT32_MAX; + if (argc > 1) + { + char *end = NULL; + depth = strtoul (argv[1], &end, 0); + if (end == NULL || *end != '\0') + depth = UINT32_MAX; + } + recurse_crash (depth); + return 0; +} \ No newline at end of file From gclayton at apple.com Fri Jan 7 18:05:13 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 00:05:13 -0000 Subject: [Lldb-commits] [lldb] r123045 - in /lldb/trunk: include/lldb/Core/Address.h include/lldb/Symbol/FuncUnwinders.h include/lldb/Symbol/UnwindTable.h source/Core/Address.cpp source/Symbol/FuncUnwinders.cpp source/Symbol/UnwindTable.cpp Message-ID: <20110108000513.1E4292A6C12C@llvm.org> Author: gclayton Date: Fri Jan 7 18:05:12 2011 New Revision: 123045 URL: http://llvm.org/viewvc/llvm-project?rev=123045&view=rev Log: Fixed issues with the unwinding code where the collection of FuncUnwinders was being searched and sorted using a shared pointer as the value which means the pointer value was what was being searched for. This means that anytime you did a stack backtrace, the collection of FuncUnwinders doubled and then the array or shared pointer got sorted (by pointer value), so you had an ever increasing collection of shared pointer where a match was never found. This means we had a ton of duplicates in this table and would cause issues after one had been debugging for a long time. Modified: lldb/trunk/include/lldb/Core/Address.h lldb/trunk/include/lldb/Symbol/FuncUnwinders.h lldb/trunk/include/lldb/Symbol/UnwindTable.h lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/UnwindTable.cpp Modified: lldb/trunk/include/lldb/Core/Address.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Address.h (original) +++ lldb/trunk/include/lldb/Core/Address.h Fri Jan 7 18:05:12 2011 @@ -434,15 +434,29 @@ lldb::addr_t m_offset; ///< Offset into section if \a m_section != NULL, else the absolute address value. }; -//bool operator< (const Address& lhs, const Address& rhs); -//bool operator<= (const Address& lhs, const Address& rhs); -//bool operator> (const Address& lhs, const Address& rhs); -//bool operator>= (const Address& lhs, const Address& rhs); + +//---------------------------------------------------------------------- +// NOTE: Be careful using this operator. It can correctly compare two +// addresses from the same Module correctly. It can't compare two +// addresses from different modules in any meaningful way, but it will +// compare the module pointers. +// +// To sum things up: +// - works great for addresses within the same module +// - it works for addresses across multiple modules, but don't expect the +// address results to make much sense +// +// This basically lets Address objects be used in ordered collection +// classes. +//---------------------------------------------------------------------- +bool operator< (const Address& lhs, const Address& rhs); +bool operator> (const Address& lhs, const Address& rhs); + + + bool operator== (const Address& lhs, const Address& rhs); bool operator!= (const Address& lhs, const Address& rhs); -//Stream& operator << (Stream& strm, const Address& so_addr); - } // namespace lldb_private #endif // liblldb_Address_h_ Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original) +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Fri Jan 7 18:05:12 2011 @@ -72,26 +72,22 @@ UnwindAssemblyProfiler *m_assembly_profiler; AddressRange m_range; - UnwindPlan* m_unwind_at_call_site; - UnwindPlan* m_unwind_at_non_call_site; - UnwindPlan* m_fast_unwind; - UnwindPlan* m_arch_default_unwind; - + std::auto_ptr m_unwind_at_call_site_ap; + std::auto_ptr m_unwind_at_non_call_site_ap; + std::auto_ptr m_fast_unwind_ap; + UnwindPlan *m_arch_default_unwind; + + bool m_tried_unwind_at_call_site:1, + m_tried_unwind_at_non_call_site:1, + m_tried_fast_unwind:1, + m_tried_arch_default_unwind:1; + Address m_first_non_prologue_insn; DISALLOW_COPY_AND_ASSIGN (FuncUnwinders); }; // class FuncUnwinders -inline bool -operator<(const FuncUnwinders& a, const FuncUnwinders& b) -{ - if (a.GetFunctionStartAddress().GetOffset() < b.GetFunctionStartAddress().GetOffset()) - return true; - else - return false; -} - } // namespace lldb_private Modified: lldb/trunk/include/lldb/Symbol/UnwindTable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindTable.h?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindTable.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindTable.h Fri Jan 7 18:05:12 2011 @@ -11,7 +11,7 @@ #ifndef liblldb_UnwindTable_h #define liblldb_UnwindTable_h -#include +#include #include "lldb/lldb-private.h" @@ -34,11 +34,14 @@ GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc); private: - void initialize (); - - typedef std::vector collection; - typedef collection::iterator iterator; - typedef collection::const_iterator const_iterator; + void + Dump (Stream &s); + + void Initialize (); + + typedef std::map collection; + typedef collection::iterator iterator; + typedef collection::const_iterator const_iterator; ObjectFile& m_object_file; collection m_unwinds; Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Fri Jan 7 18:05:12 2011 @@ -18,46 +18,6 @@ using namespace lldb; using namespace lldb_private; -//static size_t -//ReadBytes (ExecutionContextScope *exe_scope, const Address &address, void *dst, size_t dst_len) -//{ -// if (exe_scope == NULL) -// return 0; -// -// lldb::AddressType addr_type = eAddressTypeInvalid; -// addr_t addr = LLDB_INVALID_ADDRESS; -// -// Process *process = exe_scope->CalculateProcess(); -// -// if (process && process->IsAlive()) -// { -// addr = address.GetLoadAddress(process); -// if (addr != LLDB_INVALID_ADDRESS) -// addr_type = eAddressTypeLoad; -// } -// -// if (addr == LLDB_INVALID_ADDRESS) -// { -// addr = address.GetFileAddress(); -// if (addr != LLDB_INVALID_ADDRESS) -// addr_type = eAddressTypeFile; -// } -// -// if (addr_type == eAddressTypeInvalid) -// return false; -// -// Target *target = exe_scope->CalculateTarget(); -// if (target) -// { -// Error error; -// ObjectFile *objfile = NULL; -// if (address.GetModule()) -// objfile = address.GetModule()->GetObjectFile(); -// return target->ReadMemory (addr_type, addr, dst, dst_len, error, objfile); -// } -// return 0; -//} - static size_t ReadBytes (ExecutionContextScope *exe_scope, const Address &address, void *dst, size_t dst_len) { @@ -282,25 +242,6 @@ return false; // Failed to resolve this address to a section offset value } -//bool -//Address::ResolveAddressUsingLoadSections (addr_t addr, const SectionList *sections) -//{ -// if (sections) -// m_section = sections->FindSectionContainingLoadAddress(addr).get(); -// else -// m_section = NULL; -// -// if (m_section != NULL) -// { -// assert( m_section->ContainsLoadAddress(addr) ); -// m_offset = addr - m_section->GetLoadBaseAddress(); -// return true; // Successfully transformed addr into a section offset address -// } -// -// m_offset = addr; -// return false; // Failed to resolve this address to a section offset value -//} -// Module * Address::GetModule () const { @@ -309,16 +250,6 @@ return NULL; } -//addr_t -//Address::Address() const -//{ -// addr_t addr = GetLoadAddress(); -// if (addr != LLDB_INVALID_ADDRESS) -// return addr; -// return GetFileAddress(); -//} -// - addr_t Address::GetFileAddress () const { @@ -717,12 +648,6 @@ return true; } -//Stream& operator << (Stream& s, const Address& so_addr) -//{ -// so_addr.Dump(&s, Address::DumpStyleSectionNameOffset); -// return s; -//} -// void Address::CalculateSymbolContext (SymbolContext *sc) { @@ -795,63 +720,57 @@ } -/// The only comparisons that make sense are the load addresses -//bool -//lldb::operator< (const Address& lhs, const Address& rhs) -//{ -// lldb::addr_t lhs_addr = lhs.GetLoadAddress(); -// lldb::addr_t rhs_addr = rhs.GetLoadAddress(); -// -// if (lhs_addr == rhs_addr) -// { -// lhs_addr = lhs.GetFileAddress(); -// rhs_addr = rhs.GetFileAddress(); -// } -// return lhs_addr < rhs_addr; -//} -// -//bool -//lldb::operator<= (const Address& lhs, const Address& rhs) -//{ -// lldb::addr_t lhs_addr = lhs.GetLoadAddress(); -// lldb::addr_t rhs_addr = rhs.GetLoadAddress(); -// -// if (lhs_addr == rhs_addr) -// { -// lhs_addr = lhs.GetFileAddress(); -// rhs_addr = rhs.GetFileAddress(); -// } -// return lhs_addr <= rhs_addr; -//} -// -//bool -//lldb::operator> (const Address& lhs, const Address& rhs) -//{ -// lldb::addr_t lhs_addr = lhs.GetLoadAddress(); -// lldb::addr_t rhs_addr = rhs.GetLoadAddress(); -// -// if (lhs_addr == rhs_addr) -// { -// lhs_addr = lhs.GetFileAddress(); -// rhs_addr = rhs.GetFileAddress(); -// } -// return lhs_addr > rhs_addr; -//} -// -//bool -//lldb::operator>= (const Address& lhs, const Address& rhs) -//{ -// lldb::addr_t lhs_addr = lhs.GetLoadAddress(); -// lldb::addr_t rhs_addr = rhs.GetLoadAddress(); -// -// if (lhs_addr == rhs_addr) -// { -// lhs_addr = lhs.GetFileAddress(); -// rhs_addr = rhs.GetFileAddress(); -// } -// return lhs_addr >= rhs_addr; -//} -// +//---------------------------------------------------------------------- +// NOTE: Be careful using this operator. It can correctly compare two +// addresses from the same Module correctly. It can't compare two +// addresses from different modules in any meaningful way, but it will +// compare the module pointers. +// +// To sum things up: +// - works great for addresses within the same module +// - it works for addresses across multiple modules, but don't expect the +// address results to make much sense +// +// This basically lets Address objects be used in ordered collection +// classes. +//---------------------------------------------------------------------- + +bool +lldb_private::operator< (const Address& lhs, const Address& rhs) +{ + Module *lhs_module = lhs.GetModule(); + Module *rhs_module = rhs.GetModule(); + if (lhs_module == rhs_module) + { + // Addresses are in the same module, just compare the file addresses + return lhs.GetFileAddress() < rhs.GetFileAddress(); + } + else + { + // The addresses are from different modules, just use the module + // pointer value to get consistent ordering + return lhs_module < rhs_module; + } +} + +bool +lldb_private::operator> (const Address& lhs, const Address& rhs) +{ + Module *lhs_module = lhs.GetModule(); + Module *rhs_module = rhs.GetModule(); + if (lhs_module == rhs_module) + { + // Addresses are in the same module, just compare the file addresses + return lhs.GetFileAddress() > rhs.GetFileAddress(); + } + else + { + // The addresses are from different modules, just use the module + // pointer value to get consistent ordering + return lhs_module > rhs_module; + } +} + // The operator == checks for exact equality only (same section, same offset) bool Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original) +++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Fri Jan 7 18:05:12 2011 @@ -24,109 +24,101 @@ using namespace lldb_private; -FuncUnwinders::FuncUnwinders (UnwindTable& unwind_table, UnwindAssemblyProfiler *assembly_profiler, AddressRange range) : - m_unwind_table(unwind_table), - m_assembly_profiler(assembly_profiler), - m_range(range), - m_unwind_at_call_site(NULL), - m_unwind_at_non_call_site(NULL), - m_fast_unwind(NULL), - m_arch_default_unwind(NULL), - m_first_non_prologue_insn() { } +FuncUnwinders::FuncUnwinders +( + UnwindTable& unwind_table, + UnwindAssemblyProfiler *assembly_profiler, + AddressRange range +) : + m_unwind_table(unwind_table), + m_assembly_profiler(assembly_profiler), + m_range(range), + m_unwind_at_call_site_ap (), + m_unwind_at_non_call_site_ap (), + m_fast_unwind_ap (), + m_arch_default_unwind (NULL), + m_tried_unwind_at_call_site (false), + m_tried_unwind_at_non_call_site (false), + m_tried_fast_unwind (false), + m_tried_arch_default_unwind (false), + m_first_non_prologue_insn() +{ +} FuncUnwinders::~FuncUnwinders () { - if (m_unwind_at_call_site) - delete m_unwind_at_call_site; - if (m_unwind_at_non_call_site) - delete m_unwind_at_non_call_site; - if (m_fast_unwind) - delete m_fast_unwind; - if (m_arch_default_unwind) - delete m_arch_default_unwind; } UnwindPlan* FuncUnwinders::GetUnwindPlanAtCallSite (int current_offset) { - if (m_unwind_at_call_site != NULL) - return m_unwind_at_call_site; - if (!m_range.GetBaseAddress().IsValid()) - return NULL; - - // We have cases (e.g. with _sigtramp on Mac OS X) where the hand-written eh_frame unwind info for a - // function does not cover the entire range of the function and so the FDE only lists a subset of the - // address range. If we try to look up the unwind info by the starting address of the function - // (i.e. m_range.GetBaseAddress()) we may not find the eh_frame FDE. We need to use the actual byte offset - // into the function when looking it up. - - Address current_pc (m_range.GetBaseAddress ()); - if (current_offset != -1) - current_pc.SetOffset (current_pc.GetOffset() + current_offset); - - DWARFCallFrameInfo *eh_frame = m_unwind_table.GetEHFrameInfo(); - UnwindPlan *up = NULL; - if (eh_frame) + if (m_tried_unwind_at_call_site == false && m_unwind_at_call_site_ap.get() == NULL) { - up = new UnwindPlan; - if (!eh_frame->GetUnwindPlan (current_pc, *up)) + m_tried_unwind_at_call_site = true; + // We have cases (e.g. with _sigtramp on Mac OS X) where the hand-written eh_frame unwind info for a + // function does not cover the entire range of the function and so the FDE only lists a subset of the + // address range. If we try to look up the unwind info by the starting address of the function + // (i.e. m_range.GetBaseAddress()) we may not find the eh_frame FDE. We need to use the actual byte offset + // into the function when looking it up. + + if (m_range.GetBaseAddress().IsValid()) { - delete up; - return NULL; + Address current_pc (m_range.GetBaseAddress ()); + if (current_offset != -1) + current_pc.SetOffset (current_pc.GetOffset() + current_offset); + + DWARFCallFrameInfo *eh_frame = m_unwind_table.GetEHFrameInfo(); + if (eh_frame) + { + m_unwind_at_call_site_ap.reset (new UnwindPlan); + if (!eh_frame->GetUnwindPlan (current_pc, *m_unwind_at_call_site_ap)) + m_unwind_at_call_site_ap.reset(); + } } } - if (!up) - return NULL; - - m_unwind_at_call_site = up; - return m_unwind_at_call_site; + return m_unwind_at_call_site_ap.get(); } UnwindPlan* FuncUnwinders::GetUnwindPlanAtNonCallSite (Thread& thread) { - if (m_unwind_at_non_call_site != NULL) - return m_unwind_at_non_call_site; - UnwindPlan *up = new UnwindPlan; - if (!m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *up)) + if (m_tried_unwind_at_non_call_site == false && m_unwind_at_non_call_site_ap.get() == NULL) { - delete up; - return NULL; + m_tried_unwind_at_non_call_site = true; + m_unwind_at_non_call_site_ap.reset (new UnwindPlan); + if (!m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *m_unwind_at_non_call_site_ap)) + m_unwind_at_non_call_site_ap.reset(); } - m_unwind_at_non_call_site = up; - return m_unwind_at_non_call_site; + return m_unwind_at_non_call_site_ap.get(); } UnwindPlan* FuncUnwinders::GetUnwindPlanFastUnwind (Thread& thread) { - if (m_fast_unwind != NULL) - return m_fast_unwind; - UnwindPlan *up = new UnwindPlan; - if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *up)) + if (m_tried_fast_unwind == false && m_fast_unwind_ap.get() == NULL) { - delete up; - return NULL; + m_tried_fast_unwind = true; + m_fast_unwind_ap.reset (new UnwindPlan); + if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_fast_unwind_ap)) + m_fast_unwind_ap.reset(); } - m_fast_unwind = up; - return m_fast_unwind; + return m_fast_unwind_ap.get(); } UnwindPlan* FuncUnwinders::GetUnwindPlanArchitectureDefault (Thread& thread) { - if (m_arch_default_unwind != NULL) - return m_arch_default_unwind; - - Address current_pc; - Target *target = thread.CalculateTarget(); - if (target) + if (m_tried_arch_default_unwind == false && m_arch_default_unwind == NULL) { - ArchSpec arch = target->GetArchitecture (); - ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); - if (arch_default) + m_tried_arch_default_unwind = true; + Address current_pc; + Target *target = thread.CalculateTarget(); + if (target) { - m_arch_default_unwind = arch_default->GetArchDefaultUnwindPlan (thread, current_pc); + ArchSpec arch = target->GetArchitecture (); + ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); + if (arch_default) + m_arch_default_unwind = arch_default->GetArchDefaultUnwindPlan (thread, current_pc); } } Modified: lldb/trunk/source/Symbol/UnwindTable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=123045&r1=123044&r2=123045&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindTable.cpp (original) +++ lldb/trunk/source/Symbol/UnwindTable.cpp Fri Jan 7 18:05:12 2011 @@ -15,6 +15,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" +//#include "lldb/Core/StreamFile.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/FuncUnwinders.h" #include "lldb/Symbol/SymbolContext.h" @@ -28,11 +29,12 @@ using namespace lldb; using namespace lldb_private; -UnwindTable::UnwindTable (ObjectFile& objfile) : m_object_file(objfile), - m_unwinds(), - m_initialized(false), - m_eh_frame(NULL), - m_assembly_profiler(NULL) +UnwindTable::UnwindTable (ObjectFile& objfile) : + m_object_file (objfile), + m_unwinds (), + m_initialized (false), + m_eh_frame (NULL), + m_assembly_profiler (NULL) { } @@ -40,7 +42,7 @@ // until needed for something. void -UnwindTable::initialize () +UnwindTable::Initialize () { if (m_initialized) return; @@ -75,31 +77,21 @@ { FuncUnwindersSP no_unwind_found; - initialize(); + Initialize(); - // Create a FuncUnwinders object for the binary search below - AddressRange search_range(addr, 1); - FuncUnwindersSP search_unwind(new FuncUnwinders (*this, NULL, search_range)); + // There is an UnwindTable per object file, so we can safely use file handles + addr_t file_addr = addr.GetFileAddress(); + iterator end = m_unwinds.end (); + iterator insert_pos = end; + if (!m_unwinds.empty()) + { + insert_pos = m_unwinds.lower_bound (file_addr); + iterator pos = insert_pos; + if ((pos == m_unwinds.end ()) || (pos != m_unwinds.begin() && pos->second->GetFunctionStartAddress() != addr)) + --pos; - const_iterator idx; - idx = std::lower_bound (m_unwinds.begin(), m_unwinds.end(), search_unwind); - - bool found_match = true; - if (m_unwinds.size() == 0) - { - found_match = false; - } - else if (idx == m_unwinds.end()) - { - --idx; - } - if (idx != m_unwinds.begin() && (*idx)->GetFunctionStartAddress().GetOffset() != addr.GetOffset()) - { - --idx; - } - if (found_match && (*idx)->ContainsAddress (addr)) - { - return *idx; + if (pos->second->ContainsAddress (addr)) + return pos->second; } AddressRange range; @@ -112,15 +104,29 @@ } } - FuncUnwindersSP unw(new FuncUnwinders(*this, m_assembly_profiler, range)); - m_unwinds.push_back (unw); - std::sort (m_unwinds.begin(), m_unwinds.end()); - return unw; + FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, m_assembly_profiler, range)); + m_unwinds.insert (insert_pos, std::make_pair(range.GetBaseAddress().GetFileAddress(), func_unwinder_sp)); +// StreamFile s(stdout); +// Dump (s); + return func_unwinder_sp; +} + +void +UnwindTable::Dump (Stream &s) +{ + s.Printf("UnwindTable for %s/%s:\n", m_object_file.GetFileSpec().GetDirectory().GetCString(), m_object_file.GetFileSpec().GetFilename().GetCString()); + const_iterator begin = m_unwinds.begin(); + const_iterator end = m_unwinds.end(); + for (const_iterator pos = begin; pos != end; ++pos) + { + s.Printf ("[%zu] 0x%16.16llx\n", std::distance (begin, pos), pos->first); + } + s.EOL(); } DWARFCallFrameInfo * UnwindTable::GetEHFrameInfo () { - initialize(); + Initialize(); return m_eh_frame; } From johnny.chen at apple.com Fri Jan 7 19:37:33 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 08 Jan 2011 01:37:33 -0000 Subject: [Lldb-commits] [lldb] r123049 - /lldb/trunk/test/blacklist.py Message-ID: <20110108013733.C70F52A6C12C@llvm.org> Author: johnny Date: Fri Jan 7 19:37:33 2011 New Revision: 123049 URL: http://llvm.org/viewvc/llvm-project?rev=123049&view=rev Log: Blacklisted testclass STLTestCase for a known crasher . Modified: lldb/trunk/test/blacklist.py Modified: lldb/trunk/test/blacklist.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/blacklist.py?rev=123049&r1=123048&r2=123049&view=diff ============================================================================== --- lldb/trunk/test/blacklist.py (original) +++ lldb/trunk/test/blacklist.py Fri Jan 7 19:37:33 2011 @@ -13,9 +13,6 @@ } """ -blacklist = {'BasicExprCommandsTestCase.test_evaluate_expression_python': 'Crashed while running the entire test suite with CC=clang' - # To reproduce the crash: CC=clang ./dotest.py -v -w -# 5 -f BasicExprCommandsTestCase.test_evaluate_expression_python - # The clang version used is clang-126. - # Two radars filed for the crashes: rdar://problem/8769826 and rdar://problem/8773329. - # To skip this test case: CC=clang ./dotest.py -b blacklist.py -v -w 2> ~/Developer/Log/lldbtest.log +blacklist = {'STLTestCase': ' Crashed while running the entire test suite' + # To skip this test case: ./dotest.py -b blacklist.py -v -w 2> ~/Developer/Log/lldbtest.log } From gclayton at apple.com Fri Jan 7 19:53:06 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 01:53:06 -0000 Subject: [Lldb-commits] [lldb] r123052 - /lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Message-ID: <20110108015306.A95862A6C12C@llvm.org> Author: gclayton Date: Fri Jan 7 19:53:06 2011 New Revision: 123052 URL: http://llvm.org/viewvc/llvm-project?rev=123052&view=rev Log: Fixed an issue with the UnwindLLDB code where if there were inlined stack frames, UnwindLLDB could create the incorrect RegisterContext for a given stack frame because it was using the frame index (not the concrete frame index). This was causing crashes when doing backtraces through the SBFrame::GetFP() because a NULL register context was being returned for the deepest stack frame. Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp 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=123052&r1=123051&r2=123052&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Jan 7 19:53:06 2011 @@ -167,7 +167,7 @@ UnwindLLDB::CreateRegisterContextForFrame (StackFrame *frame) { lldb::RegisterContextSP reg_ctx_sp; - uint32_t idx = frame->GetFrameIndex (); + uint32_t idx = frame->GetConcreteFrameIndex (); if (idx == 0) { From gclayton at apple.com Fri Jan 7 21:17:57 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 03:17:57 -0000 Subject: [Lldb-commits] [lldb] r123053 - in /lldb/trunk: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Utility/StringExtractor.cpp source/Utility/StringExtractor.h tools/debugserver/source/RNBRemote.cpp Message-ID: <20110108031757.5161D2A6C12C@llvm.org> Author: gclayton Date: Fri Jan 7 21:17:57 2011 New Revision: 123053 URL: http://llvm.org/viewvc/llvm-project?rev=123053&view=rev Log: Modified the stop reply packet to be able to send the thread name using the new "hexname" key for the "key:value;" duple that is part of the packet. This allows for thread names to contain special characters such as $ # : ; + - Debugserver now detects if the thread name contains special characters and sends the chars in hex format if needed. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Utility/StringExtractor.cpp lldb/trunk/source/Utility/StringExtractor.h lldb/trunk/tools/debugserver/source/RNBRemote.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=123053&r1=123052&r2=123053&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Jan 7 21:17:57 2011 @@ -517,18 +517,25 @@ std::string &response_str = response.GetStringRef(); if (packet_data[0] == '$') { - assert (packet_size >= 4); // Must have at least '$#CC' where CC is checksum - assert (packet_data[packet_size-3] == '#'); - assert (::isxdigit (packet_data[packet_size-2])); // Must be checksum hex byte - assert (::isxdigit (packet_data[packet_size-1])); // Must be checksum hex byte - response_str.assign (packet_data + 1, packet_size - 4); + bool success = false; + if (packet_size < 4) + ::fprintf (stderr, "Packet that starts with $ is too short: '%s'\n", packet_data); + else if (packet_data[packet_size-3] != '#' || + !::isxdigit (packet_data[packet_size-2]) || + !::isxdigit (packet_data[packet_size-1])) + ::fprintf (stderr, "Invalid checksum footer for packet: '%s'\n", packet_data); + else + success = true; + + if (success) + response_str.assign (packet_data + 1, packet_size - 4); if (m_send_acks) { char packet_checksum = strtol (&packet_data[packet_size-2], NULL, 16); char actual_checksum = CalculcateChecksum (&response_str[0], response_str.size()); checksum_error = packet_checksum != actual_checksum; // Send the ack or nack if needed - if (checksum_error) + if (checksum_error || !success) SendAck('-'); else SendAck('+'); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=123053&r1=123052&r2=123053&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jan 7 21:17:57 2011 @@ -1036,6 +1036,15 @@ // thread in big endian hex tid = Args::StringToUInt32 (value.c_str(), 0, 16); } + else if (name.compare("hexname") == 0) + { + StringExtractor name_extractor; + // Swap "value" over into "name_extractor" + name_extractor.GetStringRef().swap(value); + // Now convert the HEX bytes into a string value + name_extractor.GetHexByteString (value); + thread_name.swap (value); + } else if (name.compare("name") == 0) { thread_name.swap (value); Modified: lldb/trunk/source/Utility/StringExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=123053&r1=123052&r2=123053&view=diff ============================================================================== --- lldb/trunk/source/Utility/StringExtractor.cpp (original) +++ lldb/trunk/source/Utility/StringExtractor.cpp Fri Jan 7 21:17:57 2011 @@ -336,6 +336,16 @@ return fail_value; } +size_t +StringExtractor::GetHexByteString (std::string &str) +{ + str.clear(); + char ch; + while ((ch = GetHexU8()) != '\0') + str.append(1, ch); + return str.size(); +} + bool StringExtractor::GetNameColonValue (std::string &name, std::string &value) { Modified: lldb/trunk/source/Utility/StringExtractor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.h?rev=123053&r1=123052&r2=123053&view=diff ============================================================================== --- lldb/trunk/source/Utility/StringExtractor.h (original) +++ lldb/trunk/source/Utility/StringExtractor.h Fri Jan 7 21:17:57 2011 @@ -110,6 +110,9 @@ uint64_t GetHexWithFixedSize (uint32_t byte_size, bool little_endian, uint64_t fail_value); + size_t + GetHexByteString (std::string &str); + protected: //------------------------------------------------------------------ // For StringExtractor only Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=123053&r1=123052&r2=123053&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Jan 7 21:17:57 2011 @@ -1922,7 +1922,21 @@ const char *thread_name = DNBThreadGetName (pid, tid); if (thread_name && thread_name[0]) - ostrm << std::hex << "name:" << thread_name << ';'; + { + size_t thread_name_len = strlen(thread_name); + + if (::strcspn (thread_name, "$#+-;:") == thread_name_len) + ostrm << std::hex << "name:" << thread_name << ';'; + else + { + // the thread name contains special chars, send as hex bytes + ostrm << std::hex << "hexname:"; + uint8_t *u_thread_name = (uint8_t *)thread_name; + for (int i = 0; i < thread_name_len; i++) + ostrm << RAWHEX8(u_thread_name[i]); + ostrm << ';'; + } + } thread_identifier_info_data_t thread_ident_info; if (DNBThreadGetIdentifierInfo (pid, tid, &thread_ident_info)) From bruce.mitchener at gmail.com Fri Jan 7 21:31:01 2011 From: bruce.mitchener at gmail.com (Bruce Mitchener) Date: Sat, 8 Jan 2011 10:31:01 +0700 Subject: [Lldb-commits] [Patch] Spelling fixes Message-ID: This is, perhaps, the most obsessive patch that I've done in a long time, but I was reading through the sources to familiarize myself with them... - Bruce -------------- next part -------------- A non-text attachment was scrubbed... Name: lldb_spelling.diff Type: application/octet-stream Size: 43181 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20110108/dcb3e77e/attachment-0001.obj From gclayton at apple.com Sat Jan 8 14:28:42 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 20:28:42 -0000 Subject: [Lldb-commits] [lldb] r123083 - in /lldb/trunk: docs/ docs/testsuite/ examples/lookup/ source/ source/Commands/ source/Core/ source/Host/common/ source/Host/macosx/ source/Host/macosx/cfcpp/ source/Interpreter/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/ObjectContainer/Universal-Mach-O/ source/Plugins/ObjectFile/ELF/ source/Plugins/Process/Linux/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins... Message-ID: <20110108202843.249512A6C12C@llvm.org> Author: gclayton Date: Sat Jan 8 14:28:42 2011 New Revision: 123083 URL: http://llvm.org/viewvc/llvm-project?rev=123083&view=rev Log: Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener. Thanks Bruce! Modified: lldb/trunk/docs/lldb-for-gdb-users.txt lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt lldb/trunk/examples/lookup/main.cpp lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Host/common/Condition.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/common/Mutex.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Host/macosx/cfcpp/CFCReleaser.h lldb/trunk/source/Interpreter/Args.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp lldb/trunk/source/Interpreter/CommandObjectScript.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXRemote.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/docs/lldb-for-gdb-users.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-for-gdb-users.txt?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/docs/lldb-for-gdb-users.txt (original) +++ lldb/trunk/docs/lldb-for-gdb-users.txt Sat Jan 8 14:28:42 2011 @@ -367,7 +367,7 @@ (SKTGraphicView *) self = 0x0000000100208b40 The frame variable command is not a full expression parser but it -does support some common operations like defererencing: +does support some common operations like dereferencing: (lldb) fr v *self (SKTGraphicView *) self = 0x0000000100208b40 Modified: lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt (original) +++ lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt Sat Jan 8 14:28:42 2011 @@ -119,7 +119,7 @@ if not module.buildDwarf(self, architecture, compiler, dictionary): raise Exception("Don't know how to build binary with dwarf") -And the test/plugins/darwin.py provides the implmentation for all three build +And the test/plugins/darwin.py provides the implementation for all three build methods using the makefile mechanism. We envision that linux plugin can use a similar approach to accomplish the task of building the binaries. Modified: lldb/trunk/examples/lookup/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/lookup/main.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/examples/lookup/main.cpp (original) +++ lldb/trunk/examples/lookup/main.cpp Sat Jan 8 14:28:42 2011 @@ -41,7 +41,7 @@ // The first argument is the file path we want to look something up in const char *exe_file_path = argv[1]; - // The second arguemnt in the address that we want to lookup + // The second argument in the address that we want to lookup lldb::addr_t file_addr = strtoull (argv[2], NULL, 0); // Make a file spec out of our executable path Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Sat Jan 8 14:28:42 2011 @@ -141,7 +141,7 @@ memcpy(partial_name_copy, partial_file_name, partial_name_len); partial_name_copy[partial_name_len] = '\0'; - // We'll need to save a copy of the remainder for comparision, which we do here. + // We'll need to save a copy of the remainder for comparison, which we do here. char remainder[PATH_MAX]; // end_ptr will point past the last / in partial_name_copy, or if there is no slash to the beginning of the string. Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Sat Jan 8 14:28:42 2011 @@ -170,7 +170,7 @@ char buf[k_buf_len+1]; buf[k_buf_len] = '\0'; // NULL terminate - // Byte order and adderss size don't matter for C string dumping.. + // Byte order and address size don't matter for C string dumping.. DataExtractor data (buf, sizeof(buf), eByteOrderHost, 4); size_t total_len = 0; size_t bytes_read; Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Sat Jan 8 14:28:42 2011 @@ -290,7 +290,7 @@ ValueObjectSP ValueObject::GetChildMemberWithName (const ConstString &name, bool can_create) { - // when getting a child by name, it could be burried inside some base + // when getting a child by name, it could be buried inside some base // classes (which really aren't part of the expression path), so we // need a vector of indexes that can get us down to the correct child std::vector child_indexes; Modified: lldb/trunk/source/Host/common/Condition.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Condition.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Condition.cpp (original) +++ lldb/trunk/source/Host/common/Condition.cpp Sat Jan 8 14:28:42 2011 @@ -66,7 +66,7 @@ //---------------------------------------------------------------------- // The Wait() function atomically blocks the current thread -// waiting on the owend condition variable, and unblocks the mutex +// waiting on the owned condition variable, and unblocks the mutex // specified by "mutex". The waiting thread unblocks only after // another thread calls Signal(), or Broadcast() with the same // condition variable, or if "abstime" is valid (non-NULL) this Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Sat Jan 8 14:28:42 2011 @@ -662,7 +662,7 @@ bool Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) { - // To get paths related to LLDB we get the path to the exectuable that + // To get paths related to LLDB we get the path to the executable that // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB", // on linux this is assumed to be the "lldb" main executable. If LLDB on // linux is actually in a shared library (lldb.so??) then this function will Modified: lldb/trunk/source/Host/common/Mutex.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Mutex.cpp (original) +++ lldb/trunk/source/Host/common/Mutex.cpp Sat Jan 8 14:28:42 2011 @@ -72,7 +72,7 @@ } //---------------------------------------------------------------------- -// Desstructor +// Destructor // // Unlocks any owned mutex object (if it is valid). //---------------------------------------------------------------------- Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Sat Jan 8 14:28:42 2011 @@ -55,7 +55,7 @@ // function, so we do it manually. auto_zone_register_thread(auto_zone()); #else - // On SnowLoepard and later we just call the thread registration function. + // On SnowLeopard and later we just call the thread registration function. objc_registerThreadWithCollector(); #endif } Modified: lldb/trunk/source/Host/macosx/cfcpp/CFCReleaser.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/cfcpp/CFCReleaser.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/cfcpp/CFCReleaser.h (original) +++ lldb/trunk/source/Host/macosx/cfcpp/CFCReleaser.h Sat Jan 8 14:28:42 2011 @@ -23,7 +23,7 @@ // is designed to mimic the std::auto_ptr class and has all of the // same functions. The one thing to watch out for is the // CFCReleaser::release() function won't actually CFRelease any owned -// pointer, it is designed to relinquish ownwership of the pointer just +// pointer, it is designed to relinquish ownership of the pointer just // like std:auto_ptr::release() does. //---------------------------------------------------------------------- template Modified: lldb/trunk/source/Interpreter/Args.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/Args.cpp (original) +++ lldb/trunk/source/Interpreter/Args.cpp Sat Jan 8 14:28:42 2011 @@ -145,7 +145,7 @@ if (*arg_start == '\0') break; - // Arguments can be split into multiple discongituous pieces, + // Arguments can be split into multiple discontiguous pieces, // for example: // "Hello ""World" // this would result in a single argument "Hello World" (without/ @@ -228,7 +228,7 @@ else { // We found the start of a quote scope. - // Make sure there isn't a string that predeces + // Make sure there isn't a string that precedes // the start of a quote scope like: // Hello" World" // If so, then add the "Hello" to the arg Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sat Jan 8 14:28:42 2011 @@ -746,7 +746,7 @@ // the user could have specified an alias, and in translating the alias there may also be command options and/or // even data (including raw text strings) that need to be found and inserted into the command line as part of // the translation. So this first step is plain look-up & replacement, resulting in three things: 1). the command - // object whose Execute method will actually be called; 2). a revised command string, with all substituitions & + // object whose Execute method will actually be called; 2). a revised command string, with all substitutions & // replacements taken care of; 3). whether or not the Execute function wants raw input or not. StreamString revised_command_line; Modified: lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp Sat Jan 8 14:28:42 2011 @@ -97,7 +97,7 @@ m_cmd_name.c_str()); return false; } - result.AppendError("empty command passed to regular exression command"); + result.AppendError("empty command passed to regular expression command"); result.SetStatus(eReturnStatusFailed); return false; } Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Sat Jan 8 14:28:42 2011 @@ -52,7 +52,7 @@ if (script_interpreter == NULL) { - result.AppendError("no script interpeter"); + result.AppendError("no script interpreter"); result.SetStatus (eReturnStatusFailed); } Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h Sat Jan 8 14:28:42 2011 @@ -372,7 +372,7 @@ bool ReadAllImageInfosStructure (); - DYLDImageInfo m_dyld; // Info about the curent dyld being used + DYLDImageInfo m_dyld; // Info about the current dyld being used lldb::addr_t m_dyld_all_image_infos_addr; DYLDAllImageInfos m_dyld_all_image_infos; uint32_t m_dyld_all_image_infos_stop_id; Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Sat Jan 8 14:28:42 2011 @@ -560,7 +560,7 @@ const Symbol *msgSend_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (name_const_str, eSymbolTypeCode); if (msgSend_symbol) { - // FixMe: Make g_dispatch_functions static table of DisptachFunctions, and have the map be address->index. + // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and have the map be address->index. // Problem is we also need to lookup the dispatch function. For now we could have a side table of stret & non-stret // dispatch functions. If that's as complex as it gets, we're fine. Modified: lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp Sat Jan 8 14:28:42 2011 @@ -127,7 +127,7 @@ } // Now we should have enough data for all of the fat headers, so lets index - // them so we know how many architectures that this univeral binary contains. + // them so we know how many architectures that this universal binary contains. uint32_t arch_idx = 0; for (arch_idx = 0; arch_idx < m_header.nfat_arch; ++arch_idx) { Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.h Sat Jan 8 14:28:42 2011 @@ -68,9 +68,9 @@ elf_half e_machine; ///< Target architecture. elf_half e_ehsize; ///< Byte size of the ELF header. elf_half e_phentsize; ///< Size of a program header table entry. - elf_half e_phnum; ///< Number of program header entrys. + elf_half e_phnum; ///< Number of program header entries. elf_half e_shentsize; ///< Size of a section header table entry. - elf_half e_shnum; ///< Number of section header entrys. + elf_half e_shnum; ///< Number of section header entries. elf_half e_shstrndx; ///< String table section index. ELFHeader(); @@ -184,19 +184,19 @@ /// @brief Generic representation of an ELF program header. struct ELFProgramHeader { - elf_word p_type; ///< Type of program segement. - elf_word p_flags; ///< Segement attibutes. - elf_off p_offset; ///< Start of segment from begining of file. + elf_word p_type; ///< Type of program segment. + elf_word p_flags; ///< Segment attributes. + elf_off p_offset; ///< Start of segment from beginning of file. elf_addr p_vaddr; ///< Virtual address of segment in memory. elf_addr p_paddr; ///< Physical address (for non-VM systems). elf_xword p_filesz; ///< Byte size of the segment in file. elf_xword p_memsz; ///< Byte size of the segment in memory. - elf_xword p_align; ///< Segement alignement constraint. + elf_xword p_align; ///< Segment alignment constraint. ELFProgramHeader(); - /// Parse an ELFProgramHeader entry from the given DataExtracter starting at - /// position \p offset. The address size of the DataExtracter determines if + /// Parse an ELFProgramHeader entry from the given DataExtractor starting at + /// position \p offset. The address size of the DataExtractor determines if /// a 32 or 64 bit object is to be parsed. /// /// @param[in] data @@ -234,13 +234,13 @@ /// Returns the type attribute of the st_info member. unsigned char getType() const { return st_info & 0x0F; } - /// Sets the bining and type of the st_info member. + /// Sets the binding and type of the st_info member. void setBindingAndType(unsigned char binding, unsigned char type) { st_info = (binding << 4) + (type & 0x0F); } - /// Parse an ELFSymbol entry from the given DataExtracter starting at - /// position \p offset. The address size of the DataExtracter determines if + /// Parse an ELFSymbol entry from the given DataExtractor starting at + /// position \p offset. The address size of the DataExtractor determines if /// a 32 or 64 bit object is to be parsed. /// /// @param[in] data @@ -271,8 +271,8 @@ ELFDynamic(); - /// Parse an ELFDynamic entry from the given DataExtracter starting at - /// position \p offset. The address size of the DataExtracter determines if + /// Parse an ELFDynamic entry from the given DataExtractor starting at + /// position \p offset. The address size of the DataExtractor determines if /// a 32 or 64 bit object is to be parsed. /// /// @param[in] data Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Sat Jan 8 14:28:42 2011 @@ -171,7 +171,7 @@ ParseSectionHeaders(); /// Scans the dynamic section and locates all dependent modules (shared - /// libaries) populating m_filespec_ap. This method will compute the + /// libraries) populating m_filespec_ap. This method will compute the /// dependent module list only once. Returns the number of dependent /// modules parsed. size_t Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Sat Jan 8 14:28:42 2011 @@ -174,7 +174,7 @@ if (!HasExited()) { - // Shut down the private state thread as we will syncronize with events + // Shut down the private state thread as we will synchronize with events // ourselves. Discard all current thread plans. PausePrivateStateThread(); GetThreadList().DiscardThreadPlans(); Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Sat Jan 8 14:28:42 2011 @@ -444,7 +444,7 @@ /// "drives" state changes in the debugger. /// /// The second thread (@see OperationThread) is responsible for two things 1) -/// lauching or attaching to the inferior process, and then 2) servicing +/// launching or attaching to the inferior process, and then 2) servicing /// operations such as register reads/writes, stepping, etc. See the comments /// on the Operation class for more info as to why this is needed. ProcessMonitor::ProcessMonitor(ProcessLinux *process, @@ -601,7 +601,7 @@ // Let us have our own process group. setpgid(0, 0); - // Dup file discriptors if needed. + // Dup file descriptors if needed. // // FIXME: If two or more of the paths are the same we needlessly open // the same file multiple times. Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h Sat Jan 8 14:28:42 2011 @@ -65,10 +65,10 @@ ProcessLinux & GetProcess() { return *m_process; } - /// Returns a file descriptor to the controling terminal of the inferior + /// Returns a file descriptor to the controlling terminal of the inferior /// process. /// - /// Reads from this file descriptor yeild both the standard output and + /// Reads from this file descriptor yield both the standard output and /// standard error of this debugee. Even if stderr and stdout were /// redirected on launch it may still happen that data is available on this /// descriptor (if the inferior process opens /dev/tty, for example). Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux.h Sat Jan 8 14:28:42 2011 @@ -30,7 +30,7 @@ /// Updates the register state of the associated thread after hitting a /// breakpoint (if that make sense for the architecture). Default /// implementation simply returns true for architectures which do not - /// require any upadte. + /// require any update. /// /// @return /// True if the operation succeeded and false otherwise. Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Sat Jan 8 14:28:42 2011 @@ -291,16 +291,16 @@ (offsetof(RegisterContextLinux_x86_64::UserArea, i387) + \ offsetof(RegisterContextLinux_x86_64::FPU, regname)) -// Number of bytes needed to represet a GPR. +// Number of bytes needed to represent a GPR. #define GPR_SIZE(reg) sizeof(((RegisterContextLinux_x86_64::GPR*)NULL)->reg) -// Number of bytes needed to represet a FPR. +// Number of bytes needed to represent a FPR. #define FPR_SIZE(reg) sizeof(((RegisterContextLinux_x86_64::FPU*)NULL)->reg) -// Number of bytes needed to represet the i'th FP register. +// Number of bytes needed to represent the i'th FP register. #define FP_SIZE sizeof(((RegisterContextLinux_x86_64::MMSReg*)NULL)->bytes) -// Number of bytes needed to represet an XMM register. +// Number of bytes needed to represent an XMM register. #define XMM_SIZE sizeof(RegisterContextLinux_x86_64::XMMReg) #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \ Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h Sat Jan 8 14:28:42 2011 @@ -131,7 +131,7 @@ FPU i387; // FPU registers. uint64_t tsize; // Text segment size. uint64_t dsize; // Data segment size. - uint64_t ssize; // Stack segement size. + uint64_t ssize; // Stack segment size. uint64_t start_code; // VM address of text. uint64_t start_stack; // VM address of stack bottom (top in rsp). int64_t signal; // Signal causing core dump. Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Sat Jan 8 14:28:42 2011 @@ -477,7 +477,7 @@ // MACH_RCV_TIMEOUT option with a zero timeout to grab all other current // exceptions for our process. After we have received the last pending // exception, we will get a timeout which enables us to then notify - // our main thread that we have an exception bundle avaiable. We then wait + // our main thread that we have an exception bundle available. We then wait // for the main thread to tell this exception thread to start trying to get // exceptions messages again and we start again with a mach_msg read with // infinite timeout. Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Sat Jan 8 14:28:42 2011 @@ -873,7 +873,7 @@ Task().Resume(); } - // NULL our task out as we have already retored all exception ports + // NULL our task out as we have already restored all exception ports Task().Clear(); // Clear out any notion of the process we once were @@ -1238,7 +1238,7 @@ // MACH_RCV_TIMEOUT option with a zero timeout to grab all other current // exceptions for our process. After we have received the last pending // exception, we will get a timeout which enables us to then notify - // our main thread that we have an exception bundle avaiable. We then wait + // our main thread that we have an exception bundle available. We then wait // for the main thread to tell this exception thread to start trying to get // exceptions messages again and we start again with a mach_msg read with // infinite timeout. @@ -1410,7 +1410,7 @@ // Resume our task Task().Resume(); - // NULL our task out as we have already retored all exception ports + // NULL our task out as we have already restored all exception ports Task().Clear(); // Clear out any notion of the process we once were Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Sat Jan 8 14:28:42 2011 @@ -159,7 +159,7 @@ "\ttask - log mach task calls\n" "\tthread - log thread events and activities\n" "\tstep - log step related activities\n" - "\tverbose - enable verbose loggging\n" + "\tverbose - enable verbose logging\n" "\twatch - log watchpoint related activities\n", ProcessMacOSX::GetPluginNameStatic()); } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXRemote.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXRemote.cpp Sat Jan 8 14:28:42 2011 @@ -214,7 +214,7 @@ { case CPU_TYPE_ARM: // TODO: fill this in for ARM. We need to dig up the symbol for - // the address in the breakpoint locaiton and figure out if it is + // the address in the breakpoint location and figure out if it is // an ARM or Thumb breakpoint. trap_opcode = g_arm_breakpoint_opcode; trap_opcode_size = sizeof(g_arm_breakpoint_opcode); @@ -592,7 +592,7 @@ const uint8_t * const break_op = bp->GetTrapOpcodeBytes(); if (break_op_size > 0) { - // Clear a software breakoint instruction + // Clear a software breakpoint instruction uint8_t curr_break_op[break_op_size]; bool break_op_found = false; @@ -728,7 +728,7 @@ { wp->SetEnabled(false); if (log) - log->Printf ("ProcessMacOSXRemote::Disablewatchpoint (watchID = %d) addr = 0x%8.8llx (hardware) => success", watchID, (uint64_t)addr); + log->Printf ("ProcessMacOSXRemote::DisableWatchpoint (watchID = %d) addr = 0x%8.8llx (hardware) => success", watchID, (uint64_t)addr); return true; } } @@ -1036,7 +1036,7 @@ // MACH_RCV_TIMEOUT option with a zero timeout to grab all other current // exceptions for our process. After we have received the last pending // exception, we will get a timeout which enables us to then notify - // our main thread that we have an exception bundle avaiable. We then wait + // our main thread that we have an exception bundle available. We then wait // for the main thread to tell this exception thread to start trying to get // exceptions messages again and we start again with a mach_msg read with // infinite timeout. Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h Sat Jan 8 14:28:42 2011 @@ -37,7 +37,7 @@ #define BAS_IMVA_2_3 ((uint32_t)(3u << 7)) #define BAS_IMVA_ALL ((uint32_t)(0xfu << 5)) -// Break only in priveleged or user mode +// Break only in privileged or user mode #define S_RSVD ((uint32_t)(0u << 1)) #define S_PRIV ((uint32_t)(1u << 1)) #define S_USER ((uint32_t)(2u << 1)) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp Sat Jan 8 14:28:42 2011 @@ -410,7 +410,7 @@ //---------------------------------------------------------------------- -// Register information defintions for 32 bit i386. +// Register information definitions for 32 bit i386. //---------------------------------------------------------------------- int RegisterContextMach_i386::GetSetForNativeRegNum (int reg_num) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Sat Jan 8 14:28:42 2011 @@ -440,7 +440,7 @@ case TH_STATE_STOPPED: thread_run_state = "stopped"; break; // 2 thread is stopped case TH_STATE_WAITING: thread_run_state = "waiting"; break; // 3 thread is waiting normally case TH_STATE_UNINTERRUPTIBLE: thread_run_state = "uninter"; break; // 4 thread is in an uninterruptible wait - case TH_STATE_HALTED: thread_run_state = "halted "; break; // 5 thread is halted at a + case TH_STATE_HALTED: thread_run_state = "halted "; break; // 5 thread is halted at a default: thread_run_state = "???"; break; } 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=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sat Jan 8 14:28:42 2011 @@ -309,7 +309,7 @@ if (m_sym_ctx_valid == false) decr_pc_and_recompute_addr_range = true; - // Or if we're in the middle of the stack (and not "above" an asynchornous event like sigtramp), + // Or if we're in the middle of the stack (and not "above" an asynchronous event like sigtramp), // and our "current" pc is the start of a function... if (m_sym_ctx_valid && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type != eSigtrampFrame 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=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Sat Jan 8 14:28:42 2011 @@ -121,11 +121,11 @@ InitializeNonZerothFrame(); // Provide a location for where THIS function saved the CALLER's register value - // Or a frame "below" this one savedit, i.e. a function called by this one, preserved a register that this + // Or a frame "below" this one saved it, i.e. a function called by this one, preserved a register that this // function didn't modify/use. // // The RegisterLocation type may be set to eRegisterNotAvailable -- this will happen for a volatile register - // bieng queried mid-stack. Instead of floating frame 0's contents of that register up the stack (which may + // being queried mid-stack. Instead of floating frame 0's contents of that register up the stack (which may // or may not be the value of that reg when the function was executing), we won't return any value. // // If a non-volatile register (a "preserved" register) is requested mid-stack and no frames "below" the requested Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Sat Jan 8 14:28:42 2011 @@ -164,7 +164,7 @@ //class ScopedValueChanger //{ //public: -// // Take a value reference and the value to assing it to when this class +// // Take a value reference and the value to assign it to when this class // // instance goes out of scope. // ScopedValueChanger (_Tp &value_ref, _Tp value) : // m_value_ref (value_ref), @@ -180,7 +180,7 @@ // m_value_ref = m_value; // } //protected: -// _Tp &m_value_ref; // A reference to the value we wil change when this object destructs +// _Tp &m_value_ref; // A reference to the value we will change when this object destructs // _Tp m_value; // The value to assign to m_value_ref when this goes out of scope. //}; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Sat Jan 8 14:28:42 2011 @@ -152,7 +152,7 @@ /// environment that the inferior should be launched with. /// /// @param[in] name_equal_value - /// A NULL terminated C string that contains a single enironment + /// A NULL terminated C string that contains a single environment /// in the format "NAME=VALUE". /// /// @param[in] timeout_seconds 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=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Sat Jan 8 14:28:42 2011 @@ -167,7 +167,7 @@ "\tprocess - log process events and activities\n" "\tthread - log thread events and activities\n" "\tstep - log step related activities\n" - "\tverbose - enable verbose loggging\n" + "\tverbose - enable verbose logging\n" "\twatch - log watchpoint related activities\n", ProcessGDBRemote::GetPluginNameStatic()); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Sat Jan 8 14:28:42 2011 @@ -114,7 +114,7 @@ // Encode // // Encode the abbreviation table onto the end of the buffer provided -// into a byte represenation as would be found in a ".debug_abbrev" +// into a byte representation as would be found in a ".debug_abbrev" // debug information section. //---------------------------------------------------------------------- //void Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Sat Jan 8 14:28:42 2011 @@ -357,7 +357,7 @@ const dw_offset_t next_cu_offset = cu->GetNextCompileUnitOffset(); depth = 0; - // Call the callback funtion with no DIE pointer for the compile unit + // Call the callback function with no DIE pointer for the compile unit // and get the offset that we are to continue to parse from offset = callback(dwarf2Data, cu, NULL, offset, depth, userData); @@ -369,7 +369,7 @@ bool done = false; while (!done && die.Extract(dwarf2Data, cu.get(), &offset)) { - // Call the callback funtion with DIE pointer that falls within the compile unit + // Call the callback function with DIE pointer that falls within the compile unit offset = callback(dwarf2Data, cu, &die, offset, depth, userData); if (die.IsNULL()) @@ -397,7 +397,7 @@ cu.reset(new DWARFCompileUnit(dwarf2Data)); - // Make sure we start on a propper + // Make sure we start on a proper offset = next_cu_offset; } } @@ -512,7 +512,7 @@ { if (verifyInfo->sibling_errors++ == 0) s->Printf("ERROR\n"); - s->Printf(" 0x%8.8x: sibling attribyte (0x%8.8x) in this die is not valid: it is less than this DIE or some of its contents.\n", die->GetOffset(), sibling); + s->Printf(" 0x%8.8x: sibling attribute (0x%8.8x) in this die is not valid: it is less than this DIE or some of its contents.\n", die->GetOffset(), sibling); } else if (sibling > verifyInfo->die_ranges.back().hi_die_offset) { @@ -583,7 +583,7 @@ // the address ranges within it (if any) are contiguous. The DWARF // spec states that if a compile unit TAG has high and low PC // attributes, there must be no gaps in the address ranges of it's - // contained subtroutines. If there are gaps, the high and low PC + // contained subroutines. If there are gaps, the high and low PC // must not be in the DW_TAG_compile_unit's attributes. Errors like // this can crop up when optimized code is dead stripped and the debug // information isn't properly fixed up for output. @@ -698,7 +698,7 @@ else { // cu->Dump(ostrm_ptr); // Dump the compile unit for the DIE - // We have a new comile unit header + // We have a new compile unit header verifyInfo->die_ranges.clear(); DIERange die_range; die_range.range.offset = cu->GetOffset(); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Sat Jan 8 14:28:42 2011 @@ -1999,7 +1999,7 @@ } else { // compile units may not have a valid high/low pc when there - // are address gaps in subtroutines so we must always search + // are address gaps in subroutines so we must always search // if there is no valid high and low PC check_children = (tag == DW_TAG_compile_unit) && ((function_die != NULL) || (block_die != NULL)); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Sat Jan 8 14:28:42 2011 @@ -796,7 +796,7 @@ // opcode divided by the line_range multiplied by the // minimum_instruction_length field from the header. That is: // - // address increment = (adjusted opcode / line_range) * minimim_instruction_length + // address increment = (adjusted opcode / line_range) * minimum_instruction_length // // The amount to increment the line register is the line_base plus // the result of the adjusted opcode modulo the line_range. That is: @@ -1142,7 +1142,7 @@ // with the current one if the one it is replacing is an end_sequence entry. // We currently always place an extra end sequence when ever we exit a valid // address range for a function in case the functions get rearranged by - // optmimizations or by order specifications. These extra end sequences will + // optimizations or by order specifications. These extra end sequences will // disappear by getting replaced with valid consecutive entries within a // compile unit if there are no gaps. if (range.first == range.second) @@ -1202,7 +1202,7 @@ DWARFDebugLine::State::AppendRowToMatrix(dw_offset_t offset) { // Each time we are to add an entry into the line table matrix - // call the callback funtion so that someone can do something with + // call the callback function so that someone can do something with // the current state of the state machine (like build a line table // or dump the line table!) if (log) 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=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Sat Jan 8 14:28:42 2011 @@ -187,7 +187,7 @@ Prologue::shared_ptr prologue; lldb_private::Log *log; - Callback callback; // Callback funcation that gets called each time an entry it to be added to the matrix + Callback callback; // Callback function that gets called each time an entry is to be added to the matrix void* callbackUserData; int row; // The row number that starts at zero for the prologue, and increases for each row added to the matrix private: Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp Sat Jan 8 14:28:42 2011 @@ -150,7 +150,7 @@ case DW_TAG_inlined_subroutine: // Even if this is a function level static, we don't add it. We could theoretically // add these if we wanted to by introspecting into the DW_AT_location and seeing - // if the location describes a hard coded address, but we dont want the performance + // if the location describes a hard coded address, but we don't want the performance // penalty of that right now. add_die = false; // if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Sat Jan 8 14:28:42 2011 @@ -131,7 +131,7 @@ // End of range list break; } - // Extend 4 byte addresses that consits of 32 bits of 1's to be 64 bits + // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits // of ones switch (addr_size) { Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=123083&r1=123082&r2=123083&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Sat Jan 8 14:28:42 2011 @@ -237,6 +237,6 @@ "\tstate - log private and public process state changes\n" "\tstep - log step related activities\n" "\tunwind - log stack unwind activities\n" - "\tverbose - enable verbose loggging\n" + "\tverbose - enable verbose logging\n" "\twatch - log watchpoint related activities\n"); } From gclayton at apple.com Sat Jan 8 14:31:49 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 8 Jan 2011 12:31:49 -0800 Subject: [Lldb-commits] [Patch] Spelling fixes In-Reply-To: References: Message-ID: <5EBE7327-34F5-4A3F-B230-1C717B9CC3E2@apple.com> Committed revision 123083. Thanks Bruce! On Jan 7, 2011, at 7:31 PM, Bruce Mitchener wrote: > This is, perhaps, the most obsessive patch that I've done in a long > time, but I was reading through the sources to familiarize myself with > them... > > - Bruce > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From gclayton at apple.com Sat Jan 8 15:19:00 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 21:19:00 -0000 Subject: [Lldb-commits] [lldb] r123088 - in /lldb/trunk: include/lldb/Symbol/FuncUnwinders.h include/lldb/Symbol/UnwindPlan.h source/Plugins/Process/Utility/RegisterContextLLDB.cpp source/Symbol/FuncUnwinders.cpp source/Symbol/UnwindPlan.cpp Message-ID: <20110108211900.602512A6C12C@llvm.org> Author: gclayton Date: Sat Jan 8 15:19:00 2011 New Revision: 123088 URL: http://llvm.org/viewvc/llvm-project?rev=123088&view=rev Log: Made FuncUnwinders threadsafe. Other small cleanups as well. Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h lldb/trunk/include/lldb/Symbol/UnwindPlan.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/UnwindPlan.cpp Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=123088&r1=123087&r2=123088&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original) +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Sat Jan 8 15:19:00 2011 @@ -1,12 +1,13 @@ #ifndef liblldb_FuncUnwinders_h #define liblldb_FuncUnwinders_h -#include "lldb/lldb-private.h" -#include "lldb/lldb-forward.h" -#include "lldb/lldb-forward-rtti.h" + +#include + #include "lldb/Core/AddressRange.h" #include "lldb/Core/ArchSpec.h" -#include +#include "lldb/Core/AddressRange.h" +#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -72,15 +73,16 @@ UnwindAssemblyProfiler *m_assembly_profiler; AddressRange m_range; + Mutex m_mutex; std::auto_ptr m_unwind_at_call_site_ap; std::auto_ptr m_unwind_at_non_call_site_ap; - std::auto_ptr m_fast_unwind_ap; - UnwindPlan *m_arch_default_unwind; + std::auto_ptr m_unwind_fast_ap; + UnwindPlan *m_unwind_arch_default; bool m_tried_unwind_at_call_site:1, m_tried_unwind_at_non_call_site:1, - m_tried_fast_unwind:1, - m_tried_arch_default_unwind:1; + m_tried_unwind_fast:1, + m_tried_unwind_arch_default:1; Address m_first_non_prologue_insn; Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=123088&r1=123087&r2=123088&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Sat Jan 8 15:19:00 2011 @@ -204,7 +204,11 @@ public: - UnwindPlan () : m_register_kind(-1), m_row_list(), m_plan_valid_address_range(), m_source_name() + UnwindPlan () : + m_register_kind(-1), + m_row_list(), + m_plan_valid_address_range(), + m_source_name() { m_plan_valid_address_range.SetByteSize (0); } 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=123088&r1=123087&r2=123088&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sat Jan 8 15:19:00 2011 @@ -107,9 +107,9 @@ m_current_pc = frame_sp->GetFrameCodeAddress(); - static ConstString sigtramp_name ("_sigtramp"); - if ((m_sym_ctx.function && m_sym_ctx.function->GetMangled().GetMangledName() == sigtramp_name) - || (m_sym_ctx.symbol && m_sym_ctx.symbol->GetMangled().GetMangledName() == sigtramp_name)) + static ConstString g_sigtramp_name ("_sigtramp"); + if ((m_sym_ctx.function && m_sym_ctx.function->GetName() == g_sigtramp_name) || + (m_sym_ctx.symbol && m_sym_ctx.symbol->GetName() == g_sigtramp_name)) { m_frame_type = eSigtrampFrame; } @@ -184,8 +184,11 @@ if (log) { log->Printf("%*sThread %d Frame %u initialized frame current pc is 0x%llx cfa is 0x%llx using %s UnwindPlan", - m_frame_number < 100 ? m_frame_number : 100, "", m_thread.GetIndexID(), m_frame_number, - (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa, + m_frame_number < 100 ? m_frame_number : 100, "", + m_thread.GetIndexID(), + m_frame_number, + (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), + (uint64_t) m_cfa, m_full_unwind_plan->GetSourceName().GetCString()); } } Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=123088&r1=123087&r2=123088&view=diff ============================================================================== --- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original) +++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Sat Jan 8 15:19:00 2011 @@ -33,14 +33,15 @@ m_unwind_table(unwind_table), m_assembly_profiler(assembly_profiler), m_range(range), + m_mutex (Mutex::eMutexTypeNormal), m_unwind_at_call_site_ap (), m_unwind_at_non_call_site_ap (), - m_fast_unwind_ap (), - m_arch_default_unwind (NULL), + m_unwind_fast_ap (), + m_unwind_arch_default (NULL), m_tried_unwind_at_call_site (false), m_tried_unwind_at_non_call_site (false), - m_tried_fast_unwind (false), - m_tried_arch_default_unwind (false), + m_tried_unwind_fast (false), + m_tried_unwind_arch_default (false), m_first_non_prologue_insn() { } @@ -52,6 +53,19 @@ UnwindPlan* FuncUnwinders::GetUnwindPlanAtCallSite (int current_offset) { + // Lock the mutex to ensure we can always give out the most appropriate + // information. We want to make sure if someone requests a call site unwind + // plan, that they get one and don't run into a race condition where one + // thread has started to create the unwind plan and has put it into + // m_unwind_at_call_site_ap, and have another thread enter this function + // and return the partially filled in m_unwind_at_call_site_ap pointer. + // We also want to make sure that we lock out other unwind plans from + // being accessed until this one is done creating itself in case someone + // had some code like: + // UnwindPlan *best_unwind_plan = ...GetUnwindPlanAtCallSite (...) + // if (best_unwind_plan == NULL) + // best_unwind_plan = GetUnwindPlanAtNonCallSite (...) + Mutex::Locker locker (m_mutex); if (m_tried_unwind_at_call_site == false && m_unwind_at_call_site_ap.get() == NULL) { m_tried_unwind_at_call_site = true; @@ -82,6 +96,19 @@ UnwindPlan* FuncUnwinders::GetUnwindPlanAtNonCallSite (Thread& thread) { + // Lock the mutex to ensure we can always give out the most appropriate + // information. We want to make sure if someone requests an unwind + // plan, that they get one and don't run into a race condition where one + // thread has started to create the unwind plan and has put it into + // the auto_ptr member variable, and have another thread enter this function + // and return the partially filled pointer contained in the auto_ptr. + // We also want to make sure that we lock out other unwind plans from + // being accessed until this one is done creating itself in case someone + // had some code like: + // UnwindPlan *best_unwind_plan = ...GetUnwindPlanAtCallSite (...) + // if (best_unwind_plan == NULL) + // best_unwind_plan = GetUnwindPlanAtNonCallSite (...) + Mutex::Locker locker (m_mutex); if (m_tried_unwind_at_non_call_site == false && m_unwind_at_non_call_site_ap.get() == NULL) { m_tried_unwind_at_non_call_site = true; @@ -95,22 +122,48 @@ UnwindPlan* FuncUnwinders::GetUnwindPlanFastUnwind (Thread& thread) { - if (m_tried_fast_unwind == false && m_fast_unwind_ap.get() == NULL) + // Lock the mutex to ensure we can always give out the most appropriate + // information. We want to make sure if someone requests an unwind + // plan, that they get one and don't run into a race condition where one + // thread has started to create the unwind plan and has put it into + // the auto_ptr member variable, and have another thread enter this function + // and return the partially filled pointer contained in the auto_ptr. + // We also want to make sure that we lock out other unwind plans from + // being accessed until this one is done creating itself in case someone + // had some code like: + // UnwindPlan *best_unwind_plan = ...GetUnwindPlanAtCallSite (...) + // if (best_unwind_plan == NULL) + // best_unwind_plan = GetUnwindPlanAtNonCallSite (...) + Mutex::Locker locker (m_mutex); + if (m_tried_unwind_fast == false && m_unwind_fast_ap.get() == NULL) { - m_tried_fast_unwind = true; - m_fast_unwind_ap.reset (new UnwindPlan); - if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_fast_unwind_ap)) - m_fast_unwind_ap.reset(); + m_tried_unwind_fast = true; + m_unwind_fast_ap.reset (new UnwindPlan); + if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_unwind_fast_ap)) + m_unwind_fast_ap.reset(); } - return m_fast_unwind_ap.get(); + return m_unwind_fast_ap.get(); } UnwindPlan* FuncUnwinders::GetUnwindPlanArchitectureDefault (Thread& thread) { - if (m_tried_arch_default_unwind == false && m_arch_default_unwind == NULL) + // Lock the mutex to ensure we can always give out the most appropriate + // information. We want to make sure if someone requests an unwind + // plan, that they get one and don't run into a race condition where one + // thread has started to create the unwind plan and has put it into + // the auto_ptr member variable, and have another thread enter this function + // and return the partially filled pointer contained in the auto_ptr. + // We also want to make sure that we lock out other unwind plans from + // being accessed until this one is done creating itself in case someone + // had some code like: + // UnwindPlan *best_unwind_plan = ...GetUnwindPlanAtCallSite (...) + // if (best_unwind_plan == NULL) + // best_unwind_plan = GetUnwindPlanAtNonCallSite (...) + Mutex::Locker locker (m_mutex); + if (m_tried_unwind_arch_default == false && m_unwind_arch_default == NULL) { - m_tried_arch_default_unwind = true; + m_tried_unwind_arch_default = true; Address current_pc; Target *target = thread.CalculateTarget(); if (target) @@ -118,11 +171,11 @@ ArchSpec arch = target->GetArchitecture (); ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); if (arch_default) - m_arch_default_unwind = arch_default->GetArchDefaultUnwindPlan (thread, current_pc); + m_unwind_arch_default = arch_default->GetArchDefaultUnwindPlan (thread, current_pc); } } - return m_arch_default_unwind; + return m_unwind_arch_default; } Address& Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=123088&r1=123087&r2=123088&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindPlan.cpp (original) +++ lldb/trunk/source/Symbol/UnwindPlan.cpp Sat Jan 8 15:19:00 2011 @@ -97,13 +97,13 @@ switch (m_type) { case unspecified: - s.Printf ("unspecified"); + s.PutCString ("unspecified"); break; case isUndefined: - s.Printf ("isUndefined"); + s.PutCString ("isUndefined"); break; case isSame: - s.Printf ("isSame"); + s.PutCString ("isSame"); break; case atCFAPlusOffset: s.Printf ("atCFAPlusOffset %d", m_location.offset); @@ -115,10 +115,10 @@ s.Printf ("inOtherRegister %d", m_location.reg_num); break; case atDWARFExpression: - s.Printf ("atDWARFExpression"); + s.PutCString ("atDWARFExpression"); break; case isDWARFExpression: - s.Printf ("isDWARFExpression"); + s.PutCString ("isDWARFExpression"); break; } } @@ -157,7 +157,7 @@ s.Printf ("CFA offset %d", (int) GetCFAOffset ()); for (collection::const_iterator idx = m_register_locations.begin (); idx != m_register_locations.end (); ++idx) { - s.Printf (" ["); + s.PutCString (" ["); bool printed_name = false; if (reg_ctx) { @@ -174,9 +174,9 @@ s.Printf ("reg %d ", idx->first); } idx->second.Dump(s); - s.Printf ("]"); + s.PutCString ("]"); } - s.Printf ("\n"); + s.EOL(); } UnwindPlan::Row::Row() : @@ -218,23 +218,24 @@ const UnwindPlan::Row * UnwindPlan::GetRowForFunctionOffset (int offset) const { - const UnwindPlan::Row *rowp = NULL; - if (offset == -1 && m_row_list.size() > 0) + const UnwindPlan::Row *row_ptr = NULL; + if (!m_row_list.empty()) { - return &m_row_list[m_row_list.size() - 1]; - } - for (int i = 0; i < m_row_list.size(); ++i) - { - if (m_row_list[i].GetOffset() <= offset) - { - rowp = &m_row_list[i]; - } + if (offset == -1) + row_ptr = &m_row_list.back(); else { - break; + collection::const_iterator pos, end = m_row_list.end(); + for (pos = m_row_list.begin(); pos != end; ++pos) + { + if (pos->GetOffset() <= offset) + row_ptr = &*pos; + else + break; + } } } - return rowp; + return row_ptr; } bool @@ -247,6 +248,7 @@ UnwindPlan::GetRowAtIndex (uint32_t idx) const { // You must call IsValidRowIndex(idx) first before calling this!!! + assert (idx < m_row_list.size()); return m_row_list[idx]; } @@ -272,11 +274,7 @@ UnwindPlan::SetPlanValidAddressRange (const AddressRange& range) { if (range.GetBaseAddress().IsValid() && range.GetByteSize() != 0) - { m_plan_valid_address_range = range; - } -// .GetBaseAddress() = addr; -// m_plan_valid_address_range.SetByteSize (range.GetByteSize()); } bool @@ -303,25 +301,25 @@ } if (m_plan_valid_address_range.GetBaseAddress().IsValid() && m_plan_valid_address_range.GetByteSize() > 0) { - s.Printf ("Address range of this UnwindPlan: "); + s.PutCString ("Address range of this UnwindPlan: "); m_plan_valid_address_range.Dump (&s, &thread->GetProcess().GetTarget(), Address::DumpStyleSectionNameOffset); - s.Printf ("\n"); + s.EOL(); } else { - s.Printf ("No valid address range recorded for this UnwindPlan.\n"); + s.PutCString ("No valid address range recorded for this UnwindPlan.\n"); } s.Printf ("UnwindPlan register kind %d", m_register_kind); switch (m_register_kind) { - case eRegisterKindGCC: s.Printf (" [eRegisterKindGCC]"); break; - case eRegisterKindDWARF: s.Printf (" [eRegisterKindDWARF]"); break; - case eRegisterKindGeneric: s.Printf (" [eRegisterKindGeneric]"); break; - case eRegisterKindGDB: s.Printf (" [eRegisterKindGDB]"); break; - case eRegisterKindLLDB: s.Printf (" [eRegisterKindLLDB]"); break; + case eRegisterKindGCC: s.PutCString (" [eRegisterKindGCC]"); break; + case eRegisterKindDWARF: s.PutCString (" [eRegisterKindDWARF]"); break; + case eRegisterKindGeneric: s.PutCString (" [eRegisterKindGeneric]"); break; + case eRegisterKindGDB: s.PutCString (" [eRegisterKindGDB]"); break; + case eRegisterKindLLDB: s.PutCString (" [eRegisterKindLLDB]"); break; default: break; } - s.Printf ("\n"); + s.EOL(); for (int i = 0; IsValidRowIndex (i); i++) { s.Printf ("UnwindPlan row at index %d: ", i); From gclayton at apple.com Sat Jan 8 16:26:47 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 22:26:47 -0000 Subject: [Lldb-commits] [lldb] r123092 - in /lldb/trunk/source: Core/ValueObject.cpp Core/ValueObjectChild.cpp Symbol/ClangASTContext.cpp Message-ID: <20110108222648.05F542A6C12C@llvm.org> Author: gclayton Date: Sat Jan 8 16:26:47 2011 New Revision: 123092 URL: http://llvm.org/viewvc/llvm-project?rev=123092&view=rev Log: Make sure we don't assert if we have a child with zero byte size. Also we now say that "void *" value objects don't have children. Modified: lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Core/ValueObjectChild.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=123092&r1=123091&r2=123092&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Sat Jan 8 16:26:47 2011 @@ -383,7 +383,7 @@ child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class); - if (child_clang_type) + if (child_clang_type && child_byte_size) { if (synthetic_index) child_byte_offset += child_byte_size * synthetic_index; @@ -1245,7 +1245,7 @@ child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class); - if (child_clang_type) + if (child_clang_type && child_byte_offset) { ConstString child_name; if (!child_name_str.empty()) Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=123092&r1=123091&r2=123092&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Sat Jan 8 16:26:47 2011 @@ -47,7 +47,6 @@ { assert (bitfield_bit_size < (sizeof(m_bitfield_bit_size ) * CHAR_BIT)); assert (bitfield_bit_offset < (sizeof(m_bitfield_bit_offset) * CHAR_BIT)); - assert(byte_size != 0 && "TEMPORARY DEBUGGING ASSERT"); m_name = name; } Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=123092&r1=123091&r2=123092&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sat Jan 8 16:26:47 2011 @@ -2053,7 +2053,43 @@ const clang::Type::TypeClass type_class = qual_type->getTypeClass(); switch (type_class) { - case clang::Type::Builtin: return 1; + case clang::Type::Builtin: + switch (cast(qual_type)->getKind()) + { + case clang::BuiltinType::Void: + case clang::BuiltinType::NullPtr: + return 0; + case clang::BuiltinType::Bool: + case clang::BuiltinType::Char_U: + case clang::BuiltinType::UChar: + case clang::BuiltinType::Char16: + case clang::BuiltinType::Char32: + case clang::BuiltinType::UShort: + case clang::BuiltinType::UInt: + case clang::BuiltinType::ULong: + case clang::BuiltinType::ULongLong: + case clang::BuiltinType::UInt128: + case clang::BuiltinType::Char_S: + case clang::BuiltinType::SChar: + case clang::BuiltinType::WChar: + case clang::BuiltinType::Short: + case clang::BuiltinType::Int: + case clang::BuiltinType::Long: + case clang::BuiltinType::LongLong: + case clang::BuiltinType::Int128: + case clang::BuiltinType::Float: + case clang::BuiltinType::Double: + case clang::BuiltinType::LongDouble: + case clang::BuiltinType::Dependent: + case clang::BuiltinType::Overload: + case clang::BuiltinType::UndeducedAuto: + case clang::BuiltinType::ObjCId: + case clang::BuiltinType::ObjCClass: + case clang::BuiltinType::ObjCSel: + return 1; + } + break; + case clang::Type::Complex: return 2; case clang::Type::Pointer: return 1; case clang::Type::BlockPointer: return 0; // If block pointers don't have debug info, then no children for them @@ -2403,6 +2439,10 @@ { PointerType *pointer_type = cast(parent_qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); + + // Don't dereference "void *" pointers + if (pointee_type->isVoidType()) + return NULL; if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) { From gclayton at apple.com Sat Jan 8 16:55:04 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 08 Jan 2011 22:55:04 -0000 Subject: [Lldb-commits] [lldb] r123094 - /lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Message-ID: <20110108225504.73B3E2A6C12C@llvm.org> Author: gclayton Date: Sat Jan 8 16:55:04 2011 New Revision: 123094 URL: http://llvm.org/viewvc/llvm-project?rev=123094&view=rev Log: Fixed the "-b" option on disassembly to always pad out the bytes with for i386 and for x86_64 to allow 15 byte opcodes to be displayed. This outputs clean looking disassembly when the bytes are shown. Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=123094&r1=123093&r2=123094&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original) +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Sat Jan 8 16:55:04 2011 @@ -129,11 +129,14 @@ if (bytes) { uint32_t bytes_dumped = bytes->Dump(s, bytes_offset, eFormatBytes, 1, EDInstByteSize(m_inst), UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0) - bytes_offset; - // Allow for 8 bytes of opcodes normally - const uint32_t default_num_opcode_bytes = 9; + // Allow for 15 bytes of opcodes since this is the max for x86_64. + // TOOD: We need to taylor this better for different architectures. For + // ARM we would want to show 16 bit opcodes for Thumb as properly byte + // swapped uint16_t values, or 32 bit values swapped values for ARM. + const uint32_t default_num_opcode_bytes = 15; if (bytes_dumped * 3 < (default_num_opcode_bytes*3)) { - uint32_t indent_level = (default_num_opcode_bytes*3) - (bytes_dumped * 3); + uint32_t indent_level = (default_num_opcode_bytes*3) - (bytes_dumped * 3) + 1; s->Printf("%*.*s", indent_level, indent_level, ""); } } From gclayton at apple.com Sun Jan 9 15:07:36 2011 From: gclayton at apple.com (Greg Clayton) Date: Sun, 09 Jan 2011 21:07:36 -0000 Subject: [Lldb-commits] [lldb] r123127 - in /lldb/trunk: include/lldb/Expression/ include/lldb/Target/ source/Core/ source/Expression/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Target/ Message-ID: <20110109210736.459E32A6C12C@llvm.org> Author: gclayton Date: Sun Jan 9 15:07:35 2011 New Revision: 123127 URL: http://llvm.org/viewvc/llvm-project?rev=123127&view=rev Log: Put more smarts into the RegisterContext base class. Now the base class has a method: void RegisterContext::InvalidateIfNeeded (bool force); Each time this function is called, when "force" is false, it will only call the pure virtual "virtual void RegisterContext::InvalideAllRegisters()" if the register context's stop ID doesn't match that of the process. When the stop ID doesn't match, or "force" is true, the base class will clear its cached registers and the RegisterContext will update its stop ID to match that of the process. This helps make it easier to correctly flush the register context (possibly from multiple locations depending on when and where new registers are availabe) without inadvertently clearing the register cache when it doesn't need to be. Modified the ProcessGDBRemote plug-in to be much more efficient when it comes to: - caching the expedited registers in the stop reply packets (we were ignoring these before and it was causing us to read at least three registers every time we stopped that were already supplied in the stop reply packet). - When a thread has no stop reason, don't keep asking for the thread stopped info. Prior to this fix we would continually send a qThreadStopInfo packet over and over when any thread stop info was requested. We now note the stop ID that the stop info was requested for and avoid multiple requests. Cleaned up some of the expression code to not look for ClangExpressionVariable objects up by name since they are now shared pointers and we can just look for the exact pointer match and avoid possible errors. Fixed an bug in the ValueObject code that would cause children to not be displayed. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h lldb/trunk/include/lldb/Target/RegisterContext.h lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/RegisterContext.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Sun Jan 9 15:07:35 2011 @@ -226,13 +226,13 @@ //---------------------------------------------------------------------- /// Implementation of methods in ClangExpressionVariableListBase //---------------------------------------------------------------------- - virtual size_t + size_t GetSize() { return m_variables.size(); } - virtual lldb::ClangExpressionVariableSP + lldb::ClangExpressionVariableSP GetVariableAtIndex(size_t index) { lldb::ClangExpressionVariableSP var_sp; @@ -241,13 +241,25 @@ return var_sp; } - virtual size_t + size_t AddVariable (const lldb::ClangExpressionVariableSP &var_sp) { m_variables.push_back(var_sp); return m_variables.size() - 1; } + bool + ContainsVariable (const lldb::ClangExpressionVariableSP &var_sp) + { + const size_t size = m_variables.size(); + for (size_t index = 0; index < size; ++index) + { + if (m_variables[index].get() == var_sp.get()) + return true; + } + return false; + } + //---------------------------------------------------------------------- /// Finds a variable by name in the list. /// Modified: lldb/trunk/include/lldb/Target/RegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/RegisterContext.h (original) +++ lldb/trunk/include/lldb/Target/RegisterContext.h Sun Jan 9 15:07:35 2011 @@ -31,11 +31,14 @@ virtual ~RegisterContext (); + void + InvalidateIfNeeded (bool force); + //------------------------------------------------------------------ // Subclasses must override these functions //------------------------------------------------------------------ virtual void - Invalidate () = 0; + InvalidateAllRegisters () = 0; virtual size_t GetRegisterCount () = 0; @@ -163,12 +166,25 @@ virtual void CalculateExecutionContext (ExecutionContext &exe_ctx); + uint32_t + GetStopID () const + { + return m_stop_id; + } + + void + SetStopID (uint32_t stop_id) + { + m_stop_id = stop_id; + } + protected: //------------------------------------------------------------------ // Classes that inherit from RegisterContext can see and modify these //------------------------------------------------------------------ Thread &m_thread; // The thread that this register context belongs to. uint32_t m_concrete_frame_idx; // The concrete frame index for this register context + uint32_t m_stop_id; // The stop ID that any data in this context is valid for private: //------------------------------------------------------------------ // For RegisterContext only Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Sun Jan 9 15:07:35 2011 @@ -1245,7 +1245,7 @@ child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class); - if (child_clang_type && child_byte_offset) + if (child_clang_type && child_byte_size) { ConstString child_name; if (!child_name_str.empty()) Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Sun Jan 9 15:07:35 2011 @@ -713,13 +713,9 @@ { ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(member_index)); - ClangExpressionVariableSP entity_sp (m_found_entities.GetVariable(member_sp->GetName())); - - ClangExpressionVariableSP persistent_var_sp (persistent_vars.GetVariable(member_sp->GetName())); - - if (entity_sp) + if (m_found_entities.ContainsVariable (member_sp)) { - RegisterInfo *reg_info = entity_sp->GetRegisterInfo (); + RegisterInfo *reg_info = member_sp->GetRegisterInfo (); if (reg_info) { // This is a register variable @@ -752,34 +748,36 @@ return false; } } - else if (persistent_var_sp) + else { - if (member_sp->GetName() == m_struct_vars->m_result_name) + // No need to look for presistent variables if the name doesn't start + // with with a '$' character... + if (member_sp->GetName().AsCString ("!")[0] == '$' && persistent_vars.ContainsVariable(member_sp)) { - if (!dematerialize) - continue; - - if (log) - log->PutCString("Found result member in the struct"); - - if (result_sp_ptr) - *result_sp_ptr = member_sp; + if (member_sp->GetName() == m_struct_vars->m_result_name) + { + if (!dematerialize) + continue; + + if (log) + log->PutCString("Found result member in the struct"); + + if (result_sp_ptr) + *result_sp_ptr = member_sp; + } + + if (!DoMaterializeOnePersistentVariable (dematerialize, + exe_ctx, + member_sp, + m_material_vars->m_materialized_location + member_sp->m_jit_vars->m_offset, + err)) + return false; } - - if (log) - log->Printf("Searched for persistent variable %s and found %s", member_sp->GetName().GetCString(), persistent_var_sp->GetName().GetCString()); - - if (!DoMaterializeOnePersistentVariable (dematerialize, - exe_ctx, - persistent_var_sp, - m_material_vars->m_materialized_location + member_sp->m_jit_vars->m_offset, - err)) + else + { + err.SetErrorStringWithFormat("Unexpected variable %s", member_sp->GetName().GetCString()); return false; - } - else - { - err.SetErrorStringWithFormat("Unexpected variable %s", member_sp->GetName().GetCString()); - return false; + } } } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp Sun Jan 9 15:07:35 2011 @@ -394,7 +394,7 @@ static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo)); void -RegisterContextMach_arm::Invalidate () +RegisterContextMach_arm::InvalidateAllRegisters () { InvalidateAllRegisterStates(); } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h Sun Jan 9 15:07:35 2011 @@ -60,7 +60,7 @@ ~RegisterContextMach_arm(); virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp Sun Jan 9 15:07:35 2011 @@ -275,7 +275,7 @@ static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo)); void -RegisterContextMach_i386::Invalidate () +RegisterContextMach_i386::InvalidateAllRegisters () { InvalidateAllRegisterStates(); } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h Sun Jan 9 15:07:35 2011 @@ -28,7 +28,7 @@ ~RegisterContextMach_i386(); virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp Sun Jan 9 15:07:35 2011 @@ -311,7 +311,7 @@ void -RegisterContextMach_x86_64::Invalidate () +RegisterContextMach_x86_64::InvalidateAllRegisters () { InvalidateAllRegisterStates(); } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h Sun Jan 9 15:07:35 2011 @@ -27,7 +27,7 @@ ~RegisterContextMach_x86_64(); virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Sun Jan 9 15:07:35 2011 @@ -198,7 +198,7 @@ ThreadMacOSX::RefreshStateAfterStop() { // Invalidate all registers in our register context - GetRegisterContext()->Invalidate(); + GetRegisterContext()->InvalidateIfNeeded (false); m_context->RefreshStateAfterStop(); @@ -650,7 +650,7 @@ // Clear out all stack frames as our world just changed. ClearStackFrames(); - frame_sp->GetRegisterContext()->Invalidate(); + frame_sp->GetRegisterContext()->InvalidateIfNeeded(true); return ret; } 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=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sun Jan 9 15:07:35 2011 @@ -633,7 +633,7 @@ void -RegisterContextLLDB::Invalidate () +RegisterContextLLDB::InvalidateAllRegisters () { m_frame_type = eNotAValidFrame; } 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=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Sun Jan 9 15:07:35 2011 @@ -33,7 +33,7 @@ ~RegisterContextLLDB () { } virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp Sun Jan 9 15:07:35 2011 @@ -46,7 +46,7 @@ } void -RegisterContextMacOSXFrameBackchain::Invalidate () +RegisterContextMacOSXFrameBackchain::InvalidateAllRegisters () { m_cursor_is_valid = false; } Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h Sun Jan 9 15:07:35 2011 @@ -36,7 +36,7 @@ // Subclasses must override these functions //------------------------------------------------------------------ virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); 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=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Sun Jan 9 15:07:35 2011 @@ -35,6 +35,7 @@ { //#define DEBUG_FRAME_SPEED 1 #if DEBUG_FRAME_SPEED +#define FRAME_COUNT 10000 TimeValue time_value (TimeValue::Now()); #endif if (!AddFirstFrame ()) @@ -42,11 +43,15 @@ while (AddOneMoreFrame ()) { #if DEBUG_FRAME_SPEED - if ((m_frames.size() % 10000) == 0) + if ((m_frames.size() % FRAME_COUNT) == 0) { TimeValue now(TimeValue::Now()); uint64_t delta_t = now - time_value; - printf ("10000 frames in %llu.%09llu ms\n", delta_t / NSEC_PER_SEC, delta_t % NSEC_PER_SEC); + printf ("%u frames in %llu.%09llu ms (%g frames/sec)\n", + FRAME_COUNT, + delta_t / NSEC_PER_SEC, + delta_t % NSEC_PER_SEC, + (float)FRAME_COUNT / ((float)delta_t / (float)NSEC_PER_SEC)); time_value = now; } #endif Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Sun Jan 9 15:07:35 2011 @@ -39,7 +39,6 @@ RegisterContext (thread, concrete_frame_idx), m_reg_info (reg_info), m_reg_valid (), - m_reg_valid_stop_id (), m_reg_data (), m_read_all_at_once (read_all_at_once) { @@ -74,7 +73,7 @@ } void -GDBRemoteRegisterContext::Invalidate () +GDBRemoteRegisterContext::InvalidateAllRegisters () { SetAllRegisterValid (false); } @@ -179,25 +178,41 @@ return false; } +void +GDBRemoteRegisterContext::PrivateSetRegisterValue (uint32_t reg, StringExtractor &response) +{ + const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg); + assert (reg_info); + + // Invalidate if needed + InvalidateIfNeeded(false); + + const uint32_t reg_byte_size = reg_info->byte_size; + const size_t bytes_copied = response.GetHexBytes (const_cast(m_reg_data.PeekData(reg_info->byte_offset, reg_byte_size)), reg_byte_size, '\xcc'); + bool success = bytes_copied == reg_byte_size; + if (success) + { + m_reg_valid[reg] = true; + } + else if (bytes_copied > 0) + { + // Only set register is valid to false if we copied some bytes, else + // leave it as it was. + m_reg_valid[reg] = false; + } +} + bool GDBRemoteRegisterContext::ReadRegisterBytes (uint32_t reg, DataExtractor &data) { GDBRemoteCommunication &gdb_comm = GetGDBProcess().GetGDBRemote(); -// FIXME: This check isn't right because IsRunning checks the Public state, but this -// is work you need to do - for instance in ShouldStop & friends - before the public -// state has been changed. -// if (gdb_comm.IsRunning()) -// return false; - if (m_reg_valid_stop_id != m_thread.GetProcess().GetStopID()) - { - Invalidate(); - m_reg_valid_stop_id = m_thread.GetProcess().GetStopID(); - } + InvalidateIfNeeded(false); + const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg); assert (reg_info); - if (m_reg_valid[reg] == false) + if (!m_reg_valid[reg]) { Mutex::Locker locker; if (gdb_comm.GetSequenceMutex (locker)) @@ -225,28 +240,27 @@ packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg); assert (packet_len < (sizeof(packet) - 1)); if (gdb_comm.SendPacketAndWaitForResponse(packet, response, 1, false)) - if (response.GetHexBytes (const_cast(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)), reg_info->byte_size, '\xcc') == reg_info->byte_size) - m_reg_valid[reg] = true; + PrivateSetRegisterValue (reg, response); } } } + + // Make sure we got a valid register value after reading it + if (!m_reg_valid[reg]) + return false; } - bool reg_is_valid = m_reg_valid[reg]; - if (reg_is_valid) + if (&data != &m_reg_data) { - if (&data != &m_reg_data) - { - // If we aren't extracting into our own buffer (which - // only happens when this function is called from - // ReadRegisterValue(uint32_t, Scalar&)) then - // we transfer bytes from our buffer into the data - // buffer that was passed in - data.SetByteOrder (m_reg_data.GetByteOrder()); - data.SetData (m_reg_data, reg_info->byte_offset, reg_info->byte_size); - } + // If we aren't extracting into our own buffer (which + // only happens when this function is called from + // ReadRegisterValue(uint32_t, Scalar&)) then + // we transfer bytes from our buffer into the data + // buffer that was passed in + data.SetByteOrder (m_reg_data.GetByteOrder()); + data.SetData (m_reg_data, reg_info->byte_offset, reg_info->byte_size); } - return reg_is_valid; + return true; } @@ -323,8 +337,8 @@ eByteOrderHost); // Invalidate all register values - Invalidate (); - + InvalidateIfNeeded (true); + if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), packet.GetString().size(), response, Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h Sun Jan 9 15:07:35 2011 @@ -25,6 +25,7 @@ class ThreadGDBRemote; class ProcessGDBRemote; +class StringExtractor; class GDBRemoteDynamicRegisterInfo { @@ -189,7 +190,7 @@ // Subclasses must override these functions //------------------------------------------------------------------ virtual void - Invalidate (); + InvalidateAllRegisters (); virtual size_t GetRegisterCount (); @@ -225,8 +226,12 @@ ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num); protected: + friend class ThreadGDBRemote; void + PrivateSetRegisterValue (uint32_t reg, StringExtractor &response); + + void SetAllRegisterValid (bool b); ProcessGDBRemote & @@ -237,7 +242,6 @@ GDBRemoteDynamicRegisterInfo &m_reg_info; std::vector m_reg_valid; - uint32_t m_reg_valid_stop_id; lldb_private::DataExtractor m_reg_data; bool m_read_all_at_once; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sun Jan 9 15:07:35 2011 @@ -975,9 +975,7 @@ if (tid != LLDB_INVALID_THREAD_ID) { ThreadSP thread_sp (GetThreadList().FindThreadByID (tid, false)); - if (thread_sp) - thread_sp->GetRegisterContext()->Invalidate(); - else + if (!thread_sp) thread_sp.reset (new ThreadGDBRemote (*this, tid)); curr_thread_list.AddThread(thread_sp); } @@ -1014,6 +1012,8 @@ uint32_t tid = LLDB_INVALID_THREAD_ID; addr_t thread_dispatch_qaddr = LLDB_INVALID_ADDRESS; uint32_t exc_data_count = 0; + ThreadSP thread_sp; + while (stop_packet.GetNameColonValue(name, value)) { if (name.compare("metype") == 0) @@ -1035,6 +1035,7 @@ { // thread in big endian hex tid = Args::StringToUInt32 (value.c_str(), 0, 16); + thread_sp = m_thread_list.FindThreadByID(tid, false); } else if (name.compare("hexname") == 0) { @@ -1053,8 +1054,25 @@ { thread_dispatch_qaddr = Args::StringToUInt64 (value.c_str(), 0, 16); } + else if (name.size() == 2 && ::isxdigit(name[0]) && ::isxdigit(name[1])) + { + // We have a register number that contains an expedited + // register value. Lets supply this register to our thread + // so it won't have to go and read it. + if (thread_sp) + { + uint32_t reg = Args::StringToUInt32 (name.c_str(), UINT32_MAX, 16); + + if (reg != UINT32_MAX) + { + StringExtractor reg_value_extractor; + // Swap "value" over into "reg_value_extractor" + reg_value_extractor.GetStringRef().swap(value); + static_cast (thread_sp.get())->PrivateSetRegisterValue (reg, reg_value_extractor); + } + } + } } - ThreadSP thread_sp (m_thread_list.FindThreadByID(tid, false)); if (thread_sp) { Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Sun Jan 9 15:07:35 2011 @@ -37,7 +37,8 @@ Thread(process, tid), m_thread_name (), m_dispatch_queue_name (), - m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS) + m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS), + m_thread_stop_reason_stop_id (0) { // ProcessGDBRemoteLog::LogIf(GDBR_LOG_THREAD | GDBR_LOG_VERBOSE, "ThreadGDBRemote::ThreadGDBRemote ( pid = %i, tid = 0x%4.4x, )", m_process.GetID(), GetID()); ProcessGDBRemoteLog::LogIf(GDBR_LOG_THREAD, "%p: ThreadGDBRemote::ThreadGDBRemote (pid = %i, tid = 0x%4.4x)", this, m_process.GetID(), GetID()); @@ -116,14 +117,18 @@ void ThreadGDBRemote::RefreshStateAfterStop() { - // Invalidate all registers in our register context - GetRegisterContext()->Invalidate(); + // Invalidate all registers in our register context. We don't set "force" to + // true because the stop reply packet might have had some register values + // that were expedited and these will already be copied into the register + // context by the time this function gets called. The GDBRemoteRegisterContext + // class has been made smart enough to detect when it needs to invalidate + // which registers are valid by putting hooks in the register read and + // register supply functions where they check the process stop ID and do + // the right thing. + const bool force = false; + GetRegisterContext()->InvalidateIfNeeded (force); } -// Whether to use the new native unwinder (UnwindLLDB) or the libunwind-remote based unwinder for -// stack walks on i386/x86_64 -#define USE_NATIVE_UNWINDER - Unwind * ThreadGDBRemote::GetUnwinder () { @@ -132,11 +137,7 @@ const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ()); if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386")) { -#if defined (USE_NATIVE_UNWINDER) m_unwinder_ap.reset (new UnwindLLDB (*this)); -#else - m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace())); -#endif } else { @@ -198,6 +199,14 @@ return reg_ctx_sp; } +void +ThreadGDBRemote::PrivateSetRegisterValue (uint32_t reg, StringExtractor &response) +{ + GDBRemoteRegisterContext *gdb_reg_ctx = static_cast(GetRegisterContext ().get()); + assert (gdb_reg_ctx); + gdb_reg_ctx->PrivateSetRegisterValue (reg, response); +} + bool ThreadGDBRemote::SaveFrameZeroState (RegisterCheckpoint &checkpoint) { @@ -217,7 +226,7 @@ if (frame_sp) { bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (checkpoint.GetData()); - frame_sp->GetRegisterContext()->Invalidate(); + frame_sp->GetRegisterContext()->InvalidateIfNeeded(true); ClearStackFrames(); return ret; } @@ -227,8 +236,19 @@ lldb::StopInfoSP ThreadGDBRemote::GetPrivateStopReason () { - if (m_actual_stop_info_sp.get() == NULL || m_actual_stop_info_sp->IsValid() == false) + const uint32_t process_stop_id = GetProcess().GetStopID(); + if (m_thread_stop_reason_stop_id != process_stop_id || + (m_actual_stop_info_sp && !m_actual_stop_info_sp->IsValid())) { + // If GetGDBProcess().SetThreadStopInfo() doesn't find a stop reason + // for this thread, then m_actual_stop_info_sp will not ever contain + // a valid stop reason and the "m_actual_stop_info_sp->IsValid() == false" + // check will never be able to tell us if we have the correct stop info + // for this thread and we will continually send qThreadStopInfo packets + // down to the remote GDB server, so we need to keep our own notion + // of the stop ID that m_actual_stop_info_sp is valid for (even if it + // contains nothing). We use m_thread_stop_reason_stop_id for this below. + m_thread_stop_reason_stop_id = process_stop_id; m_actual_stop_info_sp.reset(); char packet[256]; @@ -236,7 +256,6 @@ StringExtractorGDBRemote stop_packet; if (GetGDBProcess().GetGDBRemote().SendPacketAndWaitForResponse(packet, stop_packet, 1, false)) { - std::string copy(stop_packet.GetStringRef()); GetGDBProcess().SetThreadStopInfo (stop_packet); } } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h Sun Jan 9 15:07:35 2011 @@ -108,12 +108,20 @@ } protected: + + friend class ProcessGDBRemote; + + void + PrivateSetRegisterValue (uint32_t reg, + StringExtractor &response); + //------------------------------------------------------------------ // Member variables. //------------------------------------------------------------------ std::string m_thread_name; std::string m_dispatch_queue_name; lldb::addr_t m_thread_dispatch_qaddr; + uint32_t m_thread_stop_reason_stop_id; //------------------------------------------------------------------ // Member variables. //------------------------------------------------------------------ Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Sun Jan 9 15:07:35 2011 @@ -234,7 +234,7 @@ m_addr_byte_size (0), m_abi_sp (), m_process_input_reader (), - m_stdio_communication ("lldb.process.stdio"), + m_stdio_communication ("process.stdio"), m_stdio_communication_mutex (Mutex::eMutexTypeRecursive), m_stdout_data (), m_memory_cache () @@ -2004,7 +2004,9 @@ // Create a thread that watches our internal state and controls which // events make it to clients (into the DCProcess event queue). - m_private_state_thread = Host::ThreadCreate ("", Process::PrivateStateThread, this, NULL); + char thread_name[1024]; + snprintf(thread_name, sizeof(thread_name), "", GetID()); + m_private_state_thread = Host::ThreadCreate (thread_name, Process::PrivateStateThread, this, NULL); return m_private_state_thread != LLDB_INVALID_HOST_THREAD; } Modified: lldb/trunk/source/Target/RegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/RegisterContext.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Target/RegisterContext.cpp (original) +++ lldb/trunk/source/Target/RegisterContext.cpp Sun Jan 9 15:07:35 2011 @@ -16,6 +16,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/StackFrame.h" +#include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" using namespace lldb; @@ -23,7 +24,8 @@ RegisterContext::RegisterContext (Thread &thread, uint32_t concrete_frame_idx) : m_thread (thread), - m_concrete_frame_idx (concrete_frame_idx) + m_concrete_frame_idx (concrete_frame_idx), + m_stop_id (thread.GetProcess().GetStopID()) { } @@ -34,6 +36,19 @@ { } +void +RegisterContext::InvalidateIfNeeded (bool force) +{ + const uint32_t this_stop_id = GetStopID(); + const uint32_t process_stop_id = m_thread.GetProcess().GetStopID(); + if (force || process_stop_id != this_stop_id) + { + InvalidateAllRegisters (); + SetStopID (process_stop_id); + } +} + + const RegisterInfo * RegisterContext::GetRegisterInfoByName (const char *reg_name, uint32_t start_idx) { Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=123127&r1=123126&r2=123127&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Sun Jan 9 15:07:35 2011 @@ -961,7 +961,11 @@ { // Make sure we aren't just trying to see the value of a persistent // variable (something like "$0") - lldb::ClangExpressionVariableSP persistent_var_sp (m_persistent_variables.GetVariable (expr_cstr)); + lldb::ClangExpressionVariableSP persistent_var_sp; + // Only check for persistent variables the expression starts with a '$' + if (expr_cstr[0] == '$') + persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr); + if (persistent_var_sp) { result_valobj_sp = persistent_var_sp->GetValueObject (); From gclayton at apple.com Sun Jan 9 16:26:45 2011 From: gclayton at apple.com (Greg Clayton) Date: Sun, 09 Jan 2011 22:26:45 -0000 Subject: [Lldb-commits] [lldb] r123132 - /lldb/trunk/source/Core/ValueObjectChild.cpp Message-ID: <20110109222645.30E6A2A6C12C@llvm.org> Author: gclayton Date: Sun Jan 9 16:26:45 2011 New Revision: 123132 URL: http://llvm.org/viewvc/llvm-project?rev=123132&view=rev Log: Removed a few bad assert() statement regarding bitfields. Modified: lldb/trunk/source/Core/ValueObjectChild.cpp Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=123132&r1=123131&r2=123132&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Sun Jan 9 16:26:45 2011 @@ -45,8 +45,6 @@ m_bitfield_bit_offset (bitfield_bit_offset), m_is_base_class (is_base_class) { - assert (bitfield_bit_size < (sizeof(m_bitfield_bit_size ) * CHAR_BIT)); - assert (bitfield_bit_offset < (sizeof(m_bitfield_bit_offset) * CHAR_BIT)); m_name = name; } From gclayton at apple.com Sun Jan 9 21:47:25 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 10 Jan 2011 03:47:25 -0000 Subject: [Lldb-commits] [lldb] r123157 - /lldb/trunk/source/Target/UnixSignals.cpp Message-ID: <20110110034725.9003F2A6C12C@llvm.org> Author: gclayton Date: Sun Jan 9 21:47:25 2011 New Revision: 123157 URL: http://llvm.org/viewvc/llvm-project?rev=123157&view=rev Log: Change the default signal setting for SIBABRT to SUPPRESS the signal. Why? When debugging, if an expression hits a SIGABRT, it the expression ends up completing and stopping due the the "SIGABRT". Then the next thing that runs (another expression, or continuing the program) ends up progating the SIGABRT and causing the parent processes to die. We should probably think of a different solution where we suppress any signal that resulted due to an expression, or we modifyin the UnixSignals class to contain a row for "suppress for expression". So the settings for SIGABRT are: suppress = true, stop = true, and notify = true. Modified: lldb/trunk/source/Target/UnixSignals.cpp Modified: lldb/trunk/source/Target/UnixSignals.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnixSignals.cpp?rev=123157&r1=123156&r2=123157&view=diff ============================================================================== --- lldb/trunk/source/Target/UnixSignals.cpp (original) +++ lldb/trunk/source/Target/UnixSignals.cpp Sun Jan 9 21:47:25 2011 @@ -66,7 +66,7 @@ AddSignal (3, "SIGQUIT", "QUIT", false, true, true, "quit"); AddSignal (4, "SIGILL", "ILL", false, true, true, "illegal instruction"); AddSignal (5, "SIGTRAP", "TRAP", true, true, true, "trace trap (not reset when caught)"); - AddSignal (6, "SIGABRT", "ABRT", false, true, true, "abort()"); + AddSignal (6, "SIGABRT", "ABRT", true, true, true, "abort()"); AddSignal (7, "SIGEMT", "EMT", false, true, true, "pollable event"); AddSignal (8, "SIGFPE", "FPE", false, true, true, "floating point exception"); AddSignal (9, "SIGKILL", "KILL", false, true, true, "kill");