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'):
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'):
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits