From gclayton at apple.com Mon Jan 24 00:11:50 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 06:11:50 -0000 Subject: [Lldb-commits] [lldb] r124110 - in /lldb/trunk/tools/debugserver/source/MacOSX: MachThreadList.cpp MachThreadList.h Message-ID: <20110124061150.A05722A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 00:11:50 2011 New Revision: 124110 URL: http://llvm.org/viewvc/llvm-project?rev=124110&view=rev Log: Added logging for threads that are spawned while we stop. We log their existence if the "thread" log bit is enabled right before we resume. Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=124110&r1=124109&r2=124110&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Mon Jan 24 00:11:50 2011 @@ -194,7 +194,7 @@ } uint32_t -MachThreadList::UpdateThreadList(MachProcess *process, bool update) +MachThreadList::UpdateThreadList(MachProcess *process, bool update, MachThreadList::collection *new_threads) { // locker will keep a mutex locked until it goes out of scope DNBLogThreadedIf (LOG_THREAD, "MachThreadList::UpdateThreadList (pid = %4.4x, update = %u) process stop count = %u", process->ProcessID(), update, process->StopCount()); @@ -250,6 +250,11 @@ { // We don't have this thread, lets add it. thread_sp.reset(new MachThread(process, tid)); + + // Add the new thread regardless of its is user ready state... + if (new_threads) + new_threads->push_back(thread_sp); + // Make sure the thread is ready to be displayed and shown to users // before we add this thread to our list... if (thread_sp->IsUserReady()) @@ -320,6 +325,24 @@ assert (thread_action); thread->ThreadWillResume (thread_action); } + + if (DNBLogCheckLogBit(LOG_THREAD)) + { + MachThreadList::collection new_threads; + UpdateThreadList(process, true, &new_threads); + if (new_threads.size()) + { + + for (uint32_t idx = 0, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) + { + DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", + process->ProcessID(), + process->StopCount(), + new_threads[idx]->ThreadID(), + new_threads[idx]->IsUserReady()); + } + } + } } uint32_t Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h?rev=124110&r1=124109&r2=124110&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h Mon Jan 24 00:11:50 2011 @@ -59,7 +59,7 @@ typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; - uint32_t UpdateThreadList (MachProcess *process, bool update); + uint32_t UpdateThreadList (MachProcess *process, bool update, collection *num_threads = NULL); // const_iterator FindThreadByID (thread_t tid) const; collection m_threads; From gclayton at apple.com Mon Jan 24 00:22:23 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 06:22:23 -0000 Subject: [Lldb-commits] [lldb] r124111 - /lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Message-ID: <20110124062223.8782F2A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 00:22:23 2011 New Revision: 124111 URL: http://llvm.org/viewvc/llvm-project?rev=124111&view=rev Log: Discover new threads right before we continue a process since libdispatch has been known to make threads for us while our process/task is suspended. Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=124111&r1=124110&r2=124111&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Mon Jan 24 00:22:23 2011 @@ -315,6 +315,13 @@ MachThreadList::ProcessWillResume(MachProcess *process, const DNBThreadResumeActions &thread_actions) { PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); + + // Update our thread list, because sometimes libdispatch or the kernel + // will spawn threads while a task is suspended. + MachThreadList::collection new_threads; + + UpdateThreadList(process, true, &new_threads); + const uint32_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) { @@ -326,21 +333,15 @@ thread->ThreadWillResume (thread_action); } - if (DNBLogCheckLogBit(LOG_THREAD)) + if (new_threads.size()) { - MachThreadList::collection new_threads; - UpdateThreadList(process, true, &new_threads); - if (new_threads.size()) + for (uint32_t idx = 0, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) { - - for (uint32_t idx = 0, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) - { - DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", - process->ProcessID(), - process->StopCount(), - new_threads[idx]->ThreadID(), - new_threads[idx]->IsUserReady()); - } + DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, resuming newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", + process->ProcessID(), + process->StopCount(), + new_threads[idx]->ThreadID(), + new_threads[idx]->IsUserReady()); } } } From gclayton at apple.com Mon Jan 24 00:30:45 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 06:30:45 -0000 Subject: [Lldb-commits] [lldb] r124112 - /lldb/trunk/source/Target/Process.cpp Message-ID: <20110124063045.8C4AA2A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 00:30:45 2011 New Revision: 124112 URL: http://llvm.org/viewvc/llvm-project?rev=124112&view=rev Log: Make the logging come out all lined up and such. Modified: lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124112&r1=124111&r2=124112&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Mon Jan 24 00:30:45 2011 @@ -1401,7 +1401,7 @@ addr_t allocated_addr = DoAllocateMemory (size, permissions, error); LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf("Process::AllocateMemory(size = %zu, permissions=%c%c%c) => 0x%16.16llx (m_stop_id = %u)", + log->Printf("Process::AllocateMemory(size=%4zu, permissions=%c%c%c) => 0x%16.16llx (m_stop_id = %u)", size, permissions & ePermissionsReadable ? 'r' : '-', permissions & ePermissionsWritable ? 'w' : '-', From jingham at apple.com Mon Jan 24 00:34:17 2011 From: jingham at apple.com (Jim Ingham) Date: Mon, 24 Jan 2011 06:34:17 -0000 Subject: [Lldb-commits] [lldb] r124113 - in /lldb/trunk: include/lldb/Target/ThreadPlanBase.h source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Target/Process.cpp source/Target/Thread.cpp source/Target/ThreadPlanBase.cpp tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110124063417.7187B2A6C12C@llvm.org> Author: jingham Date: Mon Jan 24 00:34:17 2011 New Revision: 124113 URL: http://llvm.org/viewvc/llvm-project?rev=124113&view=rev Log: More useful STEP logging. Be sure to clear out the base plan's m_report_run and m_report_stop each time we resume so we don't use stale values. Modified: lldb/trunk/include/lldb/Target/ThreadPlanBase.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlanBase.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/include/lldb/Target/ThreadPlanBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanBase.h?rev=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanBase.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanBase.h Mon Jan 24 00:34:17 2011 @@ -39,6 +39,7 @@ virtual lldb::StateType GetPlanRunState (); virtual bool WillStop (); virtual bool MischiefManaged (); + virtual bool WillResume (lldb::StateType resume_state, bool current_plan); virtual bool IsMasterPlan() { 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=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 00:34:17 2011 @@ -1968,8 +1968,8 @@ ::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags); debugserver_args.AppendArgument(arg_cstr); } -// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); -// debugserver_args.AppendArgument("--log-flags=0x800e0e"); + debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); + debugserver_args.AppendArgument("--log-flags=0x800e0e"); // Now append the program arguments if (launch_process) Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Mon Jan 24 00:34:17 2011 @@ -1716,7 +1716,10 @@ { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf("Process::Resume() m_stop_id = %u", m_stop_id); + log->Printf("Process::Resume() m_stop_id = %u, public state: %s private state: %s", + m_stop_id, + StateAsCString(m_public_state.GetValue()), + StateAsCString(m_private_state.GetValue())); Error error (WillResume()); // Tell the process it is about to resume before the thread list @@ -1737,13 +1740,17 @@ { DidResume(); m_thread_list.DidResume(); + if (log) + log->Printf ("Process thinks the process has resumed."); } } else { - error.SetErrorStringWithFormat("thread list returned flase after WillResume"); + error.SetErrorStringWithFormat("Process::WillResume() thread list returned false after WillResume"); } } + else if (log) + log->Printf ("Process::WillResume() got an error \"%s\".", error.AsCString("")); return error; } @@ -2605,6 +2612,13 @@ return lldb::eExecutionSetupError; } + if (m_private_state.GetValue() != eStateStopped) + { + errors.Printf ("RunThreadPlan called while the private state was not stopped."); + // REMOVE BEAR TRAP... + // abort(); + } + // Save this value for restoration of the execution context after we run uint32_t tid = exe_ctx.thread->GetIndexID(); @@ -2629,7 +2643,10 @@ Listener listener("lldb.process.listener.run-thread-plan"); exe_ctx.process->HijackProcessEvents(&listener); - + Event *random_event = listener.PeekAtNextEvent(); + // if (random_event != NULL) + // abort(); + lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); if (log) { @@ -2738,7 +2755,7 @@ if (log) log->Printf ("Halt failed: \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", halt_error.AsCString()); - abort(); +// abort(); if (single_thread_timeout_usec != 0) { Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Mon Jan 24 00:34:17 2011 @@ -351,17 +351,35 @@ Thread::ShouldReportRun (Event* event_ptr) { StateType thread_state = GetResumeState (); + if (thread_state == eStateSuspended || thread_state == eStateInvalid) + { return eVoteNoOpinion; - + } + + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_completed_plan_stack.size() > 0) { // Don't use GetCompletedPlan here, since that suppresses private plans. + if (log) + log->Printf ("Current Plan for thread %d (0x%4.4x): %s being asked whether we should report run.", + GetIndexID(), + GetID(), + m_completed_plan_stack.back()->GetName()); + return m_completed_plan_stack.back()->ShouldReportRun (event_ptr); } else + { + if (log) + log->Printf ("Current Plan for thread %d (0x%4.4x): %s being asked whether we should report run.", + GetIndexID(), + GetID(), + GetCurrentPlan()->GetName()); + return GetCurrentPlan()->ShouldReportRun (event_ptr); + } } bool Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanBase.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanBase.cpp Mon Jan 24 00:34:17 2011 @@ -90,7 +90,8 @@ { case eStopReasonInvalid: case eStopReasonNone: - m_run_vote = eVoteNo; + // This + m_run_vote = eVoteNoOpinion; m_stop_vote = eVoteNo; return false; @@ -153,7 +154,7 @@ } else { - m_run_vote = eVoteNo; + m_run_vote = eVoteNoOpinion; m_stop_vote = eVoteNo; } @@ -179,6 +180,17 @@ return true; } +bool +ThreadPlanBase::WillResume (lldb::StateType resume_state, bool current_plan) +{ + // Reset these to the default values so we don't set them wrong, then not get asked + // for a while, then return the wrong answer. + m_run_vote = eVoteNoOpinion; + m_stop_vote = eVoteNo; + return true; +} + + // The base plan is never done. bool ThreadPlanBase::MischiefManaged () 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=124113&r1=124112&r2=124113&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Jan 24 00:34:17 2011 @@ -372,7 +372,6 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, From jingham at apple.com Mon Jan 24 00:35:54 2011 From: jingham at apple.com (Jim Ingham) Date: Mon, 24 Jan 2011 06:35:54 -0000 Subject: [Lldb-commits] [lldb] r124114 - /lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20110124063554.CBA942A6C12C@llvm.org> Author: jingham Date: Mon Jan 24 00:35:54 2011 New Revision: 124114 URL: http://llvm.org/viewvc/llvm-project?rev=124114&view=rev Log: Remember to turn off the debugserver.txt hard-coded emission. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 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=124114&r1=124113&r2=124114&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 00:35:54 2011 @@ -1968,8 +1968,8 @@ ::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags); debugserver_args.AppendArgument(arg_cstr); } - debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); - debugserver_args.AppendArgument("--log-flags=0x800e0e"); +// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); +// debugserver_args.AppendArgument("--log-flags=0x800e0e"); // Now append the program arguments if (launch_process) From gclayton at apple.com Mon Jan 24 01:10:48 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 07:10:48 -0000 Subject: [Lldb-commits] [lldb] r124115 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Target/Process.cpp tools/debugserver/debugserver.xcodeproj/project.pbxproj tools/debugserver/source/MacOSX/MachThreadList.cpp Message-ID: <20110124071048.73B1F2A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 01:10:48 2011 New Revision: 124115 URL: http://llvm.org/viewvc/llvm-project?rev=124115&view=rev Log: One more thing... Resume any threads that we discover were created while we stop as they may be in sensitive areas and we set breakpoints on the thread creation routines if we are running expressions, so the threads should quickly get to a safe spot. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Target/Process.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124115&r1=124114&r2=124115&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jan 24 01:10:48 2011 @@ -2384,6 +2384,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124115&r1=124114&r2=124115&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Mon Jan 24 01:10:48 2011 @@ -2643,9 +2643,6 @@ Listener listener("lldb.process.listener.run-thread-plan"); exe_ctx.process->HijackProcessEvents(&listener); - Event *random_event = listener.PeekAtNextEvent(); - // if (random_event != NULL) - // abort(); lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); if (log) 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=124115&r1=124114&r2=124115&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Jan 24 01:10:48 2011 @@ -372,6 +372,7 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=124115&r1=124114&r2=124115&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Mon Jan 24 01:10:48 2011 @@ -322,20 +322,36 @@ UpdateThreadList(process, true, &new_threads); + DNBThreadResumeAction resume_new_threads = { -1, eStateRunning, 0, INVALID_NUB_ADDRESS }; + + const uint32_t num_new_threads = new_threads.size(); const uint32_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) { MachThread *thread = m_threads[idx].get(); + bool handled = false; + for (uint32_t new_idx = 0; new_idx < num_new_threads; ++new_idx) + { + if (thread == new_threads[new_idx].get()) + { + thread->ThreadWillResume(&resume_new_threads); + handled = true; + break; + } + } - const DNBThreadResumeAction *thread_action = thread_actions.GetActionForThread (thread->ThreadID(), true); - // There must always be a thread action for every thread. - assert (thread_action); - thread->ThreadWillResume (thread_action); + if (!handled) + { + const DNBThreadResumeAction *thread_action = thread_actions.GetActionForThread (thread->ThreadID(), true); + // There must always be a thread action for every thread. + assert (thread_action); + thread->ThreadWillResume (thread_action); + } } if (new_threads.size()) { - for (uint32_t idx = 0, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) + for (uint32_t idx = 0; idx < num_new_threads; ++idx) { DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, resuming newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", process->ProcessID(), From gclayton at apple.com Mon Jan 24 01:16:06 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 07:16:06 -0000 Subject: [Lldb-commits] [lldb] r124116 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110124071606.8748A2A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 01:16:06 2011 New Revision: 124116 URL: http://llvm.org/viewvc/llvm-project?rev=124116&view=rev Log: Bumped Xcode project versions: lldb-43 and debugserver-128. 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=124116&r1=124115&r2=124116&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jan 24 01:16:06 2011 @@ -2950,9 +2950,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 42; + DYLIB_CURRENT_VERSION = 43; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3007,11 +3007,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 42; + DYLIB_CURRENT_VERSION = 43; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3086,7 +3086,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3121,11 +3121,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 42; + DYLIB_CURRENT_VERSION = 43; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3179,7 +3179,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3217,7 +3217,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 42; + CURRENT_PROJECT_VERSION = 43; 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=124116&r1=124115&r2=124116&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Mon Jan 24 01:16:06 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 42 + 43 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=124116&r1=124115&r2=124116&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Jan 24 01:16:06 2011 @@ -460,7 +460,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 127; + CURRENT_PROJECT_VERSION = 128; 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 = 127; + CURRENT_PROJECT_VERSION = 128; 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 = 127; + CURRENT_PROJECT_VERSION = 128; 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 = 127; + CURRENT_PROJECT_VERSION = 128; 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 = 127; + CURRENT_PROJECT_VERSION = 128; 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 = 127; + CURRENT_PROJECT_VERSION = 128; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From scallanan at apple.com Mon Jan 24 02:11:45 2011 From: scallanan at apple.com (Sean Callanan) Date: Mon, 24 Jan 2011 08:11:45 -0000 Subject: [Lldb-commits] [lldb] r124117 - /lldb/trunk/source/Expression/ClangUserExpression.cpp Message-ID: <20110124081145.C00782A6C12D@llvm.org> Author: spyffe Date: Mon Jan 24 02:11:45 2011 New Revision: 124117 URL: http://llvm.org/viewvc/llvm-project?rev=124117&view=rev Log: Fixed a bug in the expression code which caused it to interpret a "this" variable that was merely a pointer -- that is, not a class pointer -- as meaning that the current context was inside a C++ method. This bug would prevent expressions from evaluating correctly in regular C code if there was a pointer variable named "this" in scope. Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=124117&r1=124116&r2=124117&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Jan 24 02:11:45 2011 @@ -89,11 +89,14 @@ { TypeFromUser target_ast_type(pointer_target_type, this_type->GetClangAST()); - if (target_ast_type.IsDefined()) + if (target_ast_type.IsDefined() && + ClangASTContext::IsCXXClassType(target_ast_type.GetOpaqueQualType())) + { m_cplusplus = true; - if (target_ast_type.IsConst()) - m_const_object = true; + if (target_ast_type.IsConst()) + m_const_object = true; + } } } else if (self_var.get()) From johnny.chen at apple.com Mon Jan 24 12:24:53 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 18:24:53 -0000 Subject: [Lldb-commits] [lldb] r124131 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/Process/Utility/ARMUtils.h source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124182453.6EC512A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 12:24:53 2011 New Revision: 124131 URL: http://llvm.org/viewvc/llvm-project?rev=124131&view=rev Log: Add an ARMUtils.h file to house utility functions for the ARM/Thumb Instruction Set Architecture. Added: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124131&r1=124130&r2=124131&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jan 24 12:24:53 2011 @@ -383,6 +383,7 @@ AF68D2561255416E002FF25B /* RegisterContextLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */; }; AF68D3311255A111002FF25B /* UnwindLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */; }; AF94005911C03F6500085DB9 /* SymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /* SymbolVendor.cpp */; }; + B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B23DD24F12EDFAC1000C3894 /* ARMUtils.h */; }; B296983712C2FB98002D92C3 /* CommandObjectVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */; }; /* End PBXBuildFile section */ @@ -1094,6 +1095,7 @@ AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnwindLLDB.cpp; path = Utility/UnwindLLDB.cpp; sourceTree = ""; }; AF68D3301255A110002FF25B /* UnwindLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindLLDB.h; path = Utility/UnwindLLDB.h; sourceTree = ""; }; AF94005711C03F6500085DB9 /* SymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolVendor.cpp; path = source/Symbol/SymbolVendor.cpp; sourceTree = ""; }; + B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = ""; }; B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = ""; }; B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1609,6 +1611,7 @@ 26B4666E11A2080F00CF6220 /* Utility */ = { isa = PBXGroup; children = ( + B23DD24F12EDFAC1000C3894 /* ARMUtils.h */, 2621C9CC12EA009300711A30 /* EmulateInstruction.h */, 2621CA0A12EA107700711A30 /* EmulateInstruction.cpp */, 2621C9CF12EA066500711A30 /* EmulateInstructionARM.h */, @@ -2313,6 +2316,7 @@ 4C7CF7E41295E10E00B4FBB5 /* ThreadPlanCallUserExpression.h in Headers */, 2621C9CE12EA009300711A30 /* EmulateInstruction.h in Headers */, 2621C9D012EA066500711A30 /* EmulateInstructionARM.h in Headers */, + B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124131&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (added) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Mon Jan 24 12:24:53 2011 @@ -0,0 +1,23 @@ +//===-- lldb_ARMUtils.h -----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_ARMUtils_h_ +#define lldb_ARMUtils_h_ + +// Utility functions for the ARM/Thumb Instruction Set Architecture. + +namespace lldb_private { + +// This function performs the check for the register numbers 13 and 15 that are +// not permitted for many Thumb register specifiers. +static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } + +} // namespace lldb_private + +#endif // lldb_ARMUtils_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124131&r1=124130&r2=124131&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 12:24:53 2011 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "EmulateInstructionARM.h" +#include "ARMUtils.h" using namespace lldb; using namespace lldb_private; @@ -80,6 +81,7 @@ eEncodingT5, } ARMEncoding; +// Typedef for the callback function used during the emulation. // Pass along (ARMEncoding)encoding as the callback data. typedef bool (*EmulateCallback) (EmulateInstructionARM *emulator, ARMEncoding encoding); From johnny.chen at apple.com Mon Jan 24 13:46:33 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 19:46:33 -0000 Subject: [Lldb-commits] [lldb] r124140 - in /lldb/trunk/source/Plugins/Process/Utility: ARMUtils.h EmulateInstructionARM.cpp Message-ID: <20110124194633.1708E2A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 13:46:32 2011 New Revision: 124140 URL: http://llvm.org/viewvc/llvm-project?rev=124140&view=rev Log: Add Encoding T2 & T3 of the PUSH instructions to the g_arm_opcodes table. Plus add an extra field ARMInstrSize to the table entry type 'ARMOpcode'. Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124140&r1=124139&r2=124140&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Mon Jan 24 13:46:32 2011 @@ -18,6 +18,18 @@ // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } +// Returns an integer result equal to the number of bits of x that are ones. +static inline uint32_t BitCount(uint32_t x) +{ + // c accumulates the total bits set in x + uint32_t c; + for (c = 0; x; ++c) + { + x &= x - 1; // clear the least significant bit set + } + return c; +} + } // namespace lldb_private #endif // lldb_ARMUtils_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124140&r1=124139&r2=124140&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 13:46:32 2011 @@ -67,7 +67,7 @@ #define ARMv8 (1u << 8) #define ARMvAll (0xffffffffu) -typedef enum ARMEncoding +typedef enum { eEncodingA1, eEncodingA2, @@ -81,19 +81,26 @@ eEncodingT5, } ARMEncoding; +typedef enum +{ + eSize16, + eSize32 +} ARMInstrSize; + // Typedef for the callback function used during the emulation. // Pass along (ARMEncoding)encoding as the callback data. typedef bool (*EmulateCallback) (EmulateInstructionARM *emulator, ARMEncoding encoding); -typedef struct ARMOpcode +typedef struct { uint32_t mask; uint32_t value; uint32_t variants; ARMEncoding encoding; + ARMInstrSize size; EmulateCallback callback; const char *name; -}; +} ARMOpcode; static bool EmulateARMPushEncoding (EmulateInstructionARM *emulator, ARMEncoding encoding) @@ -137,16 +144,31 @@ if (!success) return false; uint32_t registers = 0; + uint32_t t; // UInt(Rt) switch (encoding) { + case eEncodingT2: + // Ignore bits 15 & 13. + registers = EmulateInstruction::UnsignedBits (opcode, 15, 0) & ~0xa000; + // if BitCount(registers) < 2 then UNPREDICTABLE; + if (BitCount(registers) < 2) + return false; + break; + case eEncodingT3: + t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + // if BadReg(t) then UNPREDICTABLE; + if (BadReg(t)) + return false; + registers = (1u << t); + break; case eEncodingA1: registers = EmulateInstruction::UnsignedBits (opcode, 15, 0); break; case eEncodingA2: - const uint32_t Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); - // if t == 13 then UNPREDICTABLE - if (Rt == dwarf_sp) + t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + // if t == 13 then UNPREDICTABLE; + if (t == dwarf_sp) return false; - registers = (1u << Rt); + registers = (1u << t); break; } addr_t sp_offset = addr_byte_size * EmulateInstruction::BitCount (registers); @@ -193,9 +215,13 @@ static ARMOpcode g_arm_opcodes[] = { - { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, EmulateARMPushEncoding, + { 0xffff0000, 0xe8ad0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, + "PUSH ; contains more than one register" }, + { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, + "PUSH ; contains one register, " }, + { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, "PUSH ; contains more than one register" }, - { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, EmulateARMPushEncoding, + { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, "PUSH ; contains one register, " } }; From johnny.chen at apple.com Mon Jan 24 13:50:30 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 19:50:30 -0000 Subject: [Lldb-commits] [lldb] r124141 - in /lldb/trunk/source/Plugins/Process/Utility: ARMUtils.h EmulateInstructionARM.cpp Message-ID: <20110124195030.E1E212A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 13:50:30 2011 New Revision: 124141 URL: http://llvm.org/viewvc/llvm-project?rev=124141&view=rev Log: Move some #define's to the ARMUtils.h header file. Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124141&r1=124140&r2=124141&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Mon Jan 24 13:50:30 2011 @@ -10,10 +10,46 @@ #ifndef lldb_ARMUtils_h_ #define lldb_ARMUtils_h_ -// Utility functions for the ARM/Thumb Instruction Set Architecture. +// Common utilities for the ARM/Thumb Instruction Set Architecture. namespace lldb_private { +// ARM conditions +#define COND_EQ 0x0 +#define COND_NE 0x1 +#define COND_CS 0x2 +#define COND_HS 0x2 +#define COND_CC 0x3 +#define COND_LO 0x3 +#define COND_MI 0x4 +#define COND_PL 0x5 +#define COND_VS 0x6 +#define COND_VC 0x7 +#define COND_HI 0x8 +#define COND_LS 0x9 +#define COND_GE 0xA +#define COND_LT 0xB +#define COND_GT 0xC +#define COND_LE 0xD +#define COND_AL 0xE +#define COND_UNCOND 0xF + +// Masks for CPSR +#define MASK_CPSR_MODE_MASK (0x0000001fu) +#define MASK_CPSR_T (1u << 5) +#define MASK_CPSR_F (1u << 6) +#define MASK_CPSR_I (1u << 7) +#define MASK_CPSR_A (1u << 8) +#define MASK_CPSR_E (1u << 9) +#define MASK_CPSR_GE_MASK (0x000f0000u) +#define MASK_CPSR_J (1u << 24) +#define MASK_CPSR_Q (1u << 27) +#define MASK_CPSR_V (1u << 28) +#define MASK_CPSR_C (1u << 29) +#define MASK_CPSR_Z (1u << 30) +#define MASK_CPSR_N (1u << 31) + + // This function performs the check for the register numbers 13 and 15 that are // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124141&r1=124140&r2=124141&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 13:50:30 2011 @@ -19,42 +19,6 @@ #define PC_REG 15 #define PC_REGLIST_BIT 0x8000 -// ARM conditions -#define COND_EQ 0x0 -#define COND_NE 0x1 -#define COND_CS 0x2 -#define COND_HS 0x2 -#define COND_CC 0x3 -#define COND_LO 0x3 -#define COND_MI 0x4 -#define COND_PL 0x5 -#define COND_VS 0x6 -#define COND_VC 0x7 -#define COND_HI 0x8 -#define COND_LS 0x9 -#define COND_GE 0xA -#define COND_LT 0xB -#define COND_GT 0xC -#define COND_LE 0xD -#define COND_AL 0xE -#define COND_UNCOND 0xF - - -#define MASK_CPSR_MODE_MASK (0x0000001fu) -#define MASK_CPSR_T (1u << 5) -#define MASK_CPSR_F (1u << 6) -#define MASK_CPSR_I (1u << 7) -#define MASK_CPSR_A (1u << 8) -#define MASK_CPSR_E (1u << 9) -#define MASK_CPSR_GE_MASK (0x000f0000u) -#define MASK_CPSR_J (1u << 24) -#define MASK_CPSR_Q (1u << 27) -#define MASK_CPSR_V (1u << 28) -#define MASK_CPSR_C (1u << 29) -#define MASK_CPSR_Z (1u << 30) -#define MASK_CPSR_N (1u << 31) - - #define ARMv4 (1u << 0) #define ARMv4T (1u << 1) #define ARMv5T (1u << 2) From johnny.chen at apple.com Mon Jan 24 14:21:01 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 20:21:01 -0000 Subject: [Lldb-commits] [lldb] r124143 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124202101.7791B2A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 14:21:01 2011 New Revision: 124143 URL: http://llvm.org/viewvc/llvm-project?rev=124143&view=rev Log: Fix typo in the instruction descriptions for Encoding T2 and T3 of PUSH. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124143&r1=124142&r2=124143&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 14:21:01 2011 @@ -180,9 +180,9 @@ static ARMOpcode g_arm_opcodes[] = { { 0xffff0000, 0xe8ad0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, - "PUSH ; contains more than one register" }, + "PUSH.W ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, - "PUSH ; contains one register, " }, + "PUSH.W ; contains one register, " }, { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, "PUSH ; contains more than one register" }, { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, From johnny.chen at apple.com Mon Jan 24 14:38:45 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 20:38:45 -0000 Subject: [Lldb-commits] [lldb] r124144 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124203845.D85942A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 14:38:45 2011 New Revision: 124144 URL: http://llvm.org/viewvc/llvm-project?rev=124144&view=rev Log: Add Encoding T1 of the PUSH instructions to the g_arm_opcodes table. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124144&r1=124143&r2=124144&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 14:38:45 2011 @@ -108,8 +108,17 @@ if (!success) return false; uint32_t registers = 0; - uint32_t t; // UInt(Rt) + uint32_t t; // t = UInt(Rt) switch (encoding) { + case eEncodingT1: + registers = EmulateInstruction::UnsignedBits (opcode, 7, 0); + // The M bit represents LR. + if (EmulateInstruction::UnsignedBits (opcode, 8, 8)) + registers |= 0x000eu; + // if BitCount(registers) < 1 then UNPREDICTABLE; + if (BitCount(registers) < 1) + return false; + break; case eEncodingT2: // Ignore bits 15 & 13. registers = EmulateInstruction::UnsignedBits (opcode, 15, 0) & ~0xa000; @@ -179,6 +188,8 @@ static ARMOpcode g_arm_opcodes[] = { + { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, EmulateARMPushEncoding, + "PUSH " }, { 0xffff0000, 0xe8ad0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, "PUSH.W ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, From johnny.chen at apple.com Mon Jan 24 16:02:46 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 22:02:46 -0000 Subject: [Lldb-commits] [lldb] r124147 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124220246.F2AF12A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 16:02:46 2011 New Revision: 124147 URL: http://llvm.org/viewvc/llvm-project?rev=124147&view=rev Log: Make the assembler mnemonic lowercase. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124147&r1=124146&r2=124147&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 16:02:46 2011 @@ -189,15 +189,15 @@ static ARMOpcode g_arm_opcodes[] = { { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, EmulateARMPushEncoding, - "PUSH " }, + "push " }, { 0xffff0000, 0xe8ad0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, - "PUSH.W ; contains more than one register" }, + "push.w ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, - "PUSH.W ; contains one register, " }, + "push.w ; contains one register, " }, { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, - "PUSH ; contains more than one register" }, + "push ; contains more than one register" }, { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, - "PUSH ; contains one register, " } + "push ; contains one register, " } }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); From johnny.chen at apple.com Mon Jan 24 16:25:48 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 22:25:48 -0000 Subject: [Lldb-commits] [lldb] r124149 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124222548.89C5B2A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 16:25:48 2011 New Revision: 124149 URL: http://llvm.org/viewvc/llvm-project?rev=124149&view=rev Log: Add comment about using Encoding A1 push instruction to emulate the "stmfd sp!, reg" case, i.e., pushing one register onto the full descending stacks. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124149&r1=124148&r2=124149&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 16:25:48 2011 @@ -135,6 +135,9 @@ break; case eEncodingA1: registers = EmulateInstruction::UnsignedBits (opcode, 15, 0); + // Instead of return false, let's handle the following case as well, + // which amounts to pushing one reg onto the full descending stacks. + // if BitCount(register_list) < 2 then SEE STMDB / STMFD; break; case eEncodingA2: t = EmulateInstruction::UnsignedBits (opcode, 15, 12); From johnny.chen at apple.com Mon Jan 24 16:50:17 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 22:50:17 -0000 Subject: [Lldb-commits] [lldb] r124152 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124225017.26B2D2A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 16:50:16 2011 New Revision: 124152 URL: http://llvm.org/viewvc/llvm-project?rev=124152&view=rev Log: Fix typo of encoding T2 (push) in the original ARM Architecture Reference Manual, which has been corrected in the subsequent errata. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124152&r1=124151&r2=124152&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 16:50:16 2011 @@ -193,7 +193,7 @@ { { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, EmulateARMPushEncoding, "push " }, - { 0xffff0000, 0xe8ad0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, + { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, "push.w ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, "push.w ; contains one register, " }, From gclayton at apple.com Mon Jan 24 17:35:47 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 24 Jan 2011 23:35:47 -0000 Subject: [Lldb-commits] [lldb] r124155 - /lldb/trunk/source/Target/Target.cpp Message-ID: <20110124233547.32ACC2A6C12C@llvm.org> Author: gclayton Date: Mon Jan 24 17:35:47 2011 New Revision: 124155 URL: http://llvm.org/viewvc/llvm-project?rev=124155&view=rev Log: Fixed a crasher due to not checking if a shared pointer (m_last_created_breakpoint) contained a valid object pointer. Modified: lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=124155&r1=124154&r2=124155&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Mon Jan 24 17:35:47 2011 @@ -326,8 +326,11 @@ m_internal_breakpoint_list.Remove(break_id, false); else { - if (m_last_created_breakpoint->GetID() == break_id) - m_last_created_breakpoint.reset(); + if (m_last_created_breakpoint) + { + if (m_last_created_breakpoint->GetID() == break_id) + m_last_created_breakpoint.reset(); + } m_breakpoint_list.Remove(break_id, true); } return true; From johnny.chen at apple.com Mon Jan 24 17:40:59 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 24 Jan 2011 23:40:59 -0000 Subject: [Lldb-commits] [lldb] r124156 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110124234059.A392F2A6C12C@llvm.org> Author: johnny Date: Mon Jan 24 17:40:59 2011 New Revision: 124156 URL: http://llvm.org/viewvc/llvm-project?rev=124156&view=rev Log: Use two opcode tables g_arm_opcodes and g_thumb_opcodes, instead of lumping arm and thumb opcodes together. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124156&r1=124155&r2=124156&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 17:40:59 2011 @@ -191,19 +191,24 @@ static ARMOpcode g_arm_opcodes[] = { + { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, + "push ; contains more than one register" }, + { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, + "push ; contains one register, " } +}; + +static ARMOpcode g_thumb_opcodes[] = +{ { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, EmulateARMPushEncoding, "push " }, { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, "push.w ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, - "push.w ; contains one register, " }, - { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, - "push ; contains more than one register" }, - { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, - "push ; contains one register, " } + "push.w ; contains one register, " } }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); +static const size_t k_num_thumb_opcodes = sizeof(g_thumb_opcodes)/sizeof(ARMOpcode); bool EmulateInstructionARM::ReadInstruction () From johnny.chen at apple.com Mon Jan 24 19:13:00 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 01:13:00 -0000 Subject: [Lldb-commits] [lldb] r124165 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110125011300.9170A2A6C130@llvm.org> Author: johnny Date: Mon Jan 24 19:13:00 2011 New Revision: 124165 URL: http://llvm.org/viewvc/llvm-project?rev=124165&view=rev Log: Add an emulate-callback function emulate_str_rt_sp() to the g_arm_opcodes table. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124165&r1=124164&r2=124165&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Mon Jan 24 19:13:00 2011 @@ -67,7 +67,7 @@ } ARMOpcode; static bool -EmulateARMPushEncoding (EmulateInstructionARM *emulator, ARMEncoding encoding) +emulate_push (EmulateInstructionARM *emulator, ARMEncoding encoding) { #if 0 // ARM pseudo code... @@ -146,8 +146,10 @@ return false; registers = (1u << t); break; + default: + return false; } - addr_t sp_offset = addr_byte_size * EmulateInstruction::BitCount (registers); + addr_t sp_offset = addr_byte_size * BitCount (registers); addr_t addr = sp - sp_offset; uint32_t i; @@ -189,21 +191,98 @@ return true; } +// A store operation to the SP that also updates the SP. +static bool +emulate_str_rt_sp (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + offset_addr = if add then (R[n] + imm32) else (R[n] - imm32); + address = if index then offset_addr else R[n]; + MemU[address,4] = if t == 15 then PCStoreValue() else R[t]; + if wback then R[n] = offset_addr; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const uint32_t addr_byte_size = emulator->GetAddressByteSize(); + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t t; // t = UInt(Rt) + uint32_t imm12; + switch (encoding) { + case eEncodingA1: + t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + imm12 = EmulateInstruction::UnsignedBits (opcode, 11, 0); + break; + default: + return false; + } + addr_t sp_offset = imm12; + addr_t addr = sp - sp_offset; + + EmulateInstruction::Context context = { EmulateInstruction::eContextPushRegisterOnStack, eRegisterKindDWARF, 0, 0 }; + if (t != 15) + { + context.arg1 = dwarf_r0 + t; // arg1 in the context is the DWARF register number + context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset + uint32_t reg_value = emulator->ReadRegisterUnsigned(eRegisterKindDWARF, context.arg1, 0, &success); + if (!success) + return false; + if (!emulator->WriteMemoryUnsigned (context, addr, reg_value, addr_byte_size)) + return false; + } + else + { + context.arg1 = dwarf_pc; // arg1 in the context is the DWARF register number + context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset + const uint32_t pc = emulator->ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, 0, &success); + if (!success) + return false; + if (!emulator->WriteMemoryUnsigned (context, addr, pc + 8, addr_byte_size)) + return false; + } + + context.type = EmulateInstruction::eContextAdjustStackPointer; + context.arg0 = eRegisterKindGeneric; + context.arg1 = LLDB_REGNUM_GENERIC_SP; + context.arg2 = sp_offset; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, sp - sp_offset)) + return false; + } + return true; +} + static ARMOpcode g_arm_opcodes[] = { - { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, EmulateARMPushEncoding, + { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, "push ; contains more than one register" }, - { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, EmulateARMPushEncoding, - "push ; contains one register, " } + { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, + "push ; contains one register, " }, + + // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; + { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, + "str Rt, [sp, #-n]!" } }; static ARMOpcode g_thumb_opcodes[] = { - { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, EmulateARMPushEncoding, + { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, "push " }, - { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, EmulateARMPushEncoding, + { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w ; contains more than one register" }, - { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, EmulateARMPushEncoding, + { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w ; contains one register, " } }; From jingham at apple.com Mon Jan 24 20:47:23 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 25 Jan 2011 02:47:23 -0000 Subject: [Lldb-commits] [lldb] r124170 - /lldb/trunk/source/Target/Thread.cpp Message-ID: <20110125024723.9B98D2A6C130@llvm.org> Author: jingham Date: Mon Jan 24 20:47:23 2011 New Revision: 124170 URL: http://llvm.org/viewvc/llvm-project?rev=124170&view=rev Log: Check for a NULL saved stop info shared pointer. Modified: lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=124170&r1=124169&r2=124170&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Mon Jan 24 20:47:23 2011 @@ -133,7 +133,8 @@ Thread::RestoreThreadStateFromCheckpoint (ThreadStateCheckpoint &saved_state) { RestoreSaveFrameZero(saved_state.register_backup); - saved_state.stop_info_sp->MakeStopInfoValid(); + if (saved_state.stop_info_sp) + saved_state.stop_info_sp->MakeStopInfoValid(); SetStopInfo(saved_state.stop_info_sp); return true; } From gclayton at apple.com Mon Jan 24 20:58:48 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 02:58:48 -0000 Subject: [Lldb-commits] [lldb] r124171 - in /lldb/trunk: include/lldb/Core/Broadcaster.h include/lldb/Core/Section.h source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.h source/Target/Process.cpp Message-ID: <20110125025849.0615A2A6C130@llvm.org> Author: gclayton Date: Mon Jan 24 20:58:48 2011 New Revision: 124171 URL: http://llvm.org/viewvc/llvm-project?rev=124171&view=rev Log: Fixed ProcessGDBRemote to kill the process correctly when it is either running or stopped. Added support for sections to be able to state if they are encrypted or not. Modified: lldb/trunk/include/lldb/Core/Broadcaster.h lldb/trunk/include/lldb/Core/Section.h lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Core/Broadcaster.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Broadcaster.h?rev=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Broadcaster.h (original) +++ lldb/trunk/include/lldb/Core/Broadcaster.h Mon Jan 24 20:58:48 2011 @@ -222,6 +222,14 @@ bool HijackBroadcaster (Listener *listener, uint32_t event_mask = UINT32_MAX); + bool + IsHijackedForEvent (uint32_t event_mask) + { + if (m_hijacking_listener) + return (event_mask & m_hijacking_mask) != 0; + return false; + } + //------------------------------------------------------------------ /// Restore the state of the Broadcaster from a previous hijack attempt. /// Modified: lldb/trunk/include/lldb/Core/Section.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Section.h?rev=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Section.h (original) +++ lldb/trunk/include/lldb/Core/Section.h Mon Jan 24 20:58:48 2011 @@ -213,6 +213,18 @@ { m_fake = fake; } + + bool + IsEncrypted () const + { + return m_encrypted; + } + + void + SetIsEncrypted (bool b) + { + m_encrypted = b; + } bool IsDescendant (const Section *section); @@ -273,10 +285,11 @@ uint64_t m_file_offset; // Object file offset (if any) uint64_t m_file_size; // Object file size (can be smaller than m_byte_size for zero filled sections...) SectionList m_children; // Child sections - bool m_fake; // If true, then this section only can contain the address if one of its + bool m_fake:1, // If true, then this section only can contain the address if one of its // children contains an address. This allows for gaps between the children // that are contained in the address range for this section, but do not produce // hits unless the children contain the address. + m_encrypted:1; // Set to true if the contents are encrypted const Section * m_linked_section; uint64_t m_linked_offset; private: Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon Jan 24 20:58:48 2011 @@ -251,6 +251,9 @@ load_cmd.filesize = m_data.GetAddress(&offset); if (m_data.GetU32(&offset, &load_cmd.maxprot, 4)) { + + const bool segment_is_encrypted = (load_cmd.flags & SegmentCommandFlagBitProtectedVersion1) != 0; + // Keep a list of mach segments around in case we need to // get at data that isn't stored in the abstracted Sections. m_mach_segments.push_back (load_cmd); @@ -272,6 +275,7 @@ load_cmd.filesize, // Size in bytes of this section as found in the the file load_cmd.flags)); // Flags for this section + segment_sp->SetIsEncrypted (segment_is_encrypted); m_sections_ap->AddSection(segment_sp); } @@ -369,6 +373,7 @@ load_cmd.flags)); // Flags for this section segment_sp->SetIsFake(true); m_sections_ap->AddSection(segment_sp); + segment_sp->SetIsEncrypted (segment_is_encrypted); } } assert (segment_sp.get()); @@ -482,6 +487,9 @@ sect64.offset, sect64.offset == 0 ? 0 : sect64.size, sect64.flags)); + // Set the section to be encrypted to match the segment + section_sp->SetIsEncrypted (segment_is_encrypted); + segment_sp->GetChildren().AddSection(section_sp); if (segment_sp->IsFake()) 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=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Jan 24 20:58:48 2011 @@ -151,7 +151,7 @@ bool timed_out = false; bool sent_interrupt = false; - if (SendInterrupt(locker, 1, sent_interrupt, timed_out)) + if (SendInterrupt(locker, 2, sent_interrupt, timed_out)) { if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out)) { @@ -206,7 +206,6 @@ ) { LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); - LogSP async_log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC)); if (log) log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__); @@ -222,21 +221,18 @@ while (state == eStateRunning) { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...)", __FUNCTION__); if (WaitForPacket (response, (TimeValue*)NULL)) { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); - async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC); if (response.Empty()) state = eStateInvalid; else { const char stop_type = response.GetChar(); if (log) - log->Printf ("GDBRemoteCommunication::%s () got '%c' packet", __FUNCTION__, stop_type); + log->Printf ("GDBRemoteCommunication::%s () got packet: %s", __FUNCTION__, response.GetStringRef().c_str()); switch (stop_type) { case 'T': @@ -248,8 +244,8 @@ m_private_is_running.SetValue (false, eBroadcastAlways); if (m_async_signal != -1) { - if (async_log) - async_log->Printf ("async: send signo = %s", Host::GetSignalAsCString (m_async_signal)); + if (log) + log->Printf ("async: send signo = %s", Host::GetSignalAsCString (m_async_signal)); // Save off the async signal we are supposed to send const int async_signal = m_async_signal; @@ -260,8 +256,8 @@ uint8_t signo = response.GetHexU8(255); if (signo == async_signal) { - if (async_log) - async_log->Printf ("async: stopped with signal %s, we are done running", Host::GetSignalAsCString (signo)); + if (log) + log->Printf ("async: stopped with signal %s, we are done running", Host::GetSignalAsCString (signo)); // We already stopped with a signal that we wanted // to stop with, so we are done @@ -279,15 +275,15 @@ "C%2.2x", async_signal); - if (async_log) - async_log->Printf ("async: stopped with signal %s, resume with %s", + if (log) + log->Printf ("async: stopped with signal %s, resume with %s", Host::GetSignalAsCString (signo), Host::GetSignalAsCString (async_signal)); if (SendPacket(signal_packet, signal_packet_len) == 0) { - if (async_log) - async_log->Printf ("async: error: failed to resume with %s", + if (log) + log->Printf ("async: error: failed to resume with %s", Host::GetSignalAsCString (async_signal)); state = eStateExited; break; @@ -301,9 +297,9 @@ } else if (m_async_packet_predicate.GetValue()) { - if (async_log) - async_log->Printf ("async: send async packet: %s", - m_async_packet.c_str()); + if (log) + log->Printf ("async: send async packet: %s", + m_async_packet.c_str()); // We are supposed to send an asynchronous packet while // we are running. @@ -320,9 +316,9 @@ // packet know that the packet has been sent. m_async_packet_predicate.SetValue(false, eBroadcastAlways); - if (async_log) - async_log->Printf ("async: resume after async response received: %s", - m_async_response.GetStringRef().c_str()); + if (log) + log->Printf ("async: resume after async response received: %s", + m_async_response.GetStringRef().c_str()); // Continue again if (SendPacket("c", 1) == 0) @@ -342,6 +338,7 @@ break; case 'W': + case 'X': // process exited state = eStateExited; break; @@ -365,20 +362,18 @@ default: if (log) - log->Printf ("GDBRemoteCommunication::%s () got unrecognized async packet: '%s'", __FUNCTION__, stop_type); + log->Printf ("GDBRemoteCommunication::%s () unrecognized async packet", __FUNCTION__); break; } } } else { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...) => false", __FUNCTION__); state = eStateInvalid; } } - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () => %s", __FUNCTION__, StateAsCString(state)); response.SetFilePos(0); @@ -498,7 +493,7 @@ timeout = TimeValue::Now(); timeout.OffsetWithSeconds (seconds_to_wait_for_stop); } - ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: \\x03"); + ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS | GDBR_LOG_PROCESS, "send packet: \\x03"); if (Write (&ctrl_c, 1, status, NULL) > 0) { sent_interrupt = true; 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=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 20:58:48 2011 @@ -1175,7 +1175,6 @@ ( bool discard_thread_plans, bool catch_stop_event, - bool resume_private_state_thread, EventSP &stop_event_sp ) { @@ -1183,21 +1182,14 @@ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + bool paused_private_state_thread = false; const bool is_running = m_gdb_comm.IsRunning(); if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i, resume_private_state_thread=%i) is_running=%i", + log->Printf ("ProcessGDBRemote::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i) is_running=%i", discard_thread_plans, - catch_stop_event, - resume_private_state_thread, + catch_stop_event, is_running); - if (catch_stop_event) - { - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() pausing private state thread"); - PausePrivateStateThread(); - } - if (discard_thread_plans) { if (log) @@ -1206,6 +1198,14 @@ } if (is_running) { + if (catch_stop_event) + { + if (log) + log->Printf ("ProcessGDBRemote::InterruptIfRunning() pausing private state thread"); + PausePrivateStateThread(); + paused_private_state_thread = true; + } + bool timed_out = false; bool sent_interrupt = false; Mutex::Locker locker; @@ -1217,17 +1217,18 @@ error.SetErrorString("timed out sending interrupt packet"); else error.SetErrorString("unknown error sending interrupt packet"); - if (catch_stop_event) + if (paused_private_state_thread) ResumePrivateStateThread(); return error; } if (catch_stop_event) { + // LISTEN HERE TimeValue timeout_time; timeout_time = TimeValue::Now(); - timeout_time.OffsetWithSeconds(1); - StateType state = WaitForProcessStopPrivate (&timeout_time, stop_event_sp); + timeout_time.OffsetWithSeconds(5); + StateType state = WaitForStateChangedEventsPrivate (&timeout_time, stop_event_sp); const bool timed_out = state == eStateInvalid; if (log) @@ -1237,7 +1238,7 @@ error.SetErrorString("unable to verify target stopped"); } - if (catch_stop_event && resume_private_state_thread) + if (paused_private_state_thread) { if (log) log->Printf ("ProcessGDBRemote::InterruptIfRunning() resuming private state thread"); @@ -1256,9 +1257,8 @@ bool discard_thread_plans = true; bool catch_stop_event = true; - bool resume_private_state_thread = false; // DoDetach will resume the thread EventSP event_sp; - return InterruptIfRunning (discard_thread_plans, catch_stop_event, resume_private_state_thread, event_sp); + return InterruptIfRunning (discard_thread_plans, catch_stop_event, event_sp); } Error @@ -1295,21 +1295,6 @@ } Error -ProcessGDBRemote::WillDestroy () -{ - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - if (log) - log->Printf ("ProcessGDBRemote::WillDestroy()"); - bool discard_thread_plans = true; - bool catch_stop_event = true; - bool resume_private_state_thread = true; - EventSP event_sp; - return InterruptIfRunning (discard_thread_plans, catch_stop_event, resume_private_state_thread, event_sp); - - -} - -Error ProcessGDBRemote::DoDestroy () { Error error; @@ -1320,38 +1305,11 @@ // Interrupt if our inferior is running... if (m_gdb_comm.IsConnected()) { - m_continue_packet.Clear(); - m_continue_packet.Printf("k"); - Listener listener ("gdb-remote.kill-packet-sent"); - if (listener.StartListeningForEvents (&m_gdb_comm, GDBRemoteCommunication::eBroadcastBitRunPacketSent)) - { - EventSP event_sp; - TimeValue timeout; - timeout = TimeValue::Now(); - timeout.OffsetWithSeconds (1); - m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (m_continue_packet.GetData(), m_continue_packet.GetSize())); - - // Wait for the async thread to send the "k" packet - if (listener.WaitForEvent (&timeout, event_sp)) - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() got confirmation the \"k\" packet was sent"); - } - else - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() timed out waiting for \"k\" packet to be sent"); - error.SetErrorString("Resume timed out."); - } - - // Wait for the async thread to exit which will indicate we stopped. - // Hopefully the stop will be a process exited state since we are - // asking the process to go away. - if (!m_gdb_comm.WaitForNotRunning (&timeout)) - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() timed out waiting for \"k\" stop reply packet"); - } + StringExtractorGDBRemote response; + bool send_async = true; + if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 3, send_async) == 0) + { + error.SetErrorString("kill packet failed"); } } StopAsyncThread (); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Mon Jan 24 20:58:48 2011 @@ -150,9 +150,6 @@ DoSignal (int signal); virtual lldb_private::Error - WillDestroy (); - - virtual lldb_private::Error DoDestroy (); virtual void @@ -392,7 +389,6 @@ lldb_private::Error InterruptIfRunning (bool discard_thread_plans, bool catch_stop_event, - bool resume_private_state_thread, lldb::EventSP &stop_event_sp); private: Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124171&r1=124170&r2=124171&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Mon Jan 24 20:58:48 2011 @@ -555,9 +555,20 @@ bool Process::SetExitStatus (int status, const char *cstr) { + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf("Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)", + status, status, + cstr ? "\"" : "", + cstr ? cstr : "NULL", + cstr ? "\"" : ""); + // We were already in the exited state if (m_private_state.GetValue() == eStateExited) + { + log->Printf("Process::SetExitStatus () ignoring exit status because state was already set to eStateExited"); return false; + } m_exit_status = status; if (cstr) @@ -621,7 +632,7 @@ void Process::SetPublicState (StateType new_state) { - LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state)); m_public_state.SetValue (new_state); @@ -636,7 +647,7 @@ void Process::SetPrivateState (StateType new_state) { - LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); bool state_changed = false; if (log) @@ -2111,19 +2122,22 @@ Process::HandlePrivateEvent (EventSP &event_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); - const StateType internal_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); + const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); // See if we should broadcast this state to external clients? const bool should_broadcast = ShouldBroadcastEvent (event_sp.get()); - if (log) - log->Printf ("Process::%s (arg = %p, pid = %i) got event '%s' broadcast = %s", __FUNCTION__, this, GetID(), StateAsCString(internal_state), should_broadcast ? "yes" : "no"); if (should_broadcast) { if (log) { - log->Printf ("\tChanging public state from: %s to %s", StateAsCString(GetState ()), StateAsCString (internal_state)); + log->Printf ("Process::%s (pid = %i) broadcasting new state %s (old state %s) to %s", + __FUNCTION__, + GetID(), + StateAsCString(new_state), + StateAsCString (GetState ()), + IsHijackedForEvent(eBroadcastBitStateChanged) ? "hijacked" : "public"); } - if (StateIsRunningState (internal_state)) + if (StateIsRunningState (new_state)) PushProcessInputReader (); else PopProcessInputReader (); @@ -2134,7 +2148,12 @@ { if (log) { - log->Printf ("\tNot changing public state with event: %s", StateAsCString (internal_state)); + log->Printf ("Process::%s (pid = %i) suppressing state %s (old state %s): should_broadcast == false", + __FUNCTION__, + GetID(), + StateAsCString(new_state), + StateAsCString (GetState ()), + IsHijackedForEvent(eBroadcastBitStateChanged) ? "hijacked" : "public"); } } } @@ -2649,7 +2668,7 @@ { StreamString s; thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - log->Printf ("Resuming thread %u - 0x%4.4x to run thread plan \"%s\".", exe_ctx.thread->GetIndexID(), exe_ctx.thread->GetID(), s.GetData()); + log->Printf ("Process::RunThreadPlan(): Resuming thread %u - 0x%4.4x to run thread plan \"%s\".", exe_ctx.thread->GetIndexID(), exe_ctx.thread->GetID(), s.GetData()); } Error resume_error = exe_ctx.process->Resume (); @@ -2690,10 +2709,10 @@ // Not really sure what to do if Halt fails here... if (log) { if (try_all_threads) - log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.", + log->Printf ("Process::RunThreadPlan(): Running function with timeout: %d timed out, trying with all threads enabled.", single_thread_timeout_usec); else - log->Printf ("Running function with timeout: %d timed out, abandoning execution.", + log->Printf ("Process::RunThreadPlan(): Running function with timeout: %d timed out, abandoning execution.", single_thread_timeout_usec); } @@ -2703,7 +2722,7 @@ { timeout_ptr = NULL; if (log) - log->Printf ("Halt succeeded."); + log->Printf ("Process::RunThreadPlan(): Halt succeeded."); // Between the time that we got the timeout and the time we halted, but target // might have actually completed the plan. If so, we're done. Note, I call WFE here with a short @@ -2715,7 +2734,7 @@ stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (log) { - log->Printf ("Stopped with event: %s", StateAsCString(stop_state)); + log->Printf ("Process::RunThreadPlan(): Stopped with event: %s", StateAsCString(stop_state)); if (stop_state == lldb::eStateStopped && Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get())) log->Printf (" Event was the Halt interruption event."); } @@ -2723,7 +2742,7 @@ if (exe_ctx.thread->IsThreadPlanDone (thread_plan_sp.get())) { if (log) - log->Printf ("Even though we timed out, the call plan was done. Exiting wait loop."); + log->Printf ("Process::RunThreadPlan(): Even though we timed out, the call plan was done. Exiting wait loop."); return_value = lldb::eExecutionCompleted; break; } @@ -2734,7 +2753,7 @@ thread_plan_sp->SetStopOthers (false); if (log) - log->Printf ("About to resume."); + log->Printf ("Process::RunThreadPlan(): About to resume."); exe_ctx.process->Resume(); continue; @@ -2750,7 +2769,7 @@ { if (log) - log->Printf ("Halt failed: \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", + log->Printf ("Process::RunThreadPlan(): halt failed: error = \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", halt_error.AsCString()); // abort(); @@ -2767,18 +2786,22 @@ stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (log) - log->Printf("Got event: %s.", StateAsCString(stop_state)); + log->Printf("Process::RunThreadPlan(): got event: %s.", StateAsCString(stop_state)); if (stop_state == lldb::eStateRunning || stop_state == lldb::eStateStepping) continue; if (exe_ctx.thread->IsThreadPlanDone (thread_plan_sp.get())) { + if (log) + log->Printf("Process::RunThreadPlan(): thread plan is done"); return_value = lldb::eExecutionCompleted; break; } else if (exe_ctx.thread->WasThreadPlanDiscarded (thread_plan_sp.get())) { + if (log) + log->Printf("Process::RunThreadPlan(): thread plan was discarded"); return_value = lldb::eExecutionDiscarded; break; } @@ -2791,7 +2814,7 @@ event_sp->Dump (&s); else { - log->Printf ("Stop event that interrupted us is NULL."); + log->Printf ("Process::RunThreadPlan(): Stop event that interrupted us is NULL."); } StreamString ts; @@ -2860,7 +2883,7 @@ if (!GetThreadList().ShouldStop(event_sp.get())) { if (log) - log->Printf("Execution interrupted, but nobody wanted to stop, so we continued: %s %s", + log->Printf("Process::RunThreadPlan(): execution interrupted, but nobody wanted to stop, so we continued: %s %s", s.GetData(), event_explanation); if (single_thread_timeout_usec != 0) { @@ -2874,7 +2897,7 @@ else { if (log) - log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation); + log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s", s.GetData(), event_explanation); } } From jmolenda at apple.com Mon Jan 24 21:05:13 2011 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 25 Jan 2011 03:05:13 -0000 Subject: [Lldb-commits] [lldb] r124172 - /lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Message-ID: <20110125030513.899922A6C130@llvm.org> Author: jmolenda Date: Mon Jan 24 21:05:13 2011 New Revision: 124172 URL: http://llvm.org/viewvc/llvm-project?rev=124172&view=rev Log: Use new Section::IsEncrypted() method to check if the eh_frame section is encrypted before trying to read it. Fixes assert / crash when trying to unwind an executable w/ encrypted eh_frame sect. Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=124172&r1=124171&r2=124172&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Mon Jan 24 21:05:13 2011 @@ -67,7 +67,7 @@ bool DWARFCallFrameInfo::GetFDEEntryByAddress (Address addr, FDEEntry& fde_entry) { - if (m_section.get() == NULL) + if (m_section.get() == NULL || m_section->IsEncrypted()) return false; GetFDEIndex(); @@ -83,7 +83,7 @@ { --idx; } - if (idx != m_fde_index.begin() && idx->bounds.GetBaseAddress().GetOffset() != addr.GetOffset()) + if (idx != m_fde_index.begin() && !idx->bounds.ContainsFileAddress (addr)) { --idx; } @@ -281,7 +281,7 @@ void DWARFCallFrameInfo::GetFDEIndex () { - if (m_section.get() == NULL) + if (m_section.get() == NULL || m_section->IsEncrypted()) return; if (m_fde_index_initialized) return; @@ -337,7 +337,7 @@ { dw_offset_t current_entry = offset; - if (m_section.get() == NULL) + if (m_section.get() == NULL || m_section->IsEncrypted()) return false; if (m_cfi_data_initialized == false) From jmolenda at apple.com Mon Jan 24 21:12:34 2011 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 25 Jan 2011 03:12:34 -0000 Subject: [Lldb-commits] [lldb] r124173 - /lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Message-ID: <20110125031234.BCF0F2A6C130@llvm.org> Author: jmolenda Date: Mon Jan 24 21:12:34 2011 New Revision: 124173 URL: http://llvm.org/viewvc/llvm-project?rev=124173&view=rev Log: Revert one unintended change checked in to DWARFCallFrameInfo.cpp with my last commit. The change should be correct but it's not fixing anything important and right now unneeded changes are not a good idea. Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=124173&r1=124172&r2=124173&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Mon Jan 24 21:12:34 2011 @@ -83,7 +83,7 @@ { --idx; } - if (idx != m_fde_index.begin() && !idx->bounds.ContainsFileAddress (addr)) + if (idx != m_fde_index.begin() && idx->bounds.GetBaseAddress().GetOffset() != addr.GetOffset()) { --idx; } From gclayton at apple.com Mon Jan 24 22:57:42 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 04:57:42 -0000 Subject: [Lldb-commits] [lldb] r124177 - /lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20110125045742.81A222A6C130@llvm.org> Author: gclayton Date: Mon Jan 24 22:57:42 2011 New Revision: 124177 URL: http://llvm.org/viewvc/llvm-project?rev=124177&view=rev Log: One more fix to ProcessGDBRemote::DoDestroy(). This one will make sure we parse the exit status in case we send this packet while stopped. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 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=124177&r1=124176&r2=124177&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 22:57:42 2011 @@ -1307,7 +1307,17 @@ { StringExtractorGDBRemote response; bool send_async = true; - if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 3, send_async) == 0) + if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 3, send_async)) + { + char packet_cmd = response.GetChar(0); + + if (packet_cmd == 'W' || packet_cmd == 'X') + { + m_last_stop_packet = response; + SetExitStatus(response.GetHexU8(), NULL); + } + } + else { error.SetErrorString("kill packet failed"); } From jingham at apple.com Mon Jan 24 23:26:48 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 25 Jan 2011 05:26:48 -0000 Subject: [Lldb-commits] [lldb] r124178 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp tools/debugserver/debugserver.xcodeproj/project.pbxproj tools/debugserver/source/MacOSX/MachThread.cpp tools/debugserver/source/MacOSX/MachThread.h Message-ID: <20110125052648.B7DF12A6C130@llvm.org> Author: jingham Date: Mon Jan 24 23:26:48 2011 New Revision: 124178 URL: http://llvm.org/viewvc/llvm-project?rev=124178&view=rev Log: When we are stepping a thread, force it to resume ALL the way to 0. And of course, when we stop if we undid some user provided suspends, we need to re-do the suspends. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124178&r1=124177&r2=124178&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jan 24 23:26:48 2011 @@ -2388,7 +2388,6 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, 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=124178&r1=124177&r2=124178&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 23:26:48 2011 @@ -1936,8 +1936,8 @@ ::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags); debugserver_args.AppendArgument(arg_cstr); } -// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); -// debugserver_args.AppendArgument("--log-flags=0x800e0e"); + debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); + debugserver_args.AppendArgument("--log-flags=0x800e0e"); // Now append the program arguments if (launch_process) 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=124178&r1=124177&r2=124178&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Jan 24 23:26:48 2011 @@ -372,7 +372,6 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=124178&r1=124177&r2=124178&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Mon Jan 24 23:26:48 2011 @@ -30,14 +30,15 @@ m_state (eStateUnloaded), m_state_mutex (PTHREAD_MUTEX_RECURSIVE), m_breakID (INVALID_NUB_BREAK_ID), - m_suspendCount (0), + m_suspend_count (0), m_arch_ap (DNBArchProtocol::Create (this)), - m_reg_sets (m_arch_ap->GetRegisterSetInfo (&n_num_reg_sets)) + m_reg_sets (m_arch_ap->GetRegisterSetInfo (&n_num_reg_sets)), + m_basic_info_valid (false) { // Get the thread state so we know if a thread is in a state where we can't // muck with it and also so we get the suspend count correct in case it was // already suspended - GetBasicInfo(); + GetBasicInfo(true); DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id); } @@ -48,7 +49,7 @@ -uint32_t +int32_t MachThread::Suspend() { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); @@ -56,14 +57,47 @@ { DNBError err(::thread_suspend (m_tid), DNBError::MachKernel); if (err.Success()) - m_suspendCount++; + m_suspend_count++; if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) err.LogThreaded("::thread_suspend (%4.4x)", m_tid); } - return SuspendCount(); + return m_suspend_count; } -uint32_t +int32_t +MachThread::ForceResume () +{ + // We need to resume this all the way to 0. + DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); + // Okay, now m_basic_info has the full suspend count. So I'll just + // keep decrementing the suspend count till that is zero, and at the same time + // decrement m_suspend_count. If that goes below zero, then the next time we + // call RestoreSuspendCount, we'll have to suspend it back to 0. + uint32_t num_suspends = m_basic_info.suspend_count + m_suspend_count; + DNBError err; + while (num_suspends > 0) + { + if (m_suspend_count < 0) + DNBLogThreadedIf(LOG_THREAD, "MachThread::%s ( ) (tid = %4.4x) setting suspend count negative = %d", __FUNCTION__, + m_tid, m_suspend_count); + err = ::thread_resume (m_tid); + if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) + err.LogThreaded("ForceResume ::thread_resume (%4.4x)", m_tid); + if (err.Success()) + { + --m_suspend_count; + --num_suspends; + } + else + { + break; + } + } + return m_suspend_count; + +} + +int32_t MachThread::Resume() { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); @@ -71,49 +105,59 @@ { RestoreSuspendCount(); } - return SuspendCount(); + return m_suspend_count; } bool MachThread::RestoreSuspendCount() { - DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); + DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( ) (tid = %4.4x) our suspend count = %d", __FUNCTION__, + m_tid, m_suspend_count); DNBError err; if (ThreadIDIsValid(m_tid) == false) return false; - if (m_suspendCount > 0) + if (m_suspend_count > 0) { - while (m_suspendCount > 0) + while (m_suspend_count > 0) { err = ::thread_resume (m_tid); if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) - err.LogThreaded("::thread_resume (%4.4x)", m_tid); + err.LogThreaded("RestoreSuspendCount ::thread_resume (%4.4x)", m_tid); if (err.Success()) - --m_suspendCount; + --m_suspend_count; else { - if (GetBasicInfo()) - m_suspendCount = m_basicInfo.suspend_count; + if (GetBasicInfo(true)) + m_suspend_count = m_basic_info.suspend_count; else - m_suspendCount = 0; + m_suspend_count = 0; return false; // ??? } } } - // We don't currently really support resuming a thread that was externally - // suspended. If/when we do, we will need to make the code below work and - // m_suspendCount will need to become signed instead of unsigned. -// else if (m_suspendCount < 0) -// { -// while (m_suspendCount < 0) -// { -// err = ::thread_suspend (m_tid); -// if (err.Success()) -// ++m_suspendCount; -// if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) -// err.LogThreaded("::thread_suspend (%4.4x)", m_tid); -// } -// } + else if (m_suspend_count < 0) + { + DNBLogThreadedIf(LOG_THREAD, "MachThread::%s ( ) (tid = %4.4x) negative suspend count = %d", __FUNCTION__, + m_tid, m_suspend_count); + while (m_suspend_count < 0) + { + err = ::thread_suspend (m_tid); + if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) + err.LogThreaded("RestoreSuspendCount ::thread_suspend (%4.4x)", m_tid); + + if (err.Success()) + ++m_suspend_count; + else + { + if (GetBasicInfo(true)) + m_suspend_count = m_basic_info.suspend_count; + else + m_suspend_count = 0; + return false; // ??? + } + + } + } return true; } @@ -193,10 +237,9 @@ bool MachThread::IsUserReady() { - if (m_basicInfo.run_state == 0) - GetBasicInfo (); + GetBasicInfo (false); - switch (m_basicInfo.run_state) + switch (m_basic_info.run_state) { default: case TH_STATE_UNINTERRUPTIBLE: @@ -212,10 +255,16 @@ } struct thread_basic_info * -MachThread::GetBasicInfo () +MachThread::GetBasicInfo (bool force) { - if (MachThread::GetBasicInfo(m_tid, &m_basicInfo)) - return &m_basicInfo; + if (!force && m_basic_info_valid) + return &m_basic_info; + + if (MachThread::GetBasicInfo(m_tid, &m_basic_info)) + { + m_basic_info_valid = true; + return &m_basic_info; + } return NULL; } @@ -287,7 +336,7 @@ { const char * thread_run_state = NULL; - switch (m_basicInfo.run_state) + switch (m_basic_info.run_state) { case TH_STATE_RUNNING: thread_run_state = "running"; break; // 1 thread is running normally case TH_STATE_STOPPED: thread_run_state = "stopped"; break; // 2 thread is stopped @@ -304,15 +353,15 @@ GetPC(INVALID_NUB_ADDRESS), GetSP(INVALID_NUB_ADDRESS), m_breakID, - m_basicInfo.user_time.seconds, m_basicInfo.user_time.microseconds, - m_basicInfo.system_time.seconds, m_basicInfo.system_time.microseconds, - m_basicInfo.cpu_usage, - m_basicInfo.policy, - m_basicInfo.run_state, + m_basic_info.user_time.seconds, m_basic_info.user_time.microseconds, + m_basic_info.system_time.seconds, m_basic_info.system_time.microseconds, + m_basic_info.cpu_usage, + m_basic_info.policy, + m_basic_info.run_state, thread_run_state, - m_basicInfo.flags, - m_basicInfo.suspend_count, m_suspendCount, - m_basicInfo.sleep_time); + m_basic_info.flags, + m_basic_info.suspend_count, m_suspend_count, + m_basic_info.sleep_time); //DumpRegisterState(0); } @@ -321,7 +370,11 @@ { if (thread_action->addr != INVALID_NUB_ADDRESS) SetPC (thread_action->addr); - + // DidStop restores the state to it's natural state, and sets + // m_suspend_count to 0 in the process, and then here is the only + // place that we should be suspending or resuming (and thus changing + // that state. + assert (m_suspend_count == 0); SetState (thread_action->state); switch (thread_action->state) { @@ -331,9 +384,11 @@ break; case eStateRunning: - case eStateStepping: Resume(); break; + case eStateStepping: + ForceResume(); + break; } m_arch_ap->ThreadWillResume(); m_stop_exception.Clear(); @@ -438,7 +493,7 @@ RestoreSuspendCount(); // Update the basic information for a thread - MachThread::GetBasicInfo(m_tid, &m_basicInfo); + GetBasicInfo (true); #if ENABLE_AUTO_STEPPING_OVER_BP // See if we were at a breakpoint when we last resumed that we disabled, @@ -448,7 +503,7 @@ if (NUB_BREAK_ID_IS_VALID(breakID)) { m_process->EnableBreakpoint(breakID); - if (m_basicInfo.suspend_count > 0) + if (m_basic_info.suspend_count > 0) { SetState(eStateSuspended); } @@ -471,7 +526,7 @@ } else { - if (m_basicInfo.suspend_count > 0) + if (m_basic_info.suspend_count > 0) { SetState(eStateSuspended); } @@ -481,7 +536,7 @@ } } #else - if (m_basicInfo.suspend_count > 0) + if (m_basic_info.suspend_count > 0) SetState(eStateSuspended); else SetState(eStateStopped); Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h?rev=124178&r1=124177&r2=124178&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h Mon Jan 24 23:26:48 2011 @@ -49,11 +49,6 @@ uint32_t SequenceID() const { return m_seq_id; } static bool ThreadIDIsValid(thread_t thread); - uint32_t Resume(); - uint32_t Suspend(); - uint32_t SuspendCount() const { return m_suspendCount; } - bool RestoreSuspendCount(); - bool GetRegisterState(int flavor, bool force); bool SetRegisterState(int flavor); uint64_t GetPC(uint64_t failValue = INVALID_NUB_ADDRESS); // Get program counter @@ -92,8 +87,6 @@ } bool IsUserReady(); - struct thread_basic_info * - GetBasicInfo (); const char * GetBasicInfoAsString () const; const char * GetName (); @@ -104,6 +97,13 @@ } protected: + int32_t Resume(); + int32_t ForceResume(); + int32_t Suspend(); +// uint32_t SuspendCount() const { return m_suspendCount; } + bool RestoreSuspendCount(); + struct thread_basic_info * + GetBasicInfo (bool force); static bool GetBasicInfo(thread_t threadID, struct thread_basic_info *basic_info); bool @@ -118,8 +118,9 @@ nub_state_t m_state; // The state of our process PThreadMutex m_state_mutex; // Multithreaded protection for m_state nub_break_t m_breakID; // Breakpoint that this thread is (stopped)/was(running) at (NULL for none) - struct thread_basic_info m_basicInfo; // Basic information for a thread used to see if a thread is valid - uint32_t m_suspendCount; // The current suspend count + struct thread_basic_info m_basic_info; // Basic information for a thread used to see if a thread is valid + bool m_basic_info_valid; + uint32_t m_suspend_count; // The current suspend count MachException::Data m_stop_exception; // The best exception that describes why this thread is stopped std::auto_ptr m_arch_ap; // Arch specific information for register state and more const DNBRegisterSetInfo *const m_reg_sets; // Register set information for this thread @@ -128,6 +129,7 @@ thread_identifier_info_data_t m_ident_info; struct proc_threadinfo m_proc_threadinfo; std::string m_dispatch_queue_name; + #endif }; From gclayton at apple.com Tue Jan 25 00:17:32 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 06:17:32 -0000 Subject: [Lldb-commits] [lldb] r124179 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20110125061732.540FC2A6C130@llvm.org> Author: gclayton Date: Tue Jan 25 00:17:32 2011 New Revision: 124179 URL: http://llvm.org/viewvc/llvm-project?rev=124179&view=rev Log: Fixed an issue that was stopping LLDB from finding complete definitions for types. What was happening was the DWARF parser was almost ignoring definitions (DIEs with the DW_AT_declaration set to 1). It wasn't ignoring declarations that had _some_ children. When this happened, we would treat the declaration as a complete type. Often we would have a declaration of a type with just some enum definitions inside and nothing else. Now we correctly ignore these definitions, and also I added some changes to allow us to figure out what decl context these special declarations actually point to. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=124179&r1=124178&r2=124179&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jan 25 00:17:32 2011 @@ -2788,6 +2788,8 @@ //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x )\n", die->GetOffset()); const DWARFDebugInfoEntry * const decl_die = die; + clang::DeclContext *decl_ctx = NULL; + while (die != NULL) { // If this is the original DIE that we are searching for a declaration @@ -2827,14 +2829,22 @@ case DW_TAG_union_type: case DW_TAG_class_type: { - ResolveType (curr_cu, die); + Type* type = ResolveType (curr_cu, die); pos = m_die_to_decl_ctx.find(die); - assert (pos != m_die_to_decl_ctx.end()); if (pos != m_die_to_decl_ctx.end()) { //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset()); return pos->second; } + else + { + if (type) + { + decl_ctx = ClangASTContext::GetDeclContextForType (type->GetClangForwardType ()); + if (decl_ctx) + return decl_ctx; + } + } } break; @@ -2843,7 +2853,6 @@ } } - clang::DeclContext *decl_ctx; dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET); if (die_offset != DW_INVALID_OFFSET) { @@ -3180,7 +3189,7 @@ } - if (is_forward_declaration && die->HasChildren() == false) + if (is_forward_declaration) { // We have a forward declaration to a type and we need // to try and find a full declaration. We look in the @@ -3190,14 +3199,14 @@ type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); - if (!type_sp) + if (!type_sp && m_debug_map_symfile) { // We weren't able to find a full declaration in // this DWARF, see if we have a declaration anywhere // else... - if (m_debug_map_symfile) - type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); + type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str); } + if (type_sp) { // We found a real definition for this type elsewhere @@ -3310,6 +3319,8 @@ clang_type = m_forward_decl_die_to_clang_type.lookup (die); if (clang_type == NULL) { + if (die->GetOffset() == 0x1c436) + printf("REMOVE THIS!!!\n"); enumerator_clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (NULL, DW_ATE_signed, byte_size * 8); From gclayton at apple.com Tue Jan 25 00:55:14 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 06:55:14 -0000 Subject: [Lldb-commits] [lldb] r124180 - in /lldb/trunk: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp tools/debugserver/source/MacOSX/MachThread.cpp tools/debugserver/source/MacOSX/MachThread.h Message-ID: <20110125065514.1BD452A6C12E@llvm.org> Author: gclayton Date: Tue Jan 25 00:55:13 2011 New Revision: 124180 URL: http://llvm.org/viewvc/llvm-project?rev=124180&view=rev Log: Reverting recent thread resume changes as it was causing testing issues. We will need to try again soon, but this change was causing instability. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h 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=124180&r1=124179&r2=124180&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jan 25 00:55:13 2011 @@ -1307,7 +1307,7 @@ { StringExtractorGDBRemote response; bool send_async = true; - if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 3, send_async)) + if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 2, send_async)) { char packet_cmd = response.GetChar(0); @@ -1319,7 +1319,8 @@ } else { - error.SetErrorString("kill packet failed"); + SetExitStatus(SIGABRT, NULL); + //error.SetErrorString("kill packet failed"); } } StopAsyncThread (); @@ -1936,8 +1937,8 @@ ::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags); debugserver_args.AppendArgument(arg_cstr); } - debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); - debugserver_args.AppendArgument("--log-flags=0x800e0e"); +// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); +// debugserver_args.AppendArgument("--log-flags=0x800e0e"); // Now append the program arguments if (launch_process) Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=124180&r1=124179&r2=124180&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Tue Jan 25 00:55:13 2011 @@ -30,15 +30,14 @@ m_state (eStateUnloaded), m_state_mutex (PTHREAD_MUTEX_RECURSIVE), m_breakID (INVALID_NUB_BREAK_ID), - m_suspend_count (0), + m_suspendCount (0), m_arch_ap (DNBArchProtocol::Create (this)), - m_reg_sets (m_arch_ap->GetRegisterSetInfo (&n_num_reg_sets)), - m_basic_info_valid (false) + m_reg_sets (m_arch_ap->GetRegisterSetInfo (&n_num_reg_sets)) { // Get the thread state so we know if a thread is in a state where we can't // muck with it and also so we get the suspend count correct in case it was // already suspended - GetBasicInfo(true); + GetBasicInfo(); DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id); } @@ -49,7 +48,7 @@ -int32_t +uint32_t MachThread::Suspend() { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); @@ -57,47 +56,14 @@ { DNBError err(::thread_suspend (m_tid), DNBError::MachKernel); if (err.Success()) - m_suspend_count++; + m_suspendCount++; if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) err.LogThreaded("::thread_suspend (%4.4x)", m_tid); } - return m_suspend_count; -} - -int32_t -MachThread::ForceResume () -{ - // We need to resume this all the way to 0. - DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); - // Okay, now m_basic_info has the full suspend count. So I'll just - // keep decrementing the suspend count till that is zero, and at the same time - // decrement m_suspend_count. If that goes below zero, then the next time we - // call RestoreSuspendCount, we'll have to suspend it back to 0. - uint32_t num_suspends = m_basic_info.suspend_count + m_suspend_count; - DNBError err; - while (num_suspends > 0) - { - if (m_suspend_count < 0) - DNBLogThreadedIf(LOG_THREAD, "MachThread::%s ( ) (tid = %4.4x) setting suspend count negative = %d", __FUNCTION__, - m_tid, m_suspend_count); - err = ::thread_resume (m_tid); - if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) - err.LogThreaded("ForceResume ::thread_resume (%4.4x)", m_tid); - if (err.Success()) - { - --m_suspend_count; - --num_suspends; - } - else - { - break; - } - } - return m_suspend_count; - + return SuspendCount(); } -int32_t +uint32_t MachThread::Resume() { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); @@ -105,59 +71,49 @@ { RestoreSuspendCount(); } - return m_suspend_count; + return SuspendCount(); } bool MachThread::RestoreSuspendCount() { - DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( ) (tid = %4.4x) our suspend count = %d", __FUNCTION__, - m_tid, m_suspend_count); + DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); DNBError err; if (ThreadIDIsValid(m_tid) == false) return false; - if (m_suspend_count > 0) + if (m_suspendCount > 0) { - while (m_suspend_count > 0) + while (m_suspendCount > 0) { err = ::thread_resume (m_tid); if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) - err.LogThreaded("RestoreSuspendCount ::thread_resume (%4.4x)", m_tid); - if (err.Success()) - --m_suspend_count; - else - { - if (GetBasicInfo(true)) - m_suspend_count = m_basic_info.suspend_count; - else - m_suspend_count = 0; - return false; // ??? - } - } - } - else if (m_suspend_count < 0) - { - DNBLogThreadedIf(LOG_THREAD, "MachThread::%s ( ) (tid = %4.4x) negative suspend count = %d", __FUNCTION__, - m_tid, m_suspend_count); - while (m_suspend_count < 0) - { - err = ::thread_suspend (m_tid); - if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) - err.LogThreaded("RestoreSuspendCount ::thread_suspend (%4.4x)", m_tid); - + err.LogThreaded("::thread_resume (%4.4x)", m_tid); if (err.Success()) - ++m_suspend_count; + --m_suspendCount; else { - if (GetBasicInfo(true)) - m_suspend_count = m_basic_info.suspend_count; + if (GetBasicInfo()) + m_suspendCount = m_basicInfo.suspend_count; else - m_suspend_count = 0; + m_suspendCount = 0; return false; // ??? } - } } + // We don't currently really support resuming a thread that was externally + // suspended. If/when we do, we will need to make the code below work and + // m_suspendCount will need to become signed instead of unsigned. +// else if (m_suspendCount < 0) +// { +// while (m_suspendCount < 0) +// { +// err = ::thread_suspend (m_tid); +// if (err.Success()) +// ++m_suspendCount; +// if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail()) +// err.LogThreaded("::thread_suspend (%4.4x)", m_tid); +// } +// } return true; } @@ -237,9 +193,10 @@ bool MachThread::IsUserReady() { - GetBasicInfo (false); + if (m_basicInfo.run_state == 0) + GetBasicInfo (); - switch (m_basic_info.run_state) + switch (m_basicInfo.run_state) { default: case TH_STATE_UNINTERRUPTIBLE: @@ -255,16 +212,10 @@ } struct thread_basic_info * -MachThread::GetBasicInfo (bool force) +MachThread::GetBasicInfo () { - if (!force && m_basic_info_valid) - return &m_basic_info; - - if (MachThread::GetBasicInfo(m_tid, &m_basic_info)) - { - m_basic_info_valid = true; - return &m_basic_info; - } + if (MachThread::GetBasicInfo(m_tid, &m_basicInfo)) + return &m_basicInfo; return NULL; } @@ -336,7 +287,7 @@ { const char * thread_run_state = NULL; - switch (m_basic_info.run_state) + switch (m_basicInfo.run_state) { case TH_STATE_RUNNING: thread_run_state = "running"; break; // 1 thread is running normally case TH_STATE_STOPPED: thread_run_state = "stopped"; break; // 2 thread is stopped @@ -353,15 +304,15 @@ GetPC(INVALID_NUB_ADDRESS), GetSP(INVALID_NUB_ADDRESS), m_breakID, - m_basic_info.user_time.seconds, m_basic_info.user_time.microseconds, - m_basic_info.system_time.seconds, m_basic_info.system_time.microseconds, - m_basic_info.cpu_usage, - m_basic_info.policy, - m_basic_info.run_state, + m_basicInfo.user_time.seconds, m_basicInfo.user_time.microseconds, + m_basicInfo.system_time.seconds, m_basicInfo.system_time.microseconds, + m_basicInfo.cpu_usage, + m_basicInfo.policy, + m_basicInfo.run_state, thread_run_state, - m_basic_info.flags, - m_basic_info.suspend_count, m_suspend_count, - m_basic_info.sleep_time); + m_basicInfo.flags, + m_basicInfo.suspend_count, m_suspendCount, + m_basicInfo.sleep_time); //DumpRegisterState(0); } @@ -370,11 +321,7 @@ { if (thread_action->addr != INVALID_NUB_ADDRESS) SetPC (thread_action->addr); - // DidStop restores the state to it's natural state, and sets - // m_suspend_count to 0 in the process, and then here is the only - // place that we should be suspending or resuming (and thus changing - // that state. - assert (m_suspend_count == 0); + SetState (thread_action->state); switch (thread_action->state) { @@ -384,10 +331,8 @@ break; case eStateRunning: - Resume(); - break; case eStateStepping: - ForceResume(); + Resume(); break; } m_arch_ap->ThreadWillResume(); @@ -493,7 +438,7 @@ RestoreSuspendCount(); // Update the basic information for a thread - GetBasicInfo (true); + MachThread::GetBasicInfo(m_tid, &m_basicInfo); #if ENABLE_AUTO_STEPPING_OVER_BP // See if we were at a breakpoint when we last resumed that we disabled, @@ -503,7 +448,7 @@ if (NUB_BREAK_ID_IS_VALID(breakID)) { m_process->EnableBreakpoint(breakID); - if (m_basic_info.suspend_count > 0) + if (m_basicInfo.suspend_count > 0) { SetState(eStateSuspended); } @@ -526,7 +471,7 @@ } else { - if (m_basic_info.suspend_count > 0) + if (m_basicInfo.suspend_count > 0) { SetState(eStateSuspended); } @@ -536,7 +481,7 @@ } } #else - if (m_basic_info.suspend_count > 0) + if (m_basicInfo.suspend_count > 0) SetState(eStateSuspended); else SetState(eStateStopped); Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h?rev=124180&r1=124179&r2=124180&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h Tue Jan 25 00:55:13 2011 @@ -49,6 +49,11 @@ uint32_t SequenceID() const { return m_seq_id; } static bool ThreadIDIsValid(thread_t thread); + uint32_t Resume(); + uint32_t Suspend(); + uint32_t SuspendCount() const { return m_suspendCount; } + bool RestoreSuspendCount(); + bool GetRegisterState(int flavor, bool force); bool SetRegisterState(int flavor); uint64_t GetPC(uint64_t failValue = INVALID_NUB_ADDRESS); // Get program counter @@ -87,6 +92,8 @@ } bool IsUserReady(); + struct thread_basic_info * + GetBasicInfo (); const char * GetBasicInfoAsString () const; const char * GetName (); @@ -97,13 +104,6 @@ } protected: - int32_t Resume(); - int32_t ForceResume(); - int32_t Suspend(); -// uint32_t SuspendCount() const { return m_suspendCount; } - bool RestoreSuspendCount(); - struct thread_basic_info * - GetBasicInfo (bool force); static bool GetBasicInfo(thread_t threadID, struct thread_basic_info *basic_info); bool @@ -118,9 +118,8 @@ nub_state_t m_state; // The state of our process PThreadMutex m_state_mutex; // Multithreaded protection for m_state nub_break_t m_breakID; // Breakpoint that this thread is (stopped)/was(running) at (NULL for none) - struct thread_basic_info m_basic_info; // Basic information for a thread used to see if a thread is valid - bool m_basic_info_valid; - uint32_t m_suspend_count; // The current suspend count + struct thread_basic_info m_basicInfo; // Basic information for a thread used to see if a thread is valid + uint32_t m_suspendCount; // The current suspend count MachException::Data m_stop_exception; // The best exception that describes why this thread is stopped std::auto_ptr m_arch_ap; // Arch specific information for register state and more const DNBRegisterSetInfo *const m_reg_sets; // Register set information for this thread @@ -129,7 +128,6 @@ thread_identifier_info_data_t m_ident_info; struct proc_threadinfo m_proc_threadinfo; std::string m_dispatch_queue_name; - #endif }; From gclayton at apple.com Tue Jan 25 01:01:26 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 07:01:26 -0000 Subject: [Lldb-commits] [lldb] r124181 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110125070126.6A93B2A6C12E@llvm.org> Author: gclayton Date: Tue Jan 25 01:01:26 2011 New Revision: 124181 URL: http://llvm.org/viewvc/llvm-project?rev=124181&view=rev Log: Bumped Xcode project versions to lldb-44 and debugserver-129. 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=124181&r1=124180&r2=124181&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan 25 01:01:26 2011 @@ -2388,6 +2388,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, @@ -2953,9 +2954,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 43; + DYLIB_CURRENT_VERSION = 44; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3010,11 +3011,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 43; + DYLIB_CURRENT_VERSION = 44; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3089,7 +3090,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3124,11 +3125,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 43; + DYLIB_CURRENT_VERSION = 44; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3182,7 +3183,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3220,7 +3221,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 43; + CURRENT_PROJECT_VERSION = 44; 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=124181&r1=124180&r2=124181&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Tue Jan 25 01:01:26 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 43 + 44 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=124181&r1=124180&r2=124181&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Jan 25 01:01:26 2011 @@ -459,7 +459,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -477,7 +477,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -497,7 +497,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -514,7 +514,7 @@ buildSettings = { "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -555,7 +555,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -596,7 +596,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From wilsons at start.ca Tue Jan 25 09:42:12 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 25 Jan 2011 10:42:12 -0500 Subject: [Lldb-commits] Simple makefile fixups. Message-ID: With the current target revision of Clang libclangChecker no longer exists and is not needed. Update the include path so we can get at ARM_DWARF_Registers.h and friends. --- Makefile | 1 + lib/Makefile | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index abe694b..528c36c 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/../clang/include CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include CPP.Flags += -I/usr/include/python2.6 CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source +CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Utility CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Utility ifeq ($(HOST_OS),Darwin) CPP.Flags += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks diff --git a/lib/Makefile b/lib/Makefile index abd9c1d..fffcab6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -49,8 +49,7 @@ USEDLIBS = lldbAPI.a \ clangParse.a \ clangSema.a \ clangSerialization.a \ - EnhancedDisassembly.a \ - clangChecker.a + EnhancedDisassembly.a include $(LLDB_LEVEL)/../../Makefile.config -- 1.7.3.5 From johnny.chen at apple.com Tue Jan 25 10:56:01 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 16:56:01 -0000 Subject: [Lldb-commits] [lldb] r124195 - /lldb/trunk/tools/debugserver/source/debugserver.cpp Message-ID: <20110125165601.80A702A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 10:56:01 2011 New Revision: 124195 URL: http://llvm.org/viewvc/llvm-project?rev=124195&view=rev Log: Trivial comment fix. Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=124195&r1=124194&r2=124195&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/debugserver.cpp (original) +++ lldb/trunk/tools/debugserver/source/debugserver.cpp Tue Jan 25 10:56:01 2011 @@ -653,8 +653,8 @@ { "native-regs", no_argument, NULL, 'r' }, // Specify to use the native registers instead of the gdb defaults for the architecture. { "stdio-path", required_argument, NULL, 's' }, // Set the STDIO path to be used when launching applications (STDIN, STDOUT and STDERR) (only if debugserver launches the process) { "stdin-path", required_argument, NULL, 'I' }, // Set the STDIN path to be used when launching applications (only if debugserver launches the process) - { "stdout-path", required_argument, NULL, 'O' }, // Set the STDIN path to be used when launching applications (only if debugserver launches the process) - { "stderr-path", required_argument, NULL, 'E' }, // Set the STDIN path to be used when launching applications (only if debugserver launches the process) + { "stdout-path", required_argument, NULL, 'O' }, // Set the STDOUT path to be used when launching applications (only if debugserver launches the process) + { "stderr-path", required_argument, NULL, 'E' }, // Set the STDERR path to be used when launching applications (only if debugserver launches the process) { "no-stdio", no_argument, NULL, 'n' }, // Do not set up any stdio (perhaps the program is a GUI program) (only if debugserver launches the process) { "setsid", no_argument, NULL, 'S' }, // call setsid() to make debugserver run in its own session { "disable-aslr", no_argument, NULL, 'D' }, // Use _POSIX_SPAWN_DISABLE_ASLR to avoid shared library randomization From johnny.chen at apple.com Tue Jan 25 11:02:45 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 09:02:45 -0800 Subject: [Lldb-commits] Simple makefile fixups. In-Reply-To: References: Message-ID: <018A87FA-F5E5-495D-A8B5-7DA050B616AF@apple.com> Hi Stephen, Looks good! Feel free to check in your patch. Thanks. On Jan 25, 2011, at 7:42 AM, Stephen Wilson wrote: > > With the current target revision of Clang libclangChecker no longer exists and > is not needed. Update the include path so we can get at ARM_DWARF_Registers.h > and friends. > > --- > Makefile | 1 + > lib/Makefile | 3 +-- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index abe694b..528c36c 100644 > --- a/Makefile > +++ b/Makefile > @@ -35,6 +35,7 @@ CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/../clang/include > CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include > CPP.Flags += -I/usr/include/python2.6 > CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source > +CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Utility > CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Utility > ifeq ($(HOST_OS),Darwin) > CPP.Flags += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks > diff --git a/lib/Makefile b/lib/Makefile > index abd9c1d..fffcab6 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -49,8 +49,7 @@ USEDLIBS = lldbAPI.a \ > clangParse.a \ > clangSema.a \ > clangSerialization.a \ > - EnhancedDisassembly.a \ > - clangChecker.a > + EnhancedDisassembly.a > > include $(LLDB_LEVEL)/../../Makefile.config > > -- > 1.7.3.5 > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From johnny.chen at apple.com Tue Jan 25 11:17:45 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 17:17:45 -0000 Subject: [Lldb-commits] [lldb] r124196 - /lldb/trunk/test/threads/TestPrintStackTraces.py Message-ID: <20110125171745.EBDE02A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 11:17:45 2011 New Revision: 124196 URL: http://llvm.org/viewvc/llvm-project?rev=124196&view=rev Log: Fix wrong order of "import lldbutil" statement and its usage in the failure case. Modified: lldb/trunk/test/threads/TestPrintStackTraces.py Modified: lldb/trunk/test/threads/TestPrintStackTraces.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/threads/TestPrintStackTraces.py?rev=124196&r1=124195&r2=124196&view=diff ============================================================================== --- lldb/trunk/test/threads/TestPrintStackTraces.py (original) +++ lldb/trunk/test/threads/TestPrintStackTraces.py Tue Jan 25 11:17:45 2011 @@ -40,12 +40,12 @@ if not rc.Success() or not self.process.IsValid(): self.fail("SBTarget.LaunchProcess() failed") + import lldbutil if self.process.GetState() != lldb.eStateStopped: self.fail("Process should be in the 'stopped' state, " "instead the actual state is: '%s'" % lldbutil.StateTypeString(self.process.GetState())) - import lldbutil lldbutil.PrintStackTraces(self.process) From johnny.chen at apple.com Tue Jan 25 11:39:43 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 17:39:43 -0000 Subject: [Lldb-commits] [lldb] r124198 - in /lldb/trunk/test/settings: TestSettings.py main.cpp Message-ID: <20110125173943.81E9A2A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 11:39:43 2011 New Revision: 124198 URL: http://llvm.org/viewvc/llvm-project?rev=124198&view=rev Log: Remove the expectedFailure decorator for the fixed bug: rdar://problem/8435794 settings set target.process.output-path does not seem to work Also change the test case from test_set_output_path to test_set_error_output_path as it now exercises both setting target.process.error-path and target.process.output-path. Modified: lldb/trunk/test/settings/TestSettings.py lldb/trunk/test/settings/main.cpp Modified: lldb/trunk/test/settings/TestSettings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=124198&r1=124197&r2=124198&view=diff ============================================================================== --- lldb/trunk/test/settings/TestSettings.py (original) +++ lldb/trunk/test/settings/TestSettings.py Tue Jan 25 11:39:43 2011 @@ -16,6 +16,7 @@ """Cleanup the test byproducts.""" system(["/bin/sh", "-c", "rm -f output1.txt"]) system(["/bin/sh", "-c", "rm -f output2.txt"]) + system(["/bin/sh", "-c", "rm -f stderr.txt"]) system(["/bin/sh", "-c", "rm -f stdout.txt"]) def test_set_prompt(self): @@ -140,22 +141,25 @@ substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.", "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."]) - @unittest2.expectedFailure - # rdar://problem/8435794 - # settings set target.process.output-path does not seem to work - def test_set_output_path(self): - """Test that setting target.process.output-path for the launched process works.""" + def test_set_error_output_path(self): + """Test that setting target.process.error/output-path for the launched process works.""" self.buildDefault() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - # Set the output-path and verify it is set. - self.runCmd("settings set target.process.output-path 'stdout.txt'") - # And add a hook to restore original setting of target.process.output-path - # later on during tearDown(). + # Set the error-path and output-path and verify both are set. + self.runCmd("settings set target.process.error-path stderr.txt") + self.runCmd("settings set target.process.output-path stdout.txt") + # And add hooks to restore the original settings during tearDown(). self.addTearDownHook( lambda: self.runCmd("settings set -r target.process.output-path")) + self.addTearDownHook( + lambda: self.runCmd("settings set -r target.process.error-path")) + + self.expect("settings show target.process.error-path", + SETTING_MSG("target.process.error-path"), + startstr = "target.process.error-path (string) = 'stderr.txt'") self.expect("settings show target.process.output-path", SETTING_MSG("target.process.output-path"), @@ -163,6 +167,17 @@ self.runCmd("run", RUN_SUCCEEDED) + # The 'stderr.txt' file should now exist. + self.assertTrue(os.path.isfile("stderr.txt"), + "'stderr.txt' exists due to target.process.error-path.") + + # Read the output file produced by running the program. + with open('stderr.txt', 'r') as f: + output = f.read() + + self.expect(output, exe=False, + startstr = "This message should go to standard error.") + # The 'stdout.txt' file should now exist. self.assertTrue(os.path.isfile("stdout.txt"), "'stdout.txt' exists due to target.process.output-path.") Modified: lldb/trunk/test/settings/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/main.cpp?rev=124198&r1=124197&r2=124198&view=diff ============================================================================== --- lldb/trunk/test/settings/main.cpp (original) +++ lldb/trunk/test/settings/main.cpp Tue Jan 25 11:39:43 2011 @@ -62,6 +62,7 @@ } } + std::cerr << "This message should go to standard error.\n"; std::cout << "This message should go to standard out.\n"; outfile.close(); From johnny.chen at apple.com Tue Jan 25 13:07:04 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 19:07:04 -0000 Subject: [Lldb-commits] [lldb] r124208 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110125190704.B45312A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 13:07:04 2011 New Revision: 124208 URL: http://llvm.org/viewvc/llvm-project?rev=124208&view=rev Log: Variable renaming for better readability. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124208&r1=124207&r2=124208&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 13:07:04 2011 @@ -108,7 +108,7 @@ if (!success) return false; uint32_t registers = 0; - uint32_t t; // t = UInt(Rt) + uint32_t Rt; // the source register switch (encoding) { case eEncodingT1: registers = EmulateInstruction::UnsignedBits (opcode, 7, 0); @@ -127,11 +127,11 @@ return false; break; case eEncodingT3: - t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); // if BadReg(t) then UNPREDICTABLE; - if (BadReg(t)) + if (BadReg(Rt)) return false; - registers = (1u << t); + registers = (1u << Rt); break; case eEncodingA1: registers = EmulateInstruction::UnsignedBits (opcode, 15, 0); @@ -140,11 +140,11 @@ // if BitCount(register_list) < 2 then SEE STMDB / STMFD; break; case eEncodingA2: - t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); // if t == 13 then UNPREDICTABLE; - if (t == dwarf_sp) + if (Rt == dwarf_sp) return false; - registers = (1u << t); + registers = (1u << Rt); break; default: return false; @@ -218,11 +218,11 @@ const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); if (!success) return false; - uint32_t t; // t = UInt(Rt) + uint32_t Rt; // the source register uint32_t imm12; switch (encoding) { case eEncodingA1: - t = EmulateInstruction::UnsignedBits (opcode, 15, 12); + Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); imm12 = EmulateInstruction::UnsignedBits (opcode, 11, 0); break; default: @@ -232,10 +232,10 @@ addr_t addr = sp - sp_offset; EmulateInstruction::Context context = { EmulateInstruction::eContextPushRegisterOnStack, eRegisterKindDWARF, 0, 0 }; - if (t != 15) + if (Rt != 15) { - context.arg1 = dwarf_r0 + t; // arg1 in the context is the DWARF register number - context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset + context.arg1 = dwarf_r0 + Rt; // arg1 in the context is the DWARF register number + context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset uint32_t reg_value = emulator->ReadRegisterUnsigned(eRegisterKindDWARF, context.arg1, 0, &success); if (!success) return false; From bugzilla-daemon at llvm.org Tue Jan 25 14:49:42 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 14:49:42 -0600 (CST) Subject: [Lldb-commits] [Bug 9053] New: null pointer dereferenced when "file" is given a bogus path Message-ID: http://llvm.org/bugs/show_bug.cgi?id=9053 Summary: null pointer dereferenced when "file" is given a bogus path Product: lldb Version: unspecified Platform: Macintosh OS/Version: MacOS X Status: NEW Severity: normal Priority: P Component: All Bugs AssignedTo: lldb-commits at cs.uiuc.edu ReportedBy: ken.ryall at nokia.com Created an attachment (id=6050) --> (http://llvm.org/bugs/attachment.cgi?id=6050) Checks to see if the string is empty before using it I accidentally used lldb's "file" command with a bogus path. Instead of: file /Users/kenryall/Source/HW_XCode/build/Debug/HW_XCode I gave it: file file://localhost/Users/kenryall/Source/HW_XCode/build/Debug/HW_XCode This caused a null pointer to be used in FileSpec::ResolveExecutableLocation. The attached patch fixes this problem. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From gclayton at apple.com Tue Jan 25 15:32:01 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 21:32:01 -0000 Subject: [Lldb-commits] [lldb] r124231 - /lldb/trunk/source/Core/FileSpec.cpp Message-ID: <20110125213201.AEF462A6C12C@llvm.org> Author: gclayton Date: Tue Jan 25 15:32:01 2011 New Revision: 124231 URL: http://llvm.org/viewvc/llvm-project?rev=124231&view=rev Log: http://llvm.org/bugs/show_bug.cgi?id=9053 Fixed bug reported by Ken Ryall. Modified: lldb/trunk/source/Core/FileSpec.cpp Modified: lldb/trunk/source/Core/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=124231&r1=124230&r2=124231&view=diff ============================================================================== --- lldb/trunk/source/Core/FileSpec.cpp (original) +++ lldb/trunk/source/Core/FileSpec.cpp Tue Jan 25 15:32:01 2011 @@ -497,29 +497,33 @@ { if (!m_directory) { - const std::string file_str (m_filename.AsCString()); - llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str); - const std::string &path_str = path.str(); - llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str); - //llvm::StringRef dir_ref = path.getDirname(); - if (! dir_ref.empty()) + const char *file_cstr = m_filename.GetCString(); + if (file_cstr) { - // FindProgramByName returns "." if it can't find the file. - if (strcmp (".", dir_ref.data()) == 0) - return false; - - m_directory.SetCString (dir_ref.data()); - if (Exists()) - return true; - else + const std::string file_str (file_cstr); + llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str); + const std::string &path_str = path.str(); + llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str); + //llvm::StringRef dir_ref = path.getDirname(); + if (! dir_ref.empty()) { - // If FindProgramByName found the file, it returns the directory + filename in its return results. - // We need to separate them. - FileSpec tmp_file (dir_ref.data(), false); - if (tmp_file.Exists()) - { - m_directory = tmp_file.m_directory; + // FindProgramByName returns "." if it can't find the file. + if (strcmp (".", dir_ref.data()) == 0) + return false; + + m_directory.SetCString (dir_ref.data()); + if (Exists()) return true; + else + { + // If FindProgramByName found the file, it returns the directory + filename in its return results. + // We need to separate them. + FileSpec tmp_file (dir_ref.data(), false); + if (tmp_file.Exists()) + { + m_directory = tmp_file.m_directory; + return true; + } } } } From bugzilla-daemon at llvm.org Tue Jan 25 15:32:17 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 15:32:17 -0600 (CST) Subject: [Lldb-commits] [Bug 9053] null pointer dereferenced when "file" is given a bogus path In-Reply-To: References: Message-ID: <20110125213217.7087D2A6C12D@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=9053 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |FIXED --- Comment #1 from Greg Clayton 2011-01-25 15:32:17 CST --- I fixed this in a slightly different way. ConstString has two C string accessors: const char * ConstString::AsCString(const char *value_if_empty); const char * ConstString::GetCString(); // Can return NULL I used the latter with the fix I submitted. Committed revision 124231. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From bugzilla-daemon at llvm.org Tue Jan 25 15:37:35 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 15:37:35 -0600 (CST) Subject: [Lldb-commits] [Bug 8188] DW_CFA_same_value unsupported In-Reply-To: References: Message-ID: <20110125213735.AB96F2A6C12D@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8188 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |WONTFIX --- Comment #1 from Greg Clayton 2011-01-25 15:37:34 CST --- Marking as resolved, won't fix since we have removed libunwind from lldb after we switched to our new stack unwinder. I will pass the information along to the person that originally wrote libunwind though, thanks for finding this. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From gclayton at apple.com Tue Jan 25 15:39:46 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 21:39:46 -0000 Subject: [Lldb-commits] [lldb] r124232 - /lldb/trunk/source/Core/Value.cpp Message-ID: <20110125213946.E92072A6C12C@llvm.org> Author: gclayton Date: Tue Jan 25 15:39:46 2011 New Revision: 124232 URL: http://llvm.org/viewvc/llvm-project?rev=124232&view=rev Log: http://llvm.org/bugs/show_bug.cgi?id=8260 Removed incorrect enumeration from switch. Modified: lldb/trunk/source/Core/Value.cpp Modified: lldb/trunk/source/Core/Value.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=124232&r1=124231&r2=124232&view=diff ============================================================================== --- lldb/trunk/source/Core/Value.cpp (original) +++ lldb/trunk/source/Core/Value.cpp Tue Jan 25 15:39:46 2011 @@ -677,10 +677,6 @@ case eValueTypeScalar: // raw scalar value break; - case eContextTypeValue: - m_value.Clear(); // TODO: Sean, fill this in - break; - default: case eValueTypeFileAddress: m_value.Clear(); From bugzilla-daemon at llvm.org Tue Jan 25 15:39:59 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 15:39:59 -0600 (CST) Subject: [Lldb-commits] [Bug 8260] Invalid case in switch statement In-Reply-To: References: Message-ID: <20110125213959.03B032A6C124@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8260 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |FIXED --- Comment #2 from Greg Clayton 2011-01-25 15:39:58 CST --- Committed revision 124232. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Tue Jan 25 16:45:28 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 22:45:28 -0000 Subject: [Lldb-commits] [lldb] r124237 - in /lldb/trunk/source/Plugins/Process/Utility: ARMUtils.h EmulateInstructionARM.cpp Message-ID: <20110125224528.47AF22A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 16:45:28 2011 New Revision: 124237 URL: http://llvm.org/viewvc/llvm-project?rev=124237&view=rev Log: Add an entry to the g_arm_opcodes table named emulate_sub_sp_imm which corresponds to an operation to adjust the stack pointer (allocate space for local storage). Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124237&r1=124236&r2=124237&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Tue Jan 25 16:45:28 2011 @@ -50,6 +50,30 @@ #define MASK_CPSR_N (1u << 31) +static inline uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit) +{ + assert(msbit < 32 && lsbit <= msbit); + return (val >> lsbit) & ((1u << (msbit - lsbit + 1)) - 1); +} + +static inline uint32_t bit(const uint32_t val, const uint32_t msbit) +{ + return bits(val, msbit, msbit); +} + +static inline uint32_t ARMExpandImm(uint32_t imm12) +{ + uint32_t imm = bits(imm12, 7, 0); // immediate value + uint32_t rot = 2 * bits(imm12, 11, 8); // rotate amount + return (imm >> rot) | (imm << (32 - rot)); +} + +// Convenience function for ARMExpandImm(imm12). +static inline uint32_t ARMExpand(uint32_t val) +{ + return ARMExpandImm(bits(val, 11, 0)); +} + // This function performs the check for the register numbers 13 and 15 that are // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124237&r1=124236&r2=124237&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 16:45:28 2011 @@ -191,7 +191,61 @@ return true; } -// A store operation to the SP that also updates the SP. +// A sub operation to adjust the SP -- allocate space for local storage. +static bool +emulate_sub_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + (result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ???1???); + if d == 15 then // Can only occur for ARM encoding + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + APSR.C = carry; + APSR.V = overflow; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t imm32; + switch (encoding) { + case eEncodingA1: + imm32 = ARMExpand(opcode); // imm32 = ARMExpandImm(imm12) + break; + default: + return false; + } + addr_t sp_offset = imm32; + addr_t addr = sp - sp_offset; // the adjusted stack pointer value + + EmulateInstruction::Context context = { EmulateInstruction::eContextAdjustStackPointer, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_SP, + sp_offset }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, addr)) + return false; + } + return true; +} + +// A store operation to the stacks that also updates the SP. static bool emulate_str_rt_sp (EmulateInstructionARM *emulator, ARMEncoding encoding) { @@ -267,23 +321,27 @@ static ARMOpcode g_arm_opcodes[] = { { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, - "push ; contains more than one register" }, + "push ; contains more than one register" }, { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, - "push ; contains one register, " }, + "push ; contains one register, " }, + + // adjust the stack pointer + { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, + "sub sp, sp, #n"}, // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, - "str Rt, [sp, #-n]!" } + "str Rt, [sp, #-n]!" } }; static ARMOpcode g_thumb_opcodes[] = { { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, - "push " }, + "push " }, { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, - "push.w ; contains more than one register" }, + "push.w ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, - "push.w ; contains one register, " } + "push.w ; contains one register, " } }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); From wilsons at start.ca Tue Jan 25 17:03:42 2011 From: wilsons at start.ca (Stephen Wilson) Date: Tue, 25 Jan 2011 23:03:42 -0000 Subject: [Lldb-commits] [lldb] r124240 - in /lldb/trunk: Makefile lib/Makefile Message-ID: <20110125230342.9DAA12A6C12C@llvm.org> Author: wilsons Date: Tue Jan 25 17:03:42 2011 New Revision: 124240 URL: http://llvm.org/viewvc/llvm-project?rev=124240&view=rev Log: Simple makefile fixups. With the current target revision of Clang libclangChecker no longer exists and is not needed. Update the include path so we can get at ARM_DWARF_Registers.h and friends. Modified: lldb/trunk/Makefile lldb/trunk/lib/Makefile Modified: lldb/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=124240&r1=124239&r2=124240&view=diff ============================================================================== --- lldb/trunk/Makefile (original) +++ lldb/trunk/Makefile Tue Jan 25 17:03:42 2011 @@ -35,6 +35,7 @@ CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include CPP.Flags += -I/usr/include/python2.6 CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source +CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Utility CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Utility ifeq ($(HOST_OS),Darwin) CPP.Flags += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks Modified: lldb/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=124240&r1=124239&r2=124240&view=diff ============================================================================== --- lldb/trunk/lib/Makefile (original) +++ lldb/trunk/lib/Makefile Tue Jan 25 17:03:42 2011 @@ -49,8 +49,7 @@ clangParse.a \ clangSema.a \ clangSerialization.a \ - EnhancedDisassembly.a \ - clangChecker.a + EnhancedDisassembly.a include $(LLDB_LEVEL)/../../Makefile.config From johnny.chen at apple.com Tue Jan 25 17:49:39 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 25 Jan 2011 23:49:39 -0000 Subject: [Lldb-commits] [lldb] r124248 - in /lldb/trunk/source/Plugins/Process/Utility: ARMUtils.h EmulateInstructionARM.cpp Message-ID: <20110125234939.DD9782A6C12D@llvm.org> Author: johnny Date: Tue Jan 25 17:49:39 2011 New Revision: 124248 URL: http://llvm.org/viewvc/llvm-project?rev=124248&view=rev Log: Add Encoding T2 & T3 entries of emulate_sub_sp_imm to the g_thumb_opcodes table. Update emulate_sub_sp_imm to handle Encoding T2 & T3. Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124248&r1=124247&r2=124248&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Tue Jan 25 17:49:39 2011 @@ -61,17 +61,63 @@ return bits(val, msbit, msbit); } -static inline uint32_t ARMExpandImm(uint32_t imm12) +static uint32_t ror(uint32_t val, uint32_t N, uint32_t shift) { - uint32_t imm = bits(imm12, 7, 0); // immediate value - uint32_t rot = 2 * bits(imm12, 11, 8); // rotate amount + uint32_t m = shift % N; + return (val >> m) | (val << (N - m)); +} + +static inline uint32_t ARMExpandImm(uint32_t val) +{ + uint32_t imm = bits(val, 7, 0); // immediate value + uint32_t rot = 2 * bits(val, 11, 8); // rotate amount return (imm >> rot) | (imm << (32 - rot)); } -// Convenience function for ARMExpandImm(imm12). -static inline uint32_t ARMExpand(uint32_t val) +static inline uint32_t ThumbExpandImm(uint32_t val) +{ + uint32_t imm32 = 0; + const uint32_t i = bit(val, 26); + const uint32_t imm3 = bits(val, 14, 12); + const uint32_t abcdefgh = bits(val, 7, 0); + const uint32_t imm12 = i << 11 | imm3 << 8 | abcdefgh; + + if (bits(imm12, 10, 11) == 0) + { + switch (bits(imm12, 8, 9)) { + case 0: + imm32 = abcdefgh; + break; + + case 1: + imm32 = abcdefgh << 16 | abcdefgh; + break; + + case 2: + imm32 = abcdefgh << 24 | abcdefgh << 8; + break; + + case 3: + imm32 = abcdefgh << 24 | abcdefgh << 16 | abcdefgh << 8 | abcdefgh; + break; + } + } + else + { + const uint32_t unrotated_value = 0x80 | bits(imm12, 0, 6); + imm32 = ror(unrotated_value, 32, bits(imm12, 7, 11)); + } + return imm32; +} + +// imm32 = ZeroExtend(i:imm3:imm8, 32) +static inline uint32_t ThumbImm12(uint32_t val) { - return ARMExpandImm(bits(val, 11, 0)); + const uint32_t i = bit(val, 26); + const uint32_t imm3 = bits(val, 14, 12); + const uint32_t imm8 = bits(val, 7, 0); + const uint32_t imm12 = i << 11 | imm3 << 8 | imm8; + return imm12; } // This function performs the check for the register numbers 13 and 15 that are Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124248&r1=124247&r2=124248&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 17:49:39 2011 @@ -28,7 +28,7 @@ #define ARMv6K (1u << 6) #define ARMv6T2 (1u << 7) #define ARMv7 (1u << 8) -#define ARMv8 (1u << 8) +#define ARMv8 (1u << 9) #define ARMvAll (0xffffffffu) typedef enum @@ -225,8 +225,14 @@ return false; uint32_t imm32; switch (encoding) { + case eEncodingT2: + imm32 = ThumbExpandImm(opcode); // imm32 = ThumbExpandImm(i:imm3:imm8) + break; + case eEncodingT3: + imm32 = ThumbImm12(opcode); // imm32 = ZeroExtend(i:imm3:imm8, 32) + break; case eEncodingA1: - imm32 = ARMExpand(opcode); // imm32 = ARMExpandImm(imm12) + imm32 = ARMExpandImm(opcode); // imm32 = ARMExpandImm(imm12) break; default: return false; @@ -327,11 +333,11 @@ // adjust the stack pointer { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, - "sub sp, sp, #n"}, + "sub sp, sp, #"}, // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, - "str Rt, [sp, #-n]!" } + "str Rt, [sp, #-]!" } }; static ARMOpcode g_thumb_opcodes[] = @@ -341,7 +347,14 @@ { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w ; contains more than one register" }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, - "push.w ; contains one register, " } + "push.w ; contains one register, " }, + + // adjust the stack pointer + { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, + "sub{s}.w sp, sp, #"}, + // adjust the stack pointer + { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, + "subw sp, sp, #"} }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); From gclayton at apple.com Tue Jan 25 17:55:37 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 23:55:37 -0000 Subject: [Lldb-commits] [lldb] r124250 - in /lldb/trunk: include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Symbol/ include/lldb/Target/ include/lldb/Utility/ lldb.xcodeproj/ source/Commands/ source/Core/ source/Expression/ source/Interpreter/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Plu... Message-ID: <20110125235538.531C22A6C12C@llvm.org> Author: gclayton Date: Tue Jan 25 17:55:37 2011 New Revision: 124250 URL: http://llvm.org/viewvc/llvm-project?rev=124250&view=rev Log: Enabled extra warnings and fixed a bunch of small issues. Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h lldb/trunk/include/lldb/Core/DataExtractor.h lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Core/PluginInterface.h lldb/trunk/include/lldb/Core/StreamFile.h lldb/trunk/include/lldb/Core/Value.h lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h lldb/trunk/include/lldb/Expression/ASTStructExtractor.h lldb/trunk/include/lldb/Expression/ClangASTSource.h lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h lldb/trunk/include/lldb/Expression/DWARFExpression.h lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/include/lldb/Symbol/ClangASTType.h lldb/trunk/include/lldb/Symbol/Symbol.h lldb/trunk/include/lldb/Symbol/SymbolContextScope.h lldb/trunk/include/lldb/Symbol/TaggedASTType.h lldb/trunk/include/lldb/Symbol/Type.h lldb/trunk/include/lldb/Symbol/UnwindTable.h lldb/trunk/include/lldb/Target/ExecutionContextScope.h lldb/trunk/include/lldb/Utility/SharingPtr.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Core/Value.cpp lldb/trunk/source/Core/ValueObjectVariable.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/DWARFExpression.cpp lldb/trunk/source/Expression/IRDynamicChecks.cpp lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/ClangASTType.cpp lldb/trunk/source/Symbol/Type.cpp lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointList.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointList.h Tue Jan 25 17:55:37 2011 @@ -46,7 +46,7 @@ /// @result /// Returns breakpoint id. //------------------------------------------------------------------ - virtual lldb::break_id_t + lldb::break_id_t Add (lldb::BreakpointSP& bp_sp, bool notify); //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Tue Jan 25 17:55:37 2011 @@ -38,6 +38,7 @@ friend class Breakpoint; public: + virtual ~BreakpointLocationList(); //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Core/DataExtractor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataExtractor.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/DataExtractor.h (original) +++ lldb/trunk/include/lldb/Core/DataExtractor.h Tue Jan 25 17:55:37 2011 @@ -720,10 +720,10 @@ GetU8 ( uint32_t *offset_ptr) const; uint8_t - GetU8_unchecked ( uint32_t *offset_ptr) const + GetU8_unchecked (uint32_t *offset_ptr) const { uint8_t val = m_start[*offset_ptr]; - *offset_ptr += sizeof(val); + *offset_ptr += 1; return val; } Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Tue Jan 25 17:55:37 2011 @@ -82,6 +82,7 @@ //------------------------------------------------------------------ /// Destructor. //------------------------------------------------------------------ + virtual ~Module (); //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Core/PluginInterface.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginInterface.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/PluginInterface.h (original) +++ lldb/trunk/include/lldb/Core/PluginInterface.h Tue Jan 25 17:55:37 2011 @@ -21,6 +21,8 @@ class PluginInterface { public: + virtual + ~PluginInterface () {} virtual const char * GetPluginName() = 0; Modified: lldb/trunk/include/lldb/Core/StreamFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamFile.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/StreamFile.h (original) +++ lldb/trunk/include/lldb/Core/StreamFile.h Tue Jan 25 17:55:37 2011 @@ -72,6 +72,9 @@ FILE* m_file; ///< File handle to dump to. bool m_close_file; std::string m_path_name; + +private: + DISALLOW_COPY_AND_ASSIGN (StreamFile); }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/Core/Value.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Value.h (original) +++ lldb/trunk/include/lldb/Core/Value.h Tue Jan 25 17:55:37 2011 @@ -63,8 +63,11 @@ Value(double v); Value(long double v); Value(const uint8_t *bytes, int len); - Value(const Value &v); + Value(const Value &rhs); + Value & + operator=(const Value &rhs); + Value * CreateProxy(); @@ -145,10 +148,16 @@ class ValueList { public: - ValueList () {} + ValueList () : + m_values() + { + } + ValueList (const ValueList &rhs); - ~ValueList () {} + ~ValueList () + { + } const ValueList & operator= (const ValueList &rhs); Modified: lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h (original) +++ lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h Tue Jan 25 17:55:37 2011 @@ -158,4 +158,4 @@ } -#endif \ No newline at end of file +#endif Modified: lldb/trunk/include/lldb/Expression/ASTStructExtractor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ASTStructExtractor.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ASTStructExtractor.h (original) +++ lldb/trunk/include/lldb/Expression/ASTStructExtractor.h Tue Jan 25 17:55:37 2011 @@ -153,4 +153,4 @@ } -#endif \ No newline at end of file +#endif Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original) +++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Tue Jan 25 17:55:37 2011 @@ -255,4 +255,4 @@ } -#endif \ No newline at end of file +#endif Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Tue Jan 25 17:55:37 2011 @@ -469,7 +469,9 @@ //---------------------------------------------------------------------- /// The following values should not live beyond parsing //---------------------------------------------------------------------- - struct ParserVars { + class ParserVars + { + public: ParserVars() : m_exe_ctx(NULL), m_sym_ctx(), @@ -493,6 +495,8 @@ ClangPersistentVariables *m_persistent_vars; ///< The persistent variables for the process. bool m_enable_lookups; ///< Set to true during parsing if we have found the first "$__lldb" name. bool m_ignore_lookups; ///< True during an import when we should be ignoring type lookups. + private: + DISALLOW_COPY_AND_ASSIGN (ParserVars); }; std::auto_ptr m_parser_vars; Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Tue Jan 25 17:55:37 2011 @@ -89,7 +89,9 @@ //---------------------------------------------------------------------- /// The following values should not live beyond parsing //---------------------------------------------------------------------- - struct ParserVars { + class ParserVars + { + public: ParserVars() : m_parser_type(), @@ -103,6 +105,9 @@ const clang::NamedDecl *m_named_decl; ///< The Decl corresponding to this variable llvm::Value *m_llvm_value; ///< The IR value corresponding to this variable; usually a GlobalValue lldb_private::Value *m_lldb_value; ///< The value found in LLDB for this variable + + private: + DISALLOW_COPY_AND_ASSIGN (ParserVars); }; //---------------------------------------------------------------------- /// Make this variable usable by the parser by allocating space for Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original) +++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Tue Jan 25 17:55:37 2011 @@ -189,6 +189,8 @@ bool Evaluate (ExecutionContextScope *exe_scope, clang::ASTContext *ast_context, + ClangExpressionVariableList *expr_locals, + ClangExpressionDeclMap *decl_map, lldb::addr_t loclist_base_load_addr, const Value* initial_value_ptr, Value& result, @@ -201,6 +203,8 @@ bool Evaluate (ExecutionContext *exe_ctx, clang::ASTContext *ast_context, + ClangExpressionVariableList *expr_locals, + ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, lldb::addr_t loclist_base_load_addr, const Value* initial_value_ptr, @@ -269,10 +273,10 @@ static bool Evaluate (ExecutionContext *exe_ctx, clang::ASTContext *ast_context, - const DataExtractor& opcodes, ClangExpressionVariableList *expr_locals, ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, + const DataExtractor& opcodes, const uint32_t offset, const uint32_t length, const uint32_t reg_set, @@ -331,8 +335,7 @@ lldb::addr_t m_loclist_slide; ///< A value used to slide the location list offsets so that ///< they are relative to the object that owns the location list ///< (the function for frame base and variable location lists) - ClangExpressionVariableList *m_expr_locals; ///< The locals used by this expression. See Evaluate() - ClangExpressionDeclMap *m_decl_map; ///< The external variables used by this expression. See Evaluate() + }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Jan 25 17:55:37 2011 @@ -589,7 +589,7 @@ CreateMemberPointerType (lldb::clang_type_t clang_pointee_type, lldb::clang_type_t clang_class_type); - size_t + uint32_t GetPointerBitSize (); static bool Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Tue Jan 25 17:55:37 2011 @@ -46,7 +46,7 @@ { } - ~ClangASTType(); + virtual ~ClangASTType(); const ClangASTType & operator= (const ClangASTType &atb) @@ -75,10 +75,10 @@ static ConstString GetClangTypeName (lldb::clang_type_t clang_type); - uint64_t + uint32_t GetClangTypeBitWidth (); - static uint64_t + static uint32_t GetClangTypeBitWidth (clang::ASTContext *ast_context, lldb::clang_type_t opaque_clang_qual_type); size_t Modified: lldb/trunk/include/lldb/Symbol/Symbol.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/Symbol.h (original) +++ lldb/trunk/include/lldb/Symbol/Symbol.h Tue Jan 25 17:55:37 2011 @@ -93,7 +93,7 @@ uint32_t GetSiblingIndex () const; - uint32_t + lldb::addr_t GetByteSize () const { return m_addr_range.GetByteSize(); } lldb::SymbolType Modified: lldb/trunk/include/lldb/Symbol/SymbolContextScope.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContextScope.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolContextScope.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolContextScope.h Tue Jan 25 17:55:37 2011 @@ -71,6 +71,9 @@ class SymbolContextScope { public: + virtual + ~SymbolContextScope () {} + //------------------------------------------------------------------ /// Reconstruct the object's symbolc context into \a sc. /// Modified: lldb/trunk/include/lldb/Symbol/TaggedASTType.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TaggedASTType.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/TaggedASTType.h (original) +++ lldb/trunk/include/lldb/Symbol/TaggedASTType.h Tue Jan 25 17:55:37 2011 @@ -29,7 +29,7 @@ TaggedASTType () : ClangASTType() { } - ~TaggedASTType() { } + virtual ~TaggedASTType() { } TaggedASTType &operator= (const TaggedASTType &tw) { Modified: lldb/trunk/include/lldb/Symbol/Type.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/Type.h (original) +++ lldb/trunk/include/lldb/Symbol/Type.h Tue Jan 25 17:55:37 2011 @@ -48,8 +48,8 @@ const ConstString &name, uint32_t byte_size, SymbolContextScope *context, - uintptr_t encoding_uid, - EncodingDataType encoding_type, + lldb::user_id_t encoding_uid, + EncodingDataType encoding_uid_type, const Declaration& decl, lldb::clang_type_t clang_qual_type, ResolveState clang_type_resolve_state); @@ -57,6 +57,8 @@ // This makes an invalid type. Used for functions that return a Type when they // get an error. Type(); + + Type (const Type &rhs); const Type& operator= (const Type& rhs); @@ -88,7 +90,7 @@ const ConstString& GetName(); - uint64_t + uint32_t GetByteSize(); uint32_t @@ -234,8 +236,8 @@ SymbolFile *m_symbol_file; SymbolContextScope *m_context; // The symbol context in which this type is defined Type *m_encoding_type; - EncodingDataType m_encoding_uid_type; uint32_t m_encoding_uid; + EncodingDataType m_encoding_uid_type; uint32_t m_byte_size; Declaration m_decl; lldb::clang_type_t m_clang_type; @@ -244,7 +246,8 @@ Type * GetEncodingType (); - bool ResolveClangType (ResolveState clang_type_resolve_state); + bool + ResolveClangType (ResolveState clang_type_resolve_state); }; } // 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=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindTable.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindTable.h Tue Jan 25 17:55:37 2011 @@ -51,6 +51,8 @@ UnwindAssemblyProfiler* m_assembly_profiler; DWARFCallFrameInfo* m_eh_frame; + + DISALLOW_COPY_AND_ASSIGN (UnwindTable); }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/Target/ExecutionContextScope.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ExecutionContextScope.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ExecutionContextScope.h (original) +++ lldb/trunk/include/lldb/Target/ExecutionContextScope.h Tue Jan 25 17:55:37 2011 @@ -39,6 +39,9 @@ class ExecutionContextScope { public: + virtual + ~ExecutionContextScope () {} + virtual Target * CalculateTarget () = 0; Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/SharingPtr.h (original) +++ lldb/trunk/include/lldb/Utility/SharingPtr.h Tue Jan 25 17:55:37 2011 @@ -48,6 +48,11 @@ private: virtual void on_zero_shared(); + + // Outlaw copy constructor and assignment operator to keep effictive C++ + // warnings down to a minumum + shared_ptr_pointer (const shared_ptr_pointer &); + shared_ptr_pointer & operator=(const shared_ptr_pointer &); }; template @@ -169,7 +174,7 @@ template template SharingPtr::SharingPtr(Y* p) - : ptr_(p) + : ptr_(p), cntrl_(0) { std::auto_ptr hold(p); typedef imp::shared_ptr_pointer _CntrlBlk; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan 25 17:55:37 2011 @@ -2874,8 +2874,15 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_DEBUG, ); + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; @@ -2897,8 +2904,15 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_RELEASE, ); + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; VALID_ARCHS = "x86_64 i386"; @@ -3078,8 +3092,15 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_BUILD_AND_INTEGRATION, ); + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; VALID_ARCHS = "x86_64 i386"; Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Jan 25 17:55:37 2011 @@ -629,7 +629,7 @@ { for (uint32_t i=0; iGetVariableAtIndex(i)); + var_sp = variable_list->GetVariableAtIndex(i); bool dump_variable = true; switch (var_sp->GetScope()) Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jan 25 17:55:37 2011 @@ -1253,7 +1253,7 @@ // earlier C++ libraries std::string binary_value(64, '0'); std::bitset<64> bits(uval64); - for (size_t i = 0; i < 64; ++i) + for (i = 0; i < 64; ++i) if (bits[i]) binary_value[64 - 1 - i] = '1'; if (item_bit_size > 0) Modified: lldb/trunk/source/Core/Value.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Core/Value.cpp (original) +++ lldb/trunk/source/Core/Value.cpp Tue Jan 25 17:55:37 2011 @@ -142,6 +142,26 @@ } } +Value & +Value::operator=(const Value &rhs) +{ + if (this != &rhs) + { + m_value = rhs.m_value; + m_value_type = rhs.m_value_type; + m_context = rhs.m_context; + m_context_type = rhs.m_context_type; + if ((uintptr_t)rhs.m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)rhs.m_data_buffer.GetBytes()) + { + m_data_buffer.CopyData(rhs.m_data_buffer.GetBytes(), + rhs.m_data_buffer.GetByteSize()); + + m_value = (uintptr_t)m_data_buffer.GetBytes(); + } + } + return *this; +} + Value * Value::CreateProxy() { @@ -653,17 +673,17 @@ { // Resolve the proxy - Value * v = (Value*)m_context; + Value * rhs = (Value*)m_context; - m_value = v->m_value; - m_value_type = v->m_value_type; - m_context = v->m_context; - m_context_type = v->m_context_type; + m_value = rhs->m_value; + m_value_type = rhs->m_value_type; + m_context = rhs->m_context; + m_context_type = rhs->m_context_type; - if ((uintptr_t)v->m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)v->m_data_buffer.GetBytes()) + if ((uintptr_t)rhs->m_value.ULongLong(LLDB_INVALID_ADDRESS) == (uintptr_t)rhs->m_data_buffer.GetBytes()) { - m_data_buffer.CopyData(v->m_data_buffer.GetBytes(), - v->m_data_buffer.GetByteSize()); + m_data_buffer.CopyData(rhs->m_data_buffer.GetBytes(), + rhs->m_data_buffer.GetByteSize()); m_value = (uintptr_t)m_data_buffer.GetBytes(); } Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectVariable.cpp (original) +++ lldb/trunk/source/Core/ValueObjectVariable.cpp Tue Jan 25 17:55:37 2011 @@ -118,7 +118,7 @@ loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.target); } Value old_value(m_value); - if (expr.Evaluate (&exe_ctx, GetClangAST(), NULL, loclist_base_load_addr, NULL, m_value, &m_error)) + if (expr.Evaluate (&exe_ctx, GetClangAST(), NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error)) { m_value.SetContext(Value::eContextTypeVariable, variable); Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Jan 25 17:55:37 2011 @@ -1402,17 +1402,15 @@ { uint32_t register_number = reg_info.kinds[lldb::eRegisterKindLLDB]; uint32_t register_byte_size = reg_info.byte_size; - - Error error; - + if (dematerialize) { DataBufferHeap register_data (register_byte_size, 0); - Error error; - if (exe_ctx.process->ReadMemory (addr, register_data.GetBytes(), register_byte_size, error) != register_byte_size) + Error read_error; + if (exe_ctx.process->ReadMemory (addr, register_data.GetBytes(), register_byte_size, read_error) != register_byte_size) { - err.SetErrorStringWithFormat ("Couldn't read %s from the target: %s", reg_info.name, error.AsCString()); + err.SetErrorStringWithFormat ("Couldn't read %s from the target: %s", reg_info.name, read_error.AsCString()); return false; } @@ -1801,7 +1799,7 @@ } Error err; - if (!var_location_expr.Evaluate(&exe_ctx, ast, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err)) + if (!var_location_expr.Evaluate(&exe_ctx, ast, NULL, NULL, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err)) { if (log) log->Printf("Error evaluating location: %s", err.AsCString()); Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Tue Jan 25 17:55:37 2011 @@ -217,18 +217,14 @@ DWARFExpression::DWARFExpression() : m_data(), m_reg_kind (eRegisterKindDWARF), - m_loclist_slide (LLDB_INVALID_ADDRESS), - m_expr_locals (NULL), - m_decl_map (NULL) + m_loclist_slide (LLDB_INVALID_ADDRESS) { } DWARFExpression::DWARFExpression(const DWARFExpression& rhs) : m_data(rhs.m_data), m_reg_kind (rhs.m_reg_kind), - m_loclist_slide(rhs.m_loclist_slide), - m_expr_locals (rhs.m_expr_locals), - m_decl_map (rhs.m_decl_map) + m_loclist_slide(rhs.m_loclist_slide) { } @@ -236,9 +232,7 @@ DWARFExpression::DWARFExpression(const DataExtractor& data, uint32_t data_offset, uint32_t data_length) : m_data(data, data_offset, data_length), m_reg_kind (eRegisterKindDWARF), - m_loclist_slide(LLDB_INVALID_ADDRESS), - m_expr_locals (NULL), - m_decl_map (NULL) + m_loclist_slide(LLDB_INVALID_ADDRESS) { } @@ -256,19 +250,6 @@ return m_data.GetByteSize() > 0; } - -void -DWARFExpression::SetExpressionLocalVariableList (ClangExpressionVariableList *locals) -{ - m_expr_locals = locals; -} - -void -DWARFExpression::SetExpressionDeclMap (ClangExpressionDeclMap *decl_map) -{ - m_decl_map = decl_map; -} - void DWARFExpression::SetOpcodeData (const DataExtractor& data) { @@ -749,6 +730,8 @@ ( ExecutionContextScope *exe_scope, clang::ASTContext *ast_context, + ClangExpressionVariableList *expr_locals, + ClangExpressionDeclMap *decl_map, lldb::addr_t loclist_base_load_addr, const Value* initial_value_ptr, Value& result, @@ -756,7 +739,7 @@ ) const { ExecutionContext exe_ctx (exe_scope); - return Evaluate(&exe_ctx, ast_context, NULL, loclist_base_load_addr, initial_value_ptr, result, error_ptr); + return Evaluate(&exe_ctx, ast_context, expr_locals, decl_map, NULL, loclist_base_load_addr, initial_value_ptr, result, error_ptr); } bool @@ -764,6 +747,8 @@ ( ExecutionContext *exe_ctx, clang::ASTContext *ast_context, + ClangExpressionVariableList *expr_locals, + ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, lldb::addr_t loclist_base_load_addr, const Value* initial_value_ptr, @@ -809,7 +794,7 @@ if (length > 0 && lo_pc <= pc && pc < hi_pc) { - return DWARFExpression::Evaluate (exe_ctx, ast_context, m_data, m_expr_locals, m_decl_map, reg_ctx, offset, length, m_reg_kind, initial_value_ptr, result, error_ptr); + return DWARFExpression::Evaluate (exe_ctx, ast_context, expr_locals, decl_map, reg_ctx, m_data, offset, length, m_reg_kind, initial_value_ptr, result, error_ptr); } offset += length; } @@ -821,7 +806,7 @@ } // Not a location list, just a single expression. - return DWARFExpression::Evaluate (exe_ctx, ast_context, m_data, m_expr_locals, m_decl_map, reg_ctx, 0, m_data.GetByteSize(), m_reg_kind, initial_value_ptr, result, error_ptr); + return DWARFExpression::Evaluate (exe_ctx, ast_context, expr_locals, decl_map, reg_ctx, m_data, 0, m_data.GetByteSize(), m_reg_kind, initial_value_ptr, result, error_ptr); } @@ -831,10 +816,10 @@ ( ExecutionContext *exe_ctx, clang::ASTContext *ast_context, - const DataExtractor& opcodes, ClangExpressionVariableList *expr_locals, ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, + const DataExtractor& opcodes, const uint32_t opcodes_offset, const uint32_t opcodes_length, const uint32_t reg_kind, Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original) +++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Tue Jan 25 17:55:37 2011 @@ -127,6 +127,10 @@ { } + virtual~Instrumenter () + { + } + //------------------------------------------------------------------ /// Inspect a function to find instructions to instrument /// @@ -287,12 +291,16 @@ class ValidPointerChecker : public Instrumenter { public: - ValidPointerChecker(llvm::Module &module, - DynamicCheckerFunctions &checker_functions) : + ValidPointerChecker (llvm::Module &module, + DynamicCheckerFunctions &checker_functions) : Instrumenter(module, checker_functions), m_valid_pointer_check_func(NULL) { } + + virtual ~ValidPointerChecker () + { + } private: bool InstrumentInstruction(llvm::Instruction *inst) { @@ -356,6 +364,12 @@ m_objc_object_check_func(NULL) { } + + virtual + ~ObjcObjectChecker () + { + } + private: bool InstrumentInstruction(llvm::Instruction *inst) { Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Jan 25 17:55:37 2011 @@ -1293,7 +1293,6 @@ && python_function_name[0] != '\0') { Thread *thread = context->exe_ctx.thread; - Target *target = context->exe_ctx.target; const StackFrameSP stop_frame_sp = thread->GetStackFrameSPForStackFramePtr (context->exe_ctx.frame); BreakpointSP breakpoint_sp = target->GetBreakpointByID (break_id); const BreakpointLocationSP bp_loc_sp = breakpoint_sp->FindLocationByID (break_loc_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=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Tue Jan 25 17:55:37 2011 @@ -344,11 +344,10 @@ eSymbolTypeData); if (trampoline_symbol != NULL) { - const Address &temp_address = trampoline_symbol->GetValue(); - if (!temp_address.IsValid()) + if (!trampoline_symbol->GetValue().IsValid()) return false; - m_trampoline_header = temp_address.GetLoadAddress(&target); + m_trampoline_header = trampoline_symbol->GetValue().GetLoadAddress(&target); if (m_trampoline_header == LLDB_INVALID_ADDRESS) return false; @@ -358,11 +357,10 @@ eSymbolTypeCode); if (changed_symbol != NULL) { - const Address &temp_address = changed_symbol->GetValue(); - if (!temp_address.IsValid()) + if (!changed_symbol->GetValue().IsValid()) return false; - lldb::addr_t changed_addr = temp_address.GetLoadAddress(&target); + lldb::addr_t changed_addr = changed_symbol->GetValue().GetLoadAddress(&target); if (changed_addr != LLDB_INVALID_ADDRESS) { BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Jan 25 17:55:37 2011 @@ -202,11 +202,11 @@ Symtab * ObjectFileMachO::GetSymtab() { - lldb_private::Mutex::Locker locker(m_mutex); + lldb_private::Mutex::Locker symfile_locker(m_mutex); if (m_symtab_ap.get() == NULL) { m_symtab_ap.reset(new Symtab(this)); - Mutex::Locker locker (m_symtab_ap->GetMutex()); + Mutex::Locker symtab_locker (m_symtab_ap->GetMutex()); ParseSymtab (true); } return m_symtab_ap.get(); 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=124250&r1=124249&r2=124250&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 Tue Jan 25 17:55:37 2011 @@ -133,7 +133,7 @@ void MachThreadContext_arm::RefreshStateAfterStop () { - EnableHardwareSingleStep (false) == KERN_SUCCESS; + EnableHardwareSingleStep (false); } #if defined (ENABLE_ARM_SINGLE_STEP) 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=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Tue Jan 25 17:55:37 2011 @@ -89,12 +89,10 @@ { // 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. - uint32_t flag_bits; + uint32_t flag_bits = 0; LogSP log(GetLog ()); if (log) flag_bits = log->GetMask().Get(); - else - flag_bits = 0; // Now make a new log with this stream if one was provided if (log_stream_sp) @@ -105,7 +103,6 @@ if (log) { - uint32_t flag_bits = 0; bool got_unknown_category = false; const size_t argc = args.GetArgumentCount(); for (size_t i=0; iSetName (thread_name.empty() ? thread_name.c_str() : NULL); if (exc_type != 0) { - const size_t exc_data_count = exc_data.size(); + const size_t exc_data_size = exc_data.size(); gdb_thread->SetStopInfo (StopInfoMachException::CreateStopReasonWithMachException (*thread_sp, exc_type, - exc_data_count, - exc_data_count >= 1 ? exc_data[0] : 0, - exc_data_count >= 2 ? exc_data[1] : 0)); + exc_data_size, + exc_data_size >= 1 ? exc_data[0] : 0, + exc_data_size >= 2 ? exc_data[1] : 0)); } else if (signo) { @@ -1230,7 +1230,7 @@ timeout_time.OffsetWithSeconds(5); StateType state = WaitForStateChangedEventsPrivate (&timeout_time, stop_event_sp); - const bool timed_out = state == eStateInvalid; + timed_out = state == eStateInvalid; if (log) log->Printf ("ProcessGDBRemote::InterruptIfRunning() catch stop event: state = %s, timed-out=%i", StateAsCString(state), timed_out); 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=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Tue Jan 25 17:55:37 2011 @@ -96,12 +96,10 @@ { // 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. - uint32_t flag_bits; + uint32_t flag_bits = 0; LogSP log(GetLog ()); if (log) flag_bits = log->GetMask().Get(); - else - flag_bits = 0; // Now make a new log with this stream if one was provided if (log_stream_sp) @@ -112,7 +110,6 @@ if (log) { - uint32_t flag_bits = 0; bool got_unknown_category = false; const size_t argc = args.GetArgumentCount(); for (size_t i=0; i 0) { - uint32_t i; - is_variable = tag == DW_TAG_variable; - for (i=0; iAppendRange (m_offset, range->begin_offset, range->end_offset); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jan 25 17:55:37 2011 @@ -1272,10 +1272,10 @@ uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); if (DWARFExpression::Evaluate (NULL, NULL, - debug_info_data, NULL, NULL, NULL, + debug_info_data, block_offset, block_length, eRegisterKindDWARF, @@ -2882,14 +2882,14 @@ // DIE and we want to try and find a type that has the complete definition. TypeSP SymbolFileDWARF::FindDefinitionTypeForDIE ( - DWARFCompileUnit* curr_cu, + DWARFCompileUnit* cu, const DWARFDebugInfoEntry *die, const ConstString &type_name ) { TypeSP type_sp; - if (curr_cu == NULL || die == NULL || !type_name) + if (cu == NULL || die == NULL || !type_name) return type_sp; if (!m_indexed) @@ -2901,7 +2901,7 @@ if (num_matches > 0) { DWARFCompileUnit* type_cu = NULL; - DWARFCompileUnit* curr_cu = curr_cu; + DWARFCompileUnit* curr_cu = cu; DWARFDebugInfo *info = DebugInfo(); for (size_t i=0; iHasChildren()) { - SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu)); - ParseChildEnumerators(sc, clang_type, type_sp->GetByteSize(), dwarf_cu, die); + SymbolContext cu_sc(GetCompUnitForDWARFCompUnit(dwarf_cu)); + ParseChildEnumerators(cu_sc, clang_type, type_sp->GetByteSize(), dwarf_cu, die); } ast.CompleteTagDeclarationDefinition (clang_type); #endif @@ -3396,7 +3396,7 @@ uint32_t i; for (i=0; i"), m_symbol_file (NULL), @@ -71,29 +72,33 @@ } -const lldb_private::Type& -lldb_private::Type::operator= (const Type& rhs) +Type::Type (const Type &rhs) : + UserID (rhs), + m_name (rhs.m_name), + m_symbol_file (rhs.m_symbol_file), + m_context (rhs.m_context), + m_encoding_type (rhs.m_encoding_type), + m_encoding_uid_type (rhs.m_encoding_uid_type), + m_encoding_uid (rhs.m_encoding_uid), + m_byte_size (rhs.m_byte_size), + m_decl (rhs.m_decl), + m_clang_type (rhs.m_clang_type), + m_clang_type_resolve_state (rhs.m_clang_type_resolve_state) +{ +} + +const Type& +Type::operator= (const Type& rhs) { if (this != &rhs) { - UserID::operator= (rhs); - m_name = rhs.m_name; - m_symbol_file = rhs.m_symbol_file; - m_context = rhs.m_context; - m_encoding_type = rhs.m_encoding_type; - m_encoding_uid_type = rhs.m_encoding_uid_type; - m_encoding_uid = rhs.m_encoding_uid; - m_byte_size = rhs.m_byte_size; - m_decl = rhs.m_decl; - m_clang_type = rhs.m_clang_type; - m_clang_type_resolve_state = rhs.m_clang_type_resolve_state; } return *this; } void -lldb_private::Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name) +Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name) { *s << "id = " << (const UserID&)*this; @@ -133,7 +138,7 @@ void -lldb_private::Type::Dump (Stream *s, bool show_context) +Type::Dump (Stream *s, bool show_context) { s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); s->Indent(); @@ -183,8 +188,8 @@ s->EOL(); } -const lldb_private::ConstString & -lldb_private::Type::GetName() +const ConstString & +Type::GetName() { if (!(m_name)) { @@ -199,18 +204,18 @@ } void -lldb_private::Type::DumpTypeName(Stream *s) +Type::DumpTypeName(Stream *s) { GetName().Dump(s, ""); } void -lldb_private::Type::DumpValue +Type::DumpValue ( - lldb_private::ExecutionContext *exe_ctx, - lldb_private::Stream *s, - const lldb_private::DataExtractor &data, + ExecutionContext *exe_ctx, + Stream *s, + const DataExtractor &data, uint32_t data_byte_offset, bool show_types, bool show_summary, @@ -229,7 +234,7 @@ s->PutCString(") "); } - lldb_private::ClangASTType::DumpValue (GetClangAST (), + ClangASTType::DumpValue (GetClangAST (), m_clang_type, exe_ctx, s, @@ -246,8 +251,8 @@ } } -lldb_private::Type * -lldb_private::Type::GetEncodingType () +Type * +Type::GetEncodingType () { if (m_encoding_type == NULL && m_encoding_uid != LLDB_INVALID_UID) m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid); @@ -256,8 +261,8 @@ -uint64_t -lldb_private::Type::GetByteSize() +uint32_t +Type::GetByteSize() { if (m_byte_size == 0) { @@ -274,7 +279,7 @@ m_byte_size = encoding_type->GetByteSize(); if (m_byte_size == 0) { - uint64_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangLayoutType()); + uint32_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangLayoutType()); m_byte_size = (bit_width + 7 ) / 8; } } @@ -293,7 +298,7 @@ uint32_t -lldb_private::Type::GetNumChildren (bool omit_empty_base_classes) +Type::GetNumChildren (bool omit_empty_base_classes) { if (ResolveClangType(eResolveStateForward)) { @@ -305,7 +310,7 @@ } bool -lldb_private::Type::IsAggregateType () +Type::IsAggregateType () { if (ResolveClangType(eResolveStateForward)) return ClangASTContext::IsAggregateType (m_clang_type); @@ -313,33 +318,33 @@ } lldb::Format -lldb_private::Type::GetFormat () +Type::GetFormat () { // Make sure we resolve our type if it already hasn't been. if (!ResolveClangType(eResolveStateForward)) return lldb::eFormatInvalid; - return lldb_private::ClangASTType::GetFormat (m_clang_type); + return ClangASTType::GetFormat (m_clang_type); } lldb::Encoding -lldb_private::Type::GetEncoding (uint32_t &count) +Type::GetEncoding (uint32_t &count) { // Make sure we resolve our type if it already hasn't been. if (!ResolveClangType(eResolveStateForward)) return lldb::eEncodingInvalid; - return lldb_private::ClangASTType::GetEncoding (m_clang_type, count); + return ClangASTType::GetEncoding (m_clang_type, count); } bool -lldb_private::Type::DumpValueInMemory +Type::DumpValueInMemory ( - lldb_private::ExecutionContext *exe_ctx, - lldb_private::Stream *s, + ExecutionContext *exe_ctx, + Stream *s, lldb::addr_t address, lldb::AddressType address_type, bool show_types, @@ -349,7 +354,7 @@ { if (address != LLDB_INVALID_ADDRESS) { - lldb_private::DataExtractor data; + DataExtractor data; data.SetByteOrder (exe_ctx->process->GetByteOrder()); if (ReadFromMemory (exe_ctx, address, address_type, data)) { @@ -362,7 +367,7 @@ bool -lldb_private::Type::ReadFromMemory (lldb_private::ExecutionContext *exe_ctx, lldb::addr_t addr, lldb::AddressType address_type, lldb_private::DataExtractor &data) +Type::ReadFromMemory (ExecutionContext *exe_ctx, lldb::addr_t addr, lldb::AddressType address_type, DataExtractor &data) { if (address_type == lldb::eAddressTypeFile) { @@ -401,26 +406,26 @@ bool -lldb_private::Type::WriteToMemory (lldb_private::ExecutionContext *exe_ctx, lldb::addr_t addr, lldb::AddressType address_type, lldb_private::DataExtractor &data) +Type::WriteToMemory (ExecutionContext *exe_ctx, lldb::addr_t addr, lldb::AddressType address_type, DataExtractor &data) { return false; } -lldb_private::TypeList* -lldb_private::Type::GetTypeList() +TypeList* +Type::GetTypeList() { return GetSymbolFile()->GetTypeList(); } -const lldb_private::Declaration & -lldb_private::Type::GetDeclaration () const +const Declaration & +Type::GetDeclaration () const { return m_decl; } bool -lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state) +Type::ResolveClangType (ResolveState clang_type_resolve_state) { Type *encoding_type = NULL; if (m_clang_type == NULL) @@ -560,7 +565,7 @@ return m_clang_type != NULL; } uint32_t -lldb_private::Type::GetEncodingMask () +Type::GetEncodingMask () { uint32_t encoding_mask = 1u << m_encoding_uid_type; Type *encoding_type = GetEncodingType(); @@ -571,40 +576,40 @@ } clang_type_t -lldb_private::Type::GetClangType () +Type::GetClangType () { ResolveClangType(eResolveStateFull); return m_clang_type; } clang_type_t -lldb_private::Type::GetClangLayoutType () +Type::GetClangLayoutType () { ResolveClangType(eResolveStateLayout); return m_clang_type; } clang_type_t -lldb_private::Type::GetClangForwardType () +Type::GetClangForwardType () { ResolveClangType (eResolveStateForward); return m_clang_type; } clang::ASTContext * -lldb_private::Type::GetClangAST () +Type::GetClangAST () { return GetClangASTContext().getASTContext(); } -lldb_private::ClangASTContext & -lldb_private::Type::GetClangASTContext () +ClangASTContext & +Type::GetClangASTContext () { return m_symbol_file->GetClangASTContext(); } int -lldb_private::Type::Compare(const Type &a, const Type &b) +Type::Compare(const Type &a, const Type &b) { // Just compare the UID values for now... lldb::user_id_t a_uid = a.GetID(); @@ -620,14 +625,14 @@ void * -lldb_private::Type::CreateClangPointerType (lldb_private::Type *type) +Type::CreateClangPointerType (Type *type) { assert(type); return GetClangASTContext().CreatePointerType(type->GetClangForwardType()); } void * -lldb_private::Type::CreateClangTypedefType (lldb_private::Type *typedef_type, lldb_private::Type *base_type) +Type::CreateClangTypedefType (Type *typedef_type, Type *base_type) { assert(typedef_type && base_type); return GetClangASTContext().CreateTypedefType (typedef_type->GetName().AsCString(), @@ -636,14 +641,14 @@ } void * -lldb_private::Type::CreateClangLValueReferenceType (lldb_private::Type *type) +Type::CreateClangLValueReferenceType (Type *type) { assert(type); return GetClangASTContext().CreateLValueReferenceType(type->GetClangForwardType()); } void * -lldb_private::Type::CreateClangRValueReferenceType (lldb_private::Type *type) +Type::CreateClangRValueReferenceType (Type *type) { assert(type); return GetClangASTContext().CreateRValueReferenceType (type->GetClangForwardType()); Modified: lldb/trunk/source/Target/StackFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Target/StackFrame.cpp (original) +++ lldb/trunk/source/Target/StackFrame.cpp Tue Jan 25 17:55:37 2011 @@ -48,9 +48,9 @@ lldb::addr_t pc, const SymbolContext *sc_ptr ) : + m_thread (thread), m_frame_index (frame_idx), m_concrete_frame_index (unwind_frame_index), - m_thread (thread), m_reg_context_sp (), m_id (pc, cfa, NULL), m_frame_code_addr (NULL, pc), @@ -59,7 +59,8 @@ m_frame_base (), m_frame_base_error (), m_variable_list_sp (), - m_variable_list_value_objects () + m_variable_list_value_objects (), + m_disassembly () { if (sc_ptr != NULL) { @@ -78,9 +79,9 @@ lldb::addr_t pc, const SymbolContext *sc_ptr ) : + m_thread (thread), m_frame_index (frame_idx), m_concrete_frame_index (unwind_frame_index), - m_thread (thread), m_reg_context_sp (reg_context_sp), m_id (pc, cfa, NULL), m_frame_code_addr (NULL, pc), @@ -89,7 +90,8 @@ m_frame_base (), m_frame_base_error (), m_variable_list_sp (), - m_variable_list_value_objects () + m_variable_list_value_objects (), + m_disassembly () { if (sc_ptr != NULL) { @@ -114,9 +116,9 @@ const Address& pc_addr, const SymbolContext *sc_ptr ) : + m_thread (thread), m_frame_index (frame_idx), 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), m_frame_code_addr (pc_addr), @@ -125,7 +127,8 @@ m_frame_base (), m_frame_base_error (), m_variable_list_sp (), - m_variable_list_value_objects () + m_variable_list_value_objects (), + m_disassembly () { if (sc_ptr != NULL) { @@ -626,7 +629,7 @@ if (var_path.size() > 2) // Need at least two brackets and a number { char *end = NULL; - int32_t child_index = ::strtol (&var_path[1], &end, 0); + long child_index = ::strtol (&var_path[1], &end, 0); if (end && *end == ']') { @@ -745,7 +748,7 @@ if (m_sc.function->GetFrameBaseExpression().IsLocationList()) loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (&m_thread.GetProcess().GetTarget()); - if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false) + if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, NULL, NULL, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false) { // We should really have an error if evaluate returns, but in case // we don't, lets set the error to something at least. @@ -963,4 +966,4 @@ StackFrame::GetSP () { return m_thread.GetStackFrameSPForStackFramePtr (this); -} \ No newline at end of file +} Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Tue Jan 25 17:55:37 2011 @@ -844,7 +844,7 @@ stack_size = m_discarded_plan_stack.size(); s->Printf ("Discarded Plan Stack: %d elements.\n", stack_size); - for (int i = stack_size - 1; i >= 0; i--) + for (i = stack_size - 1; i >= 0; i--) { s->Printf ("Element %d: ", i); s->IndentMore(); Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Tue Jan 25 17:55:37 2011 @@ -50,4 +50,4 @@ return m_callback (m_owner, m_flags, m_baton); else return NULL; -} \ No newline at end of file +} 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=124250&r1=124249&r2=124250&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Jan 25 17:55:37 2011 @@ -372,6 +372,7 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, From bugzilla-daemon at llvm.org Tue Jan 25 17:55:50 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 17:55:50 -0600 (CST) Subject: [Lldb-commits] [Bug 8261] Initialization Order Warnings In-Reply-To: References: Message-ID: <20110125235550.38E7A2A6C12D@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8261 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |FIXED --- Comment #2 from Greg Clayton 2011-01-25 17:55:49 CST --- Committed revision 124250. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From bugzilla-daemon at llvm.org Tue Jan 25 17:57:10 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 17:57:10 -0600 (CST) Subject: [Lldb-commits] [Bug 8262] String to Octal conversion In-Reply-To: References: Message-ID: <20110125235710.C69752A6C124@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8262 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |FIXED --- Comment #1 from Greg Clayton 2011-01-25 17:57:10 CST --- Fixed with revision 115485. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From gclayton at apple.com Tue Jan 25 17:58:39 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 25 Jan 2011 23:58:39 -0000 Subject: [Lldb-commits] [lldb] r124251 - /lldb/trunk/source/gdbserver/ Message-ID: <20110125235839.AFB302A6C12C@llvm.org> Author: gclayton Date: Tue Jan 25 17:58:39 2011 New Revision: 124251 URL: http://llvm.org/viewvc/llvm-project?rev=124251&view=rev Log: Removed unused directory. Removed: lldb/trunk/source/gdbserver/ From bugzilla-daemon at llvm.org Tue Jan 25 17:59:05 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 25 Jan 2011 17:59:05 -0600 (CST) Subject: [Lldb-commits] [Bug 8271] Extraneous Files (Building under linux / makefiles) In-Reply-To: References: Message-ID: <20110125235905.8083D2A6C124@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8271 Greg Clayton changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clayborg at gmail.com Resolution| |FIXED --- Comment #1 from Greg Clayton 2011-01-25 17:59:05 CST --- We removed the CommandObjectCall files a while back, and I just removed gdbserver with revision 124251. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Tue Jan 25 18:08:59 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 00:08:59 -0000 Subject: [Lldb-commits] [lldb] r124253 - in /lldb/trunk/source/Plugins/Process/Utility: ARMUtils.h EmulateInstructionARM.cpp Message-ID: <20110126000859.594572A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 18:08:59 2011 New Revision: 124253 URL: http://llvm.org/viewvc/llvm-project?rev=124253&view=rev Log: Add Encoding T1 entry of emulate_sub_sp_imm to the g_thumb_opcodes table. Update emulate_sub_sp_imm to handle Encoding T1. Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124253&r1=124252&r2=124253&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Tue Jan 25 18:08:59 2011 @@ -120,6 +120,13 @@ return imm12; } +// imm32 = ZeroExtend(imm7:'00', 32) +static inline uint32_t ThumbImmScaled(uint32_t val) +{ + const uint32_t imm7 = bits(val, 6, 0); + return imm7 * 4; +} + // This function performs the check for the register numbers 13 and 15 that are // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124253&r1=124252&r2=124253&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 18:08:59 2011 @@ -225,6 +225,8 @@ return false; uint32_t imm32; switch (encoding) { + case eEncodingT1: + imm32 = ThumbImmScaled(opcode); // imm32 = ZeroExtend(imm7:'00', 32) case eEncodingT2: imm32 = ThumbExpandImm(opcode); // imm32 = ThumbExpandImm(i:imm3:imm8) break; @@ -326,6 +328,7 @@ static ARMOpcode g_arm_opcodes[] = { + // push register(s) { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, "push ; contains more than one register" }, { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, @@ -342,7 +345,8 @@ static ARMOpcode g_thumb_opcodes[] = { - { 0x0000fe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, + // push register(s) + { 0xfffffe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, "push " }, { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w ; contains more than one register" }, @@ -350,6 +354,9 @@ "push.w ; contains one register, " }, // adjust the stack pointer + { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, + "sub{s} sp, sp, #"}, + // adjust the stack pointer { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub{s}.w sp, sp, #"}, // adjust the stack pointer From johnny.chen at apple.com Tue Jan 25 19:00:55 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 01:00:55 -0000 Subject: [Lldb-commits] [lldb] r124259 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/Process/Utility/ARMUtils.h source/Plugins/Process/Utility/EmulateInstruction.h source/Plugins/Process/Utility/EmulateInstructionARM.cpp source/Plugins/Process/Utility/InstructionUtils.h Message-ID: <20110126010055.73C212A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 19:00:55 2011 New Revision: 124259 URL: http://llvm.org/viewvc/llvm-project?rev=124259&view=rev Log: Move the generic instruction bits manipulation routines into a newly created file named InstructionUtils.h and modify some existing code to use them. Added: lldb/trunk/source/Plugins/Process/Utility/InstructionUtils.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124259&r1=124258&r2=124259&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan 25 19:00:55 2011 @@ -385,6 +385,7 @@ AF94005911C03F6500085DB9 /* SymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /* SymbolVendor.cpp */; }; B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B23DD24F12EDFAC1000C3894 /* ARMUtils.h */; }; B296983712C2FB98002D92C3 /* CommandObjectVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */; }; + B2D3033712EFA5C500F84EB3 /* InstructionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1098,6 +1099,7 @@ B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = ""; }; B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = ""; }; B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = ""; }; + B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1611,6 +1613,7 @@ 26B4666E11A2080F00CF6220 /* Utility */ = { isa = PBXGroup; children = ( + B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */, B23DD24F12EDFAC1000C3894 /* ARMUtils.h */, 2621C9CC12EA009300711A30 /* EmulateInstruction.h */, 2621CA0A12EA107700711A30 /* EmulateInstruction.cpp */, @@ -2317,6 +2320,7 @@ 2621C9CE12EA009300711A30 /* EmulateInstruction.h in Headers */, 2621C9D012EA066500711A30 /* EmulateInstructionARM.h in Headers */, B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */, + B2D3033712EFA5C500F84EB3 /* InstructionUtils.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124259&r1=124258&r2=124259&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Tue Jan 25 19:00:55 2011 @@ -10,6 +10,8 @@ #ifndef lldb_ARMUtils_h_ #define lldb_ARMUtils_h_ +#include "InstructionUtils.h" + // Common utilities for the ARM/Thumb Instruction Set Architecture. namespace lldb_private { @@ -52,8 +54,7 @@ static inline uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit) { - assert(msbit < 32 && lsbit <= msbit); - return (val >> lsbit) & ((1u << (msbit - lsbit + 1)) - 1); + return Bits32(val, msbit, lsbit); } static inline uint32_t bit(const uint32_t val, const uint32_t msbit) @@ -131,18 +132,6 @@ // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } -// Returns an integer result equal to the number of bits of x that are ones. -static inline uint32_t BitCount(uint32_t x) -{ - // c accumulates the total bits set in x - uint32_t c; - for (c = 0; x; ++c) - { - x &= x - 1; // clear the least significant bit set - } - return c; -} - } // namespace lldb_private #endif // lldb_ARMUtils_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124259&r1=124258&r2=124259&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Tue Jan 25 19:00:55 2011 @@ -104,45 +104,6 @@ virtual bool EvaluateInstruction () = 0; - // Create a mask that starts at bit zero and includes "bit" - static uint64_t - MaskUpToBit (const uint64_t bit) - { - return (1ull << (bit + 1ull)) - 1ull; - } - - static bool - BitIsSet (const uint64_t value, const uint64_t bit) - { - return (value & (1ull << bit)) != 0; - } - - static bool - BitIsClear (const uint64_t value, const uint64_t bit) - { - return (value & (1ull << bit)) == 0; - } - - static int64_t - SignedBits (const uint64_t value, const uint64_t msbit, const uint64_t lsbit) - { - uint64_t result = UnsignedBits (value, msbit, lsbit); - if (BitIsSet(value, msbit)) - { - // Sign extend - result |= ~MaskUpToBit (msbit - lsbit); - } - return result; - } - - static uint64_t - UnsignedBits (const uint64_t value, const uint64_t msbit, const uint64_t lsbit) - { - uint64_t result = value >> lsbit; - result &= MaskUpToBit (msbit - lsbit); - return result; - } - uint64_t ReadRegisterUnsigned (uint32_t reg_kind, uint32_t reg_num, @@ -168,19 +129,6 @@ uint64_t uval, size_t uval_byte_size); - static uint32_t - BitCount (uint64_t value) - { - uint32_t set_bit_count = 0; - while (value) - { - if (value & 1) - ++set_bit_count; - value >>= 1; - } - return set_bit_count; - } - uint32_t GetAddressByteSize () const { Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124259&r1=124258&r2=124259&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 19:00:55 2011 @@ -111,9 +111,9 @@ uint32_t Rt; // the source register switch (encoding) { case eEncodingT1: - registers = EmulateInstruction::UnsignedBits (opcode, 7, 0); + registers = Bits32(opcode, 7, 0); // The M bit represents LR. - if (EmulateInstruction::UnsignedBits (opcode, 8, 8)) + if (Bits32(opcode, 8, 8)) registers |= 0x000eu; // if BitCount(registers) < 1 then UNPREDICTABLE; if (BitCount(registers) < 1) @@ -121,26 +121,26 @@ break; case eEncodingT2: // Ignore bits 15 & 13. - registers = EmulateInstruction::UnsignedBits (opcode, 15, 0) & ~0xa000; + registers = Bits32(opcode, 15, 0) & ~0xa000; // if BitCount(registers) < 2 then UNPREDICTABLE; if (BitCount(registers) < 2) return false; break; case eEncodingT3: - Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); + Rt = Bits32(opcode, 15, 12); // if BadReg(t) then UNPREDICTABLE; if (BadReg(Rt)) return false; registers = (1u << Rt); break; case eEncodingA1: - registers = EmulateInstruction::UnsignedBits (opcode, 15, 0); + registers = Bits32(opcode, 15, 0); // Instead of return false, let's handle the following case as well, // which amounts to pushing one reg onto the full descending stacks. // if BitCount(register_list) < 2 then SEE STMDB / STMFD; break; case eEncodingA2: - Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); + Rt = Bits32(opcode, 15, 12); // if t == 13 then UNPREDICTABLE; if (Rt == dwarf_sp) return false; @@ -156,7 +156,7 @@ EmulateInstruction::Context context = { EmulateInstruction::eContextPushRegisterOnStack, eRegisterKindDWARF, 0, 0 }; for (i=0; i<15; ++i) { - if (EmulateInstruction::BitIsSet (registers, 1u << i)) + if (BitIsSet (registers, 1u << i)) { context.arg1 = dwarf_r0 + i; // arg1 in the context is the DWARF register number context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset @@ -169,7 +169,7 @@ } } - if (EmulateInstruction::BitIsSet (registers, 1u << 15)) + if (BitIsSet (registers, 1u << 15)) { context.arg1 = dwarf_pc; // arg1 in the context is the DWARF register number context.arg2 = addr - sp; // arg2 in the context is the stack pointer offset @@ -284,8 +284,8 @@ uint32_t imm12; switch (encoding) { case eEncodingA1: - Rt = EmulateInstruction::UnsignedBits (opcode, 15, 12); - imm12 = EmulateInstruction::UnsignedBits (opcode, 11, 0); + Rt = Bits32(opcode, 15, 12); + imm12 = Bits32(opcode, 11, 0); break; default: return false; Added: lldb/trunk/source/Plugins/Process/Utility/InstructionUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/InstructionUtils.h?rev=124259&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/InstructionUtils.h (added) +++ lldb/trunk/source/Plugins/Process/Utility/InstructionUtils.h Tue Jan 25 19:00:55 2011 @@ -0,0 +1,78 @@ +//===-- lldb_InstructionUtils.h ---------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_InstructionUtils_h_ +#define lldb_InstructionUtils_h_ + +// Common utilities for manipulating instruction bit fields. + +namespace lldb_private { + +static inline uint32_t +Bits32 (const uint32_t value, const uint32_t msbit, const uint32_t lsbit) +{ + assert(msbit < 32 && lsbit <= msbit); + return (value >> lsbit) & ((1u << (msbit - lsbit + 1)) - 1); +} + +// Create a mask that starts at bit zero and includes "bit" +static inline uint64_t +MaskUpToBit (const uint64_t bit) +{ + return (1ull << (bit + 1ull)) - 1ull; +} + +// Returns an integer result equal to the number of bits of x that are ones. +static inline uint32_t +BitCount (uint64_t x) +{ + // c accumulates the total bits set in x + uint32_t c; + for (c = 0; x; ++c) + { + x &= x - 1; // clear the least significant bit set + } + return c; +} + +static inline bool +BitIsSet (const uint64_t value, const uint64_t bit) +{ + return (value & (1ull << bit)) != 0; +} + +static inline bool +BitIsClear (const uint64_t value, const uint64_t bit) +{ + return (value & (1ull << bit)) == 0; +} + +static inline uint64_t +UnsignedBits (const uint64_t value, const uint64_t msbit, const uint64_t lsbit) +{ + uint64_t result = value >> lsbit; + result &= MaskUpToBit (msbit - lsbit); + return result; +} + +static inline int64_t +SignedBits (const uint64_t value, const uint64_t msbit, const uint64_t lsbit) +{ + uint64_t result = UnsignedBits (value, msbit, lsbit); + if (BitIsSet(value, msbit)) + { + // Sign extend + result |= ~MaskUpToBit (msbit - lsbit); + } + return result; +} + +} // namespace lldb_private + +#endif // lldb_InstructionUtils_h_ From johnny.chen at apple.com Tue Jan 25 19:18:52 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 01:18:52 -0000 Subject: [Lldb-commits] [lldb] r124261 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/Process/Utility/ARMDefines.h source/Plugins/Process/Utility/ARMUtils.h source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110126011852.C92C32A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 19:18:52 2011 New Revision: 124261 URL: http://llvm.org/viewvc/llvm-project?rev=124261&view=rev Log: Move #define's out of ARMUtils.h and into a newly created file ARMDefines.h. Added: lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124261&r1=124260&r2=124261&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan 25 19:18:52 2011 @@ -384,6 +384,7 @@ AF68D3311255A111002FF25B /* UnwindLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */; }; AF94005911C03F6500085DB9 /* SymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /* SymbolVendor.cpp */; }; B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B23DD24F12EDFAC1000C3894 /* ARMUtils.h */; }; + B287E63F12EFAE2C00C9BEFE /* ARMDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */; }; B296983712C2FB98002D92C3 /* CommandObjectVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */; }; B2D3033712EFA5C500F84EB3 /* InstructionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */; }; /* End PBXBuildFile section */ @@ -1097,6 +1098,7 @@ AF68D3301255A110002FF25B /* UnwindLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindLLDB.h; path = Utility/UnwindLLDB.h; sourceTree = ""; }; AF94005711C03F6500085DB9 /* SymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolVendor.cpp; path = source/Symbol/SymbolVendor.cpp; sourceTree = ""; }; B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = ""; }; + B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = ""; }; B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = ""; }; B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = ""; }; B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = ""; }; @@ -1614,6 +1616,7 @@ isa = PBXGroup; children = ( B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */, + B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */, B23DD24F12EDFAC1000C3894 /* ARMUtils.h */, 2621C9CC12EA009300711A30 /* EmulateInstruction.h */, 2621CA0A12EA107700711A30 /* EmulateInstruction.cpp */, @@ -2321,6 +2324,7 @@ 2621C9D012EA066500711A30 /* EmulateInstructionARM.h in Headers */, B23DD25012EDFAC1000C3894 /* ARMUtils.h in Headers */, B2D3033712EFA5C500F84EB3 /* InstructionUtils.h in Headers */, + B287E63F12EFAE2C00C9BEFE /* ARMDefines.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h?rev=124261&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h (added) +++ lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h Tue Jan 25 19:18:52 2011 @@ -0,0 +1,56 @@ +//===-- lldb_ARMDefines.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_ARMDefines_h_ +#define lldb_ARMDefines_h_ + +#include "InstructionUtils.h" + +// Common defintions for the ARM/Thumb Instruction Set Architecture. + +namespace lldb_private { + +// ARM conditions +#define COND_EQ 0x0 +#define COND_NE 0x1 +#define COND_CS 0x2 +#define COND_HS 0x2 +#define COND_CC 0x3 +#define COND_LO 0x3 +#define COND_MI 0x4 +#define COND_PL 0x5 +#define COND_VS 0x6 +#define COND_VC 0x7 +#define COND_HI 0x8 +#define COND_LS 0x9 +#define COND_GE 0xA +#define COND_LT 0xB +#define COND_GT 0xC +#define COND_LE 0xD +#define COND_AL 0xE +#define COND_UNCOND 0xF + +// Masks for CPSR +#define MASK_CPSR_MODE_MASK (0x0000001fu) +#define MASK_CPSR_T (1u << 5) +#define MASK_CPSR_F (1u << 6) +#define MASK_CPSR_I (1u << 7) +#define MASK_CPSR_A (1u << 8) +#define MASK_CPSR_E (1u << 9) +#define MASK_CPSR_GE_MASK (0x000f0000u) +#define MASK_CPSR_J (1u << 24) +#define MASK_CPSR_Q (1u << 27) +#define MASK_CPSR_V (1u << 28) +#define MASK_CPSR_C (1u << 29) +#define MASK_CPSR_Z (1u << 30) +#define MASK_CPSR_N (1u << 31) + +} // namespace lldb_private + +#endif // lldb_ARMDefines_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h?rev=124261&r1=124260&r2=124261&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/ARMUtils.h Tue Jan 25 19:18:52 2011 @@ -16,42 +16,6 @@ namespace lldb_private { -// ARM conditions -#define COND_EQ 0x0 -#define COND_NE 0x1 -#define COND_CS 0x2 -#define COND_HS 0x2 -#define COND_CC 0x3 -#define COND_LO 0x3 -#define COND_MI 0x4 -#define COND_PL 0x5 -#define COND_VS 0x6 -#define COND_VC 0x7 -#define COND_HI 0x8 -#define COND_LS 0x9 -#define COND_GE 0xA -#define COND_LT 0xB -#define COND_GT 0xC -#define COND_LE 0xD -#define COND_AL 0xE -#define COND_UNCOND 0xF - -// Masks for CPSR -#define MASK_CPSR_MODE_MASK (0x0000001fu) -#define MASK_CPSR_T (1u << 5) -#define MASK_CPSR_F (1u << 6) -#define MASK_CPSR_I (1u << 7) -#define MASK_CPSR_A (1u << 8) -#define MASK_CPSR_E (1u << 9) -#define MASK_CPSR_GE_MASK (0x000f0000u) -#define MASK_CPSR_J (1u << 24) -#define MASK_CPSR_Q (1u << 27) -#define MASK_CPSR_V (1u << 28) -#define MASK_CPSR_C (1u << 29) -#define MASK_CPSR_Z (1u << 30) -#define MASK_CPSR_N (1u << 31) - - static inline uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit) { return Bits32(val, msbit, lsbit); Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124261&r1=124260&r2=124261&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 19:18:52 2011 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "EmulateInstructionARM.h" +#include "ARMDefines.h" #include "ARMUtils.h" using namespace lldb; From johnny.chen at apple.com Tue Jan 25 19:24:46 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 01:24:46 -0000 Subject: [Lldb-commits] [lldb] r124262 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110126012446.25D0A2A6C12C@llvm.org> Author: johnny Date: Tue Jan 25 19:24:45 2011 New Revision: 124262 URL: http://llvm.org/viewvc/llvm-project?rev=124262&view=rev Log: Remove duplicated comments. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124262&r1=124261&r2=124262&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Tue Jan 25 19:24:45 2011 @@ -357,10 +357,8 @@ // adjust the stack pointer { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "sub{s} sp, sp, #"}, - // adjust the stack pointer { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub{s}.w sp, sp, #"}, - // adjust the stack pointer { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, "subw sp, sp, #"} }; From johnny.chen at apple.com Wed Jan 26 13:07:42 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 19:07:42 -0000 Subject: [Lldb-commits] [lldb] r124303 - /lldb/trunk/test/dotest.py Message-ID: <20110126190742.77BFB2A6C12C@llvm.org> Author: johnny Date: Wed Jan 26 13:07:42 2011 New Revision: 124303 URL: http://llvm.org/viewvc/llvm-project?rev=124303&view=rev Log: Add "-A arch_spec" and "-C compiler_spec" options to the test driver. Example: $ ./dotest.py -A i386 -C clang -v -w -t -p TestObjCMethods.py $ ./dotest.py -A x86_64 -C gcc -v -w types 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=124303&r1=124302&r2=124303&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Wed Jan 26 13:07:42 2011 @@ -121,6 +121,8 @@ Usage: dotest.py [option] [args] where options: -h : print this help message and exit (also --help) +-A : specify the architecture to launch for the inferior process +-C : specify the compiler used to build the inferior executable -a : don't do lldb Python API tests use @python_api_test to decorate a test case as lldb Python API test +a : just do lldb Python API tests @@ -276,6 +278,20 @@ if sys.argv[index].find('-h') != -1: usage() + elif sys.argv[index].startswith('-A'): + # Increment by 1 to fetch the ARCH spec. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + os.environ["ARCH"] = sys.argv[index] + index += 1 + elif sys.argv[index].startswith('-C'): + # Increment by 1 to fetch the CC spec. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + os.environ["CC"] = sys.argv[index] + index += 1 elif sys.argv[index].startswith('-a'): dont_do_python_api_test = True index += 1 From jingham at apple.com Wed Jan 26 13:09:39 2011 From: jingham at apple.com (Jim Ingham) Date: Wed, 26 Jan 2011 19:09:39 -0000 Subject: [Lldb-commits] [lldb] r124304 - /lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Message-ID: <20110126190939.CD1452A6C12C@llvm.org> Author: jingham Date: Wed Jan 26 13:09:39 2011 New Revision: 124304 URL: http://llvm.org/viewvc/llvm-project?rev=124304&view=rev Log: Initialize an uninitialized variable. I don't think this is ever used, but just to be sure... Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp 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=124304&r1=124303&r2=124304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Wed Jan 26 13:09:39 2011 @@ -608,6 +608,7 @@ this_dispatch.stret_return = (flags & AppleObjCVTables::eOBJC_TRAMPOLINE_STRET) == AppleObjCVTables::eOBJC_TRAMPOLINE_STRET; this_dispatch.is_super = false; + this_dispatch.is_super2 = false; this_dispatch.fixedup = DispatchFunction::eFixUpFixed; } } From jingham at apple.com Wed Jan 26 13:10:34 2011 From: jingham at apple.com (Jim Ingham) Date: Wed, 26 Jan 2011 19:10:34 -0000 Subject: [Lldb-commits] [lldb] r124305 - /lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Message-ID: <20110126191034.CBB172A6C12C@llvm.org> Author: jingham Date: Wed Jan 26 13:10:34 2011 New Revision: 124305 URL: http://llvm.org/viewvc/llvm-project?rev=124305&view=rev Log: Typo in looking up the stored address breakpoints, could cause us to look too far for breakpoints. Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=124305&r1=124304&r2=124305&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Wed Jan 26 13:10:34 2011 @@ -247,7 +247,8 @@ { lldb::addr_t current_address = m_thread.GetRegisterContext()->GetPC(); bool found_it = false; - for (size_t i = 0; i < m_addresses[i]; i++) + size_t num_addresses = m_addresses.size(); + for (size_t i = 0; i < num_addresses; i++) { if (m_addresses[i] == current_address) { From jingham at apple.com Wed Jan 26 13:13:10 2011 From: jingham at apple.com (Jim Ingham) Date: Wed, 26 Jan 2011 19:13:10 -0000 Subject: [Lldb-commits] [lldb] r124306 - /lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Message-ID: <20110126191310.6595E2A6C12C@llvm.org> Author: jingham Date: Wed Jan 26 13:13:09 2011 New Revision: 124306 URL: http://llvm.org/viewvc/llvm-project?rev=124306&view=rev Log: Make sure that if a CallFunction thread plan crashes while running in the "run to address" mode, and it is an auto-discard thread plan, the plan stack unwinds properly. Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=124306&r1=124305&r2=124306&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Jan 26 13:13:09 2011 @@ -149,6 +149,7 @@ ClearBreakpoints(); if (log && log->GetVerbose()) ReportRegisterState ("Restoring thread state after function call. Restored register state:"); + } else { @@ -236,7 +237,10 @@ else { // If the subplan is running, any crashes are attributable to us. - return (m_subplan_sp.get() != NULL); + // If we want to discard the plan, then we say we explain the stop + // but if we are going to be discarded, let whoever is above us + // explain the stop. + return ((m_subplan_sp.get() != NULL) && !OkayToDiscard()); } } From johnny.chen at apple.com Wed Jan 26 17:14:33 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 26 Jan 2011 23:14:33 -0000 Subject: [Lldb-commits] [lldb] r124333 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110126231433.D0AF92A6C12C@llvm.org> Author: johnny Date: Wed Jan 26 17:14:33 2011 New Revision: 124333 URL: http://llvm.org/viewvc/llvm-project?rev=124333&view=rev Log: Add emulate_vpush (stores multiple consecutive extension registers to the stack) entries to both the g_arm_opcodes and g_thumb_opcodes tables. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124333&r1=124332&r2=124333&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Wed Jan 26 17:14:33 2011 @@ -203,7 +203,7 @@ EncodingSpecificOperations(); (result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ???1???); if d == 15 then // Can only occur for ARM encoding - ALUWritePC(result); // setflags is always FALSE here + ALUWritePC(result); // setflags is always FALSE here else R[d] = result; if setflags then @@ -327,6 +327,99 @@ return true; } +static bool +emulate_vpush (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(13); + address = SP - imm32; + SP = SP - imm32; + if single_regs then + for r = 0 to regs-1 + MemA[address,4] = S[d+r]; address = address+4; + else + for r = 0 to regs-1 + // Store as two word-aligned words in the correct order for current endianness. + MemA[address,4] = if BigEndian() then D[d+r]<63:32> else D[d+r]<31:0>; + MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else D[d+r]<63:32>; + address = address+8; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const uint32_t addr_byte_size = emulator->GetAddressByteSize(); + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + bool single_regs; + uint32_t d; // UInt(Vd:D) starting register + uint32_t imm32; // stack offset + uint32_t regs; // number of registers + switch (encoding) { + case eEncodingT1: + case eEncodingA1: + single_regs = false; + d = Bits32(opcode, 15, 12) << 1 | Bits32(opcode, 22, 22); + imm32 = Bits32(opcode, 7, 0) * addr_byte_size; + // If UInt(imm8) is odd, see "FSTMX". + regs = Bits32(opcode, 7, 0) / 2; + // if regs == 0 || regs > 16 || (d+regs) > 32 then UNPREDICTABLE; + if (regs == 0 || regs > 16 || (d + regs) > 32) + return false; + break; + case eEncodingT2: + case eEncodingA2: + single_regs = true; + d = Bits32(opcode, 15, 12) << 1 | Bits32(opcode, 22, 22); + imm32 = Bits32(opcode, 7, 0) * addr_byte_size; + regs = Bits32(opcode, 7, 0); + // if regs == 0 || regs > 16 || (d+regs) > 32 then UNPREDICTABLE; + if (regs == 0 || regs > 16 || (d + regs) > 32) + return false; + break; + default: + return false; + } + uint32_t start_reg = single_regs ? dwarf_s0 : dwarf_d0; + uint32_t reg_byte_size = single_regs ? addr_byte_size : addr_byte_size * 2; + addr_t sp_offset = imm32; + addr_t addr = sp - sp_offset; + uint32_t i; + + EmulateInstruction::Context context = { EmulateInstruction::eContextPushRegisterOnStack, eRegisterKindDWARF, 0, 0 }; + for (i=d; iReadRegisterUnsigned(eRegisterKindDWARF, context.arg1, 0, &success); + if (!success) + return false; + if (!emulator->WriteMemoryUnsigned (context, addr, reg_value, reg_byte_size)) + return false; + addr += reg_byte_size; + } + + context.type = EmulateInstruction::eContextAdjustStackPointer; + context.arg0 = eRegisterKindGeneric; + context.arg1 = LLDB_REGNUM_GENERIC_SP; + context.arg2 = sp_offset; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, sp - sp_offset)) + return false; + } + return true; +} + static ARMOpcode g_arm_opcodes[] = { // push register(s) @@ -341,7 +434,13 @@ // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, - "str Rt, [sp, #-]!" } + "str Rt, [sp, #-]!" }, + + // vector push consecutive extension register(s) + { 0x0fbf0f00, 0x0d2d0b00, ARMv6T2|ARMv7, eEncodingA1, eSize32, emulate_vpush, + "vpush.64 "}, + { 0x0fbf0f00, 0x0d2d0a00, ARMv6T2|ARMv7, eEncodingA2, eSize32, emulate_vpush, + "vpush.32 "} }; static ARMOpcode g_thumb_opcodes[] = @@ -360,7 +459,13 @@ { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub{s}.w sp, sp, #"}, { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, - "subw sp, sp, #"} + "subw sp, sp, #"}, + + // vector push consecutive extension register(s) + { 0xffbf0f00, 0xed2d0b00, ARMv6T2|ARMv7, eEncodingT1, eSize32, emulate_vpush, + "vpush.64 "}, + { 0xffbf0f00, 0xed2d0a00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_vpush, + "vpush.32 "} }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); From gclayton at apple.com Wed Jan 26 17:47:30 2011 From: gclayton at apple.com (Greg Clayton) Date: Wed, 26 Jan 2011 23:47:30 -0000 Subject: [Lldb-commits] [lldb] r124338 - /lldb/trunk/source/Target/Process.cpp Message-ID: <20110126234730.2997F2A6C12C@llvm.org> Author: gclayton Date: Wed Jan 26 17:47:29 2011 New Revision: 124338 URL: http://llvm.org/viewvc/llvm-project?rev=124338&view=rev Log: Fixed a crasher when there is no log in Process::SetExitStatus (...). Modified: lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124338&r1=124337&r2=124338&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Wed Jan 26 17:47:29 2011 @@ -566,7 +566,8 @@ // We were already in the exited state if (m_private_state.GetValue() == eStateExited) { - log->Printf("Process::SetExitStatus () ignoring exit status because state was already set to eStateExited"); + if (log) + log->Printf("Process::SetExitStatus () ignoring exit status because state was already set to eStateExited"); return false; } From gclayton at apple.com Wed Jan 26 19:01:10 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 01:01:10 -0000 Subject: [Lldb-commits] [lldb] r124341 - in /lldb/trunk/source: API/SBTarget.cpp Interpreter/ScriptInterpreter.cpp Interpreter/ScriptInterpreterPython.cpp Message-ID: <20110127010110.8F68F2A6C12C@llvm.org> Author: gclayton Date: Wed Jan 26 19:01:10 2011 New Revision: 124341 URL: http://llvm.org/viewvc/llvm-project?rev=124341&view=rev Log: Added support for some new environment variables within LLDB to enable some extra launch options: LLDB_LAUNCH_FLAG_DISABLE_ASLR disables ASLR for all launched processes LLDB_LAUNCH_FLAG_DISABLE_STDIO will disable STDIO (reroute to "/dev/null") for all launched processes LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY will force all launched processes to be launched in new terminal windows. Also, don't init python if we never create a script interpreter. Modified: lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Interpreter/ScriptInterpreter.cpp lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=124341&r1=124340&r2=124341&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Wed Jan 26 19:01:10 2011 @@ -151,36 +151,102 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); - if (sb_process.IsValid()) + if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR")) + launch_flags |= eLaunchFlagDisableASLR; + + if ((launch_flags & eLaunchFlagLaunchInTTY) || getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY")) { - error.SetError (sb_process->Launch (argv, envp, launch_flags, stdin_path, stdout_path, stderr_path, working_directory)); - if (error.Success()) + ArchSpec arch (m_opaque_sp->GetArchitecture ()); + + Module *exe_module = m_opaque_sp->GetExecutableModule().get(); + if (exe_module) { - // We we are stopping at the entry point, we can return now! - if (stop_at_entry) - return sb_process; - - // Make sure we are stopped at the entry - StateType state = sb_process->WaitForProcessToStop (NULL); - if (state == eStateStopped) + char exec_file_path[PATH_MAX]; + exe_module->GetFileSpec().GetPath(exec_file_path, sizeof(exec_file_path)); + if (exe_module->GetFileSpec().Exists()) { - // resume the process to skip the entry point - error.SetError (sb_process->Resume()); - if (error.Success()) + // Make a new argument vector + std::vector exec_path_plus_argv; + // Append the resolved executable path + exec_path_plus_argv.push_back (exec_file_path); + + // Push all args if there are any + if (argv) { - // If we are doing synchronous mode, then wait for the - // process to stop yet again! - if (m_opaque_sp->GetDebugger().GetAsyncExecution () == false) - sb_process->WaitForProcessToStop (NULL); + for (int i = 0; argv[i]; ++i) + exec_path_plus_argv.push_back(argv[i]); + } + + // Push a NULL to terminate the args. + exec_path_plus_argv.push_back(NULL); + + + lldb::pid_t pid = Host::LaunchInNewTerminal (NULL, + &exec_path_plus_argv[0], + envp, + working_directory, + &arch, + true, + launch_flags & eLaunchFlagDisableASLR); + + if (pid != LLDB_INVALID_PROCESS_ID) + { + sb_process = AttachToProcessWithID(pid, error); + } + else + { + error.SetErrorStringWithFormat("failed to launch process in terminal"); } } + else + { + error.SetErrorStringWithFormat("executable doesn't exist: \"%s\"", exec_file_path); + } + } + else + { + error.SetErrorStringWithFormat("invalid executable"); } } else { - error.SetErrorString ("unable to create lldb_private::Process"); + sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); + + if (sb_process.IsValid()) + { + + if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO")) + launch_flags |= eLaunchFlagDisableSTDIO; + + + error.SetError (sb_process->Launch (argv, envp, launch_flags, stdin_path, stdout_path, stderr_path, working_directory)); + if (error.Success()) + { + // We we are stopping at the entry point, we can return now! + if (stop_at_entry) + return sb_process; + + // Make sure we are stopped at the entry + StateType state = sb_process->WaitForProcessToStop (NULL); + if (state == eStateStopped) + { + // resume the process to skip the entry point + error.SetError (sb_process->Resume()); + if (error.Success()) + { + // If we are doing synchronous mode, then wait for the + // process to stop yet again! + if (m_opaque_sp->GetDebugger().GetAsyncExecution () == false) + sb_process->WaitForProcessToStop (NULL); + } + } + } + } + else + { + error.SetErrorString ("unable to create lldb_private::Process"); + } } } else Modified: lldb/trunk/source/Interpreter/ScriptInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreter.cpp?rev=124341&r1=124340&r2=124341&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreter.cpp Wed Jan 26 19:01:10 2011 @@ -93,12 +93,12 @@ void ScriptInterpreter::Initialize () { - ScriptInterpreterPython::Initialize (); +// ScriptInterpreterPython::Initialize (); } void ScriptInterpreter::Terminate () { - ScriptInterpreterPython::Terminate (); +// ScriptInterpreterPython::Terminate (); } Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=124341&r1=124340&r2=124341&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Jan 26 19:01:10 2011 @@ -224,6 +224,14 @@ m_valid_session (true) { + static int g_initialized = false; + + if (!g_initialized) + { + g_initialized = true; + ScriptInterpreterPython::Initialize (); + } + bool safe_to_run = false; bool need_to_release_lock = true; int interval = 5; // Number of seconds to try getting the Python lock before timing out. From scallanan at apple.com Wed Jan 26 19:07:04 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 27 Jan 2011 01:07:04 -0000 Subject: [Lldb-commits] [lldb] r124342 - in /lldb/trunk: include/lldb/Expression/IRForTarget.h source/Expression/ClangExpressionParser.cpp source/Expression/IRForTarget.cpp Message-ID: <20110127010704.700C02A6C12C@llvm.org> Author: spyffe Date: Wed Jan 26 19:07:04 2011 New Revision: 124342 URL: http://llvm.org/viewvc/llvm-project?rev=124342&view=rev Log: Added error reporting to IRForTarget so that the user doesn't have to enable logging to see where something went wrong. Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=124342&r1=124341&r2=124342&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/IRForTarget.h (original) +++ lldb/trunk/include/lldb/Expression/IRForTarget.h Wed Jan 26 19:07:04 2011 @@ -12,6 +12,7 @@ #include "lldb/lldb-include.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/Stream.h" #include "lldb/Symbol/TaggedASTType.h" #include "llvm/Pass.h" @@ -55,17 +56,27 @@ /// for use in looking up globals and allocating the argument /// struct. See the documentation for ClangExpressionDeclMap. /// - /// @param[in] func_name - /// The name of the function to prepare for execution in the target. - /// /// @param[in] resolve_vars /// True if the external variable references (including persistent /// variables) should be resolved. If not, only external functions /// are resolved. + /// + /// @param[in] const_result + /// If non-NULL, a shared pointer to a ClangExpressionVariable that + /// is populated with the statically-computed result of the function, + /// if it has no side-effects and the result can be computed + /// statically. + /// + /// @param[in] error_stream + /// If non-NULL, a stream on which errors can be printed. + /// + /// @param[in] func_name + /// The name of the function to prepare for execution in the target. //------------------------------------------------------------------ IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map, bool resolve_vars, lldb::ClangExpressionVariableSP *const_result, + lldb_private::Stream *error_stream, const char* func_name = "$__lldb_expr"); //------------------------------------------------------------------ @@ -466,6 +477,7 @@ llvm::Constant *m_CFStringCreateWithBytes; ///< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type llvm::Constant *m_sel_registerName; ///< The address of the function sel_registerName, cast to the appropriate function pointer type lldb::ClangExpressionVariableSP *m_const_result; ///< If non-NULL, this value should be set to the return value of the expression if it is constant and the expression has no side effects + lldb_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed bool m_has_side_effects; ///< True if the function's result cannot be simply determined statically bool m_result_is_pointer; ///< True if the function's result in the AST is a pointer (see comments in ASTResultSynthesizer::SynthesizeBodyResult) Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=124342&r1=124341&r2=124342&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Wed Jan 26 19:07:04 2011 @@ -11,6 +11,7 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/Debugger.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamString.h" @@ -467,9 +468,15 @@ if (decl_map) { + Stream *error_stream = NULL; + + if (exe_ctx.target) + error_stream = &exe_ctx.target->GetDebugger().GetErrorStream(); + IRForTarget ir_for_target(decl_map, m_expr.NeedsVariableResolution(), const_result, + error_stream, function_name.c_str()); if (!ir_for_target.runOnModule(*module)) Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=124342&r1=124341&r2=124342&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Jan 26 19:07:04 2011 @@ -35,6 +35,7 @@ IRForTarget::IRForTarget (lldb_private::ClangExpressionDeclMap *decl_map, bool resolve_vars, lldb::ClangExpressionVariableSP *const_result, + lldb_private::Stream *error_stream, const char *func_name) : ModulePass(ID), m_decl_map(decl_map), @@ -44,7 +45,8 @@ m_resolve_vars(resolve_vars), m_const_result(const_result), m_has_side_effects(false), - m_result_is_pointer(false) + m_result_is_pointer(false), + m_error_stream(error_stream) { } @@ -189,6 +191,9 @@ if (log) log->PutCString("Result variable had no data"); + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Result variable's name (%s) exists, but not its definition\n", result_name); + return false; } @@ -201,6 +206,10 @@ { if (log) log->PutCString("Result variable isn't a GlobalVariable"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Result variable (%s) is defined, but is not a global variable\n", result_name); + return false; } @@ -213,6 +222,9 @@ if (log) log->PutCString("No global metadata"); + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: No metadata\n"); + return false; } @@ -238,6 +250,10 @@ { if (log) log->PutCString("Couldn't find result metadata"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Result variable (%s) is a global variable, but has no metadata\n", result_name); + return false; } @@ -262,6 +278,10 @@ { if (log) log->PutCString("Expected result to have pointer type, but it did not"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Lvalue result (%s) is not a pointer variable\n", result_name); + return false; } @@ -335,6 +355,10 @@ { if (log) log->Printf("Couldn't find initializer for unused variable"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Result variable (%s) has no writes and no initializer\n", result_name); + return false; } @@ -412,6 +436,9 @@ if (log) log->PutCString("Couldn't find CFStringCreateWithBytes in the target"); + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Rewriting an Objective-C constant string requires CFStringCreateWithBytes\n"); + return false; } @@ -478,6 +505,9 @@ if (log) log->PutCString("Couldn't replace the NSString with the result of the call"); + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Couldn't replace an Objective-C constant string with a dynamic string\n"); + return false; } @@ -501,6 +531,9 @@ if (log) log->PutCString("Couldn't find first instruction for rewritten Objective-C strings"); + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't find the location for calls to CFStringCreateWithBytes\n"); + return false; } @@ -518,6 +551,10 @@ { if (log) log->PutCString("NSString variable is not a GlobalVariable"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string is not a global variable\n"); + return false; } @@ -525,6 +562,10 @@ { if (log) log->PutCString("NSString variable does not have an initializer"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string does not have an initializer\n"); + return false; } @@ -534,6 +575,10 @@ { if (log) log->PutCString("NSString variable's initializer is not a ConstantStruct"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string is not a structure constant\n"); + return false; } @@ -550,6 +595,10 @@ { if (log) log->Printf("NSString variable's initializer structure has an unexpected number of members. Should be 4, is %d", nsstring_struct->getNumOperands()); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: The struct for an Objective-C constant string is not as expected\n"); + return false; } @@ -559,6 +608,10 @@ { if (log) log->PutCString("NSString initializer's str element was empty"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string does not have a string initializer\n"); + return false; } @@ -568,6 +621,10 @@ { if (log) log->PutCString("NSString initializer's str element is not a ConstantExpr"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer is not constant\n"); + return false; } @@ -575,6 +632,10 @@ { if (log) log->Printf("NSString initializer's str element is not a GetElementPtr expression, it's a %s", nsstring_expr->getOpcodeName()); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer is not an array\n"); + return false; } @@ -586,6 +647,9 @@ { if (log) log->PutCString("NSString initializer's str element is not a GlobalVariable"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer doesn't point to a global\n"); return false; } @@ -594,6 +658,10 @@ { if (log) log->PutCString("NSString initializer's str element does not have an initializer"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer doesn't point to initialized data\n"); + return false; } @@ -603,6 +671,10 @@ { if (log) log->PutCString("NSString initializer's str element is not a ConstantArray"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer doesn't point to an array\n"); + return false; } @@ -610,6 +682,10 @@ { if (log) log->PutCString("NSString initializer's str element is not a C string array"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: An Objective-C constant string's string initializer doesn't point to a C string\n"); + return false; } @@ -617,13 +693,14 @@ log->Printf("Found NSString constant %s, which contains \"%s\"", vi->first(), cstr_array->getAsString().c_str()); if (!RewriteObjCConstString(llvm_module, nsstring_global, cstr_global, FirstEntryInstruction)) - { + { if (log) log->PutCString("Error rewriting the constant string"); + + // We don't print an error message here because RewriteObjCConstString has done so for us. + return false; } - - } } @@ -639,6 +716,10 @@ { if (log) log->PutCString("__CFConstantStringClassReference is not a global variable"); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Found a CFConstantStringClassReference, but it is not a global object\n"); + return false; } @@ -661,6 +742,7 @@ return true; } +// This function does not report errors; its callers are responsible. bool IRForTarget::RewriteObjCSelector (Instruction* selector_load, Module &llvm_module) { @@ -803,8 +885,12 @@ { if (!RewriteObjCSelector(*iter, llvm_module)) { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't change a static reference to an Objective-C selector to a dynamic reference\n"); + if(log) log->PutCString("Couldn't rewrite a reference to an Objective-C selector"); + return false; } } @@ -812,6 +898,7 @@ return true; } +// This function does not report errors; its callers are responsible. bool IRForTarget::RewritePersistentAlloc (llvm::Instruction *persistent_alloc, llvm::Module &llvm_module) @@ -912,6 +999,9 @@ if (log) log->Printf("Rejecting a numeric persistent variable."); + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Names starting with $0, $1, ... are reserved for use as result names\n"); + return false; } @@ -928,8 +1018,12 @@ { if (!RewritePersistentAlloc(*iter, llvm_module)) { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite the creation of a persistent variable\n"); + if(log) log->PutCString("Couldn't rewrite the creation of a persistent variable"); + return false; } } @@ -976,6 +1070,7 @@ return NULL; } +// This function does not report errors; its callers are responsible. bool IRForTarget::MaybeHandleVariable (Module &llvm_module, Value *llvm_value_ptr) { @@ -1011,6 +1106,7 @@ if (log) log->Printf("Found global variable \"%s\" without metadata", global_variable->getName().str().c_str()); + return false; } @@ -1083,6 +1179,7 @@ return true; } +// This function does not report errors; its callers are responsible. bool IRForTarget::HandleSymbol (Module &llvm_module, Value *symbol) @@ -1133,8 +1230,13 @@ op_index < num_ops; ++op_index) if (!MaybeHandleVariable(llvm_module, Old->getArgOperand(op_index))) // conservatively believe that this is a store + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite one of the arguments of a function call.\n"); + return false; - + } + return true; } @@ -1156,7 +1258,12 @@ fun = dyn_cast(const_expr->getOperand(0)); if (!fun) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Called entity is a cast of something not a function\n"); + return false; + } } else if (const_expr && const_expr->getOpcode() == Instruction::IntToPtr) { @@ -1164,6 +1271,9 @@ } else { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Called entity is not a function\n"); + return false; } } @@ -1179,6 +1289,10 @@ default: if (log) log->Printf("Unresolved intrinsic \"%s\"", Intrinsic::getName(intrinsic_id).c_str()); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Call to unhandled compiler intrinsic '%s'\n", Intrinsic::getName(intrinsic_id).c_str()); + return false; case Intrinsic::memcpy: { @@ -1211,6 +1325,9 @@ if (log) log->Printf("Function \"%s\" had no address", str.GetCString()); + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Call to a function '%s' that is not present in the target\n", str.GetCString()); + return false; } } @@ -1221,6 +1338,11 @@ { if (log) log->Printf ("Metadataless function \"%s\" had no address", str.GetCString()); + + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Call to a symbol-only function '%s' that is not present in the target\n", str.GetCString()); + + return false; } } @@ -1278,9 +1400,11 @@ CallInst *call = dyn_cast(&inst); + // MaybeHandleCall handles error reporting; we are silent here if (call && !MaybeHandleCall(llvm_module, call)) return false; + // MaybeHandleCallArguments handles error reporting; we are silent here if (call && !MaybeHandleCallArguments(llvm_module, call)) return false; } @@ -1305,12 +1429,22 @@ if ((*global).getName().str().find("OBJC_IVAR") == 0) { if (!HandleSymbol(llvm_module, global)) + { + if (m_error_stream) + m_error_stream->Printf("Error [IRForTarget]: Couldn't find Objective-C indirect ivar symbol %s\n", (*global).getName().str().c_str()); + return false; + } } else if (DeclForGlobalValue(llvm_module, global)) { if (!MaybeHandleVariable (llvm_module, global)) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite external variable %s\n", (*global).getName().str().c_str()); + return false; + } } } @@ -1415,6 +1549,7 @@ return true; } +// This function does not report errors; its callers are responsible. bool IRForTarget::UnfoldConstant(Constant *old_constant, Value *new_constant, Instruction *first_entry_inst) { @@ -1541,8 +1676,13 @@ Function::arg_iterator iter(llvm_function.getArgumentList().begin()); if (iter == llvm_function.getArgumentList().end()) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes no arguments (should take at least a struct pointer)"); + return false; - + } + Argument *argument = iter; if (argument->getName().equals("this")) @@ -1550,7 +1690,12 @@ ++iter; if (iter == llvm_function.getArgumentList().end()) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes only 'this' argument (should take a struct pointer too)"); + return false; + } argument = iter; } @@ -1559,22 +1704,42 @@ ++iter; if (iter == llvm_function.getArgumentList().end()) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes only 'self' argument (should take '_cmd' and a struct pointer too)"); + return false; + } if (!iter->getName().equals("_cmd")) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes '%s' after 'self' argument (should take '_cmd')", iter->getName().str().c_str()); + return false; + } ++iter; if (iter == llvm_function.getArgumentList().end()) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes only 'self' and '_cmd' arguments (should take a struct pointer too)"); + return false; + } argument = iter; } if (!argument->getName().equals("$__lldb_arg")) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Wrapper takes an argument named '%s' instead of the struct pointer", argument->getName().str().c_str()); + return false; - + } + if (log) log->Printf("Arg: \"%s\"", PrintValue(argument).c_str()); @@ -1582,13 +1747,23 @@ Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg()); if (!FirstEntryInstruction) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't find the first instruction in the wrapper for use in rewriting"); + return false; + } LLVMContext &context(llvm_module.getContext()); const IntegerType *offset_type(Type::getInt32Ty(context)); if (!offset_type) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't produce an offset type"); + return false; + } for (element_index = 0; element_index < num_elements; ++element_index) { @@ -1598,8 +1773,13 @@ lldb_private::ConstString name; if (!m_decl_map->GetStructElement (decl, value, offset, name, element_index)) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Structure information is incomplete"); + return false; - + } + if (log) log->Printf(" \"%s\" [\"%s\"] (\"%s\") placed at %d", value->getName().str().c_str(), @@ -1656,6 +1836,9 @@ { if (log) log->Printf("Couldn't find \"%s()\" in the module", m_func_name.c_str()); + + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't find wrapper '%s' in the mdoule", m_func_name.c_str()); return false; } @@ -1672,6 +1855,9 @@ { if (log) log->Printf("CreateResultVariable() failed"); + + // CreateResultVariable() reports its own errors, so we don't do so here + return false; } @@ -1683,6 +1869,9 @@ { if (log) log->Printf("RewriteObjCConstStrings() failed"); + + // RewriteObjCConstStrings() reports its own errors, so we don't do so here + return false; } @@ -1698,6 +1887,9 @@ { if (log) log->Printf("RemoveGuards() failed"); + + // RemoveGuards() reports its own errors, so we don't do so here + return false; } @@ -1705,6 +1897,9 @@ { if (log) log->Printf("RewritePersistentAllocs() failed"); + + // RewritePersistentAllocs() reports its own errors, so we don't do so here + return false; } @@ -1712,6 +1907,9 @@ { if (log) log->Printf("RewriteObjCSelectors() failed"); + + // RewriteObjCSelectors() reports its own errors, so we don't do so here + return false; } @@ -1719,6 +1917,9 @@ { if (log) log->Printf("ResolveCalls() failed"); + + // ResolveCalls() reports its own errors, so we don't do so here + return false; } } @@ -1731,6 +1932,9 @@ { if (log) log->Printf("ResolveExternals() failed"); + + // ResolveExternals() reports its own errors, so we don't do so here + return false; } @@ -1738,6 +1942,9 @@ { if (log) log->Printf("ReplaceVariables() failed"); + + // ReplaceVariables() reports its own errors, so we don't do so here + return false; } From johnny.chen at apple.com Wed Jan 26 19:26:19 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 27 Jan 2011 01:26:19 -0000 Subject: [Lldb-commits] [lldb] r124343 - in /lldb/trunk/source/Plugins/Process/Utility: EmulateInstruction.h EmulateInstructionARM.cpp Message-ID: <20110127012619.7E3112A6C12C@llvm.org> Author: johnny Date: Wed Jan 26 19:26:19 2011 New Revision: 124343 URL: http://llvm.org/viewvc/llvm-project?rev=124343&view=rev Log: Add emulate_add_rd_sp_imm (SP plus immediate) to the g_arm_opcodes and g_thumb_opcodes tables. Change the data type of Context.arg2 to int64_t due to possible negative values. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124343&r1=124342&r2=124343&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Wed Jan 26 19:26:19 2011 @@ -30,9 +30,9 @@ struct Context { ContextType type; - lldb::addr_t arg0; - lldb::addr_t arg1; - lldb::addr_t arg2; + lldb::addr_t arg0; // Register kind. + lldb::addr_t arg1; // Register spec. + int64_t arg2; // Possible negative value. }; union Opcode Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124343&r1=124342&r2=124343&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Wed Jan 26 19:26:19 2011 @@ -192,6 +192,67 @@ return true; } +// Adjust r7 or ip to point to saved value residing within the stack. +// ADD (SP plus immediate) +static bool +emulate_add_rd_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + (result, carry, overflow) = AddWithCarry(SP, imm32, ???0???); + if d == 15 then + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + APSR.C = carry; + APSR.V = overflow; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t Rd; // the destination register + uint32_t imm32; + switch (encoding) { + case eEncodingT1: + Rd = 7; + imm32 = Bits32(opcode, 7, 0) << 2; // imm32 = ZeroExtend(imm8:'00', 32) + break; + case eEncodingA1: + Rd = Bits32(opcode, 15, 12); + imm32 = ARMExpandImm(opcode); // imm32 = ARMExpandImm(imm12) + break; + default: + return false; + } + addr_t sp_offset = imm32; + addr_t addr = sp + sp_offset; // a pointer to the stack area + + EmulateInstruction::Context context = { EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_SP, + sp_offset }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, addr)) + return false; + } + return true; +} + // A sub operation to adjust the SP -- allocate space for local storage. static bool emulate_sub_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) @@ -423,49 +484,43 @@ static ARMOpcode g_arm_opcodes[] = { // push register(s) - { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, - "push ; contains more than one register" }, - { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, - "push ; contains one register, " }, + { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, "push " }, + { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, "push " }, + + // adjust r7 to point to a stack offset + { 0x0ffff000, 0x028d7000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add r7, sp, #" }, + // adjust ip to point to a stack offset + { 0x0ffff000, 0x028dc000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add ip, sp, #" }, // adjust the stack pointer - { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, - "sub sp, sp, #"}, + { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, "sub sp, sp, #"}, // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; - { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, - "str Rt, [sp, #-]!" }, + { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, "str Rt, [sp, #-]!" }, // vector push consecutive extension register(s) - { 0x0fbf0f00, 0x0d2d0b00, ARMv6T2|ARMv7, eEncodingA1, eSize32, emulate_vpush, - "vpush.64 "}, - { 0x0fbf0f00, 0x0d2d0a00, ARMv6T2|ARMv7, eEncodingA2, eSize32, emulate_vpush, - "vpush.32 "} + { 0x0fbf0f00, 0x0d2d0b00, ARMv6T2|ARMv7, eEncodingA1, eSize32, emulate_vpush, "vpush.64 "}, + { 0x0fbf0f00, 0x0d2d0a00, ARMv6T2|ARMv7, eEncodingA2, eSize32, emulate_vpush, "vpush.32 "} }; static ARMOpcode g_thumb_opcodes[] = { // push register(s) - { 0xfffffe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, - "push " }, - { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, - "push.w ; contains more than one register" }, - { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, - "push.w ; contains one register, " }, + { 0xfffffe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, "push " }, + { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w " }, + { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w " }, + + // adjust r7 to point to a stack offset + { 0xffffff00, 0x000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #" }, // adjust the stack pointer - { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, - "sub{s} sp, sp, #"}, - { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, - "sub{s}.w sp, sp, #"}, - { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, - "subw sp, sp, #"}, + { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "sub{s} sp, sp, #"}, + { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub{s}.w sp, sp, #"}, + { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, "subw sp, sp, #"}, // vector push consecutive extension register(s) - { 0xffbf0f00, 0xed2d0b00, ARMv6T2|ARMv7, eEncodingT1, eSize32, emulate_vpush, - "vpush.64 "}, - { 0xffbf0f00, 0xed2d0a00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_vpush, - "vpush.32 "} + { 0xffbf0f00, 0xed2d0b00, ARMv6T2|ARMv7, eEncodingT1, eSize32, emulate_vpush, "vpush.64 "}, + { 0xffbf0f00, 0xed2d0a00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_vpush, "vpush.32 "} }; static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); From johnny.chen at apple.com Wed Jan 26 20:58:54 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 27 Jan 2011 02:58:54 -0000 Subject: [Lldb-commits] [lldb] r124353 - in /lldb/trunk/test: lldbtest.py plugins/darwin.py Message-ID: <20110127025854.A18602A6C12C@llvm.org> Author: johnny Date: Wed Jan 26 20:58:54 2011 New Revision: 124353 URL: http://llvm.org/viewvc/llvm-project?rev=124353&view=rev Log: Some cleanup to plugins/darwin.py after the recent additions of '-A arch' and '-C compiler' command line options to the test driver. Replace TestBase.getRunSpec() with TestBase.getRunOptions(). Modified: lldb/trunk/test/lldbtest.py lldb/trunk/test/plugins/darwin.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=124353&r1=124352&r2=124353&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Wed Jan 26 20:58:54 2011 @@ -625,7 +625,7 @@ print >> f, "Session info generated @", datetime.datetime.now().ctime() print >> f, self.session.getvalue() print >> f, "To rerun this test, issue the following command from the 'test' directory:\n" - print >> f, "%s ./dotest.py -v -t -f %s.%s" % (self.getRunSpec(), + print >> f, "./dotest.py %s -v -t -f %s.%s" % (self.getRunOptions(), self.__class__.__name__, self._testMethodName) @@ -855,16 +855,27 @@ # End of while loop. + def getArchitecture(self): + """Returns the architecture in effect the test suite is now running with.""" + module = __import__(sys.platform) + return module.getArchitecture() + def getCompiler(self): """Returns the compiler in effect the test suite is now running with.""" module = __import__(sys.platform) return module.getCompiler() - def getRunSpec(self): - """Environment variable spec to run this test again, invoked from within - dumpSessionInfo().""" + def getRunOptions(self): + """Command line option for -A and -C to run this test again, called from + within dumpSessionInfo().""" module = __import__(sys.platform) - return module.getRunSpec() + arch = self.getArchitecture() + comp = self.getCompiler() + if not arch and not comp: + return "" + else: + return "%s %s" % ("-A "+arch if arch else "", + "-C "+comp if comp else "") def buildDefault(self, architecture=None, compiler=None, dictionary=None): """Platform specific way to build the default binaries.""" Modified: lldb/trunk/test/plugins/darwin.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/darwin.py?rev=124353&r1=124352&r2=124353&view=diff ============================================================================== --- lldb/trunk/test/plugins/darwin.py (original) +++ lldb/trunk/test/plugins/darwin.py Wed Jan 26 20:58:54 2011 @@ -17,15 +17,14 @@ #print "Hello, darwin plugin!" +def getArchitecture(): + """Returns the architecture in effect the test suite is now running with.""" + return os.environ["ARCH"] if "ARCH" in os.environ else "" + def getCompiler(): """Returns the compiler in effect the test suite is now running with.""" return os.environ["CC"] if "CC" in os.environ else "" -def getRunSpec(): - """Environment variable spec to run this test again, invoked from within - dumpSessionInfo().""" - return "%s%s" % (getArchSpec(None), getCCSpec(None)) - def getArchSpec(architecture): """ Helper function to return the key-value string to specify the architecture From scallanan at apple.com Wed Jan 26 22:42:51 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 27 Jan 2011 04:42:51 -0000 Subject: [Lldb-commits] [lldb] r124355 - in /lldb/trunk: llvm.zip scripts/build-llvm.pl source/Expression/ASTResultSynthesizer.cpp source/Expression/ClangASTSource.cpp source/Expression/IRForTarget.cpp source/Symbol/ClangASTContext.cpp source/Symbol/ClangASTType.cpp source/Symbol/Function.cpp Message-ID: <20110127044251.B5E962A6C12C@llvm.org> Author: spyffe Date: Wed Jan 26 22:42:51 2011 New Revision: 124355 URL: http://llvm.org/viewvc/llvm-project?rev=124355&view=rev Log: Updated Clang to a version that supports propagating the "virtual" flag when importing a C++ function declaration. Made changes to LLDB to support other changes in Clang. Modified: lldb/trunk/llvm.zip lldb/trunk/scripts/build-llvm.pl lldb/trunk/source/Expression/ASTResultSynthesizer.cpp lldb/trunk/source/Expression/ClangASTSource.cpp lldb/trunk/source/Expression/IRForTarget.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/ClangASTType.cpp lldb/trunk/source/Symbol/Function.cpp Modified: lldb/trunk/llvm.zip URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== Binary files - no diff available. Modified: lldb/trunk/scripts/build-llvm.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/scripts/build-llvm.pl (original) +++ lldb/trunk/scripts/build-llvm.pl Wed Jan 26 22:42:51 2011 @@ -25,7 +25,7 @@ our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; -our $llvm_revision = "123723"; +our $llvm_revision = "124349"; our $llvm_source_dir = "$ENV{SRCROOT}"; our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2"; our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2"; Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original) +++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Wed Jan 26 22:42:51 2011 @@ -290,7 +290,7 @@ (last_expr->getObjectKind() == OK_Ordinary); QualType expr_qual_type = last_expr->getType(); - clang::Type *expr_type = expr_qual_type.getTypePtr(); + const clang::Type *expr_type = expr_qual_type.getTypePtr(); if (!expr_type) return false; Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Jan 26 22:42:51 2011 @@ -244,7 +244,7 @@ { QualType qual_type = QualType::getFromOpaquePtr(type); - if (TagType *tag_type = dyn_cast(qual_type)) + if (const TagType *tag_type = dyn_cast(qual_type)) { TagDecl *tag_decl = tag_type->getDecl(); @@ -252,7 +252,7 @@ return tag_decl; } - else if (ObjCObjectType *objc_object_type = dyn_cast(qual_type)) + else if (const ObjCObjectType *objc_object_type = dyn_cast(qual_type)) { ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface(); Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Jan 26 22:42:51 2011 @@ -271,8 +271,8 @@ if (m_result_is_pointer) { clang::QualType pointer_qual_type = result_decl->getType(); - clang::Type *pointer_type = pointer_qual_type.getTypePtr(); - clang::PointerType *pointer_pointertype = dyn_cast(pointer_type); + const clang::Type *pointer_type = pointer_qual_type.getTypePtr(); + const clang::PointerType *pointer_pointertype = dyn_cast(pointer_type); if (!pointer_pointertype) { @@ -1252,6 +1252,7 @@ Value *val = llvm_call_inst->getCalledValue(); ConstantExpr *const_expr = dyn_cast(val); + LoadInst *load_inst = dyn_cast(val); if (const_expr && const_expr->getOpcode() == Instruction::BitCast) { @@ -1269,6 +1270,10 @@ { return true; // already resolved } + else if (load_inst) + { + return true; // virtual method call + } else { if (m_error_stream) Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Jan 26 22:42:51 2011 @@ -75,7 +75,7 @@ case clang::Type::Record: case clang::Type::Enum: { - clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); + const clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); if (tag_type) { clang::TagDecl *tag_decl = tag_type->getDecl(); @@ -103,7 +103,7 @@ case clang::Type::ObjCObject: case clang::Type::ObjCInterface: { - clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type); + const clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type); if (objc_class_type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); @@ -1078,7 +1078,7 @@ case clang::Type::ObjCObject: case clang::Type::ObjCInterface: { - ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); + const ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { @@ -1357,12 +1357,12 @@ const bool is_implicitly_declared = false; - clang::FunctionType *function_Type = dyn_cast(method_qual_type.getTypePtr()); + const clang::FunctionType *function_Type = dyn_cast(method_qual_type.getTypePtr()); if (function_Type == NULL) return NULL; - FunctionProtoType *method_function_prototype (dyn_cast(function_Type)); + const FunctionProtoType *method_function_prototype (dyn_cast(function_Type)); if (!method_function_prototype) return NULL; @@ -1494,7 +1494,7 @@ QualType record_qual_type(QualType::getFromOpaquePtr(record_clang_type)); - clang::Type *clang_type = record_qual_type.getTypePtr(); + const clang::Type *clang_type = record_qual_type.getTypePtr(); if (clang_type) { const RecordType *record_type = dyn_cast(clang_type); @@ -1527,7 +1527,7 @@ } else { - ObjCObjectType *objc_class_type = dyn_cast(clang_type); + const ObjCObjectType *objc_class_type = dyn_cast(clang_type); if (objc_class_type) { bool is_synthesized = false; @@ -1610,7 +1610,7 @@ { QualType qual_type(QualType::getFromOpaquePtr(clang_type)); - RecordType *record_type = dyn_cast(qual_type.getTypePtr()); + const RecordType *record_type = dyn_cast(qual_type.getTypePtr()); if (record_type) { RecordDecl *record_decl = record_type->getDecl(); @@ -1710,12 +1710,12 @@ { QualType class_qual_type(QualType::getFromOpaquePtr(class_opaque_type)); QualType super_qual_type(QualType::getFromOpaquePtr(super_opaque_type)); - clang::Type *class_type = class_qual_type.getTypePtr(); - clang::Type *super_type = super_qual_type.getTypePtr(); + const clang::Type *class_type = class_qual_type.getTypePtr(); + const clang::Type *super_type = super_qual_type.getTypePtr(); if (class_type && super_type) { - ObjCObjectType *objc_class_type = dyn_cast(class_type); - ObjCObjectType *objc_super_type = dyn_cast(super_type); + const ObjCObjectType *objc_class_type = dyn_cast(class_type); + const ObjCObjectType *objc_super_type = dyn_cast(super_type); if (objc_class_type && objc_super_type) { ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); @@ -1754,10 +1754,10 @@ QualType class_qual_type(QualType::getFromOpaquePtr(class_opaque_type)); - clang::Type *class_type = class_qual_type.getTypePtr(); + const clang::Type *class_type = class_qual_type.getTypePtr(); if (class_type) { - ObjCObjectType *objc_class_type = dyn_cast(class_type); + const ObjCObjectType *objc_class_type = dyn_cast(class_type); if (objc_class_type) { @@ -1799,10 +1799,10 @@ { QualType class_qual_type(QualType::getFromOpaquePtr(class_opaque_type)); - clang::Type *class_type = class_qual_type.getTypePtr(); + const clang::Type *class_type = class_qual_type.getTypePtr(); if (class_type) { - ObjCObjectType *objc_class_type = dyn_cast(class_type); + const ObjCObjectType *objc_class_type = dyn_cast(class_type); if (objc_class_type) return ObjCDeclHasIVars (objc_class_type->getInterface(), check_superclass); @@ -1846,11 +1846,11 @@ QualType class_qual_type(QualType::getFromOpaquePtr(class_opaque_type)); - clang::Type *class_type = class_qual_type.getTypePtr(); + const clang::Type *class_type = class_qual_type.getTypePtr(); if (class_type == NULL) return NULL; - ObjCObjectType *objc_class_type = dyn_cast(class_type); + const ObjCObjectType *objc_class_type = dyn_cast(class_type); if (objc_class_type == NULL) return NULL; @@ -1897,12 +1897,12 @@ QualType method_qual_type (QualType::getFromOpaquePtr (method_opaque_type)); // Populate the method decl with parameter decls - clang::Type *method_type(method_qual_type.getTypePtr()); + const clang::Type *method_type(method_qual_type.getTypePtr()); if (method_type == NULL) return NULL; - FunctionProtoType *method_function_prototype (dyn_cast(method_type)); + const FunctionProtoType *method_function_prototype (dyn_cast(method_type)); if (!method_function_prototype) return NULL; @@ -2175,7 +2175,7 @@ case clang::Type::ObjCInterface: if (GetCompleteQualType (ast, qual_type)) { - ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); + const ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { @@ -2204,7 +2204,7 @@ case clang::Type::ObjCObjectPointer: { - ObjCObjectPointerType *pointer_type = cast(qual_type.getTypePtr()); + const ObjCObjectPointerType *pointer_type = cast(qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); uint32_t num_pointee_children = ClangASTContext::GetNumChildren (ast, pointee_type.getAsOpaquePtr(), @@ -2223,7 +2223,7 @@ case clang::Type::Pointer: { - PointerType *pointer_type = cast(qual_type.getTypePtr()); + const PointerType *pointer_type = cast(qual_type.getTypePtr()); QualType pointee_type (pointer_type->getPointeeType()); uint32_t num_pointee_children = ClangASTContext::GetNumChildren (ast, pointee_type.getAsOpaquePtr(), @@ -2242,7 +2242,7 @@ case clang::Type::LValueReference: case clang::Type::RValueReference: { - ReferenceType *reference_type = cast(qual_type.getTypePtr()); + const ReferenceType *reference_type = cast(qual_type.getTypePtr()); QualType pointee_type = reference_type->getPointeeType(); uint32_t num_pointee_children = ClangASTContext::GetNumChildren (ast, pointee_type.getAsOpaquePtr(), @@ -2533,7 +2533,7 @@ case clang::Type::ObjCInterface: if (GetCompleteQualType (ast, parent_qual_type)) { - ObjCObjectType *objc_class_type = dyn_cast(parent_qual_type.getTypePtr()); + const ObjCObjectType *objc_class_type = dyn_cast(parent_qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { @@ -2610,7 +2610,7 @@ case clang::Type::ObjCObjectPointer: { - ObjCObjectPointerType *pointer_type = cast(parent_qual_type.getTypePtr()); + const ObjCObjectPointerType *pointer_type = cast(parent_qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) @@ -2679,7 +2679,7 @@ case clang::Type::Pointer: { - PointerType *pointer_type = cast(parent_qual_type.getTypePtr()); + const PointerType *pointer_type = cast(parent_qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); // Don't dereference "void *" pointers @@ -2730,7 +2730,7 @@ case clang::Type::LValueReference: case clang::Type::RValueReference: { - ReferenceType *reference_type = cast(parent_qual_type.getTypePtr()); + const ReferenceType *reference_type = cast(parent_qual_type.getTypePtr()); QualType pointee_type(reference_type->getPointeeType()); clang_type_t pointee_clang_type = pointee_type.getAsOpaquePtr(); if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_clang_type)) @@ -3078,7 +3078,7 @@ if (GetCompleteQualType (ast, qual_type)) { StringRef name_sref(name); - ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); + const ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { @@ -3182,7 +3182,7 @@ case clang::Type::LValueReference: case clang::Type::RValueReference: { - ReferenceType *reference_type = cast(qual_type.getTypePtr()); + const ReferenceType *reference_type = cast(qual_type.getTypePtr()); QualType pointee_type = reference_type->getPointeeType(); if (ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) @@ -3198,7 +3198,7 @@ case clang::Type::Pointer: { - PointerType *pointer_type = cast(qual_type.getTypePtr()); + const PointerType *pointer_type = cast(qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); if (ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) @@ -3314,7 +3314,7 @@ if (GetCompleteQualType (ast, qual_type)) { StringRef name_sref(name); - ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); + const ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { @@ -3397,7 +3397,7 @@ case clang::Type::LValueReference: case clang::Type::RValueReference: { - ReferenceType *reference_type = cast(qual_type.getTypePtr()); + const ReferenceType *reference_type = cast(qual_type.getTypePtr()); QualType pointee_type = reference_type->getPointeeType(); if (ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) @@ -3412,7 +3412,7 @@ case clang::Type::Pointer: { - PointerType *pointer_type = cast(qual_type.getTypePtr()); + const PointerType *pointer_type = cast(qual_type.getTypePtr()); QualType pointee_type = pointer_type->getPointeeType(); if (ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr())) @@ -3464,10 +3464,10 @@ if (tag_clang_type) { QualType tag_qual_type(QualType::getFromOpaquePtr(tag_clang_type)); - clang::Type *clang_type = tag_qual_type.getTypePtr(); + const clang::Type *clang_type = tag_qual_type.getTypePtr(); if (clang_type) { - TagType *tag_type = dyn_cast(clang_type); + const TagType *tag_type = dyn_cast(clang_type); if (tag_type) { TagDecl *tag_decl = dyn_cast(tag_type->getDecl()); @@ -3661,10 +3661,10 @@ if (clang_type) { QualType qual_type (QualType::getFromOpaquePtr(clang_type)); - clang::Type *t = qual_type.getTypePtr(); + const clang::Type *t = qual_type.getTypePtr(); if (t) { - TagType *tag_type = dyn_cast(t); + const TagType *tag_type = dyn_cast(t); if (tag_type) { TagDecl *tag_decl = tag_type->getDecl(); @@ -3695,7 +3695,7 @@ return true; } - ObjCObjectType *objc_class_type = dyn_cast(qual_type); + const ObjCObjectType *objc_class_type = dyn_cast(qual_type); if (objc_class_type) { @@ -3789,7 +3789,7 @@ { QualType enum_qual_type (QualType::getFromOpaquePtr(enum_clang_type)); - clang::Type *clang_type = enum_qual_type.getTypePtr(); + const clang::Type *clang_type = enum_qual_type.getTypePtr(); if (clang_type) { const EnumType *enum_type = dyn_cast(clang_type); @@ -3824,7 +3824,7 @@ assert (identifier_table != NULL); QualType enum_qual_type (QualType::getFromOpaquePtr(enum_clang_type)); - clang::Type *clang_type = enum_qual_type.getTypePtr(); + const clang::Type *clang_type = enum_qual_type.getTypePtr(); if (clang_type) { const EnumType *enum_type = dyn_cast(clang_type); @@ -4177,7 +4177,7 @@ case clang::Type::LValueReference: case clang::Type::RValueReference: { - ReferenceType *reference_type = cast(qual_type.getTypePtr()); + const ReferenceType *reference_type = cast(qual_type.getTypePtr()); if (reference_type) return ClangASTContext::IsFunctionPointerType (reference_type->getPointeeType().getAsOpaquePtr()); } @@ -4192,7 +4192,7 @@ { if (clang_type) { - ConstantArrayType *array = cast(QualType::getFromOpaquePtr(clang_type).getTypePtr()); + const ConstantArrayType *array = cast(QualType::getFromOpaquePtr(clang_type).getTypePtr()); if (array) return array->getSize().getLimitedValue(); } Modified: lldb/trunk/source/Symbol/ClangASTType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTType.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTType.cpp Wed Jan 26 22:42:51 2011 @@ -522,7 +522,7 @@ bool is_array_of_characters = false; clang::QualType element_qual_type = array->getElementType(); - clang::Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr(); + const clang::Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr(); if (canonical_type) is_array_of_characters = canonical_type->isCharType(); @@ -898,7 +898,7 @@ ClangASTType::IsDefined (clang_type_t clang_type) { clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type)); - clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); + const clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); if (tag_type) { clang::TagDecl *tag_decl = tag_type->getDecl(); @@ -908,7 +908,7 @@ } else { - clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type); + const clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type); if (objc_class_type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); @@ -951,7 +951,7 @@ llvm::SmallVector buf; llvm::raw_svector_ostream llvm_ostrm (buf); - clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); + const clang::TagType *tag_type = dyn_cast(qual_type.getTypePtr()); if (tag_type) { clang::TagDecl *tag_decl = tag_type->getDecl(); @@ -966,7 +966,7 @@ case clang::Type::ObjCObject: case clang::Type::ObjCInterface: { - clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); + const clang::ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr()); assert (objc_class_type); if (objc_class_type) { Modified: lldb/trunk/source/Symbol/Function.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=124355&r1=124354&r2=124355&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Function.cpp (original) +++ lldb/trunk/source/Symbol/Function.cpp Wed Jan 26 22:42:51 2011 @@ -404,7 +404,7 @@ { clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType())); assert (clang_type->isFunctionType()); - clang::FunctionType *function_type = dyn_cast (clang_type); + const clang::FunctionType *function_type = dyn_cast (clang_type); clang::QualType fun_return_qualtype = function_type->getResultType(); const ConstString fun_return_name(ClangASTType::GetClangTypeName(fun_return_qualtype.getAsOpaquePtr())); @@ -484,7 +484,7 @@ const char * Function::GetArgumentNameAtIndex (size_t idx) { - clang::Type *clang_type = static_cast(GetType()->GetClangType())->getTypePtr(); + const clang::Type *clang_type = static_cast(GetType()->GetClangType())->getTypePtr(); assert (clang_type->isFunctionType()); if (!clang_type->isFunctionProtoType()) return NULL; From gclayton at apple.com Thu Jan 27 00:44:37 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 06:44:37 -0000 Subject: [Lldb-commits] [lldb] r124359 - in /lldb/trunk: include/lldb/Core/ include/lldb/Symbol/ lldb.xcodeproj/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/ Message-ID: <20110127064437.A21CE2A6C12C@llvm.org> Author: gclayton Date: Thu Jan 27 00:44:37 2011 New Revision: 124359 URL: http://llvm.org/viewvc/llvm-project?rev=124359&view=rev Log: Changed the SymbolFile::FindFunction() function calls to only return lldb_private::Function objects. Previously the SymbolFileSymtab subclass would return lldb_private::Symbol objects when it was asked to find functions. The Module::FindFunctions (...) now take a boolean "bool include_symbols" so that the module can track down functions and symbols, yet functions are found by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are gotten through the ObjectFile plug-ins. Fixed and issue where the DWARF parser might run into incomplete class member function defintions which would make clang mad when we tried to make certain member functions with invalid number of parameters (such as an operator= operator that had no parameters). Now we just avoid and don't complete these incomplete functions. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Core/ModuleList.h lldb/trunk/include/lldb/Symbol/SymbolContext.h lldb/trunk/include/lldb/Symbol/Symtab.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Commands/CommandObjectSource.cpp lldb/trunk/source/Core/AddressResolverName.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp lldb/trunk/source/Symbol/SymbolContext.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Thu Jan 27 00:44:37 2011 @@ -143,13 +143,18 @@ /// NULL otherwise. //------------------------------------------------------------------ const Symbol * - FindFirstSymbolWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); + FindFirstSymbolWithNameAndType (const ConstString &name, + lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); size_t - FindSymbolsWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type, SymbolContextList &sc_list); + FindSymbolsWithNameAndType (const ConstString &name, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list); size_t - FindSymbolsMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list); + FindSymbolsMatchingRegExAndType (const RegularExpression ®ex, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list); //------------------------------------------------------------------ /// Find functions by name. @@ -176,7 +181,11 @@ /// The number of matches added to \a sc_list. //------------------------------------------------------------------ uint32_t - FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list); + FindFunctions (const ConstString &name, + uint32_t name_type_mask, + bool symbols_ok, + bool append, + SymbolContextList& sc_list); //------------------------------------------------------------------ /// Find functions by name. @@ -197,7 +206,10 @@ /// The number of matches added to \a sc_list. //------------------------------------------------------------------ uint32_t - FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list); + FindFunctions (const RegularExpression& regex, + bool symbols_ok, + bool append, + SymbolContextList& sc_list); //------------------------------------------------------------------ /// Find global and static variables by name. @@ -223,7 +235,10 @@ /// The number of matches added to \a variable_list. //------------------------------------------------------------------ uint32_t - FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variable_list); + FindGlobalVariables (const ConstString &name, + bool append, + uint32_t max_matches, + VariableList& variable_list); //------------------------------------------------------------------ /// Find global and static variables by regular exression. @@ -248,7 +263,10 @@ /// The number of matches added to \a variable_list. //------------------------------------------------------------------ uint32_t - FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variable_list); + FindGlobalVariables (const RegularExpression& regex, + bool append, + uint32_t max_matches, + VariableList& variable_list); //------------------------------------------------------------------ /// Find types by name. @@ -284,43 +302,11 @@ /// The number of matches added to \a type_list. //------------------------------------------------------------------ uint32_t - FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types); - - //------------------------------------------------------------------ - /// Find types by name. - /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. - /// - /// @param[in] regex - /// A regular expression to use when matching the name. - /// - /// @param[in] append - /// If \b true, any matches will be appended to \a - /// variable_list, else matches replace the contents of - /// \a variable_list. - /// - /// @param[in] max_matches - /// Allow the number of matches to be limited to \a - /// max_matches. Specify UINT32_MAX to get all possible matches. - /// - /// @param[in] encoding - /// Limit the search to specific types, or get all types if - /// set to Type::invalid. - /// - /// @param[in] udt_name - /// If the encoding is a user defined type, specify the name - /// of the user defined type ("struct", "union", "class", etc). - /// - /// @param[out] type_list - /// A type list gets populated with any matches. - /// - /// @return - /// The number of matches added to \a type_list. - //------------------------------------------------------------------ -// uint32_t -// FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& type_list); + FindTypes (const SymbolContext& sc, + const ConstString &name, + bool append, + uint32_t max_matches, + TypeList& types); //------------------------------------------------------------------ /// Get const accessor for the module architecture. Modified: lldb/trunk/include/lldb/Core/ModuleList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ModuleList.h (original) +++ lldb/trunk/include/lldb/Core/ModuleList.h Thu Jan 27 00:44:37 2011 @@ -164,6 +164,7 @@ size_t FindFunctions (const ConstString &name, uint32_t name_type_mask, + bool include_symbols, bool append, SymbolContextList &sc_list); Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Thu Jan 27 00:44:37 2011 @@ -206,6 +206,7 @@ //------------------------------------------------------------------ size_t FindFunctionsByName (const ConstString &name, + bool include_symbols, bool append, SymbolContextList &sc_list) const; @@ -277,7 +278,10 @@ /// A symbol context to append to the list. //------------------------------------------------------------------ void - Append(const SymbolContext& sc); + Append (const SymbolContext& sc); + + bool + AppendIfUnique (const SymbolContext& sc); //------------------------------------------------------------------ /// Clear the object's state. Modified: lldb/trunk/include/lldb/Symbol/Symtab.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) +++ lldb/trunk/include/lldb/Symbol/Symtab.h Thu Jan 27 00:44:37 2011 @@ -24,8 +24,8 @@ { public: typedef enum Debug { - eDebugNo, // Not a debug symbol - eDebugYes, // A debug symbol + eDebugNo, // Not a debug symbol + eDebugYes, // A debug symbol eDebugAny } Debug; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jan 27 00:44:37 2011 @@ -2882,6 +2882,7 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_DEBUG, ); + GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -2912,6 +2913,7 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_RELEASE, ); + GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -3100,6 +3102,7 @@ __STDC_LIMIT_MACROS, LLDB_CONFIGURATION_BUILD_AND_INTEGRATION, ); + GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -3129,6 +3132,7 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; @@ -3222,6 +3226,7 @@ GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; @@ -3260,6 +3265,7 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Jan 27 00:44:37 2011 @@ -155,7 +155,28 @@ if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR")) launch_flags |= eLaunchFlagDisableASLR; - if ((launch_flags & eLaunchFlagLaunchInTTY) || getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY")) + static const char *g_launch_tty = NULL; + static bool g_got_launch_tty = false; + if (!g_got_launch_tty) + { + // Get the LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY only once + g_got_launch_tty = true; + g_launch_tty = ::getenv ("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY"); + if (g_launch_tty) + { + // LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY is a path to a terminal to reuse + // if the first character is '/', else it is a boolean value. + if (g_launch_tty[0] != '/') + { + if (Args::StringToBoolean(g_launch_tty, false, NULL)) + g_launch_tty = ""; + else + g_launch_tty = NULL; + } + } + } + + if ((launch_flags & eLaunchFlagLaunchInTTY) || g_launch_tty) { ArchSpec arch (m_opaque_sp->GetArchitecture ()); @@ -182,14 +203,18 @@ exec_path_plus_argv.push_back(NULL); - lldb::pid_t pid = Host::LaunchInNewTerminal (NULL, - &exec_path_plus_argv[0], - envp, - working_directory, - &arch, - true, - launch_flags & eLaunchFlagDisableASLR); - + const char *tty_name = NULL; + if (g_launch_tty && g_launch_tty[0] == '/') + tty_name = g_launch_tty; + + lldb::pid_t pid = Host::LaunchInNewTerminal (tty_name, + &exec_path_plus_argv[0], + envp, + working_directory, + &arch, + true, + launch_flags & eLaunchFlagDisableASLR); + if (pid != LLDB_INVALID_PROCESS_ID) { sb_process = AttachToProcessWithID(pid, error); Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Thu Jan 27 00:44:37 2011 @@ -155,6 +155,8 @@ return Searcher::eCallbackReturnStop; } + const bool include_symbols = false; + const bool append = false; switch (m_match_type) { case Breakpoint::Exact: @@ -162,14 +164,21 @@ { if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list); - context.module_sp->FindFunctions (m_func_name, m_func_name_type_mask, false, func_list); + context.module_sp->FindFunctions (m_func_name, + m_func_name_type_mask, + include_symbols, + append, + func_list); } break; case Breakpoint::Regexp: if (context.module_sp) { context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list); - context.module_sp->FindFunctions (m_regex, true, func_list); + context.module_sp->FindFunctions (m_regex, + include_symbols, + append, + func_list); } break; case Breakpoint::Glob: Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Jan 27 00:44:37 2011 @@ -599,35 +599,24 @@ bool complete ) { - SymbolContextList func_list; - SymbolContextList sym_list; - - if (context.module_sp != NULL) + if (context.module_sp) { - if (context.module_sp) - { - context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, lldb::eSymbolTypeCode, sym_list); - context.module_sp->FindFunctions (m_regex, true, func_list); - } + SymbolContextList sc_list; + const bool include_symbols = true; + const bool append = true; + context.module_sp->FindFunctions (m_regex, include_symbols, append, sc_list); SymbolContext sc; // Now add the functions & symbols to the list - only add if unique: - for (uint32_t i = 0; i < func_list.GetSize(); i++) + for (uint32_t i = 0; i < sc_list.GetSize(); i++) { - if (func_list.GetContextAtIndex(i, sc)) + if (sc_list.GetContextAtIndex(i, sc)) { if (sc.function) { m_match_set.insert (sc.function->GetMangled().GetDemangledName()); } - } - } - - for (uint32_t i = 0; i < sym_list.GetSize(); i++) - { - if (sym_list.GetContextAtIndex(i, sc)) - { - if (sc.symbol && sc.symbol->GetAddressRangePtr()) + else if (sc.symbol && sc.symbol->GetAddressRangePtr()) { m_match_set.insert (sc.symbol->GetMangled().GetDemangledName()); } Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Thu Jan 27 00:44:37 2011 @@ -360,33 +360,36 @@ if (module && name && name[0]) { SymbolContextList sc_list; - - SymbolVendor *symbol_vendor = module->GetSymbolVendor(); - if (symbol_vendor) + const bool include_symbols = false; + const bool append = true; + uint32_t num_matches = 0; + if (name_is_regex) + { + RegularExpression function_name_regex (name); + num_matches = module->FindFunctions (function_name_regex, + include_symbols, + append, + sc_list); + } + else { - uint32_t num_matches = 0; - if (name_is_regex) - { - RegularExpression function_name_regex (name); - num_matches = symbol_vendor->FindFunctions(function_name_regex, true, sc_list); - - } - else - { - ConstString function_name(name); - num_matches = symbol_vendor->FindFunctions(function_name, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, true, sc_list); - } + ConstString function_name (name); + num_matches = module->FindFunctions (function_name, + eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, + include_symbols, + append, + sc_list); + } - if (num_matches) - { - strm.Indent (); - strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : ""); - DumpFullpath (strm, &module->GetFileSpec(), 0); - strm.PutCString(":\n"); - DumpSymbolContextList (interpreter, strm, sc_list, true); - } - return num_matches; + if (num_matches) + { + strm.Indent (); + strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : ""); + DumpFullpath (strm, &module->GetFileSpec(), 0); + strm.PutCString(":\n"); + DumpSymbolContextList (interpreter, strm, sc_list, true); } + return num_matches; } return 0; } Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Thu Jan 27 00:44:37 2011 @@ -289,6 +289,7 @@ SymbolContextList sc_list; ConstString name(m_options.symbol_name.c_str()); + bool include_symbols = false; bool append = true; size_t num_matches = 0; @@ -302,13 +303,13 @@ { matching_modules.Clear(); target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules); - num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeBase, append, sc_list); + num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list); } } } else { - num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeBase, append, sc_list); + num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list); } SymbolContext sc; Modified: lldb/trunk/source/Core/AddressResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp (original) +++ lldb/trunk/source/Core/AddressResolverName.cpp Thu Jan 27 00:44:37 2011 @@ -102,9 +102,11 @@ return Searcher::eCallbackReturnStop; } + const bool include_symbols = false; + const bool append = false; switch (m_match_type) { - case AddressResolver::Exact: + case AddressResolver::Exact: if (context.module_sp) { context.module_sp->FindSymbolsWithNameAndType (m_func_name, @@ -112,22 +114,26 @@ sym_list); context.module_sp->FindFunctions (m_func_name, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, - false, + include_symbols, + append, func_list); } break; - case AddressResolver::Regexp: + + case AddressResolver::Regexp: if (context.module_sp) { context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list); context.module_sp->FindFunctions (m_regex, - true, + include_symbols, + append, func_list); } break; - case AddressResolver::Glob: + + case AddressResolver::Glob: if (log) log->Warning ("glob is not supported yet."); break; Modified: lldb/trunk/source/Core/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Core/Disassembler.cpp (original) +++ lldb/trunk/source/Core/Disassembler.cpp Thu Jan 27 00:44:37 2011 @@ -99,39 +99,44 @@ Stream &strm ) { - if (exe_ctx.target == NULL && name) - return false; - SymbolContextList sc_list; - - if (module) - { - if (!module->FindFunctions (name, - eFunctionNameTypeBase | - eFunctionNameTypeFull | - eFunctionNameTypeMethod | - eFunctionNameTypeSelector, - true, - sc_list)) - return false; - } - else + if (name) { - if (exe_ctx.target->GetImages().FindFunctions (name, + const bool include_symbols = true; + if (module) + { + module->FindFunctions (name, + eFunctionNameTypeBase | + eFunctionNameTypeFull | + eFunctionNameTypeMethod | + eFunctionNameTypeSelector, + include_symbols, + true, + sc_list); + } + else if (exe_ctx.target) + { + exe_ctx.target->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, + include_symbols, false, - sc_list)) - { - return Disassemble (debugger, arch, exe_ctx, sc_list, num_mixed_context_lines, show_bytes, strm); - } - else if (exe_ctx.target->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list)) - { - return Disassemble (debugger, arch, exe_ctx, sc_list, num_mixed_context_lines, show_bytes, strm); + sc_list); } } + + if (sc_list.GetSize ()) + { + return Disassemble (debugger, + arch, + exe_ctx, + sc_list, + num_mixed_context_lines, + show_bytes, + strm); + } return false; } Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Thu Jan 27 00:44:37 2011 @@ -321,21 +321,88 @@ } uint32_t -Module::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +Module::FindFunctions (const ConstString &name, + uint32_t name_type_mask, + bool include_symbols, + bool append, + SymbolContextList& sc_list) { + if (!append) + sc_list.Clear(); + + const uint32_t start_size = sc_list.GetSize(); + + // Find all the functions (not symbols, but debug information functions... SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - return symbols->FindFunctions(name, name_type_mask, append, sc_list); - return 0; + symbols->FindFunctions(name, name_type_mask, append, sc_list); + + // Now check our symbol table for symbols that are code symbols if requested + if (include_symbols) + { + ObjectFile *objfile = GetObjectFile(); + if (objfile) + { + Symtab *symtab = objfile->GetSymtab(); + if (symtab) + { + std::vector symbol_indexes; + symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); + const uint32_t num_matches = symbol_indexes.size(); + if (num_matches) + { + SymbolContext sc(this); + for (uint32_t i=0; iSymbolAtIndex(symbol_indexes[i]); + sc_list.AppendIfUnique (sc); + } + } + } + } + } + return sc_list.GetSize() - start_size; } uint32_t -Module::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) -{ +Module::FindFunctions (const RegularExpression& regex, + bool include_symbols, + bool append, + SymbolContextList& sc_list) +{ + if (!append) + sc_list.Clear(); + + const uint32_t start_size = sc_list.GetSize(); + SymbolVendor *symbols = GetSymbolVendor (); if (symbols) return symbols->FindFunctions(regex, append, sc_list); - return 0; + // Now check our symbol table for symbols that are code symbols if requested + if (include_symbols) + { + ObjectFile *objfile = GetObjectFile(); + if (objfile) + { + Symtab *symtab = objfile->GetSymtab(); + if (symtab) + { + std::vector symbol_indexes; + symtab->AppendSymbolIndexesMatchingRegExAndType (regex, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); + const uint32_t num_matches = symbol_indexes.size(); + if (num_matches) + { + SymbolContext sc(this); + for (uint32_t i=0; iSymbolAtIndex(symbol_indexes[i]); + sc_list.AppendIfUnique (sc); + } + } + } + } + } + return sc_list.GetSize() - start_size; } uint32_t Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Jan 27 00:44:37 2011 @@ -141,7 +141,11 @@ } size_t -ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList &sc_list) +ModuleList::FindFunctions (const ConstString &name, + uint32_t name_type_mask, + bool include_symbols, + bool append, + SymbolContextList &sc_list) { if (!append) sc_list.Clear(); @@ -150,14 +154,17 @@ collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindFunctions (name, name_type_mask, true, sc_list); + (*pos)->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); } return sc_list.GetSize(); } uint32_t -ModuleList::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variable_list) +ModuleList::FindGlobalVariables (const ConstString &name, + bool append, + uint32_t max_matches, + VariableList& variable_list) { size_t initial_size = variable_list.GetSize(); Mutex::Locker locker(m_modules_mutex); @@ -171,7 +178,10 @@ uint32_t -ModuleList::FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variable_list) +ModuleList::FindGlobalVariables (const RegularExpression& regex, + bool append, + uint32_t max_matches, + VariableList& variable_list) { size_t initial_size = variable_list.GetSize(); Mutex::Locker locker(m_modules_mutex); @@ -185,7 +195,9 @@ size_t -ModuleList::FindSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, SymbolContextList &sc_list) +ModuleList::FindSymbolsWithNameAndType (const ConstString &name, + SymbolType symbol_type, + SymbolContextList &sc_list) { Mutex::Locker locker(m_modules_mutex); sc_list.Clear(); Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Jan 27 00:44:37 2011 @@ -429,8 +429,9 @@ return false; SymbolContextList sc_list; - - m_parser_vars->m_sym_ctx.FindFunctionsByName(name, false, sc_list); + const bool include_symbols = true; + const bool append = false; + m_parser_vars->m_sym_ctx.FindFunctionsByName(name, include_symbols, append, sc_list); if (!sc_list.GetSize()) return false; @@ -1557,7 +1558,12 @@ } else { - m_parser_vars->m_sym_ctx.FindFunctionsByName (name, false, sc_list); + const bool include_symbols = true; + const bool append = false; + m_parser_vars->m_sym_ctx.FindFunctionsByName (name, + include_symbols, + append, + sc_list); bool found_specific = false; Symbol *generic_symbol = NULL; @@ -1590,9 +1596,9 @@ if (!found_specific) { if (generic_symbol) - AddOneFunction(context, NULL, generic_symbol); + AddOneFunction (context, NULL, generic_symbol); else if (non_extern_symbol) - AddOneFunction(context, NULL, non_extern_symbol); + AddOneFunction (context, NULL, non_extern_symbol); } ClangNamespaceDecl namespace_decl (m_parser_vars->m_sym_ctx.FindNamespace(name)); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Jan 27 00:44:37 2011 @@ -3566,17 +3566,27 @@ // in the DWARF for C++ methods... Default to public for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; - - clang::CXXMethodDecl *cxx_method_decl; - cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type, - type_name_cstr, - clang_type, - accessibility, - is_virtual, - is_static, - is_inline, - is_explicit); - type_handled = cxx_method_decl != NULL; + + if (!is_static && !die->HasChildren()) + { + // We have a C++ member function with no children (this pointer!) + // and clang will get mad if we try and make a function that isn't + // well formed in the DWARF, so we will just skip it... + type_handled = true; + } + else + { + clang::CXXMethodDecl *cxx_method_decl; + cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type, + type_name_cstr, + clang_type, + accessibility, + is_virtual, + is_static, + is_inline, + is_explicit); + type_handled = cxx_method_decl != NULL; + } } } } Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Thu Jan 27 00:44:37 2011 @@ -323,25 +323,11 @@ Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileSymtab::FindFunctions (name = '%s')", name.GetCString()); - - Symtab *symtab = m_obj_file->GetSymtab(); - if (symtab) - { - const uint32_t start_size = sc_list.GetSize(); - std::vector symbol_indexes; - symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); - const uint32_t num_matches = symbol_indexes.size(); - if (num_matches) - { - SymbolContext sc(m_obj_file->GetModule()); - for (uint32_t i=0; iSymbolAtIndex(symbol_indexes[i]); - sc_list.Append(sc); - } - } - return sc_list.GetSize() - start_size; - } + // If we ever support finding STABS or COFF debug info symbols, + // we will need to add support here. We are not trying to find symbols + // here, just "lldb_private::Function" objects that come from complete + // debug information. Any symbol queries should go through the symbol + // table itself in the module's object file. return 0; } @@ -351,7 +337,11 @@ Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileSymtab::FindFunctions (regex = '%s')", regex.GetText()); - + // If we ever support finding STABS or COFF debug info symbols, + // we will need to add support here. We are not trying to find symbols + // here, just "lldb_private::Function" objects that come from complete + // debug information. Any symbol queries should go through the symbol + // table itself in the module's object file. return 0; } Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=124359&r1=124358&r2=124359&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu Jan 27 00:44:37 2011 @@ -345,23 +345,23 @@ bool lldb_private::operator== (const SymbolContext& lhs, const SymbolContext& rhs) { - return lhs.target_sp.get() == rhs.target_sp.get() && - lhs.module_sp.get() == rhs.module_sp.get() && - lhs.comp_unit == rhs.comp_unit && - lhs.function == rhs.function && - LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0 && - lhs.symbol == rhs.symbol; + return lhs.function == rhs.function + && lhs.symbol == rhs.symbol + && lhs.module_sp.get() == rhs.module_sp.get() + && lhs.comp_unit == rhs.comp_unit + && lhs.target_sp.get() == rhs.target_sp.get() + && LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0; } bool lldb_private::operator!= (const SymbolContext& lhs, const SymbolContext& rhs) { - return lhs.target_sp.get() != rhs.target_sp.get() || - lhs.module_sp.get() != rhs.module_sp.get() || - lhs.comp_unit != rhs.comp_unit || - lhs.function != rhs.function || - LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0 || - lhs.symbol != rhs.symbol; + return lhs.function != rhs.function + && lhs.symbol != rhs.symbol + && lhs.module_sp.get() != rhs.module_sp.get() + && lhs.comp_unit != rhs.comp_unit + && lhs.target_sp.get() != rhs.target_sp.get() + && LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0; } bool @@ -410,7 +410,10 @@ } size_t -SymbolContext::FindFunctionsByName (const ConstString &name, bool append, SymbolContextList &sc_list) const +SymbolContext::FindFunctionsByName (const ConstString &name, + bool include_symbols, + bool append, + SymbolContextList &sc_list) const { if (!append) sc_list.Clear(); @@ -422,10 +425,10 @@ } if (module_sp != NULL) - module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, true, sc_list); + module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list); if (target_sp) - target_sp->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, true, sc_list); + target_sp->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list); return sc_list.GetSize(); } @@ -475,6 +478,19 @@ m_symbol_contexts.push_back(sc); } +bool +SymbolContextList::AppendIfUnique (const SymbolContext& sc) +{ + collection::const_iterator pos, end = m_symbol_contexts.end(); + for (pos = m_symbol_contexts.begin(); pos != end; ++pos) + { + if (*pos == sc) + return false; + } + m_symbol_contexts.push_back(sc); + return true; +} + void SymbolContextList::Clear() { From gclayton at apple.com Thu Jan 27 03:02:32 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 09:02:32 -0000 Subject: [Lldb-commits] [lldb] r124369 - in /lldb/trunk: include/lldb/Core/Communication.h source/Core/Communication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp tools/debugserver/source/RNBRemote.cpp tools/debugserver/source/RNBRemote.h Message-ID: <20110127090232.F003C2A6C12D@llvm.org> Author: gclayton Date: Thu Jan 27 03:02:32 2011 New Revision: 124369 URL: http://llvm.org/viewvc/llvm-project?rev=124369&view=rev Log: Finally tracked down the racy condition that would hose up our debug sessions: When continue packet has been sent and an interrupt packet was quickly sent, it would get read at the same time: $c#00\x03 There was an error where the packet end index was always being computed incorrectly by debugserver, but it wouldn't matter if there weren't extra bytes on the end (the hex \x03 interrupt byte in this case). The first '$' last 3 bytes of the data in the packet buffer were being trimmed (trying to trim the '#' + checksum (#XX)) which made: c# And this would then be passed to the handle routine for the 'c' packet which would see an extra character at the end and assume it was going to be in the form c[addr] where "[addr]" was a hex address to resume at and this would result in a malformed packet response. This is now fixed and everything works great. Another issue was issuing async packets correctly by doing correct handshakes between the thread that wants to send the async packet, and the thread that is tracking the current run. Added a write lock to the communication class as well to make sure you never get two threads trying to write data at the same time. This wasn't happening, but it is a good idea to make sure it doesn't. Modified: lldb/trunk/include/lldb/Core/Communication.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/tools/debugserver/source/RNBRemote.cpp lldb/trunk/tools/debugserver/source/RNBRemote.h Modified: lldb/trunk/include/lldb/Core/Communication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=124369&r1=124368&r2=124369&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Communication.h (original) +++ lldb/trunk/include/lldb/Core/Communication.h Thu Jan 27 03:02:32 2011 @@ -358,7 +358,8 @@ lldb::thread_t m_read_thread; ///< The read thread handle in case we need to cancel the thread. bool m_read_thread_enabled; std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function. - Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes. + Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes. + Mutex m_write_mutex; ///< Don't let multiple threads write at the same time... ReadThreadBytesReceived m_callback; void *m_callback_baton; bool m_close_on_eof; Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=124369&r1=124368&r2=124369&view=diff ============================================================================== --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Thu Jan 27 03:02:32 2011 @@ -32,6 +32,7 @@ m_read_thread_enabled (false), m_bytes(), m_bytes_mutex (Mutex::eMutexTypeRecursive), + m_write_mutex (Mutex::eMutexTypeNormal), m_callback (NULL), m_callback_baton (NULL), m_close_on_eof (true) @@ -205,6 +206,7 @@ { lldb::ConnectionSP connection_sp (m_connection_sp); + Mutex::Locker (m_write_mutex); lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION, "%p Communication::Write (src = %p, src_len = %zu) connection = %p", this, 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=124369&r1=124368&r2=124369&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Jan 27 03:02:32 2011 @@ -134,6 +134,7 @@ TimeValue timeout_time; timeout_time = TimeValue::Now(); timeout_time.OffsetWithSeconds (timeout_seconds); + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (GetSequenceMutex (locker)) { @@ -149,24 +150,53 @@ m_async_timeout = timeout_seconds; m_async_packet_predicate.SetValue (true, eBroadcastNever); + if (log) + log->Printf ("async: async packet = %s", m_async_packet.c_str()); + bool timed_out = false; bool sent_interrupt = false; if (SendInterrupt(locker, 2, sent_interrupt, timed_out)) { - if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out)) + if (sent_interrupt) { - response = m_async_response; - return response.GetStringRef().size(); + if (log) + log->Printf ("async: sent interrupt"); + if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out)) + { + if (log) + log->Printf ("async: got response"); + response = m_async_response; + return response.GetStringRef().size(); + } + else + { + if (log) + log->Printf ("async: timed out waiting for response"); + } + + // Make sure we wait until the continue packet has been sent again... + if (m_private_is_running.WaitForValueEqualTo (true, &timeout_time, &timed_out)) + { + if (log) + log->Printf ("async: timed out waiting for process to resume"); + } + } + else + { + // We had a racy condition where we went to send the interrupt + // yet we were able to get the loc } } -// if (timed_out) -// m_error.SetErrorString("Timeout."); -// else -// m_error.SetErrorString("Unknown error."); + else + { + if (log) + log->Printf ("async: failed to interrupt"); + } } else { -// m_error.SetErrorString("Sequence mutex is locked."); + if (log) + log->Printf ("mutex taken and send_async == false, aborting packet"); } } return 0; @@ -212,17 +242,23 @@ Mutex::Locker locker(m_sequence_mutex); StateType state = eStateRunning; - if (SendPacket(payload, packet_length) == 0) - state = eStateInvalid; - BroadcastEvent(eBroadcastBitRunPacketSent, NULL); m_public_is_running.SetValue (true, eBroadcastNever); - m_private_is_running.SetValue (true, eBroadcastNever); - + // Set the starting continue packet into "continue_packet". This packet + // make change if we are interrupted and we continue after an async packet... + std::string continue_packet(payload, packet_length); + while (state == eStateRunning) { if (log) - log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...)", __FUNCTION__); + log->Printf ("GDBRemoteCommunication::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str()); + if (SendPacket(continue_packet.c_str(), continue_packet.size()) == 0) + state = eStateInvalid; + + m_private_is_running.SetValue (true, eBroadcastNever); + + if (log) + log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(%.*s)", __FUNCTION__); if (WaitForPacket (response, (TimeValue*)NULL)) { @@ -280,32 +316,28 @@ Host::GetSignalAsCString (signo), Host::GetSignalAsCString (async_signal)); - if (SendPacket(signal_packet, signal_packet_len) == 0) - { - if (log) - log->Printf ("async: error: failed to resume with %s", - Host::GetSignalAsCString (async_signal)); - state = eStateExited; - break; - } - else - { - m_private_is_running.SetValue (true, eBroadcastNever); - continue; - } + // Set the continue packet to resume... + continue_packet.assign(signal_packet, signal_packet_len); + continue; } } else if (m_async_packet_predicate.GetValue()) { - if (log) - log->Printf ("async: send async packet: %s", - m_async_packet.c_str()); - // We are supposed to send an asynchronous packet while // we are running. m_async_response.Clear(); - if (!m_async_packet.empty()) + if (m_async_packet.empty()) { + if (log) + log->Printf ("async: error: empty async packet"); + + } + else + { + if (log) + log->Printf ("async: sending packet: %s", + m_async_packet.c_str()); + SendPacketAndWaitForResponse (&m_async_packet[0], m_async_packet.size(), m_async_response, @@ -313,25 +345,13 @@ false); } // Let the other thread that was trying to send the async - // packet know that the packet has been sent. + // packet know that the packet has been sent and response is + // ready... m_async_packet_predicate.SetValue(false, eBroadcastAlways); - if (log) - log->Printf ("async: resume after async response received: %s", - m_async_response.GetStringRef().c_str()); - - // Continue again - if (SendPacket("c", 1) == 0) - { - // Failed to send the continue packet - state = eStateExited; - break; - } - else - { - m_private_is_running.SetValue (true, eBroadcastNever); - continue; - } + // Set the continue packet to resume... + continue_packet.assign (1, 'c'); + continue; } // Stop with signal and thread info state = eStateStopped; @@ -477,8 +497,9 @@ { sent_interrupt = false; timed_out = false; + LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); - if (IsConnected() && IsRunning()) + if (IsRunning()) { // Only send an interrupt if our debugserver is running... if (GetSequenceMutex (locker) == false) @@ -493,14 +514,35 @@ timeout = TimeValue::Now(); timeout.OffsetWithSeconds (seconds_to_wait_for_stop); } + size_t bytes_written = Write (&ctrl_c, 1, status, NULL); ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS | GDBR_LOG_PROCESS, "send packet: \\x03"); - if (Write (&ctrl_c, 1, status, NULL) > 0) + if (bytes_written > 0) { sent_interrupt = true; if (seconds_to_wait_for_stop) + { m_private_is_running.WaitForValueEqualTo (false, &timeout, &timed_out); + if (log) + log->Printf ("GDBRemoteCommunication::%s () - sent interrupt, private state stopped", __FUNCTION__); + + } + else + { + if (log) + log->Printf ("GDBRemoteCommunication::%s () - sent interrupt, not waiting for stop...", __FUNCTION__); + } return true; } + else + { + if (log) + log->Printf ("GDBRemoteCommunication::%s () - failed to write interrupt", __FUNCTION__); + } + } + else + { + if (log) + log->Printf ("GDBRemoteCommunication::%s () - got sequence mutex without having to interrupt", __FUNCTION__); } } return false; Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=124369&r1=124368&r2=124369&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Thu Jan 27 03:02:32 2011 @@ -383,7 +383,7 @@ } } } - break; + break; default: DNBLogThreadedIf (LOG_RNB_REMOTE, "%8u RNBRemote::%s tossing unexpected packet???? %s", (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__, return_packet.c_str()); @@ -403,9 +403,9 @@ } rnb_err_t -RNBRemote::HandlePacket_ILLFORMED (const char *description) +RNBRemote::HandlePacket_ILLFORMED (const char *file, int line, const char *p, const char *description) { - DNBLogThreadedIf (LOG_RNB_MAX, "%8u RNBRemote::%s sending ILLFORMED", (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__); + DNBLogThreadedIf (LOG_RNB_PACKETS, "%8u %s:%i ILLFORMED: '%s' (%s)", (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), file, line, __FUNCTION__, p); return SendPacket ("E03"); } @@ -583,8 +583,9 @@ } else { - // Add two for the checksum bytes - end_idx += 4; + // Add two for the checksum bytes and 1 to point to the + // byte just past the end of this packet + end_idx += 2 + 1; } break; @@ -1125,12 +1126,12 @@ { if (p == NULL || *p == '\0') { - return HandlePacket_ILLFORMED ("Null packet for 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Null packet for 'A' pkt"); } p++; if (p == '\0' || !isdigit (*p)) { - return HandlePacket_ILLFORMED ("arglen not specified on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "arglen not specified on 'A' pkt"); } /* I promise I don't modify it anywhere in this function. strtoul()'s @@ -1150,11 +1151,11 @@ arglen = strtoul (buf, &c, 10); if (errno != 0 && arglen == 0) { - return HandlePacket_ILLFORMED ("arglen not a number on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "arglen not a number on 'A' pkt"); } if (*c != ',') { - return HandlePacket_ILLFORMED ("arglen not followed by comma on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "arglen not followed by comma on 'A' pkt"); } buf = c + 1; @@ -1162,11 +1163,11 @@ argnum = strtoul (buf, &c, 10); if (errno != 0 && argnum == 0) { - return HandlePacket_ILLFORMED ("argnum not a number on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "argnum not a number on 'A' pkt"); } if (*c != ',') { - return HandlePacket_ILLFORMED ("arglen not followed by comma on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "arglen not followed by comma on 'A' pkt"); } buf = c + 1; @@ -1183,7 +1184,7 @@ int ch = strtoul (smallbuf, NULL, 16); if (errno != 0 && ch == 0) { - return HandlePacket_ILLFORMED ("non-hex char in arg on 'A' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "non-hex char in arg on 'A' pkt"); } arg.push_back(ch); @@ -1209,7 +1210,7 @@ p++; // skip 'H' if (*p != 'c' && *p != 'g') { - return HandlePacket_ILLFORMED ("Missing 'c' or 'g' type in H packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Missing 'c' or 'g' type in H packet"); } if (!m_ctx.HasValidProcessID()) @@ -1223,7 +1224,7 @@ nub_thread_t tid = strtoul (p + 1, NULL, 16); if (errno != 0 && tid == 0) { - return HandlePacket_ILLFORMED ("Invalid thread number in H packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid thread number in H packet"); } if (*p == 'c') SetContinueThread (tid); @@ -1333,12 +1334,12 @@ sequence of letters encoded in as 2-hex-chars-per-letter. */ p += strlen ("qThreadExtraInfo"); if (*p++ != ',') - return HandlePacket_ILLFORMED ("Ill formed qThreadExtraInfo packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Illformed qThreadExtraInfo packet"); errno = 0; nub_thread_t tid = strtoul (p, NULL, 16); if (errno != 0 && tid == 0) { - return HandlePacket_ILLFORMED ("Invalid thread number in qThreadExtraInfo packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid thread number in qThreadExtraInfo packet"); } const char * threadInfo = DNBThreadGetInfo(pid, tid); @@ -1760,7 +1761,7 @@ uint32_t size = strtoul (p, NULL, 16); if (errno != 0 && size == 0) { - return HandlePacket_ILLFORMED ("Invalid length in QSetMaxPayloadSize packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in QSetMaxPayloadSize packet"); } m_max_payload_size = size; return SendPacket ("OK"); @@ -1777,7 +1778,7 @@ uint32_t size = strtoul (p, NULL, 16); if (errno != 0 && size == 0) { - return HandlePacket_ILLFORMED ("Invalid length in QSetMaxPacketSize packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in QSetMaxPacketSize packet"); } m_max_payload_size = size - 5; return SendPacket ("OK"); @@ -2050,7 +2051,7 @@ { if (p == NULL || p[0] == '\0' || strlen (p) < 3) { - return HandlePacket_ILLFORMED ("Too short M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Too short M packet"); } char *c; @@ -2059,11 +2060,11 @@ nub_addr_t addr = strtoull (p, &c, 16); if (errno != 0 && addr == 0) { - return HandlePacket_ILLFORMED ("Invalid address in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in M packet"); } if (*c != ',') { - return HandlePacket_ILLFORMED ("Comma sep missing in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Comma sep missing in M packet"); } /* Advance 'p' to the length part of the packet. */ @@ -2073,7 +2074,7 @@ uint32_t length = strtoul (p, &c, 16); if (errno != 0 && length == 0) { - return HandlePacket_ILLFORMED ("Invalid length in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in M packet"); } if (length == 0) { @@ -2082,7 +2083,7 @@ if (*c != ':') { - return HandlePacket_ILLFORMED ("Missing colon in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Missing colon in M packet"); } /* Advance 'p' to the data part of the packet. */ p += (c - p) + 1; @@ -2090,7 +2091,7 @@ int datalen = strlen (p); if (datalen & 0x1) { - return HandlePacket_ILLFORMED ("Uneven # of hex chars for data in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Uneven # of hex chars for data in M packet"); } if (datalen == 0) { @@ -2110,7 +2111,7 @@ uint8_t byte = strtoul (hexbuf, NULL, 16); if (errno != 0 && byte == 0) { - return HandlePacket_ILLFORMED ("Invalid hex byte in M packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid hex byte in M packet"); } *i++ = byte; p += 2; @@ -2129,7 +2130,7 @@ { if (p == NULL || p[0] == '\0' || strlen (p) < 3) { - return HandlePacket_ILLFORMED ("Too short m packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Too short m packet"); } char *c; @@ -2138,11 +2139,11 @@ nub_addr_t addr = strtoull (p, &c, 16); if (errno != 0 && addr == 0) { - return HandlePacket_ILLFORMED ("Invalid address in m packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in m packet"); } if (*c != ',') { - return HandlePacket_ILLFORMED ("Comma sep missing in m packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Comma sep missing in m packet"); } /* Advance 'p' to the length part of the packet. */ @@ -2152,7 +2153,7 @@ uint32_t length = strtoul (p, NULL, 16); if (errno != 0 && length == 0) { - return HandlePacket_ILLFORMED ("Invalid length in m packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in m packet"); } if (length == 0) { @@ -2181,7 +2182,7 @@ { if (p == NULL || p[0] == '\0' || strlen (p) < 3) { - return HandlePacket_ILLFORMED ("Too short X packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Too short X packet"); } char *c; @@ -2190,11 +2191,11 @@ nub_addr_t addr = strtoull (p, &c, 16); if (errno != 0 && addr == 0) { - return HandlePacket_ILLFORMED ("Invalid address in X packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in X packet"); } if (*c != ',') { - return HandlePacket_ILLFORMED ("Comma sep missing in X packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Comma sep missing in X packet"); } /* Advance 'p' to the length part of the packet. */ @@ -2204,7 +2205,7 @@ int length = strtoul (p, NULL, 16); if (errno != 0 && length == 0) { - return HandlePacket_ILLFORMED ("Invalid length in m packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in m packet"); } // I think gdb sends a zero length write request to test whether this @@ -2250,7 +2251,7 @@ nub_process_t pid = m_ctx.ProcessID (); nub_thread_t tid = ExtractThreadIDFromThreadSuffix (p + 1); if (tid == INVALID_NUB_THREAD) - return HandlePacket_ILLFORMED ("No thread specified in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in p packet"); if (m_use_native_regs) { @@ -2298,7 +2299,7 @@ nub_process_t pid = m_ctx.ProcessID(); nub_thread_t tid = ExtractThreadIDFromThreadSuffix (p); if (tid == INVALID_NUB_THREAD) - return HandlePacket_ILLFORMED ("No thread specified in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in p packet"); if (m_use_native_regs) { @@ -2491,7 +2492,7 @@ errno = 0; thread_action.signal = strtoul (c, &c, 16); if (errno != 0) - return HandlePacket_ILLFORMED ("Could not parse signal in vCont packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse signal in vCont packet"); // Fall through to next case... case 'c': @@ -2503,7 +2504,7 @@ errno = 0; thread_action.signal = strtoul (c, &c, 16); if (errno != 0) - return HandlePacket_ILLFORMED ("Could not parse signal in vCont packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse signal in vCont packet"); // Fall through to next case... case 's': @@ -2514,7 +2515,7 @@ break; default: - rnb_err = HandlePacket_ILLFORMED ("Unsupported action in vCont packet"); + rnb_err = HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Unsupported action in vCont packet"); break; } if (*c == ':') @@ -2522,7 +2523,7 @@ errno = 0; thread_action.tid = strtoul (++c, &c, 16); if (errno != 0) - return HandlePacket_ILLFORMED ("Could not parse thread number in vCont packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse thread number in vCont packet"); } thread_actions.Append (thread_action); @@ -2553,7 +2554,7 @@ int ch = strtoul (smallbuf, NULL, 16); if (errno != 0 && ch == 0) { - return HandlePacket_ILLFORMED ("non-hex char in arg on 'vAttachWait' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "non-hex char in arg on 'vAttachWait' pkt"); } attach_name.push_back(ch); @@ -2578,7 +2579,7 @@ int ch = strtoul (smallbuf, NULL, 16); if (errno != 0 && ch == 0) { - return HandlePacket_ILLFORMED ("non-hex char in arg on 'vAttachWait' pkt"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "non-hex char in arg on 'vAttachWait' pkt"); } attach_name.push_back(ch); @@ -2638,7 +2639,7 @@ p++; if (p == NULL || *p == '\0') { - return HandlePacket_ILLFORMED ("No thread specified in T packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in T packet"); } if (!m_ctx.HasValidProcessID()) { @@ -2648,7 +2649,7 @@ nub_thread_t tid = strtoul (p, NULL, 16); if (errno != 0 && tid == 0) { - return HandlePacket_ILLFORMED ("Could not parse thread number in T packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse thread number in T packet"); } nub_state_t state = DNBThreadGetState (m_ctx.ProcessID(), tid); @@ -2665,7 +2666,7 @@ RNBRemote::HandlePacket_z (const char *p) { if (p == NULL || *p == '\0') - return HandlePacket_ILLFORMED ("No thread specified in z packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in z packet"); if (!m_ctx.HasValidProcessID()) return SendPacket ("E15"); @@ -2674,22 +2675,22 @@ char break_type = *p++; if (*p++ != ',') - return HandlePacket_ILLFORMED ("Comma separator missing in z packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Comma separator missing in z packet"); char *c = NULL; nub_process_t pid = m_ctx.ProcessID(); errno = 0; nub_addr_t addr = strtoull (p, &c, 16); if (errno != 0 && addr == 0) - return HandlePacket_ILLFORMED ("Invalid address in z packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in z packet"); p = c; if (*p++ != ',') - return HandlePacket_ILLFORMED ("Comma separator missing in z packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Comma separator missing in z packet"); errno = 0; uint32_t byte_size = strtoul (p, &c, 16); if (errno != 0 && byte_size == 0) - return HandlePacket_ILLFORMED ("Invalid length in z packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid length in z packet"); if (packet_cmd == 'Z') { @@ -2912,7 +2913,7 @@ if (p == NULL || *p == '\0') { - return HandlePacket_ILLFORMED ("No thread specified in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in p packet"); } if (!m_ctx.HasValidProcessID()) { @@ -2924,12 +2925,12 @@ uint32_t reg = strtoul (p + 1, &tid_cstr, 16); if (errno != 0 && reg == 0) { - return HandlePacket_ILLFORMED ("Could not parse register number in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse register number in p packet"); } nub_thread_t tid = ExtractThreadIDFromThreadSuffix (tid_cstr); if (tid == INVALID_NUB_THREAD) - return HandlePacket_ILLFORMED ("No thread specified in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in p packet"); const register_map_entry_t *reg_entry; @@ -2978,7 +2979,7 @@ if (p == NULL || *p == '\0') { - return HandlePacket_ILLFORMED ("Empty P packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Empty P packet"); } if (!m_ctx.HasValidProcessID()) { @@ -2995,7 +2996,7 @@ const char equal_char = packet.GetChar(); if (cmd_char != 'P') - return HandlePacket_ILLFORMED ("Improperly formed P packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Improperly formed P packet"); if (reg == UINT32_MAX) return SendPacket ("E29"); @@ -3022,7 +3023,7 @@ nub_thread_t tid = ExtractThreadIDFromThreadSuffix (p); if (tid == INVALID_NUB_THREAD) - return HandlePacket_ILLFORMED ("No thread specified in p packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "No thread specified in p packet"); if (!DNBThreadSetRegisterValueByID (pid, tid, reg_entry->nub_info.set, reg_entry->nub_info.reg, ®_value)) { @@ -3050,7 +3051,7 @@ errno = 0; action.addr = strtoull (p + 1, NULL, 16); if (errno != 0 && action.addr == 0) - return HandlePacket_ILLFORMED ("Could not parse address in c packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse address in c packet"); } DNBThreadResumeActions thread_actions; @@ -3082,13 +3083,13 @@ errno = 0; process_signo = strtoul (p + 1, &end, 16); if (errno != 0) - return HandlePacket_ILLFORMED ("Could not parse signal in C packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse signal in C packet"); else if (*end == ';') { errno = 0; action.addr = strtoull (end + 1, NULL, 16); if (errno != 0 && action.addr == 0) - return HandlePacket_ILLFORMED ("Could not parse address in C packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse address in C packet"); } } @@ -3186,14 +3187,14 @@ errno = 0; action.signal = strtoul (p + 1, &end, 16); if (errno != 0) - return HandlePacket_ILLFORMED ("Could not parse signal in S packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse signal in S packet"); else if (*end == ';') { errno = 0; action.addr = strtoull (end + 1, NULL, 16); if (errno != 0 && action.addr == 0) { - return HandlePacket_ILLFORMED ("Could not parse address in S packet"); + return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Could not parse address in S packet"); } } } Modified: lldb/trunk/tools/debugserver/source/RNBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.h?rev=124369&r1=124368&r2=124369&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.h (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.h Thu Jan 27 03:02:32 2011 @@ -183,7 +183,7 @@ rnb_err_t HandlePacket_S (const char *p); rnb_err_t HandlePacket_v (const char *p); rnb_err_t HandlePacket_UNIMPLEMENTED (const char *p); - rnb_err_t HandlePacket_ILLFORMED (const char *description); + rnb_err_t HandlePacket_ILLFORMED (const char *file, int line, const char *p, const char *description); rnb_err_t HandlePacket_AllocateMemory (const char *p); rnb_err_t HandlePacket_DeallocateMemory (const char *p); From gclayton at apple.com Thu Jan 27 03:15:12 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 09:15:12 -0000 Subject: [Lldb-commits] [lldb] r124371 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20110127091512.219A52A6C12D@llvm.org> Author: gclayton Date: Thu Jan 27 03:15:11 2011 New Revision: 124371 URL: http://llvm.org/viewvc/llvm-project?rev=124371&view=rev Log: Improved support for GCC complex integers. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=124371&r1=124370&r2=124371&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jan 27 03:15:11 2011 @@ -688,7 +688,7 @@ case DW_ATE_lo_user: // This has been seen to mean DW_AT_complex_integer - if (strcmp(type_name, "complex") == 0) + if (::strstr(type_name, "complex")) { clang_type_t complex_int_clang_type = GetBuiltinTypeForDWARFEncodingAndBitSize ("int", DW_ATE_signed, bit_size/2); return ast->getComplexType (QualType::getFromOpaquePtr(complex_int_clang_type)).getAsOpaquePtr(); From gclayton at apple.com Thu Jan 27 03:20:08 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 09:20:08 -0000 Subject: [Lldb-commits] [lldb] r124372 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110127092008.51B0A2A6C12D@llvm.org> Author: gclayton Date: Thu Jan 27 03:20:08 2011 New Revision: 124372 URL: http://llvm.org/viewvc/llvm-project?rev=124372&view=rev Log: Updated Xcode project versions: lldb-45 and debugserver-130 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=124372&r1=124371&r2=124372&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jan 27 03:20:08 2011 @@ -2978,9 +2978,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 44; + DYLIB_CURRENT_VERSION = 45; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3035,11 +3035,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 44; + DYLIB_CURRENT_VERSION = 45; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3122,7 +3122,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3158,11 +3158,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 44; + DYLIB_CURRENT_VERSION = 45; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3216,7 +3216,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3255,7 +3255,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 44; + CURRENT_PROJECT_VERSION = 45; 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=124372&r1=124371&r2=124372&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Thu Jan 27 03:20:08 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 44 + 45 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=124372&r1=124371&r2=124372&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Thu Jan 27 03:20:08 2011 @@ -460,7 +460,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 129; + CURRENT_PROJECT_VERSION = 130; 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 = 129; + CURRENT_PROJECT_VERSION = 130; 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 = 129; + CURRENT_PROJECT_VERSION = 130; 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 = 129; + CURRENT_PROJECT_VERSION = 130; 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 = 129; + CURRENT_PROJECT_VERSION = 130; 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 = 129; + CURRENT_PROJECT_VERSION = 130; 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 Thu Jan 27 13:34:31 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 27 Jan 2011 19:34:31 -0000 Subject: [Lldb-commits] [lldb] r124400 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110127193431.156682A6C12C@llvm.org> Author: johnny Date: Thu Jan 27 13:34:30 2011 New Revision: 124400 URL: http://llvm.org/viewvc/llvm-project?rev=124400&view=rev Log: Add emulate_add_sp_rm entry to the g_thumb_opcodes table, which represents an operation to adjust the stack pointer by adding a register value in Rm to the SP. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124400&r1=124399&r2=124400&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Thu Jan 27 13:34:30 2011 @@ -184,7 +184,7 @@ context.type = EmulateInstruction::eContextAdjustStackPointer; context.arg0 = eRegisterKindGeneric; context.arg1 = LLDB_REGNUM_GENERIC_SP; - context.arg2 = sp_offset; + context.arg2 = -sp_offset; if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, sp - sp_offset)) return false; @@ -192,7 +192,7 @@ return true; } -// Adjust r7 or ip to point to saved value residing within the stack. +// Set r7 or ip to point to saved value residing within the stack. // ADD (SP plus immediate) static bool emulate_add_rd_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) @@ -253,6 +253,65 @@ return true; } +// An add operation to adjust the SP. +// ADD (SP plus register) +static bool +emulate_add_sp_rm (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + shifted = Shift(R[m], shift_t, shift_n, APSR.C); + (result, carry, overflow) = AddWithCarry(SP, shifted, ???0???); + if d == 15 then + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + APSR.C = carry; + APSR.V = overflow; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t Rm; // the second operand + switch (encoding) { + case eEncodingT2: + Rm = Bits32(opcode, 6, 3); + break; + default: + return false; + } + int32_t reg_value = emulator->ReadRegisterUnsigned(eRegisterKindDWARF, dwarf_r0 + Rm, 0, &success); + if (!success) + return false; + + addr_t addr = (int32_t)sp + reg_value; // the adjusted stack pointer value + + EmulateInstruction::Context context = { EmulateInstruction::eContextAdjustStackPointer, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_SP, + reg_value }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, addr)) + return false; + } + return true; +} + // A sub operation to adjust the SP -- allocate space for local storage. static bool emulate_sub_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) @@ -307,7 +366,7 @@ EmulateInstruction::Context context = { EmulateInstruction::eContextAdjustStackPointer, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, - sp_offset }; + -sp_offset }; if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, addr)) return false; @@ -380,7 +439,7 @@ context.type = EmulateInstruction::eContextAdjustStackPointer; context.arg0 = eRegisterKindGeneric; context.arg1 = LLDB_REGNUM_GENERIC_SP; - context.arg2 = sp_offset; + context.arg2 = -sp_offset; if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, sp - sp_offset)) return false; @@ -473,7 +532,7 @@ context.type = EmulateInstruction::eContextAdjustStackPointer; context.arg0 = eRegisterKindGeneric; context.arg1 = LLDB_REGNUM_GENERIC_SP; - context.arg2 = sp_offset; + context.arg2 = -sp_offset; if (!emulator->WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, sp - sp_offset)) return false; @@ -487,9 +546,9 @@ { 0x0fff0000, 0x092d0000, ARMvAll, eEncodingA1, eSize32, emulate_push, "push " }, { 0x0fff0fff, 0x052d0004, ARMvAll, eEncodingA2, eSize32, emulate_push, "push " }, - // adjust r7 to point to a stack offset + // set r7 to point to a stack offset { 0x0ffff000, 0x028d7000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add r7, sp, #" }, - // adjust ip to point to a stack offset + // set ip to point to a stack offset { 0x0ffff000, 0x028dc000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add ip, sp, #" }, // adjust the stack pointer @@ -510,12 +569,13 @@ { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w " }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w " }, - // adjust r7 to point to a stack offset + // set r7 to point to a stack offset { 0xffffff00, 0x000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #" }, // adjust the stack pointer - { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "sub{s} sp, sp, #"}, - { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub{s}.w sp, sp, #"}, + { 0xffffff87, 0x00004485, ARMvAll, eEncodingT2, eSize16, emulate_add_sp_rm, "add sp, "}, + { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "add sp, sp, #"}, + { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub.w sp, sp, #"}, { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, "subw sp, sp, #"}, // vector push consecutive extension register(s) From gclayton at apple.com Thu Jan 27 13:37:17 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 27 Jan 2011 19:37:17 -0000 Subject: [Lldb-commits] [lldb] r124401 - /lldb/trunk/lldb.xcodeproj/project.pbxproj Message-ID: <20110127193717.6F3282A6C12C@llvm.org> Author: gclayton Date: Thu Jan 27 13:37:17 2011 New Revision: 124401 URL: http://llvm.org/viewvc/llvm-project?rev=124401&view=rev Log: Removed the "lldb" folder reference from the Xcode project. 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=124401&r1=124400&r2=124401&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jan 27 13:37:17 2011 @@ -870,7 +870,6 @@ 26C72C951243229A0068DC16 /* SBStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBStream.cpp; path = source/API/SBStream.cpp; sourceTree = ""; }; 26C81CA411335651004BDC5A /* UUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UUID.h; path = include/lldb/Core/UUID.h; sourceTree = ""; }; 26C81CA511335651004BDC5A /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UUID.cpp; path = source/Core/UUID.cpp; sourceTree = ""; }; - 26C9DF03113C5B93006B0F94 /* lldb */ = {isa = PBXFileReference; lastKnownFileType = folder; name = lldb; path = include/lldb; sourceTree = ""; }; 26D0DD5010FE554D00271C65 /* BreakpointResolverAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverAddress.h; path = include/lldb/Breakpoint/BreakpointResolverAddress.h; sourceTree = ""; }; 26D0DD5110FE554D00271C65 /* BreakpointResolverFileLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverFileLine.h; path = include/lldb/Breakpoint/BreakpointResolverFileLine.h; sourceTree = ""; }; 26D0DD5210FE554D00271C65 /* BreakpointResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverName.h; path = include/lldb/Breakpoint/BreakpointResolverName.h; sourceTree = ""; }; @@ -1146,7 +1145,6 @@ 08FB7794FE84155DC02AAC07 /* lldb */ = { isa = PBXGroup; children = ( - 26C9DF02113C5B80006B0F94 /* Include */, 26F5C32810F3DF7D009D5894 /* Libraries */, 08FB7795FE84155DC02AAC07 /* Source */, 26F5C22410F3D950009D5894 /* Tools */, @@ -2108,14 +2106,6 @@ name = MacOSX; sourceTree = ""; }; - 26C9DF02113C5B80006B0F94 /* Include */ = { - isa = PBXGroup; - children = ( - 26C9DF03113C5B93006B0F94 /* lldb */, - ); - name = Include; - sourceTree = ""; - }; 26F5C22410F3D950009D5894 /* Tools */ = { isa = PBXGroup; children = ( From jingham at apple.com Thu Jan 27 14:15:39 2011 From: jingham at apple.com (Jim Ingham) Date: Thu, 27 Jan 2011 20:15:39 -0000 Subject: [Lldb-commits] [lldb] r124416 - in /lldb/trunk: lldb.xcodeproj/project.xcworkspace/ lldb.xcodeproj/project.xcworkspace/xcuserdata/ lldb.xcodeproj/xcshareddata/ lldb.xcodeproj/xcshareddata/xcschemes/ lldb.xcworkspace/ tools/debugserver/debugserver.xcodeproj/project.xcworkspace/ tools/debugserver/debugserver.xcodeproj/project.xcworkspace/xcuserdata/ tools/debugserver/debugserver.xcodeproj/xcshareddata/ tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/ tools/driver/ Message-ID: <20110127201540.096DA2A6C12C@llvm.org> Author: jingham Date: Thu Jan 27 14:15:39 2011 New Revision: 124416 URL: http://llvm.org/viewvc/llvm-project?rev=124416&view=rev Log: Adding a Xcode workspace for lldb. Added: lldb/trunk/lldb.xcodeproj/project.xcworkspace/ lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata lldb/trunk/lldb.xcodeproj/project.xcworkspace/xcuserdata/ lldb/trunk/lldb.xcodeproj/xcshareddata/ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/lldb.xcworkspace/ lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/xcuserdata/ lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/ lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/ lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme Modified: lldb/trunk/tools/driver/Driver.cpp Added: lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata?rev=124416&view=auto ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata (added) +++ lldb/trunk/lldb.xcodeproj/project.xcworkspace/contents.xcworkspacedata Thu Jan 27 14:15:39 2011 @@ -0,0 +1,7 @@ + + + + + Added: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme?rev=124416&view=auto ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme (added) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme Thu Jan 27 14:15:39 2011 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme?rev=124416&view=auto ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme (added) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme Thu Jan 27 14:15:39 2011 @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=124416&view=auto ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (added) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Thu Jan 27 14:15:39 2011 @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata?rev=124416&view=auto ============================================================================== --- lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata (added) +++ lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata Thu Jan 27 14:15:39 2011 @@ -0,0 +1,10 @@ + + + + + + + Added: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata?rev=124416&view=auto ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata (added) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata Thu Jan 27 14:15:39 2011 @@ -0,0 +1,7 @@ + + + + + Added: lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme?rev=124416&view=auto ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme (added) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme Thu Jan 27 14:15:39 2011 @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=124416&r1=124415&r2=124416&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Thu Jan 27 14:15:39 2011 @@ -1431,7 +1431,7 @@ } int -main (int argc, char const *argv[]) +main (int argc, char const *argv[], const char *envp[]) { SBDebugger::Initialize(); From johnny.chen at apple.com Thu Jan 27 16:52:23 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 27 Jan 2011 22:52:23 -0000 Subject: [Lldb-commits] [lldb] r124448 - in /lldb/trunk/source/Plugins/Process/Utility: EmulateInstruction.h EmulateInstructionARM.cpp Message-ID: <20110127225223.8CA3D2A6C12C@llvm.org> Author: johnny Date: Thu Jan 27 16:52:23 2011 New Revision: 124448 URL: http://llvm.org/viewvc/llvm-project?rev=124448&view=rev Log: Add emulate_ldr_rd_pc_rel entry to the g_thumb_opcodes table, which represents a PC relative immediate load into register, possibly followed by an add operation to adjust the SP. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124448&r1=124447&r2=124448&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Thu Jan 27 16:52:23 2011 @@ -21,6 +21,7 @@ { eContextInvalid = 0, eContextReadOpcode, + eContextReadMemory, eContextImmediate, eContextPushRegisterOnStack, eContextAdjustStackPointer, Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124448&r1=124447&r2=124448&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Thu Jan 27 16:52:23 2011 @@ -253,6 +253,71 @@ return true; } +// PC relative immediate load into register, possibly followed by ADD (SP plus register). +// LDR (literal) +static bool +emulate_ldr_rd_pc_rel (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); NullCheckIfThumbEE(15); + base = Align(PC,4); + address = if add then (base + imm32) else (base - imm32); + data = MemU[address,4]; + if t == 15 then + if address<1:0> == ???00??? then LoadWritePC(data); else UNPREDICTABLE; + elsif UnalignedSupport() || address<1:0> = ???00??? then + R[t] = data; + else // Can only apply before ARMv7 + if CurrentInstrSet() == InstrSet_ARM then + R[t] = ROR(data, 8*UInt(address<1:0>)); + else + R[t] = bits(32) UNKNOWN; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const uint32_t pc = emulator->ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, 0, &success); + if (!success) + return false; + uint32_t Rd; // the destination register + uint32_t imm32; // immediate offset from the PC + addr_t addr; // the PC relative address + uint32_t data; // the literal data value from the PC relative load + switch (encoding) { + case eEncodingT1: + Rd = Bits32(opcode, 10, 8); + imm32 = Bits32(opcode, 7, 0) << 2; // imm32 = ZeroExtend(imm8:'00', 32); + addr = pc + 4 + imm32; + break; + default: + return false; + } + EmulateInstruction::Context read_data_context = {EmulateInstruction::eContextReadMemory, 0, 0, 0}; + success = false; + data = emulator->ReadMemoryUnsigned(read_data_context, addr, 4, 0, &success); + if (!success) + return false; + + EmulateInstruction::Context context = { EmulateInstruction::eContextImmediate, + eRegisterKindDWARF, + dwarf_r0 + Rd, + data }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, data)) + return false; + } + return true; +} + // An add operation to adjust the SP. // ADD (SP plus register) static bool @@ -555,7 +620,7 @@ { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, "sub sp, sp, #"}, // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; - { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, "str Rt, [sp, #-]!" }, + { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, "str Rt, [sp, #-imm12]!" }, // vector push consecutive extension register(s) { 0x0fbf0f00, 0x0d2d0b00, ARMv6T2|ARMv7, eEncodingA1, eSize32, emulate_vpush, "vpush.64 "}, @@ -570,13 +635,16 @@ { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w " }, // set r7 to point to a stack offset - { 0xffffff00, 0x000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #" }, + { 0xffffff00, 0x000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #imm" }, + + // PC relative load into register (see also emulate_add_sp_rm) + { 0xfffff800, 0x00004800, ARMvAll, eEncodingT1, eSize16, emulate_ldr_rd_pc_rel, "ldr , [PC, #imm]"}, // adjust the stack pointer { 0xffffff87, 0x00004485, ARMvAll, eEncodingT2, eSize16, emulate_add_sp_rm, "add sp, "}, - { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "add sp, sp, #"}, + { 0xffffff80, 0x0000b080, ARMvAll, eEncodingT1, eSize16, emulate_sub_sp_imm, "add sp, sp, #imm"}, { 0xfbef8f00, 0xf1ad0d00, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_sub_sp_imm, "sub.w sp, sp, #"}, - { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, "subw sp, sp, #"}, + { 0xfbff8f00, 0xf2ad0d00, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_sub_sp_imm, "subw sp, sp, #imm12"}, // vector push consecutive extension register(s) { 0xffbf0f00, 0xed2d0b00, ARMv6T2|ARMv7, eEncodingT1, eSize32, emulate_vpush, "vpush.64 "}, From ctice at apple.com Thu Jan 27 18:19:58 2011 From: ctice at apple.com (Caroline Tice) Date: Fri, 28 Jan 2011 00:19:58 -0000 Subject: [Lldb-commits] [lldb] r124459 - /lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20110128001958.A72A02A6C12C@llvm.org> Author: ctice Date: Thu Jan 27 18:19:58 2011 New Revision: 124459 URL: http://llvm.org/viewvc/llvm-project?rev=124459&view=rev Log: If the user specfies one of stdin, stdout or stderr, don't automatically set the non-specified ones to /dev/null. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 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=124459&r1=124458&r2=124459&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jan 27 18:19:58 2011 @@ -1845,14 +1845,27 @@ lldb_utility::PseudoTerminal pty; const char *stdio_path = NULL; if (launch_process && - stdin_path == NULL && - stdout_path == NULL && - stderr_path == NULL && + (stdin_path == NULL || stdout_path == NULL || stderr_path == NULL) && m_local_debugserver && no_stdio == false) { if (pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, NULL, 0)) - stdio_path = pty.GetSlaveName (NULL, 0); + { + const char *slave_name = pty.GetSlaveName (NULL, 0); + if (stdin_path == NULL + && stdout_path == NULL + && stderr_path == NULL) + stdio_path = slave_name; + else + { + if (stdin_path == NULL) + stdin_path = slave_name; + if (stdout_path == NULL) + stdout_path = slave_name; + if (stderr_path == NULL) + stderr_path = slave_name; + } + } } // Start args with "debugserver /file/path -r --" From johnny.chen at apple.com Thu Jan 27 18:32:27 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 00:32:27 -0000 Subject: [Lldb-commits] [lldb] r124460 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110128003227.9538A2A6C12C@llvm.org> Author: johnny Date: Thu Jan 27 18:32:27 2011 New Revision: 124460 URL: http://llvm.org/viewvc/llvm-project?rev=124460&view=rev Log: Should provide more useful context info for the emulate_ldr_rd_pc_rel() impl. The context being that it's a PC relative load. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124460&r1=124459&r2=124460&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Thu Jan 27 18:32:27 2011 @@ -288,6 +288,12 @@ const uint32_t pc = emulator->ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, 0, &success); if (!success) return false; + + // PC relative immediate load context + EmulateInstruction::Context context = {EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, + 0}; uint32_t Rd; // the destination register uint32_t imm32; // immediate offset from the PC addr_t addr; // the PC relative address @@ -297,21 +303,14 @@ Rd = Bits32(opcode, 10, 8); imm32 = Bits32(opcode, 7, 0) << 2; // imm32 = ZeroExtend(imm8:'00', 32); addr = pc + 4 + imm32; + context.arg2 = 4 + imm32; break; default: return false; } - EmulateInstruction::Context read_data_context = {EmulateInstruction::eContextReadMemory, 0, 0, 0}; - success = false; - data = emulator->ReadMemoryUnsigned(read_data_context, addr, 4, 0, &success); + data = emulator->ReadMemoryUnsigned(context, addr, 4, 0, &success); if (!success) - return false; - - EmulateInstruction::Context context = { EmulateInstruction::eContextImmediate, - eRegisterKindDWARF, - dwarf_r0 + Rd, - data }; - + return false; if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, data)) return false; } From jingham at apple.com Thu Jan 27 20:21:37 2011 From: jingham at apple.com (Jim Ingham) Date: Fri, 28 Jan 2011 02:21:37 -0000 Subject: [Lldb-commits] [lldb] r124463 - /lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Message-ID: <20110128022137.A92372A6C12C@llvm.org> Author: jingham Date: Thu Jan 27 20:21:37 2011 New Revision: 124463 URL: http://llvm.org/viewvc/llvm-project?rev=124463&view=rev Log: The thread_info changes over the life of the thread, so you can't get it once and cache it, you have to fetch it every time you want to use it. Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=124463&r1=124462&r2=124463&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Thu Jan 27 20:21:37 2011 @@ -672,11 +672,11 @@ MachThread::GetIdentifierInfo () { #ifdef THREAD_IDENTIFIER_INFO_COUNT - if (m_ident_info.thread_id == 0) - { + // Don't try to get the thread info once and cache it for the life of the thread. It changes over time, for instance + // if the thread name changes, then the thread_handle also changes... So you have to refetch it every time. mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; - return ::thread_info (ThreadID(), THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count) == KERN_SUCCESS; - } + kern_return_t kret = ::thread_info (ThreadID(), THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count); + return kret == KERN_SUCCESS; #endif return false; From jingham at apple.com Thu Jan 27 20:23:12 2011 From: jingham at apple.com (Jim Ingham) Date: Fri, 28 Jan 2011 02:23:12 -0000 Subject: [Lldb-commits] [lldb] r124464 - /lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20110128022312.5842D2A6C12C@llvm.org> Author: jingham Date: Thu Jan 27 20:23:12 2011 New Revision: 124464 URL: http://llvm.org/viewvc/llvm-project?rev=124464&view=rev Log: Fix a little thinko in sending down the thread name to SetName. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 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=124464&r1=124463&r2=124464&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jan 27 20:23:12 2011 @@ -1095,7 +1095,7 @@ ThreadGDBRemote *gdb_thread = static_cast (thread_sp.get()); gdb_thread->SetThreadDispatchQAddr (thread_dispatch_qaddr); - gdb_thread->SetName (thread_name.empty() ? thread_name.c_str() : NULL); + gdb_thread->SetName (thread_name.empty() ? NULL : thread_name.c_str()); if (exc_type != 0) { const size_t exc_data_size = exc_data.size(); From johnny.chen at apple.com Thu Jan 27 20:26:08 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 02:26:08 -0000 Subject: [Lldb-commits] [lldb] r124466 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110128022608.2C0AA2A6C12D@llvm.org> Author: johnny Date: Thu Jan 27 20:26:08 2011 New Revision: 124466 URL: http://llvm.org/viewvc/llvm-project?rev=124466&view=rev Log: Add emulate_sub_r7_ip_imm() (set frame pointer to some ip offset) and emulate_sub_ip_sp_imm() ( set ip to some stack offset) entries to the g_arm_opcodes table. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124466&r1=124465&r2=124466&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Thu Jan 27 20:26:08 2011 @@ -376,6 +376,116 @@ return true; } +// Set r7 to point to some ip offset. +// SUB (immediate) +static bool +emulate_sub_r7_ip_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + (result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ???1???); + if d == 15 then // Can only occur for ARM encoding + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + APSR.C = carry; + APSR.V = overflow; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t ip = emulator->ReadRegisterUnsigned (eRegisterKindDWARF, dwarf_r12, 0, &success); + if (!success) + return false; + uint32_t imm32; + switch (encoding) { + case eEncodingA1: + imm32 = ARMExpandImm(opcode); // imm32 = ARMExpandImm(imm12) + break; + default: + return false; + } + addr_t ip_offset = imm32; + addr_t addr = ip - ip_offset; // the adjusted ip value + + EmulateInstruction::Context context = { EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindDWARF, + dwarf_r12, + -ip_offset }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r7, addr)) + return false; + } + return true; +} + +// Set ip to point to some stack offset. +// SUB (SP minus immediate) +static bool +emulate_sub_ip_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + (result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ???1???); + if d == 15 then // Can only occur for ARM encoding + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + APSR.C = carry; + APSR.V = overflow; + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t imm32; + switch (encoding) { + case eEncodingA1: + imm32 = ARMExpandImm(opcode); // imm32 = ARMExpandImm(imm12) + break; + default: + return false; + } + addr_t sp_offset = imm32; + addr_t addr = sp - sp_offset; // the adjusted stack pointer value + + EmulateInstruction::Context context = { EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_SP, + -sp_offset }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r12, addr)) + return false; + } + return true; +} + // A sub operation to adjust the SP -- allocate space for local storage. static bool emulate_sub_sp_imm (EmulateInstructionARM *emulator, ARMEncoding encoding) @@ -612,8 +722,10 @@ // set r7 to point to a stack offset { 0x0ffff000, 0x028d7000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add r7, sp, #" }, + { 0x0ffff000, 0xe24c7000, ARMvAll, eEncodingA1, eSize32, emulate_sub_r7_ip_imm, "sub r7, ip, #"}, // set ip to point to a stack offset { 0x0ffff000, 0x028dc000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add ip, sp, #" }, + { 0x0ffff000, 0xe24dc000, ARMvAll, eEncodingA1, eSize32, emulate_sub_ip_sp_imm, "sub ip, sp, #"}, // adjust the stack pointer { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, "sub sp, sp, #"}, From johnny.chen at apple.com Fri Jan 28 11:22:29 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 17:22:29 -0000 Subject: [Lldb-commits] [lldb] r124488 - /lldb/trunk/test/make/Makefile.rules Message-ID: <20110128172230.072802A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 11:22:29 2011 New Revision: 124488 URL: http://llvm.org/viewvc/llvm-project?rev=124488&view=rev Log: Minor comment change. Modified: lldb/trunk/test/make/Makefile.rules Modified: lldb/trunk/test/make/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=124488&r1=124487&r2=124488&view=diff ============================================================================== --- lldb/trunk/test/make/Makefile.rules (original) +++ lldb/trunk/test/make/Makefile.rules Fri Jan 28 11:22:29 2011 @@ -186,3 +186,8 @@ @echo ' origin = $(origin $*)' @echo ' flavor = $(flavor $*)' @echo ' value = $(value $*)' + + +### Local Variables: ### +### mode:makefile ### +### End: ### From ctice at apple.com Fri Jan 28 11:31:28 2011 From: ctice at apple.com (Caroline Tice) Date: Fri, 28 Jan 2011 17:31:28 -0000 Subject: [Lldb-commits] [lldb] r124489 - in /lldb/trunk/test/process_io: ./ Makefile TestProcessIO.py input-file.txt main.cpp Message-ID: <20110128173128.7118F2A6C12C@llvm.org> Author: ctice Date: Fri Jan 28 11:31:28 2011 New Revision: 124489 URL: http://llvm.org/viewvc/llvm-project?rev=124489&view=rev Log: Add tests for 'process launch' I/O flags. Added: lldb/trunk/test/process_io/ lldb/trunk/test/process_io/Makefile lldb/trunk/test/process_io/TestProcessIO.py lldb/trunk/test/process_io/input-file.txt lldb/trunk/test/process_io/main.cpp Added: lldb/trunk/test/process_io/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/Makefile?rev=124489&view=auto ============================================================================== --- lldb/trunk/test/process_io/Makefile (added) +++ lldb/trunk/test/process_io/Makefile Fri Jan 28 11:31:28 2011 @@ -0,0 +1,6 @@ +LEVEL = ../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules + Added: lldb/trunk/test/process_io/TestProcessIO.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/TestProcessIO.py?rev=124489&view=auto ============================================================================== --- lldb/trunk/test/process_io/TestProcessIO.py (added) +++ lldb/trunk/test/process_io/TestProcessIO.py Fri Jan 28 11:31:28 2011 @@ -0,0 +1,119 @@ +""" +Test lldb process IO launch flags.. +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class ProcessLaunchIOTestCase(TestBase): + + mydir = "process_io" + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + def test_with_dsym (self): + self.buildDsym () + self.process_io_test () + + def test_with_dwarf (self): + self.buildDwarf () + self.process_io_test () + + def do_nothing (self): + i = 1 + + def process_io_test (self): + exe = os.path.join (os.getcwd(), "a.out") + self.expect("file " + exe, + patterns = [ "Current executable set to .*a.out" ]) + + + in_file = os.path.join (os.getcwd(), "input-file.txt") + out_file = os.path.join (os.getcwd(), "output-test.out") + err_file = os.path.join (os.getcwd(), "output-test.err") + + + # Make sure the output files do not exist before launching the process + try: + os.remove (out_file) + except OSError: + # do_nothing (self) + i = 1 + + try: + os.remove (err_file) + except OSError: + # do_nothing (self) + i = 1 + + launch_command = "process launch -i " + in_file + " -o " + out_file + " -e " + err_file + + self.expect (launch_command, + patterns = [ "Process .* launched: .*a.out" ]) + + + success = True + err_msg = "" + + # Check to see if the 'stdout' file was created + try: + out_f = open (out_file) + except IOError: + success = False + err_msg = err_msg + " ERROR: stdout file was not created.\n" + else: + # Check to see if the 'stdout' file contains the right output + line = out_f.readline (); + if line != "This should go to stdout.\n": + success = False + err_msg = err_msg + " ERROR: stdout file does not contain correct output.\n" + out_f.close(); + + # Try to delete the 'stdout' file + try: + os.remove (out_file) + except OSError: + # do_nothing (self) + i = 1 + + # Check to see if the 'stderr' file was created + try: + err_f = open (err_file) + except IOError: + success = False + err_msg = err_msg + " ERROR: stderr file was not created.\n" + else: + # Check to see if the 'stderr' file contains the right output + line = err_f.readline () + if line != "This should go to stderr.\n": + success = False + err_msg = err_msg + " ERROR: stderr file does not contain correct output.\n\ +" + err_f.close() + + # Try to delete the 'stderr' file + try: + os.remove (err_file) + except OSError: + # do_nothing (self) + i = 1 + + if not success: + # This test failed, but we need to make the main testing + # mechanism realize something is wrong. + # + # First, print out the real error message. + self.fail (err_msg) + #print err_msg + + # Second, force a test case to fail: + #self.expect ("help quit", + # patterns = ["Intentional failure .*"]) + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() + Added: lldb/trunk/test/process_io/input-file.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/input-file.txt?rev=124489&view=auto ============================================================================== --- lldb/trunk/test/process_io/input-file.txt (added) +++ lldb/trunk/test/process_io/input-file.txt Fri Jan 28 11:31:28 2011 @@ -0,0 +1,2 @@ +This should go to stdout. +This should go to stderr. Added: lldb/trunk/test/process_io/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/main.cpp?rev=124489&view=auto ============================================================================== --- lldb/trunk/test/process_io/main.cpp (added) +++ lldb/trunk/test/process_io/main.cpp Fri Jan 28 11:31:28 2011 @@ -0,0 +1,17 @@ +#include +#include + +int +main (int argc, char **argv) +{ + char buffer[1024]; + + fgets (buffer, sizeof (buffer), stdin); + fprintf (stdout, "%s", buffer); + + + fgets (buffer, sizeof (buffer), stdin); + fprintf (stderr, "%s", buffer); + + return 0; +} From ctice at apple.com Fri Jan 28 11:34:54 2011 From: ctice at apple.com (Caroline Tice) Date: Fri, 28 Jan 2011 17:34:54 -0000 Subject: [Lldb-commits] [lldb] r124490 - /lldb/trunk/test/process_io/TestProcessIO.py Message-ID: <20110128173454.5362C2A6C12C@llvm.org> Author: ctice Date: Fri Jan 28 11:34:54 2011 New Revision: 124490 URL: http://llvm.org/viewvc/llvm-project?rev=124490&view=rev Log: Remove comments I accidentally left in before. Modified: lldb/trunk/test/process_io/TestProcessIO.py Modified: lldb/trunk/test/process_io/TestProcessIO.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/TestProcessIO.py?rev=124490&r1=124489&r2=124490&view=diff ============================================================================== --- lldb/trunk/test/process_io/TestProcessIO.py (original) +++ lldb/trunk/test/process_io/TestProcessIO.py Fri Jan 28 11:34:54 2011 @@ -100,16 +100,7 @@ i = 1 if not success: - # This test failed, but we need to make the main testing - # mechanism realize something is wrong. - # - # First, print out the real error message. self.fail (err_msg) - #print err_msg - - # Second, force a test case to fail: - #self.expect ("help quit", - # patterns = ["Intentional failure .*"]) if __name__ == '__main__': import atexit From ctice at apple.com Fri Jan 28 12:31:34 2011 From: ctice at apple.com (Caroline Tice) Date: Fri, 28 Jan 2011 18:31:34 -0000 Subject: [Lldb-commits] [lldb] r124495 - /lldb/trunk/test/process_io/TestProcessIO.py Message-ID: <20110128183134.4121E2A6C12C@llvm.org> Author: ctice Date: Fri Jan 28 12:31:34 2011 New Revision: 124495 URL: http://llvm.org/viewvc/llvm-project?rev=124495&view=rev Log: Add comment. Modified: lldb/trunk/test/process_io/TestProcessIO.py Modified: lldb/trunk/test/process_io/TestProcessIO.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/process_io/TestProcessIO.py?rev=124495&r1=124494&r2=124495&view=diff ============================================================================== --- lldb/trunk/test/process_io/TestProcessIO.py (original) +++ lldb/trunk/test/process_io/TestProcessIO.py Fri Jan 28 12:31:34 2011 @@ -24,6 +24,7 @@ i = 1 def process_io_test (self): + """Test that process launch I/O redirection flags work properly.""" exe = os.path.join (os.getcwd(), "a.out") self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ]) From johnny.chen at apple.com Fri Jan 28 13:30:12 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 19:30:12 -0000 Subject: [Lldb-commits] [lldb] r124499 - /lldb/trunk/test/command_source/TestCommandSource.py Message-ID: <20110128193012.31BB32A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 13:30:12 2011 New Revision: 124499 URL: http://llvm.org/viewvc/llvm-project?rev=124499&view=rev Log: Hardened the test_command_source() test case by actually capturing the output from running the "script my.date()" lldb command and comparing it against our expected result. Modified: lldb/trunk/test/command_source/TestCommandSource.py Modified: lldb/trunk/test/command_source/TestCommandSource.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/TestCommandSource.py?rev=124499&r1=124498&r2=124499&view=diff ============================================================================== --- lldb/trunk/test/command_source/TestCommandSource.py (original) +++ lldb/trunk/test/command_source/TestCommandSource.py Fri Jan 28 13:30:12 2011 @@ -20,9 +20,23 @@ # the "my" package that defines the date() function. self.runCmd("command source .lldb") + # Let's temporarily redirect the stdout to our StringIO session object + # in order to capture the script evaluation output. + old_stdout = sys.stdout + session = StringIO.StringIO() + sys.stdout = session + # Python should evaluate "my.date()" successfully. self.runCmd("script my.date()") + import datetime + self.expect(session.getvalue(), "script my.date() runs successfully", + exe=False, + substrs = [str(datetime.date.today())]) + + # Now restore stdout to the way we were. :-) + sys.stdout = old_stdout + if __name__ == '__main__': import atexit From johnny.chen at apple.com Fri Jan 28 13:39:06 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 19:39:06 -0000 Subject: [Lldb-commits] [lldb] r124500 - /lldb/trunk/test/command_source/TestCommandSource.py Message-ID: <20110128193906.B0A3B2A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 13:39:06 2011 New Revision: 124500 URL: http://llvm.org/viewvc/llvm-project?rev=124500&view=rev Log: The restoring of sys.stdout should happen right after: self.runCmd("script my.date()") In case the self.expect() fails, the restore would not be executed. Modified: lldb/trunk/test/command_source/TestCommandSource.py Modified: lldb/trunk/test/command_source/TestCommandSource.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/TestCommandSource.py?rev=124500&r1=124499&r2=124500&view=diff ============================================================================== --- lldb/trunk/test/command_source/TestCommandSource.py (original) +++ lldb/trunk/test/command_source/TestCommandSource.py Fri Jan 28 13:39:06 2011 @@ -29,14 +29,14 @@ # Python should evaluate "my.date()" successfully. self.runCmd("script my.date()") + # Now restore stdout to the way we were. :-) + sys.stdout = old_stdout + import datetime self.expect(session.getvalue(), "script my.date() runs successfully", exe=False, substrs = [str(datetime.date.today())]) - # Now restore stdout to the way we were. :-) - sys.stdout = old_stdout - if __name__ == '__main__': import atexit From johnny.chen at apple.com Fri Jan 28 13:57:26 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 19:57:26 -0000 Subject: [Lldb-commits] [lldb] r124501 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110128195726.1EC472A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 13:57:25 2011 New Revision: 124501 URL: http://llvm.org/viewvc/llvm-project?rev=124501&view=rev Log: Add emulate_mov_rd_sp() entries to the g_arm_opcodes and g_thumb_opcodes tables. For prolog instructions which set r7 or ip to the stack pointer. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124501&r1=124500&r2=124501&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Fri Jan 28 13:57:25 2011 @@ -253,6 +253,61 @@ return true; } +// Set r7 or ip to the current stack pointer. +// MOV (register) +static bool +emulate_mov_rd_sp (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + result = R[m]; + if d == 15 then + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + // APSR.C unchanged + // APSR.V unchanged + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + const addr_t sp = emulator->ReadRegisterUnsigned (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, 0, &success); + if (!success) + return false; + uint32_t Rd; // the destination register + switch (encoding) { + case eEncodingT1: + Rd = 7; + break; + case eEncodingA1: + Rd = 12; + break; + default: + return false; + } + EmulateInstruction::Context context = { EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_SP, + 0 }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, sp)) + return false; + } + return true; +} + // PC relative immediate load into register, possibly followed by ADD (SP plus register). // LDR (literal) static bool @@ -722,14 +777,16 @@ // set r7 to point to a stack offset { 0x0ffff000, 0x028d7000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add r7, sp, #" }, - { 0x0ffff000, 0xe24c7000, ARMvAll, eEncodingA1, eSize32, emulate_sub_r7_ip_imm, "sub r7, ip, #"}, + { 0x0ffff000, 0x024c7000, ARMvAll, eEncodingA1, eSize32, emulate_sub_r7_ip_imm, "sub r7, ip, #"}, // set ip to point to a stack offset + { 0x0fffffff, 0x01a0c00d, ARMvAll, eEncodingA1, eSize32, emulate_mov_rd_sp, "mov ip, sp" }, { 0x0ffff000, 0x028dc000, ARMvAll, eEncodingA1, eSize32, emulate_add_rd_sp_imm, "add ip, sp, #" }, - { 0x0ffff000, 0xe24dc000, ARMvAll, eEncodingA1, eSize32, emulate_sub_ip_sp_imm, "sub ip, sp, #"}, + { 0x0ffff000, 0x024dc000, ARMvAll, eEncodingA1, eSize32, emulate_sub_ip_sp_imm, "sub ip, sp, #"}, // adjust the stack pointer { 0x0ffff000, 0x024dd000, ARMvAll, eEncodingA1, eSize32, emulate_sub_sp_imm, "sub sp, sp, #"}, + // push one register // if Rn == '1101' && imm12 == '000000000100' then SEE PUSH; { 0x0fff0000, 0x052d0000, ARMvAll, eEncodingA1, eSize32, emulate_str_rt_sp, "str Rt, [sp, #-imm12]!" }, @@ -746,7 +803,8 @@ { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w " }, // set r7 to point to a stack offset - { 0xffffff00, 0x000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #imm" }, + { 0xffffff00, 0x0000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #imm" }, + { 0xffffffff, 0x0000466f, ARMvAll, eEncodingT1, eSize16, emulate_mov_rd_sp, "mov r7, sp" }, // PC relative load into register (see also emulate_add_sp_rm) { 0xfffff800, 0x00004800, ARMvAll, eEncodingT1, eSize16, emulate_ldr_rd_pc_rel, "ldr , [PC, #imm]"}, From johnny.chen at apple.com Fri Jan 28 14:59:39 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 28 Jan 2011 20:59:39 -0000 Subject: [Lldb-commits] [lldb] r124504 - /lldb/trunk/test/command_source/TestCommandSource.py Message-ID: <20110128205939.99C4E2A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 14:59:39 2011 New Revision: 124504 URL: http://llvm.org/viewvc/llvm-project?rev=124504&view=rev Log: Add "import sys" for sys.stdout. Modified: lldb/trunk/test/command_source/TestCommandSource.py Modified: lldb/trunk/test/command_source/TestCommandSource.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_source/TestCommandSource.py?rev=124504&r1=124503&r2=124504&view=diff ============================================================================== --- lldb/trunk/test/command_source/TestCommandSource.py (original) +++ lldb/trunk/test/command_source/TestCommandSource.py Fri Jan 28 14:59:39 2011 @@ -4,7 +4,7 @@ See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673. """ -import os, time +import os, sys import unittest2 import lldb from lldbtest import * From johnny.chen at apple.com Fri Jan 28 18:11:15 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 29 Jan 2011 00:11:15 -0000 Subject: [Lldb-commits] [lldb] r124509 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Message-ID: <20110129001116.0480C2A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 18:11:15 2011 New Revision: 124509 URL: http://llvm.org/viewvc/llvm-project?rev=124509&view=rev Log: Add emulate_mov_low_high() entry to the g_thumb_opcodes table to capture moving of high registers to low registers in the prologue so they can be saved. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124509&r1=124508&r2=124509&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Fri Jan 28 18:11:15 2011 @@ -277,9 +277,9 @@ #endif bool success = false; - const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); - if (!success) - return false; + //const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + //if (!success) + // return false; if (emulator->ConditionPassed()) { @@ -308,6 +308,62 @@ return true; } +// Move from high register (r8-r15) to low register (r0-r7). +// MOV (register) +static bool +emulate_mov_low_high (EmulateInstructionARM *emulator, ARMEncoding encoding) +{ +#if 0 + // ARM pseudo code... + if (ConditionPassed()) + { + EncodingSpecificOperations(); + result = R[m]; + if d == 15 then + ALUWritePC(result); // setflags is always FALSE here + else + R[d] = result; + if setflags then + APSR.N = result<31>; + APSR.Z = IsZeroBit(result); + // APSR.C unchanged + // APSR.V unchanged + } +#endif + + bool success = false; + const uint32_t opcode = emulator->OpcodeAsUnsigned (&success); + if (!success) + return false; + + if (emulator->ConditionPassed()) + { + uint32_t Rm; // the source register + uint32_t Rd; // the destination register + switch (encoding) { + case eEncodingT1: + Rm = Bits32(opcode, 6, 3); + Rd = Bits32(opcode, 2, 1); // bits(7) == 0 + break; + default: + return false; + } + int32_t reg_value = emulator->ReadRegisterUnsigned(eRegisterKindDWARF, dwarf_r0 + Rm, 0, &success); + if (!success) + return false; + + // The context specifies that Rm is to be moved into Rd. + EmulateInstruction::Context context = { EmulateInstruction::eContextRegisterPlusOffset, + eRegisterKindDWARF, + dwarf_r0 + Rm, + 0 }; + + if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, reg_value)) + return false; + } + return true; +} + // PC relative immediate load into register, possibly followed by ADD (SP plus register). // LDR (literal) static bool @@ -801,6 +857,8 @@ { 0xfffffe00, 0x0000b400, ARMvAll, eEncodingT1, eSize16, emulate_push, "push " }, { 0xffff0000, 0xe92d0000, ARMv6T2|ARMv7, eEncodingT2, eSize32, emulate_push, "push.w " }, { 0xffff0fff, 0xf84d0d04, ARMv6T2|ARMv7, eEncodingT3, eSize32, emulate_push, "push.w " }, + // move from high register to low register + { 0xffffffc0, 0x00004640, ARMvAll, eEncodingT1, eSize16, emulate_mov_low_high, "mov r0-r7, r8-r15" }, // set r7 to point to a stack offset { 0xffffff00, 0x0000af00, ARMvAll, eEncodingT1, eSize16, emulate_add_rd_sp_imm, "add r7, sp, #imm" }, From ctice at apple.com Fri Jan 28 18:19:53 2011 From: ctice at apple.com (Caroline Tice) Date: Sat, 29 Jan 2011 00:19:53 -0000 Subject: [Lldb-commits] [lldb] r124510 - in /lldb/trunk/test/logging: ./ Makefile TestLogging.py main.cpp Message-ID: <20110129001954.035342A6C12C@llvm.org> Author: ctice Date: Fri Jan 28 18:19:53 2011 New Revision: 124510 URL: http://llvm.org/viewvc/llvm-project?rev=124510&view=rev Log: Add a test case to check logging of command processing. Currently this test case works fine run by itself, but fails when run in the entire test suite; Johnny requested that I check it in so that he can look at it. Added: lldb/trunk/test/logging/ lldb/trunk/test/logging/Makefile lldb/trunk/test/logging/TestLogging.py lldb/trunk/test/logging/main.cpp Added: lldb/trunk/test/logging/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/Makefile?rev=124510&view=auto ============================================================================== --- lldb/trunk/test/logging/Makefile (added) +++ lldb/trunk/test/logging/Makefile Fri Jan 28 18:19:53 2011 @@ -0,0 +1,5 @@ +LEVEL = ../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/logging/TestLogging.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/TestLogging.py?rev=124510&view=auto ============================================================================== --- lldb/trunk/test/logging/TestLogging.py (added) +++ lldb/trunk/test/logging/TestLogging.py Fri Jan 28 18:19:53 2011 @@ -0,0 +1,93 @@ +""" +Test lldb logging. +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class LogTestCase(TestBase): + + mydir = "logging" + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + def test_with_dsym (self): + self.buildDsym () + self.command_log_tests () + + def test_with_dwarf (self): + self.buildDwarf () + self.command_log_tests () + + def command_log_tests (self): + exe = os.path.join (os.getcwd(), "a.out") + self.expect("file " + exe, + patterns = [ "Current executable set to .*a.out" ]) + + log_file = os.path.join (os.getcwd(), "lldb-commands-log.txt") + + if (os.path.exists (log_file)): + os.remove (log_file) + + self.runCmd ("log enable lldb commands -f " + log_file) + + self.runCmd ("commands alias bp breakpoint") + + self.runCmd ("bp set -n main") + + self.runCmd ("bp l") + + expected_log_lines = [ + "com.apple.main-thread Processing command: commands alias bp breakpoint\n", + "com.apple.main-thread HandleCommand, cmd_obj : 'commands alias'\n", + "com.apple.main-thread HandleCommand, revised_command_line: 'commands alias bp breakpoint'\n", + "com.apple.main-thread HandleCommand, wants_raw_input:'True'\n", + "com.apple.main-thread HandleCommand, command line after removing command name(s): 'bp breakpoint'\n", + "\n", + "com.apple.main-thread Processing command: bp set -n main\n", + "com.apple.main-thread HandleCommand, cmd_obj : 'breakpoint set'\n", + "com.apple.main-thread HandleCommand, revised_command_line: 'breakpoint set -n main'\n", + "com.apple.main-thread HandleCommand, wants_raw_input:'False'\n", + "com.apple.main-thread HandleCommand, command line after removing command name(s): '-n main'\n", + "\n", + "com.apple.main-thread Processing command: bp l\n", + "com.apple.main-thread HandleCommand, cmd_obj : 'breakpoint list'\n", + "com.apple.main-thread HandleCommand, revised_command_line: 'breakpoint l'\n", + "com.apple.main-thread HandleCommand, wants_raw_input:'False'\n", + "com.apple.main-thread HandleCommand, command line after removing command name(s): ''\n", + "\n" + ] + + self.assertTrue (os.path.isfile (log_file)) + + idx = 0 + end = len (expected_log_lines) + f = open (log_file) + log_lines = f.readlines() + f.close () + os.remove (log_file) + + err_msg = "" + success = True + + if len (log_lines) != len (expected_log_lines): + success = False + err_msg = "Wrong number of lines in log file; expected: " + repr (len (expected_log_lines)) + " found: " + repr(len (log_lines)) + else: + for line1, line2 in zip (log_lines, expected_log_lines): + if line1 != line2: + success = False + err_msg = "Expected '" + line2 + "'; Found '" + line1 + "'" + break + + if not success: + self.fail (err_msg) + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() + Added: lldb/trunk/test/logging/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/main.cpp?rev=124510&view=auto ============================================================================== --- lldb/trunk/test/logging/main.cpp (added) +++ lldb/trunk/test/logging/main.cpp Fri Jan 28 18:19:53 2011 @@ -0,0 +1,62 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + +int +product (int x, int y) +{ + int result = x * y; + return result; +} + +int +sum (int a, int b) +{ + int result = a + b; + return result; +} + +int +strange_max (int m, int n) +{ + if (m > n) + return m; + else if (n > m) + return n; + else + return 0; +} + +int +foo (int i, int j) +{ + if (strange_max (i, j) == i) + return product (i, j); + else if (strange_max (i, j) == j) + return sum (i, j); + else + return product (sum (i, i), sum (j, j)); +} + +int +main(int argc, char const *argv[]) +{ + + int array[3]; + + array[0] = foo (1238, 78392); + array[1] = foo (379265, 23674); + array[2] = foo (872934, 234); + + return 0; +} From ctice at apple.com Fri Jan 28 18:20:56 2011 From: ctice at apple.com (Caroline Tice) Date: Sat, 29 Jan 2011 00:20:56 -0000 Subject: [Lldb-commits] [lldb] r124511 - /lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Message-ID: <20110129002056.5D1872A6C12C@llvm.org> Author: ctice Date: Fri Jan 28 18:20:56 2011 New Revision: 124511 URL: http://llvm.org/viewvc/llvm-project?rev=124511&view=rev Log: Add a test case to verify that the frame and breakpoint location are being properly passed down to script breakpoint commands. Modified: lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Modified: lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py?rev=124511&r1=124510&r2=124511&view=diff ============================================================================== --- lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py (original) +++ lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Fri Jan 28 18:20:56 2011 @@ -21,11 +21,13 @@ """Test a sequence of breakpoint command add, list, and remove.""" self.buildDsym() self.breakpoint_command_sequence() + self.breakpoint_command_script_parameters () def test_with_dwarf(self): """Test a sequence of breakpoint command add, list, and remove.""" self.buildDwarf() self.breakpoint_command_sequence() + self.breakpoint_command_script_parameters () def setUp(self): # Call super's setUp(). @@ -127,6 +129,44 @@ self.expect("breakpoint list", BREAKPOINT_HIT_TWICE, substrs = ['resolved, hit count = 2']) + def breakpoint_command_script_parameters (self): + """Test that the frame and breakpoint location are being properly passed to the script breakpoint command function.""" + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Add a breakpoint. + self.expect("breakpoint set -f main.c -l %d" % self.line, + BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" % + self.line) + + # Now add callbacks for the breakpoints just created. + self.runCmd("breakpoint command add -p -o 'here = open(\"output-2.txt\", \"w\"); print >> here, frame; print >> here, bp_loc; here.close()' 1") + + # Remove 'output-2.txt' if it already exists. + + if (os.path.exists('output-2.txt')): + os.remove ('output-2.txt') + + # Run program, hit breakpoint, and hopefully write out new version of 'output-2.txt' + self.runCmd ("run", RUN_SUCCEEDED) + + # Check that the file 'output.txt' exists and contains the string "lldb". + + # The 'output-2.txt' file should now exist. + self.assertTrue(os.path.isfile("output-2.txt"), + "'output-2.txt' exists due to breakpoint command for breakpoint 1.") + + # Read the output file produced by running the program. + with open('output-2.txt', 'r') as f: + output = f.read() + + self.expect (output, "File 'output-2.txt' and the content matches", exe=False, + startstr = "frame #0:", + patterns = ["1.* where = .*main .* 11.* resolved, hit count = 1" ]) + + # Now remove 'output-2.txt' + os.remove ('output-2.txt') if __name__ == '__main__': import atexit From johnny.chen at apple.com Fri Jan 28 18:52:55 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 29 Jan 2011 00:52:55 -0000 Subject: [Lldb-commits] [lldb] r124513 - /lldb/trunk/test/logging/TestLogging.py Message-ID: <20110129005255.0DD362A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 18:52:54 2011 New Revision: 124513 URL: http://llvm.org/viewvc/llvm-project?rev=124513&view=rev Log: Use different log files for the two test cases in order not to confuse the logging subsystem. Modified: lldb/trunk/test/logging/TestLogging.py Modified: lldb/trunk/test/logging/TestLogging.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/TestLogging.py?rev=124513&r1=124512&r2=124513&view=diff ============================================================================== --- lldb/trunk/test/logging/TestLogging.py (original) +++ lldb/trunk/test/logging/TestLogging.py Fri Jan 28 18:52:54 2011 @@ -14,18 +14,18 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym (self): self.buildDsym () - self.command_log_tests () + self.command_log_tests ("dsym") def test_with_dwarf (self): self.buildDwarf () - self.command_log_tests () + self.command_log_tests ("dwarf") - def command_log_tests (self): + def command_log_tests (self, type): exe = os.path.join (os.getcwd(), "a.out") self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ]) - log_file = os.path.join (os.getcwd(), "lldb-commands-log.txt") + log_file = os.path.join (os.getcwd(), "lldb-commands-log-%s.txt" % type) if (os.path.exists (log_file)): os.remove (log_file) @@ -66,6 +66,7 @@ f = open (log_file) log_lines = f.readlines() f.close () + self.runCmd("log disable lldb") os.remove (log_file) err_msg = "" From johnny.chen at apple.com Fri Jan 28 19:16:52 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 29 Jan 2011 01:16:52 -0000 Subject: [Lldb-commits] [lldb] r124516 - /lldb/trunk/test/dotest.py Message-ID: <20110129011652.B62DC2A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 19:16:52 2011 New Revision: 124516 URL: http://llvm.org/viewvc/llvm-project?rev=124516&view=rev Log: Add a "-D" option to the test driver which dumps the Python sys.path variable to be used for the test run. Could be useful for debugging the setup of the test environment. 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=124516&r1=124515&r2=124516&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Fri Jan 28 19:16:52 2011 @@ -72,6 +72,9 @@ # Delay startup in order for the debugger to attach. delay = False +# Dump the Python sys.path variable. +dumpSysPath = False + # By default, failfast is False. Use '-F' to overwrite it. failfast = False @@ -123,6 +126,7 @@ -h : print this help message and exit (also --help) -A : specify the architecture to launch for the inferior process -C : specify the compiler used to build the inferior executable +-D : dump the Python sys.path variable -a : don't do lldb Python API tests use @python_api_test to decorate a test case as lldb Python API test +a : just do lldb Python API tests @@ -252,6 +256,7 @@ global configFile global count global delay + global dumpSysPath global failfast global filterspec global fs4all @@ -292,6 +297,9 @@ usage() os.environ["CC"] = sys.argv[index] index += 1 + elif sys.argv[index].startswith('-D'): + dumpSysPath = True + index += 1 elif sys.argv[index].startswith('-a'): dont_do_python_api_test = True index += 1 @@ -453,6 +461,7 @@ global rdir global testdirs + global dumpSysPath # Get the directory containing the current script. if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ: @@ -509,6 +518,8 @@ # This is to locate the lldb.py module. Insert it right after sys.path[0]. sys.path[1:1] = [lldbPath] + if dumpSysPath: + print "sys.path:", sys.path def doDelay(delta): From johnny.chen at apple.com Fri Jan 28 19:21:04 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 29 Jan 2011 01:21:04 -0000 Subject: [Lldb-commits] [lldb] r124517 - /lldb/trunk/test/dotest.py Message-ID: <20110129012104.DB4512A6C12C@llvm.org> Author: johnny Date: Fri Jan 28 19:21:04 2011 New Revision: 124517 URL: http://llvm.org/viewvc/llvm-project?rev=124517&view=rev Log: Added comment. 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=124517&r1=124516&r2=124517&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Fri Jan 28 19:21:04 2011 @@ -72,7 +72,7 @@ # Delay startup in order for the debugger to attach. delay = False -# Dump the Python sys.path variable. +# Dump the Python sys.path variable. Use '-D' to dump sys.path. dumpSysPath = False # By default, failfast is False. Use '-F' to overwrite it. From jingham at apple.com Fri Jan 28 19:49:25 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 29 Jan 2011 01:49:25 -0000 Subject: [Lldb-commits] [lldb] r124520 - in /lldb/trunk: include/lldb/Target/Process.h source/Commands/CommandObjectProcess.cpp source/Target/Process.cpp Message-ID: <20110129014925.652232A6C12C@llvm.org> Author: jingham Date: Fri Jan 28 19:49:25 2011 New Revision: 124520 URL: http://llvm.org/viewvc/llvm-project?rev=124520&view=rev Log: Added a completion action class to the Process events so that we can make things like Attach and later Launch start their job, and then return to the event loop while waiting for the work to be done. Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Commands/CommandObjectProcess.cpp 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=124520&r1=124519&r2=124520&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Fri Jan 28 19:49:25 2011 @@ -1795,6 +1795,59 @@ GetSP (); protected: + //------------------------------------------------------------------ + // lldb::ExecutionContextScope pure virtual functions + //------------------------------------------------------------------ + class NextEventAction + { + public: + typedef enum EventActionResult + { + eEventActionSuccess, + eEventActionRetry, + eEventActionExit + } EventActionResult; + + NextEventAction (Process *process) : + m_process(process) + {} + virtual ~NextEventAction() {} + + virtual EventActionResult PerformAction (lldb::EventSP &event_sp) = 0; + virtual void HandleBeingUnshipped () {}; + virtual EventActionResult HandleBeingInterrupted () = 0; + virtual const char *GetExitString() = 0; + protected: + Process *m_process; + }; + + void SetNextEventAction (Process::NextEventAction *next_event_action) + { + if (m_next_event_action) + { + m_next_event_action->HandleBeingUnshipped(); + delete m_next_event_action; + } + m_next_event_action = next_event_action; + } + + // This is the completer for Attaching: + class AttachCompletionHandler : public NextEventAction + { + public: + AttachCompletionHandler (Process *process) : + NextEventAction(process) + {} + virtual ~AttachCompletionHandler() {} + + virtual EventActionResult PerformAction (lldb::EventSP &event_sp); + virtual EventActionResult HandleBeingInterrupted (); + virtual const char *GetExitString(); + private: + std::string m_exit_string; + }; + + class MemoryCache { public: @@ -1867,6 +1920,7 @@ typedef std::map LanguageRuntimeCollection; LanguageRuntimeCollection m_language_runtimes; + NextEventAction *m_next_event_action; size_t RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const; @@ -1904,10 +1958,6 @@ lldb::StateType WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp); - Error - CompleteAttach (); - - // This waits for both the state change broadcaster, and the control broadcaster. // If control_only, it only waits for the control broadcaster. Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=124520&r1=124519&r2=124520&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Jan 28 19:49:25 2011 @@ -536,7 +536,8 @@ CommandReturnObject &result) { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - + bool synchronous_execution = m_interpreter.GetSynchronous (); + Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; if (process) { @@ -636,6 +637,24 @@ result.SetStatus (eReturnStatusFailed); return false; } + // If we're synchronous, wait for the stopped event and report that. + // Otherwise just return. + // FIXME: in the async case it will now be possible to get to the command + // interpreter with a state eStateAttaching. Make sure we handle that correctly. + if (synchronous_execution) + { + StateType state = process->WaitForProcessToStop (NULL); + + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state)); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + else + { + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Starting to attach to process."); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } } else { @@ -681,6 +700,21 @@ error.AsCString()); result.SetStatus (eReturnStatusFailed); } + // See comment for synchronous_execution above. + if (synchronous_execution) + { + StateType state = process->WaitForProcessToStop (NULL); + + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state)); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + else + { + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Starting to attach to process."); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } } else { Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124520&r1=124519&r2=124520&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jan 28 19:49:25 2011 @@ -237,7 +237,8 @@ m_stdio_communication ("process.stdio"), m_stdio_communication_mutex (Mutex::eMutexTypeRecursive), m_stdout_data (), - m_memory_cache () + m_memory_cache (), + m_next_event_action(NULL) { UpdateInstanceName(); @@ -273,6 +274,8 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Process::~Process()", this); + if (m_next_event_action) + SetNextEventAction(NULL); StopPrivateStateThread(); } @@ -1583,23 +1586,18 @@ return error; } -Error -Process::CompleteAttach () +Process::NextEventAction::EventActionResult +Process::AttachCompletionHandler::PerformAction (lldb::EventSP &event_sp) { - Error error; - - if (GetID() == LLDB_INVALID_PROCESS_ID) - { - error.SetErrorString("no process"); - } - - EventSP event_sp; - StateType state = WaitForProcessStopPrivate(NULL, event_sp); - if (state == eStateStopped || state == eStateCrashed) + StateType state = ProcessEventData::GetStateFromEvent (event_sp.get()); + switch (state) { - DidAttach (); + case eStateStopped: + case eStateCrashed: + { + m_process->DidAttach (); // Figure out which one is the executable, and set that in our target: - ModuleList &modules = GetTarget().GetImages(); + ModuleList &modules = m_process->GetTarget().GetImages(); size_t num_modules = modules.GetSize(); for (int i = 0; i < num_modules; i++) @@ -1607,31 +1605,37 @@ ModuleSP module_sp = modules.GetModuleAtIndex(i); if (module_sp->IsExecutable()) { - ModuleSP exec_module = GetTarget().GetExecutableModule(); + ModuleSP exec_module = m_process->GetTarget().GetExecutableModule(); if (!exec_module || exec_module != module_sp) { - GetTarget().SetExecutableModule (module_sp, false); + m_process->GetTarget().SetExecutableModule (module_sp, false); } break; } } - - // This delays passing the stopped event to listeners till DidLaunch gets - // a chance to complete... - HandlePrivateEvent(event_sp); - StartPrivateStateThread(); - } - else - { - // We exited while trying to launch somehow. Don't call DidLaunch as that's - // not likely to work, and return an invalid pid. - if (state == eStateExited) - HandlePrivateEvent (event_sp); - error.SetErrorStringWithFormat("invalid state after attach: %s", - lldb_private::StateAsCString(state)); + return eEventActionSuccess; + } + break; + default: + case eStateExited: + case eStateInvalid: + m_exit_string.assign ("No valid Process"); + return eEventActionExit; + break; } - return error; +} + +Process::NextEventAction::EventActionResult +Process::AttachCompletionHandler::HandleBeingInterrupted() +{ + return eEventActionSuccess; +} + +const char * +Process::AttachCompletionHandler::GetExitString () +{ + return m_exit_string.c_str(); } Error @@ -1660,7 +1664,8 @@ error = DoAttachToProcessWithID (attach_pid); if (error.Success()) { - error = CompleteAttach(); + SetNextEventAction(new Process::AttachCompletionHandler(this)); + StartPrivateStateThread(); } else { @@ -1717,7 +1722,8 @@ } else { - error = CompleteAttach(); + SetNextEventAction(new Process::AttachCompletionHandler(this)); + StartPrivateStateThread(); } } return error; @@ -1769,73 +1775,82 @@ Error Process::Halt () { - Error error (WillHalt()); + // Pause our private state thread so we can ensure no one else eats + // the stop event out from under us. + PausePrivateStateThread(); + + EventSP event_sp; + Error error; - if (error.Success()) + if (m_public_state.GetValue() == eStateAttaching) { + SetExitStatus(SIGKILL, "Cancelled async attach."); + } + else + { + error = WillHalt(); - bool caused_stop = false; - EventSP event_sp; - - // Pause our private state thread so we can ensure no one else eats - // the stop event out from under us. - PausePrivateStateThread(); - - // Ask the process subclass to actually halt our process - error = DoHalt(caused_stop); if (error.Success()) { - // If "caused_stop" is true, then DoHalt stopped the process. If - // "caused_stop" is false, the process was already stopped. - // If the DoHalt caused the process to stop, then we want to catch - // this event and set the interrupted bool to true before we pass - // this along so clients know that the process was interrupted by - // a halt command. - if (caused_stop) - { - // Wait for 2 seconds for the process to stop. - TimeValue timeout_time; - timeout_time = TimeValue::Now(); - timeout_time.OffsetWithSeconds(1); - StateType state = WaitForStateChangedEventsPrivate (&timeout_time, event_sp); - - if (state == eStateInvalid) - { - // We timeout out and didn't get a stop event... - error.SetErrorString ("Halt timed out."); - } - else - { - if (StateIsStoppedState (state)) + + bool caused_stop = false; + + // Ask the process subclass to actually halt our process + error = DoHalt(caused_stop); + if (error.Success()) + { + // If "caused_stop" is true, then DoHalt stopped the process. If + // "caused_stop" is false, the process was already stopped. + // If the DoHalt caused the process to stop, then we want to catch + // this event and set the interrupted bool to true before we pass + // this along so clients know that the process was interrupted by + // a halt command. + if (caused_stop) + { + // Wait for 2 seconds for the process to stop. + TimeValue timeout_time; + timeout_time = TimeValue::Now(); + timeout_time.OffsetWithSeconds(1); + StateType state = WaitForStateChangedEventsPrivate (&timeout_time, event_sp); + + if (state == eStateInvalid) { - // We caused the process to interrupt itself, so mark this - // as such in the stop event so clients can tell an interrupted - // process from a natural stop - ProcessEventData::SetInterruptedInEvent (event_sp.get(), true); + // We timeout out and didn't get a stop event... + error.SetErrorString ("Halt timed out."); } else { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); - if (log) - log->Printf("Process::Halt() failed to stop, state is: %s", StateAsCString(state)); - error.SetErrorString ("Did not get stopped event after halt."); + if (StateIsStoppedState (state)) + { + // We caused the process to interrupt itself, so mark this + // as such in the stop event so clients can tell an interrupted + // process from a natural stop + ProcessEventData::SetInterruptedInEvent (event_sp.get(), true); + } + else + { + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf("Process::Halt() failed to stop, state is: %s", StateAsCString(state)); + error.SetErrorString ("Did not get stopped event after halt."); + } } } - } - DidHalt(); + DidHalt(); + } } - // Resume our private state thread before we post the event (if any) - ResumePrivateStateThread(); + } + // Resume our private state thread before we post the event (if any) + ResumePrivateStateThread(); - // Post any event we might have consumed. If all goes well, we will have - // stopped the process, intercepted the event and set the interrupted - // bool in the event. Post it to the private event queue and that will end up - // correctly setting the state. - if (event_sp) - m_private_state_broadcaster.BroadcastEvent(event_sp); + // Post any event we might have consumed. If all goes well, we will have + // stopped the process, intercepted the event and set the interrupted + // bool in the event. Post it to the private event queue and that will end up + // correctly setting the state. + if (event_sp) + m_private_state_broadcaster.BroadcastEvent(event_sp); - } return error; } @@ -2123,7 +2138,27 @@ Process::HandlePrivateEvent (EventSP &event_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); + const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); + + // First check to see if anybody wants a shot at this event: + if (m_next_event_action != NULL) + { + NextEventAction::EventActionResult action_result = m_next_event_action->PerformAction(event_sp); + switch (action_result) + { + case NextEventAction::eEventActionSuccess: + SetNextEventAction(NULL); + break; + case NextEventAction::eEventActionRetry: + break; + case NextEventAction::eEventActionExit: + // Handle Exiting Here... + + break; + } + } + // See if we should broadcast this state to external clients? const bool should_broadcast = ShouldBroadcastEvent (event_sp.get()); From jingham at apple.com Fri Jan 28 19:57:32 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 29 Jan 2011 01:57:32 -0000 Subject: [Lldb-commits] [lldb] r124521 - /lldb/trunk/source/Target/Process.cpp Message-ID: <20110129015732.275AF2A6C12C@llvm.org> Author: jingham Date: Fri Jan 28 19:57:31 2011 New Revision: 124521 URL: http://llvm.org/viewvc/llvm-project?rev=124521&view=rev Log: Handle the case where the "NextEventAction" wants to kill us on some event other than eStateExited. Modified: lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124521&r1=124520&r2=124521&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jan 28 19:57:31 2011 @@ -2153,8 +2153,17 @@ case NextEventAction::eEventActionRetry: break; case NextEventAction::eEventActionExit: - // Handle Exiting Here... - + // Handle Exiting Here. If we already got an exited event, + // we should just propagate it. Otherwise, swallow this event, + // and set our state to exit so the next event will kill us. + if (new_state != eStateExited) + { + // FIXME: should cons up an exited event, and discard this one. + SetExitStatus(0, m_next_event_action->GetExitString()); + SetNextEventAction(NULL); + return; + } + SetNextEventAction(NULL); break; } } From jingham at apple.com Fri Jan 28 22:05:41 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 29 Jan 2011 04:05:41 -0000 Subject: [Lldb-commits] [lldb] r124525 - in /lldb/trunk: include/lldb/Target/Process.h source/Target/Process.cpp Message-ID: <20110129040541.75BFB2A6C12C@llvm.org> Author: jingham Date: Fri Jan 28 22:05:41 2011 New Revision: 124525 URL: http://llvm.org/viewvc/llvm-project?rev=124525&view=rev Log: The m_next_action is simpler if it is an auto_pointer. Modified: lldb/trunk/include/lldb/Target/Process.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=124525&r1=124524&r2=124525&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Fri Jan 28 22:05:41 2011 @@ -1823,12 +1823,10 @@ void SetNextEventAction (Process::NextEventAction *next_event_action) { - if (m_next_event_action) - { - m_next_event_action->HandleBeingUnshipped(); - delete m_next_event_action; - } - m_next_event_action = next_event_action; + if (m_next_event_action_ap.get()) + m_next_event_action_ap->HandleBeingUnshipped(); + + m_next_event_action_ap.reset(next_event_action); } // This is the completer for Attaching: @@ -1920,7 +1918,7 @@ typedef std::map LanguageRuntimeCollection; LanguageRuntimeCollection m_language_runtimes; - NextEventAction *m_next_event_action; + std::auto_ptr *m_next_event_action_ap; size_t RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const; Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124525&r1=124524&r2=124525&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jan 28 22:05:41 2011 @@ -238,7 +238,7 @@ m_stdio_communication_mutex (Mutex::eMutexTypeRecursive), m_stdout_data (), m_memory_cache (), - m_next_event_action(NULL) + m_next_event_action_ap(NULL) { UpdateInstanceName(); @@ -274,8 +274,6 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Process::~Process()", this); - if (m_next_event_action) - SetNextEventAction(NULL); StopPrivateStateThread(); } @@ -2142,9 +2140,9 @@ const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); // First check to see if anybody wants a shot at this event: - if (m_next_event_action != NULL) + if (m_next_event_action_ap.get() != NULL) { - NextEventAction::EventActionResult action_result = m_next_event_action->PerformAction(event_sp); + NextEventAction::EventActionResult action_result = m_next_event_action_ap->PerformAction(event_sp); switch (action_result) { case NextEventAction::eEventActionSuccess: @@ -2159,7 +2157,7 @@ if (new_state != eStateExited) { // FIXME: should cons up an exited event, and discard this one. - SetExitStatus(0, m_next_event_action->GetExitString()); + SetExitStatus(0, m_next_event_action_ap->GetExitString()); SetNextEventAction(NULL); return; } From gclayton at apple.com Sat Jan 29 01:10:56 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 29 Jan 2011 07:10:56 -0000 Subject: [Lldb-commits] [lldb] r124530 - in /lldb/trunk: include/lldb/Target/Process.h source/Commands/CommandObjectImage.cpp source/Commands/CommandObjectProcess.cpp source/Core/Address.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.h source/Target/Process.cpp Message-ID: <20110129071056.2AB3D2A6C12C@llvm.org> Author: gclayton Date: Sat Jan 29 01:10:55 2011 New Revision: 124530 URL: http://llvm.org/viewvc/llvm-project?rev=124530&view=rev Log: Finished up the async attach support. This allows us to request to attach by name or by pid (with or without waiting for a process to launch) and catch the response asynchronously. Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Sat Jan 29 01:10:55 2011 @@ -1918,7 +1918,7 @@ typedef std::map LanguageRuntimeCollection; LanguageRuntimeCollection m_language_runtimes; - std::auto_ptr *m_next_event_action_ap; + std::auto_ptr m_next_event_action_ap; size_t RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const; Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Sat Jan 29 01:10:55 2011 @@ -240,7 +240,7 @@ // If an offset was given, print out the address we ended up looking up if (offset) - strm.Printf("0x%llx: ", addr); + strm.Printf("File Address: 0x%llx\n", addr); ExecutionContextScope *exe_scope = interpreter.GetDebugger().GetExecutionContext().GetBestExecutionContextScope(); strm.IndentMore(); Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Sat Jan 29 01:10:55 2011 @@ -167,10 +167,14 @@ Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; if (process && process->IsAlive()) { - if (!m_interpreter.Confirm ("There is a running process, kill it and restart?", true)) + char message[1024]; + if (process->GetState() == eStateAttaching) + ::strncpy (message, "There is a pending attach, abort it and launch a new process?", sizeof(message)); + else + ::strncpy (message, "There is a running process, kill it and restart?", sizeof(message)); + + if (!m_interpreter.Confirm (message, true)) { - result.AppendErrorWithFormat ("Process %u is currently being debugged, restart cancelled.\n", - process->GetID()); result.SetStatus (eReturnStatusFailed); return false; } @@ -623,7 +627,7 @@ return false; } - m_interpreter.GetDebugger().GetOutputStream().Printf("Waiting to attach to a process named \"%s\".\n", wait_name); + result.AppendMessageWithFormat("Waiting to attach to a process named \"%s\".\n", wait_name); error = process->Attach (wait_name, m_options.waitfor); if (error.Success()) { @@ -652,7 +656,6 @@ else { result.SetDidChangeProcessState (true); - result.AppendMessageWithFormat ("Starting to attach to process."); result.SetStatus (eReturnStatusSuccessFinishNoResult); } } @@ -712,7 +715,6 @@ else { result.SetDidChangeProcessState (true); - result.AppendMessageWithFormat ("Starting to attach to process."); result.SetStatus (eReturnStatusSuccessFinishNoResult); } } @@ -731,18 +733,20 @@ if (result.Succeeded()) { // Okay, we're done. Last step is to warn if the executable module has changed: + char new_path[PATH_MAX]; if (!old_exec_module_sp) { - char new_path[PATH_MAX + 1]; - target->GetExecutableModule()->GetFileSpec().GetPath(new_path, PATH_MAX); - - result.AppendMessageWithFormat("Executable module set to \"%s\".\n", - new_path); + // We might not have a module if we attached to a raw pid... + ModuleSP new_module_sp (target->GetExecutableModule()); + if (new_module_sp) + { + new_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX); + result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path); + } } else if (old_exec_module_sp->GetFileSpec() != target->GetExecutableModule()->GetFileSpec()) { - char old_path[PATH_MAX + 1]; - char new_path[PATH_MAX + 1]; + char old_path[PATH_MAX]; old_exec_module_sp->GetFileSpec().GetPath(old_path, PATH_MAX); target->GetExecutableModule()->GetFileSpec().GetPath (new_path, PATH_MAX); Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Sat Jan 29 01:10:55 2011 @@ -576,7 +576,7 @@ bool show_stop_context = true; const bool show_module = (style == DumpStyleResolvedDescription); const bool show_fullpaths = false; - const bool show_inlined_frames = false; + const bool show_inlined_frames = true; if (sc.function == NULL && sc.symbol != NULL) { // If we have just a symbol make sure it is in the right section 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=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Sat Jan 29 01:10:55 2011 @@ -273,6 +273,17 @@ { case 'T': case 'S': + if (process->GetStopID() == 0) + { + if (process->GetID() == LLDB_INVALID_PROCESS_ID) + { + lldb::pid_t pid = GetCurrentProcessID (1); + if (pid != LLDB_INVALID_PROCESS_ID) + process->SetID (pid); + } + process->BuildDynamicRegisterInfo (true); + } + // Privately notify any internal threads that we have stopped // in case we wanted to interrupt our process, yet we might // send a packet and continue without returning control to the 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=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sat Jan 29 01:10:55 2011 @@ -184,18 +184,22 @@ } void -ProcessGDBRemote::BuildDynamicRegisterInfo () +ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) { - char register_info_command[64]; + if (!force && m_register_info.GetNumRegisters() > 0) + return; + + char packet[128]; m_register_info.Clear(); StringExtractorGDBRemote::Type packet_type = StringExtractorGDBRemote::eResponse; uint32_t reg_offset = 0; uint32_t reg_num = 0; for (; packet_type == StringExtractorGDBRemote::eResponse; ++reg_num) { - ::snprintf (register_info_command, sizeof(register_info_command), "qRegisterInfo%x", reg_num); + const int packet_len = ::snprintf (packet, sizeof(packet), "qRegisterInfo%x", reg_num); + assert (packet_len < sizeof(packet)); StringExtractorGDBRemote response; - if (m_gdb_comm.SendPacketAndWaitForResponse(register_info_command, response, 2, false)) + if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, false)) { packet_type = response.GetType(); if (packet_type == StringExtractorGDBRemote::eResponse) @@ -586,7 +590,7 @@ { m_dispatch_queue_offsets_addr = LLDB_INVALID_ADDRESS; - BuildDynamicRegisterInfo (); + BuildDynamicRegisterInfo (false); m_byte_order = m_gdb_comm.GetByteOrder(); @@ -677,43 +681,11 @@ { char packet[64]; const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%x", attach_pid); - StringExtractorGDBRemote response; - StateType stop_state = m_gdb_comm.SendContinuePacketAndWaitForResponse (this, - packet, - packet_len, - response); - switch (stop_state) - { - case eStateStopped: - case eStateCrashed: - case eStateSuspended: - SetID (attach_pid); - m_last_stop_packet = response; - m_last_stop_packet.SetFilePos (0); - SetPrivateState (stop_state); - break; - - case eStateExited: - m_last_stop_packet = response; - m_last_stop_packet.SetFilePos (0); - response.SetFilePos(1); - SetExitStatus(response.GetHexU8(), NULL); - break; - - default: - SetExitStatus(-1, "unable to attach to process"); - break; - } - + + m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (packet, packet_len)); } } } - - lldb::pid_t pid = GetID(); - if (pid == LLDB_INVALID_PROCESS_ID) - { - KillDebugserverProcess(); - } return error; } @@ -787,86 +759,15 @@ packet.PutCString("vAttachName"); packet.PutChar(';'); packet.PutBytesAsRawHex8(process_name, strlen(process_name), eByteOrderHost, eByteOrderHost); - StringExtractorGDBRemote response; - StateType stop_state = m_gdb_comm.SendContinuePacketAndWaitForResponse (this, - packet.GetData(), - packet.GetSize(), - response); - switch (stop_state) - { - case eStateStopped: - case eStateCrashed: - case eStateSuspended: - SetID (m_gdb_comm.GetCurrentProcessID(m_packet_timeout)); - m_last_stop_packet = response; - m_last_stop_packet.SetFilePos (0); - SetPrivateState (stop_state); - break; - - case eStateExited: - m_last_stop_packet = response; - m_last_stop_packet.SetFilePos (0); - response.SetFilePos(1); - SetExitStatus(response.GetHexU8(), NULL); - break; + + m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (packet.GetData(), packet.GetSize())); - default: - SetExitStatus(-1, "unable to attach to process"); - break; - } } } } - - lldb::pid_t pid = GetID(); - if (pid == LLDB_INVALID_PROCESS_ID) - { - KillDebugserverProcess(); - - if (error.Success()) - error.SetErrorStringWithFormat("unable to attach to process named '%s'", process_name); - } - return error; } -// -// if (wait_for_launch) -// { -// InputReaderSP reader_sp (new InputReader()); -// StreamString instructions; -// instructions.Printf("Hit any key to cancel waiting for '%s' to launch...", process_name); -// error = reader_sp->Initialize (AttachInputReaderCallback, // callback -// this, // baton -// eInputReaderGranularityByte, -// NULL, // End token -// false); -// -// StringExtractorGDBRemote response; -// m_waiting_for_attach = true; -// FILE *reader_out_fh = reader_sp->GetOutputFileHandle(); -// while (m_waiting_for_attach) -// { -// // Wait for one second for the stop reply packet -// if (m_gdb_comm.WaitForPacket(response, 1)) -// { -// // Got some sort of packet, see if it is the stop reply packet? -// char ch = response.GetChar(0); -// if (ch == 'T') -// { -// m_waiting_for_attach = false; -// } -// } -// else -// { -// // Put a period character every second -// fputc('.', reader_out_fh); -// } -// } -// } -// } -// return GetID(); -//} void ProcessGDBRemote::DidAttach () @@ -1158,15 +1059,23 @@ bool timed_out = false; Mutex::Locker locker; - - if (!m_gdb_comm.SendInterrupt (locker, 2, caused_stop, timed_out)) + + if (m_public_state.GetValue() == eStateAttaching) { - if (timed_out) - error.SetErrorString("timed out sending interrupt packet"); - else - error.SetErrorString("unknown error sending interrupt packet"); + // We are being asked to halt during an attach. We need to just close + // our file handle and debugserver will go away, and we can be done... + m_gdb_comm.Disconnect(); + } + else + { + if (!m_gdb_comm.SendInterrupt (locker, 2, caused_stop, timed_out)) + { + if (timed_out) + error.SetErrorString("timed out sending interrupt packet"); + else + error.SetErrorString("unknown error sending interrupt packet"); + } } - return error; } @@ -1305,22 +1214,32 @@ // Interrupt if our inferior is running... if (m_gdb_comm.IsConnected()) { - StringExtractorGDBRemote response; - bool send_async = true; - if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 2, send_async)) + if (m_public_state.GetValue() == eStateAttaching) { - char packet_cmd = response.GetChar(0); - - if (packet_cmd == 'W' || packet_cmd == 'X') - { - m_last_stop_packet = response; - SetExitStatus(response.GetHexU8(), NULL); - } + // We are being asked to halt during an attach. We need to just close + // our file handle and debugserver will go away, and we can be done... + m_gdb_comm.Disconnect(); } else { - SetExitStatus(SIGABRT, NULL); - //error.SetErrorString("kill packet failed"); + + StringExtractorGDBRemote response; + bool send_async = true; + if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 2, send_async)) + { + char packet_cmd = response.GetChar(0); + + if (packet_cmd == 'W' || packet_cmd == 'X') + { + m_last_stop_packet = response; + SetExitStatus(response.GetHexU8(), NULL); + } + } + else + { + SetExitStatus(SIGABRT, NULL); + //error.SetErrorString("kill packet failed"); + } } } StopAsyncThread (); @@ -1951,7 +1870,7 @@ debugserver_args.AppendArgument(arg_cstr); } // debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); -// debugserver_args.AppendArgument("--log-flags=0x800e0e"); +// debugserver_args.AppendArgument("--log-flags=0x802e0e"); // Now append the program arguments if (launch_process) @@ -2268,7 +2187,8 @@ if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr); - process->SetPrivateState(eStateRunning); + if (::strstr (continue_cstr, "vAttach") == NULL) + process->SetPrivateState(eStateRunning); StringExtractorGDBRemote response; StateType stop_state = process->GetGDBRemote().SendContinuePacketAndWaitForResponse (process, continue_cstr, continue_cstr_len, response); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Sat Jan 29 01:10:55 2011 @@ -307,7 +307,7 @@ KillDebugserverProcess (); void - BuildDynamicRegisterInfo (); + BuildDynamicRegisterInfo (bool force); GDBRemoteCommunication & GetGDBRemote() Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124530&r1=124529&r2=124530&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Sat Jan 29 01:10:55 2011 @@ -238,7 +238,7 @@ m_stdio_communication_mutex (Mutex::eMutexTypeRecursive), m_stdout_data (), m_memory_cache (), - m_next_event_action_ap(NULL) + m_next_event_action_ap() { UpdateInstanceName(); @@ -1590,37 +1590,46 @@ StateType state = ProcessEventData::GetStateFromEvent (event_sp.get()); switch (state) { - case eStateStopped: - case eStateCrashed: - { - m_process->DidAttach (); - // Figure out which one is the executable, and set that in our target: - ModuleList &modules = m_process->GetTarget().GetImages(); - - size_t num_modules = modules.GetSize(); - for (int i = 0; i < num_modules; i++) + case eStateRunning: + return eEventActionRetry; + + case eStateStopped: + case eStateCrashed: { - ModuleSP module_sp = modules.GetModuleAtIndex(i); - if (module_sp->IsExecutable()) + // During attach, prior to sending the eStateStopped event, + // lldb_private::Process subclasses must set the process must set + // the new process ID. + assert (m_process->GetID() != LLDB_INVALID_PROCESS_ID); + m_process->DidAttach (); + // Figure out which one is the executable, and set that in our target: + ModuleList &modules = m_process->GetTarget().GetImages(); + + size_t num_modules = modules.GetSize(); + for (int i = 0; i < num_modules; i++) { - ModuleSP exec_module = m_process->GetTarget().GetExecutableModule(); - if (!exec_module || exec_module != module_sp) + ModuleSP module_sp = modules.GetModuleAtIndex(i); + if (module_sp->IsExecutable()) { - - m_process->GetTarget().SetExecutableModule (module_sp, false); + ModuleSP exec_module = m_process->GetTarget().GetExecutableModule(); + if (!exec_module || exec_module != module_sp) + { + + m_process->GetTarget().SetExecutableModule (module_sp, false); + } + break; } - break; } + return eEventActionSuccess; } - return eEventActionSuccess; - } - break; - default: - case eStateExited: - case eStateInvalid: - m_exit_string.assign ("No valid Process"); - return eEventActionExit; - break; + + + break; + default: + case eStateExited: + case eStateInvalid: + m_exit_string.assign ("No valid Process"); + return eEventActionExit; + break; } } @@ -1778,24 +1787,23 @@ PausePrivateStateThread(); EventSP event_sp; - Error error; + Error error (WillHalt()); - if (m_public_state.GetValue() == eStateAttaching) - { - SetExitStatus(SIGKILL, "Cancelled async attach."); - } - else + if (error.Success()) { - error = WillHalt(); + bool caused_stop = false; + + // Ask the process subclass to actually halt our process + error = DoHalt(caused_stop); if (error.Success()) { - - bool caused_stop = false; - - // Ask the process subclass to actually halt our process - error = DoHalt(caused_stop); - if (error.Success()) + if (m_public_state.GetValue() == eStateAttaching) + { + SetExitStatus(SIGKILL, "Cancelled async attach."); + Destroy (); + } + else { // If "caused_stop" is true, then DoHalt stopped the process. If // "caused_stop" is false, the process was already stopped. @@ -1835,7 +1843,6 @@ } } DidHalt(); - } } } From gclayton at apple.com Sat Jan 29 01:14:26 2011 From: gclayton at apple.com (Greg Clayton) Date: Sat, 29 Jan 2011 07:14:26 -0000 Subject: [Lldb-commits] [lldb] r124531 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20110129071426.893802A6C12C@llvm.org> Author: gclayton Date: Sat Jan 29 01:14:26 2011 New Revision: 124531 URL: http://llvm.org/viewvc/llvm-project?rev=124531&view=rev Log: Bumped Xcode project versions to lldb-46 and debugserver-131. 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=124531&r1=124530&r2=124531&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sat Jan 29 01:14:26 2011 @@ -2968,9 +2968,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 45; + DYLIB_CURRENT_VERSION = 46; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3025,11 +3025,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 45; + DYLIB_CURRENT_VERSION = 46; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3112,7 +3112,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3148,11 +3148,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 45; + DYLIB_CURRENT_VERSION = 46; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3206,7 +3206,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3245,7 +3245,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 45; + CURRENT_PROJECT_VERSION = 46; 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=124531&r1=124530&r2=124531&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Sat Jan 29 01:14:26 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 45 + 46 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=124531&r1=124530&r2=124531&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Sat Jan 29 01:14:26 2011 @@ -460,7 +460,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 130; + CURRENT_PROJECT_VERSION = 131; 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 = 130; + CURRENT_PROJECT_VERSION = 131; 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 = 130; + CURRENT_PROJECT_VERSION = 131; 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 = 130; + CURRENT_PROJECT_VERSION = 131; 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 = 130; + CURRENT_PROJECT_VERSION = 131; 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 = 130; + CURRENT_PROJECT_VERSION = 131; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From gclayton at apple.com Sun Jan 30 13:42:40 2011 From: gclayton at apple.com (Greg Clayton) Date: Sun, 30 Jan 2011 19:42:40 -0000 Subject: [Lldb-commits] [lldb] r124562 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Message-ID: <20110130194240.5DABE2A6C12C@llvm.org> Author: gclayton Date: Sun Jan 30 13:42:40 2011 New Revision: 124562 URL: http://llvm.org/viewvc/llvm-project?rev=124562&view=rev Log: Added some documentation that describes the purpose and the goals of the EmulateInstruction class. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124562&r1=124561&r2=124562&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Sun Jan 30 13:42:40 2011 @@ -12,6 +12,67 @@ #include "lldb/lldb-include.h" + +//---------------------------------------------------------------------- +/// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h" +/// @brief A class that allows emulation of CPU opcodes. +/// +/// This class is a plug-in interface that is accessed through the +/// standard static FindPlugin function call in the EmulateInstruction +/// class. The FindPlugin takes a target triple and returns a new object +/// if there is a plug-in that supports the architecture and OS. Four +/// callbacks and a baton are provided. The four callbacks are read +/// register, write register, read memory and write memory. +/// +/// This class is currently designed for these main use cases: +/// - Auto generation of Call Frame Information (CFI) from assembly code +/// - Predicting single step breakpoint locations +/// - Emulating instructions for breakpoint traps +/// +/// Objects can be asked to read and instruction which will cause a call +/// to the read register callback to get the PC, followed by a read +/// memory call to read the opcode. If ReadInstruction () returns true, +/// then a call to EmulateInstruction::EvaluateInstruction () can be +/// made. At this point the EmulateInstruction subclass will use all of +/// the callbacks to emulate an instruction. +/// +/// Clients that provide the callbacks can either do the read/write +/// registers/memory to actually emulate the instruction on a real or +/// virtual CPU, or watch to the EmulateInstruction::Context which +/// is context for the read/write register/memory which explains why +/// the callback is being called. Examples of a context are: +/// "pushing register 3 onto to stack at offset -12", or "adjusting +/// stack pointer by -16". This extra context allows the generation of +/// CFI information from assembly code without having to actually do +/// the read/write register/memory. +/// +/// Clients must be prepared that not all instructions for an +/// Instruction Set Architecture (ISA) will be emulated. +/// +/// Subclasses at the very least should implement the instructions that +/// save and restore regiters onto the stack and adjustment to the stack +/// pointer. By just implementing a few instructions for an ISA that are +/// the typical prologue opcodes, you can then generate CFI using a +/// class that will soon be available. +/// +/// Implmenting all of the instructions that affect the PC can then +/// can then allow single step prediction support. +/// +/// Implmenting all of the instructions allows for emulation of opcodes +/// for breakpoint traps and will pave the way for "thread centric" +/// debugging. The current debugging model is "process centric" where +/// all threads must be stopped when any thread is stopped since when +/// hitting software breakpoints once must disable the breakpoint by +/// restoring the original breakpoint opcde, single stepping and +/// restoring the breakpoint trap. If all threads were allowed to run +/// then other threads could miss the breakpoint. +/// +/// This class centralizes the code that usually is done in separate +/// code paths in a debugger (single step prediction, finding save +/// restore locations of registers for unwinding stack frame variables, +/// and emulating the intruction is just a bonus. +//---------------------------------------------------------------------- + namespace lldb_private { class EmulateInstruction @@ -20,11 +81,39 @@ enum ContextType { eContextInvalid = 0, + // Read an instruciton opcode from memory eContextReadOpcode, - eContextReadMemory, + + // Usually used for writing a register value whose source value in an + // immediate eContextImmediate, + + // Exclusively used when saving a register to the stack as part of the + // prologue + // arg0 = register kind + // arg1 = register number + // arg2 = signed offset from current SP value where register is being + // stored eContextPushRegisterOnStack, + + // Exclusively used when restoring a register to the stack as part of + // the epilogue + // arg0 = register kind + // arg1 = register number + // arg2 = signed offset from current SP value where register is being + // restored + eContextPopRegisterOffStack, + + // Add or subtract a value from the stack + // arg0 = register kind for SP + // arg1 = register number for SP + // arg2 = signed offset being applied to the SP value eContextAdjustStackPointer, + + // Used in WriteRegister callbacks to indicate where the + // arg0 = source register kind + // arg1 = source register number + // arg2 = source signed offset eContextRegisterPlusOffset, }; From gclayton at apple.com Sun Jan 30 14:03:57 2011 From: gclayton at apple.com (Greg Clayton) Date: Sun, 30 Jan 2011 20:03:57 -0000 Subject: [Lldb-commits] [lldb] r124563 - in /lldb/trunk/source/Plugins/Process/Utility: EmulateInstruction.h EmulateInstructionARM.cpp EmulateInstructionARM.h Message-ID: <20110130200357.1C0772A6C12C@llvm.org> Author: gclayton Date: Sun Jan 30 14:03:56 2011 New Revision: 124563 URL: http://llvm.org/viewvc/llvm-project?rev=124563&view=rev Log: Added the start of the plug-in interface to EmulateInstruction and implemented it for the EmulateInstructionARM class. Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124563&r1=124562&r2=124563&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Sun Jan 30 14:03:56 2011 @@ -11,7 +11,7 @@ #define lldb_EmulateInstruction_h_ #include "lldb/lldb-include.h" - +#include "lldb/Core/PluginInterface.h" //---------------------------------------------------------------------- /// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h" @@ -75,9 +75,14 @@ namespace lldb_private { -class EmulateInstruction +class EmulateInstruction : + public PluginInterface { -public: +public: + + static Disassembler* + FindPlugin (const ArchSpec &arch); + enum ContextType { eContextInvalid = 0, @@ -188,6 +193,9 @@ { } + virtual bool + SetTargetTriple (const ConstString &triple) = 0; + virtual bool ReadInstruction () = 0; Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124563&r1=124562&r2=124563&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Sun Jan 30 14:03:56 2011 @@ -10,6 +10,7 @@ #include "EmulateInstructionARM.h" #include "ARMDefines.h" #include "ARMUtils.h" +#include "lldb/Core/ConstString.h" using namespace lldb; using namespace lldb_private; @@ -881,6 +882,44 @@ static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode); static const size_t k_num_thumb_opcodes = sizeof(g_thumb_opcodes)/sizeof(ARMOpcode); +bool +EmulateInstructionARM::SetTargetTriple (const ConstString &triple) +{ + m_arm_isa = 0; + const char *triple_cstr = triple.GetCString(); + if (triple_cstr) + { + const char *dash = ::strchr (triple_cstr, '-'); + if (dash) + { + std::string arch (triple_cstr, dash); + const char *arch_cstr = arch.c_str(); + if (strcasecmp(arch_cstr, "armv4t") == 0) + m_arm_isa = ARMv4T; + else if (strcasecmp(arch_cstr, "armv4") == 0) + m_arm_isa = ARMv4; + else if (strcasecmp(arch_cstr, "armv5tej") == 0) + m_arm_isa = ARMv5TEJ; + else if (strcasecmp(arch_cstr, "armv5te") == 0) + m_arm_isa = ARMv5TE; + else if (strcasecmp(arch_cstr, "armv5t") == 0) + m_arm_isa = ARMv5T; + else if (strcasecmp(arch_cstr, "armv6k") == 0) + m_arm_isa = ARMv6K; + else if (strcasecmp(arch_cstr, "armv6") == 0) + m_arm_isa = ARMv6; + else if (strcasecmp(arch_cstr, "armv6t2") == 0) + m_arm_isa = ARMv6T2; + else if (strcasecmp(arch_cstr, "armv7") == 0) + m_arm_isa = ARMv7; + else if (strcasecmp(arch_cstr, "armv8") == 0) + m_arm_isa = ARMv8; + } + } + return m_arm_isa != 0; +} + + bool EmulateInstructionARM::ReadInstruction () { Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h?rev=124563&r1=124562&r2=124563&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h Sun Jan 30 14:03:56 2011 @@ -13,11 +13,51 @@ #include "EmulateInstruction.h" #include "ARM_DWARF_Registers.h" +#include "lldb/Core/Error.h" + namespace lldb_private { class EmulateInstructionARM : public EmulateInstruction { public: + + virtual const char * + GetPluginName() + { + return "EmulateInstructionARM"; + } + + virtual const char * + GetShortPluginName() + { + return "lldb.emulate-instruction.arm"; + } + + virtual uint32_t + GetPluginVersion() + { + return 1; + } + + virtual void + GetPluginCommandHelp (const char *command, Stream *strm) + { + } + + virtual lldb_private::Error + ExecutePluginCommand (Args &command, Stream *strm) + { + Error error; + error.SetErrorString("no plug-in commands are supported"); + return error; + } + + virtual Log * + EnablePluginLogging (Stream *strm, Args &command) + { + return NULL; + } + enum Mode { eModeInvalid, @@ -37,9 +77,15 @@ write_mem_callback, read_reg_callback, write_reg_callback), - m_inst_mode (eModeInvalid) + m_arm_isa (0), + m_inst_mode (eModeInvalid), + m_inst_cpsr (0) { } + + + virtual bool + SetTargetTriple (const ConstString &triple); virtual bool ReadInstruction (); @@ -54,7 +100,7 @@ CurrentCond (); protected: - + uint32_t m_arm_isa; Mode m_inst_mode; uint32_t m_inst_cpsr;