LLDB  mainline
ClangExpressionSourceCode.cpp
Go to the documentation of this file.
1 //===-- ClangExpressionSourceCode.cpp -------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
11 #include "ClangExpressionUtil.h"
12 
13 #include "clang/Basic/CharInfo.h"
14 #include "clang/Basic/FileManager.h"
15 #include "clang/Basic/SourceManager.h"
16 #include "clang/Lex/Lexer.h"
17 #include "llvm/ADT/StringRef.h"
18 
21 #include "lldb/Symbol/Block.h"
24 #include "lldb/Symbol/TypeSystem.h"
27 #include "lldb/Target/Language.h"
28 #include "lldb/Target/Platform.h"
29 #include "lldb/Target/StackFrame.h"
30 #include "lldb/Target/Target.h"
32 #include "lldb/lldb-forward.h"
33 
34 using namespace lldb_private;
35 
36 #define PREFIX_NAME "<lldb wrapper prefix>"
37 #define SUFFIX_NAME "<lldb wrapper suffix>"
38 
40 
42 "#line 1 \"" PREFIX_NAME R"("
43 #ifndef offsetof
44 #define offsetof(t, d) __builtin_offsetof(t, d)
45 #endif
46 #ifndef NULL
47 #define NULL (__null)
48 #endif
49 #ifndef Nil
50 #define Nil (__null)
51 #endif
52 #ifndef nil
53 #define nil (__null)
54 #endif
55 #ifndef YES
56 #define YES ((BOOL)1)
57 #endif
58 #ifndef NO
59 #define NO ((BOOL)0)
60 #endif
61 typedef __INT8_TYPE__ int8_t;
62 typedef __UINT8_TYPE__ uint8_t;
63 typedef __INT16_TYPE__ int16_t;
64 typedef __UINT16_TYPE__ uint16_t;
65 typedef __INT32_TYPE__ int32_t;
66 typedef __UINT32_TYPE__ uint32_t;
67 typedef __INT64_TYPE__ int64_t;
68 typedef __UINT64_TYPE__ uint64_t;
69 typedef __INTPTR_TYPE__ intptr_t;
70 typedef __UINTPTR_TYPE__ uintptr_t;
71 typedef __SIZE_TYPE__ size_t;
72 typedef __PTRDIFF_TYPE__ ptrdiff_t;
73 typedef unsigned short unichar;
74 extern "C"
75 {
76  int printf(const char * __restrict, ...);
77 }
78 )";
79 
81  "\n;\n#line 1 \"" SUFFIX_NAME "\"\n";
82 
83 namespace {
84 
85 class AddMacroState {
86  enum State {
87  CURRENT_FILE_NOT_YET_PUSHED,
88  CURRENT_FILE_PUSHED,
89  CURRENT_FILE_POPPED
90  };
91 
92 public:
93  AddMacroState(const FileSpec &current_file, const uint32_t current_file_line)
94  : m_current_file(current_file), m_current_file_line(current_file_line) {}
95 
96  void StartFile(const FileSpec &file) {
97  m_file_stack.push_back(file);
98  if (file == m_current_file)
99  m_state = CURRENT_FILE_PUSHED;
100  }
101 
102  void EndFile() {
103  if (m_file_stack.size() == 0)
104  return;
105 
106  FileSpec old_top = m_file_stack.back();
107  m_file_stack.pop_back();
108  if (old_top == m_current_file)
109  m_state = CURRENT_FILE_POPPED;
110  }
111 
112  // An entry is valid if it occurs before the current line in the current
113  // file.
114  bool IsValidEntry(uint32_t line) {
115  switch (m_state) {
116  case CURRENT_FILE_NOT_YET_PUSHED:
117  return true;
118  case CURRENT_FILE_PUSHED:
119  // If we are in file included in the current file, the entry should be
120  // added.
121  if (m_file_stack.back() != m_current_file)
122  return true;
123 
124  return line < m_current_file_line;
125  default:
126  return false;
127  }
128  }
129 
130 private:
131  std::vector<FileSpec> m_file_stack;
132  State m_state = CURRENT_FILE_NOT_YET_PUSHED;
133  FileSpec m_current_file;
134  uint32_t m_current_file_line;
135 };
136 
137 } // anonymous namespace
138 
139 static void AddMacros(const DebugMacros *dm, CompileUnit *comp_unit,
140  AddMacroState &state, StreamString &stream) {
141  if (dm == nullptr)
142  return;
143 
144  for (size_t i = 0; i < dm->GetNumMacroEntries(); i++) {
145  const DebugMacroEntry &entry = dm->GetMacroEntryAtIndex(i);
146  uint32_t line;
147 
148  switch (entry.GetType()) {
150  if (state.IsValidEntry(entry.GetLineNumber()))
151  stream.Printf("#define %s\n", entry.GetMacroString().AsCString());
152  else
153  return;
154  break;
156  if (state.IsValidEntry(entry.GetLineNumber()))
157  stream.Printf("#undef %s\n", entry.GetMacroString().AsCString());
158  else
159  return;
160  break;
162  line = entry.GetLineNumber();
163  if (state.IsValidEntry(line))
164  state.StartFile(entry.GetFileSpec(comp_unit));
165  else
166  return;
167  break;
169  state.EndFile();
170  break;
172  AddMacros(entry.GetIndirectDebugMacros(), comp_unit, state, stream);
173  break;
174  default:
175  // This is an unknown/invalid entry. Ignore.
176  break;
177  }
178  }
179 }
180 
182  llvm::StringRef filename, llvm::StringRef name, llvm::StringRef prefix,
183  llvm::StringRef body, Wrapping wrap, WrapKind wrap_kind)
184  : ExpressionSourceCode(name, prefix, body, wrap), m_wrap_kind(wrap_kind) {
185  // Use #line markers to pretend that we have a single-line source file
186  // containing only the user expression. This will hide our wrapper code
187  // from the user when we render diagnostics with Clang.
188  m_start_marker = "#line 1 \"" + filename.str() + "\"\n";
190 }
191 
192 namespace {
193 /// Allows checking if a token is contained in a given expression.
194 class TokenVerifier {
195  /// The tokens we found in the expression.
196  llvm::StringSet<> m_tokens;
197 
198 public:
199  TokenVerifier(std::string body);
200  /// Returns true iff the given expression body contained a token with the
201  /// given content.
202  bool hasToken(llvm::StringRef token) const {
203  return m_tokens.find(token) != m_tokens.end();
204  }
205 };
206 
207 // If we're evaluating from inside a lambda that captures a 'this' pointer,
208 // add a "using" declaration to 'stream' for each capture used in the
209 // expression (tokenized by 'verifier').
210 //
211 // If no 'this' capture exists, generate no using declarations. Instead
212 // capture lookups will get resolved by the same mechanism as class member
213 // variable lookup. That's because Clang generates an unnamed structure
214 // representing the lambda closure whose members are the captured variables.
215 void AddLambdaCaptureDecls(StreamString &stream, StackFrame *frame,
216  TokenVerifier const &verifier) {
217  assert(frame);
218 
219  if (auto thisValSP = ClangExpressionUtil::GetLambdaValueObject(frame)) {
220  uint32_t numChildren = thisValSP->GetNumChildren();
221  for (uint32_t i = 0; i < numChildren; ++i) {
222  auto childVal = thisValSP->GetChildAtIndex(i, true);
223  ConstString childName(childVal ? childVal->GetName() : ConstString(""));
224 
225  if (!childName.IsEmpty() && verifier.hasToken(childName.GetStringRef()) &&
226  childName != "this") {
227  stream.Printf("using $__lldb_local_vars::%s;\n",
228  childName.GetCString());
229  }
230  }
231  }
232 }
233 
234 } // namespace
235 
236 TokenVerifier::TokenVerifier(std::string body) {
237  using namespace clang;
238 
239  // We only care about tokens and not their original source locations. If we
240  // move the whole expression to only be in one line we can simplify the
241  // following code that extracts the token contents.
242  std::replace(body.begin(), body.end(), '\n', ' ');
243  std::replace(body.begin(), body.end(), '\r', ' ');
244 
245  FileSystemOptions file_opts;
246  FileManager file_mgr(file_opts,
247  FileSystem::Instance().GetVirtualFileSystem());
248 
249  // Let's build the actual source code Clang needs and setup some utility
250  // objects.
251  llvm::IntrusiveRefCntPtr<DiagnosticIDs> diag_ids(new DiagnosticIDs());
252  llvm::IntrusiveRefCntPtr<DiagnosticOptions> diags_opts(
253  new DiagnosticOptions());
254  DiagnosticsEngine diags(diag_ids, diags_opts);
255  clang::SourceManager SM(diags, file_mgr);
256  auto buf = llvm::MemoryBuffer::getMemBuffer(body);
257 
258  FileID FID = SM.createFileID(buf->getMemBufferRef());
259 
260  // Let's just enable the latest ObjC and C++ which should get most tokens
261  // right.
262  LangOptions Opts;
263  Opts.ObjC = true;
264  Opts.DollarIdents = true;
265  Opts.CPlusPlus17 = true;
266  Opts.LineComment = true;
267 
268  Lexer lex(FID, buf->getMemBufferRef(), SM, Opts);
269 
270  Token token;
271  bool exit = false;
272  while (!exit) {
273  // Returns true if this is the last token we get from the lexer.
274  exit = lex.LexFromRawLexer(token);
275 
276  // Extract the column number which we need to extract the token content.
277  // Our expression is just one line, so we don't need to handle any line
278  // numbers here.
279  bool invalid = false;
280  unsigned start = SM.getSpellingColumnNumber(token.getLocation(), &invalid);
281  if (invalid)
282  continue;
283  // Column numbers start at 1, but indexes in our string start at 0.
284  --start;
285 
286  // Annotations don't have a length, so let's skip them.
287  if (token.isAnnotation())
288  continue;
289 
290  // Extract the token string from our source code and store it.
291  std::string token_str = body.substr(start, token.getLength());
292  if (token_str.empty())
293  continue;
294  m_tokens.insert(token_str);
295  }
296 }
297 
299  const std::string &expr,
300  StackFrame *frame) const {
301  assert(frame);
302  TokenVerifier tokens(expr);
303 
304  lldb::VariableListSP var_list_sp = frame->GetInScopeVariableList(false, true);
305 
306  for (size_t i = 0; i < var_list_sp->GetSize(); i++) {
307  lldb::VariableSP var_sp = var_list_sp->GetVariableAtIndex(i);
308 
309  ConstString var_name = var_sp->GetName();
310 
311  if (var_name == "this" && m_wrap_kind == WrapKind::CppMemberFunction) {
312  AddLambdaCaptureDecls(stream, frame, tokens);
313 
314  continue;
315  }
316 
317  // We can check for .block_descriptor w/o checking for langauge since this
318  // is not a valid identifier in either C or C++.
319  if (!var_name || var_name == ".block_descriptor")
320  continue;
321 
322  if (!expr.empty() && !tokens.hasToken(var_name.GetStringRef()))
323  continue;
324 
325  const bool is_objc = m_wrap_kind == WrapKind::ObjCInstanceMethod ||
327  if ((var_name == "self" || var_name == "_cmd") && is_objc)
328  continue;
329 
330  stream.Printf("using $__lldb_local_vars::%s;\n", var_name.AsCString());
331  }
332 }
333 
335  std::string &text, ExecutionContext &exe_ctx, bool add_locals,
336  bool force_add_all_locals, llvm::ArrayRef<std::string> modules) const {
337  const char *target_specific_defines = "typedef signed char BOOL;\n";
338  std::string module_macros;
339  llvm::raw_string_ostream module_macros_stream(module_macros);
340 
341  Target *target = exe_ctx.GetTargetPtr();
342  if (target) {
343  if (target->GetArchitecture().GetMachine() == llvm::Triple::aarch64 ||
344  target->GetArchitecture().GetMachine() == llvm::Triple::aarch64_32) {
345  target_specific_defines = "typedef bool BOOL;\n";
346  }
347  if (target->GetArchitecture().GetMachine() == llvm::Triple::x86_64) {
348  if (lldb::PlatformSP platform_sp = target->GetPlatform()) {
349  if (platform_sp->GetPluginName() == "ios-simulator") {
350  target_specific_defines = "typedef bool BOOL;\n";
351  }
352  }
353  }
354 
355  auto *persistent_vars = llvm::cast<ClangPersistentVariables>(
357  std::shared_ptr<ClangModulesDeclVendor> decl_vendor =
358  persistent_vars->GetClangModulesDeclVendor();
359  if (decl_vendor) {
360  const ClangModulesDeclVendor::ModuleVector &hand_imported_modules =
361  persistent_vars->GetHandLoadedClangModules();
362  ClangModulesDeclVendor::ModuleVector modules_for_macros;
363 
364  for (ClangModulesDeclVendor::ModuleID module : hand_imported_modules) {
365  modules_for_macros.push_back(module);
366  }
367 
368  if (target->GetEnableAutoImportClangModules()) {
369  if (StackFrame *frame = exe_ctx.GetFramePtr()) {
370  if (Block *block = frame->GetFrameBlock()) {
371  SymbolContext sc;
372 
373  block->CalculateSymbolContext(&sc);
374 
375  if (sc.comp_unit) {
376  StreamString error_stream;
377 
378  decl_vendor->AddModulesForCompileUnit(
379  *sc.comp_unit, modules_for_macros, error_stream);
380  }
381  }
382  }
383  }
384 
385  decl_vendor->ForEachMacro(
386  modules_for_macros,
387  [&module_macros_stream](llvm::StringRef token,
388  llvm::StringRef expansion) -> bool {
389  // Check if the macro hasn't already been defined in the
390  // g_expression_prefix (which defines a few builtin macros).
391  module_macros_stream << "#ifndef " << token << "\n";
392  module_macros_stream << expansion << "\n";
393  module_macros_stream << "#endif\n";
394  return false;
395  });
396  }
397  }
398 
399  StreamString debug_macros_stream;
400  StreamString lldb_local_var_decls;
401  if (StackFrame *frame = exe_ctx.GetFramePtr()) {
402  const SymbolContext &sc = frame->GetSymbolContext(
403  lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry);
404 
405  if (sc.comp_unit && sc.line_entry.IsValid()) {
407  if (dm) {
408  AddMacroState state(sc.line_entry.file, sc.line_entry.line);
409  AddMacros(dm, sc.comp_unit, state, debug_macros_stream);
410  }
411  }
412 
413  if (add_locals)
414  if (target->GetInjectLocalVariables(&exe_ctx)) {
415  AddLocalVariableDecls(lldb_local_var_decls,
416  force_add_all_locals ? "" : m_body, frame);
417  }
418  }
419 
420  if (m_wrap) {
421  // Generate a list of @import statements that will import the specified
422  // module into our expression.
423  std::string module_imports;
424  for (const std::string &module : modules) {
425  module_imports.append("@import ");
426  module_imports.append(module);
427  module_imports.append(";\n");
428  }
429 
430  StreamString wrap_stream;
431 
432  wrap_stream.Printf("%s\n%s\n%s\n%s\n%s\n", g_expression_prefix,
433  module_macros.c_str(), debug_macros_stream.GetData(),
434  target_specific_defines, m_prefix.c_str());
435 
436  // First construct a tagged form of the user expression so we can find it
437  // later:
438  std::string tagged_body;
439  tagged_body.append(m_start_marker);
440  tagged_body.append(m_body);
441  tagged_body.append(m_end_marker);
442 
443  switch (m_wrap_kind) {
444  case WrapKind::Function:
445  wrap_stream.Printf("%s"
446  "void \n"
447  "%s(void *$__lldb_arg) \n"
448  "{ \n"
449  " %s; \n"
450  "%s"
451  "} \n",
452  module_imports.c_str(), m_name.c_str(),
453  lldb_local_var_decls.GetData(), tagged_body.c_str());
454  break;
456  wrap_stream.Printf("%s"
457  "void \n"
458  "$__lldb_class::%s(void *$__lldb_arg) \n"
459  "{ \n"
460  " %s; \n"
461  "%s"
462  "} \n",
463  module_imports.c_str(), m_name.c_str(),
464  lldb_local_var_decls.GetData(), tagged_body.c_str());
465  break;
467  wrap_stream.Printf(
468  "%s"
469  "@interface $__lldb_objc_class ($__lldb_category) \n"
470  "-(void)%s:(void *)$__lldb_arg; \n"
471  "@end \n"
472  "@implementation $__lldb_objc_class ($__lldb_category) \n"
473  "-(void)%s:(void *)$__lldb_arg \n"
474  "{ \n"
475  " %s; \n"
476  "%s"
477  "} \n"
478  "@end \n",
479  module_imports.c_str(), m_name.c_str(), m_name.c_str(),
480  lldb_local_var_decls.GetData(), tagged_body.c_str());
481  break;
482 
484  wrap_stream.Printf(
485  "%s"
486  "@interface $__lldb_objc_class ($__lldb_category) \n"
487  "+(void)%s:(void *)$__lldb_arg; \n"
488  "@end \n"
489  "@implementation $__lldb_objc_class ($__lldb_category) \n"
490  "+(void)%s:(void *)$__lldb_arg \n"
491  "{ \n"
492  " %s; \n"
493  "%s"
494  "} \n"
495  "@end \n",
496  module_imports.c_str(), m_name.c_str(), m_name.c_str(),
497  lldb_local_var_decls.GetData(), tagged_body.c_str());
498  break;
499  }
500 
501  text = std::string(wrap_stream.GetString());
502  } else {
503  text.append(m_body);
504  }
505 
506  return true;
507 }
508 
510  std::string transformed_text, size_t &start_loc, size_t &end_loc) {
511  start_loc = transformed_text.find(m_start_marker);
512  if (start_loc == std::string::npos)
513  return false;
514  start_loc += m_start_marker.size();
515  end_loc = transformed_text.find(m_end_marker);
516  return end_loc != std::string::npos;
517 }
Block.h
lldb_private::ClangExpressionSourceCode::WrapKind::ObjCInstanceMethod
@ ObjCInstanceMethod
Wrapped in an instance Objective-C method.
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
ClangExpressionSourceCode.h
lldb_private::LineEntry::file
FileSpec file
The source file, possibly mapped by the target.source-map setting.
Definition: LineEntry.h:140
lldb_private::ClangExpressionSourceCode::WrapKind::CppMemberFunction
@ CppMemberFunction
Wrapped in a non-static member function of a C++ class.
ClangModulesDeclVendor.h
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:678
CompileUnit.h
lldb_private::LineEntry::IsValid
bool IsValid() const
Check if a line entry object is valid.
Definition: LineEntry.cpp:46
lldb_private::DebugMacros
Definition: DebugMacros.h:71
lldb_private::ClangExpressionSourceCode::g_expression_suffix
static const char * g_expression_suffix
Definition: ClangExpressionSourceCode.h:30
lldb_private::ClangExpressionSourceCode::m_end_marker
std::string m_end_marker
String marking the end of the user expression.
Definition: ClangExpressionSourceCode.h:98
lldb_private::StackFrame::GetFrameBlock
Block * GetFrameBlock()
Get the current lexical scope block for this StackFrame, if possible.
Definition: StackFrame.cpp:275
lldb_private::ClangExpressionSourceCode::g_prefix_file_name
static const llvm::StringRef g_prefix_file_name
The file name we use for the wrapper code that we inject before the user expression.
Definition: ClangExpressionSourceCode.h:28
lldb_private::TargetProperties::GetInjectLocalVariables
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition: Target.cpp:4092
lldb_private::ClangExpressionSourceCode::m_start_marker
std::string m_start_marker
String marking the start of the user expression.
Definition: ClangExpressionSourceCode.h:96
lldb_private::ClangExpressionSourceCode::g_expression_prefix
static const char * g_expression_prefix
Definition: ClangExpressionSourceCode.h:29
ClangExpressionUtil.h
lldb_private::ExecutionContext::GetFramePtr
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Definition: ExecutionContext.h:408
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:192
StackFrame.h
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:440
lldb_private::ClangExpressionSourceCode::GetText
bool GetText(std::string &text, ExecutionContext &exe_ctx, bool add_locals, bool force_add_all_locals, llvm::ArrayRef< std::string > modules) const
Generates the source code that will evaluate the expression.
Definition: ClangExpressionSourceCode.cpp:334
Language.h
lldb_private::ExpressionSourceCode::m_name
std::string m_name
Definition: ExpressionSourceCode.h:38
lldb_private::DebugMacroEntry::GetIndirectDebugMacros
DebugMacros * GetIndirectDebugMacros() const
Definition: DebugMacros.h:54
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::CompileUnit
Definition: CompileUnit.h:38
lldb_private::CompileUnit::GetDebugMacros
DebugMacros * GetDebugMacros()
Definition: CompileUnit.cpp:188
Target.h
lldb_private::DebugMacros::GetMacroEntryAtIndex
DebugMacroEntry GetMacroEntryAtIndex(const size_t index) const
Definition: DebugMacros.h:83
lldb_private::Target::GetPlatform
lldb::PlatformSP GetPlatform()
Definition: Target.h:1404
lldb_private::ExpressionSourceCode::m_prefix
std::string m_prefix
Definition: ExpressionSourceCode.h:39
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:55
lldb_private::DebugMacroEntry::GetType
EntryType GetType() const
Definition: DebugMacros.h:46
AddMacros
static void AddMacros(const DebugMacros *dm, CompileUnit *comp_unit, AddMacroState &state, StreamString &stream)
Definition: ClangExpressionSourceCode.cpp:139
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:201
lldb_private::ClangModulesDeclVendor::ModuleVector
std::vector< ModuleID > ModuleVector
Definition: ClangModulesDeclVendor.h:37
lldb_private::ClangExpressionSourceCode::GetOriginalBodyBounds
bool GetOriginalBodyBounds(std::string transformed_text, size_t &start_loc, size_t &end_loc)
Definition: ClangExpressionSourceCode.cpp:509
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
StreamString.h
ClangPersistentVariables.h
lldb_private::ClangExpressionSourceCode::ClangExpressionSourceCode
ClangExpressionSourceCode(llvm::StringRef filename, llvm::StringRef name, llvm::StringRef prefix, llvm::StringRef body, Wrapping wrap, WrapKind wrap_kind)
Definition: ClangExpressionSourceCode.cpp:181
lldb_private::DebugMacroEntry
Definition: DebugMacros.h:24
lldb_private::LLDBLog::State
@ State
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::DebugMacroEntry::INDIRECT
@ INDIRECT
Definition: DebugMacros.h:27
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::ClangModulesDeclVendor::ModuleID
uintptr_t ModuleID
Definition: ClangModulesDeclVendor.h:36
lldb_private::DebugMacroEntry::START_FILE
@ START_FILE
Definition: DebugMacros.h:27
lldb_private::DebugMacroEntry::DEFINE
@ DEFINE
Definition: DebugMacros.h:27
lldb_private::Target::GetPersistentExpressionStateForLanguage
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition: Target.cpp:2370
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
TypeSystem.h
lldb_private::ClangExpressionSourceCode::WrapKind
WrapKind
The possible ways an expression can be wrapped.
Definition: ClangExpressionSourceCode.h:33
VariableList.h
lldb_private::DebugMacroEntry::GetLineNumber
uint64_t GetLineNumber() const
Definition: DebugMacros.h:48
lldb_private::LineEntry::line
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:143
lldb_private::ExpressionSourceCode::Wrapping
Wrapping
Definition: ExpressionSourceCode.h:22
lldb_private::DebugMacroEntry::END_FILE
@ END_FILE
Definition: DebugMacros.h:27
lldb_private::ExpressionSourceCode
Definition: ExpressionSourceCode.h:20
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
lldb_private::Block
Definition: Block.h:41
lldb_private::TargetProperties::GetEnableAutoImportClangModules
bool GetEnableAutoImportClangModules() const
Definition: Target.cpp:4379
uint32_t
SUFFIX_NAME
#define SUFFIX_NAME
Definition: ClangExpressionSourceCode.cpp:37
lldb_private::ClangExpressionSourceCode::AddLocalVariableDecls
void AddLocalVariableDecls(StreamString &stream, const std::string &expr, StackFrame *frame) const
Writes "using" declarations for local variables into the specified stream.
Definition: ClangExpressionSourceCode.cpp:298
lldb_private::ExpressionSourceCode::m_wrap
Wrapping m_wrap
Definition: ExpressionSourceCode.h:41
clang
Definition: ASTResultSynthesizer.h:15
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb-forward.h
lldb_private::ClangExpressionSourceCode::WrapKind::Function
@ Function
Wrapped in a non-member function.
lldb_private::FileSystem::Instance
static FileSystem & Instance()
Definition: common/FileSystem.cpp:46
lldb_private::ClangExpressionSourceCode::WrapKind::ObjCStaticMethod
@ ObjCStaticMethod
Wrapped in a static Objective-C method.
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DebugMacros::GetNumMacroEntries
size_t GetNumMacroEntries() const
Definition: DebugMacros.h:81
lldb_private::ExpressionSourceCode::m_body
std::string m_body
Definition: ExpressionSourceCode.h:40
DebugMacros.h
lldb_private::StackFrame::GetInScopeVariableList
lldb::VariableListSP GetInScopeVariableList(bool get_file_globals, bool must_have_valid_location=false)
Retrieve the list of variables that are in scope at this StackFrame's pc.
Definition: StackFrame.cpp:475
lldb_private::SymbolContext::line_entry
LineEntry line_entry
The LineEntry for a given query.
Definition: SymbolContext.h:322
lldb_private::DebugMacroEntry::UNDEF
@ UNDEF
Definition: DebugMacros.h:27
lldb_private::ClangExpressionSourceCode::m_wrap_kind
const WrapKind m_wrap_kind
How the expression has been wrapped.
Definition: ClangExpressionSourceCode.h:100
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::StackFrame::GetSymbolContext
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
Definition: StackFrame.cpp:300
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
ExecutionContext.h
PREFIX_NAME
#define PREFIX_NAME
Definition: ClangExpressionSourceCode.cpp:36
lldb_private::DebugMacroEntry::GetFileSpec
const FileSpec & GetFileSpec(CompileUnit *comp_unit) const
Definition: DebugMacros.cpp:25
lldb_private::ClangExpressionUtil::GetLambdaValueObject
lldb::ValueObjectSP GetLambdaValueObject(StackFrame *frame)
Returns a ValueObject for the lambda class in the current frame.
Definition: ClangExpressionUtil.cpp:17
lldb_private::DebugMacroEntry::GetMacroString
ConstString GetMacroString() const
Definition: DebugMacros.h:50