• Daniel Borkmann's avatar
    bpf: bpftool support for dumping data/bss/rodata sections · 817998af
    Daniel Borkmann authored
    Add the ability to bpftool to handle BTF Var and DataSec kinds
    in order to dump them out of btf_dumper_type(). The value has a
    single object with the section name, which itself holds an array
    of variables it dumps. A single variable is an object by itself
    printed along with its name. From there further type information
    is dumped along with corresponding value information.
    
    Example output from .rodata:
    
      # ./bpftool m d i 150
      [{
              "value": {
                  ".rodata": [{
                          "load_static_data.bar": 18446744073709551615
                      },{
                          "num2": 24
                      },{
                          "num5": 43947
                      },{
                          "num6": 171
                      },{
                          "str0": [97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0,0
                          ]
                      },{
                          "struct0": {
                              "a": 42,
                              "b": 4278120431,
                              "c": 1229782938247303441
                          }
                      },{
                          "struct2": {
                              "a": 0,
                              "b": 0,
                              "c": 0
                          }
                      }
                  ]
              }
          }
      ]
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    817998af
map.c 27.6 KB