[RFC] Improve map-files for effective analysis and debugging

Hi @smithp35

Thank you for the quick response.

You have managed to catch me just before I go on vacation for the week before Easter.

I am glad we were able to catch you :). I wish you a great vacation!

The LLVM Embedded Toolchains working group is this Thursday (LLVM Embedded Toolchains Working Group sync up ) you might want to join that call to discuss.

That’s great to know. Would it be possible to discuss this RFC in the upcoming embedded toolchain meeting? I can briefly present the RFC and some of the improvements to initiate the discussion for map-file format.

There’s been a group of people wanting to improve the LLD map file output at each of the most recent LLVM Dev meetings. I think the suggestions are broadly in line with suggestions at those meetings.

That’s great to know!

  • Should all of those extra outputs be enabled at once? Could people opt in to extra diagnostics to keep the Map file small? If this were the case each individual topic could be discussed individually with more focus.

Yes, we should definitely allow users to selectively enable which extra information they want in the map-file. We can perhaps have a core set of information which would always be part of the map-file and users can opt in for additional information by using options such as --MapDetail linker-script-expression, --MapDetail input-section-description and so on. I think if we go this route, then we should also add a wildcard option --MapDetail all for having map-file as detailed as possible.

  • The topic of a machine readable map file ouptut format has come up before. Would this be a good format for some of the additional information.

This sounds great! As @Shankar_Easwaram mentioned, we have a custom protobuf schema for storing map-file and making it more parse-friendly :). We have had good experience with the protobuf for this so far. This being said, we should definitely explore and discuss more options.

  • The expression evaluation may need more significant effort. I can remember a discussion suggesting that an AST format that is walked may be required to do this well.

Yes, expression evaluation would need significant effort, but in our experience, it’s definitely worth the efforts. Having this information significantly speeds up debugging time in some cases.

Thank you for mentioning about the AST format. This sounds interesting.

Thank you for your feedback.