OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package dwarf_test | 5 package dwarf_test |
6 | 6 |
7 // Stripped-down, simplified version of ../../gosym/pclntab_test.go | 7 // Stripped-down, simplified version of ../../gosym/pclntab_test.go |
8 | 8 |
9 import ( | 9 import ( |
10 "fmt" | 10 "fmt" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 defer endtest() | 110 defer endtest() |
111 | 111 |
112 data, err := getData(pclinetestBinary) | 112 data, err := getData(pclinetestBinary) |
113 if err != nil { | 113 if err != nil { |
114 t.Fatal(err) | 114 t.Fatal(err) |
115 } | 115 } |
116 | 116 |
117 // Test PCToLine. | 117 // Test PCToLine. |
118 // TODO: Do much more than this. | 118 // TODO: Do much more than this. |
119 » pc, err := data.LookupSym("linefrompc") | 119 » pc, err := data.LookupFunction("linefrompc") |
120 if err != nil { | 120 if err != nil { |
121 t.Fatal(err) | 121 t.Fatal(err) |
122 } | 122 } |
123 file, line, err := data.PCToLine(pc) | 123 file, line, err := data.PCToLine(pc) |
124 if err != nil { | 124 if err != nil { |
125 t.Fatal(err) | 125 t.Fatal(err) |
126 } | 126 } |
127 // We expect <longpath>/pclinetest.asm, line 13. | 127 // We expect <longpath>/pclinetest.asm, line 13. |
128 if !strings.HasSuffix(file, "/pclinetest.asm") { | 128 if !strings.HasSuffix(file, "/pclinetest.asm") { |
129 t.Errorf("got %s; want %s", file, ".../pclinetest.asm") | 129 t.Errorf("got %s; want %s", file, ".../pclinetest.asm") |
130 } | 130 } |
131 if line != 13 { | 131 if line != 13 { |
132 t.Errorf("got %d; want %d", line, 13) | 132 t.Errorf("got %d; want %d", line, 13) |
133 } | 133 } |
134 } | 134 } |
OLD | NEW |