Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- Variable.cpp --------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "lldb/Symbol/Variable.h" |
| 11 | |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 +0000 | [diff] [blame] | 12 | #include "lldb/Core/Module.h" |
Greg Clayton | 884fb69 | 2011-07-08 21:46:14 +0000 | [diff] [blame] | 13 | #include "lldb/Core/ValueObject.h" |
| 14 | #include "lldb/Core/ValueObjectVariable.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 15 | #include "lldb/Symbol/Block.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 16 | #include "lldb/Symbol/CompileUnit.h" |
Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 17 | #include "lldb/Symbol/CompilerDecl.h" |
| 18 | #include "lldb/Symbol/CompilerDeclContext.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 19 | #include "lldb/Symbol/Function.h" |
| 20 | #include "lldb/Symbol/SymbolContext.h" |
Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 21 | #include "lldb/Symbol/SymbolFile.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 22 | #include "lldb/Symbol/Type.h" |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 23 | #include "lldb/Symbol/TypeSystem.h" |
Greg Clayton | 884fb69 | 2011-07-08 21:46:14 +0000 | [diff] [blame] | 24 | #include "lldb/Symbol/VariableList.h" |
Greg Clayton | afacd14 | 2011-09-02 01:15:17 +0000 | [diff] [blame] | 25 | #include "lldb/Target/ABI.h" |
Greg Clayton | f5e56de | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 26 | #include "lldb/Target/Process.h" |
Greg Clayton | 9da7bd0 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 27 | #include "lldb/Target/RegisterContext.h" |
Jason Molenda | b57e4a1 | 2013-11-04 09:33:30 +0000 | [diff] [blame] | 28 | #include "lldb/Target/StackFrame.h" |
Greg Clayton | f5e56de | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 29 | #include "lldb/Target/Target.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 30 | #include "lldb/Target/Thread.h" |
Zachary Turner | bf9a773 | 2017-02-02 21:39:50 +0000 | [diff] [blame] | 31 | #include "lldb/Utility/RegularExpression.h" |
| 32 | #include "lldb/Utility/Stream.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 33 | |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 34 | #include "llvm/ADT/Twine.h" |
| 35 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 36 | using namespace lldb; |
| 37 | using namespace lldb_private; |
| 38 | |
| 39 | //---------------------------------------------------------------------- |
| 40 | // Variable constructor |
| 41 | //---------------------------------------------------------------------- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 42 | Variable::Variable( |
| 43 | lldb::user_id_t uid, const char *name, |
| 44 | const char *mangled, // The mangled or fully qualified name of the variable. |
| 45 | const lldb::SymbolFileTypeSP &symfile_type_sp, ValueType scope, |
| 46 | SymbolContextScope *context, const RangeList &scope_range, |
| 47 | Declaration *decl_ptr, const DWARFExpression &location, bool external, |
| 48 | bool artificial, bool static_member) |
| 49 | : UserID(uid), m_name(name), m_mangled(ConstString(mangled)), |
| 50 | m_symfile_type_sp(symfile_type_sp), m_scope(scope), |
| 51 | m_owner_scope(context), m_scope_range(scope_range), |
| 52 | m_declaration(decl_ptr), m_location(location), m_external(external), |
| 53 | m_artificial(artificial), m_static_member(static_member) {} |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 54 | |
| 55 | //---------------------------------------------------------------------- |
| 56 | // Destructor |
| 57 | //---------------------------------------------------------------------- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 58 | Variable::~Variable() {} |
| 59 | |
| 60 | lldb::LanguageType Variable::GetLanguage() const { |
| 61 | SymbolContext variable_sc; |
| 62 | m_owner_scope->CalculateSymbolContext(&variable_sc); |
| 63 | if (variable_sc.comp_unit) |
| 64 | return variable_sc.comp_unit->GetLanguage(); |
| 65 | return lldb::eLanguageTypeUnknown; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 68 | ConstString Variable::GetName() const { |
| 69 | ConstString name = m_mangled.GetName(GetLanguage()); |
| 70 | if (name) |
| 71 | return name; |
| 72 | return m_name; |
Greg Clayton | ddaf6a7 | 2015-07-08 22:32:23 +0000 | [diff] [blame] | 73 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 74 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 75 | ConstString Variable::GetUnqualifiedName() const { return m_name; } |
Greg Clayton | ddaf6a7 | 2015-07-08 22:32:23 +0000 | [diff] [blame] | 76 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 77 | bool Variable::NameMatches(const ConstString &name) const { |
| 78 | if (m_name == name) |
| 79 | return true; |
| 80 | SymbolContext variable_sc; |
| 81 | m_owner_scope->CalculateSymbolContext(&variable_sc); |
Greg Clayton | ddaf6a7 | 2015-07-08 22:32:23 +0000 | [diff] [blame] | 82 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 83 | LanguageType language = eLanguageTypeUnknown; |
| 84 | if (variable_sc.comp_unit) |
| 85 | language = variable_sc.comp_unit->GetLanguage(); |
| 86 | return m_mangled.NameMatches(name, language); |
| 87 | } |
| 88 | bool Variable::NameMatches(const RegularExpression ®ex) const { |
| 89 | if (regex.Execute(m_name.AsCString())) |
| 90 | return true; |
| 91 | if (m_mangled) |
| 92 | return m_mangled.NameMatches(regex, GetLanguage()); |
| 93 | return false; |
Greg Clayton | 83c5cd9 | 2010-11-14 22:13:40 +0000 | [diff] [blame] | 94 | } |
| 95 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 96 | Type *Variable::GetType() { |
| 97 | if (m_symfile_type_sp) |
| 98 | return m_symfile_type_sp->GetType(); |
| 99 | return nullptr; |
Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 100 | } |
| 101 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 102 | void Variable::Dump(Stream *s, bool show_context) const { |
| 103 | s->Printf("%p: ", static_cast<const void *>(this)); |
| 104 | s->Indent(); |
| 105 | *s << "Variable" << (const UserID &)*this; |
Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 106 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 107 | if (m_name) |
| 108 | *s << ", name = \"" << m_name << "\""; |
Greg Clayton | ddaf6a7 | 2015-07-08 22:32:23 +0000 | [diff] [blame] | 109 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 110 | if (m_symfile_type_sp) { |
| 111 | Type *type = m_symfile_type_sp->GetType(); |
| 112 | if (type) { |
| 113 | *s << ", type = {" << type->GetID() << "} " << (void *)type << " ("; |
| 114 | type->DumpTypeName(s); |
| 115 | s->PutChar(')'); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 116 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 117 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 118 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 119 | if (m_scope != eValueTypeInvalid) { |
| 120 | s->PutCString(", scope = "); |
| 121 | switch (m_scope) { |
Greg Clayton | 007d5be | 2011-05-30 00:49:24 +0000 | [diff] [blame] | 122 | case eValueTypeVariableGlobal: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 123 | s->PutCString(m_external ? "global" : "static"); |
| 124 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 125 | case eValueTypeVariableArgument: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 126 | s->PutCString("parameter"); |
| 127 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 128 | case eValueTypeVariableLocal: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 129 | s->PutCString("local"); |
| 130 | break; |
| 131 | case eValueTypeVariableThreadLocal: |
| 132 | s->PutCString("thread local"); |
| 133 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 134 | default: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 135 | *s << "??? (" << m_scope << ')'; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | if (show_context && m_owner_scope != nullptr) { |
| 140 | s->PutCString(", context = ( "); |
| 141 | m_owner_scope->DumpSymbolContext(s); |
| 142 | s->PutCString(" )"); |
| 143 | } |
| 144 | |
| 145 | bool show_fullpaths = false; |
| 146 | m_declaration.Dump(s, show_fullpaths); |
| 147 | |
| 148 | if (m_location.IsValid()) { |
| 149 | s->PutCString(", location = "); |
| 150 | lldb::addr_t loclist_base_addr = LLDB_INVALID_ADDRESS; |
| 151 | if (m_location.IsLocationList()) { |
| 152 | SymbolContext variable_sc; |
| 153 | m_owner_scope->CalculateSymbolContext(&variable_sc); |
| 154 | if (variable_sc.function) |
| 155 | loclist_base_addr = variable_sc.function->GetAddressRange() |
| 156 | .GetBaseAddress() |
| 157 | .GetFileAddress(); |
| 158 | } |
| 159 | ABI *abi = nullptr; |
| 160 | if (m_owner_scope) { |
| 161 | ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); |
| 162 | if (module_sp) |
Jason Molenda | 43294c9 | 2017-06-29 02:57:03 +0000 | [diff] [blame] | 163 | abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 164 | } |
| 165 | m_location.GetDescription(s, lldb::eDescriptionLevelBrief, |
| 166 | loclist_base_addr, abi); |
| 167 | } |
| 168 | |
| 169 | if (m_external) |
| 170 | s->PutCString(", external"); |
| 171 | |
| 172 | if (m_artificial) |
| 173 | s->PutCString(", artificial"); |
| 174 | |
| 175 | s->EOL(); |
| 176 | } |
| 177 | |
| 178 | bool Variable::DumpDeclaration(Stream *s, bool show_fullpaths, |
| 179 | bool show_module) { |
| 180 | bool dumped_declaration_info = false; |
| 181 | if (m_owner_scope) { |
| 182 | SymbolContext sc; |
| 183 | m_owner_scope->CalculateSymbolContext(&sc); |
| 184 | sc.block = nullptr; |
| 185 | sc.line_entry.Clear(); |
| 186 | bool show_inlined_frames = false; |
| 187 | const bool show_function_arguments = true; |
| 188 | const bool show_function_name = true; |
| 189 | |
| 190 | dumped_declaration_info = sc.DumpStopContext( |
| 191 | s, nullptr, Address(), show_fullpaths, show_module, show_inlined_frames, |
| 192 | show_function_arguments, show_function_name); |
| 193 | |
| 194 | if (sc.function) |
| 195 | s->PutChar(':'); |
| 196 | } |
| 197 | if (m_declaration.DumpStopContext(s, false)) |
| 198 | dumped_declaration_info = true; |
| 199 | return dumped_declaration_info; |
| 200 | } |
| 201 | |
| 202 | size_t Variable::MemorySize() const { return sizeof(Variable); } |
| 203 | |
| 204 | CompilerDeclContext Variable::GetDeclContext() { |
| 205 | Type *type = GetType(); |
| 206 | if (type) |
| 207 | return type->GetSymbolFile()->GetDeclContextContainingUID(GetID()); |
| 208 | return CompilerDeclContext(); |
| 209 | } |
| 210 | |
| 211 | CompilerDecl Variable::GetDecl() { |
| 212 | Type *type = GetType(); |
| 213 | return type ? type->GetSymbolFile()->GetDeclForUID(GetID()) : CompilerDecl(); |
| 214 | } |
| 215 | |
| 216 | void Variable::CalculateSymbolContext(SymbolContext *sc) { |
| 217 | if (m_owner_scope) { |
| 218 | m_owner_scope->CalculateSymbolContext(sc); |
| 219 | sc->variable = this; |
| 220 | } else |
| 221 | sc->Clear(false); |
| 222 | } |
| 223 | |
| 224 | bool Variable::LocationIsValidForFrame(StackFrame *frame) { |
| 225 | // Is the variable is described by a single location? |
| 226 | if (!m_location.IsLocationList()) { |
| 227 | // Yes it is, the location is valid. |
| 228 | return true; |
| 229 | } |
| 230 | |
| 231 | if (frame) { |
| 232 | Function *function = |
| 233 | frame->GetSymbolContext(eSymbolContextFunction).function; |
| 234 | if (function) { |
| 235 | TargetSP target_sp(frame->CalculateTarget()); |
| 236 | |
| 237 | addr_t loclist_base_load_addr = |
| 238 | function->GetAddressRange().GetBaseAddress().GetLoadAddress( |
| 239 | target_sp.get()); |
| 240 | if (loclist_base_load_addr == LLDB_INVALID_ADDRESS) |
| 241 | return false; |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 242 | // It is a location list. We just need to tell if the location list |
| 243 | // contains the current address when converted to a load address |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 244 | return m_location.LocationListContainsAddress( |
| 245 | loclist_base_load_addr, |
| 246 | frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get())); |
| 247 | } |
| 248 | } |
| 249 | return false; |
| 250 | } |
| 251 | |
| 252 | bool Variable::LocationIsValidForAddress(const Address &address) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 253 | // Be sure to resolve the address to section offset prior to calling this |
| 254 | // function. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 255 | if (address.IsSectionOffset()) { |
| 256 | SymbolContext sc; |
| 257 | CalculateSymbolContext(&sc); |
| 258 | if (sc.module_sp == address.GetModule()) { |
| 259 | // Is the variable is described by a single location? |
| 260 | if (!m_location.IsLocationList()) { |
| 261 | // Yes it is, the location is valid. |
| 262 | return true; |
| 263 | } |
| 264 | |
| 265 | if (sc.function) { |
| 266 | addr_t loclist_base_file_addr = |
| 267 | sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); |
| 268 | if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) |
| 269 | return false; |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 270 | // It is a location list. We just need to tell if the location list |
| 271 | // contains the current address when converted to a load address |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 272 | return m_location.LocationListContainsAddress(loclist_base_file_addr, |
| 273 | address.GetFileAddress()); |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | bool Variable::IsInScope(StackFrame *frame) { |
| 281 | switch (m_scope) { |
| 282 | case eValueTypeRegister: |
| 283 | case eValueTypeRegisterSet: |
| 284 | return frame != nullptr; |
| 285 | |
| 286 | case eValueTypeConstResult: |
| 287 | case eValueTypeVariableGlobal: |
| 288 | case eValueTypeVariableStatic: |
| 289 | case eValueTypeVariableThreadLocal: |
| 290 | return true; |
| 291 | |
| 292 | case eValueTypeVariableArgument: |
| 293 | case eValueTypeVariableLocal: |
| 294 | if (frame) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 295 | // We don't have a location list, we just need to see if the block that |
| 296 | // this variable was defined in is currently |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 297 | Block *deepest_frame_block = |
| 298 | frame->GetSymbolContext(eSymbolContextBlock).block; |
| 299 | if (deepest_frame_block) { |
| 300 | SymbolContext variable_sc; |
| 301 | CalculateSymbolContext(&variable_sc); |
| 302 | |
| 303 | // Check for static or global variable defined at the compile unit |
| 304 | // level that wasn't defined in a block |
| 305 | if (variable_sc.block == nullptr) |
| 306 | return true; |
| 307 | |
| 308 | // Check if the variable is valid in the current block |
| 309 | if (variable_sc.block != deepest_frame_block && |
| 310 | !variable_sc.block->Contains(deepest_frame_block)) |
| 311 | return false; |
| 312 | |
| 313 | // If no scope range is specified then it means that the scope is the |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 314 | // same as the scope of the enclosing lexical block. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 315 | if (m_scope_range.IsEmpty()) |
| 316 | return true; |
| 317 | |
| 318 | addr_t file_address = frame->GetFrameCodeAddress().GetFileAddress(); |
| 319 | return m_scope_range.FindEntryThatContains(file_address) != nullptr; |
| 320 | } |
| 321 | } |
| 322 | break; |
| 323 | |
| 324 | default: |
| 325 | break; |
| 326 | } |
| 327 | return false; |
| 328 | } |
| 329 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 330 | Status Variable::GetValuesForVariableExpressionPath( |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 331 | llvm::StringRef variable_expr_path, ExecutionContextScope *scope, |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 332 | GetVariableCallback callback, void *baton, VariableList &variable_list, |
| 333 | ValueObjectList &valobj_list) { |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 334 | Status error; |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 335 | if (!callback || variable_expr_path.empty()) { |
| 336 | error.SetErrorString("unknown error"); |
| 337 | return error; |
| 338 | } |
| 339 | |
| 340 | switch (variable_expr_path.front()) { |
| 341 | case '*': |
| 342 | error = Variable::GetValuesForVariableExpressionPath( |
| 343 | variable_expr_path.drop_front(), scope, callback, baton, variable_list, |
| 344 | valobj_list); |
| 345 | if (error.Fail()) { |
| 346 | error.SetErrorString("unknown error"); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 347 | return error; |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 348 | } |
| 349 | for (uint32_t i = 0; i < valobj_list.GetSize();) { |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 350 | Status tmp_error; |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 351 | ValueObjectSP valobj_sp( |
| 352 | valobj_list.GetValueObjectAtIndex(i)->Dereference(tmp_error)); |
| 353 | if (tmp_error.Fail()) { |
| 354 | variable_list.RemoveVariableAtIndex(i); |
| 355 | valobj_list.RemoveValueObjectAtIndex(i); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 356 | } else { |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 357 | valobj_list.SetValueObjectAtIndex(i, valobj_sp); |
| 358 | ++i; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 359 | } |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 360 | } |
| 361 | return error; |
| 362 | case '&': { |
| 363 | error = Variable::GetValuesForVariableExpressionPath( |
| 364 | variable_expr_path.drop_front(), scope, callback, baton, variable_list, |
| 365 | valobj_list); |
| 366 | if (error.Success()) { |
| 367 | for (uint32_t i = 0; i < valobj_list.GetSize();) { |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 368 | Status tmp_error; |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 369 | ValueObjectSP valobj_sp( |
| 370 | valobj_list.GetValueObjectAtIndex(i)->AddressOf(tmp_error)); |
| 371 | if (tmp_error.Fail()) { |
| 372 | variable_list.RemoveVariableAtIndex(i); |
| 373 | valobj_list.RemoveValueObjectAtIndex(i); |
| 374 | } else { |
| 375 | valobj_list.SetValueObjectAtIndex(i, valobj_sp); |
| 376 | ++i; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 377 | } |
| 378 | } |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 379 | } else { |
| 380 | error.SetErrorString("unknown error"); |
| 381 | } |
| 382 | return error; |
| 383 | } break; |
| 384 | |
| 385 | default: { |
| 386 | static RegularExpression g_regex( |
| 387 | llvm::StringRef("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)")); |
| 388 | RegularExpression::Match regex_match(1); |
| 389 | std::string variable_name; |
| 390 | variable_list.Clear(); |
| 391 | if (!g_regex.Execute(variable_expr_path, ®ex_match)) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 392 | error.SetErrorStringWithFormat( |
Zachary Turner | 72f4997c | 2016-11-19 00:50:29 +0000 | [diff] [blame] | 393 | "unable to extract a variable name from '%s'", |
| 394 | variable_expr_path.str().c_str()); |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 395 | return error; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 396 | } |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 397 | if (!regex_match.GetMatchAtIndex(variable_expr_path, 1, variable_name)) { |
| 398 | error.SetErrorStringWithFormat( |
Zachary Turner | 72f4997c | 2016-11-19 00:50:29 +0000 | [diff] [blame] | 399 | "unable to extract a variable name from '%s'", |
| 400 | variable_expr_path.str().c_str()); |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 401 | return error; |
| 402 | } |
| 403 | if (!callback(baton, variable_name.c_str(), variable_list)) { |
| 404 | error.SetErrorString("unknown error"); |
| 405 | return error; |
| 406 | } |
| 407 | uint32_t i = 0; |
| 408 | while (i < variable_list.GetSize()) { |
| 409 | VariableSP var_sp(variable_list.GetVariableAtIndex(i)); |
| 410 | ValueObjectSP valobj_sp; |
| 411 | if (!var_sp) { |
| 412 | variable_list.RemoveVariableAtIndex(i); |
| 413 | continue; |
| 414 | } |
| 415 | ValueObjectSP variable_valobj_sp( |
| 416 | ValueObjectVariable::Create(scope, var_sp)); |
| 417 | if (!variable_valobj_sp) { |
| 418 | variable_list.RemoveVariableAtIndex(i); |
| 419 | continue; |
| 420 | } |
| 421 | |
| 422 | llvm::StringRef variable_sub_expr_path = |
| 423 | variable_expr_path.drop_front(variable_name.size()); |
| 424 | if (!variable_sub_expr_path.empty()) { |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 425 | valobj_sp = variable_valobj_sp->GetValueForExpressionPath( |
Pavel Labath | 62ef185 | 2017-12-07 10:38:22 +0000 | [diff] [blame] | 426 | variable_sub_expr_path); |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 427 | if (!valobj_sp) { |
| 428 | error.SetErrorStringWithFormat( |
| 429 | "invalid expression path '%s' for variable '%s'", |
Zachary Turner | 72f4997c | 2016-11-19 00:50:29 +0000 | [diff] [blame] | 430 | variable_sub_expr_path.str().c_str(), |
| 431 | var_sp->GetName().GetCString()); |
Zachary Turner | 2a3d10a | 2016-11-18 19:23:39 +0000 | [diff] [blame] | 432 | variable_list.RemoveVariableAtIndex(i); |
| 433 | continue; |
| 434 | } |
| 435 | } else { |
| 436 | // Just the name of a variable with no extras |
| 437 | valobj_sp = variable_valobj_sp; |
| 438 | } |
| 439 | |
| 440 | valobj_list.Append(valobj_sp); |
| 441 | ++i; |
| 442 | } |
| 443 | |
| 444 | if (variable_list.GetSize() > 0) { |
| 445 | error.Clear(); |
| 446 | return error; |
| 447 | } |
| 448 | } break; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 449 | } |
| 450 | error.SetErrorString("unknown error"); |
| 451 | return error; |
| 452 | } |
| 453 | |
| 454 | bool Variable::DumpLocationForAddress(Stream *s, const Address &address) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 455 | // Be sure to resolve the address to section offset prior to calling this |
| 456 | // function. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 457 | if (address.IsSectionOffset()) { |
| 458 | SymbolContext sc; |
| 459 | CalculateSymbolContext(&sc); |
| 460 | if (sc.module_sp == address.GetModule()) { |
| 461 | ABI *abi = nullptr; |
| 462 | if (m_owner_scope) { |
| 463 | ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); |
| 464 | if (module_sp) |
Jason Molenda | 43294c9 | 2017-06-29 02:57:03 +0000 | [diff] [blame] | 465 | abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | const addr_t file_addr = address.GetFileAddress(); |
| 469 | if (sc.function) { |
| 470 | if (sc.function->GetAddressRange().ContainsFileAddress(address)) { |
| 471 | addr_t loclist_base_file_addr = |
| 472 | sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); |
| 473 | if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) |
| 474 | return false; |
| 475 | return m_location.DumpLocationForAddress(s, eDescriptionLevelBrief, |
| 476 | loclist_base_file_addr, |
| 477 | file_addr, abi); |
| 478 | } |
| 479 | } |
| 480 | return m_location.DumpLocationForAddress( |
| 481 | s, eDescriptionLevelBrief, LLDB_INVALID_ADDRESS, file_addr, abi); |
| 482 | } |
| 483 | } |
| 484 | return false; |
| 485 | } |
| 486 | |
| 487 | static void PrivateAutoComplete( |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 488 | StackFrame *frame, llvm::StringRef partial_path, |
| 489 | const llvm::Twine |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 490 | &prefix_path, // Anything that has been resolved already will be in here |
| 491 | const CompilerType &compiler_type, |
| 492 | StringList &matches, bool &word_complete); |
| 493 | |
| 494 | static void PrivateAutoCompleteMembers( |
| 495 | StackFrame *frame, const std::string &partial_member_name, |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 496 | llvm::StringRef partial_path, |
| 497 | const llvm::Twine |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 498 | &prefix_path, // Anything that has been resolved already will be in here |
| 499 | const CompilerType &compiler_type, |
| 500 | StringList &matches, bool &word_complete); |
| 501 | |
| 502 | static void PrivateAutoCompleteMembers( |
| 503 | StackFrame *frame, const std::string &partial_member_name, |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 504 | llvm::StringRef partial_path, |
| 505 | const llvm::Twine |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 506 | &prefix_path, // Anything that has been resolved already will be in here |
| 507 | const CompilerType &compiler_type, |
| 508 | StringList &matches, bool &word_complete) { |
| 509 | |
| 510 | // We are in a type parsing child members |
| 511 | const uint32_t num_bases = compiler_type.GetNumDirectBaseClasses(); |
| 512 | |
| 513 | if (num_bases > 0) { |
| 514 | for (uint32_t i = 0; i < num_bases; ++i) { |
| 515 | CompilerType base_class_type = |
| 516 | compiler_type.GetDirectBaseClassAtIndex(i, nullptr); |
| 517 | |
| 518 | PrivateAutoCompleteMembers( |
| 519 | frame, partial_member_name, partial_path, prefix_path, |
| 520 | base_class_type.GetCanonicalType(), matches, word_complete); |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | const uint32_t num_vbases = compiler_type.GetNumVirtualBaseClasses(); |
| 525 | |
| 526 | if (num_vbases > 0) { |
| 527 | for (uint32_t i = 0; i < num_vbases; ++i) { |
| 528 | CompilerType vbase_class_type = |
| 529 | compiler_type.GetVirtualBaseClassAtIndex(i, nullptr); |
| 530 | |
| 531 | PrivateAutoCompleteMembers( |
| 532 | frame, partial_member_name, partial_path, prefix_path, |
| 533 | vbase_class_type.GetCanonicalType(), matches, word_complete); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | // We are in a type parsing child members |
| 538 | const uint32_t num_fields = compiler_type.GetNumFields(); |
| 539 | |
| 540 | if (num_fields > 0) { |
| 541 | for (uint32_t i = 0; i < num_fields; ++i) { |
| 542 | std::string member_name; |
| 543 | |
| 544 | CompilerType member_compiler_type = compiler_type.GetFieldAtIndex( |
| 545 | i, member_name, nullptr, nullptr, nullptr); |
| 546 | |
| 547 | if (partial_member_name.empty() || |
| 548 | member_name.find(partial_member_name) == 0) { |
| 549 | if (member_name == partial_member_name) { |
| 550 | PrivateAutoComplete( |
| 551 | frame, partial_path, |
| 552 | prefix_path + member_name, // Anything that has been resolved |
| 553 | // already will be in here |
| 554 | member_compiler_type.GetCanonicalType(), matches, word_complete); |
| 555 | } else { |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 556 | matches.AppendString((prefix_path + member_name).str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 557 | } |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | static void PrivateAutoComplete( |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 564 | StackFrame *frame, llvm::StringRef partial_path, |
| 565 | const llvm::Twine |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 566 | &prefix_path, // Anything that has been resolved already will be in here |
| 567 | const CompilerType &compiler_type, |
| 568 | StringList &matches, bool &word_complete) { |
| 569 | // printf ("\nPrivateAutoComplete()\n\tprefix_path = '%s'\n\tpartial_path = |
| 570 | // '%s'\n", prefix_path.c_str(), partial_path.c_str()); |
| 571 | std::string remaining_partial_path; |
| 572 | |
| 573 | const lldb::TypeClass type_class = compiler_type.GetTypeClass(); |
| 574 | if (partial_path.empty()) { |
| 575 | if (compiler_type.IsValid()) { |
| 576 | switch (type_class) { |
| 577 | default: |
| 578 | case eTypeClassArray: |
| 579 | case eTypeClassBlockPointer: |
| 580 | case eTypeClassBuiltin: |
| 581 | case eTypeClassComplexFloat: |
| 582 | case eTypeClassComplexInteger: |
| 583 | case eTypeClassEnumeration: |
| 584 | case eTypeClassFunction: |
| 585 | case eTypeClassMemberPointer: |
| 586 | case eTypeClassReference: |
| 587 | case eTypeClassTypedef: |
| 588 | case eTypeClassVector: { |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 589 | matches.AppendString(prefix_path.str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 590 | word_complete = matches.GetSize() == 1; |
| 591 | } break; |
| 592 | |
| 593 | case eTypeClassClass: |
| 594 | case eTypeClassStruct: |
| 595 | case eTypeClassUnion: |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 596 | if (prefix_path.str().back() != '.') |
| 597 | matches.AppendString((prefix_path + ".").str()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 598 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 599 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 600 | case eTypeClassObjCObject: |
| 601 | case eTypeClassObjCInterface: |
| 602 | break; |
| 603 | case eTypeClassObjCObjectPointer: |
| 604 | case eTypeClassPointer: { |
| 605 | bool omit_empty_base_classes = true; |
| 606 | if (compiler_type.GetNumChildren(omit_empty_base_classes) > 0) |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 607 | matches.AppendString((prefix_path + "->").str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 608 | else { |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 609 | matches.AppendString(prefix_path.str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 610 | word_complete = true; |
| 611 | } |
| 612 | } break; |
| 613 | } |
| 614 | } else { |
| 615 | if (frame) { |
| 616 | const bool get_file_globals = true; |
| 617 | |
| 618 | VariableList *variable_list = frame->GetVariableList(get_file_globals); |
| 619 | |
| 620 | if (variable_list) { |
| 621 | const size_t num_variables = variable_list->GetSize(); |
| 622 | for (size_t i = 0; i < num_variables; ++i) { |
| 623 | Variable *variable = variable_list->GetVariableAtIndex(i).get(); |
| 624 | matches.AppendString(variable->GetName().AsCString()); |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | } else { |
| 630 | const char ch = partial_path[0]; |
| 631 | switch (ch) { |
| 632 | case '*': |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 633 | if (prefix_path.str().empty()) { |
| 634 | PrivateAutoComplete(frame, partial_path.substr(1), "*", compiler_type, |
| 635 | matches, word_complete); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 636 | } |
| 637 | break; |
| 638 | |
| 639 | case '&': |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 640 | if (prefix_path.isTriviallyEmpty()) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 641 | PrivateAutoComplete(frame, partial_path.substr(1), std::string("&"), |
| 642 | compiler_type, matches, word_complete); |
| 643 | } |
| 644 | break; |
| 645 | |
| 646 | case '-': |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 647 | if (partial_path[1] == '>' && !prefix_path.str().empty()) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 648 | switch (type_class) { |
| 649 | case lldb::eTypeClassPointer: { |
| 650 | CompilerType pointee_type(compiler_type.GetPointeeType()); |
| 651 | if (partial_path[2]) { |
| 652 | // If there is more after the "->", then search deeper |
| 653 | PrivateAutoComplete( |
| 654 | frame, partial_path.substr(2), prefix_path + "->", |
| 655 | pointee_type.GetCanonicalType(), matches, word_complete); |
| 656 | } else { |
| 657 | // Nothing after the "->", so list all members |
| 658 | PrivateAutoCompleteMembers( |
| 659 | frame, std::string(), std::string(), prefix_path + "->", |
| 660 | pointee_type.GetCanonicalType(), matches, word_complete); |
| 661 | } |
| 662 | } break; |
Greg Clayton | 884fb69 | 2011-07-08 21:46:14 +0000 | [diff] [blame] | 663 | default: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 664 | break; |
Greg Clayton | 884fb69 | 2011-07-08 21:46:14 +0000 | [diff] [blame] | 665 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 666 | } |
| 667 | break; |
Greg Clayton | 884fb69 | 2011-07-08 21:46:14 +0000 | [diff] [blame] | 668 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 669 | case '.': |
| 670 | if (compiler_type.IsValid()) { |
| 671 | switch (type_class) { |
| 672 | case lldb::eTypeClassUnion: |
| 673 | case lldb::eTypeClassStruct: |
| 674 | case lldb::eTypeClassClass: |
| 675 | if (partial_path[1]) { |
| 676 | // If there is more after the ".", then search deeper |
| 677 | PrivateAutoComplete(frame, partial_path.substr(1), |
| 678 | prefix_path + ".", compiler_type, matches, |
| 679 | word_complete); |
Greg Clayton | afacd14 | 2011-09-02 01:15:17 +0000 | [diff] [blame] | 680 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 681 | } else { |
| 682 | // Nothing after the ".", so list all members |
| 683 | PrivateAutoCompleteMembers(frame, std::string(), partial_path, |
| 684 | prefix_path + ".", compiler_type, |
| 685 | matches, word_complete); |
| 686 | } |
| 687 | break; |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 688 | default: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 689 | break; |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 690 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 691 | } |
| 692 | break; |
| 693 | default: |
| 694 | if (isalpha(ch) || ch == '_' || ch == '$') { |
| 695 | const size_t partial_path_len = partial_path.size(); |
| 696 | size_t pos = 1; |
| 697 | while (pos < partial_path_len) { |
| 698 | const char curr_ch = partial_path[pos]; |
| 699 | if (isalnum(curr_ch) || curr_ch == '_' || curr_ch == '$') { |
| 700 | ++pos; |
| 701 | continue; |
| 702 | } |
| 703 | break; |
| 704 | } |
| 705 | |
| 706 | std::string token(partial_path, 0, pos); |
| 707 | remaining_partial_path = partial_path.substr(pos); |
| 708 | |
| 709 | if (compiler_type.IsValid()) { |
| 710 | PrivateAutoCompleteMembers(frame, token, remaining_partial_path, |
| 711 | prefix_path, compiler_type, matches, |
| 712 | word_complete); |
| 713 | } else if (frame) { |
| 714 | // We haven't found our variable yet |
| 715 | const bool get_file_globals = true; |
| 716 | |
| 717 | VariableList *variable_list = |
| 718 | frame->GetVariableList(get_file_globals); |
| 719 | |
| 720 | if (!variable_list) |
| 721 | break; |
| 722 | |
| 723 | const size_t num_variables = variable_list->GetSize(); |
| 724 | for (size_t i = 0; i < num_variables; ++i) { |
| 725 | Variable *variable = variable_list->GetVariableAtIndex(i).get(); |
| 726 | |
| 727 | if (!variable) |
| 728 | continue; |
| 729 | |
| 730 | const char *variable_name = variable->GetName().AsCString(); |
| 731 | if (strstr(variable_name, token.c_str()) == variable_name) { |
| 732 | if (strcmp(variable_name, token.c_str()) == 0) { |
| 733 | Type *variable_type = variable->GetType(); |
| 734 | if (variable_type) { |
| 735 | CompilerType variable_compiler_type( |
| 736 | variable_type->GetForwardCompilerType()); |
| 737 | PrivateAutoComplete( |
| 738 | frame, remaining_partial_path, |
| 739 | prefix_path + token, // Anything that has been resolved |
| 740 | // already will be in here |
| 741 | variable_compiler_type.GetCanonicalType(), matches, |
| 742 | word_complete); |
| 743 | } else { |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 744 | matches.AppendString((prefix_path + variable_name).str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 745 | } |
| 746 | } else if (remaining_partial_path.empty()) { |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 747 | matches.AppendString((prefix_path + variable_name).str()); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 748 | } |
| 749 | } |
| 750 | } |
| 751 | } |
| 752 | } |
| 753 | break; |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 754 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 755 | } |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 756 | } |
| 757 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 758 | size_t Variable::AutoComplete(const ExecutionContext &exe_ctx, |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 759 | llvm::StringRef partial_path, StringList &matches, |
| 760 | bool &word_complete) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 761 | word_complete = false; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 762 | CompilerType compiler_type; |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 763 | |
Zachary Turner | 4aa8753 | 2016-11-17 01:37:42 +0000 | [diff] [blame] | 764 | PrivateAutoComplete(exe_ctx.GetFramePtr(), partial_path, "", compiler_type, |
| 765 | matches, word_complete); |
Greg Clayton | f21fead | 2013-05-14 23:43:18 +0000 | [diff] [blame] | 766 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 767 | return matches.GetSize(); |
Greg Clayton | c749eb8 | 2011-07-11 05:12:02 +0000 | [diff] [blame] | 768 | } |