public (slice <Inst>, error) Disasm(@string file, ulong start, ulong end) => s_DisasmByRef?.Invoke(ref this, file, start, end) ?? s_DisasmByVal?.Invoke(this, file, start, end) ?? ObjTool?.Disasm(file, start, end) ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
public Diagnostic(Range Range = default, DiagnosticSeverity Severity = default, @string Code = default, @string Source = default, @string Message = default, slice <DiagnosticTag> Tags = default, slice <DiagnosticRelatedInformation> RelatedInformation = default) { this.Range = Range; this.Severity = Severity; this.Code = Code; this.Source = Source; this.Message = Message; this.Tags = Tags; this.RelatedInformation = RelatedInformation; }
public stringFinder(@string pattern = default, array <long> badCharSkip = default, slice <long> goodSuffixSkip = default) { this.pattern = pattern; this.badCharSkip = badCharSkip; this.goodSuffixSkip = goodSuffixSkip; }
public static void Printf(@string format, params object[] args) => Console.Write(Sprintf(format, args));
// hostArchive reads an archive file holding host objects and links in // required objects. The general format is the same as a Go archive // file, but it has an armap listing symbols and the objects that // define them. This is used for the compiler support library // libgcc.a. private static void hostArchive(ptr <Link> _addr_ctxt, @string name) => func((defer, _, __) =>
public component(long size = default, long offset = default, asmKind kind = default, @string typ = default, @string suffix = default, @string outer = default) { this.size = size; this.offset = offset; this.kind = kind; this.typ = typ; this.suffix = suffix; this.outer = outer; }
public DLLError(error Err = default, @string ObjName = default, @string Msg = default) { this.Err = Err; this.ObjName = ObjName; this.Msg = Msg; }
public boolOp(@string name = default, token.Token tok = default, token.Token badEq = default) { this.name = name; this.tok = tok; this.badEq = badEq; }
public static (bool, error) MatchString(this TestDeps _p0, @string pat, @string str) { bool result = default; error err = default !;
public InterfaceMessage(long Version = default, long Type = default, long Flags = default, long Index = default, @string Name = default, slice <Addr> Addrs = default, long extOff = default, slice <byte> raw = default) { this.Version = Version; this.Type = Type; this.Flags = Flags; this.Index = Index; this.Name = Name; this.Addrs = Addrs; this.extOff = extOff; this.raw = raw; }
public pathInfo(@string path = default, bool isDir = default) { this.path = path; this.isDir = isDir; }
// writeHeapProto writes the current heap profile in protobuf format to w. private static error writeHeapProto(io.Writer w, slice <runtime.MemProfileRecord> p, long rate, @string defaultSampleType) { var b = newProfileBuilder(w); b.pbValueType(tagProfile_PeriodType, "space", "bytes"); b.pb.int64Opt(tagProfile_Period, rate); b.pbValueType(tagProfile_SampleType, "alloc_objects", "count"); b.pbValueType(tagProfile_SampleType, "alloc_space", "bytes"); b.pbValueType(tagProfile_SampleType, "inuse_objects", "count"); b.pbValueType(tagProfile_SampleType, "inuse_space", "bytes"); if (defaultSampleType != "") { b.pb.int64Opt(tagProfile_DefaultSampleType, b.stringIndex(defaultSampleType)); } long values = new slice <long>(new long[] { 0, 0, 0, 0 }); slice <ulong> locs = default; foreach (var(_, r) in p) { var hideRuntime = true; for (long tries = 0L; tries < 2L; tries++) { var stk = r.Stack(); // For heap profiles, all stack // addresses are return PCs, which is // what appendLocsForStack expects. if (hideRuntime) { foreach (var(i, addr) in stk) { { var f = runtime.FuncForPC(addr); if (f != null && strings.HasPrefix(f.Name(), "runtime.")) { continue; } } // Found non-runtime. Show any runtime uses above it. stk = stk[i..];
// Parse creates a flag for each of the analyzer's flags, // including (in multi mode) a flag named after the analyzer, // parses the flags, then filters and returns the list of // analyzers enabled by flags. // // The result is intended to be passed to unitchecker.Run or checker.Run. // Use in unitchecker.Run will gob.Register all fact types for the returned // graph of analyzers but of course not the ones only reachable from // dropped analyzers. To avoid inconsistency about which gob types are // registered from run to run, Parse itself gob.Registers all the facts // only reachable from dropped analyzers. // This is not a particularly elegant API, but this is an internal package. public static slice <ptr <analysis.Analyzer> > Parse(slice <ptr <analysis.Analyzer> > analyzers, bool multi) { // Connect each analysis flag to the command line as -analysis.flag. var enabled = make_map <ptr <analysis.Analyzer>, ptr <triState> >(); { var a__prev1 = a; foreach (var(_, __a) in analyzers) { a = __a; @string prefix = default; // Add -NAME flag to enable it. if (multi) { prefix = a.Name + "."; ptr <triState> enable = @new <triState>(); @string enableUsage = "enable " + a.Name + " analysis"; flag.Var(enable, a.Name, enableUsage); enabled[a] = enable; } a.Flags.VisitAll(f => { if (!multi && flag.Lookup(f.Name) != null) { log.Printf("%s flag -%s would conflict with driver; skipping", a.Name, f.Name); return; } var name = prefix + f.Name; flag.Var(f.Value, name, f.Usage); }); } // standard flags: -flags, -V. a = a__prev1; } var printflags = flag.Bool("flags", false, "print analyzer flags in JSON"); addVersionFlag(); // flags common to all checkers flag.BoolVar(_addr_JSON, "json", JSON, "emit JSON output"); flag.IntVar(_addr_Context, "c", Context, "display offending line with this many lines of context"); // Add shims for legacy vet flags to enable existing // scripts that run vet to continue to work. _ = flag.Bool("source", false, "no effect (deprecated)"); _ = flag.Bool("v", false, "no effect (deprecated)"); _ = flag.Bool("all", false, "no effect (deprecated)"); _ = flag.String("tags", "", "no effect (deprecated)"); foreach (var(old, new) in vetLegacyFlags) { var newFlag = flag.Lookup(new); if (newFlag != null && flag.Lookup(old) == null) { flag.Var(newFlag.Value, old, "deprecated alias for -" + new); } } flag.Parse(); // (ExitOnError) // -flags: print flags so that go vet knows which ones are legitimate. if (printflags.val) { printFlags(); os.Exit(0L); } var everything = expand(analyzers); // If any -NAME flag is true, run only those analyzers. Otherwise, // if any -NAME flag is false, run all but those analyzers. if (multi) { bool hasTrue = default; bool hasFalse = default; foreach (var(_, ts) in enabled) { if (ts.val == setTrue) { hasTrue = true; } else if (ts.val == setFalse) { hasFalse = true; } } slice <ptr <analysis.Analyzer> > keep = default; if (hasTrue) { { var a__prev1 = a; foreach (var(_, __a) in analyzers) { a = __a; if (enabled[a] == setTrue.val) { keep = append(keep, a); } } a = a__prev1; } analyzers = keep; } else if (hasFalse) { { var a__prev1 = a; foreach (var(_, __a) in analyzers) { a = __a; if (enabled[a] != setFalse.val) { keep = append(keep, a); } } a = a__prev1; } analyzers = keep; } } // Register fact types of skipped analyzers // in case we encounter them in imported files. var kept = expand(analyzers); { var a__prev1 = a; foreach (var(__a) in everything) { a = __a; if (!kept[a]) { foreach (var(_, f) in a.FactTypes) { gob.Register(f); } } } a = a__prev1; } return(analyzers); }
public Signature(@string Name = default, uint Hash = default, @string Base64 = default) { this.Name = Name; this.Hash = Hash; this.Base64 = Base64; }
public mibentry(@string ctlname = default, slice <_C_int> ctloid = default) { this.ctlname = ctlname; this.ctloid = ctloid; }
public pathMode(@string path = default, os.FileMode mode = default) { this.path = path; this.mode = mode; }
// Initialize examines the processor and sets the relevant variables above. // This is called by the runtime package early in program initialization, // before normal init functions are run. env is set by runtime if the OS supports // cpu feature options in GODEBUG. public static void Initialize(@string env) { doinit(); processOptions(env); }
private static void Main() { flag.Usage = () => { fmt.Fprintln(os.Stderr, usageMessage); os.Exit(2L); } ; flag.Parse(); // Go 1.7 traces embed symbol info and does not require the binary. // But we optionally accept binary as first arg for Go 1.5 traces. switch (flag.NArg()) { case 1L: traceFile = flag.Arg(0L); break; case 2L: programBinary = flag.Arg(0L); traceFile = flag.Arg(1L); break; default: flag.Usage(); break; } Func <io.Writer, ptr <http.Request>, error> pprofFunc = default; switch (pprofFlag.val) { case "net": pprofFunc = pprofByGoroutine(computePprofIO); break; case "sync": pprofFunc = pprofByGoroutine(computePprofBlock); break; case "syscall": pprofFunc = pprofByGoroutine(computePprofSyscall); break; case "sched": pprofFunc = pprofByGoroutine(computePprofSched); break; } if (pprofFunc != null) { { var err = pprofFunc(os.Stdout, addr(new http.Request())); if (err != null) { dief("failed to generate pprof: %v\n", err); } } os.Exit(0L); } if (pprofFlag != "".val) { dief("unknown pprof type %s\n", pprofFlag.val); } var(ln, err) = net.Listen("tcp", httpFlag.val); if (err != null) { dief("failed to create server socket: %v\n", err); } log.Print("Parsing trace..."); var(res, err) = parseTrace(); if (err != null) { dief("%v\n", err); } if (debugFlag.val) { trace.Print(res.Events); os.Exit(0L); } reportMemoryUsage("after parsing trace"); debug.FreeOSMemory(); log.Print("Splitting trace..."); ranges = splitTrace(res); reportMemoryUsage("after spliting trace"); debug.FreeOSMemory(); @string addr = "http://" + ln.Addr().String(); log.Printf("Opening browser. Trace viewer is listening on %s", addr); browser.Open(addr); // Start http server. http.HandleFunc("/", httpMain); err = http.Serve(ln, null); dief("failed to start http server: %v\n", err); }
public command(long format = default, PostProcessor postProcess = default, PostProcessor visualizer = default, bool hasParam = default, @string description = default, @string usage = default) { this.format = format; this.postProcess = postProcess; this.visualizer = visualizer; this.hasParam = hasParam; this.description = description; this.usage = usage; }
public static @event TriggerRegisterVariableEvent(trigger whichTrigger, @string varName, limitop opcode, real limitval) { throw new NotImplementedException(); }
private static void fillFileStatFromSys(ptr <fileStat> _addr_fs, @string name) { ref fileStat fs = ref _addr_fs.val;
public static @event TriggerRegisterPlayerChatEvent(trigger whichTrigger, player whichPlayer, @string chatMessageToDetect, boolean exactMatchOnly) { @event triEvent = new @event() { sourcePlayer = whichPlayer, chatMatchMessage = chatMessageToDetect, playerEvent = EVENT_PLAYER_CHAT }; whichTrigger.events.Add(triEvent); return(triEvent); }
public static string Sprintf(@string format, params object[] args) => string.Format(format, args.Select(arg => (object)ToString(arg)).ToArray());
public ambiguousVerifierError(@string name = default, uint hash = default) { this.name = name; this.hash = hash; }
public NumError(@string Func = default, @string Num = default, error Err = default) { this.Func = Func; this.Num = Num; this.Err = Err; }
public Note(token.Pos Pos = default, token.Pos End = default, @string UID = default, @string Body = default) { this.Pos = Pos; this.End = End; this.UID = UID; this.Body = Body; }
public zone(@string name = default, long offset = default, bool isDST = default) { this.name = name; this.offset = offset; this.isDST = isDST; }
public asmVar(@string name = default, asmKind kind = default, @string typ = default, long off = default, long size = default, slice <ptr <asmVar> > inner = default) { this.name = name; this.kind = kind; this.typ = typ; this.off = off; this.size = size; this.inner = inner; }
// Do executes and returns the results of the given function, making // sure that only one execution is in-flight for a given key at a // time. If a duplicate comes in, the duplicate caller waits for the // original to complete and receives the same results. // The return value shared indicates whether v was given to multiple callers. private static (object, error, bool) Do(this ptr <Group> _addr_g, @string key, Func <(object, error)> fn)
private delegate(slice <Inst>, error) DisasmByRef(ref T value, @string file, ulong start, ulong end);