1 //===-- SBValueList.h -------------------------------------------*- C++ -*-===// 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 9 #ifndef LLDB_API_SBVALUELIST_H 10 #define LLDB_API_SBVALUELIST_H 11 12 #include "lldb/API/SBDefines.h" 13 14 class ValueListImpl; 15 16 namespace lldb { 17 18 class LLDB_API SBValueList { 19 public: 20 SBValueList(); 21 22 SBValueList(const lldb::SBValueList &rhs); 23 24 ~SBValueList(); 25 26 explicit operator bool() const; 27 28 bool IsValid() const; 29 30 void Clear(); 31 32 void Append(const lldb::SBValue &val_obj); 33 34 void Append(const lldb::SBValueList &value_list); 35 36 uint32_t GetSize() const; 37 38 lldb::SBValue GetValueAtIndex(uint32_t idx) const; 39 40 lldb::SBValue GetFirstValueByName(const char *name) const; 41 42 lldb::SBValue FindValueObjectByUID(lldb::user_id_t uid); 43 44 const lldb::SBValueList &operator=(const lldb::SBValueList &rhs); 45 46 // Get an error for why this list is empty. 47 // 48 // If this list is empty, check for an underlying error in the debug 49 // information that prevented this list from being populated. This is not 50 // meant to return an error if there is no debug information as it is ok for a 51 // value list to be empty and no error should be returned in that case. If the 52 // debug info is for an assembly file or language that doesn't have any 53 // variables, no error should be returned. 54 // 55 // This is designed as a way to let users know when they enable certain 56 // compiler options that enable debug information but provide a degraded 57 // debug information content, like -gline-tables-only, which is a compiler 58 // option that allows users to set file and line breakpoints, but users get 59 // confused when no variables show up during debugging. 60 // 61 // It is also designed to inform a user that debug information might be 62 // available if an external file, like a .dwo file, but that file doesn't 63 // exist or wasn't able to be loaded due to a mismatched ID. When debugging 64 // with fission enabled, the line tables are linked into the main executable, 65 // but if the .dwo or .dwp files are not available or have been modified, 66 // users can get confused if they can stop at a file and line breakpoint but 67 // can't see variables in this case. 68 // 69 // This error can give vital clues to the user about the cause is and allow 70 // the user to fix the issue. 71 lldb::SBError GetError(); 72 73 protected: 74 // only useful for visualizing the pointer or comparing two SBValueLists to 75 // see if they are backed by the same underlying Impl. 76 void *opaque_ptr(); 77 78 private: 79 friend class SBFrame; 80 81 SBValueList(const ValueListImpl *lldb_object_ptr); 82 83 void Append(lldb::ValueObjectSP &val_obj_sp); 84 85 void CreateIfNeeded(); 86 87 ValueListImpl *operator->(); 88 89 ValueListImpl &operator*(); 90 91 const ValueListImpl *operator->() const; 92 93 const ValueListImpl &operator*() const; 94 95 ValueListImpl &ref(); 96 97 std::unique_ptr<ValueListImpl> m_opaque_up; 98 99 void SetError(const lldb_private::Status &status); 100 }; 101 102 } // namespace lldb 103 104 #endif // LLDB_API_SBVALUELIST_H 105