llvm-project/lldb/source/Commands
Greg Clayton 63a27afae3 Added support for thread local variables on all Apple OS variants.
We had support that assumed that thread local data for a variable could be determined solely from the module in which the variable exists. While this work for linux, it doesn't work for Apple OSs. The DWARF for thread local variables consists of location opcodes that do something like:

DW_OP_const8u (x)
DW_OP_form_tls_address

or 

DW_OP_const8u (x)
DW_OP_GNU_push_tls_address

The "x" is allowed to be anything that is needed to determine the location of the variable. For Linux "x" is the offset within the TLS data for a given executable (ModuleSP in LLDB). For Apple OS variants, it is the file address of the data structure that contains a pthread key that can be used with pthread_getspecific() and the offset needed. 

This fix passes the "x" along to the thread:

virtual lldb::addr_t
lldb_private::Thread::GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr);

Then this is passed along to the DynamicLoader::GetThreadLocalData():

virtual lldb::addr_t
lldb_private::DynamicLoader::GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr);

This allows each DynamicLoader plug-in do the right thing for the current OS.

The DynamicLoaderMacOSXDYLD was modified to be able to grab the pthread key from the data structure that is in memory and call "void *pthread_getspecific(pthread_key_t key)" to get the value of the thread local storage and it caches it per thread since it never changes.

I had to update the test case to access the thread local data before trying to print it as on Apple OS variants, thread locals are not available unless they have been accessed at least one by the current thread.

I also added a new lldb::ValueType named "eValueTypeVariableThreadLocal" so that we can ask SBValue objects for their ValueType and be able to tell when we have a thread local variable.

<rdar://problem/23308080>

llvm-svn: 274366
2016-07-01 17:17:23 +00:00
..
CMakeLists.txt [cmake] Remove LLVM_NO_RTTI. 2015-09-03 08:46:55 +00:00
CommandCompletions.cpp Unicode support on Win32. 2016-03-22 17:58:09 +00:00
CommandObjectApropos.cpp Change 'apropos' such that it doesn't look into the "long help/syntax" strings for commands 2016-03-23 01:21:55 +00:00
CommandObjectApropos.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectArgs.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-19 19:33:46 +00:00
CommandObjectArgs.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectBreakpoint.cpp second pass over removal of Mutex and Condition 2016-05-19 05:13:57 +00:00
CommandObjectBreakpoint.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectBreakpointCommand.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-19 19:33:46 +00:00
CommandObjectBreakpointCommand.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectBugreport.cpp commands: Use override instead of virtual. 2015-10-07 16:56:17 +00:00
CommandObjectBugreport.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectCommands.cpp Cleanups to command alias to refer to itself as 'command alias' and not allow to make aliases starting with a - as that isn't really supported, and is most often a mistake (trying to pass options) 2016-04-08 17:56:57 +00:00
CommandObjectCommands.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectDisassemble.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-20 00:58:29 +00:00
CommandObjectDisassemble.h Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-20 00:58:29 +00:00
CommandObjectExpression.cpp fixits are apparently called fix-its. 2016-06-28 01:33:03 +00:00
CommandObjectExpression.h [LLDB] Added support for PHI nodes to IR interpreter 2016-05-12 20:00:53 +00:00
CommandObjectFrame.cpp Added support for thread local variables on all Apple OS variants. 2016-07-01 17:17:23 +00:00
CommandObjectFrame.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectGUI.cpp Don't #include "lldb-python.h" from anywhere. 2015-05-29 17:41:47 +00:00
CommandObjectGUI.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectHelp.cpp Added command prefix to new help messages to ensure that they're correctly words in REPL mode. 2016-04-21 00:55:20 +00:00
CommandObjectHelp.h When 'help' cannot find a command, produce additional help text that also points the user to the apropos and type lookup commands 2016-02-29 23:22:53 +00:00
CommandObjectLanguage.cpp Replace accidental DOS (and mixed) line endings in a few text files 2016-01-11 18:07:47 +00:00
CommandObjectLanguage.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectLog.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-20 00:58:29 +00:00
CommandObjectLog.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectMemory.cpp Since our expression parser needs to locate areas of memory that are not in use when you have a process that can't JIT code, like core file debugging, the core file process plug-ins should be able to override the Process::GetMemoryRegionInfo(...) function. 2016-06-09 16:34:06 +00:00
CommandObjectMemory.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectMultiword.cpp Fix a bug where LLDB would crash if 'apropos <anything>' was used after spawning an inferior process 2016-04-20 20:48:05 +00:00
CommandObjectPlatform.cpp Get rid of a global constructor and also make this code safe to use after the global destructor chain has been run on the main thread. 2016-03-24 21:49:22 +00:00
CommandObjectPlatform.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectPlugin.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-20 00:58:29 +00:00
CommandObjectPlugin.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectProcess.cpp second pass over removal of Mutex and Condition 2016-05-19 05:13:57 +00:00
CommandObjectProcess.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectQuit.cpp Don't #include "lldb-python.h" from anywhere. 2015-05-29 17:41:47 +00:00
CommandObjectQuit.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectRegister.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-23 01:43:44 +00:00
CommandObjectRegister.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectSettings.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-24 02:05:55 +00:00
CommandObjectSettings.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectSource.cpp Keep original source path and mapped path in LineEntry 2016-05-11 22:46:53 +00:00
CommandObjectSource.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectSyntax.cpp When 'help' cannot find a command, produce additional help text that also points the user to the apropos and type lookup commands 2016-02-29 23:22:53 +00:00
CommandObjectSyntax.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectTarget.cpp Added support for thread local variables on all Apple OS variants. 2016-07-01 17:17:23 +00:00
CommandObjectTarget.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectThread.cpp second pass over removal of Mutex and Condition 2016-05-19 05:13:57 +00:00
CommandObjectThread.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectType.cpp Make LLDB print out an explicit marker when it's displaying formatters that are part of a disabled category 2016-05-16 17:27:26 +00:00
CommandObjectType.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectVersion.cpp Don't #include "lldb-python.h" from anywhere. 2015-05-29 17:41:47 +00:00
CommandObjectVersion.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectWatchpoint.cpp second pass over removal of Mutex and Condition 2016-05-19 05:13:57 +00:00
CommandObjectWatchpoint.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00
CommandObjectWatchpointCommand.cpp Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes. 2016-02-23 01:43:44 +00:00
CommandObjectWatchpointCommand.h Fix Clang-tidy misc-use-override warnings in source/Commands headers, unify closing inclusion guards 2015-09-02 09:33:09 +00:00