1 //===-- OptionValueProperties.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/Interpreter/OptionValueProperties.h" 11 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 // Project includes 16 #include "lldb/Core/Flags.h" 17 #include "lldb/Core/Stream.h" 18 #include "lldb/Core/StringList.h" 19 #include "lldb/Core/UserSettingsController.h" 20 #include "lldb/Interpreter/Args.h" 21 #include "lldb/Interpreter/OptionValues.h" 22 #include "lldb/Interpreter/Property.h" 23 24 using namespace lldb; 25 using namespace lldb_private; 26 27 28 OptionValueProperties::OptionValueProperties (const ConstString &name) : 29 OptionValue (), 30 m_name (name), 31 m_properties (), 32 m_name_to_index () 33 { 34 } 35 36 OptionValueProperties::OptionValueProperties (const OptionValueProperties &global_properties) : 37 OptionValue (global_properties), 38 std::enable_shared_from_this<OptionValueProperties> (), 39 m_name (global_properties.m_name), 40 m_properties (global_properties.m_properties), 41 m_name_to_index (global_properties.m_name_to_index) 42 { 43 // We now have an exact copy of "global_properties". We need to now 44 // find all non-global settings and copy the property values so that 45 // all non-global settings get new OptionValue instances created for 46 // them. 47 const size_t num_properties = m_properties.size(); 48 for (size_t i=0; i<num_properties; ++i) 49 { 50 // Duplicate any values that are not global when constructing properties from 51 // a global copy 52 if (m_properties[i].IsGlobal() == false) 53 { 54 lldb::OptionValueSP new_value_sp (m_properties[i].GetValue()->DeepCopy()); 55 m_properties[i].SetOptionValue(new_value_sp); 56 } 57 } 58 } 59 60 61 62 size_t 63 OptionValueProperties::GetNumProperties() const 64 { 65 return m_properties.size(); 66 } 67 68 69 void 70 OptionValueProperties::Initialize (const PropertyDefinition *defs) 71 { 72 for (size_t i=0; defs[i].name; ++i) 73 { 74 Property property(defs[i]); 75 assert(property.IsValid()); 76 m_name_to_index.Append(property.GetName().GetCString(),m_properties.size()); 77 property.GetValue()->SetParent(shared_from_this()); 78 m_properties.push_back(property); 79 } 80 m_name_to_index.Sort(); 81 } 82 83 void 84 OptionValueProperties::SetValueChangedCallback (uint32_t property_idx, 85 OptionValueChangedCallback callback, 86 void *baton) 87 { 88 Property *property = ProtectedGetPropertyAtIndex (property_idx); 89 if (property) 90 property->SetValueChangedCallback (callback, baton); 91 } 92 93 void 94 OptionValueProperties::AppendProperty(const ConstString &name, 95 const ConstString &desc, 96 bool is_global, 97 const OptionValueSP &value_sp) 98 { 99 Property property(name, desc, is_global, value_sp); 100 m_name_to_index.Append(name.GetCString(),m_properties.size()); 101 m_properties.push_back(property); 102 value_sp->SetParent (shared_from_this()); 103 m_name_to_index.Sort(); 104 } 105 106 107 108 //bool 109 //OptionValueProperties::GetQualifiedName (Stream &strm) 110 //{ 111 // bool dumped_something = false; 112 //// lldb::OptionValuePropertiesSP parent_sp(GetParent ()); 113 //// if (parent_sp) 114 //// { 115 //// parent_sp->GetQualifiedName (strm); 116 //// strm.PutChar('.'); 117 //// dumped_something = true; 118 //// } 119 // if (m_name) 120 // { 121 // strm << m_name; 122 // dumped_something = true; 123 // } 124 // return dumped_something; 125 //} 126 // 127 lldb::OptionValueSP 128 OptionValueProperties::GetValueForKey (const ExecutionContext *exe_ctx, 129 const ConstString &key, 130 bool will_modify) const 131 { 132 lldb::OptionValueSP value_sp; 133 size_t idx = m_name_to_index.Find (key.GetCString(), SIZE_MAX); 134 if (idx < m_properties.size()) 135 value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue(); 136 return value_sp; 137 } 138 139 lldb::OptionValueSP 140 OptionValueProperties::GetSubValue (const ExecutionContext *exe_ctx, 141 const char *name, 142 bool will_modify, 143 Error &error) const 144 { 145 lldb::OptionValueSP value_sp; 146 147 if (name && name[0]) 148 { 149 const char *sub_name = nullptr; 150 ConstString key; 151 size_t key_len = ::strcspn (name, ".[{"); 152 153 if (name[key_len]) 154 { 155 key.SetCStringWithLength (name, key_len); 156 sub_name = name + key_len; 157 } 158 else 159 key.SetCString (name); 160 161 value_sp = GetValueForKey (exe_ctx, key, will_modify); 162 if (sub_name && value_sp) 163 { 164 switch (sub_name[0]) 165 { 166 case '.': 167 return value_sp->GetSubValue (exe_ctx, sub_name + 1, will_modify, error); 168 169 case '{': 170 // Predicate matching for predicates like 171 // "<setting-name>{<predicate>}" 172 // strings are parsed by the current OptionValueProperties subclass 173 // to mean whatever they want to. For instance a subclass of 174 // OptionValueProperties for a lldb_private::Target might implement: 175 // "target.run-args{arch==i386}" -- only set run args if the arch is i386 176 // "target.run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the path matches 177 // "target.run-args{basename==test&&arch==x86_64}" -- only set run args if executable basename is "test" and arch is "x86_64" 178 if (sub_name[1]) 179 { 180 const char *predicate_start = sub_name + 1; 181 const char *predicate_end = strchr(predicate_start, '}'); 182 if (predicate_end) 183 { 184 std::string predicate(predicate_start, predicate_end); 185 if (PredicateMatches(exe_ctx, predicate.c_str())) 186 { 187 if (predicate_end[1]) 188 { 189 // Still more subvalue string to evaluate 190 return value_sp->GetSubValue (exe_ctx, predicate_end + 1, will_modify, error); 191 } 192 else 193 { 194 // We have a match! 195 break; 196 } 197 } 198 } 199 } 200 // Predicate didn't match or wasn't correctly formed 201 value_sp.reset(); 202 break; 203 204 case '[': 205 // Array or dictionary access for subvalues like: 206 // "[12]" -- access 12th array element 207 // "['hello']" -- dictionary access of key named hello 208 return value_sp->GetSubValue (exe_ctx, sub_name, will_modify, error); 209 210 default: 211 value_sp.reset(); 212 break; 213 } 214 } 215 } 216 return value_sp; 217 } 218 219 Error 220 OptionValueProperties::SetSubValue (const ExecutionContext *exe_ctx, 221 VarSetOperationType op, 222 const char *name, 223 const char *value) 224 { 225 Error error; 226 const bool will_modify = true; 227 lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error)); 228 if (value_sp) 229 error = value_sp->SetValueFromCString(value, op); 230 else 231 { 232 if (error.AsCString() == nullptr) 233 error.SetErrorStringWithFormat("invalid value path '%s'", name); 234 } 235 return error; 236 } 237 238 239 ConstString 240 OptionValueProperties::GetPropertyNameAtIndex (uint32_t idx) const 241 { 242 const Property *property = GetPropertyAtIndex(nullptr, false, idx); 243 if (property) 244 return property->GetName(); 245 return ConstString(); 246 247 } 248 249 const char * 250 OptionValueProperties::GetPropertyDescriptionAtIndex (uint32_t idx) const 251 { 252 const Property *property = GetPropertyAtIndex(nullptr, false, idx); 253 if (property) 254 return property->GetDescription(); 255 return nullptr; 256 } 257 258 uint32_t 259 OptionValueProperties::GetPropertyIndex (const ConstString &name) const 260 { 261 return m_name_to_index.Find (name.GetCString(), SIZE_MAX); 262 } 263 264 const Property * 265 OptionValueProperties::GetProperty (const ExecutionContext *exe_ctx, bool will_modify, const ConstString &name) const 266 { 267 return GetPropertyAtIndex (exe_ctx, will_modify, m_name_to_index.Find (name.GetCString(), SIZE_MAX)); 268 } 269 270 const Property * 271 OptionValueProperties::GetPropertyAtIndex (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const 272 { 273 return ProtectedGetPropertyAtIndex (idx); 274 } 275 276 lldb::OptionValueSP 277 OptionValueProperties::GetPropertyValueAtIndex (const ExecutionContext *exe_ctx, 278 bool will_modify, 279 uint32_t idx) const 280 { 281 const Property *setting = GetPropertyAtIndex (exe_ctx, will_modify, idx); 282 if (setting) 283 return setting->GetValue(); 284 return OptionValueSP(); 285 } 286 287 OptionValuePathMappings * 288 OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const 289 { 290 OptionValueSP value_sp(GetPropertyValueAtIndex (exe_ctx, will_modify, idx)); 291 if (value_sp) 292 return value_sp->GetAsPathMappings(); 293 return nullptr; 294 } 295 296 OptionValueFileSpecList * 297 OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpecList (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const 298 { 299 OptionValueSP value_sp(GetPropertyValueAtIndex (exe_ctx, will_modify, idx)); 300 if (value_sp) 301 return value_sp->GetAsFileSpecList(); 302 return nullptr; 303 } 304 305 OptionValueArch * 306 OptionValueProperties::GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const 307 { 308 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 309 if (property) 310 return property->GetValue()->GetAsArch(); 311 return nullptr; 312 } 313 314 bool 315 OptionValueProperties::GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const 316 { 317 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 318 if (property) 319 { 320 OptionValue *value = property->GetValue().get(); 321 if (value) 322 { 323 const OptionValueArray *array = value->GetAsArray(); 324 if (array) 325 return array->GetArgs(args); 326 else 327 { 328 const OptionValueDictionary *dict = value->GetAsDictionary(); 329 if (dict) 330 return dict->GetArgs(args); 331 } 332 } 333 } 334 return false; 335 } 336 337 bool 338 OptionValueProperties::SetPropertyAtIndexFromArgs (const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) 339 { 340 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 341 if (property) 342 { 343 OptionValue *value = property->GetValue().get(); 344 if (value) 345 { 346 OptionValueArray *array = value->GetAsArray(); 347 if (array) 348 return array->SetArgs(args, eVarSetOperationAssign).Success(); 349 else 350 { 351 OptionValueDictionary *dict = value->GetAsDictionary(); 352 if (dict) 353 return dict->SetArgs(args, eVarSetOperationAssign).Success(); 354 } 355 } 356 } 357 return false; 358 } 359 360 bool 361 OptionValueProperties::GetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool fail_value) const 362 { 363 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 364 if (property) 365 { 366 OptionValue *value = property->GetValue().get(); 367 if (value) 368 return value->GetBooleanValue(fail_value); 369 } 370 return fail_value; 371 } 372 373 bool 374 OptionValueProperties::SetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool new_value) 375 { 376 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 377 if (property) 378 { 379 OptionValue *value = property->GetValue().get(); 380 if (value) 381 { 382 value->SetBooleanValue(new_value); 383 return true; 384 } 385 } 386 return false; 387 } 388 389 OptionValueDictionary * 390 OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary (const ExecutionContext *exe_ctx, uint32_t idx) const 391 { 392 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 393 if (property) 394 return property->GetValue()->GetAsDictionary(); 395 return nullptr; 396 } 397 398 int64_t 399 OptionValueProperties::GetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const 400 { 401 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 402 if (property) 403 { 404 OptionValue *value = property->GetValue().get(); 405 if (value) 406 return value->GetEnumerationValue(fail_value); 407 } 408 return fail_value; 409 } 410 411 bool 412 OptionValueProperties::SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value) 413 { 414 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 415 if (property) 416 { 417 OptionValue *value = property->GetValue().get(); 418 if (value) 419 return value->SetEnumerationValue(new_value); 420 } 421 return false; 422 } 423 424 425 OptionValueFileSpec * 426 OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const 427 { 428 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 429 if (property) 430 { 431 OptionValue *value = property->GetValue().get(); 432 if (value) 433 return value->GetAsFileSpec(); 434 } 435 return nullptr; 436 } 437 438 439 FileSpec 440 OptionValueProperties::GetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx) const 441 { 442 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 443 if (property) 444 { 445 OptionValue *value = property->GetValue().get(); 446 if (value) 447 return value->GetFileSpecValue(); 448 } 449 return FileSpec(); 450 } 451 452 453 bool 454 OptionValueProperties::SetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx, const FileSpec &new_file_spec) 455 { 456 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 457 if (property) 458 { 459 OptionValue *value = property->GetValue().get(); 460 if (value) 461 return value->SetFileSpecValue(new_file_spec); 462 } 463 return false; 464 } 465 466 const RegularExpression * 467 OptionValueProperties::GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const 468 { 469 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 470 if (property) 471 { 472 OptionValue *value = property->GetValue().get(); 473 if (value) 474 return value->GetRegexValue(); 475 } 476 return nullptr; 477 } 478 479 OptionValueSInt64 * 480 OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64 (const ExecutionContext *exe_ctx, uint32_t idx) const 481 { 482 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 483 if (property) 484 { 485 OptionValue *value = property->GetValue().get(); 486 if (value) 487 return value->GetAsSInt64(); 488 } 489 return nullptr; 490 } 491 492 int64_t 493 OptionValueProperties::GetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const 494 { 495 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 496 if (property) 497 { 498 OptionValue *value = property->GetValue().get(); 499 if (value) 500 return value->GetSInt64Value(fail_value); 501 } 502 return fail_value; 503 } 504 505 bool 506 OptionValueProperties::SetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value) 507 { 508 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 509 if (property) 510 { 511 OptionValue *value = property->GetValue().get(); 512 if (value) 513 return value->SetSInt64Value(new_value); 514 } 515 return false; 516 } 517 518 const char * 519 OptionValueProperties::GetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *fail_value) const 520 { 521 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 522 if (property) 523 { 524 OptionValue *value = property->GetValue().get(); 525 if (value) 526 return value->GetStringValue(fail_value); 527 } 528 return fail_value; 529 } 530 531 bool 532 OptionValueProperties::SetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *new_value) 533 { 534 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 535 if (property) 536 { 537 OptionValue *value = property->GetValue().get(); 538 if (value) 539 return value->SetStringValue(new_value); 540 } 541 return false; 542 } 543 544 OptionValueString * 545 OptionValueProperties::GetPropertyAtIndexAsOptionValueString (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const 546 { 547 OptionValueSP value_sp(GetPropertyValueAtIndex (exe_ctx, will_modify, idx)); 548 if (value_sp) 549 return value_sp->GetAsString(); 550 return nullptr; 551 } 552 553 554 uint64_t 555 OptionValueProperties::GetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t fail_value) const 556 { 557 const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); 558 if (property) 559 { 560 OptionValue *value = property->GetValue().get(); 561 if (value) 562 return value->GetUInt64Value(fail_value); 563 } 564 return fail_value; 565 } 566 567 bool 568 OptionValueProperties::SetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t new_value) 569 { 570 const Property *property = GetPropertyAtIndex (exe_ctx, true, idx); 571 if (property) 572 { 573 OptionValue *value = property->GetValue().get(); 574 if (value) 575 return value->SetUInt64Value(new_value); 576 } 577 return false; 578 } 579 580 bool 581 OptionValueProperties::Clear () 582 { 583 const size_t num_properties = m_properties.size(); 584 for (size_t i=0; i<num_properties; ++i) 585 m_properties[i].GetValue()->Clear(); 586 return true; 587 } 588 589 590 Error 591 OptionValueProperties::SetValueFromCString (const char *value, VarSetOperationType op) 592 { 593 Error error; 594 595 // Args args(value_cstr); 596 // const size_t argc = args.GetArgumentCount(); 597 switch (op) 598 { 599 case eVarSetOperationClear: 600 Clear (); 601 break; 602 603 case eVarSetOperationReplace: 604 case eVarSetOperationAssign: 605 case eVarSetOperationRemove: 606 case eVarSetOperationInsertBefore: 607 case eVarSetOperationInsertAfter: 608 case eVarSetOperationAppend: 609 case eVarSetOperationInvalid: 610 error = OptionValue::SetValueFromCString (value, op); 611 break; 612 } 613 614 return error; 615 } 616 617 void 618 OptionValueProperties::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) 619 { 620 const size_t num_properties = m_properties.size(); 621 for (size_t i=0; i<num_properties; ++i) 622 { 623 const Property *property = GetPropertyAtIndex(exe_ctx, false, i); 624 if (property) 625 { 626 OptionValue *option_value = property->GetValue().get(); 627 assert (option_value); 628 const bool transparent_value = option_value->ValueIsTransparent (); 629 property->Dump (exe_ctx, 630 strm, 631 dump_mask); 632 if (!transparent_value) 633 strm.EOL(); 634 } 635 } 636 } 637 638 Error 639 OptionValueProperties::DumpPropertyValue (const ExecutionContext *exe_ctx, 640 Stream &strm, 641 const char *property_path, 642 uint32_t dump_mask) 643 { 644 Error error; 645 const bool will_modify = false; 646 lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, property_path, will_modify, error)); 647 if (value_sp) 648 { 649 if (!value_sp->ValueIsTransparent ()) 650 { 651 if (dump_mask & eDumpOptionName) 652 strm.PutCString (property_path); 653 if (dump_mask & ~eDumpOptionName) 654 strm.PutChar (' '); 655 } 656 value_sp->DumpValue (exe_ctx, strm, dump_mask); 657 } 658 return error; 659 } 660 661 lldb::OptionValueSP 662 OptionValueProperties::DeepCopy () const 663 { 664 assert(!"this shouldn't happen"); 665 return lldb::OptionValueSP(); 666 } 667 668 const Property * 669 OptionValueProperties::GetPropertyAtPath (const ExecutionContext *exe_ctx, 670 bool will_modify, 671 const char *name) const 672 { 673 const Property *property = nullptr; 674 if (name && name[0]) 675 { 676 const char *sub_name = nullptr; 677 ConstString key; 678 size_t key_len = ::strcspn (name, ".[{"); 679 680 if (name[key_len]) 681 { 682 key.SetCStringWithLength (name, key_len); 683 sub_name = name + key_len; 684 } 685 else 686 key.SetCString (name); 687 688 property = GetProperty (exe_ctx, will_modify, key); 689 if (sub_name && property) 690 { 691 if (sub_name[0] == '.') 692 { 693 OptionValueProperties *sub_properties = property->GetValue()->GetAsProperties(); 694 if (sub_properties) 695 return sub_properties->GetPropertyAtPath(exe_ctx, will_modify, sub_name + 1); 696 } 697 property = nullptr; 698 } 699 } 700 return property; 701 } 702 703 void 704 OptionValueProperties::DumpAllDescriptions (CommandInterpreter &interpreter, 705 Stream &strm) const 706 { 707 size_t max_name_len = 0; 708 const size_t num_properties = m_properties.size(); 709 for (size_t i=0; i<num_properties; ++i) 710 { 711 const Property *property = ProtectedGetPropertyAtIndex(i); 712 if (property) 713 max_name_len = std::max<size_t>(property->GetName().GetLength(), max_name_len); 714 } 715 for (size_t i=0; i<num_properties; ++i) 716 { 717 const Property *property = ProtectedGetPropertyAtIndex(i); 718 if (property) 719 property->DumpDescription (interpreter, strm, max_name_len, false); 720 } 721 } 722 723 void 724 OptionValueProperties::Apropos (const char *keyword, std::vector<const Property *> &matching_properties) const 725 { 726 const size_t num_properties = m_properties.size(); 727 StreamString strm; 728 for (size_t i=0; i<num_properties; ++i) 729 { 730 const Property *property = ProtectedGetPropertyAtIndex(i); 731 if (property) 732 { 733 const OptionValueProperties *properties = property->GetValue()->GetAsProperties(); 734 if (properties) 735 { 736 properties->Apropos (keyword, matching_properties); 737 } 738 else 739 { 740 bool match = false; 741 const char *name = property->GetName().GetCString(); 742 if (name && ::strcasestr(name, keyword)) 743 match = true; 744 else 745 { 746 const char *desc = property->GetDescription(); 747 if (desc && ::strcasestr(desc, keyword)) 748 match = true; 749 } 750 if (match) 751 { 752 matching_properties.push_back (property); 753 } 754 } 755 } 756 } 757 } 758 759 lldb::OptionValuePropertiesSP 760 OptionValueProperties::GetSubProperty (const ExecutionContext *exe_ctx, 761 const ConstString &name) 762 { 763 lldb::OptionValueSP option_value_sp(GetValueForKey(exe_ctx, name, false)); 764 if (option_value_sp) 765 { 766 OptionValueProperties *ov_properties = option_value_sp->GetAsProperties (); 767 if (ov_properties) 768 return ov_properties->shared_from_this(); 769 } 770 return lldb::OptionValuePropertiesSP(); 771 } 772 773 774 775