fjricci created this revision.
fjricci added reviewers: clayborg, tfiala, tberghammer.
fjricci added subscribers: sas, lldb-commits.
Herald added subscribers: danalbert, tberghammer, aemerson.

If we determine an OS from the executable, but not an environment,
the existing code will not update the target triple to add an
environment provided by the remote.

This manifests if we have an android exe, where we could parse
arm-*-linux from the ELF, but then the remote gives a triple of
arm-*-linux-android. The existing code will not update the
environment in this case, because the OS has not changed.

http://reviews.llvm.org/D18621

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1220,19 +1220,20 @@
                     if (new_target_triple.getVendorName().size() == 0)
                     {
                         new_target_triple.setVendor 
(remote_triple.getVendor());
+                    }
+                    if (new_target_triple.getOSName().size() == 0)
+                    {
+                        new_target_triple.setOS (remote_triple.getOS());
 
-                        if (new_target_triple.getOSName().size() == 0)
-                        {
-                            new_target_triple.setOS (remote_triple.getOS());
-
-                            if (new_target_triple.getEnvironmentName().size() 
== 0)
-                                new_target_triple.setEnvironment 
(remote_triple.getEnvironment());
-                        }
-
-                        ArchSpec new_target_arch = target_arch;
-                        new_target_arch.SetTriple(new_target_triple);
-                        GetTarget().SetArchitecture(new_target_arch);
                     }
+                    if (new_target_triple.getEnvironmentName().size() == 0)
+                    {
+                        new_target_triple.setEnvironment 
(remote_triple.getEnvironment());
+                    }
+
+                    ArchSpec new_target_arch = target_arch;
+                    new_target_arch.SetTriple(new_target_triple);
+                    GetTarget().SetArchitecture(new_target_arch);
                 }
 
                 if (log)


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1220,19 +1220,20 @@
                     if (new_target_triple.getVendorName().size() == 0)
                     {
                         new_target_triple.setVendor (remote_triple.getVendor());
+                    }
+                    if (new_target_triple.getOSName().size() == 0)
+                    {
+                        new_target_triple.setOS (remote_triple.getOS());
 
-                        if (new_target_triple.getOSName().size() == 0)
-                        {
-                            new_target_triple.setOS (remote_triple.getOS());
-
-                            if (new_target_triple.getEnvironmentName().size() == 0)
-                                new_target_triple.setEnvironment (remote_triple.getEnvironment());
-                        }
-
-                        ArchSpec new_target_arch = target_arch;
-                        new_target_arch.SetTriple(new_target_triple);
-                        GetTarget().SetArchitecture(new_target_arch);
                     }
+                    if (new_target_triple.getEnvironmentName().size() == 0)
+                    {
+                        new_target_triple.setEnvironment (remote_triple.getEnvironment());
+                    }
+
+                    ArchSpec new_target_arch = target_arch;
+                    new_target_arch.SetTriple(new_target_triple);
+                    GetTarget().SetArchitecture(new_target_arch);
                 }
 
                 if (log)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to