Projects STRLCPY redress Commits ea3137d0
🤬
  • ■ ■ ■ ■ ■ ■
    type.go
    skipped 9 lines
    10 10   "os"
    11 11   "path/filepath"
    12 12   "reflect"
     13 + "strconv"
    13 14   "strings"
    14 15   
    15 16   gore "github.com/goretk/gore"
    skipped 65 lines
    81 82   typCmd.Flags().BoolVarP(&includeMethods, "methods", "m", false, "Include method definitions.")
    82 83   typCmd.Flags().StringVar(&forceGoVersion, "version", assumedGoVersion, "Fallback compiler version.")
    83 84   
     85 + typeOffsetCmd := &cobra.Command{
     86 + Use: "offset address path/to/file",
     87 + Short: "Print type at the given address.",
     88 + Args: cobra.ExactArgs(2),
     89 + Run: func(cmd *cobra.Command, args []string) {
     90 + addr, err := strconv.ParseUint(args[0], 0, strconv.IntSize)
     91 + if err != nil {
     92 + fmt.Printf("Bad address format: %s.\n", err)
     93 + return
     94 + }
     95 + file, err := gore.Open(args[1])
     96 + if err != nil {
     97 + fmt.Println("Error when opening the file:", err)
     98 + return
     99 + }
     100 + defer file.Close()
     101 + 
     102 + lookupType(file, addr)
     103 + },
     104 + }
     105 + 
     106 + typCmd.AddCommand(typeOffsetCmd)
    84 107   rootCmd.AddCommand(typCmd)
    85 108  }
    86 109   
    skipped 116 lines
Please wait...
Page is in error, reload to recover