Beispiel #1
0
    private void CanResolveStacktraces(string abi)
    {
        if (!AndroidLogcatTestsSetup.AndroidSDKAndNDKAvailable())
        {
            System.Console.WriteLine("Test ignored");
            return;
        }
        var          tools          = new AndroidTools();
        const string symbolName     = "JNI_OnLoad";
        var          playerPackage  = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None);
        var          expectedOutput = symbolName + " at ??:?";
        var          symbolPath     = Path.GetFullPath(Path.Combine(playerPackage, "Variations/il2cpp/Development/Symbols/" + abi + "/libmain.sym.so"));

#if UNITY_2019_3_OR_NEWER
        var targetAddress = GetSymbolAddressUsingNM(tools, symbolPath, symbolName);
#else
        var targetAddress = GetSymbolAddressUsingReadElf(tools, symbolPath, symbolName);
#endif

        Assert.IsNotEmpty(targetAddress, "Failed to find address for " + symbolName);
        var resolvedSymbols = tools.RunAddr2Line(symbolPath, new[] { targetAddress });
        Assert.IsTrue(resolvedSymbols.Length == 1, "Expected to resolve one symbol");
        Assert.AreEqual(expectedOutput, resolvedSymbols[0],
                        string.Format("Failed to resolve symbol '{0}' for address '{1}'", symbolName, targetAddress));
    }
    private void CanResolveStacktraces(string abi)
    {
        if (!AndroidBridge.AndroidExtensionsInstalled)
        {
            System.Console.WriteLine("Test ignored, because Android Support is not installed");
            return;
        }

        if (!AndroidLogcatTestsSetup.AndroidSDKAndNDKAvailable())
        {
            System.Console.WriteLine("Test ignored");
            return;
        }
        var          tools      = new AndroidTools();
        const string symbolName = "JNI_OnLoad";

        var expectedOutput = symbolName + " at ??:?";
        var symbolPath     = GetSymbolPath(abi, "libmain.so");
        var targetAddress  = GetSymbolAddress(tools, symbolPath, symbolName);

        Assert.IsNotEmpty(targetAddress, "Failed to find address for " + symbolName);
        var resolvedSymbols = tools.RunAddr2Line(symbolPath, new[] { targetAddress });

        Assert.IsTrue(resolvedSymbols.Length == 1, "Expected to resolve one symbol");
        Assert.AreEqual(expectedOutput, resolvedSymbols[0],
                        string.Format("Failed to resolve symbol '{0}' for address '{1}'", symbolName, targetAddress));
    }