You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug fix, reload modules before getting thread local storage
Summary:
Debugged locally with 2 scenario:
* Load core only, and then auto-load-debuginfo, then can reproduce the error:
```
(lldb) target var HPHP::s_stackSize
(size_t) HPHP::s_stackSize = <No TLS data currently exists for this thread.>
```
* Load core with executable manually, thread local variable is able to be show:
```
(lldb) target var HPHP::s_stackSize
(size_t) HPHP::s_stackSize = 0
```
The root cause is that the [link_map](https://www.internalfb.com/code/osmeta-external-llvm-project/[toolchain%2Fllvm-sand%2Fmain%3A55d44adeadd8500af2335ac99a9b10d1414f47e4]/lldb/source/Plugins/DynamicLoader/ModuleList-DYLD/DynamicLoaderDumpWithModuleList.cpp?lines=284) in the first scenario was 0. Because when the target was created, [DYLDRenzdevous can not be resolved](https://www.internalfb.com/code/osmeta-external-llvm-project/[toolchain%2Fllvm-sand%2Fmain%3A55d44adeadd8500af2335ac99a9b10d1414f47e4]/lldb/source/Plugins/DynamicLoader/ModuleList-DYLD/DynamicLoaderDumpWithModuleList.cpp?lines=120) because of lacking main executable. After auto-load-debuginfo, even we called target module replace, we never have a chance to call DYLDRenzdevous again to resolve and update link map address.
So calling DidAttach() if m_rendezvous is not valid at the very beginning of GetThreadLocalData function is the easiest fix, to have a chance to update the link_map_addr in m_loaded_modules after we have the executable object file replaced by the auto-load-debuginfo command.
Test Plan:
Before this diff:
```
(lldb) target create --core "k9vc79dn9h6pe2y9"
Core file '/home/hyubo/test/k9vc79dn9h6pe2y9' (x86_64) was loaded.
(lldb) auto-load-debuginfo
...
(lldb) target var HPHP::s_stackSize
(size_t) HPHP::s_stackSize = <No TLS data currently exists for this thread.>
```
After this diff:
```
(lldb) target create --core "k9vc79dn9h6pe2y9"
Core file '/home/hyubo/test/k9vc79dn9h6pe2y9' (x86_64) was loaded.
(lldb) auto-load-debuginfo
...
(lldb) target var HPHP::s_stackSize
(size_t) HPHP::s_stackSize = 0
```
Reviewers: jeffreytan, gclayton, #lldb_team
Reviewed By: jeffreytan
Subscribers: michristensen, #lldb_team
Differential Revision: https://phabricator.intern.facebook.com/D56793922
Tasks: T186207554
Tags: accept2ship
0 commit comments