netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Jakub Kicinski <jakub.kicinski@netronome.com>, netdev@vger.kernel.org
Cc: oss-drivers@netronome.com, alexei.starovoitov@gmail.com,
	Quentin Monnet <quentin.monnet@netronome.com>
Subject: Re: [PATCH net-next 06/12] tools: bpftool: add JSON output for `bpftool prog dump xlated *` command
Date: Mon, 23 Oct 2017 22:32:20 +0200	[thread overview]
Message-ID: <59EE51D4.2040805@iogearbox.net> (raw)
In-Reply-To: <20171023162416.32753-7-jakub.kicinski@netronome.com>

On 10/23/2017 06:24 PM, Jakub Kicinski wrote:
> From: Quentin Monnet <quentin.monnet@netronome.com>
>
> Add a new printing function to dump translated eBPF instructions as
> JSON. As for plain output, opcodes are printed only on request (when
> `opcodes` is provided on the command line).
>
> The disassembled output is generated by the same code that is used by
> the kernel verifier.
>
> Example output:
>
>      $ bpftool --json --pretty prog dump xlated id 1
>      [{
>              "disasm": "(bf) r6 = r1"
>          },{
>              "disasm": "(61) r7 = *(u32 *)(r6 +16)"
>          },{
>              "disasm": "(95) exit"
>          }
>      ]
>
>      $ bpftool --json --pretty prog dump xlated id 1 opcodes
>      [{
>              "disasm": "(bf) r6 = r1",
>              "opcodes": {
>                  "code": "0xbf",
>                  "src_reg": "0x1",
>                  "dst_reg": "0x6",
>                  "off": ["0x00","0x00"
>                  ],
>                  "imm": ["0x00","0x00","0x00","0x00"
>                  ]
>              }
>          },{
>              "disasm": "(61) r7 = *(u32 *)(r6 +16)",
>              "opcodes": {
>                  "code": "0x61",
>                  "src_reg": "0x6",
>                  "dst_reg": "0x7",
>                  "off": ["0x10","0x00"
>                  ],
>                  "imm": ["0x00","0x00","0x00","0x00"
>                  ]
>              }
>          },{
>              "disasm": "(95) exit",
>              "opcodes": {
>                  "code": "0x95",
>                  "src_reg": "0x0",
>                  "dst_reg": "0x0",
>                  "off": ["0x00","0x00"
>                  ],
>                  "imm": ["0x00","0x00","0x00","0x00"
>                  ]
>              }
>          }
>      ]
>
> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

  reply	other threads:[~2017-10-23 20:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 16:24 [PATCH net-next 00/12] tools: bpftool: Add JSON output to bpftool Jakub Kicinski
2017-10-23 16:24 ` [PATCH net-next 01/12] tools: bpftool: copy JSON writer from iproute2 repository Jakub Kicinski
2017-10-23 20:29   ` Daniel Borkmann
2017-10-24  8:23   ` Stephen Hemminger
2017-10-23 16:24 ` [PATCH net-next 02/12] tools: bpftool: add option parsing to bpftool, --help and --version Jakub Kicinski
2017-10-23 20:30   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 03/12] tools: bpftool: introduce --json and --pretty options Jakub Kicinski
2017-10-23 20:30   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 04/12] tools: bpftool: add JSON output for `bpftool prog show *` command Jakub Kicinski
2017-10-23 20:30   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 05/12] tools: bpftool: add JSON output for `bpftool prog dump jited " Jakub Kicinski
2017-10-23 20:31   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 06/12] tools: bpftool: add JSON output for `bpftool prog dump xlated " Jakub Kicinski
2017-10-23 20:32   ` Daniel Borkmann [this message]
2017-10-23 16:24 ` [PATCH net-next 07/12] tools: bpftool: add JSON output for `bpftool map *` commands Jakub Kicinski
2017-10-23 20:32   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 08/12] tools: bpftool: add JSON output for `bpftool batch file FILE` command Jakub Kicinski
2017-10-23 20:32   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 09/12] tools: bpftool: turn err() and info() macros into functions Jakub Kicinski
2017-10-23 20:33   ` Daniel Borkmann
2017-11-03  0:59   ` Joe Perches
2017-11-03 21:26     ` Quentin Monnet
2017-10-23 16:24 ` [PATCH net-next 10/12] tools: bpftool: provide JSON output for all possible commands Jakub Kicinski
2017-10-23 20:33   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 11/12] tools: bpftool: add cosmetic changes for the manual pages Jakub Kicinski
2017-10-23 20:33   ` Daniel Borkmann
2017-10-23 16:24 ` [PATCH net-next 12/12] tools: bpftool: update documentation for --json and --pretty usage Jakub Kicinski
2017-10-23 20:34   ` Daniel Borkmann
2017-10-23 17:44 ` [PATCH net-next 00/12] tools: bpftool: Add JSON output to bpftool Alexei Starovoitov
2017-10-24  0:25 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59EE51D4.2040805@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=quentin.monnet@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).