Esempio n. 1
0
func serveSymbol(req *web.Request) {
	var p []byte
	if req.Method == "POST" {
		var err os.Error
		p, err = req.BodyBytes(-1)
		if err != nil {
			req.Error(web.StatusInternalServerError, err)
			return
		}
	} else {
		p = []byte(req.URL.RawQuery)
	}

	w := respondText(req)
	io.WriteString(w, "num_symbols: 1\n")
	for len(p) > 0 {
		var a []byte
		if i := bytes.IndexByte(p, '+'); i >= 0 {
			a = p[:i]
			p = p[i+1:]
		} else {
			a = p
			p = nil
		}
		if pc, _ := strconv.Btoui64(string(a), 0); pc != 0 {
			if f := runtime.FuncForPC(uintptr(pc)); f != nil {
				fmt.Fprintf(w, "%#x %s\n", pc, f.Name())
			}
		}
	}
}