本文整理匯總了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
}
示例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)
}
示例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
}
示例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)
}
示例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
}
示例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)
}