Add new API to SBTarget class

Summary:
The new API appends an image search path to the
target's path mapping list.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D49739

llvm-svn: 339175
This commit is contained in:
Alexander Polyakov 2018-08-07 20:23:57 +00:00
parent 4364d604c2
commit 3e7b9db2d9
3 changed files with 28 additions and 0 deletions

View File

@ -272,6 +272,9 @@ public:
lldb::SBFileSpec GetExecutable();
void AppendImageSearchPath(const char *from, const char *to,
lldb::SBError &error);
bool AddModule(lldb::SBModule &module);
lldb::SBModule AddModule(const char *path, const char *triple,

View File

@ -373,6 +373,11 @@ public:
lldb::SBFileSpec
GetExecutable ();
void
AppendImageSearchPath (const char *from,
const char *to,
SBError &error);
bool
AddModule (lldb::SBModule &module);

View File

@ -1457,6 +1457,26 @@ bool SBTarget::DeleteAllWatchpoints() {
return false;
}
void SBTarget::AppendImageSearchPath(const char *from, const char *to,
lldb::SBError &error) {
TargetSP target_sp(GetSP());
if (!target_sp)
return error.SetErrorString("invalid target");
const ConstString csFrom(from), csTo(to);
if (!csFrom)
return error.SetErrorString("<from> path can't be empty");
if (!csTo)
return error.SetErrorString("<to> path can't be empty");
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (log)
log->Printf("SBTarget(%p)::%s: '%s' -> '%s'",
static_cast<void *>(target_sp.get()), __FUNCTION__,
from, to);
target_sp->GetImageSearchPathList().Append(csFrom, csTo, true);
}
lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
const char *uuid_cstr) {
return AddModule(path, triple, uuid_cstr, NULL);