diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBBreakpoint.cpp | 27 | ||||
-rw-r--r-- | lldb/source/API/SBFrame.cpp | 3 | ||||
-rw-r--r-- | lldb/source/API/SBFunction.cpp | 18 | ||||
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 4 | ||||
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 41 | ||||
-rw-r--r-- | lldb/source/API/SBThread.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 33 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 11 |
10 files changed, 75 insertions, 74 deletions
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 70a70458b36..8f0545310b1 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -323,28 +323,19 @@ SBBreakpoint::GetNumLocations() const } bool -SBBreakpoint::GetDescription (const char *description_level, SBStream &description) +SBBreakpoint::GetDescription (SBStream &s) { if (m_opaque_sp) { - DescriptionLevel level; - if (strcmp (description_level, "brief") == 0) - level = eDescriptionLevelBrief; - else if (strcmp (description_level, "full") == 0) - level = eDescriptionLevelFull; - else if (strcmp (description_level, "verbose") == 0) - level = eDescriptionLevelVerbose; - else - level = eDescriptionLevelBrief; - - description.ref(); - m_opaque_sp->GetDescription (description.get(), level); - description.get()->EOL(); + s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID()); + m_opaque_sp->GetResolverDescription (s.get()); + m_opaque_sp->GetFilterDescription (s.get()); + const size_t num_locations = m_opaque_sp->GetNumLocations (); + s.Printf(", locations = %zu", num_locations); + return true; } - else - description.Printf ("No value"); - - return true; + s.Printf ("No value"); + return false; } bool diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 9ca92fc9b6b..f4dfb33242d 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -402,8 +402,7 @@ SBFrame::GetDescription (SBStream &description) { if (m_opaque_sp) { - description.ref(); - m_opaque_sp->DumpUsingSettingsFormat (description.get()); + description.Printf("SBFrame: idx = %u", m_opaque_sp->GetFrameIndex()); } else description.Printf ("No value"); diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp index f1426e787cd..de56a2e0ede 100644 --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Type.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" @@ -70,17 +71,20 @@ SBFunction::operator != (const SBFunction &rhs) const } bool -SBFunction::GetDescription (SBStream &description) +SBFunction::GetDescription (SBStream &s) { if (m_opaque_ptr) { - description.ref(); - m_opaque_ptr->Dump (description.get(), false); + s.Printf ("SBFunction: id = 0x%8.8x, name = %s", + m_opaque_ptr->GetID(), + m_opaque_ptr->GetName().AsCString()); + Type *func_type = m_opaque_ptr->GetType(); + if (func_type) + s.Printf(", type = %s", func_type->GetName().AsCString()); + return true; } - else - description.Printf ("No value"); - - return true; + s.Printf ("No value"); + return false; } SBInstructionList diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index a288833e0f0..53d6ad2d5c3 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -488,11 +488,11 @@ SBProcess::GetDescription (SBStream &description) if (exe_module) exe_name = exe_module->GetFileSpec().GetFilename().AsCString(); - description.Printf ("Process {pid: %d, state: %s, threads: %d%s%s}", + description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s", m_opaque_sp->GetID(), SBDebugger::StateAsCString (GetState()), GetNumThreads(), - exe_name ? ", executable: " : "", + exe_name ? ", executable = " : "", exe_name ? exe_name : ""); } else diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 860dae7aa92..9aac03e8552 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -119,21 +119,6 @@ SBTarget::CreateProcess () } -// SBProcess -// SBTarget::LaunchProcess -// ( -// char const **argv, -// char const **envp, -// const char *tty, -// uint32_t launch_flags, -// bool stop_at_entry -// ) -// { -// SBError sb_error; -// return LaunchProcess (argv, envp, tty, launch_flags, stop_at_entry, sb_error); -// } - - SBProcess SBTarget::LaunchProcess ( @@ -141,6 +126,20 @@ SBTarget::LaunchProcess char const **envp, const char *tty, uint32_t launch_flags, + bool stop_at_entry +) +{ + SBError sb_error; + return Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); +} + +SBProcess +SBTarget::Launch +( + char const **argv, + char const **envp, + const char *tty, + uint32_t launch_flags, bool stop_at_entry, SBError &error ) @@ -165,14 +164,14 @@ SBTarget::LaunchProcess error.SetError (sb_process->Launch (argv, envp, launch_flags, tty, tty, tty)); 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) { + // We we are stopping at the entry point, we can return now! + if (stop_at_entry) + return sb_process; + // resume the process to skip the entry point error.SetError (sb_process->Resume()); if (error.Success()) @@ -199,7 +198,7 @@ SBTarget::LaunchProcess lldb::SBProcess -SBTarget::AttachToProcess +SBTarget::AttachToProcessWithID ( lldb::pid_t pid,// The process ID to attach to SBError& error // An error explaining what went wrong if attach fails @@ -238,7 +237,7 @@ SBTarget::AttachToProcess } lldb::SBProcess -SBTarget::AttachToProcess +SBTarget::AttachToProcessWithName ( const char *name, // basename of process to attach to bool wait_for, // if true wait for a new instance of "name" to be launched diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index 0489dc5605d..006efc79132 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -452,7 +452,10 @@ bool SBThread::GetDescription (SBStream &description) { if (m_opaque_sp) - m_opaque_sp->DumpUsingSettingsFormat (description.ref(), 0); + { + StreamString strm; + description.Printf("SBThread: tid = 0x%4.4x", m_opaque_sp->GetID()); + } else description.Printf ("No value"); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 73d03f5c89a..c2f43368a96 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -133,13 +133,9 @@ public: } bool - Execute (Args& launch_args, - CommandReturnObject &result) + Execute (Args& launch_args, CommandReturnObject &result) { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - bool synchronous_execution = m_interpreter.GetSynchronous (); - // bool launched = false; - // bool stopped_after_launch = false; if (target == NULL) { @@ -235,22 +231,29 @@ public: if (error.Success()) { result.AppendMessageWithFormat ("Launching '%s' (%s)\n", filename, archname); - result.SetStatus (eReturnStatusSuccessContinuingNoResult); + result.SetDidChangeProcessState (true); if (m_options.stop_at_entry == false) { + result.SetStatus (eReturnStatusSuccessContinuingNoResult); StateType state = process->WaitForProcessToStop (NULL); if (state == eStateStopped) { - // Call continue_command. - CommandReturnObject continue_result; - m_interpreter.HandleCommand("process continue", false, continue_result); - } - - if (synchronous_execution) - { - result.SetDidChangeProcessState (true); - result.SetStatus (eReturnStatusSuccessFinishNoResult); + error = process->Resume(); + if (error.Success()) + { + bool synchronous_execution = m_interpreter.GetSynchronous (); + if (synchronous_execution) + { + state = process->WaitForProcessToStop (NULL); + result.SetDidChangeProcessState (true); + result.SetStatus (eReturnStatusSuccessFinishResult); + } + else + { + result.SetStatus (eReturnStatusSuccessContinuingNoResult); + } + } } } } diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp index 756a644afeb..e1c1bcc2fae 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp @@ -360,7 +360,6 @@ ProcessMacOSX::DoAttachToProcessWithID (lldb::pid_t attach_pid) Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); if (attach_pid != LLDB_INVALID_PROCESS_ID) { - SetPrivateState (eStateAttaching); SetID(attach_pid); // Let ourselves know we are going to be using SBS if the correct flag bit is set... #if defined (__arm__) @@ -1642,8 +1641,6 @@ ProcessMacOSX::LaunchForDebug if (launch_type == eLaunchPosixSpawn) { - - //SetState (eStateAttaching); errno = 0; if (::ptrace (PT_ATTACHEXC, pid, 0, 0) == 0) launch_err.Clear(); @@ -1967,7 +1964,6 @@ ProcessMacOSX::SBLaunchForDebug // m_args.push_back(arg); Task().StartExceptionThread(); StartSTDIOThread(); - SetState (eStateAttaching); int err = ptrace (PT_ATTACHEXC, m_pid, 0, 0); if (err == 0) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index d84fedd9b48..c3b0c9d1c66 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -652,7 +652,6 @@ ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid) if (attach_pid != LLDB_INVALID_PROCESS_ID) { - SetPrivateState (eStateAttaching); char host_port[128]; snprintf (host_port, sizeof(host_port), "localhost:%u", get_random_port ()); error = StartDebugserverProcess (host_port, // debugserver_url @@ -753,8 +752,6 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait //Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (process_name && process_name[0]) { - - SetPrivateState (eStateAttaching); char host_port[128]; ArchSpec arch_spec = GetTarget().GetArchitecture(); snprintf (host_port, sizeof(host_port), "localhost:%u", get_random_port ()); diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 3a65c5235e0..7f67a87243f 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -198,9 +198,14 @@ Process::WaitForState { EventSP event_sp; uint32_t i; - StateType state = eStateUnloaded; + StateType state = GetState(); while (state != eStateInvalid) { + // If we are exited or detached, we won't ever get back to any + // other valid state... + if (state == eStateDetached || state == eStateExited) + return state; + state = WaitForStateChangedEvents (timeout, event_sp); for (i=0; i<num_match_states; ++i) @@ -1006,6 +1011,7 @@ Process::Launch error = WillLaunch (exe_module); if (error.Success()) { + SetPublicState (eStateLaunching); // The args coming in should not contain the application name, the // lldb_private::Process class will add this in case the executable // gets resolved to a different file than was given on the command @@ -1147,6 +1153,8 @@ Process::Attach (lldb::pid_t attach_pid) Error error (WillAttachToProcessWithID(attach_pid)); if (error.Success()) { + SetPublicState (eStateAttaching); + error = DoAttachToProcessWithID (attach_pid); if (error.Success()) { @@ -1190,6 +1198,7 @@ Process::Attach (const char *process_name, bool wait_for_launch) Error error (WillAttachToProcessWithName(process_name, wait_for_launch)); if (error.Success()) { + SetPublicState (eStateAttaching); StartPrivateStateThread(); error = DoAttachToProcessWithName (process_name, wait_for_launch); if (error.Fail()) |