DumpValueObjectOptions.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //===-- DumpValueObjectOptions.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. #ifndef LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
  9. #define LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
  10. #include <string>
  11. #include "lldb/lldb-private.h"
  12. #include "lldb/lldb-public.h"
  13. #include <functional>
  14. #include <string>
  15. namespace lldb_private {
  16. class DumpValueObjectOptions {
  17. public:
  18. struct PointerDepth {
  19. enum class Mode { Always, Default, Never } m_mode;
  20. uint32_t m_count;
  21. PointerDepth operator--() const {
  22. if (m_count > 0)
  23. return PointerDepth{m_mode, m_count - 1};
  24. return PointerDepth{m_mode, m_count};
  25. }
  26. bool CanAllowExpansion() const;
  27. };
  28. struct PointerAsArraySettings {
  29. size_t m_element_count;
  30. size_t m_base_element;
  31. size_t m_stride;
  32. PointerAsArraySettings()
  33. : m_element_count(0), m_base_element(0), m_stride() {}
  34. PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
  35. size_t stride = 1)
  36. : m_element_count(elem_count), m_base_element(base_elem),
  37. m_stride(stride) {}
  38. operator bool() { return m_element_count > 0; }
  39. };
  40. typedef std::function<bool(ConstString, ConstString,
  41. const DumpValueObjectOptions &, Stream &)>
  42. DeclPrintingHelper;
  43. static const DumpValueObjectOptions DefaultOptions() {
  44. static DumpValueObjectOptions g_default_options;
  45. return g_default_options;
  46. }
  47. DumpValueObjectOptions();
  48. DumpValueObjectOptions(ValueObject &valobj);
  49. DumpValueObjectOptions &
  50. SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
  51. DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
  52. DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
  53. DumpValueObjectOptions &SetShowTypes(bool show = false);
  54. DumpValueObjectOptions &SetShowLocation(bool show = false);
  55. DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
  56. DumpValueObjectOptions &SetShowSummary(bool show = true);
  57. DumpValueObjectOptions &
  58. SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
  59. DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
  60. DumpValueObjectOptions &SetScopeChecked(bool check = true);
  61. DumpValueObjectOptions &SetFlatOutput(bool flat = false);
  62. DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
  63. DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
  64. DumpValueObjectOptions &SetRawDisplay();
  65. DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
  66. DumpValueObjectOptions &
  67. SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
  68. DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
  69. DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
  70. DumpValueObjectOptions &SetHideName(bool hide_name = false);
  71. DumpValueObjectOptions &SetHideValue(bool hide_value = false);
  72. DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
  73. DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
  74. lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
  75. DumpValueObjectOptions &SetRunValidator(bool run = true);
  76. DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
  77. DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
  78. DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
  79. DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
  80. DumpValueObjectOptions &
  81. SetPointerAsArray(const PointerAsArraySettings &ptr_array);
  82. uint32_t m_max_depth = UINT32_MAX;
  83. lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
  84. uint32_t m_omit_summary_depth = 0;
  85. lldb::Format m_format = lldb::eFormatDefault;
  86. lldb::TypeSummaryImplSP m_summary_sp;
  87. std::string m_root_valobj_name;
  88. lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
  89. PointerDepth m_max_ptr_depth;
  90. DeclPrintingHelper m_decl_printing_helper;
  91. PointerAsArraySettings m_pointer_as_array;
  92. bool m_use_synthetic : 1;
  93. bool m_scope_already_checked : 1;
  94. bool m_flat_output : 1;
  95. bool m_ignore_cap : 1;
  96. bool m_show_types : 1;
  97. bool m_show_location : 1;
  98. bool m_use_objc : 1;
  99. bool m_hide_root_type : 1;
  100. bool m_hide_name : 1;
  101. bool m_hide_value : 1;
  102. bool m_run_validator : 1;
  103. bool m_use_type_display_name : 1;
  104. bool m_allow_oneliner_mode : 1;
  105. bool m_hide_pointer_value : 1;
  106. bool m_reveal_empty_aggregates : 1;
  107. };
  108. } // namespace lldb_private
  109. #endif // LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H