hanchenye-llvm-project/lldb/source/Target
Raphael Isemann 6c0bbfc0c9 Add ability to import std module into expression parser to improve C++ debugging
Summary:
This patch is the MVP version of importing the std module into the expression parser to improve C++ debugging.

What happens in this patch is that we inject a `@import std` into our expression source code. We also
modify our internal Clang instance for parsing this expression to work with modules and debug info
at the same time (which is the main change in terms of LOC). We implicitly build the `std` module on the first use. The
C++ include paths for building are extracted from the debug info, which means that this currently only
works if the program is compiled with `-glldb -fmodules` and uses the std module. The C include paths
are currently specified by LLDB.

I enabled the tests currently only for libc++ and Linux because I could test this locally. I'll enable the tests
for other platforms once this has landed and doesn't break any bots (and I implemented the platform-specific
C include paths for them).

With this patch we can now:
* Build a libc++ as a module and import it into the expression parser.
* Read from the module while also referencing declarations from the debug info. E.g. `std::abs(local_variable)`.

What doesn't work (yet):
* Merging debug info and C++ module declarations. E.g. `std::vector<CustomClass>` doesn't work.
* Pretty much anything that involves the ASTImporter and templated code. As the ASTImporter is used for saving the result declaration, this means that we can't
call yet any function that returns a non-trivial type.
* Use libstdc++ for this, as it requires multiple include paths and Clang only emits one include path per module. Also libstdc++ doesn't support Clang modules without patches.

Reviewers: aprantl, jingham, shafik, friss, davide, serge-sans-paille

Reviewed By: aprantl

Subscribers: labath, mgorny, abidh, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

Differential Revision: https://reviews.llvm.org/D58125

llvm-svn: 355939
2019-03-12 17:09:33 +00:00
..
ABI.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
CMakeLists.txt Extract common PlatformPOSIX/Windows code into a separate class 2019-02-12 09:27:24 +00:00
CPPLanguageRuntime.cpp Use std::make_shared in LLDB (NFC) 2019-02-11 23:13:08 +00:00
ExecutionContext.cpp Remove tautological #ifdefs (NFC) 2019-03-05 23:51:25 +00:00
InstrumentationRuntime.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InstrumentationRuntimeStopInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JITLoader.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JITLoaderList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Language.cpp Remove redundant ::get() for smart pointer. (NFC) 2019-02-12 03:47:39 +00:00
LanguageRuntime.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00
Memory.cpp Add parens to force the order of operations in an expression trying 2019-03-09 00:04:24 +00:00
MemoryHistory.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModuleCache.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjCLanguageRuntime.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
OperatingSystem.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00
PathMappingList.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
Platform.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
Process.cpp [lldb-vscode] Report an error if an invalid program is specified. 2019-03-08 00:11:27 +00:00
Queue.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
QueueItem.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
QueueList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterContext.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterNumber.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RemoteAwarePlatform.cpp Refactor user/group name resolving code 2019-03-04 18:48:00 +00:00
SectionLoadHistory.cpp Remove redundant ::get() for smart pointer. (NFC) 2019-02-12 03:47:39 +00:00
SectionLoadList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StackFrame.cpp Fix a crasher in StackFrame::GetValueForVariableExpressionPath() 2019-03-11 18:16:20 +00:00
StackFrameList.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00
StackFrameRecognizer.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
StackID.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StopInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StructuredDataPlugin.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
SystemRuntime.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00
Target.cpp Add ability to import std module into expression parser to improve C++ debugging 2019-03-12 17:09:33 +00:00
TargetList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Thread.cpp Pass ConstString by value (NFC) 2019-03-06 21:22:25 +00:00
ThreadCollection.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlan.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanBase.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanCallFunction.cpp Use std::make_shared in LLDB (NFC) 2019-02-11 23:13:08 +00:00
ThreadPlanCallFunctionUsingABI.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanCallOnFunctionExit.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanCallUserExpression.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanPython.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanRunToAddress.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanShouldStopHere.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepInRange.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00
ThreadPlanStepInstruction.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepOut.cpp Use std::make_shared in LLDB (NFC) 2019-02-11 23:13:08 +00:00
ThreadPlanStepOverBreakpoint.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepOverRange.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepRange.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepThrough.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanStepUntil.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPlanTracer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadSpec.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UnixSignals.cpp Resubmit "Don't include UnixSignals.h from Host." 2019-03-06 18:20:23 +00:00
UnwindAssembly.cpp Replace 'ap' with 'up' suffix in variable names. (NFC) 2019-02-13 06:25:41 +00:00