[Lldb-commits] [PATCH] D108061: [lldb] Add support for shared library load when executable called through ld.

Rumeet Dhindsa via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 18 12:00:26 PDT 2021


rdhindsa added a comment.

I checked the status with both gdb and lldb using test case added here. It looks like breakpoint on main doesn't get hit even for gdb when called through ld.so. However, breakpoint on shared library functions is supported by gdb. With this patch, we are now able to set breakpoint on functions in shared libraries as supported by gdb.

  bin/lldb -- /lib64/ld-linux-x86-64.so.2 --library-path $PWD ./a.out
  (lldb) target create "/lib64/ld-linux-x86-64.so.2"
   Current executable set to '/lib64/ld-linux-x86-64.so.2' (x86_64).
  (lldb) settings set -- target.run-args  "--library-path" "........" "./a.out"
  (lldb) b main
  Breakpoint 1: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.
  (lldb) b get_signal_crash
  Breakpoint 2: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.
  (lldb) run
  Process 526132 launched: '/lib64/ld-linux-x86-64.so.2' (x86_64)
  1 location added to breakpoint 2
  Process 526132 stopped
  * thread #1, name = 'ld-linux-x86-64', stop reason = breakpoint 2.1
      frame #0: 0x00007ffff7fa1110 libsignal_file.so`get_signal_crash()
  
  gdb --args /lib64/ld-linux-x86-64.so.2 --library-path $PWD ./a.out
  (gdb) b main
  Function "main" not defined.
  Make breakpoint pending on future shared library load? (y or [n]) y
  Breakpoint 1 (main) pending.
  (gdb) b get_signal_crash
  Function "get_signal_crash" not defined.
  Make breakpoint pending on future shared library load? (y or [n]) y
  Breakpoint 2 (get_signal_crash) pending.
  (gdb) run
  Starting program: /lib64/ld-linux-x86-64.so.2 --library-path ...... ./a.out
  Breakpoint 2, 0x00007ffff7fa1114 in get_signal_crash()

This patch adds the support for shared library load. Do you think if it is okay if the functionality to be able to breakpoint on the main executable is added as next step?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108061



More information about the lldb-commits mailing list