Change CommandObjectTargetModulesLoad so that the filename argument
authorJason Molenda <jmolenda@apple.com>
Fri, 21 Nov 2014 02:25:15 +0000 (02:25 +0000)
committerJason Molenda <jmolenda@apple.com>
Fri, 21 Nov 2014 02:25:15 +0000 (02:25 +0000)
commitc6127dd6530d523fc004163496690105c8728af4
tree67365bec7dfd307e99c8d285766c0ec8077fac5d
parent12d36309c924f7bec2ed2540f9da618eb404a34c
Change CommandObjectTargetModulesLoad so that the filename argument
is treated as a string instead of a FileSpec.

OptionValueFileSpec::SetValueFromCString() passes the c string to
FileSpec::SetFile(str, true /* resolve */) - and with Zachary's
changes to FileSpec we're using llvm::sys::fs::make_absolute() to
do that "resolve" action now, where we used to use realpath().

One important difference between llvm::sys::fs::make_absolute and
realpath is that when they're handed a filename (no directory),
realpath prepends the current working directory *and if the file exists*,
returns that full path.  If that file doesn't exist, the caller
uses the basename only.

llvm::sys::fs::make_absolute prepends the current working directory
regardless of whether it exists or not.

I considered having FileSpec::SetFile save the initial pathname,
call FileSpec::Resolve, and then check to see if the Resolve return
path exists - and if not, go back to the original one.

But instead I just went with changing 'target modules load' to treat its
filename argument as a string instead of a FileSpec.  This brings it
in line with how 'target modules list' works.

<rdar://problem/18955416>

llvm-svn: 222498
lldb/source/Commands/CommandObjectTarget.cpp