|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 | 8 |
|
9 | 9 | #include "lldb/Target/CPPLanguageRuntime.h"
|
| 10 | +#include "lldb/Target/ObjCLanguageRuntime.h" |
10 | 11 |
|
11 | 12 | #include <string.h>
|
12 | 13 |
|
|
15 | 16 | #include "llvm/ADT/StringRef.h"
|
16 | 17 |
|
17 | 18 | #include "lldb/Symbol/Block.h"
|
| 19 | +#include "lldb/Symbol/Variable.h" |
18 | 20 | #include "lldb/Symbol/VariableList.h"
|
19 | 21 |
|
20 | 22 | #include "lldb/Core/PluginManager.h"
|
|
31 | 33 | using namespace lldb;
|
32 | 34 | using namespace lldb_private;
|
33 | 35 |
|
| 36 | +static ConstString g_this = ConstString("this"); |
| 37 | + |
34 | 38 | // Destructor
|
35 | 39 | CPPLanguageRuntime::~CPPLanguageRuntime() {}
|
36 | 40 |
|
37 | 41 | CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
|
38 | 42 | : LanguageRuntime(process) {}
|
39 | 43 |
|
| 44 | +bool CPPLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) { |
| 45 | + // All runtime support values have to be marked as artificial by the |
| 46 | + // compiler. But not all artificial variables should be hidden from |
| 47 | + // the user. |
| 48 | + if (!valobj.GetVariable()) |
| 49 | + return false; |
| 50 | + if (!valobj.GetVariable()->IsArtificial()) |
| 51 | + return false; |
| 52 | + |
| 53 | + // Whitelist "this" and since there is no ObjC++ runtime, any ObjC names. |
| 54 | + ConstString name = valobj.GetName(); |
| 55 | + if (name == g_this) |
| 56 | + return false; |
| 57 | + return !ObjCLanguageRuntime::IsWhitelistedRuntimeValue(name); |
| 58 | +} |
| 59 | + |
40 | 60 | bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
|
41 | 61 | ValueObject &object) {
|
42 | 62 | // C++ has no generic way to do this.
|
@@ -317,7 +337,7 @@ CPPLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread,
|
317 | 337 | StackFrameSP frame = thread.GetStackFrameAtIndex(0);
|
318 | 338 |
|
319 | 339 | if (frame) {
|
320 |
| - ValueObjectSP value_sp = frame->FindVariable(ConstString("this")); |
| 340 | + ValueObjectSP value_sp = frame->FindVariable(g_this); |
321 | 341 |
|
322 | 342 | CPPLanguageRuntime::LibCppStdFunctionCallableInfo callable_info =
|
323 | 343 | FindLibCppStdFunctionCallableInfo(value_sp);
|
|
0 commit comments