summaryrefslogtreecommitdiff
path: root/usr/austin/ogle/cmd.go
diff options
context:
space:
mode:
authorAustin Clements <aclements@csail.mit.edu>2009-09-25 09:39:08 -0700
committerAustin Clements <aclements@csail.mit.edu>2009-09-25 09:39:08 -0700
commit3b4fd069f85c550e2c1aecf2cb71fce1bf9d2734 (patch)
tree3953c656d29f7babbcd97c70bb9be9f5e650f74f /usr/austin/ogle/cmd.go
parent57f80519032490f375886f5547eaf4f0971e4ffd (diff)
downloadgolang-3b4fd069f85c550e2c1aecf2cb71fce1bf9d2734.tar.gz
Switch ogle to in-tree gosym package. Delete my private sym
package. If a Sym is a function symbol, include a reference to the Func so it's easily accessible when you're traversing the list of all symbols. This diff is more interesting than the proc switch because the gosym interface differs from the old sym interface. R=rsc APPROVED=rsc DELTA=1957 (34 added, 1868 deleted, 55 changed) OCL=34969 CL=35008
Diffstat (limited to 'usr/austin/ogle/cmd.go')
-rw-r--r--usr/austin/ogle/cmd.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/usr/austin/ogle/cmd.go b/usr/austin/ogle/cmd.go
index 150b5a5a3..09767e72f 100644
--- a/usr/austin/ogle/cmd.go
+++ b/usr/austin/ogle/cmd.go
@@ -6,6 +6,7 @@ package ogle
import (
"bufio";
+ "debug/elf";
"debug/proc";
"eval";
"fmt";
@@ -14,7 +15,6 @@ import (
"os";
"strconv";
"strings";
- "sym";
)
var world *eval.World;
@@ -177,7 +177,7 @@ func cmdLoad(args []byte) os.Error {
return err;
}
defer f.Close();
- elf, err := sym.NewElf(f);
+ elf, err := elf.NewFile(f);
if err != nil {
tproc.Detach();
return err;
@@ -366,13 +366,9 @@ func fnBpSet(t *eval.Thread, args []eval.Value, res []eval.Value) {
t.Abort(NoCurrentGoroutine{});
}
name := args[0].(eval.StringValue).Get(t);
- s := curProc.syms.SymFromName(name);
- if s == nil {
- t.Abort(UsageError("symbol " + name + " not defined"));
+ fn := curProc.syms.LookupFunc(name);
+ if fn == nil {
+ t.Abort(UsageError("no such function " + name));
}
- fn, ok := s.(*sym.TextSym);
- if !ok {
- t.Abort(UsageError("symbol " + name + " is not a function"));
- }
- curProc.OnBreakpoint(proc.Word(fn.Entry())).AddHandler(EventStop);
+ curProc.OnBreakpoint(proc.Word(fn.Entry)).AddHandler(EventStop);
}