forked from OSchip/llvm-project
Expose the error contained within an SBValue.
Move anything that creates a new process into SBTarget. Marked some functions as deprecated. I will remove them after our new API changes make it through a build cycle. llvm-svn: 115854
This commit is contained in:
parent
24ab1ce8c2
commit
524e60b4e4
|
@ -75,6 +75,8 @@ protected:
|
|||
friend class SBHostOS;
|
||||
friend class SBInputReader;
|
||||
friend class SBProcess;
|
||||
friend class SBTarget;
|
||||
friend class SBValue;
|
||||
|
||||
#ifndef SWIG
|
||||
|
||||
|
|
|
@ -112,9 +112,11 @@ public:
|
|||
lldb::pid_t
|
||||
AttachByPID (lldb::pid_t pid); // DEPRECATED: will be removed in a few builds in favor of SBError AttachByPID(pid_t)
|
||||
|
||||
// DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (lldb::pid_t pid, SBError& error)"
|
||||
SBError
|
||||
Attach (lldb::pid_t pid);
|
||||
|
||||
// DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (const char *name, bool wait_for_launch, SBError& error)"
|
||||
SBError
|
||||
AttachByName (const char *name, bool wait_for_launch);
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
// DEPRECATED in favor of the function below that contains an SBError as the
|
||||
// last parameter.
|
||||
lldb::SBProcess
|
||||
LaunchProcess (char const **argv,
|
||||
char const **envp,
|
||||
|
@ -62,6 +64,23 @@ public:
|
|||
uint32_t launch_flags, // See lldb::LaunchFlags
|
||||
bool stop_at_entry);
|
||||
|
||||
lldb::SBProcess
|
||||
LaunchProcess (char const **argv,
|
||||
char const **envp,
|
||||
const char *tty,
|
||||
uint32_t launch_flags, // See lldb::LaunchFlags
|
||||
bool stop_at_entry,
|
||||
SBError& error);
|
||||
|
||||
lldb::SBProcess
|
||||
AttachToProcess (lldb::pid_t pid, // The process ID to attach to
|
||||
SBError& error); // An error explaining what went wrong if attach fails
|
||||
|
||||
lldb::SBProcess
|
||||
AttachToProcess (const char *name, // basename of process to attach to
|
||||
bool wait_for, // if true wait for a new instance of "name" to be launched
|
||||
SBError& error); // An error explaining what went wrong if attach fails
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetExecutable ();
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
SBError
|
||||
GetError();
|
||||
|
||||
const char *
|
||||
GetName();
|
||||
|
|
|
@ -128,6 +128,22 @@ SBTarget::LaunchProcess
|
|||
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
|
||||
(
|
||||
char const **argv,
|
||||
char const **envp,
|
||||
const char *tty,
|
||||
uint32_t launch_flags,
|
||||
bool stop_at_entry,
|
||||
SBError &error
|
||||
)
|
||||
{
|
||||
SBProcess sb_process;
|
||||
if (m_opaque_sp)
|
||||
|
@ -146,7 +162,7 @@ SBTarget::LaunchProcess
|
|||
|
||||
if (sb_process.IsValid())
|
||||
{
|
||||
Error error (sb_process->Launch (argv, envp, launch_flags, tty, tty, tty));
|
||||
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!
|
||||
|
@ -158,7 +174,7 @@ SBTarget::LaunchProcess
|
|||
if (state == eStateStopped)
|
||||
{
|
||||
// resume the process to skip the entry point
|
||||
error = sb_process->Resume();
|
||||
error.SetError (sb_process->Resume());
|
||||
if (error.Success())
|
||||
{
|
||||
// If we are doing synchronous mode, then wait for the
|
||||
|
@ -169,10 +185,98 @@ SBTarget::LaunchProcess
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("unable to create lldb_private::Process");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("SBTarget is invalid");
|
||||
}
|
||||
return sb_process;
|
||||
}
|
||||
|
||||
|
||||
lldb::SBProcess
|
||||
SBTarget::AttachToProcess
|
||||
(
|
||||
lldb::pid_t pid,// The process ID to attach to
|
||||
SBError& error // An error explaining what went wrong if attach fails
|
||||
)
|
||||
{
|
||||
SBProcess sb_process;
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
// DEPRECATED, this will change when CreateProcess is removed...
|
||||
if (m_opaque_sp->GetProcessSP())
|
||||
{
|
||||
sb_process.SetProcess(m_opaque_sp->GetProcessSP());
|
||||
}
|
||||
else
|
||||
{
|
||||
// When launching, we always want to create a new process When
|
||||
// SBTarget::CreateProcess is removed, this will always happen.
|
||||
sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
|
||||
}
|
||||
|
||||
if (sb_process.IsValid())
|
||||
{
|
||||
error.SetError (sb_process->Attach (pid));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("unable to create lldb_private::Process");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("SBTarget is invalid");
|
||||
}
|
||||
return sb_process;
|
||||
|
||||
}
|
||||
|
||||
lldb::SBProcess
|
||||
SBTarget::AttachToProcess
|
||||
(
|
||||
const char *name, // basename of process to attach to
|
||||
bool wait_for, // if true wait for a new instance of "name" to be launched
|
||||
SBError& error // An error explaining what went wrong if attach fails
|
||||
)
|
||||
{
|
||||
SBProcess sb_process;
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
// DEPRECATED, this will change when CreateProcess is removed...
|
||||
if (m_opaque_sp->GetProcessSP())
|
||||
{
|
||||
sb_process.SetProcess(m_opaque_sp->GetProcessSP());
|
||||
}
|
||||
else
|
||||
{
|
||||
// When launching, we always want to create a new process When
|
||||
// SBTarget::CreateProcess is removed, this will always happen.
|
||||
sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
|
||||
}
|
||||
|
||||
if (sb_process.IsValid())
|
||||
{
|
||||
error.SetError (sb_process->Attach (name, wait_for));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("unable to create lldb_private::Process");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("SBTarget is invalid");
|
||||
}
|
||||
return sb_process;
|
||||
|
||||
}
|
||||
|
||||
SBFileSpec
|
||||
SBTarget::GetExecutable ()
|
||||
{
|
||||
|
|
|
@ -53,6 +53,17 @@ SBValue::IsValid () const
|
|||
return (m_opaque_sp.get() != NULL);
|
||||
}
|
||||
|
||||
SBError
|
||||
SBValue::GetError()
|
||||
{
|
||||
SBError sb_error;
|
||||
|
||||
if (m_opaque_sp.get())
|
||||
sb_error.SetError(m_opaque_sp->GetError());
|
||||
|
||||
return sb_error;
|
||||
}
|
||||
|
||||
const char *
|
||||
SBValue::GetName()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue