LEFT | RIGHT |
(no file at all) | |
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 // Ogle is the beginning of a debugger for Go. | 5 // Ogle is the beginning of a debugger for Go. |
6 package ogle | 6 package ogle |
7 | 7 |
8 import ( | 8 import ( |
9 "bufio" | 9 "bufio" |
10 "debug/elf" | 10 "debug/elf" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 return nil | 200 return nil |
201 } | 201 } |
202 | 202 |
203 func parseLoad(args []byte) (ident string, path string, err os.Error) { | 203 func parseLoad(args []byte) (ident string, path string, err os.Error) { |
204 err = UsageError("Usage: load [sym] \"path\"") | 204 err = UsageError("Usage: load [sym] \"path\"") |
205 sc, ev := newScanner(args) | 205 sc, ev := newScanner(args) |
206 | 206 |
207 var toks [4]token.Token | 207 var toks [4]token.Token |
208 » var lits [4][]byte | 208 » var lits [4]string |
209 for i := range toks { | 209 for i := range toks { |
210 _, toks[i], lits[i] = sc.Scan() | 210 _, toks[i], lits[i] = sc.Scan() |
211 } | 211 } |
212 if sc.ErrorCount != 0 { | 212 if sc.ErrorCount != 0 { |
213 err = ev.GetError(scanner.NoMultiples) | 213 err = ev.GetError(scanner.NoMultiples) |
214 return | 214 return |
215 } | 215 } |
216 | 216 |
217 i := 0 | 217 i := 0 |
218 switch toks[i] { | 218 switch toks[i] { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if curProc == nil { | 364 if curProc == nil { |
365 t.Abort(NoCurrentGoroutine{}) | 365 t.Abort(NoCurrentGoroutine{}) |
366 } | 366 } |
367 name := args[0].(eval.StringValue).Get(t) | 367 name := args[0].(eval.StringValue).Get(t) |
368 fn := curProc.syms.LookupFunc(name) | 368 fn := curProc.syms.LookupFunc(name) |
369 if fn == nil { | 369 if fn == nil { |
370 t.Abort(UsageError("no such function " + name)) | 370 t.Abort(UsageError("no such function " + name)) |
371 } | 371 } |
372 curProc.OnBreakpoint(proc.Word(fn.Entry)).AddHandler(EventStop) | 372 curProc.OnBreakpoint(proc.Word(fn.Entry)).AddHandler(EventStop) |
373 } | 373 } |
LEFT | RIGHT |