[all-commits] [llvm/llvm-project] 668134: [gsymutil] Add `--statistics` option (#186495)

Roy Shi via All-commits all-commits at lists.llvm.org
Thu Aug 6 17:39:28 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 668134e8acf10218663a0c33835bd4157ba358c4
      https://github.com/llvm/llvm-project/commit/668134e8acf10218663a0c33835bd4157ba358c4
  Author: Roy Shi <royitaqi at users.noreply.github.com>
  Date:   2026-08-07 (Fri, 07 Aug 2026)

  Changed paths:
    M llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
    M llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
    M llvm/include/llvm/DebugInfo/GSYM/GsymReaderV1.h
    M llvm/include/llvm/DebugInfo/GSYM/GsymReaderV2.h
    M llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
    M llvm/lib/DebugInfo/GSYM/GsymReader.cpp
    M llvm/tools/llvm-gsymutil/Opts.td
    M llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
    M llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

  Log Message:
  -----------
  [gsymutil] Add `--statistics` option (#186495)

# Motiviation

Currently, if one wants to know the size of the sections in a gSYM (e.g.
to check if they exceed 4GB), they have to dump the whole gSYM in the
text form, then process that huge text to get the sizes.

# New option `--statistics[=<format>]`

This patch adds a `llvm-gsymutil --statistics[=<format>]` option to
print the size info for all sections. It supports three formats:
* `text`: Default.
* `json`: Dense JSON.
* `pretty-json`: Pretty-printed JSON.

See example output below.

# Examples

```
royshi-mac-office ~/tmp % guuu v2.gsym --statistics
GSYM statistics for "v2.gsym":
  UUID:                4C4C446A-5555-3144-A1CF-AEBBCCD48E61
  Number of addresses:          6,382
  File size:                3,095,960 bytes
  Header:                          20 bytes ( 0.00%)
  Global data dir:                140 bytes ( 0.00%)
  UUID section:                    16 bytes ( 0.00%)
  Address table:               25,528 bytes ( 0.82%)
  Addr info offsets:           51,056 bytes ( 1.65%)
  File table:                   3,652 bytes ( 0.12%)
  String table:             1,772,169 bytes (57.24%)
  Function info data:       1,243,376 bytes (40.16%)
    Size and name:             76,584 bytes ( 2.47%)
    Line table info:          145,260 bytes ( 4.69%)
    Inline info:               58,540 bytes ( 1.89%)
    Call site info:            25,902 bytes ( 0.84%)
    End of list:               51,056 bytes ( 1.65%)
    Padding:                    5,387 bytes ( 0.17%)
    Merged func info:         880,647 bytes (28.45%)
      InfoType/InfoLength/Count/FnSize:        102,900 bytes ( 3.32%)
      Size and name:          209,160 bytes ( 6.76%)
      Line table info:        424,847 bytes (13.72%)
      Inline info:              2,058 bytes ( 0.07%)
      Call site info:           2,242 bytes ( 0.07%)
      Merged func info:             0 bytes ( 0.00%)
      End of list:            139,440 bytes ( 4.50%)
  Padding:                          3 bytes ( 0.00%)

royshi-mac-office ~/tmp % guuu v2.gsym --statistics=pretty-json
{
  "byte-sizes": {
    "addr_info_offsets": 51056,
    "address_table": 25528,
    "file_size": 3095960,
    "file_table": 3652,
    "function_info_data": 1243376,
    "function_info_type_sizes": {
      "call_site_info": 25902,
      "end_of_list": 51056,
      "inline_info": 58540,
      "line_table_info": 145260,
      "merged_func_info": 880647,
      "merged_func_info_type_sizes": {
        "call_site_info": 2242,
        "end_of_list": 139440,
        "infotype_infolength_count_and_fnsize": 102900,
        "inline_info": 2058,
        "line_table_info": 424847,
        "merged_func_info": 0,
        "size_and_name": 209160
      },
      "padding": 5387,
      "size_and_name": 76584
    },
    "global_data_directory": 140,
    "header": 20,
    "padding": 3,
    "string_table": 1772169,
    "uuid_section": 16
  },
  "num_addresses": 6382,
  "path": "v2.gsym",
  "uuid": "4C4C446A-5555-3144-A1CF-AEBBCCD48E61"
}
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list