[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

Nitesh Jain via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 27 00:11:34 PST 2017


nitesh.jain created this revision.

In case of a core file, if the core file architecture(like x86_64) is incompatible with that of Host architecture(like Mips64) then platform is set to remote-platform. If the remote-platform is not connected then SBPlatform::GetTriple() will return none. Hence we assume target platform is same as the host platform.

(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.

>>> import lldb
>>>  dbg = lldb.SBDebugger.Create()
>>>  print dbg.GetSelectedPlatform().GetName()

host

>>> print dbg.GetSelectedPlatform().GetTriple()

mips64el--linux-gnu

>>> dbg.CreateTarget("linux-x86_64")

<lldb.SBTarget; proxy of <Swig Object of type 'lldb::SBTarget *' at 0x7f1fb4615390> >

>>> print dbg.GetSelectedPlatform().GetName()

remote-linux

>>> print dbg.GetSelectedPlatform().GetTriple()

None

>>> print dbg.GetSelectedPlatform().IsConnected()

False

>>> 




Repository:
  rL LLVM

https://reviews.llvm.org/D29215

Files:
  packages/Python/lldbsuite/test/lldbplatformutil.py


Index: packages/Python/lldbsuite/test/lldbplatformutil.py
===================================================================
--- packages/Python/lldbsuite/test/lldbplatformutil.py
+++ packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -127,7 +127,15 @@
 
 def getPlatform():
     """Returns the target platform which the tests are running on."""
-    platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+    if lldb.DBG.GetSelectedPlatform().GetTriple():
+        platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+    else:
+        # In case of a core file, if the core file architecture(like x86_64)
+        # is incompatible with that of Host architecture(like Mips64)
+        # then platform is set to remote-platform. If the remote-platform is
+        # not connected then SBPlatform::GetTriple() will return none.
+        # Hence we assume target platform is same as the host platform.
+        platform = sys.platform
     if platform.startswith('freebsd'):
         platform = 'freebsd'
     elif platform.startswith('netbsd'):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29215.86024.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170127/7ee43577/attachment.bin>


More information about the lldb-commits mailing list