Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(440)

Side by Side Diff: program/server/dwarf.go

Issue 112270043: code review 112270043: ogle/server: provide type-aware printer for DWARF-typed... (Closed)
Patch Set: diff -r 836b304af90d https://code.google.com/p/ogle Created 9 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « program/program.go ('k') | program/server/print.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Go Authors. All rights reserved. 1 // Copyright 2014 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 server 5 package server
6 6
7 import ( 7 import (
8 "regexp" 8 "regexp"
9 9
10 "code.google.com/p/ogle/debug/dwarf" 10 "code.google.com/p/ogle/debug/dwarf"
11 ) 11 )
12 12
13 func (s *Server) lookupRE(re *regexp.Regexp) (result []string, err error) { 13 func (s *Server) lookupRE(re *regexp.Regexp) (result []string, err error) {
14 r := s.dwarfData.Reader() 14 r := s.dwarfData.Reader()
15 for { 15 for {
16 entry, err := r.Next() 16 entry, err := r.Next()
17 if err != nil { 17 if err != nil {
18 return nil, err 18 return nil, err
19 } 19 }
20 if entry == nil { 20 if entry == nil {
21 // TODO: why don't we get an error here. 21 // TODO: why don't we get an error here.
22 break 22 break
23 } 23 }
24 if entry.Tag != dwarf.TagSubprogram { 24 if entry.Tag != dwarf.TagSubprogram {
25 continue 25 continue
26 } 26 }
27 » » nameAttr := entry.LookupAttr(dwarf.AttrName) 27 » » nameAttr := entry.Val(dwarf.AttrName)
28 if nameAttr == nil { 28 if nameAttr == nil {
29 // TODO: this shouldn't be possible. 29 // TODO: this shouldn't be possible.
30 continue 30 continue
31 } 31 }
32 name, ok := nameAttr.(string) 32 name, ok := nameAttr.(string)
33 if !ok || !re.MatchString(name) { 33 if !ok || !re.MatchString(name) {
34 continue 34 continue
35 } 35 }
36 result = append(result, name) 36 result = append(result, name)
37 } 37 }
38 return result, nil 38 return result, nil
39 } 39 }
40 40
41 func (s *Server) lookupSym(name string) (uint64, error) { 41 func (s *Server) lookupFunction(name string) (uint64, error) {
42 » return s.dwarfData.LookupSym(name) 42 » return s.dwarfData.LookupFunction(name)
43 } 43 }
44 44
45 func (s *Server) lookupPC(pc uint64) (string, error) { 45 func (s *Server) lookupPC(pc uint64) (string, error) {
46 return s.dwarfData.LookupPC(pc) 46 return s.dwarfData.LookupPC(pc)
47 } 47 }
48 48
49 func (s *Server) entryForPC(pc uint64) (entry *dwarf.Entry, lowpc uint64, err er ror) { 49 func (s *Server) entryForPC(pc uint64) (entry *dwarf.Entry, lowpc uint64, err er ror) {
50 return s.dwarfData.EntryForPC(pc) 50 return s.dwarfData.EntryForPC(pc)
51 } 51 }
52 52
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if x&0x80 == 0 { 90 if x&0x80 == 0 {
91 if x&0x40 != 0 { 91 if x&0x40 != 0 {
92 s |= sign 92 s |= sign
93 } 93 }
94 break 94 break
95 } 95 }
96 } 96 }
97 // Sign extend? 97 // Sign extend?
98 return s 98 return s
99 } 99 }
OLDNEW
« no previous file with comments | « program/program.go ('k') | program/server/print.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b