diff options
author | Greg Clayton <gclayton@apple.com> | 2012-02-21 18:40:07 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-02-21 18:40:07 +0000 |
commit | 0c90ef479a8870ed8adb598cd7e70518960f0353 (patch) | |
tree | bc08dd05ff8e394a9f207f1cac32f03b0ff5bf5b /lldb/source/Plugins/Process/POSIX | |
parent | ff461fcf07688fafdf3b84dee11d84ac760fcf5d (diff) | |
download | bcm5719-llvm-0c90ef479a8870ed8adb598cd7e70518960f0353.tar.gz bcm5719-llvm-0c90ef479a8870ed8adb598cd7e70518960f0353.zip |
Linux fix patch from Dmitry Vyukov.
llvm-svn: 151072
Diffstat (limited to 'lldb/source/Plugins/Process/POSIX')
7 files changed, 46 insertions, 46 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp index 3f5e022ee30..9de6c859b83 100644 --- a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp +++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp @@ -29,10 +29,11 @@ #include "UnwindLLDB.h" +using namespace lldb; using namespace lldb_private; -POSIXThread::POSIXThread(Process &process, lldb::tid_t tid) +POSIXThread::POSIXThread(ProcessSP &process, lldb::tid_t tid) : Thread(process, tid), m_frame_ap(0) { @@ -49,7 +50,8 @@ POSIXThread::~POSIXThread() ProcessMonitor & POSIXThread::GetMonitor() { - ProcessPOSIX &process = static_cast<ProcessPOSIX&>(GetProcess()); + ProcessSP base = GetProcess(); + ProcessPOSIX &process = static_cast<ProcessPOSIX&>(*base); return process.GetMonitor(); } @@ -62,7 +64,8 @@ POSIXThread::RefreshStateAfterStop() // Let all threads recover from stopping and do any clean up based // on the previous thread state (if any). - ProcessPOSIX &process = static_cast<ProcessPOSIX&>(GetProcess()); + ProcessSP base = GetProcess(); + ProcessPOSIX &process = static_cast<ProcessPOSIX&>(*base); process.GetThreadList().RefreshStateAfterStop(); } @@ -237,7 +240,7 @@ POSIXThread::BreakNotify(const ProcessMessage &message) lldb::addr_t pc = GetRegisterContext()->GetPC(); if (log) log->Printf ("POSIXThread::%s () PC=0x%8.8llx", __FUNCTION__, pc); - lldb::BreakpointSiteSP bp_site(GetProcess().GetBreakpointSiteList().FindByAddress(pc)); + lldb::BreakpointSiteSP bp_site(GetProcess()->GetBreakpointSiteList().FindByAddress(pc)); assert(bp_site); lldb::break_id_t bp_id = bp_site->GetID(); assert(bp_site && bp_site->ValidForThisThread(this)); diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.h b/lldb/source/Plugins/Process/POSIX/POSIXThread.h index 95280d46bc5..7343884fe99 100644 --- a/lldb/source/Plugins/Process/POSIX/POSIXThread.h +++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.h @@ -29,7 +29,7 @@ class POSIXThread : public lldb_private::Thread { public: - POSIXThread(lldb_private::Process &process, lldb::tid_t tid); + POSIXThread(lldb::ProcessSP &process, lldb::tid_t tid); virtual ~POSIXThread(); diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index 67cf8a9311b..68ffc2f70c8 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -500,8 +500,10 @@ ProcessPOSIX::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thre // FIXME: We should be using tid, not pid. assert(m_monitor); ThreadSP thread_sp (old_thread_list.FindThreadByID (GetID(), false)); - if (!thread_sp) - thread_sp.reset(new POSIXThread(*this, GetID())); + if (!thread_sp) { + ProcessSP me = this->shared_from_this(); + thread_sp.reset(new POSIXThread(me, GetID())); + } if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) log->Printf ("ProcessPOSIX::%s() updated pid = %i", __FUNCTION__, GetID()); diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp index 6e7ae1464b4..017035d483e 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp @@ -44,44 +44,38 @@ ProcessPOSIXLog::GetLogIfAllCategoriesSet (uint32_t mask) } void -ProcessPOSIXLog::DisableLog (Args &args, Stream *feedback_strm) +ProcessPOSIXLog::DisableLog (const char **args, Stream *feedback_strm) { LogSP log (GetLog ()); if (log) { uint32_t flag_bits = 0; - const size_t argc = args.GetArgumentCount (); - if (argc > 0) + flag_bits = log->GetMask().Get(); + for (; args[0]; args++) { - flag_bits = log->GetMask().Get(); - for (size_t i = 0; i < argc; ++i) + const char *arg = args[0]; + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~POSIX_LOG_ALL; + else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~POSIX_LOG_ASYNC; + else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~POSIX_LOG_BREAKPOINTS; + else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~POSIX_LOG_COMM; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~POSIX_LOG_DEFAULT; + else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~POSIX_LOG_PACKETS; + else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY; + else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_SHORT; + else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_LONG; + else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~POSIX_LOG_PROCESS; + else if (::strcasecmp (arg, "ptrace") == 0 ) flag_bits &= ~POSIX_LOG_PTRACE; + else if (::strcasecmp (arg, "registers") == 0 ) flag_bits &= ~POSIX_LOG_REGISTERS; + else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~POSIX_LOG_STEP; + else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~POSIX_LOG_THREAD; + else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~POSIX_LOG_VERBOSE; + else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~POSIX_LOG_WATCHPOINTS; + else { - const char *arg = args.GetArgumentAtIndex (i); - - - if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~POSIX_LOG_ALL; - else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~POSIX_LOG_ASYNC; - else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~POSIX_LOG_BREAKPOINTS; - else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~POSIX_LOG_COMM; - else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~POSIX_LOG_DEFAULT; - else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~POSIX_LOG_PACKETS; - else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY; - else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_SHORT; - else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~POSIX_LOG_MEMORY_DATA_LONG; - else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~POSIX_LOG_PROCESS; - else if (::strcasecmp (arg, "ptrace") == 0 ) flag_bits &= ~POSIX_LOG_PTRACE; - else if (::strcasecmp (arg, "registers") == 0 ) flag_bits &= ~POSIX_LOG_REGISTERS; - else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~POSIX_LOG_STEP; - else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~POSIX_LOG_THREAD; - else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~POSIX_LOG_VERBOSE; - else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~POSIX_LOG_WATCHPOINTS; - else - { - feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); - ListLogCategories (feedback_strm); - } - + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); } } @@ -95,7 +89,7 @@ ProcessPOSIXLog::DisableLog (Args &args, Stream *feedback_strm) } LogSP -ProcessPOSIXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) +ProcessPOSIXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const char **args, Stream *feedback_strm) { // Try see if there already is a log - that way we can reuse its settings. // We could reuse the log in toto, but we don't know that the stream is the same. @@ -107,17 +101,16 @@ ProcessPOSIXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args // Now make a new log with this stream if one was provided if (log_stream_sp) { - log = make_shared<Log>(log_stream_sp); + log = LogSP(new Log(log_stream_sp)); GetLog () = log; } if (log) { bool got_unknown_category = false; - const size_t argc = args.GetArgumentCount(); - for (size_t i=0; i<argc; ++i) + for (; args[0]; args++) { - const char *arg = args.GetArgumentAtIndex(i); + const char *arg = args[0]; if (::strcasecmp (arg, "all") == 0 ) flag_bits |= POSIX_LOG_ALL; else if (::strcasecmp (arg, "async") == 0 ) flag_bits |= POSIX_LOG_ASYNC; diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h index 5c34a88af7c..2e4000c0389 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h @@ -54,11 +54,11 @@ public: GetLogIfAllCategoriesSet(uint32_t mask = 0); static void - DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + DisableLog (const char **args, lldb_private::Stream *feedback_strm); static lldb::LogSP EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, - lldb_private::Args &args, lldb_private::Stream *feedback_strm); + const char **args, lldb_private::Stream *feedback_strm); static void ListLogCategories (lldb_private::Stream *strm); diff --git a/lldb/source/Plugins/Process/POSIX/RegisterContext_i386.cpp b/lldb/source/Plugins/Process/POSIX/RegisterContext_i386.cpp index 9aef2375928..bc415828b26 100644 --- a/lldb/source/Plugins/Process/POSIX/RegisterContext_i386.cpp +++ b/lldb/source/Plugins/Process/POSIX/RegisterContext_i386.cpp @@ -364,7 +364,8 @@ RegisterContext_i386::~RegisterContext_i386() ProcessMonitor & RegisterContext_i386::GetMonitor() { - ProcessPOSIX *process = static_cast<ProcessPOSIX*>(CalculateProcess()); + ProcessSP base = CalculateProcess(); + ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get()); return process->GetMonitor(); } diff --git a/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp b/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp index 8ecb4d14cb8..fc9dfbe8284 100644 --- a/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp +++ b/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp @@ -434,7 +434,8 @@ RegisterContext_x86_64::~RegisterContext_x86_64() ProcessMonitor & RegisterContext_x86_64::GetMonitor() { - ProcessPOSIX *process = static_cast<ProcessPOSIX*>(CalculateProcess()); + ProcessSP base = CalculateProcess(); + ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get()); return process->GetMonitor(); } |