本文整理汇总了C#中Mono.Debugger.Frontend.ScriptingContext.Print方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptingContext.Print方法的具体用法?C# ScriptingContext.Print怎么用?C# ScriptingContext.Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Debugger.Frontend.ScriptingContext
的用法示例。
在下文中一共展示了ScriptingContext.Print方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoExecute
protected override object DoExecute(ScriptingContext context)
{
Backtrace backtrace = null;
if ((mode == Backtrace.Mode.Default) && (max_frames == -1))
backtrace = CurrentThread.CurrentBacktrace;
if (backtrace == null)
backtrace = CurrentThread.GetBacktrace (mode, max_frames);
for (int i = 0; i < backtrace.Count; i++) {
string prefix = i == backtrace.CurrentFrameIndex ? "(*)" : " ";
context.Print ("{0} {1}", prefix, backtrace [i]);
EmonicInterpreter.backtraceData bt = new EmonicInterpreter.backtraceData();
bt.frameNumber = backtrace[i].Level;
bt.currentFrame = i == backtrace.CurrentFrameIndex;
if (backtrace[i].Method != null) {
bt.method = backtrace[i].Method.Name;
if (bt.method == null)
bt.method = "";
} else {
if (backtrace[i].Name == null)
bt.method = "";
else {
bt.method = backtrace[i].Name.ToString();
if (bt.method == null)
bt.method = "";
}
}
if (backtrace[i].SourceAddress != null && backtrace[i].SourceAddress.SourceFile != null)
bt.file = backtrace[i].SourceAddress.SourceFile.FileName;
else
bt.file = "";
if (backtrace[i].SourceAddress != null)
bt.lineNumber = backtrace[i].SourceAddress.Row;
else
bt.lineNumber = -1;
if (i+1 < backtrace.Count)
bt.moreData = true;
else
bt.moreData = false;
EmonicInterpreter.backtraceList.Add(bt);
}
return backtrace;
}
示例2: DoExecute
protected override object DoExecute(ScriptingContext context)
{
string name = (string) Args [0];
ModuleBase module = null;
if (name.StartsWith ("@")) {
name = name.Substring (1);
module = context.Interpreter.Session.Config.GetModuleGroup (name);
if (module == null)
throw new ScriptingException ("No such module group `{0}'", name);
} else {
int index;
try {
index = (int) UInt32.Parse (name);
} catch {
context.Print ("Module number expected.");
return false;
}
foreach (Module mod in CurrentProcess.Modules) {
if (mod.ID == index) {
module = mod;
break;
}
}
}
if (module == null)
throw new ScriptingException ("No such module `{0}'", name);
for (int i = 1; i < Args.Count; i++) {
string command = (string) Args [i];
switch (command) {
case "step":
module.StepInto = true;
break;
case "nostep":
module.StepInto = false;
break;
case "hide":
module.HideFromUser = true;
break;
case "nohide":
module.HideFromUser = false;
break;
case "load":
module.LoadSymbols = true;
break;
case "noload":
module.LoadSymbols = false;
break;
default:
throw new ScriptingException ("Invalid module command `{0}'", command);
}
}
context.Print ("{0}: {1} {2} {3}",
module.Name,
module.HideFromUser ? "hide" : "nohide",
module.StepInto ? "step" : "nostep",
module.LoadSymbols ? "load " : "noload");
return null;
}
示例3: DoResolve
protected override bool DoResolve(ScriptingContext context)
{
if ((Args == null) || (Args.Count < 2)) {
context.Print ("Invalid arguments: Need the name of the " +
"thread group to operate on and one ore more " +
"threads");
return false;
}
name = (string) Args [0];
int[] ids = new int [Args.Count - 1];
for (int i = 0; i < Args.Count - 1; i++) {
try {
ids [i] = (int) UInt32.Parse ((string) Args [i+1]);
} catch {
context.Print ("Invalid argument {0}: expected " +
"thread id", i+1);
return false;
}
}
threads = context.Interpreter.GetThreads (ids);
return threads != null;
}
示例4: Execute
protected override string Execute(ScriptingContext context,
Expression expression, DisplayFormat format)
{
TargetType type = expression.EvaluateType (context);
string text = context.FormatType (type);
context.Print (text);
return text;
}
示例5: PrintFrame
public override void PrintFrame(ScriptingContext context, StackFrame frame)
{
context.Print (frame);
bool native = false;
if (!PrintSource (context.Interpreter, frame))
native = true;
if (native) {
AssemblerLine insn = frame.Thread.DisassembleInstruction (
frame.Method, frame.TargetAddress);
if (insn != null)
context.Interpreter.PrintInstruction (insn);
else
throw new ScriptingException (
"Cannot disassemble instruction at address {0}.",
frame.TargetAddress);
}
}