summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-01-28 22:08:17 +0000
committerGreg Clayton <gclayton@apple.com>2015-01-28 22:08:17 +0000
commitd26a1e5060dcf92c8508651526381a7309ab750d (patch)
tree53a305cd74fd378d0e2fc9b4ef3ee92ddb272dbb /lldb/source/Commands
parent4379d102730d3d43fa9b0470978f560012fc80a5 (diff)
downloadbcm5719-llvm-d26a1e5060dcf92c8508651526381a7309ab750d.tar.gz
bcm5719-llvm-d26a1e5060dcf92c8508651526381a7309ab750d.zip
Fixed the failing test:
./dotest.py -A x86_64 -C clang -v -t -f TestImageListMultiArchitecture.test_image_list_shows_multiple_architectures The problem was that if the platform wasn't compatible with the current file in the "target create" command, it wasn't finding a platform that was like it used to. Also, the currently selected platform was being used upload the file _before_ the target was created which was incorrect as "target create a.out" might switch platforms if its architecture doesn't match, so I moved the uploading to happen after the target was created so we use the right platform (the one in the target, not the selected one). llvm-svn: 227380
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp109
1 files changed, 61 insertions, 48 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 30eecbff7f6..9188283966f 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -281,70 +281,83 @@ protected:
bool must_set_platform_path = false;
Debugger &debugger = m_interpreter.GetDebugger();
- PlatformSP platform_sp(debugger.GetPlatformList().GetSelectedPlatform ());
- if (remote_file)
+ TargetSP target_sp;
+ const char *arch_cstr = m_arch_option.GetArchitectureName();
+ const bool get_dependent_files = m_add_dependents.GetOptionValue().GetCurrentValue();
+ Error error (debugger.GetTargetList().CreateTarget (debugger,
+ file_path,
+ arch_cstr,
+ get_dependent_files,
+ NULL,
+ target_sp));
+
+ if (target_sp)
{
- // I have a remote file.. two possible cases
- if (file_spec && file_spec.Exists())
+ // Only get the platform after we create the target because we might have
+ // switched platforms depending on what the arguments were to CreateTarget()
+ // we can't rely on the selected platform.
+
+ PlatformSP platform_sp = target_sp->GetPlatform();
+
+ if (remote_file)
{
- // if the remote file does not exist, push it there
- if (!platform_sp->GetFileExists (remote_file))
+ if (platform_sp)
{
- Error err = platform_sp->PutFile(file_spec, remote_file);
- if (err.Fail())
+ // I have a remote file.. two possible cases
+ if (file_spec && file_spec.Exists())
{
- result.AppendError(err.AsCString());
- result.SetStatus (eReturnStatusFailed);
- return false;
+ // if the remote file does not exist, push it there
+ if (!platform_sp->GetFileExists (remote_file))
+ {
+ Error err = platform_sp->PutFile(file_spec, remote_file);
+ if (err.Fail())
+ {
+ result.AppendError(err.AsCString());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
}
- }
- }
- else
- {
- // there is no local file and we need one
- // in order to make the remote ---> local transfer we need a platform
- // TODO: if the user has passed in a --platform argument, use it to fetch the right platform
- if (!platform_sp)
- {
- result.AppendError("unable to perform remote debugging without a platform");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- if (file_path)
- {
- // copy the remote file to the local file
- Error err = platform_sp->GetFile(remote_file, file_spec);
- if (err.Fail())
+ else
{
- result.AppendError(err.AsCString());
- result.SetStatus (eReturnStatusFailed);
- return false;
+ // there is no local file and we need one
+ // in order to make the remote ---> local transfer we need a platform
+ // TODO: if the user has passed in a --platform argument, use it to fetch the right platform
+ if (!platform_sp)
+ {
+ result.AppendError("unable to perform remote debugging without a platform");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ if (file_path)
+ {
+ // copy the remote file to the local file
+ Error err = platform_sp->GetFile(remote_file, file_spec);
+ if (err.Fail())
+ {
+ result.AppendError(err.AsCString());
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
+ else
+ {
+ // make up a local file
+ result.AppendError("remote --> local transfer without local path is not implemented yet");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
}
}
else
{
- // make up a local file
- result.AppendError("remote --> local transfer without local path is not implemented yet");
+ result.AppendError("no platform found for target");
result.SetStatus (eReturnStatusFailed);
return false;
}
}
- }
- TargetSP target_sp;
- const char *arch_cstr = m_arch_option.GetArchitectureName();
- ArchSpec arch_spec(arch_cstr);
- const bool get_dependent_files = m_add_dependents.GetOptionValue().GetCurrentValue();
- Error error (debugger.GetTargetList().CreateTarget (debugger,
- file_path,
- arch_spec,
- get_dependent_files,
- platform_sp,
- target_sp));
-
- if (target_sp)
- {
if (symfile || remote_file)
{
ModuleSP module_sp (target_sp->GetExecutableModule());
OpenPOWER on IntegriCloud