ValueObject.h revision f669850b51f3898020cbae8fdfd17faf4f18ba02
1//===-- ValueObject.h -------------------------------------------*- 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#ifndef liblldb_ValueObject_h_ 11#define liblldb_ValueObject_h_ 12 13// C Includes 14// C++ Includes 15#include <map> 16#include <vector> 17// Other libraries and framework includes 18// Project includes 19 20#include "lldb/lldb-private.h" 21#include "lldb/Core/DataExtractor.h" 22#include "lldb/Core/Error.h" 23#include "lldb/Core/Flags.h" 24#include "lldb/Core/ConstString.h" 25#include "lldb/Core/UserID.h" 26#include "lldb/Core/Value.h" 27#include "lldb/Target/ExecutionContext.h" 28#include "lldb/Target/ExecutionContextScope.h" 29#include "lldb/Target/StackID.h" 30#include "lldb/Utility/PriorityPointerPair.h" 31#include "lldb/Utility/SharedCluster.h" 32 33namespace lldb_private { 34 35/// ValueObject: 36/// 37/// This abstract class provides an interface to a particular value, be it a register, a local or global variable, 38/// that is evaluated in some particular scope. The ValueObject also has the capibility of being the "child" of 39/// some other variable object, and in turn of having children. 40/// If a ValueObject is a root variable object - having no parent - then it must be constructed with respect to some 41/// particular ExecutionContextScope. If it is a child, it inherits the ExecutionContextScope from its parent. 42/// The ValueObject will update itself if necessary before fetching its value, summary, object description, etc. 43/// But it will always update itself in the ExecutionContextScope with which it was originally created. 44 45/// A brief note on life cycle management for ValueObjects. This is a little tricky because a ValueObject can contain 46/// various other ValueObjects - the Dynamic Value, its children, the dereference value, etc. Any one of these can be 47/// handed out as a shared pointer, but for that contained value object to be valid, the root object and potentially other 48/// of the value objects need to stay around. 49/// We solve this problem by handing out shared pointers to the Value Object and any of its dependents using a shared 50/// ClusterManager. This treats each shared pointer handed out for the entire cluster as a reference to the whole 51/// cluster. The whole cluster will stay around until the last reference is released. 52/// 53/// The ValueObject mostly handle this automatically, if a value object is made with a Parent ValueObject, then it adds 54/// itself to the ClusterManager of the parent. 55 56/// It does mean that external to the ValueObjects we should only ever make available ValueObjectSP's, never ValueObjects 57/// or pointers to them. So all the "Root level" ValueObject derived constructors should be private, and 58/// should implement a Create function that new's up object and returns a Shared Pointer that it gets from the GetSP() method. 59/// 60/// However, if you are making an derived ValueObject that will be contained in a parent value object, you should just 61/// hold onto a pointer to it internally, and by virtue of passing the parent ValueObject into its constructor, it will 62/// be added to the ClusterManager for the parent. Then if you ever hand out a Shared Pointer to the contained ValueObject, 63/// just do so by calling GetSP() on the contained object. 64 65class ValueObject : public UserID 66{ 67public: 68 69 enum GetExpressionPathFormat 70 { 71 eDereferencePointers = 1, 72 eHonorPointers 73 }; 74 75 enum ValueObjectRepresentationStyle 76 { 77 eDisplayValue = 1, 78 eDisplaySummary, 79 eDisplayLanguageSpecific, 80 eDisplayLocation, 81 eDisplayChildrenCount, 82 }; 83 84 enum ExpressionPathScanEndReason 85 { 86 eEndOfString = 1, // out of data to parse 87 eNoSuchChild, // child element not found 88 eEmptyRangeNotAllowed, // [] only allowed for arrays 89 eDotInsteadOfArrow, // . used when -> should be used 90 eArrowInsteadOfDot, // -> used when . should be used 91 eFragileIVarNotAllowed, // ObjC ivar expansion not allowed 92 eRangeOperatorNotAllowed, // [] not allowed by options 93 eRangeOperatorInvalid, // [] not valid on objects other than scalars, pointers or arrays 94 eArrayRangeOperatorMet, // [] is good for arrays, but I cannot parse it 95 eBitfieldRangeOperatorMet, // [] is good for bitfields, but I cannot parse after it 96 eUnexpectedSymbol, // something is malformed in the expression 97 eTakingAddressFailed, // impossible to apply & operator 98 eDereferencingFailed, // impossible to apply * operator 99 eRangeOperatorExpanded, // [] was expanded into a VOList 100 eUnknown = 0xFFFF 101 }; 102 103 enum ExpressionPathEndResultType 104 { 105 ePlain = 1, // anything but... 106 eBitfield, // a bitfield 107 eBoundedRange, // a range [low-high] 108 eUnboundedRange, // a range [] 109 eValueObjectList, // several items in a VOList 110 eInvalid = 0xFFFF 111 }; 112 113 enum ExpressionPathAftermath 114 { 115 eNothing = 1, // just return it 116 eDereference, // dereference the target 117 eTakeAddress // take target's address 118 }; 119 120 struct GetValueForExpressionPathOptions 121 { 122 bool m_check_dot_vs_arrow_syntax; 123 bool m_no_fragile_ivar; 124 bool m_allow_bitfields_syntax; 125 bool m_no_synthetic_children; 126 127 GetValueForExpressionPathOptions(bool dot = false, 128 bool no_ivar = false, 129 bool bitfield = true, 130 bool no_synth = false) : 131 m_check_dot_vs_arrow_syntax(dot), 132 m_no_fragile_ivar(no_ivar), 133 m_allow_bitfields_syntax(bitfield), 134 m_no_synthetic_children(no_synth) 135 { 136 } 137 138 GetValueForExpressionPathOptions& 139 DoCheckDotVsArrowSyntax() 140 { 141 m_check_dot_vs_arrow_syntax = true; 142 return *this; 143 } 144 145 GetValueForExpressionPathOptions& 146 DontCheckDotVsArrowSyntax() 147 { 148 m_check_dot_vs_arrow_syntax = false; 149 return *this; 150 } 151 152 GetValueForExpressionPathOptions& 153 DoAllowFragileIVar() 154 { 155 m_no_fragile_ivar = false; 156 return *this; 157 } 158 159 GetValueForExpressionPathOptions& 160 DontAllowFragileIVar() 161 { 162 m_no_fragile_ivar = true; 163 return *this; 164 } 165 166 GetValueForExpressionPathOptions& 167 DoAllowBitfieldSyntax() 168 { 169 m_allow_bitfields_syntax = true; 170 return *this; 171 } 172 173 GetValueForExpressionPathOptions& 174 DontAllowBitfieldSyntax() 175 { 176 m_allow_bitfields_syntax = false; 177 return *this; 178 } 179 180 GetValueForExpressionPathOptions& 181 DoAllowSyntheticChildren() 182 { 183 m_no_synthetic_children = false; 184 return *this; 185 } 186 187 GetValueForExpressionPathOptions& 188 DontAllowSyntheticChildren() 189 { 190 m_no_synthetic_children = true; 191 return *this; 192 } 193 194 static const GetValueForExpressionPathOptions 195 DefaultOptions() 196 { 197 static GetValueForExpressionPathOptions g_default_options; 198 199 return g_default_options; 200 } 201 202 }; 203 204 class EvaluationPoint 205 { 206 public: 207 208 EvaluationPoint (); 209 210 EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected = false); 211 212 EvaluationPoint (const EvaluationPoint &rhs); 213 214 ~EvaluationPoint (); 215 216 ExecutionContextScope * 217 GetExecutionContextScope (); 218 219 lldb::TargetSP 220 GetTargetSP () const 221 { 222 return m_target_sp; 223 } 224 225 lldb::ProcessSP 226 GetProcessSP () const 227 { 228 return m_process_sp; 229 } 230 231 // Set the EvaluationPoint to the values in exe_scope, 232 // Return true if the Evaluation Point changed. 233 // Since the ExecutionContextScope is always going to be valid currently, 234 // the Updated Context will also always be valid. 235 236 bool 237 SetContext (ExecutionContextScope *exe_scope); 238 239 void 240 SetIsConstant () 241 { 242 SetUpdated(); 243 m_stop_id = LLDB_INVALID_UID; 244 } 245 246 bool 247 IsConstant () const 248 { 249 return m_stop_id == LLDB_INVALID_UID; 250 } 251 252 lldb::user_id_t 253 GetUpdateID () const 254 { 255 return m_stop_id; 256 } 257 258 void 259 SetUpdateID (lldb::user_id_t new_id) 260 { 261 m_stop_id = new_id; 262 } 263 264 bool 265 IsFirstEvaluation () const 266 { 267 return m_first_update; 268 } 269 270 void 271 SetNeedsUpdate () 272 { 273 m_needs_update = true; 274 } 275 276 void 277 SetUpdated (); 278 279 bool 280 NeedsUpdating() 281 { 282 SyncWithProcessState(); 283 return m_needs_update; 284 } 285 286 bool 287 IsValid () 288 { 289 if (m_stop_id == LLDB_INVALID_UID) 290 return false; 291 else if (SyncWithProcessState ()) 292 { 293 if (m_stop_id == LLDB_INVALID_UID) 294 return false; 295 } 296 return true; 297 } 298 299 void 300 SetInvalid () 301 { 302 // Use the stop id to mark us as invalid, leave the thread id and the stack id around for logging and 303 // history purposes. 304 m_stop_id = LLDB_INVALID_UID; 305 306 // Can't update an invalid state. 307 m_needs_update = false; 308 309// m_thread_id = LLDB_INVALID_THREAD_ID; 310// m_stack_id.Clear(); 311 } 312 313 private: 314 bool 315 SyncWithProcessState (); 316 317 ExecutionContextScope *m_exe_scope; // This is not the way to store the evaluation point state, it is just 318 // a cache of the lookup, and gets thrown away when we update. 319 bool m_needs_update; 320 bool m_first_update; 321 322 lldb::TargetSP m_target_sp; 323 lldb::ProcessSP m_process_sp; 324 lldb::user_id_t m_thread_id; 325 StackID m_stack_id; 326 lldb::user_id_t m_stop_id; // This is the stop id when this ValueObject was last evaluated. 327 }; 328 329 const EvaluationPoint & 330 GetUpdatePoint () const 331 { 332 return m_update_point; 333 } 334 335 EvaluationPoint & 336 GetUpdatePoint () 337 { 338 return m_update_point; 339 } 340 341 ExecutionContextScope * 342 GetExecutionContextScope () 343 { 344 return m_update_point.GetExecutionContextScope(); 345 } 346 347 virtual ~ValueObject(); 348 349 //------------------------------------------------------------------ 350 // Sublasses must implement the functions below. 351 //------------------------------------------------------------------ 352 virtual size_t 353 GetByteSize() = 0; 354 355 virtual clang::ASTContext * 356 GetClangAST () = 0; 357 358 virtual lldb::clang_type_t 359 GetClangType () = 0; 360 361 virtual lldb::ValueType 362 GetValueType() const = 0; 363 364 virtual ConstString 365 GetTypeName() = 0; 366 367 virtual lldb::LanguageType 368 GetObjectRuntimeLanguage(); 369 370 virtual bool 371 IsPointerType (); 372 373 virtual bool 374 IsArrayType (); 375 376 virtual bool 377 IsScalarType (); 378 379 virtual bool 380 IsPointerOrReferenceType (); 381 382 virtual bool 383 IsPossibleCPlusPlusDynamicType (); 384 385 virtual bool 386 IsPossibleDynamicType (); 387 388 virtual bool 389 IsBaseClass () 390 { 391 return false; 392 } 393 394 virtual bool 395 IsDereferenceOfParent () 396 { 397 return false; 398 } 399 400 bool 401 IsIntegerType (bool &is_signed); 402 403 virtual bool 404 GetBaseClassPath (Stream &s); 405 406 virtual void 407 GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat = eDereferencePointers); 408 409 lldb::ValueObjectSP 410 GetValueForExpressionPath(const char* expression, 411 const char** first_unparsed = NULL, 412 ExpressionPathScanEndReason* reason_to_stop = NULL, 413 ExpressionPathEndResultType* final_value_type = NULL, 414 const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(), 415 ExpressionPathAftermath* final_task_on_target = NULL); 416 417 int 418 GetValuesForExpressionPath(const char* expression, 419 lldb::ValueObjectListSP& list, 420 const char** first_unparsed = NULL, 421 ExpressionPathScanEndReason* reason_to_stop = NULL, 422 ExpressionPathEndResultType* final_value_type = NULL, 423 const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(), 424 ExpressionPathAftermath* final_task_on_target = NULL); 425 426 virtual bool 427 IsInScope () 428 { 429 return true; 430 } 431 432 virtual off_t 433 GetByteOffset() 434 { 435 return 0; 436 } 437 438 virtual uint32_t 439 GetBitfieldBitSize() 440 { 441 return 0; 442 } 443 444 virtual uint32_t 445 GetBitfieldBitOffset() 446 { 447 return 0; 448 } 449 450 virtual bool 451 IsArrayItemForPointer() 452 { 453 return m_is_array_item_for_pointer; 454 } 455 456 virtual bool 457 SetClangAST (clang::ASTContext *ast) 458 { 459 return false; 460 } 461 462 virtual const char * 463 GetValueAsCString (); 464 465 virtual unsigned long long 466 GetValueAsUnsigned(); 467 468 virtual bool 469 SetValueFromCString (const char *value_str); 470 471 // Return the module associated with this value object in case the 472 // value is from an executable file and might have its data in 473 // sections of the file. This can be used for variables. 474 virtual Module * 475 GetModule() 476 { 477 if (m_parent) 478 return m_parent->GetModule(); 479 return NULL; 480 } 481 //------------------------------------------------------------------ 482 // The functions below should NOT be modified by sublasses 483 //------------------------------------------------------------------ 484 const Error & 485 GetError(); 486 487 const ConstString & 488 GetName() const; 489 490 virtual lldb::ValueObjectSP 491 GetChildAtIndex (uint32_t idx, bool can_create); 492 493 virtual lldb::ValueObjectSP 494 GetChildMemberWithName (const ConstString &name, bool can_create); 495 496 virtual uint32_t 497 GetIndexOfChildWithName (const ConstString &name); 498 499 uint32_t 500 GetNumChildren (); 501 502 const Value & 503 GetValue() const; 504 505 Value & 506 GetValue(); 507 508 bool 509 ResolveValue (Scalar &scalar); 510 511 const char * 512 GetLocationAsCString (); 513 514 const char * 515 GetSummaryAsCString (); 516 517 const char * 518 GetObjectDescription (); 519 520 bool 521 GetPrintableRepresentation(Stream& s, 522 ValueObjectRepresentationStyle val_obj_display = eDisplaySummary, 523 lldb::Format custom_format = lldb::eFormatInvalid); 524 525 bool 526 DumpPrintableRepresentation(Stream& s, 527 ValueObjectRepresentationStyle val_obj_display = eDisplaySummary, 528 lldb::Format custom_format = lldb::eFormatInvalid); 529 bool 530 GetValueIsValid () const; 531 532 bool 533 GetValueDidChange (); 534 535 bool 536 UpdateValueIfNeeded (bool update_format = true); 537 538 bool 539 UpdateValueIfNeeded (lldb::DynamicValueType use_dynamic, bool update_format = true); 540 541 void 542 UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic = lldb::eNoDynamicValues); 543 544 DataExtractor & 545 GetDataExtractor (); 546 547 bool 548 Write (); 549 550 lldb::ValueObjectSP 551 GetSP () 552 { 553 return m_manager->GetSharedPointer(this); 554 } 555 556protected: 557 void 558 AddSyntheticChild (const ConstString &key, 559 ValueObject *valobj); 560public: 561 lldb::ValueObjectSP 562 GetSyntheticChild (const ConstString &key) const; 563 564 lldb::ValueObjectSP 565 GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create); 566 567 lldb::ValueObjectSP 568 GetSyntheticArrayMemberFromArray (int32_t index, bool can_create); 569 570 lldb::ValueObjectSP 571 GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create); 572 573 lldb::ValueObjectSP 574 GetSyntheticExpressionPathChild(const char* expression, bool can_create); 575 576 virtual lldb::ValueObjectSP 577 GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); 578 579 lldb::ValueObjectSP 580 GetDynamicValue (lldb::DynamicValueType valueType); 581 582 lldb::ValueObjectSP 583 GetSyntheticValue (lldb::SyntheticValueType use_synthetic); 584 585 bool 586 HasSyntheticValue(); 587 588 virtual lldb::ValueObjectSP 589 CreateConstantValue (const ConstString &name); 590 591 virtual lldb::ValueObjectSP 592 Dereference (Error &error); 593 594 virtual lldb::ValueObjectSP 595 AddressOf (Error &error); 596 597 virtual lldb::ValueObjectSP 598 CastPointerType (const char *name, 599 ClangASTType &ast_type); 600 601 virtual lldb::ValueObjectSP 602 CastPointerType (const char *name, 603 lldb::TypeSP &type_sp); 604 605 // The backing bits of this value object were updated, clear any value 606 // values, summaries or descriptions so we refetch them. 607 virtual void 608 ValueUpdated () 609 { 610 m_value_str.clear(); 611 m_summary_str.clear(); 612 m_object_desc_str.clear(); 613 } 614 615 virtual bool 616 IsDynamic () 617 { 618 return false; 619 } 620 621 static void 622 DumpValueObject (Stream &s, 623 ValueObject *valobj, 624 const char *root_valobj_name, 625 uint32_t ptr_depth, 626 uint32_t curr_depth, 627 uint32_t max_depth, 628 bool show_types, 629 bool show_location, 630 bool use_objc, 631 lldb::DynamicValueType use_dynamic, 632 bool use_synthetic, 633 bool scope_already_checked, 634 bool flat_output, 635 uint32_t omit_summary_depth); 636 637 // returns true if this is a char* or a char[] 638 // if it is a char* and check_pointer is true, 639 // it also checks that the pointer is valid 640 bool 641 IsCStringContainer(bool check_pointer = false); 642 643 void 644 ReadPointedString(Stream& s, 645 Error& error, 646 uint32_t max_length = 0, 647 bool honor_array = true, 648 lldb::Format item_format = lldb::eFormatCharArray); 649 650 bool 651 GetIsConstant () const 652 { 653 return m_update_point.IsConstant(); 654 } 655 656 void 657 SetIsConstant () 658 { 659 m_update_point.SetIsConstant(); 660 } 661 662 lldb::Format 663 GetFormat () const 664 { 665 if (m_parent && m_format == lldb::eFormatDefault) 666 return m_parent->GetFormat(); 667 return m_format; 668 } 669 670 void 671 SetIsExpressionResult(bool expr) 672 { 673 m_is_expression_result = expr; 674 } 675 676 bool 677 GetIsExpressionResult() 678 { 679 return m_is_expression_result; 680 } 681 682 void 683 SetFormat (lldb::Format format) 684 { 685 if (format != m_format) 686 m_value_str.clear(); 687 m_format = format; 688 } 689 690 void 691 SetCustomSummaryFormat(lldb::SummaryFormatSP format) 692 { 693 m_forced_summary_format = format; 694 m_user_id_of_forced_summary = m_update_point.GetUpdateID(); 695 m_summary_str.clear(); 696 } 697 698 lldb::SummaryFormatSP 699 GetCustomSummaryFormat() 700 { 701 return m_forced_summary_format; 702 } 703 704 void 705 ClearCustomSummaryFormat() 706 { 707 m_forced_summary_format.reset(); 708 m_summary_str.clear(); 709 } 710 711 bool 712 HasCustomSummaryFormat() 713 { 714 return (m_forced_summary_format.get()); 715 } 716 717 lldb::SummaryFormatSP 718 GetSummaryFormat() 719 { 720 UpdateFormatsIfNeeded(m_last_format_mgr_dynamic); 721 if (HasCustomSummaryFormat()) 722 return m_forced_summary_format; 723 return m_last_summary_format; 724 } 725 726 // Use GetParent for display purposes, but if you want to tell the parent to update itself 727 // then use m_parent. The ValueObjectDynamicValue's parent is not the correct parent for 728 // displaying, they are really siblings, so for display it needs to route through to its grandparent. 729 virtual ValueObject * 730 GetParent() 731 { 732 return m_parent; 733 } 734 735 virtual const ValueObject * 736 GetParent() const 737 { 738 return m_parent; 739 } 740 741 ValueObject * 742 GetNonBaseClassParent(); 743 744 void 745 SetPointersPointToLoadAddrs (bool b) 746 { 747 m_pointers_point_to_load_addrs = b; 748 } 749 750protected: 751 typedef ClusterManager<ValueObject> ValueObjectManager; 752 753 //------------------------------------------------------------------ 754 // Classes that inherit from ValueObject can see and modify these 755 //------------------------------------------------------------------ 756 ValueObject * m_parent; // The parent value object, or NULL if this has no parent 757 EvaluationPoint m_update_point; // Stores both the stop id and the full context at which this value was last 758 // updated. When we are asked to update the value object, we check whether 759 // the context & stop id are the same before updating. 760 ConstString m_name; // The name of this object 761 DataExtractor m_data; // A data extractor that can be used to extract the value. 762 Value m_value; 763 Error m_error; // An error object that can describe any errors that occur when updating values. 764 std::string m_value_str; // Cached value string that will get cleared if/when the value is updated. 765 std::string m_old_value_str;// Cached old value string from the last time the value was gotten 766 std::string m_location_str; // Cached location string that will get cleared if/when the value is updated. 767 std::string m_summary_str; // Cached summary string that will get cleared if/when the value is updated. 768 std::string m_object_desc_str; // Cached result of the "object printer". This differs from the summary 769 // in that the summary is consed up by us, the object_desc_string is builtin. 770 771 ValueObjectManager *m_manager; // This object is managed by the root object (any ValueObject that gets created 772 // without a parent.) The manager gets passed through all the generations of 773 // dependent objects, and will keep the whole cluster of objects alive as long 774 // as a shared pointer to any of them has been handed out. Shared pointers to 775 // value objects must always be made with the GetSP method. 776 777 std::vector<ValueObject *> m_children; 778 std::map<ConstString, ValueObject *> m_synthetic_children; 779 ValueObject *m_dynamic_value; 780 ValueObject *m_synthetic_value; 781 lldb::ValueObjectSP m_addr_of_valobj_sp; // We have to hold onto a shared pointer to this one because it is created 782 // as an independent ValueObjectConstResult, which isn't managed by us. 783 ValueObject *m_deref_valobj; 784 785 lldb::Format m_format; 786 uint32_t m_last_format_mgr_revision; 787 lldb::DynamicValueType m_last_format_mgr_dynamic; 788 lldb::SummaryFormatSP m_last_summary_format; 789 lldb::SummaryFormatSP m_forced_summary_format; 790 lldb::ValueFormatSP m_last_value_format; 791 lldb::SyntheticChildrenSP m_last_synthetic_filter; 792 lldb::user_id_t m_user_id_of_forced_summary; 793 794 bool m_value_is_valid:1, 795 m_value_did_change:1, 796 m_children_count_valid:1, 797 m_old_value_valid:1, 798 m_pointers_point_to_load_addrs:1, 799 m_is_deref_of_parent:1, 800 m_is_array_item_for_pointer:1, 801 m_is_bitfield_for_scalar:1, 802 m_is_expression_path_child:1, 803 m_is_child_at_offset:1, 804 m_is_expression_result:1; 805 806 // used to prevent endless looping into GetpPrintableRepresentation() 807 uint32_t m_dump_printable_counter; 808 friend class ClangExpressionDeclMap; // For GetValue 809 friend class ClangExpressionVariable; // For SetName 810 friend class Target; // For SetName 811 812 //------------------------------------------------------------------ 813 // Constructors and Destructors 814 //------------------------------------------------------------------ 815 816 // Use the no-argument constructor to make a constant variable object (with no ExecutionContextScope.) 817 818 ValueObject(); 819 820 // Use this constructor to create a "root variable object". The ValueObject will be locked to this context 821 // through-out its lifespan. 822 823 ValueObject (ExecutionContextScope *exe_scope); 824 825 // Use this constructor to create a ValueObject owned by another ValueObject. It will inherit the ExecutionContext 826 // of its parent. 827 828 ValueObject (ValueObject &parent); 829 830 ValueObjectManager * 831 GetManager() 832 { 833 return m_manager; 834 } 835 836 virtual bool 837 UpdateValue () = 0; 838 839 virtual void 840 CalculateDynamicValue (lldb::DynamicValueType use_dynamic); 841 842 virtual void 843 CalculateSyntheticValue (lldb::SyntheticValueType use_synthetic); 844 845 // Should only be called by ValueObject::GetChildAtIndex() 846 // Returns a ValueObject managed by this ValueObject's manager. 847 virtual ValueObject * 848 CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); 849 850 // Should only be called by ValueObject::GetNumChildren() 851 virtual uint32_t 852 CalculateNumChildren() = 0; 853 854 void 855 SetNumChildren (uint32_t num_children); 856 857 void 858 SetValueDidChange (bool value_changed); 859 860 void 861 SetValueIsValid (bool valid); 862 863 void 864 ClearUserVisibleData(); 865 866public: 867 868 void 869 SetName (const ConstString &name); 870 871 lldb::addr_t 872 GetPointerValue (AddressType &address_type, 873 bool scalar_is_load_address); 874 875 lldb::addr_t 876 GetAddressOf (AddressType &address_type, 877 bool scalar_is_load_address); 878private: 879 //------------------------------------------------------------------ 880 // For ValueObject only 881 //------------------------------------------------------------------ 882 883 lldb::ValueObjectSP 884 GetValueForExpressionPath_Impl(const char* expression_cstr, 885 const char** first_unparsed, 886 ExpressionPathScanEndReason* reason_to_stop, 887 ExpressionPathEndResultType* final_value_type, 888 const GetValueForExpressionPathOptions& options, 889 ExpressionPathAftermath* final_task_on_target); 890 891 // this method will ONLY expand [] expressions into a VOList and return 892 // the number of elements it added to the VOList 893 // it will NOT loop through expanding the follow-up of the expression_cstr 894 // for all objects in the list 895 int 896 ExpandArraySliceExpression(const char* expression_cstr, 897 const char** first_unparsed, 898 lldb::ValueObjectSP root, 899 lldb::ValueObjectListSP& list, 900 ExpressionPathScanEndReason* reason_to_stop, 901 ExpressionPathEndResultType* final_value_type, 902 const GetValueForExpressionPathOptions& options, 903 ExpressionPathAftermath* final_task_on_target); 904 905 906 DISALLOW_COPY_AND_ASSIGN (ValueObject); 907 908}; 909 910} // namespace lldb_private 911 912#endif // liblldb_ValueObject_h_ 913