[Lldb-commits] [lldb] [lldb] Handle STT_TLS symbol type in ELF parser (PR #178975)

via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 5 10:47:55 PST 2026


mugiwaraluffy56 wrote:

> Parsing `STT_TLS` doesn't work on FreeBSD. Is this implementation issue on `Process/FreeBSD`?
> 
> ```
> ➜ ./build/bin/lldb ./build/lldb-test-build.noindex/lang/cpp/thread_local/TestThreadLocal.test_thread_local_dwo/a.out
> (lldb) target create "./build/lldb-test-build.noindex/lang/cpp/thread_local/TestThreadLocal.test_thread_local_dwo/a.out"
> Current executable set to '/usr/src/llvm/tls/build/lldb-test-build.noindex/lang/cpp/thread_local/TestThreadLocal.test_thread_local_dwo/a.out' (x86_64).
> (lldb) b main.cpp:10
> Breakpoint 1: where = a.out`main + 76 at main.cpp:10:3, address = 0x00000000002016ec
> (lldb) r
> Process 24792 launched: '/usr/src/llvm/tls/build/lldb-test-build.noindex/lang/cpp/thread_local/TestThreadLocal.test_thread_local_dwo/a.out' (x86_64)
> Process 24792 stopped
> * thread #1, name = 'a.out', stop reason = breakpoint 1.1
>     frame #0: 0x00000000002016ec a.out`main(argc=1, argv=0x0000000820795330) at main.cpp:10:3
>    7      thread_local int *tl_local_ptr = nullptr;
>    8      tl_local_ptr = &tl_local_int;
>    9      tl_local_int++;
> -> 10     return 0; // Set breakpoint here
>           ^
>    11   }
> (lldb) expr tl_local_int + 1
> 
> error: Couldn't materialize: couldn't get the value of variable tl_local_int: no TLS data currently exists for this thread
> error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression]
> ```

This PR only fixes STT_TLS symbol parsing (recognizing the symbol type in the ELF table). The runtime TLS variable evaluation you're showing is a separate issue in the Process plugin .My PR doesn't address that. The yaml test confirms parsing works correctly.

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


More information about the lldb-commits mailing list