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


Golang reader.NextPackageVariable函數代碼示例

本文整理匯總了Golang中github.com/derekparker/delve/dwarf/reader.NextPackageVariable函數的典型用法代碼示例。如果您正苦於以下問題:Golang NextPackageVariable函數的具體用法?Golang NextPackageVariable怎麽用?Golang NextPackageVariable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: PackageVariables

// PackageVariables returns the name, value, and type of all package variables in the application.
func (scope *EvalScope) PackageVariables(cfg LoadConfig) ([]*Variable, error) {
	var vars []*Variable
	reader := scope.DwarfReader()

	var utypoff dwarf.Offset
	utypentry, err := reader.SeekToTypeNamed("<unspecified>")
	if err == nil {
		utypoff = utypentry.Offset
	}

	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		if typoff, ok := entry.Val(dwarf.AttrType).(dwarf.Offset); !ok || typoff == utypoff {
			continue
		}

		// Ignore errors trying to extract values
		val, err := scope.extractVariableFromEntry(entry, cfg)
		if err != nil {
			continue
		}
		vars = append(vars, val)
	}

	return vars, nil
}
開發者ID:DuoSoftware,項目名稱:v6engine-deps,代碼行數:30,代碼來源:variables.go

示例2: packageVarAddr

func (scope *EvalScope) packageVarAddr(name string) (*Variable, error) {
	reader := scope.DwarfReader()
	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		n, ok := entry.Val(dwarf.AttrName).(string)
		if !ok {
			continue
		}

		if n == name {
			return scope.extractVarInfoFromEntry(entry, reader)
		}
	}
	return nil, fmt.Errorf("could not find symbol value for %s", name)
}
開發者ID:DuoSoftware,項目名稱:v6engine-deps,代碼行數:18,代碼來源:variables.go

示例3: PackageVariables

// PackageVariables returns the name, value, and type of all package variables in the application.
func (scope *EvalScope) PackageVariables() ([]*Variable, error) {
	var vars []*Variable
	reader := scope.DwarfReader()

	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		// Ignore errors trying to extract values
		val, err := scope.extractVariableFromEntry(entry)
		if err != nil {
			continue
		}
		vars = append(vars, val)
	}

	return vars, nil
}
開發者ID:catgatp,項目名稱:delve,代碼行數:20,代碼來源:variables.go

示例4: EvalPackageVariable

func (thread *Thread) EvalPackageVariable(name string) (*Variable, error) {
	reader := thread.dbp.DwarfReader()

	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		n, ok := entry.Val(dwarf.AttrName).(string)
		if !ok {
			continue
		}

		if n == name {
			return thread.extractVariableFromEntry(entry)
		}
	}

	return nil, fmt.Errorf("could not find symbol value for %s", name)
}
開發者ID:rsrsps,項目名稱:delve,代碼行數:20,代碼來源:variables.go

示例5: PackageVariables

// PackageVariables returns the name, value, and type of all package variables in the application.
func (thread *Thread) PackageVariables() ([]*Variable, error) {
	reader := thread.dbp.DwarfReader()

	vars := make([]*Variable, 0)

	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		// Ignore errors trying to extract values
		val, err := thread.extractVariableFromEntry(entry)
		if err != nil {
			continue
		}
		vars = append(vars, val)
	}

	return vars, nil
}
開發者ID:rsrsps,項目名稱:delve,代碼行數:21,代碼來源:variables.go

示例6: EvalPackageVariable

func (dbp *Process) EvalPackageVariable(name string) (*Variable, error) {
	reader := dbp.DwarfReader()
	scope := &EvalScope{Thread: dbp.CurrentThread, PC: 0, CFA: 0}

	for entry, err := reader.NextPackageVariable(); entry != nil; entry, err = reader.NextPackageVariable() {
		if err != nil {
			return nil, err
		}

		n, ok := entry.Val(dwarf.AttrName).(string)
		if !ok {
			continue
		}

		if n == name {
			return scope.extractVariableFromEntry(entry)
		}
	}

	return nil, fmt.Errorf("could not find symbol value for %s", name)
}
開發者ID:jeffallen,項目名稱:delve,代碼行數:21,代碼來源:variables.go


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