[Lldb-commits] [PATCH] D106837: Create synthetic symbol names on demand to improve memory consumption and startup times.

PoYao Chang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 23 00:21:25 PST 2021


rZhBoYao added a comment.

Hi all, I found this patch causing PR52702 <https://llvm.org/PR52702> in that the parent of this commit <https://github.com/llvm/llvm-project/commit/ec1a4917> and LLDB 12 worked fine.
When disassembling a hello world C program on Linux, LLDB used to show
 `callq  0x401030                  ; symbol stub for: puts` 
instead of
`callq  0x401030                  ; symbol stub for: ___lldb_unnamed_symbol36`.
Examining the symbol table by running `lldb -b -o 'image dump symtab' a.out` used to show:

  [   18]     20   X Undefined       0x0000000000000000                    0x0000000000000000 0x00000012 puts at GLIBC_2.2.5
                           ........
  [   33]     35   X Code            0x0000000000401000                    0x000000000000001b 0x00000212 _init
  [   34]     36  S  Trampoline      0x0000000000401030                    0x0000000000000010 0x00000000 puts
  [   35]     37  SX Code            0x0000000000401020                    0x0000000000000010 0x00000000 ___lldb_unnamed_symbol1$$a.out

and now (ToT and LLDB 13) it's:

  [   18]     20   X Undefined       0x0000000000000000                    0x0000000000000000 0x00000012 puts at GLIBC_2.2.5
                           ........
  [   33]     35   X Code            0x0000000000401000                    0x000000000000001b 0x00000212 _init
  [   34]     36  S  Trampoline      0x0000000000401030                    0x0000000000000010 0x00000000 ___lldb_unnamed_symbol36
  [   35]     37  SX Code            0x0000000000401020                    0x0000000000000010 0x00000000 ___lldb_unnamed_symbol37

`image dump symtab libc.so.6` gives similar result.
Before ec1a4917 <https://github.com/llvm/llvm-project/commit/ec1a4917> :

  [ 2366]   2367  S  Trampoline      0x0000000000025010 0x00007ffff7df2010 0x0000000000000010 0x00000000 realloc
  [ 2367]   2368  S  Trampoline      0x0000000000025020 0x00007ffff7df2020 0x0000000000000010 0x00000000 __tls_get_addr
  [ 2368]   2369  S  Trampoline      0x0000000000025030 0x00007ffff7df2030 0x0000000000000010 0x00000000 memalign
  [ 2369]   2370  S  Trampoline      0x0000000000025040 0x00007ffff7df2040 0x0000000000000010 0x00000000 _dl_exception_create
  [ 2370]   2371  S  Trampoline      0x0000000000025050 0x00007ffff7df2050 0x0000000000000010 0x00000000 __tunable_get_val
  [ 2371]   2372  S  Trampoline      0x0000000000025060 0x00007ffff7df2060 0x0000000000000010 0x00000000 _dl_find_dso_for_object
  [ 2372]   2373  S  Trampoline      0x0000000000025070 0x00007ffff7df2070 0x0000000000000010 0x00000000 calloc
  [ 2373]   2373  SX Code            0x0000000000025000 0x00007ffff7df2000 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol1$$libc.so.6
  [ 2374]   2373  SX Code            0x0000000000025300 0x00007ffff7df2300 0x0000000000000040 0x00000000 ___lldb_unnamed_symbol2$$libc.so.6
  [ 2375]   2373  SX Code            0x0000000000025340 0x00007ffff7df2340 0x00000000000002f0 0x00000000 ___lldb_unnamed_symbol3$$libc.so.6
  [ 2376]   2373  SX Code            0x0000000000025630 0x00007ffff7df2630 0x000000000000000c 0x00000000 ___lldb_unnamed_symbol4$$libc.so.6

After:

  [ 2366]   2367  S  Trampoline      0x0000000000025010 0x00007ffff7df2010 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2367
  [ 2367]   2368  S  Trampoline      0x0000000000025020 0x00007ffff7df2020 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2368
  [ 2368]   2369  S  Trampoline      0x0000000000025030 0x00007ffff7df2030 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2369
  [ 2369]   2370  S  Trampoline      0x0000000000025040 0x00007ffff7df2040 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2370
  [ 2370]   2371  S  Trampoline      0x0000000000025050 0x00007ffff7df2050 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2371
  [ 2371]   2372  S  Trampoline      0x0000000000025060 0x00007ffff7df2060 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2372
  [ 2372]   2373  S  Trampoline      0x0000000000025070 0x00007ffff7df2070 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2373
  [ 2373]   2374  SX Code            0x0000000000025000 0x00007ffff7df2000 0x0000000000000010 0x00000000 ___lldb_unnamed_symbol2374
  [ 2374]   2375  SX Code            0x0000000000025300 0x00007ffff7df2300 0x0000000000000040 0x00000000 ___lldb_unnamed_symbol2375
  [ 2375]   2376  SX Code            0x0000000000025340 0x00007ffff7df2340 0x00000000000002f0 0x00000000 ___lldb_unnamed_symbol2376
  [ 2376]   2377  SX Code            0x0000000000025630 0x00007ffff7df2630 0x000000000000000c 0x00000000 ___lldb_unnamed_symbol2377

Is this intended for the performance boost? It seems to me that "`S  Trampoline`" symbols should be handled differently.

FWIW, I also found that this doesn't affect macOS tho as `puts` is not even a synthetic symbol:

  Index   UserID DSX Type            File Address/Value Load Address       Size               Flags      Name
  ------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
  [    0]      0     Data            0x0000000100008008                    0x0000000000000008 0x000e0000 _dyld_private
  [    1]      1   X Data            0x0000000100000000                    0x0000000000003f70 0x000f0010 _mh_execute_header
  [    2]      2   X Code            0x0000000100003f70                    0x0000000000000014 0x000f0000 main
  [    3]      3     Trampoline      0x0000000100003f84                    0x0000000000000006 0x00010100 puts
  [    4]      4   X Undefined       0x0000000000000000                    0x0000000000000000 0x00010100 dyld_stub_binder

  callq  0x100003f84               ; symbol stub for: puts


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106837



More information about the lldb-commits mailing list