本文整理汇总了Golang中debug/dwarf.Reader函数的典型用法代码### 示例。如果您正苦于以下问题:Golang Reader函数的具体用法?Golang Reader怎么用?Golang Reader使用的例子?那么恭喜您, 这里精选的函数代码### 示例或许可以为您提供帮助。
在下文中一共展示了Reader函数的3个代码### 示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码### 示例。
示例1: TestDWARFRelocations
func TestDWARFRelocations(t *testing.T) {
for i, test := range relocationTests {
f, err := Open(test.file)
if err != nil {
t.Error(err)
continue
}
dwarf, err := f.DWARF()
if err != nil {
t.Error(err)
continue
}
for _, testEntry := range test.entries {
reader := dwarf.Reader()
for j := 0; j < testEntry.entryNumber; j++ {
entry, err := reader.Next()
if entry == nil || err != nil {
t.Errorf("Failed to skip to entry %d: %v", testEntry.entryNumber, err)
continue
}
}
entry, err := reader.Next()
if err != nil {
t.Error(err)
continue
}
if !reflect.DeepEqual(testEntry.entry, entry) {
t.Errorf("#%d/%d: mismatch: got:%#v want:%#v", i, testEntry.entryNumber, entry, testEntry.entry)
continue
}
}
}
}
开发者ID:Harvey-OS,项目名称:go,代码行数:33,代码来源:file_test.go
示例2: TestCompressedDWARF
func TestCompressedDWARF(t *testing.T) {
// Test file built with GCC 4.8.4 and as 2.24 using:
// gcc -Wa,--compress-debug-sections -g -c -o zdebug-test-gcc484-x86-64.obj hello.c
f, err := Open("testdata/zdebug-test-gcc484-x86-64.obj")
if err != nil {
t.Fatal(err)
}
dwarf, err := f.DWARF()
if err != nil {
t.Fatal(err)
}
reader := dwarf.Reader()
n := 0
for {
entry, err := reader.Next()
if err != nil {
t.Fatal(err)
}
if entry == nil {
break
}
n++
}
if n != 18 {
t.Fatalf("want %d DWARF entries, got %d", 18, n)
}
}
开发者ID:Harvey-OS,项目名称:go,代码行数:27,代码来源:file_test.go
示例3: TestDWARFRelocations
func TestDWARFRelocations(t *testing.T) {
for i, test := range relocationTests {
f, err := Open(test.file)
if err != nil {
t.Error(err)
continue
}
dwarf, err := f.DWARF()
if err != nil {
t.Error(err)
continue
}
reader := dwarf.Reader()
// Checking only the first entry is sufficient since it has
// many different strings. If the relocation had failed, all
// the string offsets would be zero and all the strings would
// end up being the same.
firstEntry, err := reader.Next()
if err != nil {
t.Error(err)
continue
}
if !reflect.DeepEqual(test.firstEntry, firstEntry) {
t.Errorf("#%d: mismatch: got:%#v want:%#v", i, firstEntry, test.firstEntry)
continue
}
}
}
开发者ID:HackLinux,项目名称:openrisc,代码行数:29,代码来源:file_test.go
最后编辑: kuteng 文档更新时间: 2021-08-23 19:14 作者:kuteng