Example #1
0
        bool AddSymbolFile(string filepath, SbModule module, TextWriter searchLog)
        {
            var command = "target symbols add";

            var platformFileSpec = module.GetPlatformFileSpec();

            if (platformFileSpec != null)
            {
                var platformPath = FileUtil.PathCombineLinux(platformFileSpec.GetDirectory(),
                                                             platformFileSpec.GetFilename());
                // The -s flag specifies the path of the module to add symbols to.
                command += " -s " + LldbCommandUtil.QuoteArgument(platformPath);
            }

            command += " " + LldbCommandUtil.QuoteArgument(filepath);

            SbCommandReturnObject commandResult;

            lldbCommandInterpreter.HandleCommand(command, out commandResult);
            Trace.WriteLine($"Executed LLDB command '{command}' with result:" +
                            Environment.NewLine + commandResult.GetDescription());
            if (!commandResult.Succeeded())
            {
                searchLog.WriteLine("LLDB error: " + commandResult.GetError());
                return(false);
            }
            searchLog.WriteLine("LLDB output: " + commandResult.GetOutput());

            searchLog.WriteLine("Symbols loaded successfully.");
            Trace.WriteLine($"Successfully loaded symbol file '{filepath}'.");

            return(true);
        }
        void SetHandleCommandReturnValue(SbCommandInterpreter mockCommandInterpreter,
                                         string command, ReturnStatus returnStatus,
                                         SbCommandReturnObject returnObject)
        {
            SbCommandReturnObject _;

            mockCommandInterpreter.HandleCommand(command, out _).Returns(x => {
                x[1] = returnObject;
                return(returnStatus);
            });
        }
        public static void HandleAndLogCommand(this SbCommandInterpreter commandInterpreter,
                                               string command)
        {
            SbCommandReturnObject commandResult;

            commandInterpreter.HandleCommand(command, out commandResult);
            if (commandResult == null)
            {
                Trace.WriteLine(
                    $"WARNING: The LLDB command '{command}' failed to return a result.");
                return;
            }
            Trace.WriteLine($"Executed LLDB command '{command}' with result: " +
                            $"{Environment.NewLine} {commandResult.GetDescription()}" +
                            $"{Environment.NewLine} Command error: {commandResult.GetError()}" +
                            $"{Environment.NewLine} Command output: {commandResult.GetOutput()}");
        }