當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Frame.I方法代碼示例

本文整理匯總了Golang中github.com/rocky/ssa-interp/interp.Frame.I方法的典型用法代碼示例。如果您正苦於以下問題:Golang Frame.I方法的具體用法?Golang Frame.I怎麽用?Golang Frame.I使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/rocky/ssa-interp/interp.Frame的用法示例。


在下文中一共展示了Frame.I方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: GubTraceHook

// GubTraceHook is the callback hook from interpreter. It contains
// top-level statement breakout.
func GubTraceHook(fr *interp.Frame, instr *ssa2.Instruction, event ssa2.TraceEvent) {
	if !fr.I().TraceEventMask[event] {
		return
	}
	gubLock.Lock()
	defer gubLock.Unlock()
	if skipEvent(fr, event) {
		return
	}
	TraceEvent = event
	frameInit(fr)
	if instr == nil && event != ssa2.PROGRAM_TERMINATION {
		instr = &curBlock.Instrs[fr.PC()]
	}
	Instr = instr

	if event == ssa2.BREAKPOINT && Breakpoints[curBpnum].Kind == "Function" {
		event = ssa2.CALL_ENTER
	}

	if FirstTime {
		IntroText()
		FirstTime = false
	}
	printLocInfo(topFrame, instr, event)

	line := ""
	var err error
	for InCmdLoop = true; err == nil && InCmdLoop; cmdCount++ {
		if inputReader != nil {
			line, err = inputReader.ReadString('\n')
		} else {
			line, err = gnureadline.Readline(computePrompt(), true)
		}
		if err != nil {
			break
		}
		line = strings.Trim(line, " \t\n")
		args := strings.Split(line, " ")
		if len(args) == 0 || len(args[0]) == 0 {
			if len(LastCommand) == 0 {
				Msg("Empty line skipped")
				gnureadline.RemoveHistory(gnureadline.HistoryLength() - 1)
				continue
			} else {
				line = LastCommand
				args = strings.Split(line, " ")
			}
		}
		if args[0][0] == '#' {
			gnureadline.RemoveHistory(gnureadline.HistoryLength() - 1)
			Msg(line) // echo line but do nothing
			continue
		}

		name := args[0]
		CmdArgstr = strings.TrimLeft(line[len(name):], " ")
		if newname := LookupCmd(name); newname != "" {
			name = newname
		}
		cmd := Cmds[name]
		LastCommand = ""

		if cmd != nil {
			runCommand(name, args)
			continue
		}

		if len(args) > 0 {
			if !WhatisName(args[0]) {
				gnureadline.RemoveHistory(gnureadline.HistoryLength() - 1)
			}
		} else {
			gnureadline.RemoveHistory(gnureadline.HistoryLength() - 1)
			Errmsg("Unknown command %s\n", cmd)
		}
	}
}
開發者ID:rocky,項目名稱:ssa-interp,代碼行數:80,代碼來源:hook.go


注:本文中的github.com/rocky/ssa-interp/interp.Frame.I方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。