[Lldb-commits] [lldb] r187545 - Fix thread name updating in Linux. "thread list" should report correct names always now.

Michael Sartain mikesart at valvesoftware.com
Thu Aug 1 10:36:50 PDT 2013


Well, it was me. My changes exposed a different bug: bad tids are being
passed to GetThreadName().

    std::string thread_name (Host::GetThreadName (getpid(),
Host::GetCurrentThreadID()));

Host::GetCurrentThreadID() does this:

    return lldb::tid_t(pthread_self());

That doesn't work on Linux though - pthread_self() and TIDs are completely
different beasts. I'll fix this.
 -Mike

On Thu, Aug 1, 2013 at 8:49 AM, Mike Sartain <mikesart at valvesoftware.com>wrote:

> I think the test is failing because an extra space is showing up before
> the log output for the "command alias bp breakpoint" command. I'll look,
> but I'd be surprised if this is due to my checkin.
>
> (lldb) command alias bp breakpoint
> Processing command: command alias bp breakpoint
> HandleCommand, cmd_obj : 'command alias'
> HandleCommand, revised_command_line: 'command alias bp breakpoint'
> HandleCommand, wants_raw_input:'True'
> HandleCommand, command line after removing command name(s): 'bp breakpoint'
> HandleCommand, command succeeded
>
> AssertionError: Expected 'Processing command: command alias bp breakpoint
> '; Found ' Processing command: command alias bp breakpoint
> '
>
> On Aug 1, 2013, at 8:05 AM, "Thirumurthi, Ashok" <
> ashok.thirumurthi at intel.com> wrote:
>
> > FYI Mike,
> >
> > I'm guessing that one of the "thread list" commits introduced a minor
> regression on both buildbots:
> >
> http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang/builds/5774/steps/test%20lldb/logs/stdio
> >
> http://lab.llvm.org:8011/builders/lldb-x86_64-linux/builds/5859/steps/test%20lldb/logs/stdio
> >
> >
> > FAIL: LLDB (clang-x86_64) :: test_with_dwarf (TestLogging.LogTestCase)
> > ======================================================================
> > FAIL: test_with_dwarf (TestLogging.LogTestCase)
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >  File
> "/home/llvmbb/llvm-build-dir/lldb-x86_64-clang/llvm/tools/lldb/test/lldbtest.py",
> line 370, in wrapper
> >    return func(self, *args, **kwargs)
> >  File
> "/home/llvmbb/llvm-build-dir/lldb-x86_64-clang/llvm/tools/lldb/test/logging/TestLogging.py",
> line 23, in test_with_dwarf
> >    self.command_log_tests ("dwarf")
> >  File
> "/home/llvmbb/llvm-build-dir/lldb-x86_64-clang/llvm/tools/lldb/test/logging/TestLogging.py",
> line 90, in command_log_tests
> >    self.fail (err_msg)
> > AssertionError: Expected 'Processing command: command alias bp breakpoint
> > '; Found ' Processing command: command alias bp breakpoint
> > '
> > Config=x86_64-clang
> >
> > - Ashok
> >
> > -----Original Message-----
> > From: lldb-commits-bounces at cs.uiuc.edu [mailto:
> lldb-commits-bounces at cs.uiuc.edu] On Behalf Of Michael Sartain
> > Sent: Wednesday, July 31, 2013 7:28 PM
> > To: lldb-commits at cs.uiuc.edu
> > Subject: [Lldb-commits] [lldb] r187545 - Fix thread name updating in
> Linux. "thread list" should report correct names always now.
> >
> > Author: mikesart
> > Date: Wed Jul 31 18:27:46 2013
> > New Revision: 187545
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=187545&view=rev
> > Log:
> > Fix thread name updating in Linux. "thread list" should report correct
> names always now.
> > Created new LinuxThread class inherited from POSIXThread and removed
> linux / freebsd ifdefs Removed several un-needed set thread name calls
> >
> > CR (and multiple suggestions): mkopec
> >
> >
> > Added:
> >    lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp
> >    lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h
> > Modified:
> >    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
> >    lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
> >    lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
> >    lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h
> >    lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
> >    lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
> >    lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.h
> >    lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
> >    lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.h
> >    lldb/trunk/source/Target/TargetList.cpp
> >
> > Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
> (original)
> > +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Wed Jul
> > +++ 31 18:27:46 2013
> > @@ -1003,7 +1003,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
> >         goto FINISH;
> >
> >     // Update the process thread list with this new thread.
> > -    inferior.reset(new POSIXThread(*processSP, pid));
> > +    inferior.reset(process.CreateNewPOSIXThread(*processSP, pid));
> >     if (log)
> >         log->Printf ("ProcessMonitor::%s() adding pid = %" PRIu64,
> __FUNCTION__, pid);
> >     process.GetThreadList().AddThread(inferior);
> > @@ -1085,7 +1085,7 @@ ProcessMonitor::Attach(AttachArgs *args)
> >     }
> >
> >     // Update the process thread list with the attached thread.
> > -    inferior.reset(new POSIXThread(*processSP, pid));
> > +    inferior.reset(process.CreateNewPOSIXThread(*processSP, pid));
> >     tl.AddThread(inferior);
> >
> >     // Let our process instance know the thread has stopped.
> >
> > Modified: lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt (original)
> > +++ lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt Wed Jul 31
> > +++ 18:27:46 2013
> > @@ -7,5 +7,6 @@ add_lldb_library(lldbPluginProcessLinux
> >   ProcessLinux.cpp
> >   ProcessMonitor.cpp
> >   LinuxSignals.cpp
> > +  LinuxThread.cpp
> >   )
> >
> >
> > Added: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=187545&view=auto
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (added)
> > +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Wed Jul 31
> > +++ 18:27:46 2013
> > @@ -0,0 +1,63 @@
> > +//===-- LinuxThread.cpp -----------------------------------------*- C++
> > +-*-===// //
> > +//                     The LLVM Compiler Infrastructure
> > +//
> > +// This file is distributed under the University of Illinois Open
> > +Source // License. See LICENSE.TXT for details.
> > +//
> > +//===------------------------------------------------------------------
> > +----===//
> > +
> > +// C Includes
> > +// C++ Includes
> > +// Other libraries and framework includes // Project includes #include
> > +"LinuxThread.h"
> > +
> > +using namespace lldb;
> > +using namespace lldb_private;
> > +
> > +//---------------------------------------------------------------------
> > +---------
> > +// Constructors and destructors.
> > +
> > +LinuxThread::LinuxThread(Process &process, lldb::tid_t tid)
> > +    : POSIXThread(process, tid)
> > +{
> > +}
> > +
> > +LinuxThread::~LinuxThread()
> > +{
> > +}
> > +
> > +//---------------------------------------------------------------------
> > +---------
> > +// ProcessInterface protocol.
> > +
> > +void
> > +LinuxThread::RefreshStateAfterStop()
> > +{
> > +    // Invalidate the thread names every time we get a stop event on
> Linux so we
> > +    // will re-read the procfs comm virtual file when folks ask for the
> thread name.
> > +    m_thread_name_valid = false;
> > +
> > +    POSIXThread::RefreshStateAfterStop();
> > +}
> > +
> > +void
> > +LinuxThread::TraceNotify(const ProcessMessage &message) {
> > +    RegisterContextPOSIX* reg_ctx = GetRegisterContextPOSIX();
> > +    if (reg_ctx)
> > +    {
> > +        uint32_t num_hw_wps =
> reg_ctx->NumSupportedHardwareWatchpoints();
> > +        uint32_t wp_idx;
> > +        for (wp_idx = 0; wp_idx < num_hw_wps; wp_idx++)
> > +        {
> > +            if (reg_ctx->IsWatchpointHit(wp_idx))
> > +            {
> > +                WatchNotify(message);
> > +                return;
> > +            }
> > +        }
> > +    }
> > +
> > +    POSIXThread::TraceNotify (message); }
> > \ No newline at end of file
> >
> > Added: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=187545&view=auto
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (added)
> > +++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Wed Jul 31
> 18:27:46 2013
> > @@ -0,0 +1,43 @@
> > +//===-- LinuxThread.h -------------------------------------------*- C++
> -*-===//
> > +//
> > +//                     The LLVM Compiler Infrastructure
> > +//
> > +// This file is distributed under the University of Illinois Open Source
> > +// License. See LICENSE.TXT for details.
> > +//
> >
> +//===----------------------------------------------------------------------===//
> > +
> > +#ifndef liblldb_LinuxThread_H_
> > +#define liblldb_LinuxThread_H_
> > +
> > +// Other libraries and framework includes
> > +#include "POSIXThread.h"
> > +
> >
> +//------------------------------------------------------------------------------
> > +// @class LinuxThread
> > +// @brief Abstraction of a Linux thread.
> > +class LinuxThread
> > +    : public POSIXThread
> > +{
> > +public:
> > +
> > +    //------------------------------------------------------------------
> > +    // Constructors and destructors
> > +    //------------------------------------------------------------------
> > +    LinuxThread(lldb_private::Process &process, lldb::tid_t tid);
> > +
> > +    virtual ~LinuxThread();
> > +
> > +
>  //--------------------------------------------------------------------------
> > +    // LinuxThread internal API.
> > +
> > +    // POSIXThread override
> > +    virtual void
> > +    RefreshStateAfterStop();
> > +
> > +protected:
> > +    virtual void
> > +    TraceNotify(const ProcessMessage &message);
> > +};
> > +
> > +#endif // #ifndef liblldb_LinuxThread_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=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
> > +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Wed Jul 31
> 18:27:46 2013
> > @@ -23,7 +23,7 @@
> > #include "ProcessPOSIXLog.h"
> > #include "Plugins/Process/Utility/InferiorCallPOSIX.h"
> > #include "ProcessMonitor.h"
> > -#include "POSIXThread.h"
> > +#include "LinuxThread.h"
> >
> > using namespace lldb;
> > using namespace lldb_private;
> > @@ -64,7 +64,7 @@ ProcessLinux::Initialize()
> > // Constructors and destructors.
> >
> > ProcessLinux::ProcessLinux(Target& target, Listener &listener, FileSpec
> *core_file)
> > -    : ProcessPOSIX(target, listener), m_stopping_threads(false),
> m_core_file(core_file)
> > +    : ProcessPOSIX(target, listener), m_core_file(core_file),
> m_stopping_threads(false)
> > {
> > #if 0
> >     // FIXME: Putting this code in the ctor and saving the byte order in
> a
> > @@ -81,6 +81,7 @@ void
> > ProcessLinux::Terminate()
> > {
> > }
> > +
> > lldb_private::ConstString
> > ProcessLinux::GetPluginNameStatic()
> > {
> > @@ -171,6 +172,13 @@ ProcessLinux::StopAllThreads(lldb::tid_t
> >         log->Printf ("ProcessLinux::%s() finished", __FUNCTION__);
> > }
> >
> > +// ProcessPOSIX override
> > +POSIXThread *
> > +ProcessLinux::CreateNewPOSIXThread(lldb_private::Process &process,
> lldb::tid_t tid)
> > +{
> > +    return new LinuxThread(process, tid);
> > +}
> > +
> > bool
> > ProcessLinux::CanDebug(Target &target, bool plugin_specified_by_name)
> > {
> >
> > 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=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h (original)
> > +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Wed Jul 31
> 18:27:46 2013
> > @@ -56,6 +56,7 @@ public:
> >
> >     virtual bool
> >     UpdateThreadList(lldb_private::ThreadList &old_thread_list,
> lldb_private::ThreadList &new_thread_list);
> > +
> >     //------------------------------------------------------------------
> >     // PluginInterface protocol
> >     //------------------------------------------------------------------
> > @@ -94,6 +95,9 @@ public:
> >     virtual void
> >     StopAllThreads(lldb::tid_t stop_tid);
> >
> > +    virtual POSIXThread *
> > +    CreateNewPOSIXThread(lldb_private::Process &process, lldb::tid_t
> tid);
> > +
> > private:
> >
> >     /// Linux-specific signal set.
> >
> > 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=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
> > +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Wed Jul
> 31 18:27:46 2013
> > @@ -1098,7 +1098,6 @@ ProcessMonitor::Launch(LaunchArgs *args)
> >     lldb::pid_t pid;
> >
> >     lldb::ThreadSP inferior;
> > -    POSIXThread *thread;
> >     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet
> (POSIX_LOG_PROCESS));
> >
> >     // Propagate the environment if one is not supplied.
> > @@ -1232,10 +1231,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
> >     // Update the process thread list with this new thread.
> >     // FIXME: should we be letting UpdateThreadList handle this?
> >     // FIXME: by using pids instead of tids, we can only support one
> thread.
> > -    inferior.reset(new POSIXThread(process, pid));
> > -
> > -    thread = static_cast<POSIXThread*>(inferior.get());
> > -    thread->SetName(Host::GetThreadName(pid, pid).c_str());
> > +    inferior.reset(process.CreateNewPOSIXThread(process, pid));
> >
> >     if (log)
> >         log->Printf ("ProcessMonitor::%s() adding pid = %" PRIu64,
> __FUNCTION__, pid);
> > @@ -1297,7 +1293,6 @@ ProcessMonitor::Attach(AttachArgs *args)
> >     ProcessMonitor *monitor = args->m_monitor;
> >     ProcessLinux &process = monitor->GetProcess();
> >     lldb::ThreadSP inferior;
> > -    POSIXThread *thread;
> >     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet
> (POSIX_LOG_PROCESS));
> >
> >     // Use a map to keep track of the threads which we have
> attached/need to attach.
> > @@ -1362,10 +1357,7 @@ ProcessMonitor::Attach(AttachArgs *args)
> >                 }
> >
> >                 // Update the process thread list with the attached
> thread.
> > -                inferior.reset(new POSIXThread(process, tid));
> > -
> > -                thread = static_cast<POSIXThread*>(inferior.get());
> > -                thread->SetName(Host::GetThreadName(pid, tid).c_str());
> > +                inferior.reset(process.CreateNewPOSIXThread(process,
> tid));
> >
> >                 if (log)
> >                     log->Printf ("ProcessMonitor::%s() adding tid = %"
> PRIu64, __FUNCTION__, tid);
> >
> > Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
> > +++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Wed Jul 31
> 18:27:46 2013
> > @@ -45,6 +45,7 @@ POSIXThread::POSIXThread(Process &proces
> >     : Thread(process, tid),
> >       m_frame_ap (),
> >       m_breakpoint (),
> > +      m_thread_name_valid (false),
> >       m_thread_name ()
> > {
> >     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet
> (POSIX_LOG_THREAD));
> > @@ -111,7 +112,8 @@ POSIXThread::GetInfo()
> > void
> > POSIXThread::SetName (const char *name)
> > {
> > -    if (name && name[0])
> > +    m_thread_name_valid = (name && name[0]);
> > +    if (m_thread_name_valid)
> >         m_thread_name.assign (name);
> >     else
> >         m_thread_name.clear();
> > @@ -120,6 +122,12 @@ POSIXThread::SetName (const char *name)
> > const char *
> > POSIXThread::GetName ()
> > {
> > +    if (!m_thread_name_valid)
> > +    {
> > +        SetName(Host::GetThreadName(GetProcess()->GetID(),
> GetID()).c_str());
> > +        m_thread_name_valid = true;
> > +    }
> > +
> >     if (m_thread_name.empty())
> >         return NULL;
> >     return m_thread_name.c_str();
> > @@ -460,22 +468,6 @@ POSIXThread::WatchNotify(const ProcessMe
> > void
> > POSIXThread::TraceNotify(const ProcessMessage &message)
> > {
> > -#ifndef __FreeBSD__
> > -    RegisterContextPOSIX* reg_ctx = GetRegisterContextPOSIX();
> > -    if (reg_ctx)
> > -    {
> > -        uint32_t num_hw_wps =
> reg_ctx->NumSupportedHardwareWatchpoints();
> > -        uint32_t wp_idx;
> > -        for (wp_idx = 0; wp_idx < num_hw_wps; wp_idx++)
> > -        {
> > -            if (reg_ctx->IsWatchpointHit(wp_idx))
> > -            {
> > -                WatchNotify(message);
> > -                return;
> > -            }
> > -        }
> > -    }
> > -#endif
> >     SetStopInfo (StopInfo::CreateStopReasonToTrace(*this));
> > }
> >
> >
> > Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.h
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.h?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.h (original)
> > +++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.h Wed Jul 31
> 18:27:46 2013
> > @@ -91,7 +91,7 @@ public:
> >
> >     uint32_t FindVacantWatchpointIndex();
> >
> > -private:
> > +protected:
> >     RegisterContextPOSIX *
> >     GetRegisterContextPOSIX ()
> >     {
> > @@ -107,6 +107,7 @@ private:
> >
> >     lldb::BreakpointSiteSP m_breakpoint;
> >
> > +    bool m_thread_name_valid;
> >     std::string m_thread_name;
> >
> >     ProcessMonitor &
> > @@ -117,7 +118,7 @@ private:
> >
> >     void BreakNotify(const ProcessMessage &message);
> >     void WatchNotify(const ProcessMessage &message);
> > -    void TraceNotify(const ProcessMessage &message);
> > +    virtual void TraceNotify(const ProcessMessage &message);
> >     void LimboNotify(const ProcessMessage &message);
> >     void SignalNotify(const ProcessMessage &message);
> >     void SignalDeliveredNotify(const ProcessMessage &message);
> >
> > Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
> > +++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Wed Jul 31
> 18:27:46 2013
> > @@ -479,6 +479,12 @@ ProcessPOSIX::AddThreadForInitialStopIfN
> >     return added_to_set;
> > }
> >
> > +POSIXThread *
> > +ProcessPOSIX::CreateNewPOSIXThread(lldb_private::Process &process,
> lldb::tid_t tid)
> > +{
> > +    return new POSIXThread(process, tid);
> > +}
> > +
> > void
> > ProcessPOSIX::RefreshStateAfterStop()
> > {
> > @@ -508,10 +514,7 @@ ProcessPOSIX::RefreshStateAfterStop()
> >                 log->Printf ("ProcessPOSIX::%s() adding thread, tid = %"
> PRIi64, __FUNCTION__, message.GetChildTID());
> >             lldb::tid_t child_tid = message.GetChildTID();
> >             ThreadSP thread_sp;
> > -            thread_sp.reset(new POSIXThread(*this, child_tid));
> > -
> > -            POSIXThread *thread =
> static_cast<POSIXThread*>(thread_sp.get());
> > -            thread->SetName(Host::GetThreadName(GetID(),
> child_tid).c_str());
> > +            thread_sp.reset(CreateNewPOSIXThread(*this, child_tid));
> >
> >             Mutex::Locker lock(m_thread_list.GetMutex());
> >
> > @@ -821,7 +824,7 @@ ProcessPOSIX::UpdateThreadList(ThreadLis
> >     assert(m_monitor);
> >     ThreadSP thread_sp (old_thread_list.FindThreadByID (GetID(), false));
> >     if (!thread_sp) {
> > -        thread_sp.reset(new POSIXThread(*this, GetID()));
> > +        thread_sp.reset(CreateNewPOSIXThread(*this, GetID()));
> >     }
> >
> >     if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
> >
> > Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.h
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.h?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.h (original)
> > +++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.h Wed Jul 31
> 18:27:46 2013
> > @@ -22,6 +22,7 @@
> > #include "ProcessMessage.h"
> >
> > class ProcessMonitor;
> > +class POSIXThread;
> >
> > class ProcessPOSIX :
> >     public lldb_private::Process
> > @@ -166,6 +167,9 @@ public:
> >     bool
> >     AddThreadForInitialStopIfNeeded(lldb::tid_t stop_tid);
> >
> > +    virtual POSIXThread *
> > +    CreateNewPOSIXThread(lldb_private::Process &process, lldb::tid_t
> tid);
> > +
> > protected:
> >     /// Target byte order.
> >     lldb::ByteOrder m_byte_order;
> >
> > Modified: lldb/trunk/source/Target/TargetList.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=187545&r1=187544&r2=187545&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/source/Target/TargetList.cpp (original)
> > +++ lldb/trunk/source/Target/TargetList.cpp Wed Jul 31 18:27:46 2013
> > @@ -222,8 +222,19 @@ TargetList::CreateTarget (Debugger &debu
> >     FileSpec file (user_exe_path, false);
> >     if (!file.Exists() && user_exe_path && user_exe_path[0] == '~')
> >     {
> > -        file = FileSpec(user_exe_path, true);
> > +        // we want to expand the tilde but we don't want to resolve any
> symbolic links
> > +        // so we can't use the FileSpec constructor's resolve flag
> > +        char unglobbed_path[PATH_MAX];
> > +        unglobbed_path[0] = '\0';
> > +
> > +        size_t return_count = FileSpec::ResolveUsername(user_exe_path,
> unglobbed_path, sizeof(unglobbed_path));
> > +
> > +        if (return_count == 0 || return_count >= sizeof(unglobbed_path))
> > +            ::snprintf (unglobbed_path, sizeof(unglobbed_path), "%s",
> user_exe_path);
> > +
> > +        file = FileSpec(unglobbed_path, false);
> >     }
> > +
> >     bool user_exe_path_is_bundle = false;
> >     char resolved_bundle_exe_path[PATH_MAX];
> >     resolved_bundle_exe_path[0] = '\0';
> > @@ -305,8 +316,8 @@ TargetList::CreateTarget (Debugger &debu
> >             }
> >             else
> >             {
> > -                // Just use what the user typed
> > -                target_sp->SetArg0 (user_exe_path);
> > +                // Use resolved path
> > +                target_sp->SetArg0 (file.GetPath().c_str());
> >             }
> >         }
> >         if (file.GetDirectory())
> >
> >
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130801/e75e4083/attachment.html>


More information about the lldb-commits mailing list