[PATCH] D95511: [llvm-readelf] Support dumping the BB address map section with --bb-addr-map.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 23:12:25 PST 2021


rahmanl added a comment.

In D95511#2541083 <https://reviews.llvm.org/D95511#2541083>, @mtrofin wrote:

> In D95511#2541073 <https://reviews.llvm.org/D95511#2541073>, @rahmanl wrote:
>
>> In D95511#2541040 <https://reviews.llvm.org/D95511#2541040>, @mtrofin wrote:
>>
>>> Can the output be consumed programmatically?  (i.e. is it for example valid yaml or json)
>>
>> Yes, but it's not yaml or json. The output is `std::vector<Elf_BBAddrMap>` and it is accessible via the library call: `ELFFile::decodeBBAddrMap(Elf_Shdr&)` (However, the user needs to find the BB address map section).
>
> I meant the textual output. It's very close to json - the benefit of it actually being json is that one could script from llvm-readobj output.

I see. You're right. The output is similar to json. This is produced by `ScopedPrinter`. The relevant sources do not point out similarity with JSON at all. Maybe @jhenderson can answer this.

> The other question - looking at the textual output, could it go the next step and produce the association bbaddress - name? My thinking is that the user of the output would find that more valuable (quick scripting, for instance)

This is a good point. Currently, the bb-address-map is only generated using `-fbasic-block-sections=labels` which also renumbers the basic block in ascending. So we can say that the MBB number associated with the //i//'th BB entry is //i//.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95511/new/

https://reviews.llvm.org/D95511



More information about the llvm-commits mailing list