From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann 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 Message-ID: <59EE51D4.2040805@iogearbox.net> References: <20171023162416.32753-1-jakub.kicinski@netronome.com> <20171023162416.32753-7-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: oss-drivers@netronome.com, alexei.starovoitov@gmail.com, Quentin Monnet To: Jakub Kicinski , netdev@vger.kernel.org Return-path: Received: from www62.your-server.de ([213.133.104.62]:41750 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbdJWUcW (ORCPT ); Mon, 23 Oct 2017 16:32:22 -0400 In-Reply-To: <20171023162416.32753-7-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: On 10/23/2017 06:24 PM, Jakub Kicinski wrote: > From: Quentin Monnet > > 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 Acked-by: Daniel Borkmann