[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 12 09:10:38 PDT 2023


jimingham wrote:

> > I don't think the lldb command line dumps raw JSON anywhere as a command result. Can we make something a little more human readable?
> 
> It was my idea to make this JSON. The problem is each debug info (.dwo and DWARF in .o files for Mac) has very different fields and pretty printing these items free form looked like it should be JSON. For DWO we have the DW_AT_dwo_name, DW_AT_comp_dir, and DW_AT_dwo_id to display, and for OSO we have .o file path + mod time. I wanted the ability to be able to parse the output and use it in a script so the JSON was nice for that end game. It also allows us to include this information in "statistics dump".
> 
> > BTW, the idea seems useful to me, but particularly if you're doing OSO you can get a whole lot of these so a space efficient presentation where you can scan the names easily, etc, will be important as well.
> 
> Maybe we can add an extra "flavor" to the JSON output, and then have a format string for how the output can look akin to the "frame-format" that the command would use by default? That would allow us to format the output in a nice human readable way for the command output, and also add a --json option to the command. The format string could use the "flavor" ("oso" or "dwo") to format the output string as needed?

Emitting it as JSON seems a fine option for scripting.  If you know that this is an array of dictionaries with all the same keys (that's true for an given output, right?), it shouldn't be hard to write a generic "JSON -> table" routine to convert the output.  Having that driven by a format is an interesting idea, but you'd have to standardize the key values at least somewhat for that to be generally useful.

https://github.com/llvm/llvm-project/pull/66035


More information about the lldb-commits mailing list