[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

Greg Clayton gclayton at apple.com
Thu Jan 6 15:34:44 PST 2011


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 <gclayton at apple.com> 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<ProcessLinux*>(CalculateProcess());
> -    return process->GetMonitor();
> +    ProcessLinux &process = static_cast<ProcessLinux&>(GetProcess());
> +    return process.GetMonitor();
> }
> 
> void
> @@ -51,6 +51,8 @@ LinuxThread::GetInfo()
> lldb::RegisterContextSP
> LinuxThread::GetRegisterContext()
> {
> +    ProcessLinux &process = static_cast<ProcessLinux&>(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<lldb_private::StackFrame> m_frame_ap;





More information about the lldb-commits mailing list