public async Task <IEnumerable <SConstantResult> > LookupConstants(string module, string type, ulong constantValue) { NotifyDebuggerMessage(String.Format("Looking up name for {0}({1})...", type, constantValue)); string pythonResult = await this.QueryDebuggerPython(String.Format("LookupConstants(\"{0}\", \"{1}\", {2})", module, type, constantValue)); if (pythonResult == "None") { throw new DebuggerException(String.Format("Error looking up constant value {0} on {1}!{2}", constantValue, module, type)); } List <string> objects = ParsePythonObjectArrayToStrings(pythonResult); List <SConstantResult> result = new List <SConstantResult>(); foreach (string fieldString in objects) { // '{%s#%d}' % (self.name, self.value) string[] properties = fieldString.Split('#'); Debug.Assert(properties.Length == 2); SConstantResult field = new SConstantResult(); field.ConstantName = properties[0]; field.Value = UInt64.Parse(properties[1]); result.Add(field); } return(result); }
public async Task <SConstantResult> LookupConstant(string module, string type, string constantName) { NotifyDebuggerMessage(String.Format("Looking up value for constant {0}...", constantName)); string response = await this.QueryDebuggerPython(String.Format("LookupConstant(\"{0}\",\"{1}\",\"{2}\")", module, type == null ? "None" : type, constantName)); if (response == "None") { throw new DebuggerException(String.Format("Error looking up constant {0} on {1}!{2}", constantName, module, type)); } SConstantResult result = new SConstantResult(); result.ConstantName = constantName; result.Value = UInt64.Parse(response); return(result); }