Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Commands = make(map[string]*Command)
View Source
var MapsCmd = cmd(&Command{ Name: "maps", Desc: "Display memory mappings.", Run: func(c *Context) error { for _, m := range c.U.Mappings() { c.Printf(" %v\n", m.String()) } return nil }, })
View Source
var MemCmd = cmd(&Command{ Name: "mem", Desc: "Read/write memory.", Run: func(c *Context, addr, size uint64) error { mem, err := c.U.MemRead(addr, size) if err != nil { return err } for _, line := range models.HexDump(addr, mem, int(c.U.Bits())) { c.Printf(" %s\n", line) } return nil }, })
View Source
var RegCmd = cmd(&Command{ Name: "reg", Desc: "Read/write regs.", Run: func(c *Context, args ...string) error { if len(args) == 0 { for name, enum := range c.U.Arch().Regs { val, _ := c.U.RegRead(enum) c.Printf("%s 0x%x\n", name, val) } } else { for _, v := range args { var value uint64 reg := v match := strEqNumRe.FindStringSubmatch(v) if len(match) > 0 { reg = match[1] var err error if match[2][0] == '-' { var n int64 n, err = strconv.ParseInt(match[2], 0, int(c.U.Bits())) value = uint64(n) } else { value, err = strconv.ParseUint(match[2], 0, int(c.U.Bits())) } if err != nil { c.Printf("error parsing %s value: %v\n", reg, err) continue } } valid := false for name, enum := range c.U.Arch().Regs { if reg == name { valid = true if len(match) > 0 { if err := c.U.RegWrite(enum, value); err != nil { c.Printf("%s: %v\n", v, err) } } else { val, _ := c.U.RegRead(enum) c.Printf("%s 0x%x\n", name, val) } break } } if !valid { if strings.Contains(reg, "=") { c.Printf("invalid assignment: %s\n", reg) } else { c.Printf("reg %s not found\n", reg) } } } } return nil }, })
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.