llvm-project/lldb/unittests
Raphael Isemann c9a39a896c [lldb] Add a display name to ClangASTContext instances
Summary:
I often struggle to understand what exactly LLDB is doing by looking at our expression evaluation logging as our messages look like this:
```
CompleteTagDecl[2] on (ASTContext*)0x7ff31f01d240 Completing (TagDecl*)0x7ff31f01d568 named DeclName1
```

From the log messages it's unclear what this ASTContext is. Is it the scratch context, the expression context, some decl vendor context or a context from a module?
The pointer value isn't helpful for anyone unless I'm in a debugger where I could inspect the memory at the address. But even with a debugger it's not easy to
figure out what this ASTContext is without having deeper understanding about all the different ASTContext instances in LLDB (e.g., valid SourceLocation
from the file system usually means that this is the Objective-C decl vendor, a file name from multiple expressions is probably the scratch context, etc.).

This patch adds a name field to ClangASTContext instances that we can use to store a name which can be used for logging and debugging. With this
our log messages now look like this:
```
CompleteTagDecl[2] on scratch ASTContext. Completing (TagDecl*)0x7ff31f01d568 named Foo
```
We can now also just print a ClangASTContext from the debugger and see a useful name in the `m_display_name` field, e.g.
```
  m_display_name = "AST for /Users/user/test/main.o";
```

Reviewers: shafik, labath, JDevlieghere, mib

Reviewed By: shafik

Subscribers: clayborg, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72391
2020-01-22 08:54:10 +01:00
..
Breakpoint Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Core [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
DataFormatter [lldb][NFC] Cleanup includes in FormatManagerTests.cpp 2019-12-11 11:33:19 +01:00
Disassembler [lldb/Plugin] Move DisassemblerLLVMC for consistency with plugin (NFC) 2020-01-21 15:17:29 -08:00
Editline [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
Expression Fix a buffer-size bug when the first DW_OP_piece is undefined 2020-01-16 16:47:59 -08:00
Host [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
Interpreter [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
Language [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
ObjectFile [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
Platform Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Process [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
ScriptInterpreter [Lldb/Lua] Generate Lua Bindings 2019-12-21 11:28:41 -08:00
Signals Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Symbol [lldb] Add a display name to ClangASTContext instances 2020-01-22 08:54:10 +01:00
SymbolFile [lldb] Add a display name to ClangASTContext instances 2020-01-22 08:54:10 +01:00
Target [lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests 2019-12-23 10:38:25 +01:00
TestingSupport [lldb] Add a display name to ClangASTContext instances 2020-01-22 08:54:10 +01:00
UnwindAssembly [lldb/Plugin] Move DisassemblerLLVMC for consistency with plugin (NFC) 2020-01-21 15:17:29 -08:00
Utility RangeDataVector: Support custom sorting for D63540 2020-01-10 15:14:38 +01:00
debugserver [lldb] Fix JSON parser to allow empty arrays 2019-11-18 15:12:55 +01:00
tools [lldb] [unittest] Skip TestStopReplyContainsThreadPcs on NetBSD 2019-11-18 22:36:02 +01:00
CMakeLists.txt [FormatManager] Add a unittest for GetCandidateLanguages() 2019-12-10 13:42:59 -08:00
gtest_common.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00