[all-commits] [llvm/llvm-project] e8ea47: [lldb] Implement thread local storage for linux (#...

jeffreytan81 via All-commits all-commits at lists.llvm.org
Wed Sep 27 09:14:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8ea47602bdb74a88c707d289fc241f7670e1483
      https://github.com/llvm/llvm-project/commit/e8ea47602bdb74a88c707d289fc241f7670e1483
  Author: jeffreytan81 <jeffreytan at meta.com>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M lldb/include/lldb/Target/RegisterContext.h
    M lldb/include/lldb/lldb-defines.h
    M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
    M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    M lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64_with_base.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Target/RegisterContext.cpp
    M lldb/source/Target/Thread.cpp
    M lldb/source/Utility/Args.cpp
    M lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py

  Log Message:
  -----------
  [lldb] Implement thread local storage for linux (#67470)

This patch implements the thread local storage support for linux
(https://github.com/llvm/llvm-project/issues/28766).

TLS feature is originally only implemented for Mac. With my previous
patch to enable `fs_base` register for Linux
(https://reviews.llvm.org/D155256), now it is feasible to implement this
feature for Linux.

The major changes are:
* Track the main module's link address during launch
* Fetch thread pointer from `fs_base` register
* Create register alias for thread pointer
* Read pthread metadata from target memory instead of process so that it
works for coredump

With the patch the failing test is passing now. Note: I am only enabling
this test for Mac and Linux because I do not have machine to test for
FreeBSD/NetBSD.

---------

Co-authored-by: jeffreytan81 <jeffreytan at fb.com>




More information about the All-commits mailing list