コード例 #1
0
        public void TestAttachToGameFail_AnotherTracer()
        {
            string parentPid  = "1234";
            string tracerPid  = "9876";
            string tracerName = "gdb";

            var launcherFactory = CreateLauncherFactory(false);
            var launcher        = launcherFactory.Create(_debugEngine, LaunchOption.AttachToGame, "",
                                                         _gameBinary, _gameBinary, _gameLaunch);

            _debuggerFactory.SetTargetAttachError("Operation not permitted");
            _platformFactory.AddCommandOutput($"cat /proc/{_pid}/status",
                                              "Name:\tgame\n" + $"Pid:\t{_pid}\n" +
                                              $"PPid:\t{parentPid}\n" +
                                              $"TracerPid:\t{tracerPid}\n" + "FDSize:\t256\n");
            _platformFactory.AddCommandOutput($"cat /proc/{tracerPid}/comm", tracerName);

            AttachException e =
                Assert.ThrowsAsync <AttachException>(async() => await LaunchAsync(launcher));

            Assert.That(e.Message,
                        Is.EqualTo(
                            ErrorStrings
                            .FailedToAttachToProcessOtherTracer(tracerName, tracerPid)));
            CheckLldbListenerStops();
        }
コード例 #2
0
        public void TestAttachToGameFail_CannotGetTracer()
        {
            var launcherFactory = CreateLauncherFactory(false);
            var launcher        = launcherFactory.Create(_debugEngine, LaunchOption.AttachToGame, "",
                                                         _gameBinary, _gameBinary, _gameLaunch);

            _debuggerFactory.SetTargetAttachError("Operation not permitted");
            _platformFactory.AddCommandOutput($"cat /proc/{_pid}/status", null);

            AttachException e =
                Assert.ThrowsAsync <AttachException>(async() => await LaunchAsync(launcher));

            Assert.That(e.Message,
                        Is.EqualTo(
                            ErrorStrings.FailedToAttachToProcess("Operation not permitted")));
            CheckLldbListenerStops();
        }