Exemple #1
0
// handleFragment extracts fragment-specific input from the HTTP request and
// returns a FragmentParser if successful.
func (h *Handler) handleFragment(ctx context.Context, rw http.ResponseWriter, req *http.Request) parser.Parser {
	module := req.FormValue("module")
	ident := req.FormValue("ident")
	if module == "" || ident == "" {
		replyError(req, rw, http.StatusBadRequest, "Missing module or ident")
		return nil
	}

	loadAddress, err := breakpad.ParseAddress(req.FormValue("load_address"))
	if err != nil {
		replyError(req, rw, http.StatusBadRequest, fmt.Sprintf("Load address: %s", err))
		return nil
	}

	return parser.NewFragmentParser(module, ident, loadAddress)
}
Exemple #2
0
func main() {
	flag.Parse()

	if *symbolFile == "" {
		fatal("Need to specify a symbol file")
	}
	offset, err := breakpad.ParseAddress(*baseAddress)
	if err != nil {
		fatal(err)
	}

	fd, err := os.Open(*symbolFile)
	if err != nil {
		fatal(err)
	}
	defer fd.Close()

	data, err := ioutil.ReadAll(fd)
	if err != nil {
		fatal(err)
	}

	table, err := breakpad.NewBreakpadSymbolTable(string(data))
	if err != nil {
		fatal(err)
	}

	input := strings.Join(flag.Args(), " ")

	parser := parser.NewFragmentParser(table.ModuleName(), table.Identifier(), offset)
	if err = parser.ParseInput(input); err != nil {
		fatal(err)
	}

	fmt.Println(parser.Symbolize([]breakpad.SymbolTable{table}))
}