LEFT | RIGHT |
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 program provides the portable interface to a program being debugged. | 5 // Package program provides the portable interface to a program being debugged. |
6 package program | 6 package program |
7 | 7 |
8 import ( | 8 import ( |
9 "io" | 9 "io" |
10 ) | 10 ) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // TODO: Step(). Where does the granularity happen, | 52 // TODO: Step(). Where does the granularity happen, |
53 // on the proxy end or the debugging control end? | 53 // on the proxy end or the debugging control end? |
54 | 54 |
55 // Kill kills the current process. | 55 // Kill kills the current process. |
56 Kill() (Status, error) | 56 Kill() (Status, error) |
57 | 57 |
58 // Breakpoint sets a breakpoint at the specified address. | 58 // Breakpoint sets a breakpoint at the specified address. |
59 // When the target binary is re-run, breakpoints are | 59 // When the target binary is re-run, breakpoints are |
60 // automatically re-established in the new process by | 60 // automatically re-established in the new process by |
61 // re-evaluating the address. | 61 // re-evaluating the address. |
62 » // Address syntax: | 62 » // The address is the same mini-language accepted by Eval, |
63 » //» "main.main" Start of function | 63 » // which permits setting multiple breakpoints using a regular |
64 » //» "main.go:23" Line number | 64 » // expression to match a set of symbols. |
65 » //» "/regexp/" Set of addresses whose symbolic names match | |
66 » //» (TODO: more to follow; may want an expression grammar) | |
67 » // It is OK if two breakpoints evaluate to the same PC. (TODO: verify.) | |
68 Breakpoint(address string) error | 65 Breakpoint(address string) error |
69 | 66 |
70 // DeleteBreakpoint removes the breakpoint at to the specified | 67 // DeleteBreakpoint removes the breakpoint at to the specified |
71 // address. TODO: Probably the wrong interface. | 68 // address. TODO: Probably the wrong interface. |
72 DeleteBreakpoint(address string) error | 69 DeleteBreakpoint(address string) error |
73 | 70 |
74 // Eval evaluates the expression (typically an address) and returns | 71 // Eval evaluates the expression (typically an address) and returns |
75 // its string representation(s). Multivalued expressions such as | 72 // its string representation(s). Multivalued expressions such as |
76 // matches for regular expressions return multiple values. | 73 // matches for regular expressions return multiple values. |
| 74 // Syntax: |
| 75 // re:regexp |
| 76 // Returns a list of symbol names that match the expression |
| 77 // sym:symbol |
| 78 // Returns a one-element list holding the hexadecimal |
| 79 // ("0x1234") value of the address of the symbol |
| 80 // 0x1234, 01234, 467 |
| 81 // Returns a one-element list holding the name of the |
| 82 // symbol ("main.foo") at that address (hex, octal, decimal
). |
77 Eval(expr string) ([]string, error) | 83 Eval(expr string) ([]string, error) |
78 } | 84 } |
79 | 85 |
80 // The File interface provides access to file-like resources in the program. | 86 // The File interface provides access to file-like resources in the program. |
81 // It implements only ReaderAt and WriterAt, not Reader and Writer, because | 87 // It implements only ReaderAt and WriterAt, not Reader and Writer, because |
82 // random access is a far more common pattern for things like symbol tables, | 88 // random access is a far more common pattern for things like symbol tables, |
83 // and because enormous address space of virtual memory makes routines | 89 // and because enormous address space of virtual memory makes routines |
84 // like io.Copy dangerous. | 90 // like io.Copy dangerous. |
85 type File interface { | 91 type File interface { |
86 io.ReaderAt | 92 io.ReaderAt |
87 io.WriterAt | 93 io.WriterAt |
88 io.Closer | 94 io.Closer |
89 } | 95 } |
90 | 96 |
91 type Status struct { | 97 type Status struct { |
92 PC, SP uint64 | 98 PC, SP uint64 |
93 } | 99 } |
LEFT | RIGHT |